mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-21 11:09:53 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
*.map
|
||||
*.swp
|
||||
.DS_Store
|
||||
npm-debug.log
|
||||
|
||||
_Resharper.DefinitelyTyped
|
||||
bin
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "iojs-v2"
|
||||
- 4
|
||||
|
||||
sudo: false
|
||||
|
||||
|
||||
+314
-74
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
# DefinitelyTyped [](https://travis-ci.org/borisyankov/DefinitelyTyped)
|
||||
# DefinitelyTyped [](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped)
|
||||
|
||||
[](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path="./abs.d.ts" />
|
||||
|
||||
import Abs from 'abs';
|
||||
|
||||
const x: string = Abs('/foo');
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Type definitions for abs 1.1.0
|
||||
// Project: https://github.com/IonicaBizau/node-abs
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "abs" {
|
||||
/**
|
||||
* Compute the absolute path of an input.
|
||||
* @param input The input path.
|
||||
*/
|
||||
function Abs(input: string): string;
|
||||
|
||||
export default Abs;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path="./absolute.d.ts" />
|
||||
|
||||
import absolute from 'absolute';
|
||||
|
||||
const x: boolean = absolute('/home/foo');
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// Type definitions for absolute 0.0.1
|
||||
// Project: https://github.com/bahamas10/node-absolute
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "absolute" {
|
||||
/**
|
||||
* Test if a path is absolute
|
||||
*/
|
||||
function absolute(path: string): boolean;
|
||||
|
||||
export default absolute;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
--noImplicitAny
|
||||
Vendored
+294
-294
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@
|
||||
/// <reference path='../node/node.d.ts'/>
|
||||
|
||||
/// <reference path='../redis/redis.d.ts'/>
|
||||
/// <reference path="../mongodb/mongodb.d.ts" />
|
||||
/// <reference path="../mongodb/mongodb-1.4.9.d.ts" />
|
||||
|
||||
declare module "acl" {
|
||||
import http = require('http');
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/// <reference path="adm-zip.d.ts" />
|
||||
import AdmZip = require("adm-zip");
|
||||
|
||||
|
||||
// reading archives
|
||||
var zip = new AdmZip("./my_file.zip");
|
||||
var zipEntries = zip.getEntries(); // an array of ZipEntry records
|
||||
var zipEntries: AdmZip.IZipEntry[] = zip.getEntries(); // an array of ZipEntry records
|
||||
|
||||
zipEntries.forEach(function (zipEntry) {
|
||||
console.log(zipEntry.toString()); // outputs zip entries information
|
||||
@@ -31,3 +30,32 @@ zip.addLocalFile("/home/me/some_picture.png");
|
||||
var willSendthis = zip.toBuffer();
|
||||
// or write everything to disk
|
||||
zip.writeZip(/*target file name*/"/home/me/files.zip");
|
||||
|
||||
function processZipEntry(zipEntry: AdmZip.IZipEntry) {
|
||||
console.log('comment', zipEntry.comment);
|
||||
}
|
||||
|
||||
//tests taken from examples at https://github.com/cthackers/adm-zip/wiki/ADM-ZIP
|
||||
import Zip = require("adm-zip");
|
||||
// loads and parses existing zip file local_file.zip
|
||||
var zip = new Zip("local_file.zip");
|
||||
// creates new in memory zip
|
||||
zip = new Zip();
|
||||
// loads and parses existing zip file local_file.zip
|
||||
zip = new Zip("local_file.zip");
|
||||
// get all entries and iterate them
|
||||
zip.getEntries().forEach((entry) => {
|
||||
var entryName = entry.entryName;
|
||||
var decompressedData = zip.readFile(entry); // decompressed buffer of the entry
|
||||
console.log(zip.readAsText(entry)); // outputs the decompressed content of the entry
|
||||
});
|
||||
|
||||
// will extract the file myfile.txt from the archive to /home/user/folder/subfolder/myfile.txt
|
||||
zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", true, true);
|
||||
|
||||
// will extract the file myfile.txt from the archive to /home/user/myfile.txt
|
||||
zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", false, true);
|
||||
|
||||
function isAdmZipEntry(obj: any): obj is AdmZip.IZipEntry {
|
||||
return obj !== null && typeof obj === "object" && typeof obj['entryName'] === 'string';
|
||||
}
|
||||
Vendored
+80
-81
@@ -5,8 +5,8 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module AdmZip {
|
||||
class ZipFile {
|
||||
declare module "adm-zip" {
|
||||
class AdmZip {
|
||||
/**
|
||||
* Create a new, empty archive.
|
||||
*/
|
||||
@@ -28,7 +28,7 @@ declare module AdmZip {
|
||||
* @param entry ZipEntry object
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFile(entry: IZipEntry): Buffer;
|
||||
readFile(entry: AdmZip.IZipEntry): Buffer;
|
||||
/**
|
||||
* Asynchronous readFile
|
||||
* @param entry String with the full path of the entry
|
||||
@@ -41,7 +41,7 @@ declare module AdmZip {
|
||||
* @param callback Called with a Buffer or Null in case of error
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFileAsync(entry: IZipEntry, callback: (data: Buffer, err: string) => any): void;
|
||||
readFileAsync(entry: AdmZip.IZipEntry, callback: (data: Buffer, err: string) => any): void;
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as
|
||||
* plain text in the given encoding
|
||||
@@ -57,7 +57,7 @@ declare module AdmZip {
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
* @return String
|
||||
*/
|
||||
readAsText(fileName: IZipEntry, encoding?: string): string;
|
||||
readAsText(fileName: AdmZip.IZipEntry, encoding?: string): string;
|
||||
/**
|
||||
* Asynchronous readAsText
|
||||
* @param entry String with the full path of the entry
|
||||
@@ -71,7 +71,7 @@ declare module AdmZip {
|
||||
* @param callback Called with the resulting string.
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
*/
|
||||
readAsTextAsync(fileName: IZipEntry, callback: (data: string) => any, encoding?: string): void;
|
||||
readAsTextAsync(fileName: AdmZip.IZipEntry, callback: (data: string) => any, encoding?: string): void;
|
||||
/**
|
||||
* Remove the entry from the file or the entry and all its nested directories
|
||||
* and files if the given entry is a directory
|
||||
@@ -83,7 +83,7 @@ declare module AdmZip {
|
||||
* and files if the given entry is a directory
|
||||
* @param entry A ZipEntry object.
|
||||
*/
|
||||
deleteFile(entry: IZipEntry): void;
|
||||
deleteFile(entry: AdmZip.IZipEntry): void;
|
||||
/**
|
||||
* Adds a comment to the zip. The zip must be rewritten after
|
||||
* adding the comment.
|
||||
@@ -110,7 +110,7 @@ declare module AdmZip {
|
||||
* @param entry ZipEntry object.
|
||||
* @param comment The comment to add to the entry.
|
||||
*/
|
||||
addZipEntryComment(entry: IZipEntry, comment: string): void;
|
||||
addZipEntryComment(entry: AdmZip.IZipEntry, comment: string): void;
|
||||
/**
|
||||
* Returns the comment of the specified entry.
|
||||
* @param entry String with the full path of the entry.
|
||||
@@ -122,7 +122,7 @@ declare module AdmZip {
|
||||
* @param entry ZipEntry object.
|
||||
* @return String The comment of the specified entry.
|
||||
*/
|
||||
getZipEntryComment(entry: IZipEntry): string;
|
||||
getZipEntryComment(entry: AdmZip.IZipEntry): string;
|
||||
/**
|
||||
* Updates the content of an existing entry inside the archive. The zip
|
||||
* must be rewritten after updating the content
|
||||
@@ -136,7 +136,7 @@ declare module AdmZip {
|
||||
* @param entry ZipEntry object.
|
||||
* @param content The entry's new contents.
|
||||
*/
|
||||
updateFile(entry: IZipEntry, content: Buffer): void;
|
||||
updateFile(entry: AdmZip.IZipEntry, content: Buffer): void;
|
||||
/**
|
||||
* Adds a file from the disk to the archive.
|
||||
* @param localPath Path to a file on disk.
|
||||
@@ -167,14 +167,14 @@ declare module AdmZip {
|
||||
* Returns an array of ZipEntry objects representing the files and folders
|
||||
* inside the archive
|
||||
*/
|
||||
getEntries(): IZipEntry[];
|
||||
getEntries(): AdmZip.IZipEntry[];
|
||||
/**
|
||||
* Returns a ZipEntry object representing the file or folder specified by
|
||||
* ``name``.
|
||||
* @param name Name of the file or folder to retrieve.
|
||||
* @return ZipEntry The entry corresponding to the name.
|
||||
*/
|
||||
getEntry(name: string): IZipEntry;
|
||||
getEntry(name: string): AdmZip.IZipEntry;
|
||||
/**
|
||||
* Extracts the given entry to the given targetPath.
|
||||
* If the entry is a directory inside the archive, the entire directory and
|
||||
@@ -203,7 +203,7 @@ declare module AdmZip {
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
* @return Boolean
|
||||
*/
|
||||
extractEntryTo(entryPath: IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean;
|
||||
extractEntryTo(entryPath: AdmZip.IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean;
|
||||
/**
|
||||
* Extracts the entire archive to the given location
|
||||
* @param targetPath Target location
|
||||
@@ -225,76 +225,75 @@ declare module AdmZip {
|
||||
toBuffer(): Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* The ZipEntry is more than a structure representing the entry inside the
|
||||
* zip file. Beside the normal attributes and headers a entry can have, the
|
||||
* class contains a reference to the part of the file where the compressed
|
||||
* data resides and decompresses it when requested. It also compresses the
|
||||
* data and creates the headers required to write in the zip file.
|
||||
*/
|
||||
interface IZipEntry {
|
||||
module AdmZip {
|
||||
/**
|
||||
* Represents the full name and path of the file
|
||||
* The ZipEntry is more than a structure representing the entry inside the
|
||||
* zip file. Beside the normal attributes and headers a entry can have, the
|
||||
* class contains a reference to the part of the file where the compressed
|
||||
* data resides and decompresses it when requested. It also compresses the
|
||||
* data and creates the headers required to write in the zip file.
|
||||
*/
|
||||
entryName: string;
|
||||
rawEntryName: Buffer;
|
||||
/**
|
||||
* Extra data associated with this entry.
|
||||
*/
|
||||
extra: Buffer;
|
||||
/**
|
||||
* Entry comment.
|
||||
*/
|
||||
comment: string;
|
||||
name: string;
|
||||
/**
|
||||
* Read-Only property that indicates the type of the entry.
|
||||
*/
|
||||
isDirectory: boolean;
|
||||
/**
|
||||
* Get the header associated with this ZipEntry.
|
||||
*/
|
||||
header: Buffer;
|
||||
/**
|
||||
* Retrieve the compressed data for this entry. Note that this may trigger
|
||||
* compression if any properties were modified.
|
||||
*/
|
||||
getCompressedData(): Buffer;
|
||||
/**
|
||||
* Asynchronously retrieve the compressed data for this entry. Note that
|
||||
* this may trigger compression if any properties were modified.
|
||||
*/
|
||||
getCompressedDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: string): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: Buffer): void;
|
||||
/**
|
||||
* Get the decompressed data associated with this entry.
|
||||
*/
|
||||
getData(): Buffer;
|
||||
/**
|
||||
* Asynchronously get the decompressed data associated with this entry.
|
||||
*/
|
||||
getDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Returns the CEN Entry Header to be written to the output zip file, plus
|
||||
* the extra data and the entry comment.
|
||||
*/
|
||||
packHeader(): Buffer;
|
||||
/**
|
||||
* Returns a nicely formatted string with the most important properties of
|
||||
* the ZipEntry.
|
||||
*/
|
||||
toString(): string;
|
||||
interface IZipEntry {
|
||||
/**
|
||||
* Represents the full name and path of the file
|
||||
*/
|
||||
entryName: string;
|
||||
rawEntryName: Buffer;
|
||||
/**
|
||||
* Extra data associated with this entry.
|
||||
*/
|
||||
extra: Buffer;
|
||||
/**
|
||||
* Entry comment.
|
||||
*/
|
||||
comment: string;
|
||||
name: string;
|
||||
/**
|
||||
* Read-Only property that indicates the type of the entry.
|
||||
*/
|
||||
isDirectory: boolean;
|
||||
/**
|
||||
* Get the header associated with this ZipEntry.
|
||||
*/
|
||||
header: Buffer;
|
||||
/**
|
||||
* Retrieve the compressed data for this entry. Note that this may trigger
|
||||
* compression if any properties were modified.
|
||||
*/
|
||||
getCompressedData(): Buffer;
|
||||
/**
|
||||
* Asynchronously retrieve the compressed data for this entry. Note that
|
||||
* this may trigger compression if any properties were modified.
|
||||
*/
|
||||
getCompressedDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: string): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: Buffer): void;
|
||||
/**
|
||||
* Get the decompressed data associated with this entry.
|
||||
*/
|
||||
getData(): Buffer;
|
||||
/**
|
||||
* Asynchronously get the decompressed data associated with this entry.
|
||||
*/
|
||||
getDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Returns the CEN Entry Header to be written to the output zip file, plus
|
||||
* the extra data and the entry comment.
|
||||
*/
|
||||
packHeader(): Buffer;
|
||||
/**
|
||||
* Returns a nicely formatted string with the most important properties of
|
||||
* the ZipEntry.
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "adm-zip" {
|
||||
import zipFile = AdmZip.ZipFile;
|
||||
export = zipFile;
|
||||
export = AdmZip;
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -1464,7 +1464,6 @@ declare module ag.grid {
|
||||
addDropTarget(eDropTarget: any, dropTargetCallback: any): void;
|
||||
}
|
||||
}
|
||||
declare function require(name: string): any;
|
||||
declare module ag.grid {
|
||||
class AgList {
|
||||
private eGui;
|
||||
|
||||
Vendored
+1
-1
@@ -179,4 +179,4 @@ interface amplifyStatic {
|
||||
}
|
||||
|
||||
declare var amplify: amplifyStatic;
|
||||
|
||||
declare module "amplify" { export =amplify; }
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module "angular-dynamic-locale" {
|
||||
import ng = angular.dynamicLocale;
|
||||
export = ng;
|
||||
}
|
||||
|
||||
declare module angular.dynamicLocale {
|
||||
|
||||
interface tmhDynamicLocaleService {
|
||||
|
||||
@@ -20,11 +20,23 @@ class FormConfig {
|
||||
name: 'customInput',
|
||||
extends: 'input'
|
||||
});
|
||||
|
||||
formlyConfig.disableWarnings = true;
|
||||
formlyConfig.templateManipulators = undefined;
|
||||
|
||||
formlyConfig.extras.apiCheckInstance = null;
|
||||
formlyConfig.extras.defaultHideDirective = 'ng-if';
|
||||
formlyConfig.extras.disableNgModelAttrsManipulator = true;
|
||||
formlyConfig.extras.errorExistsAndShouldBeVisibleExpression = angular.noop;
|
||||
formlyConfig.extras.explicitAsync = true;
|
||||
formlyConfig.extras.fieldTransform = angular.noop;
|
||||
formlyConfig.extras.getFieldId = angular.noop;
|
||||
formlyConfig.extras.ngModelAttrsManipulatorPreferUnbound = true;
|
||||
}
|
||||
}
|
||||
|
||||
class AppController {
|
||||
fields: AngularFormly.IFieldConfigurationObject[];
|
||||
fields: AngularFormly.IFieldArray;
|
||||
constructor() {
|
||||
var vm = this;
|
||||
vm.fields = [
|
||||
@@ -99,6 +111,21 @@ class AppController {
|
||||
templateOptions: {
|
||||
label: 'no wrapper here...'
|
||||
}
|
||||
},
|
||||
{
|
||||
//From http://angular-formly.com/#/example/other/nested-formly-forms
|
||||
key: 'address',
|
||||
wrapper: 'panel',
|
||||
templateOptions: { label: 'Address' },
|
||||
fieldGroup: [{
|
||||
key: 'town',
|
||||
type: 'input',
|
||||
templateOptions: {
|
||||
required: true,
|
||||
type: 'text',
|
||||
label: 'Town'
|
||||
}
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+76
-29
@@ -1,7 +1,7 @@
|
||||
// Type definitions for angular-formly 6.18.0
|
||||
// Type definitions for angular-formly 7.2.3
|
||||
// Project: https://github.com/formly-js/angular-formly
|
||||
// Definitions by: Scott Hatcher <https://github.com/scatcher>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
@@ -9,20 +9,30 @@ declare module 'AngularFormly' {
|
||||
export = AngularFormly;
|
||||
}
|
||||
|
||||
declare module 'angular-formly' {
|
||||
var angularFormlyDefaultExport: string;
|
||||
export = angularFormlyDefaultExport;
|
||||
}
|
||||
|
||||
declare module AngularFormly {
|
||||
|
||||
interface IFieldArray extends Array<IFieldConfigurationObject | IFieldGroup> {
|
||||
|
||||
}
|
||||
|
||||
interface IFieldGroup {
|
||||
data?: Object;
|
||||
className?: string;
|
||||
elementAttributes?: { [key: string]: string };
|
||||
fieldGroup: IFieldConfigurationObject[];
|
||||
elementAttributes?: string;
|
||||
fieldGroup?: IFieldArray;
|
||||
form?: Object;
|
||||
hide?: boolean;
|
||||
hideExpression?: string | IExpresssionFunction;
|
||||
hideExpression?: string | IExpressionFunction;
|
||||
key?: string | number;
|
||||
model?: string | Object;
|
||||
options?: IFormOptionsAPI
|
||||
options?: IFormOptionsAPI;
|
||||
templateOptions?: ITemplateOptions;
|
||||
wrapper?: string | string[];
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +51,7 @@ declare module AngularFormly {
|
||||
/**
|
||||
* see http://docs.angular-formly.com/docs/formly-expressions#expressionproperties-validators--messages
|
||||
*/
|
||||
interface IExpresssionFunction {
|
||||
interface IExpressionFunction {
|
||||
($viewValue: any, $modelValue: any, scope: ITemplateScope): any;
|
||||
}
|
||||
|
||||
@@ -65,6 +75,11 @@ declare module AngularFormly {
|
||||
postWrapper?: ITemplateManipulator[];
|
||||
}
|
||||
|
||||
interface ISelectOption {
|
||||
name: string;
|
||||
value?: string;
|
||||
group?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* see http://docs.angular-formly.com/docs/ngmodelattrstemplatemanipulator
|
||||
@@ -86,19 +101,25 @@ declare module AngularFormly {
|
||||
type?: string;
|
||||
|
||||
//expression types
|
||||
onBlur?: string;
|
||||
onChange?: string;
|
||||
onClick?: string;
|
||||
onFocus?: string;
|
||||
onKeydown?: string;
|
||||
onKeypress?: string;
|
||||
onKeyup?: string;
|
||||
onBlur?: string | IExpressionFunction;
|
||||
onChange?: string | IExpressionFunction;
|
||||
onClick?: string | IExpressionFunction;
|
||||
onFocus?: string | IExpressionFunction;
|
||||
onKeydown?: string | IExpressionFunction;
|
||||
onKeypress?: string | IExpressionFunction;
|
||||
onKeyup?: string | IExpressionFunction;
|
||||
|
||||
//Bootstrap types
|
||||
label?: string;
|
||||
description?: string;
|
||||
[key: string]: any;
|
||||
|
||||
// types for select/radio fields
|
||||
options?: Array<ISelectOption>;
|
||||
groupProp?: string; // default: group
|
||||
valueProp?: string; // default: value
|
||||
labelProp?: string; // default: name
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -106,8 +127,8 @@ declare module AngularFormly {
|
||||
* see http://docs.angular-formly.com/docs/field-configuration-object#validators-object
|
||||
*/
|
||||
interface IValidator {
|
||||
expression: string | IExpresssionFunction;
|
||||
message?: string | IExpresssionFunction;
|
||||
expression: string | IExpressionFunction;
|
||||
message?: string | IExpressionFunction;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,8 +159,8 @@ declare module AngularFormly {
|
||||
* see http://angular-formly.com/#/example/other/unique-value-async-validation
|
||||
*/
|
||||
asyncValidators?: {
|
||||
[key: string]: string | IExpresssionFunction | IValidator;
|
||||
}
|
||||
[key: string]: string | IExpressionFunction | IValidator;
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a great way to add custom behavior to a specific field. It is injectable with the $scope of the
|
||||
@@ -188,8 +209,8 @@ declare module AngularFormly {
|
||||
* see http://docs.angular-formly.com/docs/field-configuration-object#expressionproperties-object
|
||||
*/
|
||||
expressionProperties?: {
|
||||
[key: string]: string | IExpresssionFunction | IValidator;
|
||||
}
|
||||
[key: string]: string | IExpressionFunction | IValidator;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -198,7 +219,7 @@ declare module AngularFormly {
|
||||
*
|
||||
* see http://docs.angular-formly.com/docs/field-configuration-object#hide-boolean
|
||||
*/
|
||||
hide?: boolean
|
||||
hide?: boolean;
|
||||
|
||||
|
||||
/**
|
||||
@@ -208,7 +229,7 @@ declare module AngularFormly {
|
||||
*
|
||||
* see http://docs.angular-formly.com/docs/field-configuration-object#hideexpression-string--function
|
||||
*/
|
||||
hideExpression?: string | IExpresssionFunction;
|
||||
hideExpression?: string | IExpressionFunction;
|
||||
|
||||
|
||||
/**
|
||||
@@ -297,6 +318,18 @@ declare module AngularFormly {
|
||||
bound?: any;
|
||||
expression?: any;
|
||||
value?: any;
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This allows you to place attributes with string values on the ng-model element.
|
||||
* Easy to use alternative to ngModelAttrs option.
|
||||
*
|
||||
* see http://docs.angular-formly.com/docs/field-configuration-object#ngmodelelattrs-object
|
||||
*/
|
||||
ngModelElAttrs?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -388,7 +421,7 @@ declare module AngularFormly {
|
||||
* like in this example.
|
||||
*/
|
||||
messages?: {
|
||||
[key: string]: IExpresssionFunction | string;
|
||||
[key: string]: IExpressionFunction | string;
|
||||
}
|
||||
|
||||
|
||||
@@ -399,7 +432,7 @@ declare module AngularFormly {
|
||||
*/
|
||||
show?: boolean;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -412,8 +445,8 @@ declare module AngularFormly {
|
||||
* see http://docs.angular-formly.com/docs/field-configuration-object#validators-object
|
||||
*/
|
||||
validators?: {
|
||||
[key: string]: string | IExpresssionFunction | IValidator;
|
||||
}
|
||||
[key: string]: string | IExpressionFunction | IValidator;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -525,10 +558,24 @@ declare module AngularFormly {
|
||||
validateOptions?: Function;
|
||||
}
|
||||
|
||||
interface IFormlyConfigExtras {
|
||||
disableNgModelAttrsManipulator: boolean;
|
||||
apiCheckInstance: any;
|
||||
ngModelAttrsManipulatorPreferUnbound: boolean;
|
||||
removeChromeAutoComplete: boolean;
|
||||
defaultHideDirective: string;
|
||||
errorExistsAndShouldBeVisibleExpression: any;
|
||||
getFieldId: Function;
|
||||
fieldTransform: Function;
|
||||
explicitAsync: boolean;
|
||||
}
|
||||
|
||||
interface IFormlyConfig {
|
||||
disableWarnings: boolean;
|
||||
extras: IFormlyConfigExtras;
|
||||
setType(typeOptions: ITypeOptions): void;
|
||||
setWrapper(wrapperOptions: IWrapperOptions): void;
|
||||
|
||||
templateManipulators: ITemplateManipulators;
|
||||
}
|
||||
|
||||
interface ITemplateScopeOptions {
|
||||
@@ -545,7 +592,7 @@ declare module AngularFormly {
|
||||
//Shortcut to options.formControl
|
||||
fc: ng.IFormController | ng.IFormController[];
|
||||
//all the fields for the form
|
||||
fields: IFieldConfigurationObject[];
|
||||
fields: IFieldArray;
|
||||
//the form controller the field is in
|
||||
form: any;
|
||||
//The object passed as options.formState to the formly-form directive. Use this to share state between fields.
|
||||
@@ -571,4 +618,4 @@ declare module AngularFormly {
|
||||
messages: { [key: string]: ($viewValue: any, $modelValue: any, scope: ITemplateScope) => string };
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/// <reference path="angular-google-analytics.d.ts" />
|
||||
|
||||
function ConfigurationMethodChaining(AnalyticsProvider: angular.google.analytics.AnalyticsProvider) {
|
||||
AnalyticsProvider
|
||||
.logAllCalls(true)
|
||||
.startOffline(true)
|
||||
.useECommerce(true, true);
|
||||
}
|
||||
|
||||
function EnableECommerce(AnalyticsProvider: angular.google.analytics.AnalyticsProvider) {
|
||||
AnalyticsProvider.useECommerce(true, false);
|
||||
AnalyticsProvider.useECommerce(true, true);
|
||||
AnalyticsProvider.setCurrency("CDN");
|
||||
}
|
||||
|
||||
function SetGoogleAnalyticsAccounts(AnalyticsProvider: angular.google.analytics.AnalyticsProvider) {
|
||||
AnalyticsProvider.setAccount("UA-XXXXX-xx");
|
||||
AnalyticsProvider.setAccount([
|
||||
{ tracker: "UA-12345-12", name: "tracker1" },
|
||||
{ tracker: "UA-12345-34", name: "tracker2" }
|
||||
]);
|
||||
}
|
||||
|
||||
function UseClassicAnalytics(AnalyticsProvider: angular.google.analytics.AnalyticsProvider) {
|
||||
AnalyticsProvider.useAnalytics(false);
|
||||
}
|
||||
|
||||
function UseDisplayFeatures(AnalyticsProvider: angular.google.analytics.AnalyticsProvider) {
|
||||
AnalyticsProvider.useDisplayFeatures(true);
|
||||
}
|
||||
|
||||
function UseEnhancedLinkAttribution(AnalyticsProvider: angular.google.analytics.AnalyticsProvider) {
|
||||
AnalyticsProvider.useEnhancedLinkAttribution(true);
|
||||
}
|
||||
|
||||
function UseCrossDomainLinking(AnalyticsProvider: angular.google.analytics.AnalyticsProvider) {
|
||||
AnalyticsProvider.useCrossDomainLinker(true);
|
||||
AnalyticsProvider.setCrossLinkDomains(["domain-1.com", "domain-2.com"]);
|
||||
}
|
||||
|
||||
function SetCookieConfiguration(AnalyticsProvider: angular.google.analytics.AnalyticsProvider) {
|
||||
AnalyticsProvider.setCookieConfig({
|
||||
cookieDomain: "foo.example.com",
|
||||
cookieName: "myNewName",
|
||||
cookieExpires: 20000
|
||||
});
|
||||
}
|
||||
|
||||
function SetRouteTrackingBehaviors(AnalyticsProvider: angular.google.analytics.AnalyticsProvider) {
|
||||
AnalyticsProvider.trackPages(true);
|
||||
AnalyticsProvider.trackUrlParams(true);
|
||||
AnalyticsProvider.ignoreFirstPageLoad(true);
|
||||
AnalyticsProvider.trackPrefix("my-application");
|
||||
AnalyticsProvider.setPageEvent("$stateChangeSuccess");
|
||||
AnalyticsProvider.setRemoveRegExp(/\/\d+?$/);
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
// Type definitions for angular-google-analytics v1.1.0
|
||||
// Project: https://github.com/revolunet/angular-google-analytics
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module angular.google.analytics {
|
||||
/**
|
||||
* @summary Interface for {@link AnalysticsProvider}.
|
||||
* @interface
|
||||
*/
|
||||
interface AnalyticsProvider {
|
||||
/**
|
||||
* @summary Use Delay Script Tag Insertion.
|
||||
* @param {boolean} val If true, the delay script tag is inserted.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
delayScriptTag(val: boolean): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Activates the test mode.
|
||||
*/
|
||||
enterTestMode(): void;
|
||||
|
||||
/**
|
||||
* @summary Gets the global cookie configuration.
|
||||
* @return {Object} The global cookie configuration.
|
||||
*/
|
||||
getCookieConfig(): Object;
|
||||
|
||||
/**
|
||||
* @summary Ignore first page view.
|
||||
* @param {boolean} val If true, the first page view is ignored.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
ignoreFirstPageLoad(val: boolean): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Enable Service Logging.
|
||||
* @param {boolean} val If true, log all outbound calls to an in-memory array accessible.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
logAllCalls(val: boolean): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Set Google Analytics Accounts.
|
||||
* @param {Object} tracker The account identifier(s).
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
setAccount(tracker: string|Object|Array<Object>): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Set Cookie Configuration.
|
||||
* @param {Object} config The custom cookie parameters.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
* @deprecated
|
||||
*/
|
||||
setCookieConfig(config: Object): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Set cross-linked domains.
|
||||
* @param {Array<string>} domains The domains.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
setCrossLinkDomains(domains: Array<string>): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Set currency.
|
||||
* @param {string} currencyCode The currency code.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
setCurrency(currencyCode: string): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Set Domain Name.
|
||||
* @param {string} domain The domain name.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
setDomainName(domain: string): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Enable Experiment (universal analytics only).
|
||||
* @param {string} id The experiment identifier.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
setExperimentId(id: string): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Support Hybrid Mobile Applications.
|
||||
* @param {boolean} val If true, each account object will disable protocol checking and all injected scripts will use the HTTPS protocol.
|
||||
*/
|
||||
setHybridMobileSupport(val: boolean): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Set the default page event name.
|
||||
* @param {string} name The default page event name.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
setPageEvent(name: string): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Sets the regex to scrub location before sending to analytics.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
* @param {RegExp} regex The regex.
|
||||
*/
|
||||
setRemoveRegExp(regex: RegExp): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Starts the offline mode.
|
||||
* @param {boolean} val If true, the offline mode is started.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
startOffline(val: boolean): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Track all routes.
|
||||
* @param {boolean} val If true, all routes are tracked.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
trackPages(doTrack: boolean): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Sets the URL prefix.
|
||||
* @param {string} prefix The URL prefix.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
trackPrefix(prefix: string): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Track all URL query parameters.
|
||||
* @param {boolean} val If true, all URL query parameters are tracked.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
trackUrlParams(val: boolean): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Use Classic Analytics.
|
||||
* @param {boolean} val If true, use classic analytics.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
useAnalytics(val: boolean): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Use Cross Domain Linking.
|
||||
* @param {boolean} val If true, the cross-linked domains are registered with Google Analytics.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
useCrossDomainLinker(val: boolean): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Use Display Features.
|
||||
* @param {boolean} val If true, the display features module is loaded with Google Analytics.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
useDisplayFeatures(val: boolean): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Enable enhanced e-commerce module.
|
||||
* @param {boolean} val If true, the enhanced e-commerce module is enabled.
|
||||
* @param {boolean} enhanced If true, the "ec.js" file is used, otherwises, the "ecommerce.js" is used.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
useECommerce(val: boolean, enhanced: boolean): AnalyticsProvider;
|
||||
|
||||
/**
|
||||
* @summary Use Enhanced Link Attribution.
|
||||
* @param {boolean} val If true, the enhanced link attribution module is loaded with Google Analytics.
|
||||
* @return {angular.google.analytics.IAnalyticsProvider} The object instance.
|
||||
*/
|
||||
useEnhancedLinkAttribution(val: boolean): AnalyticsProvider;
|
||||
}
|
||||
}
|
||||
@@ -8,25 +8,27 @@ app.config((growlProvider:angular.growl.IGrowlProvider, $httpProvider:angular.IH
|
||||
error: 4000
|
||||
};
|
||||
|
||||
growlProvider.globalTimeToLive(ttl);
|
||||
growlProvider.globalTimeToLive(5000);
|
||||
growlProvider.globalDisableCloseButton(true);
|
||||
growlProvider.globalDisableIcons(true);
|
||||
growlProvider.globalReversedOrder(false);
|
||||
growlProvider.globalDisableCountDown(true);
|
||||
growlProvider.messageVariableKey("someKey");
|
||||
growlProvider.globalInlineMessages(false);
|
||||
growlProvider.globalPosition("top-center");
|
||||
growlProvider.messagesKey("someKey");
|
||||
growlProvider.messageTextKey("someKey");
|
||||
growlProvider.messageTitleKey("someKey");
|
||||
growlProvider.messageSeverityKey("someKey");
|
||||
growlProvider.onlyUniqueMessages(false);
|
||||
growlProvider.globalTimeToLive(ttl)
|
||||
.globalTimeToLive(5000)
|
||||
.globalDisableCloseButton(true)
|
||||
.globalDisableIcons(true)
|
||||
.globalReversedOrder(false)
|
||||
.globalDisableCountDown(true)
|
||||
.messageVariableKey("someKey")
|
||||
.globalInlineMessages(false)
|
||||
.globalPosition("top-center")
|
||||
.messagesKey("someKey")
|
||||
.messageTextKey("someKey")
|
||||
.messageTitleKey("someKey")
|
||||
.messageSeverityKey("someKey")
|
||||
.onlyUniqueMessages(false);
|
||||
|
||||
$httpProvider.interceptors.push(growlProvider.serverMessagesInterceptor);
|
||||
});
|
||||
|
||||
app.controller("Ctrl", ($scope:angular.IScope, growl:angular.growl.IGrowlService) => {
|
||||
app.controller("Ctrl", ($scope:angular.IScope,
|
||||
growl:angular.growl.IGrowlService,
|
||||
growlMessages:angular.growl.IGrowlMessagesService) => {
|
||||
var config:angular.growl.IGrowlMessageConfig = {
|
||||
ttl: 5000,
|
||||
disableCountDown: true,
|
||||
@@ -50,4 +52,14 @@ app.controller("Ctrl", ($scope:angular.IScope, growl:angular.growl.IGrowlService
|
||||
growl.reverseOrder();
|
||||
growl.inlineMessages();
|
||||
growl.position();
|
||||
|
||||
growlMessages.initDirective(1, 10);
|
||||
var messages:angular.growl.IGrowlMessage[] = growlMessages.getAllMessages(2);
|
||||
growlMessages.destroyAllMessages(0);
|
||||
growlMessages.addMessage(messages[0]);
|
||||
growlMessages.deleteMessage(messages[1]);
|
||||
|
||||
var testMessage = growl.warning(message);
|
||||
testMessage.setText("Some other message");
|
||||
testMessage.destroy();
|
||||
});
|
||||
|
||||
+60
-15
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular Growl 2 v.0.7.3
|
||||
// Type definitions for Angular Growl 2 v.0.7.5
|
||||
// Project: http://janstevens.github.io/angular-growl-2
|
||||
// Definitions by: Tadeusz Hucal <https://github.com/mkp05>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -39,6 +39,16 @@ declare module angular.growl {
|
||||
*/
|
||||
interface IGrowlMessage extends IGrowlMessageConfig {
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* Destroy the message.
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
* Update the message body.
|
||||
* @param newText new message body
|
||||
*/
|
||||
setText(newText: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,73 +64,73 @@ declare module angular.growl {
|
||||
* Set default TTL settings.
|
||||
* @param ttl configuration of TTL for different type of message
|
||||
*/
|
||||
globalTimeToLive(ttl: IGrowlTTLConfig): void;
|
||||
globalTimeToLive(ttl: IGrowlTTLConfig): IGrowlProvider;
|
||||
/**
|
||||
* Set default TTL settings.
|
||||
* @param ttl ttl in milliseconds
|
||||
*/
|
||||
globalTimeToLive(ttl: number): void;
|
||||
globalTimeToLive(ttl: number): IGrowlProvider;
|
||||
/**
|
||||
* Set default setting for disabling close button.
|
||||
* @param disableCloseButton
|
||||
*/
|
||||
globalDisableCloseButton(disableCloseButton: boolean): void;
|
||||
globalDisableCloseButton(disableCloseButton: boolean): IGrowlProvider;
|
||||
/**
|
||||
* Set default setting for disabling icons.
|
||||
* @param disableIcons
|
||||
*/
|
||||
globalDisableIcons(disableIcons: boolean): void;
|
||||
globalDisableIcons(disableIcons: boolean): IGrowlProvider;
|
||||
/**
|
||||
* Set reversing order of displaying new messages.
|
||||
* @param reverseOrder
|
||||
*/
|
||||
globalReversedOrder(reverseOrder: boolean): void
|
||||
globalReversedOrder(reverseOrder: boolean): IGrowlProvider;
|
||||
/**
|
||||
* Set default setting for displaying message disappear countdown.
|
||||
* @param disableCountDown
|
||||
*/
|
||||
globalDisableCountDown(disableCountDown: boolean): void;
|
||||
globalDisableCountDown(disableCountDown: boolean): IGrowlProvider;
|
||||
/**
|
||||
* Set default allowance for inline messages.
|
||||
* @param inline
|
||||
*/
|
||||
globalInlineMessages(inline: boolean): void;
|
||||
globalInlineMessages(inline: boolean): IGrowlProvider;
|
||||
/**
|
||||
* Set default message position.
|
||||
* @param position
|
||||
*/
|
||||
globalPosition(position: string): void;
|
||||
globalPosition(position: string): IGrowlProvider;
|
||||
/**
|
||||
* Enable/disable displaying only unique messages.
|
||||
* @param onlyUniqueMessages
|
||||
*/
|
||||
onlyUniqueMessages(onlyUniqueMessages: boolean): void;
|
||||
onlyUniqueMessages(onlyUniqueMessages: boolean): IGrowlProvider;
|
||||
|
||||
/**
|
||||
* Set key where messages are stored (for http interceptor).
|
||||
* @param messageVariableKey
|
||||
*/
|
||||
messagesKey(messageKey: string): void;
|
||||
messagesKey(messageKey: string): IGrowlProvider;
|
||||
/**
|
||||
* Set key where message text is stored (for http interceptor).
|
||||
* @param messageVariableKey
|
||||
*/
|
||||
messageTextKey(messageTextKey: string): void;
|
||||
messageTextKey(messageTextKey: string): IGrowlProvider;
|
||||
/**
|
||||
* Set key where title of message is stored (for http interceptor).
|
||||
* @param messageVariableKey
|
||||
*/
|
||||
messageTitleKey(messageTitleKey: string): void;
|
||||
messageTitleKey(messageTitleKey: string): IGrowlProvider;
|
||||
/**
|
||||
* Set key where severity of message is stored (for http interceptor).
|
||||
* @param messageVariableKey
|
||||
*/
|
||||
messageSeverityKey(messageSeverityKey: string): void;
|
||||
messageSeverityKey(messageSeverityKey: string): IGrowlProvider;
|
||||
/**
|
||||
* Set key where variables for message are stored (for http interceptor).
|
||||
* @param messageVariableKey
|
||||
*/
|
||||
messageVariableKey(messageVariableKey: string): void;
|
||||
messageVariableKey(messageVariableKey: string): IGrowlProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,4 +221,39 @@ declare module angular.growl {
|
||||
*/
|
||||
position(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* GrowlMessages service.
|
||||
*/
|
||||
interface IGrowlMessagesService {
|
||||
/**
|
||||
* Initialize a directive
|
||||
* We look at the preloaded directive and use this else we
|
||||
* create a new blank object
|
||||
* @param referenceId
|
||||
* @param limitMessages
|
||||
*/
|
||||
initDirective(referenceId: number, limitMessages: number): angular.IDirective;
|
||||
|
||||
/**
|
||||
* Get current messages
|
||||
*/
|
||||
getAllMessages(referenceId?: number): IGrowlMessage[];
|
||||
|
||||
/**
|
||||
* Destroy all messages
|
||||
*/
|
||||
destroyAllMessages(referenceId?: number): void;
|
||||
|
||||
/**
|
||||
* Add a message
|
||||
*/
|
||||
addMessage(message: IGrowlMessage): IGrowlMessage;
|
||||
|
||||
/**
|
||||
* Delete a message
|
||||
*/
|
||||
deleteMessage(message: IGrowlMessage): void;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="./httpi.d.ts" />
|
||||
/// <reference path="./angular-httpi.d.ts" />
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
@@ -1,23 +1,53 @@
|
||||
/// <reference path="./angular-idle.d.ts" />
|
||||
|
||||
angular.module('app', ['ngIdle'])
|
||||
.config(['$keepaliveProvider', '$idleProvider',
|
||||
($keepaliveProvider: ng.idle.IKeepAliveProvider, $idleProvider: ng.idle.IIdleProvider) => {
|
||||
$idleProvider.activeOn('mousemove keydown DOMMouseScroll mousewheel mousedown');
|
||||
$idleProvider.idleDuration(5);
|
||||
$idleProvider.warningDuration(5);
|
||||
$idleProvider.keepalive(true)
|
||||
$idleProvider.autoResume(true);
|
||||
$keepaliveProvider.interval(10);
|
||||
.config(['KeepaliveProvider', 'IdleProvider', 'TitleProvider',
|
||||
(keepaliveProvider: angular.idle.IKeepAliveProvider, idleProvider: angular.idle.IIdleProvider,
|
||||
titleProvider: angular.idle.ITitleProvider) => {
|
||||
idleProvider.interrupt('mousemove keydown DOMMouseScroll mousewheel mousedown');
|
||||
idleProvider.idle(5);
|
||||
idleProvider.timeout(5);
|
||||
idleProvider.keepalive(true)
|
||||
idleProvider.autoResume(true);
|
||||
|
||||
const config: ng.IRequestConfig = {
|
||||
url: "http://google.com",
|
||||
method: "GET"
|
||||
};
|
||||
|
||||
keepaliveProvider.http(config.url); // should accept string and ng.IRequestConfig
|
||||
keepaliveProvider.http(config);
|
||||
keepaliveProvider.interval(10);
|
||||
|
||||
titleProvider.enabled(true);
|
||||
}])
|
||||
.run(['$keepalive', '$idle', ($keepalive: ng.idle.IKeepAliveService, $idle: ng.idle.IIdleService) => {
|
||||
$idle.watch();
|
||||
|
||||
if ($idle.running() || $idle.idling()) {
|
||||
$idle.unwatch();
|
||||
.run(['Keepalive', 'Idle', 'Title', (Keepalive: angular.idle.IKeepAliveService, Idle: angular.idle.IIdleService,
|
||||
Title: angular.idle.ITitleService) => {
|
||||
Idle.setTimeout(Idle.getTimeout());
|
||||
Idle.setIdle(Idle.getIdle());
|
||||
|
||||
Idle.watch();
|
||||
Idle.interrupt();
|
||||
|
||||
const expired: boolean = Idle.isExpired();
|
||||
|
||||
if (Idle.running() || Idle.idling()) {
|
||||
Idle.unwatch();
|
||||
}
|
||||
|
||||
$keepalive.start();
|
||||
$keepalive.ping();
|
||||
$keepalive.stop();
|
||||
|
||||
Keepalive.start();
|
||||
Keepalive.ping();
|
||||
Keepalive.stop();
|
||||
Keepalive.setInterval(10);
|
||||
|
||||
Title.setEnabled(Title.isEnabled());
|
||||
Title.original(Title.original());
|
||||
Title.value(Title.value());
|
||||
Title.store(false);
|
||||
Title.store();
|
||||
Title.restore();
|
||||
Title.idleMessage(Title.idleMessage());
|
||||
Title.timedOutMessage(Title.timedOutMessage());
|
||||
Title.setAsIdle(120);
|
||||
Title.setAsTimedOut();
|
||||
}]);
|
||||
Vendored
+149
-20
@@ -1,4 +1,4 @@
|
||||
// Type definitions for ng-idle v0.3.5
|
||||
// Type definitions for ng-idle v1.1.1
|
||||
// Project: http://hackedbychinese.github.io/ng-idle/
|
||||
// Definitions by: mthamil <https://github.com/mthamil>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -8,7 +8,99 @@
|
||||
declare module angular.idle {
|
||||
|
||||
/**
|
||||
* Used to configure the $keepalive service.
|
||||
* Used to configure the Title service.
|
||||
*/
|
||||
interface ITitleProvider extends IServiceProvider {
|
||||
|
||||
/**
|
||||
* Enables or disables the Title functionality.
|
||||
*
|
||||
* @param enabled Boolean, default is true.
|
||||
*/
|
||||
enabled(enabled: boolean): void;
|
||||
}
|
||||
|
||||
interface ITitleService {
|
||||
|
||||
/**
|
||||
* Allows the title functionality to be enabled or disabled on the fly.
|
||||
*/
|
||||
setEnabled(enabled: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns whether or not the title functionality has been enabled.
|
||||
*/
|
||||
isEnabled(): boolean;
|
||||
|
||||
/**
|
||||
* Will store val as the "original" title of the document.
|
||||
*
|
||||
* Tracking the original title is important when restoring the title after displaying, for example, the idle warning message.
|
||||
*/
|
||||
original(val: string): void;
|
||||
|
||||
/**
|
||||
* Returns the "original" title value that has been previously set.
|
||||
*
|
||||
* Tracking the original title is important when restoring the title after displaying, for example, the idle warning message.
|
||||
*/
|
||||
original(): string;
|
||||
|
||||
/**
|
||||
* Changes the actual title of the document.
|
||||
*/
|
||||
value(val: string): void;
|
||||
|
||||
/**
|
||||
* Returns the current document title.
|
||||
*/
|
||||
value(): string;
|
||||
|
||||
/**
|
||||
* If overwrite is false or unspecified, updates the "original" title with the current document title
|
||||
* if it has not already been stored. If overwrite is true, the current document title is stored regardless.
|
||||
*/
|
||||
store(overwrite?: boolean): void;
|
||||
|
||||
/**
|
||||
* Sets the title to the original value (if it was stored or set previously).
|
||||
*/
|
||||
restore(): void;
|
||||
|
||||
/**
|
||||
* Sets the text to use as the message displayed when the user is idle.
|
||||
*/
|
||||
idleMessage(val: string): void;
|
||||
|
||||
/**
|
||||
* Gets the text to use as the message displayed when the user is idle.
|
||||
*/
|
||||
idleMessage(): string;
|
||||
|
||||
/**
|
||||
* Sets the text to use as the message displayed when the user is timed out.
|
||||
*/
|
||||
timedOutMessage(val: string): void;
|
||||
|
||||
/**
|
||||
* Gets the text to use as the message displayed when the user is timed out.
|
||||
*/
|
||||
timedOutMessage(): string;
|
||||
|
||||
/**
|
||||
* Stores the original title if it hasn't been already, determines the number minutes, seconds,
|
||||
* and total seconds from countdown, and displays the idleMessage with the aforementioned values interpolated.
|
||||
*/
|
||||
setAsIdle(countdown: number): void;
|
||||
|
||||
/**
|
||||
* Stores the original title if it hasn't been already, and displays the timedOutMessage.
|
||||
*/
|
||||
setAsTimedOut(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to configure the Keepalive service.
|
||||
*/
|
||||
interface IKeepAliveProvider extends IServiceProvider {
|
||||
|
||||
@@ -18,24 +110,24 @@ declare module angular.idle {
|
||||
* You can specify a string, which it will assume to be a URL to a simple GET request.
|
||||
* Otherwise, you can use the same options $http takes. However, cache will always be false.
|
||||
*
|
||||
* @param value May be string or object, default is null.
|
||||
* @param value May be string or IRequestConfig, default is null.
|
||||
*/
|
||||
http(value: any): void;
|
||||
http(value: string | IRequestConfig): void;
|
||||
|
||||
/**
|
||||
* This specifies how often the keepalive event is triggered and the
|
||||
* HTTP request is issued.
|
||||
*
|
||||
* @param seconds Integer, default is 5 minutes. Must be greater than 0.
|
||||
* @param seconds Integer, default is 10 minutes. Must be greater than 0.
|
||||
*/
|
||||
interval(seconds: number): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* $keepalive will use a timeout to periodically wake, broadcast a $keepalive event on the root scope,
|
||||
* and optionally make an $http request. By default, the $idle service will stop and start $keepalive
|
||||
* Keepalive will use a timeout to periodically wake, broadcast a Keepalive event on the root scope,
|
||||
* and optionally make an $http request. By default, the Idle service will stop and start Keepalive
|
||||
* when a user becomes idle or returns from idle, respectively. It is also started automatically when
|
||||
* $idle.watch() is called. This can be disabled by configuring the $idleProvider.
|
||||
* Idle.watch() is called. This can be disabled by configuring the IdleProvider.
|
||||
*/
|
||||
interface IKeepAliveService {
|
||||
|
||||
@@ -53,20 +145,25 @@ declare module angular.idle {
|
||||
* Performs one ping only.
|
||||
*/
|
||||
ping(): void;
|
||||
|
||||
/**
|
||||
* Changes the interval value at runtime.
|
||||
* You will need to restart the pinging process by calling start() manually for the changes to be reflected.
|
||||
*/
|
||||
setInterval(seconds: number): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to configure the $idle service.
|
||||
* Used to configure the Idle service.
|
||||
*/
|
||||
interface IIdleProvider extends IServiceProvider {
|
||||
|
||||
/**
|
||||
* Specifies the DOM events the service will watch to reset the idle timeout.
|
||||
* Multiple events should be separated by a space.
|
||||
*
|
||||
* @param events string, default 'mousemove keydown DOMMouseScroll mousewheel mousedown'
|
||||
*/
|
||||
activeOn(events: string): void;
|
||||
interrupt(events: string): void;
|
||||
|
||||
/**
|
||||
* The idle timeout duration in seconds. After this amount of time passes without the user
|
||||
@@ -75,7 +172,7 @@ declare module angular.idle {
|
||||
*
|
||||
* @param seconds integer, default is 20min
|
||||
*/
|
||||
idleDuration(seconds: number): void;
|
||||
idle(seconds: number): void;
|
||||
|
||||
/**
|
||||
* The amount of time the user has to respond (in seconds) before they have been considered
|
||||
@@ -83,19 +180,20 @@ declare module angular.idle {
|
||||
*
|
||||
* @param seconds integer, default is 30s
|
||||
*/
|
||||
warningDuration(seconds: number): void;
|
||||
timeout(seconds: number): void;
|
||||
|
||||
/**
|
||||
* When true, user activity will automatically interrupt the warning countdown and reset the
|
||||
* idle state. If false, you will need to manually call watch() when you want to start
|
||||
* watching for idleness again.
|
||||
* When true or idle, user activity will automatically interrupt the warning countdown
|
||||
* and reset the idle state. If false or off, you will need to manually call watch()
|
||||
* when you want to start watching for idleness again. If notIdle, user activity will
|
||||
* only automatically interrupt if the user is not yet idle.
|
||||
*
|
||||
* @param enabled boolean, default is true
|
||||
* @param enabled boolean or string, possible values: off/false, idle/true, or notIdle
|
||||
*/
|
||||
autoResume(enabled: boolean): void;
|
||||
autoResume(enabled: boolean | string): void;
|
||||
|
||||
/**
|
||||
* When true, the $keepalive service is automatically stopped and started as needed.
|
||||
* When true, the Keepalive service is automatically stopped and started as needed.
|
||||
*
|
||||
* @param enabled boolean, default is true
|
||||
*/
|
||||
@@ -103,13 +201,39 @@ declare module angular.idle {
|
||||
}
|
||||
|
||||
/**
|
||||
* $idle, once watch() is called, will start a timeout which if expires, will enter a warning state
|
||||
* Idle, once watch() is called, will start a timeout which if expires, will enter a warning state
|
||||
* countdown. Once the countdown reaches zero, idle will broadcast a timeout event indicating the
|
||||
* user has timed out (where your app should log them out or whatever you like). If the user performs
|
||||
* an action that triggers a watched DOM event that bubbles up to document.body, this will reset the
|
||||
* idle/warning state and start the process over again.
|
||||
*/
|
||||
interface IIdleService {
|
||||
/**
|
||||
* Gets the current idle value
|
||||
*/
|
||||
getIdle(): number;
|
||||
|
||||
/**
|
||||
* Gets the current timeout value
|
||||
*/
|
||||
getTimeout(): number;
|
||||
|
||||
/**
|
||||
* Updates the idle value (see IdleProvider.idle()) and
|
||||
* restarts the watch if its running.
|
||||
*/
|
||||
setIdle(idle: number): void;
|
||||
|
||||
/**
|
||||
* Updates the timeout value (see IdleProvider.timeout()) and
|
||||
* restarts the watch if its running.
|
||||
*/
|
||||
setTimeout(timeout: number): void;
|
||||
|
||||
/**
|
||||
* Whether user has timed out (meaning idleDuration + timeout has passed without any activity)
|
||||
*/
|
||||
isExpired(): boolean;
|
||||
|
||||
/**
|
||||
* Whether or not the watch() has been called and it is watching for idleness.
|
||||
@@ -130,5 +254,10 @@ declare module angular.idle {
|
||||
* Stops watching for idleness, and resets the idle/warning state.
|
||||
*/
|
||||
unwatch(): void;
|
||||
|
||||
/**
|
||||
* Manually trigger the idle interrupt that normally occurs during user activity.
|
||||
*/
|
||||
interrupt(): any;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -25,6 +25,6 @@ declare module angular.jwt {
|
||||
}
|
||||
|
||||
interface IJwtInterceptor {
|
||||
tokenGetter(): string;
|
||||
tokenGetter(...params : any[]): string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,17 @@ class TestController {
|
||||
constructor($http: ng.IHttpService) {
|
||||
|
||||
$http.get("http://xyz.com", { ignoreLoadingBar: true })
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
app.controller('TestController', TestController);
|
||||
|
||||
var barConfig: angular.loadingBar.ILoadingBarProvider[] = [];
|
||||
barConfig.push({
|
||||
includeSpinner: true,
|
||||
includeBar: true,
|
||||
spinnerTemplate: 'template',
|
||||
latencyThreshold: 100
|
||||
});
|
||||
|
||||
+26
-1
@@ -14,5 +14,30 @@ declare module angular {
|
||||
*/
|
||||
ignoreLoadingBar?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
declare module angular.loadingBar {
|
||||
|
||||
interface ILoadingBarProvider{
|
||||
/**
|
||||
* Turn the spinner on or off
|
||||
*/
|
||||
includeSpinner?: boolean;
|
||||
|
||||
/**
|
||||
* Turn the loading bar on or off
|
||||
*/
|
||||
includeBar?: boolean;
|
||||
|
||||
/**
|
||||
* HTML template
|
||||
*/
|
||||
spinnerTemplate?: string;
|
||||
|
||||
/**
|
||||
* Latency Threshold
|
||||
*/
|
||||
latencyThreshold?: number;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/// <reference path='../angularjs/angular.d.ts' />
|
||||
/// <reference path='angular-locker.d.ts' />
|
||||
|
||||
angular
|
||||
.module('angular-locker-tests', ['angular-locker'])
|
||||
.config(['lockerProvider', function config(lockerProvider: angular.locker.ILockerProvider) {
|
||||
let lockerSettings: angular.locker.ILockerSettings = {
|
||||
driver: 'session',
|
||||
namespace: 'myApp',
|
||||
separator: '.',
|
||||
eventsEnabled: true,
|
||||
extend: <any>{}
|
||||
};
|
||||
|
||||
lockerProvider.defaults(lockerSettings);
|
||||
}])
|
||||
.controller('LockerController', ['$scope', 'locker', function ($scope: angular.IScope, locker: angular.locker.ILockerService) {
|
||||
locker.put('someKey', 'someVal');
|
||||
|
||||
// put an item into session storage
|
||||
locker.driver('session').put('sessionKey', ['some', 'session', 'data']);
|
||||
|
||||
// add an item within a different namespace
|
||||
locker.namespace('otherNamespace').put('foo', 'bar');
|
||||
|
||||
locker.put('someString', 'anyDataType');
|
||||
locker.put('someObject', { foo: 'I will be serialized', bar: 'pretty cool eh' });
|
||||
locker.put('someArray', ['foo', 'bar', 'baz']);
|
||||
// etc
|
||||
|
||||
//Inserts specified key and return value of function
|
||||
locker.put('someKey', function() {
|
||||
var obj = { foo: 'bar', bar: 'baz' };
|
||||
// some other logic
|
||||
return obj;
|
||||
});
|
||||
|
||||
locker.put('someKey', ['foo', 'bar']);
|
||||
|
||||
//The current value will be passed into the function so you can perform logic on the current value, before returning it. e.g.
|
||||
locker.put('someKey', function(current: any) {
|
||||
current.push('baz');
|
||||
|
||||
return current;
|
||||
});
|
||||
|
||||
locker.get('someKey'); // = ['foo', 'bar', 'baz']
|
||||
|
||||
// given locker.get('foo') is not defined
|
||||
locker.put('foo', function (current: any) {
|
||||
// current will equal 'bar'
|
||||
}, 'bar');
|
||||
|
||||
//This will add each key/value pair as a separate item in storage
|
||||
locker.put({
|
||||
someKey: 'johndoe',
|
||||
anotherKey: ['some', 'random', 'array'],
|
||||
boolKey: true
|
||||
});
|
||||
|
||||
locker.add('someKey', 'someVal'); // true or false - whether the item was added or not
|
||||
|
||||
// locker.put('fooArray', ['bar', 'baz', 'bob']);
|
||||
|
||||
locker.get('fooArray'); // ['bar', 'baz', 'bob']
|
||||
|
||||
locker.get('keyDoesNotExist', 'a default value'); // 'a default value'
|
||||
|
||||
locker.get(['someKey', 'anotherKey', 'foo']);
|
||||
/* will return something like...
|
||||
{
|
||||
someKey: 'someValue',
|
||||
anotherKey: true,
|
||||
foo: 'bar'
|
||||
}*/
|
||||
|
||||
// locker.put('someKey', { foo: 'bar', baz: 'bob' });
|
||||
|
||||
locker.pull('someKey', 'defaultVal'); // { foo: 'bar', baz: 'bob' }
|
||||
|
||||
// then...
|
||||
|
||||
locker.get('someKey', 'defaultVal'); // 'defaultVal'
|
||||
|
||||
locker.all();
|
||||
// or
|
||||
locker.namespace('somethingElse').all();
|
||||
|
||||
locker.count();
|
||||
// or
|
||||
locker.namespace('somethingElse').count();
|
||||
|
||||
locker.has('someKey'); // true or false
|
||||
|
||||
// or
|
||||
locker.namespace('foo').has('bar');
|
||||
|
||||
// e.g.
|
||||
if (locker.has('user.authToken') ) {
|
||||
// we're logged in
|
||||
} else {
|
||||
// go to login page or something
|
||||
}
|
||||
|
||||
locker.forget('keyToRemove');
|
||||
// or
|
||||
locker.driver('session').forget('sessionKey');
|
||||
// etc..
|
||||
|
||||
locker.forget(['keyToRemove', 'anotherKeyToRemove', 'something', 'else']);
|
||||
|
||||
locker.clean();
|
||||
// or
|
||||
locker.namespace('someOtherNamespace').clean();
|
||||
|
||||
locker.empty();
|
||||
|
||||
locker.bind($scope, 'foo');
|
||||
$scope['foo'] = ['bar', 'baz'];
|
||||
locker.get('foo'); // = ['bar', 'baz']
|
||||
|
||||
locker.bind($scope, 'foo', 'someDefault');
|
||||
$scope['foo']; // = 'someDefault'
|
||||
locker.get('foo'); // = 'someDefault'
|
||||
|
||||
locker.unbind($scope, 'foo');
|
||||
$scope['foo']; // = undefined
|
||||
locker.get('foo'); // = undefined
|
||||
|
||||
if (! locker.supported()) {
|
||||
// load a polyfill?
|
||||
}
|
||||
}]);
|
||||
Vendored
+170
@@ -0,0 +1,170 @@
|
||||
// Type definitions for Angular Locker v2.0.3
|
||||
// Project: https://github.com/tymondesigns/angular-locker
|
||||
// Definitions by: Niko Kovačič <https://github.com/nkovacic>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module "angular-locker" {
|
||||
var _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module angular.locker {
|
||||
interface ILockerServicePutFunction {
|
||||
(current: any): any
|
||||
}
|
||||
|
||||
interface ILockerService {
|
||||
/**
|
||||
* Add an item to storage if it doesn't already exist
|
||||
*
|
||||
* @param {String} key The key to add
|
||||
* @param {Mixed} value The value to add
|
||||
*/
|
||||
add(key: string, value: any): boolean;
|
||||
/**
|
||||
* Return all items in storage within the current namespace/driver
|
||||
*
|
||||
*/
|
||||
all(): any;
|
||||
/**
|
||||
* Remove all items set within the current namespace/driver
|
||||
*/
|
||||
clean(): ILockerService;
|
||||
/**
|
||||
* Get the total number of items within the current namespace
|
||||
*/
|
||||
count(): number;
|
||||
/**
|
||||
* Retrieve the specified item from storage
|
||||
*
|
||||
* @param {String|Array} key The key to get
|
||||
* @param {Mixed} def The default value if it does not exist
|
||||
*/
|
||||
get(key: string | Array<string>, defaultValue?: any): any;
|
||||
/**
|
||||
* Determine whether the item exists in storage
|
||||
*
|
||||
* @param {String|Function} key - The key to remove
|
||||
*/
|
||||
has(key: string): boolean
|
||||
/**
|
||||
* Get the storage keys as an array
|
||||
*/
|
||||
keys(): Array<string>;
|
||||
/**
|
||||
* Add a new item to storage (even if it already exists)
|
||||
*
|
||||
* @param {Object} keyValuePairs Key value object
|
||||
*/
|
||||
put(keyValuePairs: Object): ILockerService | boolean;
|
||||
/**
|
||||
* Add a new item to storage (even if it already exists)
|
||||
*
|
||||
* @param {Mixed} putFunction The default to pass to function if doesn't already exist
|
||||
*/
|
||||
put(putFunction: Function): ILockerService | boolean;
|
||||
/**
|
||||
* Add a new item to storage (even if it already exists)
|
||||
*
|
||||
* @param {Mixed} key The key to add
|
||||
* @param {Mixed} value The value to add
|
||||
*/
|
||||
put(key: string, value: any): ILockerService | boolean;
|
||||
/**
|
||||
* Add a new item to storage (even if it already exists)
|
||||
*
|
||||
* @param {Mixed} key The key to add
|
||||
* @param {Mixed} putFunction The default to pass to function if doesn't already exist
|
||||
* @param {Mixed} value The value to add
|
||||
*/
|
||||
put(key: string, putFunction: ILockerServicePutFunction, value: any): ILockerService | boolean;
|
||||
/**
|
||||
* Remove specified item(s) from storage
|
||||
*
|
||||
* @param {String} key The key to remove
|
||||
*/
|
||||
forget(key: string): ILockerService;
|
||||
/**
|
||||
* Remove specified item(s) from storage
|
||||
*
|
||||
* @param {Array} keys The array of keys to remove
|
||||
*
|
||||
*/
|
||||
forget(keys: Array<string>): ILockerService;
|
||||
/**
|
||||
* Retrieve the specified item from storage and then remove it
|
||||
*
|
||||
* @param {String|Array} key The key to pull from storage
|
||||
* @param {Mixed} def The default value if it does not exist
|
||||
*/
|
||||
pull(key: string | Array<string>, defaultValue?: any): any;
|
||||
/**
|
||||
* Bind a storage key to a $scope property
|
||||
*
|
||||
* @param {Object} $scope The angular $scope object
|
||||
* @param {String} key The key in storage to bind to
|
||||
* @param {Mixed} def The default value to initially bind
|
||||
*/
|
||||
bind(scope: IScope, property: string, defaultPropertyValue?: any): ILockerService;
|
||||
/**
|
||||
* Set the storage driver on a new instance to enable overriding defaults
|
||||
*
|
||||
* @param {String} driver The driver to switch to
|
||||
*/
|
||||
driver(localStorageType: string): ILockerService;
|
||||
/**
|
||||
* Empty the current storage driver completely. careful now.
|
||||
*/
|
||||
empty(): ILockerService;
|
||||
/**
|
||||
* Get the currently set namespace
|
||||
*/
|
||||
getNamespace(): string;
|
||||
/**
|
||||
* Get a new instance of Locker
|
||||
*
|
||||
* @param {Object} options The config options to instantiate with
|
||||
*/
|
||||
instance(lockerSettings: ILockerSettings): ILockerService;
|
||||
/**
|
||||
* Set the namespace on a new instance to enable overriding defaults
|
||||
*
|
||||
* @param {String} namespace The namespace to switch to
|
||||
*/
|
||||
'namespace'(name: string): ILockerService;
|
||||
/**
|
||||
* Check browser support
|
||||
*
|
||||
* @see github.com/Modernizr/Modernizr/blob/master/feature-detects/storage/localstorage.js#L38-L47
|
||||
*
|
||||
* @param {String} driver The driver to check support with
|
||||
*/
|
||||
supported(): boolean;
|
||||
/**
|
||||
* Unbind a storage key from a $scope property
|
||||
*
|
||||
* @param {Object} $scope The angular $scope object
|
||||
* @param {String} key The key to remove from bindings
|
||||
*/
|
||||
unbind(scope: IScope, property: string): ILockerService;
|
||||
}
|
||||
|
||||
interface ILockerSettings {
|
||||
driver?: string;
|
||||
'namespace'?: string | boolean;
|
||||
separator?: string;
|
||||
eventsEnabled?: boolean;
|
||||
extend?: Object;
|
||||
}
|
||||
|
||||
interface ILockerProvider extends angular.IServiceProvider {
|
||||
/**
|
||||
* Allow the defaults to be specified via the `lockerProvider`
|
||||
*
|
||||
* @param {ILockerSettings} lockerSettings The defaults to override
|
||||
*/
|
||||
defaults(lockerSettings: ILockerSettings): void;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -59,7 +59,7 @@ declare module angular.material {
|
||||
show(dialog: MDDialogOptions|MDPresetDialog<any>): angular.IPromise<any>;
|
||||
confirm(): MDConfirmDialog;
|
||||
alert(): MDAlertDialog;
|
||||
hide(response?: any): void;
|
||||
hide(response?: any): angular.IPromise<any>;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ declare module angular.material {
|
||||
show(dialog: MDDialogOptions|MDAlertDialog|MDConfirmDialog): angular.IPromise<any>;
|
||||
confirm(): MDConfirmDialog;
|
||||
alert(): MDAlertDialog;
|
||||
hide(response?: any): void;
|
||||
hide(response?: any): angular.IPromise<any>;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,10 +44,16 @@ myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.
|
||||
});
|
||||
};
|
||||
$scope['alertDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.alert().content('Alert!'));
|
||||
$mdDialog.show($mdDialog.alert().textContent('Alert!'));
|
||||
};
|
||||
$scope['alertDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.alert().htmlContent('<span>Alert!</span>'));
|
||||
};
|
||||
$scope['confirmDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.confirm().content('Confirm!'));
|
||||
$mdDialog.show($mdDialog.confirm().textContent('Confirm!'));
|
||||
};
|
||||
$scope['confirmDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.confirm().htmlContent('<span>Confirm!</span>'));
|
||||
};
|
||||
$scope['hideDialog'] = $mdDialog.hide.bind($mdDialog, 'hide');
|
||||
$scope['cancelDialog'] = $mdDialog.cancel.bind($mdDialog, 'cancel');
|
||||
@@ -90,5 +96,5 @@ 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().content('Hello!'));
|
||||
});
|
||||
$scope['openToast'] = () => $mdToast.show($mdToast.simple().textContent('Hello!'));
|
||||
});
|
||||
|
||||
+7
-4
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular Material 0.10.1-rc1+ (angular.material module)
|
||||
// Type definitions for Angular Material 1.0.0-rc5+ (angular.material module)
|
||||
// Project: https://github.com/angular/material
|
||||
// Definitions by: Matt Traynham <https://github.com/mtraynham>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -16,6 +16,7 @@ declare module angular.material {
|
||||
targetEvent?: MouseEvent;
|
||||
resolve?: {[index: string]: angular.IPromise<any>}
|
||||
controllerAs?: string;
|
||||
bindToController?: boolean;
|
||||
parent?: string|Element|JQuery; // default: root node
|
||||
disableParentScroll?: boolean; // default: true
|
||||
}
|
||||
@@ -28,7 +29,8 @@ declare module angular.material {
|
||||
|
||||
interface IPresetDialog<T> {
|
||||
title(title: string): T;
|
||||
content(content: string): T;
|
||||
textContent(textContent: string): T;
|
||||
htmlContent(htmlContent: string): T;
|
||||
ok(ok: string): T;
|
||||
theme(theme: string): T;
|
||||
templateUrl(templateUrl?: string): T;
|
||||
@@ -75,6 +77,7 @@ declare module angular.material {
|
||||
resolve?: {[index: string]: angular.IPromise<any>}
|
||||
controllerAs?: string;
|
||||
parent?: string|Element|JQuery; // default: root node
|
||||
fullscreen?: boolean;
|
||||
onComplete?: Function;
|
||||
}
|
||||
|
||||
@@ -82,7 +85,7 @@ declare module angular.material {
|
||||
show(dialog: IDialogOptions|IAlertDialog|IConfirmDialog): angular.IPromise<any>;
|
||||
confirm(): IConfirmDialog;
|
||||
alert(): IAlertDialog;
|
||||
hide(response?: any): void;
|
||||
hide(response?: any): angular.IPromise<any>;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
|
||||
@@ -115,7 +118,7 @@ declare module angular.material {
|
||||
}
|
||||
|
||||
interface IToastPreset<T> {
|
||||
content(content: string): T;
|
||||
textContent(content: string): T;
|
||||
action(action: string): T;
|
||||
highlightAction(highlightAction: boolean): T;
|
||||
capsule(capsule: boolean): T;
|
||||
|
||||
Vendored
+22
@@ -39,6 +39,28 @@ declare module angular.meteor {
|
||||
* @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle.
|
||||
*/
|
||||
subscribe(name: string, ...publisherArguments: any[]): angular.IPromise<Meteor.SubscriptionHandle>;
|
||||
|
||||
/**
|
||||
* The helpers method is part of the ReactiveContext, and available on every context and $scope.
|
||||
* These method are defined as Object, where each key is the name of the variable that will be available on the context we run, and each value is a function with a return value.
|
||||
* Under the hood, each helper starts a new Tracker.autorun. When its reactive dependencies change, the helper is rerun.
|
||||
* To trigger a rerun every time an specific Angular variable change, use getReactively](/api/1.3.1/get-reactively) to make your Angular variable reactive inside the helper its used in.
|
||||
* Each helper function should return a MongoDB Cursor and the helpers will expose it as a normal array to the context.
|
||||
*
|
||||
* @param definitions - Object containing `name` => `function` definition, where each name is a string and each function is the helper function. Should return a [MongoDB Cursor](http://docs.meteor.com/#/full/mongo_cursor)
|
||||
* @return This method returns this, which the the reactive context, in order to provide the ability to chain the logic.
|
||||
*/
|
||||
helpers(definitions : { [helperName : string] : () => Mongo.Cursor<any> }): IScope;
|
||||
|
||||
/**
|
||||
* This method is a wrapper of Tracker.autorun and shares exactly the same API.
|
||||
* The autorun method is part of the ReactiveContext, and available on every context and $scope.
|
||||
* The argument of this method is a callback, which will be called each time Autorun will be used.
|
||||
* The Autorun will stop automatically when when it's context ($scope) is destroyed.
|
||||
*
|
||||
* @param runFunc - The function to run. It receives one argument: the Computation object that will be returned.
|
||||
*/
|
||||
autorun(runFunc : () => void) : Tracker.Computation;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="angular-modal.d.ts" />
|
||||
|
||||
var btfModal: angularModal.AngularModalFactory;
|
||||
|
||||
// Using template URL
|
||||
function withTemplateUrl() {
|
||||
btfModal({
|
||||
controller: 'SomeController',
|
||||
controllerAs: 'vm',
|
||||
templateUrl: 'some-template.html'
|
||||
});
|
||||
}
|
||||
|
||||
// Using template
|
||||
function withTemplate() {
|
||||
btfModal({
|
||||
controller: 'SomeController',
|
||||
controllerAs: 'vm',
|
||||
template: '<div></div>'
|
||||
});
|
||||
}
|
||||
|
||||
// Using controller function
|
||||
function withControllerAsFunction() {
|
||||
btfModal({
|
||||
controller: function () {},
|
||||
template: '<div></div>'
|
||||
})
|
||||
}
|
||||
|
||||
// Using constructor function
|
||||
function withControllerClass() {
|
||||
class TestController {
|
||||
constructor(dependency1:any, dependency2:any) {}
|
||||
}
|
||||
btfModal({
|
||||
controller: TestController,
|
||||
template: '<div></div>'
|
||||
});
|
||||
}
|
||||
|
||||
// With container as selector
|
||||
function withContainerAsString() {
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: '.container'
|
||||
});
|
||||
}
|
||||
|
||||
// With container as jQuery element
|
||||
function withContainerAsJquery() {
|
||||
var container: JQuery = $('body');
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: container
|
||||
});
|
||||
}
|
||||
|
||||
// With container as DOM Element
|
||||
function withContainerAsDom() {
|
||||
var container: Element = document.getElementById('container');
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: container
|
||||
});
|
||||
}
|
||||
|
||||
// With container as DOM Element Array
|
||||
function withContainerAsDomArray() {
|
||||
var container: Element[] = [document.getElementById('container'), document.getElementById('container2')];
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: container
|
||||
});
|
||||
}
|
||||
|
||||
// With container as function
|
||||
function withContainerAsFunction() {
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: function() {}
|
||||
});
|
||||
}
|
||||
|
||||
// With container as array
|
||||
function withContainerAsArray() {
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: ['1', 2]
|
||||
});
|
||||
}
|
||||
|
||||
// Calling return values
|
||||
function callingValues() {
|
||||
var modal: angularModal.AngularModal = btfModal({
|
||||
template: '<div></div>'
|
||||
});
|
||||
modal.activate().then(() => {}, () => {});
|
||||
modal.deactivate().then(() => {}, () => {});
|
||||
var isActive: boolean = modal.active();
|
||||
}
|
||||
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for angular-modal 0.5.0
|
||||
// Project: https://github.com/btford/angular-modal
|
||||
// Definitions by: Paul Lessing <https://github.com/paullessing>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module angularModal {
|
||||
|
||||
type AngularModalControllerDefinition = (new (...args: any[]) => any) | Function | string; // Possible arguments to IControllerService
|
||||
|
||||
type AngularModalJQuerySelector = string | Element | Element[] | JQuery | Function | any[] | {}; // Possible arguments to IAugmentedJQueryStatic
|
||||
|
||||
interface AngularModalSettings {
|
||||
controller?: AngularModalControllerDefinition;
|
||||
controllerAs?: string;
|
||||
container?: AngularModalJQuerySelector;
|
||||
}
|
||||
|
||||
export interface AngularModalSettingsWithTemplate extends AngularModalSettings {
|
||||
template: any;
|
||||
}
|
||||
|
||||
export interface AngularModalSettingsWithTemplateUrl extends AngularModalSettings {
|
||||
templateUrl: string;
|
||||
}
|
||||
|
||||
export interface AngularModal {
|
||||
activate(): angular.IPromise<void>;
|
||||
deactivate(): angular.IPromise<void>;
|
||||
active(): boolean;
|
||||
}
|
||||
|
||||
export interface AngularModalFactory {
|
||||
(settings: AngularModalSettingsWithTemplate | AngularModalSettingsWithTemplateUrl): AngularModal;
|
||||
}
|
||||
}
|
||||
Vendored
+11
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for angular-notify 2.0.2
|
||||
// Type definitions for angular-notify 2.5.0
|
||||
// Project: https://github.com/cgross/angular-notify
|
||||
// Definitions by: Suwato <https://github.com/Suwato/DefinitelyTyped>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -51,6 +51,11 @@ declare module angular.cgNotify {
|
||||
* Optional. Currently center and right are the only acceptable values.
|
||||
*/
|
||||
position? : string;
|
||||
|
||||
/**
|
||||
* Optional. The duration (in milliseconds) of the message. A duration of 0 will prevent the message from closing automatically.
|
||||
*/
|
||||
duration? : number;
|
||||
|
||||
/**
|
||||
* Optional. Element that contains each notification. Defaults to document.body.
|
||||
@@ -94,6 +99,11 @@ declare module angular.cgNotify {
|
||||
* The default element that contains each notification. Defaults to document.body.
|
||||
*/
|
||||
container? : any;
|
||||
|
||||
/**
|
||||
* The maximum number of total notifications that can be visible at one time. Older notifications will be closed when the maximum is reached.
|
||||
*/
|
||||
maximumOpen? : number;
|
||||
}):void;
|
||||
|
||||
/**
|
||||
|
||||
@@ -174,6 +174,7 @@ var user = odataResourceClass.odata()
|
||||
.skip(10)
|
||||
.take(20)
|
||||
.orderBy("Name", "desc")
|
||||
.transformUrl((s)=>s)
|
||||
.single();
|
||||
user.$save();
|
||||
|
||||
|
||||
@@ -281,6 +281,7 @@ declare module OData {
|
||||
constructor(callback: ProviderCallback<T>);
|
||||
filter(operand1: any, operand2?: any, operand3?: any): Provider<T>;
|
||||
orderBy(arg1: string, arg2?: string): Provider<T>;
|
||||
transformUrl(transformMethod : (url:string)=>string): Provider<T>;
|
||||
take(amount: number): Provider<T>;
|
||||
skip(amount: number): Provider<T>;
|
||||
private execute();
|
||||
|
||||
@@ -196,6 +196,27 @@ function TestWebDriverUntilModule() {
|
||||
conditionWebElements = protractor.until.elementsLocated(by.className('class'));
|
||||
}
|
||||
|
||||
function TestWebDriverExpectedConditionsModule() {
|
||||
var conditionB: protractor.until.Condition<boolean>;
|
||||
var el: protractor.ElementFinder = element(by.id('id'));
|
||||
|
||||
conditionB = protractor.ExpectedConditions.alertIsPresent();
|
||||
conditionB = protractor.ExpectedConditions.elementToBeClickable(el);
|
||||
conditionB = protractor.ExpectedConditions.textToBePresentInElement(el, 'text');
|
||||
conditionB = protractor.ExpectedConditions.textToBePresentInElementValue(el, 'text');
|
||||
conditionB = protractor.ExpectedConditions.titleContains('text');
|
||||
conditionB = protractor.ExpectedConditions.titleIs('text');
|
||||
conditionB = protractor.ExpectedConditions.presenceOf(el);
|
||||
conditionB = protractor.ExpectedConditions.stalenessOf(el);
|
||||
conditionB = protractor.ExpectedConditions.visibilityOf(el);
|
||||
conditionB = protractor.ExpectedConditions.invisibilityOf(el);
|
||||
conditionB = protractor.ExpectedConditions.elementToBeSelected(el);
|
||||
|
||||
conditionB = protractor.ExpectedConditions.not(protractor.ExpectedConditions.alertIsPresent());
|
||||
conditionB = protractor.ExpectedConditions.and(protractor.ExpectedConditions.alertIsPresent(), protractor.ExpectedConditions.elementToBeClickable(el));
|
||||
conditionB = protractor.ExpectedConditions.or(protractor.ExpectedConditions.alertIsPresent(), protractor.ExpectedConditions.elementToBeClickable(el));
|
||||
}
|
||||
|
||||
function TestProtractor() {
|
||||
var ptor: protractor.Protractor;
|
||||
var driver: webdriver.WebDriver = new webdriver.Builder().
|
||||
@@ -385,9 +406,19 @@ function TestElementArrayFinder() {
|
||||
elementArrayFinder.each(function(element: protractor.ElementFinder){
|
||||
// nothing
|
||||
});
|
||||
|
||||
stringPromise = elementArrayFinder.map(function(element: protractor.ElementFinder, index: number){
|
||||
return 'abc';
|
||||
})
|
||||
});
|
||||
|
||||
stringPromise = elementArrayFinder.map<string>(function(element: protractor.ElementFinder, index: number): string {
|
||||
return 'abc';
|
||||
});
|
||||
|
||||
stringPromise = elementArrayFinder.map<string, webdriver.promise.Promise<string>>(function(element: protractor.ElementFinder, index: number): webdriver.promise.Promise<string> {
|
||||
return element.getText();
|
||||
});
|
||||
|
||||
elementArrayFinder = elementArrayFinder.filter(function(element: protractor.ElementFinder, index: number){
|
||||
return element.getText().then((text: string) => {
|
||||
return text === "foo";
|
||||
|
||||
+150
@@ -501,6 +501,145 @@ declare module protractor {
|
||||
function titleMatches(regex: RegExp): webdriver.until.Condition<boolean>;
|
||||
}
|
||||
|
||||
module ExpectedConditions {
|
||||
/**
|
||||
* Negates the result of a promise.
|
||||
*
|
||||
* @param {webdriver.until.Condition<boolean>} expectedCondition
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns the negated value.
|
||||
*/
|
||||
function not<T>(expectedCondition: webdriver.until.Condition<T>): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* Chain a number of expected conditions using logical_and, short circuiting at the
|
||||
* first expected condition that evaluates to false.
|
||||
*
|
||||
* @param {...webdriver.until.Condition<boolean>[]} fns An array of expected conditions to 'and' together.
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise which evaluates
|
||||
* to the result of the logical and.
|
||||
*/
|
||||
function and<T>(...fns: webdriver.until.Condition<T>[]): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* Chain a number of expected conditions using logical_or, short circuiting at the
|
||||
* first expected condition that evaluates to true.
|
||||
*
|
||||
* @param {...webdriver.until.Condition<boolean>[]} fns An array of expected conditions to 'or' together.
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise which
|
||||
* evaluates to the result of the logical or.
|
||||
*/
|
||||
function or<T>(...fns: webdriver.until.Condition<T>[]): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* Expect an alert to be present.
|
||||
*
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise representing
|
||||
* whether an alert is present.
|
||||
*/
|
||||
function alertIsPresent<T>(): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* An Expectation for checking an element is visible and enabled such that you can click it.
|
||||
*
|
||||
* @param {ElementFinder} element The element to check
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise representing
|
||||
* whether the element is clickable.
|
||||
*/
|
||||
function elementToBeClickable<T>(element: ElementFinder): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* An expectation for checking if the given text is present in the element.
|
||||
* Returns false if the elementFinder does not find an element.
|
||||
*
|
||||
* @param {ElementFinder} element The element to check
|
||||
* @param {string} text The text to verify against
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise representing
|
||||
* whether the text is present in the element.
|
||||
*/
|
||||
function textToBePresentInElement<T>(element: ElementFinder, text: string): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* An expectation for checking if the given text is present in the element’s value.
|
||||
* Returns false if the elementFinder does not find an element.
|
||||
*
|
||||
* @param {ElementFinder} element The element to check
|
||||
* @param {string} text The text to verify against
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise representing
|
||||
* whether the text is present in the element's value.
|
||||
*/
|
||||
function textToBePresentInElementValue<T>(
|
||||
element: ElementFinder, text: string
|
||||
): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* An expectation for checking that the title contains a case-sensitive substring.
|
||||
*
|
||||
* @param {string} title The fragment of title expected
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise representing
|
||||
* whether the title contains the string.
|
||||
*/
|
||||
function titleContains<T>(title: string): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* An expectation for checking the title of a page.
|
||||
*
|
||||
* @param {string} title The expected title, which must be an exact match.
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise representing
|
||||
* whether the title equals the string.
|
||||
*/
|
||||
function titleIs<T>(title: string): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* An expectation for checking that an element is present on the DOM of a page. This does not necessarily
|
||||
* mean that the element is visible. This is the opposite of 'stalenessOf'.
|
||||
*
|
||||
* @param {ElementFinder} elementFinder The element to check
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise
|
||||
* representing whether the element is present.
|
||||
*/
|
||||
function presenceOf<T>(element: ElementFinder): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* An expectation for checking that an element is not attached to the DOM of a page.
|
||||
* This is the opposite of 'presenceOf'.
|
||||
*
|
||||
* @param {ElementFinder} elementFinder The element to check
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise representing
|
||||
* whether the element is stale.
|
||||
*/
|
||||
function stalenessOf<T>(element: ElementFinder): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* An expectation for checking that an element is present on the DOM of a page and visible.
|
||||
* Visibility means that the element is not only displayed but also has a height and width that is
|
||||
* greater than 0. This is the opposite of 'invisibilityOf'.
|
||||
*
|
||||
* @param {ElementFinder} elementFinder The element to check
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise representing
|
||||
* whether the element is visible.
|
||||
*/
|
||||
function visibilityOf<T>(element: ElementFinder): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* An expectation for checking that an element is present on the DOM of a page. This does not necessarily
|
||||
* mean that the element is visible. This is the opposite of 'stalenessOf'.
|
||||
*
|
||||
* @param {ElementFinder} elementFinder The element to check
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise representing
|
||||
* whether the element is invisible.
|
||||
*/
|
||||
function invisibilityOf<T>(element: ElementFinder): webdriver.until.Condition<T>;
|
||||
|
||||
/**
|
||||
* An expectation for checking the selection is selected.
|
||||
*
|
||||
* @param {ElementFinder} elementFinder The element to check
|
||||
* @return {!webdriver.until.Condition<boolean>} An expected condition that returns a promise representing
|
||||
* whether the element is selected.
|
||||
*/
|
||||
function elementToBeSelected<T>(element: ElementFinder): webdriver.until.Condition<T>;
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
/**
|
||||
@@ -853,6 +992,7 @@ declare module protractor {
|
||||
* of values returned by the map function.
|
||||
*/
|
||||
map<T>(mapFn: (element: ElementFinder, index: number) => T): webdriver.promise.Promise<T[]>;
|
||||
map<T, T2>(mapFn: (element: ElementFinder, index: number) => T2): webdriver.promise.Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Apply a filter function to each element within the ElementArrayFinder. Returns
|
||||
@@ -1667,6 +1807,16 @@ declare module protractor {
|
||||
* @return {Protractor} a protractor instance.
|
||||
*/
|
||||
forkNewDriverInstance(opt_useSameUrl?: boolean, opt_copyMockModules?: boolean): Protractor;
|
||||
|
||||
/**
|
||||
* Get the processed configuration object that is currently being run. This will contain
|
||||
* the specs and capabilities properties of the current runner instance.
|
||||
*
|
||||
* Set by the runner.
|
||||
*
|
||||
* @return {webdriver.promise.Promise<any>} A promise which resolves to the capabilities object.
|
||||
*/
|
||||
getProcessedConfig(): webdriver.promise.Promise<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,378 @@
|
||||
/// <reference path="../angularjs/angular.d.ts"/>
|
||||
/// <reference path="./angular-strap.d.ts"/>
|
||||
|
||||
module angularStrapTests {
|
||||
|
||||
import ngStrap = mgcrea.ngStrap;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Modal
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module modalTests {
|
||||
|
||||
interface IDemoCtrlScope extends ngStrap.modal.IModalScope {
|
||||
showModal: () => void;
|
||||
}
|
||||
|
||||
angular.module('demoApp')
|
||||
.config($modalConfig)
|
||||
.controller('demoCtrl', demoCtrl);
|
||||
|
||||
function demoCtrl($scope: IDemoCtrlScope,
|
||||
$modal: ngStrap.modal.IModalService): void {
|
||||
|
||||
var myModalOptions: ngStrap.modal.IModalOptions = {};
|
||||
myModalOptions.title = 'My Title';
|
||||
myModalOptions.content = 'Hello Modal<br />This is a multiline message!';
|
||||
myModalOptions.show = true;
|
||||
|
||||
var myModal = $modal(myModalOptions);
|
||||
|
||||
var myOtherModalOptions: ngStrap.modal.IModalOptions = {};
|
||||
myOtherModalOptions.scope = $scope;
|
||||
myOtherModalOptions.template = 'modal/docs/modal.demo.tpl.html';
|
||||
myOtherModalOptions.show = false;
|
||||
|
||||
var myOtherModal = $modal(myOtherModalOptions);
|
||||
|
||||
$scope.showModal = (): void => {
|
||||
myOtherModal.$promise.then(myOtherModal.show);
|
||||
};
|
||||
}
|
||||
|
||||
function $modalConfig($modalProvider: ngStrap.modal.IModalProvider): void {
|
||||
var defaults: ngStrap.modal.IModalOptions = {
|
||||
animation: 'am-flip-x'
|
||||
}
|
||||
angular.extend($modalProvider.defaults, defaults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Aside
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module asideTests {
|
||||
|
||||
angular.module('demoApp')
|
||||
.config($asideConfig)
|
||||
.controller('demoCtrl', demoCtrl);
|
||||
|
||||
function demoCtrl($scope: ngStrap.aside.IAsideScope,
|
||||
$aside: ngStrap.aside.IAsideService): void {
|
||||
|
||||
var myAsideOptions: ngStrap.aside.IAsideOptions = {};
|
||||
myAsideOptions.title = 'My Title';
|
||||
myAsideOptions.content = 'My content';
|
||||
myAsideOptions.show = true;
|
||||
|
||||
var myAside = $aside(myAsideOptions);
|
||||
|
||||
var myOtherAsideOptions: ngStrap.aside.IAsideOptions = {};
|
||||
myOtherAsideOptions.scope = $scope;
|
||||
myOtherAsideOptions.template = 'aside/docs/aside.demo.tpl.html';
|
||||
|
||||
var myOtherAside = $aside();
|
||||
|
||||
myOtherAside.$promise.then(() => {
|
||||
myOtherAside.show();
|
||||
});
|
||||
}
|
||||
|
||||
function $asideConfig($asideProvider: ngStrap.aside.IAsideProvider): void {
|
||||
var defaults: ngStrap.aside.IAsideOptions = {};
|
||||
defaults.animation = 'am-fadeAndSlideLeft';
|
||||
defaults.placement = 'left';
|
||||
|
||||
angular.extend($asideProvider.defaults, defaults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Alert
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module alertTests {
|
||||
|
||||
angular.module('demoApp')
|
||||
.config($alertConfig)
|
||||
.controller('demoCtrl', demoCtrl);
|
||||
|
||||
function demoCtrl($scope: ngStrap.alert.IAlertScope,
|
||||
$alert: ngStrap.alert.IAlertService): void {
|
||||
|
||||
var options: ngStrap.alert.IAlertOptions = {};
|
||||
options.title = 'Holy guacamole!';
|
||||
options.content = 'Best check yo self, you\'re not looking too good.';
|
||||
options.placement = 'top';
|
||||
options.type = 'info';
|
||||
options.show = true;
|
||||
|
||||
var myAlert = $alert();
|
||||
}
|
||||
|
||||
function $alertConfig($alertProvider: ngStrap.alert.IAlertProvider): void {
|
||||
var defaults: ngStrap.alert.IAlertOptions = {};
|
||||
defaults.animation = 'am-fade-and-slide-top';
|
||||
defaults.placement = 'top';
|
||||
|
||||
angular.extend($alertProvider.defaults, defaults);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Tooltip
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module tooltipTests {
|
||||
|
||||
angular.module('demoApp')
|
||||
.config($tooltipConfig)
|
||||
.controller('demoDrct', demoDrct);
|
||||
|
||||
function demoDrct($tooltip: ngStrap.tooltip.ITooltipService): ng.IDirective {
|
||||
var drct: ng.IDirective = {};
|
||||
drct.restrict = 'EA';
|
||||
drct.link = link;
|
||||
return drct;
|
||||
|
||||
function link(scope: ng.IScope, elem: ng.IAugmentedJQuery, attrs: ng.IAttributes): void {
|
||||
var options: ngStrap.tooltip.ITooltipOptions = {};
|
||||
options.title = 'My Title';
|
||||
$tooltip(elem, options);
|
||||
}
|
||||
}
|
||||
|
||||
function $tooltipConfig($tooltipProvider: ngStrap.tooltip.ITooltipProvider): void {
|
||||
var defaults: ngStrap.tooltip.ITooltipOptions = {};
|
||||
defaults.animation = 'am-flip-x';
|
||||
defaults.trigger = 'hover';
|
||||
|
||||
angular.extend($tooltipProvider.defaults, defaults);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Popover
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module popoverTests {
|
||||
|
||||
angular.module('demoApp')
|
||||
.config($popoverConfig)
|
||||
.controller('demoDrct', demoDrct);
|
||||
|
||||
function demoDrct($popover: ngStrap.popover.IPopoverService): ng.IDirective {
|
||||
var drct: ng.IDirective = {};
|
||||
drct.restrict = 'EA';
|
||||
drct.link = link;
|
||||
return drct;
|
||||
|
||||
function link(scope: ng.IScope, elem: ng.IAugmentedJQuery, attrs: ng.IAttributes): void {
|
||||
var options: ngStrap.tooltip.ITooltipOptions = {};
|
||||
options.title = 'My Title';
|
||||
|
||||
$popover(elem, options);
|
||||
}
|
||||
}
|
||||
|
||||
function $popoverConfig($popoverProvider: ngStrap.popover.IPopoverProvider): void {
|
||||
var defaults: ngStrap.tooltip.ITooltipOptions = {}
|
||||
defaults.animation = 'am-flip-x';
|
||||
defaults.trigger = 'hover';
|
||||
|
||||
angular.extend($popoverProvider.defaults, defaults);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Typeahead
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module typeaheadTests {
|
||||
|
||||
angular.module('myApp')
|
||||
.config($typeaheadConfig);
|
||||
|
||||
function $typeaheadConfig($typeaheadProvider: ngStrap.typeahead.ITypeaheadProvider) {
|
||||
var defaults: ngStrap.typeahead.ITypeaheadOptions = {}
|
||||
defaults.animation = 'am-flip-x';
|
||||
defaults.minLength = 2;
|
||||
defaults.limit = 8;
|
||||
|
||||
angular.extend($typeaheadProvider.defaults, defaults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Datepicker
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module datepickerTests {
|
||||
|
||||
angular.module('myApp')
|
||||
.config($datepickerConfig);
|
||||
|
||||
function $datepickerConfig($datepickerProvider: ngStrap.datepicker.IDatepickerProvider): void {
|
||||
var defaults: ngStrap.datepicker.IDatepickerOptions = {};
|
||||
defaults.dateFormat = 'dd/MM/yyyy';
|
||||
defaults.startWeek = 1;
|
||||
|
||||
angular.extend($datepickerProvider.defaults, defaults);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Timepicker
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module timepickerTests {
|
||||
|
||||
angular.module('myApp')
|
||||
.config($timepickerConfig);
|
||||
|
||||
function $timepickerConfig($timepickerProvider: ngStrap.timepicker.ITimepickerProvider): void {
|
||||
var defaults: ngStrap.timepicker.ITimepickerOptions = {};
|
||||
defaults.timeFormat = 'HH:mm';
|
||||
defaults.length = 7;
|
||||
|
||||
angular.extend($timepickerProvider.defaults, defaults);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Select
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module selectTests {
|
||||
|
||||
angular.module('myApp')
|
||||
.config($selectConfig);
|
||||
|
||||
function $selectConfig($selectProvider: ngStrap.select.ISelectProvider): void {
|
||||
var defaults: ngStrap.select.ISelectOptions = {};
|
||||
defaults.animation = 'am-flip-x';
|
||||
defaults.sort = false;
|
||||
|
||||
angular.extend($selectProvider.defaults, defaults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Tabs
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module tabTests {
|
||||
|
||||
angular.module('myApp')
|
||||
.config($tabConfig);
|
||||
|
||||
function $tabConfig($tabProvider: ngStrap.tab.ITabProvider) {
|
||||
var defaults: ngStrap.tab.ITabOptions = {};
|
||||
defaults.animation = 'am-flip-x';
|
||||
|
||||
angular.extend($tabProvider.defaults, defaults);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Collapse
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module collapseTests {
|
||||
|
||||
angular.module('myApp')
|
||||
.config($collapseConfig);
|
||||
|
||||
function $collapseConfig($collapseProvider: ngStrap.collapse.ICollapseProvider):void {
|
||||
var defaults: ngStrap.collapse.ICollapseOptions = {};
|
||||
defaults.animation = 'am-flip-x';
|
||||
|
||||
angular.extend($collapseProvider.defaults, defaults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Dropdown
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module dropdownTests {
|
||||
|
||||
angular.module('myApp')
|
||||
.config($dropdownConfig);
|
||||
|
||||
function $dropdownConfig($dropdownProvider: ngStrap.dropdown.IDropdownProvider):void {
|
||||
var defaults: ngStrap.dropdown.IDropdownOptions = {};
|
||||
defaults.animation = 'am-flip-x';
|
||||
defaults.trigger = 'hover';
|
||||
|
||||
angular.extend($dropdownProvider.defaults, defaults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Navbar
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module navbarTests {
|
||||
|
||||
angular.module('myApp')
|
||||
.config($navbarConfig);
|
||||
|
||||
function $navbarConfig($navbarProvider: ngStrap.navbar.INavbarProvider):void {
|
||||
var defaults: ngStrap.navbar.INavbarOptions = {};
|
||||
defaults.activeClass = 'in';
|
||||
|
||||
angular.extend($navbarProvider.defaults, defaults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Scrollspy
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module scrollspyTests {
|
||||
|
||||
angular.module('myApp')
|
||||
.config($scrollspyConfig);
|
||||
|
||||
function $scrollspyConfig($scrollspyProvider: ngStrap.scrollspy.IScrollspyProvider):void {
|
||||
var defaults: ngStrap.scrollspy.IScrollspyOptions = {};
|
||||
defaults.offset = 0;
|
||||
defaults.target = 'my-selector';
|
||||
|
||||
angular.extend($scrollspyProvider.defaults, defaults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Affix
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module affixTests {
|
||||
|
||||
angular.module('myApp')
|
||||
.config($affixConfig);
|
||||
|
||||
function $affixConfig($affixProvider: ngStrap.affix.IAffixProvider):void {
|
||||
var defaults: ngStrap.affix.IAffixOptions = {};
|
||||
defaults.offsetTop = 100;
|
||||
|
||||
angular.extend($affixProvider.defaults, defaults);
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+600
@@ -0,0 +1,600 @@
|
||||
// Type definitions for angular-strap v2.2.x
|
||||
// Project: http://mgcrea.github.io/angular-strap/
|
||||
// Definitions by: Sam Herrmann <https://github.com/samherrmann>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module mgcrea.ngStrap {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Modal
|
||||
// see http://mgcrea.github.io/angular-strap/#/modals
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module modal {
|
||||
|
||||
interface IModalService {
|
||||
(config?: IModalOptions): IModal;
|
||||
}
|
||||
|
||||
interface IModalProvider {
|
||||
defaults: IModalOptions;
|
||||
}
|
||||
|
||||
interface IModal {
|
||||
$promise: ng.IPromise<void>;
|
||||
show: () => void;
|
||||
hide: () => void;
|
||||
toggle: () => void;
|
||||
}
|
||||
|
||||
interface IModalOptions {
|
||||
animation?: string;
|
||||
backdropAnimation?: string;
|
||||
placement?: string;
|
||||
title?: string;
|
||||
content?: string;
|
||||
html?: boolean;
|
||||
backdrop?: boolean | string;
|
||||
keyboard?: boolean;
|
||||
show?: boolean;
|
||||
container?: string | boolean;
|
||||
template?: string;
|
||||
contentTemplate?: string;
|
||||
prefixEvent?: string;
|
||||
id?: string;
|
||||
scope?: ng.IScope;
|
||||
}
|
||||
|
||||
interface IModalScope extends ng.IScope {
|
||||
$show: () => void;
|
||||
$hide: () => void;
|
||||
$toggle: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Aside
|
||||
// see http://mgcrea.github.io/angular-strap/#/asides
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module aside {
|
||||
|
||||
interface IAsideService {
|
||||
(config?: IAsideOptions): IAside;
|
||||
}
|
||||
|
||||
interface IAsideProvider {
|
||||
defaults: IAsideOptions;
|
||||
}
|
||||
|
||||
interface IAside {
|
||||
$promise: ng.IPromise<void>;
|
||||
show: () => void;
|
||||
hide: () => void;
|
||||
toggle: () => void;
|
||||
}
|
||||
|
||||
interface IAsideOptions {
|
||||
animation?: string;
|
||||
placement?: string;
|
||||
title?: string;
|
||||
content?: string;
|
||||
html?: boolean;
|
||||
backdrop?: boolean | string;
|
||||
keyboard?: boolean;
|
||||
show?: boolean;
|
||||
container?: string | boolean;
|
||||
template?: string;
|
||||
contentTemplate?: string;
|
||||
scope?: ng.IScope;
|
||||
}
|
||||
|
||||
interface IAsideScope extends ng.IScope {
|
||||
$show: () => void;
|
||||
$hide: () => void;
|
||||
$toggle: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Alert
|
||||
// see http://mgcrea.github.io/angular-strap/#/alerts
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module alert {
|
||||
|
||||
interface IAlertService {
|
||||
(config?: IAlertOptions): IAlert;
|
||||
}
|
||||
|
||||
interface IAlertProvider {
|
||||
defaults: IAlertOptions;
|
||||
}
|
||||
|
||||
interface IAlert {
|
||||
$promise: ng.IPromise<void>;
|
||||
show: () => void;
|
||||
hide: () => void;
|
||||
toggle: () => void;
|
||||
}
|
||||
|
||||
interface IAlertOptions {
|
||||
animation?: string;
|
||||
placement?: string;
|
||||
title?: string;
|
||||
content?: string;
|
||||
type?: string;
|
||||
keyboard?: boolean;
|
||||
show?: boolean;
|
||||
container?: string | boolean;
|
||||
template?: string;
|
||||
duration?: number | boolean;
|
||||
dismissable?: boolean;
|
||||
}
|
||||
|
||||
interface IAlertScope extends ng.IScope {
|
||||
$show: () => void;
|
||||
$hide: () => void;
|
||||
$toggle: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Tooltip
|
||||
// see http://mgcrea.github.io/angular-strap/#/tooltips
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module tooltip {
|
||||
|
||||
interface ITooltipService {
|
||||
(element: ng.IAugmentedJQuery, config?: ITooltipOptions): ITooltip;
|
||||
}
|
||||
|
||||
interface ITooltipProvider {
|
||||
defaults: ITooltipOptions;
|
||||
}
|
||||
|
||||
interface ITooltip {
|
||||
$promise: ng.IPromise<void>;
|
||||
show: () => void;
|
||||
hide: () => void;
|
||||
toggle: () => void;
|
||||
}
|
||||
|
||||
interface ITooltipOptions {
|
||||
animation?: string;
|
||||
placement?: string;
|
||||
trigger?: string;
|
||||
title?: string;
|
||||
html?: boolean;
|
||||
delay?: number | { show: number; hide: number};
|
||||
container?: string | boolean;
|
||||
target?: string | ng.IAugmentedJQuery | boolean;
|
||||
template?: string;
|
||||
contentTemplate?: string;
|
||||
prefixEvent?: string;
|
||||
id?: string;
|
||||
viewport?: string | { selector: string; padding: string | number };
|
||||
}
|
||||
|
||||
interface ITooltipScope extends ng.IScope {
|
||||
$show: () => void;
|
||||
$hide: () => void;
|
||||
$toggle: () => void;
|
||||
$setEnabled: (isEnabled: boolean) => void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Popover
|
||||
// see http://mgcrea.github.io/angular-strap/#/popovers
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module popover {
|
||||
|
||||
interface IPopoverService {
|
||||
(element: ng.IAugmentedJQuery, config?: IPopoverOptions): IPopover;
|
||||
}
|
||||
|
||||
interface IPopoverProvider {
|
||||
defaults: IPopoverOptions;
|
||||
}
|
||||
|
||||
interface IPopover {
|
||||
$promise: ng.IPromise<void>;
|
||||
show: () => void;
|
||||
hide: () => void;
|
||||
toggle: () => void;
|
||||
}
|
||||
|
||||
interface IPopoverOptions {
|
||||
animation?: string;
|
||||
placement?: string;
|
||||
trigger?: string;
|
||||
title?: string;
|
||||
content?: string;
|
||||
html?: boolean;
|
||||
delay?: number | { show: number; hide: number };
|
||||
container?: string | boolean;
|
||||
target?: string | ng.IAugmentedJQuery | boolean;
|
||||
template?: string;
|
||||
contentTemplate?: string;
|
||||
autoClose?: boolean;
|
||||
id?: string;
|
||||
viewport?: string | { selector: string; padding: string | number };
|
||||
}
|
||||
|
||||
interface IPopoverScope extends ng.IScope {
|
||||
$show: () => void;
|
||||
$hide: () => void;
|
||||
$toggle: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Typeahead
|
||||
// see http://mgcrea.github.io/angular-strap/#/typeaheads
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module typeahead {
|
||||
|
||||
interface ITypeaheadService {
|
||||
(element: ng.IAugmentedJQuery, controller: any, config?: ITypeaheadOptions): ITypeahead;
|
||||
}
|
||||
|
||||
interface ITypeaheadProvider {
|
||||
defaults: ITypeaheadOptions;
|
||||
}
|
||||
|
||||
interface ITypeahead {
|
||||
$promise: ng.IPromise<void>;
|
||||
show: () => void;
|
||||
hide: () => void;
|
||||
toggle: () => void;
|
||||
}
|
||||
|
||||
interface ITypeaheadOptions {
|
||||
animation?: string;
|
||||
placement?: string;
|
||||
trigger?: string;
|
||||
html?: boolean;
|
||||
delay?: number | { show: number; hide: number };
|
||||
container?: string | boolean;
|
||||
template?: string;
|
||||
limit?: number;
|
||||
minLength?: number;
|
||||
autoSelect?: boolean;
|
||||
comparator?: string;
|
||||
id?: string;
|
||||
watchOptions?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Datepicker
|
||||
// see http://mgcrea.github.io/angular-strap/#/datepickers
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module datepicker {
|
||||
|
||||
interface IDatepickerService {
|
||||
(element: ng.IAugmentedJQuery, controller: any, config?: IDatepickerOptions): IDatepicker;
|
||||
}
|
||||
|
||||
interface IDatepickerProvider {
|
||||
defaults: IDatepickerOptions;
|
||||
}
|
||||
|
||||
interface IDatepicker {
|
||||
update: (date: Date) => void;
|
||||
updateDisabledDates: (dateRanges: IDatepickerDateRange[]) => void;
|
||||
select: (dateConstructorArg: string | number | number[], keep: boolean) => void;
|
||||
setMode: (mode: any) => void;
|
||||
int: () => void;
|
||||
destroy: () => void;
|
||||
show: () => void;
|
||||
hide: () => void;
|
||||
}
|
||||
|
||||
interface IDatepickerDateRange {
|
||||
start: Date;
|
||||
end: Date;
|
||||
}
|
||||
|
||||
interface IDatepickerOptions {
|
||||
animation?: string;
|
||||
placement?: string;
|
||||
trigger?: string;
|
||||
html?: boolean;
|
||||
delay?: number | { show: number; hide: number };
|
||||
container?: string | boolean;
|
||||
template?: string;
|
||||
dateFormat?: string;
|
||||
modelDateFormat?: string;
|
||||
dateType?: string;
|
||||
timezone?: string;
|
||||
autoclose?: boolean;
|
||||
useNative?: boolean;
|
||||
minDate?: Date;
|
||||
maxDate?: Date;
|
||||
startView?: number;
|
||||
minView?: number;
|
||||
startWeek?: number;
|
||||
startDate?: Date;
|
||||
iconLeft?: string;
|
||||
iconRight?: string;
|
||||
daysOfWeekDisabled?: string;
|
||||
disabledDates?: IDatepickerDateRange[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Timepicker
|
||||
// see http://mgcrea.github.io/angular-strap/#/timepickers
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module timepicker {
|
||||
|
||||
interface ITimepickerService {
|
||||
(element: ng.IAugmentedJQuery, controller: any, config?: ITimepickerOptions): ITimepicker;
|
||||
}
|
||||
|
||||
interface ITimepickerProvider {
|
||||
defaults: ITimepickerOptions;
|
||||
}
|
||||
|
||||
interface ITimepicker {
|
||||
|
||||
}
|
||||
|
||||
interface ITimepickerOptions {
|
||||
animation?: string;
|
||||
placement?: string;
|
||||
trigger?: string;
|
||||
html?: boolean;
|
||||
delay?: number | { show: number; hide: number; };
|
||||
container?: string | boolean;
|
||||
template?: string;
|
||||
timeFormat?: string;
|
||||
modelTimeFormat?: string;
|
||||
timeType?: string;
|
||||
autoclose?: boolean;
|
||||
useNative?: boolean;
|
||||
minTime?: Date; // TODO
|
||||
maxTime?: Date; // TODO
|
||||
length?: number;
|
||||
hourStep?: number;
|
||||
minuteStep?: number;
|
||||
secondStep?: number;
|
||||
roundDisplay?: boolean;
|
||||
iconUp?: string;
|
||||
iconDown?: string;
|
||||
arrowBehaviour?: string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Button
|
||||
// see http://mgcrea.github.io/angular-strap/#/buttons
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// No definitions for this module
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Select
|
||||
// see http://mgcrea.github.io/angular-strap/#/selects
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module select {
|
||||
|
||||
interface ISelectService {
|
||||
(element: ng.IAugmentedJQuery, controller: any, config: ISelectOptions): ISelect;
|
||||
}
|
||||
|
||||
interface ISelectProvider {
|
||||
defaults: ISelectOptions;
|
||||
}
|
||||
|
||||
interface ISelect {
|
||||
update: (matches: any) => void;
|
||||
active: (index: number) => number;
|
||||
select: (index: number) => void;
|
||||
show: () => void;
|
||||
hide: () => void;
|
||||
}
|
||||
|
||||
interface ISelectOptions {
|
||||
animation?: string;
|
||||
placement?: string;
|
||||
trigger?: string;
|
||||
html?: boolean;
|
||||
delay?: number | { show: number; hide: number; };
|
||||
container?: string | boolean;
|
||||
template?: string;
|
||||
multiple?: boolean;
|
||||
allNoneButtons?: boolean;
|
||||
allText?: string;
|
||||
noneText?: string;
|
||||
maxLength?: number;
|
||||
maxLengthHtml?: string;
|
||||
sort?: boolean;
|
||||
placeholder?: string;
|
||||
iconCheckmark?: string;
|
||||
id?: string;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Tabs
|
||||
// see http://mgcrea.github.io/angular-strap/#/tabs
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module tab {
|
||||
|
||||
interface ITabProvider {
|
||||
defaults: ITabOptions;
|
||||
}
|
||||
|
||||
interface ITabService {
|
||||
defaults: ITabOptions;
|
||||
controller: any;
|
||||
}
|
||||
|
||||
interface ITabOptions {
|
||||
animation?: string;
|
||||
template?: string;
|
||||
navClass?: string;
|
||||
activeClass?: string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Collapses
|
||||
// see http://mgcrea.github.io/angular-strap/#/collapses
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module collapse {
|
||||
|
||||
interface ICollapseProvider {
|
||||
defaults: ICollapseOptions;
|
||||
}
|
||||
|
||||
interface ICollapseOptions {
|
||||
animation?: string;
|
||||
activeClass?: string;
|
||||
disallowToggle?: boolean;
|
||||
startCollapsed?: boolean;
|
||||
allowMultiple?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Dropdowsn
|
||||
// see http://mgcrea.github.io/angular-strap/#/dropdowns
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module dropdown {
|
||||
|
||||
interface IDropdownProvider {
|
||||
defaults: IDropdownOptions;
|
||||
}
|
||||
|
||||
interface IDropdownService {
|
||||
(element: ng.IAugmentedJQuery, config: IDropdownOptions): IDropdown;
|
||||
}
|
||||
|
||||
interface IDropdown {
|
||||
show: () => void;
|
||||
hide: () => void;
|
||||
destroy: () => void;
|
||||
}
|
||||
|
||||
interface IDropdownOptions {
|
||||
animation?: string;
|
||||
placement?: string;
|
||||
trigger?: string;
|
||||
html?: boolean;
|
||||
delay?: number | { show: number; hide: number; };
|
||||
container?: string | boolean;
|
||||
template?: string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Navbar
|
||||
// see http://mgcrea.github.io/angular-strap/#/navbars
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module navbar {
|
||||
|
||||
interface INavbarProvider {
|
||||
defaults: INavbarOptions;
|
||||
}
|
||||
|
||||
interface INavbarOptions {
|
||||
activeClass?: string;
|
||||
routeAttr?: string;
|
||||
}
|
||||
|
||||
interface INavbarService {
|
||||
defaults: INavbarOptions;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Scrollspy
|
||||
// see http://mgcrea.github.io/angular-strap/#/scrollspy
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module scrollspy {
|
||||
|
||||
interface IScrollspyProvider {
|
||||
defaults: IScrollspyOptions;
|
||||
}
|
||||
|
||||
interface IScrollspyService {
|
||||
(element: ng.IAugmentedJQuery, options: IScrollspyOptions): IScrollspy;
|
||||
}
|
||||
|
||||
interface IScrollspy {
|
||||
checkOffsets: () => void;
|
||||
trackElement: (target: any, source: any) => void;
|
||||
untrackElement: (target: any, source: any) => void;
|
||||
activate: (index: number) => void;
|
||||
}
|
||||
|
||||
interface IScrollspyOptions {
|
||||
target?: string;
|
||||
offset?: number;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Affix
|
||||
// see http://mgcrea.github.io/angular-strap/#/affix
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module affix {
|
||||
|
||||
interface IAffixProvider {
|
||||
defaults: IAffixOptions;
|
||||
}
|
||||
|
||||
interface IAffixService {
|
||||
(element: ng.IAugmentedJQuery, options: IAffixOptions): IAffix;
|
||||
}
|
||||
|
||||
interface IAffix {
|
||||
init: () => void;
|
||||
destroy: () => void;
|
||||
checkPositionWithEventLoop: () => void;
|
||||
checkPosition: () => void;
|
||||
}
|
||||
|
||||
interface IAffixOptions {
|
||||
offsetTop?: number;
|
||||
offsetBottom?: number;
|
||||
offsetParent?: number;
|
||||
offsetUnpin?: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/// <reference path='../angularjs/angular.d.ts' />
|
||||
/// <reference path='angular-toastr.d.ts' />
|
||||
|
||||
|
||||
angular
|
||||
.module('toastr-tests', ['toastr'])
|
||||
.config(function(toastrConfig: angular.toastr.IToastrConfig) {
|
||||
let toastContainerConfig: angular.toastr.IToastContainerConfig = {
|
||||
autoDismiss: false,
|
||||
containerId: 'toast-container',
|
||||
maxOpened: 0,
|
||||
newestOnTop: true,
|
||||
positionClass: 'toast-top-right',
|
||||
preventDuplicates: false,
|
||||
preventOpenDuplicates: false,
|
||||
target: 'body'
|
||||
},
|
||||
toastConfig: angular.toastr.IToastConfig = {
|
||||
allowHtml: false,
|
||||
closeButton: false,
|
||||
closeHtml: '<button>×</button>',
|
||||
extendedTimeOut: 1000,
|
||||
iconClasses: {
|
||||
error: 'toast-error',
|
||||
info: 'toast-info',
|
||||
success: 'toast-success',
|
||||
warning: 'toast-warning'
|
||||
},
|
||||
messageClass: 'toast-message',
|
||||
onHidden: null,
|
||||
onShown: null,
|
||||
onTap: null,
|
||||
progressBar: false,
|
||||
tapToDismiss: true,
|
||||
templates: {
|
||||
|
||||
toast: 'directives/toast/toast.html',
|
||||
progressbar: 'directives/progressbar/progressbar.html'
|
||||
},
|
||||
timeOut: 5000,
|
||||
titleClass: 'toast-title',
|
||||
toastClass: 'toast'
|
||||
};
|
||||
|
||||
angular.extend(toastrConfig, toastContainerConfig, toastConfig);
|
||||
})
|
||||
.controller('ToastrController', function(toastr: angular.toastr.IToastrService) {
|
||||
toastr.info('<input type="checkbox" checked> Success!', 'With HTML', {
|
||||
allowHtml: true
|
||||
});
|
||||
|
||||
toastr.success('What a nice button', 'Button spree', {
|
||||
closeButton: true
|
||||
});
|
||||
|
||||
toastr.info('What a nice apple button', 'Button spree', {
|
||||
closeButton: true,
|
||||
closeHtml: '<button></button>'
|
||||
});
|
||||
|
||||
toastr.info('I am totally custom!', 'Happy toast', {
|
||||
iconClass: 'toast-pink'
|
||||
});
|
||||
});
|
||||
Vendored
+121
@@ -0,0 +1,121 @@
|
||||
// Type definitions for Angular Toastr v1.6.0
|
||||
// Project: https://github.com/Foxandxss/angular-toastr
|
||||
// Definitions by: Niko Kovačič <https://github.com/nkovacic>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module "angular-toastr" {
|
||||
var _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module angular.toastr {
|
||||
interface IToastBaseConfig {
|
||||
allowHtml?: boolean;
|
||||
closeButton?: boolean;
|
||||
closeHtml?: string;
|
||||
extendedTimeOut?: number;
|
||||
messageClass?: string;
|
||||
onHidden?: Function;
|
||||
onShown?: Function;
|
||||
onTap?: Function;
|
||||
progressBar?: boolean;
|
||||
tapToDismiss?: boolean;
|
||||
templates?: {
|
||||
toast?: string;
|
||||
progressbar?: string;
|
||||
};
|
||||
timeOut?: number;
|
||||
titleClass?: string;
|
||||
toastClass?: string;
|
||||
}
|
||||
|
||||
interface IToastContainerConfig {
|
||||
autoDismiss?: boolean;
|
||||
containerId?: string;
|
||||
maxOpened?: number;
|
||||
newestOnTop?: boolean;
|
||||
positionClass?: string;
|
||||
preventDuplicates?: boolean;
|
||||
preventOpenDuplicates?: boolean;
|
||||
target?: string;
|
||||
}
|
||||
|
||||
interface IToastConfig extends IToastBaseConfig {
|
||||
iconClasses?: {
|
||||
error?: string;
|
||||
info?: string;
|
||||
success?: string;
|
||||
warning?: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface IToastrConfig extends IToastContainerConfig, IToastConfig { }
|
||||
|
||||
interface IToastScope extends angular.IScope {
|
||||
message: string;
|
||||
options: IToastConfig;
|
||||
title: string;
|
||||
toastId: number;
|
||||
toastType: string;
|
||||
}
|
||||
|
||||
interface IToast {
|
||||
el: angular.IAugmentedJQuery;
|
||||
iconClass: string;
|
||||
isOpened: boolean;
|
||||
open: angular.IPromise<any>;
|
||||
scope: IToastScope;
|
||||
toastId: number;
|
||||
}
|
||||
|
||||
interface IToastOptions extends IToastBaseConfig {
|
||||
iconClass?: string;
|
||||
}
|
||||
|
||||
interface IToastrService {
|
||||
/**
|
||||
* Return the number of active toasts in screen.
|
||||
*/
|
||||
active(): number;
|
||||
/**
|
||||
* Remove toast from screen. If no toast is passed in, all toasts will be closed.
|
||||
*
|
||||
* @param {IToast} toast Optional toast object to delete
|
||||
*/
|
||||
clear(toast?: IToast): void;
|
||||
/**
|
||||
* Create error toast notification message.
|
||||
*
|
||||
* @param {String} message Message to show on toast
|
||||
* @param {String} title Title to show on toast
|
||||
* @param {IToastOptions} options Override default toast options
|
||||
*/
|
||||
error(message: string, title?: string, options?: IToastOptions): IToast;
|
||||
/**
|
||||
* Create info toast notification message.
|
||||
*
|
||||
* @param {String} message Message to show on toast
|
||||
* @param {String} title Title to show on toast
|
||||
* @param {IToastOptions} options Override default toast options
|
||||
*/
|
||||
info(message: string, title?: string, options?: IToastOptions): IToast;
|
||||
/**
|
||||
* Create success toast notification message.
|
||||
*
|
||||
* @param {String} message Message to show on toast
|
||||
* @param {String} title Title to show on toast
|
||||
* @param {IToastOptions} options Override default toast options
|
||||
*/
|
||||
success(message: string, title?: string, options?: IToastOptions): IToast;
|
||||
/**
|
||||
* Create warning toast notification message.
|
||||
*
|
||||
* @param {String} message Message to show on toast
|
||||
* @param {String} title Title to show on toast
|
||||
* @param {IToastOptions} options Override default toast options
|
||||
*/
|
||||
warning(message: string, title?: string, options?: IToastOptions): IToast;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ app.config(($translateProvider: angular.translate.ITranslateProvider) => {
|
||||
$translateProvider.preferredLanguage('en');
|
||||
|
||||
$translateProvider.useLoader('customLoader');
|
||||
$translateProvider.forceAsyncReload(true);
|
||||
});
|
||||
|
||||
interface Scope extends ng.IScope {
|
||||
@@ -36,4 +37,9 @@ app.controller('Ctrl', ($scope: Scope, $translate: angular.translate.ITranslateS
|
||||
$scope['changeLanguage'] = function (key: any) {
|
||||
$translate.use(key);
|
||||
};
|
||||
}).run(($filter: ng.IFilterService) => {
|
||||
var x: string;
|
||||
x = $filter('translate')('something');
|
||||
x = $filter('translate')('something', {});
|
||||
x = $filter('translate')('something', {}, '');
|
||||
});
|
||||
|
||||
+12
-3
@@ -6,8 +6,8 @@
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module "angular-translate" {
|
||||
var _: string;
|
||||
export = _;
|
||||
import ngt = angular.translate;
|
||||
export = ngt;
|
||||
}
|
||||
|
||||
declare module angular.translate {
|
||||
@@ -22,7 +22,7 @@ declare module angular.translate {
|
||||
|
||||
interface IStorage {
|
||||
get(name: string): string;
|
||||
set(name: string, value: string): void;
|
||||
put(name: string, value: string): void;
|
||||
}
|
||||
|
||||
interface IStaticFilesLoaderOptions {
|
||||
@@ -87,6 +87,7 @@ declare module angular.translate {
|
||||
fallbackLanguage(): ITranslateProvider;
|
||||
fallbackLanguage(language: string): ITranslateProvider;
|
||||
fallbackLanguage(languages: string[]): ITranslateProvider;
|
||||
forceAsyncReload(value: boolean): ITranslateProvider;
|
||||
use(): string;
|
||||
use(key: string): ITranslateProvider;
|
||||
storageKey(): string;
|
||||
@@ -108,3 +109,11 @@ declare module angular.translate {
|
||||
useLoaderCache(cache?: any): ITranslateProvider;
|
||||
}
|
||||
}
|
||||
|
||||
declare module angular {
|
||||
interface IFilterService {
|
||||
(name:'translate'): {
|
||||
(translationId: string, interpolateParams?: any, interpolation?: string): string;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,8 +177,13 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
if (this.$state.href("myState") === "/myState") {
|
||||
//
|
||||
}
|
||||
this.$state.get("myState");
|
||||
this.$state.get();
|
||||
this.$state.get("myState");
|
||||
this.$state.get("myState", "yourState");
|
||||
this.$state.get("myState", this.$state.current);
|
||||
this.$state.get(this.$state.current);
|
||||
this.$state.get(this.$state.current, "yourState");
|
||||
this.$state.get(this.$state.current, this.$state.current);
|
||||
this.$state.reload();
|
||||
|
||||
// http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#properties
|
||||
@@ -230,7 +235,7 @@ module UrlRouterProviderTests {
|
||||
// this allows you to configure custom behavior in between
|
||||
// location changes and route synchronization:
|
||||
$urlRouterProvider.deferIntercept();
|
||||
}).run(($rootScope: ng.IRootScopeService, $urlRouter: ng.ui.IUrlRouterService, UserService: ITestUserService) => {
|
||||
}).run(($rootScope: ng.IRootScopeService, $urlRouter: ng.ui.IUrlRouterService, UserService: ITestUserService, $urlMatcher: ng.ui.IUrlMatcher) => {
|
||||
$rootScope.$on('$locationChangeSuccess', e => {
|
||||
// UserService is an example service for managing user state
|
||||
if (UserService.isLoggedIn()) return;
|
||||
@@ -245,6 +250,18 @@ module UrlRouterProviderTests {
|
||||
});
|
||||
|
||||
// Configures $urlRouter's listener *after* your custom listener
|
||||
$urlRouter.listen();
|
||||
var listen: Function = $urlRouter.listen();
|
||||
|
||||
var href: string;
|
||||
href = $urlRouter.href($urlMatcher);
|
||||
href = $urlRouter.href($urlMatcher, {});
|
||||
href = $urlRouter.href($urlMatcher, {}, {});
|
||||
|
||||
$urlRouter.update();
|
||||
$urlRouter.update(false);
|
||||
|
||||
$urlRouter.push($urlMatcher);
|
||||
$urlRouter.push($urlMatcher, {});
|
||||
$urlRouter.push($urlMatcher, {}, {});
|
||||
});
|
||||
}
|
||||
|
||||
+29
-5
@@ -5,10 +5,27 @@
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
// Support for AMD require
|
||||
// Support for AMD require and CommonJS
|
||||
declare module 'angular-ui-router' {
|
||||
var _: string;
|
||||
export = _;
|
||||
// Since angular-ui-router adds providers for a bunch of
|
||||
// injectable dependencies, it doesn't really return any
|
||||
// actual data except the plain string 'ui.router'.
|
||||
//
|
||||
// As such, I don't think anybody will ever use the actual
|
||||
// default value of the module. So I've only included the
|
||||
// the types. (@xogeny)
|
||||
export type IState = angular.ui.IState;
|
||||
export type IStateProvider = angular.ui.IStateProvider;
|
||||
export type IUrlMatcher = angular.ui.IUrlMatcher;
|
||||
export type IUrlRouterProvider = angular.ui.IUrlRouterProvider;
|
||||
export type IStateOptions = angular.ui.IStateOptions;
|
||||
export type IHrefOptions = angular.ui.IHrefOptions;
|
||||
export type IStateService = angular.ui.IStateService;
|
||||
export type IResolvedState = angular.ui.IResolvedState;
|
||||
export type IStateParamsService = angular.ui.IStateParamsService;
|
||||
export type IUrlRouterService = angular.ui.IUrlRouterService;
|
||||
export type IUiViewScrollProvider = angular.ui.IUiViewScrollProvider;
|
||||
export type IType = angular.ui.IType;
|
||||
}
|
||||
|
||||
declare module angular.ui {
|
||||
@@ -240,11 +257,15 @@ declare module angular.ui {
|
||||
transitionTo(state: string, params?: {}, options?: IStateOptions): angular.IPromise<any>;
|
||||
transitionTo(state: IState, params?: {}, options?: IStateOptions): angular.IPromise<any>;
|
||||
includes(state: string, params?: {}): boolean;
|
||||
includes(state: string, params?: {}, options?:any): boolean;
|
||||
is(state:string, params?: {}): boolean;
|
||||
is(state: IState, params?: {}): boolean;
|
||||
href(state: IState, params?: {}, options?: IHrefOptions): string;
|
||||
href(state: string, params?: {}, options?: IHrefOptions): string;
|
||||
get(state: string): IState;
|
||||
get(state: string, context?: string): IState;
|
||||
get(state: IState, context?: string): IState;
|
||||
get(state: string, context?: IState): IState;
|
||||
get(state: IState, context?: IState): IState;
|
||||
get(): IState[];
|
||||
/** A reference to the state's config object. However you passed it in. Useful for accessing custom data. */
|
||||
current: IState;
|
||||
@@ -283,7 +304,10 @@ declare module angular.ui {
|
||||
*
|
||||
*/
|
||||
sync(): void;
|
||||
listen(): void;
|
||||
listen(): Function;
|
||||
href(urlMatcher: IUrlMatcher, params?: IStateParamsService, options?: IHrefOptions): string;
|
||||
update(read?: boolean): void;
|
||||
push(urlMatcher: IUrlMatcher, params?: IStateParamsService, options?: IHrefOptions): void;
|
||||
}
|
||||
|
||||
interface IUiViewScrollProvider {
|
||||
|
||||
@@ -11,3 +11,73 @@ var treeNode2: AngularUITree.ITreeNode = {
|
||||
nodes: [treeNode],
|
||||
title: "test2"
|
||||
};
|
||||
|
||||
// fake jquery node here so that we can pull a pretend
|
||||
// angular scope element out of it
|
||||
var dummyJQueryNode: ng.IAugmentedJQuery;
|
||||
var fakeScope: (ng.IScope | AngularUITree.IParentTreeNodeScope) = dummyJQueryNode.scope();
|
||||
|
||||
(<AngularUITree.ITreeNodeScope> fakeScope).node = treeNode;
|
||||
|
||||
var treeNodeScope: AngularUITree.ITreeNodeScope = <AngularUITree.ITreeNodeScope> fakeScope;
|
||||
|
||||
(<AngularUITree.IParentTreeNodeScope> fakeScope).isParent = (nodeScope: AngularUITree.ITreeNodeScope) => {
|
||||
return true;
|
||||
};
|
||||
|
||||
var parentTreeNodeScope: AngularUITree.IParentTreeNodeScope = <AngularUITree.IParentTreeNodeScope> fakeScope;
|
||||
|
||||
var eventSourceInfo: AngularUITree.IEventSourceInfo = {
|
||||
cloneModel: {},
|
||||
nodeScope: treeNodeScope,
|
||||
index: 0,
|
||||
nodesScope: parentTreeNodeScope
|
||||
};
|
||||
|
||||
var position: AngularUITree.IPosition = {
|
||||
dirAx: 0,
|
||||
dirX: 0,
|
||||
dirY: 0,
|
||||
distAxX: 0,
|
||||
distAxY: 0,
|
||||
distX: 0,
|
||||
distY: 0,
|
||||
lastDirX: 0,
|
||||
lastDirY: 0,
|
||||
lastX: 0,
|
||||
lastY: 0,
|
||||
moving: true,
|
||||
nowX: 0,
|
||||
nowY: 0,
|
||||
offsetX: 0,
|
||||
offsetY: 0,
|
||||
startX: 0,
|
||||
startY: 0
|
||||
|
||||
};
|
||||
|
||||
var eventInfo: AngularUITree.IEventInfo = {
|
||||
source: eventSourceInfo,
|
||||
dest: {
|
||||
index: 0,
|
||||
nodesScope: parentTreeNodeScope
|
||||
},
|
||||
elements: {},
|
||||
pos: position
|
||||
};
|
||||
|
||||
var acceptCallback: AngularUITree.IAcceptCallback = (source: AngularUITree.ITreeNodeScope,
|
||||
destination: AngularUITree.ITreeNodeScope,
|
||||
destinationIndex: number) => {
|
||||
return false;
|
||||
};
|
||||
|
||||
var droppedCallback: AngularUITree.IDroppedCallback = (eventInfo: AngularUITree.IEventInfo) => {
|
||||
return;
|
||||
};
|
||||
|
||||
var callbacks: AngularUITree.ICallbacks = {
|
||||
accept: acceptCallback,
|
||||
dragStart: droppedCallback,
|
||||
dropped: droppedCallback
|
||||
};
|
||||
|
||||
Vendored
+65
@@ -3,7 +3,72 @@
|
||||
// Definitions by: Calvin Fernandez <https://github.com/CalvinFernandez>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path='../angularjs/angular.d.ts' />
|
||||
|
||||
declare module AngularUITree {
|
||||
interface IEventSourceInfo {
|
||||
cloneModel: any;
|
||||
index: number;
|
||||
nodeScope: ITreeNodeScope;
|
||||
nodesScope: ITreeNodeScope;
|
||||
}
|
||||
|
||||
interface IPosition {
|
||||
dirAx: number;
|
||||
dirX: number;
|
||||
dirY: number;
|
||||
distAxX: number;
|
||||
distAxY: number;
|
||||
distX: number;
|
||||
distY: number;
|
||||
lastDirX: number;
|
||||
lastDirY: number;
|
||||
lastX: number;
|
||||
lastY: number;
|
||||
moving: boolean;
|
||||
nowX: number;
|
||||
nowY: number;
|
||||
offsetX: number;
|
||||
offsetY: number;
|
||||
startX: number;
|
||||
startY: number;
|
||||
}
|
||||
|
||||
interface IEventInfo {
|
||||
dest: {
|
||||
index: number;
|
||||
nodesScope: IParentTreeNodeScope;
|
||||
};
|
||||
elements: any;
|
||||
pos: IPosition;
|
||||
source: IEventSourceInfo;
|
||||
}
|
||||
|
||||
interface IAcceptCallback {
|
||||
(source: ITreeNodeScope, destination: ITreeNodeScope, destinationIndex: number): boolean;
|
||||
}
|
||||
|
||||
interface IDroppedCallback {
|
||||
(eventInfo: IEventInfo): void;
|
||||
}
|
||||
|
||||
interface ICallbacks {
|
||||
accept: IAcceptCallback;
|
||||
dragStart: IDroppedCallback;
|
||||
dropped: IDroppedCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal representation of node in the UI
|
||||
*/
|
||||
interface ITreeNodeScope extends ng.IScope {
|
||||
node: ITreeNode;
|
||||
}
|
||||
|
||||
interface IParentTreeNodeScope extends ITreeNodeScope {
|
||||
isParent(nodeScope: ITreeNodeScope): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Node in list
|
||||
*/
|
||||
|
||||
@@ -1,68 +1,114 @@
|
||||
/// <reference path="../jasmine/jasmine.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="../angularjs/angular-mocks.d.ts" />
|
||||
|
||||
/// <reference path="angular-wizard.d.ts" />
|
||||
|
||||
// test file taken from https://github.com/mgonto/angular-wizard
|
||||
|
||||
|
||||
interface WizardScope extends ng.IScope {
|
||||
referenceCurrentStep:string;
|
||||
stepValidation:()=>void;
|
||||
finishedWizard:()=>void;
|
||||
enterValidation:()=>void;
|
||||
interface IWizardScope extends ng.IScope {
|
||||
referenceCurrentStep: string;
|
||||
stepValidation: () => void;
|
||||
finishedWizard: () => void;
|
||||
enterValidation: () => void;
|
||||
exitValidation: boolean;
|
||||
dynamicStepDisabled: string;
|
||||
}
|
||||
|
||||
describe('AngularWizard', function () {
|
||||
var $compile:ng.ICompileService,
|
||||
$rootScope:ng.IRootScopeService, WizardHandler:angular.mgoAngularWizard.WizardHandler, scope:WizardScope;
|
||||
var $compile: ng.ICompileService,
|
||||
$q: ng.IQService,
|
||||
$rootScope: ng.IRootScopeService,
|
||||
$timeout: ng.ITimeoutService,
|
||||
WizardHandler: angular.mgoAngularWizard.WizardHandler;
|
||||
|
||||
beforeEach(() => angular.module('mgo-angular-wizard'));
|
||||
|
||||
beforeEach(inject(function (_$compile_: ng.ICompileService,
|
||||
_$q_: ng.IQService,
|
||||
_$rootScope_: ng.IRootScopeService,
|
||||
_$timeout_: ng.ITimeoutService,
|
||||
_WizardHandler_: angular.mgoAngularWizard.WizardHandler) {
|
||||
$compile = _$compile_;
|
||||
$q = _$q_;
|
||||
$rootScope = _$rootScope_;
|
||||
$timeout = _$timeout_;
|
||||
WizardHandler = _WizardHandler_;
|
||||
}));
|
||||
|
||||
/**
|
||||
* Create the view with wizard to test
|
||||
* Create the generic view with wizard to test
|
||||
* @param {Scope} scope A scope to bind to
|
||||
* @return {[DOM element]} A DOM element compiled
|
||||
*/
|
||||
function createView(scope:WizardScope) {
|
||||
function createGenericView(scope: IWizardScope) {
|
||||
scope.referenceCurrentStep = null;
|
||||
var element = angular.element('<wizard on-finish="finishedWizard()" current-step="referenceCurrentStep" ng-init="msg = 14" >'
|
||||
+ ' <wz-step title="Starting" canenter="enterValidation">'
|
||||
+ ' <h1>This is the first step</h1>'
|
||||
+ ' <p>Here you can use whatever you want. You can use other directives, binding, etc.</p>'
|
||||
+ ' <input type="submit" wz-next value="Continue" />'
|
||||
+ ' </wz-step>'
|
||||
+ ' <wz-step title="Continuing" canexit="stepValidation">'
|
||||
+ ' <h1>Continuing</h1>'
|
||||
+ ' <p>You have continued here!</p>'
|
||||
+ ' <input type="submit" wz-next value="Go on" />'
|
||||
+ ' </wz-step>'
|
||||
+ ' <wz-step title="More steps" canenter="enterValidation">'
|
||||
+ ' <p>Even more steps!!</p>'
|
||||
+ ' <input type="submit" wz-next value="Finish now" />'
|
||||
+ ' </wz-step>'
|
||||
+ '</wizard>');
|
||||
+ ' <wz-step wz-title="Starting" canenter="enterValidation" description="Step description">'
|
||||
+ ' <h1>This is the first step</h1>'
|
||||
+ ' <p>Here you can use whatever you want. You can use other directives, binding, etc.</p>'
|
||||
+ ' <input type="submit" wz-next value="Continue" />'
|
||||
+ ' </wz-step>'
|
||||
+ ' <wz-step wz-title="Dynamic" wz-disabled="{{dynamicStepDisabled == \'Y\'}}">'
|
||||
+ ' <h1>Dynamic {{dynamicStepDisabled}}</h1>'
|
||||
+ ' <p>You have continued here!</p>'
|
||||
+ ' <input type="submit" wz-next value="Go on" />'
|
||||
+ ' </wz-step>'
|
||||
+ ' <wz-step wz-title="Continuing" canexit="stepValidation">'
|
||||
+ ' <h1>Continuing</h1>'
|
||||
+ ' <p>You have continued here!</p>'
|
||||
+ ' <input type="submit" wz-next value="Go on" />'
|
||||
+ ' </wz-step>'
|
||||
+ ' <wz-step wz-title="More steps" canenter="enterValidation">'
|
||||
+ ' <p>Even more steps!!</p>'
|
||||
+ ' <input type="submit" wz-next value="Finish now" />'
|
||||
+ ' </wz-step>'
|
||||
+ '</wizard>');
|
||||
var elementCompiled = $compile(element)(scope);
|
||||
$rootScope.$digest();
|
||||
return elementCompiled;
|
||||
}
|
||||
|
||||
it("should correctly create the wizard", function () {
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
var view = createGenericView(scope);
|
||||
expect(WizardHandler).toBeTruthy();
|
||||
expect(view.find('section').length).toEqual(3);
|
||||
expect(view.find('section').length).toEqual(4);
|
||||
// expect the correct step to be desirable one
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
});
|
||||
|
||||
it("should go to the next step", function () {
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
var view = createGenericView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().next();
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('Dynamic');
|
||||
});
|
||||
it("should render only those steps which are enabled", function () {
|
||||
var scope =<IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().next();
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('Continuing');
|
||||
});
|
||||
it("should enable or disable dynamic steps based on conditions", function () {
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
var view = createGenericView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
$rootScope.$digest();
|
||||
WizardHandler.wizard().goTo(2);
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('More steps');
|
||||
});
|
||||
it("should return to a previous step", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().next();
|
||||
$rootScope.$digest();
|
||||
@@ -72,24 +118,27 @@ describe('AngularWizard', function () {
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
});
|
||||
it("should go to a step specified by name", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().goTo('More steps');
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('More steps');
|
||||
});
|
||||
it("should go to a step specified by index", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().goTo(2);
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('More steps');
|
||||
});
|
||||
it("should go to next step becasue callback is truthy", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().next(function () {
|
||||
return true
|
||||
@@ -98,8 +147,9 @@ describe('AngularWizard', function () {
|
||||
expect(scope.referenceCurrentStep).toEqual('Continuing');
|
||||
});
|
||||
it("should NOT go to next step because callback is falsey", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().next(function () {
|
||||
return false
|
||||
@@ -108,16 +158,18 @@ describe('AngularWizard', function () {
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
});
|
||||
it("should go to next step because CANEXIT is UNDEFINED", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().next();
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('Continuing');
|
||||
});
|
||||
it("should go to next step because CANEXIT is TRUE", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
scope.stepValidation = function () {
|
||||
return true;
|
||||
};
|
||||
@@ -130,8 +182,9 @@ describe('AngularWizard', function () {
|
||||
expect(scope.referenceCurrentStep).toEqual('More steps');
|
||||
});
|
||||
it("should NOT go to next step because CANEXIT is FALSE", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
scope.stepValidation = function () {
|
||||
return false;
|
||||
};
|
||||
@@ -144,8 +197,9 @@ describe('AngularWizard', function () {
|
||||
expect(scope.referenceCurrentStep).toEqual('Continuing');
|
||||
});
|
||||
it("should go to next step because CANENTER is TRUE", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
scope.enterValidation = function () {
|
||||
return true;
|
||||
};
|
||||
@@ -158,8 +212,9 @@ describe('AngularWizard', function () {
|
||||
expect(scope.referenceCurrentStep).toEqual('More steps');
|
||||
});
|
||||
it("should NOT go to next step because CANENTER is FALSE", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
scope.enterValidation = function () {
|
||||
return false;
|
||||
};
|
||||
@@ -172,8 +227,9 @@ describe('AngularWizard', function () {
|
||||
expect(scope.referenceCurrentStep).toEqual('Continuing');
|
||||
});
|
||||
it("should NOT return to a previous step. Although CANEXIT is false and we are heading to a previous state, the can enter validation is false", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
scope.stepValidation = function () {
|
||||
return false;
|
||||
};
|
||||
@@ -189,8 +245,9 @@ describe('AngularWizard', function () {
|
||||
expect(scope.referenceCurrentStep).toEqual('Continuing');
|
||||
});
|
||||
it("should return to a previous step even though CANEXIT is false", function () {
|
||||
|
||||
var view = createView(scope);
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
scope.stepValidation = function () {
|
||||
return false;
|
||||
};
|
||||
@@ -202,17 +259,66 @@ describe('AngularWizard', function () {
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
});
|
||||
it("should finish", function () {
|
||||
|
||||
var flag = false;
|
||||
scope.finishedWizard = function () {
|
||||
flag = true;
|
||||
it("should go to the next step because the promise that CANENTER returns resolves to true", function (done) {
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
scope.enterValidation = function () {
|
||||
var deferred = $q.defer();
|
||||
$timeout(function () {
|
||||
deferred.resolve(true);
|
||||
done();
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
var view = createView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().next();
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('Continuing');
|
||||
WizardHandler.wizard().next();
|
||||
$timeout.flush();
|
||||
expect(scope.referenceCurrentStep).toEqual('More steps');
|
||||
});
|
||||
it("should go to the next step because CANEXIT is set to true", function () {
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
scope.exitValidation = true;
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().next();
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('Continuing');
|
||||
WizardHandler.wizard().next();
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('More steps');
|
||||
});
|
||||
it("should finish", function () {
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var flag = false;
|
||||
scope.finishedWizard = function () { flag = true; };
|
||||
var view = createGenericView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().finish();
|
||||
expect(flag).toBeTruthy();
|
||||
$rootScope.$digest();
|
||||
});
|
||||
it("should go to first step when reset is called", function () {
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
WizardHandler.wizard().goTo(2);
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('More steps');
|
||||
WizardHandler.wizard().reset();
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
});
|
||||
it("step description should be accessible", function () {
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
expect((<any>view.isolateScope()).steps[0].description).toEqual('Step description');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Vendored
+28
-11
@@ -1,21 +1,38 @@
|
||||
// Type definitions for Angular Wizard 0.4.2
|
||||
// Type definitions for Angular Wizard 0.6.1
|
||||
// Project: https://github.com/mgonto/angular-wizard
|
||||
// Definitions by: Marko Jurisic <https://github.com/mjurisic>
|
||||
// Definitions by: Marko Jurisic <https://github.com/mjurisic>, Ronald Wildenberg <https://github.com/rwwilden>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module angular.mgoAngularWizard {
|
||||
interface WizardHandler {
|
||||
wizard(name?:string): Wizard;
|
||||
addWizard(name:string, wizard:Wizard):void;
|
||||
removeWizard(name:string):void;
|
||||
wizard(name?: string): Wizard;
|
||||
addWizard(name: string, wizard: Wizard): void;
|
||||
removeWizard(name: string): void;
|
||||
}
|
||||
|
||||
interface Wizard {
|
||||
next(nextHandler?:Function):void;
|
||||
previous():void;
|
||||
goTo(step:number):void;
|
||||
goTo(step:string):void;
|
||||
finish():void;
|
||||
currentStepNumber():number;
|
||||
next(nextHandler?: () => boolean): void;
|
||||
previous(): void;
|
||||
cancel: () => void;
|
||||
goTo(step: number | string): void;
|
||||
finish(): void;
|
||||
reset: () => void;
|
||||
|
||||
addStep: (step: WzStep) => void;
|
||||
currentStep: () => WzStep;
|
||||
currentStepNumber(): number;
|
||||
currentStepDescription: () => string;
|
||||
currentStepTitle: () => string;
|
||||
getEnabledSteps(): WzStep[];
|
||||
}
|
||||
|
||||
interface WzStep {
|
||||
canenter: (...args: any[]) => boolean;
|
||||
canexit: (...args: any[]) => boolean;
|
||||
description: string;
|
||||
selected: boolean;
|
||||
title: string;
|
||||
wzData: any;
|
||||
wzTitle: string;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ To avoid cluttering the list of suggestions as you type in your IDE, all interfa
|
||||
|
||||
**ngMockE2E** does not define a new namespace, but rather modifies some of **ng**'s interfaces.
|
||||
|
||||
Bellow is an example of how to use the interfaces:
|
||||
Below is an example of how to use the interfaces:
|
||||
```ts
|
||||
function MainController($scope: ng.IScope, $http: ng.IHttpService) {
|
||||
// code assistance will now be available for $scope and $http
|
||||
|
||||
+432
@@ -0,0 +1,432 @@
|
||||
// Type definitions for Angular JS 1.5 component router
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: David Reher <http://github.com/davidreher>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="./angular.d.ts" />
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts" />
|
||||
|
||||
declare module angular {
|
||||
/**
|
||||
* `Instruction` is a tree of {@link ComponentInstruction}s with all the information needed
|
||||
* to transition each component in the app to a given route, including all auxiliary routes.
|
||||
*
|
||||
* `Instruction`s can be created using {@link Router#generate}, and can be used to
|
||||
* perform route changes with {@link Router#navigateByInstruction}.
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* ```
|
||||
* import {Component} from 'angular2/core';
|
||||
* import {bootstrap} from 'angular2/platform/browser';
|
||||
* import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from 'angular2/router';
|
||||
*
|
||||
* @Component({directives: [ROUTER_DIRECTIVES]})
|
||||
* @RouteConfig([
|
||||
* {...},
|
||||
* ])
|
||||
* class AppCmp {
|
||||
* constructor(router: Router) {
|
||||
* var instruction = router.generate(['/MyRoute']);
|
||||
* router.navigateByInstruction(instruction);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* bootstrap(AppCmp, ROUTER_PROVIDERS);
|
||||
* ```
|
||||
*/
|
||||
interface Instruction {
|
||||
component: ComponentInstruction;
|
||||
child: Instruction;
|
||||
auxInstruction: {[key: string]: Instruction};
|
||||
|
||||
urlPath(): string;
|
||||
|
||||
urlParams(): string[];
|
||||
|
||||
specificity(): number;
|
||||
|
||||
resolveComponent(): Promise<ComponentInstruction>;
|
||||
|
||||
/**
|
||||
* converts the instruction into a URL string
|
||||
*/
|
||||
toRootUrl(): string;
|
||||
|
||||
toUrlQuery(): string;
|
||||
|
||||
/**
|
||||
* Returns a new instruction that shares the state of the existing instruction, but with
|
||||
* the given child {@link Instruction} replacing the existing child.
|
||||
*/
|
||||
replaceChild(child: Instruction): Instruction;
|
||||
|
||||
/**
|
||||
* If the final URL for the instruction is ``
|
||||
*/
|
||||
toUrlPath(): string;
|
||||
|
||||
/**
|
||||
* default instructions override these
|
||||
*/
|
||||
toLinkUrl(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
|
||||
*
|
||||
* ## Use
|
||||
*
|
||||
* ```
|
||||
* <router-outlet></router-outlet>
|
||||
* ```
|
||||
*/
|
||||
interface RouterOutlet {
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Called by the Router to instantiate a new component during the commit phase of a navigation.
|
||||
* This method in turn is responsible for calling the `routerOnActivate` hook of its child.
|
||||
*/
|
||||
activate(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during the commit phase of a navigation when an outlet
|
||||
* reuses a component between different routes.
|
||||
* This method in turn is responsible for calling the `routerOnReuse` hook of its child.
|
||||
*/
|
||||
reuse(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} when an outlet disposes of a component's contents.
|
||||
* This method in turn is responsible for calling the `routerOnDeactivate` hook of its child.
|
||||
*/
|
||||
deactivate(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If this resolves to `false`, the given navigation is cancelled.
|
||||
*
|
||||
* This method delegates to the child component's `routerCanDeactivate` hook if it exists,
|
||||
* and otherwise resolves to true.
|
||||
*/
|
||||
routerCanDeactivate(nextInstruction: ComponentInstruction): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If the new child component has a different Type than the existing child component,
|
||||
* this will resolve to `false`. You can't reuse an old component when the new component
|
||||
* is of a different Type.
|
||||
*
|
||||
* Otherwise, this method delegates to the child component's `routerCanReuse` hook if it exists,
|
||||
* or resolves to true if the hook is not present.
|
||||
*/
|
||||
routerCanReuse(nextInstruction: ComponentInstruction): Promise<boolean>;
|
||||
}
|
||||
|
||||
interface RouteRegistry {
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent: any, config: RouteDefinition): void;
|
||||
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component: any): void;
|
||||
|
||||
/**
|
||||
* Given a URL and a parent component, return the most specific instruction for navigating
|
||||
* the application into the state specified by the url
|
||||
*/
|
||||
recognize(url: string, ancestorInstructions: Instruction[]): Promise<Instruction>;
|
||||
|
||||
/**
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*
|
||||
* If the optional param `_aux` is `true`, then we generate starting at an auxiliary
|
||||
* route boundary.
|
||||
*/
|
||||
generate(linkParams: any[], ancestorInstructions: Instruction[], _aux?: boolean): Instruction;
|
||||
|
||||
hasRoute(name: string, parentComponent: any): boolean;
|
||||
|
||||
generateDefault(componentCursor: any): Instruction;
|
||||
}
|
||||
|
||||
/**
|
||||
* The `Router` is responsible for mapping URLs to components.
|
||||
*
|
||||
* You can see the state of the router by inspecting the read-only field `router.navigating`.
|
||||
* This may be useful for showing a spinner, for instance.
|
||||
*
|
||||
* ## Concepts
|
||||
*
|
||||
* Routers and component instances have a 1:1 correspondence.
|
||||
*
|
||||
* The router holds reference to a number of {@link RouterOutlet}.
|
||||
* An outlet is a placeholder that the router dynamically fills in depending on the current URL.
|
||||
*
|
||||
* When the router navigates from a URL, it must first recognize it and serialize it into an
|
||||
* `Instruction`.
|
||||
* The router uses the `RouteRegistry` to get an `Instruction`.
|
||||
*/
|
||||
interface Router {
|
||||
navigating: boolean;
|
||||
lastNavigationAttempt: string;
|
||||
registry: RouteRegistry;
|
||||
parent: Router;
|
||||
hostComponent: any;
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
childRouter(hostComponent: any): Router;
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
auxRouter(hostComponent: any): Router;
|
||||
|
||||
/**
|
||||
* Register an outlet to be notified of primary route changes.
|
||||
*
|
||||
* You probably don't need to use this unless you're writing a reusable component.
|
||||
*/
|
||||
registerPrimaryOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Register an outlet to notified of auxiliary route changes.
|
||||
*
|
||||
* You probably don't need to use this unless you're writing a reusable component.
|
||||
*/
|
||||
registerAuxOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Given an instruction, returns `true` if the instruction is currently active,
|
||||
* otherwise `false`.
|
||||
*/
|
||||
isRouteActive(instruction: Instruction): boolean;
|
||||
|
||||
/**
|
||||
* Dynamically update the routing configuration and trigger a navigation.
|
||||
*
|
||||
* ### Usage
|
||||
*
|
||||
* ```
|
||||
* router.config([
|
||||
* { 'path': '/', 'component': IndexComp },
|
||||
* { 'path': '/user/:id', 'component': UserComp },
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(definitions: RouteDefinition[]): Promise<any>;
|
||||
|
||||
/**
|
||||
* Navigate based on the provided Route Link DSL. It's preferred to navigate with this method
|
||||
* over `navigateByUrl`.
|
||||
*
|
||||
* ### Usage
|
||||
*
|
||||
* This method takes an array representing the Route Link DSL:
|
||||
* ```
|
||||
* ['./MyCmp', {param: 3}]
|
||||
* ```
|
||||
* See the {@link RouterLink} directive for more.
|
||||
*/
|
||||
navigate(linkParams: any[]): Promise<any>;
|
||||
|
||||
/**
|
||||
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
|
||||
* It's preferred to navigate with `navigate` instead of this method, since URLs are more brittle.
|
||||
*
|
||||
* If the given URL begins with a `/`, router will navigate absolutely.
|
||||
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
||||
*/
|
||||
navigateByUrl(url: string, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
/**
|
||||
* Navigate via the provided instruction. Returns a promise that resolves when navigation is
|
||||
* complete.
|
||||
*/
|
||||
navigateByInstruction(instruction: Instruction,
|
||||
_skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
/**
|
||||
* Updates this router and all descendant routers according to the given instruction
|
||||
*/
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: (value: any) => void): Object;
|
||||
|
||||
/**
|
||||
* Removes the contents of this router's outlet and all descendant outlets
|
||||
*/
|
||||
deactivate(instruction: Instruction): Promise<any>;
|
||||
|
||||
/**
|
||||
* Given a URL, returns an instruction representing the component graph
|
||||
*/
|
||||
recognize(url: string): Promise<Instruction>;
|
||||
|
||||
/**
|
||||
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
|
||||
* router has yet to successfully navigate.
|
||||
*/
|
||||
renavigate(): Promise<any>;
|
||||
|
||||
/**
|
||||
* Generate an `Instruction` based on the provided Route Link DSL.
|
||||
*/
|
||||
generate(linkParams: any[]): Instruction;
|
||||
}
|
||||
|
||||
/**
|
||||
* RouteData is an immutable map of additional data you can configure in your Route.
|
||||
* You can inject RouteData into the constructor of a component to use it.
|
||||
*/
|
||||
interface RouteData {
|
||||
data: {[key: string]: any};
|
||||
get(key: string): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* A `ComponentInstruction` represents the route state for a single component. An `Instruction` is
|
||||
* composed of a tree of these `ComponentInstruction`s.
|
||||
*
|
||||
* `ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed
|
||||
* to route lifecycle hooks, like {@link CanActivate}.
|
||||
*
|
||||
* `ComponentInstruction`s are [https://en.wikipedia.org/wiki/Hash_consing](hash consed). You should
|
||||
* never construct one yourself with "new." Instead, rely on {@link Router/RouteRecognizer} to
|
||||
* construct `ComponentInstruction`s.
|
||||
*
|
||||
* You should not modify this object. It should be treated as immutable.
|
||||
*/
|
||||
interface ComponentInstruction {
|
||||
reuse: boolean;
|
||||
routeData: RouteData;
|
||||
urlPath: string;
|
||||
urlParams: string[];
|
||||
data: RouteData;
|
||||
componentType: any;
|
||||
terminal: boolean;
|
||||
specificity: number;
|
||||
params: {[key: string]: any};
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method `routerOnActivate`, which is called by the router at the end of a
|
||||
* successful route navigation.
|
||||
*
|
||||
* For a single component's navigation, only one of either {@link OnActivate} or {@link OnReuse}
|
||||
* will be called depending on the result of {@link CanReuse}.
|
||||
*
|
||||
* The `routerOnActivate` hook is called with two {@link ComponentInstruction}s as parameters, the
|
||||
* first
|
||||
* representing the current route being navigated to, and the second parameter representing the
|
||||
* previous route or `null`.
|
||||
*
|
||||
* If `routerOnActivate` returns a promise, the route change will wait until the promise settles to
|
||||
* instantiate and activate child components.
|
||||
*
|
||||
* ### Example
|
||||
* {@example router/ts/on_activate/on_activate_example.ts region='routerOnActivate'}
|
||||
*/
|
||||
interface OnActivate {
|
||||
$routerOnActivate(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method `routerCanDeactivate`, which is called by the router to determine
|
||||
* if a component can be removed as part of a navigation.
|
||||
*
|
||||
* The `routerCanDeactivate` hook is called with two {@link ComponentInstruction}s as parameters,
|
||||
* the
|
||||
* first representing the current route being navigated to, and the second parameter
|
||||
* representing the previous route.
|
||||
*
|
||||
* If `routerCanDeactivate` returns or resolves to `false`, the navigation is cancelled. If it
|
||||
* returns or
|
||||
* resolves to `true`, then the navigation continues, and the component will be deactivated
|
||||
* (the {@link OnDeactivate} hook will be run) and removed.
|
||||
*
|
||||
* If `routerCanDeactivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
* ### Example
|
||||
* {@example router/ts/can_deactivate/can_deactivate_example.ts region='routerCanDeactivate'}
|
||||
*/
|
||||
interface CanDeactivate {
|
||||
$routerCanDeactivate(next?: ComponentInstruction, prev?: ComponentInstruction): boolean | Promise<boolean>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method `routerOnDeactivate`, which is called by the router before
|
||||
* destroying
|
||||
* a component as part of a route change.
|
||||
*
|
||||
* The `routerOnDeactivate` hook is called with two {@link ComponentInstruction}s as parameters, the
|
||||
* first
|
||||
* representing the current route being navigated to, and the second parameter representing the
|
||||
* previous route.
|
||||
*
|
||||
* If `routerOnDeactivate` returns a promise, the route change will wait until the promise settles.
|
||||
*
|
||||
* ### Example
|
||||
* {@example router/ts/on_deactivate/on_deactivate_example.ts region='routerOnDeactivate'}
|
||||
*/
|
||||
interface OnDeactivate {
|
||||
$routerOnDeactivate(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method `routerCanReuse`, which is called by the router to determine
|
||||
* whether a
|
||||
* component should be reused across routes, or whether to destroy and instantiate a new component.
|
||||
*
|
||||
* The `routerCanReuse` hook is called with two {@link ComponentInstruction}s as parameters, the
|
||||
* first
|
||||
* representing the current route being navigated to, and the second parameter representing the
|
||||
* previous route.
|
||||
*
|
||||
* If `routerCanReuse` returns or resolves to `true`, the component instance will be reused and the
|
||||
* {@link OnDeactivate} hook will be run. If `routerCanReuse` returns or resolves to `false`, a new
|
||||
* component will be instantiated, and the existing component will be deactivated and removed as
|
||||
* part of the navigation.
|
||||
*
|
||||
* If `routerCanReuse` throws or rejects, the navigation will be cancelled.
|
||||
*
|
||||
* ### Example
|
||||
* {@example router/ts/reuse/reuse_example.ts region='reuseCmp'}
|
||||
*/
|
||||
interface CanReuse {
|
||||
$routerCanReuse(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): boolean | Promise<boolean>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method `routerOnReuse`, which is called by the router at the end of a
|
||||
* successful route navigation when {@link CanReuse} is implemented and returns or resolves to true.
|
||||
*
|
||||
* For a single component's navigation, only one of either {@link OnActivate} or {@link OnReuse}
|
||||
* will be called, depending on the result of {@link CanReuse}.
|
||||
*
|
||||
* The `routerOnReuse` hook is called with two {@link ComponentInstruction}s as parameters, the
|
||||
* first
|
||||
* representing the current route being navigated to, and the second parameter representing the
|
||||
* previous route or `null`.
|
||||
*
|
||||
* ### Example
|
||||
* {@example router/ts/reuse/reuse_example.ts region='reuseCmp'}
|
||||
*/
|
||||
interface OnReuse {
|
||||
$routerOnReuse(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): any;
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,9 @@ resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () {
|
||||
|
||||
var promise : angular.IPromise<IMyResource>;
|
||||
var arrayPromise : angular.IPromise<IMyResource[]>;
|
||||
var json: {
|
||||
[index: string]: any;
|
||||
};
|
||||
|
||||
promise = resource.$delete();
|
||||
promise = resource.$delete({ key: 'value' });
|
||||
@@ -127,6 +130,8 @@ promise = resource.$save(function () { });
|
||||
promise = resource.$save(function () { }, function () { });
|
||||
promise = resource.$save({ key: 'value' }, function () { }, function () { });
|
||||
|
||||
json = resource.toJSON();
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResourceService
|
||||
///////////////////////////////////////
|
||||
|
||||
Vendored
+8
-1
@@ -5,6 +5,10 @@
|
||||
|
||||
/// <reference path="angular.d.ts" />
|
||||
|
||||
declare module 'angular-resource' {
|
||||
var _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ngResource module (angular-resource.js)
|
||||
@@ -136,12 +140,15 @@ declare module angular.resource {
|
||||
/** the promise of the original server interaction that created this instance. **/
|
||||
$promise : angular.IPromise<T>;
|
||||
$resolved : boolean;
|
||||
toJSON: () => {
|
||||
[index: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Really just a regular Array object with $promise and $resolve attached to it
|
||||
*/
|
||||
interface IResourceArray<T> extends Array<T> {
|
||||
interface IResourceArray<T> extends Array<T & IResource<T>> {
|
||||
/** the promise of the original server interaction that created this collection. **/
|
||||
$promise : angular.IPromise<IResourceArray<T>>;
|
||||
$resolved : boolean;
|
||||
|
||||
Vendored
+16
@@ -35,6 +35,16 @@ declare module angular.route {
|
||||
// May not always be available. For instance, current will not be available
|
||||
// to a controller that was not initialized as a result of a route maching.
|
||||
current?: ICurrentRoute;
|
||||
|
||||
/**
|
||||
* Causes $route service to update the current URL, replacing current route parameters with those specified in newParams.
|
||||
* Provided property names that match the route's path segment definitions will be interpolated into the
|
||||
* location's path, while remaining properties will be treated as query params.
|
||||
*
|
||||
* @param newParams Object.<string, string> mapping of URL parameter names to values
|
||||
*/
|
||||
updateParams(newParams:{[key:string]:string}): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +128,12 @@ declare module angular.route {
|
||||
}
|
||||
|
||||
interface IRouteProvider extends IServiceProvider {
|
||||
/**
|
||||
* Match routes without being case sensitive
|
||||
*
|
||||
* This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive
|
||||
*/
|
||||
caseInsensitiveMatch?: boolean;
|
||||
/**
|
||||
* Sets route definition that will be used on route change when no other route definition is matched.
|
||||
*
|
||||
|
||||
Vendored
+121
-2
@@ -165,6 +165,12 @@ declare module angular {
|
||||
dot: number;
|
||||
codeName: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called.
|
||||
* @param extraModules An optional array of modules that should be added to the original list of modules that the app was about to be bootstrapped with.
|
||||
*/
|
||||
resumeBootstrap?(extraModules?: string[]): ng.auto.IInjectorService;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -175,6 +181,13 @@ declare module angular {
|
||||
animation(name: string, animationFactory: Function): IModule;
|
||||
animation(name: string, inlineAnnotatedFunction: any[]): IModule;
|
||||
animation(object: Object): IModule;
|
||||
/**
|
||||
* Use this method to register a component.
|
||||
*
|
||||
* @param name The name of the component.
|
||||
* @param options A definition object passed into the component.
|
||||
*/
|
||||
component(name: string, options: IComponentOptions): IModule;
|
||||
/**
|
||||
* Use this method to register work which needs to be performed on module loading.
|
||||
*
|
||||
@@ -615,7 +628,7 @@ declare module angular {
|
||||
// see http://docs.angularjs.org/api/ng.$interval
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IIntervalService {
|
||||
(func: Function, delay: number, count?: number, invokeApply?: boolean): IPromise<any>;
|
||||
(func: Function, delay: number, count?: number, invokeApply?: boolean, ...args: any[]): IPromise<any>;
|
||||
cancel(promise: IPromise<any>): boolean;
|
||||
}
|
||||
|
||||
@@ -774,7 +787,7 @@ declare module angular {
|
||||
* @param reverse Reverse the order of the array.
|
||||
* @return Reverse the order of the array.
|
||||
*/
|
||||
<T>(array: T[], expression: string|string[]|((value: T) => any)|((value: T) => any)[], reverse?: boolean): T[];
|
||||
<T>(array: T[], expression: string|((value: T) => any)|(((value: T) => any)|string)[], reverse?: boolean): T[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1614,6 +1627,110 @@ declare module angular {
|
||||
totalPendingRequests: number;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Component
|
||||
// see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html
|
||||
// and http://toddmotto.com/exploring-the-angular-1-5-component-method/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Runtime representation a type that a Component or other object is instances of.
|
||||
*
|
||||
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
|
||||
* the `MyCustomComponent` constructor function.
|
||||
*/
|
||||
interface Type extends Function {
|
||||
}
|
||||
|
||||
/**
|
||||
* `RouteDefinition` defines a route within a {@link RouteConfig} decorator.
|
||||
*
|
||||
* Supported keys:
|
||||
* - `path` or `aux` (requires exactly one of these)
|
||||
* - `component`, `loader`, `redirectTo` (requires exactly one of these)
|
||||
* - `name` or `as` (optional) (requires exactly one of these)
|
||||
* - `data` (optional)
|
||||
*
|
||||
* See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}.
|
||||
*/
|
||||
interface RouteDefinition {
|
||||
path?: string;
|
||||
aux?: string;
|
||||
component?: Type | ComponentDefinition | string;
|
||||
loader?: Function;
|
||||
redirectTo?: any[];
|
||||
as?: string;
|
||||
name?: string;
|
||||
data?: any;
|
||||
useAsDefault?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents either a component type (`type` is `component`) or a loader function
|
||||
* (`type` is `loader`).
|
||||
*
|
||||
* See also {@link RouteDefinition}.
|
||||
*/
|
||||
interface ComponentDefinition {
|
||||
type: string;
|
||||
loader?: Function;
|
||||
component?: Type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component definition object (a simplified directive definition object)
|
||||
*/
|
||||
interface IComponentOptions {
|
||||
/**
|
||||
* Controller constructor function that should be associated with newly created scope or the name of a registered
|
||||
* controller if passed as a string. Empty function by default.
|
||||
*/
|
||||
controller?: string | Function;
|
||||
/**
|
||||
* An identifier name for a reference to the controller. If present, the controller will be published to scope under
|
||||
* the controllerAs name. If not present, this will default to be the same as the component name.
|
||||
*/
|
||||
controllerAs?: string;
|
||||
/**
|
||||
* html template as a string or a function that returns an html template as a string which should be used as the
|
||||
* contents of this component. Empty string by default.
|
||||
* If template is a function, then it is injected with the following locals:
|
||||
* $element - Current element
|
||||
* $attrs - Current attributes object for the element
|
||||
*/
|
||||
template?: string | Function;
|
||||
/**
|
||||
* path or function that returns a path to an html template that should be used as the contents of this component.
|
||||
* If templateUrl is a function, then it is injected with the following locals:
|
||||
* $element - Current element
|
||||
* $attrs - Current attributes object for the element
|
||||
*/
|
||||
templateUrl?: string | Function;
|
||||
/**
|
||||
* Define DOM attribute binding to component properties. Component properties are always bound to the component
|
||||
* controller and not to the scope.
|
||||
*/
|
||||
bindings?: any;
|
||||
/**
|
||||
* Whether transclusion is enabled. Enabled by default.
|
||||
*/
|
||||
transclude?: boolean;
|
||||
/**
|
||||
* Whether the new scope is isolated. Isolated by default.
|
||||
*/
|
||||
isolate?: boolean;
|
||||
/**
|
||||
* String of subset of EACM which restricts the component to specific directive declaration style. If omitted,
|
||||
* this defaults to 'E'.
|
||||
*/
|
||||
restrict?: string;
|
||||
$canActivate?: () => boolean;
|
||||
$routeConfig?: RouteDefinition[];
|
||||
}
|
||||
|
||||
interface IComponentTemplateFn {
|
||||
( $element?: IAugmentedJQuery, $attrs?: IAttributes ): string;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Directive
|
||||
// see http://docs.angularjs.org/api/ng.$compileProvider#directive
|
||||
@@ -1660,6 +1777,7 @@ declare module angular {
|
||||
restrict?: string;
|
||||
scope?: any;
|
||||
template?: any;
|
||||
templateNamespace?: string;
|
||||
templateUrl?: any;
|
||||
terminal?: boolean;
|
||||
transclude?: any;
|
||||
@@ -1758,6 +1876,7 @@ declare module angular {
|
||||
provider(name: string, provider: IServiceProvider): IServiceProvider;
|
||||
provider(name: string, serviceProviderConstructor: Function): IServiceProvider;
|
||||
service(name: string, constructor: Function): IServiceProvider;
|
||||
service(name: string, inlineAnnotatedFunction: any[]): IServiceProvider;
|
||||
value(name: string, value: any): IServiceProvider;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/// Type definitions for Angular JS 1.0 (ngCookies module)
|
||||
// Type definitions for Angular JS 1.0 (ngCookies module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular Scenario Testing 1.0 (ngScenario module)
|
||||
// Project: [http://angularjs.org]
|
||||
// Definitions by: [RomanoLindano]
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: RomanoLindano <https://github.com/RomanoLindano>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module angularScenario {
|
||||
|
||||
Vendored
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angulartics v0.19.2
|
||||
// Type definitions for Angulartics v0.20.2
|
||||
// Project: http://luisfarzati.github.io/angulartics/
|
||||
// Definitions by: Steven Fan <https://github.com/stevenfan>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -21,6 +21,7 @@ declare module angulartics {
|
||||
|
||||
interface IAnalyticsServiceProvider extends angular.IServiceProvider {
|
||||
virtualPageviews(value: boolean): void;
|
||||
excludeRoutes(value: string[]): void;
|
||||
firstPageview(value: boolean): void;
|
||||
withBase(value: boolean): void;
|
||||
withAutoBase(value: boolean): void;
|
||||
|
||||
Vendored
+1
-1
@@ -50,7 +50,7 @@ declare module "any-db" {
|
||||
/**
|
||||
* Result rows
|
||||
*/
|
||||
rows: Object[];
|
||||
rows: any[];
|
||||
/**
|
||||
* Result field descriptions
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="../anydb-sql/anydb-sql.d.ts" />
|
||||
/// <reference path="anydb-sql-migrations" />
|
||||
import anydbsql = require('anydb-sql');
|
||||
import { Table, Column } from 'anydb-sql'
|
||||
import migrator = require('anydb-sql-migrations');
|
||||
|
||||
function do_not_run() {
|
||||
|
||||
var db = anydbsql({
|
||||
url: 'postgres://user:pass@host:port/database',
|
||||
connections: { min: 2, max: 20 }
|
||||
});
|
||||
|
||||
migrator
|
||||
.create(db, '/path/to/migrations/dir')
|
||||
.run();
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for anydb-sql-migrations
|
||||
// Project: https://github.com/spion/anydb-sql-migrations
|
||||
// Definitions by: Gorgi Kosev <https://github.com/spion>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../anydb-sql/anydb-sql.d.ts" />
|
||||
|
||||
declare module "anydb-sql-migrations" {
|
||||
import Promise = require('bluebird');
|
||||
import { Column, Table, Transaction, AnydbSql } from 'anydb-sql';
|
||||
export interface Migration {
|
||||
version: string;
|
||||
}
|
||||
export interface MigrationsTable extends Table<Migration> {
|
||||
version: Column<string>;
|
||||
}
|
||||
export interface MigFn {
|
||||
(tx: Transaction): Promise<any>;
|
||||
}
|
||||
export interface MigrationTask {
|
||||
up: MigFn;
|
||||
down: MigFn;
|
||||
name: string;
|
||||
}
|
||||
export function create(db: AnydbSql, tasks: any): {
|
||||
run: () => Promise<any>;
|
||||
migrateTo: (target?: string) => Promise<any>;
|
||||
check: (f: (m: {
|
||||
type: string;
|
||||
items: MigrationTask[];
|
||||
}) => any) => Promise<any>;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/// <reference path="anydb-sql.d.ts" />
|
||||
import anydbsql = require('anydb-sql');
|
||||
import { Table, Column } from 'anydb-sql'
|
||||
|
||||
function do_not_run() {
|
||||
|
||||
var db = anydbsql({
|
||||
url: 'postgres://user:pass@host:port/database',
|
||||
connections: { min: 2, max: 20 }
|
||||
});
|
||||
|
||||
// Table Post
|
||||
|
||||
interface Post {
|
||||
content: string;
|
||||
userId: string;
|
||||
date: string;
|
||||
}
|
||||
|
||||
interface PostTable extends Table<Post> {
|
||||
content: Column<string>;
|
||||
userId: Column<string>;
|
||||
date: Column<string>;
|
||||
}
|
||||
|
||||
var post = <PostTable>db.define<Post>({
|
||||
name: 'posts',
|
||||
columns: {
|
||||
content: {},
|
||||
userId: {},
|
||||
date: {}
|
||||
}
|
||||
});
|
||||
|
||||
// Table User
|
||||
|
||||
interface User {
|
||||
id: string;
|
||||
email: string;
|
||||
password: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface UserTable extends Table<User> {
|
||||
id: Column<string>;
|
||||
email: Column<string>;
|
||||
password: Column<string>;
|
||||
name: Column<string>;
|
||||
}
|
||||
|
||||
var user = <UserTable>db.define<User>({
|
||||
name: 'users',
|
||||
columns: {
|
||||
id: { primaryKey: true },
|
||||
email: {},
|
||||
password: {},
|
||||
name: {},
|
||||
date: {}
|
||||
},
|
||||
has: {
|
||||
posts: { from: 'posts', many: true },
|
||||
group: { from: 'groups'}
|
||||
}
|
||||
});
|
||||
|
||||
user.select(user.name, post.content)
|
||||
.from(user.join(post).on(user.id.equals(post.userId)))
|
||||
.where(post.date.gt('123'))
|
||||
.all()
|
||||
}
|
||||
Vendored
+194
@@ -0,0 +1,194 @@
|
||||
// Type definitions for anydb-sql
|
||||
// Project: https://github.com/doxout/anydb-sql
|
||||
// Definitions by: Gorgi Kosev <https://github.com/spion>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
|
||||
declare module "anydb-sql" {
|
||||
import Promise = require('bluebird');
|
||||
|
||||
interface AnyDBPool extends anydbSQL.DatabaseConnection {
|
||||
query:(text:string, values:any[], callback:(err:Error, result:any)=>void)=>void
|
||||
begin:()=>anydbSQL.Transaction
|
||||
close:(err:Error)=>void
|
||||
}
|
||||
|
||||
interface Dictionary<T> { [key:string]:T; }
|
||||
|
||||
module anydbSQL {
|
||||
export interface OrderByValueNode {}
|
||||
export interface ColumnDefinition {
|
||||
primaryKey?:boolean;
|
||||
dataType?:string;
|
||||
references?: {table:string; column: string}
|
||||
notNull?:boolean
|
||||
}
|
||||
|
||||
export interface TableDefinition {
|
||||
name:string
|
||||
columns:Dictionary<ColumnDefinition>
|
||||
has?:Dictionary<{from:string; many?:boolean}>
|
||||
}
|
||||
|
||||
|
||||
export interface QueryLike {
|
||||
query:string;
|
||||
values: any[]
|
||||
text:string
|
||||
}
|
||||
export interface DatabaseConnection {
|
||||
queryAsync<T>(query:string, ...params:any[]):Promise<{rowCount:number;rows:T[]}>
|
||||
queryAsync<T>(query:QueryLike):Promise<{rowCount:number;rows:T[]}>
|
||||
}
|
||||
|
||||
export interface Transaction extends DatabaseConnection {
|
||||
rollback():void
|
||||
commitAsync():Promise<void>
|
||||
}
|
||||
|
||||
export interface SubQuery<T> {
|
||||
select(node:Column<T>):SubQuery<T>
|
||||
where(...nodes:any[]):SubQuery<T>
|
||||
from(table:TableNode):SubQuery<T>
|
||||
group(...nodes:any[]):SubQuery<T>
|
||||
order(criteria:OrderByValueNode):SubQuery<T>
|
||||
notExists(subQuery:SubQuery<any>):SubQuery<T>
|
||||
}
|
||||
|
||||
interface Executable<T> {
|
||||
get():Promise<T>
|
||||
getWithin(tx:DatabaseConnection):Promise<T>
|
||||
exec():Promise<void>
|
||||
all():Promise<T[]>
|
||||
execWithin(tx:DatabaseConnection):Promise<void>
|
||||
allWithin(tx:DatabaseConnection):Promise<T[]>
|
||||
toQuery():QueryLike;
|
||||
}
|
||||
|
||||
interface Queryable<T> {
|
||||
where(...nodes:any[]):Query<T>
|
||||
delete():ModifyingQuery
|
||||
select<U>(...nodes:any[]):Query<U>
|
||||
selectDeep<U>(table: Table<T>): Query<T>
|
||||
selectDeep<U>(...nodesOrTables:any[]):Query<U>
|
||||
}
|
||||
|
||||
export interface Query<T> extends Executable<T>, Queryable<T> {
|
||||
from(table:TableNode):Query<T>
|
||||
update(o:Dictionary<any>):ModifyingQuery
|
||||
update(o:{}):ModifyingQuery
|
||||
group(...nodes:any[]):Query<T>
|
||||
order(...criteria:OrderByValueNode[]):Query<T>
|
||||
limit(l:number):Query<T>
|
||||
offset(o:number):Query<T>
|
||||
}
|
||||
|
||||
export interface ModifyingQuery extends Executable<void> {
|
||||
returning<U>(...nodes:any[]):Query<U>
|
||||
where(...nodes:any[]):ModifyingQuery
|
||||
}
|
||||
|
||||
export interface TableNode {
|
||||
join(table:TableNode):JoinTableNode
|
||||
leftJoin(table:TableNode):JoinTableNode
|
||||
}
|
||||
|
||||
export interface JoinTableNode extends TableNode {
|
||||
on(filter:BinaryNode):TableNode
|
||||
on(filter:string):TableNode
|
||||
}
|
||||
|
||||
interface CreateQuery extends Executable<void> {
|
||||
ifNotExists():Executable<void>
|
||||
}
|
||||
interface DropQuery extends Executable<void> {
|
||||
ifExists():Executable<void>
|
||||
}
|
||||
export interface Table<T> extends TableNode, Queryable<T> {
|
||||
create():CreateQuery
|
||||
drop():DropQuery
|
||||
as(name:string):Table<T>
|
||||
update(o:any):ModifyingQuery
|
||||
insert(row:T):ModifyingQuery
|
||||
insert(rows:T[]):ModifyingQuery
|
||||
select():Query<T>
|
||||
select<U>(...nodes:any[]):Query<U>
|
||||
from<U>(table:TableNode):Query<U>
|
||||
star():Column<any>
|
||||
subQuery<U>():SubQuery<U>
|
||||
eventEmitter:{emit:(type:string, ...args:any[])=>void
|
||||
on:(eventName:string, handler:Function)=>void}
|
||||
columns:Column<any>[]
|
||||
sql: SQL;
|
||||
alter():AlterQuery<T>
|
||||
}
|
||||
export interface AlterQuery<T> extends Executable<void> {
|
||||
addColumn(column:Column<any>): AlterQuery<T>;
|
||||
addColumn(name: string, options:string): AlterQuery<T>;
|
||||
dropColumn(column: Column<any>): AlterQuery<T>;
|
||||
renameColumn(column: Column<any>, newColumn: Column<any>):AlterQuery<T>;
|
||||
renameColumn(column: Column<any>, newName: string):AlterQuery<T>;
|
||||
renameColumn(name: string, newName: string):AlterQuery<T>;
|
||||
rename(newName: string): AlterQuery<T>
|
||||
}
|
||||
|
||||
export interface SQL {
|
||||
functions: {
|
||||
LOWER(c:Column<string>):Column<string>
|
||||
}
|
||||
}
|
||||
|
||||
export interface BinaryNode {
|
||||
and(node:BinaryNode):BinaryNode
|
||||
or(node:BinaryNode):BinaryNode
|
||||
}
|
||||
|
||||
export interface Column<T> {
|
||||
in(arr:T[]):BinaryNode
|
||||
in(subQuery:SubQuery<T>):BinaryNode
|
||||
notIn(arr:T[]):BinaryNode
|
||||
equals(node:any):BinaryNode
|
||||
notEquals(node:any):BinaryNode
|
||||
gte(node:any):BinaryNode
|
||||
lte(node:any):BinaryNode
|
||||
gt(node:any):BinaryNode
|
||||
lt(node:any):BinaryNode
|
||||
like(str:string):BinaryNode
|
||||
multiply:{
|
||||
(node:Column<T>):Column<T>
|
||||
(n:number):Column<number>
|
||||
}
|
||||
isNull():BinaryNode
|
||||
isNotNull():BinaryNode
|
||||
sum():Column<number>
|
||||
count():Column<number>
|
||||
count(name:string):Column<number>
|
||||
distinct():Column<T>
|
||||
as(name:string):Column<T>
|
||||
ascending:OrderByValueNode
|
||||
descending:OrderByValueNode
|
||||
asc:OrderByValueNode
|
||||
desc:OrderByValueNode
|
||||
}
|
||||
|
||||
export interface AnydbSql extends DatabaseConnection {
|
||||
define<T>(map:TableDefinition):Table<T>;
|
||||
transaction<T>(fn:(tx:Transaction)=>Promise<T>):Promise<T>
|
||||
allOf(...tables:Table<any>[]):any
|
||||
models:Dictionary<Table<any>>
|
||||
functions:{LOWER:(name:Column<string>)=>Column<string>
|
||||
RTRIM:(name:Column<string>)=>Column<string>}
|
||||
makeFunction(name:string):Function
|
||||
begin():Transaction
|
||||
open():void;
|
||||
close():void;
|
||||
getPool():AnyDBPool;
|
||||
dialect():string;
|
||||
}
|
||||
}
|
||||
|
||||
function anydbSQL(config:Object):anydbSQL.AnydbSql;
|
||||
|
||||
export = anydbSQL;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path="api-error-handler.d.ts" />
|
||||
|
||||
import errorHandler = require('api-error-handler');
|
||||
import express = require('express');
|
||||
import * as errorHandler from 'api-error-handler';
|
||||
import * as express from 'express';
|
||||
|
||||
var api = express.Router();
|
||||
api.get('/users/:userid', function (req, res, next) {
|
||||
@@ -9,3 +9,5 @@ api.get('/users/:userid', function (req, res, next) {
|
||||
});
|
||||
|
||||
api.use(errorHandler());
|
||||
|
||||
let res: errorHandler.Response;
|
||||
|
||||
+17
-1
@@ -6,7 +6,23 @@
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module 'api-error-handler' {
|
||||
import express = require('express');
|
||||
import * as express from 'express';
|
||||
|
||||
namespace apiErrorHandler {
|
||||
|
||||
// Body response: the JSON returned by api-error-handler
|
||||
// See https://github.com/expressjs/api-error-handler/blob/1.0.0/index.js
|
||||
interface Response {
|
||||
status: number;
|
||||
stack?: string;
|
||||
message: string;
|
||||
|
||||
// Client errors
|
||||
code?: any;
|
||||
name?: string;
|
||||
type?: any;
|
||||
}
|
||||
}
|
||||
|
||||
function apiErrorHandler(options?: any): express.ErrorRequestHandler;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///<reference path='applicationinsights.d.ts' />
|
||||
import appInsights = require("applicationinsights");
|
||||
import * as appInsights from "applicationinsights";
|
||||
|
||||
// basic use
|
||||
appInsights.setup("<instrumentation_key>").start();
|
||||
@@ -18,8 +18,14 @@ appInsights.client.trackEvent("custom event", {customProperty: "custom property
|
||||
appInsights.client.trackException(new Error("handled exceptions can be logged with this method"));
|
||||
appInsights.client.trackMetric("custom metric", 3);
|
||||
appInsights.client.trackTrace("trace message");
|
||||
appInsights.client.trackDependency("dependency name", "commandName", 500, true);
|
||||
|
||||
// assign common properties to all telemetry
|
||||
appInsights.client.commonProperties = {
|
||||
environment: "dev"
|
||||
};
|
||||
|
||||
// send any pending data and log the response
|
||||
appInsights.client.sendPendingData(function (response) {
|
||||
console.log(response);
|
||||
});
|
||||
|
||||
+27
-22
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Application Insights v0.15.1
|
||||
// Type definitions for Application Insights v0.15.8
|
||||
// Project: https://github.com/Microsoft/ApplicationInsights-node.js
|
||||
// Definitions by: Scott Southwood <https://github.com/scsouthw/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -342,10 +342,23 @@ interface Client {
|
||||
trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: {
|
||||
[key: string]: string;
|
||||
}): void;
|
||||
/**
|
||||
* Log information about a dependency of your app. Typically used to track the time database calls or outgoing http requests take from your server.
|
||||
* @param name The name of the dependency (i.e. "myDatabse")
|
||||
* @param commandname The name of the command executed on the dependency
|
||||
* @param elapsedTimeMs The amount of time in ms that the dependency took to return the result
|
||||
* @param success True if the dependency succeeded, false otherwise
|
||||
* @param dependencyTypeName The type of the dependency (i.e. "SQL" "HTTP"). Defaults to empty.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param dependencyKind ContractsModule.DependencyKind of this dependency. Defaults to Other.
|
||||
* @param async True if the dependency was executed asynchronously, false otherwise. Defaults to false
|
||||
* @param dependencySource ContractsModule.DependencySourceType of this dependency. Defaults to Undefined.
|
||||
*/
|
||||
trackDependency(name: string, commandName: string, elapsedTimeMs: number, success: boolean, dependencyTypeName?: string, properties?: {}, dependencyKind?: any, async?: boolean, dependencySource?: number): void;
|
||||
/**
|
||||
* Immediately send all queued telemetry.
|
||||
*/
|
||||
sendPendingData(): void;
|
||||
sendPendingData(callback?: (response: string) => void): void;
|
||||
getEnvelope(data: ContractsModule.Data<ContractsModule.Domain>, tagOverrides?: {
|
||||
[key: string]: string;
|
||||
}): ContractsModule.Envelope;
|
||||
@@ -396,66 +409,58 @@ interface Sender {
|
||||
* The singleton meta interface for the default client of the client. This interface is used to setup/start and configure
|
||||
* the auto-collection behavior of the application insights module.
|
||||
*/
|
||||
declare class ApplicationInsights {
|
||||
static client: Client;
|
||||
private static _isConsole;
|
||||
private static _isExceptions;
|
||||
private static _isPerformance;
|
||||
private static _isRequests;
|
||||
private static _console;
|
||||
private static _exceptions;
|
||||
private static _performance;
|
||||
private static _requests;
|
||||
private static _isStarted;
|
||||
interface ApplicationInsights {
|
||||
client: Client;
|
||||
/**
|
||||
* Initializes a client with the given instrumentation key, if this is not specified, the value will be
|
||||
* read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY
|
||||
* @returns {ApplicationInsights/Client} a new client
|
||||
*/
|
||||
static getClient(instrumentationKey?: string): Client;
|
||||
getClient(instrumentationKey?: string): Client;
|
||||
/**
|
||||
* Initializes the default client of the client and sets the default configuration
|
||||
* @param instrumentationKey the instrumentation key to use. Optional, if this is not specified, the value will be
|
||||
* read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static setup(instrumentationKey?: string): typeof ApplicationInsights;
|
||||
setup(instrumentationKey?: string): ApplicationInsights;
|
||||
/**
|
||||
* Starts automatic collection of telemetry. Prior to calling start no telemetry will be collected
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static start(): typeof ApplicationInsights;
|
||||
start(): ApplicationInsights;
|
||||
/**
|
||||
* Sets the state of console tracking (enabled by default)
|
||||
* @param value if true console activity will be sent to Application Insights
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static setAutoCollectConsole(value: boolean): typeof ApplicationInsights;
|
||||
setAutoCollectConsole(value: boolean): ApplicationInsights;
|
||||
/**
|
||||
* Sets the state of exception tracking (enabled by default)
|
||||
* @param value if true uncaught exceptions will be sent to Application Insights
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static setAutoCollectExceptions(value: boolean): typeof ApplicationInsights;
|
||||
setAutoCollectExceptions(value: boolean): ApplicationInsights;
|
||||
/**
|
||||
* Sets the state of performance tracking (enabled by default)
|
||||
* @param value if true performance counters will be collected every second and sent to Application Insights
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static setAutoCollectPerformance(value: boolean): typeof ApplicationInsights;
|
||||
setAutoCollectPerformance(value: boolean): ApplicationInsights;
|
||||
/**
|
||||
* Sets the state of request tracking (enabled by default)
|
||||
* @param value if true requests will be sent to Application Insights
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static setAutoCollectRequests(value: boolean): typeof ApplicationInsights;
|
||||
setAutoCollectRequests(value: boolean): ApplicationInsights;
|
||||
/**
|
||||
* Enables verbose debug logging
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static enableVerboseLogging(): typeof ApplicationInsights;
|
||||
enableVerboseLogging(): ApplicationInsights;
|
||||
}
|
||||
|
||||
declare module "applicationinsights" {
|
||||
export = ApplicationInsights;
|
||||
const applicationinsights: ApplicationInsights;
|
||||
export = applicationinsights;
|
||||
}
|
||||
Vendored
+440
-241
File diff suppressed because it is too large
Load Diff
Vendored
+3
-2
@@ -16,12 +16,13 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
declare module "archiver" {
|
||||
import * as FS from 'fs';
|
||||
import * as STREAM from 'stream';
|
||||
|
||||
interface nameInterface {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface Archiver {
|
||||
interface Archiver extends STREAM.Transform {
|
||||
pipe(writeStream: FS.WriteStream): void;
|
||||
append(readStream: FS.ReadStream, name: nameInterface): void;
|
||||
finalize(): void;
|
||||
@@ -38,4 +39,4 @@ declare module "archiver" {
|
||||
}
|
||||
|
||||
export = archiver;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,306 @@
|
||||
/// <reference path="argparse.d.ts" />
|
||||
// near copy of each of the tests from https://github.com/nodeca/argparse/tree/master/examples
|
||||
|
||||
import {ArgumentParser, RawDescriptionHelpFormatter} from 'argparse';
|
||||
var args: any;
|
||||
|
||||
var simpleExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse example',
|
||||
});
|
||||
simpleExample.addArgument(
|
||||
['-f', '--foo'],
|
||||
{
|
||||
help: 'foo bar',
|
||||
}
|
||||
);
|
||||
simpleExample.addArgument(
|
||||
['-b', '--bar'],
|
||||
{
|
||||
help: 'bar foo',
|
||||
}
|
||||
);
|
||||
|
||||
simpleExample.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
args = simpleExample.parseArgs('-f 1 -b2'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
args = simpleExample.parseArgs('-f=3 --bar=4'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
args = simpleExample.parseArgs('--foo 5 --bar 6'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
|
||||
|
||||
|
||||
|
||||
var choicesExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: choice'
|
||||
});
|
||||
|
||||
choicesExample.addArgument(['foo'], { choices: 'abc' });
|
||||
|
||||
choicesExample.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
args = choicesExample.parseArgs(['c']);
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
// choicesExample.parseArgs(['X']);
|
||||
// console.dir(args);
|
||||
|
||||
|
||||
|
||||
|
||||
var constantExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: constant'
|
||||
});
|
||||
|
||||
constantExample.addArgument(
|
||||
['-a'],
|
||||
{
|
||||
action: 'storeConst',
|
||||
dest: 'answer',
|
||||
help: 'store constant',
|
||||
constant: 42
|
||||
}
|
||||
);
|
||||
constantExample.addArgument(
|
||||
['--str'],
|
||||
{
|
||||
action: 'appendConst',
|
||||
dest: 'types',
|
||||
help: 'append constant "str" to types',
|
||||
constant: 'str'
|
||||
}
|
||||
);
|
||||
constantExample.addArgument(
|
||||
['--int'],
|
||||
{
|
||||
action: 'appendConst',
|
||||
dest: 'types',
|
||||
help: 'append constant "int" to types',
|
||||
constant: 'int'
|
||||
}
|
||||
);
|
||||
|
||||
constantExample.addArgument(
|
||||
['--true'],
|
||||
{
|
||||
action: 'storeTrue',
|
||||
help: 'store true constant'
|
||||
}
|
||||
);
|
||||
constantExample.addArgument(
|
||||
['--false'],
|
||||
{
|
||||
action: 'storeFalse',
|
||||
help: 'store false constant'
|
||||
}
|
||||
);
|
||||
|
||||
constantExample.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
args = constantExample.parseArgs('-a --str --int --true'.split(' '));
|
||||
console.dir(args);
|
||||
|
||||
|
||||
|
||||
|
||||
var nargsExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: nargs'
|
||||
});
|
||||
nargsExample.addArgument(
|
||||
['-f', '--foo'],
|
||||
{
|
||||
help: 'foo bar',
|
||||
nargs: 1
|
||||
}
|
||||
);
|
||||
nargsExample.addArgument(
|
||||
['-b', '--bar'],
|
||||
{
|
||||
help: 'bar foo',
|
||||
nargs: '*'
|
||||
}
|
||||
);
|
||||
|
||||
nargsExample.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
args = nargsExample.parseArgs('--foo a --bar c d'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
args = nargsExample.parseArgs('--bar b c f --foo a'.split(' '));
|
||||
console.dir(args);
|
||||
|
||||
|
||||
|
||||
|
||||
var parent_parser = new ArgumentParser({ addHelp: false });
|
||||
// note addHelp:false to prevent duplication of the -h option
|
||||
parent_parser.addArgument(
|
||||
['--parent'],
|
||||
{ type: 'int', help: 'parent' }
|
||||
);
|
||||
|
||||
var foo_parser = new ArgumentParser({
|
||||
parents: [parent_parser],
|
||||
description: 'child1'
|
||||
});
|
||||
foo_parser.addArgument(['foo']);
|
||||
args = foo_parser.parseArgs(['--parent', '2', 'XXX']);
|
||||
console.log(args);
|
||||
|
||||
var bar_parser = new ArgumentParser({
|
||||
parents: [parent_parser],
|
||||
description: 'child2'
|
||||
});
|
||||
bar_parser.addArgument(['--bar']);
|
||||
args = bar_parser.parseArgs(['--bar', 'YYY']);
|
||||
console.log(args);
|
||||
|
||||
|
||||
|
||||
|
||||
var prefixCharsExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: prefix_chars',
|
||||
prefixChars: '-+'
|
||||
});
|
||||
prefixCharsExample.addArgument(['+f', '++foo']);
|
||||
prefixCharsExample.addArgument(['++bar'], { action: 'storeTrue' });
|
||||
|
||||
prefixCharsExample.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
args = prefixCharsExample.parseArgs(['+f', '1']);
|
||||
console.dir(args);
|
||||
args = prefixCharsExample.parseArgs(['++bar']);
|
||||
console.dir(args);
|
||||
args = prefixCharsExample.parseArgs(['++foo', '2', '++bar']);
|
||||
console.dir(args);
|
||||
|
||||
|
||||
|
||||
|
||||
var subparserExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: sub-commands'
|
||||
});
|
||||
|
||||
var subparsers = subparserExample.addSubparsers({
|
||||
title: 'subcommands',
|
||||
dest: "subcommand_name"
|
||||
});
|
||||
|
||||
var bar = subparsers.addParser('c1', { addHelp: true, help: 'c1 help' });
|
||||
bar.addArgument(
|
||||
['-f', '--foo'],
|
||||
{
|
||||
action: 'store',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
);
|
||||
var bar = subparsers.addParser(
|
||||
'c2',
|
||||
{ aliases: ['co'], addHelp: true, help: 'c2 help' }
|
||||
);
|
||||
bar.addArgument(
|
||||
['-b', '--bar'],
|
||||
{
|
||||
action: 'store',
|
||||
type: 'int',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
);
|
||||
subparserExample.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
args = subparserExample.parseArgs('c1 -f 2'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
args = subparserExample.parseArgs('c2 -b 1'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
args = subparserExample.parseArgs('co -b 1'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
subparserExample.parseArgs(['c1', '-h']);
|
||||
|
||||
|
||||
|
||||
|
||||
var functionExample = new ArgumentParser({ description: 'Process some integers.' });
|
||||
function sum(arr: number[]) {
|
||||
return arr.reduce(function(a, b) {
|
||||
return a + b;
|
||||
}, 0);
|
||||
}
|
||||
function max(arr: number[]) {
|
||||
return Math.max.apply(Math, arr);
|
||||
}
|
||||
|
||||
|
||||
functionExample.addArgument(['integers'], {
|
||||
metavar: 'N',
|
||||
type: 'int',
|
||||
nargs: '+',
|
||||
help: 'an integer for the accumulator'
|
||||
});
|
||||
functionExample.addArgument(['--sum'], {
|
||||
dest: 'accumulate',
|
||||
action: 'storeConst',
|
||||
constant: sum,
|
||||
defaultValue: max,
|
||||
help: 'sum the integers (default: find the max)'
|
||||
});
|
||||
|
||||
args = functionExample.parseArgs('--sum 1 2 -1'.split(' '));
|
||||
console.log(args.accumulate(args.integers));
|
||||
|
||||
|
||||
|
||||
|
||||
var formatterExample = new ArgumentParser({
|
||||
prog: 'PROG',
|
||||
formatterClass: RawDescriptionHelpFormatter,
|
||||
description: 'Keep the formatting\n' +
|
||||
' exactly as it is written\n' +
|
||||
'\n' +
|
||||
'here\n'
|
||||
});
|
||||
|
||||
formatterExample.addArgument(['--foo'], {
|
||||
help: ' foo help should not\n' +
|
||||
' retain this odd formatting'
|
||||
});
|
||||
|
||||
formatterExample.addArgument(['spam'], {
|
||||
'help': 'spam help'
|
||||
});
|
||||
|
||||
var group = formatterExample.addArgumentGroup({
|
||||
title: 'title',
|
||||
description: ' This text\n' +
|
||||
' should be indented\n' +
|
||||
' exactly like it is here\n'
|
||||
});
|
||||
|
||||
group.addArgument(['--bar'], {
|
||||
help: 'bar help'
|
||||
});
|
||||
formatterExample.printHelp();
|
||||
Vendored
+90
@@ -0,0 +1,90 @@
|
||||
// Type definitions for argparse v1.0.3
|
||||
// Project: https://github.com/nodeca/argparse
|
||||
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "argparse" {
|
||||
export class ArgumentParser extends ArgumentGroup {
|
||||
constructor(options? : ArgumentParserOptions);
|
||||
|
||||
addSubparsers(options? : SubparserOptions) : SubParser;
|
||||
parseArgs(args? : string[], ns? : Namespace|Object) : any;
|
||||
printUsage() : void;
|
||||
printHelp() : void;
|
||||
formatUsage() : string;
|
||||
formatHelp() : string;
|
||||
parseKnownArgs(args? : string[], ns? : Namespace|Object) : any[];
|
||||
convertArgLineToArg(argLine : string) : string[];
|
||||
exit(status : number, message : string) : void;
|
||||
error(err : string|Error) : void;
|
||||
}
|
||||
|
||||
interface Namespace {}
|
||||
|
||||
class SubParser {
|
||||
addParser(name : string, options? : SubArgumentParserOptions) : ArgumentParser;
|
||||
}
|
||||
|
||||
class ArgumentGroup {
|
||||
addArgument(args : string[], options? : ArgumentOptions) : void;
|
||||
addArgumentGroup(options? : ArgumentGroupOptions) : ArgumentGroup;
|
||||
addMutuallyExclusiveGroup(options? : {required : boolean}) : ArgumentGroup;
|
||||
setDefaults(options? : {}) : void;
|
||||
getDefault(dest : string) : any;
|
||||
}
|
||||
|
||||
interface SubparserOptions {
|
||||
title? : string;
|
||||
description? : string;
|
||||
prog? : string;
|
||||
parserClass? : {new() : any};
|
||||
action? : string;
|
||||
dest? : string;
|
||||
help? : string;
|
||||
metavar? : string;
|
||||
}
|
||||
|
||||
interface SubArgumentParserOptions extends ArgumentParserOptions {
|
||||
aliases? : string[];
|
||||
help? : string;
|
||||
}
|
||||
|
||||
interface ArgumentParserOptions {
|
||||
description? : string;
|
||||
epilog? : string;
|
||||
addHelp? : boolean;
|
||||
argumentDefault? : any;
|
||||
parents? : ArgumentParser[];
|
||||
prefixChars? : string;
|
||||
formatterClass? : {new() : HelpFormatter|ArgumentDefaultsHelpFormatter|RawDescriptionHelpFormatter|RawTextHelpFormatter};
|
||||
prog? : string;
|
||||
usage? : string;
|
||||
version? : string;
|
||||
}
|
||||
|
||||
interface ArgumentGroupOptions {
|
||||
prefixChars? : string;
|
||||
argumentDefault? : any;
|
||||
title? : string;
|
||||
description? : string;
|
||||
}
|
||||
|
||||
export class HelpFormatter {}
|
||||
export class ArgumentDefaultsHelpFormatter {}
|
||||
export class RawDescriptionHelpFormatter {}
|
||||
export class RawTextHelpFormatter {}
|
||||
|
||||
interface ArgumentOptions {
|
||||
action? : string;
|
||||
optionStrings? : string[];
|
||||
dest? : string;
|
||||
nargs? : string|number;
|
||||
constant? : any;
|
||||
defaultValue? : any;
|
||||
type? : string|Function;
|
||||
choices? : string|string[];
|
||||
required? : boolean;
|
||||
help? : string;
|
||||
metavar? : string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/// <reference path="asana.d.ts" />
|
||||
/// <reference path="../request/request.d.ts" />
|
||||
|
||||
import * as asana from 'asana';
|
||||
import * as util from 'util';
|
||||
|
||||
let version: string = asana.VERSION;
|
||||
|
||||
// https://github.com/Asana/node-asana#usage
|
||||
// Usage
|
||||
|
||||
var client = asana.Client.create().useAccessToken('my_access_token');
|
||||
client.users.me().then(function(me) {
|
||||
console.log(me);
|
||||
});
|
||||
|
||||
client = asana.Client.create({
|
||||
clientId: 123,
|
||||
clientSecret: 'my_client_secret',
|
||||
redirectUri: 'my_redirect_uri'
|
||||
});
|
||||
|
||||
client.useOauth({
|
||||
credentials: 'my_access_token'
|
||||
});
|
||||
|
||||
var credentials = {
|
||||
// access_token: 'my_access_token',
|
||||
refresh_token: 'my_refresh_token'
|
||||
};
|
||||
|
||||
client.useOauth({
|
||||
credentials: credentials
|
||||
});
|
||||
|
||||
// https://github.com/Asana/node-asana#collections
|
||||
// Collections
|
||||
|
||||
let tagId: string = null;
|
||||
client.tasks.findByTag(tagId, { limit: 5 }).then((collection: any) => {
|
||||
console.log(collection.data);
|
||||
// [ .. array of up to 5 task objects .. ]
|
||||
|
||||
client.tasks.findByTag(tagId).then((firstPage: any) => {
|
||||
console.log(firstPage.data);
|
||||
collection.nextPage().then((secondPage: any) => {
|
||||
console.log(secondPage.data);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
client.tasks.findByTag(tagId).then((collection: any) => {
|
||||
// Fetch up to 200 tasks, using multiple pages if necessary
|
||||
collection.fetch(200).then((tasks: any) => {
|
||||
console.log(tasks);
|
||||
});
|
||||
});
|
||||
|
||||
client.tasks.findByTag(tagId).then((collection: any) => {
|
||||
collection.stream().on('data', (task: any) => {
|
||||
console.log(task);
|
||||
});
|
||||
});
|
||||
|
||||
// https://github.com/Asana/node-asana#examples
|
||||
// Examples
|
||||
|
||||
var Asana = asana;
|
||||
|
||||
// Using the API key for basic authentication. This is reasonable to get
|
||||
// started with, but Oauth is more secure and provides more features.
|
||||
var client = Asana.Client.create().useBasicAuth(process.env.ASANA_API_KEY);
|
||||
|
||||
client.users.me()
|
||||
.then((user: any) => {
|
||||
var userId = user.id;
|
||||
// The user's "default" workspace is the first one in the list, though
|
||||
// any user can have multiple workspaces so you can't always assume this
|
||||
// is the one you want to work with.
|
||||
var workspaceId = user.workspaces[0].id;
|
||||
return client.tasks.findAll({
|
||||
assignee: userId,
|
||||
workspace: workspaceId,
|
||||
completed_since: 'now',
|
||||
opt_fields: 'id,name,assignee_status,completed'
|
||||
});
|
||||
})
|
||||
.then((response: any) => {
|
||||
// There may be more pages of data, we could stream or return a promise
|
||||
// to request those here - for now, let's just return the first page
|
||||
// of items.
|
||||
return response.data;
|
||||
})
|
||||
.filter((task: any) => {
|
||||
return task.assignee_status === 'today' ||
|
||||
task.assignee_status === 'new';
|
||||
})
|
||||
.then((list: any) => {
|
||||
console.log(util.inspect(list, {
|
||||
colors: true,
|
||||
depth: null
|
||||
}));
|
||||
});
|
||||
|
||||
Vendored
+2199
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
/// <reference path="./assertsharp.d.ts" />
|
||||
|
||||
import Assert from "assertsharp";
|
||||
|
||||
Assert.AreEqual(0, 0, "Pass");
|
||||
Assert.AreNotEqual(0, 1, "Pass");
|
||||
Assert.AreNotSame(new Date(), new Date(), "Pass");
|
||||
Assert.AreSequenceEqual([0], [0], (x, y) => x === y, "Pass");
|
||||
Assert.Fail("Should fail");
|
||||
Assert.IsFalse(false, "Pass");
|
||||
Assert.IsInstanceOfType(new Date(), Date, "Pass");
|
||||
Assert.IsNotInstanceOfType(true, Date, "Pass");
|
||||
Assert.IsNotNull(new Date(), "Pass");
|
||||
Assert.IsNull(null, "Pass");
|
||||
Assert.IsTrue(true, "Pass");
|
||||
Assert.Throws(() => { throw ""; }, "Pass");
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for assertsharp
|
||||
// Project: https://www.npmjs.com/package/assertsharp
|
||||
// Definitions by: Bruno Leonardo Michels <https://github.com/brunolm>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "assertsharp" {
|
||||
export default class Assert {
|
||||
static AreEqual<T>(expected: T, actual: T, message?: string): void;
|
||||
static AreNotEqual<T>(notExpected: T, actual: T, message?: string): void;
|
||||
static AreNotSame<T>(notExpected: T, actual: T, message?: string): void;
|
||||
static AreSequenceEqual<T>(expected: T[], actual: T[], equals?: (x: any, y: any) => boolean, message?: string): void;
|
||||
static Fail(message?: string): void;
|
||||
static IsFalse(actual: boolean, message?: string): void;
|
||||
static IsInstanceOfType(actual: any, expectedType: Function, message?: string): void;
|
||||
static IsNotInstanceOfType(actual: any, wrongType: Function, message?: string): void;
|
||||
static IsNotNull(actual: any, message?: string): void;
|
||||
static IsNull(actual: any, message?: string): void;
|
||||
static IsTrue(actual: boolean, message?: string): void;
|
||||
static Throws(fn: () => void, message?: string): void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/// <reference path="async-writer.d.ts" />
|
||||
|
||||
import asyncWriter = require('async-writer');
|
||||
import stream = require('stream');
|
||||
|
||||
class TestStream extends stream.Writable {
|
||||
constructor(public output: string) {
|
||||
super();
|
||||
}
|
||||
_write(data: string, encoding: string, callback: Function) {
|
||||
this.output += data;
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
// Simple usage
|
||||
function simpleUsage(callback: () => void) {
|
||||
var output = '';
|
||||
let testStream = new TestStream(output);
|
||||
let out = asyncWriter.create(testStream)
|
||||
.on('error', (err: Error) => {
|
||||
console.error(err);
|
||||
})
|
||||
.on('finish', () => {
|
||||
console.log(testStream.output);
|
||||
callback();
|
||||
})
|
||||
|
||||
out.write('A');
|
||||
out.write('B');
|
||||
out.write('C');
|
||||
out.end();
|
||||
}
|
||||
|
||||
|
||||
// Asynchronous, out-of-order writing
|
||||
function asyncUsage(callback: () => void) {
|
||||
var output = '';
|
||||
let testStream = new TestStream(output);
|
||||
let out = asyncWriter.create(testStream)
|
||||
.on('error', (err: Error) => {
|
||||
console.error(err);
|
||||
})
|
||||
.on('finish', () => {
|
||||
console.log(testStream.output);
|
||||
callback();
|
||||
})
|
||||
|
||||
out.write('A');
|
||||
|
||||
let asyncOut = out.beginAsync();
|
||||
setTimeout(() => {
|
||||
asyncOut.write('B');
|
||||
asyncOut.end();
|
||||
}, 1000);
|
||||
|
||||
out.write('C');
|
||||
out.end();
|
||||
}
|
||||
|
||||
// run test
|
||||
simpleUsage(() => {
|
||||
asyncUsage(() => {
|
||||
console.log('DONE');
|
||||
});
|
||||
});
|
||||
Vendored
+78
@@ -0,0 +1,78 @@
|
||||
// Type definitions for async-writer 1.4.1
|
||||
// Project: https://github.com/marko-js/async-writer
|
||||
// Definitions by: Yuce Tekol <http://yuce.me/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'async-writer' {
|
||||
import stream = require('stream');
|
||||
import events = require('events');
|
||||
|
||||
module async_writer {
|
||||
interface EventFunction {
|
||||
(event: string, callback: Function): void;
|
||||
}
|
||||
|
||||
class StringWriter {
|
||||
constructor(events: events.EventEmitter);
|
||||
end(): void;
|
||||
write(what: string): StringWriter;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
class BufferedWriter {
|
||||
constructor(wrappedStream: stream.Stream);
|
||||
flush(): void;
|
||||
on(event: string, callback: Function): BufferedWriter;
|
||||
once(event: string, callback: Function): BufferedWriter;
|
||||
clear(): void;
|
||||
end(): void;
|
||||
write(what: string): BufferedWriter;
|
||||
}
|
||||
|
||||
interface BeginAsyncOptions {
|
||||
last?: boolean;
|
||||
timeout?: number;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
class AsyncWriter {
|
||||
static enableAsyncStackTrace():void;
|
||||
|
||||
constructor(writer?: any, global?: {[s: string]: any}, async?: boolean, buffer?: boolean);
|
||||
isAsyncWriter: AsyncWriter;
|
||||
sync(): void;
|
||||
getAttributes(): {[s: string]: any};
|
||||
getAttribute(): any;
|
||||
write(str: string): AsyncWriter;
|
||||
getOutput(): string;
|
||||
captureString(func: Function, thisObj: Object): string;
|
||||
swapWriter(newWriter: StringWriter | BufferedWriter, func: Function, thisObj: Object): void;
|
||||
createNestedWriter(writer: StringWriter | BufferedWriter): AsyncWriter;
|
||||
beginAsync(options?: number | BeginAsyncOptions): AsyncWriter;
|
||||
handleBeginAsync(options: number | BeginAsyncOptions, parent: AsyncWriter): void;
|
||||
on(event: string, callback: Function): AsyncWriter;
|
||||
once(event: string, callback: Function): AsyncWriter;
|
||||
onLast(callback: Function): AsyncWriter;
|
||||
emit(arg: any): AsyncWriter;
|
||||
removeListener(): AsyncWriter;
|
||||
pipe(stream: stream.Stream): AsyncWriter;
|
||||
error(e: Error): void;
|
||||
end(data?: any): AsyncWriter;
|
||||
handleEnd(isAsync: boolean): void;
|
||||
_finish(): void;
|
||||
flush(): void;
|
||||
}
|
||||
|
||||
interface AsyncWriterOptions {
|
||||
global?: {[s: string]: any};
|
||||
buffer?: boolean;
|
||||
}
|
||||
|
||||
function create(writer?: any, options?: AsyncWriterOptions): AsyncWriter;
|
||||
function enableAsyncStackTrace(): void;
|
||||
}
|
||||
|
||||
export = async_writer;
|
||||
}
|
||||
Vendored
+2
@@ -72,6 +72,8 @@ interface Auth0LockStatic {
|
||||
|
||||
hide(callback: () => void): void;
|
||||
logout(callback: () => void): void;
|
||||
|
||||
getClient(): Auth0Static;
|
||||
}
|
||||
|
||||
declare var Auth0Lock: Auth0LockStatic;
|
||||
|
||||
Vendored
+2
@@ -51,6 +51,8 @@ interface Auth0UserProfile {
|
||||
user_id: string;
|
||||
/** Represents one or more Identities that may be associated with the User. */
|
||||
identities: Auth0Identity[];
|
||||
user_metadata?: any;
|
||||
app_metadata?: any;
|
||||
}
|
||||
|
||||
/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */
|
||||
|
||||
Vendored
+1
-2
@@ -4,7 +4,6 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../when/when.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module autobahn {
|
||||
|
||||
@@ -194,7 +193,7 @@ declare module autobahn {
|
||||
type: string;
|
||||
}
|
||||
|
||||
type DeferFactory = () => JQueryPromise<any>;
|
||||
type DeferFactory = () => When.Promise<any>;
|
||||
|
||||
type OnChallengeHandler = (session: Session, method: string, extra: any) => When.Promise<string>;
|
||||
|
||||
|
||||
+248
-5
@@ -1,13 +1,256 @@
|
||||
/// <reference path="aws-sdk.d.ts" />
|
||||
|
||||
import awsSdk = require('aws-sdk');
|
||||
import AWS = require('aws-sdk');
|
||||
|
||||
var str: string;
|
||||
|
||||
var creds: awsSdk.Credentials;
|
||||
var creds: AWS.Credentials;
|
||||
|
||||
creds = new awsSdk.Credentials(str, str);
|
||||
creds = new awsSdk.Credentials(str, str, str);
|
||||
creds = new AWS.Credentials(str, str);
|
||||
creds = new AWS.Credentials(str, str, str);
|
||||
str = creds.accessKeyId;
|
||||
|
||||
// more
|
||||
|
||||
/*
|
||||
* SQS
|
||||
*/
|
||||
var sqs:AWS.SQS
|
||||
|
||||
//Default constructor
|
||||
sqs = new AWS.SQS();
|
||||
|
||||
//Locking the API Version
|
||||
sqs = new AWS.SQS({apiVersion: '2012-11-05'});
|
||||
|
||||
// Locking the API Version Globally
|
||||
AWS.config.apiVersions = {
|
||||
sqs: '2012-11-05',
|
||||
// other service API versions
|
||||
};
|
||||
|
||||
sqs.addPermission({
|
||||
AWSAccountIds: [ /* required */
|
||||
'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
Actions: [ /* required */
|
||||
'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
Label: 'STRING_VALUE', /* required */
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.changeMessageVisibility({
|
||||
QueueUrl: 'STRING_VALUE', /* required */
|
||||
ReceiptHandle: 'STRING_VALUE', /* required */
|
||||
VisibilityTimeout: 0 /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.changeMessageVisibilityBatch({
|
||||
Entries: [ /* required */
|
||||
{
|
||||
Id: 'STRING_VALUE', /* required */
|
||||
ReceiptHandle: 'STRING_VALUE', /* required */
|
||||
VisibilityTimeout: 0
|
||||
},
|
||||
/* more items */
|
||||
],
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.createQueue({
|
||||
QueueName: 'STRING_VALUE', /* required */
|
||||
Attributes: {
|
||||
someKey: 'STRING_VALUE',
|
||||
/* anotherKey: ... */
|
||||
}
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.deleteMessage({
|
||||
QueueUrl: 'STRING_VALUE', /* required */
|
||||
ReceiptHandle: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.deleteMessageBatch({
|
||||
Entries: [ /* required */
|
||||
{
|
||||
Id: 'STRING_VALUE', /* required */
|
||||
ReceiptHandle: 'STRING_VALUE' /* required */
|
||||
},
|
||||
/* more items */
|
||||
],
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.deleteQueue({
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.getQueueAttributes({
|
||||
QueueUrl: 'STRING_VALUE', /* required */
|
||||
AttributeNames: [
|
||||
'Policy | VisibilityTimeout | MaximumMessageSize | MessageRetentionPeriod | ApproximateNumberOfMessages | ApproximateNumberOfMessagesNotVisible | CreatedTimestamp | LastModifiedTimestamp | QueueArn | ApproximateNumberOfMessagesDelayed | DelaySeconds | ReceiveMessageWaitTimeSeconds | RedrivePolicy',
|
||||
/* more items */
|
||||
]
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.getQueueUrl({
|
||||
QueueName: 'STRING_VALUE', /* required */
|
||||
QueueOwnerAWSAccountId: 'STRING_VALUE'
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.listDeadLetterSourceQueues({
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
}, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.listQueues({
|
||||
QueueNamePrefix: 'STRING_VALUE'
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.purgeQueue({
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
}, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.receiveMessage({
|
||||
QueueUrl: 'STRING_VALUE', /* required */
|
||||
AttributeNames: [
|
||||
'Policy | VisibilityTimeout | MaximumMessageSize | MessageRetentionPeriod | ApproximateNumberOfMessages | ApproximateNumberOfMessagesNotVisible | CreatedTimestamp | LastModifiedTimestamp | QueueArn | ApproximateNumberOfMessagesDelayed | DelaySeconds | ReceiveMessageWaitTimeSeconds | RedrivePolicy',
|
||||
/* more items */
|
||||
],
|
||||
MaxNumberOfMessages: 0,
|
||||
MessageAttributeNames: [
|
||||
'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
VisibilityTimeout: 0,
|
||||
WaitTimeSeconds: 0
|
||||
}, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.removePermission({
|
||||
Label: 'STRING_VALUE', /* required */
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
}, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.sendMessage({
|
||||
MessageBody: 'STRING_VALUE', /* required */
|
||||
QueueUrl: 'STRING_VALUE', /* required */
|
||||
DelaySeconds: 0,
|
||||
MessageAttributes: {
|
||||
someKey: {
|
||||
DataType: 'STRING_VALUE', /* required */
|
||||
BinaryListValues: [
|
||||
new Buffer('...') || 'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
BinaryValue: new Buffer('...') || 'STRING_VALUE',
|
||||
StringListValues: [
|
||||
'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
StringValue: 'STRING_VALUE'
|
||||
},
|
||||
/* anotherKey: ... */
|
||||
}
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.sendMessageBatch({
|
||||
Entries: [ /* required */
|
||||
{
|
||||
Id: 'STRING_VALUE', /* required */
|
||||
MessageBody: 'STRING_VALUE', /* required */
|
||||
DelaySeconds: 0,
|
||||
MessageAttributes: {
|
||||
someKey: {
|
||||
DataType: 'STRING_VALUE', /* required */
|
||||
BinaryListValues: [
|
||||
new Buffer('...') ,
|
||||
/* more items */
|
||||
],
|
||||
BinaryValue: new Buffer('...'),
|
||||
StringListValues: [
|
||||
'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
StringValue: 'STRING_VALUE'
|
||||
},
|
||||
/* anotherKey: ... */
|
||||
}
|
||||
},
|
||||
/* more items */
|
||||
],
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.setQueueAttributes({
|
||||
Attributes: { /* required */
|
||||
someKey: 'STRING_VALUE',
|
||||
/* anotherKey: ... */
|
||||
},
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
}, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
|
||||
Vendored
+273
-63
@@ -30,6 +30,16 @@ declare module "aws-sdk" {
|
||||
xhrAsync?: boolean;
|
||||
xhrWithCredentials?: boolean;
|
||||
}
|
||||
|
||||
export class Endpoint {
|
||||
constructor(endpoint:string);
|
||||
|
||||
host:string;
|
||||
hostname:string;
|
||||
href:string;
|
||||
port:number;
|
||||
protocol:string;
|
||||
}
|
||||
|
||||
export interface Services {
|
||||
autoscaling?: any;
|
||||
@@ -46,6 +56,7 @@ declare module "aws-sdk" {
|
||||
directconnect?: any;
|
||||
dynamodb?: any;
|
||||
ec2?: any;
|
||||
ecs?: any;
|
||||
elasticache?: any;
|
||||
elasticbeanstalk?: any;
|
||||
elastictranscoder?: any;
|
||||
@@ -99,7 +110,25 @@ declare module "aws-sdk" {
|
||||
|
||||
export class SQS {
|
||||
constructor(options?: any);
|
||||
public client: Sqs.Client;
|
||||
endpoint:Endpoint;
|
||||
|
||||
addPermission(params: SQS.AddPermissionParams, callback: (err:Error, data:any) => void): void;
|
||||
changeMessageVisibility(params: SQS.ChangeMessageVisibilityParams, callback: (err:Error, data:any) => void): void;
|
||||
changeMessageVisibilityBatch(params: SQS.ChangeMessageVisibilityBatchParams, callback: (err:Error, data:SQS.ChangeMessageVisibilityBatchResponse) => void): void;
|
||||
createQueue(params: SQS.CreateQueueParams, callback: (err: Error, data: SQS.CreateQueueResult) => void): void;
|
||||
deleteMessage(params: SQS.DeleteMessageParams, callback: (err: Error, data: any) => void): void;
|
||||
deleteMessageBatch(params: SQS.DeleteMessageBatchParams, callback: (err: Error, data: SQS.DeleteMessageBatchResult) => void): void;
|
||||
deleteQueue(params: { QueueUrl: string; }, callback: (err: Error, data: any) => void): void;
|
||||
getQueueAttributes(params: SQS.GetQueueAttributesParams, callback: (err: Error, data: SQS.GetQueueAttributesResult) => void): void;
|
||||
getQueueUrl(params: SQS.GetQueueUrlParams, callback: (err: Error, data: { QueueUrl: string; }) => void): void;
|
||||
listDeadLetterSourceQueues(params: {QueueUrl:string}, callback: (err: Error, data: {queueUrls: string[]}) => void): void;
|
||||
listQueues(params: {QueueNamePrefix?:string}, callback: (err: Error, data: {QueueUrls: string[]}) => void): void;
|
||||
purgeQueue(params: {QueueUrl: string}, callback: (err: Error, data: any) => void): void;
|
||||
receiveMessage(params: SQS.ReceiveMessageParams, callback: (err: Error, data: SQS.ReceiveMessageResult) => void): void;
|
||||
removePermission(params: {QueueUrl: string, Label: string}, callback: (err: Error, data: any) => void): void;
|
||||
sendMessage(params: SQS.SendMessageParams, callback: (err: Error, data: SQS.SendMessageResult) => void): void;
|
||||
sendMessageBatch(params: SQS.SendMessageBatchParams, callback: (err: Error, data: SQS.SendMessageBatchResult) => void): void;
|
||||
setQueueAttributes(params: SQS.SetQueueAttributesParams, callback: (err: Error, data: any) => void): void;
|
||||
}
|
||||
|
||||
export class SES {
|
||||
@@ -119,43 +148,101 @@ declare module "aws-sdk" {
|
||||
|
||||
export class S3 {
|
||||
constructor(options?: any);
|
||||
public client: s3.Client;
|
||||
putObject(params: s3.PutObjectRequest, callback: (err: any, data: any) => void): void;
|
||||
getObject(params: s3.GetObjectRequest, callback: (err: any, data: any) => void): void;
|
||||
}
|
||||
|
||||
export class ECS {
|
||||
constructor(options?: any);
|
||||
|
||||
createService(params: ecs.CreateServicesParams, callback: (err: any, data: any) => void): void;
|
||||
describeServices(params: ecs.DescribeServicesParams, callback: (err: any, data: any) => void): void;
|
||||
describeTaskDefinition(params: ecs.DescribeTaskDefinitionParams, callback: (err: any, data: any) => void): void;
|
||||
registerTaskDefinition(params: ecs.RegisterTaskDefinitionParams, callback: (err: any, data: any) => void): void;
|
||||
updateService(params: ecs.UpdateServiceParams, callback: (err: any, data: any) => void): void;
|
||||
}
|
||||
|
||||
export class DynamoDB {
|
||||
constructor(options?: any);
|
||||
}
|
||||
|
||||
export module Sqs {
|
||||
export module DynamoDB {
|
||||
export class DocumentClient {
|
||||
constructor(options?: any);
|
||||
}
|
||||
}
|
||||
|
||||
export interface Client {
|
||||
config: ClientConfig;
|
||||
|
||||
sendMessage(params: SendMessageRequest, callback: (err: any, data: SendMessageResult) => void): void;
|
||||
sendMessageBatch(params: SendMessageBatchRequest, callback: (err: any, data: SendMessageBatchResult) => void): void;
|
||||
receiveMessage(params: ReceiveMessageRequest, callback: (err: any, data: ReceiveMessageResult) => void): void;
|
||||
deleteMessage(params: DeleteMessageRequest, callback: (err: any, data: any) => void): void;
|
||||
deleteMessageBatch(params: DeleteMessageBatchRequest, callback: (err: any, data: DeleteMessageBatchResult) => void): void;
|
||||
createQueue(params: CreateQueueRequest, callback: (err: any, data: CreateQueueResult) => void): void;
|
||||
deleteQueue(params: DeleteQueueRequest, callback: (err: any, data: any) => void): void;
|
||||
export module SQS {
|
||||
|
||||
export interface SqsOptions {
|
||||
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;
|
||||
httpOptions?: HttpOptions;
|
||||
apiVersion?: string;
|
||||
apiVersions?: { [serviceName:string]: string};
|
||||
logger?: Logger;
|
||||
systemClockOffset?: number;
|
||||
signatureVersion?: string;
|
||||
signatureCache?: boolean;
|
||||
}
|
||||
|
||||
export interface AddPermissionParams {
|
||||
QueueUrl: string;
|
||||
Label: string;
|
||||
AWSAccountIds:string[];
|
||||
Actions:string[];
|
||||
}
|
||||
|
||||
export interface ChangeMessageVisibilityParams {
|
||||
QueueUrl: string,
|
||||
ReceiptHandle: string,
|
||||
VisibilityTimeout: number
|
||||
}
|
||||
|
||||
export interface ChangeMessageVisibilityBatchParams {
|
||||
QueueUrl: string,
|
||||
Entries: { Id: string; ReceiptHandle: string; VisibilityTimeout?: number; }[]
|
||||
}
|
||||
|
||||
export interface ChangeMessageVisibilityBatchResponse {
|
||||
Successful: { Id:string }[];
|
||||
Failed: BatchResultErrorEntry[];
|
||||
}
|
||||
|
||||
export interface SendMessageRequest {
|
||||
QueueUrl?: string;
|
||||
MessageBody?: string;
|
||||
export interface SendMessageParams {
|
||||
QueueUrl: string;
|
||||
MessageBody: string;
|
||||
DelaySeconds?: number;
|
||||
MessageAttributes?: { [name:string]: MessageAttribute; }
|
||||
}
|
||||
|
||||
export interface ReceiveMessageRequest {
|
||||
QueueUrl?: string;
|
||||
export interface ReceiveMessageParams {
|
||||
QueueUrl: string;
|
||||
MaxNumberOfMessages?: number;
|
||||
VisibilityTimeout?: number;
|
||||
AttributeNames?: string[];
|
||||
MessageAttributeNames?: string[];
|
||||
WaitTimeSeconds?:number;
|
||||
}
|
||||
|
||||
export interface DeleteMessageBatchRequest {
|
||||
QueueUrl?: string;
|
||||
Entries?: DeleteMessageBatchRequestEntry[];
|
||||
export interface DeleteMessageBatchParams {
|
||||
QueueUrl: string;
|
||||
Entries: DeleteMessageBatchRequestEntry[];
|
||||
}
|
||||
|
||||
export interface DeleteMessageBatchRequestEntry {
|
||||
@@ -163,85 +250,117 @@ declare module "aws-sdk" {
|
||||
ReceiptHandle: string;
|
||||
}
|
||||
|
||||
export interface DeleteMessageRequest {
|
||||
QueueUrl?: string;
|
||||
ReceiptHandle?: string;
|
||||
export interface DeleteMessageParams {
|
||||
QueueUrl: string;
|
||||
ReceiptHandle: string;
|
||||
}
|
||||
|
||||
export class Attribute {
|
||||
Name: string;
|
||||
Value: string;
|
||||
export interface SendMessageBatchParams {
|
||||
QueueUrl: string;
|
||||
Entries: SendMessageBatchRequestEntry[];
|
||||
}
|
||||
|
||||
export interface SendMessageBatchRequest {
|
||||
QueueUrl?: string;
|
||||
Entries?: SendMessageBatchRequestEntry[];
|
||||
}
|
||||
|
||||
export class SendMessageBatchRequestEntry {
|
||||
export interface SendMessageBatchRequestEntry {
|
||||
Id: string;
|
||||
MessageBody: string;
|
||||
DelaySeconds: number;
|
||||
}
|
||||
|
||||
export interface CreateQueueRequest {
|
||||
QueueName?: string;
|
||||
DefaultVisibilityTimeout?: number;
|
||||
DelaySeconds?: number;
|
||||
Attributes?: Attribute[];
|
||||
MessageAttributes?: { [name:string]: MessageAttribute; }
|
||||
}
|
||||
|
||||
export interface DeleteQueueRequest {
|
||||
QueueUrl?: string;
|
||||
export interface CreateQueueParams {
|
||||
QueueName: string;
|
||||
Attributes: QueueAttributes;
|
||||
}
|
||||
|
||||
export class SendMessageResult {
|
||||
|
||||
export interface QueueAttributes {
|
||||
[name:string]: any;
|
||||
DelaySeconds?: number;
|
||||
MaximumMessageSize?: number;
|
||||
MessageRetentionPeriod?: number;
|
||||
Policy?: any;
|
||||
ReceiveMessageWaitTimeSeconds?: number;
|
||||
VisibilityTimeout?: number;
|
||||
RedrivePolicy?: any;
|
||||
}
|
||||
|
||||
export interface GetQueueAttributesParams {
|
||||
QueueUrl: string;
|
||||
AttributeNames: string[];
|
||||
}
|
||||
|
||||
export interface GetQueueAttributesResult {
|
||||
Attributes: {[name:string]: string};
|
||||
}
|
||||
|
||||
export interface GetQueueUrlParams {
|
||||
QueueName: string;
|
||||
QueueOwnerAWSAccountId?: string;
|
||||
}
|
||||
|
||||
export interface SendMessageResult {
|
||||
MessageId: string;
|
||||
MD5OfMessageBody: string;
|
||||
MD5OfMessageAttributes: string;
|
||||
}
|
||||
|
||||
export class ReceiveMessageResult {
|
||||
export interface ReceiveMessageResult {
|
||||
Messages: Message[];
|
||||
}
|
||||
|
||||
export class Message {
|
||||
export interface Message {
|
||||
MessageId: string;
|
||||
ReceiptHandle: string;
|
||||
MD5OfBody: string;
|
||||
Body: string;
|
||||
Attributes: Attribute[];
|
||||
Attributes: { [name:string]:any };
|
||||
MD5OfMessageAttributes:string;
|
||||
MessageAttributes: { [name:string]: MessageAttribute; }
|
||||
}
|
||||
|
||||
export class DeleteMessageBatchResult {
|
||||
export interface MessageAttribute {
|
||||
StringValue?: string;
|
||||
BinaryValue?: any; //(Buffer, Typed Array, Blob, String)
|
||||
StringListValues?: string[];
|
||||
BinaryListValues?: any[];
|
||||
DataType: string;
|
||||
}
|
||||
|
||||
export interface DeleteMessageBatchResult {
|
||||
Successful: DeleteMessageBatchResultEntry[];
|
||||
Failed: BatchResultErrorEntry[];
|
||||
}
|
||||
|
||||
export class DeleteMessageBatchResultEntry {
|
||||
export interface DeleteMessageBatchResultEntry {
|
||||
Id: string;
|
||||
}
|
||||
|
||||
export class BatchResultErrorEntry {
|
||||
export interface BatchResultErrorEntry {
|
||||
Id: string;
|
||||
Code: string;
|
||||
Message: string;
|
||||
SenderFault: string;
|
||||
Message?: string;
|
||||
SenderFault: boolean;
|
||||
}
|
||||
|
||||
export class SendMessageBatchResult {
|
||||
export interface SendMessageBatchResult {
|
||||
Successful: SendMessageBatchResultEntry[];
|
||||
Failed: BatchResultErrorEntry[];
|
||||
}
|
||||
|
||||
export class SendMessageBatchResultEntry {
|
||||
export interface SendMessageBatchResultEntry {
|
||||
Id: string;
|
||||
MessageId: string;
|
||||
MD5OfMessageBody: string;
|
||||
MD5OfMessageAttributes:string;
|
||||
}
|
||||
|
||||
export class CreateQueueResult {
|
||||
export interface CreateQueueResult {
|
||||
QueueUrl: string;
|
||||
}
|
||||
|
||||
export interface SetQueueAttributesParams {
|
||||
QueueUrl: string;
|
||||
Attributes: QueueAttributes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -935,14 +1054,7 @@ declare module "aws-sdk" {
|
||||
}
|
||||
|
||||
export module s3 {
|
||||
|
||||
export interface Client {
|
||||
config: ClientConfig;
|
||||
|
||||
putObject(params: PutObjectRequest, callback: (err: any, data: any) => void): void;
|
||||
getObject(params: GetObjectRequest, callback: (err: any, data: any) => void): void;
|
||||
}
|
||||
|
||||
|
||||
export interface PutObjectRequest {
|
||||
ACL?: string;
|
||||
Body?: any;
|
||||
@@ -984,4 +1096,102 @@ declare module "aws-sdk" {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export module ecs {
|
||||
export interface CreateServicesParams {
|
||||
desiredCount: number;
|
||||
serviceName: string;
|
||||
taskDefinition: string;
|
||||
clientToken?: string;
|
||||
cluster?: string;
|
||||
deploymentConfiguration?: {
|
||||
maximumPercent?: number;
|
||||
minimumHealthyPercent?: number;
|
||||
};
|
||||
loadBalancers?: {
|
||||
containerName?: string;
|
||||
containerPort?: number;
|
||||
loadBalancerName?: string;
|
||||
}[];
|
||||
role?: string;
|
||||
}
|
||||
|
||||
export interface DescribeServicesParams {
|
||||
services: string[];
|
||||
cluster: string;
|
||||
}
|
||||
|
||||
export interface DescribeTaskDefinitionParams {
|
||||
taskDefinition: string;
|
||||
}
|
||||
|
||||
export interface RegisterTaskDefinitionParams {
|
||||
containerDefinitions: {
|
||||
command?: string[],
|
||||
cpu?: number,
|
||||
disableNetworking?: boolean,
|
||||
dnsSearchDomains?: string[],
|
||||
dnsServers?: string[],
|
||||
dockerLabels?: any,
|
||||
dockerSecurityOptions?: string[],
|
||||
entryPoint?: string[],
|
||||
environment?: any[],
|
||||
essential?: boolean,
|
||||
extraHosts?: {
|
||||
hostName: string,
|
||||
ipAddress: string
|
||||
}[];
|
||||
hostname?: string,
|
||||
image?: string,
|
||||
links?: string[],
|
||||
logConfiguration?: {
|
||||
logDriver: string,
|
||||
options: any
|
||||
}[],
|
||||
memory?: number,
|
||||
mountPoints?: {
|
||||
containerPath: string,
|
||||
readOnly: boolean,
|
||||
sourceVolume: string
|
||||
}[];
|
||||
name?: string,
|
||||
portMappings?: {
|
||||
containerPort?: number,
|
||||
hostPort?: number,
|
||||
protocol: string
|
||||
}[];
|
||||
privileged?: boolean,
|
||||
readonlyRootFilesystem?: boolean,
|
||||
ulimits?: {
|
||||
hardLimit: number,
|
||||
name: string,
|
||||
softLimit: number
|
||||
}[];
|
||||
user?: string,
|
||||
volumesFrom?: {
|
||||
readOnly?: boolean,
|
||||
sourceContainer?: string
|
||||
}[],
|
||||
workingDirectory?: string
|
||||
}[];
|
||||
family: string;
|
||||
volumes?: {
|
||||
host: {
|
||||
sourcePath: string
|
||||
},
|
||||
name: string
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface UpdateServiceParams {
|
||||
service: string;
|
||||
cluster?: string;
|
||||
deploymentConfiguration?: {
|
||||
maximumPercent: number;
|
||||
minimumHealthyPercent: number;
|
||||
};
|
||||
desiredCount?: number;
|
||||
taskDefinition: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+46
-3
@@ -8,21 +8,64 @@ interface Repository {
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface Issue {
|
||||
id: number;
|
||||
title: string;
|
||||
}
|
||||
|
||||
axios.interceptors.request.use<any>(config => {
|
||||
console.log("Method:" + config.method + " Url:" +config.url);
|
||||
return config;
|
||||
});
|
||||
|
||||
axios.interceptors.response.use<any>(config => {
|
||||
console.log("Status:" + config.status);
|
||||
return config;
|
||||
});
|
||||
|
||||
axios.get<Repository>("https://api.github.com/repos/mzabriskie/axios")
|
||||
.then(r => console.log(r.config.method));
|
||||
|
||||
axios<Repository>({
|
||||
var getRepoDetails = axios<Repository>({
|
||||
url: "https://api.github.com/repos/mzabriskie/axios",
|
||||
method: HttpMethod[HttpMethod.GET],
|
||||
headers: {},
|
||||
}).then(r => console.log("ID:" + r.data.id + " Name: " + r.data.name));
|
||||
}).then(r => {
|
||||
console.log("ID:" + r.data.id + " Name: " + r.data.name);
|
||||
return r;
|
||||
});
|
||||
|
||||
axios.post("http://example.com/", {}, {
|
||||
transformRequest: (data: any) => data
|
||||
});
|
||||
|
||||
axios.post("http://example.com/", {}, {
|
||||
axios.post("http://example.com/", {
|
||||
headers: {'X-Custom-Header': 'foobar'}
|
||||
}, {
|
||||
transformRequest: [
|
||||
(data: any) => data
|
||||
]
|
||||
});
|
||||
|
||||
var getRepoIssue = axios.get<Issue>("https://api.github.com/repos/mzabriskie/axios/issues/1");
|
||||
|
||||
var axiosInstance = axios.create({
|
||||
baseURL: "https://api.github.com/repos/mzabriskie/axios/",
|
||||
timeout: 1000
|
||||
});
|
||||
|
||||
axiosInstance.request({url: "issues/1"});
|
||||
|
||||
axios.all<Repository, Repository>([getRepoDetails, getRepoDetails]).then(([repo1, repo2]) => {
|
||||
var sumIds = repo1.data.id + repo2.data.id;
|
||||
console.log("Sum ID:" + sumIds);
|
||||
return sumIds;
|
||||
});
|
||||
|
||||
var repoSum = (repo1: Axios.AxiosXHR<Repository>, repo2: Axios.AxiosXHR<Repository>) => {
|
||||
var sumIds = repo1.data.id + repo2.data.id;
|
||||
console.log("Sum ID:" + sumIds);
|
||||
return sumIds;
|
||||
};
|
||||
|
||||
axios.all<Repository, Repository>([getRepoDetails, getRepoDetails]).then(axios.spread(repoSum));
|
||||
|
||||
Vendored
+246
-132
@@ -1,162 +1,276 @@
|
||||
// Type definitions for axios 0.5.2
|
||||
// Type definitions for axios 0.8.1
|
||||
// Project: https://github.com/mzabriskie/axios
|
||||
// Definitions by: Marcel Buesing <https://github.com/marcelbuesing>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts"/>
|
||||
|
||||
declare module Axios {
|
||||
|
||||
/**
|
||||
* <T> - request body data type
|
||||
*/
|
||||
interface AxiosXHRConfigBase<T> {
|
||||
interface IThenable<R> {
|
||||
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => U | IThenable<U>): IThenable<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => void): IThenable<U>;
|
||||
}
|
||||
|
||||
interface IPromise<R> extends IThenable<R> {
|
||||
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => U | IThenable<U>): IPromise<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => void): IPromise<U>;
|
||||
catch<U>(onRejected?: (error: any) => U | IThenable<U>): IPromise<U>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the request data before it is sent to the server.
|
||||
* This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
|
||||
* The last function in the array must return a string or an ArrayBuffer
|
||||
* HTTP Basic auth details
|
||||
*/
|
||||
transformRequest?: (<U>(data:T) => U)|[<U>(data:T) => U];
|
||||
interface AxiosHttpBasicAuth {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* change the response data to be made before it is passed to then/catch
|
||||
* Common axios XHR config interface
|
||||
* <T> - request body data type
|
||||
*/
|
||||
transformResponse?: <U>(data:T) => U;
|
||||
interface AxiosXHRConfigBase<T> {
|
||||
/**
|
||||
* will be prepended to `url` unless `url` is absolute.
|
||||
* It can be convenient to set `baseURL` for an instance
|
||||
* of axios to pass relative URLs to methods of that instance.
|
||||
*/
|
||||
baseURL?: string;
|
||||
|
||||
/**
|
||||
* custom headers to be sent
|
||||
*/
|
||||
headers?: Object;
|
||||
|
||||
/**
|
||||
* URL parameters to be sent with the request
|
||||
*/
|
||||
params?: Object;
|
||||
|
||||
/**
|
||||
* optional function in charge of serializing `params`
|
||||
* (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
|
||||
*/
|
||||
paramsSerializer?: (params: Object) => string;
|
||||
|
||||
/**
|
||||
* specifies the number of milliseconds before the request times out.
|
||||
* If the request takes longer than `timeout`, the request will be aborted.
|
||||
*/
|
||||
timeout?: number;
|
||||
|
||||
/**
|
||||
* indicates whether or not cross-site Access-Control requests
|
||||
* should be made using credentials
|
||||
*/
|
||||
withCredentials?: boolean;
|
||||
|
||||
/**
|
||||
* indicates that HTTP Basic auth should be used, and supplies
|
||||
* credentials. This will set an `Authorization` header,
|
||||
* overwriting any existing `Authorization` custom headers you have
|
||||
* set using `headers`.
|
||||
*/
|
||||
auth?: AxiosHttpBasicAuth;
|
||||
|
||||
/**
|
||||
* indicates the type of data that the server will respond with
|
||||
* options are 'arraybuffer', 'blob', 'document', 'json', 'text'
|
||||
*/
|
||||
responseType?: string;
|
||||
|
||||
/**
|
||||
* name of the cookie to use as a value for xsrf token
|
||||
*/
|
||||
xsrfCookieName?: string;
|
||||
|
||||
/**
|
||||
* name of the http header that carries the xsrf token value
|
||||
*/
|
||||
xsrfHeaderName?: string;
|
||||
|
||||
/**
|
||||
* Change the request data before it is sent to the server.
|
||||
* This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
|
||||
* The last function in the array must return a string or an ArrayBuffer
|
||||
*/
|
||||
transformRequest?: (<U>(data: T) => U) | [<U>(data: T) => U];
|
||||
|
||||
/**
|
||||
* change the response data to be made before it is passed to then/catch
|
||||
*/
|
||||
transformResponse?: <U>(data: T) => U;
|
||||
}
|
||||
|
||||
/**
|
||||
* custom headers to be sent
|
||||
* <T> - request body data type
|
||||
*/
|
||||
headers?: Object;
|
||||
interface AxiosXHRConfig<T> extends AxiosXHRConfigBase<T> {
|
||||
/**
|
||||
* server URL that will be used for the request, options are:
|
||||
* GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* request method to be used when making the request
|
||||
*/
|
||||
method?: string;
|
||||
|
||||
/**
|
||||
* data to be sent as the request body
|
||||
* Only applicable for request methods 'PUT', 'POST', and 'PATCH'
|
||||
* When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash
|
||||
*/
|
||||
data?: T;
|
||||
}
|
||||
|
||||
/**
|
||||
* URL parameters to be sent with the request
|
||||
* <T> - expected response type,
|
||||
* <U> - request body data type
|
||||
*/
|
||||
params?: Object;
|
||||
interface AxiosXHR<T> {
|
||||
/**
|
||||
* Response that was provided by the server
|
||||
*/
|
||||
data: T;
|
||||
|
||||
/**
|
||||
* HTTP status code from the server response
|
||||
*/
|
||||
status: number;
|
||||
|
||||
/**
|
||||
* HTTP status message from the server response
|
||||
*/
|
||||
statusText: string;
|
||||
|
||||
/**
|
||||
* headers that the server responded with
|
||||
*/
|
||||
headers: Object;
|
||||
|
||||
/**
|
||||
* config that was provided to `axios` for the request
|
||||
*/
|
||||
config: AxiosXHRConfig<T>;
|
||||
}
|
||||
|
||||
interface Interceptor {
|
||||
/**
|
||||
* intercept request before it is sent
|
||||
*/
|
||||
request: RequestInterceptor;
|
||||
|
||||
/**
|
||||
* intercept response of request when it is received.
|
||||
*/
|
||||
response: ResponseInterceptor
|
||||
}
|
||||
|
||||
interface RequestInterceptor {
|
||||
/**
|
||||
* <U> - request body data type
|
||||
*/
|
||||
use<U>(fn: (config: AxiosXHRConfig<U>) => AxiosXHRConfig<U>): void;
|
||||
}
|
||||
|
||||
interface ResponseInterceptor {
|
||||
/**
|
||||
* <T> - expected response type
|
||||
*/
|
||||
use<T>(fn: (config: AxiosXHR<T>) => AxiosXHR<T>): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* indicates whether or not cross-site Access-Control requests
|
||||
* should be made using credentials
|
||||
* <T> - expected response type,
|
||||
* <U> - request body data type
|
||||
*/
|
||||
withCredentials?: boolean;
|
||||
interface AxiosInstance {
|
||||
|
||||
/**
|
||||
* Send request as configured
|
||||
*/
|
||||
<T>(config: AxiosXHRConfig<T>): IPromise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* Send request as configured
|
||||
*/
|
||||
new <T>(config: AxiosXHRConfig<T>): IPromise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* Send request as configured
|
||||
*/
|
||||
request<T>(config: AxiosXHRConfig<T>): IPromise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* intercept requests or responses before they are handled by then or catch
|
||||
*/
|
||||
interceptors: Interceptor;
|
||||
|
||||
/**
|
||||
* equivalent to `Promise.all`
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>, T6 | IPromise<AxiosXHR<T6>>, T7 | IPromise<AxiosXHR<T7>>, T8 | IPromise<AxiosXHR<T8>>, T9 | IPromise<AxiosXHR<T9>>, T10 | IPromise<AxiosXHR<T10>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>, AxiosXHR<T6>, AxiosXHR<T7>, AxiosXHR<T8>, AxiosXHR<T9>, AxiosXHR<T10>]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>, T6 | IPromise<AxiosXHR<T6>>, T7 | IPromise<AxiosXHR<T7>>, T8 | IPromise<AxiosXHR<T8>>, T9 | IPromise<AxiosXHR<T9>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>, AxiosXHR<T6>, AxiosXHR<T7>, AxiosXHR<T8>, AxiosXHR<T9>]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>, T6 | IPromise<AxiosXHR<T6>>, T7 | IPromise<AxiosXHR<T7>>, T8 | IPromise<AxiosXHR<T8>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>, AxiosXHR<T6>, AxiosXHR<T7>, AxiosXHR<T8>]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>, T6 | IPromise<AxiosXHR<T6>>, T7 | IPromise<AxiosXHR<T7>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>, AxiosXHR<T6>, AxiosXHR<T7>]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>, T6 | IPromise<AxiosXHR<T6>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>, AxiosXHR<T6>]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>]>;
|
||||
all<T1, T2, T3>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>]>;
|
||||
all<T1, T2>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>]>;
|
||||
|
||||
/**
|
||||
* spread array parameter to `fn`.
|
||||
* note: alternative to `spread`, destructuring assignment.
|
||||
*/
|
||||
spread<T1, T2, U>(fn: (t1: T1, t2: T2) => U): (arr: ([T1, T2])) => U;
|
||||
|
||||
/**
|
||||
* convenience alias, method = GET
|
||||
*/
|
||||
get<T>(url: string, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
|
||||
|
||||
|
||||
/**
|
||||
* convenience alias, method = DELETE
|
||||
*/
|
||||
delete<T>(url: string, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* convenience alias, method = HEAD
|
||||
*/
|
||||
head<T>(url: string, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* convenience alias, method = POST
|
||||
*/
|
||||
post<T>(url: string, data?: any, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* convenience alias, method = PUT
|
||||
*/
|
||||
put<T>(url: string, data?: any, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* convenience alias, method = PATCH
|
||||
*/
|
||||
patch<T>(url: string, data?: any, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* indicates the type of data that the server will respond with
|
||||
* options are 'arraybuffer', 'blob', 'document', 'json', 'text'
|
||||
* <T> - expected response type,
|
||||
*/
|
||||
responseType?: string;
|
||||
|
||||
/**
|
||||
* name of the cookie to use as a value for xsrf token
|
||||
*/
|
||||
xsrfCookieName?: string;
|
||||
|
||||
/**
|
||||
* name of the http header that carries the xsrf token value
|
||||
*/
|
||||
xsrfHeaderName?: string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <T> - request body data type
|
||||
*/
|
||||
interface AxiosXHRConfig<T> extends AxiosXHRConfigBase<T> {
|
||||
/**
|
||||
* server URL that will be used for the request, options are:
|
||||
* GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* request method to be used when making the request
|
||||
*/
|
||||
method?: string;
|
||||
|
||||
/**
|
||||
* data to be sent as the request body
|
||||
* Only applicable for request methods 'PUT', 'POST', and 'PATCH'
|
||||
* When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash
|
||||
*/
|
||||
data?: T;
|
||||
}
|
||||
|
||||
/**
|
||||
* <T> - expected response type,
|
||||
* <U> - request body data type
|
||||
*/
|
||||
interface AxiosXHR<T> {
|
||||
/**
|
||||
* Response that was provided by the server
|
||||
*/
|
||||
data: T;
|
||||
|
||||
/**
|
||||
* HTTP status code from the server response
|
||||
*/
|
||||
status: number;
|
||||
|
||||
/**
|
||||
* HTTP status message from the server response
|
||||
*/
|
||||
statusText: string;
|
||||
|
||||
/**
|
||||
* headers that the server responded with
|
||||
*/
|
||||
headers: Object;
|
||||
|
||||
/**
|
||||
* config that was provided to `axios` for the request
|
||||
*/
|
||||
config: AxiosXHRConfig<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* <T> - expected response type,
|
||||
* <U> - request body data type
|
||||
*/
|
||||
interface AxiosStatic {
|
||||
|
||||
<T>(config: AxiosXHRConfig<T>): Promise<AxiosXHR<T>>;
|
||||
|
||||
new <T>(config: AxiosXHRConfig<T>): Promise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* convenience alias, method = GET
|
||||
*/
|
||||
get<T>(url: string, config?: AxiosXHRConfigBase<T>): Promise<AxiosXHR<T>>;
|
||||
|
||||
|
||||
/**
|
||||
* convenience alias, method = DELETE
|
||||
*/
|
||||
delete<T>(url: string, config?: AxiosXHRConfigBase<T>): Promise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* convenience alias, method = HEAD
|
||||
*/
|
||||
head<T>(url: string, config?: AxiosXHRConfigBase<T>): Promise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* convenience alias, method = POST
|
||||
*/
|
||||
post<T>(url: string, data?: any, config?: AxiosXHRConfigBase<T>): Promise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* convenience alias, method = PUT
|
||||
*/
|
||||
put<T>(url: string, data?: any, config?: AxiosXHRConfigBase<T>): Promise<AxiosXHR<T>>;
|
||||
|
||||
/**
|
||||
* convenience alias, method = PATCH
|
||||
*/
|
||||
patch<T>(url: string, data?: any, config?: AxiosXHRConfigBase<T>): Promise<AxiosXHR<T>>;
|
||||
}
|
||||
interface AxiosStatic extends AxiosInstance {
|
||||
/**
|
||||
* create a new instance of axios with a custom config
|
||||
*/
|
||||
create<T>(config: AxiosXHRConfigBase<T>): AxiosInstance;
|
||||
}
|
||||
}
|
||||
|
||||
declare var axios: Axios.AxiosStatic;
|
||||
|
||||
declare module "axios" {
|
||||
export = axios;
|
||||
export = axios;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/// <reference path="azure-mobile-apps.d.ts" />
|
||||
|
||||
import express = require('express');
|
||||
import mobileApps = require('azure-mobile-apps');
|
||||
import logger = require('azure-mobile-apps/src/logger');
|
||||
import queries = require('azure-mobile-apps/src/query');
|
||||
|
||||
var app = express(),
|
||||
mobileApp = mobileApps();
|
||||
|
||||
// various configuration permutations
|
||||
mobileApps({
|
||||
debug: true,
|
||||
data: {
|
||||
provider: 'mssql',
|
||||
server: '',
|
||||
user: '',
|
||||
database: '',
|
||||
password: ''
|
||||
}
|
||||
});
|
||||
|
||||
mobileApps({
|
||||
data: {
|
||||
provider: 'memory'
|
||||
}
|
||||
})
|
||||
|
||||
// it would be nice to integrate with winston
|
||||
mobileApps({ logging: { level: 'silly', transports: [{}] } })
|
||||
|
||||
// various custom middleware syntaxes
|
||||
mobileApp.use(function (req: any, res: any, next: any) { next(); });
|
||||
mobileApp.use([function () {}, function () {}]);
|
||||
mobileApp.use(function () {}, function () {});
|
||||
mobileApp.use(function () {}).use(function () {});
|
||||
|
||||
// basic syntax for tables and api
|
||||
mobileApp.tables.add('todoitem');
|
||||
mobileApp.tables.add('todoitem', { authorize: true });
|
||||
mobileApp.tables.add('todoitem', mobileApps.table());
|
||||
mobileApp.tables.import('tables');
|
||||
mobileApp.api.add('api', { authorize: true, get: function () {}, delete: function () {} });
|
||||
mobileApp.api.import('api');
|
||||
|
||||
// Express.Table, instantiated from the mobile app
|
||||
var table = mobileApp.table()
|
||||
table.use(function (req: Express.Request, res: Express.Response, next: any) {
|
||||
next(new Error());
|
||||
});
|
||||
table.use([function () {}, function () {}]);
|
||||
table.read(function (context: Azure.MobileApps.Context) {
|
||||
context.query.where({ p1: 'test' });
|
||||
return context.execute()
|
||||
.then(function (result: any) {
|
||||
return result;
|
||||
})
|
||||
.catch(function (error: any) { })
|
||||
.then(function () {});
|
||||
});
|
||||
table.insert(function (context: Azure.MobileApps.Context) {
|
||||
context.query.id = 'anotherId';
|
||||
context.query.single = true;
|
||||
context.item.userId = context.user.id;
|
||||
context.push.send('tag', {}, function (error, result) {});
|
||||
context.push.gcm.send('tag', {}, function (error, result) {});
|
||||
context.push.apns.send('tag', { payload: { } }, function (error, result) {});
|
||||
context.push.wns.sendToastText01('tag', '', { headers: { } }, function (error, result) {});
|
||||
});
|
||||
table.read.use(function () {});
|
||||
table.read.use([function () {}, function () {}]);
|
||||
table.read.use(function () {}, function () {});
|
||||
table.use(function () {}).use(function () {}).read(function () {}).use(function () {})
|
||||
|
||||
// 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();
|
||||
table2.read(function (context: Azure.MobileApps.Context) {})
|
||||
|
||||
// Logger
|
||||
logger.silly('test', 'message');
|
||||
logger.error('Something happened', new Error());
|
||||
mobileApps.logger.debug('a debug message')
|
||||
|
||||
// Query
|
||||
queries.create('table').where({ x: 10 }).select('col1,col2');
|
||||
mobileApps.query.create('table');
|
||||
+279
@@ -0,0 +1,279 @@
|
||||
// Type definitions for azure-mobile-apps v2.0.0-beta3
|
||||
// Project: https://github.com/Azure/azure-mobile-apps-node/
|
||||
// Definitions by: Microsoft Azure <https://github.com/Azure/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="../azure-sb/azure-sb.d.ts" />
|
||||
|
||||
declare module "azure-mobile-apps" {
|
||||
interface AzureMobileApps {
|
||||
(configuration?: Azure.MobileApps.Configuration): Azure.MobileApps.Platforms.Express.MobileApp;
|
||||
table(): Azure.MobileApps.Platforms.Express.Table;
|
||||
logger: Azure.MobileApps.Logger;
|
||||
query: Azure.MobileApps.Query;
|
||||
}
|
||||
|
||||
var out: AzureMobileApps;
|
||||
export = out;
|
||||
}
|
||||
declare module "azure-mobile-apps/src/logger" {
|
||||
var logger: Azure.MobileApps.Logger;
|
||||
export = logger;
|
||||
}
|
||||
|
||||
declare module "azure-mobile-apps/src/query" {
|
||||
var query: Azure.MobileApps.Query;
|
||||
export = query;
|
||||
}
|
||||
|
||||
declare module Azure.MobileApps {
|
||||
// the additional Platforms namespace is required to avoid collisions with the main Express namespace
|
||||
export module Platforms {
|
||||
export module Express {
|
||||
interface MobileApp {
|
||||
configuration: Configuration;
|
||||
tables: Tables;
|
||||
table(): Table;
|
||||
api: Api;
|
||||
use(...middleware: Middleware[]): MobileApp;
|
||||
use(middleware: Middleware[]): MobileApp;
|
||||
}
|
||||
|
||||
interface Api {
|
||||
add(name: string, definition: ApiDefinition): void;
|
||||
import(fileOrFolder: string): void;
|
||||
}
|
||||
|
||||
interface Table {
|
||||
authorize?: boolean;
|
||||
autoIncrement?: boolean;
|
||||
dynamicSchema?: boolean;
|
||||
name: string;
|
||||
columns?: any;
|
||||
schema: string;
|
||||
|
||||
use(...middleware: Middleware[]): Table;
|
||||
use(middleware: Middleware[]): Table;
|
||||
read: TableOperation;
|
||||
update: TableOperation;
|
||||
insert: TableOperation;
|
||||
delete: TableOperation;
|
||||
undelete: TableOperation;
|
||||
}
|
||||
|
||||
interface TableOperation {
|
||||
(operationHandler: (context: Context) => void): Table;
|
||||
use(...middleware: Middleware[]): Table;
|
||||
use(middleware: Middleware[]): Table;
|
||||
}
|
||||
|
||||
interface Tables {
|
||||
configuration: Configuration;
|
||||
add(name: string, definition?: Table | TableDefinition): void;
|
||||
import(fileOrFolder: string): void;
|
||||
initialize(): Thenable<any>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export module Data {
|
||||
interface Table {
|
||||
read(query: QueryJs): Thenable<any[]>;
|
||||
update(item: any, query: QueryJs): Thenable<any>;
|
||||
insert(item: any): Thenable<any>;
|
||||
delete(query: QueryJs, version: string): Thenable<any>;
|
||||
undelete(query: QueryJs, version: string): Thenable<any>;
|
||||
truncate(): Thenable<void>;
|
||||
initialize(): Thenable<void>;
|
||||
schema(): Thenable<Column[]>;
|
||||
}
|
||||
|
||||
interface Column {
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
}
|
||||
|
||||
// auth
|
||||
interface User {
|
||||
id: string;
|
||||
claims: any[];
|
||||
token: string;
|
||||
getIdentity(provider: string): Thenable<any>;
|
||||
}
|
||||
|
||||
interface Auth {
|
||||
validate(token: string): Thenable<User>;
|
||||
decode(token: string): User;
|
||||
sign(payload: any): string;
|
||||
}
|
||||
|
||||
// configuration
|
||||
interface Configuration {
|
||||
platform?: string;
|
||||
basePath?: string;
|
||||
configFile?: string;
|
||||
promiseConstructor?: (resolve: (result: any) => void, reject: (error: any) => void) => Thenable<any>;
|
||||
apiRootPath?: string;
|
||||
tableRootPath?: string;
|
||||
notificationRootPath?: string;
|
||||
swaggerPath?: string;
|
||||
authStubRoute?: string;
|
||||
debug?: boolean;
|
||||
version?: string;
|
||||
apiVersion?: string;
|
||||
homePage?: boolean;
|
||||
swagger?: boolean;
|
||||
maxTop?: number;
|
||||
pageSize?: number;
|
||||
logging?: Configuration.Logging;
|
||||
data?: Configuration.Data;
|
||||
auth?: Configuration.Auth;
|
||||
cors?: Configuration.Cors;
|
||||
notifications?: Configuration.Notifications;
|
||||
}
|
||||
|
||||
export module Configuration {
|
||||
// it would be nice to have the config for various providers in separate interfaces,
|
||||
// but this is the simplest solution to support variations of the current setup
|
||||
interface Data {
|
||||
provider: string;
|
||||
user?: string;
|
||||
password?: string;
|
||||
server?: string;
|
||||
port?: number;
|
||||
database?: string;
|
||||
connectionTimeout?: string;
|
||||
options?: { encrypt: boolean };
|
||||
schema?: string;
|
||||
dynamicSchema?: boolean;
|
||||
}
|
||||
|
||||
interface Auth {
|
||||
secret: string;
|
||||
validateTokens?: boolean;
|
||||
}
|
||||
|
||||
interface Logging {
|
||||
level?: string;
|
||||
transports?: LoggingTransport[];
|
||||
}
|
||||
|
||||
interface LoggingTransport { }
|
||||
|
||||
interface Cors {
|
||||
maxAge?: number;
|
||||
origins: string[];
|
||||
}
|
||||
|
||||
interface Notifications {
|
||||
hubName: string;
|
||||
connectionString?: string;
|
||||
endpoint?: string;
|
||||
sharedAccessKeyName?: string;
|
||||
sharedAccessKeyValue?: string;
|
||||
}
|
||||
}
|
||||
|
||||
// query
|
||||
interface Query {
|
||||
create(tableName: string): QueryJs;
|
||||
fromRequest(req: Express.Request): QueryJs;
|
||||
toOData(query: QueryJs): OData;
|
||||
}
|
||||
|
||||
interface QueryJs {
|
||||
includeTotalCount?: boolean;
|
||||
orderBy(properties: string): QueryJs;
|
||||
orderByDescending(properties: string): QueryJs;
|
||||
select(properties: string): QueryJs;
|
||||
skip(count: number): QueryJs;
|
||||
take(count: number): QueryJs;
|
||||
where(filter: any): QueryJs;
|
||||
// these are properties added by the SDK
|
||||
id?: string | number;
|
||||
single?: boolean;
|
||||
}
|
||||
|
||||
interface OData {
|
||||
table: string;
|
||||
filters?: string;
|
||||
ordering?: string;
|
||||
orderClauses?: string;
|
||||
skip?: number;
|
||||
take?: number;
|
||||
selections?: string;
|
||||
includeTotalCount?: boolean;
|
||||
}
|
||||
|
||||
// general
|
||||
var nh: Azure.ServiceBus.NotificationHubService;
|
||||
interface Context {
|
||||
query: QueryJs;
|
||||
id: string | number;
|
||||
item: any;
|
||||
req: Express.Request;
|
||||
res: Express.Response;
|
||||
data: (table: TableDefinition) => Data.Table;
|
||||
tables: (tableName: string) => Data.Table;
|
||||
user: User;
|
||||
push: typeof nh;
|
||||
logger: Logger;
|
||||
execute(): Thenable<any>;
|
||||
}
|
||||
|
||||
interface TableDefinition {
|
||||
authorize?: boolean;
|
||||
autoIncrement?: boolean;
|
||||
dynamicSchema?: boolean;
|
||||
name?: string;
|
||||
columns?: any;
|
||||
schema?: string;
|
||||
}
|
||||
|
||||
interface ApiDefinition {
|
||||
authorize?: boolean;
|
||||
get?: Middleware | Middleware[];
|
||||
post?: Middleware | Middleware[];
|
||||
patch?: Middleware | Middleware[];
|
||||
put?: Middleware | Middleware[];
|
||||
delete?: Middleware | Middleware[];
|
||||
}
|
||||
|
||||
interface Thenable<R> {
|
||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
|
||||
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
||||
catch<U>(onRejected?: (error: any) => void): Thenable<U>;
|
||||
}
|
||||
|
||||
interface Logger {
|
||||
log(level: string, ...message: any[]): void;
|
||||
silly(...message: any[]): void;
|
||||
debug(...message: any[]): void;
|
||||
verbose(...message: any[]): void;
|
||||
info(...message: any[]): void;
|
||||
warn(...message: any[]): void;
|
||||
error(...message: any[]): void;
|
||||
}
|
||||
|
||||
interface Middleware {
|
||||
(req: Express.Request, res: Express.Response, next: NextMiddleware): void;
|
||||
}
|
||||
|
||||
interface NextMiddleware {
|
||||
(error?: any): void;
|
||||
}
|
||||
}
|
||||
|
||||
// additions to the Express modules
|
||||
declare module Express {
|
||||
interface Request {
|
||||
azureMobile: Azure.MobileApps.Context
|
||||
}
|
||||
|
||||
interface Response {
|
||||
results?: any;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/// <reference path="./azure-sb.d.ts" />
|
||||
|
||||
var nh = new Azure.ServiceBus.NotificationHubService();
|
||||
nh.send('tag', '<payload></payload>', function (error, result) {});
|
||||
nh.send('tag', '<payload></payload>', { headers: {} }, function (error, result) {});
|
||||
|
||||
nh.apns.send('tag', { payload: { } }, function (error, result) {});
|
||||
nh.apns.send(['tag'], { payload: { } }, function (error, result) {});
|
||||
nh.gcm.send('tag', { }, function (error, result) {});
|
||||
nh.gcm.send(['tag'], { }, function (error, result) {});
|
||||
nh.wns.send('tag', '<payload></payload>', 'wns/toast', function (error, result) {});
|
||||
nh.wns.send(['tag'], '<payload></payload>', 'wns/toast', function (error, result) {});
|
||||
nh.wns.send('tag', '<payload></payload>', 'wns/toast', { headers: {} }, function (error, result) {});
|
||||
nh.wns.sendToastText01('tag', '<payload></payload>', function (error, result) {});
|
||||
nh.wns.sendToastText01(['tag'], '<payload></payload>', function (error, result) {});
|
||||
nh.wns.sendToastText01('tag', '<payload></payload>', { headers: {} }, function (error, result) {});
|
||||
Vendored
+173
@@ -0,0 +1,173 @@
|
||||
// Type definitions for azure-sb
|
||||
// Project: https://github.com/Azure/azure-sdk-for-node/tree/master/lib/services/serviceBus
|
||||
// Definitions by: Microsoft Azure <https://github.com/Azure/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module Azure.ServiceBus {
|
||||
interface Callback {
|
||||
(error: any, response: any): void;
|
||||
}
|
||||
|
||||
interface NotificationHubRegistration {
|
||||
RegistrationId: string;
|
||||
ChannelUri?: string;
|
||||
DeviceToken?: string;
|
||||
gcmRegistrationId?: string;
|
||||
Tags?: string;
|
||||
BodyTemplate?: any;
|
||||
WnsHeaders?: any;
|
||||
MpnsHeaders?: any;
|
||||
Expiry?: Date;
|
||||
}
|
||||
|
||||
export class NotificationHubService {
|
||||
new(hubName: string, endpointOrConnectionString: string, sharedAccessKeyName?: string, sharedAccessKeyValue?: string): NotificationHubService;
|
||||
hubName: string;
|
||||
wns: Wns.Service;
|
||||
apns: Apns.Service;
|
||||
gcm: Gcm.Service;
|
||||
mpns: Mpns.Service;
|
||||
send(tags: string, payload: Object | string, optionsOrCallback?: { headers: Object } | Callback, callback?: Callback): void;
|
||||
|
||||
createOrUpdateInstallation(installation: string, options: any, callback?: Callback): void;
|
||||
patchInstallation(installationId: string, partialUpdateOperations: any[], options: any, callback?: Callback): void;
|
||||
deleteInstallation(installationId: string, options: any, callback?: Callback): void;
|
||||
getInstallation(installationId: string, options: any, callback?: Callback): void;
|
||||
|
||||
/*
|
||||
// old school?
|
||||
createRegistrationId(callback?: Callback): void;
|
||||
getRegistration(registrationId: string, options: any, callback?: Callback): void;
|
||||
deleteRegistration(registrationId: string, options?: { etag: any }, callback?: Callback): void;
|
||||
updateRegistration(registration: NotificationHubRegistration, options?: { etag: any }, callback?: Callback): void;
|
||||
createOrUpdateRegistration(registration: NotificationHubRegistration, options?: { etag: any }, callback?: Callback): void;
|
||||
listRegistrations(options?: { top: number, skip: number }, callback?: Callback): void;
|
||||
listRegistrationsByTag(tag: string, options?: { top: number, skip: number }, callback?: Callback): void;
|
||||
*/
|
||||
}
|
||||
|
||||
export module Apns {
|
||||
interface Payload {
|
||||
expiry?: Date;
|
||||
aps?: Object;
|
||||
badge?: number;
|
||||
alert?: string;
|
||||
sound?: string;
|
||||
payload: Object;
|
||||
}
|
||||
|
||||
interface Service {
|
||||
new(service: NotificationHubService): Service;
|
||||
send(tags: string | string[], payload: Apns.Payload, callback?: Callback): void;
|
||||
createNativeRegistration(token: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void;
|
||||
createOrUpdateNativeRegistration(registrationId: string, token: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void;
|
||||
createTemplateRegistration(token: string, tags: string | string[], template: Apns.Payload, optionsOrCallback?: Object | Callback, callback?: Callback): void;
|
||||
createOrUpdateTemplateRegistration(registrationId: string, token: string, tags: string | string[], template: Apns.Payload, optionsOrCallback?: Object | Callback, callback?: Callback): void;
|
||||
updateTemplateRegistration(registrationId: string, token: string, tags: string | string[], template: Apns.Payload, optionsOrCallback?: Object | Callback, callback?: Callback): void;
|
||||
listRegistrationsByToken(token: string, optionsOrCallback?: { top: number, skip: number } | Callback, callback?: Callback): void;
|
||||
}
|
||||
}
|
||||
export module Gcm {
|
||||
interface Service {
|
||||
new(service: NotificationHubService): Service;
|
||||
send(tags: string | string[], payload: any, callback?: Callback): void;
|
||||
createNativeRegistration(gcmRegistrationId: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void;
|
||||
createOrUpdateNativeRegistration(registrationId: string, gcmRegistrationId: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void;
|
||||
createTemplateRegistration(gcmRegistrationId: string, tags: string | string[], template: any, optionsOrCallback?: Object | Callback, callback?: Callback): void;
|
||||
createOrUpdateTemplateRegistration(registrationId: string, gcmRegistrationId: string, tags: string | string[], template: any, optionsOrCallback?: Object | Callback, callback?: Callback): void;
|
||||
updateTemplateRegistration(registrationId: string, gcmRegistrationId: string, tags: string | string[], template: any, optionsOrCallback?: Object | Callback, callback?: Callback): void;
|
||||
listRegistrationsByGcmRegistrationId(gcmRegistrationId: string, optionsOrCallback?: { top: number, skip: number } | Callback, callback?: Callback): void;
|
||||
}
|
||||
}
|
||||
|
||||
export module Mpns { interface Service { } }
|
||||
|
||||
export module Wns {
|
||||
interface Payload {
|
||||
text1?: string;
|
||||
text2?: string;
|
||||
text3?: string;
|
||||
text4?: string;
|
||||
image1src?: string;
|
||||
image1alt?: string;
|
||||
image2src?: string;
|
||||
image2alt?: string;
|
||||
image3src?: string;
|
||||
image3alt?: string;
|
||||
image4src?: string;
|
||||
image4alt?: string;
|
||||
lang?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
headers: Object;
|
||||
}
|
||||
|
||||
interface Service {
|
||||
new(service: NotificationHubService): Service;
|
||||
sendTileSquareBlock(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileSquareText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileSquareText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileSquareText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileSquareText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideText05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideText06(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideText07(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideText08(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideText09(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideText10(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideText11(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileSquareImage(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileSquarePeekImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileSquarePeekImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileSquarePeekImageAndText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileSquarePeekImageAndText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideImage(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideImageCollection(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideBlockAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideBlockAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideSmallImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideSmallImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideSmallImageAndText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideSmallImageAndText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWideSmallImageAndText05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImageCollection01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImageCollection02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImageCollection03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImageCollection04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImageCollection05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImageCollection06(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImage01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImage02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImage03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImage04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImage05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendTileWidePeekImage06(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendToastText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendToastText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendToastText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendToastText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendToastImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendToastImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendToastImageAndText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendToastImageAndText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
// badges = ['none','activity','alert','available','away','busy','newMessage','paused','playing','unavailable','error', 'attention']
|
||||
sendBadge(tags: string | string[], value: string | number, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
sendRaw(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
// types = ['wns/toast', 'wns/badge', 'wns/tile', 'wns/raw']
|
||||
send(tags: string | string[], payload: string, type: string, optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
createNativeRegistration(channel: string, tags: string | string[], optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
createOrUpdateNativeRegistration(registrationId: string, channel: string, tags: string | string[], optionsOrCallback?: Options | Callback, callback?: Callback): void;
|
||||
listRegistrationsByChannel(channel: string, optionsOrCallback?: { top: number, skip: number } | Callback, callback?: Callback): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
/// <reference path="babylon.d.ts" />
|
||||
Vendored
+6327
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user