Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Troy Weber
2017-03-20 16:14:27 -07:00
47 changed files with 5530 additions and 1374 deletions
+13 -7
View File
@@ -15,6 +15,7 @@ export type IDropdownConfig = angular.ui.bootstrap.IDropdownConfig;
export type IModalProvider = angular.ui.bootstrap.IModalProvider;
export type IModalService = angular.ui.bootstrap.IModalService;
export type IModalServiceInstance = angular.ui.bootstrap.IModalServiceInstance;
export type IModalInstanceService = angular.ui.bootstrap.IModalInstanceService;
export type IModalScope = angular.ui.bootstrap.IModalScope;
export type IModalSettings = angular.ui.bootstrap.IModalSettings;
export type IModalStackService = angular.ui.bootstrap.IModalStackService;
@@ -320,12 +321,12 @@ declare module 'angular' {
interface IModalService {
/**
* @param {IModalSettings} options
* @returns {IModalServiceInstance}
* @returns {IModalInstanceService}
*/
open(options: IModalSettings): IModalServiceInstance;
open(options: IModalSettings): IModalInstanceService;
}
interface IModalServiceInstance {
interface IModalInstanceService {
/**
* A method that can be used to close a modal, passing a result. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
*/
@@ -357,6 +358,11 @@ declare module 'angular' {
closed: angular.IPromise<any>;
}
/**
* @deprecated use IModalInstanceService instead.
*/
interface IModalServiceInstance extends IModalInstanceService { }
interface IModalScope extends angular.IScope {
/**
* Dismiss the dialog without assigning a value to the promise output. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
@@ -512,17 +518,17 @@ declare module 'angular' {
/**
* Opens a new modal instance.
*/
open(modalInstance: IModalServiceInstance, modal: any): void;
open(modalInstance: IModalInstanceService, modal: any): void;
/**
* Closes a modal instance with an optional result.
*/
close(modalInstance: IModalServiceInstance, result?: any): void;
close(modalInstance: IModalInstanceService, result?: any): void;
/**
* Dismisses a modal instance with an optional reason.
*/
dismiss(modalInstance: IModalServiceInstance, reason?: any): void;
dismiss(modalInstance: IModalInstanceService, reason?: any): void;
/**
* Dismiss all open modal instances with an optional reason that will be passed to each instance.
@@ -536,7 +542,7 @@ declare module 'angular' {
}
interface IModalStackedMapKeyValuePair {
key: IModalServiceInstance;
key: IModalInstanceService;
value: any;
}
+7
View File
@@ -0,0 +1,7 @@
import * as axel from 'axel';
axel.clear();
axel.bg(0,255,0);
axel.line(1,1,10,10);
axel.cursor.restore();
+37
View File
@@ -0,0 +1,37 @@
// Type definitions for Axel module
// Project: https://github.com/F1LT3R/axel
// Definitions by: Ruslan Molodyko <https://github.com/ruslan-molodyko>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Axel {
brush: string;
rows: number;
cols: number;
cursor: cursorInterface;
lerp(p1: number, p2: number, m: number): number;
circ(x: number, y: number, m: number): number;
goto(x: number, y: number): void;
scrub(x1: number, y1: number, w: number, h: number): void;
box(x1: number, y1: number, w: number, h: number): void;
point(x: number, y: number, char: string): void;
dist(x1: number, y1: number, x2: number, y2: number): number;
line(x1: number, y1: number, x2: number, y2: number): void;
text(x: number, y: number, text: string): void;
fg(r: number, g: number, b: number): void;
bg(r: number, g: number, b: number): void;
draw(cb: Function): void;
clear(): void;
}
declare interface cursorInterface {
on(): void;
off(): void;
reset(): void;
restore(): void;
}
declare module 'axel' {
const instance: Axel;
export = instance;
}
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -16,7 +16,7 @@
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"xmpp-jid-tests.ts"
"axel-tests.ts",
"index.d.ts"
]
}
+23 -1
View File
@@ -38,7 +38,29 @@ bootbox.prompt({
console.log(result);
}
});
bootbox.prompt({
title: "This is a prompt with a set of checkbox inputs!",
inputType: 'checkbox',
inputOptions: [
{
text: 'Choice One',
value: '1',
group: 'Group 1'
},
{
text: 'Choice Two',
value: '2',
group: 'Group 1'
},
{
text: 'Choice Three',
value: '3'
}
],
callback: function (result) {
console.log(result);
}
});
bootbox.dialog({
title: "Wassup?",
+2 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for Bootbox 4.4.0
// Project: https://github.com/makeusabrew/bootbox
// Definitions by: Vincent Bortone <https://github.com/vbortone/>, Kon Pik <https://github.com/konpikwastaken/>, Anup Kattel <https://github.com/kanup/>, Dominik Schroeter <https://github.com/icereed/>, Troy McKinnon <https://github.com/trodi/>
// Definitions by: Vincent Bortone <https://github.com/vbortone/>, Kon Pik <https://github.com/konpikwastaken/>, Anup Kattel <https://github.com/kanup/>, Dominik Schroeter <https://github.com/icereed/>, Troy McKinnon <https://github.com/trodi/>, Stanny Nuytkens <https://github.com/stannynuytkens>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="jquery" />
@@ -44,6 +44,7 @@ interface BootboxPromptOptions extends BootboxBaseOptions {
inputType?: "text" | "textarea" | "email" | "select" | "checkbox" | "date" | "time" | "number" | "password";
callback: (result: string) => any;
buttons?: BootboxConfirmPromptButtonMap;
inputOptions?: { text: string, value: string, group?: string }[];
}
/** Bootbox options available when setting defaults for modals */
+3 -1
View File
@@ -368,7 +368,9 @@ function line_examples() {
data: {},
line: {
connectNull: true,
step_type: "step-after"
step: {
type: "step-after"
}
}
});
}
+3 -1
View File
@@ -145,7 +145,9 @@ declare namespace c3 {
/**
* Change step type for step chart. 'step', 'step-before' and 'step-after' can be used.
*/
step_type?: string;
step?: {
type: string;
};
};
area?: {
+8
View File
@@ -0,0 +1,8 @@
import * as htmlescape from "htmlescape";
import { sanitize } from "htmlescape";
// === '{"x":"a\\u0026\\u003c\\u003e\\u2028\\u2029"}'
htmlescape({ x: "a&<>\u2028\u2029" });
// === 'a&<>\\u2028\\u2029'
sanitize("a&<>\u2028\u2029");
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for htmlescape 1.1
// Project: https://github.com/zertosh/htmlescape
// Definitions by: bouzuya <http://bouzuya.net>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function htmlescape(o: any): string;
declare namespace htmlescape {
export function sanitize(s: string): string;
}
export = htmlescape;
export as namespace htmlescape;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"htmlescape-tests.ts"
]
}
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for koa-cache-control 2.0
// Project: https://github.com/DaMouse404/koa-cache-control
// Definitions by: Peter Safranek <https://github.com/pe8ter>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Koa from "koa";
declare function cacheControl(options?: {
private?: boolean;
public?: boolean;
noStore?: boolean;
noCache?: boolean;
noTransform?: boolean;
mustRevalidate?: boolean;
staleIfError?: number;
staleWhileRevalidate?: number;
maxAge?: number;
sMaxAge?: number;
}): Koa.Middleware;
declare namespace cacheControl {}
export = cacheControl;
@@ -0,0 +1,19 @@
import * as Koa from "koa";
import * as cacheControl from "koa-cache-control";
const app = new Koa();
app.use(cacheControl());
app.use(cacheControl({}));
app.use(cacheControl({
private: true,
public: true,
noStore: true,
noCache: true,
noTransform: true,
mustRevalidate: true,
staleIfError: 0,
staleWhileRevalidate: 0,
maxAge: 0,
sMaxAge: 0,
}));
@@ -11,15 +11,12 @@
"typeRoots": [
"../"
],
"paths": {
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"node-form-tests.ts"
"koa-cache-control-tests.ts"
]
}
}
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "../tslint.json",
"noImplicitAny": "true",
"noImplicitThis": "true",
"strictNullChecks": "true"
}
+31 -26
View File
@@ -2,7 +2,7 @@
## Description
These are the definitions for version 1.4 of Meteor. These definitions were generated from the from the same [Meteor data.js file] (https://github.com/meteor/meteor/blob/devel/docs/client/data.js) that is used to generate the official [Meteor docs] (http://docs.meteor.com/). The code that generates these definitions can be found [here](https://github.com/meteor-typescript/meteor-typescript-libs/).
These are the definitions for version 1.4 of Meteor. These definitions were generated from the same [Meteor data.js file](https://github.com/meteor/meteor/blob/devel/docs/client/data.js) that is used to generate the official [Meteor docs](http://docs.meteor.com/). The code that generates these definitions can be found [here](https://github.com/meteor-typescript/meteor-typescript-libs/).
## Upcoming Meteor `typescript` package
@@ -33,19 +33,21 @@ Compilation will be much faster and code will be cleaner - it's always better to
With the exception of the **body** and **head** templates, Meteor's Template dot notation cannot be used (ie. *Template.mytemplate*). Thanks to Typescript static typing checks, you will need to use the *bracket notation* to access the Template.
Template['myTemplateName'].helpers({
foo: function () {
return Session.get("foo");
}
});
Template['myTemplateName'].onRendered(function ( ) { ... });
```js
Template['myTemplateName'].helpers({
foo: function () {
return Session.get("foo");
}
});
Template['myTemplateName'].onRendered(function ( ) { ... });
```
The same is true for `Meteor.settings`:
Meteor.settings.public['<some config>']
```ts
Meteor.settings.public['<some config>']
```
### Form fields
@@ -55,11 +57,11 @@ Form fields typically need to be cast to `<HTMLInputElement>`. For instance to r
### Global variables
Preface any global variable declarations with a TypeScript `declare var` statement (or place the statement in a definition file):
declare var NavbarHelpers;
NavbarHelpers = {};
NavbarHelpers.someMethod = function() {...}
```ts
declare var NavbarHelpers;
NavbarHelpers = {};
NavbarHelpers.someMethod = function() {...}
```
### Collections
@@ -67,18 +69,21 @@ The majority of extra work required to use TypeScript with Meteor is creating an
To define collections, you will need to create an interface representing the collection and then declare a Collection type variable with that interface type (as a generic):
interface JobDAO {
_id?: string;
name: string;
status?: string;
queuedAt?: string;
}
declare var Jobs: Mongo.Collection<JobDAO>;
Jobs = new Mongo.Collection<JobDAO>('jobs');
```js
interface JobDAO {
_id?: string;
name: string;
status?: string;
queuedAt?: string;
}
declare var Jobs: Mongo.Collection<JobDAO>;
Jobs = new Mongo.Collection<JobDAO>('jobs');
```
Finally, any TypeScript file using collections will need to contain a reference at the top pointing to the collection definitions:
/// <reference path=".typescript/package_defs/meteor.d.ts"/>
/// <reference path=".typescript/custom_defs/collections.ts"/>
```ts
/// <reference path=".typescript/package_defs/meteor.d.ts"/>
/// <reference path=".typescript/custom_defs/collections.ts"/>
```
-709
View File
@@ -1,709 +0,0 @@
// Type definitions for node-form v1.0.13
// Project: https://github.com/rsamec/form
// Definitions by: Roman Samec <https://github.com/rsamec>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Q from "q";
export as namespace Validation;
export = Validation;
declare namespace Validation {
/**
* Custom message functions.
*/
interface IErrorCustomMessage {
(config: any, args: any): string;
}
/**
* It represents a property validator for atomic object.
*/
interface IPropertyValidator {
isAcceptable(s: any): boolean;
customMessage?: IErrorCustomMessage;
tagName?: string;
}
/**
* It represents a property validator for simple string value.
*/
interface IStringValidator extends IPropertyValidator {
isAcceptable(s: string): boolean;
}
/**
* It represents an async property validator for atomic object.
*/
interface IAsyncPropertyValidator {
isAcceptable(s: any): Q.Promise<boolean>;
customMessage?: IErrorCustomMessage;
isAsync: boolean;
tagName?: string;
}
/**
* It represents an async property validator for simple string value.
*/
interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator {
isAcceptable(s: string): Q.Promise<boolean>;
}
/**
* It defines compare operators.
*/
enum CompareOperator {
LessThan = 0,
LessThanEqual = 1,
Equal = 2,
NotEqual = 3,
GreaterThanEqual = 4,
GreaterThan = 5,
}
class StringFce {
static format(s: string, args: any): string;
}
class NumberFce {
static GetNegDigits(value: string): number;
}
class LettersOnlyValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class ZipCodeValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class EmailValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class UrlValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class RequiredValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class DateValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class DateISOValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class NumberValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class DigitValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class SignedDigitValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class MinLengthValidator implements IStringValidator {
public MinLength: number;
constructor(MinLength?: number);
public isAcceptable(s: string): boolean;
public tagName: string;
}
class MaxLengthValidator implements IStringValidator {
public MaxLength: number;
constructor(MaxLength?: number);
public isAcceptable(s: string): boolean;
public tagName: string;
}
class RangeLengthValidator implements IStringValidator {
public RangeLength: number[];
constructor(RangeLength?: number[]);
public isAcceptable(s: string): boolean;
public MinLength : number;
public MaxLength : number;
public tagName: string;
}
class MinValidator implements IPropertyValidator {
public Min: number;
constructor(Min?: number);
public isAcceptable(s: any): boolean;
public tagName: string;
}
class MaxValidator implements IPropertyValidator {
public Max: number;
constructor(Max?: number);
public isAcceptable(s: any): boolean;
public tagName: string;
}
class RangeValidator implements IPropertyValidator {
public Range: number[];
constructor(Range?: number[]);
public isAcceptable(s: any): boolean;
public Min : number;
public Max : number;
public tagName: string;
}
class StepValidator implements IPropertyValidator {
public Step: string;
constructor(Step?: string);
public isAcceptable(s: any): boolean;
public tagName: string;
}
class PatternValidator implements IStringValidator {
public Pattern: string;
constructor(Pattern?: string);
public isAcceptable(s: string): boolean;
public tagName: string;
}
class ContainsValidator implements IAsyncPropertyValidator {
public Options: Q.Promise<any[]>;
constructor(Options: Q.Promise<any[]>);
public isAcceptable(s: string): Q.Promise<boolean>;
public isAsync: boolean;
public tagName: string;
}
}
declare namespace Validation {
/**
* basic error structure
*/
interface IError {
HasError: boolean;
ErrorMessage: string;
TranslateArgs?: IErrorTranslateArgs;
}
/**
* support for localization of error messages
*/
interface IErrorTranslateArgs {
TranslateId: string;
MessageArgs: any;
CustomMessage?: IErrorCustomMessage;
}
/**
* It defines conditional function.
*/
interface IOptional {
(): boolean;
}
/**
* It represents the validation result.
*/
interface IValidationFailure extends IError {
IsAsync: boolean;
Error: IError;
}
/**
* This class provides unit of information about error.
* Implements composite design pattern to enable nesting of error information.
*/
interface IValidationResult {
/**
* The name of error collection.
*/
Name: string;
/**
* Add error information to child collection of errors.
* @param validationResult - error information to be added.
*/
Add(validationResult: IValidationResult): void;
/**
* Remove error information from child collection of errors.
* @param index - index of error information to be removed.
*/
Remove(index: number): void;
/**
* Return collections of child errors information.
*/
Children: IValidationResult[];
/**
* Return true if there is any error.
*/
HasErrors: boolean;
/**
* Return true if there is any error and hasw dirty state.
*/
HasErrorsDirty: boolean;
/**
* Return error message, if there is no error, return empty string.
*/
ErrorMessage: string;
/**
* Return number of errors.
*/
ErrorCount: number;
/**
* It enables to have errors optional.
*/
Optional?: IOptional;
/**
* It enables support for localization of error messages.
*/
TranslateArgs?: IErrorTranslateArgs[];
}
/**
*
* @ngdoc object
* @name Error
* @module Validation
*
*
* @description
* It represents basic error structure.
*/
class Error implements IError {
public HasError: boolean;
public ErrorMessage: string;
constructor();
}
/**
*
* @ngdoc object
* @name ValidationFailure
* @module Validation
*
*
* @description
* It represents validation failure.
*/
class ValidationFailure implements IError {
public Error: IError;
public IsAsync: boolean;
constructor(Error: IError, IsAsync: boolean);
public HasError : boolean;
public ErrorMessage : string;
public TranslateArgs : IErrorTranslateArgs;
}
/**
*
* @ngdoc object
* @name ValidationResult
* @module Validation
*
*
* @description
* It represents simple abstract error object.
*/
class ValidationResult implements IValidationResult {
public Name: string;
constructor(Name: string);
public IsDirty: boolean;
public Children : IValidationResult[];
public Add(error: IValidationResult): void;
public Remove(index: number): void;
public Optional: IOptional;
public TranslateArgs: IErrorTranslateArgs[];
public HasErrorsDirty : boolean;
public HasErrors : boolean;
public ErrorCount : number;
public ErrorMessage : string;
}
/**
*
* @ngdoc object
* @name CompositeValidationResult
* @module Validation
*
*
* @description
* It represents composite error object.
*/
class CompositeValidationResult implements IValidationResult {
public Name: string;
public Children: IValidationResult[];
constructor(Name: string);
public Optional: IOptional;
public AddFirst(error: IValidationResult): void;
public Add(error: IValidationResult): void;
public Remove(index: number): void;
public HasErrorsDirty : boolean;
public HasErrors : boolean;
public ErrorCount : number;
public ErrorMessage : string;
public TranslateArgs : IErrorTranslateArgs[];
public LogErrors(headerMessage?: string): void;
public Errors : {
[name: string]: IValidationResult;
};
private FlattenErros;
public SetDirty(): void;
public SetPristine(): void;
private SetDirtyEx(node, dirty);
private flattenErrors(node, errorCollection);
private traverse(node, indent);
}
}
declare namespace Validation {
/**
* @ngdoc module
* @name Validation
*
*
* @description
* # Validation (core module)
* The module itself contains the essential components for an validation engine to function. The table below
* lists a high level breakdown of each of the components (object, functions) available within this core module.
*
* <div doc-module-components="Validation"></div>
*/
/**
* It defines validation function.
*/
interface IValidate {
(args: IError): void;
}
/**
* It defines async validation function.
*/
interface IAsyncValidate {
(args: IError): Q.Promise<any>;
}
/**
* It represents named validation function.
*/
interface IValidatorFce {
Name: string;
ValidationFce?: IValidate;
AsyncValidationFce?: IAsyncValidate;
}
/**
* This class represents custom validator.
*/
interface IValidator {
Validate(context: any): IValidationFailure;
ValidateAsync(context: any): Q.Promise<IValidationFailure>;
Error: IError;
}
/**
* It represents abstract validator for type of <T>.
*/
interface IAbstractValidator<T> {
RuleFor(prop: string, validator: IPropertyValidator): any;
ValidationFor(prop: string, validator: IValidatorFce): any;
ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>): any;
/**
* It creates new concrete validation rule and assigned data context to this rule.
* @param name of the rule
* @constructor
*/
CreateRule(name: string): IAbstractValidationRule<any>;
CreateAbstractRule(name: string): IAbstractValidationRule<any>;
CreateAbstractListRule(name: string): IAbstractValidationRule<any>;
/**
* return true if this validation rule is intended for list of items, otherwise true
*/
ForList: boolean;
}
/**
* It represents concrete validation rule for type of <T>.
*/
interface IAbstractValidationRule<T> {
/**
* Performs validation using a validation context and returns a collection of Validation Failures.
*/
Validate(context: T): IValidationResult;
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
ValidateAsync(context: T): Q.Promise<IValidationResult>;
/**
* Performs validation and async validation using a validation context.
*/
ValidateAll(context: T): void;
/**
* Performs validation and async validation using a validation context for a passed field.
*/
ValidateField(context: T, propName: string): void;
/**
* Return validation results.
*/
ValidationResult: IValidationResult;
Rules: {
[name: string]: IPropertyValidationRule<T>;
};
Validators: {
[name: string]: IValidator;
};
Children: {
[name: string]: AbstractValidationRule<any>;
};
}
/**
* It represents property validation rule for type of <T>.
*/
interface IPropertyValidationRule<T> {
/**
*The validators that are grouped under this rule.
*/
Validators: {
[name: string]: any;
};
/**
* Performs validation using a validation context and returns a collection of Validation Failures.
*/
Validate(context: IValidationContext<T>): IValidationFailure[];
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
ValidateAsync(context: IValidationContext<T>): Q.Promise<IValidationFailure[]>;
}
/**
* It represents a data context for validation rule.
*/
interface IValidationContext<T> {
/**
* Return current value.
*/
Value: string;
/**
* Return property name for current data context.
*/
Key: string;
/**
* Data context for validation rule.
*/
Data: T;
}
/**
*
* @ngdoc object
* @name AbstractValidator
* @module Validation
*
*
* @description
* It enables to create custom validator for your own abstract object (class) and to assign validation rules to its properties.
* You can assigned these rules
*
* + property validation rules - use _RuleFor_ property
* + property async validation rules - use _RuleFor_ property
* + shared validation rules - use _ValidationFor_ property
* + custom object validator - use _ValidatorFor_ property - enables composition of child custom validators
*/
class AbstractValidator<T> implements IAbstractValidator<T> {
public Validators: {
[name: string]: IPropertyValidator[];
};
public AbstractValidators: {
[name: string]: IAbstractValidator<any>;
};
public ValidationFunctions: {
[name: string]: IValidatorFce[];
};
public RuleFor(prop: string, validator: IPropertyValidator): void;
public ValidationFor(prop: string, fce: IValidatorFce): void;
public ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>, forList?: boolean): void;
public CreateAbstractRule(name: string): AbstractValidationRule<T>;
public CreateAbstractListRule(name: string): AbstractListValidationRule<T>;
public CreateRule(name: string): AbstractValidationRule<T>;
/**
* Return true if this validation rule is intended for list of items, otherwise true.
*/
public ForList: boolean;
}
/**
*
* @ngdoc object
* @name AbstractValidationRule
* @module Validation
*
*
* @description
* It represents concreate validator for custom object. It enables to assign validation rules to custom object properties.
*/
class AbstractValidationRule<T> implements IAbstractValidationRule<T> {
public Name: string;
public validator: AbstractValidator<T>;
public ValidationResult: IValidationResult;
public Rules: {
[name: string]: IPropertyValidationRule<T>;
};
public Validators: {
[name: string]: IValidator;
};
public Children: {
[name: string]: AbstractValidationRule<any>;
};
/**
* Return true if this validation rule is intended for list of items, otherwise true.
*/
public ForList: boolean;
constructor(Name: string, validator: AbstractValidator<T>, forList?: boolean);
public addChildren(): void;
public SetOptional(fce: IOptional): void;
private createRuleFor(prop);
/**
* Performs validation using a validation context and returns a collection of Validation Failures.
*/
public Validate(context: T): IValidationResult;
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
public ValidateAsync(context: T): Q.Promise<IValidationResult>;
public ValidateAll(context: T): void;
public ValidateField(context: T, propName: string): void;
}
/**
*
* @ngdoc object
* @name AbstractListValidationRule
* @module Validation
*
*
* @description
* It represents an validator for custom object. It enables to assign rules to custom object properties.
*/
class AbstractListValidationRule<T> extends AbstractValidationRule<T> {
public Name: string;
public validator: AbstractValidator<T>;
constructor(Name: string, validator: AbstractValidator<T>);
/**
* Performs validation using a validation context and returns a collection of Validation Failures.
*/
public Validate(context: any): IValidationResult;
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
public ValidateAsync(context: any): Q.Promise<IValidationResult>;
private getValidationRule(i);
private getIndexedKey(i);
public NotifyListChanged(list: any[]): void;
}
/**
*
* @ngdoc object
* @name ValidationContext
* @module Validation
*
*
* @description
* It represents a data context for validation rule.
*/
class ValidationContext<T> implements IValidationContext<T> {
public Key: string;
public Data: T;
constructor(Key: string, Data: T);
public Value : any;
}
class MessageLocalization {
static customMsg: string;
static defaultMessages: {
"required": string;
"remote": string;
"email": string;
"url": string;
"date": string;
"dateISO": string;
"number": string;
"digits": string;
"signedDigits": string;
"creditcard": string;
"equalTo": string;
"maxlength": string;
"minlength": string;
"rangelength": string;
"range": string;
"max": string;
"min": string;
"step": string;
"contains": string;
"mask": string;
"custom": string;
};
static ValidationMessages: {
"required": string;
"remote": string;
"email": string;
"url": string;
"date": string;
"dateISO": string;
"number": string;
"digits": string;
"signedDigits": string;
"creditcard": string;
"equalTo": string;
"maxlength": string;
"minlength": string;
"rangelength": string;
"range": string;
"max": string;
"min": string;
"step": string;
"contains": string;
"mask": string;
"custom": string;
};
static GetValidationMessage(validator: any): string;
}
/**
*
* @ngdoc object
* @name PropertyValidationRule
* @module Validation
*
*
* @description
* It represents a property validation rule. The property has assigned collection of property validators.
*/
class PropertyValidationRule<T> extends ValidationResult implements IPropertyValidationRule<T> {
public Name: string;
public Validators: {
[name: string]: any;
};
public ValidationFailures: {
[name: string]: IValidationFailure;
};
constructor(Name: string, validatorsToAdd?: IPropertyValidator[]);
public AddValidator(validator: any): void;
public Errors : {
[name: string]: IValidationFailure;
};
public HasErrors : boolean;
public ErrorCount : number;
public ErrorMessage : string;
public TranslateArgs : IErrorTranslateArgs[];
/**
* Performs validation using a validation context and returns a collection of Validation Failures.
*/
public Validate(context: IValidationContext<T>): IValidationFailure[];
public ValidateEx(value: any): IValidationFailure[];
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
public ValidateAsync(context: IValidationContext<T>): Q.Promise<IValidationFailure[]>;
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
public ValidateAsyncEx(value: string): Q.Promise<IValidationFailure[]>;
}
/**
*
* @ngdoc object
* @name Validator
* @module Validation
*
*
* @description
* It represents a custom validator. It enables to define your own shared validation rules
*/
class Validator extends ValidationResult implements IValidator {
public Name: string;
private ValidateFce;
private AsyncValidationFce;
public Error: IError;
public ValidationFailures: {
[name: string]: IValidationFailure;
};
constructor(Name: string, ValidateFce?: IValidate, AsyncValidationFce?: IAsyncValidate);
public Optional: IOptional;
public Validate(context: any): IValidationFailure;
public ValidateAsync(context: any): Q.Promise<IValidationFailure>;
public HasError : boolean;
public Errors : {
[name: string]: IValidationFailure;
};
public HasErrors : boolean;
public ErrorCount : number;
public ErrorMessage : string;
public TranslateArgs : IErrorTranslateArgs[];
}
}
-25
View File
@@ -1,25 +0,0 @@
interface IPerson{
Checked:boolean;
FirstName:string;
LastName:string;
Email:string;
}
//create custom composite validator
var personValidator = new Validation.AbstractValidator<IPerson>();
//create field validators
var required = new Validation.RequiredValidator();
var email = new Validation.EmailValidator();
var maxLength = new Validation.MaxLengthValidator();
maxLength.MaxLength = 15;
personValidator.RuleFor("FirstName", required);
personValidator.RuleFor("FirstName", maxLength);
personValidator.RuleFor("LastName", required);
personValidator.RuleFor("LastName", maxLength);
personValidator.RuleFor("Email", required);
personValidator.RuleFor("Email", email);
+6
View File
@@ -341,6 +341,12 @@
"typingsPackageName": "vue-router",
"sourceRepoURL": "https://github.com/vuejs/vue-router",
"asOfVersion": "2.0.0"
},
{
"libraryName": "@xmpp/jid",
"typingsPackageName": "xmpp-jid",
"sourceRepoURL": "github.com/node-xmpp/node-xmpp/",
"asOfVersion": "1.2.0"
}
]
}
-26
View File
@@ -1,26 +0,0 @@
// Type definitions for Qajax
// Project: https://github.com/gre/qajax
// Definitions by: Boltmade <https://github.com/Boltmade>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Q from "q";
export = Qajax;
export as namespace Qajax;
declare function Qajax(url : string) : Q.Promise<XMLHttpRequest>;
declare function Qajax(options : any) : Q.Promise<XMLHttpRequest>;
declare function Qajax(url : string, options : any) : Q.Promise<XMLHttpRequest>;
declare namespace Qajax {
export var defaults : any;
export function filterStatus(validStatus : number) : (xhr : XMLHttpRequest) => Q.Promise<XMLHttpRequest>;
export function filterStatus(validStatus : (status : number) => boolean) : (xhr : XMLHttpRequest) => Q.Promise<XMLHttpRequest>;
export function filterSuccess() : Q.Promise<XMLHttpRequest>;
export function toJSON(xhr : XMLHttpRequest) : Q.Promise<any>;
export function getJSON(url : string) : Q.Promise<any>;
export function serialize(paramsObj : any) : string;
}
-69
View File
@@ -1,69 +0,0 @@
import Qajax = require("qajax");
import * as Q from 'q';
// Based on https://github.com/gre/qajax/blob/master/test/qajax.js
function resetDefaults () {
Qajax.defaults.logs = true;
Qajax.defaults.timeout = 1000;
Qajax.defaults.method = "GET";
Qajax.defaults.headers = {};
Qajax.defaults.base = "";
}
var sample01url = "/test/dataset/sample01.json";
var sample01json = [
{ "name": "Jerome", "age": 20 },
{ "name": "Gerard", "age": 30 },
{ "name": "Martine", "age": 43 }
];
var emptyUrl = "/test/dataset/empty";
function urlWithOptions (url : string, options : any) {
return url+"?"+Qajax.serialize(options);
}
Qajax;
Qajax.filterStatus;
Qajax.filterSuccess;
Qajax.getJSON;
Qajax.serialize({ foo: 123, bar: "toto" });
Qajax.getJSON(sample01url).then((res) => true, (err) => true);
Qajax(sample01url).then(Qajax.filterSuccess).then(Qajax.toJSON);
Qajax(emptyUrl, { params: { status: 404 } }).then(Qajax.filterSuccess).then(Qajax.toJSON);
Qajax({method: "POST", url: "/ECHO", data: "1234567890\nazerty\nuiopqsdfghjklm\nwxcvbn\n"}).then(Qajax.filterSuccess);
Qajax({method: "POST", url: "/ECHO", data: { foo: 123, bar: { value: 42 }, arr: [1, 2, 3] }}).then(Qajax.filterSuccess).then(Qajax.toJSON);
Qajax({ url: emptyUrl, params: { status: 201 } }).then(Qajax.filterStatus(200));
Qajax({method: "POST", url: emptyUrl, params: { status: 500 }}).then(Qajax.filterSuccess).then(Qajax.toJSON);
var cancellationD = Q.defer();
var cancellation = cancellationD.promise;
Qajax({ cancellation: cancellation, url: urlWithOptions(emptyUrl, { latency: 400 }) }).then(Qajax.filterSuccess).then(Qajax.toJSON);
Qajax.defaults.timeout = 200;
Qajax({method: "DELETE", url: sample01url, params: { latency: 500 }});
resetDefaults();
Qajax({method: "POST", url: sample01url, params: { latency: 300 }, timeout: 2000});
Qajax.defaults.timeout = 200;
Qajax({method: "DELETE", url: sample01url, params: { latency: 500 }, timeout: 0});
resetDefaults();
Qajax({headers: { "X-Hello": "world" }, method: "GET", url: "/ECHO_HEADERS"}).then(Qajax.filterSuccess).then(Qajax.toJSON);
Qajax({headers: { "X-Hi": "world" }, method: "GET", url: "/ECHO_HEADERS"}).then(Qajax.filterSuccess).then(Qajax.toJSON);
Qajax.defaults.headers = {"X-Foo": "bar"};
Qajax({method: "GET", url: "/ECHO_HEADERS"}).then(Qajax.filterSuccess).then(Qajax.toJSON);
resetDefaults();
Qajax("sample01.json", {base: "/test/dataset/"}).then(Qajax.filterSuccess).then(Qajax.toJSON);
Qajax.defaults.base = "/test/dataset/";
Qajax("empty").then(Qajax.filterSuccess);
resetDefaults();
Qajax.defaults.method = "POST";
Qajax("/ECHO", { data: "1234567890\nazerty\nuiopqsdfghjklm\nwxcvbn\n", responseType: "text/plain" }).then(Qajax.filterSuccess);
resetDefaults();
Qajax.getJSON(urlWithOptions(sample01url, { latency: 50 })).then((res) => true, (err) => true, () => true);
+198
View File
@@ -0,0 +1,198 @@
// Type definitions for react-svg-pan-zoom 2.5
// Project: https://github.com/chrvadala/react-svg-pan-zoom#readme
// Definitions by: Huy Nguyen <https://github.com/huy-nguyen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as React from 'react';
declare module 'react-svg-pan-zoom' {
// String constants:
const MODE_IDLE = 'idle';
const MODE_PANNING = 'panning';
const MODE_ZOOMING = 'zooming';
export const TOOL_AUTO = 'auto';
export const TOOL_NONE = 'none';
export const TOOL_PAN = 'pan';
export const TOOL_ZOOM_IN = 'zoom-in';
export const TOOL_ZOOM_OUT = 'zoom-out';
export const POSITION_NONE = 'none';
export const POSITION_TOP = 'top';
export const POSITION_RIGHT = 'right';
export const POSITION_BOTTOM = 'bottom';
export const POSITION_LEFT = 'left';
export type Mode = typeof MODE_IDLE | typeof MODE_PANNING | typeof MODE_ZOOMING;
export interface Value {
version: 2,
mode: Mode,
focus: boolean,
a: number,
b: number,
c: number,
d: number,
e: number,
f: number,
viewerWidth: number,
viewerHeight: number,
SVGWidth: number,
SVGHeight: number,
startX?: number | null,
startY?: number | null,
endX?: number | null,
endY?: number | null,
}
export type Tool = typeof TOOL_AUTO | typeof TOOL_NONE | typeof TOOL_PAN |
typeof TOOL_ZOOM_IN | typeof TOOL_ZOOM_OUT
export type ToolbarPosition = typeof POSITION_NONE | typeof POSITION_TOP | typeof POSITION_RIGHT |
typeof POSITION_BOTTOM | typeof POSITION_LEFT
export interface OptionalProps {
//background of the viewer
background: React.CSSProperties,
//background of the svg
SVGBackground: string,
//value of the viewer (current point of view)
value: Value | null,
//CSS style of the Viewer
style: object,
//className of the Viewer
className: string,
//detect zoom operation performed trough pinch gesture or mouse scroll
detectWheel: boolean,
//perform PAN if the mouse is on viewer border
detectAutoPan: boolean,
//toolbar position
toolbarPosition: ToolbarPosition,
//handler something changed
onChangeValue: (value: Value) => void,
//handler tool changed
onChangeTool: (tool: Tool) => void,
// Note: The `T` type parameter is the type of the `target` of the event:
//handler click
onClick: <T>(event: ViewerMouseEvent<T>) => void,
//handler double click
onDoubleClick: <T>(event: ViewerMouseEvent<T>) => void,
//handler mouseup
onMouseUp: <T>(event: ViewerMouseEvent<T>) => void,
//handler mousemove
onMouseMove: <T>(event: ViewerMouseEvent<T>) => void,
//handler mousedown
onMouseDown: <T>(event: ViewerMouseEvent<T>) => void,
//if disabled the user can move the image outside the viewer
preventPanOutside: boolean,
//how much scale in or out
scaleFactor: number,
//current active tool (TOOL_NONE, TOOL_PAN, TOOL_ZOOM_IN, TOOL_ZOOM_OUT)
tool: Tool,
//modifier keys //https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState
modifierKeys: string[],
//override default toolbar component
// TODO: specify function type more clearly
customToolbar: React.Component<any, any> | React.StatelessComponent<any>,
// How about touch events? They are in README but not in `propTypes`.
}
export interface RequiredProps {
//width of the viewer displayed on screen
width: number,
//height of the viewer displayed on screen
height: number,
//accept only one node SVG
// TODO: Figure out how to constrain `children` or maybe just leave it commented out
// because `children` is already implicit props
// children: () => any
}
export type Props = RequiredProps & Partial<OptionalProps>
class ReactSVGPanZoom extends React.Component<Props, {}> {
pan(SVGDeltaX: number, SVGDeltaY: number): void
zoom(SVGPointX: number, SVGPointY: number, scaleFactor: number): void
fitSelection(selectionSVGPointX: number, selectionSVGPointY: number, selectionWidth: number, selectionHeight: number): void
fitToViewer(): void
setPointOnViewerCenter(SVGPointX: number, SVGPointY: number, zoomLevel: number): void
reset(): void
zoomOnViewerCenter(scaleFactor: number): void
getValue(): Value
setValue(value: Value): void
getTool(): Tool
setTool(tool: Tool): void
}
export interface Point {
x: number,
y: number,
}
export interface ViewerMouseEvent<T>{
originalEvent: React.MouseEvent<T>,
SVGViewer: SVGSVGElement,
point: Point,
x: number,
y: number,
scaleFactor: number,
translationX: number,
translationY: number,
preventDefault(): void
stopPropagation(): void
}
export interface ViewerTouchEvent<T> {
originalEvent: React.TouchEvent<T>,
SVGViewer: SVGSVGElement,
points: Point[],
changedPoints: Point[],
scaleFactor: number,
translationX: number,
translationY: number,
preventDefault(): void
stopPropagation(): void
}
// Utility functions exposed:
export function pan(value: Value, SVGDeltaX: number, SVGDeltaY: number, panLimit?: number): Value
export function zoom(value: Value, SVGPointX: number, SVGPointY: number, scaleFactor: number): Value
export function fitSelection(
value: Value, selectionSVGPointX: number, selectionSVGPointY: number, selectionWidth: number, selectionHeight: number): Value
export function fitToViewer(value: Value): Value
export function zoomOnViewerCenter(value: Value, scaleFactor: number): Value
export function setPointOnViewerCenter(value: Value, SVGPointX: number, SVGPointY: number, zoomLevel: number): Value
export function reset(value: Value): Value
}
@@ -0,0 +1,57 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {
ReactSVGPanZoom,
Props,
fitToViewer,
ViewerMouseEvent
} from 'react-svg-pan-zoom';
class Example1 extends React.Component<{}, {}> {
Viewer: ReactSVGPanZoom
constructor(props: Props) {
super(props);
}
componentDidMount() {
this.Viewer.fitToViewer();
}
render() {
return (
<div>
<button onClick={event => this.Viewer.zoomOnViewerCenter(1.1)}>Zoom in</button>
<button onClick={event => this.Viewer.fitSelection(40, 40, 200, 200)}>Zoom area 200x200</button>
<button onClick={event => this.Viewer.fitToViewer()}>Fit</button>
<hr/>
<ReactSVGPanZoom
style={{border: "1px solid black"}}
width={500} height={500} ref={Viewer => this.Viewer = Viewer}
onClick={(event: ViewerMouseEvent<any>) => console.log('click', event.x, event.y, event.originalEvent)}
onMouseUp={(event: ViewerMouseEvent<any>) => console.log('up', event.x, event.y)}
onMouseMove={(event: ViewerMouseEvent<any>) => console.log('move', event.x, event.y)}
onMouseDown={(event: ViewerMouseEvent<any>) => console.log('down', event.x, event.y)}>
<svg width={617} height={316}>
<g fillOpacity=".5" strokeWidth="4">
<rect x="400" y="40" width="100" height="200" fill="#4286f4" stroke="#f4f142"/>
<circle cx="108" cy="108.5" r="100" fill="#0ff" stroke="#0ff"/>
<circle cx="180" cy="209.5" r="100" fill="#ff0" stroke="#ff0"/>
<circle cx="220" cy="109.5" r="100" fill="#f0f" stroke="#f0f"/>
</g>
</svg>
</ReactSVGPanZoom>
</div>
);
}
}
ReactDOM.render(
<Example1 />,
document.getElementById('app')
);
@@ -1,26 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"jsx": "react",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"paths": {
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"qajax-tests.ts"
"react-svg-pan-zoom-tests.tsx"
]
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+93
View File
@@ -0,0 +1,93 @@
// Type definitions for redux-action 1.2
// Project: https://github.com/coderhaoxin/redux-action
// Definitions by: newraina <https://github.com/newraina>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* inspired by @types/redux-actions, thanks.
*/
import * as Redux from 'redux';
export as namespace ReduxAction;
interface BaseAction {
type: string;
}
interface Action<Payload> extends BaseAction {
payload: Payload;
}
interface MetaAction<Payload, Meta> extends Action<Payload> {
meta: Meta;
}
type ThunkAction<Payload> = (dispatch: Redux.Dispatch<any>, getState: () => any) => Promise<Action<Payload>>;
type ThunkMetaAction<Payload, Meta> = (dispatch: Redux.Dispatch<any>, getState: () => any) => Promise<MetaAction<Payload, Meta>>;
/** argument inferring borrowed from redux-actions definitions */
type ActionFunction0<R> = () => R;
type ActionFunction1<T1, R> = (t1: T1) => R;
type ActionFunction2<T1, T2, R> = (t1: T1, t2: T2) => R;
type ActionFunction3<T1, T2, T3, R> = (t1: T1, t2: T2, t3: T3) => R;
type ActionFunctionAny<R> = (...args: any[]) => R;
type ReducerHandler<State> = <A extends BaseAction, S extends State>(payload: any, state?: State, action?: A) => S;
interface ReducerHandlers<State> {
[type: string]: ReducerHandler<State>;
}
export function createAction<Payload>(
type: string,
payloadCreator: ActionFunctionAny<Promise<Payload> | Payload>,
): ActionFunctionAny<ThunkAction<Payload>>;
export function createAction<Payload>(
payloadCreator: ActionFunctionAny<Promise<Payload> | Payload>,
): ActionFunctionAny<ThunkAction<Payload>>;
export function createAction<Payload, Arg>(
payloadCreator: ActionFunction1<Arg, Promise<Payload> | Payload>,
): ActionFunction1<Arg, ThunkAction<Payload>>;
export function createAction<Payload, Arg1, Arg2>(
payloadCreator: ActionFunction2<Arg1, Arg2, Promise<Payload> | Payload>,
): ActionFunction2<Arg1, Arg2, ThunkAction<Payload>>;
export function createAction<Payload, Arg1, Arg2, Arg3>(
payloadCreator: ActionFunction3<Arg1, Arg2, Arg3, Promise<Payload> | Payload>,
): ActionFunction3<Arg1, Arg2, Arg3, ThunkAction<Payload>>;
export function createAction<Payload, Meta>(
type: string,
payloadCreator: ActionFunctionAny<Promise<Payload> | Payload>,
metaCreator: ActionFunctionAny<Meta>
): ActionFunctionAny<ThunkMetaAction<Payload, Meta>>;
export function createAction<Payload, Meta>(
payloadCreator: ActionFunctionAny<Promise<Payload> | Payload>,
metaCreator: ActionFunctionAny<Meta>
): ActionFunctionAny<ThunkMetaAction<Payload, Meta>>;
export function createAction<Payload>(
type?: string,
): ActionFunction1<any, ThunkAction<Payload>>;
export function createAction<Payload, Arg>(
type?: string,
): ActionFunction1<Arg, ThunkAction<Payload>>;
export function createSyncAction<Payload>(
type: string,
payloadCreator?: ActionFunctionAny<Payload>,
): ActionFunctionAny<Action<Payload>>;
export function createSyncAction<Payload, Meta>(
type: string,
payloadCreator: ActionFunctionAny<Payload>,
metaCreator: ActionFunctionAny<Meta>
): ActionFunctionAny<MetaAction<Payload, Meta>>;
export function createReducer<State>(defaultState: State, handlers: ReducerHandlers<State>): Redux.Reducer<State>;
+6
View File
@@ -0,0 +1,6 @@
{
"dependencies": {
"redux": "^3.6.0",
"redux-thunk": "^2.2.0"
}
}
+84
View File
@@ -0,0 +1,84 @@
import * as ReduxAction from 'redux-action';
import * as ReduxThunk from 'redux-thunk';
import * as Redux from 'redux';
interface Payload {
name: string;
id: number;
}
const dispatch: Redux.Dispatch<any> = (...args: any[]): any => { };
const actionCreator0 = ReduxAction.createAction<Payload>('get items');
dispatch(actionCreator0(1))
.then(action => {
const type: string = action.type;
const payload: Payload = action.payload;
});
const actionCreator1 = ReduxAction.createAction<Payload>();
dispatch(actionCreator1(1))
.then(action => {
const type: string = action.type;
const payload: Payload = action.payload;
});
const actionCreator2 = ReduxAction.createAction('get items', (name: string) => name);
dispatch(actionCreator2(1))
.then(action => {
const type: string = action.type;
const payload: string = action.payload;
});
const actionCreator3 = ReduxAction.createAction('get items', (name: string) => Promise.resolve(name));
dispatch(actionCreator3(1))
.then(action => {
const type: string = action.type;
const payload: string = action.payload;
});
const actionCreator4 = ReduxAction.createAction((name: string) => name);
dispatch(actionCreator4(1))
.then(action => {
const type: string = action.type;
const payload: string = action.payload;
});
const actionCreator5 = ReduxAction.createAction<number, string>((name: string) => 1);
dispatch(actionCreator5('items'))
.then(action => {
const type: string = action.type;
const payload: number = action.payload;
});
const actionCreator6 = ReduxAction.createAction<number, string, boolean>((name: string) => 1);
dispatch(actionCreator6('items', false))
.then(action => {
const type: string = action.type;
const payload: number = action.payload;
});
const syncActionCreator0 = ReduxAction.createSyncAction<Payload>('get items');
const syncAction0: ReduxAction.Action<Payload> = dispatch(syncActionCreator0(1));
const syncActionCreator1 = ReduxAction.createSyncAction<string>('get items', (name: string) => name);
const syncAction1: ReduxAction.Action<string> = dispatch(syncActionCreator1(1));
interface State {
name: string;
}
const reducer = ReduxAction.createReducer<State>({ name: 'name' }, {
'get items': () => {
return 'new name';
}
});
const combinedReducer: Redux.Reducer<State> = Redux.combineReducers<State>({ reducer });
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"redux-action-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+1
View File
@@ -102,6 +102,7 @@ declare namespace Sinon {
throws(type?: string): SinonStub;
throws(obj: any): SinonStub;
callsArg(index: number): SinonStub;
callThrough(): SinonStub;
callsArgOn(index: number, context: any): SinonStub;
callsArgWith(index: number, ...args: any[]): SinonStub;
callsArgOnWith(index: number, context: any, ...args: any[]): SinonStub;
+819 -112
View File
File diff suppressed because it is too large Load Diff
+1007 -144
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -19,4 +19,4 @@
"index.d.ts",
"sparkpost-tests.ts"
]
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../tslint.json",
"rules": {
"only-arrow-functions-2": [
false
]
}
}
+1119
View File
File diff suppressed because it is too large Load Diff
+944
View File
@@ -0,0 +1,944 @@
import * as SparkPost from "sparkpost";
let key = "YOURAPIKEY";
let client = new SparkPost(key);
client.get({
uri: "metrics/domains"
}, function(err, data) {
if (err) {
console.log(err);
return;
}
console.log(data.body);
});
client.inboundDomains.create("example1.com", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.inboundDomains.delete("example1.com", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.inboundDomains.find("example1.com", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.inboundDomains.all(function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.messageEvents.search({}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.messageEvents.search({
events: "click",
campaign_ids: "monday_mailshot"
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.messageEvents.search({
from: "2016-01-01T00:00",
to: "2016-01-02T23:59",
page: 1,
per_page: 5,
events: ["bounce", "out_of_band"],
bounce_classes: [10]
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.recipientLists.create({
id: "UNIQUE_TEST_ID",
name: "Test Recipient List",
recipients: [
{
address: {
email: "test1@test.com"
}
}, {
address: {
email: "test2@test.com"
}
}, {
address: {
email: "test3@test.com"
}
}
]
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.recipientLists.delete("UNIQUE_TEST_ID", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.recipientLists.all(function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.recipientLists.find({
id: "UNIQUE_TEST_ID"
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.recipientLists.find({
id: "UNIQUE_TEST_ID",
show_recipients: true
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.recipientLists.update({
id: "EXISTING_TEST_ID",
name: "Test Recipient List",
recipients: [
{
address: {
email: "test1@test.com"
}
}, {
address: {
email: "test2@test.com"
}
}, {
address: {
email: "test3@test.com"
}
}
]
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.relayWebhooks.create({
name: "Test Relay Webhook",
target: "http://client.test.com/test-webhook",
match: {
domain: "inbound.example.com"
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.relayWebhooks.delete("123456789", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.relayWebhooks.find("123456789", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.relayWebhooks.all(function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.relayWebhooks.update({
relayWebhookId: "123456789",
target: "http://client.test.com/test-webhook"
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.sendingDomains.create({
domain: "example1.com",
dkim: {
"private": "MIICXgIBAAKBgQC+W6scd3XWwvC//Y1g==",
"public": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==",
selector: "brisbane",
headers: "from:to:subject:date"
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.sendingDomains.delete("example1.com", function(err, data) {
if (err) {
console.log(err);
} else {
console.log(data);
console.log("Congrats you can use our client library!");
}
});
client.sendingDomains.all(function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.sendingDomains.find("example1.com", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.sendingDomains.update({
domain: "example1.com",
dkim: {
"private": "MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx//Y1g==",
"public": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==",
selector: "hello_selector",
headers: "from:to:subject:date"
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.sendingDomains.verify({
domain: "example1.com"
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.sendingDomains.verify({
domain: "example1.com",
verifySPF: false
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.sendingDomains.verify({
domain: "example1.com",
verifyDKIM: false
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.subaccounts.create({
name: "Test Subaccount",
keyLabel: "Test Subaccount key",
keyGrants: [
"smtp/inject",
"transmissions/modify"
]
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res);
console.log("Congrats you can use our client library!");
}
});
client.subaccounts.all(function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.subaccounts.find(123, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.subaccounts.update({
subaccountId: 123,
name: "Test Subaccount",
status: "suspended"
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.suppressionList.checkStatus("test@test.com", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.suppressionList.removeStatus("test@test.com", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.suppressionList.search({
from: "2015-05-07T00:00:00+0000",
to: "2015-05-07T23:59:59+0000",
limit: 5
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.suppressionList.upsert([
{
recipient: "test1@test.com",
transactional: false,
non_transactional: true,
description: "Test description 1"
},
{
recipient: "test2@test.com",
transactional: true,
non_transactional: true,
description: "Test description 2"
},
{
recipient: "test3@test.com",
transactional: true,
non_transactional: false,
description: "Test description 3"
}
], function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our client library!");
}
});
client.templates.create({
template: {
id: "TEST_ID",
name: "Test Template",
content: {
from: "test@test.com",
subject: "Test email template!",
html: "<b>This is a test email template!</b>"
}
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.templates.delete("TEST_ID", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.templates.all(function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.templates.find({
id: "TEST_ID",
draft: true
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.templates.find({
id: "TEST_ID"
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.templates.preview({
id: "TEST_ID",
data: {}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.templates.update({
id: "TEST_ID",
template: {
content: {
from: "test@test.com",
subject: "Updated Published Test email template!",
html: "<b>This is a published test email template! Updated!</b>"
}
},
update_published: true
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.templates.update({
id: "TEST_ID",
template: {
content: {
from: "test@test.com",
subject: "Updated Test email template!",
html: "<b>This is a test email template! Updated!</b>"
}
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.transmissions.all(function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.transmissions.find("YOUR-TRANSMISSION-KEY", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.transmissions.all({
campaign_id: "my_campaign"
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.transmissions.all({
template_id: "my_template"
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.transmissions.send({
transmissionBody: {
recipients: [{ address: { email: "john.doe@example.com" } }],
content: {
from: "From Envelope <from@example.com>",
subject: "Example Email for MIME Parts",
html: "<html><body><p>Hello World!</p></body></html>",
text: "Hello World!"
},
options: {
open_tracking: true,
click_tracking: true
}
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.transmissions.send({
transmissionBody: {
recipients: [{address: {email: "john.doe@example.com"}}],
content: {
email_rfc822: "Content-Type: text/plain\nFrom: From Envelope <from@example.com>\nSubject: Example Email\n\nHello World"
}
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.transmissions.send({
transmissionBody: {
options: {
open_tracking: true,
click_tracking: true
},
campaign_id: "christmas_campaign",
return_path: "bounces-christmas-campaign@flintstone.com",
metadata: {
user_type: "students"
},
substitution_data: {
sender: "Big Store Team"
},
recipients: [
{
return_path: "123@bounces.flintstone.com",
address: {
email: "wilma@flintstone.com",
name: "Wilma Flintstone"
},
tags: [
"greeting",
"prehistoric",
"fred",
"flintstone"
],
metadata: {
place: "Bedrock"
},
substitution_data: {
customer_type: "Platinum"
}
}
],
content: {
from: {
name: "Fred Flintstone",
email: "fred@flintstone.com"
},
subject: "Big Christmas savings!",
reply_to: "Christmas Sales <sales@flintstone.com>",
headers: {
"X-Customer-Campaign-ID": "christmas_campaign"
},
text: "Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n Hurry, this offer is only to {{customer_type}}\n {{sender}}",
html: "<p>Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n</p>"
}
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.transmissions.send({
transmissionBody: {
recipients: [
{
address: {
email: "original.recipient@example.com",
name: "Original Recipient"
},
substitution_data: {
recipient_type: "Original"
}
},
{
address: {
email: "bcc.recipient@example.com",
header_to: "\"Original Recipient\" <original.recipient@example.com>"
},
substitution_data: {
recipient_type: "BCC"
}
}
],
content: {
from: {
name: "Node BCC Test",
email: "from@example.com"
},
subject: "Example email using bcc",
text: "An example email using bcc with SparkPost to the {{recipient_type}} recipient.",
html: "<p>An example email using bcc with SparkPost to the {{recipient_type}} recipient.</p>"
}
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats! You sent an email with bcc using SparkPost!");
}
});
client.transmissions.send({
transmissionBody: {
recipients: [
{
address: {
email: "original.recipient@example.com",
name: "Original Recipient"
},
substitution_data: {
recipient_type: "Original"
}
},
{
address: {
email: "cc.recipient@example.com",
name: "Carbon Copy Recipient",
header_to: "\"Original Recipient\" <original.recipient@example.com>"
},
substitution_data: {
recipient_type: "CC"
}
}
],
content: {
from: {
name: "Node CC Test",
email: "from@example.com"
},
headers: {
"CC": "\"Carbon Copy Recipient\" <cc.recipient@example.com>"
},
subject: "Example email using cc",
text: "An example email using cc with SparkPost to the {{recipient_type}} recipient.",
html: "<p>An example email using cc with SparkPost to the {{recipient_type}} recipient.</p>"
}
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats! You sent an email with cc using SparkPost!");
}
});
client.transmissions.send({
transmissionBody: {
recipients: {
list_id: "example-list"
},
content: {
from: "From Envelope <from@example.com>",
subject: "Example Email for Stored List and Inline Content",
html: "<html><body><p>Hello World</p></body></html>",
text: "Hello World!"
}
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.transmissions.send({
transmissionBody: {
recipients: {
list_id: "example-list"
},
content: {
from: "From Envelope <from@example.com>",
subject: "Example Email for Stored List and Template",
template_id: "my-template"
}
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.transmissions.send({
num_rcpt_errors: 3,
transmissionBody: {
campaign_id: "ricks-campaign",
content: {
template_id: "ricks-template"
},
recipients: [{ address: { email: "rick.sanchez@rickandmorty100years.com", name: "Rick Sanchez" } }]
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("What up my glib globs! SparkPost!");
}
});
client.webhooks.create({
name: "Test webhook",
target: "http://client.test.com/test-webhook",
auth_token: "AUTH_TOKEN",
events: [
"delivery",
"injection",
"open",
"click"
]
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.webhooks.delete("TEST_WEBHOOK_UUID", function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.webhooks.describe({
id: "TEST_WEBHOOK_UUID",
timezone: "America/New_York"
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.webhooks.getBatchStatus({
id: "TEST_WEBHOOK_UUID",
limit: 1000
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.webhooks.getDocumentation(function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.webhooks.getSamples({
events: "bounce"
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.webhooks.all(function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.webhooks.update({
id: "TEST_WEBHOOK_UUID",
name: "Renamed Test webhook",
events: [
"policy_rejection",
"delay"
]
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
client.webhooks.validate({
id: "TEST_WEBHOOK_UUID",
message: {
msys: {}
}
}, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log("Congrats you can use our SDK!");
}
});
+26
View File
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"sparkpost": ["sparkpost/v1"],
"sparkpost/*": ["sparkpost/v1/*"]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"sparkpost-tests.ts"
]
}
+1
View File
@@ -49,6 +49,7 @@ interface TotpOptions {
counter?: number;
epoch?: number;
secret?: string;
digits?: number;
digest?: () => string;
algorithm?: string;
}
+1 -1
View File
@@ -1 +1 @@
{ "extends": "./node_modules/types-publisher/tslint-definitions.json" }
{ "extends": "./node_modules/types-publisher/tslint-definitions.json" }
+6 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for Victory 0.9.0
// Project: https://github.com/FormidableLabs/victory
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>, snerks <https://github.com/snerks>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@@ -299,6 +299,11 @@ declare module "victory" {
before?: (datum: any) => AnimationStyle;
after?: (datum: any) => AnimationStyle;
};
/**
* The easing prop specifies an easing function name to use for tweening.
* @default "quadInOut"
*/
easing?: AnimationEasing;
}
/**
+5 -1
View File
@@ -601,4 +601,8 @@ test = (
}
}}
/>
);
);
test = (
<VictoryChart animate={{ duration: 2000, easing: 'bounce' }} />
);
-13
View File
@@ -1,13 +0,0 @@
// Type definitions for @xmpp/jid 0.0
// Project: github.com/node-xmpp/node-xmpp/
// Definitions by: PJakcson <https://github.com/PJakcson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import {JID} from './lib/JID';
export declare function createJID(local: string, domain: string, resource: string): JID;
export {JID} from './lib/JID';
export declare function equal(a: JID, b: JID): boolean;
export declare function is(a: any): boolean;
-46
View File
@@ -1,46 +0,0 @@
/**
* Created by marcneumann on 17.02.17.
*/
export declare class JID {
local: string;
domain: string;
resource: string;
constructor(local: string, domain?: string, resource?: string);
parseJID(jid: string): void;
toString(unescape?: any): string;
/**
* Convenience method to distinguish users
**/
bare(): JID;
/**
* Comparison function
**/
equals(other: JID): boolean;
/**
* http://xmpp.org/rfcs/rfc6122.html#addressing-localpart
**/
setLocal(local: string, escape?: any): void;
getLocal(unescape?: any): string;
/**
* http://xmpp.org/rfcs/rfc6122.html#addressing-domain
*/
setDomain(value: string): void;
getDomain(): string;
/**
* http://xmpp.org/rfcs/rfc6122.html#addressing-resourcepart
*/
setResource(value: string): void;
getResource(): string;
}
-40
View File
@@ -1,40 +0,0 @@
import {JID} from './index';
/*
* All return an instance of JID.JID, the new operator is optional.
*/
let addr = new JID('alice@wonderland.net/rabbithole'); // OK
addr = new JID('alice', 'wonderland.net', 'rabbithole'); // BEST; see section on escaping below
/*
* local
*/
addr.local = 'alice';
addr.local; // alice
// same as
addr.setLocal('alice');
addr.getLocal(); // alice
/*
* domain
*/
addr.domain = 'wonderland.net';
addr.domain; // wonderland.net
// same as
addr.setDomain('wonderland.net');
addr.getDomain(); // wonderland.net
/*
* resource
*/
addr.resource = 'rabbithole';
addr.resource; // rabbithole
// same as
addr.setResource('rabbithole');
addr.getResource(); // rabbithole
addr.toString(); // alice@wonderland.net/rabbithole
addr.bare(); // returns a JID without resource
const some_jid = new JID('is', 'a', 'test');
addr.equals(some_jid); // returns true if the two JIDs are equal, false otherwise
+903 -134
View File
File diff suppressed because it is too large Load Diff