Merge with master

This commit is contained in:
James Brantly
2015-11-11 09:02:54 -05:00
58 changed files with 17136 additions and 1442 deletions
@@ -1,4 +1,4 @@
/// <reference path="./httpi.d.ts" />
/// <reference path="./angular-httpi.d.ts" />
(function() {
'use strict';
+1 -1
View File
@@ -42,7 +42,7 @@ To avoid cluttering the list of suggestions as you type in your IDE, all interfa
**ngMockE2E** does not define a new namespace, but rather modifies some of **ng**'s interfaces.
Bellow is an example of how to use the interfaces:
Below is an example of how to use the interfaces:
```ts
function MainController($scope: ng.IScope, $http: ng.IHttpService) {
// code assistance will now be available for $scope and $http
@@ -0,0 +1,17 @@
/// <reference path="../anydb-sql/anydb-sql.d.ts" />
/// <reference path="anydb-sql-migrations" />
import anydbsql = require('anydb-sql');
import { Table, Column } from 'anydb-sql'
import migrator = require('anydb-sql-migrations');
function do_not_run() {
var db = anydbsql({
url: 'postgres://user:pass@host:port/database',
connections: { min: 2, max: 20 }
});
migrator
.create(db, '/path/to/migrations/dir')
.run();
}
+34
View File
@@ -0,0 +1,34 @@
// Type definitions for anydb-sql-migrations
// Project: https://github.com/spion/anydb-sql-migrations
// Definitions by: Gorgi Kosev <https://github.com/spion>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../bluebird/bluebird.d.ts" />
/// <reference path="../anydb-sql/anydb-sql.d.ts" />
declare module "anydb-sql-migrations" {
import Promise = require('bluebird');
import { Column, Table, Transaction, AnydbSql } from 'anydb-sql';
export interface Migration {
version: string;
}
export interface MigrationsTable extends Table<Migration> {
version: Column<string>;
}
export interface MigFn {
(tx: Transaction): Promise<any>;
}
export interface MigrationTask {
up: MigFn;
down: MigFn;
name: string;
}
export function create(db: AnydbSql, tasks: any): {
run: () => Promise<any>;
migrateTo: (target?: string) => Promise<any>;
check: (f: (m: {
type: string;
items: MigrationTask[];
}) => any) => Promise<any>;
};
}
+70
View File
@@ -0,0 +1,70 @@
/// <reference path="anydb-sql.d.ts" />
import anydbsql = require('anydb-sql');
import { Table, Column } from 'anydb-sql'
function do_not_run() {
var db = anydbsql({
url: 'postgres://user:pass@host:port/database',
connections: { min: 2, max: 20 }
});
// Table Post
interface Post {
content: string;
userId: string;
date: string;
}
interface PostTable extends Table<Post> {
content: Column<string>;
userId: Column<string>;
date: Column<string>;
}
var post = <PostTable>db.define<Post>({
name: 'posts',
columns: {
content: {},
userId: {},
date: {}
}
});
// Table User
interface User {
id: string;
email: string;
password: string;
name: string;
}
interface UserTable extends Table<User> {
id: Column<string>;
email: Column<string>;
password: Column<string>;
name: Column<string>;
}
var user = <UserTable>db.define<User>({
name: 'users',
columns: {
id: { primaryKey: true },
email: {},
password: {},
name: {},
date: {}
},
has: {
posts: { from: 'posts', many: true },
group: { from: 'groups'}
}
});
user.select(user.name, post.content)
.from(user.join(post).on(user.id.equals(post.userId)))
.where(post.date.gt('123'))
.all()
}
+194
View File
@@ -0,0 +1,194 @@
// Type definitions for anydb-sql
// Project: https://github.com/doxout/anydb-sql
// Definitions by: Gorgi Kosev <https://github.com/spion>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../bluebird/bluebird.d.ts" />
declare module "anydb-sql" {
import Promise = require('bluebird');
interface AnyDBPool extends anydbSQL.DatabaseConnection {
query:(text:string, values:any[], callback:(err:Error, result:any)=>void)=>void
begin:()=>anydbSQL.Transaction
close:(err:Error)=>void
}
interface Dictionary<T> { [key:string]:T; }
module anydbSQL {
export interface OrderByValueNode {}
export interface ColumnDefinition {
primaryKey?:boolean;
dataType?:string;
references?: {table:string; column: string}
notNull?:boolean
}
export interface TableDefinition {
name:string
columns:Dictionary<ColumnDefinition>
has?:Dictionary<{from:string; many?:boolean}>
}
export interface QueryLike {
query:string;
values: any[]
text:string
}
export interface DatabaseConnection {
queryAsync<T>(query:string, ...params:any[]):Promise<{rowCount:number;rows:T[]}>
queryAsync<T>(query:QueryLike):Promise<{rowCount:number;rows:T[]}>
}
export interface Transaction extends DatabaseConnection {
rollback():void
commitAsync():Promise<void>
}
export interface SubQuery<T> {
select(node:Column<T>):SubQuery<T>
where(...nodes:any[]):SubQuery<T>
from(table:TableNode):SubQuery<T>
group(...nodes:any[]):SubQuery<T>
order(criteria:OrderByValueNode):SubQuery<T>
notExists(subQuery:SubQuery<any>):SubQuery<T>
}
interface Executable<T> {
get():Promise<T>
getWithin(tx:DatabaseConnection):Promise<T>
exec():Promise<void>
all():Promise<T[]>
execWithin(tx:DatabaseConnection):Promise<void>
allWithin(tx:DatabaseConnection):Promise<T[]>
toQuery():QueryLike;
}
interface Queryable<T> {
where(...nodes:any[]):Query<T>
delete():ModifyingQuery
select<U>(...nodes:any[]):Query<U>
selectDeep<U>(table: Table<T>): Query<T>
selectDeep<U>(...nodesOrTables:any[]):Query<U>
}
export interface Query<T> extends Executable<T>, Queryable<T> {
from(table:TableNode):Query<T>
update(o:Dictionary<any>):ModifyingQuery
update(o:{}):ModifyingQuery
group(...nodes:any[]):Query<T>
order(...criteria:OrderByValueNode[]):Query<T>
limit(l:number):Query<T>
offset(o:number):Query<T>
}
export interface ModifyingQuery extends Executable<void> {
returning<U>(...nodes:any[]):Query<U>
where(...nodes:any[]):ModifyingQuery
}
export interface TableNode {
join(table:TableNode):JoinTableNode
leftJoin(table:TableNode):JoinTableNode
}
export interface JoinTableNode extends TableNode {
on(filter:BinaryNode):TableNode
on(filter:string):TableNode
}
interface CreateQuery extends Executable<void> {
ifNotExists():Executable<void>
}
interface DropQuery extends Executable<void> {
ifExists():Executable<void>
}
export interface Table<T> extends TableNode, Queryable<T> {
create():CreateQuery
drop():DropQuery
as(name:string):Table<T>
update(o:any):ModifyingQuery
insert(row:T):ModifyingQuery
insert(rows:T[]):ModifyingQuery
select():Query<T>
select<U>(...nodes:any[]):Query<U>
from<U>(table:TableNode):Query<U>
star():Column<any>
subQuery<U>():SubQuery<U>
eventEmitter:{emit:(type:string, ...args:any[])=>void
on:(eventName:string, handler:Function)=>void}
columns:Column<any>[]
sql: SQL;
alter():AlterQuery<T>
}
export interface AlterQuery<T> extends Executable<void> {
addColumn(column:Column<any>): AlterQuery<T>;
addColumn(name: string, options:string): AlterQuery<T>;
dropColumn(column: Column<any>): AlterQuery<T>;
renameColumn(column: Column<any>, newColumn: Column<any>):AlterQuery<T>;
renameColumn(column: Column<any>, newName: string):AlterQuery<T>;
renameColumn(name: string, newName: string):AlterQuery<T>;
rename(newName: string): AlterQuery<T>
}
export interface SQL {
functions: {
LOWER(c:Column<string>):Column<string>
}
}
export interface BinaryNode {
and(node:BinaryNode):BinaryNode
or(node:BinaryNode):BinaryNode
}
export interface Column<T> {
in(arr:T[]):BinaryNode
in(subQuery:SubQuery<T>):BinaryNode
notIn(arr:T[]):BinaryNode
equals(node:any):BinaryNode
notEquals(node:any):BinaryNode
gte(node:any):BinaryNode
lte(node:any):BinaryNode
gt(node:any):BinaryNode
lt(node:any):BinaryNode
like(str:string):BinaryNode
multiply:{
(node:Column<T>):Column<T>
(n:number):Column<number>
}
isNull():BinaryNode
isNotNull():BinaryNode
sum():Column<number>
count():Column<number>
count(name:string):Column<number>
distinct():Column<T>
as(name:string):Column<T>
ascending:OrderByValueNode
descending:OrderByValueNode
asc:OrderByValueNode
desc:OrderByValueNode
}
export interface AnydbSql extends DatabaseConnection {
define<T>(map:TableDefinition):Table<T>;
transaction<T>(fn:(tx:Transaction)=>Promise<T>):Promise<T>
allOf(...tables:Table<any>[]):any
models:Dictionary<Table<any>>
functions:{LOWER:(name:Column<string>)=>Column<string>
RTRIM:(name:Column<string>)=>Column<string>}
makeFunction(name:string):Function
begin():Transaction
open():void;
close():void;
getPool():AnyDBPool;
dialect():string;
}
}
function anydbSQL(config:Object):anydbSQL.AnydbSql;
export = anydbSQL;
}
@@ -18,6 +18,7 @@ appInsights.client.trackEvent("custom event", {customProperty: "custom property
appInsights.client.trackException(new Error("handled exceptions can be logged with this method"));
appInsights.client.trackMetric("custom metric", 3);
appInsights.client.trackTrace("trace message");
appInsights.client.trackDependency("dependency name", "commandName", 500, true);
// assign common properties to all telemetry
appInsights.client.commonProperties = {
+14 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Application Insights v0.15.1
// Type definitions for Application Insights v0.15.7
// Project: https://github.com/Microsoft/ApplicationInsights-node.js
// Definitions by: Scott Southwood <https://github.com/scsouthw/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -342,6 +342,19 @@ interface Client {
trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: {
[key: string]: string;
}): void;
/**
* Log information about a dependency of your app. Typically used to track the time database calls or outgoing http requests take from your server.
* @param name The name of the dependency (i.e. "myDatabse")
* @param commandname The name of the command executed on the dependency
* @param elapsedTimeMs The amount of time in ms that the dependency took to return the result
* @param success True if the dependency succeeded, false otherwise
* @param dependencyTypeName The type of the dependency (i.e. "SQL" "HTTP"). Defaults to empty.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param dependencyKind ContractsModule.DependencyKind of this dependency. Defaults to Other.
* @param async True if the dependency was executed asynchronously, false otherwise. Defaults to false
* @param dependencySource ContractsModule.DependencySourceType of this dependency. Defaults to Undefined.
*/
trackDependency(name: string, commandName: string, elapsedTimeMs: number, success: boolean, dependencyTypeName?: string, properties?: {}, dependencyKind?: any, async?: boolean, dependencySource?: number): void;
/**
* Immediately send all queued telemetry.
*/
+248 -5
View File
@@ -1,13 +1,256 @@
/// <reference path="aws-sdk.d.ts" />
import awsSdk = require('aws-sdk');
import AWS = require('aws-sdk');
var str: string;
var creds: awsSdk.Credentials;
var creds: AWS.Credentials;
creds = new awsSdk.Credentials(str, str);
creds = new awsSdk.Credentials(str, str, str);
creds = new AWS.Credentials(str, str);
creds = new AWS.Credentials(str, str, str);
str = creds.accessKeyId;
// more
/*
* SQS
*/
var sqs:AWS.SQS
//Default constructor
sqs = new AWS.SQS();
//Locking the API Version
sqs = new AWS.SQS({apiVersion: '2012-11-05'});
// Locking the API Version Globally
AWS.config.apiVersions = {
sqs: '2012-11-05',
// other service API versions
};
sqs.addPermission({
AWSAccountIds: [ /* required */
'STRING_VALUE',
/* more items */
],
Actions: [ /* required */
'STRING_VALUE',
/* more items */
],
Label: 'STRING_VALUE', /* required */
QueueUrl: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.changeMessageVisibility({
QueueUrl: 'STRING_VALUE', /* required */
ReceiptHandle: 'STRING_VALUE', /* required */
VisibilityTimeout: 0 /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.changeMessageVisibilityBatch({
Entries: [ /* required */
{
Id: 'STRING_VALUE', /* required */
ReceiptHandle: 'STRING_VALUE', /* required */
VisibilityTimeout: 0
},
/* more items */
],
QueueUrl: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.createQueue({
QueueName: 'STRING_VALUE', /* required */
Attributes: {
someKey: 'STRING_VALUE',
/* anotherKey: ... */
}
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.deleteMessage({
QueueUrl: 'STRING_VALUE', /* required */
ReceiptHandle: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.deleteMessageBatch({
Entries: [ /* required */
{
Id: 'STRING_VALUE', /* required */
ReceiptHandle: 'STRING_VALUE' /* required */
},
/* more items */
],
QueueUrl: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.deleteQueue({
QueueUrl: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.getQueueAttributes({
QueueUrl: 'STRING_VALUE', /* required */
AttributeNames: [
'Policy | VisibilityTimeout | MaximumMessageSize | MessageRetentionPeriod | ApproximateNumberOfMessages | ApproximateNumberOfMessagesNotVisible | CreatedTimestamp | LastModifiedTimestamp | QueueArn | ApproximateNumberOfMessagesDelayed | DelaySeconds | ReceiveMessageWaitTimeSeconds | RedrivePolicy',
/* more items */
]
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.getQueueUrl({
QueueName: 'STRING_VALUE', /* required */
QueueOwnerAWSAccountId: 'STRING_VALUE'
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.listDeadLetterSourceQueues({
QueueUrl: 'STRING_VALUE' /* required */
}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.listQueues({
QueueNamePrefix: 'STRING_VALUE'
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.purgeQueue({
QueueUrl: 'STRING_VALUE' /* required */
}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.receiveMessage({
QueueUrl: 'STRING_VALUE', /* required */
AttributeNames: [
'Policy | VisibilityTimeout | MaximumMessageSize | MessageRetentionPeriod | ApproximateNumberOfMessages | ApproximateNumberOfMessagesNotVisible | CreatedTimestamp | LastModifiedTimestamp | QueueArn | ApproximateNumberOfMessagesDelayed | DelaySeconds | ReceiveMessageWaitTimeSeconds | RedrivePolicy',
/* more items */
],
MaxNumberOfMessages: 0,
MessageAttributeNames: [
'STRING_VALUE',
/* more items */
],
VisibilityTimeout: 0,
WaitTimeSeconds: 0
}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.removePermission({
Label: 'STRING_VALUE', /* required */
QueueUrl: 'STRING_VALUE' /* required */
}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.sendMessage({
MessageBody: 'STRING_VALUE', /* required */
QueueUrl: 'STRING_VALUE', /* required */
DelaySeconds: 0,
MessageAttributes: {
someKey: {
DataType: 'STRING_VALUE', /* required */
BinaryListValues: [
new Buffer('...') || 'STRING_VALUE',
/* more items */
],
BinaryValue: new Buffer('...') || 'STRING_VALUE',
StringListValues: [
'STRING_VALUE',
/* more items */
],
StringValue: 'STRING_VALUE'
},
/* anotherKey: ... */
}
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.sendMessageBatch({
Entries: [ /* required */
{
Id: 'STRING_VALUE', /* required */
MessageBody: 'STRING_VALUE', /* required */
DelaySeconds: 0,
MessageAttributes: {
someKey: {
DataType: 'STRING_VALUE', /* required */
BinaryListValues: [
new Buffer('...') ,
/* more items */
],
BinaryValue: new Buffer('...'),
StringListValues: [
'STRING_VALUE',
/* more items */
],
StringValue: 'STRING_VALUE'
},
/* anotherKey: ... */
}
},
/* more items */
],
QueueUrl: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.setQueueAttributes({
Attributes: { /* required */
someKey: 'STRING_VALUE',
/* anotherKey: ... */
},
QueueUrl: 'STRING_VALUE' /* required */
}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
+1
View File
@@ -0,0 +1 @@
--noImplicitAny --module commonjs --target es5
+156 -55
View File
@@ -30,6 +30,16 @@ declare module "aws-sdk" {
xhrAsync?: boolean;
xhrWithCredentials?: boolean;
}
export class Endpoint {
constructor(endpoint:string);
host:string;
hostname:string;
href:string;
port:number;
protocol:string;
}
export interface Services {
autoscaling?: any;
@@ -99,7 +109,25 @@ declare module "aws-sdk" {
export class SQS {
constructor(options?: any);
public client: Sqs.Client;
endpoint:Endpoint;
addPermission(params: SQS.AddPermissionParams, callback: (err:Error, data:any) => void): void;
changeMessageVisibility(params: SQS.ChangeMessageVisibilityParams, callback: (err:Error, data:any) => void): void;
changeMessageVisibilityBatch(params: SQS.ChangeMessageVisibilityBatchParams, callback: (err:Error, data:SQS.ChangeMessageVisibilityBatchResponse) => void): void;
createQueue(params: SQS.CreateQueueParams, callback: (err: Error, data: SQS.CreateQueueResult) => void): void;
deleteMessage(params: SQS.DeleteMessageParams, callback: (err: Error, data: any) => void): void;
deleteMessageBatch(params: SQS.DeleteMessageBatchParams, callback: (err: Error, data: SQS.DeleteMessageBatchResult) => void): void;
deleteQueue(params: { QueueUrl: string; }, callback: (err: Error, data: any) => void): void;
getQueueAttributes(params: SQS.GetQueueAttributesParams, callback: (err: Error, data: SQS.GetQueueAttributesResult) => void): void;
getQueueUrl(params: SQS.GetQueueUrlParams, callback: (err: Error, data: { QueueUrl: string; }) => void): void;
listDeadLetterSourceQueues(params: {QueueUrl:string}, callback: (err: Error, data: {queueUrls: string[]}) => void): void;
listQueues(params: {QueueNamePrefix?:string}, callback: (err: Error, data: {QueueUrls: string[]}) => void): void;
purgeQueue(params: {QueueUrl: string}, callback: (err: Error, data: any) => void): void;
receiveMessage(params: SQS.ReceiveMessageParams, callback: (err: Error, data: SQS.ReceiveMessageResult) => void): void;
removePermission(params: {QueueUrl: string, Label: string}, callback: (err: Error, data: any) => void): void;
sendMessage(params: SQS.SendMessageParams, callback: (err: Error, data: SQS.SendMessageResult) => void): void;
sendMessageBatch(params: SQS.SendMessageBatchParams, callback: (err: Error, data: SQS.SendMessageBatchResult) => void): void;
setQueueAttributes(params: SQS.SetQueueAttributesParams, callback: (err: Error, data: any) => void): void;
}
export class SES {
@@ -126,36 +154,77 @@ declare module "aws-sdk" {
constructor(options?: any);
}
export module Sqs {
export interface Client {
config: ClientConfig;
sendMessage(params: SendMessageRequest, callback: (err: any, data: SendMessageResult) => void): void;
sendMessageBatch(params: SendMessageBatchRequest, callback: (err: any, data: SendMessageBatchResult) => void): void;
receiveMessage(params: ReceiveMessageRequest, callback: (err: any, data: ReceiveMessageResult) => void): void;
deleteMessage(params: DeleteMessageRequest, callback: (err: any, data: any) => void): void;
deleteMessageBatch(params: DeleteMessageBatchRequest, callback: (err: any, data: DeleteMessageBatchResult) => void): void;
createQueue(params: CreateQueueRequest, callback: (err: any, data: CreateQueueResult) => void): void;
deleteQueue(params: DeleteQueueRequest, callback: (err: any, data: any) => void): void;
export module SQS {
export interface SqsOptions {
params?: any;
endpoint?: string;
accessKeyId?: string;
secretAccessKey?: string;
sessionToken?: Credentials;
credentials?: Credentials;
credentialProvider?: any;
region?: string;
maxRetries?: number;
maxRedirects?: number;
sslEnabled?: boolean;
paramValidation?: boolean;
computeChecksums?: boolean;
convertResponseTypes?: boolean;
correctClockSkew?: boolean;
s3ForcePathStyle?: boolean;
s3BucketEndpoint?: boolean;
httpOptions?: HttpOptions;
apiVersion?: string;
apiVersions?: { [serviceName:string]: string};
logger?: Logger;
systemClockOffset?: number;
signatureVersion?: string;
signatureCache?: boolean;
}
export interface AddPermissionParams {
QueueUrl: string;
Label: string;
AWSAccountIds:string[];
Actions:string[];
}
export interface ChangeMessageVisibilityParams {
QueueUrl: string,
ReceiptHandle: string,
VisibilityTimeout: number
}
export interface ChangeMessageVisibilityBatchParams {
QueueUrl: string,
Entries: { Id: string; ReceiptHandle: string; VisibilityTimeout?: number; }[]
}
export interface ChangeMessageVisibilityBatchResponse {
Successful: { Id:string }[];
Failed: BatchResultErrorEntry[];
}
export interface SendMessageRequest {
QueueUrl?: string;
MessageBody?: string;
export interface SendMessageParams {
QueueUrl: string;
MessageBody: string;
DelaySeconds?: number;
MessageAttributes?: { [name:string]: MessageAttribute; }
}
export interface ReceiveMessageRequest {
QueueUrl?: string;
export interface ReceiveMessageParams {
QueueUrl: string;
MaxNumberOfMessages?: number;
VisibilityTimeout?: number;
AttributeNames?: string[];
MessageAttributeNames?: string[];
WaitTimeSeconds?:number;
}
export interface DeleteMessageBatchRequest {
QueueUrl?: string;
Entries?: DeleteMessageBatchRequestEntry[];
export interface DeleteMessageBatchParams {
QueueUrl: string;
Entries: DeleteMessageBatchRequestEntry[];
}
export interface DeleteMessageBatchRequestEntry {
@@ -163,85 +232,117 @@ declare module "aws-sdk" {
ReceiptHandle: string;
}
export interface DeleteMessageRequest {
QueueUrl?: string;
ReceiptHandle?: string;
export interface DeleteMessageParams {
QueueUrl: string;
ReceiptHandle: string;
}
export class Attribute {
Name: string;
Value: string;
export interface SendMessageBatchParams {
QueueUrl: string;
Entries: SendMessageBatchRequestEntry[];
}
export interface SendMessageBatchRequest {
QueueUrl?: string;
Entries?: SendMessageBatchRequestEntry[];
}
export class SendMessageBatchRequestEntry {
export interface SendMessageBatchRequestEntry {
Id: string;
MessageBody: string;
DelaySeconds: number;
}
export interface CreateQueueRequest {
QueueName?: string;
DefaultVisibilityTimeout?: number;
DelaySeconds?: number;
Attributes?: Attribute[];
MessageAttributes?: { [name:string]: MessageAttribute; }
}
export interface DeleteQueueRequest {
QueueUrl?: string;
export interface CreateQueueParams {
QueueName: string;
Attributes: QueueAttributes;
}
export class SendMessageResult {
export interface QueueAttributes {
[name:string]: any;
DelaySeconds?: number;
MaximumMessageSize?: number;
MessageRetentionPeriod?: number;
Policy?: any;
ReceiveMessageWaitTimeSeconds?: number;
VisibilityTimeout?: number;
RedrivePolicy?: any;
}
export interface GetQueueAttributesParams {
QueueUrl: string;
AttributeNames: string[];
}
export interface GetQueueAttributesResult {
Attributes: {[name:string]: string};
}
export interface GetQueueUrlParams {
QueueName: string;
QueueOwnerAWSAccountId?: string;
}
export interface SendMessageResult {
MessageId: string;
MD5OfMessageBody: string;
MD5OfMessageAttributes: string;
}
export class ReceiveMessageResult {
export interface ReceiveMessageResult {
Messages: Message[];
}
export class Message {
export interface Message {
MessageId: string;
ReceiptHandle: string;
MD5OfBody: string;
Body: string;
Attributes: Attribute[];
Attributes: { [name:string]:any };
MD5OfMessageAttributes:string;
MessageAttributes: { [name:string]: MessageAttribute; }
}
export class DeleteMessageBatchResult {
export interface MessageAttribute {
StringValue?: string;
BinaryValue?: any; //(Buffer, Typed Array, Blob, String)
StringListValues?: string[];
BinaryListValues?: any[];
DataType: string;
}
export interface DeleteMessageBatchResult {
Successful: DeleteMessageBatchResultEntry[];
Failed: BatchResultErrorEntry[];
}
export class DeleteMessageBatchResultEntry {
export interface DeleteMessageBatchResultEntry {
Id: string;
}
export class BatchResultErrorEntry {
export interface BatchResultErrorEntry {
Id: string;
Code: string;
Message: string;
SenderFault: string;
Message?: string;
SenderFault: boolean;
}
export class SendMessageBatchResult {
export interface SendMessageBatchResult {
Successful: SendMessageBatchResultEntry[];
Failed: BatchResultErrorEntry[];
}
export class SendMessageBatchResultEntry {
export interface SendMessageBatchResultEntry {
Id: string;
MessageId: string;
MD5OfMessageBody: string;
MD5OfMessageAttributes:string;
}
export class CreateQueueResult {
export interface CreateQueueResult {
QueueUrl: string;
}
export interface SetQueueAttributesParams {
QueueUrl: string;
Attributes: QueueAttributes;
}
}
+9 -2
View File
@@ -1,6 +1,13 @@
/// <reference path="./browser-sync.d.ts"/>
import browserSync = require("browser-sync");
(() => {
//make sure that the interfaces are correctly exposed
var bsInstance: browserSync.BrowserSyncInstance;
var bsStatic: browserSync.BrowserSyncStatic;
var opts: browserSync.Options;
})();
browserSync({
server: {
baseDir: "./"
@@ -78,8 +85,8 @@ bs.init({
});
bs.reload();
function browserSyncInit() {
function browserSyncInit(): browserSync.BrowserSyncInstance {
var browser = browserSync.create();
browser.init();
console.log(browser.name);
+398 -396
View File
@@ -11,404 +11,406 @@ declare module "browser-sync" {
import fs = require("fs");
import http = require("http");
interface Options {
/**
* Browsersync includes a user-interface that is accessed via a separate port. The UI allows to controls
* all devices, push sync updates and much more.
*
* port - Default: 3001
* weinre.port - Default: 8080
* Note: requires at least version 2.0.0
*/
ui?: UIOptions;
/**
* Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS
* & images) or will cause all browsers to do a full-page refresh. See anymatch for more information on glob
* patterns.
* Default: false
*/
files?: string | string[];
/**
* File watching options that get passed along to Chokidar. Check their docs for available options
* Default: undefined
* Note: requires at least version 2.6.0
*/
watchOptions?: ChokidarOptions;
/**
* Use the built-in static server for basic HTML/JS/CSS websites.
* Default: false
*/
server?: ServerOptions;
/**
* Proxy an EXISTING vhost. Browsersync will wrap your vhost with a proxy URL to view your site.
* target - Default: undefined
* ws - Default: undefined
* middleware - Default: undefined
* reqHeaders - Default: undefined
* proxyRes - Default: undefined
*/
proxy?: string | boolean | ProxyOptions;
/**
* Use a specific port (instead of the one auto-detected by Browsersync)
* Default: 3000
*/
port?: number;
/**
* Add additional directories from which static files should be served.
* Should only be used in proxy or snippet mode.
* Default: []
* Note: requires at least version 2.8.0
*/
serveStatic?: string[];
/**
* Enable https for localhost development.
* Note - this is not needed for proxy option as it will be inferred from your target url.
* Note: requires at least version 1.3.0
*/
https?: boolean;
/**
* Clicks, Scrolls & Form inputs on any device will be mirrored to all others.
* clicks - Default: true
* scroll - Default: true
* forms - Default: true
*/
ghostMode?: GhostOptions | boolean;
/**
* Can be either "info", "debug", "warn", or "silent"
* Default: info
*/
logLevel?: string;
/**
* Change the console logging prefix. Useful if you're creating your own project based on Browsersync
* Default: BS
* Note: requires at least version 1.5.1
*/
logPrefix?: string;
/**
* Whether or not to log connections
* Default: false
*/
logConnections?: boolean;
/**
* Whether or not to log information about changed files
* Default: false
*/
logFileChanges?: boolean;
/**
* Log the snippet to the console when you're in snippet mode (no proxy/server)
* Default: true
* Note: requires at least version 1.5.2
*/
logSnippet?: boolean;
/**
* You can control how the snippet is injected onto each page via a custom regex + function.
* You can also provide patterns for certain urls that should be ignored from the snippet injection.
* Note: requires at least version 2.0.0
*/
snippetOptions?: SnippetOptions;
/**
* Add additional HTML rewriting rules.
* Default: false
* Note: requires at least version 2.4.0
*/
rewriteRules?: boolean | RewriteRules[];
/**
* Tunnel the Browsersync server through a random Public URL
* Default: null
*/
tunnel?: string | boolean;
/**
* Some features of Browsersync (such as xip & tunnel) require an internet connection, but if you're
* working offline, you can reduce start-up time by setting this option to false
*/
online?: boolean;
/**
* Default: true
* Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set.
* Can be true, local, external, ui, ui-external, tunnel or false
*/
open?: string | boolean;
/**
* The browser(s) to open
* Default: default
*/
browser?: string | string[];
/**
* Requires an internet connection - useful for services such as Typekit as it allows you to configure
* domains such as *.xip.io in your kit settings
* Default: false
*/
xip?: boolean;
/**
* Reload each browser when Browsersync is restarted.
* Default: false
*/
reloadOnRestart?: boolean;
/**
* The small pop-over notifications in the browser are not always needed/wanted.
* Default: true
*/
notify?: boolean;
/**
* scrollProportionally: false // Sync viewports to TOP position
* Default: true
*/
scrollProportionally?: boolean
/**
* How often to send scroll events
* Default: 0
*/
scrollThrottle?: number;
/**
* Decide which technique should be used to restore scroll position following a reload.
* Can be window.name or cookie
* Default: 'window.name'
*/
scrollRestoreTechnique?: string;
/**
* Sync the scroll position of any element on the page. Add any amount of CSS selectors
* Default: []
* Note: requires at least version 2.9.0
*/
scrollElements?: string[];
/**
* Default: []
* Note: requires at least version 2.9.0
* Sync the scroll position of any element on the page - where any scrolled element will cause
* all others to match scroll position. This is helpful when a breakpoint alters which element
* is actually scrolling
*/
scrollElementMapping?: string[];
/**
* Time, in milliseconds, to wait before instructing the browser to reload/inject following a file change event
* Default: 0
*/
reloadDelay?: number;
/**
* Restrict the frequency in which browser:reload events can be emitted to connected clients
* Default: 0
* Note: requires at least version 2.6.0
*/
reloadDebounce?: number;
/**
* User provided plugins
* Default: []
* Note: requires at least version 2.6.0
*/
plugins?: any[];
/**
* Whether to inject changes (rather than a page refresh)
* Default: true
*/
injectChanges?: boolean;
/**
* The initial path to load
*/
startPath?: string;
/**
* Whether to minify the client script
* Default: true
*/
minify?: boolean;
/**
* Override host detection if you know the correct IP to use
*/
host?: string;
/**
* Send file-change events to the browser
* Default: true
*/
codeSync?: boolean;
/**
* Append timestamps to injected files
* Default: true
*/
timestamps?: boolean;
/**
* Alter the script path for complete control over where the Browsersync Javascript is served
* from. Whatever you return from this function will be used as the script path.
* Note: requires at least version 1.5.0
*/
scriptPath?: (path: string) => string;
/**
* Configure the Socket.IO path and namespace & domain to avoid collisions.
* path - Default: "/browser-sync/socket.io"
* clientPath - Default: "/browser-sync"
* namespace - Default: "/browser-sync"
* domain - Default: undefined
* port - Default: undefined
* clients.heartbeatTimeout - Default: 5000
* Note: requires at least version 1.6.2
*/
socket?: SocketOptions;
}
interface Hash<T> {
[path: string]: T;
}
interface ChokidarOptions {
interval?: number;
debounceDelay?: number;
mode?: string;
cwd?: string;
}
interface UIOptions {
/** set the default port */
port?: number;
/** set the default weinre port */
weinre?: {
namespace browserSync {
interface Options {
/**
* Browsersync includes a user-interface that is accessed via a separate port. The UI allows to controls
* all devices, push sync updates and much more.
*
* port - Default: 3001
* weinre.port - Default: 8080
* Note: requires at least version 2.0.0
*/
ui?: UIOptions;
/**
* Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS
* & images) or will cause all browsers to do a full-page refresh. See anymatch for more information on glob
* patterns.
* Default: false
*/
files?: string | string[];
/**
* File watching options that get passed along to Chokidar. Check their docs for available options
* Default: undefined
* Note: requires at least version 2.6.0
*/
watchOptions?: ChokidarOptions;
/**
* Use the built-in static server for basic HTML/JS/CSS websites.
* Default: false
*/
server?: ServerOptions;
/**
* Proxy an EXISTING vhost. Browsersync will wrap your vhost with a proxy URL to view your site.
* target - Default: undefined
* ws - Default: undefined
* middleware - Default: undefined
* reqHeaders - Default: undefined
* proxyRes - Default: undefined
*/
proxy?: string | boolean | ProxyOptions;
/**
* Use a specific port (instead of the one auto-detected by Browsersync)
* Default: 3000
*/
port?: number;
};
/**
* Add additional directories from which static files should be served.
* Should only be used in proxy or snippet mode.
* Default: []
* Note: requires at least version 2.8.0
*/
serveStatic?: string[];
/**
* Enable https for localhost development.
* Note - this is not needed for proxy option as it will be inferred from your target url.
* Note: requires at least version 1.3.0
*/
https?: boolean;
/**
* Clicks, Scrolls & Form inputs on any device will be mirrored to all others.
* clicks - Default: true
* scroll - Default: true
* forms - Default: true
*/
ghostMode?: GhostOptions | boolean;
/**
* Can be either "info", "debug", "warn", or "silent"
* Default: info
*/
logLevel?: string;
/**
* Change the console logging prefix. Useful if you're creating your own project based on Browsersync
* Default: BS
* Note: requires at least version 1.5.1
*/
logPrefix?: string;
/**
* Whether or not to log connections
* Default: false
*/
logConnections?: boolean;
/**
* Whether or not to log information about changed files
* Default: false
*/
logFileChanges?: boolean;
/**
* Log the snippet to the console when you're in snippet mode (no proxy/server)
* Default: true
* Note: requires at least version 1.5.2
*/
logSnippet?: boolean;
/**
* You can control how the snippet is injected onto each page via a custom regex + function.
* You can also provide patterns for certain urls that should be ignored from the snippet injection.
* Note: requires at least version 2.0.0
*/
snippetOptions?: SnippetOptions;
/**
* Add additional HTML rewriting rules.
* Default: false
* Note: requires at least version 2.4.0
*/
rewriteRules?: boolean | RewriteRules[];
/**
* Tunnel the Browsersync server through a random Public URL
* Default: null
*/
tunnel?: string | boolean;
/**
* Some features of Browsersync (such as xip & tunnel) require an internet connection, but if you're
* working offline, you can reduce start-up time by setting this option to false
*/
online?: boolean;
/**
* Default: true
* Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set.
* Can be true, local, external, ui, ui-external, tunnel or false
*/
open?: string | boolean;
/**
* The browser(s) to open
* Default: default
*/
browser?: string | string[];
/**
* Requires an internet connection - useful for services such as Typekit as it allows you to configure
* domains such as *.xip.io in your kit settings
* Default: false
*/
xip?: boolean;
/**
* Reload each browser when Browsersync is restarted.
* Default: false
*/
reloadOnRestart?: boolean;
/**
* The small pop-over notifications in the browser are not always needed/wanted.
* Default: true
*/
notify?: boolean;
/**
* scrollProportionally: false // Sync viewports to TOP position
* Default: true
*/
scrollProportionally?: boolean
/**
* How often to send scroll events
* Default: 0
*/
scrollThrottle?: number;
/**
* Decide which technique should be used to restore scroll position following a reload.
* Can be window.name or cookie
* Default: 'window.name'
*/
scrollRestoreTechnique?: string;
/**
* Sync the scroll position of any element on the page. Add any amount of CSS selectors
* Default: []
* Note: requires at least version 2.9.0
*/
scrollElements?: string[];
/**
* Default: []
* Note: requires at least version 2.9.0
* Sync the scroll position of any element on the page - where any scrolled element will cause
* all others to match scroll position. This is helpful when a breakpoint alters which element
* is actually scrolling
*/
scrollElementMapping?: string[];
/**
* Time, in milliseconds, to wait before instructing the browser to reload/inject following a file
* change event
* Default: 0
*/
reloadDelay?: number;
/**
* Restrict the frequency in which browser:reload events can be emitted to connected clients
* Default: 0
* Note: requires at least version 2.6.0
*/
reloadDebounce?: number;
/**
* User provided plugins
* Default: []
* Note: requires at least version 2.6.0
*/
plugins?: any[];
/**
* Whether to inject changes (rather than a page refresh)
* Default: true
*/
injectChanges?: boolean;
/**
* The initial path to load
*/
startPath?: string;
/**
* Whether to minify the client script
* Default: true
*/
minify?: boolean;
/**
* Override host detection if you know the correct IP to use
*/
host?: string;
/**
* Send file-change events to the browser
* Default: true
*/
codeSync?: boolean;
/**
* Append timestamps to injected files
* Default: true
*/
timestamps?: boolean;
/**
* Alter the script path for complete control over where the Browsersync Javascript is served
* from. Whatever you return from this function will be used as the script path.
* Note: requires at least version 1.5.0
*/
scriptPath?: (path: string) => string;
/**
* Configure the Socket.IO path and namespace & domain to avoid collisions.
* path - Default: "/browser-sync/socket.io"
* clientPath - Default: "/browser-sync"
* namespace - Default: "/browser-sync"
* domain - Default: undefined
* port - Default: undefined
* clients.heartbeatTimeout - Default: 5000
* Note: requires at least version 1.6.2
*/
socket?: SocketOptions;
}
interface Hash<T> {
[path: string]: T;
}
interface ChokidarOptions {
interval?: number;
debounceDelay?: number;
mode?: string;
cwd?: string;
}
interface UIOptions {
/** set the default port */
port?: number;
/** set the default weinre port */
weinre?: {
port?: number;
};
}
interface ServerOptions {
/** set base directory */
baseDir?: string | string[];
/** enable directory listing */
directory?: boolean;
/** set index filename */
index?: string;
/**
* key-value object hash, where the key is the url to match,
* and the value is the folder to serve (relative to your working directory)
*/
routes?: Hash<string>;
/** configure custom middleware */
middleware?: MiddlewareHandler[];
}
interface ProxyOptions {
target?: string;
middleware?: MiddlewareHandler;
ws: boolean;
reqHeaders: (config: any) => Hash<any>;
proxyRes: (res: http.ServerResponse, req: http.ServerRequest, next: Function) => any;
}
interface MiddlewareHandler {
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
}
interface GhostOptions {
clicks?: boolean;
scroll?: boolean;
forms?: boolean;
}
interface SnippetOptions {
ignorePaths?: string;
rule?: { match?: RegExp; fn?: (snippet: string, match: string) => any };
}
interface SocketOptions {
path?: string;
clientPath?: string;
namespace?: string;
domain?: string;
port?: number;
clients?: { heartbeatTimeout?: number; };
}
interface RewriteRules {
match: RegExp;
fn: (match: string) => string;
}
interface BrowserSyncStatic extends BrowserSyncInstance {
/**
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
* depending on your use-case.
*/
(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
/**
* Create a Browsersync instance
* @param name an identifier that can used for retrieval later
*/
create(name?: string): BrowserSyncInstance;
/**
* Get a single instance by name. This is useful if you have your build scripts in separate files
* @param name the identifier used for retrieval
*/
get(name: string): BrowserSyncInstance;
}
interface BrowserSyncInstance {
/** the name of this instance of browser-sync */
name: string;
/**
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
* depending on your use-case.
*/
init(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
/**
* Reload the browser
* The reload method will inform all browsers about changed files and will either cause the browser
* to refresh, or inject the files where possible.
*/
reload(): void;
/**
* Reload a single file
* The reload method will inform all browsers about changed files and will either cause the browser
* to refresh, or inject the files where possible.
*/
reload(file: string): void;
/**
* Reload multiple files
* The reload method will inform all browsers about changed files and will either cause the browser
* to refresh, or inject the files where possible.
*/
reload(files: string[]): void;
/**
* The reload method will inform all browsers about changed files and will either cause the browser
* to refresh, or inject the files where possible.
*/
reload(options: { stream: boolean }): NodeJS.ReadWriteStream;
/**
* The stream method returns a transform stream and can act once or on many files.
* @param opts Configuration for the stream method
*/
stream(opts: { once: boolean }): NodeJS.ReadWriteStream;
/**
* Helper method for browser notifications
* @param message Can be a simple message such as 'Connected' or HTML
* @param timeout How long the message will remain in the browser. @since 1.3.0
*/
notify(message: string, timeout?: number): void;
/**
* This method will close any running server, stop file watching & exit the current process.
*/
exit(): void;
/**
* Stand alone file-watcher. Use this along with Browsersync to create your own, minimal build system
*/
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any)
: NodeJS.EventEmitter;
/**
* Method to pause file change events
*/
pause(): void;
/**
* Method to resume paused watchers
*/
resume(): void;
/**
* The internal Event Emitter used by the running Browsersync instance (if there is one). You can use
* this to emit your own events, such as changed files, logging etc.
*/
emitter: NodeJS.EventEmitter;
/**
* A simple true/false flag that you can use to determine if there's a currently-running Browsersync instance.
*/
active: boolean;
/**
* A simple true/false flag to determine if the current instance is paused
*/
paused: boolean;
}
}
interface ServerOptions {
/** set base directory */
baseDir?: string | string[];
/** enable directory listing */
directory?: boolean;
/** set index filename */
index?: string;
/**
* key-value object hash, where the key is the url to match,
* and the value is the folder to serve (relative to your working directory)
* */
routes?: Hash<string>;
/** configure custom middleware */
middleware?: MiddlewareHandler[];
}
interface ProxyOptions {
target?: string;
middleware?: MiddlewareHandler;
ws: boolean;
reqHeaders: (config: any) => Hash<any>;
proxyRes: (res: http.ServerResponse, req: http.ServerRequest, next: Function) => any;
}
interface MiddlewareHandler {
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
}
interface GhostOptions {
clicks?: boolean;
scroll?: boolean;
forms?: boolean;
}
interface SnippetOptions {
ignorePaths?: string;
rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any};
}
interface SocketOptions {
path?: string;
clientPath?: string;
namespace?: string;
domain?: string;
port?: number;
clients?: { heartbeatTimeout?: number; };
}
interface RewriteRules {
match: RegExp;
fn: (match: string) => string;
}
interface BrowserSyncStatic extends BrowserSyncInstance {
/**
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
* depending on your use-case.
*/
(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
/**
* Create a Browsersync instance
* @param name an identifier that can used for retrieval later
*/
create(name?: string): BrowserSyncInstance;
/**
* Get a single instance by name. This is useful if you have your build scripts in separate files
* @param name the identifier used for retrieval
*/
get(name: string): BrowserSyncInstance;
}
interface BrowserSyncInstance {
/** the name of this instance of browser-sync */
name: string;
/**
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
* depending on your use-case.
*/
init(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
/**
* Reload the browser
* The reload method will inform all browsers about changed files and will either cause the browser
* to refresh, or inject the files where possible.
*/
reload(): void;
/**
* Reload a single file
* The reload method will inform all browsers about changed files and will either cause the browser
* to refresh, or inject the files where possible.
*/
reload(file: string): void;
/**
* Reload multiple files
* The reload method will inform all browsers about changed files and will either cause the browser
* to refresh, or inject the files where possible.
*/
reload(files: string[]): void;
/**
* The reload method will inform all browsers about changed files and will either cause the browser
* to refresh, or inject the files where possible.
*/
reload(options: {stream: boolean}): NodeJS.ReadWriteStream;
/**
* The stream method returns a transform stream and can act once or on many files.
* @param opts Configuration for the stream method
*/
stream(opts: {once: boolean}): NodeJS.ReadWriteStream;
/**
* Helper method for browser notifications
* @param message Can be a simple message such as 'Connected' or HTML
* @param timeout How long the message will remain in the browser. @since 1.3.0
*/
notify(message: string, timeout?: number): void;
/**
* This method will close any running server, stop file watching & exit the current process.
*/
exit(): void;
/**
* Stand alone file-watcher. Use this along with Browsersync to create your own, minimal build system
*/
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any)
: NodeJS.EventEmitter;
/**
* Method to pause file change events
*/
pause(): void;
/**
* Method to resume paused watchers
*/
resume(): void;
/**
* The internal Event Emitter used by the running Browsersync instance (if there is one). You can use
* this to emit your own events, such as changed files, logging etc.
*/
emitter: NodeJS.EventEmitter;
/**
* A simple true/false flag that you can use to determine if there's a currently-running Browsersync instance.
*/
active: boolean;
/**
* A simple true/false flag to determine if the current instance is paused
*/
paused: boolean;
}
const browserSync: BrowserSyncStatic;
const browserSync: browserSync.BrowserSyncStatic;
export = browserSync;
}
Vendored
+8 -8
View File
@@ -177,7 +177,7 @@ declare module c3 {
* Set threshold to show/hide labels.
*/
threshold?: number
},
};
/**
* Enable or disable expanding pie pieces.
*/
@@ -198,7 +198,7 @@ declare module c3 {
* Set threshold to show/hide labels.
*/
threshold?: number
},
};
/**
* Enable or disable expanding pie pieces.
*/
@@ -223,7 +223,7 @@ declare module c3 {
* Set formatter for the label on gauge.
*/
format?: (value: any, ratio: number) => string;
},
};
/**
* Enable or disable expanding gauge.
*/
@@ -686,7 +686,7 @@ declare module c3 {
/**
* Set custom position for the tooltip. This option can be used to modify the tooltip position by returning object that has top and left.
*/
position?: (data: any, width: number, height: number, element: any) => { top: number, left: number };
position?: (data: any, width: number, height: number, element: any) => { top: number; left: number };
/**
* Set custom HTML for the tooltip.
* Specified function receives data, defaultTitleFormat, defaultValueFormat and color of the data point to show. If tooltip.grouped is true, data includes multiple data points.
@@ -909,7 +909,7 @@ declare module c3 {
* Remove regions. This API removes regions.
* @param args This argument should include classes. If classes is given, the regions that have one of the specified classes will be removed. If args is not given, all of regions will be removed.
*/
remove(args?: { value?: number | string, class?: string }): void;
remove(args?: { value?: number | string; class?: string }): void;
};
data: {
@@ -995,7 +995,7 @@ declare module c3 {
* Get and set axis min and max value.
* @param range If range is given, specified axis' min and max value will be updated. If no argument is given, the current min and max values for each axis will be returned.
*/
range(range?: { min?: number | { [key: string]: number }, max?: number | { [key: string]: number } }): { min: number | { [key: string]: number }, max: number | { [key: string]: number } }
range(range?: { min?: number | { [key: string]: number }; max?: number | { [key: string]: number } }): { min: number | { [key: string]: number }; max: number | { [key: string]: number } }
};
legend: {
@@ -1034,7 +1034,7 @@ declare module c3 {
* Resize the chart. If no size is specified it will resize to fit.
* @param size This argument should include width and height in pixels.
*/
resize(size?: { width?: number, height?: number }): void;
resize(size?: { width?: number; height?: number }): void;
/**
* Force to redraw.
@@ -1062,7 +1062,7 @@ declare module c3 {
* Remove x/y grid lines. This API removes x/y grid lines.
* @param args This argument should include value or class. If value is given, the x/y grid lines that have specified x/y value will be removed. If class is given, the x/y grid lines that have specified class will be removed. If args is not given, all of x/y grid lines will be removed.
*/
remove(args?: { class?: string, value?: number | string }): void;
remove(args?: { class?: string; value?: number | string }): void;
}
export function generate(config: ChartConfiguration): ChartAPI;
+1
View File
@@ -8,6 +8,7 @@
declare module 'chai-as-promised' {
function chaiAsPromised(chai: any, utils: any): void;
namespace chaiAsPromised {}
export = chaiAsPromised;
}
+16
View File
@@ -0,0 +1,16 @@
/// <reference path="credential.d.ts" />
import * as credential from 'credential';
credential.hash('password', function(err: Error, hash: string) {
if (err) console.error(err);
else console.log(hash);
});
const hash = '{}';
const password = 'test';
credential.verify(hash, password, function(err: Error, isValid: boolean) {
if (err) console.error(err);
else console.log(isValid ? 'Password match' : 'Incorrect password');
});
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for credential
// Project: https://github.com/ericelliott/credential
// Definitions by: Phú <https://github.com/phuvo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'credential' {
type HashCallback = (err: Error, hash: string) => void;
type VerifyCallback = (err: Error, isValid: boolean) => void;
module credential {
function hash(password: string, callback: HashCallback): void;
function verify(hash: string, password: string, callback: VerifyCallback): void;
}
export = credential;
}
+1 -1
View File
@@ -41,7 +41,7 @@ flowOptions.testMethod = "";
flowOptions.uploadMethod = "";
flowOptions.allowDuplicateUploads = true;
flowOptions.prioritizeFirstAndLastChunk = true;
flowOptions.testchunks = true;
flowOptions.testChunks = true;
flowOptions.preprocess = () => {};
flowOptions.initFileFn = () => {};
flowOptions.generateUniqueIdentifier = () => {};
+1 -1
View File
@@ -44,7 +44,7 @@ declare module flowjs {
uploadMethod?: string;
allowDuplicateUploads?: boolean;
prioritizeFirstAndLastChunk?: boolean;
testchunks?: boolean;
testChunks?: boolean;
preprocess?: Function;
initFileFn?: Function;
generateUniqueIdentifier?: Function;
+1
View File
@@ -1956,6 +1956,7 @@ declare module google.maps {
bounds?: LatLngBounds;
input?: string;
location?: LatLng;
offset?: number;
radius?: number;
}
+46 -11
View File
@@ -102,7 +102,7 @@ class IonicTestController {
}
private testGesture(): void {
var gesture: ionic.gestures.IonicGesture = this.$ionicGesture.on(
'eventType',
'eventType',
(e)=>{ return e; },
angular.element("body"),
{}
@@ -226,7 +226,7 @@ class IonicTestController {
cssClass: "cssClass",
template: "template",
templateUrl: "templateUrl",
okText: "OK",
okText: "OK",
okType: "okType"
}).then(() => console.log("popover shown"))
this.$ionicPopup.alert({
@@ -235,7 +235,7 @@ class IonicTestController {
cssClass: "cssClass",
template: "template",
templateUrl: "templateUrl",
okText: "OK",
okText: "OK",
okType: "okType"
}).close();
@@ -245,9 +245,9 @@ class IonicTestController {
cssClass: "cssClass",
template: "template",
templateUrl: "templateUrl",
okText: "OK",
okText: "OK",
okType: "okType",
cancelText: "Cancel",
cancelText: "Cancel",
cancelType: "cancelType"
}).then(() => console.log("popover shown"))
this.$ionicPopup.confirm({
@@ -256,9 +256,9 @@ class IonicTestController {
cssClass: "cssClass",
template: "template",
templateUrl: "templateUrl",
okText: "OK",
okText: "OK",
okType: "okType",
cancelText: "Cancel",
cancelText: "Cancel",
cancelType: "cancelType"
}).close();
@@ -268,9 +268,9 @@ class IonicTestController {
cssClass: "cssClass",
template: "template",
templateUrl: "templateUrl",
okText: "OK",
okText: "OK",
okType: "okType",
cancelText: "Cancel",
cancelText: "Cancel",
cancelType: "cancelType",
inputType: "text",
inputPlaceholder: "Type some text..."
@@ -281,9 +281,9 @@ class IonicTestController {
cssClass: "cssClass",
template: "template",
templateUrl: "templateUrl",
okText: "OK",
okText: "OK",
okType: "okType",
cancelText: "Cancel",
cancelText: "Cancel",
cancelType: "cancelType",
inputType: "text",
inputPlaceholder: "Type some text..."
@@ -359,6 +359,41 @@ class IonicTestController {
var {top: number, left: number, width: number, height: number} = this.$ionicPositionService.position(angular.element("body"));
var {top: number, left: number, width: number, height: number} = this.$ionicPositionService.offset(angular.element("body"));
}
/**
* ionic.version
*/
private testStaticVersion(): void {
var version: string = ionic.version;
}
/**
* ionic.Platform
*/
private testStaticPlaform(): void {
var callbackWithoutReturn: ()=>void;
var callbackWithReturn: ()=>boolean;
var ready: void = ionic.Platform.ready(callbackWithoutReturn);
ready = ionic.Platform.ready(callbackWithReturn);
var setGrade: void = ionic.Platform.setGrade('iOS');
var deviceInformation: string = ionic.Platform.device();
var isWebView: boolean = ionic.Platform.isWebView();
var isIPad: boolean = ionic.Platform.isIPad();
var isIOS: boolean = ionic.Platform.isIOS();
var isAndroid: boolean = ionic.Platform.isAndroid();
var isWindowsPhone: boolean = ionic.Platform.isWindowsPhone();
var currentPlatform: string = ionic.Platform.platform();
var currentPlatformVersion: number = ionic.Platform.version();
var exitApp: void = ionic.Platform.exitApp();
var showStatusBar: void = ionic.Platform.showStatusBar(true);
var showStatusBar: void = ionic.Platform.fullScreen();
showStatusBar = ionic.Platform.fullScreen(true);
showStatusBar = ionic.Platform.fullScreen(true, true);
var isReady: boolean = ionic.Platform.isReady;
var isFullScreen: boolean = ionic.Platform.isFullScreen;
var platforms: Array<string> = ionic.Platform.platforms;
var grade: string = ionic.Platform.grade;
}
}
testIonic.controller('ionicTestController', IonicTestController);
+82
View File
@@ -6,7 +6,89 @@
/// <reference path="../angularjs/angular.d.ts" />
interface IonicStatic {
/**
* What Ionic package version is.
*/
version: string;
Platform: {
/**
* Trigger a callback once the device is ready, or immediately
* if the device is already ready. This method can be run from
* anywhere and does not need to be wrapped by any additonal methods.
* When the app is within a WebView (Cordova), itll fire
* the callback once the device is ready. If the app is within
* a web browser, itll fire the callback after window.load.
* Please remember that Cordova features (Camera, FileSystem, etc) still
* will not work in a web browser.
*/
ready(callback: ()=>any): void;
/**
* Set the grade of the device: a, b, or c. a is the best
* (most css features enabled), c is the worst. By default, sets the grade
* depending on the current device.
*/
setGrade(grade: string): void;
/**
* Return the current device (given by cordova).
*/
device(): any;
/**
* Check if we are running within a WebView (such as Cordova).
*/
isWebView(): boolean;
/**
* Whether we are running on iPad.
*/
isIPad(): boolean;
/**
* Whether we are running on iOS.
*/
isIOS(): boolean;
/**
* Whether we are running on Android.
*/
isAndroid(): boolean;
/**
* Whether we are running on Windows Phone.
*/
isWindowsPhone(): boolean;
/**
* The name of the current platform.
*/
platform(): string;
/**
* The version of the current device platform.
*/
version(): number;
/**
* Exit the app.
*/
exitApp(): void;
/**
* Shows or hides the device status bar (in Cordova). Requires cordova plugin add org.apache.cordova.statusbar
*/
showStatusBar(shouldShow: boolean): void;
/**
* Sets whether the app is fullscreen or not (in Cordova).
*/
fullScreen(showFullScreen?: boolean, showStatusBar?: boolean): void;
/**
* Whether the device is ready.
*/
isReady: boolean;
/**
* Whether the device is fullscreen.
*/
isFullScreen: boolean;
/**
* An array of all platforms found.
*/
platforms: Array<string>;
/**
* What grade the current platform is.
*/
grade: string;
};
}
declare var ionic: IonicStatic;
+1 -1
View File
@@ -813,7 +813,7 @@ var customMatchers: jasmine.CustomMatcherFactories = {
if (expected === undefined) {
expected = '';
}
var result: jasmine.CustomMatcherResult = { pass: false, message: ''};
var result: jasmine.CustomMatcherResult = { pass: false };
result.pass = util.equals(actual.hyuk, "gawrsh" + expected, customEqualityTesters);
+1 -1
View File
@@ -129,7 +129,7 @@ declare module jasmine {
interface CustomMatcherResult {
pass: boolean;
message: string;
message?: string;
}
interface MatchersUtil {
+1
View File
@@ -3128,6 +3128,7 @@ function test_val() {
$("#single").val("Single2");
$("#multiple").val(["Multiple2", "Multiple3"]);
$("input").val(["check1", "check2", "radio1"]);
$("input").val(1);
}
function test_selector() {
+2 -2
View File
@@ -1363,9 +1363,9 @@ interface JQuery {
/**
* Set the value of each element in the set of matched elements.
*
* @param value A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked.
* @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked.
*/
val(value: string|string[]): JQuery;
val(value: string|string[]|number): JQuery;
/**
* Set the value of each element in the set of matched elements.
*
+49
View File
@@ -0,0 +1,49 @@
/// <reference path="kii-cloud-sdk.d.ts" />
function main() {
Kii.initializeWithSite("abc", "def", KiiSite.JP);
var user = KiiUser.userWithUsername("name", "password");
user.register({
success(user: KiiUser) {
},
failure(user: KiiUser, message: string) {
}
});
user.register({
success: (user: KiiUser) => 123,
failure: (user: KiiUser, message: string) => 456
});
user.register()
.then(function (user: KiiUser) {
});
var bucket = Kii.bucketWithName("foo");
var clause1 = KiiClause.lessThan("x", 1);
var clause2 = KiiClause.greaterThan("y", 1);
var clause3 = KiiClause.and(clause1, clause2);
var query = KiiQuery.queryWithClause(clause3);
bucket.executeQuery(query, {
success: function (query: KiiQuery,
results: KiiObject[],
nextQuery: KiiQuery) {
},
failure: function (bucket: KiiBucket, message: string) {
}
});
bucket.executeQuery<KiiObject>(query)
.then(function (params: [KiiQuery, KiiObject[], KiiQuery]) {
var [query, results, nextQuery] = params;
});
var object = bucket.createObject();
object.set("foo", 1);
object.save();
}
+7279
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -1088,7 +1088,7 @@ declare namespace L {
/**
* Size of the icon image in pixels.
*/
iconSize?: Point;
iconSize?: Point|[number, number];
/**
* The coordinates of the "tip" of the icon (relative to its top left corner).
@@ -1096,7 +1096,7 @@ declare namespace L {
* location. Centered by default if size is specified, also can be set in CSS
* with negative margins.
*/
iconAnchor?: Point;
iconAnchor?: Point|[number, number];
/**
* The URL to the icon shadow image. If not specified, no shadow image will be
@@ -1113,19 +1113,19 @@ declare namespace L {
/**
* Size of the shadow image in pixels.
*/
shadowSize?: Point;
shadowSize?: Point|[number, number];
/**
* The coordinates of the "tip" of the shadow (relative to its top left corner)
* (the same as iconAnchor if not specified).
*/
shadowAnchor?: Point;
shadowAnchor?: Point|[number, number];
/**
* The coordinates of the point from which popups will "open", relative to the
* icon anchor.
*/
popupAnchor?: Point;
popupAnchor?: Point|[number, number];
/**
* A custom class name to assign to both icon and shadow images. Empty by default.
+92
View File
@@ -0,0 +1,92 @@
/// <reference path="./linqsharp.d.ts" />
import Linq, { LinqSharp } from "linqsharp";
var linq: Linq<number> = new Linq<number>([0, 1, 2, 3]);
var linqResult: Linq<number>;
var linqAny: Linq<any>;
var arrayResult: number[];
var numberResult: number;
var boolResult: boolean;
var comparer: LinqSharp.IEqualityComparer<number> = {
Equals: (x: number, y: number): boolean =>
{
return x === y;
},
GetHashCode: (obj: number): number =>
{
return obj.valueOf();
}
};
var comparer2: (o: number, i: number) => number;
var comparer3: (o: number, i: number) => boolean;
numberResult = linq.Aggregate<number>((prev: number, next: number) => { return prev + next; });
boolResult = linq.All((value: number) => value == 0);
boolResult = linq.Any();
boolResult = linq.Any((value: number) => value == 0);
numberResult = linq.Average();
numberResult = linq.Average((value: number) => value);
linqResult = linq.Concat([4, 5, 6]);
boolResult = linq.Contains(0);
boolResult = linq.Contains(0, comparer);
numberResult = linq.Count();
numberResult = linq.Count((value: number) => value == 0);
linqResult = linq.Distinct();
linqResult = linq.Distinct(comparer);
linqResult = linq.DistinctBy((value: number) => value);
numberResult = linq.ElementAt(0);
numberResult = linq.ElementAtOrDefault(0, 1);
linqResult = linq.Except([2]);
linqResult = linq.Except([2], comparer);
numberResult = linq.First();
numberResult = linq.First((value: number) => value == 0);
numberResult = linq.FirstOrDefault();
numberResult = linq.FirstOrDefault((value: number) => value == 0);
linq.ForEach((value: number, index: number) => { });
linqAny = linq.GroupBy((value: number) => value % 2);
linqAny = linq.GroupBy((value: number) => value % 2, (value: number) => value * 2);
linqAny = linq.GroupBy((value: number) => value % 2, (value: number) => value * 2, comparer);
numberResult = linq.IndexOf(0);
numberResult = linq.IndexOf(0, comparer);
linqResult = linq.Intersect([0]);
linqResult = linq.Intersect([0], comparer);
linqResult = linq.Join([0], (outer: number) => outer, (inner: number) => inner, (outer: number, inner: number) => outer + inner);
linqResult = linq.Join([0], (outer: number) => outer, (inner: number) => inner, (outer: number, inner: number) => outer + inner, comparer);
numberResult = linq.Last();
numberResult = linq.Last((value: number) => value == 0);
numberResult = linq.LastOrDefault();
numberResult = linq.LastOrDefault((value: number) => value == 0);
numberResult = linq.Max();
numberResult = linq.Max((value: number) => value);
numberResult = linq.Min();
numberResult = linq.Min((value: number) => value);
linqResult = linq.OrderBy((value: number) => value);
linqResult = linq.OrderBy((value: number) => value, comparer2);
linqResult = linq.OrderByDescending((value: number) => value);
linqResult = linq.OrderByDescending((value: number) => value, comparer2);
linqResult = linq.Reverse();
linqResult = linq.Select((value: number) => value);
linqResult = linq.Select((value: number, index: number) => value + index);
linqResult = linq.SelectMany<number>((value: number) => [ value ]);
linqResult = linq.SelectMany<number>((value: number) => [ value ], (value: number) => value);
boolResult = linq.SequenceEqual([0]);
boolResult = linq.SequenceEqual([0], comparer3);
numberResult = linq.Single();
numberResult = linq.Single((value: number) => value == 0);
numberResult = linq.SingleOrDefault();
numberResult = linq.SingleOrDefault((value: number) => value == 0);
linqResult = linq.Skip(0);
linqResult = linq.SkipWhile((value: number) => value < 2);
numberResult = linq.Sum();
numberResult = linq.Sum((value: number) => value * 2);
linqResult = linq.Take(2);
linqResult = linq.TakeWhile((value: number) => value < 2);
arrayResult = linq.ToArray();
linqResult = linq.Union([0]);
linqResult = linq.Union([0], comparer);
linqResult = linq.Where((value: number) => value > 0);
linqResult = linq.Zip([0], (outer: number, inner: number) => outer + inner);
+500
View File
@@ -0,0 +1,500 @@
// Type definitions for linqsharp
// Project: https://www.npmjs.com/package/linqsharp
// Definitions by: Bruno Leonardo Michels <https://github.com/brunolm>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// JSDoc: Extracted and adapted from .NET source code.
/**
* LinqSharp module defines a helper class with
* .NET's Linq methods.
*
* @module linqsharp
*/
declare module "linqsharp"
{
export namespace LinqSharp {
/**
* Defines methods to support the comparison of objects for equality.
*
* {T} The type of objects to compare.
*/
export interface IEqualityComparer<T> {
Equals(x: T, y: T): boolean;
GetHashCode(obj: T): number;
}
/**
* Represents a collection of objects that have a common key.
*
* {TKey} The type of the key.
* {T} The type of the values.
*/
export interface IGrouping<TKey, T> {
Key: TKey;
Elements: T[];
}
/**
* Gets the HashCode of the object.
*
* @param e Object to compute hash.
* @returns A computed HashCode for the object.
*/
export function GetHashCode(e: any): any;
/**
* Transforms a object into a string replacing circular
* references by reference tokens.
*
* @param obj Object to convert to string.
* @returns String representation of the object.
*/
export function StringifyNonCircular(obj: any): string;
}
/**
* Wrapper class for an array that provides Linq functionallity.
*
* @class Linq<T>
*/
class Linq<T> {
/** {T[]} Internal array reference. */
private a: T[];
/**
* Creates a new instance holding an array of <T>.
* @constructor
*
* @param {Array} a Array.
*/
constructor(a?: T[]);
/**
* Applies an accumulator function over a sequence.
*
* @param func An accumulator function to be
* invoked on each element.
* @param {T} [initialValue] The initial accumulator value.
*
* @throws Error if array is empty.
*
* @returns {T} The final accumulator value.
*/
Aggregate<TResult>(func: (previous: T, next: T) => TResult, initialValue?: T): T;
/**
* Determines whether all elements of a sequence satisfy a condition.
*
* @param predicate A function to test each element for a condition.
*
* @returns true if every element of the source sequence passes the test in the specified
* predicate, or if the sequence is empty; otherwise, false.
*/
All(predicate: (value: T) => boolean): boolean;
/**
* Determines whether a sequence contains any elements.
*
* @param [predicate] A function to test each element for a condition.
*
* @returns true if any elements in the source sequence pass the test in the specified predicate;
* otherwise, false. If no predicate is specified return true if the source sequence contains any elements;
* otherwise, false.
*/
Any(predicate?: (value: T) => boolean): boolean;
/**
* Computes the average of a sequence of {number} values.
*
* @param [selector] A transform function to apply to each element.
*
* @returns The average of the sequence of values.
*/
Average(selector?: (value: T) => number): number;
/**
* Concatenates two sequences.
*
* @param array The sequence to concatenate to the first sequence.
*
* @returns An array that contains the concatenated elements of the two input sequences.
*/
Concat(array: T[]): Linq<T>;
/**
* Determines whether a sequence contains a specified element by using a specified comparer.
*
* @param value The value to locate in the sequence.
* @param [comparer] An IEqualityComparer<T> to compare values.
*
* @returns true if the source sequence contains an element that has the specified value;
* otherwise, false.
*/
Contains(value: T, comparer?: LinqSharp.IEqualityComparer<T>): boolean;
/**
* Returns a number that represents how many elements in the specified sequence satisfy a condition.
*
* @param [selector] A function to test each element for a condition.
*
* @returns A number that represents how many elements in the sequence satisfy the condition
* in the predicate function.
*/
Count(selector?: (value: T) => boolean): number;
/**
* Returns distinct elements from a sequence by using a specified IEqualityComparer<T>
* to compare values.
*
* @param [comparer] An IEqualityComparer<T> to compare values.
*
* @returns An array that contains distinct elements from the source sequence.
*/
Distinct(comparer?: LinqSharp.IEqualityComparer<T>): Linq<T>;
/**
* Returns distinct elements from a sequence by using a specified IEqualityComparer<T>
* to compare values.
*
* @param selector A function to test each element for a condition.
* @param [comparer] An IEqualityComparer<T> to compare values.
*
* @returns An array that contains distinct elements from the source sequence.
*/
DistinctBy<U>(selector: (e: T) => U, comparer?: LinqSharp.IEqualityComparer<T>): Linq<T>;
/**
* Returns the element at a specified index in a sequence.
*
* @param index The zero-based index of the element to retrieve.
*
* @throws index is less than 0 or greater than or equal to the number of elements in source.
*
* @returns The element at the specified position in the source sequence.
*/
ElementAt(index: number): T;
/**
* Returns the element at a specified index in a sequence or a default value if
* the index is out of range.
*
* @param index The zero-based index of the element to retrieve.
* @param defaultValue A default value if no element is found.
*
* @returns defaultValue if the index is outside the bounds of the source sequence;
* otherwise, the element at the specified position in the source sequence.
*/
ElementAtOrDefault(index: number, defaultValue: T): T;
/**
* Produces the set difference of two sequences by using the specified IEqualityComparer<T>
* to compare values.
*
* @param except An array whose elements that also occur in the first sequence will cause
* those elements to be removed from the returned sequence.
* @param [comparer] An IEqualityComparer<T> to compare values.
*
* @returns A sequence that contains the set difference of the elements of two sequences.
*/
Except(except: T[], comparer?: LinqSharp.IEqualityComparer<T>): Linq<T>;
/**
* Returns the first element in a sequence that satisfies a specified condition.
*
* @param [selector] A function to test each element for a condition.
*
* @throws No element satisfies the condition in predicate.-or-The source sequence is empty.
*
* @returns The first element in the sequence that passes the test in the specified predicate function.
*/
First(selector?: (e: T) => boolean): T;
/**
* Returns the first element of the sequence that satisfies a condition or a default
* value if no such element is found.
*
* @param [selector] A function to test each element for a condition.
* @param [defaultValue] A default value to return if no element is found.
*
* @returns defaultValue if source is empty or if no element passes the test specified by predicate;
* otherwise, the first element in source that passes the test specified by predicate.
*/
FirstOrDefault(selector?: (e: T) => boolean, defaultValue?: T): T;
/**
* Performs the specified action on each element of the array.
*
* @param callback The function delegate to perform on each element of the array.
*/
ForEach(callback: (e: T, index: number) => any): void;
/**
* Groups the elements of a sequence according to a specified key selector function.
*
* @param keySelector A function to extract the key for each element.
* @param [elementSelector] A function to create a result value from each group.
* @param [comparer] An IEqualityComparer<TKey> to compare keys with.
*
* @returns A collection of elements of type TResult where each element represents a projection
* over a group and its key.
*/
GroupBy<TKey, TElement>(keySelector: (e: T) => TKey, elementSelector?: (e: T) => TElement, comparer?: LinqSharp.IEqualityComparer<TKey>): Linq<any>;
/**
* Searches for the specified object and returns the zero-based index of the first
* occurrence within the entire array.
*
* @param e The object to locate in the array.
* @param [comparer] An IEqualityComparer<T> to compare elements with.
*
* @returns The zero-based index of the first occurrence of item within the entire array, if found;
* otherwise, 1.
*/
IndexOf(e: T, comparer?: LinqSharp.IEqualityComparer<T>): number;
/**
* Produces the set intersection of two sequences by using the specified IEqualityComparer<T>
* to compare values.
*
* @param array An array whose distinct elements that also appear in the first sequence will be returned.
* @param [comparer] An IEqualityComparer<T> to compare values.
*
* @returns A sequence that contains the elements that form the set intersection of two sequences.
*/
Intersect(array: T[], comparer?: LinqSharp.IEqualityComparer<T>): Linq<T>;
/**
* Correlates the elements of two sequences based on matching keys. A specified IEqualityComparer<T> is used to compare keys.
*
* @param array The sequence to join to the first sequence.
* @param outerKeySelector A function to extract the join key from each element of the first sequence.
* @param innerKeySelector A function to extract the join key from each element of the second sequence.
* @param resultSelector A function to create a result element from two matching elements.
* @param [comparer] An IEqualityComparer<T> to hash and compare keys.
*
* @returns An array that has elements of type TResult that are obtained by performing an inner join on two sequences.
*/
Join<TInner, TKey, TResult>(array: TInner[], outerKeySelector: (e: T) => TKey, innerKeySelector: (e: TInner) => TKey, resultSelector: (outer: T, inner: TInner) => TResult, comparer?: LinqSharp.IEqualityComparer<TKey>): Linq<TResult>;
/**
* Returns the last element of a sequence that satisfies a specified condition.
*
* @param [predicate] A function to test each element for a condition.
*
* @throws No element satisfies the condition in predicate.-or-The source sequence is empty.
*
* @returns The last element in the sequence that passes the test in the specified predicate function.
*/
Last(predicate?: (e: T) => boolean): T;
/**
* Returns the last element of a sequence that satisfies a condition or a default
* value if no such element is found.
*
* @param [predicate] A function to test each element for a condition.
* @param [defaultValue] A default value to return if no element is found.
*
* @returns defaultValue if the sequence is empty or if no elements pass the test in
* the predicate function; otherwise, the last element that passes the test in the
* predicate function.
*/
LastOrDefault(predicate?: (e: T) => boolean, defaultValue?: T): T;
/**
* Returns the maximum value in a sequence of System.Double values.
*
* @param [selector] A transform function to apply to each element.
*
* @returns The maximum value in the sequence.
*/
Max(): T;
Max<TResult>(selector?: (e: T) => TResult): TResult;
/**
* Returns the minimum value in a sequence of System.Int64 values.
*
* @param [selector] A transform function to apply to each element.
*
* @returns The minimum value in the sequence.
*/
Min(): T;
Min<TResult>(selector?: (e: T) => TResult): TResult;
/**
* Sorts the elements of a sequence in ascending order according to a key.
*
* @param keySelector A function to extract a key from an element.
* @param [comparer] An IEqualityComparer<T> to compare values.
*
* @returns An array whose elements are sorted according to a key.
*/
OrderBy<TKey>(keySelector: (e: T) => TKey, comparer?: (a: TKey, b: TKey) => number): Linq<T>;
/**
* Sorts the elements of a sequence in descending order according to a key.
*
* @param keySelector A function to extract a key from an element.
* @param [comparer] An IEqualityComparer<T> to compare values.
*
* @returns An array whose elements are sorted in descending order according to a key.
*/
OrderByDescending<TKey>(keySelector: (e: T) => TKey, comparer?: (a: TKey, b: TKey) => number): Linq<T>;
/**
* Inverts the order of the elements in a sequence.
*
* @returns A sequence whose elements correspond to those of the input sequence in reverse order.
*/
Reverse(): Linq<T>;
/**
* Projects each element of a sequence into a new form.
*
* @param selector A transform function to apply to each element.
*
* @returns An array whose elements are the result of invoking the transform function on each element of source.
*/
Select<TResult>(selector: (e: T, i?: number) => TResult): Linq<TResult>;
/**
* Projects each element of a sequence to an array flattens the resulting sequences into one sequence,
* and invokes a result selector function on each element therein.
*
* @param selector A transform function to apply to each element of the input sequence.
* @param [resultSelector] A transform function to apply to each element of the intermediate sequence.
*
* @returns An array whose elements are the result of invoking the one-to-many transform function
* selector on each element of source and then mapping each of those sequence elements and
* their corresponding source element to a result element.
*/
SelectMany<TResult>(selector: (e: T) => T[], resultSelector?: (e: T) => TResult): Linq<TResult>;
/**
* Determines whether two sequences are equal by comparing their elements by using
* a specified IEqualityComparer<T>.
*
* @param second An array to compare to the first sequence.
* @param [comparer] An equality comparer to compare values.
*
* @returns true if the two source sequences are of equal length and their corresponding
* elements compare equal according to comparer; otherwise, false.
*/
SequenceEqual(second: T[], comparer?: (a: T, b: T) => boolean): boolean;
/**
* Returns the only element of a sequence that satisfies a specified condition,
* and throws an exception if more than one such element exists.
*
* @param [predicate] A function to test an element for a condition.
*
* @returns The single element of the input sequence that satisfies a condition.
*/
Single(predicate?: (e: T) => boolean): T;
/**
* Returns the only element of a sequence that satisfies a specified condition or
* a default value if no such element exists; this method throws an exception if
* more than one element satisfies the condition.
*
* @param [predicate] A function to test an element for a condition.
* @param [defaultValue] A default value if no element is found.
*
* @returns The single element of the input sequence that satisfies the condition,
* or defaultValue if no such element is found.
*/
SingleOrDefault(predicate?: (e: T) => boolean, defaultValue?: T): T;
/**
* Bypasses a specified number of elements in a sequence and then returns the remaining
* elements.
*
* @param count The number of elements to skip before returning the remaining elements.
*
* @returns An array that contains the elements that occur
* after the specified index in the input sequence.
*/
Skip(count: number): Linq<T>;
/**
* Bypasses elements in a sequence as long as a specified condition is true and
* then returns the remaining elements.
*
* @param predicate A function to test an element for a condition.
*
* @returns An array that contains the elements from the
* input sequence starting at the first element in the linear series that does not
* pass the test specified by predicate.
*/
SkipWhile(predicate: (e: T) => boolean): Linq<T>;
/**
* Computes the sum of a sequence values.
*
* @param [selector] A transform function to apply to each element.
*
* @returns The sum of the values in the sequence.
*/
Sum(selector?: (value: T) => number): number;
/**
* Returns a specified number of contiguous elements from the start of a sequence.
*
* @param count The number of elements to skip before returning the remaining elements.
*
* @returns An array that contains the specified number of elements from the start
* of the input sequence.
*/
Take(count: number): Linq<T>;
/**
* Returns elements from a sequence as long as a specified condition is true.
*
* @param predicate A function to test an element for a condition.
*
* @returns An array that contains the elements from the
* input sequence that occur before the element at which the test no longer passes.
*/
TakeWhile(predicate: (e: T) => boolean): Linq<T>;
/**
* Produces the set union of two sequences by using a specified IEqualityComparer<T>.
*
* @param second An array whose distinct elements form the second set for the union.
* @param [comparer] An equality comparer to compare values.
*
* @returns An array that contains the elements from both
* input sequences, excluding duplicates.
*/
Union(second: T[], comparer?: LinqSharp.IEqualityComparer<T>): Linq<T>;
/**
* Filters a sequence of values based on a predicate.
*
* @param selector A transform function to apply to each element.
*
* @returns An array that contains elements from the input sequence
* that satisfy the condition.
*/
Where(selector: (value: T) => boolean): Linq<T>;
/**
* Applies a specified function to the corresponding elements of two sequences,
* producing a sequence of the results.
*
* @param array The second sequence to merge.
* @param resultSelector A function that specifies how to merge the elements from the two sequences.
*
* @returns An array that contains merged elements of two input sequences.
*/
Zip<TInner, TResult>(array: TInner[], resultSelector: (o: T, i: TInner) => TResult): Linq<TResult>;
/**
* Retrieves the internal array.
*
* @returns Internal array.
*/
ToArray(): T[];
}
export default Linq;
}
+1066 -190
View File
File diff suppressed because it is too large Load Diff
+934 -301
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -22,9 +22,9 @@ class SimpleTestAllParams {
this.element = $(".content");
this.element.mCustomScrollbar({
set_width: false,
set_height: false,
horizontalScroll: false,
setWidth: false,
setHeight: false,
axis: "y",
scrollInertia: 950,
mouseWheel: true,
mouseWheelPixels: "auto",
@@ -147,4 +147,4 @@ class DisableDestroyTest {
});
});
}
}
}
+31 -5
View File
@@ -10,15 +10,27 @@ declare module MCustomScrollbar {
/**
* Set the width of your content (overwrites CSS width), value in pixels (integer) or percentage (string)
*/
set_width?: any;
setWidth?: any;
/**
* Set the height of your content (overwirtes CSS height), value in pixels (integer) or percentage (string)
*/
set_height?: any;
setHeight?: any;
/**
* Add horizontal scrollbar (default is vertical), value: true, false
* Define contents scrolling axis (the type of scrollbars added to the element: vertical and/of horizontal).
* Available values: "y", "x", "yx". y -vertical, x - horizontal
*/
axis?: string;
/**
* Always keep scrollbar(s) visible, even when theres nothing to scroll.
* 0 disable (default)
* 1 keep dragger rail visible
* 2 keep all scrollbar components (dragger, rail, buttons etc.) visible
*/
horizontalScroll?: boolean;
alwaysShowScrollbar?: number;
/**
* Enable or disable auto-expanding the scrollbar when cursor is over or dragging the scrollbar.
*/
autoExpandScrollbar?: boolean;
/**
* Scrolling inertia (easing), value in milliseconds (0 for no scrolling inertia)
*/
@@ -119,6 +131,12 @@ declare module MCustomScrollbar {
* User defined callback function, triggered while scrolling
*/
whileScrolling?: () => void;
/**
* Set the behavior of calling onTotalScroll and onTotalScrollBack offsets.
* By default, callback offsets will trigger repeatedly while content is scrolling within the offsets.
* Set alwaysTriggerOffsets: false when you need to trigger onTotalScroll and onTotalScrollBack callbacks once, each time scroll end or beginning is reached.
*/
alwaysTriggerOffsets?: boolean;
}
/**
* Set a scrollbar ready-to-use theme. See themes demo for all themes - http://manos.malihu.gr/tuts/custom-scrollbar-plugin/scrollbar_themes_demo.html
@@ -132,10 +150,18 @@ declare module MCustomScrollbar {
*/
scrollInertia?: number;
/**
* Scroll-to animation easing, values: "linear", "easeOut", "easeInOut".
*/
scrollEasing?: string;
/**
* Scroll scrollbar dragger (instead of content) to a number of pixels, values: true, false
*/
moveDragger?: boolean;
/**
* Set a timeout for the method (the default timeout is 60 ms in order to work with automatic scrollbar update), value in milliseconds.
*/
timeout?: number;
/**
* Trigger user defined callback after scroll-to completes, value: true, false
*/
callbacks?: boolean;
@@ -163,4 +189,4 @@ interface JQuery {
* @param options Override default options
*/
mCustomScrollbar(options?: MCustomScrollbar.CustomScrollbarOptions): JQuery;
}
}
+50
View File
@@ -0,0 +1,50 @@
/// <reference path="../angularjs/angular.d.ts" />
/// <reference path="ngbootbox.d.ts" />
class TestBootboxController {
constructor(private $scope: angular.IScope, $ngBootbox: BootboxService) {
$ngBootbox.alert('An important message!').then(function() {
console.log('Alert closed');
});
$ngBootbox.confirm('A question?').then(function() {
console.log('Confirmed!');
}, function() {
console.log('Confirm dismissed!');
});
$ngBootbox.prompt('Enter something').then(function(result) {
console.log('Prompt returned: ' + result);
}, function() {
console.log('Prompt dismissed!');
});
var options: NgBootboxDialog = {
message: 'This is a message!',
title: 'The title!',
className: 'test-class',
buttons: {
warning: {
label: "Cancel",
className: "btn-warning",
callback: function() {
console.log('warning callback');
}
},
success: {
label: "Ok",
className: "btn-success",
callback: function() {
console.log('sucess callback');
}
}
}
};
$ngBootbox.customDialog(options);
}
}
var app = angular.module('testBootbox', ['ngBootbox']);
app.controller('TestBootboxCtrl', ['$scope', '$ngBootbox', TestBootboxController]);
+38
View File
@@ -0,0 +1,38 @@
// Type definitions for ngbootbox
// Project: https://github.com/eriktufvesson/ngBootbox
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../es6-promise/es6-promise.d.ts" />
/// <reference path="../bootbox/bootbox.d.ts" />
interface NgBootboxDialog {
title?: string;
message?: string;
templateUrl?: string;
locale?: string;
callback?: () => any;
onEscape?: () => any | boolean;
show?: boolean;
backdrop?: boolean;
closeButton?: boolean;
animate?: boolean;
className?: string;
size?: string;
buttons?: BootboxButtonMap;
}
interface BootboxService {
alert(msg: string): Promise<any>;
confirm(msg: string): Promise<any>;
prompt(msg: string): Promise<any>;
customDialog(options: NgBootboxDialog): void;
setDefaults(options: BootboxDefaultOptions): void;
hideAll(): void;
addLocale(name: string, values: BootboxLocaleValues): void;
removeLocale(name: string): void;
setLocale(name: string): void;
}
declare var $ngBootbox: BootboxService;
+411
View File
@@ -0,0 +1,411 @@
/// <reference path="node-0.12.d.ts" />
import * as assert from "assert";
import * as fs from "fs";
import * as events from "events";
import * as zlib from "zlib";
import * as url from "url";
import * as util from "util";
import * as crypto from "crypto";
import * as tls from "tls";
import * as http from "http";
import * as net from "net";
import * as dgram from "dgram";
import * as querystring from "querystring";
import * as path from "path";
import * as readline from "readline";
import * as childProcess from "child_process";
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
assert.equal(3, "3", "uses == comparator");
assert.notStrictEqual(2, "2", "uses === comparator");
assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT");
assert.doesNotThrow(() => {
if (false) { throw "a hammer at your face"; }
}, undefined, "What the...*crunch*");
////////////////////////////////////////////////////
/// File system tests : http://nodejs.org/api/fs.html
////////////////////////////////////////////////////
fs.writeFile("thebible.txt",
"Do unto others as you would have them do unto you.",
assert.ifError);
fs.write(1234, "test");
fs.writeFile("Harry Potter",
"\"You be wizzing, Harry,\" jived Dumbledore.",
{
encoding: "ascii"
},
assert.ifError);
var content: string,
buffer: Buffer;
content = fs.readFileSync('testfile', 'utf8');
content = fs.readFileSync('testfile', {encoding : 'utf8'});
buffer = fs.readFileSync('testfile');
buffer = fs.readFileSync('testfile', {flag : 'r'});
fs.readFile('testfile', 'utf8', (err, data) => content = data);
fs.readFile('testfile', {encoding : 'utf8'}, (err, data) => content = data);
fs.readFile('testfile', (err, data) => buffer = data);
fs.readFile('testfile', {flag : 'r'}, (err, data) => buffer = data);
class Networker extends events.EventEmitter {
constructor() {
super();
this.emit("mingling");
}
}
var errno: number;
fs.readFile('testfile', (err, data) => {
if (err && err.errno) {
errno = err.errno;
}
});
///////////////////////////////////////////////////////
/// Buffer tests : https://nodejs.org/api/buffer.html
///////////////////////////////////////////////////////
function bufferTests() {
var utf8Buffer = new Buffer('test');
var base64Buffer = new Buffer('','base64');
var octets: Uint8Array = null;
var octetBuffer = new Buffer(octets);
console.log(Buffer.isBuffer(octetBuffer));
console.log(Buffer.isEncoding('utf8'));
console.log(Buffer.byteLength('xyz123'));
console.log(Buffer.byteLength('xyz123', 'ascii'));
var result1 = Buffer.concat([utf8Buffer, base64Buffer]);
var result2 = Buffer.concat([utf8Buffer, base64Buffer], 9999999);
// Test that TS 1.6 works with the 'as Buffer' annotation
// on isBuffer.
var a: Buffer | number;
a = new Buffer(10);
if (Buffer.isBuffer(a)) {
a.writeUInt8(3, 4);
}
// write* methods return offsets.
var b = new Buffer(16);
var result: number = b.writeUInt32LE(0, 0);
result = b.writeUInt16LE(0, 4);
result = b.writeUInt8(0, 6);
result = b.writeInt8(0, 7);
result = b.writeDoubleLE(0, 8);
// fill returns the input buffer.
b.fill('a').fill('b');
}
////////////////////////////////////////////////////
/// Url tests : http://nodejs.org/api/url.html
////////////////////////////////////////////////////
url.format(url.parse('http://www.example.com/xyz'));
// https://google.com/search?q=you're%20a%20lizard%2C%20gary
url.format({
protocol: 'https',
host: "google.com",
pathname: 'search',
query: { q: "you're a lizard, gary" }
});
var helloUrl = url.parse('http://example.com/?hello=world', true)
assert.equal(helloUrl.query.hello, 'world');
// Old and new util.inspect APIs
util.inspect(["This is nice"], false, 5);
util.inspect(["This is nice"], { colors: true, depth: 5, customInspect: false });
////////////////////////////////////////////////////
/// Stream tests : http://nodejs.org/api/stream.html
////////////////////////////////////////////////////
// http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options
function stream_readable_pipe_test() {
var r = fs.createReadStream('file.txt');
var z = zlib.createGzip();
var w = fs.createWriteStream('file.txt.gz');
r.pipe(z).pipe(w);
r.close();
}
////////////////////////////////////////////////////
/// Crypto tests : http://nodejs.org/api/crypto.html
////////////////////////////////////////////////////
var hmacResult: string = crypto.createHmac('md5', 'hello').update('world').digest('hex');
function crypto_cipher_decipher_string_test() {
var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]);
var clearText:string = "This is the clear text.";
var cipher:crypto.Cipher = crypto.createCipher("aes-128-ecb", key);
var cipherText:string = cipher.update(clearText, "utf8", "hex");
cipherText += cipher.final("hex");
var decipher:crypto.Decipher = crypto.createDecipher("aes-128-ecb", key);
var clearText2:string = decipher.update(cipherText, "hex", "utf8");
clearText2 += decipher.final("utf8");
assert.equal(clearText2, clearText);
}
function crypto_cipher_decipher_buffer_test() {
var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]);
var clearText:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4]);
var cipher:crypto.Cipher = crypto.createCipher("aes-128-ecb", key);
var cipherBuffers:Buffer[] = [];
cipherBuffers.push(cipher.update(clearText));
cipherBuffers.push(cipher.final());
var cipherText:Buffer = Buffer.concat(cipherBuffers);
var decipher:crypto.Decipher = crypto.createDecipher("aes-128-ecb", key);
var decipherBuffers:Buffer[] = [];
decipherBuffers.push(decipher.update(cipherText));
decipherBuffers.push(decipher.final());
var clearText2:Buffer = Buffer.concat(decipherBuffers);
assert.deepEqual(clearText2, clearText);
}
////////////////////////////////////////////////////
/// TLS tests : http://nodejs.org/api/tls.html
////////////////////////////////////////////////////
var ctx: tls.SecureContext = tls.createSecureContext({
key: "NOT REALLY A KEY",
cert: "SOME CERTIFICATE",
});
var blah = ctx.context;
////////////////////////////////////////////////////
// Make sure .listen() and .close() retuern a Server instance
http.createServer().listen(0).close().address();
net.createServer().listen(0).close().address();
var request = http.request('http://0.0.0.0');
request.once('error', function () {});
request.setNoDelay(true);
request.abort();
////////////////////////////////////////////////////
/// Http tests : http://nodejs.org/api/http.html
////////////////////////////////////////////////////
module http_tests {
// Status codes
var code = 100;
var codeMessage = http.STATUS_CODES['400'];
var codeMessage = http.STATUS_CODES[400];
var agent: http.Agent = new http.Agent({
keepAlive: true,
keepAliveMsecs: 10000,
maxSockets: Infinity,
maxFreeSockets: 256
});
var agent: http.Agent = http.globalAgent;
}
////////////////////////////////////////////////////
/// Dgram tests : http://nodejs.org/api/dgram.html
////////////////////////////////////////////////////
var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
});
var ai: dgram.AddressInfo = ds.address();
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
});
////////////////////////////////////////////////////
///Querystring tests : https://gist.github.com/musubu/2202583
////////////////////////////////////////////////////
var original: string = 'http://example.com/product/abcde.html';
var escaped: string = querystring.escape(original);
console.log(escaped);
// http%3A%2F%2Fexample.com%2Fproduct%2Fabcde.html
var unescaped: string = querystring.unescape(escaped);
console.log(unescaped);
// http://example.com/product/abcde.html
////////////////////////////////////////////////////
/// path tests : http://nodejs.org/api/path.html
////////////////////////////////////////////////////
module path_tests {
path.normalize('/foo/bar//baz/asdf/quux/..');
path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');
// returns
//'/foo/bar/baz/asdf'
try {
path.join('foo', {}, 'bar');
}
catch(error) {
}
path.resolve('foo/bar', '/tmp/file/', '..', 'a/../subfile');
//Is similar to:
//
//cd foo/bar
//cd /tmp/file/
//cd ..
// cd a/../subfile
//pwd
path.resolve('/foo/bar', './baz')
// returns
// '/foo/bar/baz'
path.resolve('/foo/bar', '/tmp/file/')
// returns
// '/tmp/file'
path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif')
// if currently in /home/myself/node, it returns
// '/home/myself/node/wwwroot/static_files/gif/image.gif'
path.isAbsolute('/foo/bar') // true
path.isAbsolute('/baz/..') // true
path.isAbsolute('qux/') // false
path.isAbsolute('.') // false
path.isAbsolute('//server') // true
path.isAbsolute('C:/foo/..') // true
path.isAbsolute('bar\\baz') // false
path.isAbsolute('.') // false
path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb')
// returns
// '..\\..\\impl\\bbb'
path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb')
// returns
// '../../impl/bbb'
path.dirname('/foo/bar/baz/asdf/quux')
// returns
// '/foo/bar/baz/asdf'
path.basename('/foo/bar/baz/asdf/quux.html')
// returns
// 'quux.html'
path.basename('/foo/bar/baz/asdf/quux.html', '.html')
// returns
// 'quux'
path.extname('index.html')
// returns
// '.html'
path.extname('index.coffee.md')
// returns
// '.md'
path.extname('index.')
// returns
// '.'
path.extname('index')
// returns
// ''
'foo/bar/baz'.split(path.sep)
// returns
// ['foo', 'bar', 'baz']
'foo\\bar\\baz'.split(path.sep)
// returns
// ['foo', 'bar', 'baz']
console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
// returns
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
console.log(process.env.PATH)
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
process.env.PATH.split(path.delimiter)
// returns
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
path.parse('/home/user/dir/file.txt')
// returns
// {
// root : "/",
// dir : "/home/user/dir",
// base : "file.txt",
// ext : ".txt",
// name : "file"
// }
path.parse('C:\\path\\dir\\index.html')
// returns
// {
// root : "C:\",
// dir : "C:\path\dir",
// base : "index.html",
// ext : ".html",
// name : "index"
// }
path.format({
root : "/",
dir : "/home/user/dir",
base : "file.txt",
ext : ".txt",
name : "file"
});
// returns
// '/home/user/dir/file.txt'
}
////////////////////////////////////////////////////
///ReadLine tests : https://nodejs.org/api/readline.html
////////////////////////////////////////////////////
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.setPrompt("$>");
rl.prompt();
rl.prompt(true);
rl.question("do you like typescript?", function(answer: string) {
rl.close();
});
//////////////////////////////////////////////////////////////////////
/// Child Process tests: https://nodejs.org/api/child_process.html ///
//////////////////////////////////////////////////////////////////////
childProcess.exec("echo test");
childProcess.spawnSync("echo test");
+2080
View File
File diff suppressed because it is too large Load Diff
+20 -12
View File
@@ -1,11 +1,11 @@
// Type definitions for Node.js v0.12.0
// Type definitions for Node.js v4.x
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/borisyankov/DefinitelyTyped>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/************************************************
* *
* Node.js v0.12.0 API *
* Node.js v4.x API *
* *
************************************************/
@@ -430,6 +430,21 @@ declare module "http" {
import * as events from "events";
import * as net from "net";
import * as stream from "stream";
export interface RequestOptions {
protocol?: string;
host?: string;
hostname?: string;
family?: number;
port?: number
localAddress?: string;
socketPath?: string;
method?: string;
path?: string;
headers?: { [key: string]: any };
auth?: string;
agent?: Agent;
}
export interface Server extends events.EventEmitter {
listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server;
@@ -568,7 +583,7 @@ declare module "http" {
};
export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server;
export function createClient(port?: number, host?: string): any;
export function request(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
export function request(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
export var globalAgent: Agent;
}
@@ -718,15 +733,7 @@ declare module "https" {
SNICallback?: (servername: string) => any;
}
export interface RequestOptions {
host?: string;
hostname?: string;
port?: number;
path?: string;
method?: string;
headers?: any;
auth?: string;
agent?: any;
export interface RequestOptions extends http.RequestOptions{
pfx?: any;
key?: any;
passphrase?: string;
@@ -734,6 +741,7 @@ declare module "https" {
ca?: any;
ciphers?: string;
rejectUnauthorized?: boolean;
secureProtocol?: string;
}
export interface Agent {
+3 -1
View File
@@ -5,7 +5,7 @@
declare module "path-to-regexp" {
function pathToRegexp(path: string, keys: string[], options?: pathToRegexp.Options): RegExp;
function pathToRegexp(path: string, keys?: string[], options?: pathToRegexp.Options): RegExp;
module pathToRegexp {
@@ -14,7 +14,9 @@ declare module "path-to-regexp" {
strict?: boolean;
end?: boolean;
}
}
export = pathToRegexp;
}
+71
View File
@@ -0,0 +1,71 @@
/*
Note: This must be compiled with the target set to ES6
The content of index.io.js could be something like
'use strict';
import { AppRegistry } from 'react-native'
import Welcome from './gen/Welcome'
AppRegistry.registerComponent('MopNative', () => Welcome);
*/
///<reference path="../react-native/react-native.d.ts" />
import React from 'react-native'
const { StyleSheet, Text, View } = React
var styles = StyleSheet.create(
{
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
}
)
class Welcome extends React.Component<any,any> {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native
</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
</Text>
</View>
)
}
}
export default Welcome
@@ -0,0 +1 @@
--target es5 --noImplicitAny --experimentalDecorators --jsx react --module commonjs
+2534
View File
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -5442,8 +5442,11 @@ declare module "sequelize" {
*
* @param path The path to the file that holds the model you want to import. If the part is relative, it
* will be resolved relatively to the calling file
*
* @param defineFunction An optional function that provides model definitions. Useful if you do not
* want to use the module root as the define function
*/
import<TInstance, TAttributes>( path : string ) : Model<TInstance, TAttributes>;
import<TInstance, TAttributes>( path : string, defineFunction? : (sequelize: Sequelize, dataTypes: DataTypes) => Model<TInstance, TAttributes> ) : Model<TInstance, TAttributes>;
/**
* Execute a query on the DB, with the posibility to bypass all the sequelize goodness.
+22
View File
@@ -0,0 +1,22 @@
/// <reference path="svg-injector.d.ts" />
var SVGInjector: SVGInjector;
// Simple example
var mySVGsToInject = document.querySelectorAll('img.inject-me');
SVGInjector(mySVGsToInject);
// Single DOM element
SVGInjector(document.querySelector('.inject-me'));
// Configuration
SVGInjector(mySVGsToInject, {
evalScripts: 'always',
pngFallback: './path/to/images/',
each: eachCallback
});
function eachCallback(element: SVGElement) { }
// Callback
SVGInjector(mySVGsToInject, null, callback);
function callback(count: number) { }
+43
View File
@@ -0,0 +1,43 @@
// Type definitions for SVG Injector
// Project: https://github.com/iconic/SVGInjector
// Definitions by: Patrick Westerhoff <https://github.com/poke>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare interface SVGInjector {
/**
* Replace the given elements with their full inline SVG DOM elements.
*
* @param elements Array of or single DOM element.
* @param options Injector options.
* @param done Callback that receives the injected element count as parameter.
*/
(elements: Node | NodeList | Array<Node>, options?: SVGInjectorOptions, done?: (elementCount: number) => void): void;
}
declare interface SVGInjectorOptions {
/**
* Whether to run scripts blocks found in the SVG.
*
* Possible values:
* 'always' — Run scripts every time.
* 'once' — Only run scripts once for each SVG.
* 'never' — Ignore scripts (default)
*/
evalScripts?: string;
/**
* Location of fallback pngs, if desired.
*/
pngFallback?: string;
/**
* Callback to run during each SVG injection. The SVG element is passed if
* the injection was successful.
*/
each?: (svg: SVGElement | string) => void;
}
declare module "svg-injector" {
var SVGInjector: SVGInjector;
export = SVGInjector;
}
+31
View File
@@ -0,0 +1,31 @@
// Copied from https://github.com/jakwings/node-temp-fs/blob/60a4d2586a81a7057bd4a395ec8c00b4100f84fe/README.md
// and slightly modified.
/// <reference path="temp-fs.d.ts" />
// Create a tempfile in the system-provided tempdir.
tempfs.open(function (err:any, file:tempfs.file) {
if (err) { throw err; }
console.log(file.path, file.fd);
// async
file.unlink(function () {
console.log('File delected');
});
// sync
// No problem even if unlink() is called twice.
file.unlink();
});
// Create a tempdir in current directory.
tempfs.mkdir({
dir: '.',
recursive: true, // It and its content will be remove recursively.
track: true // Track this directory.
}, function (err:any, dir:tempfs.dir) {
if (err) { throw err; }
console.log(dir.path, dir.recursive);
throw new Error('Since it is tracked, tempfs will remove it for you.');
dir.unlink();
});
+211
View File
@@ -0,0 +1,211 @@
// Type definitions for temp-fs v0.9.8
// Project: https://github.com/jakwings/node-temp-fs
// Definitions by: MEDIA CHECK s.r.o. <http://www.mediacheck.cz/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* A temporary file and directory creator.
*/
declare module tempfs {
/**
* A tempdir.
*/
interface dir {
/**
* The absolute path to the tempdir.
*/
path: String;
/**
* Whether {@link dir#unlink} will remove the tempdir recursively.
*/
recursive: Boolean;
/**
* A special function for you to remove the directory.
*
* If the directory is not tracked, it may throw when an error occurs or
* the first argument of the callback function will be an Error object.
*
* @param callback makes it asynchronous.
*/
unlink(callback?:(error:Error)=>any): any;
}
/**
* A tempfile.
*/
interface file {
/**
* The absolute path to the tempfile.
*/
path: String;
/**
* An integer file descriptor.
*/
fd: Number;
/**
* A special function for you to delete the file.
*
* If the file is not tracked, it may throw when an error occurs or the
* first argument of the callback function will be an Error object.
*
* @param callback makes it asynchronous.
*/
unlink(callback?:(error:Error)=>any): any;
}
/**
* Options.
*/
interface options {
/**
* Where to put the generated tempfile or tempdir.
*
* Also see {@link options#name}. Default: <code>tempfs.dir()</code>
*/
dir?: String;
/**
* The maximum number of chance to retry before throwing an error.
*
* It should be a finite number. Default: 5
*/
limit?: Number;
/**
* File mode (default: 0600) or directory mode (default: 0700) to use.
*/
mode?: Number;
/**
* If set, join the two paths <code>{@link options#dir} ||
* tempfs.dir()</code> and {@link options#name} together and use the
* result as the customized filename/pathname.
*/
name?: String;
/**
* The prefix for the generated random name.
*
* Default: "tmp-"
*/
prefix?: String;
/**
* Whether {@link dir#unlink} should remove a directory recursively.
*
* Default: false
*/
recursive?: Boolean;
/**
* The suffix for the generated random name.
*
* Default: ""
*/
suffix?: String;
/**
* A string containing some capital letters Xs for substitution with
* random characters.
*
* Then it is used as part of the filename/dirname. Just like what you
* do with the <code>mktemp(3)</code> function in the C library.
*/
template?: String;
/**
* If set to true, let temp-fs manage the the current file/directory for
* you even if the global tracking is off. If set to false, don't let
* temp-fs manage it even if the global tracking is on. Otherwise, use
* the current global setting.
*/
track?: Boolean;
}
/**
* Remove all tracked files and directories asynchronously.
*/
function clear(callback?:()=>any):any;
/**
* Remove all tracked files and directories synchronously.
*/
function clearSync():any;
/**
* Return the path of a system-provided tempdir as
* <code>require('os').tmpdir()</code> does.
*
* You should not make any assumption about whether the path contains a
* trailing path separator, or it is a real path. On most system it is not a
* fixed path, and it can be changed by the user environment. When in doubt,
* check it first.
*/
function dir():string;
/**
* Try to create a new tempdir asynchronously.
*
* @param callback function receives two arguments <code>error</code> and
* <code>dir</code>. If <code>error</code> is
* <code>null</code>, <code>dir</code> has the properties of
* {@link dir}.
*/
function mkdir(options?:options, callback?:(err:any, dir:dir)=>any):any;
/**
* The synchronous version of {@link mkdir}.
*
* @throws when an error happens.
*/
function mkdirSync(options?:options):dir;
/**
* Return a customized/random filename/dirname.
*/
function name(options?:options):string;
/**
* Try to open a unique tempfile asynchronously.
*
* @param callback function receives two arguments <code>error</code> and
* <code>file</code>. If <code>error</code> is
* <code>null</code>, <code>file</code> has the properties
* of {@link file}.
*/
function open(options?:options, callback?:(err:any, file:file)=>any):any;
/**
* The synchronous version of {@link open}.
*
* @throws when an error happens.
*/
function openSync(options?:options):file;
/**
* Use it to switch global files/directories tracking on or off.
*
* Turn it on if you don't want to manually delete everything. When it is
* turned off, all recorded files and directories will not be removed but
* still kept in case it is turned on again before the program exits.
*
* This switch does not affect manually tracked files through
* {@link options#track}. They will be removed automatically on exit.
*
* <b>Note: When an uncaught exception occurs, all tracked temporary files
* and directories will be removed no matter it is on or off.</b>
*/
function track(on?:Boolean):void;
}
/**
* A temporary file and directory creator.
*/
declare module "temp-fs" {
export = tempfs;
}
@@ -54,7 +54,7 @@
// Cubes
var geometry2 = new THREE.BoxGeometry(50, 50, 50);
var material2 = new THREE.MeshLambertMaterial({ color: 0xffffff, shading: THREE.FlatShading, overdraw: 0.5 });
var material2 = new THREE.MeshLambertMaterial({ color: 0xffffff, overdraw: 0.5 });
for (var i = 0; i < 100; i++) {
@@ -54,7 +54,7 @@
loader = new THREE.JSONLoader();
loader.load('obj/WaltHeadLo.js', function (geometry) {
mesh = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: 0xffffff, shading: THREE.FlatShading, overdraw: 0.5 }));
mesh = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: 0xffffff, overdraw: 0.5 }));
scene.add(mesh);
});
+2 -2
View File
@@ -52,8 +52,8 @@
new THREE.MeshBasicMaterial({ color: 0x00ffff, wireframe: true, side: THREE.DoubleSide }),
new THREE.MeshBasicMaterial({ color: 0xff0000, blending: THREE.AdditiveBlending }),
new THREE.MeshLambertMaterial({ color: 0xffffff, shading: THREE.FlatShading, overdraw: 0.5 }),
new THREE.MeshLambertMaterial({ color: 0xffffff, shading: THREE.SmoothShading, overdraw: 0.5 }),
new THREE.MeshLambertMaterial({ color: 0xffffff, overdraw: 0.5 }),
new THREE.MeshLambertMaterial({ color: 0xffffff, overdraw: 0.5 }),
new THREE.MeshDepthMaterial({ overdraw: 0.5 }),
new THREE.MeshNormalMaterial({ overdraw: 0.5 }),
new THREE.MeshBasicMaterial({ map: THREE.ImageUtils.loadTexture('textures/land_ocean_ice_cloud_2048.jpg') }),
+23 -33
View File
@@ -8,29 +8,20 @@
var renderer, scene, camera, stats;
var sphere, uniforms, attributes;
var sphere, uniforms;
var noise = [];
var WIDTH = window.innerWidth,
HEIGHT = window.innerHeight;
var displacement, noise;
init();
animate();
function init() {
camera = new THREE.PerspectiveCamera(30, WIDTH / HEIGHT, 1, 10000);
camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 10000);
camera.position.z = 300;
scene = new THREE.Scene();
attributes = {
displacement: { type: 'f', value: [] }
};
uniforms = {
amplitude: { type: "f", value: 1.0 },
@@ -44,7 +35,6 @@
var shaderMaterial = new THREE.ShaderMaterial({
uniforms: uniforms,
attributes: attributes,
vertexShader: document.getElementById('vertexshader').textContent,
fragmentShader: document.getElementById('fragmentshader').textContent
@@ -52,27 +42,27 @@
var radius = 50, segments = 128, rings = 64;
var geometry = new THREE.SphereGeometry(radius, segments, rings);
geometry.dynamic = true;
sphere = new THREE.Mesh(geometry, shaderMaterial);
var geometry = new THREE.SphereBufferGeometry( radius, segments, rings );
var vertices = sphere.geometry.vertices;
var values = attributes.displacement.value;
displacement = new Float32Array( geometry.attributes["position"].count );
noise = new Float32Array( geometry.attributes["position"].count );
for (var v = 0; v < vertices.length; v++) {
for ( var i = 0; i < displacement.length; i ++ ) {
values[v] = 0;
noise[v] = Math.random() * 5;
noise[ i ] = Math.random() * 5;
}
geometry.addAttribute( 'displacement', new THREE.BufferAttribute( displacement, 1 ) );
sphere = new THREE.Mesh(geometry, shaderMaterial);
scene.add(sphere);
renderer = new THREE.WebGLRenderer();
renderer.setClearColor(0x050505);
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(WIDTH, HEIGHT);
renderer.setSize(window.innerWidth, window.innerHeight);
var container = document.getElementById('container');
container.appendChild(renderer.domElement);
@@ -114,19 +104,19 @@
uniforms.amplitude.value = 2.5 * Math.sin(sphere.rotation.y * 0.125);
uniforms.color.value.offsetHSL(0.0005, 0, 0);
for (var i = 0; i < attributes.displacement.value.length; i++) {
attributes.displacement.value[i] = Math.sin(0.1 * i + time);
noise[i] += 0.5 * (0.5 - Math.random());
noise[i] = THREE.Math.clamp(noise[i], -5, 5);
attributes.displacement.value[i] += noise[i];
for ( var i = 0; i < displacement.length; i ++ ) {
displacement[ i ] = Math.sin( 0.1 * i + time );
noise[ i ] += 0.5 * ( 0.5 - Math.random() );
noise[ i ] = THREE.Math.clamp( noise[ i ], -5, 5 );
displacement[ i ] += noise[ i ];
}
attributes.displacement.needsUpdate = true;
sphere.geometry.attributes.displacement.needsUpdate = true;
renderer.render(scene, camera);
+3 -3
View File
@@ -54,20 +54,20 @@
texture.needsUpdate = true;
materials.push(new THREE.MeshLambertMaterial({ map: texture, transparent: true }));
materials.push(new THREE.MeshLambertMaterial({ color: 0xdddddd, shading: THREE.FlatShading }));
materials.push(new THREE.MeshLambertMaterial({ color: 0xdddddd }));
materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.FlatShading }));
materials.push(new THREE.MeshNormalMaterial());
materials.push(new THREE.MeshBasicMaterial({ color: 0xffaa00, transparent: true, blending: THREE.AdditiveBlending }));
//materials.push( new THREE.MeshBasicMaterial( { color: 0xff0000, blending: THREE.SubtractiveBlending } ) );
materials.push(new THREE.MeshLambertMaterial({ color: 0xdddddd, shading: THREE.SmoothShading }));
materials.push(new THREE.MeshLambertMaterial({ color: 0xdddddd }));
materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.SmoothShading, map: texture, transparent: true }));
materials.push(new THREE.MeshNormalMaterial({ shading: THREE.SmoothShading }));
materials.push(new THREE.MeshBasicMaterial({ color: 0xffaa00, wireframe: true }));
materials.push(new THREE.MeshDepthMaterial());
materials.push(new THREE.MeshLambertMaterial({ color: 0x666666, emissive: 0xff0000, shading: THREE.SmoothShading }));
materials.push(new THREE.MeshLambertMaterial({ color: 0x666666, emissive: 0xff0000 }));
materials.push(new THREE.MeshPhongMaterial({ color: 0x000000, specular: 0x666666, emissive: 0xff0000, shininess: 10, shading: THREE.SmoothShading, opacity: 0.9, transparent: true }));
materials.push(new THREE.MeshBasicMaterial({ map: texture, transparent: true }));
+41
View File
@@ -0,0 +1,41 @@
// Type definitions for three.js
// Project: http://mrdoob.github.com/three.js/
// Definitions by: Poul Kjeldager Sørensen <https://github.com/s093294>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//Source : https://github.com/NTaylorMullen/CycleR/blob/master/CycleR/CycleR.Game.Client/Client/Interfaces/ThreeJS/Cameras/FirstPersonControls.d.ts
/// <reference path="./three.d.ts" />
declare module THREE {
class FirstPersonControls {
constructor(object: Camera, domElement?: HTMLElement);
object: THREE.Object3D;
target: THREE.Vector3;
domElement: HTMLCanvasElement;
movementSpeed: number;
lookSpeed: number;
noFly: boolean;
lookVertical: boolean;
autoForward: boolean;
activeLook: boolean;
heightSpeed: boolean;
heightCoef: boolean;
heightMin: boolean;
constrainVertical: boolean;
verticalMin: number;
verticalMax: number;
autoSpeedFactor: number;
mouseX: number;
mouseY: number;
lat: number;
lon: number;
phi: number;
theta: number;
moveForward: boolean;
moveBackward: boolean;
moveLeft: boolean;
moveRight: boolean;
freeze: boolean;
mouseDragOn: boolean;
update(delta?: number): void;
}
}
+247 -386
View File
File diff suppressed because it is too large Load Diff
+16 -11
View File
@@ -113,21 +113,26 @@ interface ToastrOptions {
* Set newest toast to appear on top
**/
newestOnTop?: boolean;
/**
* Rather than having identical toasts stack, set the preventDuplicates property to true. Duplicates are matched to the previous toast based on their message content.
*/
preventDuplicates?: boolean;
/**
* Visually indicates how long before a toast expires.
*/
progressBar?: boolean;
/**
* The element to put the toastr container
**/
target?: string;
/**
* Rather than having identical toasts stack, set the preventDuplicates property to true. Duplicates are matched to the previous toast based on their message content.
*/
preventDuplicates?: boolean;
/**
* Visually indicates how long before a toast expires.
*/
progressBar?: boolean;
/**
* Function to execute on toast click
*/
onclick?: () => void;
/**
* Set if toastr should parse containing html
**/
allowHtml?: boolean;
}
interface ToastrDisplayMethod {