mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Merge branch 'master' into types-2.0-2016-08-12
This commit is contained in:
157
angular-es/angular-es-tests.ts
Normal file
157
angular-es/angular-es-tests.ts
Normal file
@@ -0,0 +1,157 @@
|
||||
/// <reference path="./angular-es.d.ts" />
|
||||
|
||||
//
|
||||
// @Component
|
||||
//
|
||||
import { Component } from 'angular-es';
|
||||
@Component({
|
||||
selector: '',
|
||||
template: ''
|
||||
})
|
||||
class MyComponentController {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// @Config
|
||||
//
|
||||
import { Config } from 'angular-es';
|
||||
|
||||
@Config()
|
||||
class MyConfig {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// @Constant
|
||||
//
|
||||
import { Constant } from 'angular-es';
|
||||
|
||||
@Constant('MyConstant')
|
||||
class MyConstant {
|
||||
foo = 'foo';
|
||||
bar = 'bar';
|
||||
}
|
||||
|
||||
//
|
||||
// @Controller
|
||||
//
|
||||
import { Controller } from 'angular-es';
|
||||
|
||||
@Controller('MyController')
|
||||
class MyController {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// @Decorator
|
||||
//
|
||||
import { Decorator } from 'angular-es';
|
||||
|
||||
@Decorator('MyServiceDecorator')
|
||||
class MyServiceDecorator {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// @Directive
|
||||
//
|
||||
import { Directive } from 'angular-es';
|
||||
|
||||
@Directive('MyDirective')
|
||||
class MyDirective {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// @Factory
|
||||
//
|
||||
import { Factory } from 'angular-es';
|
||||
|
||||
@Factory('MyFactory')
|
||||
class MyFactory {
|
||||
}
|
||||
|
||||
//
|
||||
// @Filter
|
||||
//
|
||||
import { Filter } from 'angular-es';
|
||||
|
||||
@Filter('MyFilter')
|
||||
class MyFilter {
|
||||
}
|
||||
|
||||
//
|
||||
// @Inject
|
||||
//
|
||||
import { Inject } from 'angular-es';
|
||||
|
||||
@Inject('fooBar')
|
||||
class MyFooService {
|
||||
|
||||
@Inject('bazBar')
|
||||
myMethod(bazBar: Object) {
|
||||
}
|
||||
|
||||
constructor(fooBar: Object) {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// @InjectAsProperty
|
||||
//
|
||||
import { InjectAsProperty } from 'angular-es';
|
||||
|
||||
@InjectAsProperty('fooBar')
|
||||
class MyFooBarService {
|
||||
fooBar: Object;
|
||||
|
||||
myMethod() {
|
||||
this.fooBar !== undefined;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// @Module
|
||||
//
|
||||
import { Module } from 'angular-es';
|
||||
|
||||
@Module('my.module')
|
||||
@Service('MyModuleService')
|
||||
class MyModuleService {
|
||||
}
|
||||
|
||||
//
|
||||
// @Provider
|
||||
//
|
||||
import { Provider } from 'angular-es';
|
||||
|
||||
@Provider('MyProvider')
|
||||
class MyProvider {
|
||||
}
|
||||
|
||||
//
|
||||
// @Run
|
||||
//
|
||||
import { Run } from 'angular-es';
|
||||
|
||||
@Run()
|
||||
class MyRunBlock {
|
||||
}
|
||||
|
||||
//
|
||||
// @Service
|
||||
//
|
||||
import { Service } from 'angular-es';
|
||||
|
||||
@Service('MyService')
|
||||
class MyService {
|
||||
}
|
||||
//
|
||||
// @Value
|
||||
//
|
||||
import { Value } from 'angular-es';
|
||||
|
||||
@Value('MyValue')
|
||||
class MyValue {
|
||||
}
|
||||
187
angular-es/angular-es.d.ts
vendored
Normal file
187
angular-es/angular-es.d.ts
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
// Type definitions for angular-es v0.0.3
|
||||
// Project: https://github.com/mbutsykin/angular-es
|
||||
// Definitions by: mbutsykin <https://github.com/mbutsykin/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'angular-es' {
|
||||
|
||||
interface ClassDecorator {
|
||||
<TFunction extends Function>(target: TFunction): TFunction|void;
|
||||
}
|
||||
|
||||
interface MethodDecorator {
|
||||
<T>(target: Object, propertyKey: string|symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>|void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorated target
|
||||
*/
|
||||
interface ngESDecorator extends ClassDecorator, MethodDecorator {
|
||||
(target: Object|Function,
|
||||
ngName?: string,
|
||||
ngArguments?: Array<any>,
|
||||
ngType?: string,
|
||||
injectAsProperty?: Array<string>): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component interface
|
||||
* @see https://docs.angularjs.org/guide/component
|
||||
*/
|
||||
interface iComponent {
|
||||
template: string,
|
||||
selector: string,
|
||||
controllerAs?: string,
|
||||
require?: string,
|
||||
templateUrl?: string,
|
||||
transclude?: string,
|
||||
bindings?: Object
|
||||
}
|
||||
|
||||
/**
|
||||
* Register component
|
||||
*
|
||||
* @param {Object<iComponent>} component - component config
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Component: (component: iComponent) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register config block
|
||||
*/
|
||||
var Config: () => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register constant
|
||||
*
|
||||
* @param {string} name - constant name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Constant: (name: string) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register controller
|
||||
*
|
||||
* @param {string} name - controller name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Controller: (name: string) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register decorator
|
||||
*
|
||||
* @param {string} name - provider name to decorate
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Decorator: (name: string) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register directive
|
||||
*
|
||||
* @param {string} name - directive selector, can be in hyphen-case
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Directive: (name: string) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register factory
|
||||
*
|
||||
* @param {string} name - factory name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Factory: (name: string) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register filter
|
||||
*
|
||||
* @param {string} name - filter name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Filter: (name: string) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Add $inject property to target
|
||||
*
|
||||
* @param {Array<string>} dependencies - dependencies to inject
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Inject: (...dependencies: Array<string>) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Inject dependencies as properties to target
|
||||
*
|
||||
* @param {Array<string>} dependencies - dependencies to inject
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var InjectAsProperty: (...dependencies: Array<string>) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Attach target to the specified module
|
||||
*
|
||||
* @param {string} name - module name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Module: (name: string) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register provider
|
||||
*
|
||||
* @param {string} name - provider name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Provider: (name: string) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register run block
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Run: () => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register service
|
||||
*
|
||||
* @param {string} name - service name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Service: (name: string) => ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register value
|
||||
*
|
||||
* @param {string} name - value name
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Value: (name: string) => ngESDecorator;
|
||||
|
||||
export {
|
||||
Component,
|
||||
Config,
|
||||
Constant,
|
||||
Controller,
|
||||
Decorator,
|
||||
Directive,
|
||||
Factory,
|
||||
Filter,
|
||||
Inject,
|
||||
InjectAsProperty,
|
||||
Module,
|
||||
Provider,
|
||||
Run,
|
||||
Service,
|
||||
Value,
|
||||
}
|
||||
}
|
||||
@@ -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[];
|
||||
|
||||
10
angular-ui-router/index.d.ts
vendored
10
angular-ui-router/index.d.ts
vendored
@@ -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;
|
||||
|
||||
2
aws-sdk/index.d.ts
vendored
2
aws-sdk/index.d.ts
vendored
@@ -324,7 +324,7 @@ export declare module DynamoDB {
|
||||
|
||||
interface _DDBDC_Generic {
|
||||
TableName: string;
|
||||
ExpressionAttributeNames?: string[];
|
||||
ExpressionAttributeNames?: { [someKey: string]: string };
|
||||
ReturnConsumedCapacity?: "INDEXES" | "TOTAL" | "NONE";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
function tests_simple() {
|
||||
/// <reference path="index.d.ts"/>
|
||||
function tests_simple() {
|
||||
$('#datepicker').datepicker();
|
||||
$('#datepicker').datepicker({
|
||||
format: 'mm-dd-yyyy'
|
||||
@@ -8,8 +9,7 @@
|
||||
$('#datepicker').datepicker('setEndDate', '2012-12-31');
|
||||
$('#date-end')
|
||||
.datepicker()
|
||||
.on('changeDate', function (ev) { ev; });
|
||||
|
||||
.on('changeDate', function (ev) { ev; });
|
||||
var startDate = new Date(2012, 1, 20);
|
||||
var endDate = new Date(2012, 1, 25);
|
||||
$('#date-start')
|
||||
@@ -1,4 +1,4 @@
|
||||
// Type definitions for bootstrap.datepicker
|
||||
// Type definitions for bootstrap-datepicker
|
||||
// Project: https://github.com/eternicode/bootstrap-datepicker
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
19
bootstrap-datepicker/tsconfig.json
vendored
Normal file
19
bootstrap-datepicker/tsconfig.json
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bootstrap-datepicker-tests.ts"
|
||||
]
|
||||
}
|
||||
2
c3/index.d.ts
vendored
2
c3/index.d.ts
vendored
@@ -747,7 +747,7 @@ declare namespace c3 {
|
||||
/**
|
||||
* The radius size of each point.
|
||||
*/
|
||||
r?: number;
|
||||
r?: number | ((d: any) => number);
|
||||
|
||||
focus?: {
|
||||
expand: {
|
||||
|
||||
36
cassandra-driver/cassandra-driver.d.ts
vendored
36
cassandra-driver/cassandra-driver.d.ts
vendored
@@ -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>;
|
||||
}
|
||||
|
||||
847
devexpress-web/index.d.ts
vendored
847
devexpress-web/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
12
devtools-detect/devtools-detect-tests.ts
Normal file
12
devtools-detect/devtools-detect-tests.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/// <reference path="devtools-detect.d.ts" />
|
||||
|
||||
// check if it's open
|
||||
console.log('is DevTools open?', window.devtools.open);
|
||||
// check it's orientation, null if not open
|
||||
console.log('and DevTools orientation?', window.devtools.orientation);
|
||||
|
||||
// get notified when it's opened/closed or orientation changes
|
||||
window.addEventListener('devtoolschange', function (e) {
|
||||
console.log('is DevTools open?', e.detail.open);
|
||||
console.log('and DevTools orientation?', e.detail.orientation);
|
||||
});
|
||||
16
devtools-detect/devtools-detect.d.ts
vendored
Normal file
16
devtools-detect/devtools-detect.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Type definitions for ajv
|
||||
// Project: https://github.com/sindresorhus/devtools-detect
|
||||
// Definitions by: York Yao <https://github.com/plantain-00/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
type DevTools = {
|
||||
open: boolean;
|
||||
orientation: "vertical" | "horizontal";
|
||||
}
|
||||
interface DevToolsEvent extends Event {
|
||||
detail: DevTools;
|
||||
}
|
||||
interface Window {
|
||||
devtools: DevTools;
|
||||
addEventListener(type: "devtoolschange", listener: (ev: DevToolsEvent) => any, useCapture?: boolean): void;
|
||||
}
|
||||
11
documentdb/index.d.ts
vendored
11
documentdb/index.d.ts
vendored
@@ -78,7 +78,7 @@ interface QueryError {
|
||||
code: number;
|
||||
|
||||
/** A string representing the error information. */
|
||||
body: string; //{ code: string; message: string; };
|
||||
body: string; // { code: string; message: string; };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,12 @@ interface RequestCallback<TResult> {
|
||||
|
||||
/** Represents the result returned from a query. */
|
||||
interface QueryIterator<TResultRow> {
|
||||
|
||||
current(): TResultRow;
|
||||
executeNext(callback: (error: QueryError, result: TResultRow[]) => void): void;
|
||||
forEach(iteratorFunction: (error: QueryError, element: TResultRow) => void): void;
|
||||
hasMoreResults(): boolean;
|
||||
nextItem(callback: (error: QueryError, item: TResultRow) => void): void;
|
||||
reset(): void;
|
||||
toArray(callback: (error: QueryError, result: TResultRow[]) => void): void;
|
||||
}
|
||||
|
||||
@@ -126,7 +131,7 @@ interface NewDocument<TContent> extends UniqueId {
|
||||
* Define a custom property in order to disambiguate the JSON document from the metadata added by Azure.
|
||||
* This property is optional and the name is application-specific.
|
||||
*/
|
||||
//doc: TContent;
|
||||
// doc: TContent;
|
||||
}
|
||||
|
||||
/** Represents a document retrieved from storage.
|
||||
|
||||
81
domurl/domurl-tests.ts
Normal file
81
domurl/domurl-tests.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
/// <reference path="domurl.d.ts" />
|
||||
|
||||
interface UModel extends QueryString {
|
||||
a: any;
|
||||
b: string;
|
||||
}
|
||||
|
||||
interface U2Model extends QueryString {
|
||||
a: any;
|
||||
}
|
||||
|
||||
interface U3Model extends QueryString {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
var u = new Url<UModel>(); // current document URL will be used
|
||||
// or we can instantiate as
|
||||
var u2 = new Url<U2Model>("http://example.com/some/path?a=b&c=d#someAnchor");
|
||||
// it should support relative URLs also
|
||||
var u3 = new Url<U3Model>("/my/site/doc/path?foo=bar#baz");
|
||||
|
||||
// get the value of some query string parameter
|
||||
console.log(u2.query.a);
|
||||
// or
|
||||
console.log(u3.query["foo"]);
|
||||
|
||||
// Manipulating query string parameters
|
||||
u.query.a = [1, 2, 3]; // adds/replaces in query string params a=1&a=2&a=3
|
||||
u.query.b = 'woohoo'; // adds/replaces in query string param b=woohoo
|
||||
|
||||
if (u.query.a instanceof Array) { // the way to add a parameter
|
||||
u.query.a.push(4); // now it's "a=1&a=2&a=3&a=4&b=woohoo"
|
||||
}
|
||||
|
||||
else { // if not an array but scalar value here is a way how to convert to array
|
||||
u.query.a = [u.query.a];
|
||||
u.query.a.push(8)
|
||||
}
|
||||
|
||||
|
||||
// The way to remove the parameter:
|
||||
delete u.query.a;
|
||||
// or:
|
||||
delete u.query["a"];
|
||||
|
||||
// If you need to remove all query string params:
|
||||
console.log(u.clearQuery());
|
||||
console.log(u.queryLength());
|
||||
console.log(u.isEmptyQuery());
|
||||
|
||||
// Lookup URL parts:
|
||||
console.log(
|
||||
'protocol = ' + u.protocol + '\n' +
|
||||
'user = ' + u.user + '\n' +
|
||||
'pass = ' + u.pass + '\n' +
|
||||
'host = ' + u.host + '\n' +
|
||||
'port = ' + u.port + '\n' +
|
||||
'path = ' + u.path + '\n' +
|
||||
'query = ' + u.query + '\n' +
|
||||
'hash = ' + u.hash
|
||||
);
|
||||
|
||||
// Manipulating URL parts
|
||||
u.path = '/some/new/path'; // the way to change URL path
|
||||
u.protocol = 'https'; // the way to force https protocol on the source URL
|
||||
|
||||
// inject into string
|
||||
var str = '<a href="' + u + '">My Cool Link</a>';
|
||||
|
||||
// or use in DOM context
|
||||
var a = document.createElement('a');
|
||||
a.href = u.toString();
|
||||
a.innerHTML = 'test';
|
||||
document.body.appendChild(a);
|
||||
|
||||
// Stringify
|
||||
var su1 = u + '';
|
||||
var su2 = String(u);
|
||||
var su3 = u.toString();
|
||||
// NOTE, that usually it will be done automatically, so only in special
|
||||
// cases direct stringify is required
|
||||
30
domurl/domurl.d.ts
vendored
Normal file
30
domurl/domurl.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Type definitions for domurl
|
||||
// Project: https://github.com/Mikhus/domurl
|
||||
// Definitions by: Mikhus <ttps://github.com/Mikhus>
|
||||
// Definitions: https://github.com/Mikhus/DefinitelyTyped
|
||||
|
||||
declare class QueryString {
|
||||
constructor(qs?: string);
|
||||
toString: () => string;
|
||||
}
|
||||
|
||||
declare class Url<T> {
|
||||
constructor(url?: string);
|
||||
query: T;
|
||||
protocol: string;
|
||||
user: string;
|
||||
pass: string;
|
||||
host: string;
|
||||
port: string;
|
||||
path: string;
|
||||
hash: string;
|
||||
href: string;
|
||||
toString: () => string;
|
||||
encode: (s: string) => string;
|
||||
decode: (s: string) => string;
|
||||
isAbsolute: () => boolean;
|
||||
paths: (paths?: [string]) => [string];
|
||||
isEmptyQuery: () => boolean;
|
||||
queryLength: () => number;
|
||||
clearQuery: () => Url<T>;
|
||||
}
|
||||
@@ -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');
|
||||
|
||||
111
electron/index.d.ts
vendored
111
electron/index.d.ts
vendored
@@ -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.
|
||||
*/
|
||||
|
||||
9
epub/epub-tests.ts
Normal file
9
epub/epub-tests.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference path="epub.d.ts" />
|
||||
import EPub = require("epub");
|
||||
|
||||
var epub = new EPub("./file.epub");
|
||||
epub.on("end", function(){
|
||||
epub.getChapter("chapter_id", function(err: Error, text: string) {});
|
||||
});
|
||||
|
||||
epub.parse();
|
||||
66
epub/epub.d.ts
vendored
Normal file
66
epub/epub.d.ts
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
// Type definitions for epub
|
||||
// Project: https://github.com/julien-c/epub
|
||||
// Definitions by: Julien Chaumond <https://github.com/julien-c>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
/**
|
||||
* new EPub(fname[, imageroot][, linkroot])
|
||||
* - fname (String): filename for the ebook
|
||||
* - imageroot (String): URL prefix for images
|
||||
* - linkroot (String): URL prefix for links
|
||||
*
|
||||
* Creates an Event Emitter type object for parsing epub files
|
||||
*
|
||||
* var epub = new EPub("book.epub");
|
||||
* epub.on("end", function () {
|
||||
* console.log(epub.spine);
|
||||
* });
|
||||
* epub.on("error", function (error) { ... });
|
||||
* epub.parse();
|
||||
*
|
||||
* Image and link URL format is:
|
||||
*
|
||||
* imageroot + img_id + img_zip_path
|
||||
*
|
||||
* So an image "logo.jpg" which resides in "OPT/" in the zip archive
|
||||
* and is listed in the manifest with id "logo_img" will have the
|
||||
* following url (providing that imageroot is "/images/"):
|
||||
*
|
||||
* /images/logo_img/OPT/logo.jpg
|
||||
**/
|
||||
declare module "epub" {
|
||||
|
||||
import {EventEmitter} from "events";
|
||||
|
||||
interface TocElement {
|
||||
level: number;
|
||||
order: number;
|
||||
title: string;
|
||||
id: string;
|
||||
href?: string;
|
||||
}
|
||||
|
||||
class EPub extends EventEmitter {
|
||||
constructor(epubfile: string, imagewebroot?: string, chapterwebroot?: string);
|
||||
|
||||
metadata: Object;
|
||||
manifest: Object;
|
||||
spine: Object;
|
||||
flow: Array<Object>;
|
||||
toc: Array<TocElement>;
|
||||
|
||||
parse(): void;
|
||||
|
||||
getChapter(chapterId: string, callback: (error: Error, text: string) => void): void;
|
||||
|
||||
getChapterRaw(chapterId: string, callback: (error: Error, text: string) => void): void;
|
||||
|
||||
getImage(id: string, callback: (error: Error, data: Buffer, mimeType: string) => void): void;
|
||||
|
||||
getFile(id: string, callback: (error: Error, data: Buffer, mimeType: string) => void): void;
|
||||
}
|
||||
|
||||
export = EPub;
|
||||
}
|
||||
3759
graphene-pk11/index.d.ts
vendored
3759
graphene-pk11/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
10
highcharts/highcharts-modules-no-data-to-display-tests.ts
Normal file
10
highcharts/highcharts-modules-no-data-to-display-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/// <reference path="highcharts-modules-no-data-to-display.d.ts" />
|
||||
/// <reference path="highcharts.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
function test_NoDataToDisplay() {
|
||||
var chart = $("#container").highcharts();
|
||||
var chartHasData = chart.hasData();
|
||||
chart.hideNoData();
|
||||
chart.showNoData("Custom no data message");
|
||||
}
|
||||
26
highcharts/highcharts-modules-no-data-to-display.d.ts
vendored
Normal file
26
highcharts/highcharts-modules-no-data-to-display.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// Type definitions for Highcharts No Data to Display
|
||||
// Project: http://www.highcharts.com/
|
||||
// Definitions by: Andrey Zolotin <http://github.com/nitoloz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
/// <reference path="highcharts.d.ts" />
|
||||
interface HighchartsChartObject {
|
||||
/**
|
||||
* Returns true if there are data points within the plot area now
|
||||
* @return {boolean} If chart has any data.
|
||||
* @since 3.0.8
|
||||
*/
|
||||
hasData(): boolean;
|
||||
|
||||
/**
|
||||
* Hide the 'No data to display' message added by the no-data-to-display plugin.
|
||||
* @since 3.0.8
|
||||
*/
|
||||
hideNoData(): void;
|
||||
|
||||
/**
|
||||
* Display a no-data message.
|
||||
* @param {String} message An optional message to show in place of the default one
|
||||
* @since 3.0.8
|
||||
*/
|
||||
showNoData(message?: string): void;
|
||||
}
|
||||
214
inversify-inject-decorators/inversify-inject-decorators-tests.ts
Normal file
214
inversify-inject-decorators/inversify-inject-decorators-tests.ts
Normal file
@@ -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
|
||||
|
||||
}
|
||||
32
inversify-inject-decorators/inversify-inject-decorators.d.ts
vendored
Normal file
32
inversify-inject-decorators/inversify-inject-decorators.d.ts
vendored
Normal file
@@ -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
jsonschema/jsonschema-tests.ts
Normal file
6
jsonschema/jsonschema-tests.ts
Normal 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
jsonschema/jsonschema.d.ts
vendored
Normal file
103
jsonschema/jsonschema.d.ts
vendored
Normal 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): {};
|
||||
}
|
||||
}
|
||||
|
||||
68
knex/index.d.ts
vendored
68
knex/index.d.ts
vendored
@@ -326,8 +326,9 @@ declare namespace Knex {
|
||||
}
|
||||
|
||||
interface Transaction extends QueryBuilder {
|
||||
commit: any;
|
||||
rollback: any;
|
||||
commit: any;
|
||||
rollback: any;
|
||||
raw: Knex.RawBuilder;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -347,36 +348,37 @@ declare namespace Knex {
|
||||
}
|
||||
|
||||
interface TableBuilder {
|
||||
increments(columnName?: string): ColumnBuilder;
|
||||
bigIncrements(columnName?: string): ColumnBuilder;
|
||||
dropColumn(columnName: string): TableBuilder;
|
||||
dropColumns(...columnNames: string[]): TableBuilder;
|
||||
renameColumn(from: string, to: string): ColumnBuilder;
|
||||
integer(columnName: string): ColumnBuilder;
|
||||
bigInteger(columnName: string): ColumnBuilder;
|
||||
text(columnName: string, textType?: string): ColumnBuilder;
|
||||
string(columnName: string, length?: number): ColumnBuilder;
|
||||
float(columnName: string, precision?: number, scale?: number): ColumnBuilder;
|
||||
decimal(columnName: string, precision?: number, scale?: number): ColumnBuilder;
|
||||
boolean(columnName: string): ColumnBuilder;
|
||||
date(columnName: string): ColumnBuilder;
|
||||
dateTime(columnName: string): ColumnBuilder;
|
||||
time(columnName: string): ColumnBuilder;
|
||||
timestamp(columnName: string): ColumnBuilder;
|
||||
timestamps(): ColumnBuilder;
|
||||
binary(columnName: string): ColumnBuilder;
|
||||
enum(columnName: string, values: Value[]): ColumnBuilder;
|
||||
enu(columnName: string, values: Value[]): ColumnBuilder;
|
||||
json(columnName: string): ColumnBuilder;
|
||||
uuid(columnName: string): ColumnBuilder;
|
||||
comment(val: string): TableBuilder;
|
||||
specificType(columnName: string, type: string): ColumnBuilder;
|
||||
primary(columnNames: string[]): TableBuilder;
|
||||
index(columnNames: string[], indexName?: string, indexType?: string): TableBuilder;
|
||||
unique(columnNames: string[], indexName?: string): TableBuilder;
|
||||
foreign(column: string): ForeignConstraintBuilder;
|
||||
foreign(columns: string[]): MultikeyForeignConstraintBuilder;
|
||||
dropForeign(columnNames: string[], foreignKeyName?: string): TableBuilder;
|
||||
increments(columnName?: string): ColumnBuilder;
|
||||
bigIncrements(columnName?: string): ColumnBuilder;
|
||||
dropColumn(columnName: string): TableBuilder;
|
||||
dropColumns(...columnNames: string[]): TableBuilder;
|
||||
renameColumn(from: string, to: string): ColumnBuilder;
|
||||
integer(columnName: string): ColumnBuilder;
|
||||
bigInteger(columnName: string): ColumnBuilder;
|
||||
text(columnName: string, textType?: string): ColumnBuilder;
|
||||
string(columnName: string, length?: number): ColumnBuilder;
|
||||
float(columnName: string, precision?: number, scale?: number): ColumnBuilder;
|
||||
decimal(columnName: string, precision?: number, scale?: number): ColumnBuilder;
|
||||
boolean(columnName: string): ColumnBuilder;
|
||||
date(columnName: string): ColumnBuilder;
|
||||
dateTime(columnName: string): ColumnBuilder;
|
||||
time(columnName: string): ColumnBuilder;
|
||||
timestamp(columnName: string): ColumnBuilder;
|
||||
timestamps(): ColumnBuilder;
|
||||
binary(columnName: string): ColumnBuilder;
|
||||
enum(columnName: string, values: Value[]): ColumnBuilder;
|
||||
enu(columnName: string, values: Value[]): ColumnBuilder;
|
||||
json(columnName: string): ColumnBuilder;
|
||||
jsonb(columnName: string): ColumnBuilder;
|
||||
uuid(columnName: string): ColumnBuilder;
|
||||
comment(val: string): TableBuilder;
|
||||
specificType(columnName: string, type: string): ColumnBuilder;
|
||||
primary(columnNames: string[]) : TableBuilder;
|
||||
index(columnNames: string[], indexName?: string, indexType?: string) : TableBuilder;
|
||||
unique(columnNames: string[], indexName?: string) : TableBuilder;
|
||||
foreign(column: string): ForeignConstraintBuilder;
|
||||
foreign(columns: string[]): MultikeyForeignConstraintBuilder;
|
||||
dropForeign(columnNames: string[], foreignKeyName?: string): TableBuilder;
|
||||
}
|
||||
|
||||
interface CreateTableBuilder extends TableBuilder {
|
||||
@@ -452,6 +454,8 @@ declare namespace Knex {
|
||||
pool?: PoolConfig;
|
||||
migrations?: MigratorConfig;
|
||||
acquireConnectionTimeout?: number;
|
||||
useNullAsDefault?: boolean;
|
||||
searchPath?: string;
|
||||
}
|
||||
|
||||
interface ConnectionConfig {
|
||||
|
||||
@@ -75,6 +75,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
|
||||
@@ -366,6 +378,8 @@ knex.transaction(function(trx) {
|
||||
// Using trx as a transaction object:
|
||||
knex.transaction(function(trx) {
|
||||
|
||||
trx.raw('')
|
||||
|
||||
var info: any;
|
||||
var books: any[] = [
|
||||
{title: 'Canterbury Tales'},
|
||||
|
||||
21
koa-hbs/koa-hbs-tests.ts
Normal file
21
koa-hbs/koa-hbs-tests.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/// <reference path="./koa-hbs.d.ts" />
|
||||
/// <reference path="../koa/koa.d.ts" />
|
||||
|
||||
import * as Hbs from 'koa-hbs';
|
||||
import * as Koa from 'koa';
|
||||
import * as Path from 'path';
|
||||
|
||||
const app = new Koa();
|
||||
const hbs = new Hbs();
|
||||
|
||||
app.use(hbs.middleware({
|
||||
viewPath: Path.join(__dirname, './views')
|
||||
}));
|
||||
|
||||
app.use(function *(next: any) {
|
||||
yield this.render('index', {
|
||||
title: 'Hello World!'
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000);
|
||||
55
koa-hbs/koa-hbs.d.ts
vendored
Normal file
55
koa-hbs/koa-hbs.d.ts
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
// Type definitions for koa-favicon v2.x
|
||||
// Project: https://github.com/gilt/koa-hbs
|
||||
// Definitions by: Jacob Malone <https://github.com/jcbmln/>
|
||||
// Definitions: https://github.com/jcbmln/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
import * as Hbs from "koa-hbs";
|
||||
import * as Koa from "koa";
|
||||
|
||||
var hbs = new Hbs();
|
||||
var app = new Koa();
|
||||
|
||||
app.use(hbs.middleware({
|
||||
viewPath: __dirname + '/views'
|
||||
}));
|
||||
|
||||
app.use(function *() {
|
||||
yield this.render('main', {
|
||||
title: 'koa-hbs'
|
||||
});
|
||||
});
|
||||
|
||||
=============================================== */
|
||||
|
||||
/// <reference path="../koa/koa.d.ts" />
|
||||
|
||||
declare module "koa-hbs" {
|
||||
|
||||
import * as Koa from "koa";
|
||||
|
||||
namespace Hbs {
|
||||
export interface Middleware {
|
||||
viewPath: Array<string> | string,
|
||||
handlebars?: Function,
|
||||
templateOptions?: {},
|
||||
extname?: string,
|
||||
partialsPath?: Array<string> | string,
|
||||
defaultLayout?: string,
|
||||
layoutsPath?: string,
|
||||
contentHelperName?: string,
|
||||
blockHelperName?: string,
|
||||
disableCache?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
class Hbs {
|
||||
constructor();
|
||||
|
||||
middleware(opts: Hbs.Middleware): any;
|
||||
}
|
||||
|
||||
namespace Hbs {}
|
||||
export = Hbs;
|
||||
}
|
||||
10
leaflet-geocoder-mapzen/leaflet-geocoder-mapzen-tests.ts
Normal file
10
leaflet-geocoder-mapzen/leaflet-geocoder-mapzen-tests.ts
Normal file
@@ -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 = '© <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
leaflet-geocoder-mapzen/leaflet-geocoder-mapzen.d.ts
vendored
Normal file
177
leaflet-geocoder-mapzen/leaflet-geocoder-mapzen.d.ts
vendored
Normal 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;
|
||||
}
|
||||
}
|
||||
20
lru-cache/index.d.ts
vendored
20
lru-cache/index.d.ts
vendored
@@ -12,20 +12,22 @@ declare namespace LRU {
|
||||
max?: number;
|
||||
maxAge?: number;
|
||||
length?: (value: T) => number;
|
||||
dispose?: (key: string, value: T) => void;
|
||||
dispose?: (key: any, value: T) => void;
|
||||
stale?: boolean;
|
||||
}
|
||||
|
||||
interface Cache<T> {
|
||||
set(key: string, value: T): void;
|
||||
get(key: string): T;
|
||||
peek(key: string): T;
|
||||
has(key: string): boolean
|
||||
del(key: string): void;
|
||||
set(key: any, value: T): void;
|
||||
get(key: any): T;
|
||||
peek(key: any): T;
|
||||
has(key: any): boolean
|
||||
del(key: any): void;
|
||||
reset(): void;
|
||||
forEach(iter: (value: T, key: string, cache: Cache<T>) => void, thisp?: any): void;
|
||||
|
||||
keys(): string[];
|
||||
prune(): void;
|
||||
forEach(iter: (value: T, key: any, cache: Cache<T>) => void, thisp?: any): void;
|
||||
itemCount: number;
|
||||
length: number
|
||||
keys(): any[];
|
||||
values(): T[];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
72
marker-animate-unobtrusive/marker-animate-unobtrusive.d.ts
vendored
Normal file
72
marker-animate-unobtrusive/marker-animate-unobtrusive.d.ts
vendored
Normal file
@@ -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;
|
||||
}
|
||||
19
ng-dialog/index.d.ts
vendored
19
ng-dialog/index.d.ts
vendored
@@ -217,13 +217,18 @@ declare module 'angular' {
|
||||
*/
|
||||
ariaDescribedById?: string;
|
||||
|
||||
/**
|
||||
* Specifies the CSS selector for the element to be referenced by the aria-describedby attribute on the dialog element. Default value is null (unspecified)
|
||||
*
|
||||
* If specified, the first matching element is used.
|
||||
*/
|
||||
ariaDescribedBySelector?: string;
|
||||
}
|
||||
/**
|
||||
* Specifies the CSS selector for the element to be referenced by the aria-describedby attribute on the dialog element. Default value is null (unspecified)
|
||||
*
|
||||
* If specified, the first matching element is used.
|
||||
*/
|
||||
ariaDescribedBySelector?: string;
|
||||
|
||||
/**
|
||||
* Specifies the width of the dialog content element. Default value is null (unspecified)
|
||||
*/
|
||||
width?: string|number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options which are provided to open a dialog.
|
||||
|
||||
5
pikaday/index.d.ts
vendored
5
pikaday/index.d.ts
vendored
@@ -106,6 +106,11 @@ declare class Pikaday {
|
||||
*/
|
||||
setEndRange(date: Date): void;
|
||||
|
||||
/**
|
||||
* Update the HTML.
|
||||
*/
|
||||
draw(force: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns true if the picker is visible.
|
||||
*/
|
||||
|
||||
1223
pkcs11js/index.d.ts
vendored
Normal file
1223
pkcs11js/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/// <reference path="./pkcs11js.d.ts" />
|
||||
/// <reference types="pkcs11js" />
|
||||
|
||||
import * as pkcs11js from "pkcs11js";
|
||||
|
||||
@@ -44,4 +44,4 @@ catch (e) {
|
||||
}
|
||||
finally {
|
||||
pkcs11.C_Finalize();
|
||||
}
|
||||
}
|
||||
|
||||
1226
pkcs11js/pkcs11js.d.ts
vendored
1226
pkcs11js/pkcs11js.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"drop-tests.ts"
|
||||
"pkcs11js-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
)
|
||||
|
||||
15
react-i18next/react-i18next.d.ts
vendored
15
react-i18next/react-i18next.d.ts
vendored
@@ -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,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>
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
2
react-modal/react-modal.d.ts
vendored
2
react-modal/react-modal.d.ts
vendored
@@ -24,5 +24,5 @@ declare module "react-modal" {
|
||||
shouldCloseOnOverlayClick?: boolean
|
||||
}
|
||||
let ReactModal: __React.ClassicComponentClass<ReactModal>;
|
||||
export default ReactModal;
|
||||
export = ReactModal;
|
||||
}
|
||||
|
||||
4554
samchon-framework/samchon-framework.d.ts
vendored
4554
samchon-framework/samchon-framework.d.ts
vendored
File diff suppressed because it is too large
Load Diff
1
select2/index.d.ts
vendored
1
select2/index.d.ts
vendored
@@ -80,6 +80,7 @@ interface Select2Options {
|
||||
templateResult?: (object: Select2SelectionObject) => any;
|
||||
language?: string | string[] | {};
|
||||
selectOnClose?: boolean;
|
||||
sorter?: (data: any[]) => any[];
|
||||
}
|
||||
|
||||
interface Select2JQueryEventObject extends JQueryEventObject {
|
||||
|
||||
@@ -34,6 +34,7 @@ $("#e5").select2({
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#e19").select2({ maximumSelectionSize: 3 });
|
||||
$("#e10").select2({
|
||||
data: [{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' }, { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' }]
|
||||
@@ -121,6 +122,13 @@ $("#e7").select2({
|
||||
dropdownCssClass: "bigdrop"
|
||||
});
|
||||
|
||||
function sort(elements) {
|
||||
return elements.sort();
|
||||
}
|
||||
$("#e20").select2({
|
||||
sorter: sort
|
||||
});
|
||||
|
||||
$("#e8").select2();
|
||||
$("#e8_get").click(function () { alert("Selected value is: " + $("#e8").select2("val")); });
|
||||
$("#e8_set").click(function () { $("#e8").select2("val", "CA"); });
|
||||
|
||||
1
sequelize/index.d.ts
vendored
1
sequelize/index.d.ts
vendored
@@ -10,6 +10,7 @@
|
||||
/// <reference types="validator" />
|
||||
|
||||
|
||||
import * as _ from "lodash";
|
||||
|
||||
declare namespace sequelize {
|
||||
|
||||
|
||||
5
stripe/index.d.ts
vendored
5
stripe/index.d.ts
vendored
@@ -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;
|
||||
|
||||
54
superagent/index.d.ts
vendored
54
superagent/index.d.ts
vendored
@@ -80,33 +80,33 @@ declare namespace request {
|
||||
}
|
||||
|
||||
interface Request extends Promise<Response> /* extends NodeJS.WritableStream */ {
|
||||
abort(): void;
|
||||
accept(type: string): this;
|
||||
attach(field: string, file: string, filename?: string): this;
|
||||
auth(user: string, name: string): this;
|
||||
buffer(val: boolean): this;
|
||||
clearTimeout(): this;
|
||||
end(callback?: CallbackHandler): this;
|
||||
field(name: string, val: string): this;
|
||||
get(field: string): string;
|
||||
on(name: string, handler: Function): this;
|
||||
on(name: 'error', handler: (err: any) => void): this;
|
||||
part(): this;
|
||||
pipe(stream: NodeJS.WritableStream, options?: Object): stream.Writable;
|
||||
query(val: Object): this;
|
||||
redirects(n: number): this;
|
||||
send(data: string): this;
|
||||
send(data: Object): this;
|
||||
send(): this;
|
||||
set(field: string, val: string): this;
|
||||
set(field: Object): this;
|
||||
timeout(ms: number): this;
|
||||
type(val: string): this;
|
||||
use(fn: Function): this;
|
||||
withCredentials(): this;
|
||||
write(data: string, encoding?: string): this;
|
||||
write(data: Buffer, encoding?: string): this;
|
||||
parse(fn: (res: Response, callback: (err: Error, body: any) => void) => void): this;
|
||||
abort(): void;
|
||||
accept(type: string): this;
|
||||
attach(field: string, file: string, filename?: string): this;
|
||||
auth(user: string, name: string): this;
|
||||
buffer(val?: boolean): this;
|
||||
clearTimeout(): this;
|
||||
end(callback?: CallbackHandler): this;
|
||||
field(name: string, val: string): this;
|
||||
get(field: string): string;
|
||||
on(name: string, handler: Function): this;
|
||||
on(name: 'error', handler: (err: any) => void): this;
|
||||
part(): this;
|
||||
pipe(stream: NodeJS.WritableStream, options?: Object): stream.Writable;
|
||||
query(val: Object): this;
|
||||
redirects(n: number): this;
|
||||
send(data: string): this;
|
||||
send(data: Object): this;
|
||||
send(): this;
|
||||
set(field: string, val: string): this;
|
||||
set(field: Object): this;
|
||||
timeout(ms: number): this;
|
||||
type(val: string): this;
|
||||
use(fn: Function): this;
|
||||
withCredentials(): this;
|
||||
write(data: string, encoding?: string): this;
|
||||
write(data: Buffer, encoding?: string): this;
|
||||
parse(fn: (res: Response, callback: (err: Error, body: any) => void) => void): this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///<reference types="tether" />
|
||||
import Drop = require("drop");
|
||||
import Drop = require("tether-drop");
|
||||
|
||||
var yellowBox = document.querySelector(".yellow");
|
||||
var greenBox = document.querySelector(".green");
|
||||
61
tether-drop/tether-drop.d.ts
vendored
Normal file
61
tether-drop/tether-drop.d.ts
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
// Type definitions for Drop v1.4
|
||||
// Project: http://github.hubspot.com/drop/
|
||||
// Definitions by: Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference path="../tether/tether.d.ts" />
|
||||
|
||||
// global Drop constructor
|
||||
declare class Drop {
|
||||
constructor(options: Drop.IDropOptions);
|
||||
|
||||
public content: HTMLElement;
|
||||
public element: HTMLElement;
|
||||
public tether: Tether;
|
||||
public open(): void;
|
||||
public close(): void;
|
||||
public remove(): void;
|
||||
public toggle(): void;
|
||||
public isOpened(): boolean;
|
||||
public position(): void;
|
||||
public destroy(): void;
|
||||
|
||||
/*
|
||||
* Drop instances fire "open" and "close" events.
|
||||
*/
|
||||
public on(event: string, handler: Function, context?: any): void;
|
||||
public once(event: string, handler: Function, context?: any): void;
|
||||
public off(event: string, handler?: Function): void;
|
||||
|
||||
public static createContext(options: Drop.IDropContextOptions): typeof Drop;
|
||||
}
|
||||
|
||||
declare namespace Drop {
|
||||
interface IDropContextOptions {
|
||||
classPrefix?: string;
|
||||
defaults?: IDropOptions;
|
||||
}
|
||||
|
||||
interface IDropOptions {
|
||||
target?: Element;
|
||||
content?: Element | string | ((drop?: Drop) => string) | ((drop?: Drop) => Element);
|
||||
position?: string;
|
||||
openOn?: string;
|
||||
classes?: string;
|
||||
constrainToWindow?: boolean;
|
||||
constrainToScrollParent?: boolean;
|
||||
remove?: boolean;
|
||||
beforeClose?: () => boolean;
|
||||
openDelay?: number;
|
||||
closeDelay?: number;
|
||||
focusDelay?: number;
|
||||
blurDelay?: number;
|
||||
hoverOpenDelay?: number;
|
||||
hoverCloseDelay?: number;
|
||||
tetherOptions?: Tether.ITetherOptions;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "tether-drop" {
|
||||
export = Drop;
|
||||
}
|
||||
@@ -14,6 +14,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bootstrap.datepicker-tests.ts"
|
||||
"tether-drop-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
232
twilio/twilio-tests.ts
Normal file
232
twilio/twilio-tests.ts
Normal 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
twilio/twilio.d.ts
vendored
Normal file
875
twilio/twilio.d.ts
vendored
Normal 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> {}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="typescript-stl.d.ts" />
|
||||
|
||||
import std = require("typescript-stl");
|
||||
std.example.test_all();
|
||||
console.log(std);
|
||||
1357
typescript-stl/typescript-stl.d.ts
vendored
1357
typescript-stl/typescript-stl.d.ts
vendored
File diff suppressed because it is too large
Load Diff
1
underscore/index.d.ts
vendored
1
underscore/index.d.ts
vendored
@@ -5928,5 +5928,6 @@ declare module _ {
|
||||
}
|
||||
interface _ChainOfArrays<T> extends _Chain<T[]> {
|
||||
flatten(shallow?: boolean): _Chain<T>;
|
||||
mapObject(fn: _.ListIterator<T, any>): _ChainOfArrays<T>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 } = {
|
||||
|
||||
Reference in New Issue
Block a user