mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-06 13:11:46 +00:00
@@ -35,3 +35,5 @@ node_modules
|
||||
|
||||
.sublimets
|
||||
.settings/launch.json
|
||||
|
||||
.vscode
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import packer = require("3d-bin-packing");
|
||||
import samchon = require("samchon-framework");
|
||||
|
||||
function main(): void
|
||||
{
|
||||
///////////////////////////
|
||||
// CONSTRUCT OBJECTS
|
||||
///////////////////////////
|
||||
let wrapperArray: bws.packer.WrapperArray = new packer.WrapperArray();
|
||||
let instanceArray: bws.packer.InstanceArray = new packer.InstanceArray();
|
||||
|
||||
// Wrappers
|
||||
wrapperArray.push
|
||||
(
|
||||
new packer.Wrapper("Large", 1000, 40, 40, 15, 0),
|
||||
new packer.Wrapper("Medium", 700, 20, 20, 10, 0),
|
||||
new packer.Wrapper("Small", 500, 15, 15, 8, 0)
|
||||
);
|
||||
|
||||
///////
|
||||
// Each Instance is repeated #15
|
||||
///////
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Eraser", 1, 2, 5));
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Book", 15, 30, 3));
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Drink", 3, 3, 10));
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Umbrella", 5, 5, 20));
|
||||
|
||||
// Wrappers also can be packed into another Wrapper.
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Wrapper("Notebook-Box", 2000, 30, 40, 4, 2));
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Wrapper("Tablet-Box", 2500, 20, 28, 2, 0));
|
||||
|
||||
///////////////////////////
|
||||
// BEGINS PACKING
|
||||
///////////////////////////
|
||||
// CONSTRUCT PACKER
|
||||
let my_packer: bws.packer.Packer = new packer.Packer(wrapperArray, instanceArray);
|
||||
|
||||
///////
|
||||
// PACK (OPTIMIZE)
|
||||
let result: bws.packer.WrapperArray = my_packer.optimize();
|
||||
///////
|
||||
|
||||
///////////////////////////
|
||||
// TRACE PACKING RESULT
|
||||
///////////////////////////
|
||||
let xml: samchon.library.XML = result.toXML();
|
||||
console.log(xml.toString());
|
||||
}
|
||||
|
||||
main();
|
||||
Vendored
+1500
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"3d-bin-packing.d.ts",
|
||||
"3d-bin-packing-tests.ts"
|
||||
]
|
||||
}
|
||||
+4
-2
@@ -401,6 +401,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](egg.js/egg.js.d.ts) [Egg.js](https://github.com/mikeflynn/egg.js) by [Markus Peloso](https://github.com/ToastHawaii)
|
||||
* [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000)
|
||||
* [:link:](ejs/ejs.d.ts) [ejs.js](http://ejs.co) by [Ben Liddicott](https://github.com/benliddicott/DefinitelyTyped)
|
||||
* [:link:](elasticsearch/elasticsearch.d.ts) [elasticsearch](https://www.elastic.co) by [Casper Skydt](https://github.com/CasperSkydt/DefinitelyTyped), [Blake Smith](https://github.com/bfsmith/DefinitelyTyped)
|
||||
* [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan)
|
||||
* [:link:](github-electron/github-electron.d.ts) [Electron](http://electron.atom.io) by [jedmao](https://github.com/jedmao), [rhysd](https://rhysd.github.io), [Milan Burda](https://github.com/miniak)
|
||||
* [:link:](electron-builder/electron-builder.d.ts) [electron-builder](https://github.com/loopline-systems/electron-builder) by [Maxime LUCE](https://github.com/SomaticIT)
|
||||
@@ -695,7 +696,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](heap/heap.d.ts) [heap](https://github.com/qiao/heap.js) by [Ryan McNamara](https://github.com/ryan10132)
|
||||
* [:link:](heatmap.js/heatmap.d.ts) [heatmap.js](https://github.com/pa7/heatmap.js) by [Yang Guan](https://github.com/lookuptable)
|
||||
* [:link:](hellojs/hellojs.d.ts) [hello.js](http://adodson.com/hello.js) by [Pavel Zika](https://github.com/PavelPZ)
|
||||
* [:link:](helmet/helmet.d.ts) [helmet](https://github.com/helmetjs/helmet) by [Cyril Schumacher](https://github.com/cyrilschumacher)
|
||||
* [:link:](helmet/helmet.d.ts) [helmet](https://github.com/helmetjs/helmet) by [Cyril Schumacher](https://github.com/cyrilschumacher), [Evan Hahn](https://github.com/EvanHahn)
|
||||
* [:link:](highcharts/highcharts.d.ts) [Highcharts](http://www.highcharts.com) by [Damiano Gambarotto](http://github.com/damianog), [Dan Lewi Harkestad](http://github.com/baltie)
|
||||
* [:link:](highcharts-ng/highcharts-ng.d.ts) [highcharts-ng](https://github.com/pablojim/highcharts-ng) by [Scott Hatcher](https://github.com/scatcher)
|
||||
* [:link:](highland/highland.d.ts) [Highland](http://highlandjs.org) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
@@ -1123,10 +1124,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](moment/moment.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya), [Matt Brooks](https://github.com/EnableSoftware)
|
||||
* [:link:](moment-range/moment-range.d.ts) [Moment.js](https://github.com/gf3/moment-range) by [Bart van den Burg](https://github.com/Burgov), [Wilgert Velinga](https://github.com/wilgert)
|
||||
* [:link:](mongodb/mongodb.d.ts) [MongoDB](https://github.com/mongodb/node-mongodb-native/tree/2.1) by [Federico Caselli](https://github.com/CaselIT)
|
||||
* [:link:](mongoose/mongoose.d.ts) [Mongoose](http://mongoosejs.com) by [horiuchi](https://github.com/horiuchi)
|
||||
* [:link:](mongoose/mongoose.d.ts) [Mongoose](http://mongoosejs.com) by [simonxca](https://github.com/simonxca), [horiuchi](https://github.com/horiuchi)
|
||||
* [:link:](mongoose-auto-increment/mongoose-auto-increment.d.ts) [mongoose-auto-increment](https://github.com/codetunnel/mongoose-auto-increment) by [Aya Morisawa](https://github.com/AyaMorisawa)
|
||||
* [:link:](mongoose-deep-populate/mongoose-deep-populate.d.ts) [mongoose-deep-populate](https://github.com/buunguyen/mongoose-deep-populate) by [Aya Morisawa](https://github.com/AyaMorisawa)
|
||||
* [:link:](mongoose-mock/mongoose-mock.d.ts) [mongoose-mock](https://github.com/JohanObrink/mongoose-mock) by [jt000](https://github.com/jt000)
|
||||
* [:link:](mongoose-promise/mongoose-promise.d.ts) [mongoose-promise](http://mongoosejs.com/docs/api.html#promise-js) by [simonxca](https://github.com/simonxca)
|
||||
* [:link:](morgan/morgan.d.ts) [morgan](https://github.com/expressjs/morgan) by [James Roland Cabresos](https://github.com/staticfunction)
|
||||
* [:link:](mousetrap/mousetrap-global-bind.d.ts) [Mousetrap 1.4.6's global-bind extension](http://craig.is/killing/mice#extensions.global) by [Andrew Bradley](https://github.com/cspotcode)
|
||||
* [:link:](mousetrap/mousetrap.d.ts) [Mousetrap 1.5.x](http://craig.is/killing/mice) by [Dániel Tar](https://github.com/qcz)
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
|
||||
|
||||
var buf = new ArrayBuffer(100);
|
||||
var ds = new DataStream(buf);
|
||||
ds = new DataStream(buf, 10);
|
||||
ds = new DataStream(buf, 10, DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.save('somefile.ext');
|
||||
ds.dynamicSize = true;
|
||||
|
||||
for (var i=0; i<ds.byteLength; i++) {
|
||||
}
|
||||
|
||||
ds.buffer = buf;
|
||||
ds.byteOffset = 10;
|
||||
ds.seek(0);
|
||||
ds.isEof();
|
||||
|
||||
var int32arr: Int32Array;
|
||||
var int16arr: Int16Array;
|
||||
var int8arr: Int8Array;
|
||||
|
||||
var uint32arr: Uint32Array;
|
||||
var uint16arr: Uint16Array;
|
||||
var uint8arr: Uint8Array;
|
||||
|
||||
var float64arr: Float64Array;
|
||||
var float32arr: Float32Array;
|
||||
|
||||
var val: number;
|
||||
var str: string;
|
||||
|
||||
int32arr = ds.mapInt32Array(2);
|
||||
int32arr = ds.mapInt32Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
int16arr = ds.mapInt16Array(2);
|
||||
int16arr = ds.mapInt16Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
int8arr = ds.mapInt8Array(2);
|
||||
|
||||
uint32arr = ds.mapUint32Array(2);
|
||||
uint32arr = ds.mapUint32Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
uint16arr = ds.mapUint16Array(2);
|
||||
uint16arr = ds.mapUint16Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
uint8arr = ds.mapUint8Array(2);
|
||||
|
||||
float64arr = ds.mapFloat64Array(2);
|
||||
float64arr = ds.mapFloat64Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
float32arr = ds.mapFloat32Array(2);
|
||||
float32arr = ds.mapFloat32Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
int32arr = ds.readInt32Array(2);
|
||||
int32arr = ds.readInt32Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
int16arr = ds.readInt16Array(2);
|
||||
int16arr = ds.readInt16Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
int8arr = ds.readInt8Array(2);
|
||||
|
||||
uint32arr = ds.readUint32Array(2);
|
||||
uint32arr = ds.readUint32Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
uint16arr = ds.readUint16Array(2);
|
||||
uint16arr = ds.readUint16Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
uint8arr = ds.readUint8Array(2);
|
||||
|
||||
float64arr = ds.readFloat64Array(2);
|
||||
float64arr = ds.readFloat64Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
float32arr = ds.readFloat32Array(2);
|
||||
float32arr = ds.readFloat32Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeInt32Array(new Int32Array([1,2,3]));
|
||||
ds.writeInt32Array(new Int32Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeInt16Array(new Int16Array([1,2,3]));
|
||||
ds.writeInt16Array(new Int16Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeInt8Array(new Int8Array([1,2,3]));
|
||||
|
||||
ds.writeUint32Array(new Uint32Array([1,2,3]));
|
||||
ds.writeUint32Array(new Uint32Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeUint16Array(new Uint16Array([1,2,3]));
|
||||
ds.writeUint16Array(new Uint16Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeUint8Array(new Uint8Array([1,2,3]));
|
||||
|
||||
ds.writeFloat64Array(new Float64Array([1,2,3]));
|
||||
ds.writeFloat64Array(new Float64Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeFloat32Array(new Float32Array([1,2,3]));
|
||||
ds.writeFloat32Array(new Float32Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
val = ds.readInt32();
|
||||
val = ds.readInt32(DataStream.LITTLE_ENDIAN);
|
||||
|
||||
val = ds.readInt16();
|
||||
val = ds.readInt16(DataStream.BIG_ENDIAN);
|
||||
|
||||
val = ds.readInt8();
|
||||
|
||||
val = ds.readUint32();
|
||||
val = ds.readUint32(DataStream.LITTLE_ENDIAN);
|
||||
|
||||
val = ds.readUint16();
|
||||
val = ds.readUint16(DataStream.BIG_ENDIAN);
|
||||
|
||||
val = ds.readUint8();
|
||||
|
||||
val = ds.readFloat64();
|
||||
val = ds.readFloat64(DataStream.LITTLE_ENDIAN);
|
||||
|
||||
val = ds.readFloat32();
|
||||
val = ds.readFloat32(DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeInt32(1);
|
||||
ds.writeInt32(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeInt16(1);
|
||||
ds.writeInt16(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
ds.writeInt8(1);
|
||||
|
||||
ds.writeUint32(1);
|
||||
ds.writeUint32(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeUint16(1);
|
||||
ds.writeUint16(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
ds.writeUint8(1);
|
||||
|
||||
ds.writeFloat32(1);
|
||||
ds.writeFloat32(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeFloat64(1);
|
||||
ds.writeFloat64(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
var embed = [
|
||||
'tag', 'uint32be',
|
||||
'code', 'uint32le',
|
||||
'greet', 'cstring'
|
||||
];
|
||||
|
||||
var def = [
|
||||
'tag', 'cstring:4',
|
||||
'code', 'uint32le',
|
||||
'embed', embed,
|
||||
'length', 'uint16be',
|
||||
'data', ['[]', 'float32be', 'length'],
|
||||
'greet', 'cstring:20',
|
||||
'endNote', 'uint8'
|
||||
];
|
||||
|
||||
var obj = ds.readStruct(def);
|
||||
ds.writeStruct(def, obj);
|
||||
|
||||
str = ds.readUCS2String(2);
|
||||
str = ds.readUCS2String(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
ds.writeUCS2String("str");
|
||||
ds.writeUCS2String("str", DataStream.LITTLE_ENDIAN);
|
||||
ds.writeUCS2String("str", DataStream.LITTLE_ENDIAN, 1);
|
||||
|
||||
str = ds.readString(2);
|
||||
str = ds.readString(2, "ASCII");
|
||||
|
||||
ds.writeString("str");
|
||||
ds.writeString("str", "ASCII");
|
||||
ds.writeString("str", "ASCII", 1);
|
||||
|
||||
str = ds.readCString();
|
||||
str = ds.readCString(2);
|
||||
|
||||
ds.writeCString("str");
|
||||
ds.writeCString("str", 1);
|
||||
Vendored
-937
@@ -1,937 +0,0 @@
|
||||
// Type definitions for DataStream.js
|
||||
// Project: https://github.com/kig/DataStream.js
|
||||
// Definitions by: Tat <https://github.com/tatchx/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class DataStream {
|
||||
|
||||
/**
|
||||
Big-endian const to use as default endianness.
|
||||
*/
|
||||
static BIG_ENDIAN: boolean;
|
||||
|
||||
/**
|
||||
Little-endian const to use as default endianness.
|
||||
*/
|
||||
static LITTLE_ENDIAN: boolean;
|
||||
|
||||
/**
|
||||
DataStream reads scalars, arrays and structs of data from an ArrayBuffer.
|
||||
It's like a file-like DataView on steroids.
|
||||
|
||||
@param {ArrayBuffer} arrayBuffer ArrayBuffer to read from.
|
||||
*/
|
||||
constructor(arrayBuffer: ArrayBuffer);
|
||||
|
||||
/**
|
||||
DataStream reads scalars, arrays and structs of data from an ArrayBuffer.
|
||||
It's like a file-like DataView on steroids.
|
||||
|
||||
@param arrayBuffer ArrayBuffer to read from.
|
||||
@param byteOffset Offset from arrayBuffer beginning for the DataStream.
|
||||
*/
|
||||
constructor(arrayBuffer: ArrayBuffer, byteOffset: number);
|
||||
|
||||
/**
|
||||
DataStream reads scalars, arrays and structs of data from an ArrayBuffer.
|
||||
It's like a file-like DataView on steroids.
|
||||
|
||||
@param arrayBuffer ArrayBuffer to read from.
|
||||
@param byteOffset Offset from arrayBuffer beginning for the DataStream.
|
||||
@param endianness DataStream.BIG_ENDIAN or DataStream.LITTLE_ENDIAN (the default).
|
||||
*/
|
||||
constructor(arrayBuffer: ArrayBuffer, byteOffset: number, endianness: boolean);
|
||||
|
||||
/**
|
||||
Saves the DataStream contents to the given filename.
|
||||
Uses Chrome's anchor download property to initiate download.
|
||||
*
|
||||
@param filename Filename to save as.
|
||||
@return nothing
|
||||
*/
|
||||
save(filename: string): void;
|
||||
|
||||
/**
|
||||
Whether to extend DataStream buffer when trying to write beyond its size.
|
||||
If set, the buffer is reallocated to twice its current size until the
|
||||
requested write fits the buffer.
|
||||
*/
|
||||
dynamicSize: boolean;
|
||||
|
||||
/**
|
||||
Returns the byte length of the DataStream object.
|
||||
*/
|
||||
byteLength: number;
|
||||
|
||||
/**
|
||||
Set/get the backing ArrayBuffer of the DataStream object.
|
||||
The setter updates the DataView to point to the new buffer.
|
||||
*/
|
||||
buffer: ArrayBuffer;
|
||||
|
||||
/**
|
||||
Set/get the byteOffset of the DataStream object.
|
||||
The setter updates the DataView to point to the new byteOffset.
|
||||
*/
|
||||
byteOffset: number;
|
||||
|
||||
/**
|
||||
Set/get the backing DataView of the DataStream object.
|
||||
The setter updates the buffer and byteOffset to point to the DataView values.
|
||||
*/
|
||||
dataView: Object;
|
||||
|
||||
/**
|
||||
Sets the DataStream read/write position to given position.
|
||||
Clamps between 0 and DataStream length.
|
||||
*
|
||||
@param pos Position to seek to.
|
||||
@return nothing
|
||||
*/
|
||||
seek(pos: number): void;
|
||||
|
||||
/**
|
||||
Returns true if the DataStream seek pointer is at the end of buffer and
|
||||
there's no more data to read.
|
||||
*
|
||||
@return true if the seek pointer is at the end of the buffer.
|
||||
*/
|
||||
isEof(): boolean;
|
||||
|
||||
/**
|
||||
Maps an Int32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Int32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapInt32Array(length: number): Int32Array;
|
||||
|
||||
/**
|
||||
Maps an Int32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Int32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapInt32Array(length: number, e: boolean): Int32Array;
|
||||
|
||||
/**
|
||||
Maps an Int16Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Int16Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapInt16Array(length: number): Int16Array;
|
||||
|
||||
/**
|
||||
Maps an Int16Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Int16Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapInt16Array(length: number, e: boolean): Int16Array;
|
||||
|
||||
/**
|
||||
Maps an Int8Array into the DataStream buffer.
|
||||
*
|
||||
Nice for quickly reading in data.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Int8Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapInt8Array(length: number): Int8Array;
|
||||
|
||||
/**
|
||||
Maps a Uint32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Uint32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapUint32Array(length: number): Uint32Array;
|
||||
|
||||
/**
|
||||
Maps a Uint32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Uint32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapUint32Array(length: number, e: boolean): Uint32Array;
|
||||
|
||||
/**
|
||||
Maps a Uint16Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Uint16Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapUint16Array(length: number): Uint16Array;
|
||||
|
||||
/**
|
||||
Maps a Uint16Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Uint16Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapUint16Array(length: number, e: boolean): Uint16Array;
|
||||
|
||||
/**
|
||||
Maps a Uint8Array into the DataStream buffer.
|
||||
*
|
||||
Nice for quickly reading in data.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Uint8Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapUint8Array(length: number): Uint8Array;
|
||||
|
||||
/**
|
||||
Maps a Float64Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Float64Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapFloat64Array(length: number): Float64Array;
|
||||
|
||||
/**
|
||||
Maps a Float64Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Float64Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapFloat64Array(length: number, e: boolean): Float64Array;
|
||||
|
||||
/**
|
||||
Maps a Float32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Float32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapFloat32Array(length: number): Float32Array;
|
||||
|
||||
/**
|
||||
Maps a Float32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Float32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapFloat32Array(length: number, e: boolean): Float32Array;
|
||||
|
||||
/**
|
||||
Reads an Int32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Int32Array.
|
||||
*/
|
||||
readInt32Array(length: number): Int32Array;
|
||||
|
||||
/**
|
||||
Reads an Int32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Int32Array.
|
||||
*/
|
||||
readInt32Array(length: number, e: boolean): Int32Array;
|
||||
|
||||
/**
|
||||
Reads an Int16Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Int16Array.
|
||||
*/
|
||||
readInt16Array(length: number): Int16Array;
|
||||
|
||||
/**
|
||||
Reads an Int16Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Int16Array.
|
||||
*/
|
||||
readInt16Array(length: number, e: boolean): Int16Array;
|
||||
|
||||
/**
|
||||
Reads an Int8Array of desired length from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Int8Array.
|
||||
*/
|
||||
readInt8Array(length: number): Int8Array;
|
||||
|
||||
/**
|
||||
Reads an Uint32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Uint32Array.
|
||||
*/
|
||||
readUint32Array(length: number): Uint32Array;
|
||||
|
||||
/**
|
||||
Reads an Uint32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Uint32Array.
|
||||
*/
|
||||
readUint32Array(length: number, e: boolean): Uint32Array;
|
||||
|
||||
/**
|
||||
Reads an Uint16Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Uint16Array.
|
||||
*/
|
||||
readUint16Array(length: number): Uint16Array;
|
||||
|
||||
/**
|
||||
Reads an Uint16Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Uint16Array.
|
||||
*/
|
||||
readUint16Array(length: number, e: boolean): Uint16Array;
|
||||
|
||||
/**
|
||||
Reads an Uint8Array of desired length from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Uint8Array.
|
||||
*/
|
||||
readUint8Array(length: number): Uint8Array;
|
||||
|
||||
/**
|
||||
Reads a Float64Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Float64Array.
|
||||
*/
|
||||
readFloat64Array(length: number, e: boolean): Float64Array;
|
||||
|
||||
/**
|
||||
Reads a Float64Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Float64Array.
|
||||
*/
|
||||
readFloat64Array(length: number): Float64Array;
|
||||
|
||||
/**
|
||||
Reads a Float32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Float32Array.
|
||||
*/
|
||||
readFloat32Array(length: number, e: boolean): Float32Array;
|
||||
|
||||
/**
|
||||
Reads a Float32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Float32Array.
|
||||
*/
|
||||
readFloat32Array(length: number): Float32Array;
|
||||
|
||||
/**
|
||||
Writes an Int32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeInt32Array(arr: Int32Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an Int32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeInt32Array(arr: Int32Array): void;
|
||||
|
||||
/**
|
||||
Writes an Int16Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeInt16Array(arr: Int16Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an Int16Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeInt16Array(arr: Int16Array): void;
|
||||
|
||||
/**
|
||||
Writes an Int8Array to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeInt8Array(arr: Int8Array): void;
|
||||
|
||||
/**
|
||||
Writes an Uint32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeUint32Array(arr: Uint32Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an Uint32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeUint32Array(arr: Uint32Array): void;
|
||||
|
||||
/**
|
||||
Writes an Uint16Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeUint16Array(arr: Uint16Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an Uint16Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeUint16Array(arr: Uint16Array): void;
|
||||
|
||||
/**
|
||||
Writes an Uint8Array to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeUint8Array(arr: Uint8Array): void;
|
||||
|
||||
/**
|
||||
Writes a Float64Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeFloat64Array(arr: Float64Array): void;
|
||||
|
||||
/**
|
||||
Writes a Float64Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeFloat64Array(arr: Float64Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes a Float32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeFloat32Array(arr: Float32Array): void;
|
||||
|
||||
/**
|
||||
Writes a Float32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeFloat32Array(arr: Float32Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Reads a 32-bit int from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readInt32(): number;
|
||||
|
||||
/**
|
||||
Reads a 32-bit int from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readInt32(e: boolean): number;
|
||||
|
||||
/**
|
||||
Reads a 16-bit int from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readInt16(): number;
|
||||
|
||||
/**
|
||||
Reads a 16-bit int from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readInt16(e: boolean): number;
|
||||
|
||||
/**
|
||||
Reads an 8-bit int from the DataStream.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readInt8(): number;
|
||||
|
||||
/**
|
||||
Reads a 32-bit unsigned int from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readUint32(): number;
|
||||
|
||||
/**
|
||||
Reads a 32-bit unsigned int from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readUint32(e: boolean): number;
|
||||
|
||||
/**
|
||||
Reads a 16-bit unsigned int from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readUint16(): number;
|
||||
|
||||
/**
|
||||
Reads a 16-bit unsigned int from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readUint16(e: boolean): number;
|
||||
|
||||
/**
|
||||
Reads an 8-bit unsigned intfrom the DataStream.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readUint8(): number;
|
||||
|
||||
/**
|
||||
Reads a 32-bit float from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readFloat32(): number;
|
||||
|
||||
/**
|
||||
Reads a 32-bit float from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readFloat32(e: boolean): number;
|
||||
|
||||
/**
|
||||
Reads a 64-bit float from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readFloat64(): number;
|
||||
|
||||
/**
|
||||
Reads a 64-bit float from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readFloat64(e: boolean): number;
|
||||
|
||||
/**
|
||||
Writes a 32-bit int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeInt32(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 32-bit int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeInt32(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes a 16-bit int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeInt16(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 16-bit int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeInt16(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an 8-bit int to the DataStream.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeInt8(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 32-bit undigned int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeUint32(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 32-bit undigned int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeUint32(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes a 16-bit undigned int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeUint16(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 16-bit undigned int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeUint16(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an 8-bit undigned int to the DataStream.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeUint8(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 32-bit float to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeFloat32(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 32-bit float to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeFloat32(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes a 64-bit float to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeFloat64(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 64-bit float to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeFloat64(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Reads a struct of data from the DataStream. The struct is defined as
|
||||
a flat array of [name, type]-pairs. See the example below:
|
||||
*
|
||||
ds.readStruct([
|
||||
'headerTag', 'uint32', // Uint32 in DataStream endianness.
|
||||
'headerTag2', 'uint32be', // Big-endian Uint32.
|
||||
'headerTag3', 'uint32le', // Little-endian Uint32.
|
||||
'array', ['[]', 'uint32', 16], // Uint32Array of length 16.
|
||||
'array2Length', 'uint32',
|
||||
'array2', ['[]', 'uint32', 'array2Length'] // Uint32Array of length array2Length
|
||||
]);
|
||||
*
|
||||
The possible values for the type are as follows:
|
||||
*
|
||||
// Number types
|
||||
// Unsuffixed number types use DataStream endianness.
|
||||
// To explicitly specify endianness, suffix the type with
|
||||
// 'le' for little-endian or 'be' for big-endian,
|
||||
// e.g. 'int32be' for big-endian int32.
|
||||
'uint8' -- 8-bit unsigned int
|
||||
'uint16' -- 16-bit unsigned int
|
||||
'uint32' -- 32-bit unsigned int
|
||||
'int8' -- 8-bit int
|
||||
'int16' -- 16-bit int
|
||||
'int32' -- 32-bit int
|
||||
'float32' -- 32-bit float
|
||||
'float64' -- 64-bit float
|
||||
*
|
||||
// String types
|
||||
'cstring' -- ASCII string terminated by a zero byte.
|
||||
'string:N' -- ASCII string of length N, where N is a literal integer.
|
||||
'string:variableName' -- ASCII string of length $variableName,
|
||||
where 'variableName' is a previously parsed number in the current struct.
|
||||
'string,CHARSET:N' -- String of byteLength N encoded with given CHARSET.
|
||||
'u16string:N' -- UCS-2 string of length N in DataStream endianness.
|
||||
'u16stringle:N' -- UCS-2 string of length N in little-endian.
|
||||
'u16stringbe:N' -- UCS-2 string of length N in big-endian.
|
||||
*
|
||||
// Complex types
|
||||
[name, type, name_2, type_2, ..., name_N, type_N] -- Struct
|
||||
function(dataStream, struct) {} -- Callback function to read and return data.
|
||||
{get: function(dataStream, struct) {},
|
||||
set: function(dataStream, struct) {}}
|
||||
-- Getter/setter functions to read and return data, handy for using the same
|
||||
struct definition for reading and writing structs.
|
||||
['[]', type, length] -- Array of given type and length. The length can be either
|
||||
a number, a string that references a previously-read
|
||||
field, or a callback function(struct, dataStream, type){}.
|
||||
If length is '*', reads in as many elements as it can.
|
||||
*
|
||||
@param structDefinition Struct definition object.
|
||||
@return The read struct. Null if failed to read struct.
|
||||
*/
|
||||
readStruct(structDefinition: any[]): Object;
|
||||
|
||||
/**
|
||||
Writes a struct to the DataStream. Takes a structDefinition that gives the
|
||||
types and a struct object that gives the values. Refer to readStruct for the
|
||||
structure of structDefinition.
|
||||
*
|
||||
@param structDefinition Type definition of the struct.
|
||||
@param struct The struct data object.
|
||||
*/
|
||||
writeStruct(structDefinition: Object, struct: Object): void;
|
||||
|
||||
/**
|
||||
Read UCS-2 string of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length The length of the string to read.
|
||||
@return The read string.
|
||||
*/
|
||||
readUCS2String(length: number): string;
|
||||
|
||||
/**
|
||||
Read UCS-2 string of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length The length of the string to read.
|
||||
@param endianness The endianness of the string data in the DataStream.
|
||||
@return The read string.
|
||||
*/
|
||||
readUCS2String(length: number, endianness: boolean): string;
|
||||
|
||||
/**
|
||||
Write a UCS-2 string of desired endianness to the DataStream. The
|
||||
lengthOverride argument lets you define the number of characters to write.
|
||||
If the string is shorter than lengthOverride, the extra space is padded with
|
||||
zeroes.
|
||||
*
|
||||
@param str The string to write.
|
||||
*/
|
||||
writeUCS2String(str: string): void;
|
||||
|
||||
/**
|
||||
Write a UCS-2 string of desired endianness to the DataStream. The
|
||||
lengthOverride argument lets you define the number of characters to write.
|
||||
If the string is shorter than lengthOverride, the extra space is padded with
|
||||
zeroes.
|
||||
*
|
||||
@param str The string to write.
|
||||
@param endianness The endianness to use for the written string data.
|
||||
*/
|
||||
writeUCS2String(str: string, endianness: boolean): void;
|
||||
|
||||
/**
|
||||
Write a UCS-2 string of desired endianness to the DataStream. The
|
||||
lengthOverride argument lets you define the number of characters to write.
|
||||
If the string is shorter than lengthOverride, the extra space is padded with
|
||||
zeroes.
|
||||
*
|
||||
@param str The string to write.
|
||||
@param endianness The endianness to use for the written string data.
|
||||
@param lengthOverride The number of characters to write.
|
||||
*/
|
||||
writeUCS2String(str: string, endianness: boolean, lengthOverride: number): void;
|
||||
|
||||
/**
|
||||
Read a string of desired length and encoding from the DataStream.
|
||||
*
|
||||
@param length The length of the string to read in bytes.
|
||||
@return The read string.
|
||||
*/
|
||||
readString(length: number): string;
|
||||
|
||||
/**
|
||||
Read a string of desired length and encoding from the DataStream.
|
||||
*
|
||||
@param length The length of the string to read in bytes.
|
||||
@param encoding The encoding of the string data in the DataStream. Defaults to ASCII.
|
||||
@return The read string.
|
||||
*/
|
||||
readString(length: number, encoding: string): string;
|
||||
|
||||
/**
|
||||
Writes a string of desired length and encoding to the DataStream.
|
||||
*
|
||||
@param s The string to write.
|
||||
*/
|
||||
writeString(s: string): void;
|
||||
|
||||
/**
|
||||
Writes a string of desired length and encoding to the DataStream.
|
||||
*
|
||||
@param s The string to write.
|
||||
@param encoding The encoding for the written string data. Defaults to ASCII.
|
||||
*/
|
||||
writeString(s: string, encoding: string): void;
|
||||
|
||||
/**
|
||||
Writes a string of desired length and encoding to the DataStream.
|
||||
*
|
||||
@param s The string to write.
|
||||
@param encoding The encoding for the written string data. Defaults to ASCII.
|
||||
@param length The number of characters to write.
|
||||
*/
|
||||
writeString(s: string, encoding: string, length: number): void;
|
||||
|
||||
/**
|
||||
Read null-terminated string of desired length from the DataStream. Truncates
|
||||
the returned string so that the null byte is not a part of it.
|
||||
*
|
||||
@return The read string.
|
||||
*/
|
||||
readCString(): string;
|
||||
|
||||
/**
|
||||
Read null-terminated string of desired length from the DataStream. Truncates
|
||||
the returned string so that the null byte is not a part of it.
|
||||
*
|
||||
@param length The length of the string to read.
|
||||
@return The read string.
|
||||
*/
|
||||
readCString(length: number): string;
|
||||
|
||||
/**
|
||||
Writes a null-terminated string to DataStream and zero-pads it to length
|
||||
bytes. If length is not given, writes the string followed by a zero.
|
||||
If string is longer than length, the written part of the string does not have
|
||||
a trailing zero.
|
||||
*
|
||||
@param s The string to write.
|
||||
*/
|
||||
writeCString(s: string): void;
|
||||
|
||||
/**
|
||||
Writes a null-terminated string to DataStream and zero-pads it to length
|
||||
bytes. If length is not given, writes the string followed by a zero.
|
||||
If string is longer than length, the written part of the string does not have
|
||||
a trailing zero.
|
||||
*
|
||||
@param s The string to write.
|
||||
@param length The number of characters to write.
|
||||
*/
|
||||
writeCString(s: string, length: number): void;
|
||||
|
||||
/**
|
||||
Reads an object of type t from the DataStream, passing struct as the thus-far
|
||||
read struct to possible callbacks that refer to it. Used by readStruct for
|
||||
reading in the values, so the type is one of the readStruct types.
|
||||
*
|
||||
@param t Type of the object to read.
|
||||
@return Returns the object on successful read, null on unsuccessful.
|
||||
*/
|
||||
readType(t: Object): Object;
|
||||
|
||||
/**
|
||||
Reads an object of type t from the DataStream, passing struct as the thus-far
|
||||
read struct to possible callbacks that refer to it. Used by readStruct for
|
||||
reading in the values, so the type is one of the readStruct types.
|
||||
*
|
||||
@param t Type of the object to read.
|
||||
@param struct Struct to refer to when resolving length references and for calling callbacks.
|
||||
@return Returns the object on successful read, null on unsuccessful.
|
||||
*/
|
||||
readType(t: Object, struct: Object): Object;
|
||||
|
||||
/**
|
||||
Writes object v of type t to the DataStream.
|
||||
*
|
||||
@param t Type of data to write.
|
||||
@param v Value of data to write.
|
||||
@param struct Struct to pass to write callback functions.
|
||||
*/
|
||||
writeType(t: Object, v: Object, struct: Object): void;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
|
||||
/**
|
||||
* @summary Test for "saveAs" function.
|
||||
*/
|
||||
function testSaveAs() {
|
||||
var data: Blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
|
||||
var filename: string = 'hello world.txt';
|
||||
var disableAutoBOM = true;
|
||||
|
||||
saveAs(data, filename, disableAutoBOM);
|
||||
}
|
||||
@@ -24,7 +24,7 @@ Please see the [contribution guide](http://definitelytyped.org/guides/contributi
|
||||
|
||||
* Directly from the GitHub repos
|
||||
* [NuGet packages](http://nuget.org/packages?q=DefinitelyTyped)
|
||||
* [TypeScript Definition manager](https://github.com/DefinitelyTyped/tsd)
|
||||
* [Typings - TypeScript Definition Manager](https://github.com/typings/typings)
|
||||
|
||||
## List of definitions
|
||||
|
||||
@@ -32,7 +32,7 @@ Please see the [contribution guide](http://definitelytyped.org/guides/contributi
|
||||
|
||||
## Requested definitions
|
||||
|
||||
Here is are the [currently requested definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest).
|
||||
Here are the [currently requested definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest).
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Vendored
+2
-3
@@ -77,9 +77,6 @@ declare namespace AceAjax {
|
||||
|
||||
onTextInput(text: any): void;
|
||||
}
|
||||
var KeyBinding: {
|
||||
new(editor: Editor): KeyBinding;
|
||||
}
|
||||
|
||||
export interface TextMode {
|
||||
|
||||
@@ -1037,6 +1034,8 @@ declare namespace AceAjax {
|
||||
**/
|
||||
export interface Editor {
|
||||
|
||||
on(ev: string, callback: (e: any) => any): void;
|
||||
|
||||
addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any): void;
|
||||
addEventListener(ev: string, callback: Function): void;
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/monokai");
|
||||
editor.getSession().setMode("ace/mode/javascript");
|
||||
|
||||
editor.on("blur", (e) => e);
|
||||
editor.on("change", (e) => e);
|
||||
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
|
||||
editor.getSession().setMode("ace/mode/javascript");
|
||||
|
||||
Vendored
+4
-4
@@ -9,14 +9,14 @@
|
||||
import http = require('http');
|
||||
import Promise = require("bluebird");
|
||||
|
||||
type strings = string | string[];
|
||||
type Value = string | number;
|
||||
type Values = Value | Value[];
|
||||
type strings = string|string[];
|
||||
type Value = string|number;
|
||||
type Values = Value|Value[];
|
||||
type Action = () => any;
|
||||
type Callback = (err: Error) => any;
|
||||
type AnyCallback = (err: Error, obj: any) => any;
|
||||
type AllowedCallback = (err: Error, allowed: boolean) => any;
|
||||
type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value;
|
||||
type GetUserId = (req: http.IncomingMessage, res: http.ServerResponse) => Value;
|
||||
|
||||
interface AclStatic {
|
||||
new (backend: Backend<any>, logger: Logger, options: Option): Acl;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference types="estree" />
|
||||
|
||||
import acorn = require('acorn');
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
declare var token: acorn.Token;
|
||||
declare var tokens: acorn.Token[];
|
||||
|
||||
Vendored
+1
@@ -7,6 +7,7 @@
|
||||
|
||||
export as namespace acorn;
|
||||
export = acorn;
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
declare namespace acorn {
|
||||
var version: string;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//open connection to an Excel file
|
||||
var pathToExcelFile = 'C:\\path\\to\\excel\\file.xlsx';
|
||||
var conn = new ActiveXObject('ADODB.Connection');
|
||||
conn.Provider = 'Microsoft.ACE.OLEDB.12.0';
|
||||
conn.ConnectionString =
|
||||
'Data Source="' + pathToExcelFile + '";' +
|
||||
'Extended Properties="Excel 12.0;HDR=Yes"';
|
||||
conn.Open();
|
||||
|
||||
//create a Command to access the data
|
||||
var cmd = new ActiveXObject('ADODB.Command');
|
||||
cmd.CommandText = 'SELECT DISTINCT LastName, CityName FROM [Sheet1$]';
|
||||
//get a Recordset
|
||||
var rs = cmd.Execute();
|
||||
//build a string from the Recordset
|
||||
var s = rs.GetString(ADODB.StringFormatEnum.adClipString, -1, '\t', '\n', '(NULL)');
|
||||
rs.Close();
|
||||
WScript.Echo(s);
|
||||
Vendored
+834
@@ -0,0 +1,834 @@
|
||||
// Type definitions for Microsoft ActiveX Data Objects
|
||||
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms675532(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace ADODB {
|
||||
|
||||
//Enums
|
||||
const enum ADCPROP_ASYNCTHREADPRIORITY_ENUM {
|
||||
adPriorityAboveNormal = 4,
|
||||
adPriorityBelowNormal = 2,
|
||||
adPriorityHighest = 5,
|
||||
adPriorityLowest = 1,
|
||||
adPriorityNormal = 3
|
||||
}
|
||||
|
||||
const enum ADCPROP_AUTORECALC_ENUM {
|
||||
adRecalcAlways = 1,
|
||||
adRecalcUpFront = 0
|
||||
}
|
||||
|
||||
const enum ADCPROP_UPDATECRITERIA_ENUM {
|
||||
adCriteriaAllCols = 1,
|
||||
adCriteriaKey = 0,
|
||||
adCriteriaTimeStamp = 3,
|
||||
adCriteriaUpdCols = 2
|
||||
}
|
||||
|
||||
const enum ADCPROP_UPDATERESYNC_ENUM {
|
||||
adResyncAll = 15,
|
||||
adResyncAutoIncrement = 1,
|
||||
adResyncConflicts = 2,
|
||||
adResyncInserts = 8,
|
||||
adResyncNone = 0,
|
||||
adResyncUpdates = 4
|
||||
}
|
||||
|
||||
const enum AffectEnum {
|
||||
adAffectAll = 3,
|
||||
adAffectAllChapters = 4,
|
||||
adAffectCurrent = 1,
|
||||
adAffectGroup = 2
|
||||
}
|
||||
|
||||
const enum BookmarkEnum {
|
||||
adBookmarkCurrent = 0,
|
||||
adBookmarkFirst = 1,
|
||||
adBookmarkLast = 2
|
||||
}
|
||||
|
||||
const enum CommandTypeEnum {
|
||||
adCmdFile = 256,
|
||||
adCmdStoredProc = 4,
|
||||
adCmdTable = 2,
|
||||
adCmdTableDirect = 512,
|
||||
adCmdText = 1,
|
||||
adCmdUnknown = 8,
|
||||
adCmdUnspecified = -1
|
||||
}
|
||||
|
||||
const enum CompareEnum {
|
||||
adCompareEqual = 1,
|
||||
adCompareGreaterThan = 2,
|
||||
adCompareLessThan = 0,
|
||||
adCompareNotComparable = 4,
|
||||
adCompareNotEqual = 3
|
||||
}
|
||||
|
||||
const enum ConnectModeEnum {
|
||||
adModeRead = 1,
|
||||
adModeReadWrite = 3,
|
||||
adModeRecursive = 4194304,
|
||||
adModeShareDenyNone = 16,
|
||||
adModeShareDenyRead = 4,
|
||||
adModeShareDenyWrite = 8,
|
||||
adModeShareExclusive = 12,
|
||||
adModeUnknown = 0,
|
||||
adModeWrite = 2
|
||||
}
|
||||
|
||||
const enum ConnectOptionEnum {
|
||||
adAsyncConnect = 16,
|
||||
adConnectUnspecified = -1
|
||||
}
|
||||
|
||||
const enum ConnectPromptEnum {
|
||||
adPromptAlways = 1,
|
||||
adPromptComplete = 2,
|
||||
adPromptCompleteRequired = 3,
|
||||
adPromptNever = 4
|
||||
}
|
||||
|
||||
const enum CopyRecordOptionsEnum {
|
||||
adCopyAllowEmulation = 4,
|
||||
adCopyNonRecursive = 2,
|
||||
adCopyOverWrite = 1,
|
||||
adCopyUnspecified = -1
|
||||
}
|
||||
|
||||
const enum CursorLocationEnum {
|
||||
adUseClient = 3,
|
||||
adUseClientBatch = 3,
|
||||
adUseNone = 1,
|
||||
adUseServer = 2
|
||||
}
|
||||
|
||||
const enum CursorOptionEnum {
|
||||
adAddNew = 16778240,
|
||||
adApproxPosition = 16384,
|
||||
adBookmark = 8192,
|
||||
adDelete = 16779264,
|
||||
adFind = 524288,
|
||||
adHoldRecords = 256,
|
||||
adIndex = 8388608,
|
||||
adMovePrevious = 512,
|
||||
adNotify = 262144,
|
||||
adResync = 131072,
|
||||
adSeek = 4194304,
|
||||
adUpdate = 16809984,
|
||||
adUpdateBatch = 65536
|
||||
}
|
||||
|
||||
const enum CursorTypeEnum {
|
||||
adOpenDynamic = 2,
|
||||
adOpenForwardOnly = 0,
|
||||
adOpenKeyset = 1,
|
||||
adOpenStatic = 3,
|
||||
adOpenUnspecified = -1
|
||||
}
|
||||
|
||||
const enum DataTypeEnum {
|
||||
adArray = 8192,
|
||||
adBigInt = 20,
|
||||
adBinary = 128,
|
||||
adBoolean = 11,
|
||||
adBSTR = 8,
|
||||
adChapter = 136,
|
||||
adChar = 129,
|
||||
adCurrency = 6,
|
||||
adDate = 7,
|
||||
adDBDate = 133,
|
||||
adDBTime = 134,
|
||||
adDBTimeStamp = 135,
|
||||
adDecimal = 14,
|
||||
adDouble = 5,
|
||||
adEmpty = 0,
|
||||
adError = 10,
|
||||
adFileTime = 64,
|
||||
adGUID = 72,
|
||||
adIDispatch = 9,
|
||||
adInteger = 3,
|
||||
adIUnknown = 13,
|
||||
adLongVarBinary = 205,
|
||||
adLongVarChar = 201,
|
||||
adLongVarWChar = 203,
|
||||
adNumeric = 131,
|
||||
adPropVariant = 138,
|
||||
adSingle = 4,
|
||||
adSmallInt = 2,
|
||||
adTinyInt = 16,
|
||||
adUnsignedBigInt = 21,
|
||||
adUnsignedInt = 19,
|
||||
adUnsignedSmallInt = 18,
|
||||
adUnsignedTinyInt = 17,
|
||||
adUserDefined = 132,
|
||||
adVarBinary = 204,
|
||||
adVarChar = 200,
|
||||
adVariant = 12,
|
||||
adVarNumeric = 139,
|
||||
adVarWChar = 202,
|
||||
adWChar = 130
|
||||
}
|
||||
|
||||
const enum EditModeEnum {
|
||||
adEditAdd = 2,
|
||||
adEditDelete = 4,
|
||||
adEditInProgress = 1,
|
||||
adEditNone = 0
|
||||
}
|
||||
|
||||
const enum ErrorValueEnum {
|
||||
adErrBoundToCommand = 3707,
|
||||
adErrCannotComplete = 3732,
|
||||
adErrCantChangeConnection = 3748,
|
||||
adErrCantChangeProvider = 3220,
|
||||
adErrCantConvertvalue = 3724,
|
||||
adErrCantCreate = 3725,
|
||||
adErrCatalogNotSet = 3747,
|
||||
adErrColumnNotOnThisRow = 3726,
|
||||
adErrConnectionStringTooLong = 3754,
|
||||
adErrDataConversion = 3421,
|
||||
adErrDataOverflow = 3721,
|
||||
adErrDelResOutOfScope = 3738,
|
||||
adErrDenyNotSupported = 3750,
|
||||
adErrDenyTypeNotSupported = 3751,
|
||||
adErrFeatureNotAvailable = 3251,
|
||||
adErrFieldsUpdateFailed = 3749,
|
||||
adErrIllegalOperation = 3219,
|
||||
adErrIntegrityViolation = 3719,
|
||||
adErrInTransaction = 3246,
|
||||
adErrInvalidArgument = 3001,
|
||||
adErrInvalidConnection = 3709,
|
||||
adErrInvalidParamInfo = 3708,
|
||||
adErrInvalidTransaction = 3714,
|
||||
adErrInvalidURL = 3729,
|
||||
adErrItemNotFound = 3265,
|
||||
adErrNoCurrentRecord = 3021,
|
||||
adErrNotExecuting = 3715,
|
||||
adErrNotReentrant = 3710,
|
||||
adErrObjectClosed = 3704,
|
||||
adErrObjectInCollection = 3367,
|
||||
adErrObjectNotSet = 3420,
|
||||
adErrObjectOpen = 3705,
|
||||
adErrOpeningFile = 3002,
|
||||
adErrOperationCancelled = 3712,
|
||||
adErrOutOfSpace = 3734,
|
||||
adErrPermissionDenied = 3720,
|
||||
adErrPropConflicting = 3742,
|
||||
adErrPropInvalidColumn = 3739,
|
||||
adErrPropInvalidOption = 3740,
|
||||
adErrPropInvalidValue = 3741,
|
||||
adErrPropNotAllSettable = 3743,
|
||||
adErrPropNotSet = 3744,
|
||||
adErrPropNotSettable = 3745,
|
||||
adErrPropNotSupported = 3746,
|
||||
adErrProviderFailed = 3000,
|
||||
adErrProviderNotFound = 3706,
|
||||
adErrProviderNotSpecified = 3753,
|
||||
adErrReadFile = 3003,
|
||||
adErrResourceExists = 3731,
|
||||
adErrResourceLocked = 3730,
|
||||
adErrResourceOutOfScope = 3735,
|
||||
adErrSchemaViolation = 3722,
|
||||
adErrSignMismatch = 3723,
|
||||
adErrStillConnecting = 3713,
|
||||
adErrStillExecuting = 3711,
|
||||
adErrTreePermissionDenied = 3728,
|
||||
adErrUnavailable = 3736,
|
||||
adErrUnsafeOperation = 3716,
|
||||
adErrURLDoesNotExist = 3727,
|
||||
adErrURLNamedRowDoesNotExist = 3737,
|
||||
adErrVolumeNotFound = 3733,
|
||||
adErrWriteFile = 3004,
|
||||
adwrnSecurityDialog = 3717,
|
||||
adwrnSecurityDialogHeader = 3718
|
||||
}
|
||||
|
||||
const enum EventReasonEnum {
|
||||
adRsnAddNew = 1,
|
||||
adRsnClose = 9,
|
||||
adRsnDelete = 2,
|
||||
adRsnFirstChange = 11,
|
||||
adRsnMove = 10,
|
||||
adRsnMoveFirst = 12,
|
||||
adRsnMoveLast = 15,
|
||||
adRsnMoveNext = 13,
|
||||
adRsnMovePrevious = 14,
|
||||
adRsnRequery = 7,
|
||||
adRsnResynch = 8,
|
||||
adRsnUndoAddNew = 5,
|
||||
adRsnUndoDelete = 6,
|
||||
adRsnUndoUpdate = 4,
|
||||
adRsnUpdate = 3
|
||||
}
|
||||
|
||||
const enum EventStatusEnum {
|
||||
adStatusCancel = 4,
|
||||
adStatusCantDeny = 3,
|
||||
adStatusErrorsOccurred = 2,
|
||||
adStatusOK = 1,
|
||||
adStatusUnwantedEvent = 5
|
||||
}
|
||||
|
||||
const enum ExecuteOptionEnum {
|
||||
adAsyncExecute = 16,
|
||||
adAsyncFetch = 32,
|
||||
adAsyncFetchNonBlocking = 64,
|
||||
adExecuteNoRecords = 128,
|
||||
adExecuteRecord = 2048,
|
||||
adExecuteStream = 1024,
|
||||
adOptionUnspecified = -1
|
||||
}
|
||||
|
||||
const enum FieldAttributeEnum {
|
||||
adFldCacheDeferred = 4096,
|
||||
adFldFixed = 16,
|
||||
adFldIsChapter = 8192,
|
||||
adFldIsCollection = 262144,
|
||||
adFldIsDefaultStream = 131072,
|
||||
adFldIsNullable = 32,
|
||||
adFldIsRowURL = 65536,
|
||||
adFldKeyColumn = 32768,
|
||||
adFldLong = 128,
|
||||
adFldMayBeNull = 64,
|
||||
adFldMayDefer = 2,
|
||||
adFldNegativeScale = 16384,
|
||||
adFldRowID = 256,
|
||||
adFldRowVersion = 512,
|
||||
adFldUnknownUpdatable = 8,
|
||||
adFldUnspecified = -1,
|
||||
adFldUpdatable = 4
|
||||
}
|
||||
|
||||
const enum FieldEnum {
|
||||
adDefaultStream = -1,
|
||||
adRecordURL = -2
|
||||
}
|
||||
|
||||
const enum FieldStatusEnum {
|
||||
adFieldAlreadyExists = 26,
|
||||
adFieldBadStatus = 12,
|
||||
adFieldCannotComplete = 20,
|
||||
adFieldCannotDeleteSource = 23,
|
||||
adFieldCantConvertValue = 2,
|
||||
adFieldCantCreate = 7,
|
||||
adFieldDataOverflow = 6,
|
||||
adFieldDefault = 13,
|
||||
adFieldDoesNotExist = 16,
|
||||
adFieldIgnore = 15,
|
||||
adFieldIntegrityViolation = 10,
|
||||
adFieldInvalidURL = 17,
|
||||
adFieldIsNull = 3,
|
||||
adFieldOK = 0,
|
||||
adFieldOutOfSpace = 22,
|
||||
adFieldPendingChange = 262144,
|
||||
adFieldPendingDelete = 131072,
|
||||
adFieldPendingInsert = 65536,
|
||||
adFieldPendingUnknown = 524288,
|
||||
adFieldPendingUnknownDelete = 1048576,
|
||||
adFieldPermissionDenied = 9,
|
||||
adFieldReadOnly = 24,
|
||||
adFieldResourceExists = 19,
|
||||
adFieldResourceLocked = 18,
|
||||
adFieldResourceOutOfScope = 25,
|
||||
adFieldSchemaViolation = 11,
|
||||
adFieldSignMismatch = 5,
|
||||
adFieldTruncated = 4,
|
||||
adFieldUnavailable = 8,
|
||||
adFieldVolumeNotFound = 21
|
||||
}
|
||||
|
||||
const enum FilterGroupEnum {
|
||||
adFilterAffectedRecords = 2,
|
||||
adFilterConflictingRecords = 5,
|
||||
adFilterFetchedRecords = 3,
|
||||
adFilterNone = 0,
|
||||
adFilterPendingRecords = 1,
|
||||
adFilterPredicate = 4
|
||||
}
|
||||
|
||||
const enum GetRowsOptionEnum {
|
||||
adGetRowsRest = -1
|
||||
}
|
||||
|
||||
const enum IsolationLevelEnum {
|
||||
adXactBrowse = 256,
|
||||
adXactChaos = 16,
|
||||
adXactCursorStability = 4096,
|
||||
adXactIsolated = 1048576,
|
||||
adXactReadCommitted = 4096,
|
||||
adXactReadUncommitted = 256,
|
||||
adXactRepeatableRead = 65536,
|
||||
adXactSerializable = 1048576,
|
||||
adXactUnspecified = -1
|
||||
}
|
||||
|
||||
const enum LineSeparatorEnum {
|
||||
adCR = 13,
|
||||
adCRLF = -1,
|
||||
adLF = 10
|
||||
}
|
||||
|
||||
const enum LockTypeEnum {
|
||||
adLockBatchOptimistic = 4,
|
||||
adLockOptimistic = 3,
|
||||
adLockPessimistic = 2,
|
||||
adLockReadOnly = 1,
|
||||
adLockUnspecified = -1
|
||||
}
|
||||
|
||||
const enum MarshalOptionsEnum {
|
||||
adMarshalAll = 0,
|
||||
adMarshalModifiedOnly = 1
|
||||
}
|
||||
|
||||
const enum MoveRecordOptionsEnum {
|
||||
adMoveAllowEmulation = 4,
|
||||
adMoveDontUpdateLinks = 2,
|
||||
adMoveOverWrite = 1,
|
||||
adMoveUnspecified = -1
|
||||
}
|
||||
|
||||
const enum ObjectStateEnum {
|
||||
adStateClosed = 0,
|
||||
adStateConnecting = 2,
|
||||
adStateExecuting = 4,
|
||||
adStateFetching = 8,
|
||||
adStateOpen = 1
|
||||
}
|
||||
|
||||
const enum ParameterAttributesEnum {
|
||||
adParamLong = 128,
|
||||
adParamNullable = 64,
|
||||
adParamSigned = 16
|
||||
}
|
||||
|
||||
const enum ParameterDirectionEnum {
|
||||
adParamInput = 1,
|
||||
adParamInputOutput = 3,
|
||||
adParamOutput = 2,
|
||||
adParamReturnValue = 4,
|
||||
adParamUnknown = 0
|
||||
}
|
||||
|
||||
const enum PersistFormatEnum {
|
||||
adPersistADTG = 0,
|
||||
adPersistXML = 1
|
||||
}
|
||||
|
||||
const enum PositionEnum {
|
||||
adPosBOF = -2,
|
||||
adPosEOF = -3,
|
||||
adPosUnknown = -1
|
||||
}
|
||||
|
||||
const enum PositionEnum_Param {
|
||||
adPosBOF = -2,
|
||||
adPosEOF = -3,
|
||||
adPosUnknown = -1
|
||||
}
|
||||
|
||||
const enum PropertyAttributesEnum {
|
||||
adPropNotSupported = 0,
|
||||
adPropOptional = 2,
|
||||
adPropRead = 512,
|
||||
adPropRequired = 1,
|
||||
adPropWrite = 1024
|
||||
}
|
||||
|
||||
const enum RecordCreateOptionsEnum {
|
||||
adCreateCollection = 8192,
|
||||
adCreateNonCollection = 0,
|
||||
adCreateOverwrite = 67108864,
|
||||
adCreateStructDoc = -2147483648,
|
||||
adFailIfNotExists = -1,
|
||||
adOpenIfExists = 33554432
|
||||
}
|
||||
|
||||
const enum RecordOpenOptionsEnum {
|
||||
adDelayFetchFields = 32768,
|
||||
adDelayFetchStream = 16384,
|
||||
adOpenAsync = 4096,
|
||||
adOpenExecuteCommand = 65536,
|
||||
adOpenOutput = 8388608,
|
||||
adOpenRecordUnspecified = -1,
|
||||
adOpenSource = 8388608
|
||||
}
|
||||
|
||||
const enum RecordStatusEnum {
|
||||
adRecCanceled = 256,
|
||||
adRecCantRelease = 1024,
|
||||
adRecConcurrencyViolation = 2048,
|
||||
adRecDBDeleted = 262144,
|
||||
adRecDeleted = 4,
|
||||
adRecIntegrityViolation = 4096,
|
||||
adRecInvalid = 16,
|
||||
adRecMaxChangesExceeded = 8192,
|
||||
adRecModified = 2,
|
||||
adRecMultipleChanges = 64,
|
||||
adRecNew = 1,
|
||||
adRecObjectOpen = 16384,
|
||||
adRecOK = 0,
|
||||
adRecOutOfMemory = 32768,
|
||||
adRecPendingChanges = 128,
|
||||
adRecPermissionDenied = 65536,
|
||||
adRecSchemaViolation = 131072,
|
||||
adRecUnmodified = 8
|
||||
}
|
||||
|
||||
const enum RecordTypeEnum {
|
||||
adCollectionRecord = 1,
|
||||
adSimpleRecord = 0,
|
||||
adStructDoc = 2
|
||||
}
|
||||
|
||||
const enum ResyncEnum {
|
||||
adResyncAllValues = 2,
|
||||
adResyncUnderlyingValues = 1
|
||||
}
|
||||
|
||||
const enum SaveOptionsEnum {
|
||||
adSaveCreateNotExist = 1,
|
||||
adSaveCreateOverWrite = 2
|
||||
}
|
||||
|
||||
const enum SchemaEnum {
|
||||
adSchemaActions = 41,
|
||||
adSchemaAsserts = 0,
|
||||
adSchemaCatalogs = 1,
|
||||
adSchemaCharacterSets = 2,
|
||||
adSchemaCheckConstraints = 5,
|
||||
adSchemaCollations = 3,
|
||||
adSchemaColumnPrivileges = 13,
|
||||
adSchemaColumns = 4,
|
||||
adSchemaColumnsDomainUsage = 11,
|
||||
adSchemaCommands = 42,
|
||||
adSchemaConstraintColumnUsage = 6,
|
||||
adSchemaConstraintTableUsage = 7,
|
||||
adSchemaCubes = 32,
|
||||
adSchemaDBInfoKeywords = 30,
|
||||
adSchemaDBInfoLiterals = 31,
|
||||
adSchemaDimensions = 33,
|
||||
adSchemaForeignKeys = 27,
|
||||
adSchemaFunctions = 40,
|
||||
adSchemaHierarchies = 34,
|
||||
adSchemaIndexes = 12,
|
||||
adSchemaKeyColumnUsage = 8,
|
||||
adSchemaLevels = 35,
|
||||
adSchemaMeasures = 36,
|
||||
adSchemaMembers = 38,
|
||||
adSchemaPrimaryKeys = 28,
|
||||
adSchemaProcedureColumns = 29,
|
||||
adSchemaProcedureParameters = 26,
|
||||
adSchemaProcedures = 16,
|
||||
adSchemaProperties = 37,
|
||||
adSchemaProviderSpecific = -1,
|
||||
adSchemaProviderTypes = 22,
|
||||
adSchemaReferentialConstraints = 9,
|
||||
adSchemaReferentialContraints = 9,
|
||||
adSchemaSchemata = 17,
|
||||
adSchemaSets = 43,
|
||||
adSchemaSQLLanguages = 18,
|
||||
adSchemaStatistics = 19,
|
||||
adSchemaTableConstraints = 10,
|
||||
adSchemaTablePrivileges = 14,
|
||||
adSchemaTables = 20,
|
||||
adSchemaTranslations = 21,
|
||||
adSchemaTrustees = 39,
|
||||
adSchemaUsagePrivileges = 15,
|
||||
adSchemaViewColumnUsage = 24,
|
||||
adSchemaViews = 23,
|
||||
adSchemaViewTableUsage = 25
|
||||
}
|
||||
|
||||
const enum SearchDirection {
|
||||
adSearchBackward = -1,
|
||||
adSearchForward = 1
|
||||
}
|
||||
|
||||
const enum SearchDirectionEnum {
|
||||
adSearchBackward = -1,
|
||||
adSearchForward = 1
|
||||
}
|
||||
|
||||
const enum SeekEnum {
|
||||
adSeekAfter = 8,
|
||||
adSeekAfterEQ = 4,
|
||||
adSeekBefore = 32,
|
||||
adSeekBeforeEQ = 16,
|
||||
adSeekFirstEQ = 1,
|
||||
adSeekLastEQ = 2
|
||||
}
|
||||
|
||||
const enum StreamOpenOptionsEnum {
|
||||
adOpenStreamAsync = 1,
|
||||
adOpenStreamFromRecord = 4,
|
||||
adOpenStreamUnspecified = -1
|
||||
}
|
||||
|
||||
const enum StreamReadEnum {
|
||||
adReadAll = -1,
|
||||
adReadLine = -2
|
||||
}
|
||||
|
||||
const enum StreamTypeEnum {
|
||||
adTypeBinary = 1,
|
||||
adTypeText = 2
|
||||
}
|
||||
|
||||
const enum StreamWriteEnum {
|
||||
adWriteChar = 0,
|
||||
adWriteLine = 1,
|
||||
stWriteChar = 0,
|
||||
stWriteLine = 1
|
||||
}
|
||||
|
||||
const enum StringFormatEnum {
|
||||
adClipString = 2
|
||||
}
|
||||
|
||||
const enum XactAttributeEnum {
|
||||
adXactAbortRetaining = 262144,
|
||||
adXactAsyncPhaseOne = 524288,
|
||||
adXactCommitRetaining = 131072,
|
||||
adXactSyncPhaseOne = 1048576
|
||||
}
|
||||
|
||||
//Interfaces
|
||||
interface Command {
|
||||
ActiveConnection: Connection;
|
||||
Cancel: () => void;
|
||||
CommandStream: any /*VT_UNKNOWN*/;
|
||||
CommandText: string;
|
||||
CommandTimeout: number;
|
||||
CommandType: CommandTypeEnum;
|
||||
CreateParameter: (Name?: string, Type?: DataTypeEnum, Direction?: ParameterDirectionEnum, Size?: number, Value?: any) => Parameter;
|
||||
Dialect: string;
|
||||
Execute: (RecordsAffected?: any, Parameters?: any, Options?: number) => Recordset;
|
||||
Name: string;
|
||||
NamedParameters: boolean;
|
||||
Parameters: Parameters;
|
||||
Prepared: boolean;
|
||||
Properties: Properties;
|
||||
State: number;
|
||||
}
|
||||
|
||||
interface Connection {
|
||||
Attributes: number;
|
||||
BeginTrans: () => number;
|
||||
Cancel: () => void;
|
||||
Close: () => void;
|
||||
CommandTimeout: number;
|
||||
CommitTrans: () => void;
|
||||
ConnectionString: string;
|
||||
ConnectionTimeout: number;
|
||||
CursorLocation: CursorLocationEnum;
|
||||
DefaultDatabase: string;
|
||||
Errors: Errors;
|
||||
Execute: (CommandText: string, RecordsAffected: any, Options?: number) => Recordset;
|
||||
IsolationLevel: IsolationLevelEnum;
|
||||
Mode: ConnectModeEnum;
|
||||
Open: (ConnectionString?: string, UserID?: string, Password?: string, Options?: number) => void;
|
||||
OpenSchema: (Schema: SchemaEnum, Restrictions?: any, SchemaID?: any) => Recordset;
|
||||
Properties: Properties;
|
||||
Provider: string;
|
||||
RollbackTrans: () => void;
|
||||
State: number;
|
||||
Version: string;
|
||||
}
|
||||
|
||||
interface Error {
|
||||
Description: string;
|
||||
HelpContext: number;
|
||||
HelpFile: string;
|
||||
NativeError: number;
|
||||
Number: number;
|
||||
Source: string;
|
||||
SQLState: string;
|
||||
}
|
||||
|
||||
interface Errors {
|
||||
Clear: () => void;
|
||||
Count: number;
|
||||
Item: (Index: any) => Error;
|
||||
Refresh: () => void;
|
||||
}
|
||||
|
||||
interface Field {
|
||||
ActualSize: number;
|
||||
AppendChunk: (Data: any) => void;
|
||||
Attributes: number;
|
||||
DataFormat: any /*VT_UNKNOWN*/;
|
||||
DefinedSize: number;
|
||||
GetChunk: (Length: number) => any;
|
||||
Name: string;
|
||||
NumericScale: number;
|
||||
OriginalValue: any;
|
||||
Precision: number;
|
||||
Properties: Properties;
|
||||
Status: number;
|
||||
Type: DataTypeEnum;
|
||||
UnderlyingValue: any;
|
||||
Value: any;
|
||||
}
|
||||
|
||||
interface Fields {
|
||||
_Append: (Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum) => void;
|
||||
Append: (Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum, FieldValue?: any) => void;
|
||||
CancelUpdate: () => void;
|
||||
Count: number;
|
||||
Delete: (Index: any) => void;
|
||||
Item: (Index: any) => Field;
|
||||
Refresh: () => void;
|
||||
Resync: (ResyncValues?: ResyncEnum) => void;
|
||||
Update: () => void;
|
||||
}
|
||||
|
||||
interface Parameter {
|
||||
AppendChunk: (Val: any) => void;
|
||||
Attributes: number;
|
||||
Direction: ParameterDirectionEnum;
|
||||
Name: string;
|
||||
NumericScale: number;
|
||||
Precision: number;
|
||||
Properties: Properties;
|
||||
Size: number;
|
||||
Type: DataTypeEnum;
|
||||
Value: any;
|
||||
}
|
||||
|
||||
interface Parameters {
|
||||
Append: (Object: any /*VT_DISPATCH*/) => void;
|
||||
Count: number;
|
||||
Delete: (Index: any) => void;
|
||||
Item: (Index: any) => Parameter;
|
||||
Refresh: () => void;
|
||||
}
|
||||
|
||||
interface Properties {
|
||||
Count: number;
|
||||
Item: (Index: any) => Property;
|
||||
Refresh: () => void;
|
||||
}
|
||||
|
||||
interface Property {
|
||||
Attributes: number;
|
||||
Name: string;
|
||||
Type: DataTypeEnum;
|
||||
Value: any;
|
||||
}
|
||||
|
||||
interface Record {
|
||||
ActiveConnection: any;
|
||||
Cancel: () => void;
|
||||
Close: () => void;
|
||||
CopyRecord: (Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: CopyRecordOptionsEnum, Async?: boolean) => string;
|
||||
DeleteRecord: (Source?: string, Async?: boolean) => void;
|
||||
Fields: Fields;
|
||||
GetChildren: () => Recordset;
|
||||
Mode: ConnectModeEnum;
|
||||
MoveRecord: (Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: MoveRecordOptionsEnum, Async?: boolean) => string;
|
||||
Open: (Source: any, ActiveConnection: any, Mode?: ConnectModeEnum, CreateOptions?: RecordCreateOptionsEnum, Options?: RecordOpenOptionsEnum, UserName?: string, Password?: string) => void;
|
||||
ParentURL: string;
|
||||
Properties: Properties;
|
||||
RecordType: RecordTypeEnum;
|
||||
Source: any;
|
||||
State: ObjectStateEnum;
|
||||
}
|
||||
|
||||
interface Recordset {
|
||||
_xClone: () => Recordset;
|
||||
_xResync: (AffectRecords?: AffectEnum) => void;
|
||||
_xSave: (FileName?: string, PersistFormat?: PersistFormatEnum) => void;
|
||||
AbsolutePage: PositionEnum;
|
||||
AbsolutePosition: PositionEnum;
|
||||
ActiveCommand: any /*VT_DISPATCH*/;
|
||||
ActiveConnection: any /*VT_DISPATCH*/;
|
||||
AddNew: (FieldList?: any, Values?: any) => void;
|
||||
BOF: boolean;
|
||||
Bookmark: any;
|
||||
CacheSize: number;
|
||||
Cancel: () => void;
|
||||
CancelBatch: (AffectRecords?: AffectEnum) => void;
|
||||
CancelUpdate: () => void;
|
||||
Clone: (LockType?: LockTypeEnum) => Recordset;
|
||||
Close: () => void;
|
||||
Collect: (Index: any) => any; //Also has setter with parameters
|
||||
CompareBookmarks: (Bookmark1: any, Bookmark2: any) => CompareEnum;
|
||||
CursorLocation: CursorLocationEnum;
|
||||
CursorType: CursorTypeEnum;
|
||||
DataMember: string;
|
||||
DataSource: any /*VT_UNKNOWN*/;
|
||||
Delete: (AffectRecords?: AffectEnum) => void;
|
||||
EditMode: EditModeEnum;
|
||||
EOF: boolean;
|
||||
Fields: Fields;
|
||||
Filter: any;
|
||||
Find: (Criteria: string, SkipRecords?: number, SearchDirection?: SearchDirectionEnum, Start?: any) => void;
|
||||
GetRows: (Rows?: number, Start?: any, Fields?: any) => any;
|
||||
GetString: (StringFormat?: StringFormatEnum, NumRows?: number, ColumnDelimeter?: string, RowDelimeter?: string, NullExpr?: string) => string;
|
||||
Index: string;
|
||||
LockType: LockTypeEnum;
|
||||
MarshalOptions: MarshalOptionsEnum;
|
||||
MaxRecords: number;
|
||||
Move: (NumRecords: number, Start?: any) => void;
|
||||
MoveFirst: () => void;
|
||||
MoveLast: () => void;
|
||||
MoveNext: () => void;
|
||||
MovePrevious: () => void;
|
||||
NextRecordset: (RecordsAffected?: any) => Recordset;
|
||||
Open: (Source: any, ActiveConnection: any, CursorType?: CursorTypeEnum, LockType?: LockTypeEnum, Options?: number) => void;
|
||||
PageCount: number;
|
||||
PageSize: number;
|
||||
Properties: Properties;
|
||||
RecordCount: number;
|
||||
Requery: (Options?: number) => void;
|
||||
Resync: (AffectRecords?: AffectEnum, ResyncValues?: ResyncEnum) => void;
|
||||
Save: (Destination: any, PersistFormat?: PersistFormatEnum) => void;
|
||||
Seek: (KeyValues: any, SeekOption?: SeekEnum) => void;
|
||||
Sort: string;
|
||||
Source: any /*VT_DISPATCH*/;
|
||||
State: number;
|
||||
Status: number;
|
||||
StayInSync: boolean;
|
||||
Supports: (CursorOptions: CursorOptionEnum) => boolean;
|
||||
Update: (Fields?: any, Values?: any) => void;
|
||||
UpdateBatch: (AffectRecords?: AffectEnum) => void;
|
||||
}
|
||||
|
||||
interface Stream {
|
||||
Cancel: () => void;
|
||||
Charset: string;
|
||||
Close: () => void;
|
||||
CopyTo: (DestStream: Stream, CharNumber?: number) => void;
|
||||
EOS: boolean;
|
||||
Flush: () => void;
|
||||
LineSeparator: LineSeparatorEnum;
|
||||
LoadFromFile: (FileName: string) => void;
|
||||
Mode: ConnectModeEnum;
|
||||
Open: (Source: any, Mode?: ConnectModeEnum, Options?: StreamOpenOptionsEnum, UserName?: string, Password?: string) => void;
|
||||
Position: number;
|
||||
Read: (NumBytes?: number) => any;
|
||||
ReadText: (NumChars?: number) => string;
|
||||
SaveToFile: (FileName: string, Options?: SaveOptionsEnum) => void;
|
||||
SetEOS: () => void;
|
||||
Size: number;
|
||||
SkipLine: () => void;
|
||||
State: ObjectStateEnum;
|
||||
Type: StreamTypeEnum;
|
||||
Write: (Buffer: any) => void;
|
||||
WriteText: (Data: string, Options?: StreamWriteEnum) => void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
new (progID: 'ADODB.Connection'): ADODB.Connection;
|
||||
new (progID: 'ADODB.Record'): ADODB.Record;
|
||||
new (progID: 'ADODB.Stream'): ADODB.Stream;
|
||||
new (progID: 'ADODB.Command'): ADODB.Command;
|
||||
new (progID: 'ADODB.Recordset'): ADODB.Recordset;
|
||||
new (progID: 'ADODB.Parameter'): ADODB.Parameter;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bootstrap.datepicker-tests.ts"
|
||||
"activex-data-objects-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
//source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx
|
||||
|
||||
|
||||
//Generates a string describing the drive type of a given Drive object.
|
||||
var showDriveType = (drive: Scripting.Drive) => {
|
||||
switch (drive.DriveType) {
|
||||
case Scripting.DriveTypeConst.Removable:
|
||||
return 'Removeable';
|
||||
case Scripting.DriveTypeConst.Fixed:
|
||||
return 'Fixecd';
|
||||
case Scripting.DriveTypeConst.Remote:
|
||||
return 'Network';
|
||||
case Scripting.DriveTypeConst.CDRom:
|
||||
return 'CD-ROM';
|
||||
case Scripting.DriveTypeConst.RamDisk:
|
||||
return 'RAM Disk';
|
||||
default:
|
||||
return 'Unknown';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//Generates a string describing the attributes of a file or folder.
|
||||
var showFileAttributes = (file: Scripting.File) => {
|
||||
var attr = file.Attributes;
|
||||
if (attr === 0) {
|
||||
return 'Normal';
|
||||
}
|
||||
var attributeStrings: string[] = [];
|
||||
if (attr & Scripting.FileAttribute.Directory) { attributeStrings.push('Directory'); }
|
||||
if (attr & Scripting.FileAttribute.ReadOnly) { attributeStrings.push('Read-only'); }
|
||||
if (attr & Scripting.FileAttribute.Hidden) { attributeStrings.push('Hidden'); }
|
||||
if (attr & Scripting.FileAttribute.System) { attributeStrings.push('System'); }
|
||||
if (attr & Scripting.FileAttribute.Volume) { attributeStrings.push('Volume'); }
|
||||
if (attr & Scripting.FileAttribute.Archive) { attributeStrings.push('Archive'); }
|
||||
if (attr & Scripting.FileAttribute.Alias) { attributeStrings.push('Alias'); }
|
||||
if (attr & Scripting.FileAttribute.Compressed) { attributeStrings.push('Compressed'); }
|
||||
return attributeStrings.join(',');
|
||||
};
|
||||
|
||||
|
||||
//source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx
|
||||
var showFreeSpace = (drvPath: string) => {
|
||||
var fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
var d = fso.GetDrive(fso.GetDriveName(drvPath));
|
||||
var s = 'Drive ' + drvPath + ' - ';
|
||||
s += d.VolumeName + '<br>';
|
||||
s += 'Free Space: ' + d.FreeSpace / 1024 + ' Kbytes';
|
||||
return (s);
|
||||
};
|
||||
|
||||
|
||||
//source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx
|
||||
var getALine = (filespec: string) => {
|
||||
var fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
var file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false);
|
||||
|
||||
var s = '';
|
||||
while (!file.AtEndOfLine) {
|
||||
s += file.Read(1);
|
||||
}
|
||||
file.Close();
|
||||
return (s);
|
||||
};
|
||||
Vendored
+205
@@ -0,0 +1,205 @@
|
||||
// Type definitions for Microsoft Scripting Runtime
|
||||
// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Scripting {
|
||||
|
||||
//Enums
|
||||
const enum CompareMethod {
|
||||
BinaryCompare = 0,
|
||||
DatabaseCompare = 2,
|
||||
TextCompare = 1
|
||||
}
|
||||
|
||||
const enum DriveTypeConst {
|
||||
CDRom = 4,
|
||||
Fixed = 2,
|
||||
RamDisk = 5,
|
||||
Remote = 3,
|
||||
Removable = 1,
|
||||
UnknownType = 0
|
||||
}
|
||||
|
||||
const enum FileAttribute {
|
||||
Alias = 1024,
|
||||
Archive = 32,
|
||||
Compressed = 2048,
|
||||
Directory = 16,
|
||||
Hidden = 2,
|
||||
Normal = 0,
|
||||
ReadOnly = 1,
|
||||
System = 4,
|
||||
Volume = 8
|
||||
}
|
||||
|
||||
const enum IOMode {
|
||||
ForAppending = 8,
|
||||
ForReading = 1,
|
||||
ForWriting = 2
|
||||
}
|
||||
|
||||
const enum SpecialFolderConst {
|
||||
SystemFolder = 1,
|
||||
TemporaryFolder = 2,
|
||||
WindowsFolder = 0
|
||||
}
|
||||
|
||||
const enum StandardStreamTypes {
|
||||
StdErr = 2,
|
||||
StdIn = 0,
|
||||
StdOut = 1
|
||||
}
|
||||
|
||||
const enum Tristate {
|
||||
TristateFalse = 0,
|
||||
TristateMixed = -2,
|
||||
TristateTrue = -1,
|
||||
TristateUseDefault = -2
|
||||
}
|
||||
|
||||
//Interfaces
|
||||
interface Dictionary {
|
||||
Add: (Key: any, Item: any) => void;
|
||||
CompareMode: CompareMethod;
|
||||
Count: number;
|
||||
Exists: (Key: any) => boolean;
|
||||
HashVal: (Key: any) => any;
|
||||
Item: (Key: any) => any; //Also has setter with parameters
|
||||
Items: () => any;
|
||||
Key: (Key: any) => any;
|
||||
Keys: () => any;
|
||||
Remove: (Key: any) => void;
|
||||
RemoveAll: () => void;
|
||||
}
|
||||
|
||||
interface Drive {
|
||||
AvailableSpace: any;
|
||||
DriveLetter: string;
|
||||
DriveType: DriveTypeConst;
|
||||
FileSystem: string;
|
||||
FreeSpace: any;
|
||||
IsReady: boolean;
|
||||
Path: string;
|
||||
RootFolder: Folder;
|
||||
SerialNumber: number;
|
||||
ShareName: string;
|
||||
TotalSize: any;
|
||||
VolumeName: string;
|
||||
}
|
||||
|
||||
interface Drives {
|
||||
Count: number;
|
||||
Item: (Key: any) => Drive;
|
||||
}
|
||||
|
||||
interface Encoder {
|
||||
EncodeScriptFile: (szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string) => string;
|
||||
}
|
||||
|
||||
interface File {
|
||||
Attributes: FileAttribute;
|
||||
Copy: (Destination: string, OverWriteFiles?: boolean) => void;
|
||||
DateCreated: VarDate;
|
||||
DateLastAccessed: VarDate;
|
||||
DateLastModified: VarDate;
|
||||
Delete: (Force?: boolean) => void;
|
||||
Drive: Drive;
|
||||
Move: (Destination: string) => void;
|
||||
Name: string;
|
||||
OpenAsTextStream: (IOMode?: IOMode, Format?: Tristate) => TextStream;
|
||||
ParentFolder: Folder;
|
||||
Path: string;
|
||||
ShortName: string;
|
||||
ShortPath: string;
|
||||
Size: any;
|
||||
Type: string;
|
||||
}
|
||||
|
||||
interface Files {
|
||||
Count: number;
|
||||
Item: (Key: any) => File;
|
||||
}
|
||||
|
||||
interface FileSystemObject {
|
||||
BuildPath: (Path: string, Name: string) => string;
|
||||
CopyFile: (Source: string, Destination: string, OverWriteFiles?: boolean) => void;
|
||||
CopyFolder: (Source: string, Destination: string, OverWriteFiles?: boolean) => void;
|
||||
CreateFolder: (Path: string) => Folder;
|
||||
CreateTextFile: (FileName: string, Overwrite?: boolean, Unicode?: boolean) => TextStream;
|
||||
DeleteFile: (FileSpec: string, Force?: boolean) => void;
|
||||
DeleteFolder: (FolderSpec: string, Force?: boolean) => void;
|
||||
DriveExists: (DriveSpec: string) => boolean;
|
||||
Drives: Drives;
|
||||
FileExists: (FileSpec: string) => boolean;
|
||||
FolderExists: (FolderSpec: string) => boolean;
|
||||
GetAbsolutePathName: (Path: string) => string;
|
||||
GetBaseName: (Path: string) => string;
|
||||
GetDrive: (DriveSpec: string) => Drive;
|
||||
GetDriveName: (Path: string) => string;
|
||||
GetExtensionName: (Path: string) => string;
|
||||
GetFile: (FilePath: string) => File;
|
||||
GetFileName: (Path: string) => string;
|
||||
GetFileVersion: (FileName: string) => string;
|
||||
GetFolder: (FolderPath: string) => Folder;
|
||||
GetParentFolderName: (Path: string) => string;
|
||||
GetSpecialFolder: (SpecialFolder: SpecialFolderConst) => Folder;
|
||||
GetStandardStream: (StandardStreamType: StandardStreamTypes, Unicode?: boolean) => TextStream;
|
||||
GetTempName: () => string;
|
||||
MoveFile: (Source: string, Destination: string) => void;
|
||||
MoveFolder: (Source: string, Destination: string) => void;
|
||||
OpenTextFile: (FileName: string, IOMode?: IOMode, Create?: boolean, Format?: Tristate) => TextStream;
|
||||
}
|
||||
|
||||
interface Folder {
|
||||
Attributes: FileAttribute;
|
||||
Copy: (Destination: string, OverWriteFiles?: boolean) => void;
|
||||
CreateTextFile: (FileName: string, Overwrite?: boolean, Unicode?: boolean) => TextStream;
|
||||
DateCreated: VarDate;
|
||||
DateLastAccessed: VarDate;
|
||||
DateLastModified: VarDate;
|
||||
Delete: (Force?: boolean) => void;
|
||||
Drive: Drive;
|
||||
Files: Files;
|
||||
IsRootFolder: boolean;
|
||||
Move: (Destination: string) => void;
|
||||
Name: string;
|
||||
ParentFolder: Folder;
|
||||
Path: string;
|
||||
ShortName: string;
|
||||
ShortPath: string;
|
||||
Size: any;
|
||||
SubFolders: Folders;
|
||||
Type: string;
|
||||
}
|
||||
|
||||
interface Folders {
|
||||
Add: (Name: string) => Folder;
|
||||
Count: number;
|
||||
Item: (Key: any) => Folder;
|
||||
}
|
||||
|
||||
interface TextStream {
|
||||
AtEndOfLine: boolean;
|
||||
AtEndOfStream: boolean;
|
||||
Close: () => void;
|
||||
Column: number;
|
||||
Line: number;
|
||||
Read: (Characters: number) => string;
|
||||
ReadAll: () => string;
|
||||
ReadLine: () => string;
|
||||
Skip: (Characters: number) => void;
|
||||
SkipLine: () => void;
|
||||
Write: (Text: string) => void;
|
||||
WriteBlankLines: (Lines: number) => void;
|
||||
WriteLine: (Text?: string) => void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
new (progID: 'Scripting.Dictionary'): Scripting.Dictionary;
|
||||
new (progID: 'Scripting.FileSystemObject'): Scripting.FileSystemObject;
|
||||
new (progID: 'Scripting.Encoder'): Scripting.Encoder;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"activex-scripting-runtime-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//source -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms630826(v=vs.85).aspx
|
||||
|
||||
|
||||
//Convert a file
|
||||
var commonDialog = new ActiveXObject('WIA.CommonDialog');
|
||||
var img = commonDialog.ShowAcquireImage();
|
||||
if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) {
|
||||
var ip = new ActiveXObject('WIA.ImageProcess');
|
||||
ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID);
|
||||
ip.Filters.Item(1).Properties.Item('FormatID').Value = WIA.FormatID.wiaFormatJPEG;
|
||||
img = ip.Apply(img);
|
||||
}
|
||||
|
||||
|
||||
//Take a picture
|
||||
var dev = commonDialog.ShowSelectDevice();
|
||||
if (dev.Type === WIA.WiaDeviceType.CameraDeviceType) {
|
||||
var itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);
|
||||
}
|
||||
|
||||
|
||||
//Display detailed property information
|
||||
dev = commonDialog.ShowSelectDevice();
|
||||
var e = new Enumerator<WIA.Property>(dev.Properties); //no foreach over ActiveX collections
|
||||
e.moveFirst();
|
||||
while (!e.atEnd()) {
|
||||
var p = e.item();
|
||||
var s = p.Name + ' (' + p.PropertyID + ') = ';
|
||||
if (p.IsVector) {
|
||||
s += '[vector of data]';
|
||||
} else {
|
||||
s += p.Value;
|
||||
if (p.SubType !== WIA.WiaSubType.UnspecifiedSubType) {
|
||||
if (p.Value !== p.SubTypeDefault) {
|
||||
s += ' (Default = ' + p.SubTypeDefault + ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p.IsReadOnly) {
|
||||
s += ' [READ ONLY]';
|
||||
} else {
|
||||
switch (p.SubType) {
|
||||
case WIA.WiaSubType.FlagSubType:
|
||||
case WIA.WiaSubType.ListSubType:
|
||||
if (p.SubType === WIA.WiaSubType.FlagSubType) {
|
||||
s += ' [valid flags include: ';
|
||||
} else {
|
||||
s += ' [valid values include: ';
|
||||
}
|
||||
var count = p.SubTypeValues.Count;
|
||||
for (var i = 1; i <= count; i++) {
|
||||
s += p.SubTypeValues.Item(i);
|
||||
if (i < count) {
|
||||
s += ', ';
|
||||
}
|
||||
}
|
||||
s += ']';
|
||||
break;
|
||||
case WIA.WiaSubType.RangeSubType:
|
||||
s += ' [valid values in the range from ' + p.SubTypeMin + ' to ' + p.SubTypeMax + ' in increments of ' + p.SubTypeStep + ']';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (WScript) {
|
||||
WScript.Echo(s);
|
||||
} else if (window) {
|
||||
window.alert(s);
|
||||
}
|
||||
}
|
||||
+379
@@ -0,0 +1,379 @@
|
||||
// Type definitions for Microsoft Windows Image Acquisition Library v2.0
|
||||
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630827(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace WIA {
|
||||
|
||||
//Enums
|
||||
type CommandID =
|
||||
"'{04E725B0-ACAE-11D2-A093-00C04F72DC3C}'" //wiaCommandChangeDocument
|
||||
| "'{E208C170-ACAD-11D2-A093-00C04F72DC3C}'" //wiaCommandDeleteAllItems
|
||||
| "'{9B26B7B2-ACAD-11D2-A093-00C04F72DC3C}'" //wiaCommandSynchronize
|
||||
| "'{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}'" //wiaCommandTakePicture
|
||||
| "'{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}'"; //wiaCommandUnloadDocument
|
||||
const CommandID: {
|
||||
wiaCommandChangeDocument: CommandID,
|
||||
wiaCommandDeleteAllItems: CommandID,
|
||||
wiaCommandSynchronize: CommandID,
|
||||
wiaCommandTakePicture: CommandID,
|
||||
wiaCommandUnloadDocument: CommandID
|
||||
};
|
||||
|
||||
type EventID =
|
||||
"'{A28BBADE-64B6-11D2-A231-00C04FA31809}'" //wiaEventDeviceConnected
|
||||
| "'{143E4E83-6497-11D2-A231-00C04FA31809}'" //wiaEventDeviceDisconnected
|
||||
| "'{4C8F4EF5-E14F-11D2-B326-00C04F68CE61}'" //wiaEventItemCreated
|
||||
| "'{1D22A559-E14F-11D2-B326-00C04F68CE61}'" //wiaEventItemDeleted
|
||||
| "'{C686DCEE-54F2-419E-9A27-2FC7F2E98F9E}'" //wiaEventScanEmailImage
|
||||
| "'{C00EB793-8C6E-11D2-977A-0000F87A926F}'" //wiaEventScanFaxImage
|
||||
| "'{9B2B662C-6185-438C-B68B-E39EE25E71CB}'" //wiaEventScanFilmImage
|
||||
| "'{A6C5A715-8C6E-11D2-977A-0000F87A926F}'" //wiaEventScanImage
|
||||
| "'{FC4767C1-C8B3-48A2-9CFA-2E90CB3D3590}'" //wiaEventScanImage2
|
||||
| "'{154E27BE-B617-4653-ACC5-0FD7BD4C65CE}'" //wiaEventScanImage3
|
||||
| "'{A65B704A-7F3C-4447-A75D-8A26DFCA1FDF}'" //wiaEventScanImage4
|
||||
| "'{9D095B89-37D6-4877-AFED-62A297DC6DBE}'" //wiaEventScanOCRImage
|
||||
| "'{B441F425-8C6E-11D2-977A-0000F87A926F}'"; //wiaEventScanPrintImage
|
||||
const EventID: {
|
||||
wiaEventDeviceConnected: EventID,
|
||||
wiaEventDeviceDisconnected: EventID,
|
||||
wiaEventItemCreated: EventID,
|
||||
wiaEventItemDeleted: EventID,
|
||||
wiaEventScanEmailImage: EventID,
|
||||
wiaEventScanFaxImage: EventID,
|
||||
wiaEventScanFilmImage: EventID,
|
||||
wiaEventScanImage: EventID,
|
||||
wiaEventScanImage2: EventID,
|
||||
wiaEventScanImage3: EventID,
|
||||
wiaEventScanImage4: EventID,
|
||||
wiaEventScanOCRImage: EventID,
|
||||
wiaEventScanPrintImage: EventID
|
||||
};
|
||||
|
||||
type FormatID =
|
||||
"'{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatBMP
|
||||
| "'{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatGIF
|
||||
| "'{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatJPEG
|
||||
| "'{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatPNG
|
||||
| "'{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}'"; //wiaFormatTIFF
|
||||
const FormatID: {
|
||||
wiaFormatBMP: FormatID,
|
||||
wiaFormatGIF: FormatID,
|
||||
wiaFormatJPEG: FormatID,
|
||||
wiaFormatPNG: FormatID,
|
||||
wiaFormatTIFF: FormatID
|
||||
};
|
||||
|
||||
type Miscellaneous =
|
||||
"'*'" //wiaAnyDeviceID
|
||||
| "'{00000000-0000-0000-0000-000000000000}'"; //wiaIDUnknown
|
||||
const Miscellaneous: {
|
||||
wiaAnyDeviceID: Miscellaneous,
|
||||
wiaIDUnknown: Miscellaneous
|
||||
};
|
||||
|
||||
const enum WiaDeviceType {
|
||||
CameraDeviceType = 2,
|
||||
ScannerDeviceType = 1,
|
||||
UnspecifiedDeviceType = 0,
|
||||
VideoDeviceType = 3
|
||||
}
|
||||
|
||||
const enum WiaEventFlag {
|
||||
ActionEvent = 2,
|
||||
NotificationEvent = 1
|
||||
}
|
||||
|
||||
const enum WiaImageBias {
|
||||
MaximizeQuality = 131072,
|
||||
MinimizeSize = 65536
|
||||
}
|
||||
|
||||
const enum WiaImageIntent {
|
||||
ColorIntent = 1,
|
||||
GrayscaleIntent = 2,
|
||||
TextIntent = 4,
|
||||
UnspecifiedIntent = 0
|
||||
}
|
||||
|
||||
const enum WiaImagePropertyType {
|
||||
ByteImagePropertyType = 1001,
|
||||
LongImagePropertyType = 1004,
|
||||
RationalImagePropertyType = 1006,
|
||||
StringImagePropertyType = 1002,
|
||||
UndefinedImagePropertyType = 1000,
|
||||
UnsignedIntegerImagePropertyType = 1003,
|
||||
UnsignedLongImagePropertyType = 1005,
|
||||
UnsignedRationalImagePropertyType = 1007,
|
||||
VectorOfBytesImagePropertyType = 1101,
|
||||
VectorOfLongsImagePropertyType = 1103,
|
||||
VectorOfRationalsImagePropertyType = 1105,
|
||||
VectorOfUndefinedImagePropertyType = 1100,
|
||||
VectorOfUnsignedIntegersImagePropertyType = 1102,
|
||||
VectorOfUnsignedLongsImagePropertyType = 1104,
|
||||
VectorOfUnsignedRationalsImagePropertyType = 1106
|
||||
}
|
||||
|
||||
const enum WiaItemFlag {
|
||||
AnalyzeItemFlag = 16,
|
||||
AudioItemFlag = 32,
|
||||
BurstItemFlag = 2048,
|
||||
DeletedItemFlag = 128,
|
||||
DeviceItemFlag = 64,
|
||||
DisconnectedItemFlag = 256,
|
||||
FileItemFlag = 2,
|
||||
FolderItemFlag = 4,
|
||||
FreeItemFlag = 0,
|
||||
GeneratedItemFlag = 16384,
|
||||
HasAttachmentsItemFlag = 32768,
|
||||
HPanoramaItemFlag = 512,
|
||||
ImageItemFlag = 1,
|
||||
RemovedItemFlag = -2147483648,
|
||||
RootItemFlag = 8,
|
||||
StorageItemFlag = 4096,
|
||||
TransferItemFlag = 8192,
|
||||
VideoItemFlag = 65536,
|
||||
VPanoramaItemFlag = 1024
|
||||
}
|
||||
|
||||
const enum WiaPropertyType {
|
||||
BooleanPropertyType = 1,
|
||||
BytePropertyType = 2,
|
||||
ClassIDPropertyType = 15,
|
||||
CurrencyPropertyType = 12,
|
||||
DatePropertyType = 13,
|
||||
DoublePropertyType = 11,
|
||||
ErrorCodePropertyType = 7,
|
||||
FileTimePropertyType = 14,
|
||||
HandlePropertyType = 18,
|
||||
IntegerPropertyType = 3,
|
||||
LargeIntegerPropertyType = 8,
|
||||
LongPropertyType = 5,
|
||||
ObjectPropertyType = 17,
|
||||
SinglePropertyType = 10,
|
||||
StringPropertyType = 16,
|
||||
UnsignedIntegerPropertyType = 4,
|
||||
UnsignedLargeIntegerPropertyType = 9,
|
||||
UnsignedLongPropertyType = 6,
|
||||
UnsupportedPropertyType = 0,
|
||||
VariantPropertyType = 19,
|
||||
VectorOfBooleansPropertyType = 101,
|
||||
VectorOfBytesPropertyType = 102,
|
||||
VectorOfClassIDsPropertyType = 115,
|
||||
VectorOfCurrenciesPropertyType = 112,
|
||||
VectorOfDatesPropertyType = 113,
|
||||
VectorOfDoublesPropertyType = 111,
|
||||
VectorOfErrorCodesPropertyType = 107,
|
||||
VectorOfFileTimesPropertyType = 114,
|
||||
VectorOfIntegersPropertyType = 103,
|
||||
VectorOfLargeIntegersPropertyType = 108,
|
||||
VectorOfLongsPropertyType = 105,
|
||||
VectorOfSinglesPropertyType = 110,
|
||||
VectorOfStringsPropertyType = 116,
|
||||
VectorOfUnsignedIntegersPropertyType = 104,
|
||||
VectorOfUnsignedLargeIntegersPropertyType = 109,
|
||||
VectorOfUnsignedLongsPropertyType = 106,
|
||||
VectorOfVariantsPropertyType = 119
|
||||
}
|
||||
|
||||
const enum WiaSubType {
|
||||
FlagSubType = 3,
|
||||
ListSubType = 2,
|
||||
RangeSubType = 1,
|
||||
UnspecifiedSubType = 0
|
||||
}
|
||||
|
||||
//Interfaces
|
||||
interface CommonDialog {
|
||||
ShowAcquireImage: (DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean) => ImageFile;
|
||||
ShowAcquisitionWizard: (Device: Device) => any;
|
||||
ShowDeviceProperties: (Device: Device, CancelError?: boolean) => void;
|
||||
ShowItemProperties: (Item: Item, CancelError?: boolean) => void;
|
||||
ShowPhotoPrintingWizard: (Files: any) => void;
|
||||
ShowSelectDevice: (DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean) => Device;
|
||||
ShowSelectItems: (Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean) => Items;
|
||||
ShowTransfer: (Item: Item, FormatID?: string, CancelError?: boolean) => any;
|
||||
}
|
||||
|
||||
interface Device {
|
||||
Commands: DeviceCommands;
|
||||
DeviceID: string;
|
||||
Events: DeviceEvents;
|
||||
ExecuteCommand: (CommandID: string) => Item;
|
||||
GetItem: (ItemID: string) => Item;
|
||||
Items: Items;
|
||||
Properties: Properties;
|
||||
Type: WiaDeviceType;
|
||||
WiaItem: any /*VT_UNKNOWN*/;
|
||||
}
|
||||
|
||||
interface DeviceCommand {
|
||||
CommandID: string;
|
||||
Description: string;
|
||||
Name: string;
|
||||
}
|
||||
|
||||
interface DeviceCommands {
|
||||
Count: number;
|
||||
Item: (Index: number) => DeviceCommand;
|
||||
}
|
||||
|
||||
interface DeviceEvent {
|
||||
Description: string;
|
||||
EventID: string;
|
||||
Name: string;
|
||||
Type: WiaEventFlag;
|
||||
}
|
||||
|
||||
interface DeviceEvents {
|
||||
Count: number;
|
||||
Item: (Index: number) => DeviceEvent;
|
||||
}
|
||||
|
||||
interface DeviceInfo {
|
||||
Connect: () => Device;
|
||||
DeviceID: string;
|
||||
Properties: Properties;
|
||||
Type: WiaDeviceType;
|
||||
}
|
||||
|
||||
interface DeviceInfos {
|
||||
Count: number;
|
||||
Item: (Index: any) => DeviceInfo;
|
||||
}
|
||||
|
||||
interface DeviceManager {
|
||||
DeviceInfos: DeviceInfos;
|
||||
RegisterEvent: (EventID: string, DeviceID?: string) => void;
|
||||
RegisterPersistentEvent: (Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string) => void;
|
||||
UnregisterEvent: (EventID: string, DeviceID?: string) => void;
|
||||
UnregisterPersistentEvent: (Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string) => void;
|
||||
}
|
||||
|
||||
interface Filter {
|
||||
Description: string;
|
||||
FilterID: string;
|
||||
Name: string;
|
||||
Properties: Properties;
|
||||
}
|
||||
|
||||
interface FilterInfo {
|
||||
Description: string;
|
||||
FilterID: string;
|
||||
Name: string;
|
||||
}
|
||||
|
||||
interface FilterInfos {
|
||||
Count: number;
|
||||
Item: (Index: any) => FilterInfo;
|
||||
}
|
||||
|
||||
interface Filters {
|
||||
Add: (FilterID: string, Index?: number) => void;
|
||||
Count: number;
|
||||
Item: (Index: number) => Filter;
|
||||
Remove: (Index: number) => void;
|
||||
}
|
||||
|
||||
interface Formats {
|
||||
Count: number;
|
||||
Item: (Index: number) => string;
|
||||
}
|
||||
|
||||
interface ImageFile {
|
||||
ActiveFrame: number;
|
||||
ARGBData: Vector;
|
||||
FileData: Vector;
|
||||
FileExtension: string;
|
||||
FormatID: string;
|
||||
FrameCount: number;
|
||||
Height: number;
|
||||
HorizontalResolution: number;
|
||||
IsAlphaPixelFormat: boolean;
|
||||
IsAnimated: boolean;
|
||||
IsExtendedPixelFormat: boolean;
|
||||
IsIndexedPixelFormat: boolean;
|
||||
LoadFile: (Filename: string) => void;
|
||||
PixelDepth: number;
|
||||
Properties: Properties;
|
||||
SaveFile: (Filename: string) => void;
|
||||
VerticalResolution: number;
|
||||
Width: number;
|
||||
}
|
||||
|
||||
interface ImageProcess {
|
||||
Apply: (Source: ImageFile) => ImageFile;
|
||||
FilterInfos: FilterInfos;
|
||||
Filters: Filters;
|
||||
}
|
||||
|
||||
interface Item {
|
||||
Commands: DeviceCommands;
|
||||
ExecuteCommand: (CommandID: string) => Item;
|
||||
Formats: Formats;
|
||||
ItemID: string;
|
||||
Items: Items;
|
||||
Properties: Properties;
|
||||
Transfer: (FormatID?: string) => any;
|
||||
WiaItem: any /*VT_UNKNOWN*/;
|
||||
}
|
||||
|
||||
interface Items {
|
||||
Add: (Name: string, Flags: number) => void;
|
||||
Count: number;
|
||||
Item: (Index: number) => Item;
|
||||
Remove: (Index: number) => void;
|
||||
}
|
||||
|
||||
interface Properties {
|
||||
Count: number;
|
||||
Exists: (Index: any) => boolean;
|
||||
Item: (Index: any) => Property;
|
||||
}
|
||||
|
||||
interface Property {
|
||||
IsReadOnly: boolean;
|
||||
IsVector: boolean;
|
||||
Name: string;
|
||||
PropertyID: number;
|
||||
SubType: WiaSubType;
|
||||
SubTypeDefault: any;
|
||||
SubTypeMax: number;
|
||||
SubTypeMin: number;
|
||||
SubTypeStep: number;
|
||||
SubTypeValues: Vector;
|
||||
Type: number;
|
||||
Value: any;
|
||||
}
|
||||
|
||||
interface Rational {
|
||||
Denominator: number;
|
||||
Numerator: number;
|
||||
Value: number;
|
||||
}
|
||||
|
||||
interface Vector {
|
||||
Add: (Value: any, Index?: number) => void;
|
||||
BinaryData: any;
|
||||
Clear: () => void;
|
||||
Count: number;
|
||||
Date: VarDate;
|
||||
ImageFile: (Width?: number, Height?: number) => ImageFile;
|
||||
Item: (Index: number) => any; //Also has setter with parameters
|
||||
Picture: (Width?: number, Height?: number) => any;
|
||||
Remove: (Index: number) => any;
|
||||
SetFromString: (Value: string, Resizable?: boolean, Unicode?: boolean) => void;
|
||||
String: (Unicode?: boolean) => string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
new (progID: 'WIA.Rational'): WIA.Rational;
|
||||
new (progID: 'WIA.Vector'): WIA.Vector;
|
||||
new (progID: 'WIA.ImageFile'): WIA.ImageFile;
|
||||
new (progID: 'WIA.ImageProcess'): WIA.ImageProcess;
|
||||
new (progID: 'WIA.CommonDialog'): WIA.CommonDialog;
|
||||
new (progID: 'WIA.DeviceManager'): WIA.DeviceManager;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"activex-windows-image-acquisition-tests.ts"
|
||||
]
|
||||
}
|
||||
+10
-1
@@ -12,4 +12,13 @@ var config : adal.Config = {
|
||||
|
||||
var auth = new AuthenticationContext(config);
|
||||
|
||||
var userName: string = auth.getCachedUser().userName;
|
||||
Logging.log = (message: string) => {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
Logging.level = 4;
|
||||
|
||||
auth.info("Logging message");
|
||||
|
||||
var userName: string = auth.getCachedUser().userName;var postLogoutRedirectUrl = auth.config.postLogoutRedirectUri;
|
||||
var isValidRequest = auth.getRequestInfo('hash').valid;
|
||||
Vendored
+43
-20
@@ -4,37 +4,51 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var AuthenticationContext: adal.AuthenticationContextStatic;
|
||||
declare var Logging: adal.Logging;
|
||||
|
||||
declare module 'adal' {
|
||||
export = AuthenticationContext;
|
||||
export = { AuthenticationContext, Logging };
|
||||
}
|
||||
|
||||
declare namespace adal {
|
||||
|
||||
interface Config {
|
||||
tenant?: string,
|
||||
clientId: string,
|
||||
redirectUri?: string,
|
||||
cacheLocation?: string,
|
||||
displayCall?: (urlNavigate: string) => any,
|
||||
correlationId?: string,
|
||||
loginResource?: string,
|
||||
resource?: string
|
||||
endpoints?: any // If you need to send CORS api requests.
|
||||
extraQueryParameter?: string
|
||||
tenant?: string;
|
||||
clientId: string;
|
||||
redirectUri?: string;
|
||||
cacheLocation?: string;
|
||||
displayCall?: (urlNavigate: string) => any;
|
||||
correlationId?: string;
|
||||
loginResource?: string;
|
||||
resource?: string;
|
||||
endpoints?: any; // If you need to send CORS api requests.
|
||||
extraQueryParameter?: string;
|
||||
postLogoutRedirectUri?: string; // redirect url after succesful logout operation
|
||||
}
|
||||
|
||||
interface User {
|
||||
userName: string,
|
||||
profile: any
|
||||
userName: string;
|
||||
profile: any;
|
||||
}
|
||||
|
||||
interface RequestInfo {
|
||||
valid: boolean,
|
||||
parameters: any,
|
||||
stateMatch: boolean,
|
||||
stateResponse: string,
|
||||
requestType: string
|
||||
valid: boolean;
|
||||
parameters: any;
|
||||
stateMatch: boolean;
|
||||
stateResponse: string;
|
||||
requestType: string;
|
||||
}
|
||||
|
||||
interface Logging {
|
||||
log: (message: string) => void;
|
||||
level: LoggingLevel;
|
||||
}
|
||||
|
||||
enum LoggingLevel {
|
||||
ERROR = 0,
|
||||
WARNING = 1,
|
||||
INFO = 2,
|
||||
VERBOSE = 3
|
||||
}
|
||||
|
||||
interface AuthenticationContextStatic {
|
||||
@@ -51,6 +65,10 @@ declare namespace adal {
|
||||
* Saves the resulting Idtoken in localStorage.
|
||||
*/
|
||||
login(): void;
|
||||
|
||||
/**
|
||||
* Indicates whether login is in progress now or not.
|
||||
*/
|
||||
loginInProgress(): boolean;
|
||||
|
||||
/**
|
||||
@@ -118,9 +136,9 @@ declare namespace adal {
|
||||
|
||||
/**
|
||||
* Gets requestInfo from given hash.
|
||||
* @returns {string} error message related to login
|
||||
* @returns {RequestInfo} for appropriate hash.
|
||||
*/
|
||||
getRequestInfo(hash: string): string;
|
||||
getRequestInfo(hash: string): RequestInfo;
|
||||
|
||||
/**
|
||||
* Saves token from hash that is received from redirect.
|
||||
@@ -134,6 +152,11 @@ declare namespace adal {
|
||||
*/
|
||||
getResourceForEndpoint(endpoint: string): string;
|
||||
|
||||
/**
|
||||
* Handles redirection after login operation.
|
||||
* Gets access token from url and saves token to the (local/session) storage
|
||||
* or saves error in case unsuccessful login.
|
||||
*/
|
||||
handleWindowCallback(): void;
|
||||
|
||||
log(level: number, message: string, error: any): void;
|
||||
|
||||
Vendored
+294
-285
@@ -5,8 +5,10 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import {EventEmitter} from "events";
|
||||
import {Db, Collection, ObjectID} from "mongodb";
|
||||
import { EventEmitter } from "events";
|
||||
import { Db, Collection, ObjectID } from "mongodb";
|
||||
|
||||
export = Agenda;
|
||||
|
||||
interface Callback {
|
||||
(err?: Error): void;
|
||||
@@ -16,285 +18,14 @@ interface ResultCallback<T> {
|
||||
(err?: Error, result?: T): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Agenda Configuration.
|
||||
*/
|
||||
interface AgendaConfiguration {
|
||||
|
||||
/**
|
||||
* Sets the interval with which the queue is checked. A number in milliseconds or a frequency string.
|
||||
*/
|
||||
processEvery?: string | number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be running at any given moment.
|
||||
* By default it is 5.
|
||||
*/
|
||||
defaultConcurrency?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the max number of jobs that can be running at any given moment. By default it
|
||||
* is 20.
|
||||
*/
|
||||
maxConcurrency?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be locked at any given moment.
|
||||
* By default it is 0 for no max.
|
||||
*/
|
||||
defaultLockLimit?: number;
|
||||
|
||||
/**
|
||||
* Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* 0 for no max.
|
||||
*/
|
||||
lockLimit?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default lock lifetime in milliseconds. By default it is 10 minutes. This
|
||||
* can be overridden by specifying the lockLifetime option to a defined job.
|
||||
*/
|
||||
defaultLockLifetime?: number;
|
||||
|
||||
/**
|
||||
* Specifies that Agenda should be initialized using and existing MongoDB connection.
|
||||
*/
|
||||
mongo?: {
|
||||
/**
|
||||
* The MongoDB database connection to use.
|
||||
*/
|
||||
db: Db;
|
||||
|
||||
/**
|
||||
* The name of the collection to use.
|
||||
*/
|
||||
collection?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies that Agenda should connect to MongoDB.
|
||||
*/
|
||||
db?: {
|
||||
/**
|
||||
* The connection URL.
|
||||
*/
|
||||
address: string;
|
||||
|
||||
/**
|
||||
* The name of the collection to use.
|
||||
*/
|
||||
collection?: string;
|
||||
|
||||
/**
|
||||
* Connection options to pass to MongoDB.
|
||||
*/
|
||||
options?: any;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The database record associated with a job.
|
||||
*/
|
||||
interface JobAttributes {
|
||||
/**
|
||||
* The record identity.
|
||||
*/
|
||||
_id: ObjectID;
|
||||
|
||||
/**
|
||||
* The name of the job.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The type of the job (single|normal).
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* The job details.
|
||||
*/
|
||||
data: { [name: string]: any };
|
||||
|
||||
/**
|
||||
* The priority of the job.
|
||||
*/
|
||||
priority: number;
|
||||
|
||||
/**
|
||||
* How often the job is repeated using a human-readable or cron format.
|
||||
*/
|
||||
repeatInterval: string | number;
|
||||
|
||||
/**
|
||||
* The timezone that conforms to [moment-timezone](http://momentjs.com/timezone/).
|
||||
*/
|
||||
repeatTimezone: string;
|
||||
|
||||
/**
|
||||
* Date/time the job was las modified.
|
||||
*/
|
||||
lastModifiedBy: string;
|
||||
|
||||
/**
|
||||
* Date/time the job will run next.
|
||||
*/
|
||||
nextRunAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job was locked.
|
||||
*/
|
||||
lockedAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job was last run.
|
||||
*/
|
||||
lastRunAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job last finished running.
|
||||
*/
|
||||
lastFinishedAt: Date;
|
||||
|
||||
/**
|
||||
* The reason the job failed.
|
||||
*/
|
||||
failReason: string;
|
||||
|
||||
/**
|
||||
* The number of times the job has failed.
|
||||
*/
|
||||
failCount: number;
|
||||
|
||||
/**
|
||||
* The date/time the job last failed.
|
||||
*/
|
||||
failedAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* A scheduled job.
|
||||
*/
|
||||
interface Job {
|
||||
|
||||
/**
|
||||
* The database record associated with the job.
|
||||
*/
|
||||
attrs: JobAttributes;
|
||||
|
||||
/**
|
||||
* Specifies an interval on which the job should repeat.
|
||||
* @param interval A human-readable format String, a cron format String, or a Number.
|
||||
* @param options An optional argument that can include a timezone field. The timezone should be a string as
|
||||
* accepted by moment-timezone and is considered when using an interval in the cron string format.
|
||||
*/
|
||||
repeatEvery(interval: string | number, options?: { timezone?: string }): Job
|
||||
|
||||
/**
|
||||
* Specifies a time when the job should repeat. [Possible values](https://github.com/matthewmueller/date#examples).
|
||||
* @param time
|
||||
*/
|
||||
repeatAt(time: string): Job
|
||||
|
||||
/**
|
||||
* Disables the job.
|
||||
*/
|
||||
disable(): Job;
|
||||
|
||||
/**
|
||||
* Enables the job.
|
||||
*/
|
||||
enable(): Job;
|
||||
|
||||
/**
|
||||
* Ensure that only one instance of this job exists with the specified properties
|
||||
* @param value The properties associated with the job that must be unqiue.
|
||||
* @param opts
|
||||
*/
|
||||
unique(value: any, opts?: { insertOnly?: boolean }): Job;
|
||||
|
||||
/**
|
||||
* Specifies the next time at which the job should run.
|
||||
* @param time The next time at which the job should run.
|
||||
*/
|
||||
schedule(time: string | Date): Job;
|
||||
|
||||
/**
|
||||
* Specifies the priority weighting of the job.
|
||||
* @param value The priority of the job (lowest|low|normal|high|highest|number).
|
||||
*/
|
||||
priority(value: string | number): Job;
|
||||
|
||||
/**
|
||||
* Sets job.attrs.failedAt to now, and sets job.attrs.failReason to reason.
|
||||
* @param reason A message or Error object that indicates why the job failed.
|
||||
*/
|
||||
fail(reason: string | Error): Job;
|
||||
|
||||
/**
|
||||
* Runs the given job and calls callback(err, job) upon completion. Normally you never need to call this manually
|
||||
* @param cb Called when the job is completed.
|
||||
*/
|
||||
run(cb?: ResultCallback<Job>): Job;
|
||||
|
||||
/**
|
||||
* Returns true if the job is running; otherwise, returns false.
|
||||
*/
|
||||
isRunning(): boolean;
|
||||
|
||||
/**
|
||||
* Saves the job into the database.
|
||||
* @param cb Called when the job is saved.
|
||||
*/
|
||||
save(cb?: ResultCallback<Job>): Job;
|
||||
|
||||
/**
|
||||
* Removes the job from the database and cancels the job.
|
||||
* @param cb Called after the job has beeb removed from the database.
|
||||
*/
|
||||
remove(cb?: Callback): void;
|
||||
|
||||
/**
|
||||
* Resets the lock on the job. Useful to indicate that the job hasn't timed out when you have very long running
|
||||
* jobs.
|
||||
* @param cb Called after the job has been saved to the database.
|
||||
*/
|
||||
touch(cb?: Callback): void;
|
||||
}
|
||||
|
||||
interface JobOptions {
|
||||
|
||||
/**
|
||||
* Maximum number of that job that can be running at once (per instance of agenda)
|
||||
*/
|
||||
concurrency?: number;
|
||||
|
||||
/**
|
||||
* Maximum number of that job that can be locked at once (per instance of agenda)
|
||||
*/
|
||||
lockLimit?: number;
|
||||
|
||||
/**
|
||||
* Interval in ms of how long the job stays locked for (see multiple job processors for more info). A job will
|
||||
* automatically unlock if done() is called.
|
||||
*/
|
||||
lockLifetime?: number;
|
||||
|
||||
/**
|
||||
* (lowest|low|normal|high|highest|number) specifies the priority of the job. Higher priority jobs will run
|
||||
* first.
|
||||
*/
|
||||
priority?: string | number;
|
||||
}
|
||||
|
||||
declare class Agenda extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Constructs a new Agenda object.
|
||||
* @param config Optional configuration to initialize the Agenda.
|
||||
* @param cb Optional callback called with the MongoDB colleciton.
|
||||
*/
|
||||
constructor(config?: AgendaConfiguration, cb?: ResultCallback<Collection>);
|
||||
constructor(config?: Agenda.AgendaConfiguration, cb?: ResultCallback<Collection>);
|
||||
|
||||
/**
|
||||
* Connect to the specified MongoDB server and database.
|
||||
@@ -357,14 +88,14 @@ declare class Agenda extends EventEmitter {
|
||||
* @param name The name of the job.
|
||||
* @param data Data to associated with the job.
|
||||
*/
|
||||
create(name: string, data?: any): Job;
|
||||
create(name: string, data?: any): Agenda.Job;
|
||||
|
||||
/**
|
||||
* Find all Jobs matching `query` and pass same back in cb().
|
||||
* @param query
|
||||
* @param cb
|
||||
*/
|
||||
jobs(query: any, cb: ResultCallback<Job[]>): void;
|
||||
jobs(query: any, cb: ResultCallback<Agenda.Job[]>): void;
|
||||
|
||||
/**
|
||||
* Removes all jobs in the database without defined behaviors. Useful if you change a definition name and want
|
||||
@@ -381,8 +112,8 @@ declare class Agenda extends EventEmitter {
|
||||
* @param options The options for the job.
|
||||
* @param handler The handler to execute.
|
||||
*/
|
||||
define(name: string, handler: (job?: Job, done?: (err?: Error) => void) => void): void;
|
||||
define(name: string, options: JobOptions, handler: (job?: Job, done?: (err?: Error) => void) => void): void;
|
||||
define(name: string, handler: (job?: Agenda.Job, done?: (err?: Error) => void) => void): void;
|
||||
define(name: string, options: Agenda.JobOptions, handler: (job?: Agenda.Job, done?: (err?: Error) => void) => void): void;
|
||||
|
||||
/**
|
||||
* Runs job name at the given interval. Optionally, data and options can be passed in.
|
||||
@@ -392,8 +123,8 @@ declare class Agenda extends EventEmitter {
|
||||
* @param options An optional argument that will be passed to job.repeatEvery.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
every(interval: number | string, names: string, data?: any, options?: any, cb?: ResultCallback<Job>): Job;
|
||||
every(interval: number | string, names: string[], data?: any, options?: any, cb?: ResultCallback<Job[]>): Job[];
|
||||
every(interval: number | string, names: string, data?: any, options?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
|
||||
every(interval: number | string, names: string[], data?: any, options?: any, cb?: ResultCallback<Agenda.Job[]>): Agenda.Job[];
|
||||
|
||||
/**
|
||||
* Schedules a job to run name once at a given time.
|
||||
@@ -402,8 +133,8 @@ declare class Agenda extends EventEmitter {
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
schedule(when: Date | string, names: string, data?: any, cb?: ResultCallback<Job>): Job;
|
||||
schedule(when: Date | string, names: string[], data?: any, cb?: ResultCallback<Job[]>): Job[];
|
||||
schedule(when: Date | string, names: string, data?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
|
||||
schedule(when: Date | string, names: string[], data?: any, cb?: ResultCallback<Agenda.Job[]>): Agenda.Job[];
|
||||
|
||||
/**
|
||||
* Schedules a job to run name once immediately.
|
||||
@@ -411,7 +142,7 @@ declare class Agenda extends EventEmitter {
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
now(name: string, data?: any, cb?: ResultCallback<Job>): Job;
|
||||
now(name: string, data?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
|
||||
|
||||
/**
|
||||
* Cancels any jobs matching the passed mongodb-native query, and removes them from the database.
|
||||
@@ -434,6 +165,284 @@ declare class Agenda extends EventEmitter {
|
||||
|
||||
declare namespace Agenda {
|
||||
|
||||
}
|
||||
/**
|
||||
* Agenda Configuration.
|
||||
*/
|
||||
interface AgendaConfiguration {
|
||||
|
||||
export = Agenda;
|
||||
/**
|
||||
* Sets the interval with which the queue is checked. A number in milliseconds or a frequency string.
|
||||
*/
|
||||
processEvery?: string | number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be running at any given moment.
|
||||
* By default it is 5.
|
||||
*/
|
||||
defaultConcurrency?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the max number of jobs that can be running at any given moment. By default it
|
||||
* is 20.
|
||||
*/
|
||||
maxConcurrency?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be locked at any given moment.
|
||||
* By default it is 0 for no max.
|
||||
*/
|
||||
defaultLockLimit?: number;
|
||||
|
||||
/**
|
||||
* Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* 0 for no max.
|
||||
*/
|
||||
lockLimit?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default lock lifetime in milliseconds. By default it is 10 minutes. This
|
||||
* can be overridden by specifying the lockLifetime option to a defined job.
|
||||
*/
|
||||
defaultLockLifetime?: number;
|
||||
|
||||
/**
|
||||
* Specifies that Agenda should be initialized using and existing MongoDB connection.
|
||||
*/
|
||||
mongo?: {
|
||||
/**
|
||||
* The MongoDB database connection to use.
|
||||
*/
|
||||
db: Db;
|
||||
|
||||
/**
|
||||
* The name of the collection to use.
|
||||
*/
|
||||
collection?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies that Agenda should connect to MongoDB.
|
||||
*/
|
||||
db?: {
|
||||
/**
|
||||
* The connection URL.
|
||||
*/
|
||||
address: string;
|
||||
|
||||
/**
|
||||
* The name of the collection to use.
|
||||
*/
|
||||
collection?: string;
|
||||
|
||||
/**
|
||||
* Connection options to pass to MongoDB.
|
||||
*/
|
||||
options?: any;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The database record associated with a job.
|
||||
*/
|
||||
interface JobAttributes {
|
||||
/**
|
||||
* The record identity.
|
||||
*/
|
||||
_id: ObjectID;
|
||||
|
||||
/**
|
||||
* The name of the job.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The type of the job (single|normal).
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* The job details.
|
||||
*/
|
||||
data: { [name: string]: any };
|
||||
|
||||
/**
|
||||
* The priority of the job.
|
||||
*/
|
||||
priority: number;
|
||||
|
||||
/**
|
||||
* How often the job is repeated using a human-readable or cron format.
|
||||
*/
|
||||
repeatInterval: string | number;
|
||||
|
||||
/**
|
||||
* The timezone that conforms to [moment-timezone](http://momentjs.com/timezone/).
|
||||
*/
|
||||
repeatTimezone: string;
|
||||
|
||||
/**
|
||||
* Date/time the job was las modified.
|
||||
*/
|
||||
lastModifiedBy: string;
|
||||
|
||||
/**
|
||||
* Date/time the job will run next.
|
||||
*/
|
||||
nextRunAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job was locked.
|
||||
*/
|
||||
lockedAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job was last run.
|
||||
*/
|
||||
lastRunAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job last finished running.
|
||||
*/
|
||||
lastFinishedAt: Date;
|
||||
|
||||
/**
|
||||
* The reason the job failed.
|
||||
*/
|
||||
failReason: string;
|
||||
|
||||
/**
|
||||
* The number of times the job has failed.
|
||||
*/
|
||||
failCount: number;
|
||||
|
||||
/**
|
||||
* The date/time the job last failed.
|
||||
*/
|
||||
failedAt: Date;
|
||||
|
||||
/**
|
||||
* Job's state
|
||||
*/
|
||||
disabled: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* A scheduled job.
|
||||
*/
|
||||
interface Job {
|
||||
|
||||
/**
|
||||
* The database record associated with the job.
|
||||
*/
|
||||
attrs: JobAttributes;
|
||||
|
||||
/**
|
||||
* Specifies an interval on which the job should repeat.
|
||||
* @param interval A human-readable format String, a cron format String, or a Number.
|
||||
* @param options An optional argument that can include a timezone field. The timezone should be a string as
|
||||
* accepted by moment-timezone and is considered when using an interval in the cron string format.
|
||||
*/
|
||||
repeatEvery(interval: string | number, options?: { timezone?: string }): Job
|
||||
|
||||
/**
|
||||
* Specifies a time when the job should repeat. [Possible values](https://github.com/matthewmueller/date#examples).
|
||||
* @param time
|
||||
*/
|
||||
repeatAt(time: string): Job
|
||||
|
||||
/**
|
||||
* Disables the job.
|
||||
*/
|
||||
disable(): Job;
|
||||
|
||||
/**
|
||||
* Enables the job.
|
||||
*/
|
||||
enable(): Job;
|
||||
|
||||
/**
|
||||
* Ensure that only one instance of this job exists with the specified properties
|
||||
* @param value The properties associated with the job that must be unqiue.
|
||||
* @param opts
|
||||
*/
|
||||
unique(value: any, opts?: { insertOnly?: boolean }): Job;
|
||||
|
||||
/**
|
||||
* Specifies the next time at which the job should run.
|
||||
* @param time The next time at which the job should run.
|
||||
*/
|
||||
schedule(time: string | Date): Job;
|
||||
|
||||
/**
|
||||
* Specifies the priority weighting of the job.
|
||||
* @param value The priority of the job (lowest|low|normal|high|highest|number).
|
||||
*/
|
||||
priority(value: string | number): Job;
|
||||
|
||||
/**
|
||||
* Sets job.attrs.failedAt to now, and sets job.attrs.failReason to reason.
|
||||
* @param reason A message or Error object that indicates why the job failed.
|
||||
*/
|
||||
fail(reason: string | Error): Job;
|
||||
|
||||
/**
|
||||
* Runs the given job and calls callback(err, job) upon completion. Normally you never need to call this manually
|
||||
* @param cb Called when the job is completed.
|
||||
*/
|
||||
run(cb?: ResultCallback<Job>): Job;
|
||||
|
||||
/**
|
||||
* Returns true if the job is running; otherwise, returns false.
|
||||
*/
|
||||
isRunning(): boolean;
|
||||
|
||||
/**
|
||||
* Saves the job into the database.
|
||||
* @param cb Called when the job is saved.
|
||||
*/
|
||||
save(cb?: ResultCallback<Job>): Job;
|
||||
|
||||
/**
|
||||
* Removes the job from the database and cancels the job.
|
||||
* @param cb Called after the job has beeb removed from the database.
|
||||
*/
|
||||
remove(cb?: Callback): void;
|
||||
|
||||
/**
|
||||
* Resets the lock on the job. Useful to indicate that the job hasn't timed out when you have very long running
|
||||
* jobs.
|
||||
* @param cb Called after the job has been saved to the database.
|
||||
*/
|
||||
touch(cb?: Callback): void;
|
||||
|
||||
/**
|
||||
* Calculates next time the job should run
|
||||
*/
|
||||
computeNextRunAt(): Job;
|
||||
}
|
||||
|
||||
interface JobOptions {
|
||||
|
||||
/**
|
||||
* Maximum number of that job that can be running at once (per instance of agenda)
|
||||
*/
|
||||
concurrency?: number;
|
||||
|
||||
/**
|
||||
* Maximum number of that job that can be locked at once (per instance of agenda)
|
||||
*/
|
||||
lockLimit?: number;
|
||||
|
||||
/**
|
||||
* Interval in ms of how long the job stays locked for (see multiple job processors for more info). A job will
|
||||
* automatically unlock if done() is called.
|
||||
*/
|
||||
lockLifetime?: number;
|
||||
|
||||
/**
|
||||
* (lowest|low|normal|high|highest|number) specifies the priority of the job. Higher priority jobs will run
|
||||
* first.
|
||||
*/
|
||||
priority?: string | number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/// <reference types="ajv" />
|
||||
|
||||
import * as Ajv from 'ajv';
|
||||
var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true}
|
||||
var validate = ajv.compile({});
|
||||
var valid = validate({});
|
||||
if (!valid) console.log(validate.errors);
|
||||
|
||||
var valid = ajv.validate({}, {});
|
||||
if (!valid) console.log(ajv.errors);
|
||||
|
||||
ajv.addSchema({}, 'mySchema');
|
||||
var valid = ajv.validate('mySchema', {});
|
||||
if (!valid) console.log(ajv.errorsText());
|
||||
|
||||
ajv.addKeyword('range', {
|
||||
type: 'number', compile: function (sch, parentSchema) {
|
||||
var min: any = sch[0];
|
||||
var max: any = sch[1];
|
||||
|
||||
return parentSchema.exclusiveRange === true
|
||||
? function (data) { return data > min && data < max; }
|
||||
: function (data) { return data >= min && data <= max; }
|
||||
}
|
||||
});
|
||||
|
||||
var schema = { "range": [2, 4], "exclusiveRange": true };
|
||||
var validate = ajv.compile(schema);
|
||||
console.log(validate(2.01)); // true
|
||||
console.log(validate(3.99)); // true
|
||||
console.log(validate(2)); // false
|
||||
console.log(validate(4)); // false
|
||||
|
||||
declare var request: any;
|
||||
function loadSchema(uri: any, callback: any) {
|
||||
request.json(uri, function (err: any, res: any, body: any) {
|
||||
if (err || res.statusCode >= 400)
|
||||
callback(err || new Error('Loading error: ' + res.statusCode));
|
||||
else
|
||||
callback(null, body);
|
||||
});
|
||||
}
|
||||
var ajv = new Ajv({ loadSchema: loadSchema });
|
||||
|
||||
ajv.compileAsync(schema, function (err, validate) {
|
||||
if (err) return;
|
||||
var valid = validate({});
|
||||
});
|
||||
|
||||
declare var knex: any;
|
||||
function checkIdExists(schema: any, data: any) {
|
||||
return knex(schema.table)
|
||||
.select('id')
|
||||
.where('id', data)
|
||||
.then(function (rows: any) {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
var validate = ajv.compile(schema);
|
||||
|
||||
(validate({ userId: 1, postId: 19 }) as PromiseLike<boolean>)
|
||||
.then(function (valid) {
|
||||
// "valid" is always true here
|
||||
console.log('Data is valid');
|
||||
}, function (err) {
|
||||
if (!(err instanceof Ajv.ValidationError)) throw err;
|
||||
// data is invalid
|
||||
console.log('Validation errors:', err.errors);
|
||||
});
|
||||
|
||||
var ajv = new Ajv({ /* async: 'es7', */ transpile: 'nodent' });
|
||||
var validate = ajv.compile(schema); // transpiled es7 async function
|
||||
(validate({}) as PromiseLike<any>).then(() => { }, () => { });
|
||||
Vendored
+112
@@ -0,0 +1,112 @@
|
||||
// Type definitions for ajv
|
||||
// Project: https://github.com/epoberezkin/ajv
|
||||
// Definitions by: York Yao <https://github.com/plantain-00/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Ajv {
|
||||
/**
|
||||
* Create Ajv instance.
|
||||
*/
|
||||
constructor(options?: Ajv.AjvOptions);
|
||||
/**
|
||||
* Generate validating function and cache the compiled schema for future use.
|
||||
*/
|
||||
compile(schema: any): Ajv.AjvValidate;
|
||||
/**
|
||||
* Asyncronous version of compile method that loads missing remote schemas using asynchronous function in options.loadSchema.
|
||||
*/
|
||||
compileAsync(schema: any, callback: (error: Error, validate: Ajv.AjvValidate) => void): void;
|
||||
/**
|
||||
* Validate data using passed schema (it will be compiled and cached).
|
||||
*/
|
||||
validate(schema: any, data: any): boolean | PromiseLike<boolean>;
|
||||
errors: Ajv.ValidationError[];
|
||||
/**
|
||||
* Add schema(s) to validator instance.
|
||||
*/
|
||||
addSchema(schema: any, key: string): void;
|
||||
/**
|
||||
* Adds meta schema(s) that can be used to validate other schemas.
|
||||
* That function should be used instead of addSchema because there may be instance options that would compile a meta schema incorrectly (at the moment it is removeAdditional option).
|
||||
*/
|
||||
addMetaSchema(schema: any, key: string): void;
|
||||
/**
|
||||
* Validates schema.
|
||||
* This method should be used to validate schemas rather than validate due to the inconsistency of uri format in JSON-Schema standard.
|
||||
*/
|
||||
validateSchema(schema: any): Boolean;
|
||||
/**
|
||||
* Retrieve compiled schema previously added with addSchema by the key passed to addSchema or by its full reference (id).
|
||||
* Returned validating function has schema property with the reference to the original schema.
|
||||
*/
|
||||
getSchema(key: string): Ajv.AjvValidate;
|
||||
/**
|
||||
* Remove added/cached schema.
|
||||
* Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references.
|
||||
*/
|
||||
removeSchema(schema: any): void;
|
||||
/**
|
||||
* Add custom format to validate strings. It can also be used to replace pre-defined formats for Ajv instance.
|
||||
*/
|
||||
addFormat(name: string, format: any): void;
|
||||
/**
|
||||
* Add custom validation keyword to Ajv instance.
|
||||
*/
|
||||
addKeyword(keyword: string, definition: Ajv.AjxKeywordDefinition): void;
|
||||
errorsText(): any;
|
||||
static ValidationError: Function;
|
||||
}
|
||||
declare namespace Ajv {
|
||||
type AjvOptions = {
|
||||
v5?: boolean;
|
||||
allErrors?: boolean;
|
||||
verbose?: boolean;
|
||||
jsonPointers?: boolean;
|
||||
uniqueItems?: boolean;
|
||||
unicode?: boolean;
|
||||
format?: string;
|
||||
formats?: any;
|
||||
schemas?: any;
|
||||
missingRefs?: boolean;
|
||||
loadSchema?(uri: string, callback: (error: Error, body: any) => void): void;
|
||||
removeAdditional?: boolean;
|
||||
useDefaults?: boolean;
|
||||
coerceTypes?: boolean;
|
||||
async?: any;
|
||||
transpile?: string;
|
||||
meta?: boolean;
|
||||
validateSchema?: boolean;
|
||||
addUsedSchema?: boolean;
|
||||
inlineRefs?: boolean;
|
||||
passContext?: boolean;
|
||||
loopRequired?: number;
|
||||
ownProperties?: boolean;
|
||||
multipleOfPrecision?: boolean;
|
||||
errorDataPath?: string,
|
||||
messages?: boolean;
|
||||
beautify?: boolean;
|
||||
cache?: any;
|
||||
}
|
||||
type AjvValidate = ((data: any) => boolean | PromiseLike<boolean>) & {
|
||||
errors: ValidationError[];
|
||||
}
|
||||
type AjxKeywordDefinition = {
|
||||
async?: boolean;
|
||||
type: string;
|
||||
compile?: (schema: any, parentsSchema: any) => ((data: any) => boolean | PromiseLike<boolean>);
|
||||
validate?: (schema: any, data: any) => boolean;
|
||||
}
|
||||
type ValidationError = {
|
||||
keyword: string;
|
||||
dataPath: string;
|
||||
schemaPath: string;
|
||||
params: any;
|
||||
message: string;
|
||||
schema: any;
|
||||
parentSchema: any;
|
||||
data: any;
|
||||
}
|
||||
}
|
||||
|
||||
export = Ajv;
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"drop-tests.ts"
|
||||
"ajv-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/// <reference types="node"/>
|
||||
|
||||
import * as Alexa from "alexa-sdk";
|
||||
|
||||
exports.handler = function(event: Alexa.RequestBody, context: Alexa.Context, callback: Function) {
|
||||
let alexa = Alexa.handler(event, context);
|
||||
alexa.registerHandlers(handlers);
|
||||
alexa.execute();
|
||||
};
|
||||
|
||||
let handlers: Alexa.Handlers = {
|
||||
'LaunchRequest': function () {
|
||||
var self: Alexa.Handler = this;
|
||||
self.emit('SayHello');
|
||||
},
|
||||
'HelloWorldIntent': function () {
|
||||
var self: Alexa.Handler = this;
|
||||
self.emit('SayHello');
|
||||
},
|
||||
'SayHello': function () {
|
||||
var self: Alexa.Handler = this;
|
||||
self.emit(':tell', 'Hello World!');
|
||||
}
|
||||
};
|
||||
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
// Type definitions for Alexa SDK for Node.js v1.0.3
|
||||
// Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs
|
||||
// Definitions by: Pete Beegle <https://github.com/petebeegle>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject;
|
||||
export function CreateStateHandler(state: string, obj: any): any;
|
||||
export var StateString: string;
|
||||
|
||||
interface AlexaObject {
|
||||
_event: any;
|
||||
_context: any;
|
||||
_callback: any;
|
||||
state: any;
|
||||
appId: any;
|
||||
response: any;
|
||||
dynamoDBTableName: any;
|
||||
saveBeforeResponse: boolean;
|
||||
registerHandlers: (...handlers: Handlers[]) => any;
|
||||
execute: () => void;
|
||||
}
|
||||
|
||||
interface Handlers {
|
||||
[intent: string]: () => void;
|
||||
}
|
||||
|
||||
interface Handler {
|
||||
on: any;
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
emitWithState: any;
|
||||
state: any;
|
||||
handler: any;
|
||||
event: RequestBody;
|
||||
attributes: any;
|
||||
context: any;
|
||||
name: any;
|
||||
isOverriden: any;
|
||||
}
|
||||
|
||||
interface Context {
|
||||
callbackWaitsForEmptyEventLoop: boolean;
|
||||
logGroupName: string;
|
||||
logStreamName: string;
|
||||
functionName: string;
|
||||
memoryLimitInMB: string;
|
||||
functionVersion: string;
|
||||
invokeid: string;
|
||||
awsRequestId: string;
|
||||
}
|
||||
|
||||
interface RequestBody {
|
||||
version: string;
|
||||
session: Session;
|
||||
request: LaunchRequest | IntentRequest | SessionEndedRequest;
|
||||
}
|
||||
|
||||
interface Session {
|
||||
new: boolean;
|
||||
sessionId: string;
|
||||
attributes: any;
|
||||
application: SessionApplication;
|
||||
user: SessionUser;
|
||||
}
|
||||
|
||||
interface SessionApplication {
|
||||
applicationId: string;
|
||||
}
|
||||
|
||||
interface SessionUser {
|
||||
userId: string;
|
||||
accessToken: string;
|
||||
}
|
||||
|
||||
interface LaunchRequest extends IRequest { }
|
||||
|
||||
interface IntentRequest extends IRequest {
|
||||
intent: Intent;
|
||||
}
|
||||
|
||||
interface Intent {
|
||||
name: string;
|
||||
slots: any;
|
||||
}
|
||||
|
||||
interface SessionEndedRequest extends IRequest {
|
||||
reason: string;
|
||||
}
|
||||
|
||||
interface IRequest {
|
||||
type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest";
|
||||
requestId: string;
|
||||
timeStamp: string;
|
||||
}
|
||||
|
||||
interface ResponseBody {
|
||||
version: string;
|
||||
sessionAttributes?: any;
|
||||
response: Response;
|
||||
}
|
||||
|
||||
interface Response {
|
||||
outputSpeech?: OutputSpeech;
|
||||
card?: Card;
|
||||
reprompt?: Reprompt;
|
||||
shouldEndSession: boolean;
|
||||
}
|
||||
|
||||
interface OutputSpeech {
|
||||
type: "PlainText" | "SSML";
|
||||
text?: string;
|
||||
ssml?: string;
|
||||
}
|
||||
|
||||
interface Card {
|
||||
type: "Simple" | "Standard" | "LinkAccount";
|
||||
title?: string;
|
||||
content?: string;
|
||||
text?: string;
|
||||
image?: Image;
|
||||
}
|
||||
|
||||
interface Image {
|
||||
smallImageUrl: string;
|
||||
largeImageUrl: string;
|
||||
}
|
||||
|
||||
interface Reprompt {
|
||||
outputSpeech: OutputSpeech;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"DataStream.js-tests.ts"
|
||||
"alexa-sdk-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
|
||||
import algoliasearch = require('algoliasearch');
|
||||
|
||||
var _clientOptions: ClientOptions = {
|
||||
timeout : 12,
|
||||
protocol: "",
|
||||
httpAgent: ""
|
||||
};
|
||||
|
||||
var _synonymOption: SynonymOption = {
|
||||
forwardToSlaves: false,
|
||||
replaceExistingSynonyms: false
|
||||
};
|
||||
|
||||
var _algoliaUserKeyOptions : AlgoliaUserKeyOptions = {
|
||||
validity: 0,
|
||||
maxQueriesPerIPPerHour: 0,
|
||||
indexes: [""],
|
||||
queryParameters: { attributesToRetrieve: ["algolia"] },
|
||||
description: ""
|
||||
};
|
||||
|
||||
var _searchSynonymOptions : SearchSynonymOptions = {
|
||||
query: "",
|
||||
page: 0,
|
||||
type: "",
|
||||
hitsPerPage: 0
|
||||
};
|
||||
|
||||
var _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = {
|
||||
filters: "",
|
||||
validUntil: 0,
|
||||
restrictIndices: "",
|
||||
userToken: ""
|
||||
};
|
||||
|
||||
var _algoliaIndexSettings : AlgoliaIndexSettings = {
|
||||
attributesToIndex: [""],
|
||||
attributesforFaceting: [""],
|
||||
unretrievableAttributes: [""],
|
||||
attributesToRetrieve: [""],
|
||||
ranking: [""],
|
||||
customRanking: [""],
|
||||
slaves: [""],
|
||||
maxValuesPerFacet: '',
|
||||
attributesToHighlight: [""],
|
||||
attributesToSnippet: [""],
|
||||
highlightPreTag: '',
|
||||
highlightPostTag: '',
|
||||
snippetEllipsisText: '',
|
||||
restrictHighlightAndSnippetArrays: false,
|
||||
hitsPerPage: 0,
|
||||
minWordSizefor1Typo: 0,
|
||||
minWordSizefor2Typos: 0,
|
||||
typoTolerance: false,
|
||||
allowTyposOnNumericTokens: false,
|
||||
ignorePlurals: false,
|
||||
disableTypoToleranceOnAttributes: '',
|
||||
separatorsToIndex: '',
|
||||
queryType: '',
|
||||
removeWordsIfNoResults: '',
|
||||
advancedSyntax: false,
|
||||
optionalWords: [""],
|
||||
removeStopWords: [""],
|
||||
disablePrefixOnAttributes: [""],
|
||||
disableExactOnAttributes: [""],
|
||||
exactOnSingleWordQuery: '',
|
||||
alternativesAsExact: false,
|
||||
attributeForDistinct: "",
|
||||
distinct: false,
|
||||
numericAttributesToIndex: [""],
|
||||
allowCompressionOfIntegerArray: false,
|
||||
altCorrections: [{}],
|
||||
minProximity: 0,
|
||||
placeholders: ''
|
||||
};
|
||||
|
||||
var _algoliaQueryParameters : AlgoliaQueryParameters = {
|
||||
query: '',
|
||||
filters: '',
|
||||
attributesToRetrieve: [""],
|
||||
restrictSearchableAttributes: [""],
|
||||
facets: '',
|
||||
maxValuesPerFacet: '',
|
||||
attributesToHighlight: [''],
|
||||
attributesToSnippet: [''],
|
||||
highlightPreTag: '',
|
||||
highlightPostTag: '',
|
||||
snippetEllipsisText: '',
|
||||
restrictHighlightAndSnippetArrays: false,
|
||||
hitsPerPage: 0,
|
||||
page: 0,
|
||||
offset: 0,
|
||||
length: 0,
|
||||
minWordSizefor1Typo: 0,
|
||||
minWordSizefor2Typos: 0,
|
||||
typoTolerance: false,
|
||||
allowTyposOnNumericTokens: false,
|
||||
ignorePlurals: false,
|
||||
disableTypoToleranceOnAttributes: '',
|
||||
aroundLatLng: '',
|
||||
aroundLatLngViaIP: '',
|
||||
aroundRadius: '',
|
||||
aroundPrecision: 0,
|
||||
minimumAroundRadius: 0,
|
||||
insideBoundingBox: '',
|
||||
queryType: '',
|
||||
insidePolygon: '',
|
||||
removeWordsIfNoResults: '',
|
||||
advancedSyntax: false,
|
||||
optionalWords: [''],
|
||||
removeStopWords: [''],
|
||||
disableExactOnAttributes: [''],
|
||||
exactOnSingleWordQuery: '',
|
||||
alternativesAsExact: true,
|
||||
distinct: 0,
|
||||
getRankingInfo: false,
|
||||
numericAttributesToIndex: [''],
|
||||
numericFilters: [''],
|
||||
tagFilters: '',
|
||||
facetFilters: '',
|
||||
analytics: false,
|
||||
analyticsTags: [''],
|
||||
synonyms: true,
|
||||
replaceSynonymsInHighlight: false,
|
||||
minProximity: 0
|
||||
};
|
||||
|
||||
var index: AlgoliaIndex = algoliasearch('', '').initIndex('');
|
||||
|
||||
var search = index.search({query: ""});
|
||||
index.search({query: ""}, function(err, res){});
|
||||
|
||||
|
||||
Vendored
+1571
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"algoliasearch-client-js-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+2
-2
@@ -53,8 +53,8 @@ declare namespace AltJS {
|
||||
export type Source = {[name:string]: () => SourceModel<any>};
|
||||
|
||||
export interface SourceModel<S> {
|
||||
local(state:any):any;
|
||||
remote(state:any):Promise<S>;
|
||||
local(state:any, ...args: any[]):any;
|
||||
remote(state:any, ...args: any[]):Promise<S>;
|
||||
shouldFetch?(fetchFn:(...args:Array<any>) => boolean):void;
|
||||
loading?:(args:any) => void;
|
||||
success?:(state:S) => void;
|
||||
|
||||
Vendored
+19
-3
@@ -27,6 +27,22 @@ declare namespace AmCharts {
|
||||
/** Clears all the charts on page, removes listeners and intervals. */
|
||||
function clear(): void;
|
||||
|
||||
/** Handle ready event */
|
||||
function ready(Function): void;
|
||||
|
||||
/** Create chart by params. */
|
||||
function makeChart(selector: string, params: any, delay?: number): AmChart;
|
||||
|
||||
/** Set a method to be called before initializing the chart.
|
||||
* When the method is called, the chart instance is passed as an attribute.
|
||||
* You can use this feature to preprocess chart data or do some other things you need
|
||||
* before initializing the chart.
|
||||
* @param {Function} handler - The method to be called.
|
||||
* @param {string[]} types - Which chart types should call this method. Defaults to all
|
||||
* if none is passed.
|
||||
*/
|
||||
function addInitHandler(handler: Function, types: string[]);
|
||||
|
||||
/** AmPieChart class creates pie/donut chart. In order to display pie chart you need to set at least three properties - dataProvider, titleField and valueField.
|
||||
@example
|
||||
var chartData = [{title:"Pie I have eaten",value:70},{title:"Pie I haven\'t eaten",value:30}];
|
||||
@@ -36,7 +52,7 @@ declare namespace AmCharts {
|
||||
chart.dataProvider = chartData;
|
||||
chart.write("chartdiv");
|
||||
*/
|
||||
class AmPieChart {
|
||||
class AmPieChart extends AmChart {
|
||||
/** Name of the field in chart's dataProvider which holds slice's alpha. */
|
||||
alphaField: string;
|
||||
/** Pie lean angle (for 3D effect). Valid range is 0 - 90. */
|
||||
@@ -198,7 +214,7 @@ declare namespace AmCharts {
|
||||
If the type is "rollOverSlice", dispatched when user rolls-over the slice.
|
||||
*/
|
||||
addListener(type: string, handler: (e: {/** Always "rollOverSlice". */
|
||||
type: string; dataItem: Slice;
|
||||
type: string; dataItem: Slice; chart: AmChart;
|
||||
}) => void): void;
|
||||
}
|
||||
|
||||
@@ -1016,7 +1032,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
bold - specifies if text is bold (true/false),
|
||||
url - url
|
||||
*/
|
||||
addLabel(x: number, y: number, text: string, align: string, size: number, color: string, rotation: number, alpha: number, bold: boolean, url: string): void;
|
||||
addLabel(x: number|string, y: number|string, text: string, align: string, size?: number, color?: string, rotation?: number, alpha?: number, bold?: boolean, url?: string);
|
||||
/** Adds a legend to the chart.
|
||||
By default, you don't need to create div for your legend, however if you want it to be positioned in some different way, you can create div anywhere you want and pass id or reference to your div as a second parameter.
|
||||
(NOTE: This method will not work on StockPanel.)
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// Tests for Amplitude SDK TypeScript definitions
|
||||
|
||||
module Amplitude.Tests {
|
||||
function all() {
|
||||
amplitude.init('YOUR_API_KEY_HERE', null, {
|
||||
// optional configuration options
|
||||
saveEvents: true,
|
||||
includeUtm: true,
|
||||
includeReferrer: true,
|
||||
batchEvents: true,
|
||||
eventUploadThreshold: 50
|
||||
});
|
||||
amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE', null, () => {});
|
||||
|
||||
amplitude.logEvent('EVENT_IDENTIFIER_HERE');
|
||||
amplitude.setUserId('USER_ID_HERE');
|
||||
amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE');
|
||||
amplitude.setUserId(null); // not string 'null'
|
||||
amplitude.setVersionName('VERSION_NAME_HERE');
|
||||
|
||||
amplitude.regenerateDeviceId();
|
||||
amplitude.setDeviceId('CUSTOM_DEVICE_ID');
|
||||
|
||||
amplitude.logEvent('EVENT_IDENTIFIER_HERE', {
|
||||
'color': 'blue',
|
||||
'age': 20,
|
||||
'key': 'value'
|
||||
});
|
||||
amplitude.logEvent("EVENT_IDENTIFIER_HERE", null, (httpCode, response) => { });
|
||||
|
||||
let identify = new amplitude.Identify().set('gender', 'female').set('age', 20);
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify().setOnce('sign_up_date', '08/24/2015');
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify().setOnce('sign_up_date', '09/14/2015');
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify().unset('gender').unset('age');
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify().add('karma', 1).add('friends', 1);
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify().append('ab-tests', 'new-user-test').append('some_list', [1, 2, 3, 4, 'values']);
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify().prepend('ab-tests', 'new-user-test').prepend('some_list', [1, 2, 3, 4, 'values']);
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify()
|
||||
.set('karma', 10)
|
||||
.add('karma', 1)
|
||||
.unset('karma');
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify()
|
||||
.set('colors', ['rose', 'gold'])
|
||||
.append('ab-tests', 'campaign_a')
|
||||
.append('existing_list', [4, 5]);
|
||||
amplitude.identify(identify);
|
||||
|
||||
amplitude.setUserProperties({
|
||||
gender: 'female',
|
||||
age: 20
|
||||
});
|
||||
|
||||
amplitude.clearUserProperties();
|
||||
|
||||
amplitude.setOptOut(true);
|
||||
amplitude.setOptOut(false);
|
||||
|
||||
amplitude.setGroup('orgId', '15');
|
||||
amplitude.setGroup('sport', ['soccer', 'tennis']);
|
||||
|
||||
// TODO: Implement those.
|
||||
/*
|
||||
var revenue = new amplitude.Revenue().setProductId('com.company.productId').setPrice(3.99).setQuantity(3);
|
||||
amplitude.logRevenueV2(revenue);
|
||||
|
||||
amplitude.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' });
|
||||
*/
|
||||
}
|
||||
}
|
||||
Vendored
+61
@@ -0,0 +1,61 @@
|
||||
// Type definitions for Amplitude SDK 2.12.1
|
||||
// Project: https://github.com/amplitude/Amplitude-Javascript
|
||||
// Definitions by: Arvydas Sidorenko <https://github.com/Asido>
|
||||
// Definitions: https://github.com/Asido/DefinitelyTyped
|
||||
|
||||
declare module amplitude {
|
||||
interface Config {
|
||||
batchEvents?: boolean;
|
||||
cookieExpiration?: number;
|
||||
cookieName?: string;
|
||||
deviceId?: string;
|
||||
domain?: string;
|
||||
eventUploadPeriodMillis?: number;
|
||||
eventUploadThreshold?: number;
|
||||
includeReferrer?: boolean;
|
||||
includeUtm?: boolean;
|
||||
language?: string;
|
||||
optOut?: boolean;
|
||||
platform?: string;
|
||||
saveEvents?: boolean;
|
||||
savedMaxCount?: number;
|
||||
sessionTimeout?: number;
|
||||
uploadBatchSize?: number;
|
||||
}
|
||||
|
||||
export class Identify {
|
||||
set(key: string, value: any): Identify;
|
||||
setOnce(key: string, value: any): Identify;
|
||||
add(key: string, value: number): Identify;
|
||||
append(key: string, value: any): Identify;
|
||||
prepend(key: string, value: any): Identify;
|
||||
|
||||
unset(key: string): Identify;
|
||||
}
|
||||
|
||||
export function init(apiKey: string): void;
|
||||
export function init(apiKey: string, userId: string): void;
|
||||
export function init(apiKey: string, userId: string, options: Config): void;
|
||||
export function init(apiKey: string, userId: string, options: Config, callback: () => void): void;
|
||||
|
||||
export function setVersionName(version: string): void;
|
||||
export function setUserId(userId: string): void;
|
||||
|
||||
export function setDeviceId(id: string): void;
|
||||
export function regenerateDeviceId(): void;
|
||||
|
||||
export function identify(identify: Identify): void;
|
||||
|
||||
export function setUserProperties(properties: Object): void;
|
||||
export function clearUserProperties(): void;
|
||||
|
||||
export function setOptOut(optOut: boolean): void;
|
||||
|
||||
export function setGroup(groupType: string, groupName: string | string[]): void;
|
||||
|
||||
export function logEvent(event: string): void;
|
||||
export function logEvent(event: string, data: Object): void;
|
||||
export function logEvent(event: string, data: Object, callback: (httpCode: number, response: any) => void): void;
|
||||
|
||||
export var options: Config;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"amplitude-js-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+40
-29
@@ -20,14 +20,14 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
interface IAnimateCallbackObject {
|
||||
eventFn?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
setClass?: (element: IAugmentedJQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
addClass?: (element: IAugmentedJQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
removeClass?: (element: IAugmentedJQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
enter?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
leave?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
move?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
animate?: (element: IAugmentedJQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
eventFn?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
setClass?: (element: JQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
addClass?: (element: JQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
removeClass?: (element: JQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
enter?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
leave?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
move?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
animate?: (element: JQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
}
|
||||
|
||||
interface IAnimationPromise extends IPromise<void> { }
|
||||
@@ -44,7 +44,7 @@ declare module 'angular' {
|
||||
* @param container the container element that will capture each of the animation events that are fired on itself as well as among its children
|
||||
* @param callback the callback function that will be fired when the listener is triggered
|
||||
*/
|
||||
on(event: string, container: JQuery, callback: Function): void;
|
||||
on(event: string, container: JQuery, callback: (element?: JQuery, phase?: string) => any): void;
|
||||
|
||||
/**
|
||||
* Deregisters an event listener based on the event which has been associated with the provided element.
|
||||
@@ -53,7 +53,7 @@ declare module 'angular' {
|
||||
* @param container the container element the event listener was placed on
|
||||
* @param callback the callback function that was registered as the listener
|
||||
*/
|
||||
off(event: string, container?: JQuery, callback?: Function): void;
|
||||
off(event: string, container?: JQuery, callback?: (element?: JQuery, phase?: string) => any): void;
|
||||
|
||||
/**
|
||||
* Associates the provided element with a host parent element to allow the element to be animated even if it exists outside of the DOM structure of the Angular application.
|
||||
@@ -71,7 +71,7 @@ declare module 'angular' {
|
||||
* @returns current animation state
|
||||
*/
|
||||
enabled(element: JQuery, value?: boolean): boolean;
|
||||
enabled(value: boolean): boolean;
|
||||
enabled(value?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Cancels the provided animation.
|
||||
@@ -184,16 +184,6 @@ declare module 'angular' {
|
||||
* see https://docs.angularjs.org/api/ngAnimate/#applying-directive-specific-styles-to-an-animation
|
||||
*/
|
||||
interface IAnimationOptions {
|
||||
/**
|
||||
* The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.
|
||||
*/
|
||||
to?: Object;
|
||||
|
||||
/**
|
||||
* The starting CSS styles (a key/value object) that will be applied at the start of the animation.
|
||||
*/
|
||||
from?: Object;
|
||||
|
||||
/**
|
||||
* The DOM event (e.g. enter, leave, move). When used, a generated CSS class of ng-EVENT and
|
||||
* ng-EVENT-active will be applied to the element during the animation. Multiple events can be provided when
|
||||
@@ -202,19 +192,35 @@ declare module 'angular' {
|
||||
event?: string;
|
||||
|
||||
/**
|
||||
* The CSS easing value that will be applied to the transition or keyframe animation (or both).
|
||||
*/
|
||||
* Indicates that the ng-prefix will be added to the event class. Setting to false or
|
||||
* omitting will turn ng-EVENT and ng-EVENT-active in EVENT and EVENT-active. Unused if event is omitted.
|
||||
*/
|
||||
structural?: boolean;
|
||||
|
||||
/**
|
||||
* The CSS easing value that will be applied to the transition or keyframe animation (or both).
|
||||
*/
|
||||
easing?: string;
|
||||
|
||||
/**
|
||||
* The raw CSS transition style that will be used (e.g. 1s linear all).
|
||||
*/
|
||||
transition?: string;
|
||||
transitionStyle?: string;
|
||||
|
||||
/**
|
||||
* The raw CSS keyframe animation style that will be used (e.g. 1s my_animation linear).
|
||||
*/
|
||||
keyframe?: string;
|
||||
keyframeStyle?: string;
|
||||
|
||||
/**
|
||||
* The starting CSS styles (a key/value object) that will be applied at the start of the animation.
|
||||
*/
|
||||
from?: Object;
|
||||
|
||||
/**
|
||||
* The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.
|
||||
*/
|
||||
to?: Object;
|
||||
|
||||
/**
|
||||
* A space separated list of CSS classes that will be added to the element and spread across the animation.
|
||||
@@ -251,11 +257,16 @@ declare module 'angular' {
|
||||
/**
|
||||
* The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item
|
||||
* in the stagger; therefore when a stagger option value of 0.1 is used then there will be a stagger delay of 600ms)
|
||||
* applyClassesEarly - Whether or not the classes being added or removed will be used when detecting the animation.
|
||||
* This is set by $animate when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time.
|
||||
* (Note that this will prevent any transitions from occuring on the classes being added and removed.)
|
||||
*
|
||||
*/
|
||||
staggerIndex?: number;
|
||||
|
||||
/**
|
||||
* Whether or not the provided from and to styles will be removed once the animation is closed. This is useful for
|
||||
* when the styles are used purely for the sake of the animation and do not have a lasting visual effect on the element
|
||||
* (e.g. a colapse and open animation). By default this value is set to false.
|
||||
*/
|
||||
cleanupStyles?: boolean;
|
||||
}
|
||||
|
||||
interface IAnimateCssRunner {
|
||||
@@ -295,4 +306,4 @@ declare module 'angular' {
|
||||
animation(name: string, inlineAnnotatedFunction: any[]): IModule;
|
||||
animation(object: Object): IModule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-2
@@ -3,8 +3,6 @@
|
||||
// Definitions by: Egor Komarov <https://github.com/Odrin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="moment" />
|
||||
|
||||
import * as moment from 'moment';
|
||||
import * as angular from 'angular';
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"moment": ">=2.14.0"
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -14,7 +14,7 @@ declare namespace angular.ui {
|
||||
/**
|
||||
* Override the parent state (only for the breadcrumb)
|
||||
**/
|
||||
parent?: string;
|
||||
parent?: string|Function;
|
||||
/**
|
||||
* When defined to true, the state is never included in the chain of states and never appears in the breadcrumb
|
||||
**/
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
deferredBootstrapper.bootstrap(
|
||||
{
|
||||
element: window.document,
|
||||
module: "myApp",
|
||||
resolve: {
|
||||
configuration: ["$http", ($http: ng.IHttpService) => $http.get("config.json")]
|
||||
}
|
||||
});
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// Type definitions for angular-deferred-bootstrap v0.1.9
|
||||
// Project: https://github.com/philippd/angular-deferred-bootstrap
|
||||
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="angular" />
|
||||
|
||||
declare var deferredBootstrapper: angular.IDeferredBootstrapperStatic;
|
||||
|
||||
declare module angular {
|
||||
interface IDeferredBootstrapperStatic {
|
||||
bootstrap(configParam: IConfigParam): ng.IPromise<boolean>
|
||||
}
|
||||
|
||||
interface IConfigParam {
|
||||
element?: Node,
|
||||
module?: string,
|
||||
resolve: any
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-deferred-bootstrap-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
}
|
||||
}
|
||||
Vendored
+13
-14
@@ -8,20 +8,19 @@
|
||||
import * as angular from 'angular';
|
||||
|
||||
declare module 'angular' {
|
||||
export namespace dynamicLocale {
|
||||
export namespace dynamicLocale {
|
||||
|
||||
interface tmhDynamicLocaleService {
|
||||
set(locale: string): void;
|
||||
get(): string;
|
||||
}
|
||||
interface tmhDynamicLocaleService {
|
||||
set(locale: string): void;
|
||||
get(): string;
|
||||
}
|
||||
|
||||
interface tmhDynamicLocaleProvider extends angular.IServiceProvider {
|
||||
localeLocationPattern(location: string): tmhDynamicLocaleProvider;
|
||||
localeLocationPattern(): string;
|
||||
useStorage(storageName: string): void;
|
||||
useCookieStorage(): void;
|
||||
}
|
||||
}
|
||||
interface tmhDynamicLocaleProvider extends angular.IServiceProvider {
|
||||
localeLocationPattern(location: string): tmhDynamicLocaleProvider;
|
||||
localeLocationPattern(): string;
|
||||
storageKey(storageKey: string): void;
|
||||
useStorage(storageName: string): void;
|
||||
useCookieStorage(): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+5
@@ -14,6 +14,11 @@ declare namespace angular.environment {
|
||||
* loads the correct environment variables.
|
||||
*/
|
||||
check: () => void;
|
||||
/**
|
||||
* Retrieves the correct version of a
|
||||
* variable for the current environment.
|
||||
*/
|
||||
read: (key: string) => any;
|
||||
}
|
||||
interface Service {
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
//
|
||||
// @Component
|
||||
//
|
||||
import { Component } from 'angular-es';
|
||||
@Component({
|
||||
selector: '',
|
||||
template: ''
|
||||
})
|
||||
class MyComponentController {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// @Config
|
||||
//
|
||||
import { Config } from 'angular-es';
|
||||
|
||||
@Config()
|
||||
class MyConfig {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// @Constant
|
||||
//
|
||||
import { Constant } from 'angular-es';
|
||||
|
||||
@Constant('MyConstant')
|
||||
class MyConstant {
|
||||
foo = 'foo';
|
||||
bar = 'bar';
|
||||
}
|
||||
|
||||
//
|
||||
// @Controller
|
||||
//
|
||||
import { Controller } from 'angular-es';
|
||||
|
||||
@Controller('MyController')
|
||||
class MyController {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// @Decorator
|
||||
//
|
||||
import { Decorator } from 'angular-es';
|
||||
|
||||
@Decorator('MyServiceDecorator')
|
||||
class MyServiceDecorator {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// @Directive
|
||||
//
|
||||
import { Directive } from 'angular-es';
|
||||
|
||||
@Directive('MyDirective')
|
||||
class MyDirective {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// @Factory
|
||||
//
|
||||
import { Factory } from 'angular-es';
|
||||
|
||||
@Factory('MyFactory')
|
||||
class MyFactory {
|
||||
}
|
||||
|
||||
//
|
||||
// @Filter
|
||||
//
|
||||
import { Filter } from 'angular-es';
|
||||
|
||||
@Filter('MyFilter')
|
||||
class MyFilter {
|
||||
}
|
||||
|
||||
//
|
||||
// @Inject
|
||||
//
|
||||
import { Inject } from 'angular-es';
|
||||
|
||||
@Inject('fooBar')
|
||||
class MyFooService {
|
||||
|
||||
@Inject('bazBar')
|
||||
myMethod(bazBar: Object) {
|
||||
}
|
||||
|
||||
constructor(fooBar: Object) {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// @InjectAsProperty
|
||||
//
|
||||
import { InjectAsProperty } from 'angular-es';
|
||||
|
||||
@InjectAsProperty('fooBar')
|
||||
class MyFooBarService {
|
||||
fooBar: Object;
|
||||
|
||||
myMethod() {
|
||||
this.fooBar !== undefined;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// @Module
|
||||
//
|
||||
import { Module } from 'angular-es';
|
||||
|
||||
@Module('my.module')
|
||||
@Service('MyModuleService')
|
||||
class MyModuleService {
|
||||
}
|
||||
|
||||
//
|
||||
// @Provider
|
||||
//
|
||||
import { Provider } from 'angular-es';
|
||||
|
||||
@Provider('MyProvider')
|
||||
class MyProvider {
|
||||
}
|
||||
|
||||
//
|
||||
// @Run
|
||||
//
|
||||
import { Run } from 'angular-es';
|
||||
|
||||
@Run()
|
||||
class MyRunBlock {
|
||||
}
|
||||
|
||||
//
|
||||
// @Service
|
||||
//
|
||||
import { Service } from 'angular-es';
|
||||
|
||||
@Service('MyService')
|
||||
class MyService {
|
||||
}
|
||||
//
|
||||
// @Value
|
||||
//
|
||||
import { Value } from 'angular-es';
|
||||
|
||||
@Value('MyValue')
|
||||
class MyValue {
|
||||
}
|
||||
Vendored
+187
@@ -0,0 +1,187 @@
|
||||
// Type definitions for angular-es v0.0.3
|
||||
// Project: https://github.com/mbutsykin/angular-es
|
||||
// Definitions by: mbutsykin <https://github.com/mbutsykin/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'angular-es' {
|
||||
|
||||
interface ClassDecorator {
|
||||
<TFunction extends Function>(target: TFunction): TFunction|void;
|
||||
}
|
||||
|
||||
interface MethodDecorator {
|
||||
<T>(target: Object, propertyKey: string|symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>|void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorated target
|
||||
*/
|
||||
interface ngESDecorator extends ClassDecorator, MethodDecorator {
|
||||
(target: Object|Function,
|
||||
ngName?: string,
|
||||
ngArguments?: Array<any>,
|
||||
ngType?: string,
|
||||
injectAsProperty?: Array<string>): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component interface
|
||||
* @see https://docs.angularjs.org/guide/component
|
||||
*/
|
||||
interface iComponent {
|
||||
template: string,
|
||||
selector: string,
|
||||
controllerAs?: string,
|
||||
require?: string,
|
||||
templateUrl?: string,
|
||||
transclude?: string,
|
||||
bindings?: Object
|
||||
}
|
||||
|
||||
/**
|
||||
* Register component
|
||||
*
|
||||
* @param {Object<iComponent>} component - component config
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Component(component: iComponent): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register config block
|
||||
*/
|
||||
function Config(): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register constant
|
||||
*
|
||||
* @param {string} name - constant name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Constant(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register controller
|
||||
*
|
||||
* @param {string} name - controller name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Controller(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register decorator
|
||||
*
|
||||
* @param {string} name - provider name to decorate
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Decorator(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register directive
|
||||
*
|
||||
* @param {string} name - directive selector, can be in hyphen-case
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Directive(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register factory
|
||||
*
|
||||
* @param {string} name - factory name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Factory(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register filter
|
||||
*
|
||||
* @param {string} name - filter name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Filter(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Add $inject property to target
|
||||
*
|
||||
* @param {Array<string>} dependencies - dependencies to inject
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Inject(...dependencies: Array<string>): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Inject dependencies as properties to target
|
||||
*
|
||||
* @param {Array<string>} dependencies - dependencies to inject
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function InjectAsProperty(...dependencies: Array<string>): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Attach target to the specified module
|
||||
*
|
||||
* @param {string} name - module name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Module(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register provider
|
||||
*
|
||||
* @param {string} name - provider name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Provider(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register run block
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Run(): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register service
|
||||
*
|
||||
* @param {string} name - service name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Service(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register value
|
||||
*
|
||||
* @param {string} name - value name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
function Value(name: string): ngESDecorator;
|
||||
|
||||
export {
|
||||
Component,
|
||||
Config,
|
||||
Constant,
|
||||
Controller,
|
||||
Decorator,
|
||||
Directive,
|
||||
Factory,
|
||||
Filter,
|
||||
Inject,
|
||||
InjectAsProperty,
|
||||
Module,
|
||||
Provider,
|
||||
Run,
|
||||
Service,
|
||||
Value,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"experimentalDecorators": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-es-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/// <reference types="angular" />
|
||||
|
||||
import * as angular from "angular";
|
||||
|
||||
let myApp = angular.module('myApp', ['feature-flags']);
|
||||
|
||||
const flagsData: Array<angular.featureflags.FlagData> = [
|
||||
{
|
||||
key: '1',
|
||||
active: true,
|
||||
name: 'flag1',
|
||||
description: 'This is the first flag'
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
active: false,
|
||||
name: 'flag2',
|
||||
description: 'This is the second flag'
|
||||
}
|
||||
];
|
||||
|
||||
myApp.config(function (featureFlagsProvider: angular.featureflags.FeatureFlagsProvider) {
|
||||
featureFlagsProvider.setInitialFlags(flagsData);
|
||||
});
|
||||
|
||||
myApp.run(function ($q: angular.IQService, $http: angular.IHttpService, featureFlags: angular.featureflags.FeatureFlagsService) {
|
||||
let deferred = $q.defer();
|
||||
deferred.resolve(flagsData);
|
||||
|
||||
featureFlags.set(deferred.promise);
|
||||
|
||||
featureFlags.set($http.get('/data/flags.json'));
|
||||
});
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// Type definitions for angular-feature-flags 1.4.0
|
||||
// Project: https://github.com/mjt01/angular-feature-flags
|
||||
// Definitions by: Borislav Zhivkov <https://github.com/borislavjivkov/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="angular" />
|
||||
|
||||
import * as angular from "angular";
|
||||
|
||||
declare module "angular" {
|
||||
namespace featureflags {
|
||||
export interface FlagData {
|
||||
/**
|
||||
* Unique key that is used from the markup to resolve whether a flag is active or not.
|
||||
*/
|
||||
key: string;
|
||||
|
||||
/**
|
||||
* Boolean value for enabling/disabling the feature
|
||||
*/
|
||||
active: boolean;
|
||||
|
||||
/**
|
||||
* A short name of the flag (only visible in the list of flags)
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* A long description of the flag to further explain the feature being toggled (only visible in the list of flags)
|
||||
*/
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface FeatureFlagsProvider {
|
||||
setInitialFlags(flags: Array<FlagData>): void;
|
||||
}
|
||||
|
||||
export interface FeatureFlagsService {
|
||||
set(flagsPromise: angular.IPromise<FlagData> | angular.IHttpPromise<FlagData>): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-feature-flags-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
-8
@@ -1,8 +0,0 @@
|
||||
// Type definitions for Angular File Upload 4.2.1
|
||||
// Project: https://github.com/danialfarid/ng-file-upload
|
||||
// Definitions by: John Reilly <https://github.com/johnnyreilly>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="ng-file-upload" />
|
||||
|
||||
// THIS FILE WILL REMOVE IF angular-file-upload.d.ts incoming.
|
||||
Vendored
+3
-3
@@ -51,12 +51,12 @@ declare namespace angular.gettext {
|
||||
/** Get the correct pluralized (but untranslated) string for the value of n. */
|
||||
getStringForm(string: string, n: number): string;
|
||||
|
||||
/** Translate a string with the given context. Uses Angular.JS interpolation, so something like this will do what you expect:
|
||||
/** Translate a string with the given scope. Uses Angular.JS interpolation, so something like this will do what you expect:
|
||||
* var hello = gettextCatalog.getString("Hello {{name}}!", { name: "Ruben" });
|
||||
* // var hello will be "Hallo Ruben!" in Dutch.
|
||||
* The context parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster.
|
||||
* The scope parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster.
|
||||
*/
|
||||
getString(string: string, context?: any): string;
|
||||
getString(string: string, scope?: any, context?: string): string;
|
||||
|
||||
/** Translate a plural string with the given context. */
|
||||
getPlural(n: number, string: string, stringPlural: string, context?: any): string;
|
||||
|
||||
@@ -14,3 +14,18 @@ var $jwtInterceptor: ng.jwt.IJwtInterceptor;
|
||||
$jwtInterceptor.tokenGetter = () => {
|
||||
return expToken;
|
||||
}
|
||||
|
||||
|
||||
var authManager: ng.jwt.IAuthManagerServiceProvider;
|
||||
|
||||
// Indicate the user is authenticated
|
||||
authManager.authenticate();
|
||||
|
||||
// Indicate the user is unauthenticated
|
||||
authManager.unauthenticate();
|
||||
|
||||
// Keep the user authenticated
|
||||
authManager.checkAuthOnRefresh();
|
||||
|
||||
// Redirect the user on unauthorized requests
|
||||
authManager.redirectWhenUnauthenticated();
|
||||
Vendored
+7
@@ -30,5 +30,12 @@ declare module 'angular' {
|
||||
interface IJwtInterceptor {
|
||||
tokenGetter(...params: any[]): string;
|
||||
}
|
||||
|
||||
interface IAuthManagerServiceProvider {
|
||||
authenticate(): void;
|
||||
unauthenticate(): void;
|
||||
checkAuthOnRefresh(): void;
|
||||
redirectWhenUnauthenticated(): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+13
-4
@@ -60,10 +60,19 @@ declare module 'angular' {
|
||||
*/
|
||||
set(key: string, val: string): boolean;
|
||||
/**
|
||||
* Directly get a value from a cookie.
|
||||
* Returns: value from local storage
|
||||
* @param key
|
||||
*/
|
||||
* Directly adds a value to cookies with an expiration.
|
||||
* Note: Typically used as a fallback if local storage is not supported.
|
||||
* Returns: Boolean
|
||||
* @param key
|
||||
* @param val
|
||||
* @param daysToExpiry
|
||||
*/
|
||||
set(key: string, val: string, daysToExpiry: number): boolean;
|
||||
/**
|
||||
* Directly get a value from a cookie.
|
||||
* Returns: value from local storage
|
||||
* @param key
|
||||
*/
|
||||
get(key: string): string;
|
||||
/**
|
||||
* Remove directly value from a cookie.
|
||||
|
||||
@@ -20,6 +20,13 @@ myApp.config((
|
||||
.warnPalette('red')
|
||||
.dark(true);
|
||||
|
||||
var browserColors: ng.material.IBrowserColors = {
|
||||
theme: 'default',
|
||||
palette: 'neonRed',
|
||||
hue: '500'
|
||||
};
|
||||
$mdThemingProvider.enableBrowserColor(browserColors);
|
||||
|
||||
$mdIconProvider
|
||||
.defaultIconSet('my/app/icons.svg') // Register a default set of SVG icons
|
||||
.iconSet('social', 'my/app/social.svg') // Register a named icon set of SVGs
|
||||
@@ -30,13 +37,36 @@ myApp.config((
|
||||
myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.IBottomSheetService) => {
|
||||
$scope['openBottomSheet'] = () => {
|
||||
$mdBottomSheet.show({
|
||||
template: '<md-bottom-sheet>Hello!</md-bottom-sheet>'
|
||||
template: '<md-bottom-sheet>Hello!</md-bottom-sheet>',
|
||||
clickOutsideToClose: true,
|
||||
disableBackdrop: true,
|
||||
disableParentScroll: false,
|
||||
parent: () => {}
|
||||
});
|
||||
};
|
||||
$scope['hideBottomSheet'] = $mdBottomSheet.hide.bind($mdBottomSheet, 'hide');
|
||||
$scope['cancelBottomSheet'] = $mdBottomSheet.cancel.bind($mdBottomSheet, 'cancel');
|
||||
});
|
||||
|
||||
myApp.controller('ColorController', ($scope: ng.IScope, $mdColor: ng.material.IColorService) => {
|
||||
var colorExpression : ng.material.IColorExpression;
|
||||
var element : Element;
|
||||
|
||||
colorExpression = { color: '#FFFFFF' }
|
||||
|
||||
element = new Element();
|
||||
|
||||
$scope['applyThemeColors'] = () => {
|
||||
$mdColor.applyThemeColors(element, colorExpression);
|
||||
};
|
||||
$scope['getThemeColor'] = () => {
|
||||
$mdColor.getThemeColor('default-neonRed')
|
||||
};
|
||||
$scope['hasTheme'] = () => {
|
||||
$mdColor.hasTheme();
|
||||
};
|
||||
});
|
||||
|
||||
myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.IDialogService) => {
|
||||
$scope['openDialog'] = () => {
|
||||
$mdDialog.show({
|
||||
@@ -55,6 +85,28 @@ myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.
|
||||
$scope['confirmDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.confirm().htmlContent('<span>Confirm!</span>'));
|
||||
};
|
||||
$scope['promptDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.prompt().textContent('Prompt!'));
|
||||
};
|
||||
$scope['promptDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.prompt().htmlContent('<span>Prompt!</span>'));
|
||||
};
|
||||
$scope['promptDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.prompt().cancel('Prompt "Cancel" button text'));
|
||||
};
|
||||
$scope['promptDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.prompt().placeholder('Prompt input placeholder text'));
|
||||
};
|
||||
$scope['promptDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.prompt().initialValue('Buddy'));
|
||||
};
|
||||
$scope['prerenderedDialog'] = () => {
|
||||
$mdDialog.show({
|
||||
template: '<md-dialog>Hello!</md-dialog>',
|
||||
contentElement: '#myDialog',
|
||||
clickOutsideToClose: true
|
||||
});
|
||||
};
|
||||
$scope['hideDialog'] = $mdDialog.hide.bind($mdDialog, 'hide');
|
||||
$scope['cancelDialog'] = $mdDialog.cancel.bind($mdDialog, 'cancel');
|
||||
});
|
||||
@@ -93,8 +145,82 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia
|
||||
$scope['close'] = () => $mdSidenav(componentId).close();
|
||||
$scope['isOpen'] = $mdSidenav(componentId).isOpen();
|
||||
$scope['isLockedOpen'] = $mdSidenav(componentId).isLockedOpen();
|
||||
|
||||
$scope['asyncLookup'] = $mdSidenav(componentId, true).then((instance) => {
|
||||
instance.toggle();
|
||||
instance.open();
|
||||
instance.close();
|
||||
instance.isOpen();
|
||||
instance.isLockedOpen();
|
||||
});
|
||||
|
||||
$scope['onClose'] = $mdSidenav(componentId).onClose(() => {});
|
||||
});
|
||||
|
||||
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => {
|
||||
$scope['openToast'] = () => $mdToast.show($mdToast.simple().textContent('Hello!'));
|
||||
$scope['openToast'] = () => {
|
||||
$mdToast.show($mdToast.simple().textContent('Hello!'));
|
||||
$mdToast.updateTextContent('New Content');
|
||||
}
|
||||
|
||||
$scope['customToast'] = () => {
|
||||
var options = {
|
||||
hideDelay: 3000,
|
||||
position: 'top right',
|
||||
controller : 'ToastCtrl',
|
||||
templateUrl : 'toast-template.html',
|
||||
toastClass: 'my-class'
|
||||
};
|
||||
|
||||
$mdToast.show(options);
|
||||
}
|
||||
});
|
||||
|
||||
myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IPanelService) => {
|
||||
$scope['createPanel'] = () => {
|
||||
var config = {
|
||||
id: 'myPanel',
|
||||
template: '<h1>Hello!</h1>',
|
||||
hasBackdrop: true,
|
||||
disableParentScroll: true,
|
||||
zIndex: 150
|
||||
};
|
||||
|
||||
$mdPanel.create(config);
|
||||
|
||||
var panelRef = $mdPanel.create(config);
|
||||
panelRef.open()
|
||||
.then((ref: ng.material.IPanelRef) => {
|
||||
ref.addClass('foo');
|
||||
ref.removeClass('bar');
|
||||
ref.close();
|
||||
})
|
||||
.finally(() => {
|
||||
panelRef = undefined;
|
||||
});
|
||||
};
|
||||
|
||||
$scope['openPanel'] = () => {
|
||||
$mdPanel.open({
|
||||
template: '<h1>Hello!</h1>',
|
||||
hasBackdrop: true,
|
||||
disableParentScroll: true,
|
||||
zIndex: 150
|
||||
})
|
||||
.then((panelRef: ng.material.IPanelRef) => {
|
||||
panelRef.addClass('foo');
|
||||
panelRef.removeClass('bar');
|
||||
panelRef.close();
|
||||
});
|
||||
};
|
||||
|
||||
$scope['newPanelPosition'] = () => {
|
||||
$mdPanel.newPanelPosition().absolute().center();
|
||||
$mdPanel.newPanelPosition().relativeTo('.demo-menu-open-button').addPanelPosition("ALIGN_START", "BELOW");
|
||||
};
|
||||
|
||||
$scope['newPanelAnimation'] = () => {
|
||||
$mdPanel.newPanelAnimation().openFrom('.some-target');
|
||||
$mdPanel.newPanelAnimation().openFrom({top: 0, left: 0});
|
||||
};
|
||||
});
|
||||
|
||||
Vendored
+151
-18
@@ -1,15 +1,15 @@
|
||||
// Type definitions for Angular Material 1.0.0-rc5+ (angular.material module)
|
||||
// Type definitions for Angular Material 1.1.0-rc5+ (angular.material module)
|
||||
// Project: https://github.com/angular/material
|
||||
// Definitions by: Matt Traynham <https://github.com/mtraynham>
|
||||
// Definitions by: Alex Staroselsky <https://github.com/AlStar01>, Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="angular" />
|
||||
|
||||
import * as angular from 'angular';
|
||||
|
||||
declare var _: string;
|
||||
export = _;
|
||||
|
||||
declare module 'angular' {
|
||||
export namespace material {
|
||||
|
||||
interface IBottomSheetOptions {
|
||||
templateUrl?: string;
|
||||
template?: string;
|
||||
@@ -17,11 +17,12 @@ declare module 'angular' {
|
||||
preserveScope?: boolean; // default: false
|
||||
controller?: string | Function;
|
||||
locals?: { [index: string]: any };
|
||||
targetEvent?: MouseEvent;
|
||||
resolve?: { [index: string]: angular.IPromise<any> }
|
||||
clickOutsideToClose?: boolean;
|
||||
disableBackdrop?: boolean;
|
||||
escapeToClose?: boolean;
|
||||
resolve?: { [index: string]: () => angular.IPromise<any> };
|
||||
controllerAs?: string;
|
||||
bindToController?: boolean;
|
||||
parent?: string | Element | JQuery; // default: root node
|
||||
parent?: Function | string | Object; // default: root node
|
||||
disableParentScroll?: boolean; // default: true
|
||||
}
|
||||
|
||||
@@ -50,7 +51,7 @@ declare module 'angular' {
|
||||
controller(controller?: string | Function): T;
|
||||
locals(locals?: { [index: string]: any }): T;
|
||||
bindToController(bindToController?: boolean): T; // default: false
|
||||
resolve(resolve?: { [index: string]: angular.IPromise<any> }): T;
|
||||
resolve(resolve?: { [index: string]: () => angular.IPromise<any> }): T;
|
||||
controllerAs(controllerAs?: string): T;
|
||||
parent(parent?: string | Element | JQuery): T; // default: root node
|
||||
onComplete(onComplete?: Function): T;
|
||||
@@ -64,9 +65,26 @@ declare module 'angular' {
|
||||
cancel(cancel: string): IConfirmDialog;
|
||||
}
|
||||
|
||||
interface IPromptDialog extends IPresetDialog<IPromptDialog> {
|
||||
cancel(cancel: string): IPromptDialog;
|
||||
placeholder(placeholder: string): IPromptDialog;
|
||||
initialValue(initialValue: string): IPromptDialog;
|
||||
}
|
||||
|
||||
interface IColorExpression {
|
||||
[cssPropertyName: string]: string;
|
||||
}
|
||||
|
||||
interface IColorService {
|
||||
applyThemeColors(element: Element|JQuery, colorExpression: IColorExpression): void;
|
||||
getThemeColor(expression: string): string;
|
||||
hasTheme(): boolean;
|
||||
}
|
||||
|
||||
interface IDialogOptions {
|
||||
templateUrl?: string;
|
||||
template?: string;
|
||||
contentElement?: string | Element;
|
||||
autoWrap?: boolean; // default: true
|
||||
targetEvent?: MouseEvent;
|
||||
openFrom?: any;
|
||||
@@ -74,26 +92,28 @@ declare module 'angular' {
|
||||
scope?: angular.IScope; // default: new child scope
|
||||
preserveScope?: boolean; // default: false
|
||||
disableParentScroll?: boolean; // default: true
|
||||
hasBackdrop?: boolean // default: true
|
||||
hasBackdrop?: boolean; // default: true
|
||||
clickOutsideToClose?: boolean; // default: false
|
||||
escapeToClose?: boolean; // default: true
|
||||
focusOnOpen?: boolean; // default: true
|
||||
controller?: string | Function;
|
||||
locals?: { [index: string]: any };
|
||||
bindToController?: boolean; // default: false
|
||||
resolve?: { [index: string]: angular.IPromise<any> }
|
||||
resolve?: { [index: string]: () => angular.IPromise<any> }
|
||||
controllerAs?: string;
|
||||
parent?: string | Element | JQuery; // default: root node
|
||||
onShowing?: Function;
|
||||
onComplete?: Function;
|
||||
onRemoving?: Function;
|
||||
fullscreen?: boolean;
|
||||
skipHide?: boolean;
|
||||
fullscreen?: boolean; // default: false
|
||||
}
|
||||
|
||||
interface IDialogService {
|
||||
show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog): angular.IPromise<any>;
|
||||
show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog | IPromptDialog): angular.IPromise<any>;
|
||||
confirm(): IConfirmDialog;
|
||||
alert(): IAlertDialog;
|
||||
prompt(): IPromptDialog;
|
||||
hide(response?: any): angular.IPromise<any>;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
@@ -120,9 +140,11 @@ declare module 'angular' {
|
||||
close(): angular.IPromise<void>;
|
||||
isOpen(): boolean;
|
||||
isLockedOpen(): boolean;
|
||||
onClose(onClose: Function): void;
|
||||
}
|
||||
|
||||
interface ISidenavService {
|
||||
(component: string, enableWait: boolean): angular.IPromise<ISidenavObject>;
|
||||
(component: string): ISidenavObject;
|
||||
}
|
||||
|
||||
@@ -149,10 +171,11 @@ declare module 'angular' {
|
||||
preserveScope?: boolean; // default: false
|
||||
hideDelay?: number; // default (ms): 3000
|
||||
position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left'
|
||||
toastClass?: string;
|
||||
controller?: string | Function;
|
||||
locals?: { [index: string]: any };
|
||||
bindToController?: boolean; // default: false
|
||||
resolve?: { [index: string]: angular.IPromise<any> }
|
||||
resolve?: { [index: string]: () => angular.IPromise<any> }
|
||||
controllerAs?: string;
|
||||
parent?: string | Element | JQuery; // default: root node
|
||||
}
|
||||
@@ -162,7 +185,8 @@ declare module 'angular' {
|
||||
showSimple(content: string): angular.IPromise<any>;
|
||||
simple(): ISimpleToastPreset;
|
||||
build(): IToastPreset<any>;
|
||||
updateContent(): void;
|
||||
updateContent(newContent: string): void;
|
||||
updateTextContent(newContent: string): void;
|
||||
hide(response?: any): void;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
@@ -200,6 +224,12 @@ declare module 'angular' {
|
||||
hues: IThemeHues;
|
||||
}
|
||||
|
||||
interface IBrowserColors{
|
||||
theme: string;
|
||||
palette: string;
|
||||
hue: string;
|
||||
}
|
||||
|
||||
interface IThemeColors {
|
||||
accent: IThemePalette;
|
||||
background: IThemePalette;
|
||||
@@ -229,11 +259,13 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
interface IThemingProvider {
|
||||
theme(name: string, inheritFrom?: string): ITheme;
|
||||
alwaysWatchTheme(alwaysWatch: boolean): void;
|
||||
definePalette(name: string, palette: IPalette): IThemingProvider;
|
||||
enableBrowserColor(browserColors: IBrowserColors): Function;
|
||||
extendPalette(name: string, palette: IPalette): IPalette;
|
||||
setDefaultTheme(theme: string): void;
|
||||
alwaysWatchTheme(alwaysWatch: boolean): void;
|
||||
setNonce(nonce: string): void;
|
||||
theme(name: string, inheritFrom?: string): ITheme;
|
||||
}
|
||||
|
||||
interface IDateLocaleProvider {
|
||||
@@ -275,5 +307,106 @@ declare module 'angular' {
|
||||
grey: IPalette;
|
||||
'blue-grey': IPalette;
|
||||
}
|
||||
|
||||
interface IPanelConfig {
|
||||
id?: string;
|
||||
template?: string;
|
||||
templateUrl?: string;
|
||||
controller?: string | Function;
|
||||
controllerAs?: string;
|
||||
bindToController?: boolean; // default: true
|
||||
locals?: { [index: string]: any };
|
||||
resolve?: { [index: string]: () => angular.IPromise<any> }
|
||||
attachTo?: string | JQuery | Element;
|
||||
propagateContainerEvents?: boolean;
|
||||
panelClass?: string;
|
||||
zIndex?: number; // default: 80
|
||||
position?: IPanelPosition;
|
||||
clickOutsideToClose?: boolean; // default: false
|
||||
escapeToClose?: boolean; // default: false
|
||||
trapFocus?: boolean; // default: false
|
||||
focusOnOpen?: boolean; // default: true
|
||||
fullscreen?: boolean; // default: false
|
||||
animation?: IPanelAnimation;
|
||||
hasBackdrop?: boolean; // default: false
|
||||
disableParentScroll?: boolean; // default: false
|
||||
onDomAdded?: Function;
|
||||
onOpenComplete?: Function;
|
||||
onRemoving?: Function;
|
||||
onDomRemoved?: Function;
|
||||
origin?: string | JQuery | Element;
|
||||
}
|
||||
|
||||
interface IPanelRef {
|
||||
id: string;
|
||||
config: IPanelConfig;
|
||||
isAttached: boolean;
|
||||
open(): angular.IPromise<any>;
|
||||
close(): angular.IPromise<any>;
|
||||
attach(): angular.IPromise<any>;
|
||||
detach(): angular.IPromise<any>;
|
||||
show(): angular.IPromise<any>;
|
||||
hide(): angular.IPromise<any>;
|
||||
destroy(): void;
|
||||
addClass(newClass: string): void;
|
||||
removeClass(oldClass: string): void;
|
||||
toggleClass(toggleClass: string): void;
|
||||
updatePosition(position: IPanelPosition): void;
|
||||
registerInterceptor(type: string, callback: () => angular.IPromise<any>): IPanelRef;
|
||||
removeInterceptor(type: string, callback: () => angular.IPromise<any>): IPanelRef;
|
||||
removeAllInterceptors(type?: string): IPanelRef;
|
||||
}
|
||||
|
||||
interface IPanelPosition {
|
||||
absolute(): IPanelPosition;
|
||||
relativeTo(someElement: string | JQuery | Element): IPanelPosition;
|
||||
top(top?: string): IPanelPosition; // default: '0'
|
||||
bottom(bottom?: string): IPanelPosition; // default: '0'
|
||||
start(start?: string): IPanelPosition; // default: '0'
|
||||
end(end?: string): IPanelPosition; // default: '0'
|
||||
left(left?: string): IPanelPosition; // default: '0'
|
||||
right(right?: string): IPanelPosition; // default: '0'
|
||||
centerHorizontally(): IPanelPosition;
|
||||
centerVertically(): IPanelPosition;
|
||||
center(): IPanelPosition;
|
||||
addPanelPosition(xPosition: string, yPosition: string): IPanelPosition;
|
||||
withOffsetX(offsetX: string | ((panel: IPanelPosition) => string)): IPanelPosition;
|
||||
withOffsetY(offsetY: string | ((panel: IPanelPosition) => string)): IPanelPosition;
|
||||
}
|
||||
|
||||
interface IPanelAnimation {
|
||||
openFrom(from: string | Element | Event | { top: number, left: number }): IPanelAnimation;
|
||||
closeTo(to: string | Element | { top: number, left: number }): IPanelAnimation;
|
||||
withAnimation(cssClass: string | { open: string, close: string }): IPanelAnimation;
|
||||
}
|
||||
|
||||
interface IPanelService {
|
||||
create(opt_config: IPanelConfig): IPanelRef;
|
||||
open(opt_config: IPanelConfig): angular.IPromise<IPanelRef>;
|
||||
newPanelPosition(): IPanelPosition;
|
||||
newPanelAnimation(): IPanelAnimation;
|
||||
xPosition: {
|
||||
CENTER: string,
|
||||
ALIGN_START: string,
|
||||
ALIGN_END: string,
|
||||
OFFSET_START: string,
|
||||
OFFSET_END: string,
|
||||
};
|
||||
yPosition: {
|
||||
CENTER: string,
|
||||
ALIGN_TOPS: string,
|
||||
ALIGN_BOTTOMS: string,
|
||||
ABOVE: string,
|
||||
BELOW: string,
|
||||
};
|
||||
animation: {
|
||||
SLIDE: string,
|
||||
SCALE: string,
|
||||
FADE: string,
|
||||
};
|
||||
interceptorTypes: {
|
||||
CLOSE: string,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,15 +136,19 @@ requestHandler = httpBackendService.expect('GET', /test.local/);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, 'response data', function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, /response data/, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, { key: 'value' }, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@@ -162,17 +166,21 @@ requestHandler = httpBackendService.expect('GET', (url: string) => { return true
|
||||
requestHandler = httpBackendService.expectDELETE('http://test.local');
|
||||
requestHandler = httpBackendService.expectDELETE('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectDELETE(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectDELETE(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectDELETE((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectGET('http://test.local');
|
||||
requestHandler = httpBackendService.expectGET('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectGET(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectGET(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectGET((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectHEAD('http://test.local');
|
||||
requestHandler = httpBackendService.expectHEAD('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectHEAD(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectHEAD(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectHEAD((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectJSONP('http://test.local');
|
||||
requestHandler = httpBackendService.expectJSONP(/test.local/);
|
||||
requestHandler = httpBackendService.expectJSONP(/test.local\/(\d+)/, ['id']);
|
||||
requestHandler = httpBackendService.expectJSONP((url: string) => { return true; });
|
||||
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local');
|
||||
@@ -187,12 +195,15 @@ requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'val
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@@ -215,12 +226,15 @@ requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'valu
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@@ -243,12 +257,16 @@ requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@@ -275,16 +293,24 @@ requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'val
|
||||
requestHandler = httpBackendService.when('GET', /test.local/);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data');
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, 'response data', function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, /response data/, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, { key: 'value' }, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@@ -302,17 +328,21 @@ requestHandler = httpBackendService.when('GET', (url: string) => { return true;
|
||||
requestHandler = httpBackendService.whenDELETE('http://test.local');
|
||||
requestHandler = httpBackendService.whenDELETE('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenDELETE(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenDELETE(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenDELETE((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenGET('http://test.local');
|
||||
requestHandler = httpBackendService.whenGET('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenGET(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenGET(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenGET((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenHEAD('http://test.local');
|
||||
requestHandler = httpBackendService.whenHEAD('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenHEAD(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenHEAD(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenHEAD((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenJSONP('http://test.local');
|
||||
requestHandler = httpBackendService.whenJSONP(/test.local/);
|
||||
requestHandler = httpBackendService.whenJSONP(/test.local\/(\d+)/, ['id']);
|
||||
requestHandler = httpBackendService.whenJSONP((url: string) => { return true; });
|
||||
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local');
|
||||
@@ -327,12 +357,16 @@ requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@@ -355,12 +389,16 @@ requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value'
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@@ -383,12 +421,16 @@ requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value'
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@@ -409,6 +451,13 @@ requestHandler.passThrough().passThrough();
|
||||
requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']);
|
||||
requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']).respond({});
|
||||
requestHandler.respond((method, url, data, headers) => { return [404, { key: 'value' }, { header: 'value' }, 'responseText']; });
|
||||
requestHandler.respond((method, url, data, headers, params) => {
|
||||
if(params.id === 1) {
|
||||
return [200, { key: 'value'}, { header: 'value'}, 'responseText'];
|
||||
} else {
|
||||
return [404, { key: 'value' }, { header: 'value' }, 'responseText'];
|
||||
}
|
||||
});
|
||||
requestHandler.respond('data');
|
||||
requestHandler.respond('data').respond({});
|
||||
requestHandler.respond(expectedData);
|
||||
|
||||
Vendored
+296
-278
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.3 (ngMock, ngMockE2E module)
|
||||
// Type definitions for Angular JS 1.5 (ngMock, ngMockE2E module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Tony Curtis <http://github.com/daltin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -13,314 +13,332 @@ import * as angular from 'angular';
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare module 'angular' {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularStatic
|
||||
// We reopen it to add the MockStatic definition
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAngularStatic {
|
||||
mock: IMockStatic;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularStatic
|
||||
// We reopen it to add the MockStatic definition
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAngularStatic {
|
||||
mock: IMockStatic;
|
||||
}
|
||||
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject
|
||||
interface IInjectStatic {
|
||||
(...fns: Function[]): any;
|
||||
(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
|
||||
strictDi(val?: boolean): void;
|
||||
}
|
||||
|
||||
interface IMockStatic {
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump
|
||||
dump(obj: any): string;
|
||||
|
||||
inject: IInjectStatic
|
||||
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.module
|
||||
module: {
|
||||
(...modules: any[]): any;
|
||||
sharedInjector(): void;
|
||||
}
|
||||
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject
|
||||
interface IInjectStatic {
|
||||
(...fns: Function[]): any;
|
||||
(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
|
||||
strictDi(val?: boolean): void;
|
||||
}
|
||||
// see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate
|
||||
TzDate(offset: number, timestamp: number): Date;
|
||||
TzDate(offset: number, timestamp: string): Date;
|
||||
}
|
||||
|
||||
interface IMockStatic {
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump
|
||||
dump(obj: any): string;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ExceptionHandlerService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$exceptionHandler
|
||||
// see https://docs.angularjs.org/api/ngMock/provider/$exceptionHandlerProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IExceptionHandlerProvider extends IServiceProvider {
|
||||
mode(mode: string): void;
|
||||
}
|
||||
|
||||
inject: IInjectStatic
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// TimeoutService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$timeout
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ITimeoutService {
|
||||
flush(delay?: number): void;
|
||||
flushNext(expectedDelay?: number): void;
|
||||
verifyNoPendingTasks(): void;
|
||||
}
|
||||
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.module
|
||||
module: {
|
||||
(...modules: any[]): any;
|
||||
sharedInjector(): void;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IntervalService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$interval
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IIntervalService {
|
||||
flush(millis?: number): number;
|
||||
}
|
||||
|
||||
// see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate
|
||||
TzDate(offset: number, timestamp: number): Date;
|
||||
TzDate(offset: number, timestamp: string): Date;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// LogService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$log
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ILogService {
|
||||
assertEmpty(): void;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ExceptionHandlerService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$exceptionHandler
|
||||
// see https://docs.angularjs.org/api/ngMock/provider/$exceptionHandlerProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IExceptionHandlerProvider extends IServiceProvider {
|
||||
mode(mode: string): void;
|
||||
}
|
||||
interface ILogCall {
|
||||
logs: string[];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// TimeoutService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$timeout
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ITimeoutService {
|
||||
flush(delay?: number): void;
|
||||
flushNext(expectedDelay?: number): void;
|
||||
verifyNoPendingTasks(): void;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ControllerService mock
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$controller
|
||||
// This interface extends http://docs.angularjs.org/api/ng.$controller
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IControllerService {
|
||||
// Although the documentation doesn't state this, locals are optional
|
||||
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindings?: any): T;
|
||||
<T>(controllerConstructor: Function, locals?: any, bindings?: any): T;
|
||||
<T>(controllerName: string, locals?: any, bindings?: any): T;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IntervalService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$interval
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IIntervalService {
|
||||
flush(millis?: number): number;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// LogService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$log
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ILogService {
|
||||
assertEmpty(): void;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
interface ILogCall {
|
||||
logs: string[];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ControllerService mock
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$controller
|
||||
// This interface extends http://docs.angularjs.org/api/ng.$controller
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IControllerService {
|
||||
// Although the documentation doesn't state this, locals are optional
|
||||
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindings?: any): T;
|
||||
<T>(controllerConstructor: Function, locals?: any, bindings?: any): T;
|
||||
<T>(controllerName: string, locals?: any, bindings?: any): T;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ComponentControllerService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$componentController
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IComponentControllerService {
|
||||
// TBinding is an interface exposed by a component as per John Papa's style guide
|
||||
// https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#accessible-members-up-top
|
||||
<T, TBinding>(componentName: string, locals: { $scope: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ComponentControllerService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$componentController
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IComponentControllerService {
|
||||
// TBinding is an interface exposed by a component as per John Papa's style guide
|
||||
// https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#accessible-members-up-top
|
||||
<T, TBinding>(componentName: string, locals: { $scope: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// HttpBackendService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$httpBackend
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IHttpBackendService {
|
||||
/**
|
||||
* Flushes all pending requests using the trained responses.
|
||||
* @param count Number of responses to flush (in the order they arrived). If undefined, all pending requests will be flushed.
|
||||
*/
|
||||
flush(count?: number): void;
|
||||
|
||||
/**
|
||||
* Resets all request expectations, but preserves all backend definitions.
|
||||
*/
|
||||
resetExpectations(): void;
|
||||
|
||||
/**
|
||||
* Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception.
|
||||
*/
|
||||
verifyNoOutstandingExpectation(): void;
|
||||
|
||||
/**
|
||||
* Verifies that there are no outstanding requests that need to be flushed.
|
||||
*/
|
||||
verifyNoOutstandingRequest(): void;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param method HTTP method.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for DELETE requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// HttpBackendService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$httpBackend
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IHttpBackendService {
|
||||
/**
|
||||
* Flushes all pending requests using the trained responses.
|
||||
* @param count Number of responses to flush (in the order they arrived). If undefined, all pending requests will be flushed.
|
||||
*/
|
||||
expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
flush(count?: number): void;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for GET requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
*/
|
||||
expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
/**
|
||||
* Resets all request expectations, but preserves all backend definitions.
|
||||
*/
|
||||
resetExpectations(): void;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for HEAD requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
*/
|
||||
expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
/**
|
||||
* Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception.
|
||||
*/
|
||||
verifyNoOutstandingExpectation(): void;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for JSONP requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
*/
|
||||
expectJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
|
||||
/**
|
||||
* Verifies that there are no outstanding requests that need to be flushed.
|
||||
*/
|
||||
verifyNoOutstandingRequest(): void;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for PATCH requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param method HTTP method.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for POST requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
/**
|
||||
* Creates a new request expectation for DELETE requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for PUT requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for GET requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param method HTTP method.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for HEAD requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for DELETE requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for GET requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for JSONP requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for HEAD requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for PATCH requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for JSONP requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for POST requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for PATCH requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for PUT requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for POST requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new backend definition.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param method HTTP method.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for DELETE requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for GET requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in request url described above
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for HEAD requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for JSONP requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for PATCH requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for POST requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for PUT requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
}
|
||||
|
||||
export module mock {
|
||||
// returned interface by the the mocked HttpBackendService expect/when methods
|
||||
interface IRequestHandler {
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using a function to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param func Function that receives the request HTTP method, url, data, headers, and an array of keys to regex matches in the request url and returns an array containing response status (number), data, headers, and status text.
|
||||
*/
|
||||
respond(func: ((method: string, url: string, data: string | Object, headers: Object, params?: any) => [number, string | Object, Object, string])): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using supplied static data to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param status HTTP status code to add to the response.
|
||||
* @param data Data to add to the response.
|
||||
* @param headers Headers object to add to the response.
|
||||
* @param responseText Response text to add to the response.
|
||||
*/
|
||||
respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param data Data to add to the response.
|
||||
* @param headers Headers object to add to the response.
|
||||
* @param responseText Response text to add to the response.
|
||||
*/
|
||||
respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
|
||||
|
||||
// Available when ngMockE2E is loaded
|
||||
/**
|
||||
* Creates a new backend definition for PUT requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.)
|
||||
*/
|
||||
whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
passThrough(): IRequestHandler;
|
||||
}
|
||||
|
||||
export module mock {
|
||||
// returned interface by the the mocked HttpBackendService expect/when methods
|
||||
interface IRequestHandler {
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using a function to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param func Function that receives the request HTTP method, url, data, and headers and returns an array containing response status (number), data, headers, and status text.
|
||||
*/
|
||||
respond(func: ((method: string, url: string, data: string | Object, headers: Object) => [number, string | Object, Object, string])): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using supplied static data to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param status HTTP status code to add to the response.
|
||||
* @param data Data to add to the response.
|
||||
* @param headers Headers object to add to the response.
|
||||
* @param responseText Response text to add to the response.
|
||||
*/
|
||||
respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param data Data to add to the response.
|
||||
* @param headers Headers object to add to the response.
|
||||
* @param responseText Response text to add to the response.
|
||||
*/
|
||||
respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
|
||||
|
||||
// Available when ngMockE2E is loaded
|
||||
/**
|
||||
* Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.)
|
||||
*/
|
||||
passThrough(): IRequestHandler;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
|
||||
import * as angular from 'angular';
|
||||
|
||||
import permission = angular.permission;
|
||||
import permissionNamespace = angular.permission;
|
||||
import { permission, ngPermission, uiPermission } from "angular-permission";
|
||||
|
||||
angular
|
||||
.module('fooModule', ['permission', 'user'])
|
||||
.run(function (PermissionStore: permission.PermissionStore, User: any) {
|
||||
.module('fooModule', [permission, ngPermission, uiPermission, 'user'])
|
||||
.run(function (PermissionStore: permissionNamespace.PermissionStore, User: any) {
|
||||
// Define anonymous permission
|
||||
PermissionStore
|
||||
.definePermission('anonymous', function (stateParams) {
|
||||
@@ -22,8 +24,8 @@ angular
|
||||
hasPermissionDefinition(permission: string) : angular.IPromise<any>;
|
||||
}
|
||||
|
||||
angular.module('barModule', ['permission', 'user'])
|
||||
.run(function (PermissionStore: permission.PermissionStore, User: BackendUserService, $q: angular.IQService) {
|
||||
angular.module('barModule', [permission, 'user'])
|
||||
.run(function (PermissionStore: permissionNamespace.PermissionStore, User: BackendUserService, $q: angular.IQService) {
|
||||
PermissionStore
|
||||
// Define user permission calling back-end
|
||||
.definePermission('user', function (stateParams) {
|
||||
@@ -64,14 +66,14 @@ angular
|
||||
|
||||
PermissionStore.removePermissionDefinition('user');
|
||||
|
||||
let permissions: Array<permission.Permission> = PermissionStore.getStore();
|
||||
let permissions: Array<permissionNamespace.Permission> = PermissionStore.getStore();
|
||||
|
||||
|
||||
});
|
||||
|
||||
angular
|
||||
.module('fooModule', ['permission', 'user'])
|
||||
.run(function (RoleStore: permission.RoleStore, User: any) {
|
||||
.module('fooModule', [permission, 'user'])
|
||||
.run(function (RoleStore: permissionNamespace.RoleStore, User: any) {
|
||||
RoleStore
|
||||
// Permission array validated role
|
||||
// Library will internally validate if 'user' and 'editor' permissions are valid when checking if role is valid
|
||||
@@ -88,5 +90,5 @@ angular
|
||||
|
||||
RoleStore.removeRoleDefinition('user');
|
||||
|
||||
let roles: Array<permission.Role> = RoleStore.getStore();
|
||||
let roles: Array<permissionNamespace.Role> = RoleStore.getStore();
|
||||
});
|
||||
|
||||
Vendored
+6
@@ -177,3 +177,9 @@ declare module 'angular' {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "angular-permission" {
|
||||
export var permission: string;
|
||||
export var ngPermission: string;
|
||||
export var uiPermission: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
interface IMyService {
|
||||
getFirstname(): ng.IPromise<string>;
|
||||
getLastname(): ng.IPromise<string>;
|
||||
}
|
||||
|
||||
interface IScope {
|
||||
name: string;
|
||||
}
|
||||
|
||||
function TestCtrl($scope: IScope, $q: ng.IQService, MyService: IMyService) {
|
||||
$scope.name = null;
|
||||
|
||||
function firstCallback(firstname: string, lastname: string)
|
||||
{
|
||||
return firstname + ' ' + lastname;
|
||||
}
|
||||
|
||||
function anotherCallback(fullname: string)
|
||||
{
|
||||
$scope.name = fullname;
|
||||
}
|
||||
|
||||
function failureCallback(reason: any)
|
||||
{
|
||||
alert('Could not load data: ' + reason);
|
||||
}
|
||||
|
||||
$q
|
||||
.all([
|
||||
MyService.getFirstname(),
|
||||
MyService.getLastname()
|
||||
])
|
||||
.spread(firstCallback)
|
||||
.then(anotherCallback)
|
||||
.catch(failureCallback);
|
||||
};
|
||||
|
||||
TestCtrl.$inject = ['$scope', '$q', 'MyService'];
|
||||
|
||||
angular.module('test').controller('TestCtrl', TestCtrl);
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for angular-q-spread module
|
||||
// Project: https://www.npmjs.com/package/angular-q-spread
|
||||
// Definitions by: rafw87 <https://github.com/rafw87>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as a from "angular";
|
||||
|
||||
declare module "angular" {
|
||||
interface IPromise<T> {
|
||||
/**
|
||||
This method can be used as a replacement for then. Similarly, it takes two parameters, a callback when all promises are resolved and a callback for failure. The resolve callback is going to be called with the result of the list of promises passed to $q.all as separate parameters instead of one parameters which is an array.
|
||||
* @param successCallback Callback for resolved promise, similar to then's one, but takes multiple parameters instead of single array parameter
|
||||
* @param errorCallback Callback for error, the same as for then
|
||||
*/
|
||||
spread<TResult>(successCallback: (...promiseValues: any[]) => IPromise<TResult>|TResult, errorCallback?: (reason: any) => any): IPromise<TResult>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"files": [
|
||||
"angular-q-spread.d.ts",
|
||||
"angular-q-spread-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
}
|
||||
}
|
||||
Vendored
+15
-4
@@ -39,15 +39,20 @@ declare module 'angular' {
|
||||
(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: any, options?: IResourceOptions): IResourceClass<IResource<any>>;
|
||||
actions?: IActionHash, options?: IResourceOptions): IResourceClass<IResource<any>>;
|
||||
<T, U>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: any, options?: IResourceOptions): U;
|
||||
actions?: IActionHash, options?: IResourceOptions): U;
|
||||
<T>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: any, options?: IResourceOptions): IResourceClass<T>;
|
||||
actions?: IActionHash, options?: IResourceOptions): IResourceClass<T>;
|
||||
}
|
||||
|
||||
// Hash of action descriptors allows custom action names
|
||||
interface IActionHash {
|
||||
[action: string]: IActionDescriptor
|
||||
}
|
||||
|
||||
// Just a reference to facilitate describing new actions
|
||||
@@ -110,7 +115,7 @@ declare module 'angular' {
|
||||
// Also, static calls always return the IResource (or IResourceArray) retrieved
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549
|
||||
interface IResourceClass<T> {
|
||||
new (dataOrParams?: any): T;
|
||||
new(dataOrParams? : any) : T & IResource<T>;
|
||||
get: IResourceMethod<T>;
|
||||
|
||||
query: IResourceArrayMethod<T>;
|
||||
@@ -181,6 +186,12 @@ declare module 'angular' {
|
||||
/** creating a resource service factory */
|
||||
factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction<any>): IModule;
|
||||
}
|
||||
|
||||
namespace auto {
|
||||
interface IInjectorService {
|
||||
get(name: '$resource'): ng.resource.IResourceService;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
||||
@@ -4,5 +4,5 @@ declare var $sanitizeService: ng.sanitize.ISanitizeService;
|
||||
shouldBeString = $sanitizeService(shouldBeString);
|
||||
|
||||
declare var $linky: ng.sanitize.filter.ILinky;
|
||||
shouldBeString = $linky(shouldBeString);
|
||||
shouldBeString = $linky(shouldBeString, "target");
|
||||
shouldBeString = $linky(shouldBeString, shouldBeString);
|
||||
|
||||
Vendored
+17
-6
@@ -26,13 +26,24 @@ declare module 'angular' {
|
||||
// see https://github.com/angular/angular.js/tree/v1.2.0/src/ngSanitize/filter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
export namespace filter {
|
||||
|
||||
// Finds links in text input and turns them into html links.
|
||||
// Supports http/https/ftp/mailto and plain email address links.
|
||||
// see http://code.angularjs.org/1.2.0/docs/api/ngSanitize.filter:linky
|
||||
/**
|
||||
* Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and plain email address links.
|
||||
* @param text Input text.
|
||||
* @param target ILinkyTargetType Window (_blank|_self|_parent|_top) or named frame to open links in.
|
||||
* @param attributes Add custom attributes to the link element.
|
||||
* @return Html-linkified and sanitized text.
|
||||
* see https://docs.angularjs.org/api/ngSanitize/filter/linky
|
||||
*/
|
||||
interface ILinky {
|
||||
(text: string, target?: string): string;
|
||||
(text: string, target: string, attributes?: { [attribute: string]: string } | ((url: string) => { [attribute: string]: string })): string;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Extend angular $filter declarations to include filters from angular.sanitize module
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
interface IFilterService {
|
||||
(name: 'linky'): angular.sanitize.filter.ILinky;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+5
@@ -6,6 +6,11 @@
|
||||
/// <reference types="signalr" />
|
||||
/// <reference types="angular" />
|
||||
|
||||
declare module "angular-signalr-hub" {
|
||||
let _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare namespace ngSignalr {
|
||||
interface HubFactory {
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,9 @@ import angularTouchSpin = require("angular-touchspin");
|
||||
import * as angular from 'angular';
|
||||
|
||||
angular
|
||||
.module('touchspin-tests', ['lm.touchspin'])
|
||||
.config(function(touchspinConfigProvider: angularTouchSpin.ITouchSpinConfigProvider) {
|
||||
touchspinConfigProvider.defaults(<angularTouchSpin.ITouchSpinOptions>{
|
||||
.module('touchspin-tests', ['nk.touchspin'])
|
||||
.config(function(touchspinConfigProvider: angular.touchspin.ITouchSpinConfigProvider) {
|
||||
touchspinConfigProvider.defaults(<angular.touchspin.ITouchSpinOptions>{
|
||||
min: 0,
|
||||
max: 0,
|
||||
step: 0,
|
||||
|
||||
Vendored
+29
-27
@@ -8,33 +8,35 @@
|
||||
declare let angularTouchSpin: string;
|
||||
export = angularTouchSpin;
|
||||
|
||||
declare namespace angularTouchSpin {
|
||||
interface ITouchSpinOptions {
|
||||
min?: number;
|
||||
max?: number;
|
||||
step?: number;
|
||||
decimals?: number;
|
||||
stepInterval?: number;
|
||||
forceStepDivisibility?: string; // none | floor | round | ceil
|
||||
stepIntervalDelay?: number;
|
||||
verticalButtons?: boolean;
|
||||
verticalUpClass?: string;
|
||||
verticalDownClass?: string;
|
||||
initVal?: number;
|
||||
prefix?: string;
|
||||
postfix?: string;
|
||||
prefixExtraClass?: string;
|
||||
postfixExtraClass?: string;
|
||||
mousewheel?: boolean;
|
||||
buttonDownClass?: string;
|
||||
buttonUpClass?: string;
|
||||
buttonDownTxt?: string;
|
||||
buttonUpTxt?: string;
|
||||
}
|
||||
declare module "angular" {
|
||||
namespace touchspin {
|
||||
interface ITouchSpinOptions {
|
||||
min?: number;
|
||||
max?: number;
|
||||
step?: number;
|
||||
decimals?: number;
|
||||
stepInterval?: number;
|
||||
forceStepDivisibility?: string; // none | floor | round | ceil
|
||||
stepIntervalDelay?: number;
|
||||
verticalButtons?: boolean;
|
||||
verticalUpClass?: string;
|
||||
verticalDownClass?: string;
|
||||
initVal?: number;
|
||||
prefix?: string;
|
||||
postfix?: string;
|
||||
prefixExtraClass?: string;
|
||||
postfixExtraClass?: string;
|
||||
mousewheel?: boolean;
|
||||
buttonDownClass?: string;
|
||||
buttonUpClass?: string;
|
||||
buttonDownTxt?: string;
|
||||
buttonUpTxt?: string;
|
||||
}
|
||||
|
||||
interface ITouchSpinConfig extends ITouchSpinOptions { }
|
||||
interface ITouchSpinConfig extends ITouchSpinOptions { }
|
||||
|
||||
interface ITouchSpinConfigProvider {
|
||||
defaults(touchSpinOptions: ITouchSpinOptions): void;
|
||||
interface ITouchSpinConfigProvider {
|
||||
defaults(touchSpinOptions: ITouchSpinOptions): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+8
-5
@@ -11,7 +11,7 @@ declare module 'angular' {
|
||||
export namespace translate {
|
||||
|
||||
interface ITranslationTable {
|
||||
[key: string]: any;
|
||||
[key: string]: string | ITranslationTable;
|
||||
}
|
||||
|
||||
interface ILanguageKeyAlias {
|
||||
@@ -66,10 +66,11 @@ declare module 'angular' {
|
||||
loaderCache(): any;
|
||||
isReady(): boolean;
|
||||
onReady(): angular.IPromise<void>;
|
||||
resolveClientLocale(): string;
|
||||
}
|
||||
|
||||
interface ITranslateProvider extends angular.IServiceProvider {
|
||||
translations(): ITranslationTable;
|
||||
translations(key?: string): ITranslationTable;
|
||||
translations(key: string, translationTable: ITranslationTable): ITranslateProvider;
|
||||
cloakClassName(): string;
|
||||
cloakClassName(name: string): ITranslateProvider;
|
||||
@@ -92,8 +93,9 @@ declare module 'angular' {
|
||||
use(key: string): ITranslateProvider;
|
||||
storageKey(): string;
|
||||
storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here
|
||||
uniformLanguageTag(options: string | Object): ITranslateProvider;
|
||||
useUrlLoader(url: string): ITranslateProvider;
|
||||
useStaticFilesLoader(options: IStaticFilesLoaderOptions): ITranslateProvider;
|
||||
useStaticFilesLoader(options: IStaticFilesLoaderOptions | { files: IStaticFilesLoaderOptions[] }): ITranslateProvider;
|
||||
useLoader(loaderFactory: string, options?: any): ITranslateProvider;
|
||||
useLocalStorage(): ITranslateProvider;
|
||||
useCookieStorage(): ITranslateProvider;
|
||||
@@ -109,12 +111,13 @@ declare module 'angular' {
|
||||
registerAvailableLanguageKeys(): string[];
|
||||
registerAvailableLanguageKeys(languageKeys: string[], aliases?: ILanguageKeyAlias): ITranslateProvider;
|
||||
useLoaderCache(cache?: any): ITranslateProvider;
|
||||
resolveClientLocale(): string;
|
||||
}
|
||||
}
|
||||
|
||||
interface IFilterService {
|
||||
(name:'translate'): {
|
||||
(name: 'translate'): {
|
||||
(translationId: string, interpolateParams?: any, interpolation?: string): string;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,6 +181,10 @@ testApp.controller('TestCtrl', (
|
||||
$log.log('modal rendered');
|
||||
});
|
||||
|
||||
modalInstance.closed.then(()=> {
|
||||
$log.log('modal closed');
|
||||
});
|
||||
|
||||
modalInstance.result.then((closeResult:any)=> {
|
||||
$log.log('modal closed', closeResult);
|
||||
}, (dismissResult:any)=> {
|
||||
|
||||
Vendored
+29
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular UI Bootstrap 0.13.3
|
||||
// Type definitions for Angular UI Bootstrap 0.13.3
|
||||
// Project: https://github.com/angular-ui/bootstrap
|
||||
// Definitions by: Brian Surowiec <https://github.com/xt0rted>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -262,6 +262,11 @@ declare module 'angular' {
|
||||
* A promise that is resolved when a modal is rendered.
|
||||
*/
|
||||
rendered: angular.IPromise<any>;
|
||||
|
||||
/**
|
||||
* A promise that is resolved when a modal is closed and the animation completes.
|
||||
*/
|
||||
closed: angular.IPromise<any>;
|
||||
}
|
||||
|
||||
interface IModalScope extends angular.IScope {
|
||||
@@ -374,6 +379,29 @@ declare module 'angular' {
|
||||
* @default 'model-open'
|
||||
*/
|
||||
openedClass?: string;
|
||||
|
||||
/**
|
||||
* CSS class(es) to be added to the top modal window.
|
||||
*/
|
||||
windowTopClass?: string;
|
||||
|
||||
/**
|
||||
* Appends the modal to a specific element.
|
||||
*
|
||||
* @default 'body'
|
||||
*/
|
||||
appendTo?: angular.IAugmentedJQuery;
|
||||
|
||||
/**
|
||||
* A string reference to the component to be rendered that is registered with Angular's compiler. If using a directive, the directive must have `restrict: 'E'` and a template or templateUrl set.
|
||||
*
|
||||
* It supports these bindings:
|
||||
* - `close` - A method that can be used to close a modal, passing a result. The result must be passed in this format: `{$value: myResult}`
|
||||
* - `dismiss` - A method that can be used to dismiss a modal, passing a result. The result must be passed in this format: `{$value: myRejectedResult}`
|
||||
* - `modalInstance` - The modal instance. This is the same `$uibModalInstance` injectable found when using `controller`.
|
||||
* - `resolve` - An object of the modal resolve values. See [UI Router resolves] for details.
|
||||
*/
|
||||
component?: string;
|
||||
}
|
||||
|
||||
interface IModalStackService {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
function TestNotifications(NotificationProvider: angular.uiNotification.INotificationProvider, Notification: angular.uiNotification.INotificationService) {
|
||||
NotificationProvider.setOptions({
|
||||
delay: 10000,
|
||||
startTop: 20,
|
||||
startRight: 10,
|
||||
verticalSpacing: 20,
|
||||
horizontalSpacing: 20,
|
||||
positionX: 'left',
|
||||
positionY: 'bottom'
|
||||
});
|
||||
|
||||
Notification.primary('Primary notification');
|
||||
Notification('Primary notification');
|
||||
|
||||
Notification.success('Success notification');
|
||||
|
||||
Notification({message: 'Warning notification'}, 'warning');
|
||||
|
||||
Notification({message: 'Primary notification', title: 'Primary notification'});
|
||||
|
||||
Notification.error({message: 'Error notification 1s', delay: 1000});
|
||||
|
||||
Notification.success({message: 'Success notification<br>Some other <b>content</b><br><a href="https://github.com/alexcrack/angular-ui-notification">This is a link</a><br><img src="https://angularjs.org/img/AngularJS-small.png">', title: 'Html content'});
|
||||
|
||||
Notification.error({message: 'Error Bottom Right', positionY: 'bottom', positionX: 'right'});
|
||||
|
||||
Notification.error({message: 'Error notification 1s', replaceMessage: true});
|
||||
}
|
||||
Vendored
+82
@@ -0,0 +1,82 @@
|
||||
// Type definitions for angular-ui-notification
|
||||
// Project: https://github.com/alexcrack/angular-ui-notification
|
||||
// Definitions by: Kamil Rojewski <https://github.com/krojew/DefinitelyTyped>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace angular.uiNotification {
|
||||
// Taken from angular to avoid dependency
|
||||
interface IPromise<T> {
|
||||
/**
|
||||
* Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected.
|
||||
* The successCallBack may return IPromise<void> for when a $q.reject() needs to be returned
|
||||
* This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method.
|
||||
*/
|
||||
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
|
||||
/**
|
||||
* Shorthand for promise.then(null, errorCallback)
|
||||
*/
|
||||
catch<TResult>(onRejected: (reason: any) => IPromise<TResult>|TResult): IPromise<TResult>;
|
||||
|
||||
/**
|
||||
* Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information.
|
||||
*
|
||||
* Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible.
|
||||
*/
|
||||
finally(finallyCallback: () => any): IPromise<T>;
|
||||
}
|
||||
|
||||
type XPosition = 'right'|'left'|'center';
|
||||
type YPosition = 'top'|'bottom';
|
||||
|
||||
type MessageType = 'primary'|'info'|'success'|'warning'|'error';
|
||||
|
||||
interface IGlobalMessageOptions {
|
||||
delay?: number;
|
||||
startTop?: number;
|
||||
startRight?: number;
|
||||
verticalSpacing?: number;
|
||||
horizontalSpacing?: number;
|
||||
positionX?: XPosition;
|
||||
positionY?: YPosition;
|
||||
replaceMessage?: boolean;
|
||||
templateUrl?: string;
|
||||
onClose?: (element: any) => any;
|
||||
closeOnClick?: boolean;
|
||||
maxCount?: number;
|
||||
}
|
||||
|
||||
interface IMessageOptions {
|
||||
title?: string;
|
||||
message?: string;
|
||||
templateUrl?: string;
|
||||
delay?: number;
|
||||
type?: MessageType;
|
||||
positionX?: XPosition;
|
||||
positionY?: YPosition;
|
||||
replaceMessage?: boolean;
|
||||
closeOnClick?: boolean;
|
||||
}
|
||||
|
||||
interface INotificationScope {
|
||||
kill(isHard: boolean): void;
|
||||
}
|
||||
|
||||
interface INotificationProvider {
|
||||
setOptions(options: IGlobalMessageOptions): void;
|
||||
}
|
||||
|
||||
type Message = string|IMessageOptions;
|
||||
|
||||
interface INotificationService {
|
||||
primary(message: Message): IPromise<INotificationScope>;
|
||||
info(message: Message): IPromise<INotificationScope>;
|
||||
success(message: Message): IPromise<INotificationScope>;
|
||||
warning(message: Message): IPromise<INotificationScope>;
|
||||
error(message: Message): IPromise<INotificationScope>;
|
||||
|
||||
clearAll(): void;
|
||||
|
||||
(message: Message, type?: MessageType): IPromise<INotificationScope>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-ui-notification-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
import * as ng from 'angular';
|
||||
import * as angular from 'angular';
|
||||
|
||||
var myApp = angular.module('testModule');
|
||||
import uiRouterModule from "angular-ui-router";
|
||||
var myApp = angular.module("testModule", [uiRouterModule]);
|
||||
|
||||
interface MyAppScope extends ng.IScope {
|
||||
items: string[];
|
||||
|
||||
Vendored
+24
-27
@@ -5,14 +5,8 @@
|
||||
|
||||
import * as angular from 'angular';
|
||||
|
||||
// Support for AMD require and CommonJS
|
||||
// Since angular-ui-router adds providers for a bunch of
|
||||
// injectable dependencies, it doesn't really return any
|
||||
// actual data except the plain string 'ui.router'.
|
||||
//
|
||||
// As such, I don't think anybody will ever use the actual
|
||||
// default value of the module. So I've only included the
|
||||
// the types. (@xogeny)
|
||||
export default "ui.router";
|
||||
|
||||
export type IState = angular.ui.IState;
|
||||
export type IStateProvider = angular.ui.IStateProvider;
|
||||
export type IUrlMatcher = angular.ui.IUrlMatcher;
|
||||
@@ -33,24 +27,28 @@ declare module 'angular' {
|
||||
/**
|
||||
* String HTML content, or function that returns an HTML string
|
||||
*/
|
||||
template?: string | {(): string};
|
||||
template?: string | { (params: IStateParamsService): string };
|
||||
/**
|
||||
* String URL path to template file OR Function, returns URL path string
|
||||
*/
|
||||
templateUrl?: string | {(params: IStateParamsService): string};
|
||||
templateUrl?: string | { (params: IStateParamsService): string };
|
||||
/**
|
||||
* Function, returns HTML content string
|
||||
*/
|
||||
templateProvider?: Function | Array<string|Function>;
|
||||
templateProvider?: Function | Array<string | Function>;
|
||||
/**
|
||||
* String, component name
|
||||
*/
|
||||
component?: string;
|
||||
/**
|
||||
* A controller paired to the state. Function, annotated array or name as String
|
||||
*/
|
||||
controller?: Function|string|Array<string|Function>;
|
||||
controller?: Function | string | Array<string | Function>;
|
||||
controllerAs?: string;
|
||||
/**
|
||||
* Function (injectable), returns the actual controller function or string.
|
||||
*/
|
||||
controllerProvider?: Function|Array<string|Function>;
|
||||
controllerProvider?: Function | Array<string | Function>;
|
||||
|
||||
/**
|
||||
* Specifies the parent state of this state
|
||||
@@ -58,7 +56,7 @@ declare module 'angular' {
|
||||
parent?: string | IState;
|
||||
|
||||
|
||||
resolve?: { [name:string]: any };
|
||||
resolve?: { [name: string]: any };
|
||||
/**
|
||||
* A url with optional parameters. When a state is navigated or transitioned to, the $stateParams service will be populated with any parameters that were passed.
|
||||
*/
|
||||
@@ -70,18 +68,18 @@ declare module 'angular' {
|
||||
/**
|
||||
* Use the views property to set up multiple views. If you don't need multiple views within a single state this property is not needed. Tip: remember that often nested views are more useful and powerful than multiple sibling views.
|
||||
*/
|
||||
views?: { [name:string]: IState };
|
||||
views?: { [name: string]: IState };
|
||||
abstract?: boolean;
|
||||
/**
|
||||
* Callback function for when a state is entered. Good way to trigger an action or dispatch an event, such as opening a dialog.
|
||||
* If minifying your scripts, make sure to explicitly annotate this function, because it won't be automatically annotated by your build tools.
|
||||
*/
|
||||
onEnter?: Function|Array<string|Function>;
|
||||
onEnter?: Function | Array<string | Function>;
|
||||
/**
|
||||
* Callback functions for when a state is entered and exited. Good way to trigger an action or dispatch an event, such as opening a dialog.
|
||||
* If minifying your scripts, make sure to explicitly annotate this function, because it won't be automatically annotated by your build tools.
|
||||
*/
|
||||
onExit?: Function|Array<string|Function>;
|
||||
onExit?: Function | Array<string | Function>;
|
||||
/**
|
||||
* Arbitrary data object, useful for custom configuration.
|
||||
*/
|
||||
@@ -103,10 +101,10 @@ declare module 'angular' {
|
||||
toParams: {},
|
||||
options: IStateOptions
|
||||
}
|
||||
|
||||
|
||||
interface IStateProvider extends angular.IServiceProvider {
|
||||
state(name:string, config:IState): IStateProvider;
|
||||
state(config:IState): IStateProvider;
|
||||
state(name: string, config: IState): IStateProvider;
|
||||
state(config: IState): IStateProvider;
|
||||
decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;
|
||||
}
|
||||
|
||||
@@ -159,7 +157,7 @@ declare module 'angular' {
|
||||
*
|
||||
* @returns {IUrlMatcherFactory} Returns $urlMatcherFactoryProvider.
|
||||
*/
|
||||
type(name: string, definition: IType, definitionFn?: (...args:any[]) => IType): IUrlMatcherFactory;
|
||||
type(name: string, definition: IType, definitionFn?: (...args: any[]) => IType): IUrlMatcherFactory;
|
||||
/**
|
||||
* Defines whether URL matching should be case sensitive (the default behavior), or not.
|
||||
*
|
||||
@@ -227,9 +225,9 @@ declare module 'angular' {
|
||||
*/
|
||||
notify?: boolean;
|
||||
/**
|
||||
* {boolean=false}, If true will force transition even if the state or params have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd use this when you want to force a reload when everything is the same, including search params.
|
||||
* {boolean=false|string|IState}, If true will force transition even if the state or params have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd use this when you want to force a reload when everything is the same, including search params.
|
||||
*/
|
||||
reload?: boolean;
|
||||
reload?: boolean | string | IState;
|
||||
}
|
||||
|
||||
interface IHrefOptions {
|
||||
@@ -261,8 +259,8 @@ declare module 'angular' {
|
||||
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;
|
||||
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;
|
||||
@@ -349,7 +347,7 @@ declare module 'angular' {
|
||||
*
|
||||
* @returns {boolean} Returns true if the values are equivalent/equal, otherwise false.
|
||||
*/
|
||||
equals? (a: any, b: any): boolean;
|
||||
equals?(a: any, b: any): boolean;
|
||||
/**
|
||||
* Detects whether a value is of a particular type. Accepts a native (decoded) value and determines whether it matches the current Type object.
|
||||
*
|
||||
@@ -367,4 +365,3 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-1
@@ -46,8 +46,9 @@ declare module 'angular' {
|
||||
topVisibleScope: ng.IRepeatScope;
|
||||
/**
|
||||
* calling this method reinitializes and reloads the scroller content.
|
||||
* @param startIndex is an integer indicating what item index the scroller will use to start the load process.
|
||||
*/
|
||||
reload(): void;
|
||||
reload(startIndex?: number): void;
|
||||
/**
|
||||
* Replaces the item in the buffer at the given index with the new items.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/// <reference path="angular-websocket.d.ts" />
|
||||
|
||||
let dummySocket: ng.websocket.IWebSocket;
|
||||
let dummyPromise: ng.IPromise<void>;
|
||||
let dummyScope: ng.IScope;
|
||||
|
||||
let provider: ng.websocket.IWebSocketProvider = (url: string, protocols?:string[] | ng.websocket.IWebSocketConfigOptions, options?: ng.websocket.IWebSocketConfigOptions) => {
|
||||
return dummySocket;
|
||||
}
|
||||
|
||||
let socketWithProtocol = provider("wss://localhost", "protocol");
|
||||
let socketWithProtocols = provider("wss://localhost", ["protocol-a", "protocol-b"]);
|
||||
|
||||
let socketWithOptions = provider("wss://localhost", {
|
||||
scope: dummyScope,
|
||||
rootScopeFailOver: true,
|
||||
useApplyAsync: true,
|
||||
initialTimeout: 100,
|
||||
maxTimeout: 300000,
|
||||
reconnectIfNotNormalClose: true,
|
||||
binaryType: "blob"
|
||||
});
|
||||
|
||||
let socketWithProtocolAndOptions = provider("wss://localhost", "protocol", {
|
||||
scope: dummyScope,
|
||||
rootScopeFailOver: true,
|
||||
useApplyAsync: true,
|
||||
initialTimeout: 100,
|
||||
maxTimeout: 300000,
|
||||
reconnectIfNotNormalClose: true,
|
||||
binaryType: "blob"
|
||||
});
|
||||
|
||||
let socket = provider("wss://localhost");
|
||||
|
||||
socket.onOpen((event) => {})
|
||||
.onClose((event) => {})
|
||||
.onError((event) => {})
|
||||
.onMessage((event) => {});
|
||||
|
||||
socket.onMessage((event) => {}, { filter: /Some Filter/ })
|
||||
.onMessage((event) => {}, { filter: 'Some Filter' })
|
||||
.onMessage((event) => {}, { filter: 'Some Filter', autoApply: true })
|
||||
.onMessage((event) => {}, { autoApply: false });
|
||||
|
||||
socket.close(true);
|
||||
socket.close();
|
||||
|
||||
socket.send("Some great data here!").finally(() => {});
|
||||
socket.send({ list: [1, 2, 3, 4] });
|
||||
|
||||
socket.socket.send("data");
|
||||
socket.socket.close();
|
||||
socket.socket.close(1);
|
||||
socket.socket.close(1, "reason");
|
||||
|
||||
socket.sendQueue.push({ message: "msg", defered: dummyPromise });
|
||||
|
||||
socket.onOpenCallbacks.push((event: Event) => {});
|
||||
socket.onCloseCallbacks.push((event: CloseEvent) => {});
|
||||
socket.onErrorCallbacks.push((event: Event) => {});
|
||||
socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: 'Some Filter', autoApply: true });
|
||||
socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: /Some Filter/, autoApply: true });
|
||||
socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: undefined, autoApply: true });
|
||||
|
||||
socket.readyState = 0;
|
||||
|
||||
socket.initialTimeout = 10;
|
||||
|
||||
socket.maxTimeout = 5000;
|
||||
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
// Type definitions for angular-websocket v2.0
|
||||
// Project: https://github.com/AngularClass/angular-websocket
|
||||
// Definitions by: Nick Veys <https://github.com/nickveys>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as ng from "angular";
|
||||
|
||||
declare module "angular" {
|
||||
namespace websocket {
|
||||
|
||||
/**
|
||||
* Options available to be specified for IWebSocketProvider.
|
||||
*/
|
||||
type IWebSocketConfigOptions = {
|
||||
scope?: ng.IScope;
|
||||
rootScopeFailOver?: boolean;
|
||||
useApplyAsync?: boolean;
|
||||
initialTimeout?: number;
|
||||
maxTimeout?: number;
|
||||
binaryType?: "blob" | "arraybuffer";
|
||||
reconnectIfNotNormalClose?: boolean;
|
||||
}
|
||||
interface IWebSocketProvider {
|
||||
/**
|
||||
* Creates and opens an IWebSocket instance.
|
||||
*
|
||||
* @param url url to connect to
|
||||
* @return websocket instance
|
||||
*/
|
||||
(url: string, protocols?: string | string[] | IWebSocketConfigOptions, options?: IWebSocketConfigOptions): IWebSocket;
|
||||
}
|
||||
|
||||
/** Options available to be specified for IWebSocket.onMessage */
|
||||
type IWebSocketMessageOptions = {
|
||||
|
||||
/**
|
||||
* If specified, only messages that match the filter will cause the message event
|
||||
* to be fired.
|
||||
*/
|
||||
filter?: string | RegExp;
|
||||
|
||||
/** If true, each message handled will safely call `$rootScope.$digest()`. */
|
||||
autoApply?: boolean;
|
||||
}
|
||||
|
||||
/** Type corresponding to onMessage callbaks stored in $Websocket#onMessageCallbacks instance. */
|
||||
type IWebSocketMessageHandler = {
|
||||
fn: (evt: MessageEvent) => void;
|
||||
pattern: string | RegExp;
|
||||
autoApply: boolean;
|
||||
}
|
||||
|
||||
/** Type corresponding to items stored in $WebSocket#sendQueue instance. */
|
||||
type IWebSocketQueueItem = {
|
||||
message: any;
|
||||
defered: ng.IPromise<void>;
|
||||
}
|
||||
|
||||
interface IWebSocket {
|
||||
|
||||
/**
|
||||
* Adds a callback to be executed each time a socket connection is opened for
|
||||
* this instance.
|
||||
*
|
||||
* @param event event object
|
||||
* @returns this instance, for method chaining
|
||||
*/
|
||||
onOpen(callback: (event: Event) => void): IWebSocket;
|
||||
|
||||
/**
|
||||
* Adds a callback to be executed each time a socket connection is closed for
|
||||
* this instance.
|
||||
*
|
||||
* @param event event object
|
||||
* @returns this instance, for method chaining
|
||||
*/
|
||||
onClose(callback: (event: CloseEvent) => void): IWebSocket;
|
||||
|
||||
/**
|
||||
* Adds a callback to be executed each time a socket connection is closed for
|
||||
* this instance.
|
||||
*
|
||||
* @param event event object
|
||||
* @returns this instance, for method chaining
|
||||
*/
|
||||
onError(callback: (event: Event) => void): IWebSocket;
|
||||
|
||||
/**
|
||||
* Adds a callback to be executed each time a socket connection has an error for
|
||||
* this instance.
|
||||
*
|
||||
* @param event event object
|
||||
* @returns this instance, for method chaining
|
||||
*/
|
||||
onMessage(callback: (event: MessageEvent) => void, options?: IWebSocketMessageOptions): IWebSocket;
|
||||
|
||||
/**
|
||||
* Closes the underlying socket, as long as no data is still being sent from the client.
|
||||
*
|
||||
* @param force if `true`, force close even if data is still being sent
|
||||
* @returns this instance, for method chaining
|
||||
*/
|
||||
close(force?: boolean): IWebSocket;
|
||||
|
||||
/**
|
||||
* Adds data to a queue, and attempts to send if the socket is ready.
|
||||
*
|
||||
* @param data data to send, if this is an object, it will be stringified before sending
|
||||
*/
|
||||
send(data: string | {}): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* WebSocket instance.
|
||||
*/
|
||||
socket: WebSocket;
|
||||
|
||||
/**
|
||||
* Queue of send calls to be made on socket when socket is able to receive data.
|
||||
*/
|
||||
sendQueue: IWebSocketQueueItem[];
|
||||
|
||||
/**
|
||||
* List of callbacks to be executed when the socket is opened.
|
||||
*/
|
||||
onOpenCallbacks: ((evt: Event) => void)[];
|
||||
|
||||
/**
|
||||
* List of callbacks to be executed when a message is received from the socket.
|
||||
*/
|
||||
onMessageCallbacks: IWebSocketMessageHandler[];
|
||||
|
||||
/**
|
||||
* List of callbacks to be executed when an error is received from the socket.
|
||||
*/
|
||||
onErrorCallbacks: ((evt: Event) => void)[];
|
||||
|
||||
/**
|
||||
* List of callbacks to be executed when the socket is closed.
|
||||
*/
|
||||
onCloseCallbacks: ((evt: CloseEvent) => void)[];
|
||||
|
||||
/**
|
||||
* Returns either the readyState value from the underlying WebSocket instance
|
||||
* or a proprietary value representing the internal state
|
||||
*/
|
||||
readyState: number;
|
||||
|
||||
/**
|
||||
* The initial timeout.
|
||||
*/
|
||||
initialTimeout: number;
|
||||
|
||||
/**
|
||||
* Maximun timeout used to determine reconnection delay.
|
||||
*/
|
||||
maxTimeout: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"files": [
|
||||
"angular-websocket.d.ts",
|
||||
"angular-websocket-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path="angular-xeditable.d.ts" />
|
||||
|
||||
var myApp = angular.module('testModule', ['xeditable']);
|
||||
|
||||
myApp.run(["editableOptions", (editableOptions: angular.xeditable.IEditableOptions) => {
|
||||
|
||||
editableOptions.activate = "select";
|
||||
editableOptions.activationEvent = "click";
|
||||
editableOptions.blurElem = "ignore";
|
||||
editableOptions.blurForm = "submit";
|
||||
editableOptions.buttons = "no";
|
||||
editableOptions.icon_set = "font-awesome";
|
||||
editableOptions.isDisabled = true;
|
||||
editableOptions.theme = "bs3";
|
||||
}]);
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
// Type definitions for Angular xEditable 0.2.0 (angular.xeditable module)
|
||||
// Project: https://vitalets.github.io/angular-xeditable/
|
||||
// Definitions by: Joao Monteiro <https://github.com/jpmnteiro>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as angular from "angular";
|
||||
|
||||
declare module "angular" {
|
||||
namespace xeditable {
|
||||
interface IEditableOptions {
|
||||
|
||||
/**
|
||||
* Theme. Possible values `bs3`, `bs2`, `default`
|
||||
*/
|
||||
theme: string;
|
||||
|
||||
/**
|
||||
* Icon Set. Possible values `font-awesome`, `default`.
|
||||
*/
|
||||
icon_set: string;
|
||||
|
||||
/**
|
||||
* Whether to show buttons for single editalbe element.
|
||||
* Possible values `right` (default), `no`.
|
||||
*/
|
||||
buttons: string;
|
||||
|
||||
/**
|
||||
* Default value for `blur` attribute of single editable element.
|
||||
* Can be `cancel|submit|ignore`.
|
||||
*/
|
||||
blurElem: string;
|
||||
|
||||
/**
|
||||
* Default value for `blur` attribute of editable form.
|
||||
* Can be `cancel|submit|ignore`.
|
||||
*/
|
||||
blurForm: string;
|
||||
|
||||
/**
|
||||
* How input elements get activated. Possible values: `focus|select|none`.
|
||||
*/
|
||||
activate: string;
|
||||
|
||||
/**
|
||||
* Whether to disable x-editable. Can be overloaded on each element.
|
||||
*/
|
||||
isDisabled: boolean;
|
||||
|
||||
/*
|
||||
* Event, on which the edit mode gets activated.
|
||||
* Can be any event.
|
||||
*/
|
||||
activationEvent: string;
|
||||
}
|
||||
|
||||
interface IEditableFormController extends angular.IFormController {
|
||||
|
||||
/**
|
||||
* Shows form with editable controls.
|
||||
*/
|
||||
$show(): void;
|
||||
|
||||
/**
|
||||
* Hides form with editable controls without saving.
|
||||
*/
|
||||
$hide(): void;
|
||||
|
||||
/**
|
||||
* Sets focus on form field specified by `name`.<br/>
|
||||
* When trying to set the focus on a form field of a new row in the editable table, the `$activate` call needs to be wrapped in a `$timeout` call so that the form is rendered before the `$activate` function is called.
|
||||
*
|
||||
* @param name name of field
|
||||
*/
|
||||
$activate(name: string): void;
|
||||
|
||||
/**
|
||||
* Triggers `oncancel` event and calls `$hide()`.
|
||||
*/
|
||||
$cancel(): void;
|
||||
|
||||
$setWaiting(value: boolean): void;
|
||||
|
||||
/**
|
||||
* Shows error message for particular field.
|
||||
*
|
||||
* @param name name of field
|
||||
* @param msg error message
|
||||
*/
|
||||
$setError(name: string, msg: string): void;
|
||||
|
||||
$submit(): void;
|
||||
|
||||
$save(): void;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"files": [
|
||||
"angular-xeditable.d.ts",
|
||||
"angular-xeditable-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
}
|
||||
}
|
||||
+51
@@ -427,4 +427,55 @@ declare namespace angular {
|
||||
interface OnReuse {
|
||||
$routerOnReuse(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
// Supplement IComponentOptions from angular.d.ts with router-specific
|
||||
// fields.
|
||||
interface IComponentOptions {
|
||||
$canActivate?: (...args: any[]) => boolean | angular.IPromise<boolean>;
|
||||
$routeConfig?: RouteDefinition[];
|
||||
}
|
||||
}
|
||||
|
||||
+66
-12
@@ -179,25 +179,51 @@ namespace My.Namespace {
|
||||
|
||||
// IModule Registering Test
|
||||
var mod = angular.module('tests', []);
|
||||
mod.controller('name', function ($scope: ng.IScope) { })
|
||||
mod.controller('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.controller(My.Namespace);
|
||||
mod.controller('name', function ($scope: ng.IScope) { });
|
||||
mod.controller('name', ['$scope', function ($scope: ng.IScope) { }]);
|
||||
mod.controller('name', class {
|
||||
// Uncommenting the next line should lead to a type error because this signature isn't compatible
|
||||
// with the signature of the `$onChanges` hook:
|
||||
// $onChanges(x: number) { }
|
||||
});
|
||||
mod.controller({
|
||||
MyCtrl: class{},
|
||||
MyCtrl2: function() {},
|
||||
MyCtrl3: ['$fooService', function($fooService: any) { }]
|
||||
});
|
||||
mod.directive('name', <any>function ($scope: ng.IScope) { })
|
||||
mod.directive('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.directive(My.Namespace);
|
||||
mod.directive({
|
||||
myFooDir: () => ({
|
||||
template: 'my-foo-dir.tpl.html'
|
||||
}),
|
||||
myBarDir: ['$fooService', ($fooService: any) => ({
|
||||
template: 'my-bar-dir.tpl.html'
|
||||
})]
|
||||
});
|
||||
mod.factory('name', function ($scope: ng.IScope) { })
|
||||
mod.factory('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.factory(My.Namespace);
|
||||
mod.factory('name', ['$scope', function ($scope: ng.IScope) { }])
|
||||
mod.factory({
|
||||
name1: function (foo: any) { },
|
||||
name2: ['foo', function (foo: any) { }]
|
||||
});
|
||||
mod.filter('name', function ($scope: ng.IScope) { })
|
||||
mod.filter('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.filter(My.Namespace);
|
||||
mod.filter('name', ['$scope', function ($scope: ng.IScope) { }])
|
||||
mod.filter({
|
||||
name1: function (foo: any) { },
|
||||
name2: ['foo', function (foo: any) { }]
|
||||
});
|
||||
mod.provider('name', function ($scope: ng.IScope) { return { $get: () => { } } })
|
||||
mod.provider('name', TestProvider);
|
||||
mod.provider('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.provider(My.Namespace);
|
||||
mod.service('name', function ($scope: ng.IScope) { })
|
||||
mod.service('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.service(My.Namespace);
|
||||
mod.service({
|
||||
MyCtrl: class{},
|
||||
MyCtrl2: function() {},
|
||||
MyCtrl3: ['$fooService', function($fooService: any) { }]
|
||||
});
|
||||
mod.constant('name', 23);
|
||||
mod.constant('name', "23");
|
||||
mod.constant(My.Namespace);
|
||||
@@ -475,6 +501,8 @@ function test_angular_forEach() {
|
||||
var element = angular.element("div.myApp");
|
||||
var scope: ng.IScope = element.scope();
|
||||
var isolateScope: ng.IScope = element.isolateScope();
|
||||
isolateScope = element.find('div.foo').isolateScope();
|
||||
isolateScope = element.children().isolateScope();
|
||||
|
||||
|
||||
// $timeout signature tests
|
||||
@@ -864,9 +892,29 @@ angular.module('docsTabsExample', [])
|
||||
};
|
||||
});
|
||||
|
||||
angular.module('multiSlotTranscludeExample', [])
|
||||
.directive('dropDownMenu', function() {
|
||||
return {
|
||||
transclude: {
|
||||
button: 'button',
|
||||
list: 'ul',
|
||||
},
|
||||
link: function(scope, element, attrs, ctrl, transclude) {
|
||||
// without scope
|
||||
transclude().appendTo(element);
|
||||
transclude(clone => clone.appendTo(element));
|
||||
|
||||
// with scope
|
||||
transclude(scope, clone => clone.appendTo(element));
|
||||
transclude(scope, clone => clone.appendTo(element), element, 'button');
|
||||
transclude(scope, null, element, 'list').addClass('drop-down-list').appendTo(element);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
angular.module('componentExample', [])
|
||||
.component('counter', {
|
||||
require: ['^ctrl'],
|
||||
require: {'ctrl': '^ctrl'},
|
||||
bindings: {
|
||||
count: '='
|
||||
},
|
||||
@@ -1095,6 +1143,12 @@ function parseTyping() {
|
||||
}
|
||||
}
|
||||
|
||||
function parseWithParams() {
|
||||
var $parse: angular.IParseService;
|
||||
var compiledExp = $parse('a.b.c', () => null);
|
||||
var compiledExp = $parse('a.b.c', null, false);
|
||||
}
|
||||
|
||||
function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjectorService {
|
||||
if (mode === 'debug') {
|
||||
return angular.bootstrap(element, ['main', function($provide: ng.auto.IProvideService) {
|
||||
@@ -1102,11 +1156,11 @@ function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjector
|
||||
$delegate['debug'] = true;
|
||||
});
|
||||
}, 'debug-helpers'], {
|
||||
debugInfoEnabled: true
|
||||
strictDi: true
|
||||
});
|
||||
}
|
||||
return angular.bootstrap(element, ['main'], {
|
||||
debugInfoEnabled: false
|
||||
strictDi: false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+215
-182
@@ -27,6 +27,8 @@ import ng = angular;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare namespace angular {
|
||||
|
||||
type Injectable<T extends Function> = T | (string | T)[];
|
||||
|
||||
// not directly implemented, but ensures that constructed class implements $get
|
||||
interface IServiceProviderClass {
|
||||
new (...args: any[]): IServiceProvider;
|
||||
@@ -43,7 +45,6 @@ declare namespace angular {
|
||||
|
||||
interface IAngularBootstrapConfig {
|
||||
strictDi?: boolean;
|
||||
debugInfoEnabled?: boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -83,7 +84,7 @@ declare namespace angular {
|
||||
*
|
||||
* If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite."
|
||||
*/
|
||||
element: IAugmentedJQueryStatic;
|
||||
element: JQueryStatic;
|
||||
equals(value1: any, value2: any): boolean;
|
||||
extend(destination: any, ...sources: any[]): any;
|
||||
|
||||
@@ -121,14 +122,15 @@ declare namespace angular {
|
||||
fromJson(json: string): any;
|
||||
identity<T>(arg?: T): T;
|
||||
injector(modules?: any[], strictDi?: boolean): auto.IInjectorService;
|
||||
isArray(value: any): boolean;
|
||||
isDate(value: any): boolean;
|
||||
isArray(value: any): value is Array<any>;
|
||||
isDate(value: any): value is Date;
|
||||
isDefined(value: any): boolean;
|
||||
isElement(value: any): boolean;
|
||||
isFunction(value: any): boolean;
|
||||
isNumber(value: any): boolean;
|
||||
isObject(value: any): boolean;
|
||||
isString(value: any): boolean;
|
||||
isFunction(value: any): value is Function;
|
||||
isNumber(value: any): value is number;
|
||||
isObject(value: any): value is Object;
|
||||
isObject<T>(value: any): value is T;
|
||||
isString(value: any): value is string;
|
||||
isUndefined(value: any): boolean;
|
||||
lowercase(str: string): string;
|
||||
|
||||
@@ -158,7 +160,7 @@ declare namespace angular {
|
||||
|
||||
noop(...args: any[]): void;
|
||||
reloadWithDebugInfo(): void;
|
||||
toJson(obj: any, pretty?: boolean): string;
|
||||
toJson(obj: any, pretty?: boolean | number): string;
|
||||
uppercase(str: string): string;
|
||||
version: {
|
||||
full: string;
|
||||
@@ -216,50 +218,26 @@ declare namespace angular {
|
||||
* @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors.
|
||||
* @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation).
|
||||
*/
|
||||
controller(name: string, controllerConstructor: Function): IModule;
|
||||
/**
|
||||
* The $controller service is used by Angular to create new controllers.
|
||||
*
|
||||
* This provider allows controller registration via the register method.
|
||||
*
|
||||
* @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors.
|
||||
* @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation).
|
||||
*/
|
||||
controller(name: string, inlineAnnotatedConstructor: any[]): IModule;
|
||||
controller(object: Object): IModule;
|
||||
controller(name: string, controllerConstructor: Injectable<IControllerConstructor>): IModule;
|
||||
controller(object: {[name: string]: Injectable<IControllerConstructor>}): IModule;
|
||||
/**
|
||||
* Register a new directive with the compiler.
|
||||
*
|
||||
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
|
||||
* @param directiveFactory An injectable directive factory function.
|
||||
*/
|
||||
directive(name: string, directiveFactory: IDirectiveFactory): IModule;
|
||||
/**
|
||||
* Register a new directive with the compiler.
|
||||
*
|
||||
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
|
||||
* @param directiveFactory An injectable directive factory function.
|
||||
*/
|
||||
directive(name: string, inlineAnnotatedFunction: any[]): IModule;
|
||||
directive(object: Object): IModule;
|
||||
directive(name: string, directiveFactory: Injectable<IDirectiveFactory>): IModule;
|
||||
directive(object: {[directiveName: string]: Injectable<IDirectiveFactory>}): IModule;
|
||||
/**
|
||||
* Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
|
||||
*
|
||||
* @param name The name of the instance.
|
||||
* @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}).
|
||||
*/
|
||||
factory(name: string, $getFn: Function): IModule;
|
||||
/**
|
||||
* Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
|
||||
*
|
||||
* @param name The name of the instance.
|
||||
* @param inlineAnnotatedFunction The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}).
|
||||
*/
|
||||
factory(name: string, inlineAnnotatedFunction: any[]): IModule;
|
||||
factory(object: Object): IModule;
|
||||
filter(name: string, filterFactoryFunction: Function): IModule;
|
||||
filter(name: string, inlineAnnotatedFunction: any[]): IModule;
|
||||
filter(object: Object): IModule;
|
||||
factory(name: string, $getFn: Injectable<Function>): IModule;
|
||||
factory(object: {[name: string]: Injectable<Function>}): IModule;
|
||||
filter(name: string, filterFactoryFunction: Injectable<Function>): IModule;
|
||||
filter(object: {[name: string]: Injectable<Function>}): IModule;
|
||||
provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule;
|
||||
provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule;
|
||||
provider(name: string, inlineAnnotatedConstructor: any[]): IModule;
|
||||
@@ -268,26 +246,15 @@ declare namespace angular {
|
||||
/**
|
||||
* Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests.
|
||||
*/
|
||||
run(initializationFunction: Function): IModule;
|
||||
/**
|
||||
* Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests.
|
||||
*/
|
||||
run(inlineAnnotatedFunction: any[]): IModule;
|
||||
run(initializationFunction: Injectable<Function>): IModule;
|
||||
/**
|
||||
* Register a service constructor, which will be invoked with new to create the service instance. This is short for registering a service where its provider's $get property is a factory function that returns an instance instantiated by the injector from the service constructor function.
|
||||
*
|
||||
* @param name The name of the instance.
|
||||
* @param serviceConstructor An injectable class (constructor function) that will be instantiated.
|
||||
*/
|
||||
service(name: string, serviceConstructor: Function): IModule;
|
||||
/**
|
||||
* Register a service constructor, which will be invoked with new to create the service instance. This is short for registering a service where its provider's $get property is a factory function that returns an instance instantiated by the injector from the service constructor function.
|
||||
*
|
||||
* @param name The name of the instance.
|
||||
* @param inlineAnnotatedConstructor An injectable class (constructor function) that will be instantiated.
|
||||
*/
|
||||
service(name: string, inlineAnnotatedConstructor: any[]): IModule;
|
||||
service(object: Object): IModule;
|
||||
service(name: string, serviceConstructor: Injectable<Function>): IModule;
|
||||
service(object: {[name: string]: Injectable<Function>}): IModule;
|
||||
/**
|
||||
* Register a value service with the $injector, such as a string, a number, an array, an object or a function. This is short for registering a service where its provider's $get property is a factory function that takes no arguments and returns the value service.
|
||||
|
||||
@@ -304,8 +271,7 @@ declare namespace angular {
|
||||
* @param name The name of the service to decorate
|
||||
* @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to.
|
||||
*/
|
||||
decorator(name:string, decoratorConstructor: Function): IModule;
|
||||
decorator(name:string, inlineAnnotatedConstructor: any[]): IModule;
|
||||
decorator(name: string, decorator: Injectable<Function>): IModule;
|
||||
|
||||
// Properties
|
||||
name: string;
|
||||
@@ -390,10 +356,11 @@ declare namespace angular {
|
||||
$invalid: boolean;
|
||||
$submitted: boolean;
|
||||
$error: any;
|
||||
$name: string;
|
||||
$pending: any;
|
||||
$addControl(control: INgModelController): void;
|
||||
$removeControl(control: INgModelController): void;
|
||||
$setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController): void;
|
||||
$addControl(control: INgModelController | IFormController): void;
|
||||
$removeControl(control: INgModelController | IFormController): void;
|
||||
$setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController | IFormController): void;
|
||||
$setDirty(): void;
|
||||
$setPristine(): void;
|
||||
$commitViewValue(): void;
|
||||
@@ -614,7 +581,7 @@ declare namespace angular {
|
||||
/**
|
||||
* calling stopPropagation function will cancel further event propagation (available only for events that were $emit-ed).
|
||||
*/
|
||||
stopPropagation?: Function;
|
||||
stopPropagation?(): void;
|
||||
/**
|
||||
* calling preventDefault sets defaultPrevented flag to true.
|
||||
*/
|
||||
@@ -876,7 +843,7 @@ declare namespace angular {
|
||||
// see http://docs.angularjs.org/api/ng.$parseProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IParseService {
|
||||
(expression: string): ICompiledExpression;
|
||||
(expression: string, interceptorFn?: (value: any, scope: IScope, locals: any) => any, expensiveChecks?: boolean): ICompiledExpression;
|
||||
}
|
||||
|
||||
interface IParseProvider {
|
||||
@@ -885,6 +852,24 @@ declare namespace angular {
|
||||
|
||||
unwrapPromises(): boolean;
|
||||
unwrapPromises(value: boolean): IParseProvider;
|
||||
|
||||
/**
|
||||
* Configure $parse service to add literal values that will be present as literal at expressions.
|
||||
*
|
||||
* @param literalName Token for the literal value. The literal name value must be a valid literal name.
|
||||
* @param literalValue Value for this literal. All literal values must be primitives or `undefined`.
|
||||
**/
|
||||
addLiteral(literalName: string, literalValue: any): void;
|
||||
|
||||
/**
|
||||
* Allows defining the set of characters that are allowed in Angular expressions. The function identifierStart will get called to know if a given character is a valid character to be the first character for an identifier. The function identifierContinue will get called to know if a given character is a valid character to be a follow-up identifier character. The functions identifierStart and identifierContinue will receive as arguments the single character to be identifier and the character code point. These arguments will be string and numeric. Keep in mind that the string parameter can be two characters long depending on the character representation. It is expected for the function to return true or false, whether that character is allowed or not.
|
||||
* Since this function will be called extensivelly, keep the implementation of these functions fast, as the performance of these functions have a direct impact on the expressions parsing speed.
|
||||
*
|
||||
* @param identifierStart The function that will decide whether the given character is a valid identifier start character.
|
||||
* @param identifierContinue The function that will decide whether the given character is a valid identifier continue character.
|
||||
**/
|
||||
setIdentifierFns(identifierStart?: (character: string, codePoint: number) => boolean,
|
||||
identifierContinue?: (character: string, codePoint: number) => boolean): void;
|
||||
}
|
||||
|
||||
interface ICompiledExpression {
|
||||
@@ -970,7 +955,10 @@ declare namespace angular {
|
||||
// DocumentService
|
||||
// see http://docs.angularjs.org/api/ng.$document
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IDocumentService extends IAugmentedJQuery {}
|
||||
interface IDocumentService extends JQuery {
|
||||
// Must return intersection type for index signature compatibility with JQuery
|
||||
[index: number]: HTMLElement & Document;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ExceptionHandlerService
|
||||
@@ -1201,19 +1189,12 @@ declare namespace angular {
|
||||
// see http://docs.angularjs.org/api/ng.$compileProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ICompileService {
|
||||
(element: string, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction;
|
||||
(element: Element, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction;
|
||||
(element: JQuery, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction;
|
||||
(element: string | Element | JQuery, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction;
|
||||
}
|
||||
|
||||
interface ICompileProvider extends IServiceProvider {
|
||||
directive(name: string, directiveFactory: Function): ICompileProvider;
|
||||
directive(directivesMap: Object, directiveFactory: Function): ICompileProvider;
|
||||
directive(name: string, inlineAnnotatedFunction: any[]): ICompileProvider;
|
||||
directive(directivesMap: Object, inlineAnnotatedFunction: any[]): ICompileProvider;
|
||||
|
||||
// Undocumented, but it is there...
|
||||
directive(directivesMap: any): ICompileProvider;
|
||||
directive(name: string, directiveFactory: Injectable<IDirectiveFactory>): ICompileProvider;
|
||||
directive(object: {[directiveName: string]: Injectable<IDirectiveFactory>}): ICompileProvider;
|
||||
|
||||
component(name: string, options: IComponentOptions): ICompileProvider;
|
||||
|
||||
@@ -1223,7 +1204,8 @@ declare namespace angular {
|
||||
imgSrcSanitizationWhitelist(): RegExp;
|
||||
imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider;
|
||||
|
||||
debugInfoEnabled(enabled?: boolean): any;
|
||||
debugInfoEnabled(): boolean;
|
||||
debugInfoEnabled(enabled: boolean): ICompileProvider;
|
||||
}
|
||||
|
||||
interface ICloneAttachFunction {
|
||||
@@ -1233,15 +1215,19 @@ declare namespace angular {
|
||||
|
||||
// This corresponds to the "publicLinkFn" returned by $compile.
|
||||
interface ITemplateLinkingFunction {
|
||||
(scope: IScope, cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;
|
||||
(scope: IScope, cloneAttachFn?: ICloneAttachFunction): JQuery;
|
||||
}
|
||||
|
||||
// This corresponds to $transclude (and also the transclude function passed to link).
|
||||
/**
|
||||
* This corresponds to $transclude passed to controllers and to the transclude function passed to link functions.
|
||||
* https://docs.angularjs.org/api/ng/service/$compile#-controller-
|
||||
* http://teropa.info/blog/2015/06/09/transclusion.html
|
||||
*/
|
||||
interface ITranscludeFunction {
|
||||
// If the scope is provided, then the cloneAttachFn must be as well.
|
||||
(scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery;
|
||||
(scope: IScope, cloneAttachFn: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQuery;
|
||||
// If one argument is provided, then it's assumed to be the cloneAttachFn.
|
||||
(cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;
|
||||
(cloneAttachFn?: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQuery;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -1392,6 +1378,16 @@ declare namespace angular {
|
||||
* Absolute or relative URL of the resource that is being requested.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* Event listeners to be bound to the XMLHttpRequest object.
|
||||
* To bind events to the XMLHttpRequest upload object, use uploadEventHandlers. The handler will be called in the context of a $apply block.
|
||||
*/
|
||||
eventHandlers?: { [type: string]: EventListenerOrEventListenerObject };
|
||||
/**
|
||||
* Event listeners to be bound to the XMLHttpRequest upload object.
|
||||
* To bind events to the XMLHttpRequest object, use eventHandlers. The handler will be called in the context of a $apply block.
|
||||
*/
|
||||
uploadEventHandlers?: { [type: string]: EventListenerOrEventListenerObject };
|
||||
}
|
||||
|
||||
interface IHttpHeadersGetter {
|
||||
@@ -1519,7 +1515,7 @@ declare namespace angular {
|
||||
* Register service factories (names or implementations) for interceptors which are called before and after
|
||||
* each request.
|
||||
*/
|
||||
interceptors: (string|IHttpInterceptorFactory|(string|IHttpInterceptorFactory)[])[];
|
||||
interceptors: (string | Injectable<IHttpInterceptorFactory>)[];
|
||||
useApplyAsync(): boolean;
|
||||
useApplyAsync(value: boolean): IHttpProvider;
|
||||
|
||||
@@ -1658,50 +1654,6 @@ declare namespace angular {
|
||||
// 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)
|
||||
*/
|
||||
@@ -1711,11 +1663,10 @@ declare namespace angular {
|
||||
* controller if passed as a string. Empty function by default.
|
||||
* Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection)
|
||||
*/
|
||||
controller?: string | Function | (string | Function)[];
|
||||
controller?: string | Injectable<IControllerConstructor>;
|
||||
/**
|
||||
* 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.
|
||||
* @default "$ctrl"
|
||||
* An identifier name for a reference to the controller. If present, the controller will be published to its scope under
|
||||
* the specified name. If not present, this will default to '$ctrl'.
|
||||
*/
|
||||
controllerAs?: string;
|
||||
/**
|
||||
@@ -1726,29 +1677,91 @@ declare namespace angular {
|
||||
* $attrs - Current attributes object for the element
|
||||
* Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection)
|
||||
*/
|
||||
template?: string | Function | (string | Function)[];
|
||||
template?: string | Injectable<(...args: any[]) => string>;
|
||||
/**
|
||||
* path or function that returns a path to an html template that should be used as the contents of this component.
|
||||
* 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
|
||||
* Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection)
|
||||
*/
|
||||
templateUrl?: string | Function | (string | Function)[];
|
||||
templateUrl?: string | Injectable<(...args: any[]) => string>;
|
||||
/**
|
||||
* Define DOM attribute binding to component properties. Component properties are always bound to the component
|
||||
* controller and not to the scope.
|
||||
*/
|
||||
bindings?: {[binding: string]: string};
|
||||
bindings?: {[boundProperty: string]: string};
|
||||
/**
|
||||
* Whether transclusion is enabled. Enabled by default.
|
||||
* Whether transclusion is enabled. Disabled by default.
|
||||
*/
|
||||
transclude?: boolean | string | {[slot: string]: string};
|
||||
require?: string | string[] | {[controller: string]: string};
|
||||
transclude?: boolean | {[slot: string]: string};
|
||||
/**
|
||||
* Requires the controllers of other directives and binds them to this component's controller.
|
||||
* The object keys specify the property names under which the required controllers (object values) will be bound.
|
||||
* Note that the required controllers will not be available during the instantiation of the controller,
|
||||
* but they are guaranteed to be available just before the $onInit method is executed!
|
||||
*/
|
||||
require?: {[controller: string]: string};
|
||||
}
|
||||
|
||||
interface IComponentTemplateFn {
|
||||
( $element?: IAugmentedJQuery, $attrs?: IAttributes ): string;
|
||||
type IControllerConstructor =
|
||||
(new (...args: any[]) => IController) |
|
||||
// Instead of classes, plain functions are often used as controller constructors, especially in examples.
|
||||
((...args: any[]) => (void | IController));
|
||||
|
||||
/**
|
||||
* Directive controllers have a well-defined lifecycle. Each controller can implement "lifecycle hooks". These are methods that
|
||||
* will be called by Angular at certain points in the life cycle of the directive.
|
||||
* https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks
|
||||
* https://docs.angularjs.org/guide/component
|
||||
*/
|
||||
interface IController {
|
||||
/**
|
||||
* Called on each controller after all the controllers on an element have been constructed and had their bindings
|
||||
* initialized (and before the pre & post linking functions for the directives on this element). This is a good
|
||||
* place to put initialization code for your controller.
|
||||
*/
|
||||
$onInit?(): void;
|
||||
/**
|
||||
* Called on each turn of the digest cycle. Provides an opportunity to detect and act on changes.
|
||||
* Any actions that you wish to take in response to the changes that you detect must be invoked from this hook;
|
||||
* implementing this has no effect on when `$onChanges` is called. For example, this hook could be useful if you wish
|
||||
* to perform a deep equality check, or to check a `Dat`e object, changes to which would not be detected by Angular's
|
||||
* change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; if detecting changes,
|
||||
* you must store the previous value(s) for comparison to the current values.
|
||||
*/
|
||||
$doCheck?(): void;
|
||||
/**
|
||||
* Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound
|
||||
* properties that have changed, and the values are an {@link IChangesObject} object of the form
|
||||
* { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as
|
||||
* cloning the bound value to prevent accidental mutation of the outer value.
|
||||
*/
|
||||
$onChanges?(onChangesObj: IOnChangesObject): void;
|
||||
/**
|
||||
* Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources,
|
||||
* watches and event handlers.
|
||||
*/
|
||||
$onDestroy?(): void;
|
||||
/**
|
||||
* Called after this controller's element and its children have been linked. Similar to the post-link function this
|
||||
* hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain
|
||||
* templateUrl directives will not have been compiled and linked since they are waiting for their template to load
|
||||
* asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered
|
||||
* analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather
|
||||
* different in Angular 1 there is no direct mapping and care should be taken when upgrading.
|
||||
*/
|
||||
$postLink?(): void;
|
||||
}
|
||||
|
||||
interface IOnChangesObject {
|
||||
[property: string]: IChangesObject<any>;
|
||||
}
|
||||
|
||||
interface IChangesObject<T> {
|
||||
currentValue: T;
|
||||
previousValue: T;
|
||||
isFirstChange(): boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -1764,7 +1777,7 @@ declare namespace angular {
|
||||
interface IDirectiveLinkFn {
|
||||
(
|
||||
scope: IScope,
|
||||
instanceElement: IAugmentedJQuery,
|
||||
instanceElement: JQuery,
|
||||
instanceAttributes: IAttributes,
|
||||
controller: {},
|
||||
transclude: ITranscludeFunction
|
||||
@@ -1778,7 +1791,7 @@ declare namespace angular {
|
||||
|
||||
interface IDirectiveCompileFn {
|
||||
(
|
||||
templateElement: IAugmentedJQuery,
|
||||
templateElement: JQuery,
|
||||
templateAttributes: IAttributes,
|
||||
/**
|
||||
* @deprecated
|
||||
@@ -1787,12 +1800,12 @@ declare namespace angular {
|
||||
* that is passed to the link function instead.
|
||||
*/
|
||||
transclude: ITranscludeFunction
|
||||
): IDirectivePrePost;
|
||||
): void | IDirectiveLinkFn | IDirectivePrePost;
|
||||
}
|
||||
|
||||
interface IDirective {
|
||||
compile?: IDirectiveCompileFn;
|
||||
controller?: any;
|
||||
controller?: string | Injectable<IControllerConstructor>;
|
||||
controllerAs?: string;
|
||||
/**
|
||||
* @deprecated
|
||||
@@ -1800,10 +1813,9 @@ declare namespace angular {
|
||||
* the controller constructor is called, this use is now deprecated. Please place initialization code that
|
||||
* relies upon bindings inside a $onInit method on the controller, instead.
|
||||
*/
|
||||
bindToController?: boolean | Object;
|
||||
bindToController?: boolean | {[boundProperty: string]: string};
|
||||
link?: IDirectiveLinkFn | IDirectivePrePost;
|
||||
multiElement?: boolean;
|
||||
name?: string;
|
||||
priority?: number;
|
||||
/**
|
||||
* @deprecated
|
||||
@@ -1811,53 +1823,28 @@ declare namespace angular {
|
||||
replace?: boolean;
|
||||
require?: string | string[] | {[controller: string]: string};
|
||||
restrict?: string;
|
||||
scope?: boolean | Object;
|
||||
template?: string | Function;
|
||||
scope?: boolean | {[boundProperty: string]: string};
|
||||
template?: string | ((tElement: JQuery, tAttrs: IAttributes) => string);
|
||||
templateNamespace?: string;
|
||||
templateUrl?: string | Function;
|
||||
templateUrl?: string | ((tElement: JQuery, tAttrs: IAttributes) => string);
|
||||
terminal?: boolean;
|
||||
transclude?: boolean | string | {[slot: string]: string};
|
||||
transclude?: boolean | 'element' | {[slot: string]: string};
|
||||
}
|
||||
|
||||
/**
|
||||
* angular.element
|
||||
* when calling angular.element, angular returns a jQuery object,
|
||||
* augmented with additional methods like e.g. scope.
|
||||
* see: http://docs.angularjs.org/api/angular.element
|
||||
*/
|
||||
interface IAugmentedJQueryStatic extends JQueryStatic {
|
||||
(selector: string, context?: any): IAugmentedJQuery;
|
||||
(element: Element): IAugmentedJQuery;
|
||||
(object: {}): IAugmentedJQuery;
|
||||
(elementArray: Element[]): IAugmentedJQuery;
|
||||
(object: JQuery): IAugmentedJQuery;
|
||||
(func: Function): IAugmentedJQuery;
|
||||
(array: any[]): IAugmentedJQuery;
|
||||
(): IAugmentedJQuery;
|
||||
}
|
||||
|
||||
interface IAugmentedJQuery extends JQuery {
|
||||
// TODO: events, how to define?
|
||||
//$destroy
|
||||
|
||||
find(selector: string): IAugmentedJQuery;
|
||||
find(element: any): IAugmentedJQuery;
|
||||
find(obj: JQuery): IAugmentedJQuery;
|
||||
controller(): any;
|
||||
controller(name: string): any;
|
||||
injector(): any;
|
||||
scope(): IScope;
|
||||
|
||||
/**
|
||||
* Overload for custom scope interfaces
|
||||
* These interfaces are kept for compatibility with older versions of these type definitions.
|
||||
* Actually, Angular doesn't create a special subclass of jQuery objects. It extends jQuery.prototype
|
||||
* like jQuery plugins do, that's why all jQuery objects have these Angular-specific methods, not
|
||||
* only those returned from angular.element.
|
||||
* See: http://docs.angularjs.org/api/angular.element
|
||||
*/
|
||||
scope<T extends IScope>(): T;
|
||||
isolateScope(): IScope;
|
||||
interface IAugmentedJQueryStatic extends JQueryStatic {}
|
||||
interface IAugmentedJQuery extends JQuery {}
|
||||
|
||||
inheritedData(key: string, value: any): JQuery;
|
||||
inheritedData(obj: { [key: string]: any; }): JQuery;
|
||||
inheritedData(key?: string): any;
|
||||
}
|
||||
/**
|
||||
* Same as IController. Keeping it for compatibility with older versions of these type definitions.
|
||||
*/
|
||||
interface IComponentController extends IController {}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AUTO module (angular.js)
|
||||
@@ -1872,6 +1859,33 @@ declare namespace angular {
|
||||
annotate(fn: Function, strictDi?: boolean): string[];
|
||||
annotate(inlineAnnotatedFunction: any[]): string[];
|
||||
get<T>(name: string, caller?: string): T;
|
||||
get(name: '$anchorScroll'): IAnchorScrollService
|
||||
get(name: '$cacheFactory'): ICacheFactoryService
|
||||
get(name: '$compile'): ICompileService
|
||||
get(name: '$controller'): IControllerService
|
||||
get(name: '$document'): IDocumentService
|
||||
get(name: '$exceptionHandler'): IExceptionHandlerService
|
||||
get(name: '$filter'): IFilterService
|
||||
get(name: '$http'): IHttpService
|
||||
get(name: '$httpBackend'): IHttpBackendService
|
||||
get(name: '$httpParamSerializer'): IHttpParamSerializer
|
||||
get(name: '$httpParamSerializerJQLike'): IHttpParamSerializer
|
||||
get(name: '$interpolate'): IInterpolateService
|
||||
get(name: '$interval'): IIntervalService
|
||||
get(name: '$locale'): ILocaleService
|
||||
get(name: '$location'): ILocationService
|
||||
get(name: '$log'): ILogService
|
||||
get(name: '$parse'): IParseService
|
||||
get(name: '$q'): IQService
|
||||
get(name: '$rootElement'): IRootElementService
|
||||
get(name: '$rootScope'): IRootScopeService
|
||||
get(name: '$sce'): ISCEService
|
||||
get(name: '$sceDelegate'): ISCEDelegateService
|
||||
get(name: '$templateCache'): ITemplateCacheService
|
||||
get(name: '$templateRequest'): ITemplateRequestService
|
||||
get(name: '$timeout'): ITimeoutService
|
||||
get(name: '$window'): IWindowService
|
||||
get<T>(name: '$xhrFactory'): IXhrFactory<T>
|
||||
has(name: string): boolean;
|
||||
instantiate<T>(typeConstructor: Function, locals?: any): T;
|
||||
invoke(inlineAnnotatedFunction: any[]): any;
|
||||
@@ -1932,3 +1946,22 @@ declare namespace angular {
|
||||
(obj: Object): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface JQuery {
|
||||
// TODO: events, how to define?
|
||||
//$destroy
|
||||
|
||||
find(element: any): JQuery;
|
||||
find(obj: JQuery): JQuery;
|
||||
controller(name?: string): any;
|
||||
injector(): ng.auto.IInjectorService;
|
||||
/** It's declared generic for custom scope interfaces */
|
||||
scope<T extends ng.IScope>(): T;
|
||||
isolateScope<T extends ng.IScope>(): T;
|
||||
|
||||
inheritedData(key: string, value: any): JQuery;
|
||||
inheritedData(obj: { [key: string]: any; }): JQuery;
|
||||
inheritedData(key?: string): any;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -886,7 +886,7 @@ declare namespace angular {
|
||||
// see http://docs.angularjs.org/api/ng.$parseProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IParseService {
|
||||
(expression: string): ICompiledExpression;
|
||||
(expression: string, interceptorFn?: (value: any, scope: IScope, locals: any) => any, expensiveChecks?: boolean): ICompiledExpression;
|
||||
}
|
||||
|
||||
interface IParseProvider {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user