mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Merge upstream into knex types 2.0 branch
This commit is contained in:
Vendored
+219
@@ -0,0 +1,219 @@
|
||||
// Type definitions for amqplib 0.3.x
|
||||
// Project: https://github.com/squaremo/amqp.node
|
||||
// Definitions by: Michael Nahkies <https://github.com/mnahkies>, Ab Reitsma <https://github.com/abreits>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="when" />
|
||||
/// <reference types="node" />
|
||||
|
||||
declare module "amqplib/properties" {
|
||||
namespace Replies {
|
||||
interface Empty {
|
||||
}
|
||||
interface AssertQueue {
|
||||
queue: string;
|
||||
messageCount: number;
|
||||
consumerCount: number;
|
||||
}
|
||||
interface PurgeQueue {
|
||||
messageCount: number;
|
||||
}
|
||||
interface DeleteQueue {
|
||||
messageCount: number;
|
||||
}
|
||||
interface AssertExchange {
|
||||
exchange: string;
|
||||
}
|
||||
interface Consume {
|
||||
consumerTag: string;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Options {
|
||||
interface AssertQueue {
|
||||
exclusive?: boolean;
|
||||
durable?: boolean;
|
||||
autoDelete?: boolean;
|
||||
arguments?: any;
|
||||
messageTtl?: number;
|
||||
expires?: number;
|
||||
deadLetterExchange?: string;
|
||||
deadLetterRoutingKey?: string;
|
||||
maxLength?: number;
|
||||
}
|
||||
interface DeleteQueue {
|
||||
ifUnused?: boolean;
|
||||
ifEmpty?: boolean;
|
||||
}
|
||||
interface AssertExchange {
|
||||
durable?: boolean;
|
||||
internal?: boolean;
|
||||
autoDelete?: boolean;
|
||||
alternateExchange?: string;
|
||||
arguments?: any;
|
||||
}
|
||||
interface DeleteExchange {
|
||||
ifUnused?: boolean;
|
||||
}
|
||||
interface Publish {
|
||||
expiration?: string;
|
||||
userId?: string;
|
||||
CC?: string | string[];
|
||||
|
||||
mandatory?: boolean;
|
||||
persistent?: boolean;
|
||||
deliveryMode?: boolean | number;
|
||||
BCC?: string | string[];
|
||||
|
||||
contentType?: string;
|
||||
contentEncoding?: string;
|
||||
headers?: any;
|
||||
priority?: number;
|
||||
correlationId?: string;
|
||||
replyTo?: string;
|
||||
messageId?: string;
|
||||
timestamp?: number;
|
||||
type?: string;
|
||||
appId?: string;
|
||||
}
|
||||
interface Consume {
|
||||
consumerTag?: string;
|
||||
noLocal?: boolean;
|
||||
noAck?: boolean;
|
||||
exclusive?: boolean;
|
||||
priority?: number;
|
||||
arguments?: any;
|
||||
}
|
||||
interface Get {
|
||||
noAck?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
interface Message {
|
||||
content: Buffer;
|
||||
fields: any;
|
||||
properties: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "amqplib" {
|
||||
|
||||
import events = require("events");
|
||||
import when = require("when");
|
||||
import shared = require("amqplib/properties")
|
||||
export import Replies = shared.Replies;
|
||||
export import Options = shared.Options;
|
||||
export import Message = shared.Message;
|
||||
|
||||
interface Connection extends events.EventEmitter {
|
||||
close(): when.Promise<void>;
|
||||
createChannel(): when.Promise<Channel>;
|
||||
createConfirmChannel(): when.Promise<Channel>;
|
||||
}
|
||||
|
||||
interface Channel extends events.EventEmitter {
|
||||
close(): when.Promise<void>;
|
||||
|
||||
assertQueue(queue: string, options?: Options.AssertQueue): when.Promise<Replies.AssertQueue>;
|
||||
checkQueue(queue: string): when.Promise<Replies.AssertQueue>;
|
||||
|
||||
deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise<Replies.DeleteQueue>;
|
||||
purgeQueue(queue: string): when.Promise<Replies.PurgeQueue>;
|
||||
|
||||
bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
|
||||
unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
|
||||
|
||||
assertExchange(exchange: string, type: string, options?: Options.AssertExchange): when.Promise<Replies.AssertExchange>;
|
||||
checkExchange(exchange: string): when.Promise<Replies.Empty>;
|
||||
|
||||
deleteExchange(exchange: string, options?: Options.DeleteExchange): when.Promise<Replies.Empty>;
|
||||
|
||||
bindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
|
||||
unbindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
|
||||
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
|
||||
consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): when.Promise<Replies.Consume>;
|
||||
|
||||
cancel(consumerTag: string): when.Promise<Replies.Empty>;
|
||||
get(queue: string, options?: Options.Get): when.Promise<Message | boolean>;
|
||||
|
||||
ack(message: Message, allUpTo?: boolean): void;
|
||||
ackAll(): void;
|
||||
|
||||
nack(message: Message, allUpTo?: boolean, requeue?: boolean): void;
|
||||
nackAll(requeue?: boolean): void;
|
||||
reject(message: Message, requeue?: boolean): void;
|
||||
|
||||
prefetch(count: number, global?: boolean): when.Promise<Replies.Empty>;
|
||||
recover(): when.Promise<Replies.Empty>;
|
||||
}
|
||||
|
||||
function connect(url: string, socketOptions?: any): when.Promise<Connection>;
|
||||
}
|
||||
|
||||
declare module "amqplib/callback_api" {
|
||||
|
||||
import events = require("events");
|
||||
import shared = require("amqplib/properties")
|
||||
export import Replies = shared.Replies;
|
||||
export import Options = shared.Options;
|
||||
export import Message = shared.Message;
|
||||
|
||||
interface Connection extends events.EventEmitter {
|
||||
close(callback?: (err: any) => void): void;
|
||||
createChannel(callback: (err: any, channel: Channel) => void): void;
|
||||
createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void;
|
||||
}
|
||||
|
||||
interface Channel extends events.EventEmitter {
|
||||
close(callback: (err: any) => void): void;
|
||||
|
||||
assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err:any, ok: Replies.AssertQueue) => void): void;
|
||||
checkQueue(queue: string, callback?: (err: any, ok: Replies.AssertQueue) => void): void;
|
||||
|
||||
deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err:any, ok: Replies.DeleteQueue) => void): void;
|
||||
purgeQueue(queue: string, callback?: (err:any, ok: Replies.PurgeQueue) => void): void;
|
||||
|
||||
bindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
unbindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
|
||||
assertExchange(exchange: string, type: string, options?: Options.AssertExchange, callback?: (err: any, ok: Replies.AssertExchange) => void): void;
|
||||
checkExchange(exchange: string, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
|
||||
deleteExchange(exchange: string, options?: Options.DeleteExchange, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
|
||||
bindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
unbindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
|
||||
consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void;
|
||||
|
||||
cancel(consumerTag: string, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | boolean) => void): void;
|
||||
|
||||
ack(message: Message, allUpTo?: boolean): void;
|
||||
ackAll(): void;
|
||||
|
||||
nack(message: Message, allUpTo?: boolean, requeue?: boolean): void;
|
||||
nackAll(requeue?: boolean): void;
|
||||
reject(message: Message, requeue?: boolean): void;
|
||||
|
||||
prefetch(count: number, global?: boolean): void;
|
||||
recover(callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
}
|
||||
|
||||
interface ConfirmChannel extends Channel {
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean;
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean;
|
||||
|
||||
waitForConfirms(callback?: (err: any) => void): void;
|
||||
}
|
||||
|
||||
function connect(callback: (err: any, connection: Connection) => void): void;
|
||||
function connect(url: string, callback: (err: any, connection: Connection) => void): void;
|
||||
function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void;
|
||||
}
|
||||
+20
-22
@@ -1,44 +1,42 @@
|
||||
|
||||
|
||||
// promise api tests
|
||||
import amqp = require("amqplib");
|
||||
import amqp = require('amqplib');
|
||||
|
||||
var msg = "Hello World";
|
||||
var msg = 'Hello World';
|
||||
|
||||
// test promise api
|
||||
amqp.connect("amqp://localhost")
|
||||
amqp.connect('amqp://localhost')
|
||||
.then(connection => {
|
||||
return connection.createChannel()
|
||||
.tap(channel => channel.checkQueue("myQueue"))
|
||||
.then(channel => channel.sendToQueue("myQueue", new Buffer(msg)))
|
||||
.ensure(() => connection.close());
|
||||
.tap(channel => channel.checkQueue('myQueue'))
|
||||
.then(channel => channel.sendToQueue('myQueue', new Buffer(msg)))
|
||||
.finally(() => connection.close());
|
||||
});
|
||||
|
||||
amqp.connect("amqp://localhost")
|
||||
amqp.connect('amqp://localhost')
|
||||
.then(connection => {
|
||||
return connection.createChannel()
|
||||
.tap(channel => channel.checkQueue("myQueue"))
|
||||
.then(channel => channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString())))
|
||||
.ensure(() => connection.close());
|
||||
.tap(channel => channel.checkQueue('myQueue'))
|
||||
.then(channel => channel.consume('myQueue', newMsg => console.log('New Message: ' + newMsg.content.toString())))
|
||||
.finally(() => connection.close());
|
||||
});
|
||||
|
||||
// test promise api properties
|
||||
var amqpMessage: amqp.Message;
|
||||
amqpMessage.properties.contentType = "application/json";
|
||||
amqpMessage.properties.contentType = 'application/json';
|
||||
var amqpAssertExchangeOptions: amqp.Options.AssertExchange;
|
||||
var anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
|
||||
|
||||
|
||||
// callback api tests
|
||||
import amqpcb = require("amqplib/callback_api");
|
||||
import amqpcb = require('amqplib/callback_api');
|
||||
|
||||
amqpcb.connect("amqp://localhost", (err, connection) => {
|
||||
amqpcb.connect('amqp://localhost', (err, connection) => {
|
||||
if(!err) {
|
||||
connection.createChannel((err, channel) => {
|
||||
if (!err) {
|
||||
channel.assertQueue("myQueue", {}, (err, ok) => {
|
||||
channel.assertQueue('myQueue', {}, (err, ok) => {
|
||||
if(!err) {
|
||||
channel.sendToQueue("myQueue", new Buffer(msg));
|
||||
channel.sendToQueue('myQueue', new Buffer(msg));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -46,13 +44,13 @@ amqpcb.connect("amqp://localhost", (err, connection) => {
|
||||
}
|
||||
});
|
||||
|
||||
amqpcb.connect("amqp://localhost", (err, connection) => {
|
||||
amqpcb.connect('amqp://localhost', (err, connection) => {
|
||||
if(!err) {
|
||||
connection.createChannel((err, channel) => {
|
||||
if (!err) {
|
||||
channel.assertQueue("myQueue", {}, (err, ok) => {
|
||||
channel.assertQueue('myQueue', {}, (err, ok) => {
|
||||
if(!err) {
|
||||
channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString()));
|
||||
channel.consume('myQueue', newMsg => console.log('New Message: ' + newMsg.content.toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -62,6 +60,6 @@ amqpcb.connect("amqp://localhost", (err, connection) => {
|
||||
|
||||
// test callback api properties
|
||||
var amqpcbMessage: amqpcb.Message;
|
||||
amqpcbMessage.properties.contentType = "application/json";
|
||||
amqpcbMessage.properties.contentType = 'application/json';
|
||||
var amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
|
||||
var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
|
||||
var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
|
||||
|
||||
Vendored
+84
-77
@@ -1,13 +1,76 @@
|
||||
// Type definitions for amqplib 0.3.x
|
||||
// Type definitions for amqplib 0.5.x
|
||||
// Project: https://github.com/squaremo/amqp.node
|
||||
// Definitions by: Michael Nahkies <https://github.com/mnahkies>, Ab Reitsma <https://github.com/abreits>
|
||||
// Definitions by: Michael Nahkies <https://github.com/mnahkies>, Ab Reitsma <https://github.com/abreits>, Nicolás Fantone <https://github.com/nfantone>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="when" />
|
||||
/// <reference types="node" />
|
||||
|
||||
declare module "amqplib/properties" {
|
||||
namespace Replies {
|
||||
declare module 'amqplib' {
|
||||
import * as Promise from 'bluebird';
|
||||
import * as events from 'events';
|
||||
import shared = require('amqplib/properties');
|
||||
|
||||
export import Replies = shared.Replies;
|
||||
export import Options = shared.Options;
|
||||
export import Message = shared.Message;
|
||||
|
||||
export interface Connection extends events.EventEmitter {
|
||||
close(): Promise<void>;
|
||||
createChannel(): Promise<Channel>;
|
||||
createConfirmChannel(): Promise<ConfirmChannel>;
|
||||
}
|
||||
|
||||
export interface Channel extends events.EventEmitter {
|
||||
close(): Promise<void>;
|
||||
|
||||
assertQueue(queue: string, options?: Options.AssertQueue): Promise<Replies.AssertQueue>;
|
||||
checkQueue(queue: string): Promise<Replies.AssertQueue>;
|
||||
|
||||
deleteQueue(queue: string, options?: Options.DeleteQueue): Promise<Replies.DeleteQueue>;
|
||||
purgeQueue(queue: string): Promise<Replies.PurgeQueue>;
|
||||
|
||||
bindQueue(queue: string, source: string, pattern: string, args?: any): Promise<Replies.Empty>;
|
||||
unbindQueue(queue: string, source: string, pattern: string, args?: any): Promise<Replies.Empty>;
|
||||
|
||||
assertExchange(exchange: string, type: string, options?: Options.AssertExchange): Promise<Replies.AssertExchange>;
|
||||
checkExchange(exchange: string): Promise<Replies.Empty>;
|
||||
|
||||
deleteExchange(exchange: string, options?: Options.DeleteExchange): Promise<Replies.Empty>;
|
||||
|
||||
bindExchange(destination: string, source: string, pattern: string, args?: any): Promise<Replies.Empty>;
|
||||
unbindExchange(destination: string, source: string, pattern: string, args?: any): Promise<Replies.Empty>;
|
||||
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
|
||||
consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): Promise<Replies.Consume>;
|
||||
|
||||
cancel(consumerTag: string): Promise<Replies.Empty>;
|
||||
get(queue: string, options?: Options.Get): Promise<Message | boolean>;
|
||||
|
||||
ack(message: Message, allUpTo?: boolean): void;
|
||||
ackAll(): void;
|
||||
|
||||
nack(message: Message, allUpTo?: boolean, requeue?: boolean): void;
|
||||
nackAll(requeue?: boolean): void;
|
||||
reject(message: Message, requeue?: boolean): void;
|
||||
|
||||
prefetch(count: number, global?: boolean): Promise<Replies.Empty>;
|
||||
recover(): Promise<Replies.Empty>;
|
||||
}
|
||||
|
||||
export interface ConfirmChannel extends Channel {
|
||||
publish(exchange:string, routingKey:string, content:Buffer, options?:Options.Publish, callback?:(err:any, ok:Replies.Empty) => void):boolean;
|
||||
sendToQueue(queue:string, content:Buffer, options?:Options.Publish, callback?:(err:any, ok:Replies.Empty) => void):boolean;
|
||||
|
||||
waitForConfirms(): Promise<void>;
|
||||
}
|
||||
|
||||
export function connect(url: string, socketOptions?: any): Promise<Connection>;
|
||||
}
|
||||
|
||||
declare module 'amqplib/properties' {
|
||||
export namespace Replies {
|
||||
interface Empty {
|
||||
}
|
||||
interface AssertQueue {
|
||||
@@ -29,7 +92,7 @@ declare module "amqplib/properties" {
|
||||
}
|
||||
}
|
||||
|
||||
namespace Options {
|
||||
export namespace Options {
|
||||
interface AssertQueue {
|
||||
exclusive?: boolean;
|
||||
durable?: boolean;
|
||||
@@ -40,6 +103,7 @@ declare module "amqplib/properties" {
|
||||
deadLetterExchange?: string;
|
||||
deadLetterRoutingKey?: string;
|
||||
maxLength?: number;
|
||||
maxPriority?: number;
|
||||
}
|
||||
interface DeleteQueue {
|
||||
ifUnused?: boolean;
|
||||
@@ -56,7 +120,7 @@ declare module "amqplib/properties" {
|
||||
ifUnused?: boolean;
|
||||
}
|
||||
interface Publish {
|
||||
expiration?: string;
|
||||
expiration?: string | number;
|
||||
userId?: string;
|
||||
CC?: string | string[];
|
||||
|
||||
@@ -89,92 +153,35 @@ declare module "amqplib/properties" {
|
||||
}
|
||||
}
|
||||
|
||||
interface Message {
|
||||
export interface Message {
|
||||
content: Buffer;
|
||||
fields: any;
|
||||
properties: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "amqplib" {
|
||||
declare module 'amqplib/callback_api' {
|
||||
import events = require('events');
|
||||
import shared = require('amqplib/properties')
|
||||
|
||||
import events = require("events");
|
||||
import when = require("when");
|
||||
import shared = require("amqplib/properties")
|
||||
export import Replies = shared.Replies;
|
||||
export import Options = shared.Options;
|
||||
export import Message = shared.Message;
|
||||
|
||||
interface Connection extends events.EventEmitter {
|
||||
close(): when.Promise<void>;
|
||||
createChannel(): when.Promise<Channel>;
|
||||
createConfirmChannel(): when.Promise<Channel>;
|
||||
}
|
||||
|
||||
interface Channel extends events.EventEmitter {
|
||||
close(): when.Promise<void>;
|
||||
|
||||
assertQueue(queue: string, options?: Options.AssertQueue): when.Promise<Replies.AssertQueue>;
|
||||
checkQueue(queue: string): when.Promise<Replies.AssertQueue>;
|
||||
|
||||
deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise<Replies.DeleteQueue>;
|
||||
purgeQueue(queue: string): when.Promise<Replies.PurgeQueue>;
|
||||
|
||||
bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
|
||||
unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
|
||||
|
||||
assertExchange(exchange: string, type: string, options?: Options.AssertExchange): when.Promise<Replies.AssertExchange>;
|
||||
checkExchange(exchange: string): when.Promise<Replies.Empty>;
|
||||
|
||||
deleteExchange(exchange: string, options?: Options.DeleteExchange): when.Promise<Replies.Empty>;
|
||||
|
||||
bindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
|
||||
unbindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
|
||||
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
|
||||
consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): when.Promise<Replies.Consume>;
|
||||
|
||||
cancel(consumerTag: string): when.Promise<Replies.Empty>;
|
||||
get(queue: string, options?: Options.Get): when.Promise<Message | boolean>;
|
||||
|
||||
ack(message: Message, allUpTo?: boolean): void;
|
||||
ackAll(): void;
|
||||
|
||||
nack(message: Message, allUpTo?: boolean, requeue?: boolean): void;
|
||||
nackAll(requeue?: boolean): void;
|
||||
reject(message: Message, requeue?: boolean): void;
|
||||
|
||||
prefetch(count: number, global?: boolean): when.Promise<Replies.Empty>;
|
||||
recover(): when.Promise<Replies.Empty>;
|
||||
}
|
||||
|
||||
function connect(url: string, socketOptions?: any): when.Promise<Connection>;
|
||||
}
|
||||
|
||||
declare module "amqplib/callback_api" {
|
||||
|
||||
import events = require("events");
|
||||
import shared = require("amqplib/properties")
|
||||
export import Replies = shared.Replies;
|
||||
export import Options = shared.Options;
|
||||
export import Message = shared.Message;
|
||||
|
||||
interface Connection extends events.EventEmitter {
|
||||
export interface Connection extends events.EventEmitter {
|
||||
close(callback?: (err: any) => void): void;
|
||||
createChannel(callback: (err: any, channel: Channel) => void): void;
|
||||
createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void;
|
||||
}
|
||||
|
||||
interface Channel extends events.EventEmitter {
|
||||
export interface Channel extends events.EventEmitter {
|
||||
close(callback: (err: any) => void): void;
|
||||
|
||||
assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err:any, ok: Replies.AssertQueue) => void): void;
|
||||
assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err: any, ok: Replies.AssertQueue) => void): void;
|
||||
checkQueue(queue: string, callback?: (err: any, ok: Replies.AssertQueue) => void): void;
|
||||
|
||||
deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err:any, ok: Replies.DeleteQueue) => void): void;
|
||||
purgeQueue(queue: string, callback?: (err:any, ok: Replies.PurgeQueue) => void): void;
|
||||
deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err: any, ok: Replies.DeleteQueue) => void): void;
|
||||
purgeQueue(queue: string, callback?: (err: any, ok: Replies.PurgeQueue) => void): void;
|
||||
|
||||
bindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
unbindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
@@ -206,14 +213,14 @@ declare module "amqplib/callback_api" {
|
||||
recover(callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
}
|
||||
|
||||
interface ConfirmChannel extends Channel {
|
||||
export interface ConfirmChannel extends Channel {
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean;
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean;
|
||||
|
||||
waitForConfirms(callback?: (err: any) => void): void;
|
||||
}
|
||||
|
||||
function connect(callback: (err: any, connection: Connection) => void): void;
|
||||
function connect(url: string, callback: (err: any, connection: Connection) => void): void;
|
||||
function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void;
|
||||
export function connect(callback: (err: any, connection: Connection) => void): void;
|
||||
export function connect(url: string, callback: (err: any, connection: Connection) => void): void;
|
||||
export function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="./index.d.ts" />
|
||||
/// <reference path="../angular/index.d.ts" />
|
||||
|
||||
import * as angular from "angular";
|
||||
import {ClipboardService} from "angular-clipboard";
|
||||
|
||||
const app = angular.module('testModule', ['angular-clipboard']);
|
||||
app.controller('TestController', ($scope: ng.IScope, clipboard: ClipboardService) => {
|
||||
$scope['testCopy'] = () => {
|
||||
if (clipboard.supported) {
|
||||
clipboard.copyText('hiiiiiii');
|
||||
}
|
||||
};
|
||||
});
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// Type definitions for angular-clipboard v1.5
|
||||
// Project: https://github.com/omichelsen/angular-clipboard
|
||||
// Definitions by: Bradford Wagner <https://github.com/bradfordwagner/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Definition of the Clipboard Service
|
||||
*/
|
||||
export interface ClipboardService {
|
||||
/**
|
||||
* tells us whether or not angular-clipboard is supported
|
||||
*/
|
||||
supported: boolean;
|
||||
|
||||
/**
|
||||
* copies text to a clipboard
|
||||
* @param text the text to be copied to the clipboard
|
||||
*/
|
||||
copyText(text: string): void;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-clipboard-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,6 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,6 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
Vendored
+59
-53
@@ -1,73 +1,79 @@
|
||||
// Type definitions for angular-gettext v2.1.0
|
||||
// Type definitions for angular-gettext v2.1.0
|
||||
// Project: https://angular-gettext.rocketeer.be/
|
||||
// Definitions by: Ákos Lukács <https://github.com/AkosLukacs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="angular" />
|
||||
|
||||
declare namespace angular.gettext {
|
||||
interface gettextCatalog {
|
||||
|
||||
//////////////
|
||||
/// Fields ///
|
||||
//////////////
|
||||
|
||||
/** (default: false): Whether or not to prefix untranslated strings with [MISSING]: or a custom prefix. */
|
||||
debug: boolean;
|
||||
/** (default: [MISSING]:): Custom prefix for untranslated strings. */
|
||||
debugPrefix: string;
|
||||
/** (default: false): Whether or not to wrap all processed text with markers.Example output: [Welcome] */
|
||||
showTranslatedMarkers: boolean;
|
||||
/** (default: [): Custom prefix to mark strings that have been run through angular-gettext. */
|
||||
translatedMarkerPrefix: string;
|
||||
/** (default: ]): Custom suffix to mark strings that have been run through angular-gettext. */
|
||||
translatedMarkerSuffix: string;
|
||||
/** An object of loaded translation strings.Shouldn't be used directly. */
|
||||
strings: {};
|
||||
/** The default language, in which you're application is written. This defaults to English and it's generally a bad idea to use anything else: if your language has different pluralization rules you'll end up with incorrect translations. Deprecated
|
||||
* @deprecreated
|
||||
*/
|
||||
baseLanguage: string;
|
||||
import * as angular from 'angular';
|
||||
|
||||
|
||||
///////////////
|
||||
/// Methods ///
|
||||
///////////////
|
||||
declare module 'angular' {
|
||||
export namespace gettext {
|
||||
interface gettextCatalog {
|
||||
|
||||
/** Sets the current language and makes sure that all translations get updated correctly. */
|
||||
setCurrentLanguage(lang: string): void;
|
||||
//////////////
|
||||
/// Fields ///
|
||||
//////////////
|
||||
|
||||
/** Returns the current language. */
|
||||
getCurrentLanguage(): string;
|
||||
/** (default: false): Whether or not to prefix untranslated strings with [MISSING]: or a custom prefix. */
|
||||
debug: boolean;
|
||||
/** (default: [MISSING]:): Custom prefix for untranslated strings. */
|
||||
debugPrefix: string;
|
||||
/** (default: false): Whether or not to wrap all processed text with markers.Example output: [Welcome] */
|
||||
showTranslatedMarkers: boolean;
|
||||
/** (default: [): Custom prefix to mark strings that have been run through angular-gettext. */
|
||||
translatedMarkerPrefix: string;
|
||||
/** (default: ]): Custom suffix to mark strings that have been run through angular-gettext. */
|
||||
translatedMarkerSuffix: string;
|
||||
/** An object of loaded translation strings.Shouldn't be used directly. */
|
||||
strings: {};
|
||||
/** The default language, in which you're application is written. This defaults to English and it's generally a bad idea to use anything else: if your language has different pluralization rules you'll end up with incorrect translations. Deprecated
|
||||
* @deprecreated
|
||||
*/
|
||||
baseLanguage: string;
|
||||
|
||||
/** Processes an object of string definitions. More details https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/
|
||||
* @param language A language code.
|
||||
* @param strings A dictionary of strings. The format of this dictionary is:
|
||||
* - Keys: Singular English strings (as defined in the source files)
|
||||
* - Values: Either a single string for signular-only strings or an array of plural forms.
|
||||
*/
|
||||
setStrings(language: string, strings: { [key: string]: string|string[] }): void;
|
||||
|
||||
/** Get the correct pluralized (but untranslated) string for the value of n. */
|
||||
getStringForm(string: string, n: number): string;
|
||||
///////////////
|
||||
/// Methods ///
|
||||
///////////////
|
||||
|
||||
/** Translate a string with the given scope. Uses Angular.JS interpolation, so something like this will do what you expect:
|
||||
* var hello = gettextCatalog.getString("Hello {{name}}!", { name: "Ruben" });
|
||||
* // var hello will be "Hallo Ruben!" in Dutch.
|
||||
* The scope parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster.
|
||||
*/
|
||||
getString(string: string, scope?: any, context?: string): string;
|
||||
/** Sets the current language and makes sure that all translations get updated correctly. */
|
||||
setCurrentLanguage(lang: string): void;
|
||||
|
||||
/** Translate a plural string with the given context. */
|
||||
getPlural(n: number, string: string, stringPlural: string, context?: any): string;
|
||||
/** Returns the current language. */
|
||||
getCurrentLanguage(): string;
|
||||
|
||||
/** Load a set of translation strings from a given URL.This should be a JSON catalog generated with grunt-angular-gettext. More details https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ */
|
||||
loadRemote(url: string): ng.IHttpPromise<any>;
|
||||
}
|
||||
/** Processes an object of string definitions. More details https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/
|
||||
* @param language A language code.
|
||||
* @param strings A dictionary of strings. The format of this dictionary is:
|
||||
* - Keys: Singular English strings (as defined in the source files)
|
||||
* - Values: Either a single string for signular-only strings or an array of plural forms.
|
||||
*/
|
||||
setStrings(language: string, strings: { [key: string]: string|string[] }): void;
|
||||
|
||||
/** If you have text that should be translated in your JavaScript code, wrap it with a call to a function named gettext. This module provides an injectable function to do so */
|
||||
interface gettextFunction {
|
||||
(dummyString: string): string;
|
||||
/** Get the correct pluralized (but untranslated) string for the value of n. */
|
||||
getStringForm(string: string, n: number): string;
|
||||
|
||||
/** Translate a string with the given scope. Uses Angular.JS interpolation, so something like this will do what you expect:
|
||||
* var hello = gettextCatalog.getString("Hello {{name}}!", { name: "Ruben" });
|
||||
* // var hello will be "Hallo Ruben!" in Dutch.
|
||||
* The scope parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster.
|
||||
*/
|
||||
getString(string: string, scope?: any, context?: string): string;
|
||||
|
||||
/** Translate a plural string with the given context. */
|
||||
getPlural(n: number, string: string, stringPlural: string, context?: any): string;
|
||||
|
||||
/** Load a set of translation strings from a given URL.This should be a JSON catalog generated with grunt-angular-gettext. More details https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ */
|
||||
loadRemote(url: string): ng.IHttpPromise<any>;
|
||||
}
|
||||
|
||||
/** If you have text that should be translated in your JavaScript code, wrap it with a call to a function named gettext. This module provides an injectable function to do so */
|
||||
interface gettextFunction {
|
||||
(dummyString: string): string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ angular
|
||||
|
||||
PermissionStore.removePermissionDefinition('user');
|
||||
|
||||
let permissions: Array<permissionNamespace.Permission> = PermissionStore.getStore();
|
||||
let permissions = PermissionStore.getStore();
|
||||
|
||||
|
||||
});
|
||||
@@ -90,5 +90,5 @@ angular
|
||||
|
||||
RoleStore.removeRoleDefinition('user');
|
||||
|
||||
let roles: Array<permissionNamespace.Role> = RoleStore.getStore();
|
||||
let roles = RoleStore.getStore();
|
||||
});
|
||||
|
||||
Vendored
+38
-19
@@ -30,8 +30,8 @@ declare module 'angular' {
|
||||
* @param validationFunction {Function} Function used to validate if permission is valid
|
||||
*/
|
||||
definePermission(
|
||||
name: string,
|
||||
validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise<any>
|
||||
permissionName: string,
|
||||
validationFunction: PermissionValidationFunction
|
||||
): void;
|
||||
|
||||
/**
|
||||
@@ -43,10 +43,14 @@ declare module 'angular' {
|
||||
* @param validationFunction {Function} Function used to validate if permission is valid
|
||||
*/
|
||||
defineManyPermissions(
|
||||
permissions: string[],
|
||||
validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise<any>
|
||||
permissionNames: string[],
|
||||
validationFunction: PermissionValidationFunction
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Removes all permissions
|
||||
* @method
|
||||
*/
|
||||
clearStore(): void;
|
||||
|
||||
/**
|
||||
@@ -55,7 +59,7 @@ declare module 'angular' {
|
||||
*
|
||||
* @param permissionName {String} Name of defined permission
|
||||
*/
|
||||
removePermissionDefinition(permission: string): void;
|
||||
removePermissionDefinition(permissionName: string): void;
|
||||
|
||||
/**
|
||||
* Checks if permission exists
|
||||
@@ -66,13 +70,21 @@ declare module 'angular' {
|
||||
*/
|
||||
hasPermissionDefinition(permissionName: string): boolean;
|
||||
|
||||
/**
|
||||
* Returns permission by it's name
|
||||
* @method
|
||||
*
|
||||
* @returns {permission.Permission} Permissions definition object
|
||||
*/
|
||||
getPermissionDefinition(permissionName: string): Permission;
|
||||
|
||||
/**
|
||||
* Returns all permissions
|
||||
* @method
|
||||
*
|
||||
* @returns {Object} Permissions collection
|
||||
*/
|
||||
getStore(): Permission[];
|
||||
getStore(): { [permissionName: string]: Permission };
|
||||
}
|
||||
|
||||
export interface RoleStore {
|
||||
@@ -85,8 +97,8 @@ declare module 'angular' {
|
||||
* @param [validationFunction] {Function} Function used to validate if permissions in role are valid
|
||||
*/
|
||||
defineRole(
|
||||
role: string,
|
||||
permissions: Array<string>,
|
||||
roleName: string,
|
||||
permissions: string[],
|
||||
validationFunction: RoleValidationFunction
|
||||
): void;
|
||||
|
||||
@@ -97,7 +109,10 @@ declare module 'angular' {
|
||||
* @param roleName {String} Name of defined role
|
||||
* @param permissions {Array} Set of permission names
|
||||
*/
|
||||
defineRole(role: string, permissions: Array<string>): void;
|
||||
defineRole(
|
||||
roleName: string,
|
||||
permissions: string[]
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Checks if role is defined in store
|
||||
@@ -106,7 +121,7 @@ declare module 'angular' {
|
||||
* @param roleName {String} Name of role
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
hasRoleDefinition(role: string): boolean;
|
||||
hasRoleDefinition(roleName: string): boolean;
|
||||
|
||||
/**
|
||||
* Returns role definition object by it's name
|
||||
@@ -136,27 +151,31 @@ declare module 'angular' {
|
||||
*
|
||||
* @returns {Object} Defined roles collection
|
||||
*/
|
||||
getStore(): Role[];
|
||||
getStore(): { [roleName: string]: Role };
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
roleName: string;
|
||||
permissionNames: string[];
|
||||
validationFunction?: RoleValidationFunction;
|
||||
validateRole: () => angular.IPromise<any>;
|
||||
}
|
||||
|
||||
export interface Permission {
|
||||
permissionName: string;
|
||||
validationFunction?: PermissionValidationFunction;
|
||||
validatePermission: () => angular.IPromise<any>;
|
||||
}
|
||||
|
||||
interface RoleValidationFunction {
|
||||
(permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise<any>;
|
||||
}
|
||||
export type RoleValidationFunction = (
|
||||
roleName?: string,
|
||||
transitionProperties?: TransitionProperties
|
||||
) => boolean | angular.IPromise<any>;
|
||||
|
||||
interface PermissionValidationFunction {
|
||||
(permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise<any>;
|
||||
}
|
||||
export type PermissionValidationFunction = (
|
||||
permissionName?: string,
|
||||
transitionProperties?: TransitionProperties
|
||||
) => boolean | angular.IPromise<any>;
|
||||
|
||||
export interface IPermissionState extends angular.ui.IState {
|
||||
data?: any | DataWithPermissions;
|
||||
@@ -164,8 +183,8 @@ declare module 'angular' {
|
||||
|
||||
export interface DataWithPermissions {
|
||||
permissions?: {
|
||||
only?: (() => void) | Array<string> | angular.IPromise<any>;
|
||||
except?: (() => void) | Array<string> | angular.IPromise<any>;
|
||||
only?: (() => void) | string | string[] | angular.IPromise<any>;
|
||||
except?: (() => void) | string | string[] | angular.IPromise<any>;
|
||||
redirectTo: string | (() => string) | (() => PermissionRedirectConfigation) | { [index: string]: PermissionRedirectConfigation }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker',
|
||||
($q: angular.IQService, promiseTracker: angular.promisetracker.PromiseTrackerService) => {
|
||||
const trackerWithoutOptions = promiseTracker();
|
||||
|
||||
const options = {
|
||||
activationDelay: 10,
|
||||
minDuration: 500
|
||||
} as angular.promisetracker.PromiseTrackerOptions;
|
||||
const trackerWithOptions = promiseTracker(options);
|
||||
|
||||
const isActive: boolean = trackerWithOptions.active();
|
||||
const tracking: boolean = trackerWithOptions.tracking();
|
||||
const trackingCount: number = trackerWithOptions.trackingCount();
|
||||
trackerWithOptions.cancel();
|
||||
|
||||
const createdPromise: angular.IDeferred<void> = trackerWithOptions.createPromise();
|
||||
|
||||
const promiseToAdd = $q.defer().promise;
|
||||
const addedPromise: angular.IDeferred<void> = trackerWithOptions.addPromise(promiseToAdd);
|
||||
}]);
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for angular-promise-tracker 2.2.2
|
||||
// Project: https://github.com/ajoslin/angular-promise-tracker
|
||||
// Definitions by: Rufus Linke <https://github.com/rufusl/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="angular" />
|
||||
|
||||
import * as angular from 'angular';
|
||||
|
||||
declare module 'angular' {
|
||||
export namespace promisetracker {
|
||||
interface PromiseTrackerOptions {
|
||||
activationDelay: number;
|
||||
minDuration: number;
|
||||
}
|
||||
|
||||
interface PromiseTracker {
|
||||
active(): boolean;
|
||||
tracking(): boolean;
|
||||
trackingCount(): number;
|
||||
addPromise<T>(promise: angular.IPromise<T>): angular.IDeferred<void>;
|
||||
createPromise(): angular.IDeferred<void>;
|
||||
cancel(): void;
|
||||
}
|
||||
|
||||
interface PromiseTrackerService {
|
||||
(options?: PromiseTrackerOptions): PromiseTracker;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-promise-tracker-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -14,6 +14,6 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,6 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,6 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,6 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
/// <reference path="./angular-ui-router-default.d.ts" />
|
||||
import * as angular from "angular";
|
||||
import { ui } from "angular";
|
||||
|
||||
angular.module("test", [
|
||||
"ui.router",
|
||||
"ui.router.default"
|
||||
])
|
||||
.config(function($stateProvider: angular.ui.IStateProvider) {
|
||||
.config(function($stateProvider: ui.IStateProvider) {
|
||||
$stateProvider
|
||||
.state('concrete', {
|
||||
// no abstract or default
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// Type definitions for angular-ui-router-default 0.5+
|
||||
// Project: https://github.com/nonplus/angular-ui-router-default
|
||||
// Definitions by: Stepan Riha <https://github.com/nonplus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" />
|
||||
|
||||
declare namespace angular.ui {
|
||||
export type StateDefaultSpecifier = string
|
||||
| ((...args: any[]) => string)
|
||||
| ((...args: any[]) => ng.IPromise<string>)
|
||||
| (string | ((...args: any[]) => string))[]
|
||||
| (string | ((...args: any[]) => ng.IPromise<string>))[];
|
||||
interface IState {
|
||||
default?: StateDefaultSpecifier
|
||||
}
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for angular-ui-router-default 0.5+
|
||||
// Project: https://github.com/nonplus/angular-ui-router-default
|
||||
// Definitions by: Stepan Riha <https://github.com/nonplus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as aur from "angular-ui-router";
|
||||
|
||||
declare module "angular" {
|
||||
namespace ui {
|
||||
export type StateDefaultSpecifier = string
|
||||
| ((...args: any[]) => string)
|
||||
| ((...args: any[]) => ng.IPromise<string>)
|
||||
| (string | ((...args: any[]) => string))[]
|
||||
| (string | ((...args: any[]) => ng.IPromise<string>))[];
|
||||
interface IState {
|
||||
default?: StateDefaultSpecifier
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-ui-router-default-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
/// <reference path="./angular-ui-router-uib-modal.d.ts" />
|
||||
|
||||
angular.module("test", [
|
||||
"ui.bootstrap",
|
||||
"ui.router",
|
||||
|
||||
+6
-4
@@ -3,10 +3,12 @@
|
||||
// Definitions by: Stepan Riha <https://github.com/nonplus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" />
|
||||
import * as auir from "angular-ui-router";
|
||||
|
||||
declare namespace angular.ui {
|
||||
interface IState {
|
||||
modal?: boolean | string[];
|
||||
declare module "angular" {
|
||||
namespace ui {
|
||||
interface IState {
|
||||
modal?: boolean | string[];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-ui-router-uib-modal-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -14,6 +14,6 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,6 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,6 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": false
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
/// <reference path="async-polling.d.ts" />
|
||||
|
||||
import * as AsyncPolling from "async-polling";
|
||||
import AsyncPolling = require("async-polling");
|
||||
|
||||
// Tests based on examples in https://github.com/cGuille/async-polling#readme
|
||||
|
||||
|
||||
Vendored
-18
@@ -1,18 +0,0 @@
|
||||
// Type definitions for AsyncPolling
|
||||
// Project: https://github.com/cGuille/async-polling
|
||||
// Definitions by: Zlatko Andonovski <https://github.com/Goldsmith42/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "async-polling" {
|
||||
module AsyncPolling {
|
||||
export type EventName = "run"|"start"|"error"|"result"|"end"|"schedule"|"stop";
|
||||
}
|
||||
|
||||
function AsyncPolling<Result>(pollingFunc: (end: (err?: Error, result?: Result) => any) => any, delay: number): {
|
||||
run: () => any;
|
||||
stop: () => any;
|
||||
on: (eventName: AsyncPolling.EventName, listener: Function) => any;
|
||||
}
|
||||
|
||||
export = AsyncPolling;
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// Type definitions for AsyncPolling
|
||||
// Project: https://github.com/cGuille/async-polling
|
||||
// Definitions by: Zlatko Andonovski <https://github.com/Goldsmith42/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace AsyncPolling {
|
||||
export type EventName = "run"|"start"|"error"|"result"|"end"|"schedule"|"stop";
|
||||
}
|
||||
|
||||
declare function AsyncPolling<Result>(pollingFunc: (end: (err?: Error, result?: Result) => any) => any, delay: number): {
|
||||
run: () => any;
|
||||
stop: () => any;
|
||||
on: (eventName: AsyncPolling.EventName, listener: Function) => any;
|
||||
}
|
||||
|
||||
export = AsyncPolling;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"async-polling-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
/// <reference path="awesomplete.d.ts" />
|
||||
|
||||
var input = document.getElementById("myinput");
|
||||
new Awesomplete(input, {list: "#mylist"});
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"awesomplete-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -381,3 +381,42 @@ dynamoDBDocClient.query(
|
||||
else console.log(data); // successful response
|
||||
}
|
||||
);
|
||||
|
||||
var kinesis = new AWS.Kinesis();
|
||||
|
||||
var putRecordParam = {
|
||||
Data: new Buffer('...') || 'STRING_VALUE', /* required */
|
||||
PartitionKey: 'STRING_VALUE', /* required */
|
||||
StreamName: 'STRING_VALUE', /* required */
|
||||
ExplicitHashKey: 'STRING_VALUE',
|
||||
SequenceNumberForOrdering: 'STRING_VALUE'
|
||||
};
|
||||
kinesis.putRecord(putRecordParam, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
var putRecordParams = {
|
||||
Records: [ /* required */
|
||||
{
|
||||
Data: new Buffer('...') || 'STRING_VALUE', /* required */
|
||||
PartitionKey: 'STRING_VALUE', /* required */
|
||||
ExplicitHashKey: 'STRING_VALUE'
|
||||
},
|
||||
/* more items */
|
||||
],
|
||||
StreamName: 'STRING_VALUE' /* required */
|
||||
};
|
||||
kinesis.putRecords(putRecordParams, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
var increaseStreamRetentionPeriodParams = {
|
||||
RetentionPeriodHours: 0, /* required */
|
||||
StreamName: 'STRING_VALUE' /* required */
|
||||
};
|
||||
kinesis.increaseStreamRetentionPeriod(increaseStreamRetentionPeriodParams, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
Vendored
+53
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for aws-sdk
|
||||
// Project: https://github.com/aws/aws-sdk-js
|
||||
// Definitions by: midknight41 <https://github.com/midknight41>
|
||||
// Definitions by: midknight41 <https://github.com/midknight41>, Casper Skydt <https://github.com/CasperSkydt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Imported from: https://github.com/soywiz/typescript-node-definitions/aws-sdk.d.ts
|
||||
@@ -335,6 +335,56 @@ export declare class SNS {
|
||||
publish(request: Sns.PublishRequest, callback: (err: any, data: any) => void): void;
|
||||
}
|
||||
|
||||
export class Kinesis {
|
||||
constructor(options?: any);
|
||||
endpoint: Endpoint;
|
||||
|
||||
putRecord(params: KINESIS.PutRecordParams, callback: (error: Error, data: KINESIS.PutRecordResult) => void): void;
|
||||
putRecords(params: KINESIS.PutRecordsParams, callback: (error: Error, data: KINESIS.PutRecordsResult) => void): void;
|
||||
increaseStreamRetentionPeriod(params: KINESIS.IncreaseStreamRetentionPeriodParams, callback: (error: Error, data: any) => void): void;
|
||||
}
|
||||
|
||||
export module KINESIS {
|
||||
export interface Record {
|
||||
Data: Buffer | string | Blob;
|
||||
PartitionKey: string;
|
||||
ExplicitHashKey?: string;
|
||||
}
|
||||
|
||||
export interface RecordResult {
|
||||
SequenceNumber: string;
|
||||
ShardId: string;
|
||||
ErrorCode: string;
|
||||
ErrorMessage: string;
|
||||
}
|
||||
|
||||
export interface PutRecordParams extends Record {
|
||||
StreamName: string;
|
||||
SequenceNumberForOrdering?: string;
|
||||
}
|
||||
|
||||
export interface PutRecordResult {
|
||||
ShardId: string;
|
||||
SequenceNumber: string;
|
||||
}
|
||||
|
||||
export interface PutRecordsParams {
|
||||
StreamName: string;
|
||||
Records: Record[];
|
||||
}
|
||||
|
||||
export interface PutRecordsResult {
|
||||
FailedRecordCount: number;
|
||||
Records: RecordResult[]
|
||||
}
|
||||
|
||||
export interface IncreaseStreamRetentionPeriodParams {
|
||||
RetentionPeriodHours: number;
|
||||
StreamName: string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export declare class SWF {
|
||||
constructor(options?: any);
|
||||
endpoint: Endpoint;
|
||||
@@ -616,8 +666,8 @@ export module CloudFormation {
|
||||
ResourceTypes?: string[];
|
||||
OnFailure?: string[]; // cannot specify both DisableRollback and OnFailure
|
||||
// DO_NOTHING | ROLLBACK | DELETE
|
||||
StackPolicyBody?: string[]; // cannot specify both StackPolicyBody and StackPolicyURL
|
||||
StackPolicyURL?: string[]; // cannot specify both StackPolicyBody and StackPolicyURL
|
||||
StackPolicyBody?: string; // cannot specify both StackPolicyBody and StackPolicyURL
|
||||
StackPolicyURL?: string; // cannot specify both StackPolicyBody and StackPolicyURL
|
||||
Tags?: CloudFormation.Tag[];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// <reference path="./aws-serverless-express.d.ts" />
|
||||
/// <reference path="../express/express.d.ts"/>
|
||||
/// <reference types="express"/>
|
||||
|
||||
import * as awsServerlessExpress from 'aws-serverless-express';
|
||||
import * as express from 'express';
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// Type definitions for aws-serverless-express
|
||||
// Project: https://github.com/awslabs/aws-serverless-express
|
||||
// Definitions by: Ben Speakman <https://github.com/threesquared>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
/// <reference path="../aws-lambda/aws-lambda.d.ts"/>
|
||||
|
||||
declare module 'aws-serverless-express' {
|
||||
|
||||
import * as http from 'http';
|
||||
import * as lambda from 'aws-lambda';
|
||||
|
||||
export function createServer(
|
||||
requestListener: (request: http.IncomingMessage, response: http.ServerResponse) => http.Server,
|
||||
serverListenCallback?: () => any
|
||||
): http.Server;
|
||||
|
||||
export function proxy(
|
||||
server: http.Server,
|
||||
event: any,
|
||||
context: lambda.Context
|
||||
): void;
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for aws-serverless-express
|
||||
// Project: https://github.com/awslabs/aws-serverless-express
|
||||
// Definitions by: Ben Speakman <https://github.com/threesquared>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
import * as http from 'http';
|
||||
import * as lambda from 'aws-lambda';
|
||||
|
||||
export function createServer(
|
||||
requestListener: (request: http.IncomingMessage, response: http.ServerResponse) => http.Server,
|
||||
serverListenCallback?: () => any
|
||||
): http.Server;
|
||||
|
||||
export function proxy(
|
||||
server: http.Server,
|
||||
event: any,
|
||||
context: lambda.Context
|
||||
): void;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"aws-serverless-express-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
/// <reference path="./bases.d.ts" />
|
||||
import * as bases from 'bases';
|
||||
|
||||
let bs16String: string = bases.toBase(200, 16); // => 'c8'
|
||||
let bs62String: string = bases.toBase(99999, 62); // => 'q0T'
|
||||
let customBaseString: string = bases.toAlphabet(300, 'aAbBcC'); // => 'Abba'
|
||||
|
||||
let frombs16Int: number = bases.fromBase('c8', 16); // => 200
|
||||
let frombs62Int: number = bases.fromBase('q0T', 62); // => 99999
|
||||
let customBaseInt: number = bases.fromAlphabet('Abba', 'aAbBcC'); // => 300
|
||||
|
||||
let bs16String: string = bases.toBase(200, 16); // => 'c8'
|
||||
let bs62String: string = bases.toBase(99999, 62); // => 'q0T'
|
||||
let customBaseString: string = bases.toAlphabet(300, 'aAbBcC'); // => 'Abba'
|
||||
|
||||
let frombs16Int: number = bases.fromBase('c8', 16); // => 200
|
||||
let frombs62Int: number = bases.fromBase('q0T', 62); // => 99999
|
||||
let customBaseInt: number = bases.fromAlphabet('Abba', 'aAbBcC'); // => 300
|
||||
|
||||
Vendored
-22
@@ -1,22 +0,0 @@
|
||||
// Type definitions for bases 0.2.1
|
||||
// Project: https://github.com/aseemk/bases.js
|
||||
// Definitions by: Hari Krishna <https://github.com/harikv>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "bases" {
|
||||
export function toAlphabet(num: number, alphabet: string): string;
|
||||
|
||||
export function fromAlphabet(str: string, alphabet: string): number;
|
||||
|
||||
export function toBase(num: number, base: number): string;
|
||||
|
||||
export function fromBase(str: string, base:number): number;
|
||||
|
||||
export let KNOWN_ALPHABETS: any;
|
||||
|
||||
export let NUMERALS: string;
|
||||
|
||||
export let LETTERS_LOWERCASE: string;
|
||||
|
||||
export let LETTERS_UPPERCASE: string;
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// Type definitions for bases 0.2.1
|
||||
// Project: https://github.com/aseemk/bases.js
|
||||
// Definitions by: Hari Krishna <https://github.com/harikv>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function toAlphabet(num: number, alphabet: string): string;
|
||||
|
||||
export function fromAlphabet(str: string, alphabet: string): number;
|
||||
|
||||
export function toBase(num: number, base: number): string;
|
||||
|
||||
export function fromBase(str: string, base:number): number;
|
||||
|
||||
export let KNOWN_ALPHABETS: any;
|
||||
|
||||
export let NUMERALS: string;
|
||||
|
||||
export let LETTERS_LOWERCASE: string;
|
||||
|
||||
export let LETTERS_UPPERCASE: string;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bases-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import ponyBind = require('bind-ponyfill');
|
||||
|
||||
let boundFn: Function;
|
||||
|
||||
boundFn = ponyBind(() => { console.log(this); }, 'Hello world!');
|
||||
boundFn = ponyBind((...args: Array<string>) => { console.log(this, ...args); }, 'Hello world!', 'arg1');
|
||||
boundFn = ponyBind((...args: Array<string>) => { console.log(this, ...args); }, 'Hello world!', 'arg1', 'arg2');
|
||||
boundFn = ponyBind((arg1: string, arg2: number) => { console.log(this, arg1, arg2); }, 'Hello world!', 'arg1', 2);
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Type definitions for bind-ponyfill 0.1.0
|
||||
// Project: https://www.npmjs.com/package/bind-ponyfill
|
||||
// Definitions by: Steve Jenkins <https://github.com/skysteve>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function ponyBind(fn: Function, that: any, ...args: Array<any>): Function;
|
||||
export = ponyBind;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bind-ponyfill-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
/// <reference path="bonjour.d.ts" />
|
||||
import * as bonjour from 'bonjour';
|
||||
|
||||
var bonjourOptions: bonjour.BonjourOptions;
|
||||
|
||||
Vendored
-71
@@ -1,71 +0,0 @@
|
||||
// Type definitions for bonjour v3.5.0
|
||||
// Project: https://github.com/watson/bonjour
|
||||
// Definitions by: Quentin Lampin <https://github.com/quentin-ol/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "bonjour" {
|
||||
export interface BonjourOptions {
|
||||
multicast?: boolean;
|
||||
interface?: string;
|
||||
port?: number;
|
||||
ip?: string;
|
||||
ttl?: number;
|
||||
loopback?: boolean;
|
||||
reuseAddr?: boolean;
|
||||
}
|
||||
|
||||
export interface BrowserOptions {
|
||||
type?: string;
|
||||
subtypes?: string[];
|
||||
protocol?: string;
|
||||
txt?: Object;
|
||||
}
|
||||
|
||||
export interface ServiceOptions {
|
||||
name: string;
|
||||
host?: string;
|
||||
port: number;
|
||||
type: string;
|
||||
subtypes?: string[];
|
||||
protocol?: 'udp'|'tcp';
|
||||
txt?: Object;
|
||||
}
|
||||
|
||||
export interface Service {
|
||||
name: string;
|
||||
type: string;
|
||||
subtypes: string[];
|
||||
protocol: string;
|
||||
host: string;
|
||||
port: number;
|
||||
fqdn: string;
|
||||
rawTxt: Object;
|
||||
txt: Object;
|
||||
published: boolean;
|
||||
|
||||
stop: (cb: ()=>any) => void;
|
||||
start: () => void;
|
||||
}
|
||||
|
||||
export class Bonjour {
|
||||
|
||||
constructor(opts: BonjourOptions);
|
||||
publish(options: ServiceOptions):Service;
|
||||
unpublishAll(cb: ()=>any): void;
|
||||
find(options:BrowserOptions, onUp: ()=>any): Browser;
|
||||
findOne(options:any, cb: (service: Service)=>any): Browser;
|
||||
destroy():void;
|
||||
}
|
||||
|
||||
export class Browser {
|
||||
services: Service[];
|
||||
|
||||
start():void;
|
||||
update():void;
|
||||
stop():void;
|
||||
}
|
||||
|
||||
export function find(options: BrowserOptions, onUp?: ()=>any): Browser;
|
||||
export function findOne(options: BrowserOptions): Browser;
|
||||
|
||||
}
|
||||
Vendored
+68
@@ -0,0 +1,68 @@
|
||||
// Type definitions for bonjour v3.5.0
|
||||
// Project: https://github.com/watson/bonjour
|
||||
// Definitions by: Quentin Lampin <https://github.com/quentin-ol/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface BonjourOptions {
|
||||
multicast?: boolean;
|
||||
interface?: string;
|
||||
port?: number;
|
||||
ip?: string;
|
||||
ttl?: number;
|
||||
loopback?: boolean;
|
||||
reuseAddr?: boolean;
|
||||
}
|
||||
|
||||
export interface BrowserOptions {
|
||||
type?: string;
|
||||
subtypes?: string[];
|
||||
protocol?: string;
|
||||
txt?: Object;
|
||||
}
|
||||
|
||||
export interface ServiceOptions {
|
||||
name: string;
|
||||
host?: string;
|
||||
port: number;
|
||||
type: string;
|
||||
subtypes?: string[];
|
||||
protocol?: 'udp'|'tcp';
|
||||
txt?: Object;
|
||||
}
|
||||
|
||||
export interface Service {
|
||||
name: string;
|
||||
type: string;
|
||||
subtypes: string[];
|
||||
protocol: string;
|
||||
host: string;
|
||||
port: number;
|
||||
fqdn: string;
|
||||
rawTxt: Object;
|
||||
txt: Object;
|
||||
published: boolean;
|
||||
|
||||
stop: (cb: ()=>any) => void;
|
||||
start: () => void;
|
||||
}
|
||||
|
||||
export class Bonjour {
|
||||
|
||||
constructor(opts: BonjourOptions);
|
||||
publish(options: ServiceOptions):Service;
|
||||
unpublishAll(cb: ()=>any): void;
|
||||
find(options:BrowserOptions, onUp: ()=>any): Browser;
|
||||
findOne(options:any, cb: (service: Service)=>any): Browser;
|
||||
destroy():void;
|
||||
}
|
||||
|
||||
export class Browser {
|
||||
services: Service[];
|
||||
|
||||
start():void;
|
||||
update():void;
|
||||
stop():void;
|
||||
}
|
||||
|
||||
export function find(options: BrowserOptions, onUp?: ()=>any): Browser;
|
||||
export function findOne(options: BrowserOptions): Browser;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bonjour-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+6
-1
@@ -12,7 +12,7 @@
|
||||
* “w” (week), “m” (month), and “y” (year).
|
||||
*
|
||||
* See online docs for more info:
|
||||
* http://bootstrap-datepicker.readthedocs.org/en/release/options.html
|
||||
* https://bootstrap-datepicker.readthedocs.io/en/latest/options.html
|
||||
*/
|
||||
interface DatepickerOptions {
|
||||
format?: string | DatepickerCustomFormatOptions;
|
||||
@@ -37,6 +37,11 @@ interface DatepickerOptions {
|
||||
orientation?: string;
|
||||
assumeNearbyYear?: any;
|
||||
viewMode?: string;
|
||||
templates?: any;
|
||||
zIndexOffset?: number;
|
||||
showOnFocus?: boolean;
|
||||
immediateUpdates?: boolean;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
interface DatepickerCustomFormatOptions {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
$().bootstrapTable({});
|
||||
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Talat Baig <https://github.com/talatbaig/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference types="jquery" />
|
||||
|
||||
interface JQuery {
|
||||
bootstrapTable(options?: any): JQuery;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bootstrap-table-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
|
||||
@@ -26,6 +26,7 @@ level = bunyan.resolveLevel(bunyan.FATAL);
|
||||
|
||||
var options:bunyan.LoggerOptions = {
|
||||
name: 'test-logger',
|
||||
serializers: bunyan.stdSerializers,
|
||||
streams: [{
|
||||
type: 'stream',
|
||||
stream: process.stdout,
|
||||
|
||||
Vendored
+2
-2
@@ -21,7 +21,7 @@ declare class Logger extends EventEmitter {
|
||||
levels(name: number | string, value: number | string): void;
|
||||
|
||||
fields: any;
|
||||
src:boolean;
|
||||
src:boolean;
|
||||
|
||||
trace(error: Error, format?: any, ...params: any[]): void;
|
||||
trace(buffer: Buffer, format?: any, ...params: any[]): void;
|
||||
@@ -54,7 +54,7 @@ interface LoggerOptions {
|
||||
streams?: Stream[];
|
||||
level?: string | number;
|
||||
stream?: NodeJS.WritableStream;
|
||||
serializers?: Serializers;
|
||||
serializers?: Serializers | StdSerializers;
|
||||
src?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/// <reference path="./bwip-js.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
'use strict';
|
||||
|
||||
import * as bwipjs from 'bwip-js';
|
||||
import * as http from 'http';
|
||||
import * as fs from 'fs';
|
||||
@@ -13,7 +9,7 @@ bwipjs.loadFont('Inconsolata', 108,
|
||||
http.createServer(function(req, res) {
|
||||
// If the url does not begin /?bcid= then 404. Otherwise, we end up
|
||||
// returning 400 on requests like favicon.ico.
|
||||
if (req.url.indexOf('/?bcid=') != 0) {
|
||||
if (req.url!.indexOf('/?bcid=') != 0) {
|
||||
res.writeHead(404, { 'Content-Type':'text/plain' });
|
||||
res.end('BWIPJS: Unknown request format.', 'utf8');
|
||||
} else {
|
||||
|
||||
Vendored
-86
@@ -1,86 +0,0 @@
|
||||
// Type definitions for bwip-js 1.1.1
|
||||
// Project: https://github.com/metafloor/bwip-js
|
||||
// Definitions by: TANAKA Koichi <https://github.com/MugeSo/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'bwip-js' {
|
||||
import {IncomingMessage as Request, ServerResponse as Response} from 'http';
|
||||
|
||||
module BwipJs {
|
||||
export function loadFont(fontName:string, sizeMulti: number, fontFile: string): void;
|
||||
export function toBuffer(opts: ToBufferOptions, callback:(err: string|Error, png: Buffer) => void): void;
|
||||
interface ToBufferOptions {
|
||||
bcid: string;
|
||||
text: string;
|
||||
|
||||
parse?: boolean;
|
||||
parsefunc?: boolean;
|
||||
|
||||
height?: number;
|
||||
width?: number;
|
||||
|
||||
scaleX?: number;
|
||||
scaleY?: number;
|
||||
scale?: number;
|
||||
|
||||
rotate?: 'N'|'R'|'L'|'I';
|
||||
|
||||
paddingwidth?: number;
|
||||
paddingheight?: number;
|
||||
|
||||
monochrome?: boolean;
|
||||
alttext?: boolean;
|
||||
|
||||
includetext?: boolean;
|
||||
textfont?: string;
|
||||
textsize?: number;
|
||||
textgaps?: number;
|
||||
|
||||
textxalign?:'offleft'|'left'|'center'|'right'|'offright'|'justify';
|
||||
textyalign?:'below'|'center'|'above';
|
||||
textxoffset?: number;
|
||||
textyoffset?: number;
|
||||
|
||||
showborder?: boolean;
|
||||
borderwidth?: number;
|
||||
borderleft?: number;
|
||||
borderright?: number;
|
||||
bordertop?: number;
|
||||
boraderbottom?: number;
|
||||
|
||||
barcolor?: string;
|
||||
backgroundcolor?: string;
|
||||
bordercolor?: string;
|
||||
textcolor?: string;
|
||||
|
||||
addontextxoffset?: number;
|
||||
addontextyoffset?: number;
|
||||
addontextfont?: string;
|
||||
addontextsize?: number;
|
||||
|
||||
guardwhitespace?: boolean;
|
||||
guardwidth?: number;
|
||||
guardheight?: number;
|
||||
guardleftpos?: number;
|
||||
guardrightpos?: number;
|
||||
guardleftypos?: number;
|
||||
guardrightypos?: number;
|
||||
|
||||
sizelimit?: number;
|
||||
|
||||
includecheck?: boolean;
|
||||
includecheckintext?: boolean;
|
||||
|
||||
inkspread?: number;
|
||||
inkspreadh?: number;
|
||||
inkspreadv?: number;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function BwipJs(req: Request, res: Response, opts?:BwipJs.ToBufferOptions): void;
|
||||
|
||||
export = BwipJs;
|
||||
}
|
||||
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
// Type definitions for bwip-js 1.1.1
|
||||
// Project: https://github.com/metafloor/bwip-js
|
||||
// Definitions by: TANAKA Koichi <https://github.com/MugeSo/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import {IncomingMessage as Request, ServerResponse as Response} from 'http';
|
||||
|
||||
declare namespace BwipJs {
|
||||
export function loadFont(fontName:string, sizeMulti: number, fontFile: string): void;
|
||||
export function toBuffer(opts: ToBufferOptions, callback:(err: string|Error, png: Buffer) => void): void;
|
||||
interface ToBufferOptions {
|
||||
bcid: string;
|
||||
text: string;
|
||||
|
||||
parse?: boolean;
|
||||
parsefunc?: boolean;
|
||||
|
||||
height?: number;
|
||||
width?: number;
|
||||
|
||||
scaleX?: number;
|
||||
scaleY?: number;
|
||||
scale?: number;
|
||||
|
||||
rotate?: 'N'|'R'|'L'|'I';
|
||||
|
||||
paddingwidth?: number;
|
||||
paddingheight?: number;
|
||||
|
||||
monochrome?: boolean;
|
||||
alttext?: boolean;
|
||||
|
||||
includetext?: boolean;
|
||||
textfont?: string;
|
||||
textsize?: number;
|
||||
textgaps?: number;
|
||||
|
||||
textxalign?:'offleft'|'left'|'center'|'right'|'offright'|'justify';
|
||||
textyalign?:'below'|'center'|'above';
|
||||
textxoffset?: number;
|
||||
textyoffset?: number;
|
||||
|
||||
showborder?: boolean;
|
||||
borderwidth?: number;
|
||||
borderleft?: number;
|
||||
borderright?: number;
|
||||
bordertop?: number;
|
||||
boraderbottom?: number;
|
||||
|
||||
barcolor?: string;
|
||||
backgroundcolor?: string;
|
||||
bordercolor?: string;
|
||||
textcolor?: string;
|
||||
|
||||
addontextxoffset?: number;
|
||||
addontextyoffset?: number;
|
||||
addontextfont?: string;
|
||||
addontextsize?: number;
|
||||
|
||||
guardwhitespace?: boolean;
|
||||
guardwidth?: number;
|
||||
guardheight?: number;
|
||||
guardleftpos?: number;
|
||||
guardrightpos?: number;
|
||||
guardleftypos?: number;
|
||||
guardrightypos?: number;
|
||||
|
||||
sizelimit?: number;
|
||||
|
||||
includecheck?: boolean;
|
||||
includecheckintext?: boolean;
|
||||
|
||||
inkspread?: number;
|
||||
inkspreadh?: number;
|
||||
inkspreadv?: number;
|
||||
}
|
||||
}
|
||||
|
||||
declare function BwipJs(req: Request, res: Response, opts?:BwipJs.ToBufferOptions): void;
|
||||
|
||||
export = BwipJs;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bwip-js-tests.ts"
|
||||
]
|
||||
}
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
|
||||
import {
|
||||
connect,
|
||||
Document as CamoDocument,
|
||||
@@ -16,7 +15,7 @@ connect("mongodb://user:password@localhost:27017/database?authSource=admin").the
|
||||
dateCreated?: Date;
|
||||
}
|
||||
|
||||
class User extends CamoDocument {
|
||||
class User extends CamoDocument<UserSchema> {
|
||||
private name: SchemaTypeExtended = String;
|
||||
private password: SchemaTypeExtended = String;
|
||||
private friends: SchemaTypeExtended = [String];
|
||||
|
||||
Vendored
+312
-127
@@ -1,137 +1,322 @@
|
||||
// Type definitions for camo v0.11.4
|
||||
// Type definitions for camo v0.12.2
|
||||
// Project: https://github.com/scottwrobinson/camo
|
||||
// Definitions by: Lucas Matías Ciruzzi <https://github.com/lucasmciruzzi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "camo" {
|
||||
|
||||
/**
|
||||
* Connect function
|
||||
*
|
||||
* @export
|
||||
* @param {string} uri Connection URI
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export function connect (uri: string): Promise<any>;
|
||||
|
||||
type TypeOrArray<Type> = Type | Type[];
|
||||
type TypeOrArrayOfType<Type> = Type | Type[];
|
||||
|
||||
/**
|
||||
* Supported type constructors for document properties
|
||||
*/
|
||||
export type SchemaTypeConstructor =
|
||||
TypeOrArray<StringConstructor> |
|
||||
TypeOrArray<NumberConstructor> |
|
||||
TypeOrArray<BooleanConstructor> |
|
||||
TypeOrArray<DateConstructor> |
|
||||
TypeOrArray<ObjectConstructor> |
|
||||
TypeOrArray<ArrayConstructor>;
|
||||
/**
|
||||
* Supported type constructors for document properties
|
||||
*/
|
||||
export type SchemaTypeConstructor =
|
||||
TypeOrArrayOfType<StringConstructor> |
|
||||
TypeOrArrayOfType<NumberConstructor> |
|
||||
TypeOrArrayOfType<BooleanConstructor> |
|
||||
TypeOrArrayOfType<ArrayBufferConstructor> |
|
||||
TypeOrArrayOfType<DateConstructor> |
|
||||
TypeOrArrayOfType<ObjectConstructor> |
|
||||
TypeOrArrayOfType<ArrayConstructor>;
|
||||
|
||||
/**
|
||||
* Supported types for document properties
|
||||
*/
|
||||
export type SchemaType = TypeOrArray<string | number | boolean | Date | Object>;
|
||||
/**
|
||||
* Supported types for document properties
|
||||
*/
|
||||
export type SchemaType = TypeOrArrayOfType<string | number | boolean | Date | Object>;
|
||||
|
||||
/**
|
||||
* Document property with options
|
||||
*/
|
||||
export interface SchemaTypeOptions<Type> {
|
||||
/**
|
||||
* Type of data
|
||||
*/
|
||||
type: SchemaTypeConstructor;
|
||||
/**
|
||||
* Default value
|
||||
*/
|
||||
default?: Type;
|
||||
/**
|
||||
* Min value (only with Number)
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* Max value (only with Number)
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* Posible options
|
||||
*/
|
||||
choices?: Type[];
|
||||
/**
|
||||
* RegEx to match value
|
||||
*/
|
||||
match?: RegExp;
|
||||
/**
|
||||
* Validation function.
|
||||
*
|
||||
* @param {Type} value Value taken.
|
||||
* @returns {boolean} true (validation ok) or false (validation wrong).
|
||||
*/
|
||||
validate?(value: Type): boolean;
|
||||
/**
|
||||
* Unique value (like ids)
|
||||
*/
|
||||
unique?: boolean;
|
||||
/**
|
||||
* Required field
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Document property type or options
|
||||
*/
|
||||
export type SchemaTypeExtended = SchemaTypeConstructor | SchemaTypeOptions<SchemaType>;
|
||||
|
||||
/**
|
||||
* Schema passed to Document.create()
|
||||
*/
|
||||
export interface DocumentSchema {
|
||||
/**
|
||||
* Index signature
|
||||
*/
|
||||
[property: string]: SchemaType;
|
||||
/**
|
||||
* Document id
|
||||
*/
|
||||
_id?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* findOneAndUpdate method options.
|
||||
*
|
||||
* @interface findOneAndUpdateOptions
|
||||
*/
|
||||
export interface FindOneAndUpdateOptions {
|
||||
/**
|
||||
* Return a new document if one is not found with the given query.
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
upsert?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* findOne method options.
|
||||
*
|
||||
* @interface FindOneOptions
|
||||
*/
|
||||
export interface FindOneOptions {
|
||||
/**
|
||||
* Find all or no references.
|
||||
* Pass an array of field names to only populate the specified references.
|
||||
*
|
||||
* @type {(boolean | string[])}
|
||||
*/
|
||||
populate?: boolean | string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* find method options.
|
||||
*
|
||||
* @interface FindOptions
|
||||
*/
|
||||
export interface FindOptions {
|
||||
/**
|
||||
* Find all or no references.
|
||||
* Pass an array of field names to only populate the specified references.
|
||||
*
|
||||
* @type {(boolean | string[])}
|
||||
*/
|
||||
populate?: boolean | string[];
|
||||
/**
|
||||
* Sort the documents by the given field(s).
|
||||
*
|
||||
* @type {TypeOrArrayOfType<string>}
|
||||
*/
|
||||
sort?: TypeOrArrayOfType<string>;
|
||||
/**
|
||||
* Limits the number of documents returned.
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
limit?: number;
|
||||
/**
|
||||
* Skips the given number of documents and returns the rest.
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
skip?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Camo document
|
||||
*/
|
||||
export class Document<Schema extends DocumentSchema> {
|
||||
/**
|
||||
* Index signature
|
||||
*/
|
||||
[property: string]: SchemaTypeExtended | string | Document<any> | Function;
|
||||
/**
|
||||
* Static method to define the collection name.
|
||||
*
|
||||
* @protected
|
||||
* @static
|
||||
* @returns {string} The collection name.
|
||||
*/
|
||||
protected static collectionName(): string;
|
||||
/**
|
||||
* Sets the schema (to be used on the constructor).
|
||||
*
|
||||
* @protected
|
||||
* @template Schema
|
||||
* @param {Schema} schema
|
||||
*/
|
||||
protected schema<Schema>(schema: Schema): void;
|
||||
/**
|
||||
* Creates a camo document instance.
|
||||
*
|
||||
* @static
|
||||
* @template StaticSchema
|
||||
* @param {StaticSchema} schema Base schema to create a document.
|
||||
* @returns {DocumentInstance<StaticSchema>} A camo document instance.
|
||||
*/
|
||||
public static create<StaticSchema extends DocumentSchema>(schema: StaticSchema): Document<StaticSchema>;
|
||||
/**
|
||||
* Saves the document instance to the database.
|
||||
*
|
||||
* @returns {Promise<Schema>}
|
||||
*/
|
||||
public save(): Promise<Schema>;
|
||||
/**
|
||||
* Return the first document found, even if multiple documents match the query.
|
||||
*
|
||||
* @static
|
||||
* @template StaticSchema
|
||||
* @param {*} query Find query.
|
||||
* @param {FindOneOptions} options findOne method options.
|
||||
* @returns {Promise<StaticSchema>}
|
||||
*/
|
||||
public static findOne<StaticSchema extends DocumentSchema>(query: any, options?: FindOneOptions): Promise<StaticSchema>;
|
||||
/**
|
||||
* Return all documents matching the query.
|
||||
*
|
||||
* @static
|
||||
* @template StaticSchema
|
||||
* @param {*} query Find query.
|
||||
* @param {FindOptions} options
|
||||
* @returns {Promise<StaticSchema>}
|
||||
*/
|
||||
public static find<StaticSchema extends DocumentSchema>(query: any, options?: FindOptions): Promise<StaticSchema[]>;
|
||||
/**
|
||||
* Find and update (or insert) a document in one atomic operation (atomic for MongoDB only).
|
||||
*
|
||||
* @static
|
||||
* @template StaticSchema
|
||||
* @param {*} query Find query.
|
||||
* @param {Schema} values Values to set.
|
||||
* @param {FindOneAndUpdateOptions} options findOneAndUpdate method options.
|
||||
* @returns {Promise<StaticSchema>}
|
||||
*/
|
||||
public static findOneAndUpdate<StaticSchema extends DocumentSchema>(query: any, values: StaticSchema, options?: FindOneAndUpdateOptions): Promise<StaticSchema>;
|
||||
/**
|
||||
* Removes documents from the database.
|
||||
* Should only be used on an instantiated document with a valid id.
|
||||
*
|
||||
* @returns {Promise<number>} Number of deleted documents.
|
||||
*/
|
||||
public delete(): Promise<number>;
|
||||
/**
|
||||
* Removes the first document found, even if multiple documents match the query.
|
||||
*
|
||||
* @static
|
||||
* @param {*} query Delete query.
|
||||
* @returns {Promise<number>} Number of deleted documents.
|
||||
*/
|
||||
public static deleteOne(query: any): Promise<number>;
|
||||
/**
|
||||
* Removes all documents matching the query.
|
||||
*
|
||||
* @static
|
||||
* @param {*} query Delete query.
|
||||
* @returns {Promise<number>} Number of deleted documents.
|
||||
*/
|
||||
public static deleteMany(query: any): Promise<number>;
|
||||
/**
|
||||
* Find the first document and delete it.
|
||||
*
|
||||
* @static
|
||||
* @param {*} query Delete query.
|
||||
* @param {*} options Database Options for findOneAndDelete method.
|
||||
* @returns {Promise<number>} Number of deleted documents.
|
||||
*/
|
||||
public static findOneAndDelete(query: any, options?: any): Promise<number>;
|
||||
/**
|
||||
* Number of matching documents without retrieving all the data.
|
||||
*
|
||||
* @static
|
||||
* @param {*} query Count query.
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
public static count(query: any): Promise<number>;
|
||||
/**
|
||||
* pre-validate hook.
|
||||
*
|
||||
* @protected
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
protected preValidate(): Promise<any>;
|
||||
/**
|
||||
* post-validate hook.
|
||||
*
|
||||
* @protected
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
protected postValidate(): Promise<any>;
|
||||
/**
|
||||
* pre-save hook.
|
||||
*
|
||||
* @protected
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
protected preSave(): Promise<any>;
|
||||
/**
|
||||
* post-save hook.
|
||||
*
|
||||
* @protected
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
protected postSave(): Promise<any>;
|
||||
/**
|
||||
* pre-delete hook.
|
||||
*
|
||||
* @protected
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
protected preDelete(): Promise<any>;
|
||||
/**
|
||||
* post-delete hook.
|
||||
*
|
||||
* @protected
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
protected postDelete(): Promise<any>;
|
||||
/**
|
||||
* Serialized document to just the data, which includes nested and referenced data.
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
public toJSON(): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Document property with options
|
||||
*/
|
||||
export interface SchemaTypeOptions<Type> {
|
||||
/**
|
||||
* Type of data
|
||||
*/
|
||||
type: SchemaTypeConstructor;
|
||||
/**
|
||||
* Default value
|
||||
*/
|
||||
default?: Type;
|
||||
/**
|
||||
* Min value (only with Number)
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* Max value (only with Number)
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* Posible options
|
||||
*/
|
||||
choices?: Type[];
|
||||
/**
|
||||
* RegEx to match value
|
||||
*/
|
||||
match?: RegExp;
|
||||
/**
|
||||
* Validation function
|
||||
*
|
||||
* @param value Value taken
|
||||
* @returns true (validation ok) or false (validation wrong)
|
||||
*/
|
||||
validate?(value: Type): boolean;
|
||||
/**
|
||||
* Unique value (like ids)
|
||||
*/
|
||||
unique?: boolean;
|
||||
/**
|
||||
* Required field
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Document property type or options
|
||||
*/
|
||||
export type SchemaTypeExtended = SchemaTypeConstructor | SchemaTypeOptions<SchemaType>;
|
||||
|
||||
/**
|
||||
* Schema passed to Document.create()
|
||||
*/
|
||||
interface DocumentSchema {
|
||||
/**
|
||||
* Index signature
|
||||
*/
|
||||
[property: string]: SchemaType;
|
||||
/**
|
||||
* Document id
|
||||
*/
|
||||
_id?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Camo document instance
|
||||
*/
|
||||
declare class DocumentInstance<Schema extends DocumentSchema> {
|
||||
public save(): Promise<Schema>;
|
||||
public loadOne(): Promise<Schema>;
|
||||
public loadMany(): Promise<Schema>;
|
||||
public delete(): Promise<Schema>;
|
||||
public deleteOne(): Promise<Schema>;
|
||||
public deleteMany(): Promise<Schema>;
|
||||
public loadOneAndDelete(): Promise<Schema>;
|
||||
public count(): Promise<Schema>;
|
||||
public preValidate(): Promise<Schema>;
|
||||
public postValidate(): Promise<Schema>;
|
||||
public preSave(): Promise<Schema>;
|
||||
public postSave(): Promise<Schema>;
|
||||
public preDelete(): Promise<Schema>;
|
||||
public postDelete(): Promise<Schema>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Camo document
|
||||
*/
|
||||
export declare class Document {
|
||||
/**
|
||||
* Index signature
|
||||
*/
|
||||
[property: string]: SchemaTypeExtended | string | DocumentInstance<any>;
|
||||
/**
|
||||
* Static method to define the collection name
|
||||
*
|
||||
* @returns The collection name
|
||||
*/
|
||||
static collectionName(): string;
|
||||
/**
|
||||
* Creates a camo document instance
|
||||
*
|
||||
* @returns A camo document instance
|
||||
*/
|
||||
static create<Schema extends DocumentSchema>(schema: Schema): DocumentInstance<Schema>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect function
|
||||
*
|
||||
* @param uri Connection URI
|
||||
*/
|
||||
export declare function connect(uri: string): Promise<any>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
@@ -14,6 +14,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cassandra-driver.tests.ts"
|
||||
"cassandra-driver-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/// <reference types="assert" />
|
||||
/// <reference types="node" />
|
||||
|
||||
import cbor = require('cbor');
|
||||
import assert = require('assert');
|
||||
import fs = require('fs');
|
||||
|
||||
var encoded = cbor.encode(true); // returns <Buffer f5>
|
||||
cbor.decodeFirst(encoded, function(error, obj) {
|
||||
// error != null if there was an error
|
||||
// obj is the unpacked object
|
||||
assert.ok(obj === true);
|
||||
});
|
||||
|
||||
// Use integers as keys?
|
||||
var m = new Map();
|
||||
m.set(1, 2);
|
||||
encoded = cbor.encode(m); // <Buffer a1 01 02>
|
||||
|
||||
var d = new cbor.Decoder();
|
||||
d.on('data', function(obj: any) {
|
||||
console.log(obj);
|
||||
});
|
||||
|
||||
var s = fs.createReadStream('foo');
|
||||
s.pipe(d);
|
||||
|
||||
var d2 = new cbor.Decoder({ input: '00', encoding: 'hex' });
|
||||
d.on('data', function(obj: any) {
|
||||
console.log(obj);
|
||||
});
|
||||
|
||||
try {
|
||||
console.log(cbor.decodeFirstSync('02')); // 2
|
||||
console.log(cbor.decodeAllSync('0202')); // [2, 2]
|
||||
} catch (e) {
|
||||
// throws on invalid input
|
||||
}
|
||||
|
||||
class Bar {
|
||||
three: number;
|
||||
constructor() {
|
||||
this.three = 3;
|
||||
}
|
||||
}
|
||||
const enc = new cbor.Encoder()
|
||||
enc.addSemanticType(Bar, (encoder, b) => {
|
||||
encoder.pushAny(b.three);
|
||||
})
|
||||
|
||||
class Foo {
|
||||
one: number;
|
||||
two: string;
|
||||
}
|
||||
const d3 = new cbor.Decoder({
|
||||
tags: {
|
||||
64000: (val) => {
|
||||
// check val to make sure it's an Array as expected, etc.
|
||||
const foo = new Foo();
|
||||
foo.one = val[0];
|
||||
foo.two = val[1];
|
||||
return foo;
|
||||
}
|
||||
}
|
||||
})
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// Type definitions for cbor 2.0.2
|
||||
// Project: https://github.com/hildjj/node-cbor
|
||||
// Definitions by: Jeffery Grajkowski <https://github.com/pushplay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import stream = require("stream");
|
||||
|
||||
export function decode(input: Buffer | string): any;
|
||||
export function decodeAll(input: Buffer | string, callback: (error: any, objs: any[]) => void): void;
|
||||
export function decodeAllSync(input: Buffer | string): any[];
|
||||
export function decodeFirst(input: Buffer | string, callback: (error: any, obj: any) => void): void;
|
||||
export function decodeFirstSync(input: Buffer | string): any;
|
||||
export function encode(input: any): Buffer;
|
||||
|
||||
export class Decoder extends stream.Transform {
|
||||
constructor(params?: {
|
||||
input?: Buffer | string;
|
||||
encoding?: string;
|
||||
tags?: {[tag: number]: (val: any[]) => any}
|
||||
});
|
||||
}
|
||||
|
||||
export class Encoder extends stream.Transform {
|
||||
constructor();
|
||||
addSemanticType<T>(type: new (...args: any[]) => T, encodeFunction: (encoder: Encoder, t: T) => void): void;
|
||||
pushAny(input: any): void;
|
||||
}
|
||||
|
||||
export namespace leveldb {
|
||||
export function decode(input: Buffer | string): any[];
|
||||
export function encode(input: any): Buffer;
|
||||
export const buffer: boolean;
|
||||
export const name: string;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cbor-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/// <reference types="chai" />
|
||||
/// <reference types="mocha" />
|
||||
|
||||
import * as chai from 'chai';
|
||||
import * as spies from 'chai-spies';
|
||||
import * as Mocha from 'mocha';
|
||||
|
||||
function original(): void {
|
||||
// do something cool
|
||||
}
|
||||
|
||||
let ee = {
|
||||
on(name: string, fn: () => void) {
|
||||
}
|
||||
};
|
||||
|
||||
let spiedFn = chai.spy(original);
|
||||
|
||||
// then use in place of original
|
||||
ee.on('some event', spiedFn);
|
||||
|
||||
// or use without original
|
||||
let spy_again = chai.spy();
|
||||
ee.on('some other event', spy_again);
|
||||
|
||||
// or you can track an object's method
|
||||
let array = [ 1, 2, 3 ];
|
||||
chai.spy.on(array, 'push');
|
||||
|
||||
// or you can track multiple object's methods
|
||||
chai.spy.on(array, 'push', 'pop');
|
||||
|
||||
array.push(5);
|
||||
|
||||
// and you can reset the object calls
|
||||
// array.push.reset();
|
||||
|
||||
// or you can create spy object
|
||||
let object = chai.spy.object([ 'push', 'pop' ]);
|
||||
object.push(5);
|
||||
|
||||
// or you create spy which returns static value
|
||||
spiedFn = chai.spy.returns(true);
|
||||
|
||||
spiedFn(); // true
|
||||
|
||||
|
||||
let should = chai.should()
|
||||
, expect = chai.expect;
|
||||
|
||||
const spy = chai.spy();
|
||||
|
||||
// .spy
|
||||
|
||||
expect(spy).to.be.spy;
|
||||
spy.should.be.spy;
|
||||
|
||||
// .called
|
||||
|
||||
expect(spy).to.have.been.called();
|
||||
spy.should.have.been.called();
|
||||
|
||||
// .with
|
||||
const spyStringArg = chai.spy((arg: string) => arg);
|
||||
spyStringArg('foo');
|
||||
expect(spyStringArg).to.have.been.called.with('foo');
|
||||
spyStringArg.should.have.been.called.with('foo');
|
||||
|
||||
const spyTwoStringArgsAndOneNumber = chai.spy((arg1: string, arg2: string, arg3: number) => arg3);
|
||||
spyTwoStringArgsAndOneNumber('foo', 'bar', 1);
|
||||
expect(spyTwoStringArgsAndOneNumber).to.have.been.called.with('bar', 'foo');
|
||||
spyTwoStringArgsAndOneNumber.should.have.been.called.with('bar', 'foo');
|
||||
|
||||
// .with.exactly
|
||||
const spyTwoStringArgs = chai.spy((arg1: string, arg2: string) => arg1);
|
||||
spyTwoStringArgs('', '');
|
||||
spyTwoStringArgs('foo', 'bar');
|
||||
expect(spyTwoStringArgs).to.have.been.called.with.exactly('foo', 'bar');
|
||||
spyTwoStringArgs.should.have.been.called.with.exactly('foo', 'bar');
|
||||
|
||||
// .always.with
|
||||
const spyThreeAnyArgs = chai.spy((arg1: any, arg2: any, arg3: any) => arg1);
|
||||
spyThreeAnyArgs('foo', null, null);
|
||||
spyThreeAnyArgs('foo', 'bar', null);
|
||||
spyThreeAnyArgs(1, 2, 'foo');
|
||||
expect(spy).to.have.been.called.always.with('foo');
|
||||
spy.should.have.been.called.always.with('foo');
|
||||
|
||||
// .always.with.exactly
|
||||
spyStringArg('foo');
|
||||
spyStringArg('foo');
|
||||
expect(spyStringArg).to.have.been.called.always.with.exactly('foo');
|
||||
spyStringArg.should.have.been.called.always.with.exactly('foo');
|
||||
|
||||
// .once
|
||||
expect(spy).to.have.been.called.once;
|
||||
expect(spy).to.not.have.been.called.once;
|
||||
spy.should.have.been.called.once;
|
||||
spy.should.not.have.been.called.once;
|
||||
|
||||
// .twice
|
||||
expect(spy).to.have.been.called.twice;
|
||||
expect(spy).to.not.have.been.called.twice;
|
||||
spy.should.have.been.called.twice;
|
||||
spy.should.not.have.been.called.twice;
|
||||
|
||||
// .exactly(n)
|
||||
expect(spy).to.have.been.called.exactly(3);
|
||||
expect(spy).to.not.have.been.called.exactly(3);
|
||||
spy.should.have.been.called.exactly(3);
|
||||
spy.should.not.have.been.called.exactly(3);
|
||||
|
||||
// .min(n) / .at.least(n)
|
||||
expect(spy).to.have.been.called.min(3);
|
||||
expect(spy).to.not.have.been.called.at.least(3);
|
||||
spy.should.have.been.called.at.least(3);
|
||||
spy.should.not.have.been.called.min(3);
|
||||
|
||||
// .max(n) / .at.most(n)
|
||||
expect(spy).to.have.been.called.max(3);
|
||||
expect(spy).to.not.have.been.called.at.most(3);
|
||||
spy.should.have.been.called.at.most(3);
|
||||
spy.should.not.have.been.called.max(3);
|
||||
|
||||
// .above(n) / .gt(n)
|
||||
expect(spy).to.have.been.called.above(3);
|
||||
expect(spy).to.not.have.been.called.gt(3);
|
||||
spy.should.have.been.called.gt(3);
|
||||
spy.should.not.have.been.called.above(3);
|
||||
|
||||
// .below(n) / .lt(n)
|
||||
expect(spy).to.have.been.called.below(3);
|
||||
expect(spy).to.not.have.been.called.lt(3);
|
||||
spy.should.have.been.called.lt(3);
|
||||
spy.should.not.have.been.called.below(3);
|
||||
Vendored
+411
@@ -0,0 +1,411 @@
|
||||
// Type definitions for chai-spies
|
||||
// Project: https://github.com/chaijs/chai-spies
|
||||
// Definitions by: Ilya Kuznetsov <https://github.com/kuzn-ilya>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="chai" />
|
||||
|
||||
declare namespace Chai {
|
||||
interface ChaiStatic {
|
||||
spy: ChaiSpies.Spy;
|
||||
}
|
||||
|
||||
interface Assertion {
|
||||
/**
|
||||
* ####.spy
|
||||
* Asserts that object is a spy.
|
||||
* ```ts
|
||||
* expect(spy).to.be.spy;
|
||||
* spy.should.be.spy;
|
||||
* ```
|
||||
*/
|
||||
spy: Assertion;
|
||||
|
||||
/**
|
||||
* ####.called
|
||||
* Assert that a spy has been called. Negation passes through.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called();
|
||||
* spy.should.have.been.called();
|
||||
* ```
|
||||
* Note that ```called``` can be used as a chainable method.
|
||||
*/
|
||||
called: ChaiSpies.Called;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace ChaiSpies {
|
||||
|
||||
interface Spy {
|
||||
/**
|
||||
* #### chai.spy (function)
|
||||
*
|
||||
* Wraps a function in a proxy function. All calls will pass through to the original function.
|
||||
* ```ts
|
||||
* function original() {}
|
||||
* var spy = chai.spy(original)
|
||||
* , e_spy = chai.spy();
|
||||
* ```
|
||||
* @param fn function to spy on. @default ```function () {}```
|
||||
* @returns function to actually call
|
||||
*/
|
||||
(): SpyFunc0Proxy<void>;
|
||||
<R>(fn: SpyFunc0<R>): SpyFunc0Proxy<R>;
|
||||
<A1, R>(fn: SpyFunc1<A1, R>): SpyFunc1Proxy<A1, R>;
|
||||
<A1, A2, R>(fn: SpyFunc2<A1, A2, R>): SpyFunc2Proxy<A1, A2, R>;
|
||||
<A1, A2, A3, R>(fn: SpyFunc3<A1, A2, A3, R>): SpyFunc3Proxy<A1, A2, A3, R>;
|
||||
<A1, A2, A3, A4, R>(fn: SpyFunc4<A1, A2, A3, A4, R>): SpyFunc4Proxy<A1, A2, A3, A4, R>;
|
||||
<A1, A2, A3, A4, A5, R>(fn: SpyFunc5<A1, A2, A3, A4, A5, R>): SpyFunc5Proxy<A1, A2, A3, A4, A5, R>;
|
||||
<A1, A2, A3, A4, A5, A6, R>(fn: SpyFunc6<A1, A2, A3, A4, A5, A6, R>): SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R>;
|
||||
<A1, A2, A3, A4, A5, A6, A7, R>(fn: SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>): SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R>;
|
||||
<A1, A2, A3, A4, A5, A6, A7, A8, R>(fn: SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>): SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R>;
|
||||
<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>(fn: SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>): SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>;
|
||||
<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>(fn: SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>): SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>;
|
||||
<R>(name: string, fn: SpyFunc0<R>): SpyFunc0Proxy<R>;
|
||||
<A1, R>(name: string, fn: SpyFunc1<A1, R>): SpyFunc1Proxy<A1, R>;
|
||||
<A1, A2, R>(name: string, fn: SpyFunc2<A1, A2, R>): SpyFunc2Proxy<A1, A2, R>;
|
||||
<A1, A2, A3, R>(name: string, fn: SpyFunc3<A1, A2, A3, R>): SpyFunc3Proxy<A1, A2, A3, R>;
|
||||
<A1, A2, A3, A4, R>(name: string, fn: SpyFunc4<A1, A2, A3, A4, R>): SpyFunc4Proxy<A1, A2, A3, A4, R>;
|
||||
<A1, A2, A3, A4, A5, R>(name: string, fn: SpyFunc5<A1, A2, A3, A4, A5, R>): SpyFunc5Proxy<A1, A2, A3, A4, A5, R>;
|
||||
<A1, A2, A3, A4, A5, A6, R>(name: string, fn: SpyFunc6<A1, A2, A3, A4, A5, A6, R>): SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R>;
|
||||
<A1, A2, A3, A4, A5, A6, A7, R>(name: string, fn: SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>): SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R>;
|
||||
<A1, A2, A3, A4, A5, A6, A7, A8, R>(name: string, fn: SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>): SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R>;
|
||||
<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>(name: string, fn: SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>): SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>;
|
||||
<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>(name: string, fn: SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>): SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>;
|
||||
|
||||
/**
|
||||
* #### chai.spy.on (function)
|
||||
*
|
||||
* Wraps an object method into spy. All calls will pass through to the original function.
|
||||
* ```ts
|
||||
* var spy = chai.spy.on(Array, 'isArray');
|
||||
* ```
|
||||
* @param {Object} object
|
||||
* @param {String} method name to spy on
|
||||
* @returns function to actually call
|
||||
*/
|
||||
on(object: Object, ...methodNames: string[]): any;
|
||||
|
||||
/**
|
||||
* #### chai.spy.object (function)
|
||||
*
|
||||
* Creates an object with spied methods.
|
||||
* ```ts
|
||||
* var object = chai.spy.object('Array', [ 'push', 'pop' ]);
|
||||
* ```
|
||||
* @param {String} [name] object name
|
||||
* @param {String[]|Object} method names or method definitions
|
||||
* @returns object with spied methods
|
||||
*/
|
||||
object(name: string, methods: string[]): any;
|
||||
object(methods: string[]): any;
|
||||
object<T>(name: string, methods: T): T;
|
||||
object<T>(methods: T): T;
|
||||
|
||||
/**
|
||||
* #### chai.spy.returns (function)
|
||||
*
|
||||
* Creates a spy which returns static value.
|
||||
*```ts
|
||||
* var method = chai.spy.returns(true);
|
||||
*```
|
||||
* @param {*} value static value which is returned by spy
|
||||
* @returns new spy function which returns static value
|
||||
* @api public
|
||||
*/
|
||||
|
||||
returns<T>(value: T): SpyFunc0Proxy<T>;
|
||||
}
|
||||
|
||||
interface Called {
|
||||
(): Chai.Assertion;
|
||||
with: With;
|
||||
always: Always;
|
||||
|
||||
/**
|
||||
* ####.once
|
||||
* Assert that a spy has been called exactly once.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.once;
|
||||
* expect(spy).to.not.have.been.called.once;
|
||||
* spy.should.have.been.called.once;
|
||||
* spy.should.not.have.been.called.once;
|
||||
* ```
|
||||
*/
|
||||
once: Chai.Assertion;
|
||||
|
||||
/**
|
||||
* ####.twice
|
||||
* Assert that a spy has been called exactly twice.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.twice;
|
||||
* expect(spy).to.not.have.been.called.twice;
|
||||
* spy.should.have.been.called.twice;
|
||||
* spy.should.not.have.been.called.twice;
|
||||
* ```
|
||||
*/
|
||||
twice: Chai.Assertion;
|
||||
|
||||
/**
|
||||
* ####.exactly(n)
|
||||
* Assert that a spy has been called exactly ```n``` times.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.exactly(3);
|
||||
* expect(spy).to.not.have.been.called.exactly(3);
|
||||
* spy.should.have.been.called.exactly(3);
|
||||
* spy.should.not.have.been.called.exactly(3);
|
||||
* ```
|
||||
*/
|
||||
exactly(n: number): Chai.Assertion;
|
||||
|
||||
/**
|
||||
* ####.min(n) / .at.least(n)
|
||||
* Assert that a spy has been called minimum of ```n``` times.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.min(3);
|
||||
* expect(spy).to.not.have.been.called.at.least(3);
|
||||
* spy.should.have.been.called.at.least(3);
|
||||
* spy.should.not.have.been.called.min(3);
|
||||
* ```
|
||||
*/
|
||||
min(n: number): Chai.Assertion;
|
||||
|
||||
/**
|
||||
* ####.max(n) / .at.most(n)
|
||||
* Assert that a spy has been called maximum of ```n``` times.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.max(3);
|
||||
* expect(spy).to.not.have.been.called.at.most(3);
|
||||
* spy.should.have.been.called.at.most(3);
|
||||
* spy.should.not.have.been.called.max(3);
|
||||
* ```
|
||||
*/
|
||||
max(n: number): Chai.Assertion;
|
||||
|
||||
at: At;
|
||||
/**
|
||||
* ####.above(n) / .gt(n)
|
||||
* Assert that a spy has been called more than ```n``` times.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.above(3);
|
||||
* spy.should.not.have.been.called.above(3);
|
||||
* ```
|
||||
*/
|
||||
above(n: number): Chai.Assertion;
|
||||
|
||||
/**
|
||||
* ####.above(n) / .gt(n)
|
||||
* Assert that a spy has been called more than ```n``` times.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.gt(3);
|
||||
* spy.should.not.have.been.called.gt(3);
|
||||
* ```
|
||||
*/
|
||||
gt(n: number): Chai.Assertion;
|
||||
|
||||
/**
|
||||
* ####.below(n) / .lt(n)
|
||||
* Assert that a spy has been called fewer than ```n``` times.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.below(3);
|
||||
* spy.should.not.have.been.called.below(3);
|
||||
* ```
|
||||
*/
|
||||
below(n: number): Chai.Assertion;
|
||||
|
||||
/**
|
||||
* ####.below(n) / .lt(n)
|
||||
* Assert that a spy has been called fewer than ```n``` times.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.lt(3);
|
||||
* spy.should.not.have.been.called.lt(3);
|
||||
* ```
|
||||
*/
|
||||
lt(n: number): Chai.Assertion;
|
||||
}
|
||||
|
||||
interface With {
|
||||
/**
|
||||
* ####.with
|
||||
* Assert that a spy has been called with a given argument at least once, even if more arguments were provided.
|
||||
* ```ts
|
||||
* spy('foo');
|
||||
* expect(spy).to.have.been.called.with('foo');
|
||||
* spy.should.have.been.called.with('foo');
|
||||
* ```
|
||||
* Will also pass for ```spy('foo', 'bar')``` and ```spy(); spy('foo')```.
|
||||
* If used with multiple arguments, assert that a spy has been called with all the given arguments at least once.
|
||||
* ```ts
|
||||
* spy('foo', 'bar', 1);
|
||||
* expect(spy).to.have.been.called.with('bar', 'foo');
|
||||
* spy.should.have.been.called.with('bar', 'foo');
|
||||
* ```
|
||||
*/
|
||||
(a: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion;
|
||||
|
||||
/**
|
||||
* ####.with.exactly
|
||||
* Similar to .with, but will pass only if the list of arguments is exactly the same as the one provided.
|
||||
* ```ts
|
||||
* spy();
|
||||
* spy('foo', 'bar');
|
||||
* expect(spy).to.have.been.called.with.exactly('foo', 'bar');
|
||||
* spy.should.have.been.called.with.exactly('foo', 'bar');
|
||||
* ```
|
||||
* Will not pass for ```spy('foo')```, ```spy('bar')```, ```spy('bar'); spy('foo')```, ```spy('foo'); spy('bar')```, ```spy('bar', 'foo')``` or ```spy('foo', 'bar', 1)```.
|
||||
* Can be used for calls with a single argument too.
|
||||
*/
|
||||
|
||||
exactly(a?: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion;
|
||||
}
|
||||
|
||||
interface Always {
|
||||
with: AlwaysWith;
|
||||
}
|
||||
|
||||
interface AlwaysWith {
|
||||
/**
|
||||
* ####.always.with
|
||||
* Assert that every time the spy has been called the argument list contained the given arguments.
|
||||
* ```ts
|
||||
* spy('foo');
|
||||
* spy('foo', 'bar');
|
||||
* spy(1, 2, 'foo');
|
||||
* expect(spy).to.have.been.called.always.with('foo');
|
||||
* spy.should.have.been.called.always.with('foo');
|
||||
* ```
|
||||
*/
|
||||
(a: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion;
|
||||
|
||||
/**
|
||||
* ####.always.with.exactly
|
||||
* Assert that the spy has never been called with a different list of arguments than the one provided.
|
||||
* ```ts
|
||||
* spy('foo');
|
||||
* spy('foo');
|
||||
* expect(spy).to.have.been.called.always.with.exactly('foo');
|
||||
* spy.should.have.been.called.always.with.exactly('foo');
|
||||
* ```
|
||||
*/
|
||||
exactly(a?: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion;
|
||||
}
|
||||
|
||||
interface At {
|
||||
/**
|
||||
* ####.min(n) / .at.least(n)
|
||||
* Assert that a spy has been called minimum of ```n``` times.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.min(3);
|
||||
* expect(spy).to.not.have.been.called.at.least(3);
|
||||
* spy.should.have.been.called.at.least(3);
|
||||
* spy.should.not.have.been.called.min(3);
|
||||
* ```
|
||||
*/
|
||||
least(n: number): Chai.Assertion;
|
||||
|
||||
/**
|
||||
* ####.max(n) / .at.most(n)
|
||||
* Assert that a spy has been called maximum of ```n``` times.
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.max(3);
|
||||
* expect(spy).to.not.have.been.called.at.most(3);
|
||||
* spy.should.have.been.called.at.most(3);
|
||||
* spy.should.not.have.been.called.max(3);
|
||||
* ```
|
||||
*/
|
||||
most(n: number): Chai.Assertion;
|
||||
}
|
||||
|
||||
interface Resetable {
|
||||
/**
|
||||
* #### proxy.reset (function)
|
||||
*
|
||||
* Resets __spy object parameters for instantiation and reuse
|
||||
* @returns proxy spy object
|
||||
*/
|
||||
reset(): this;
|
||||
}
|
||||
|
||||
interface SpyFunc0<R> {
|
||||
(): R;
|
||||
}
|
||||
|
||||
interface SpyFunc1<A1, R> {
|
||||
(a: A1): R;
|
||||
}
|
||||
|
||||
interface SpyFunc2<A1, A2, R> {
|
||||
(a: A1, b: A2): R;
|
||||
}
|
||||
|
||||
interface SpyFunc3<A1, A2, A3, R> {
|
||||
(a: A1, b: A2, c: A3): R;
|
||||
}
|
||||
|
||||
interface SpyFunc4<A1, A2, A3, A4, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4): R;
|
||||
}
|
||||
|
||||
interface SpyFunc5<A1, A2, A3, A4, A5, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5): R;
|
||||
}
|
||||
|
||||
interface SpyFunc6<A1, A2, A3, A4, A5, A6, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R;
|
||||
}
|
||||
|
||||
interface SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R;
|
||||
}
|
||||
|
||||
interface SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R;
|
||||
}
|
||||
|
||||
interface SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R;
|
||||
}
|
||||
|
||||
interface SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R;
|
||||
}
|
||||
|
||||
interface SpyFunc0Proxy<R> extends SpyFunc0<R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc1Proxy<A1, R> extends SpyFunc1<A1, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc2Proxy<A1, A2, R> extends SpyFunc2<A1, A2, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc3Proxy<A1, A2, A3, R> extends SpyFunc3<A1, A2, A3, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc4Proxy<A1, A2, A3, A4, R> extends SpyFunc4<A1, A2, A3, A4, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc5Proxy<A1, A2, A3, A4, A5, R> extends SpyFunc5<A1, A2, A3, A4, A5, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R> extends SpyFunc6<A1, A2, A3, A4, A5, A6, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R> extends SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R> extends SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> extends SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> extends SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>, Resetable {
|
||||
}
|
||||
}
|
||||
|
||||
declare var spies: ChaiSpies.Spy;
|
||||
|
||||
declare module "chai-spies" {
|
||||
export = spies;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chai-spies-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+1
-1
@@ -392,7 +392,7 @@ interface RadialLinearScale {
|
||||
}
|
||||
|
||||
declare class Chart {
|
||||
constructor (context: CanvasRenderingContext2D, options: ChartConfiguration);
|
||||
constructor (context: CanvasRenderingContext2D | HTMLCanvasElement, options: ChartConfiguration);
|
||||
config: ChartConfiguration;
|
||||
destroy: () => {};
|
||||
update: (duration?: any, lazy?: any) => {};
|
||||
|
||||
Vendored
-4
@@ -1359,10 +1359,6 @@ interface fetch {
|
||||
}): Promise<any>;
|
||||
}
|
||||
|
||||
interface XMLHttpRequest {
|
||||
responseURL: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Headers Interface. This defines the methods exposed by the Headers object.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/// <reference path="chunked-dc.d.ts" />
|
||||
|
||||
// Chunker
|
||||
|
||||
let chunker = new Chunker(1337, Uint8Array.of(1,2,3), 2);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--target es2015 --noImplicitAny
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chunked-dc-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
/// <reference path="clipboard-js.d.ts" />
|
||||
|
||||
clipboard.copy("Hello World");
|
||||
clipboard.copy(document.body).then(() => console.log("success"));
|
||||
|
||||
|
||||
@@ -13,6 +13,5 @@ declare namespace clipboard {
|
||||
|
||||
declare var clipboard: clipboard.IClipboardJsStatic;
|
||||
|
||||
declare module 'clipboard-js' {
|
||||
export = clipboard;
|
||||
}
|
||||
export = clipboard;
|
||||
export as namespace clipboard;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"clipboard-js-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
import * as Clipboard from 'clipboard';
|
||||
|
||||
var cb1 = new Clipboard('.btn');
|
||||
var cb2 = new Clipboard(document.getElementById('id'), {
|
||||
|
||||
Vendored
+50
-48
@@ -3,54 +3,56 @@
|
||||
// Definitions by: Andrei Kurosh <https://github.com/impworks>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Clipboard {
|
||||
constructor(selector: (string | Element | NodeListOf<Element>), options?: ClipboardOptions);
|
||||
|
||||
/**
|
||||
* Subscribes to events that indicate the result of a copy/cut operation.
|
||||
* @param type {String} Event type ('success' or 'error').
|
||||
* @param handler Callback function.
|
||||
*/
|
||||
on(type: "success", handler: (e: ClipboardEvent) => void): this;
|
||||
on(type: "error", handler: (e: ClipboardEvent) => void): this;
|
||||
on(type: string, handler: (e: ClipboardEvent) => void): this;
|
||||
|
||||
/**
|
||||
* Clears all event bindings.
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
interface ClipboardOptions {
|
||||
/**
|
||||
* Overwrites default command ('cut' or 'copy').
|
||||
* @param {Element} elem Current element
|
||||
* @returns {String} Only 'cut' or 'copy'.
|
||||
*/
|
||||
action?: (elem: Element) => string;
|
||||
|
||||
/**
|
||||
* Overwrites default target input element.
|
||||
* @param {Element} elem Current element
|
||||
* @returns {Element} <input> element to use.
|
||||
*/
|
||||
target?: (elem: Element) => Element;
|
||||
|
||||
/**
|
||||
* Returns the explicit text to copy.
|
||||
* @param {Element} elem Current element
|
||||
* @returns {String} Text to be copied.
|
||||
*/
|
||||
text?: (elem: Element) => string;
|
||||
}
|
||||
|
||||
interface ClipboardEvent {
|
||||
action: string;
|
||||
text: string;
|
||||
trigger: Element;
|
||||
clearSelection(): void;
|
||||
}
|
||||
|
||||
declare module 'clipboard' {
|
||||
class Clipboard {
|
||||
constructor(selector: (string | Element | NodeListOf<Element>), options?: Clipboard.Options);
|
||||
|
||||
/**
|
||||
* Subscribes to events that indicate the result of a copy/cut operation.
|
||||
* @param type {String} Event type ('success' or 'error').
|
||||
* @param handler Callback function.
|
||||
*/
|
||||
on(type: "success", handler: (e: Clipboard.Event) => void): this;
|
||||
on(type: "error", handler: (e: Clipboard.Event) => void): this;
|
||||
on(type: string, handler: (e: Clipboard.Event) => void): this;
|
||||
|
||||
/**
|
||||
* Clears all event bindings.
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
namespace Clipboard {
|
||||
interface Options {
|
||||
/**
|
||||
* Overwrites default command ('cut' or 'copy').
|
||||
* @param {Element} elem Current element
|
||||
* @returns {String} Only 'cut' or 'copy'.
|
||||
*/
|
||||
action?: (elem: Element) => string;
|
||||
|
||||
/**
|
||||
* Overwrites default target input element.
|
||||
* @param {Element} elem Current element
|
||||
* @returns {Element} <input> element to use.
|
||||
*/
|
||||
target?: (elem: Element) => Element;
|
||||
|
||||
/**
|
||||
* Returns the explicit text to copy.
|
||||
* @param {Element} elem Current element
|
||||
* @returns {String} Text to be copied.
|
||||
*/
|
||||
text?: (elem: Element) => string;
|
||||
}
|
||||
|
||||
interface Event {
|
||||
action: string;
|
||||
text: string;
|
||||
trigger: Element;
|
||||
clearSelection(): void;
|
||||
}
|
||||
}
|
||||
|
||||
export = Clipboard;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
import { expect, settings, fail, count, incomplete, thrownAt } from "code";
|
||||
|
||||
expect(10).to.be.above(5);
|
||||
expect("abc").to.be.a.string();
|
||||
expect([1, 2]).to.be.an.array();
|
||||
expect(20).to.be.at.least(20);
|
||||
expect("abc").to.have.length(3);
|
||||
expect("abc").to.be.a.string().and.contain(["a", "b"]);
|
||||
expect(6).to.be.in.range(5, 6);
|
||||
|
||||
expect(10).to.not.be.above(20);
|
||||
expect([1, 2, 3]).to.shallow.include(3);
|
||||
expect([1, 1, 2]).to.only.include([1, 2]);
|
||||
expect([1, 2]).to.once.include([1, 2]);
|
||||
expect([1, 2, 3]).to.part.include([1, 4]);
|
||||
|
||||
expect(10, "Age").to.be.above(5);
|
||||
|
||||
const func = function () { return arguments; };
|
||||
expect(func()).to.be.arguments();
|
||||
|
||||
expect([1, 2]).to.be.an.array();
|
||||
|
||||
expect(true).to.be.a.boolean();
|
||||
|
||||
expect(new Date()).to.be.a.date();
|
||||
|
||||
const err = new Error("Oops an error occured.");
|
||||
expect(err).to.be.an.error();
|
||||
expect(err).to.be.an.error(Error);
|
||||
expect(err).to.be.an.error("Oops an error occured.");
|
||||
expect(err).to.be.an.error(Error, /occured/);
|
||||
|
||||
expect(function () { }).to.be.a.function();
|
||||
|
||||
expect(123).to.be.a.number();
|
||||
|
||||
expect(/abc/).to.be.a.regexp();
|
||||
|
||||
expect("abc").to.be.a.string();
|
||||
|
||||
expect({ a: "1" }).to.be.an.object();
|
||||
|
||||
expect(true).to.be.true();
|
||||
|
||||
expect(false).to.be.false();
|
||||
|
||||
expect(null).to.be.null();
|
||||
|
||||
expect(undefined).to.be.undefined();
|
||||
|
||||
expect("abc").to.include("ab");
|
||||
expect("abc").to.only.include("abc");
|
||||
expect("aaa").to.only.include("a");
|
||||
expect("abc").to.once.include("b");
|
||||
expect("abc").to.include(["a", "c"]);
|
||||
expect("abc").to.part.include(["a", "d"]);
|
||||
|
||||
expect([1, 2, 3]).to.include(1);
|
||||
expect([{ a: 1 }]).to.include({ a: 1 });
|
||||
expect([1, 2, 3]).to.include([1, 2]);
|
||||
expect([{ a: 1 }]).to.include([{ a: 1 }]);
|
||||
expect([1, 1, 2]).to.only.include([1, 2]);
|
||||
expect([1, 2]).to.once.include([1, 2]);
|
||||
expect([1, 2, 3]).to.part.include([1, 4]);
|
||||
expect([[1], [2]]).to.include([[1]]);
|
||||
|
||||
interface TestType {
|
||||
a: number;
|
||||
b?: number;
|
||||
c?: number;
|
||||
d?: number;
|
||||
}
|
||||
|
||||
interface TestType2 {
|
||||
a: number[];
|
||||
b?: number[];
|
||||
c: number[];
|
||||
}
|
||||
|
||||
expect({ a: 1, b: 2, c: 3 }).to.include("a");
|
||||
expect({ a: 1, b: 2, c: 3 }).to.include(["a", "c"]);
|
||||
expect({ a: 1, b: 2, c: 3 }).to.only.include(["a", "b", "c"]);
|
||||
expect<TestType>({ a: 1, b: 2, c: 3 }).to.include({ a: 1 });
|
||||
expect<any>({ a: 1, b: 2, c: 3 }).to.include({ a: 1 });
|
||||
expect<TestType>({ a: 1, b: 2, c: 3 }).to.include({ a: 1, c: 3 });
|
||||
expect<TestType>({ a: 1, b: 2, c: 3 }).to.part.include({ a: 1, d: 4 });
|
||||
expect<any>({ a: 1, b: 2, c: 3 }).to.part.include({ a: 1, d: 4 });
|
||||
expect({ a: 1, b: 2, c: 3 }).to.only.include({ a: 1, b: 2, c: 3 });
|
||||
expect<TestType2>({ a: [1], b: [2], c: [3] }).to.include({ a: [1], c: [3] });
|
||||
expect<any>({ a: [1], b: [2], c: [3] }).to.include({ a: [1], c: [3] });
|
||||
|
||||
expect("https://example.org/secure").to.startWith("https://");
|
||||
|
||||
expect("http://example.org/relative").to.endWith("/relative");
|
||||
|
||||
expect(4).to.exist();
|
||||
expect(null).to.not.exist();
|
||||
|
||||
expect("abc").to.be.empty();
|
||||
|
||||
expect("abcd").to.have.length(4);
|
||||
|
||||
expect(5).to.equal(5);
|
||||
expect({ a: 1 }).to.equal({ a: 1 });
|
||||
|
||||
expect(Object.create(null)).to.equal({}, { prototype: false });
|
||||
|
||||
expect(5).to.shallow.equal(5);
|
||||
expect({ a: 1 }).to.shallow.equal({ a: 1 });
|
||||
|
||||
expect(10).to.be.above(5);
|
||||
|
||||
expect(10).to.be.at.least(10);
|
||||
|
||||
expect(10).to.be.below(20);
|
||||
|
||||
expect(10).to.be.at.most(10);
|
||||
|
||||
expect(10).to.be.within(10, 20);
|
||||
expect(20).to.be.within(10, 20);
|
||||
|
||||
expect(15).to.be.between(10, 20);
|
||||
|
||||
expect(10).to.be.about(9, 1);
|
||||
|
||||
expect(new Date()).to.be.an.instanceof(Date);
|
||||
|
||||
expect("a5").to.match(/\w\d/);
|
||||
expect(["abc", "def"]).to.match(/^[\w\d,]*$/);
|
||||
expect(1).to.match(/^\d$/);
|
||||
|
||||
expect("x").to.satisfy(value => value === "x");
|
||||
|
||||
class CustomError extends Error {
|
||||
call: (message: string) => Error;
|
||||
}
|
||||
|
||||
const throws = function () {
|
||||
|
||||
throw new CustomError("Oh no!");
|
||||
};
|
||||
|
||||
expect(throws).to.throw(CustomError, "Oh no!");
|
||||
|
||||
fail("This should not occur");
|
||||
|
||||
expect(count()).to.be.a.number();
|
||||
|
||||
expect(<null>incomplete()).to.be.null().and.not.be.an.array();
|
||||
|
||||
const error = thrownAt(new Error("oops"));
|
||||
expect(error).to.not.be.undefined();
|
||||
expect(error.column).to.exist();
|
||||
|
||||
const foo = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
||||
settings.truncateMessages = false;
|
||||
expect<number[]>(foo).to.equal([]);
|
||||
|
||||
const bar = Object.create(null);
|
||||
settings.comparePrototypes = false;
|
||||
expect(bar).to.equal({});
|
||||
Vendored
+188
@@ -0,0 +1,188 @@
|
||||
// Type definitions for code 4.0.0
|
||||
// Project: https://github.com/hapijs/code
|
||||
// Definitions by: Prashant Tiwari <https://github.com/prashaantt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/** Generates an assertion object. */
|
||||
export function expect<T>(value: T | T[], prefix?: string): AssertionChain<T>;
|
||||
/** Makes the test fail with the given message. */
|
||||
export function fail(message: string): void;
|
||||
/** Returns the total number of assertions created using the expect() method. */
|
||||
export function count(): number;
|
||||
/** Returns an array of the locations where incomplete assertions were declared or null if no incomplete assertions found. */
|
||||
export function incomplete(): Array<string> | null;
|
||||
/** Returns the filename, line number, and column number of where the error was created. */
|
||||
export function thrownAt(error?: Error): CodeError;
|
||||
/** Configure code. */
|
||||
export const settings: Settings;
|
||||
|
||||
type AssertionChain<T> = Assertion<T> & Expectation<T>;
|
||||
|
||||
interface Assertion<T> extends Grammar<T>, Flags<T> { }
|
||||
|
||||
interface Expectation<T> extends Types<T>, Values<T> { }
|
||||
|
||||
interface Grammar<T> {
|
||||
/** Connecting word. */
|
||||
a: AssertionChain<T>;
|
||||
/** Connecting word. */
|
||||
an: AssertionChain<T>;
|
||||
/** Connecting word. */
|
||||
and: AssertionChain<T>;
|
||||
/** Connecting word. */
|
||||
at: AssertionChain<T>;
|
||||
/** Connecting word. */
|
||||
be: AssertionChain<T>;
|
||||
/** Connecting word. */
|
||||
have: AssertionChain<T>;
|
||||
/** Connecting word. */
|
||||
in: AssertionChain<T>;
|
||||
/** Connecting word. */
|
||||
to: AssertionChain<T>;
|
||||
}
|
||||
|
||||
interface Flags<T> {
|
||||
/** Inverses the expected result of any assertion */
|
||||
not: AssertionChain<T>;
|
||||
/**
|
||||
* Requires that inclusion matches appear only once in the provided value.
|
||||
* Used by include().
|
||||
*/
|
||||
once: AssertionChain<T>;
|
||||
/**
|
||||
* Requires that only the provided elements appear in the provided value.
|
||||
* Used by include().
|
||||
*/
|
||||
only: AssertionChain<T>;
|
||||
/**
|
||||
* Allows a partial match when asserting inclusion
|
||||
* Used by include(). Defaults to false.
|
||||
*/
|
||||
part: AssertionChain<T>;
|
||||
/**
|
||||
* Performs a comparison using strict equality (===).
|
||||
* Code defaults to deep comparison. Used by equal() and include().
|
||||
*/
|
||||
shallow: AssertionChain<T>;
|
||||
}
|
||||
|
||||
interface Types<T> {
|
||||
/** Asserts that the reference value is an arguments object. */
|
||||
arguments(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is an Array. */
|
||||
array(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is a boolean. */
|
||||
boolean(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is a Buffer. */
|
||||
buffer(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is a Date. */
|
||||
date(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is an error. */
|
||||
error(type?: Object, message?: string | RegExp): AssertionChain<T>;
|
||||
/** Asserts that the reference value is a function. */
|
||||
function(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is a number. */
|
||||
number(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is a RegExp. */
|
||||
regexp(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is a string. */
|
||||
string(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is an object (excluding array, buffer, or other native objects). */
|
||||
object(): AssertionChain<T>;
|
||||
}
|
||||
|
||||
interface Values<T> {
|
||||
/** Asserts that the reference value is true. */
|
||||
true(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is false. */
|
||||
false(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is null. */
|
||||
null(): AssertionChain<T>;
|
||||
/** Asserts that the reference value is undefined. */
|
||||
undefined(): AssertionChain<T>;
|
||||
/** Asserts that the reference value (a string, array, or object) includes the provided values. */
|
||||
include(values: string | string[] | T | T[]): AssertionChain<T>;
|
||||
/** Asserts that the reference value (a string, array, or object) includes the provided values. */
|
||||
includes(values: string | string[] | T | T[]): AssertionChain<T>;
|
||||
/** Asserts that the reference value (a string, array, or object) includes the provided values. */
|
||||
contain(values: string | string[] | T | T[]): AssertionChain<T>;
|
||||
/** Asserts that the reference value (a string, array, or object) includes the provided values. */
|
||||
contains(values: string | string[] | T | T[]): AssertionChain<T>;
|
||||
/** Asserts that the reference value (a string) starts with the provided value. */
|
||||
startWith(value: string): AssertionChain<T>;
|
||||
/** Asserts that the reference value (a string) starts with the provided value. */
|
||||
startsWith(value: string): AssertionChain<T>;
|
||||
/** Asserts that the reference value (a string) ends with the provided value. */
|
||||
endWith(value: string): AssertionChain<T>;
|
||||
/** Asserts that the reference value (a string) ends with the provided value. */
|
||||
endsWith(value: string): AssertionChain<T>;
|
||||
/** Asserts that the reference value exists (not null or undefined). */
|
||||
exist(): AssertionChain<T>;
|
||||
/** Asserts that the reference value exists (not null or undefined). */
|
||||
exists(): AssertionChain<T>;
|
||||
/** Asserts that the reference value has a length property equal to zero or an object with no keys. */
|
||||
empty(): AssertionChain<T>;
|
||||
/** Asserts that the reference value has a length property matching the provided size or an object with the specified number of keys. */
|
||||
length(size: number): AssertionChain<T>;
|
||||
/** Asserts that the reference value equals the provided value. */
|
||||
equal(value: T, options?: any): AssertionChain<T>;
|
||||
/** Asserts that the reference value equals the provided value. */
|
||||
equals(value: T, options?: any): AssertionChain<T>;
|
||||
/** Asserts that the reference value is greater than (>) the provided value. */
|
||||
above(value: T): AssertionChain<T>;
|
||||
/** Asserts that the reference value is greater than (>) the provided value. */
|
||||
greaterThan(value: T): AssertionChain<T>;
|
||||
/** Asserts that the reference value is at least (>=) the provided value. */
|
||||
least(value: T): AssertionChain<T>;
|
||||
/** Asserts that the reference value is at least (>=) the provided value. */
|
||||
min(value: T): AssertionChain<T>;
|
||||
/** Asserts that the reference value is less than (<) the provided value. */
|
||||
below(value: T): AssertionChain<T>;
|
||||
/** Asserts that the reference value is less than (<) the provided value. */
|
||||
lessThan(value: T): AssertionChain<T>;
|
||||
/** Asserts that the reference value is at most (<=) the provided value. */
|
||||
most(value: T): AssertionChain<T>;
|
||||
/** Asserts that the reference value is at most (<=) the provided value. */
|
||||
max(value: T): AssertionChain<T>;
|
||||
/** Asserts that the reference value is within (from <= value <= to) the provided values. */
|
||||
within(from: T, to: T): AssertionChain<T>;
|
||||
/** Asserts that the reference value is within (from <= value <= to) the provided values. */
|
||||
range(from: T, to: T): AssertionChain<T>;
|
||||
/** Asserts that the reference value is between but not equal (from < value < to) the provided values. */
|
||||
between(from: T, to: T): AssertionChain<T>;
|
||||
/** Asserts that the reference value is about the provided value within a delta margin of difference. */
|
||||
about(value: number, delta: number): AssertionChain<T>;
|
||||
/** Asserts that the reference value has the provided instanceof value. */
|
||||
instanceof(type: Object): AssertionChain<T>;
|
||||
/** Asserts that the reference value has the provided instanceof value. */
|
||||
instanceOf(type: Object): AssertionChain<T>;
|
||||
/** Asserts that the reference value's toString() representation matches the provided regular expression. */
|
||||
match(regex: RegExp): AssertionChain<T>;
|
||||
/** Asserts that the reference value's toString() representation matches the provided regular expression. */
|
||||
matches(regex: RegExp): AssertionChain<T>;
|
||||
/** Asserts that the reference value satisfies the provided validator function. */
|
||||
satisfy(validator: (value: T) => boolean): AssertionChain<T>;
|
||||
/** Asserts that the reference value satisfies the provided validator function. */
|
||||
satisfies(validator: (value: T) => boolean): AssertionChain<T>;
|
||||
/** Asserts that the function reference value throws an exception when called. */
|
||||
throw(type: Object, message: string | RegExp): AssertionChain<T>;
|
||||
}
|
||||
|
||||
interface Settings {
|
||||
/**
|
||||
* Truncate long assertion error messages for readability?
|
||||
* Defaults to true.
|
||||
*/
|
||||
truncateMessages?: boolean;
|
||||
/**
|
||||
* Ignore object prototypes when doing a deep comparison?
|
||||
* Defaults to false.
|
||||
*/
|
||||
comparePrototypes?: boolean;
|
||||
}
|
||||
|
||||
interface CodeError {
|
||||
filename: string;
|
||||
line: string;
|
||||
column: string;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"code-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+2
-3
@@ -393,8 +393,8 @@ declare namespace CodeMirror {
|
||||
|
||||
/** Fired whenever a line is (re-)rendered to the DOM. Fired right after the DOM element is built, before it is added to the document.
|
||||
The handler may mess with the style of the resulting element, or add event handlers, but should not try to change the state of the editor. */
|
||||
on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void;
|
||||
off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void;
|
||||
on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => void ): void;
|
||||
off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => void ): void;
|
||||
|
||||
/** Expose the state object, so that the Editor.state.completionActive property is reachable*/
|
||||
state: any;
|
||||
@@ -1240,4 +1240,3 @@ declare namespace CodeMirror {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typesSearchPaths": [
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
import { Configuration } from 'webpack'
|
||||
import * as CopyWebpackPlugin from 'copy-webpack-plugin'
|
||||
|
||||
const c: Configuration = {
|
||||
plugins: [
|
||||
new CopyWebpackPlugin([
|
||||
// {output}/file.txt
|
||||
{ from: 'from/file.txt' },
|
||||
|
||||
// {output}/to/file.txt
|
||||
{ from: 'from/file.txt', to: 'to/file.txt' },
|
||||
|
||||
// {output}/to/directory/file.txt
|
||||
{ from: 'from/file.txt', to: 'to/directory' },
|
||||
|
||||
// Copy directory contents to {output}/
|
||||
{ from: 'from/directory' },
|
||||
|
||||
// Copy directory contents to {output}/to/directory/
|
||||
{ from: 'from/directory', to: 'to/directory' },
|
||||
|
||||
// Copy glob results to /absolute/path/
|
||||
{ from: 'from/directory/**/*', to: '/absolute/path' },
|
||||
|
||||
// Copy glob results (with dot files) to /absolute/path/
|
||||
{
|
||||
from: {
|
||||
glob:'from/directory/**/*',
|
||||
dot: true,
|
||||
},
|
||||
to: '/absolute/path'
|
||||
},
|
||||
|
||||
// Copy glob results, relative to context
|
||||
{
|
||||
context: 'from/directory',
|
||||
from: '**/*',
|
||||
to: '/absolute/path'
|
||||
},
|
||||
|
||||
// {output}/file/without/extension
|
||||
{
|
||||
from: 'path/to/file.txt',
|
||||
to: 'file/without/extension',
|
||||
toType: 'file'
|
||||
},
|
||||
|
||||
// {output}/directory/with/extension.ext/file.txt
|
||||
{
|
||||
from: 'path/to/file.txt',
|
||||
to: 'directory/with/extension.ext',
|
||||
toType: 'dir'
|
||||
},
|
||||
], {
|
||||
ignore: [
|
||||
// Doesn't copy any files with a txt extension
|
||||
'*.txt',
|
||||
|
||||
// Doesn't copy any file, even if they start with a dot
|
||||
'**/*',
|
||||
|
||||
// Doesn't copy any file, except if they start with a dot
|
||||
{ glob: '**/*', dot: false }
|
||||
],
|
||||
|
||||
// By default, we only copy modified files during
|
||||
// a watch or webpack-dev-server build. Setting this
|
||||
// to `true` copies all files.
|
||||
copyUnmodified: true,
|
||||
})
|
||||
]
|
||||
}
|
||||
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
// Type definitions for copy-webpack-plugin v4.0.0
|
||||
// Project: https://github.com/kevlened/copy-webpack-plugin
|
||||
// Definitions by: flying-sheep <http://github.com/flying-sheep>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Plugin } from 'webpack'
|
||||
import { IOptions } from 'minimatch'
|
||||
|
||||
interface MiniMatchGlob extends IOptions {
|
||||
glob: string
|
||||
}
|
||||
|
||||
interface CopyPattern {
|
||||
/** File source path or glob */
|
||||
from: string | MiniMatchGlob
|
||||
/**
|
||||
* Path or webpack file-loader patterns. defaults:
|
||||
* output root if `from` is file or dir.
|
||||
* resolved glob path if `from` is glob.
|
||||
*/
|
||||
to?: string
|
||||
/**
|
||||
* How to interpret `to`. defaults:
|
||||
* 'file' if to has extension or from is file.
|
||||
* 'dir' if from is directory, to has no extension or ends in '/'.
|
||||
* 'template' if to contains a template pattern.
|
||||
*/
|
||||
toType?: 'file' | 'dir' | 'template'
|
||||
/** A path that determines how to interpret the `from` path. (default: `compiler.options.context`) */
|
||||
context?: string
|
||||
/**
|
||||
* Removes all directory references and only copies file names.
|
||||
*
|
||||
* If files have the same name, the result is non-deterministic. (default: `false`)
|
||||
*/
|
||||
flatten?: boolean
|
||||
/** Additional globs to ignore for this pattern. (default: `[]`) */
|
||||
ignore?: Array<string | MiniMatchGlob>
|
||||
/** Function that modifies file contents before writing to webpack. (default: `(content, path) => content`) */
|
||||
transform?: (content: string, path: string) => string
|
||||
/** Overwrites files already in `compilation.assets` (usually added by other plugins; default: `false`) */
|
||||
force?: boolean
|
||||
}
|
||||
|
||||
interface CopyWebpackPluginConfiguration {
|
||||
/** Array of globs to ignore. (applied to from; default: `[]`) */
|
||||
ignore?: Array<string | MiniMatchGlob>
|
||||
/** Copies files, regardless of modification when using `watch` or `webpack-dev-server`. All files are copied on first build, regardless of this option. (default: `false`) */
|
||||
copyUnmodified?: boolean
|
||||
/** Debug level. warning: only warnings, info/true: file location and read info, debug: very detailed debugging info. (default: `'warning'`) */
|
||||
debug?: 'warning' | 'info'|true | 'debug'
|
||||
}
|
||||
|
||||
interface CopyWebpackPlugin {
|
||||
new (patterns?: CopyPattern[], options?: CopyWebpackPluginConfiguration): Plugin
|
||||
}
|
||||
|
||||
declare const copyWebpackPlugin: CopyWebpackPlugin
|
||||
export = copyWebpackPlugin
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"copy-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -4,7 +4,8 @@
|
||||
"target": "es6",
|
||||
"noImplicitAny": false,
|
||||
"strictNullChecks": false,
|
||||
"noEmit": true
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"target": "es6",
|
||||
"noImplicitAny": false,
|
||||
"strictNullChecks": false,
|
||||
"noEmit": true
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"target": "es6",
|
||||
"noImplicitAny": false,
|
||||
"strictNullChecks": false,
|
||||
"noEmit": true
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"target": "es6",
|
||||
"noImplicitAny": false,
|
||||
"strictNullChecks": false,
|
||||
"noEmit": true
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"target": "es6",
|
||||
"noImplicitAny": false,
|
||||
"strictNullChecks": false,
|
||||
"noEmit": true
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"target": "es6",
|
||||
"noImplicitAny": false,
|
||||
"strictNullChecks": false,
|
||||
"noEmit": true
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user