This commit is contained in:
Jeongho Nam
2016-08-12 09:48:08 +09:00
34 changed files with 3635 additions and 2175 deletions
+5 -4
View File
@@ -1,6 +1,7 @@
/// <reference path="angular-ui-router.d.ts" />
var myApp = angular.module('testModule');
import uiRouterModule from "angular-ui-router";
var myApp = angular.module("testModule", [uiRouterModule]);
interface MyAppScope extends ng.IScope {
items: string[];
@@ -141,7 +142,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
private $state: ng.ui.IStateService
) {
$rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event));
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
this.onStateNotFound(event, unfoundState, fromState, fromParams));
}
@@ -164,14 +165,14 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
});
}
}
private onStateNotFound(event: ng.IAngularEvent,
unfoundState: ng.ui.IUnfoundState,
fromState: ng.ui.IState,
fromParams: {}) {
var unfoundTo: string = unfoundState.to;
var unfoundToParams: {} = unfoundState.toParams;
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
}
private stateServiceTest() {
+2 -8
View File
@@ -7,13 +7,7 @@
// Support for AMD require and CommonJS
declare module 'angular-ui-router' {
// Since angular-ui-router adds providers for a bunch of
// injectable dependencies, it doesn't really return any
// actual data except the plain string 'ui.router'.
//
// As such, I don't think anybody will ever use the actual
// default value of the module. So I've only included the
// the types. (@xogeny)
export default "ui.router";
export type IState = angular.ui.IState;
export type IStateProvider = angular.ui.IStateProvider;
export type IUrlMatcher = angular.ui.IUrlMatcher;
@@ -109,7 +103,7 @@ declare namespace angular.ui {
toParams: {},
options: IStateOptions
}
interface IStateProvider extends angular.IServiceProvider {
state(name:string, config:IState): IStateProvider;
state(config:IState): IStateProvider;
+1 -1
View File
@@ -329,7 +329,7 @@ declare module "aws-sdk" {
interface _DDBDC_Generic {
TableName: string;
ExpressionAttributeNames?: string[];
ExpressionAttributeNames?: { [someKey: string]: string };
ReturnConsumedCapacity?: "INDEXES" | "TOTAL" | "NONE";
}
Vendored
+1 -1
View File
@@ -747,7 +747,7 @@ declare namespace c3 {
/**
* The radius size of each point.
*/
r?: number;
r?: number | ((d: any) => number);
focus?: {
expand: {
+18 -18
View File
@@ -16,10 +16,10 @@ declare module "cassandra-driver" {
namespace policies {
namespace addressResolution {
var EC2MultiRegionTranslator: EC2MultiRegionTranslatorStatic;
var EC2MultiRegionTranslator: EC2MultiRegionTranslatorStatic;
interface AddressTranslator {
translate(address: string, port: number, callback: Callback): void;
translate(address: string, port: number, callback: Callback): void;
}
interface EC2MultiRegionTranslatorStatic {
@@ -141,7 +141,7 @@ declare module "cassandra-driver" {
var Tuple: TupleStatic;
var Uuid: UuidStatic;
enum consistencies {
enum consistencies {
any = 0,
one,
two,
@@ -154,7 +154,7 @@ declare module "cassandra-driver" {
localSerial,
localOne
}
enum dataTypes {
custom = 0,
ascii,
@@ -204,7 +204,7 @@ declare module "cassandra-driver" {
fromString(value: string): BigDecimal;
fromNumber(value: number): BigDecimal;
}
interface BigDecimal {
equals(other: BigDecimal): boolean;
inspect(): string;
@@ -239,7 +239,7 @@ declare module "cassandra-driver" {
interface IntegerStatic {
new(bits: Array<number>, sign: number): Integer;
fromInt(value: number): Integer;
fromNumber(value: number): Integer;
fromBits(bits: Array<number>): Integer;
@@ -295,7 +295,7 @@ declare module "cassandra-driver" {
fromString(value: string): LocalDate;
fromBuffer(buffer: Buffer): LocalDate;
}
interface LocalDate {
_value: number;
year: number;
@@ -384,7 +384,7 @@ declare module "cassandra-driver" {
interface TimeUuidStatic {
new (value?: Date, ticks?: number, nodeId?: string|Buffer, clockId?: string|Buffer): TimeUuid;
fromDate(date: Date, ticks?: number, nodeId?: string|Buffer, clockId?: string|Buffer): TimeUuid;
fromString(value: string): TimeUuid;
min(date: Date, ticks?: number): TimeUuid;
@@ -408,7 +408,7 @@ declare module "cassandra-driver" {
interface Tuple {
elements: Array<any>;
length: number;
get(index: number): any;
toString(): string;
toJSON(): string;
@@ -513,7 +513,7 @@ declare module "cassandra-driver" {
execute(query: string, params?: any, options?: QueryOptions, callback?: ResultCallback): void;
getReplicas(keyspace: string, token: Buffer): Array<any>; // TODO: Should this be a more explicit return?
shutdown(callback?: Callback): void;
stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): void;
stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): NodeJS.ReadableStream;
}
interface HostStatic {
@@ -549,7 +549,7 @@ declare module "cassandra-driver" {
}
interface EncoderStatic {
new(protocolVersion: number, options: ClientOptions) : Encoder;
new(protocolVersion: number, options: ClientOptions) : Encoder;
}
interface Encoder {
@@ -590,29 +590,29 @@ declare module "cassandra-driver" {
}
class ArgumentError extends DriverError {
constructor(message: string);
constructor(message: string);
}
class AuthenticationError extends DriverError {
constructor(message: string);
constructor(message: string);
}
class DriverInternalError extends DriverError {
constructor(message: string);
constructor(message: string);
}
class NoHostAvailableError extends DriverError {
constructor(innerErrors: any, message?: string);
constructor(innerErrors: any, message?: string);
}
class NotSupportedError extends DriverError {
constructor(message: string);
constructor(message: string);
}
class OperationTimedOutError extends DriverError {}
class ResponseError extends DriverError {
constructor(code: number, message: string);
constructor(code: number, message: string);
}
}
@@ -688,7 +688,7 @@ declare module "cassandra-driver" {
interface IndexStatic {
new (name: string, target: string, kind: IndexType, options: Object): Index;
fromRows(indexRows: Array<types.Row>): Array<Index>;
fromColumnRows(columnRows: Array<types.Row>, columnsByName: { [key:string]: ColumnInfo }): Array<Index>;
}
@@ -985,3 +985,15 @@ app.on('ready', function () {
console.log(webContents.getAllWebContents());
console.log(webContents.getFocusedWebContents());
var win = new BrowserWindow({
webPreferences: {
offscreen: true
}
});
win.webContents.on('paint', (event, dirty, image) => {
console.log(dirty, image.getBitmap());
});
win.loadURL('http://github.com');
+99 -12
View File
@@ -1,4 +1,4 @@
// Type definitions for Electron v1.3.2
// Type definitions for Electron v1.3.3
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -299,13 +299,13 @@ declare namespace Electron {
* Note: This is only implemented on macOS and Windows.
* On macOS, you can only register protocols that have been added to your app's info.plist.
*/
setAsDefaultProtocolClient(protocol: string): void;
setAsDefaultProtocolClient(protocol: string): boolean;
/**
* Removes the current executable as the default handler for a protocol (aka URI scheme).
*
* Note: This is only implemented on macOS and Windows.
*/
removeAsDefaultProtocolClient(protocol: string): void;
removeAsDefaultProtocolClient(protocol: string): boolean;
/**
* @returns Whether the current executable is the default handler for a protocol (aka URI scheme).
*
@@ -317,7 +317,7 @@ declare namespace Electron {
*
* Note: This API is only available on Windows.
*/
setUserTasks(tasks: Task[]): void;
setUserTasks(tasks: Task[]): boolean;
/**
* This method makes your application a Single Instance Application instead of allowing
* multiple instances of your app to run, this will ensure that only a single instance
@@ -349,6 +349,8 @@ declare namespace Electron {
getCurrentActivityType(): string;
/**
* Changes the Application User Model ID to id.
*
* Note: This is only implemented on Windows.
*/
setAppUserModelId(id: string): void;
/**
@@ -807,6 +809,10 @@ declare namespace Electron {
* @returns Whether the window is focused.
*/
isFocused(): boolean;
/**
* @returns Whether the window is destroyed.
*/
isDestroyed(): boolean;
/**
* Shows and gives focus to the window.
*/
@@ -877,6 +883,14 @@ declare namespace Electron {
* @returns The window's width, height, x and y values.
*/
getBounds(): Rectangle;
/**
* Resizes and moves the window's client area (e.g. the web page) to width, height, x, y.
*/
setContentBounds(options: Rectangle, animate?: boolean): void;
/**
* @returns The window's client area (e.g. the web page) width, height, x and y values.
*/
getContentBounds(): Rectangle;
/**
* Resizes the window to width and height.
*/
@@ -1101,7 +1115,13 @@ declare namespace Electron {
* @param progress Valid range is [0, 1.0]. If < 0, the progress bar is removed.
* If greater than 0, it becomes indeterminate.
*/
setProgressBar(progress: number): void;
setProgressBar(progress: number, options?: {
/**
* Mode for the progress bar.
* Note: This is only implemented on Windows.
*/
mode: 'none' | 'normal' | 'indeterminate' | 'error' | 'paused'
}): void;
/**
* Sets a 16px overlay onto the current Taskbar icon, usually used to convey
* some sort of application status or to passively notify the user.
@@ -1136,7 +1156,12 @@ declare namespace Electron {
*
* Note: This API is available only on Windows.
*/
setThumbnailClip(region: Rectangle): void;
setThumbnailClip(region: Rectangle): boolean;
/**
* Sets the toolTip that is displayed when hovering over the window thumbnail in the taskbar.
* Note: This API is available only on Windows.
*/
setThumbnailToolTip(toolTip: string): boolean;
/**
* Same as webContents.showDefinitionForSelection().
* Note: This API is available only on macOS.
@@ -1379,9 +1404,14 @@ declare namespace Electron {
defaultEncoding?: string;
/**
* Whether to throttle animations and timers when the page becomes background.
* Default: true
* Default: true.
*/
backgroundThrottling?: boolean;
/**
* Whether to enable offscreen rendering for the browser window.
* Default: false.
*/
offscreen?: boolean;
}
interface BrowserWindowOptions {
@@ -2266,8 +2296,8 @@ declare namespace Electron {
}
type MenuItemType = 'normal' | 'separator' | 'submenu' | 'checkbox' | 'radio';
type MenuItemRole = 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteandmatchstyle' | 'selectall' | 'delete' | 'minimize' | 'close' | 'quit' | 'togglefullscreen';
type MenuItemRoleMac = 'about' | 'hide' | 'hideothers' | 'unhide' | 'front' | 'zoom' | 'window' | 'help' | 'services';
type MenuItemRole = 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteandmatchstyle' | 'selectall' | 'delete' | 'minimize' | 'close' | 'quit' | 'togglefullscreen' | 'resetzoom' | 'zoomin' | 'zoomout';
type MenuItemRoleMac = 'about' | 'hide' | 'hideothers' | 'unhide' | 'startspeaking' | 'stopspeaking' | 'front' | 'zoom' | 'window' | 'help' | 'services';
interface MenuItemOptions {
/**
@@ -2458,9 +2488,17 @@ declare namespace Electron {
*/
toJPEG(quality: number): Buffer;
/**
* @returns Buffer that contains the image's raw pixel data.
* @returns Buffer that contains a copy of the image's raw bitmap pixel data.
*/
toBitmap(): Buffer;
/**
* @returns Buffer that contains the image's raw bitmap pixel data.
*
* The difference between getBitmap() and toBitmap() is, getBitmap() does not copy the bitmap data,
* so you have to use the returned Buffer immediately in current event loop tick,
* otherwise the data might be changed or destroyed.
*/
getBitmap(): Buffer;
/**
* @returns string The data URL of the image.
*/
@@ -3336,6 +3374,26 @@ declare namespace Electron {
* Note: This is only implemented on macOS.
*/
isDarkMode(): boolean;
/**
* @returns If the Swipe between pages setting is on.
*
* Note: This is only implemented on macOS.
*/
isSwipeTrackingFromScrollEventsEnabled(): boolean;
/**
* Posts event as native notifications of macOS.
* The userInfo contains the user information dictionary sent along with the notification.
*
* Note: This is only implemented on macOS.
*/
postNotification(event: string, userInfo: Object): void;
/**
* Posts event as native notifications of macOS.
* The userInfo contains the user information dictionary sent along with the notification.
*
* Note: This is only implemented on macOS.
*/
postLocalNotification(event: string, userInfo: Object): void;
/**
* Subscribes to native notifications of macOS, callback will be called when the corresponding event happens.
* The id of the subscriber is returned, which can be used to unsubscribe the event.
@@ -3722,9 +3780,9 @@ declare namespace Electron {
*/
on(event: 'select-bluetooth-device', listener: (event: Event, deviceList: BluetoothDevice[], callback: (deviceId: string) => void) => void): this;
/**
* Emitted when a page's view is repainted.
* Emitted when a new frame is generated. Only the dirty area is passed in the buffer.
*/
on(event: 'view-painted', listener: Function): this;
on(event: 'paint', listener: (event: Event, dirtyRect: Rectangle, image: NativeImage) => void): this;
on(event: string, listener: Function): this;
/**
* Loads the url in the window.
@@ -4023,6 +4081,31 @@ declare namespace Electron {
* Note: This API is available only on macOS.
*/
showDefinitionForSelection(): void;
/**
* @returns Whether offscreen rendering is enabled.
*/
isOffscreen(): boolean;
/**
* If offscreen rendering is enabled and not painting, start painting.
*/
startPainting(): void;
/**
* If offscreen rendering is enabled and painting, stop painting.
*/
stopPainting(): void;
/**
* If offscreen rendering is enabled returns whether it is currently painting.
*/
isPainting(): boolean;
/**
* If offscreen rendering is enabled sets the frame rate to the specified number.
* Only values between 1 and 60 are accepted.
*/
setFrameRate(fps: number): void;
/**
* If offscreen rendering is enabled returns the current frame rate.
*/
getFrameRate(): number;
/**
* Sets the item as dragging item for current drag-drop operation.
*/
@@ -4679,6 +4762,10 @@ declare namespace Electron {
* @returns The title of guest page.
*/
getTitle(): string;
/**
* @returns Whether the web page is destroyed.
*/
isDestroyed(): boolean;
/**
* @returns Whether guest page is still loading resources.
*/
+1635 -2109
View File
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,214 @@
/// <reference path="./inversify-inject-decorators.d.ts" />
/// <reference path="../inversify/inversify.d.ts" />
import getDecorators from "inversify-inject-decorators";
import { Kernel, injectable, tagged, named } from "inversify";
module lazyInject {
let kernel = new Kernel();
let { lazyInject } = getDecorators(kernel);
let TYPES = { Weapon: "Weapon" };
interface Weapon {
name: string;
durability: number;
use(): void;
}
@injectable()
class Sword implements Weapon {
public name: string;
public durability: number;
public constructor() {
this.durability = 100;
this.name = "Sword";
}
public use() {
this.durability = this.durability - 10;
}
}
class Warrior {
@lazyInject(TYPES.Weapon)
public weapon: Weapon;
}
kernel.bind<Weapon>(TYPES.Weapon).to(Sword);
let warrior = new Warrior();
console.log(warrior.weapon instanceof Sword); // true
}
module lazyInjectNamed {
let kernel = new Kernel();
let { lazyInjectNamed } = getDecorators(kernel);
let TYPES = { Weapon: "Weapon" };
interface Weapon {
name: string;
durability: number;
use(): void;
}
@injectable()
class Sword implements Weapon {
public name: string;
public durability: number;
public constructor() {
this.durability = 100;
this.name = "Sword";
}
public use() {
this.durability = this.durability - 10;
}
}
@injectable()
class Shuriken implements Weapon {
public name: string;
public durability: number;
public constructor() {
this.durability = 100;
this.name = "Shuriken";
}
public use() {
this.durability = this.durability - 10;
}
}
class Warrior {
@lazyInjectNamed(TYPES.Weapon, "not-throwwable")
@named("not-throwwable")
public primaryWeapon: Weapon;
@lazyInjectNamed(TYPES.Weapon, "throwwable")
@named("throwwable")
public secondaryWeapon: Weapon;
}
kernel.bind<Weapon>(TYPES.Weapon).to(Sword).whenTargetNamed("not-throwwable");
kernel.bind<Weapon>(TYPES.Weapon).to(Shuriken).whenTargetNamed("throwwable");
let warrior = new Warrior();
console.log(warrior.primaryWeapon instanceof Sword); // true
console.log(warrior.primaryWeapon instanceof Shuriken); // true
}
module lazyInjectTagged {
let kernel = new Kernel();
let { lazyInjectTagged } = getDecorators(kernel);
let TYPES = { Weapon: "Weapon" };
interface Weapon {
name: string;
durability: number;
use(): void;
}
@injectable()
class Sword implements Weapon {
public name: string;
public durability: number;
public constructor() {
this.durability = 100;
this.name = "Sword";
}
public use() {
this.durability = this.durability - 10;
}
}
@injectable()
class Shuriken implements Weapon {
public name: string;
public durability: number;
public constructor() {
this.durability = 100;
this.name = "Shuriken";
}
public use() {
this.durability = this.durability - 10;
}
}
class Warrior {
@lazyInjectTagged(TYPES.Weapon, "throwwable", false)
@tagged("throwwable", false)
public primaryWeapon: Weapon;
@lazyInjectTagged(TYPES.Weapon, "throwwable", true)
@tagged("throwwable", true)
public secondaryWeapon: Weapon;
}
kernel.bind<Weapon>(TYPES.Weapon).to(Sword).whenTargetTagged("throwwable", false);
kernel.bind<Weapon>(TYPES.Weapon).to(Shuriken).whenTargetTagged("throwwable", true);
let warrior = new Warrior();
console.log(warrior.primaryWeapon instanceof Sword); // true
console.log(warrior.primaryWeapon instanceof Shuriken); // true
}
module lazyMultiInject {
let kernel = new Kernel();
let { lazyMultiInject } = getDecorators(kernel);
let TYPES = { Weapon: "Weapon" };
interface Weapon {
name: string;
durability: number;
use(): void;
}
@injectable()
class Sword implements Weapon {
public name: string;
public durability: number;
public constructor() {
this.durability = 100;
this.name = "Sword";
}
public use() {
this.durability = this.durability - 10;
}
}
@injectable()
class Shuriken implements Weapon {
public name: string;
public durability: number;
public constructor() {
this.durability = 100;
this.name = "Shuriken";
}
public use() {
this.durability = this.durability - 10;
}
}
class Warrior {
@lazyMultiInject(TYPES.Weapon)
public weapons: Weapon[];
}
kernel.bind<Weapon>(TYPES.Weapon).to(Sword);
kernel.bind<Weapon>(TYPES.Weapon).to(Shuriken);
let warrior = new Warrior();
console.log(warrior.weapons[0] instanceof Sword); // true
console.log(warrior.weapons[1] instanceof Shuriken); // true
}
@@ -0,0 +1,32 @@
// Type definitions for inversify-inject-decorators 1.0.0-beta.1
// Project: https://github.com/inversify/inversify-inject-decorators
// Definitions by: inversify <https://github.com/inversify/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../inversify/inversify.d.ts" />
declare namespace inversifyInjectDecorators {
interface InjectDecorators {
lazyInject: (serviceIdentifier: (string|Symbol|inversify.interfaces.Newable<any>)) =>
(proto: any, key: string) => void;
lazyInjectNamed: (serviceIdentifier: (string|Symbol|inversify.interfaces.Newable<any>), named: string) =>
(proto: any, key: string) => void;
lazyInjectTagged: (serviceIdentifier: (string|Symbol|inversify.interfaces.Newable<any>), key: string, value: any) =>
(proto: any, propertyName: string) => void;
lazyMultiInject: (serviceIdentifier: (string|Symbol|inversify.interfaces.Newable<any>)) =>
(proto: any, key: string) => void;
}
export function getDecorators(kernel: inversify.interfaces.Kernel): InjectDecorators;
}
declare module "inversify-inject-decorators" {
export default inversifyInjectDecorators.getDecorators;
}
+6
View File
@@ -0,0 +1,6 @@
/// <reference path="jsonschema.d.ts" />
import { Validator, IJSONSchemaValidationError } from "jsonschema";
const v: Validator = new Validator();
const validationResults: { errors: Array<IJSONSchemaValidationError> } = v.validate("Smith", {"type": "string"});
+103
View File
@@ -0,0 +1,103 @@
// Type definitions for jsonschema
// Project: https://github.com/tdegrunt/jsonschema
// Definitions by: Vlado Tešanovic <https://github.com/vladotesanovic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "jsonschema" {
export interface IJSONSchemaResult {
errors: Array<IJSONSchemaValidationError>;
instance: any;
arguments: Array<{}>;
propertyPath: string;
name: string;
schema: {};
throwError: any;
disableFormat: boolean;
}
export interface IJSONSchemaValidationError {
message: string;
property: string;
stack: string;
schema: {};
name: string;
instance: any;
argument: {};
}
export interface IJSONSchemaOptions {
propertyName?: string;
base?: string;
}
/**
* How to;
*
* const v: Validator = new Validator();
*
* const schema: {} = {
* "type": "object",
* "properties": {
* "key": {
* "type": "string",
* "required": true
* },
* "value": {
* "type": "string",
* "required": true
* }
* }
* };
*
* const validationResults: { errors: Array<IJSONSchemaValidationError> } =
* v.validate({ key: "Name", value: "A10" }, {"type": "string"});
*
*/
export class Validator {
/**
* Creates a new Validator object
* @name Validator
* @constructor
*/
new(): this;
/**
* Validates instance against the provided schema
* @param instance
* @param schema
* @param [options]
* @param [ctx]
* @return {Array}
*/
validate(instance: any, schema: {}, options?: IJSONSchemaOptions, ctx?: {}): IJSONSchemaResult;
/**
* Adds a schema with a certain urn to the Validator instance.
* @param schema
* @param urn
* @return {Object}
*/
addSchema(schema: {}, urn: string): {};
/**
* Add Sub schema to existing one
* @param baseuri
* @param schema
*/
addSubSchema(baseuri: string, schema: {}): {}
/**
* Sets all the schemas of the Validator instance.
* @param schemas
*/
setSchemas (schemas: Array<{}>): void;
/**
* Returns the schema of a certain urn
* @param urn
*/
getSchema(urn: string): {};
}
}
+12
View File
@@ -78,6 +78,18 @@ var knex = Knex({
client: 'pg'
});
// searchPath
var knex = Knex({
client: 'pg',
searchPath: 'public',
});
// useNullAsDefault
var knex = Knex({
client: 'sqlite',
useNullAsDefault: true,
});
knex('books').insert({title: 'Test'}).returning('*').toString();
// Migrations
+2
View File
@@ -454,6 +454,8 @@ declare module "knex" {
pool?: PoolConfig;
migrations?: MigratorConfig;
acquireConnectionTimeout?: number;
useNullAsDefault?: boolean;
searchPath?: string;
}
interface ConnectionConfig {
@@ -0,0 +1,10 @@
/// <reference path="../leaflet/leaflet.d.ts" />
/// <reference path="leaflet-geocoder-mapzen.d.ts" />
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}),
map = new L.Map('map', {layers: [osm], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 });
// Add geocoding plugin
L.control.geocoder('search-MKZrG6M').addTo(map);
+177
View File
@@ -0,0 +1,177 @@
// Type definitions for leaflet-geocoder-mapzen v1.6.3
// Project: https://github.com/mapzen/leaflet-geocoder
// Definitions by: Leonard Lausen <http://leonard.lausen.nl/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../leaflet/leaflet.d.ts" />
declare namespace L {
namespace Control {
export interface GeocoderStatic extends ClassStatic {
/**
* Creates a geocoder control.
*/
new (options?: GeocoderOptions): Geocoder;
}
export interface Geocoder extends L.Control {
}
export interface GeocoderOptions {
/**
* Host endpoint for a Pelias-compatible search API.
*
* Default value: 'https://search.mapzen.com/v1'.
*/
url?: string;
/**
* If true, search is bounded by the current map view.
* You may also provide a custom bounding box in form of a LatLngBounds object.
* Note: bounds is not supported by autocomplete.
*
* Default value: false.
*/
bounds?: LatLngBounds | boolean;
/**
* If true, search and autocomplete prioritizes results near the center
* of the current view.
* You may also provide a custom LatLng value
* (in any of the accepted Leaflet formats) to act as the center bias.
*
* Default value: 'true'.
*/
focus?: LatLng | boolean;
/**
* Filters results by layers (documentation).
* If left blank, results will come from all available layers.
*
* Default value: null.
*/
layers?: string | any[] ;
/**
* An object of key-value pairs which will be serialized
* into query parameters that will be passed to the API.
* This allows custom queries that are not already supported
* by the convenience options listed above.
* For a full list of supported parameters,
* please read the Mapzen Search documentation.
*
* IMPORTANT: some parameters only work with the /search endpoint,
* and do not apply to /autocomplete requests!
* All supplied parameters are passed through;
* this library doesn't know which are valid parameters and which are not.
* In the event that other options conflict with parameters passed through params,
* the params option takes precedence.
*
* Default value: null.
*/
params?: Object;
/**
* The position of the control (one of the map corners).
* Can be 'topleft', 'topright', 'bottomleft', or 'bottomright'.
*
* Default value: 'topleft'.
*/
position?: PositionString;
/**
* Attribution text to include.
* Set to blank or null to disable.
*
* Default value: 'Geocoding by <a href="https://mapzen.com/projects/search/">Mapzen</a>'
*/
attribution?: string;
/**
* Placeholder text to display in the search input box.
* Set to blank or null to disable.
*
* Default value: 'Search'
*/
placeholder?: string;
/**
* Tooltip text to display on the search icon. Set to blank or null to disable.
*
* Default value: 'Search'
*/
title?: string;
/**
* If true, highlighting a search result pans the map to that location.
*
* Default value: true
*/
panToPoint?: boolean;
/**
* If true, an icon is used to indicate a polygonal result,
* matching any non-"venue" or non-"address" layer type.
* If false, no icon is displayed.
* For custom icons, pass a string containing a path to the image.
*
* Default value: true
*/
polygonIcon?: boolean | string;
/**
* If true, search results drops Leaflet's default blue markers onto the map.
* You may customize this marker's appearance and
* behavior using Leaflet marker options.
*
* Default value: true
*/
markers?: MarkerOptions | boolean;
/**
* If true, the input box will expand to take up the full width of the map container.
* If an integer breakpoint is provided,
* the full width applies only if the map container width is below this breakpoint.
*
* Default value: 650
*/
fullWidth?: number | boolean;
/**
* If true, the search input is always expanded.
* It does not collapse into a button-only state.
*
* Default value: false
*/
expanded?: boolean;
/**
* If true, suggested results are fetched on each keystroke.
* If false, this is disabled and users must obtain results
* by pressing the Enter key after typing in their query.
*
* Default value: true
*/
autocomplete?: boolean;
/**
* If true, selected results will make a request to the service /place endpoint.
* If false, this is disabled.
* The geocoder does not handle responses to /place,
* you will need to do handle it yourself in the results event listener (see below).
*
* Default value: false
*/
place?: boolean;
}
}
export namespace control {
/**
* Creates a geocoder control.
*/
export function geocoder(api_key: string, options?: Control.GeocoderOptions): L.Control.Geocoder;
}
}
@@ -0,0 +1,8 @@
/// <reference path="../googlemaps/google.maps.d.ts" />
/// <reference path='./marker-animate-unobtrusive.d.ts' />
import SlidingMarker = require('SlidingMarker');
import MarkerWithGhost = require('MarkerWithGhost');
SlidingMarker.initializeGlobally();
MarkerWithGhost.initializeGlobally();
@@ -0,0 +1,50 @@
/// <reference path="../googlemaps/google.maps.d.ts" />
/// <reference path='./marker-animate-unobtrusive.d.ts' />
function test_init() {
SlidingMarker.initializeGlobally();
MarkerWithGhost.initializeGlobally();
}
function test_options() {
var options: SlidingMarkerOptions = {
position: new google.maps.LatLng(0, 0),
easing: "easeInOutSine",
duration: 1000,
animateFunctionAdapter: (marker, destPoint, easing, duration) => {}
};
var m = new SlidingMarker(options);
var g = new MarkerWithGhost(options);
}
function test_sliding_marker() {
let googleMarker: google.maps.Marker;
let p: google.maps.LatLng;
let d: number;
let e:jQuery.easing.IEasingType;
var m = new SlidingMarker();
googleMarker = m;
p = m.getPosition();
m.setDuration(d);
d = m.getDuration();
m.setEasing(e);
e = m.getEasing();
p = m.getAnimationPosition();
m.setPositionNotAnimated(p);
}
function test_marker_with_ghost() {
let p: google.maps.LatLng;
let d: number;
let e:jQuery.easing.IEasingType;
let slidingMarker: SlidingMarker;
var g = new MarkerWithGhost();
slidingMarker = g;
g.setGhostPosition(p);
p = g.getGhostPosition();
p = g.getGhostAnimationPosition();
}
@@ -0,0 +1,72 @@
// Type definitions for marker-animate-unobtrusive 0.2.8
// Project: https://github.com/terikon/marker-animate-unobtrusive
// Definitions by: Roman Viskin <https://github.com/viskin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../googlemaps/google.maps.d.ts" />
declare namespace jQuery.easing {
type IEasingType =
'swing' |
'easeInQuad' |
'easeOutQuad' |
'easeInOutQuad' |
'easeInCubic' |
'easeOutCubic' |
'easeInOutCubic' |
'easeInQuart' |
'easeOutQuart' |
'easeInOutQuart' |
'easeInQuint' |
'easeOutQuint' |
'easeInOutQuint' |
'easeInSine' |
'easeOutSine' |
'easeInOutSine' |
'easeInExpo' |
'easeOutExpo' |
'easeInOutExpo' |
'easeInCirc' |
'easeOutCirc' |
'easeInOutCirc' |
'easeInElastic' |
'easeOutElastic' |
'easeInOutElastic' |
'easeInBack' |
'easeOutBack' |
'easeInOutBack' |
'easeInBounce' |
'easeOutBounce' |
'easeInOutBounce';
}
interface SlidingMarkerOptions extends google.maps.MarkerOptions {
easing?: jQuery.easing.IEasingType,
duration?: number,
animateFunctionAdapter?: (marker: google.maps.Marker, destPoint: google.maps.LatLng, easing: 'linear' | jQuery.easing.IEasingType, duration: number) => void
}
declare class SlidingMarker extends google.maps.Marker {
static initializeGlobally(): void;
constructor(opts?: SlidingMarkerOptions);
setDuration(duration: number): void;
getDuration(): number;
setEasing(easing: jQuery.easing.IEasingType): void;
getEasing(): jQuery.easing.IEasingType;
getAnimationPosition(): google.maps.LatLng;
setPositionNotAnimated(position: google.maps.LatLng | google.maps.LatLngLiteral): void;
}
declare class MarkerWithGhost extends SlidingMarker {
setGhostPosition(ghostPosition: google.maps.LatLng | google.maps.LatLngLiteral): void;
getGhostPosition(): google.maps.LatLng;
getGhostAnimationPosition(): google.maps.LatLng;
}
declare module "SlidingMarker" {
export = SlidingMarker;
}
declare module "MarkerWithGhost" {
export = MarkerWithGhost;
}
+2 -2
View File
@@ -210,7 +210,7 @@ declare module "pkcs11js" {
* @param {Handle} slot ID of token's slot
* @returns {Handle[]} Gets mech. array
*/
C_GetMechanismList(slot: Handle): Handle[];
C_GetMechanismList(slot: Handle): number[];
/**
* Obtains information about a particular mechanism possibly supported by a token
*
@@ -218,7 +218,7 @@ declare module "pkcs11js" {
* @param {Handle} mech Type of mechanism
* @returns {MechanismInfo} Receives mechanism info
*/
C_GetMechanismInfo(slot: Handle, mech: Handle): MechanismInfo;
C_GetMechanismInfo(slot: Handle, mech: number): MechanismInfo;
/* Session management */
+20 -6
View File
@@ -7,7 +7,7 @@
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import * as i18n from 'i18next';
import { translate, I18nextProvider, Interpolate, InjectedTranslateProps } from 'react-i18next';
import { translate, I18nextProvider, Interpolate, InjectedTranslateProps, TranslationFunction } from 'react-i18next';
i18n
@@ -26,18 +26,19 @@ i18n
});
interface InnerAnotherComponentProps extends InjectedTranslateProps {
interface InnerAnotherComponentProps {
_?: TranslationFunction;
}
class InnerAnotherComponent extends React.Component<InnerAnotherComponentProps, {}> {
render() {
const { t } = this.props;
const { _ } = this.props;
return <p>{t('content.text', { /* options t options */ })}</p>;
return <p>{_('content.text', { /* options t options */ })}</p>;
}
}
const AnotherComponent = translate('view', { wait: true })(InnerAnotherComponent);
const AnotherComponent = translate('view', { wait: true, translateFuncName: '_' })(InnerAnotherComponent);
@@ -69,7 +70,20 @@ class TranslatableView extends React.Component<TranslatableViewProps, {}> {
<h1>{t('common:appName')}</h1>
<AnotherComponent />
<YetAnotherComponent />
<Interpolate parent='p' i18nKey='common:interpolateSample' value='"some value in props"' component={interpolateComponent} />
<Interpolate
parent='p'
i18nKey='common:interpolateSample'
value='"some value in props"'
component={interpolateComponent}
/>
<Interpolate
parent='p'
i18nKey='common:interpolateSample'
useDangerouslySetInnerHTML={true}
dangerouslySetInnerHTMLPartElement='span'
value='"some value in props"'
component={interpolateComponent}
/>
<a href='https://github.com/i18next/react-i18next' target='_blank'>{t('nav:link1')}</a>
</div>
)
+12 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for react-i18next 1.6.3
// Type definitions for react-i18next 1.7.0
// Project: https://github.com/i18next/react-i18next
// Definitions by: Kostya Esmukov <https://github.com/KostyaEsmukov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -11,11 +11,16 @@
declare namespace ReactI18next {
import React = __React;
export type TranslationFunction = I18next.TranslationFunction;
// Extend your component's Prop interface with this one to get access to `this.props.t`
//
// Please note that if you use the `translateFuncName` option, you should create
// your own interface just like this one, but with your name of the translation function.
//
// interface MyComponentProps extends ReactI18next.InjectedTranslateProps {}
export interface InjectedTranslateProps {
t?: I18next.TranslationFunction;
t?: TranslationFunction;
}
interface I18nextProviderProps {
@@ -35,7 +40,10 @@ declare namespace ReactI18next {
regexp?: RegExp;
options?: I18next.TranslationOptions;
[regexKey: string]: InterpolateValue | RegExp | I18next.TranslationOptions;
useDangerouslySetInnerHTML?: boolean;
dangerouslySetInnerHTMLPartElement?: string;
[regexKey: string]: InterpolateValue | RegExp | I18next.TranslationOptions | boolean;
}
export class Interpolate extends React.Component<InterpolateProps, {}> { }
@@ -43,6 +51,7 @@ declare namespace ReactI18next {
interface TranslateOptions {
withRef?: boolean;
wait?: boolean;
translateFuncName?: string;
}
export function translate(namespaces?: string[] | string, options?: TranslateOptions): <C extends Function>(WrappedComponent: C) => C;
+2 -2
View File
@@ -2,7 +2,7 @@
/// <reference path="./react-modal.d.ts"/>
import * as React from "react";
import ReactModal from 'react-modal';
import * as ReactModal from 'react-modal';
class ExampleOfUsingReactModal extends React.Component<{}, {}> {
render() {
@@ -46,4 +46,4 @@ class ExampleOfUsingReactModal extends React.Component<{}, {}> {
</ReactModal>
);
}
};
};
+1 -1
View File
@@ -24,5 +24,5 @@ declare module "react-modal" {
shouldCloseOnOverlayClick?: boolean
}
let ReactModal: __React.ClassicComponentClass<ReactModal>;
export default ReactModal;
export = ReactModal;
}
+1
View File
@@ -10,6 +10,7 @@
/// <reference path="../validator/validator.d.ts" />
declare module "sequelize" {
import * as _ from "lodash";
namespace sequelize {
+3 -2
View File
@@ -17,8 +17,9 @@ interface StripeStatic {
interface StripeTokenData {
number: string;
exp_month: number;
exp_year: number;
exp_month?: number;
exp_year?: number;
exp?: string;
cvc?: string;
name?: string;
address_line1?: string;
+1 -1
View File
@@ -85,7 +85,7 @@ declare module "superagent" {
accept(type: string): this;
attach(field: string, file: string, filename?: string): this;
auth(user: string, name: string): this;
buffer(val: boolean): this;
buffer(val?: boolean): this;
clearTimeout(): this;
end(callback?: CallbackHandler): this;
field(name: string, val: string): this;
@@ -1,5 +1,7 @@
///<reference path="../tether/tether.d.ts" />
///<reference path="drop.d.ts" />
///<reference path="tether-drop.d.ts" />
import 'tether-drop';
var yellowBox = document.querySelector(".yellow");
var greenBox = document.querySelector(".green");
+1 -1
View File
@@ -56,6 +56,6 @@ declare namespace Drop {
}
}
declare module "drop" {
declare module "tether-drop" {
export = Drop;
}
+232
View File
@@ -0,0 +1,232 @@
import { twilio } from './twilio';
// Examples taken from https://twilio.github.io/twilio-node/ (v2.1.0)
var str: string;
// Create a client:
var client: twilio.RestClient = (require('twilio') as twilio)('ACCOUNT_SID', 'AUTH_TOKEN');
//Get a list of calls made by this account
// GET /2010-04-01/Accounts/ACCOUNT_SID/Calls
// alias for get is "list", if you prefer
client.calls.get(function(err: any, response: any) {
response.calls.forEach(function(call: any) {
console.log('Received call from: ' + call.from);
console.log('Call duration (in seconds): ' + call.duration);
});
});
//Get a list of calls made by this account, from this phone number
// GET /2010-04-01/Accounts/ACCOUNT_SID/Calls?From=+16513334455
client.calls.get({
from:'+16513334455'
}, function(err: any, response: any) {
response.calls.forEach(function(call: any) {
console.log('Received call from: ' + call.from);
console.log('This call\'s unique ID is: ' + call.sid);
});
});
//Get data for a specific call
// GET /2010-04-01/Accounts/ACCOUNT_SID/Calls/abc123...
client.calls('abc123...').get(function(err: any, call: any) {
console.log('This call\'s unique ID is: ' + call.sid);
console.log('This call was created at: ' + call.dateCreated);
});
//Get data for a specific call, for a specific account
// GET /2010-04-01/Accounts/AC.../Calls/abc123...
client.accounts('AC...').calls('abc123...').get(function(err: any, response: any) {
response.calls.forEach(function(call: any) {
console.log('Received call from: ' + call.from);
console.log('This call\'s unique ID is: ' + call.sid);
});
});
// Create (send) an SMS message
// POST /2010-04-01/Accounts/ACCOUNT_SID/SMS/Messages
// "create" and "update" aliases are in place where appropriate on PUT and POST requests
client.sms.messages.post({
to:'+16515559999',
from:'+14503334455',
body:'word to your mother.'
}, function(err: any, text: any) {
console.log('You sent: '+ text.body);
console.log('Current status of this text message is: '+ text.status);
});
// Delete a TwiML application
// DELETE /2010-04-01/Accounts/ACCOUNT_SID/Applications/APP...
client.applications('APP...').delete(function(err: any, response: any, nodeResponse: any) {
//DELETE requests do not return data - if there was no error, it worked.
err ? console.log('There was an error') : console.log('it worked!');
});
var SOME_SUBACCOUNT_SID = 'AC...';
//Send a text message, associated with the given subaccount
client.accounts(SOME_SUBACCOUNT_SID).sms.messages.create({
to:'+16512223333',
from:'+14505556677',
body:'word to your subaccount mother.'
}, function(err: any, text: any) {
console.log('You sent: '+ text.body);
console.log('Current status of this text message is: '+ text.status);
});
//This REST call using the master/default account for the client...
client.makeCall({
to:'+16512223333',
from:'+14505556677',
url:'http://example.com/someTwiml.php'
}, function(err: any, call: any) {
console.log('This call\'s unique ID is: ' + call.sid);
console.log('This call was created at: ' + call.dateCreated);
});
//...is the same as...
client.accounts(str).calls.create({
to:'+16512223333',
from:'+14505556677',
url:'http://example.com/someTwiml.php'
}, function(err: any, call: any) {
console.log('This call\'s unique ID is: ' + call.sid);
console.log('This call was created at: ' + call.dateCreated);
});
var restClient = new twilio.RestClient('ACCOUNT_SID', 'AUTH_TOKEN');
// A simple example of making a phone call using promises
var promise = restClient.makeCall({
to:'+16515556667777', // a number to call
from:'+16518889999', // a Twilio number you own
url:'https://demo.twilio.com/welcome/voice' // A URL containing TwiML instructions for the call
});
// You can assign functions to be called, at any time, after the request to
// Twilio has been completed. The first function is called when the request
// succeeds, the second if there was an error.
promise.then(function(call: any) {
console.log('Call success! Call SID: '+call.sid);
}, function(error: any) {
console.error('Call failed! Reason: '+error.message);
});
// Let's look at an example where we're making multiple requests to Twilio, like
// buying a new phone number. This is where promises can become very useful:
// First, search for available phone numbers
restClient.availablePhoneNumbers('US').local.get({
areaCode:'651'
}).then(function(searchResults: any) {
// handle the case where there are no numbers found
if (searchResults.availablePhoneNumbers.length < 1) {
throw { message:'No numbers found with that area code' };
}
// Okay, so there are some available numbers. Now, let's buy the first one
// in the list. Return the promise created by the next call to Twilio:
return restClient.incomingPhoneNumbers.create({
phoneNumber:searchResults.availablePhoneNumbers[0].phoneNumber,
voiceUrl:'https://demo.twilio.com/welcome/voice',
smsUrl:'https://demo.twilio.com/welcome/sms/reply'
});
}).then(function(number: any) {
// We bought the number! Everything worked!
console.log('Your new number: '+number.phoneNumber);
}).fail(function(error: any) {
// This callback will be invoked on any error returned in the
// process.
console.log('Number purchase failed! Reason: '+error.message);
}).fin(function() {
// You can use this optional callback like a "finally" block
// It will always execute last. Perform any cleanup necessary here.
});
client.request({
url:'/Accounts',
method:'GET'
}, function (error: any, responseData: any) {
//work with response data
});
/// TwiML
var resp = new twilio.TwimlResponse();
resp.say('Welcome to Twilio!');
resp.say('Please let us know if we can help during your development.', {
voice:'woman',
language:'en-gb'
});
console.log(resp.toString());
resp.say('Welcome to Twilio!')
.pause({ length:3 })
.say('Please let us know if we can help during your development.', {
voice:'woman',
language:'en-gb'
})
.play('http://www.example.com/some_sound.mp3');
resp.say('Welcome to Acme Customer Service!')
.gather({
action:'http://www.example.com/callFinished.php',
finishOnKey:'*'
}, function() {
this.say('Press 1 for customer service')
.say('Press 2 for British customer service', { language:'en-gb' });
});
resp.say('Welcome to Acme Customer Service!')
.gather({
action:'http://www.example.com/callFinished.php',
finishOnKey:'*'
}, function(node: twilio.Node) { //note the use of the "node" variable in the anonymous function
//Now you can use this reference as well, if using "this" wrankles you
node.say('Press 1 for customer service')
.say('Press 2 for British customer service', { language:'en-gb' });
});
resp.say('Your conference call is starting.',
{
voice:'woman',
language:'en-gb'
})
.dial({
action:'http://example.com/something.php'
}, function(node: twilio.Node) {
node.conference('waitingRoom', {
beep:'false'
});
});
/// Capabilities
var capability = new twilio.Capability(str, str);
capability.allowClientIncoming('jenny');
var token = capability.generate();
capability.allowClientOutgoing('AP123');
var token = capability.generate();
capability.allowClientOutgoing('AP123');
var token = capability.generate(120);
/// Utilities
twilio.validateRequest(token, str, 'http://example.herokuapp.com', { query: 'val' });
twilio.validateExpressRequest({}, 'YOUR_TWILIO_AUTH_TOKEN');
twilio.validateExpressRequest({}, 'YOUR_TWILIO_AUTH_TOKEN', {});
twilio.webhook({ validate: false });
+875
View File
@@ -0,0 +1,875 @@
// Type definitions for twilio
// Project: https://github.com/twilio/twilio-node
// Definitions by: nickiannone <https://github.com/nickiannone>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
/// <reference path="../node/node.d.ts" />
/// <reference path="../q/Q.d.ts" />
import * as express from 'express';
import * as Http from 'http';
import q = require('q');
export interface twilio {
(sid?: string, tkn?: string, options?: twilio.ClientOptions): twilio.RestClient;
}
export module twilio {
// Composite Classes:
//==============================
// RestClient
// PricingClient
// MonitorClient
// TaskRouterClient
// IpMessagingClient
// LookupsClient
// TrunkingClient
// Classes:
//==============================
// AccessToken
// Capability
// TaskRouterCapability
// TaskRouterWorkerCapability
// TaskRouterWorkspaceCapability
// TaskRouterTaskQueueCapability
// TwimlResponse (TODO main export is generator function)
// webhook
// Methods:
//===============================
// validateRequest
// validateExpressRequest
/// Random stuff
export interface GrantPayload {}
export interface Grant {
toPayload(): GrantPayload;
}
export interface RequestCallback { (err: any, data: any, response: Http.ClientResponse): void; }
export interface BaseRequestCallback { (err: any, data: any): void; }
export interface RestMethod { (args: any | BaseRequestCallback, callback?: RequestCallback): Q.Promise<any>; }
/// Resource stock interfaces
export interface BaseMappedResource<T> {
(resourceSid: string): T;
}
export interface Resource {
get: RestMethod;
}
export interface DeletableResource extends Resource {
delete: RestMethod;
}
export interface ListableResource extends Resource {
list: RestMethod;
}
export interface MappedResource<T> extends Resource, BaseMappedResource<T> {}
export interface PostableResource extends Resource {
post: RestMethod;
}
export interface InstanceResource extends PostableResource, DeletableResource {
update: RestMethod;
}
export interface CreatableMappedResource<T> extends MappedResource<T>, PostableResource {
create: RestMethod;
}
export interface ListMappedResource<T> extends CreatableMappedResource<T>, ListableResource {}
/// AccessToken.js
export interface IpMessagingGrantOptions {
serviceSid: string;
endpointId: string;
deploymentRoleSid: string;
pushCredentialSid: string;
}
export interface IpMessagingGrantPayload extends GrantPayload {
service_sid: string;
endpoint_id: string;
deployment_role_sid: string;
push_credential_sid: string;
}
export class IpMessagingGrant implements Grant {
serviceSid: string;
endpointId: string;
deploymentRoleSid: string;
pushCredentialSid: string;
key: string;
constructor(options?: IpMessagingGrantOptions);
toPayload(): IpMessagingGrantPayload;
}
export interface ConversationsGrantOptions {
configurationProfileSid: string;
}
export interface ConversationsGrantPayload extends GrantPayload {
configuration_profile_sid: string;
}
export class ConversationsGrant implements Grant {
configurationProfileSid: string;
constructor(options?: ConversationsGrantOptions);
toPayload(): ConversationsGrantPayload;
}
export interface AccessTokenOptions {
ttl: number;
identity: string;
nbf: number;
}
export class AccessToken {
accountSid: string;
keySid: string;
secret: string;
ttl: number;
identity: string;
nbf: number;
grants: Array<Grant>;
static IpMessagingGrant: IpMessagingGrant;
static ConversationGrant: ConversationsGrant;
static DEFAULT_ALGORITHM: string;
static ALGORITHMS: Array<string>;
constructor(accountSid: string, keySid: string, secret: string, opts?: AccessTokenOptions);
addGrant(grant: Grant): void;
toJwt(algorithm: string): any; // TODO Find correct typedef
}
/// Capability.js
export class Capability {
accountSid: string;
authToken: string;
capabilities: Array<string>;
clientName: string;
outgoingScopeParams: any;
scopeParams: any;
constructor(sid?: string, tkn?: string);
allowClientIncoming(clientName: string): Capability;
allowClientOutgoing(appSid: string, params?: any): Capability;
allowEventStream(filters?: any): Capability;
generate(timeout?: number): string;
}
/// Client.js
export interface ClientOptions {
host?: string;
apiVersion?: string;
timeout?: number;
}
export interface ClientRequestOptions {
url: string;
method?: string;
form?: any;
}
export class Client {
accountSid: string;
authToken: string;
host: string;
apiVersion: string;
timeout: number;
constructor(sid?: string, tkn?: string, host?: string, api_version?: string, timeout?: number);
getBaseUrl(): string;
request(options: ClientRequestOptions, callback?: RequestCallback): Q.Promise<any>;
}
/// IpMessagingClient.js
export class IpMessagingClient extends Client {
services: ServiceResource;
credentials: CredentialResource;
constructor(sid?: string, tkn?: string, options?: ClientOptions);
}
/// LookupsClient.js
export class LookupsClient extends Client {
phoneNumbers: PhoneNumberResource;
constructor(sid?: string, tkn?: string, options?: ClientOptions);
}
/// MonitorClient.js
export class MonitorClient extends Client {
events: EventResource;
alerts: AlertResource;
constructor(sid?: string, tkn?: string, options?: ClientOptions);
}
/// PricingClient.js
export class PricingClient extends Client {
voice: PricingVoiceResource;
phoneNumbers: PricingPhoneNumberResource;
messaging: PricingMessagingResource;
constructor(sid?: string, tkn?: string, options?: ClientOptions);
}
/// RestClient.js
export class RestClient extends Client {
constructor(sid?: string, tkn?: string, options?: ClientOptions);
accounts: AccountResource;
// Imported from AccountResource
availablePhoneNumbers: AvailablePhoneNumberResource;
outgoingCallerIds: OutgoingCallerIdResource;
incomingPhoneNumbers: IncomingPhoneNumberResource;
messages: MessageResource;
sms: SMSIntermediary;
applications: ApplicationResource;
connectApps: ConnectAppResource;
authorizedConnectApps: AuthorizedConnectAppResource;
calls: CallResource;
conferences: ConferenceResource;
queues: QueueResource;
recordings: RecordingResource;
tokens: TokenResource;
transcriptions: TranscriptionResource;
notifications: NotificationResource;
usage: UsageIntermediary;
sip: SIPIntermediary;
addresses: AddressResource;
keys: KeyResource;
// Mixed-in Methods
put: RestMethod;
post: RestMethod;
get: RestMethod;
update: RestMethod;
list: RestMethod;
// Messaging shorthand
sendSms: RestMethod;
sendMms: RestMethod;
sendMessage: RestMethod;
listSms: RestMethod;
listMessages: RestMethod;
getSms(messageSid: string, callback?: RequestCallback): Q.Promise<any>;
getMessage(messageSid: string, callback?: RequestCallback): Q.Promise<any>;
// Calls shorthand
makeCall: RestMethod;
listCalls: RestMethod;
getCall(callSid: string, callback?: RequestCallback): Q.Promise<any>;
// Overrides Client.request(...)
request(options: ClientRequestOptions, callback?: RequestCallback): Q.Promise<any>;
}
/// TaskRouterCapability.js
export interface Policy {
url: string;
method: string;
query_filter?: any; // Map<string, FilterRequirement>, where FilterRequirement ::= Map<string, boolean>
post_filter?: any; // Map<string, FilterRequirement>, where FilterRequirement ::= Map<string, boolean>
allow: boolean;
}
export class TaskRouterCapability {
accountSid: string;
authToken: string;
policies: Array<Policy>;
workspaceSid: string;
channelId: string;
private _baseUrl: string;
private _resourceUrl: string;
constructor(accountSid: string, authToken: string, workspaceSid: string, channelId: string);
protected _setupResource(): void;
private _validateJWT(): void;
private _generate(ttl: number, extraAttributes: any): string;
allowFetchSubresources(): void;
allowUpdates(): void;
allowUpdatesSubresources(): void;
allowDelete(): void;
allowDeleteSubresources(): void;
allowWorkerActivityUpdates(): void;
allowWorkerFetchAttributes(): void;
allowTaskReservationUpdates(): void;
addPolicy(url: string, method: string, allowed?: boolean, queryFilter?: any, postFilter?: any): void;
allow(url: string, method: string, queryFilter?: any, postFilter?: any): void;
deny(url: string, method: string, queryFilter?: any, postFilter?: any): void;
generate(ttl: number): string;
}
/// TaskRouterClient.js
export class TaskRouterClient extends Client {
workspaces: WorkspaceResource;
workspace: WorkspaceResource;
constructor(sid?: string, tkn?: string, workspaceSid?: string, options?: ClientOptions);
}
/// TaskRouterTaskQueueCapability.js
export class TaskRouterTaskQueueCapability extends TaskRouterCapability {
constructor(accountSid: string, authToken: string, workspaceSid: string, taskQueueSid: string);
protected _setupResource(): void;
}
/// TaskRouterWorkerCapability.js
export class TaskRouterWorkerCapability extends TaskRouterCapability {
reservationsUrl: string;
activityUrl: string;
workerReservationsUrl: string;
constructor(accountSid: string, authToken: string, workspaceSid: string, workerSid: string);
protected _setupResource(): void;
allowActivityUpdates(): void;
allowReservationUpdates(): void;
}
/// TaskRouterWorkspaceCapability.js
export class TaskRouterWorkspaceCapability extends TaskRouterCapability {
constructor(accountSid: string, authToken: string, workspaceSid: string);
protected _setupResource(): void;
}
/// TrunkingClient.js
export class TrunkingClient extends Client {
trunks: TrunkResource;
constructor(sid?: string, tkn?: string, options?: ClientOptions);
}
/// TwimlResponse.js
// ???? - Someone else should look at this thing to make sure it's correct
export interface NodeOptions {
name: string;
attributes?: any;
text?: string;
topLevel?: boolean;
legalNodes: Array<string>;
}
export interface TwimlMethod { (arg1: any | string | TwimlCallback, arg2?: any | string | TwimlCallback): Node }
export interface TwimlCallback { (node?: Node): void; }
export class Node implements NodeOptions {
name: string;
attributes: any;
text: any;
topLevel: boolean;
legalNodes: Array<string>;
constructor(config?: NodeOptions);
// TwiML Verbs/Nouns:
gather: TwimlMethod;
say: TwimlMethod;
play: TwimlMethod;
pause: TwimlMethod;
dial: TwimlMethod;
number: TwimlMethod;
client: TwimlMethod;
conference: TwimlMethod;
queue: TwimlMethod;
sip: TwimlMethod;
message: TwimlMethod;
media: TwimlMethod;
body: TwimlMethod;
enqueue: TwimlMethod;
task: TwimlMethod;
record: TwimlMethod;
sms: TwimlMethod;
hangup: TwimlMethod;
redirect: TwimlMethod;
reject: TwimlMethod;
leave: TwimlMethod;
toString(): string;
}
export class TwimlResponse extends Node {}
/// webhook.js
export interface webhookOptions {
validate?: boolean;
includeHelpers?: boolean;
host?: string;
protocol?: string;
}
export interface WebhookExpressOptions {
// The full URL (with query string) you used to configure the webhook with Twilio - overrides host/protocol options
url?: string;
// manually specify the host name used by Twilio in a number's webhook config
host?: string;
// manually specify the protocol used by Twilio in a number's webhook config
protocol?: string;
}
// For interop with node middleware chains
export interface MiddlewareFunction { (request: Http.ClientRequest, response: Http.ClientResponse, next: MiddlewareFunction): void; }
export function webhook(options?: string | webhookOptions): MiddlewareFunction;
export function validateRequest(authToken: string, twilioHeader: string, url: string, params?: any): boolean;
export function validateExpressRequest(request: Express.Request, authToken: string, options?: WebhookExpressOptions): boolean;
/// resources/Accounts.js
export interface OutgoingCallerIdInstance extends InstanceResource {
put: RestMethod;
}
export interface OutgoingCallerIdResource extends CreatableMappedResource<OutgoingCallerIdInstance> {}
export interface SMSMessageInstance extends Resource {}
export interface SMSMessageResource extends CreatableMappedResource<SMSMessageInstance> {}
export interface SMSShortCodeInstance extends PostableResource {
update: RestMethod;
}
export interface SMSShortCodeResource extends MappedResource<SMSShortCodeInstance> {}
export interface SMSIntermediary {
messages: SMSMessageResource;
shortCodes: SMSShortCodeResource;
}
export interface ApplicationInstance extends InstanceResource {}
export interface ApplicationResource extends CreatableMappedResource<ApplicationInstance> {}
export interface ConnectAppInstance extends PostableResource {
update: RestMethod;
}
export interface ConnectAppResource extends MappedResource<ConnectAppInstance> {}
export interface AuthorizedConnectAppInstance extends Resource {}
export interface AuthorizedConnectAppResource extends MappedResource<AuthorizedConnectAppInstance> {}
export interface TokenInstance {}
export interface TokenResource extends BaseMappedResource<TokenInstance> {
post: RestMethod;
create: RestMethod;
}
export interface TranscriptionInstance extends DeletableResource {}
export interface TranscriptionResource extends MappedResource<TranscriptionInstance> {}
export interface NotificationInstance extends DeletableResource {}
export interface NotificationResource extends MappedResource<NotificationInstance> {}
export interface UsageTriggerInstance extends InstanceResource {}
export interface UsageTriggerResource extends CreatableMappedResource<UsageTriggerInstance> {}
export interface UsageIntermediary {
records: UsageRecordResource;
triggers: UsageTriggerResource;
}
export interface SIPIntermediary {
domains: DomainResource;
ipAccessControlLists: IPAccessControlListResource;
credentialLists: CredentialListResource;
}
export interface KeyInstance extends InstanceResource {}
export interface KeyResource extends CreatableMappedResource<KeyInstance> {}
export interface AccountInstance extends PostableResource {
update: RestMethod;
put: RestMethod;
// Mixed-in resources
availablePhoneNumbers: AvailablePhoneNumberResource;
outgoingCallerIds: OutgoingCallerIdResource;
incomingPhoneNumbers: IncomingPhoneNumberResource;
messages: MessageResource;
sms: SMSIntermediary;
applications: ApplicationResource;
connectApps: ConnectAppResource;
authorizedConnectApps: AuthorizedConnectAppResource;
calls: CallResource;
conferences: ConferenceResource;
queues: QueueResource;
recordings: RecordingResource;
tokens: TokenResource;
transcriptions: TranscriptionResource;
notifications: NotificationResource;
usage: UsageIntermediary;
sip: SIPIntermediary;
addresses: AddressResource;
keys: KeyResource;
}
export interface AccountResource extends AccountInstance, ListMappedResource<AccountInstance> {}
/// resources/Addresses.js
export interface DependentPhoneNumberResource extends ListableResource {}
export interface AddressInstance extends PostableResource, DeletableResource {
// Mixins
dependentPhoneNumbers: DependentPhoneNumberResource;
}
export interface AddressResource extends ListMappedResource<AddressInstance> {}
/// resources/AvailablePhoneNumbers.js
export interface AvailablePhoneNumberResourceGroup extends ListableResource {
search: RestMethod;
}
export interface AvailablePhoneNumberInstance {
local: AvailablePhoneNumberResourceGroup;
tollFree: AvailablePhoneNumberResourceGroup;
mobile: AvailablePhoneNumberResourceGroup;
}
export interface AvailablePhoneNumberResource extends BaseMappedResource<AvailablePhoneNumberInstance> {}
/// resources/Calls.js
export interface CallRecordingResource extends ListableResource {}
export interface CallNotificationResource extends ListableResource {}
export interface CallFeedbackResource extends PostableResource, DeletableResource {
create: RestMethod;
}
export interface CallInstance extends InstanceResource {
recordings: CallRecordingResource;
notifications: CallNotificationResource;
feedback: CallFeedbackResource;
}
export interface CallFeedbackSummaryInstance extends DeletableResource {}
export interface CallFeedbackSummaryResource extends BaseMappedResource<CallFeedbackSummaryInstance> {
post: RestMethod;
create: RestMethod;
}
export interface CallResource extends CreatableMappedResource<CallInstance> {
feedbackSummary: CallFeedbackSummaryResource;
}
/// resources/Conferences.js
export interface ConferenceParticipantInstance extends InstanceResource {
kick: RestMethod;
}
export interface ConferenceParticipantResource extends MappedResource<ConferenceParticipantInstance>, ListableResource {}
export interface ConferenceInstance extends Resource {
participants: ConferenceParticipantResource;
}
export interface ConferenceResource extends MappedResource<ConferenceInstance>, ListableResource {}
/// resources/IncomingPhoneNumbers.js
export interface IncomingPhoneNumberResourceGroup extends PostableResource {
create: RestMethod;
}
export interface IncomingPhoneNumberInstance extends InstanceResource {
put: RestMethod;
}
export interface IncomingPhoneNumberResource extends CreatableMappedResource<IncomingPhoneNumberInstance> {
local: IncomingPhoneNumberResourceGroup;
tollFree: IncomingPhoneNumberResourceGroup;
mobile: IncomingPhoneNumberResourceGroup;
}
/// resources/Messages.js
export interface MessageMediaInstance extends DeletableResource {}
export interface MessageMediaResource extends MappedResource<MessageMediaInstance>, ListableResource {}
export interface MessageInstance extends PostableResource, DeletableResource {
media: MessageMediaResource;
}
export interface MessageResource extends ListMappedResource<MessageInstance> {}
/// resources/Queues.js
export interface QueueMemberInstance extends PostableResource {
update: RestMethod;
}
export interface QueueMemberResource extends MappedResource<QueueMemberInstance> {
front: QueueMemberInstance;
}
export interface QueueInstance extends InstanceResource {
members: QueueMemberResource;
}
export interface QueueResource extends CreatableMappedResource<QueueInstance> {}
/// resources/Recordings.js
export interface RecordingTranscriptionResource extends ListableResource {}
export interface RecordingInstance extends ListableResource, DeletableResource {
transcriptions: RecordingTranscriptionResource;
}
export interface RecordingResource extends MappedResource<RecordingInstance>, ListableResource {}
/// resources/UsageRecords.js
export interface UsageRecordInstance extends Resource {}
export interface UsageRecordRange extends ListableResource {}
export interface UsageRecordResource extends MappedResource<UsageRecordInstance> {
daily: UsageRecordRange;
monthly: UsageRecordRange;
yearly: UsageRecordRange;
allTime: UsageRecordRange;
today: UsageRecordRange;
yesterday: UsageRecordRange;
thisMonth: UsageRecordRange;
lastMonth: UsageRecordRange;
}
/// resources/ip_messaging/Credentials.js
export interface CredentialInstance extends InstanceResource {}
export interface CredentialResource extends ListMappedResource<CredentialInstance> {}
/// resources/ip_messaging/Services.js
export interface ServiceUserInstance extends InstanceResource {}
export interface ServiceUserResource extends ListMappedResource<ServiceUserInstance> {}
export interface ServiceRoleInstance extends Resource {}
export interface ServiceRoleResource extends MappedResource<ServiceRoleInstance>, ListableResource {}
export interface ServiceChannelMessageInstance extends InstanceResource {}
export interface ServiceChannelMessageResource extends ListMappedResource<ServiceChannelMessageInstance> {}
export interface ServiceChannelMemberInstance extends InstanceResource {}
export interface ServiceChannelMemberResource extends ListMappedResource<ServiceChannelMemberInstance> {}
export interface ServiceChannelInstance extends InstanceResource {
messages: ServiceChannelMessageResource;
members: ServiceChannelMemberResource;
}
export interface ServiceChannelResource extends ListMappedResource<ServiceChannelInstance> {}
export interface ServiceInstance extends InstanceResource {
users: ServiceUserResource;
roles: ServiceRoleResource;
channels: ServiceChannelResource;
}
export interface ServiceResource extends ListMappedResource<ServiceInstance> {}
/// resources/lookups/PhoneNumbers.js
export interface PhoneNumberInstance extends Resource {}
export interface PhoneNumberResource extends BaseMappedResource<PhoneNumberInstance> {}
/// resources/monitor/Alerts.js
export interface AlertInstance extends Resource {}
export interface AlertResource extends MappedResource<AlertInstance>, ListableResource {}
/// resources/monitor/Events.js
export interface EventInstance extends Resource {}
export interface EventResource extends MappedResource<EventInstance>, ListableResource {}
/// resources/pricing/Messaging.js
export interface CountryInstance extends Resource {}
export interface CountryResource extends MappedResource<CountryInstance>, ListableResource {}
export interface PricingMessagingResource {
countries: CountryResource;
}
/// resources/pricing/PhoneNumbers.js
export interface PricingPhoneNumberResource {
countries: CountryResource;
}
/// resources/pricing/Voice.js
export interface NumberInstance extends Resource {}
export interface NumberResource extends MappedResource<NumberInstance>, ListableResource {}
export interface PricingVoiceResource {
countries: CountryResource;
numbers: NumberResource;
}
/// resources/sip/CredentialLists.js
export interface CredentialListInstance extends InstanceResource {
credentials: CredentialResource;
}
export interface CredentialListResource extends ListMappedResource<CredentialListInstance> {}
/// resources/sip/Domains.js
export interface IPAccessControlListMappingInstance extends DeletableResource {}
export interface IPAccessControlListMappingResource extends ListMappedResource<IPAccessControlListMappingInstance> {}
export interface CredentialListMappingInstance extends DeletableResource {}
export interface CredentialListMappingResource extends ListMappedResource<CredentialListMappingInstance> {}
export interface DomainInstance extends InstanceResource {
ipAccessControlListMappings: IPAccessControlListMappingResource;
credentialListMappings: CredentialListMappingResource;
}
export interface DomainResource extends ListMappedResource<DomainInstance> {}
/// resources/sip/IpAccessControlLists.js
export interface IPAddressInstance extends InstanceResource {}
export interface IPAddressResource extends ListMappedResource<IPAddressInstance> {}
export interface IPAccessControlListInstance extends InstanceResource {
ipAddresses: IPAddressResource;
}
export interface IPAccessControlListResource extends ListMappedResource<IPAccessControlListInstance> {}
/// resources/task_router/WorkflowBuilder.js
export interface WorkflowRuleTargetOptions {
queue: string;
expression?: string;
priority?: number;
timeout?: number;
}
export class WorkflowRuleTarget {
queue: string;
expression: string;
priority: number;
timeout: number;
constructor(options?: WorkflowRuleTargetOptions);
}
export interface WorkflowRuleOptions {
expression: string;
targets: Array<WorkflowRuleTargetOptions>;
// Don't ask me why, but all of these are supported options.
friendly_name?: string;
friendlyName?: string;
filter_friendly_name?: string;
}
export class WorkflowRule {
friendly_name: string;
expression: string;
targets: Array<WorkflowRuleTarget>;
friendlyName: string; // Defined property mapped to friendly_name.
constructor(options?: WorkflowRuleOptions);
}
export interface TaskRoutingConfigurationOptions {
filters: Array<WorkflowRuleOptions>;
default_filter?: WorkflowRuleOptions;
defaultFilter?: WorkflowRuleOptions;
}
export class TaskRoutingConfiguration {
filters: Array<WorkflowRule>;
default_filter: WorkflowRuleOptions;
defaultFilter: WorkflowRuleOptions; // Defined property mapped to default_filter.
constructor(options?: TaskRoutingConfigurationOptions);
}
export interface WorkflowConfigurationOptions {
task_routing?: TaskRoutingConfigurationOptions;
taskRouting?: TaskRoutingConfigurationOptions;
}
export class WorkflowConfiguration {
task_routing: TaskRoutingConfiguration;
taskRouting: TaskRoutingConfiguration; // Defined property mapped to task_routing.
constructor(options?: WorkflowConfigurationOptions);
static fromJSON(json: string): WorkflowConfiguration;
toJSON(): string;
}
/// resources/task_router/Workspaces.js
export interface WorkspaceActivityInstance extends InstanceResource {}
export interface WorkspaceActivityResource extends ListMappedResource<WorkspaceActivityInstance> {}
export interface WorkspaceEventInstance extends Resource {}
export interface WorkspaceEventResource extends MappedResource<WorkspaceEventInstance>, ListableResource {}
export interface WorkspaceTaskReservationInstance extends PostableResource {
update: RestMethod;
}
export interface WorkspaceTaskReservationResource extends MappedResource<WorkspaceTaskReservationInstance>, ListableResource {}
export interface WorkspaceTaskInstance extends InstanceResource {
reservations: WorkspaceTaskReservationResource;
}
export interface WorkspaceTaskResource extends ListMappedResource<WorkspaceTaskInstance> {}
export interface WorkspaceInstanceStatisticResource extends Resource {}
export interface WorkspaceStatisticResource extends ListableResource {}
export interface WorkspaceTaskQueueInstance extends InstanceResource {
statistics: WorkspaceInstanceStatisticResource;
}
export interface WorkspaceTaskQueueResource extends ListMappedResource<WorkspaceTaskQueueInstance> {
statistics: WorkspaceStatisticResource;
}
export interface WorkspaceWorkerReservationInstance extends PostableResource {
update: RestMethod;
}
export interface WorkspaceWorkerReservationResource extends MappedResource<WorkspaceWorkerReservationInstance>, ListableResource {}
export interface WorkspaceWorkerInstance extends InstanceResource {
statistics: WorkspaceInstanceStatisticResource;
reservations: WorkspaceWorkerReservationResource;
}
export interface WorkspaceWorkerResource extends ListMappedResource<WorkspaceWorkerInstance> {
statistics: WorkspaceStatisticResource;
}
export interface WorkspaceWorkflowInstance extends InstanceResource {
statistics: WorkspaceInstanceStatisticResource;
}
export interface WorkspaceWorkflowResource extends ListMappedResource<WorkspaceWorkflowInstance> {
statistics: WorkspaceStatisticResource;
}
export interface WorkspaceInstance extends InstanceResource {
activities: WorkspaceActivityResource;
events: WorkspaceEventResource;
tasks: WorkspaceTaskResource;
taskQueues: WorkspaceTaskQueueResource;
workers: WorkspaceWorkerResource;
workflows: WorkspaceWorkflowResource;
statistics: WorkspaceInstanceStatisticResource;
}
export interface WorkspaceResource extends CreatableMappedResource<WorkspaceInstance> {}
/// resources/trunking/Trunks.js
export interface OriginationURLInstance extends InstanceResource {}
export interface OriginationURLResource extends ListMappedResource<OriginationURLInstance> {}
export interface TrunkInstance extends InstanceResource {
ipAccessControlLists: IPAccessControlListResource;
credentialLists: CredentialListResource;
phoneNumbers: PhoneNumberResource;
originationUrls: OriginationURLResource;
}
export interface TrunkResource extends ListMappedResource<TrunkInstance> {}
}
+6
View File
@@ -505,6 +505,12 @@ function chain_tests() {
var firstVal: number = _.chain([1, 2, 3])
.first()
.value();
let numberObjects = [{property: 'odd', value: 1}, {property: 'even', value: 2}, {property: 'even', value: 0}];
let evenAndOddGroupedNumbers = _.chain(numberObjects)
.groupBy('property')
.mapObject((objects: any) => _.pluck(objects, 'value'))
.value(); // { odd: [1], even: [0, 2] }
}
var obj: { [k: string] : number } = {
+1
View File
@@ -5924,6 +5924,7 @@ interface _ChainSingle<T> {
}
interface _ChainOfArrays<T> extends _Chain<T[]> {
flatten(shallow?: boolean): _Chain<T>;
mapObject(fn: _.ListIterator<T, any>): _ChainOfArrays<T>;
}
declare var _: UnderscoreStatic;
+16 -3
View File
@@ -7,6 +7,7 @@ declare module 'xlsx' {
export function readFile(filename:string, opts?:IParsingOptions):IWorkBook;
export function read(data:any, opts?:IParsingOptions):IWorkBook;
export function write(data:any, opts?:IParsingOptions): any;
export var utils:IUtils;
export interface IProperties {
@@ -41,6 +42,7 @@ declare module 'xlsx' {
bookSheets?:boolean;
bookVBA?:boolean;
password?:string;
bookType?:string;
/**
* Possible options: 'binary', 'base64', 'buffer', 'file'
@@ -127,10 +129,21 @@ declare module 'xlsx' {
s?: string;
}
export interface ICell {
c: number;
r: number;
}
export interface IUtils {
sheet_to_json<T>(worksheet:IWorkSheet):T[];
sheet_to_csv(worksheet:IWorkSheet):any;
sheet_to_formulae(worksheet:IWorkSheet):any;
sheet_to_json<T>(worksheet:IWorkSheet, opts?: {
raw?: boolean;
range?: any;
header?: "A"|number|string[];
}):T[];
sheet_to_csv(worksheet: IWorkSheet):any;
sheet_to_formulae(worksheet: IWorkSheet):any;
encode_cell(cell: ICell): any;
encode_range(s: ICell, e: ICell): any;
}
}