From ae74c4d932879b517df15bba34773e5f72abe4e2 Mon Sep 17 00:00:00 2001 From: Mick Dekkers Date: Sun, 12 Nov 2017 01:18:06 +0100 Subject: [PATCH 001/890] [execa] update to v0.8, refactor definitions - Update execa to v0.8 - Add JSDoc documentation for everything - Fix being unable to pass boolean to `shell` option due to intersection type issues - Restructure definitions file based on chroma-js typings to expose function return types --- types/execa/index.d.ts | 298 ++++++++++++++++++++++++++++++++++------- 1 file changed, 249 insertions(+), 49 deletions(-) diff --git a/types/execa/index.d.ts b/types/execa/index.d.ts index 84c6939798..ff665a8e9f 100644 --- a/types/execa/index.d.ts +++ b/types/execa/index.d.ts @@ -1,63 +1,263 @@ -// Type definitions for execa 0.7 +// Type definitions for execa 0.8 // Project: https://github.com/sindresorhus/execa#readme // Definitions by: Douglas Duteil // BendingBender +// Mick Dekkers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// -import { ChildProcess, ExecOptions, SpawnOptions, SpawnSyncOptions } from "child_process"; +import { ChildProcess } from 'child_process'; import { Stream } from 'stream'; -type StdIOOption = 'pipe' | 'ipc' | 'ignore' | number | Stream | undefined | null; - -interface ExecaOptions { - input: string | Buffer | Stream; - preferLocal: boolean; - stripEof: boolean; - extendEnv: boolean; - argv0: string; - localDir: string; - reject: boolean; - cleanup: boolean; - stdin: StdIOOption; - stdout: StdIOOption; - stderr: StdIOOption; -} - -type Options = SpawnOptions & ExecaOptions & ExecOptions; -type SyncOptions = SpawnSyncOptions & ExecaOptions & ExecOptions; - -interface ExecaReturns { - cmd: string; - code: number; - failed: boolean; - killed: boolean; - signal: string | null; - stderr: string; - stdout: string; - timedOut: boolean; -} - -type ExecaError = Error & ExecaReturns; - -interface ExecaChildPromise { - catch(onrejected?: ((reason: ExecaError) => TResult | PromiseLike) | null): Promise; -} -type ExecaChildProcess = ChildProcess & ExecaChildPromise & Promise; - -declare function execa(file: string, options?: Partial): ExecaChildProcess; -declare function execa(file: string, args?: string[], options?: Partial): ExecaChildProcess; +/** + * A better `child_process` + */ declare namespace execa { - function stdout(file: string, options?: Partial): Promise; - function stdout(file: string, args?: string[], options?: Partial): Promise; - function stderr(file: string, options?: Partial): Promise; - function stderr(file: string, args?: string[], options?: Partial): Promise; - function shell(command: string, options?: Partial): ExecaChildProcess; - function sync(file: string, options?: Partial): ExecaReturns; - function sync(file: string, args?: string[], options?: Partial): ExecaReturns; - function shellSync(command: string, options?: Partial): ExecaReturns; + interface ExecaStatic { + /** + * Execute a file. + * + * Think of this as a mix of `child_process.execFile` and `child_process.spawn`. + * @returns a `child_process` instance which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties. + */ + (file: string, args?: string[], options?: Options): ExecaChildProcess; + (file: string, options?: Options): ExecaChildProcess; + + /** + * Execute a file. + * + * Think of this as a mix of `child_process.execFile` and `child_process.spawn`. + * @returns a `child_process` instance which is enhanced to also be a `Promise` for `stdout`. + */ + stdout(file: string, args?: string[], options?: Options): Promise; + stdout(file: string, options?: Options): Promise; + + /** + * Execute a file. + * + * Think of this as a mix of `child_process.execFile` and `child_process.spawn`. + * @returns a `child_process` instance which is enhanced to also be a `Promise` for `stderr`. + */ + stderr(file: string, args?: string[], options?: Options): Promise; + stderr(file: string, options?: Options): Promise; + + /** + * Execute a command through the system shell. + * + * Prefer `execa()` whenever possible, as it's both faster and safer. + * @returns a `child_process` instance which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties. + */ + shell(command: string, options?: Options): ExecaChildProcess; + + /** + * Execute a file synchronously. + * + * Think of this as a mix of `child_process.execFile` and `child_process.spawn`. + * @returns the same result object as `child_process.spawnSync`. + * @throws an `Error` if the command fails. + */ + sync(file: string, args?: string[], options?: SyncOptions): ExecaReturns; + sync(file: string, options?: SyncOptions): ExecaReturns; + + /** + * Execute a command synchronously through the system shell. + * + * @returns the same result object as `child_process.spawnSync`. + * @throws an `Error` if the command fails. + */ + shellSync(command: string, options?: Options): ExecaReturns; + } + + type StdIOOption = 'pipe' | 'ipc' | 'ignore' | Stream | number | null | undefined; + + interface CommonOptions { + /** + * Current working directory of the child process. + * @default `process.cwd()` + */ + cwd?: string; + /** + * Environment key-value pairs. + * Extends automatically from `process.env`. + * Set `extendEnv` to `false` if you don't want this. + * @default `process.env` + */ + env?: NodeJS.ProcessEnv; + /** + * Set to `false` if you don't want to extend the environment variables when providing the `env` property. + * @default `true` + */ + extendEnv?: boolean; + /** + * Explicitly set the value of `argv[0]` sent to the child process. + * This will be set to `command` or `file` if not specified. + */ + argv0?: string; + /** + * The `stdio` option is used to configure the pipes that are established between the parent and child process. + * By default, the child's stdin, stdout, and stderr are redirected to corresponding `subprocess.stdin`, `subprocess.stdout`, and `subprocess.stderr` streams on the `ChildProcess` object. + * @default `'pipe'` + * + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stdio?: 'pipe' | 'ignore' | 'inherit' | StdIOOption[]; + /** + * Prepare child to run independently of its parent process. + * Specific behavior depends on the platform. + * @see https://nodejs.org/api/child_process.html#child_process_options_detached + */ + detached?: boolean; + /** + * Sets the user identity of the process. + */ + uid?: number; + /** + * Sets the group identity of the process. + */ + gid?: number; + /** + * If `true`, runs `command` inside of a shell. + * Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. + * A different shell can be specified as a string. + * The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows. + * @default `false` + */ + shell?: boolean | string; + /** + * If `true`, no quoting or escaping of arguments is done on Windows. + * Ignored on other platforms. + * This is set to `true` automatically when `shell` is specified. + * @default `false` + */ + windowsVerbatimArguments?: boolean; + /** + * Strip EOF (last newline) from the output. + * @default `true` + * @see https://github.com/sindresorhus/strip-eof + */ + stripEof?: boolean; + /** + * Prefer locally installed binaries when looking for a binary to execute. + * If you `$ npm install foo`, you can then `execa('foo')`. + * @default `true` + */ + preferLocal?: boolean; + /** + * Preferred path to find locally installed binaries in (use with `preferLocal`). + * @default `process.cwd()` + */ + localDir?: string; + /** + * Setting this to `false` resolves the promise with the error instead of rejecting it. + * @default `true` + */ + reject?: boolean; + /** + * Keep track of the spawned process and `kill` it when the parent process exits. + * @default `true` + */ + cleanup?: boolean; + /** + * Specify the character encoding used to decode the `stdout` and `stderr` output. + * @default `utf8` + */ + encoding?: string; + /** + * If `timeout` is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than `timeout` milliseconds. + * @default `0` + */ + timeout?: number; + /** + * Largest amount of data in bytes allowed on `stdout` or `stderr`. + * @default `10000000` (10MB) + */ + maxBuffer?: number; + /** + * Signal value to be used when the spawned process will be killed. + * @default `SIGTERM` + */ + killSignal?: string | number; + /** + * Used to configure the stdin pipe that is established between the parent and child process. + * @default `'pipe'` + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stdin?: StdIOOption; + /** + * Used to configure the stdout pipe that is established between the parent and child process. + * @default `'pipe'` + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stdout?: StdIOOption; + /** + * Used to configure the stderr pipe that is established between the parent and child process. + * @default `'pipe'` + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stderr?: StdIOOption; + } + + interface Options extends CommonOptions { + /** + * Write some input to the `stdin` of your binary. + */ + input?: string | Buffer | Stream; + } + + interface SyncOptions extends CommonOptions { + /** + * Write some input to the `stdin` of your binary. + * Streams are not allowed when using the synchronous methods. + */ + input?: string | Buffer; + } + + interface ExecaReturns { + /** + * The command that was run. + */ + cmd: string; + /** + * The exit code of the process that was run. + */ + code: number; + /** + * Whether the process failed to run. + */ + failed: boolean; + /** + * Whether the process was killed. + */ + killed: boolean; + /** + * The signal that was used to terminate the process. + */ + signal: string | null; + /** + * The output of the process on stderr. + */ + stderr: string; + /** + * The output of the process on stdout. + */ + stdout: string; + /** + * Whether the process timed out. + */ + timedOut: boolean; + } + + type ExecaError = Error & ExecaReturns; + + interface ExecaChildPromise { + catch(onrejected?: ((reason: ExecaError) => TResult | PromiseLike) | null): Promise; + } + + type ExecaChildProcess = ChildProcess & ExecaChildPromise & Promise; } +declare var execa: execa.ExecaStatic; + export = execa; From 4b9b219c99dd3abf7bf88e398fa6a913c28a39b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Wed, 29 Nov 2017 01:19:31 +0100 Subject: [PATCH 002/890] [Lowdb] Typings for Lowdb 1.0.0 More complete than the old ones, reuses complete lodash typings instead of copy & pasting them. Typings require TypeScript 2.6. --- types/lowdb/adapters/Base.d.ts | 3 + types/lowdb/adapters/FileAsync.d.ts | 3 + types/lowdb/adapters/FileSync.d.ts | 3 + types/lowdb/adapters/LocalStorage.d.ts | 3 + types/lowdb/adapters/Memory.d.ts | 3 + types/lowdb/index.d.ts | 915 ++++++++++--------------- types/lowdb/lib/fp.d.ts | 3 + types/lowdb/lib/main.d.ts | 3 + types/lowdb/lowdb-tests.ts | 207 +++++- types/lowdb/tsconfig.json | 9 +- 10 files changed, 591 insertions(+), 561 deletions(-) create mode 100644 types/lowdb/adapters/Base.d.ts create mode 100644 types/lowdb/adapters/FileAsync.d.ts create mode 100644 types/lowdb/adapters/FileSync.d.ts create mode 100644 types/lowdb/adapters/LocalStorage.d.ts create mode 100644 types/lowdb/adapters/Memory.d.ts create mode 100644 types/lowdb/lib/fp.d.ts create mode 100644 types/lowdb/lib/main.d.ts diff --git a/types/lowdb/adapters/Base.d.ts b/types/lowdb/adapters/Base.d.ts new file mode 100644 index 0000000000..50839dc9f2 --- /dev/null +++ b/types/lowdb/adapters/Base.d.ts @@ -0,0 +1,3 @@ +import { BaseAdapter } from "../index"; +declare const Base: BaseAdapter; +export = Base; diff --git a/types/lowdb/adapters/FileAsync.d.ts b/types/lowdb/adapters/FileAsync.d.ts new file mode 100644 index 0000000000..9ecc292fe6 --- /dev/null +++ b/types/lowdb/adapters/FileAsync.d.ts @@ -0,0 +1,3 @@ +import { AdapterAsync } from "../index"; +declare const FileAsync: AdapterAsync; +export = FileAsync; diff --git a/types/lowdb/adapters/FileSync.d.ts b/types/lowdb/adapters/FileSync.d.ts new file mode 100644 index 0000000000..d1c8b4c5ae --- /dev/null +++ b/types/lowdb/adapters/FileSync.d.ts @@ -0,0 +1,3 @@ +import { AdapterSync } from "../index"; +declare const FileSync: AdapterSync; +export = FileSync; diff --git a/types/lowdb/adapters/LocalStorage.d.ts b/types/lowdb/adapters/LocalStorage.d.ts new file mode 100644 index 0000000000..3a9edc7a7d --- /dev/null +++ b/types/lowdb/adapters/LocalStorage.d.ts @@ -0,0 +1,3 @@ +import { AdapterSync } from "../index"; +declare const LocalStorage: AdapterSync; +export = LocalStorage; diff --git a/types/lowdb/adapters/Memory.d.ts b/types/lowdb/adapters/Memory.d.ts new file mode 100644 index 0000000000..d1c8b4c5ae --- /dev/null +++ b/types/lowdb/adapters/Memory.d.ts @@ -0,0 +1,3 @@ +import { AdapterSync } from "../index"; +declare const FileSync: AdapterSync; +export = FileSync; diff --git a/types/lowdb/index.d.ts b/types/lowdb/index.d.ts index 3ca15155e1..bab0116404 100644 --- a/types/lowdb/index.d.ts +++ b/types/lowdb/index.d.ts @@ -1,558 +1,373 @@ -// Type definitions for Lowdb 0.15 +// Type definitions for Lowdb 1.0.0 // Project: https://github.com/typicode/lowdb -// Definitions by: typicode, +// Definitions by: typicode +// Bazyli Brzóska // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import { LoDashExplicitWrapper, LoDashStatic } from "lodash"; + +declare let Lowdb: Lowdb.lowdb; +export = Lowdb; declare namespace Lowdb { - - interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; - } - - interface StringRepresentable { - toString(): string; - } - - interface List { - [index: number]: T; - length: number; - } - - interface Dictionary { - [index: string]: T; - } - - interface DictionaryIterator { - (value: T, key?: string, collection?: Dictionary): TResult; - } - - interface ListIterator { - (value: T, index: number, collection: List): TResult; - } - - interface StringIterator { - (char: string, index?: number, string?: string): TResult; - } - - interface MixinOptions { - chain?: boolean; - } - - class LoDashWrapper> { - - /** - * @see _.has - */ - has(path: StringRepresentable | StringRepresentable[]): LowEntryClass; - - /** - * @see _.hasIn - */ - hasIn(path: StringRepresentable | StringRepresentable[]): LowEntryClass; - - /** - * @see _.assign - */ - assign( - source: TSource - ): LowEntryClass; - - /** - * @see _.assign - */ - assign( - source1: TSource1, - source2: TSource2 - ): LowEntryClass; - - /** - * @see _.assign - */ - assign( - source1: TSource1, - source2: TSource2, - source3: TSource3 - ): LowEntryClass; - - /** - * @see _.assign - */ - assign( - source1: TSource1, - source2: TSource2, - source3: TSource3, - source4: TSource4 - ): LowEntryClass; - - /** - * @see _.assign - */ - assign(): LowEntryClass; - - /** - * @see _.assign - */ - assign(...otherArgs: any[]): LowEntryClass; - - /** - * @see _.cloneDeep - */ - cloneDeep(): LowEntryClass; - - /** - * @see _.cloneDeep - */ - cloneDeep(): LowEntryClass; - - /** - * @see _.cloneDeep - */ - cloneDeepWith(customizer: (value: any) => any): LowEntryClass[]; - - /** - * @see _.cloneDeep - */ - cloneDeepWith(customizer: (value: any) => any): LowEntryClass; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - ...sources: {}[] - ): LowEntryClass; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - source2: S2, - ...sources: {}[] - ): LowEntryClass; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - source2: S2, - source3: S3, - ...sources: {}[] - ): LowEntryClass; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - source2: S2, - source3: S3, - source4: S4, - ...sources: {}[] - ): LowEntryClass; - - /** - * @see _.defaults - */ - defaults(): LowEntryClass; - - /** - * @see _.defaults - */ - defaults(...sources: {}[]): LowEntryClass; - - /** - * @see _.get - */ - get(object: any, - path: string | number | boolean | Array, - defaultValue?: TResult - ): LowEntryClass; - - /** - * @see _.get - */ - get(path: string | number | boolean | Array, - defaultValue?: TResult - ): LowEntryClass; - - - /** - * @see _.mixin - */ - mixin( - source: Dictionary<() => void>, - options?: MixinOptions - ): LowEntryClass; - - /** - * @see _.mixin - */ - mixin( - options?: MixinOptions - ): LowEntryClass; - - /** - * @see _.set - */ - set( - path: StringRepresentable | StringRepresentable[], - value: any - ): LowEntryClass; - - /** - * @see _.set - */ - set( - path: StringRepresentable | StringRepresentable[], - value: V - ): LowEntryClass; - - /** - * @see _.find - */ - find( - predicate?: ListIterator, - thisArg?: any - ): LowEntryClass; - - /** - * @see _.find - */ - find( - predicate?: string, - thisArg?: any - ): LowEntryClass; - - /** - * @see _.find - */ - find( - predicate?: TObject - ): LowEntryClass; - - /** - * @see _.find - */ - filter( - predicate?: TObject - ): LowEntryClass; - - /** - * @see _.filter - */ - filter( - predicate?: ListIterator, - thisArg?: any - ): LowEntryClass; - - /** - * @see _.filter - */ - filter( - predicate: string, - thisArg?: any - ): LowEntryClass; - - /** - * @see _.filter - */ - filter( - predicate: ListIterator | DictionaryIterator, - thisArg?: any - ): LowEntryClass; - - /** - * @see _.filter - */ - filter( - predicate?: StringIterator, - thisArg?: any - ): LowEntryClass; - - /** - * @see _.filter - */ - filter(predicate: W): LowEntryClass; - /** - * @see _.map - */ - map( - iteratee?: ListIterator, - thisArg?: any - ): LowEntryClass; - - /** - * @see _.map - */ - map( - iteratee?: string - ): LowEntryClass; - - /** - * @see _.map - */ - map( - iteratee?: TObject - ): LowEntryClass; - /** - * @see _.map - */ - map( - iteratee?: ListIterator | DictionaryIterator, - thisArg?: any - ): LowEntryClass; - - /** - * @see _.range - */ - range( - end?: number, - step?: number - ): LowEntryClass; - - /** - * @see _.rangeRight - */ - rangeRight( - end?: number, - step?: number - ): LowEntryClass; - - /** - * @see _.remove - */ - remove( - predicate?: ListIterator, - thisArg?: any - ): LowEntryClass; - - /** - * @see _.remove - */ - remove( - predicate?: string, - thisArg?: any - ): LowEntryClass; - - /** - * @see _.remove - */ - remove( - predicate?: W - ): LowEntryClass; - - /** - * @see _.sortBy - */ - sortBy( - iteratee?: ListIterator - ): LowEntryClass; - - /** - * @see _.sortBy - */ - sortBy(iteratee: string): LowEntryClass; - - /** - * @see _.sortBy - */ - sortBy(whereValue: W): LowEntryClass; - - /** - * @see _.sortBy - */ - sortBy(): LowEntryClass; - - /** - * @see _.sortBy - */ - sortBy(...iteratees: (ListIterator | any | string)[]): LowEntryClass; - - /** - * @see _.sortBy - */ - sortBy(iteratees: (ListIterator | string | any)[]): LowEntryClass; - - /** - * @see _.slice - */ - slice( - start?: number, - end?: number - ): LowEntryClass; - - /** - * @see _.size - */ - size(): LowEntryClass; - - /** - * @see _.take - */ - take(n?: number): LowEntryClass; - - /** - * @see _.times - */ - times( - iteratee: (num: number) => TResult - ): LowEntryClass; - - /** - * @see _.times - */ - times(): LowEntryClass; - - /** - * @see _.uniqueId - */ - uniqueId(): LowEntryClass; - - value(): T; - - pop(): T; - push(...items: T[]): LowEntryClass; - shift(): T; - sort(compareFn?: (a: T, b: T) => number): LowEntryClass; - splice(start: number): LowEntryClass; - splice(start: number, deleteCount: number, ...items: any[]): LowEntryClass; - unshift(...items: T[]): LowEntryClass; - } - - export interface Storage { - - /** - * Reads the database. - * - * @param source The source location. - * @param deserialize The deserialize function to apply. - * @return Returns a promise with the deserialized db object. - */ - read?(source: string, deserialize: any): PromiseLike - - /** - * Reads the database. - * - * @param source The source location. - * @param deserialize The deserialize function to apply. - * @return Returns the deserialized db object. - */ - read?(source: string, deserialize: any): {} - - /** - * Writes to the database. - * - * @param destination The destination location. - * @param obj The object to write. - * @param serialize The serialize function to apply. - */ - write?(destination: string, obj: any, serialize: any): void - - /** - * Writes to the database. - * - * @param destination The destination location. - * @param obj The object to write. - * @param serialize The serialize function to apply. - */ - write?(destination: string, obj: any, serialize: any): PromiseLike - } - - export interface Format { - - /** - * Writes to the database. - * - * @param obj The object to serialize. - * @return Returns the serialized object string. - */ - serialize(obj: any): string - - /** - * Writes to the database. - * - * @param data The object to deserialize. - * @return Returns the deserialized object. - */ - deserialize(data: string): any - } - - export interface Options { - - /** - * The custom "storage" object. - */ - storage?: Storage - - /** - * The custom "format" object. - */ - format?: Format - - /** - * The flag to automatically persist changes. - */ - writeOnChange?: boolean - - } - - export class Lowdb extends LoDashWrapper { - - constructor(filePath: string, options?: Options); - - /** - * Access current database state. - * Returns Returns the database state. - */ - getState(): any - - /** - * Drop or reset database state. - * @param newState New state of the database - */ - setState(newState: any): void - - /** - * Persist database. - * @param source The source location. - */ - write(source?: string): void - - /** - * Persist database. - * @param source The source location. - */ - write(source?: string): PromiseLike - - /** - * Read database. - * @param source The source location. - */ - read(source?: string): any - - /** - * Read database. - * @param source The source location. - */ - read(source?: string): PromiseLike - + export type AdapterOptions = { + defaultValue?: SchemaT; + serialize?: (data: SchemaT) => string; + deserialize?: (serializedData: string) => SchemaT; + }; + + export interface BaseAdapter + extends AdapterOptions { + readonly "@@reference": SchemaT; + new ( + source: string, + options?: AdapterOptions + ): BaseAdapter; + source: string; } -// declare class lowdb { -// new (source?: string, opts?: Options): Low; -// (source?: string, opts?: Options) : Low; -// } + export interface AdapterSync + extends BaseAdapter { + new ( + source: string, + options?: AdapterOptions + ): AdapterSync; + readonly "@@isAsync": False; + write(state: Object): void; + } + + export interface AdapterAsync + extends BaseAdapter { + new ( + source: string, + options?: AdapterOptions + ): AdapterAsync; + readonly "@@isAsync": True; + write(state: Object): Promise; + } + + export type Adapter = + | AdapterSync + | AdapterAsync; + + export interface LowdbBase< + SchemaT extends {}, + AdapterT extends Adapter + > { + read: () => Wrapper; + getState: () => SchemaT; + setState: (state: SchemaT) => this; + } + + export interface Lowdb> + extends LowdbBase, + LoDashExplicitWrapper { + _: LoDashStatic; + /** + * @description Be careful: This function overwrites the whole database. + */ + write(returnValue?: T): Wrapper; + } + + export interface LowdbFp< + SchemaT extends {} = any, + AdapterT extends Adapter = Adapter + > extends LowdbBase { + /** + * @description Be careful: This function overwrites the whole database. + */ + write(returnValue?: T): Wrapper; + /** + * @description Returns a function that allows you to access/modify the database at a given path. + * @example + * ```js + * const posts = db('posts') + * const firstPost = posts(all => all[0]) + * posts.write((allPosts) => [...allPosts, {title: 'Yup!'}]) + * ``` + */ + ( + path: TKey | [TKey], + defaultValue?: SchemaT[TKey] + ): FpReturn; + ( + path: [TKey, TSubKey], + defaultValue?: SchemaT[TKey][TSubKey] + ): FpReturn; + < + TKey extends keyof SchemaT, + TSubKey extends keyof SchemaT[TKey], + TSubKey2 extends keyof SchemaT[TKey][TSubKey] + >( + path: [TKey, TSubKey, TSubKey2], + defaultValue?: SchemaT[TKey][TSubKey][TSubKey2] + ): FpReturn; + < + TKey extends keyof SchemaT, + TSubKey extends keyof SchemaT[TKey], + TSubKey2 extends keyof SchemaT[TKey][TSubKey], + TSubKey3 extends keyof SchemaT[TKey][TSubKey][TSubKey2] + >( + path: [TKey, TSubKey, TSubKey2, TSubKey3], + defaultValue?: SchemaT[TKey][TSubKey][TSubKey2][TSubKey3] + ): FpReturn; + < + TKey extends keyof SchemaT, + TSubKey extends keyof SchemaT[TKey], + TSubKey2 extends keyof SchemaT[TKey][TSubKey], + TSubKey3 extends keyof SchemaT[TKey][TSubKey][TSubKey2], + TSubKey4 extends keyof SchemaT[TKey][TSubKey][TSubKey2][TSubKey3] + >( + path: [TKey, TSubKey, TSubKey2, TSubKey3, TSubKey4], + defaultValue?: SchemaT[TKey][TSubKey][TSubKey2][TSubKey3][TSubKey4] + ): FpReturn; + (path: string | Array, defaultValue?: T): T; + } + export interface FpReturn { + /** + * Execute a series of functions on the data at a given path. + * Result of previous function is the input of the next one. + * Returns the result of the last function. + */ + (f1: (a1: PathT) => R1): R1; + // (f1: [(a1: PathT) => R1]): R1; + (f1: [(a1: PathT) => R1, (a: R1) => R2]): R2; + (f1: [(a1: PathT) => R1, (a: R1) => R2, (a: R2) => R3]): R3; + ( + f1: [(a1: PathT) => R1, (a: R1) => R2, (a: R2) => R3, (a: R3) => R4] + ): R4; + ( + f1: [ + (a1: PathT) => R1, + (a: R1) => R2, + (a: R2) => R3, + (a: R3) => R4, + (a: R4) => R5 + ] + ): R5; + ( + f1: [ + (a1: PathT) => R1, + (a: R1) => R2, + (a: R2) => R3, + (a: R3) => R4, + (a: R4) => R5, + (a: R5) => R6 + ] + ): R6; + ( + f1: [ + (a1: PathT) => R1, + (a: R1) => R2, + (a: R2) => R3, + (a: R3) => R4, + (a: R4) => R5, + (a: R5) => R6, + (a: R6) => R7 + ] + ): R7; + (funcs: Array<(a: any) => any>): any; + + /** + * @description Writes the change to the database, based on the callback's return value. + * @example + * ```js + * posts.write((allPosts) => [...allPosts, {title: 'Yup!'}]) + * ``` + */ + write(f1: (a1: PathT) => R1): Wrapper; + } + + export type lowdb = < + SchemaT extends AdapterT[ReferenceProperty], + AdapterT extends Adapter + >( + adapter: AdapterT + ) => If< + AdapterT[AsyncProperty], + Promise, AdapterT>>, + Lowdb, AdapterT> + >; + + export type lowdbFp = < + SchemaT extends AdapterT[ReferenceProperty], + AdapterT extends Adapter + >( + adapter: AdapterT + ) => If< + AdapterT[AsyncProperty], + Promise>, + LowdbFp + >; + + export type Wrapper = WrapInPromiseIfTrue< + T, + AdapterT[AsyncProperty] + >; } -declare module "lowdb" { - export = Lowdb.Lowdb; -} \ No newline at end of file +/** + * lodash augmentation is necessary in order not to duplicate the whole lodash definition + * it's mostly harmless, aside from the fact that 'write' becomes a method in a lodash.chain() + */ +declare module "lodash" { + interface LoDashExplicitWrapper { + write(): WrapInPromiseIfAsyncTag>; + // override lodash's methods only if source tag is present: + value(): GetReferenceTypeIfDefined; + } +} + +// utility types: +type WrapInPromiseIfTrue = If, T>; +type ReferenceProperty = "@@reference"; +/** + * Hidden source property for resolving to the correct type. + * It is doubly nested so that we retain all nullability information + */ +type SourceReference = { + readonly "@@reference"?: { readonly "@@reference": T }; +}; +type GetReferenceParent> = NonNull< + U[keyof U & ReferenceProperty] +>; +type GetDefinedReferenceType< + TValue, + SourceParent = GetReferenceParent +> = SourceParent[keyof SourceParent & ReferenceProperty]; +type AsyncProperty = "@@isAsync"; +type AsyncTag = { readonly "@@reference"?: { readonly "@@isAsync"?: true } }; +type SyncTag = {}; +type HasAsyncTag> = If< + HasReferenceProperty, + UnionHasKey, + False +>; +type HasReferenceProperty = UnionHasKey, ReferenceProperty>; +type WrapInPromiseIfAsyncTag< + TaggedT, + WrappedT = GetReferenceTypeIfDefined +> = WrapInPromiseIfTrue>; + +/** + * Resolves the hidden source type + * while preserving nullability as much as possible + */ +type GetReferenceType> = If< + IsEmptyType, + Source | undefined, + Source +>; + +type GetReferenceTypeIfDefined = If< + HasReferenceProperty, + GetReferenceType, + T +>; + +type RecursivelyExtend = If< + IsArrayType, + MapArrayType, AddT>, + MapScalarOrObjectType +> & + SourceReference; + +type MapScalarOrObjectType = If< + IsScalarOrInstance, + T, + MapObjectWithPossibleArrays & SourceReference & AddT +>; + +type MapObjectWithPossibleArrays = { + [P in keyof T]: If< + IsArrayType, + MapArrayType, AddT> & SourceReference, + MapScalarOrObjectType + > +}; + +type MapArrayType, AddT, T = Arr[-1]> = Array< + MapObjectWithPossibleArrays & SourceReference & AddT +> & + AddT; + +////////////////////////////////////////// +// generic utils (some from https://github.com/tycho01/typical/): + +type False = "0"; +type True = "1"; +type Bool = True | False; +type If = { 1: Then; 0: Else }[Cond]; + +type Obj = { [k: string]: T }; + +type And = ({ 1: { 1: "1" } & Obj<"0"> } & Obj< + Obj<"0"> +>)[A][B]; + +type UnionHasKey = ({ + [S in Union]: "1" +} & + Obj<"0">)[K]; + +type Indeterminate = And< + UnionHasKey, + UnionHasKey +>; + +type Not = { "1": "0"; "0": "1" }[T]; + +type Determinate = Not>; + +type DefinitelyYes = And>; + +type UnionContained = DefinitelyYes< + ({ [P in U]: "1" } & Obj<"0">)[T | U] +>; + +type UnionEmpty = And< + UnionContained, + UnionContained +>; + +type UnionToObject = { [K in Keys]: K }; + +type Keyed = { [K in keyof T]: K }; + +type KeyedSafe = Keyed & Obj; + +type IntersectionUnions = KeyedSafe< + UnionToObject +>[Big]; +type UnionsOverlap = Not< + UnionEmpty> +>; + +type DiffUnion = ({ [P in T]: P } & + { [P in U]: never } & { [k: string]: never })[T]; + +type ObjectHasKey = UnionHasKey; + +type ArrayPrototypeProperties = DiffUnion< + keyof Array, + "toString" | "toLocaleString" +>; +type IsArrayType = DefinitelyYes>; +/** + * either: undefined, never, null or {} + * can also be used to check if one union contains one of the above + **/ +type IsEmptyType = UnionEmpty; + +/** + * false for: undefined, interfaces + * true for: Array, boolean, number, string, Object + */ +type IsScalarOrInstance = ObjectHasKeySafe; +type ObjectHasKeySafe = UnionsOverlap; +type NonNull = T & {}; + +interface List { + readonly [n: number]: T; +} diff --git a/types/lowdb/lib/fp.d.ts b/types/lowdb/lib/fp.d.ts new file mode 100644 index 0000000000..5202c13712 --- /dev/null +++ b/types/lowdb/lib/fp.d.ts @@ -0,0 +1,3 @@ +import { lowdbFp } from "../index"; +declare const lowdbFp: lowdbFp; +export = lowdbFp; diff --git a/types/lowdb/lib/main.d.ts b/types/lowdb/lib/main.d.ts new file mode 100644 index 0000000000..33c4dfaae0 --- /dev/null +++ b/types/lowdb/lib/main.d.ts @@ -0,0 +1,3 @@ +import { lowdb } from "../index"; +declare const lowdb: lowdb; +export = lowdb; diff --git a/types/lowdb/lowdb-tests.ts b/types/lowdb/lowdb-tests.ts index b7e0f4f5f6..d466681ab4 100644 --- a/types/lowdb/lowdb-tests.ts +++ b/types/lowdb/lowdb-tests.ts @@ -1,16 +1,203 @@ -import Lowdb = require('lowdb'); +import * as low from "lowdb"; +import * as lowfp from "lowdb/lib/fp"; +import * as FileSync from "lowdb/adapters/FileSync"; +import * as FileAsync from "lowdb/adapters/FileAsync"; +import * as LocalStorage from "lowdb/adapters/LocalStorage"; -const db = new Lowdb('db.json'); +const adapterSync: low.AdapterSync<{}> = new FileSync("db.json"); +const adapterAsync: low.AdapterAsync<{}> = new FileAsync("db.json"); +const db = low(adapterSync); -db.defaults({ someObject: {}, anotherObject: {} }).write(); +const write: DbSchema = db.defaults({ posts: [] }).write(); -db.get('someObject').set('foo' , 'bar').write(); -db.get('someObject.foo').value(); +const result: Post[] = db + .get("posts") + .push({ title: "hello", views: 123 }) + .value(); -db.get('anotherObject').set('foo' , 'bar').write(); -db.get('anotherObject.foo').value(); +const teste = db.get("user").value(); +const post: Post | undefined = db + .get("posts") + .find({ id: 123 }) + .value(); -db.set('singleValue', 'foo').write(); -db.get('singleValue').value(); +// $ExpectError +const postAssertWithUndefined: Post = db + .get("posts") + .find({ id: 123 }) + .value(); -console.log(db.getState()); +// $ExpectError +const postAssertWithUndefined2: Post = db + .get("posts") + .find({ id: 123 }) + .write(); + +low(adapterAsync).then(dbAsync => { + const writeAction: Promise = dbAsync + .get("posts") + .push({ title: "async hello" }) + .last() + .assign({ id: Date.now().toString() }) + .write(); + + const test: Promise = dbAsync + .get("posts") + .find({}) + .write(); + + const test2: Post | undefined = dbAsync + .get("posts") + .find({}) + .value(); + + const tuple: Promise<[boolean, number] | undefined> = dbAsync + .get("posts") + .first() + .get("tuple") + .write(); +}); + +async () => { + const adapterSync: low.AdapterSync = new FileSync("db.json", { + defaultValue: { + posts: [{ name: "baz" }] + } + }); + + const adapterAsync: low.AdapterAsync = new FileAsync( + "db.json", + { + defaultValue: { + posts: [{ name: "baz" }] + } + } + ); + + const dbSync = low(adapterSync); + const dbAsync = await low(adapterAsync); + const dbAssertTypeSync: low.Lowdb = dbSync; + const dbAssertTypeAsync: low.Lowdb< + ExampleSchema, + typeof adapterAsync + > = dbAsync; + + const xSync: ExampleSchema = dbSync + .defaults({ posts: [{ name: "baz" }] }) + .write(); + + const xAsync: Promise = dbAsync + .defaults({ posts: [{ name: "baz" }] }) + .write(); + + const result: Promise = dbAsync + .get("posts") + .push({ name: "hello" }) + .write(); + + const resultSync: ExampleSchema["posts"] = dbSync + .get("posts") + .push({ name: "hello" }) + .write(); + + const dbPromise = low(adapterAsync); + const db = await dbPromise; + + const nested: OtherSchema["nested"] = db.get("nested").value(); + + const result2: Promise = db + .get("nested") + .get("x") + .write(); +}; + +declare const lodashChain: _.LoDashExplicitWrapper; + +// let's also ensure we didn't break lodash.chain through extension +const weDidNotBreakLodash: ExampleSchema["posts"] = lodashChain + .get("posts") + .sortBy("") + .value(); + +// tests for lowdb/lib/fp: +() => { + const adapterLS = new LocalStorage("test.json"); + const dbFP = lowfp(adapterLS); + // Get posts + const postsFP: low.FpReturn> = dbFP( + "posts" + ); + + // replace posts with a new array resulting from concat + // and persist database + const write: Post[] = postsFP.write( + concat({ title: "lowdb is awesome", views: random(0, 5) }) + ); + + // Find post by id + const post: Post = postsFP(find({ id: 1 })); + + // Find top 5 fives posts + const popular: Post[] = postsFP([ + sortBy("views") as PostsAction, + take(5) as PostsAction + ]); + + const filtered: Post[] = dbFP("posts")(filter({ published: true })); + const writeAction: Post[] = dbFP("posts").write(concat({ id: "123" })); + const writeAction2: string = dbFP(["user", "name"]).write(set("typicode")); + + async () => { + const adapterAsync = new FileAsync("test.json"); + const dbAsyncPromise = lowfp(adapterAsync); + const dbAsync = await dbAsyncPromise; + const postsWithDefault: low.FpReturn< + Post[], + low.AdapterAsync + > = dbAsync("posts", [{ title: "baz" }] as Post[]); + + const func: Promise = postsWithDefault.write(post => [ + ...post, + { title: "another" } + ]); + }; + + type PostsAction = (posts: Post[]) => Post[]; +}; + +declare function find(a: B): (arr: A[]) => A; +declare function filter(a: B): (arr: A[]) => A[]; +declare function random(a: number, b: number): number; +declare function concat(a: any): (arr: A) => A; +declare function sortBy(a: any): (arr: A) => A; +declare function take(a: A): (arr: A) => A; +declare function set(a: A): (val: A) => A; + +interface DbSchema { + posts: Array; + user: { + name: string; + }; +} + +interface Post { + title?: string; + views?: number; + id?: number; + published?: boolean | undefined; + tuple?: [boolean, number]; +} + +interface ExampleSchema { + posts: Array<{ + name: string; + }>; +} + +interface OtherSchema extends ExampleSchema { + nested: { + x: { + y: number; + }; + }; +} diff --git a/types/lowdb/tsconfig.json b/types/lowdb/tsconfig.json index 3ca3c13b78..7897564789 100644 --- a/types/lowdb/tsconfig.json +++ b/types/lowdb/tsconfig.json @@ -19,6 +19,13 @@ }, "files": [ "index.d.ts", + "adapters/Base.d.ts", + "adapters/FileAsync.d.ts", + "adapters/FileSync.d.ts", + "adapters/LocalStorage.d.ts", + "adapters/Memory.d.ts", + "lib/fp.d.ts", + "lib/main.d.ts", "lowdb-tests.ts" ] -} \ No newline at end of file +} From f5ec0756729d0b28c9dca14bb739add2cc3a4762 Mon Sep 17 00:00:00 2001 From: Sam Verschueren Date: Thu, 30 Nov 2017 20:20:31 +0100 Subject: [PATCH 003/890] Add type definitions for vali-date --- types/vali-date/index.d.ts | 8 ++++++++ types/vali-date/tsconfig.json | 25 +++++++++++++++++++++++++ types/vali-date/tslint.json | 3 +++ types/vali-date/vali-date-tests.ts | 5 +++++ 4 files changed, 41 insertions(+) create mode 100644 types/vali-date/index.d.ts create mode 100644 types/vali-date/tsconfig.json create mode 100644 types/vali-date/tslint.json create mode 100644 types/vali-date/vali-date-tests.ts diff --git a/types/vali-date/index.d.ts b/types/vali-date/index.d.ts new file mode 100644 index 0000000000..8df7dee517 --- /dev/null +++ b/types/vali-date/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for vali-date 1.0 +// Project: https://github.com/SamVerschueren/vali-date +// Definitions by: Sam Verschueren +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function valiDate(input: string): boolean; +declare namespace valiDate { } +export = valiDate; diff --git a/types/vali-date/tsconfig.json b/types/vali-date/tsconfig.json new file mode 100644 index 0000000000..8e27969380 --- /dev/null +++ b/types/vali-date/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "vali-date-tests.ts" + ] +} diff --git a/types/vali-date/tslint.json b/types/vali-date/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/vali-date/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/vali-date/vali-date-tests.ts b/types/vali-date/vali-date-tests.ts new file mode 100644 index 0000000000..85a3e39bc5 --- /dev/null +++ b/types/vali-date/vali-date-tests.ts @@ -0,0 +1,5 @@ +import * as valiDate from 'vali-date'; + +valiDate('foo'); +valiDate('bar'); +valiDate('2017-05-10'); From 3810ac72668dcac1ef0c5ab64d26d46ff65187eb Mon Sep 17 00:00:00 2001 From: Viko Date: Sun, 3 Dec 2017 20:22:14 -0600 Subject: [PATCH 004/890] Fix jDataView --- types/jdataview/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/jdataview/index.d.ts b/types/jdataview/index.d.ts index f80784eb60..9aa1d59dbe 100644 --- a/types/jdataview/index.d.ts +++ b/types/jdataview/index.d.ts @@ -105,3 +105,5 @@ declare namespace jDataView { static fromNumber(number: number): Int64 } } + +export = jDataView From 833eeee25bdedb2073f92a447b4212289481226b Mon Sep 17 00:00:00 2001 From: Sergei Dryganets Date: Fri, 8 Dec 2017 12:11:54 -0800 Subject: [PATCH 005/890] some of the not implemented lint rules disabled for react --- types/react/tslint.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/react/tslint.json b/types/react/tslint.json index c09aa3940e..6a9d91ddbd 100644 --- a/types/react/tslint.json +++ b/types/react/tslint.json @@ -6,6 +6,8 @@ "no-any-union": false, "no-object-literal-type-assertion": false, "no-unnecessary-generics": false, - "no-void-expression": false + "no-void-expression": false, + "strict-export-declare-modifiers": false, + "void-return": false } } From 7b4dd11955c9e3ac3620be64848787d40d24c17c Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 8 Dec 2017 15:59:09 -0700 Subject: [PATCH 006/890] fix typo --- types/expo/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 04d500ab6b..bfb1819515 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -1400,7 +1400,7 @@ export interface SvgCommonProps { originY?: number; } -export class Svg extends Component<{ width: number, heigth: number }> { } +export class Svg extends Component<{ width: number, height: number }> { } export class Rect extends Component { } export interface CircleProps extends SvgCommonProps { From 08477d7c3dbe20b20712740a25fbdb450bd3e122 Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Sat, 9 Dec 2017 15:06:00 +0000 Subject: [PATCH 007/890] [lokijs] additional tests --- types/lokijs/lokijs-tests.ts | 110 +++++++++++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 4 deletions(-) diff --git a/types/lokijs/lokijs-tests.ts b/types/lokijs/lokijs-tests.ts index 167adba4ad..ac16e5cc15 100644 --- a/types/lokijs/lokijs-tests.ts +++ b/types/lokijs/lokijs-tests.ts @@ -1,7 +1,18 @@ - import Loki = require("lokijs"); + +interface EarthLocation { + longitude: number; + latitude: number; +} + +interface User { + name: string; + age: number; +} + + class Ant { static uniqueId = 1; @@ -37,10 +48,12 @@ class QueenAnt extends Ant { class AntColony { + location: EarthLocation; ants: Loki.Collection; queens: Loki.Collection; - constructor(ants: Loki.Collection, queens: Loki.Collection) { + constructor(location: EarthLocation, ants: Loki.Collection, queens: Loki.Collection) { + this.location = location; this.ants = ants; this.queens = queens; } @@ -73,15 +86,104 @@ class Test { throw new Error("queen object's '.$loki' property lookup failed"); } - var anotherColl = new Loki.Collection("anotherCollection"); + Test.events(lokiInst); + Test.insertUpdateRemove(lokiInst); + Test.dynamicViews(lokiInst); + Test.transform(lokiInst); + } + + static events(lokiInst: Loki) { + var coll = new Loki.Collection("anotherCollection", {}); + var onUpdate: (t: any) => void; + + coll.on("update", onUpdate = function (target) { + console.log("update", target); + }); + + coll.on("error", function (target) { + console.log("error", target); + }); + + coll.emit("update", { data: "abc" }); + + coll.removeListener("update", onUpdate); + } + + + static insertUpdateRemove(lokiInst: Loki) { + var coll = new Loki.Collection("anotherCollection", { + unique: <["id"]>["id"], + indices: <["dob"]>["dob"], + autoupdate: true + }); + + coll.insert({ + id: 127, + dob: new Date(2012, 9, 1), + health: 1.0, + lengthMm: 3.5, + weightMg: 0.4, + }); + + var doc = coll.by("id", 127); + if (doc) doc.health -= 0.25; + + // untyped collection (collection type should default to 'any') + var tmpColl = lokiInst.addCollection("_temp"); + tmpColl.insert(coll.find()); + var res = tmpColl.findOne({ id: 127 }); + if (res) res.health -= 0.25; + + coll.clear({ removeIndices: true }); + + tmpColl.removeWhere({ id: 127 }); + + if(doc) coll.add(doc); + + coll.remove(1); + coll.removeDataOnly(); + } + + + static dynamicViews(lokiInst: Loki) { + var users = lokiInst.addCollection("users"); + + users.insert({ name: "joe", age: 39 }); + users.insert({ name: "jack", age: 20 }); + users.insert({ name: "jim", age: 40 }); + users.insert([ + { name: "dave", age: 33 }, + { name: "eric", age: 29 }, + { name: "dave", age: 21 } + ]); + + var dv = users.addDynamicView("testview"); + dv.applyWhere(function (obj) { + return obj.name.length > 3; + }); + + console.log("expect 2 == " + dv.data().length); + + users.removeWhere(function (obj: User) { + return obj.age > 35; + }); + + console.log("expect 0 == " + dv.data().length); + } + + + static transform(lokiInst: Loki) { + var ants = lokiInst.addCollection("tmpAnts"); + var len = ants.chain().transform([{ property: "id" }]).data().length; + ants.addTransform("tmpAnts", [{ type: "map", mapFun: (a: any) => a, desc: true }]); } static createAntColony(lokiInst: Loki, antCount: number, queenCount: number = 1) { var ants = lokiInst.addCollection("ants", { indices: "id" }); var queens = lokiInst.addCollection("queenAnts", { indices: "id" }); - var antColony = new AntColony(ants, queens); + var antColony = new AntColony({ latitude: 0, longitude: 0 }, ants, queens); for (var i = 0; i < antCount; i++) { ants.add(Ant.createAnt()); From ded79672a7a0471faaeb9bdf6f4810e079f296a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20=C5=81aziuk?= Date: Sun, 10 Dec 2017 00:18:25 +0100 Subject: [PATCH 008/890] koa-static v4.0 --- types/koa-send/index.d.ts | 2 +- types/koa-static/index.d.ts | 44 ++++++++-------------------- types/koa-static/koa-static-tests.ts | 6 ++-- 3 files changed, 16 insertions(+), 36 deletions(-) diff --git a/types/koa-send/index.d.ts b/types/koa-send/index.d.ts index 65228c9981..a4b090e1ea 100644 --- a/types/koa-send/index.d.ts +++ b/types/koa-send/index.d.ts @@ -29,7 +29,7 @@ declare namespace send { /** Root directory to restrict file access. (defaults to '') */ root?: string; /** Name of the index file to serve automatically when visiting the root location. (defaults to none) */ - index?: string; + index?: string | false; /** Try to serve the gzipped version of a file automatically when gzip is supported by a client and if the requested file with .gz extension exists. (defaults to true). */ gzip?: boolean; /** Try to serve the brotli version of a file automatically when brotli is supported by a client and if the requested file with .br extension exists. (defaults to true). */ diff --git a/types/koa-static/index.d.ts b/types/koa-static/index.d.ts index 6395efec3a..eaba7866c4 100644 --- a/types/koa-static/index.d.ts +++ b/types/koa-static/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for koa-static 3.0 +// Type definitions for koa-static 4.0 // Project: https://github.com/koajs/static // Definitions by: Jerry Chin -// Definitions: https://github.com/hellopao/DefinitelyTyped +// Tomek Łaziuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /* =================== USAGE =================== @@ -14,38 +15,17 @@ =============================================== */ -import * as Koa from "koa"; +import { Middleware } from "koa"; -declare function serve(root: string, opts?: { - /** - * Default file name, defaults to 'index.html' - */ - index?: boolean | string; +import { SendOptions } from "koa-send"; - /** - * If true, serves after return next(),allowing any downstream middleware to respond first. - */ - defer?: boolean; +declare function serve(root: string, opts?: serve.Options): Middleware; - /** - * Browser cache max-age in milliseconds. defaults to 0 - */ - maxage?: number; +declare namespace serve { + interface Options extends SendOptions { + /** If true, serves after return next(), allowing any downstream middleware to respond first. */ + defer?: boolean; + } +} - /** - * Allow transfer of hidden files. defaults to false - */ - hidden?: boolean; - - /** - * Try to serve the gzipped version of a file automatically when gzip is supported by a client and if the requested file with .gz extension exists. defaults to true. - */ - gzip?: boolean; - - /** - * Try to match extensions from passed array to search for file when no extension is sufficed in URL. First found is served. (defaults to `false`) - */ - extensions?: string[]; -}): Koa.Middleware; -declare namespace serve {} export = serve; diff --git a/types/koa-static/koa-static-tests.ts b/types/koa-static/koa-static-tests.ts index 2bcb0ae030..9b0d756f7d 100644 --- a/types/koa-static/koa-static-tests.ts +++ b/types/koa-static/koa-static-tests.ts @@ -4,9 +4,9 @@ import serve = require("koa-static"); const app = new Koa(); app.use(serve('.', { - index: false, - defer: false, - extensions: ['html'] + index: false, + defer: false, + extensions: ['html'], })); app.listen(80); From acb2f62ccc44cd2d6b2dff4db0804d3bbd579506 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Fri, 8 Dec 2017 19:54:51 +0800 Subject: [PATCH 009/890] add types of mirrox --- types/mirrorx/README.md | 1 + types/mirrorx/index.d.ts | 219 +++++++++++++++++++++++++++++++++ types/mirrorx/mirrorx-tests.ts | 29 +++++ types/mirrorx/package.json | 11 ++ types/mirrorx/tsconfig.json | 26 ++++ types/mirrorx/tslint.json | 7 ++ 6 files changed, 293 insertions(+) create mode 100644 types/mirrorx/README.md create mode 100644 types/mirrorx/index.d.ts create mode 100644 types/mirrorx/mirrorx-tests.ts create mode 100644 types/mirrorx/package.json create mode 100644 types/mirrorx/tsconfig.json create mode 100644 types/mirrorx/tslint.json diff --git a/types/mirrorx/README.md b/types/mirrorx/README.md new file mode 100644 index 0000000000..a4bce407a2 --- /dev/null +++ b/types/mirrorx/README.md @@ -0,0 +1 @@ +This is typings for [mirrorjs](https://github.com/mirrorjs/mirror) \ No newline at end of file diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts new file mode 100644 index 0000000000..5720677bfe --- /dev/null +++ b/types/mirrorx/index.d.ts @@ -0,0 +1,219 @@ +// Type definitions for mirrorjs +// Project: https://github.com/mirrorjs/mirror +// Definitions by: Aaronphy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; +import * as H from 'history'; +import { + ReactInstance, Component, ComponentState, + ReactElement, SFCElement, CElement, + DOMAttributes, DOMElement, ReactNode, ReactPortal +} from 'react'; +import { + History, + Location, + Path, + LocationState, + LocationDescriptor +} from 'history'; + +import { Connect } from 'react-redux'; +import { match } from "react-router"; + + +export = mirror; +export as namespace mirror; + +declare namespace mirror { + + type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; + type Omit = Pick>; + + interface model { + name:string, + initialState?:any, + reducers?:any, + effects?:any + } + + interface _model { + name:string, + reducers:any + } + + interface LinkProps extends React.AnchorHTMLAttributes { + to: H.LocationDescriptor; + replace?: boolean; + } + + interface NavLinkProps extends LinkProps { + activeClassName?: string; + activeStyle?: React.CSSProperties; + exact?: boolean; + strict?: boolean; + isActive?

(match: match

, location: H.Location): boolean; + location?: H.Location; + } + + interface SwitchProps { + children?: React.ReactNode; + location?: H.Location; + } + + interface RedirectProps { + to: H.LocationDescriptor; + push?: boolean; + from?: string; + path?: string; + exact?: boolean; + strict?: boolean; + } + + interface RouteComponentProps

{ + match: match

; + location: H.Location; + history: H.History; + staticContext?: any; + } + + interface RouteProps { + location?: H.Location; + component?: React.ComponentType> | React.ComponentType; + render?: ((props: RouteComponentProps) => React.ReactNode); + children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; + path?: string; + exact?: boolean; + strict?: boolean; + } + + interface PromptProps { + message: string | ((location: H.Location) => string | boolean); + when?: boolean; + } + + interface LocationActionPayload { + method: string; + args?: any[]; + } + + interface RouterAction { + type:'@@router/CALL_HISTORY_METHOD', + payload: LocationActionPayload; + } + + interface routeActions { + push(location:any,state?:any):RouterAction, + replace(location:any,state?:any):RouterAction, + go(n:number):RouterAction, + goBack(): RouterAction, + goForward(): RouterAction + } + + export interface ConnectedRouterProps { + store?: any; + history?: History; +} + + interface Actions { + routing:routeActions, + [propName: string]: any + } + + interface defaultOptions { + initialState?:{}, + historyMode?:string, + middlewares:[any], + reducers:{}, + addEffect(name:string,handler:()=>any):any + } + + interface Renderer { + // Deprecated(render): The return value is deprecated. + // In future releases the render function's return type will be void. + + ( + element: DOMElement, T>, + container: Element | null, + callback?: () => void + ): T; + + ( + element: Array, any>>, + container: Element | null, + callback?: () => void + ): Element; + + ( + element: SFCElement | Array>, + container: Element | null, + callback?: () => void + ): void; + + >( + element: CElement, + container: Element | null, + callback?: () => void + ): T; + + ( + element: Array>>, + container: Element | null, + callback?: () => void + ): Component; + +

( + element: ReactElement

, + container: Element | null, + callback?: () => void + ): Component | Element | void; + + ( + element: Array>, + container: Element | null, + callback?: () => void + ): Component | Element | void; + + ( + parentComponent: Component | Array>, + element: SFCElement, + container: Element, + callback?: () => void + ): void; +} + + /** + * This method is used to create and inject a model. + * @param options + */ + function model(options:model):_model + /** + * connect connects your React component to your Redux store + */ + const connect:Connect + //The actions object contains both your Redux actions and reducers. + const actions:Actions + //Add a hook to monitor actions that have been dispatched. + const hook:(subscriber:()=>any)=>any + //mirror.defaults is a pretty intuitive API, you use it to configure your Mirror app. + const defaults:(options:defaultOptions)=>void + //render is an enhanced ReactDOM.render, it starts your Mirror app. + const render: Renderer; + // Mirror uses react-router@4.x, so if you're from react-router 2.x/3.x, you should checkout the Migrating from v2/v3 to v4 Guide. + class Router extends React.Component> {} + + class Link extends React.Component {} + + class NavLink extends React.Component {} + + class Redirect extends React.Component { } + + class Route extends React.Component { } + + class Prompt extends React.Component { } + + function withRouter

>(component: React.ComponentType

): React.ComponentClass>>; + + function withRouter>(target: TFunction): TFunction; +} \ No newline at end of file diff --git a/types/mirrorx/mirrorx-tests.ts b/types/mirrorx/mirrorx-tests.ts new file mode 100644 index 0000000000..c2a1ca6616 --- /dev/null +++ b/types/mirrorx/mirrorx-tests.ts @@ -0,0 +1,29 @@ +import { Component, ReactElement } from 'react'; +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import * as mirror from 'mirrorx'; +import { render,actions,withRouter,Link,NavLink,Router,Route,connect,Redirect} from 'mirrorx' + +mirror.model({ + name:'app', + + initialState: 0, + + reducers:{ + increment(state:any) { return state + 1 }, + decrement(state:any) { return state - 1 } + }, + + effects:{ + async incrementAsync() { + await new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, 1000) + }) + actions.app.increment() + } + } +}); + + diff --git a/types/mirrorx/package.json b/types/mirrorx/package.json new file mode 100644 index 0000000000..ee406466f8 --- /dev/null +++ b/types/mirrorx/package.json @@ -0,0 +1,11 @@ +{ + "private": true, + "dependencies": { + "@types/react":"^16.0.0", + "@types/react-dom":"^16.0.0", + "@types/react-router-dom":"^4.2.3", + "@types/redux":"^3.6.0", + "@types/react-redux":"^5.0.14", + "@types/react-router-redux":"^5.0.10" + } +} \ No newline at end of file diff --git a/types/mirrorx/tsconfig.json b/types/mirrorx/tsconfig.json new file mode 100644 index 0000000000..bc994b8f74 --- /dev/null +++ b/types/mirrorx/tsconfig.json @@ -0,0 +1,26 @@ +{ + "files": [ + "index.d.ts", + "mirrorx_test.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "experimentalDecorators": true, + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/mirrorx/tslint.json b/types/mirrorx/tslint.json new file mode 100644 index 0000000000..f7a71e1866 --- /dev/null +++ b/types/mirrorx/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": ["tslint:latest", "tslint-react"], + "rules": { + "no-unnecessary-generics": false, + "jsx-wrap-multiline": false + } +} \ No newline at end of file From 202a79f8b1ea947ff9866ec376bc1057a872cb7b Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 11:10:28 +0800 Subject: [PATCH 010/890] add commit in mirrorx-tests.ts file --- types/mirrorx/mirrorx-tests.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/mirrorx/mirrorx-tests.ts b/types/mirrorx/mirrorx-tests.ts index c2a1ca6616..57e16f9321 100644 --- a/types/mirrorx/mirrorx-tests.ts +++ b/types/mirrorx/mirrorx-tests.ts @@ -4,6 +4,10 @@ import * as ReactDOM from 'react-dom'; import * as mirror from 'mirrorx'; import { render,actions,withRouter,Link,NavLink,Router,Route,connect,Redirect} from 'mirrorx' + +/** + * add mirror.model.tests + */ mirror.model({ name:'app', @@ -27,3 +31,4 @@ mirror.model({ }); + From 56fd54961c539eefc95c75438994f7947550891c Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 11:24:44 +0800 Subject: [PATCH 011/890] update code for new pr --- types/mirrorx/mirrorx-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/mirrorx/mirrorx-tests.ts b/types/mirrorx/mirrorx-tests.ts index 57e16f9321..79c9e581c1 100644 --- a/types/mirrorx/mirrorx-tests.ts +++ b/types/mirrorx/mirrorx-tests.ts @@ -7,6 +7,7 @@ import { render,actions,withRouter,Link,NavLink,Router,Route,connect,Redirect} f /** * add mirror.model.tests + * */ mirror.model({ name:'app', From 34b79a66c003c4bd59523807e9faccfef5c9661c Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 11:32:07 +0800 Subject: [PATCH 012/890] update the tsconfig.json --- types/mirrorx/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/tsconfig.json b/types/mirrorx/tsconfig.json index bc994b8f74..c6dab55976 100644 --- a/types/mirrorx/tsconfig.json +++ b/types/mirrorx/tsconfig.json @@ -1,7 +1,7 @@ { "files": [ "index.d.ts", - "mirrorx_test.ts" + "mirrorx-tests.ts" ], "compilerOptions": { "module": "commonjs", From 944c7e079575e91f40891e0134d180716d29ed16 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 11:38:52 +0800 Subject: [PATCH 013/890] remove the dev --- types/mirrorx/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/package.json b/types/mirrorx/package.json index ee406466f8..fb14dbd95e 100644 --- a/types/mirrorx/package.json +++ b/types/mirrorx/package.json @@ -1,6 +1,6 @@ { "private": true, - "dependencies": { + "devDependencies": { "@types/react":"^16.0.0", "@types/react-dom":"^16.0.0", "@types/react-router-dom":"^4.2.3", From 5713b4e99389519be29dcd445b6ae312612c946e Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 11:42:28 +0800 Subject: [PATCH 014/890] update code for remove @types --- types/mirrorx/package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/mirrorx/package.json b/types/mirrorx/package.json index fb14dbd95e..b390246ac3 100644 --- a/types/mirrorx/package.json +++ b/types/mirrorx/package.json @@ -1,11 +1,11 @@ { "private": true, "devDependencies": { - "@types/react":"^16.0.0", - "@types/react-dom":"^16.0.0", - "@types/react-router-dom":"^4.2.3", - "@types/redux":"^3.6.0", - "@types/react-redux":"^5.0.14", - "@types/react-router-redux":"^5.0.10" + "react":"^16.0.0", + "react-dom":"^16.0.0", + "react-router-dom":"^4.2.3", + "redux":"^3.6.0", + "react-redux":"^5.0.14", + "react-router-redux":"^5.0.10" } } \ No newline at end of file From 232e20c614033ca44821884600016f959fa3c658 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 11:45:48 +0800 Subject: [PATCH 015/890] ass dependecies --- types/mirrorx/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/package.json b/types/mirrorx/package.json index b390246ac3..1ad45d6701 100644 --- a/types/mirrorx/package.json +++ b/types/mirrorx/package.json @@ -1,6 +1,6 @@ { "private": true, - "devDependencies": { + "dependencies": { "react":"^16.0.0", "react-dom":"^16.0.0", "react-router-dom":"^4.2.3", From d818809206f188fc42ff9cb370c1ee7170dd082b Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 11:48:51 +0800 Subject: [PATCH 016/890] remove react de --- types/mirrorx/package.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/types/mirrorx/package.json b/types/mirrorx/package.json index 1ad45d6701..63eb9221f9 100644 --- a/types/mirrorx/package.json +++ b/types/mirrorx/package.json @@ -1,11 +1,6 @@ { "private": true, "dependencies": { - "react":"^16.0.0", - "react-dom":"^16.0.0", - "react-router-dom":"^4.2.3", - "redux":"^3.6.0", - "react-redux":"^5.0.14", - "react-router-redux":"^5.0.10" + "redux":"^3.6.0" } } \ No newline at end of file From 7f34cb2f66f1b5fdce83d84d11deaf73d75dca99 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 12:02:10 +0800 Subject: [PATCH 017/890] update the dependencies --- types/mirrorx/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/package.json b/types/mirrorx/package.json index 63eb9221f9..b8e8fb1e35 100644 --- a/types/mirrorx/package.json +++ b/types/mirrorx/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "redux":"^3.6.0" + "mirrorx":"^0.2.10" } } \ No newline at end of file From c687f9ca319d15b98a591e658af8a540b6b47932 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 12:07:45 +0800 Subject: [PATCH 018/890] upate code for de --- types/mirrorx/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/package.json b/types/mirrorx/package.json index b8e8fb1e35..6cceba467a 100644 --- a/types/mirrorx/package.json +++ b/types/mirrorx/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "mirrorx":"^0.2.10" + "redux":"^3.7.2" } } \ No newline at end of file From d451a47ce552525b7d33232d9d03221e77a16e96 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 12:10:39 +0800 Subject: [PATCH 019/890] remove the package.json --- types/mirrorx/README.md | 1 - types/mirrorx/package.json | 6 ------ 2 files changed, 7 deletions(-) delete mode 100644 types/mirrorx/README.md delete mode 100644 types/mirrorx/package.json diff --git a/types/mirrorx/README.md b/types/mirrorx/README.md deleted file mode 100644 index a4bce407a2..0000000000 --- a/types/mirrorx/README.md +++ /dev/null @@ -1 +0,0 @@ -This is typings for [mirrorjs](https://github.com/mirrorjs/mirror) \ No newline at end of file diff --git a/types/mirrorx/package.json b/types/mirrorx/package.json deleted file mode 100644 index 6cceba467a..0000000000 --- a/types/mirrorx/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "redux":"^3.7.2" - } -} \ No newline at end of file From ab4d095b2c467f9849fc4e7310e931979453ff88 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 12:23:37 +0800 Subject: [PATCH 020/890] update code for refference --- types/mirrorx/index.d.ts | 5 +++++ types/mirrorx/mirrorx-tests.ts | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 5720677bfe..d0755b1194 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -4,6 +4,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +/// +/// +/// +/// + import * as React from 'react'; import * as H from 'history'; import { diff --git a/types/mirrorx/mirrorx-tests.ts b/types/mirrorx/mirrorx-tests.ts index 79c9e581c1..0cfe58b358 100644 --- a/types/mirrorx/mirrorx-tests.ts +++ b/types/mirrorx/mirrorx-tests.ts @@ -1,6 +1,3 @@ -import { Component, ReactElement } from 'react'; -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; import * as mirror from 'mirrorx'; import { render,actions,withRouter,Link,NavLink,Router,Route,connect,Redirect} from 'mirrorx' From 732e32254cfdf310049fc5439a5149e2703bd75f Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 12:29:45 +0800 Subject: [PATCH 021/890] update code for typescript --- types/mirrorx/index.d.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index d0755b1194..a286559ca0 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -2,12 +2,7 @@ // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// -/// -/// -/// +// TypeScript Version: 2.4 import * as React from 'react'; import * as H from 'history'; From 269c14933782ca4a88f681f5619f9c46127fbf3a Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 12:56:43 +0800 Subject: [PATCH 022/890] update code for new --- types/mirrorx/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index a286559ca0..8b1cc26416 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.3 import * as React from 'react'; import * as H from 'history'; From db9f2f17a6f988c473dabd6bdd5db10ee3a90b08 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 13:15:03 +0800 Subject: [PATCH 023/890] update code for ts version --- types/mirrorx/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 8b1cc26416..abe6f2d496 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.2 import * as React from 'react'; import * as H from 'history'; From fc38ac1720d03e53cbcef8f5e6b5e90e7657fe05 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 13:35:13 +0800 Subject: [PATCH 024/890] typescript version --- types/mirrorx/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index abe6f2d496..37805d4bac 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.0 import * as React from 'react'; import * as H from 'history'; From 952a9db4b3fffbf580ca3a485ee74a0083412b01 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 13:44:25 +0800 Subject: [PATCH 025/890] updat code for ts version --- types/mirrorx/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 37805d4bac..2c07f1008b 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.0 +// TypeScript Version: 2.6 import * as React from 'react'; import * as H from 'history'; From ee98bdd185dd4fd886f3453de3191e5f1408265d Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 13:51:02 +0800 Subject: [PATCH 026/890] react ts --- types/mirrorx/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 2c07f1008b..4c1da1e750 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 1.9 import * as React from 'react'; import * as H from 'history'; From d817b64e821bafd61d6c4e359676811939404715 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 13:57:44 +0800 Subject: [PATCH 027/890] update code for ts version --- types/mirrorx/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 4c1da1e750..ad87c2f9ce 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 1.9 +// TypeScript Version: 1.0 import * as React from 'react'; import * as H from 'history'; From 939a36fe561970db57c899e25aa5e5c7062f54a6 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 14:31:46 +0800 Subject: [PATCH 028/890] update code for ts version --- types/mirrorx/index.d.ts | 2 +- types/mirrorx/mirrorx-tests.ts | 7 +-- types/mirrorx/tslint.json | 78 +++++++++++++++++++++++++++++++++- 3 files changed, 81 insertions(+), 6 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index ad87c2f9ce..fef4b74ec9 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 1.0 +// TypeScript Version: 2.1 import * as React from 'react'; import * as H from 'history'; diff --git a/types/mirrorx/mirrorx-tests.ts b/types/mirrorx/mirrorx-tests.ts index 0cfe58b358..98d1a2e94e 100644 --- a/types/mirrorx/mirrorx-tests.ts +++ b/types/mirrorx/mirrorx-tests.ts @@ -1,7 +1,8 @@ +import { Component, ReactElement } from 'react'; +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; import * as mirror from 'mirrorx'; -import { render,actions,withRouter,Link,NavLink,Router,Route,connect,Redirect} from 'mirrorx' - - +import { render,actions,withRouter,Link,NavLink,Router,Route,connect,Redirect} from 'mirrorx'; /** * add mirror.model.tests * diff --git a/types/mirrorx/tslint.json b/types/mirrorx/tslint.json index f7a71e1866..db6c870b64 100644 --- a/types/mirrorx/tslint.json +++ b/types/mirrorx/tslint.json @@ -1,7 +1,81 @@ { - "extends": ["tslint:latest", "tslint-react"], + "extends": "dtslint/dt.json", "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, "no-unnecessary-generics": false, - "jsx-wrap-multiline": false + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-object-spread": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "use-default-type-parameter": false, + "void-return": false, + "whitespace": false } } \ No newline at end of file From ef68bf75d342b9d36da1c594be880964db23131a Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 16:22:42 +0800 Subject: [PATCH 029/890] update the ts versin --- types/mirrorx/index.d.ts | 2 +- types/mirrorx/mirrorx-tests.ts | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index fef4b74ec9..1ffcd20925 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.4 import * as React from 'react'; import * as H from 'history'; diff --git a/types/mirrorx/mirrorx-tests.ts b/types/mirrorx/mirrorx-tests.ts index 98d1a2e94e..51f30d5f40 100644 --- a/types/mirrorx/mirrorx-tests.ts +++ b/types/mirrorx/mirrorx-tests.ts @@ -2,21 +2,17 @@ import { Component, ReactElement } from 'react'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; import * as mirror from 'mirrorx'; -import { render,actions,withRouter,Link,NavLink,Router,Route,connect,Redirect} from 'mirrorx'; /** * add mirror.model.tests * */ mirror.model({ name:'app', - initialState: 0, - reducers:{ increment(state:any) { return state + 1 }, decrement(state:any) { return state - 1 } }, - effects:{ async incrementAsync() { await new Promise((resolve, reject) => { From 98c1e46910232926a3129ac1056aa8e0fbe10d8f Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 11 Dec 2017 16:27:58 +0800 Subject: [PATCH 030/890] update code for mirrorx --- types/mirrorx/mirrorx-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/mirrorx/mirrorx-tests.ts b/types/mirrorx/mirrorx-tests.ts index 51f30d5f40..7a571b2497 100644 --- a/types/mirrorx/mirrorx-tests.ts +++ b/types/mirrorx/mirrorx-tests.ts @@ -2,6 +2,7 @@ import { Component, ReactElement } from 'react'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; import * as mirror from 'mirrorx'; +import { render,actions,withRouter,Link,NavLink,Router,Route,connect,Redirect} from 'mirrorx'; /** * add mirror.model.tests * From 8d49cf6705f6debd70ea8389408b3a2181cceff7 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 12 Dec 2017 11:18:57 +0800 Subject: [PATCH 031/890] fix the code review --- types/mirrorx/index.d.ts | 2 +- types/mirrorx/tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 1ffcd20925..9cea8531dc 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -124,7 +124,7 @@ declare namespace mirror { interface defaultOptions { initialState?:{}, historyMode?:string, - middlewares:[any], + middlewares:any[], reducers:{}, addEffect(name:string,handler:()=>any):any } diff --git a/types/mirrorx/tsconfig.json b/types/mirrorx/tsconfig.json index c6dab55976..561f5cdab4 100644 --- a/types/mirrorx/tsconfig.json +++ b/types/mirrorx/tsconfig.json @@ -11,7 +11,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "jsx": "react", From 0dc16819cc65f955bb5be11a4970a856a735375c Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Wed, 13 Dec 2017 11:39:02 +0800 Subject: [PATCH 032/890] update code for new code --- types/mirrorx/tslint.json | 152 +++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/types/mirrorx/tslint.json b/types/mirrorx/tslint.json index db6c870b64..77cc132a9e 100644 --- a/types/mirrorx/tslint.json +++ b/types/mirrorx/tslint.json @@ -1,81 +1,81 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-object-spread": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "use-default-type-parameter": false, - "void-return": false, - "whitespace": false + "adjacent-overload-signatures": true, + "array-type": true, + "arrow-return-shorthand": true, + "ban-types": true, + "callable-types": true, + "comment-format": true, + "dt-header": true, + "eofline": true, + "export-just-namespace": true, + "import-spacing": true, + "interface-name": true, + "interface-over-type-literal": true, + "jsdoc-format": true, + "max-line-length": true, + "member-access": true, + "new-parens": true, + "no-any-union": true, + "no-boolean-literal-compare": true, + "no-conditional-assignment": true, + "no-consecutive-blank-lines": true, + "no-construct": true, + "no-declare-current-package": true, + "no-duplicate-imports": true, + "no-duplicate-variable": true, + "no-empty-interface": true, + "no-for-in-array": true, + "no-inferrable-types": true, + "no-internal-module": true, + "no-irregular-whitespace": true, + "no-mergeable-namespace": true, + "no-misused-new": true, + "no-namespace": true, + "no-object-literal-type-assertion": true, + "no-padding": true, + "no-redundant-jsdoc": true, + "no-redundant-jsdoc-2": true, + "no-redundant-undefined": true, + "no-reference-import": true, + "no-relative-import-in-test": true, + "no-self-import": true, + "no-single-declare-module": true, + "no-string-throw": true, + "no-unnecessary-callback-wrapper": true, + "no-unnecessary-class": true, + "no-unnecessary-generics": true, + "no-unnecessary-qualifier": true, + "no-unnecessary-type-assertion": true, + "no-useless-files": true, + "no-var-keyword": true, + "no-var-requires": true, + "no-void-expression": true, + "no-trailing-whitespace": true, + "object-literal-key-quotes": true, + "object-literal-shorthand": true, + "one-line": true, + "one-variable-per-declaration": true, + "only-arrow-functions": true, + "prefer-conditional-expression": true, + "prefer-const": true, + "prefer-declare-function": true, + "prefer-for-of": true, + "prefer-method-signature": true, + "prefer-object-spread": true, + "prefer-template": true, + "radix": true, + "semicolon": true, + "space-before-function-paren": true, + "space-within-parens": true, + "strict-export-declare-modifiers": true, + "trim-file": true, + "triple-equals": true, + "typedef-whitespace": true, + "unified-signatures": true, + "use-default-type-parameter": true, + "void-return": true, + "whitespace": true } } \ No newline at end of file From bd202bef484f14e91c83c53a906837c57051a08d Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Wed, 13 Dec 2017 08:24:20 +0100 Subject: [PATCH 033/890] added RetryOptions in auth0 --- types/auth0/index.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index 12829b5b67..1470de60c4 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -14,6 +14,7 @@ export interface ManagementClientOptions { audience?: string; scope?: string; tokenProvider?: TokenProvider; + retry?: RetryOptions; } export interface TokenProvider { @@ -21,6 +22,17 @@ export interface TokenProvider { cacheTTLInSeconds?: number; } +export interface RetryOptions { + /** + * Default value is `true`. + */ + enabled?: boolean; + /** + * Default value is `10`. + */ + maxRetries?: number; +} + export interface UserMetadata { } export interface AppMetadata { } From 203a292d174d75bff9984b1e70a22047f5dac760 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Wed, 13 Dec 2017 15:52:34 +0800 Subject: [PATCH 034/890] turn on the rules --- types/mirrorx/tslint.json | 74 +-------------------------------------- 1 file changed, 1 insertion(+), 73 deletions(-) diff --git a/types/mirrorx/tslint.json b/types/mirrorx/tslint.json index 77cc132a9e..9b48672d6c 100644 --- a/types/mirrorx/tslint.json +++ b/types/mirrorx/tslint.json @@ -1,81 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": true, - "array-type": true, - "arrow-return-shorthand": true, - "ban-types": true, - "callable-types": true, - "comment-format": true, - "dt-header": true, - "eofline": true, - "export-just-namespace": true, "import-spacing": true, - "interface-name": true, "interface-over-type-literal": true, - "jsdoc-format": true, "max-line-length": true, - "member-access": true, - "new-parens": true, - "no-any-union": true, - "no-boolean-literal-compare": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": true, - "no-construct": true, - "no-declare-current-package": true, - "no-duplicate-imports": true, - "no-duplicate-variable": true, - "no-empty-interface": true, - "no-for-in-array": true, - "no-inferrable-types": true, - "no-internal-module": true, - "no-irregular-whitespace": true, - "no-mergeable-namespace": true, - "no-misused-new": true, - "no-namespace": true, - "no-object-literal-type-assertion": true, - "no-padding": true, - "no-redundant-jsdoc": true, - "no-redundant-jsdoc-2": true, - "no-redundant-undefined": true, - "no-reference-import": true, - "no-relative-import-in-test": true, - "no-self-import": true, - "no-single-declare-module": true, - "no-string-throw": true, - "no-unnecessary-callback-wrapper": true, - "no-unnecessary-class": true, - "no-unnecessary-generics": true, - "no-unnecessary-qualifier": true, - "no-unnecessary-type-assertion": true, - "no-useless-files": true, - "no-var-keyword": true, - "no-var-requires": true, - "no-void-expression": true, - "no-trailing-whitespace": true, - "object-literal-key-quotes": true, - "object-literal-shorthand": true, - "one-line": true, - "one-variable-per-declaration": true, - "only-arrow-functions": true, - "prefer-conditional-expression": true, - "prefer-const": true, - "prefer-declare-function": true, - "prefer-for-of": true, - "prefer-method-signature": true, - "prefer-object-spread": true, - "prefer-template": true, - "radix": true, - "semicolon": true, - "space-before-function-paren": true, - "space-within-parens": true, - "strict-export-declare-modifiers": true, - "trim-file": true, - "triple-equals": true, - "typedef-whitespace": true, - "unified-signatures": true, - "use-default-type-parameter": true, - "void-return": true, - "whitespace": true + "member-access": true } } \ No newline at end of file From da53438dd21420f165a3ed66b864fa54830510cc Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Wed, 13 Dec 2017 16:04:10 +0800 Subject: [PATCH 035/890] change the tslint --- types/mirrorx/mirrorx-tests.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/types/mirrorx/mirrorx-tests.ts b/types/mirrorx/mirrorx-tests.ts index 7a571b2497..7d90c97b68 100644 --- a/types/mirrorx/mirrorx-tests.ts +++ b/types/mirrorx/mirrorx-tests.ts @@ -1,8 +1,7 @@ -import { Component, ReactElement } from 'react'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; import * as mirror from 'mirrorx'; -import { render,actions,withRouter,Link,NavLink,Router,Route,connect,Redirect} from 'mirrorx'; +import { actions } from 'mirrorx'; /** * add mirror.model.tests * @@ -18,10 +17,10 @@ mirror.model({ async incrementAsync() { await new Promise((resolve, reject) => { setTimeout(() => { - resolve() + resolve(); }, 1000) }) - actions.app.increment() + actions.app.increment(); } } }); From d3ca9be002076cb0101ce1185a8cff2717d6cec7 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Wed, 13 Dec 2017 16:18:31 +0800 Subject: [PATCH 036/890] turn off the tslint --- types/mirrorx/tslint.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/types/mirrorx/tslint.json b/types/mirrorx/tslint.json index 9b48672d6c..790ed12b0f 100644 --- a/types/mirrorx/tslint.json +++ b/types/mirrorx/tslint.json @@ -4,6 +4,16 @@ "import-spacing": true, "interface-over-type-literal": true, "max-line-length": true, - "member-access": true + "member-access": true, + "no-trailing-whitespace":false, + "whitespace":false, + "semicolon":false, + "no-duplicate-imports":false, + "export-just-namespace":false, + "no-unnecessary-generics":false, + "typedef-whitespace":false, + "no-consecutive-blank-lines":false, + "trim-file":false, + "prefer-declare-function":"prefer-declare-function" } } \ No newline at end of file From d5693c93f38cb443611b3915b8ab3cf8a95aa179 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Wed, 13 Dec 2017 19:58:03 +0800 Subject: [PATCH 037/890] update code for new code --- types/mirrorx/tslint.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/mirrorx/tslint.json b/types/mirrorx/tslint.json index 790ed12b0f..a29191565d 100644 --- a/types/mirrorx/tslint.json +++ b/types/mirrorx/tslint.json @@ -14,6 +14,12 @@ "typedef-whitespace":false, "no-consecutive-blank-lines":false, "trim-file":false, - "prefer-declare-function":"prefer-declare-function" + "prefer-declare-function":false, + "dt-header":false, + "no-padding":false, + "no-redundant-jsdoc-2":false, + "comment-format":false, + "eofline":false, + "strict-export-declare-modifiers":false } } \ No newline at end of file From 7de58334ac8ceaf8d0d558f3c83b5ff60c5684d9 Mon Sep 17 00:00:00 2001 From: Nicholas Boll Date: Wed, 13 Dec 2017 15:34:25 -0700 Subject: [PATCH 038/890] fix(chai-jquery): Fix assertions that deviate from other assertions This was causing an issue with `chai-enzyme` types. I'm not sure why these 4 assertion methods deviated from the style of the rest of assertion methods --- types/chai-jquery/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/chai-jquery/index.d.ts b/types/chai-jquery/index.d.ts index e1628f1743..a5ed7aadbd 100644 --- a/types/chai-jquery/index.d.ts +++ b/types/chai-jquery/index.d.ts @@ -10,10 +10,10 @@ declare namespace Chai { interface Assertion { - attr: (name: string, value?: string) => Assertion; - prop: (name: string, value?: any) => Assertion; - css: (name: string, value?: string) => Assertion; - data: (name: string, value?: string) => Assertion; + attr(name: string, value?: string): Assertion; + prop(name: string, value?: any): Assertion; + css(name: string, value?: string): Assertion; + data(name: string, value?: string): Assertion; class(className: string): Assertion; id(id: string): Assertion; html(html: string): Assertion; From ebe2876998c5e45565a6cf920b84427cee0dda87 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Thu, 14 Dec 2017 14:28:29 +0800 Subject: [PATCH 039/890] add tslint --- types/mirrorx/mirrorx-tests.ts | 21 ++++++++------------- types/mirrorx/tsconfig.json | 2 +- types/mirrorx/tslint.json | 24 +----------------------- 3 files changed, 10 insertions(+), 37 deletions(-) diff --git a/types/mirrorx/mirrorx-tests.ts b/types/mirrorx/mirrorx-tests.ts index 7d90c97b68..11f1af29da 100644 --- a/types/mirrorx/mirrorx-tests.ts +++ b/types/mirrorx/mirrorx-tests.ts @@ -1,29 +1,24 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import * as mirror from 'mirrorx'; -import { actions } from 'mirrorx'; +import mirror, { actions } from 'mirrorx'; /** * add mirror.model.tests - * */ mirror.model({ - name:'app', + name: 'app', initialState: 0, - reducers:{ - increment(state:any) { return state + 1 }, - decrement(state:any) { return state - 1 } + reducers: { + increment(state: any) { return state + 1; }, + decrement(state: any) { return state - 1; } }, - effects:{ + effects: { async incrementAsync() { await new Promise((resolve, reject) => { setTimeout(() => { resolve(); - }, 1000) - }) + }, 1000); + }); actions.app.increment(); } } }); - - - diff --git a/types/mirrorx/tsconfig.json b/types/mirrorx/tsconfig.json index 561f5cdab4..8ca8985f1d 100644 --- a/types/mirrorx/tsconfig.json +++ b/types/mirrorx/tsconfig.json @@ -19,7 +19,7 @@ "typeRoots": [ "../" ], - "types": [], + "types": ["types"], "noEmit": true, "forceConsistentCasingInFileNames": true } diff --git a/types/mirrorx/tslint.json b/types/mirrorx/tslint.json index a29191565d..e60c15844f 100644 --- a/types/mirrorx/tslint.json +++ b/types/mirrorx/tslint.json @@ -1,25 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "import-spacing": true, - "interface-over-type-literal": true, - "max-line-length": true, - "member-access": true, - "no-trailing-whitespace":false, - "whitespace":false, - "semicolon":false, - "no-duplicate-imports":false, - "export-just-namespace":false, - "no-unnecessary-generics":false, - "typedef-whitespace":false, - "no-consecutive-blank-lines":false, - "trim-file":false, - "prefer-declare-function":false, - "dt-header":false, - "no-padding":false, - "no-redundant-jsdoc-2":false, - "comment-format":false, - "eofline":false, - "strict-export-declare-modifiers":false - } + "extends": "dtslint/dt.json" } \ No newline at end of file From d384da9dde266644920ed3dca880e78868d2559e Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Thu, 14 Dec 2017 14:34:19 +0800 Subject: [PATCH 040/890] update code for remove types --- types/mirrorx/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mirrorx/tsconfig.json b/types/mirrorx/tsconfig.json index 8ca8985f1d..561f5cdab4 100644 --- a/types/mirrorx/tsconfig.json +++ b/types/mirrorx/tsconfig.json @@ -19,7 +19,7 @@ "typeRoots": [ "../" ], - "types": ["types"], + "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true } From 8b93073673ab748f5d1d3dfb382016da1f96f0c5 Mon Sep 17 00:00:00 2001 From: Dasa Paddock Date: Thu, 14 Dec 2017 11:28:36 -0800 Subject: [PATCH 041/890] Update for ArcGIS API for JavaScript version 3.23 --- types/arcgis-js-api/v3/index.d.ts | 63 +++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/types/arcgis-js-api/v3/index.d.ts b/types/arcgis-js-api/v3/index.d.ts index de4328a957..9d3126ee63 100644 --- a/types/arcgis-js-api/v3/index.d.ts +++ b/types/arcgis-js-api/v3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ArcGIS API for JavaScript 3.22 +// Type definitions for ArcGIS API for JavaScript 3.23 // Project: https://developers.arcgis.com/javascript/3/ // Definitions by: Esri // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -478,6 +478,10 @@ declare module "esri" { zoomOptions?: any; } export interface ColorPickerOptions { + /** Indicates whether the widget displays collapsed. */ + collapsed?: boolean; + /** Indicates whether the widget can be collapsed. */ + collapsible?: boolean; /** The selected color. */ color: Color; /** The row size of the palette. */ @@ -1830,8 +1834,10 @@ declare module "esri" { whereFields: any; } export interface QueryTaskOptions { - /** Specify the geodatabase version to display. */ + /** The geodatabase version to display. */ gdbVersion?: string; + /** The dynamic layer or table source. */ + source?: LayerSource; } export interface RasterLayerOptions { /** Sets the layer's draw mode. */ @@ -3852,6 +3858,10 @@ declare module "esri/dijit/ColorPicker" { /** A widget to assist choosing a color from a color palette. */ class ColorPicker { + /** Indicates whether the widget displays collapsed. */ + collapsed: boolean; + /** Indicates whether the widget is collapsible. */ + collapsible: boolean; /** The selected color. */ color: Color; /** The set of available color options. */ @@ -8158,9 +8168,9 @@ declare module "esri/geometry/geometryEngine" { */ nearestVertices(geometry: Geometry, inputPoint: Point, searchRadius: number, maxVertexCountToReturn: number): any[]; /** - * Creates offset version of the input geometry. + * The offset operation creates a geometry that is a constant planar distance from an input polyline or polygon. * @param geometry The geometries to offset. - * @param offsetDistance The offset distance for the Geometries. + * @param offsetDistance The planar distance to offset from the input geometry. * @param offsetUnit Measurement unit for the offset. * @param joinType The join type. * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. @@ -8401,9 +8411,9 @@ declare module "esri/geometry/geometryEngineAsync" { */ nearestVertices(geometry: Geometry, inputPoint: Point, searchRadius: number, maxVertexCountToReturn: number): any; /** - * Creates offset version of the input geometry. + * The offset operation creates a geometry that is a constant planar distance from an input polyline or polygon. * @param geometry The geometries to offset. - * @param offsetDistance The offset distance for the Geometries. + * @param offsetDistance The planar distance to offset from the input geometry. * @param offsetUnit Measurement unit for the offset. * @param joinType The join type. * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. @@ -8691,11 +8701,8 @@ declare module "esri/graphic" { clone(): Graphic; /** Draws the graphic. */ draw(): Graphic; - /** - * Returns the graphics summarized by the given aggregate graphic in a clustering or feature reduction visualization. - * @param aggregateGraphic A graphic representing the aggregation (or reduction) of several individual graphics in a layer. - */ - getChildGraphics(aggregateGraphic: Graphic): Graphic[]; + /** Returns the graphics summarized by an aggregate graphic in a clustering or feature reduction visualization. */ + getChildGraphics(): Graphic[]; /** Returns the content string based on attributes and infoTemplate values. */ getContent(): string; /** Returns the dojo/gfx/shape.Shape of the Esri graphic. */ @@ -13588,6 +13595,20 @@ declare module "esri/request" { export = request; } +declare module "esri/support/expressionUtils" { + /** A utility module that allows you to enable geometry operations referenced inside Arcade expressions. */ + var expressionUtils: { + /** Loads all geometry operations for use in any Arcade expression within the given application. */ + enableGeometryOperations(): any; + /** + * Indicates if the given Arcade expression contains one or more geometry operations. + * @param expression The Arcade expression to evaluate for the presence of one or more geometry operations. + */ + hasGeometryOperations(expression: string): boolean; + }; + export = expressionUtils; +} + declare module "esri/symbols/CartographicLineSymbol" { import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); import Color = require("esri/Color"); @@ -13718,7 +13739,7 @@ declare module "esri/symbols/Font" { size: number; /** Text style. */ style: string; - /** Text variant. */ + /** Text variant (deprecated). */ variant: string; /** Text weight. */ weight: string; @@ -13759,7 +13780,7 @@ declare module "esri/symbols/Font" { */ setStyle(style: string): Font; /** - * Sets the font variant. + * Sets the font variant (deprecated). * @param variant Font variant. */ setVariant(variant: string): Font; @@ -14018,6 +14039,8 @@ declare module "esri/symbols/SimpleLineSymbol" { static STYLE_SHORTDOT: any; /** The line is solid. */ static STYLE_SOLID: any; + /** Indicates marker symbols present at the beginning and/or end of a SimpleLineSymbol. */ + marker: any; /** The line style. */ style: string; /** Creates a new empty SimpleLineSymbol object. */ @@ -14034,6 +14057,11 @@ declare module "esri/symbols/SimpleLineSymbol" { * @param json JSON object representing the SimpleLineSymbol. */ constructor(json: Object); + /** + * Sets marker symbols at the beginning and/or end of a SimpleLineSymbol. + * @param options The options defining the marker style and placement. + */ + setMarker(options: any): void; /** * Sets the line symbol style. * @param style Line style. @@ -15038,7 +15066,7 @@ declare module "esri/tasks/GeometryService" { */ lengths(lengthsParameter: LengthsParameters, callback?: Function, errback?: Function): any; /** - * Constructs the offset of the input geometries. + * Constructs the offset of the input geometries based on a planar distance. * @param params Set the geometries to offset, distance and units. * @param callback The function to call when the method has completed. * @param errback An error object is returned if an error occurs during task execution. @@ -15680,7 +15708,7 @@ declare module "esri/tasks/OffsetParameters" { bevelRatio: number; /** The array of geometries to be offset. */ geometries: Geometry[]; - /** Specifies the distance for constructing an offset based on the input geometries. */ + /** Specifies the planar distance for constructing an offset based on the input geometries. */ offsetDistance: number; /** Options that determine how the ends intersect. */ offsetHow: string; @@ -15806,12 +15834,17 @@ declare module "esri/tasks/ProjectParameters" { declare module "esri/tasks/QueryTask" { import esri = require("esri"); + import LayerSource = require("esri/layers/LayerSource"); import Query = require("esri/tasks/query"); import RelationshipQuery = require("esri/tasks/RelationshipQuery"); import FeatureSet = require("esri/tasks/FeatureSet"); /** Executes a query operation on a layer resource of a map service exposed by the ArcGIS Server REST API. */ class QueryTask { + /** The geodatabase version to display. */ + gdbVersion: string; + /** The dynamic layer or table source. */ + source: LayerSource; /** URL to the ArcGIS Server REST resource that represents a map service layer. */ url: string; /** From 6092201a8b488adcbe5524770e209ce641c06207 Mon Sep 17 00:00:00 2001 From: ywceric Date: Fri, 15 Dec 2017 11:46:21 +0000 Subject: [PATCH 042/890] [cassandra-driver] Add signature for Promise-based connect/shutdown --- types/cassandra-driver/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/cassandra-driver/index.d.ts b/types/cassandra-driver/index.d.ts index bdaed6559c..5c0578ccf2 100644 --- a/types/cassandra-driver/index.d.ts +++ b/types/cassandra-driver/index.d.ts @@ -513,6 +513,7 @@ export interface Client extends events.EventEmitter { batch(queries: Array | Array<{ query: string, params?: any }>, options?: QueryOptions): Promise; connect(callback: Callback): void; + connect(): Promise; eachRow(query: string, params?: any, options?: QueryOptions, rowCallback?: Callback, callback?: Callback): void; execute(query: string, params: any, options: QueryOptions, callback: ResultCallback): void; execute(query: string, params: any, callback: ResultCallback): void; @@ -520,6 +521,7 @@ export interface Client extends events.EventEmitter { execute(query: string, params?: any, options?: QueryOptions): Promise; getReplicas(keyspace: string, token: Buffer): Array; // TODO: Should this be a more explicit return? shutdown(callback?: Callback): void; + shutdown(): Promise; stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): NodeJS.ReadableStream; } From 4364b887d1dcbba59c9b2911f23717ffc712a0ea Mon Sep 17 00:00:00 2001 From: Dmitry Zakharov Date: Fri, 15 Dec 2017 17:59:48 +0300 Subject: [PATCH 043/890] dc-js add selectMenu --- types/dc/index.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/types/dc/index.d.ts b/types/dc/index.d.ts index 62fbd8330c..69ee20a93e 100644 --- a/types/dc/index.d.ts +++ b/types/dc/index.d.ts @@ -417,6 +417,16 @@ declare namespace dc { tickFormat: IGetSet, BoxPlot>; } + // https://github.com/dc-js/dc.js/blob/master/src/select-menu.js + export interface SelectMenu extends BaseMixin { + order: IGetSet<(a: any, b: any) => number, SelectMenu>; + promptText: IGetSet; + filterDisplayed: IGetSet<(a: {value: any, key: any}, index: number) => boolean, SelectMenu>; + multiple: IGetSet; + promptValue: IGetSet; + numberVisible: IGetSet; + } + export interface ChartRegistry { has(chart: BaseMixin): boolean; register(chart: BaseMixin, group?: string): void; @@ -472,5 +482,6 @@ declare namespace dc { numberDisplay(parent: string, chartGroup?: string): NumberDisplayWidget; heatMap(parent: string, chartGroup?: string): HeatMap; boxPlot(parent: string, chartGroup?: string): BoxPlot; + selectMenu(parent: string, chartGroup?: string): SelectMenu; } } \ No newline at end of file From dac66d0de306a9598cce805830113bde92af3133 Mon Sep 17 00:00:00 2001 From: Jacob Froman Date: Fri, 15 Dec 2017 10:00:21 -0600 Subject: [PATCH 044/890] Add style prop CommonApiProps --- types/rc-slider/README.md | 2 +- types/rc-slider/index.d.ts | 6 ++++++ types/rc-slider/rc-slider-tests.tsx | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/types/rc-slider/README.md b/types/rc-slider/README.md index f51d31a6b6..622c75a90e 100644 --- a/types/rc-slider/README.md +++ b/types/rc-slider/README.md @@ -5,7 +5,7 @@ This package contains type definitions for rc-slider (https://github.com/react-component/slider). Additional Details - * Last updated: Tue, 24 Oct 2017 + * Last updated: Fri, 15 Dec 2017 * Dependencies: react * Global values: none diff --git a/types/rc-slider/index.d.ts b/types/rc-slider/index.d.ts index f64ae8c03c..f2010b3ec9 100644 --- a/types/rc-slider/index.d.ts +++ b/types/rc-slider/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Marcinkus Mantas // Alexander Mattoni // Austin Turner +// Jacob Froman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -91,6 +92,11 @@ export interface CommonApiProps { */ tipFormatter?: ((value: any) => any | undefined) | null; + /** + * The style used for the background and container. (both for slider(Object) and range(Array of Object), the array will be used for mutli handle follow element order) + */ + style?: React.CSSProperties[] | React.CSSProperties; + /** * The style used for handle. (both for slider(Object) and range(Array of Object), the array will be used for mutli handle follow element order) */ diff --git a/types/rc-slider/rc-slider-tests.tsx b/types/rc-slider/rc-slider-tests.tsx index 84c9997be6..e08a674dca 100644 --- a/types/rc-slider/rc-slider-tests.tsx +++ b/types/rc-slider/rc-slider-tests.tsx @@ -35,6 +35,7 @@ ReactDOM.render( onAfterChange={() => { }} defaultValue={0.1} value={0.1} + style={{backgroundColor: 'plum'}} dotStyle={{backgroundColor: 'antiquewhite'}} activeDotStyle={{backgroundColor: 'antiquewhite'}} />, From f1297338e26a914fa2787bea66756cb994c75958 Mon Sep 17 00:00:00 2001 From: chibi929 Date: Sat, 16 Dec 2017 02:17:32 +0900 Subject: [PATCH 045/890] Add event method of webspeechapi. --- types/webspeechapi/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/webspeechapi/index.d.ts b/types/webspeechapi/index.d.ts index 3041c778b4..a7aae15987 100644 --- a/types/webspeechapi/index.d.ts +++ b/types/webspeechapi/index.d.ts @@ -25,6 +25,7 @@ interface SpeechRecognition extends EventTarget { onspeechstart: (ev: Event) => any; onspeechend: (ev: Event) => any; onsoundend: (ev: Event) => any; + onaudioend: (ev: Event) => any; onresult: (ev: SpeechRecognitionEvent) => any; onnomatch: (ev: SpeechRecognitionEvent) => any; onerror: (ev: SpeechRecognitionError) => any; From d571b322e603c3bd511c0d7f6b05a8c06e2ba4cb Mon Sep 17 00:00:00 2001 From: Farouk Abdou Date: Fri, 15 Dec 2017 21:10:00 +0100 Subject: [PATCH 046/890] Corrections on InterleavedBuffer and InterleavedBufferAttribute --- types/three/three-core.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 7dd21783a8..a99875d771 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -1451,6 +1451,7 @@ export class InterleavedBuffer { count: number; needsUpdate: boolean; + setArray(array?: ArrayBufferView): void; setDynamic(dynamic: boolean): InterleavedBuffer; clone(): this; copy(source: this): this; @@ -1472,7 +1473,7 @@ export class InstancedInterleavedBuffer extends InterleavedBuffer { * @see src/core/InterleavedBufferAttribute.js */ export class InterleavedBufferAttribute { - constructor(interleavedBuffer: InterleavedBuffer, itemSize: number, offset: number, normalized: boolean); + constructor(interleavedBuffer: InterleavedBuffer, itemSize: number, offset: number, normalized?: boolean); uuid: string; data: InterleavedBuffer; From d8fab43698e560faa0320dbb45f6cb59bca057f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=BCmay=20=C3=87eber?= Date: Sat, 16 Dec 2017 02:09:52 +0300 Subject: [PATCH 047/890] Namespace 'passport' has no exported member 'Passport'. --- types/koa-passport/index.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/types/koa-passport/index.d.ts b/types/koa-passport/index.d.ts index 0a011a06d5..d00635a462 100644 --- a/types/koa-passport/index.d.ts +++ b/types/koa-passport/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rkusa/koa-passport // Definitions by: horiuchi // Tomek Łaziuk +// Tümay Çeber // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -46,9 +47,9 @@ declare namespace KoaPassport { authorize(strategy: string | string[], callback?: (...args: any[]) => any): Middleware; authorize(strategy: string | string[], options: any, callback?: (...args: any[]) => any): Middleware; - serializeUser: passport.Passport["serializeUser"]; - deserializeUser: passport.Passport["deserializeUser"]; - transformAuthInfo: passport.Passport["transformAuthInfo"]; + serializeUser: passport.Authenticator["serializeUser"]; + deserializeUser: passport.Authenticator["deserializeUser"]; + transformAuthInfo: passport.Authenticator["transformAuthInfo"]; } interface Static extends KoaPassport { From c079326a78fe4e79f5fb6c9463864f805a2094e3 Mon Sep 17 00:00:00 2001 From: Vaillant Samuel Date: Sat, 16 Dec 2017 15:10:45 +0100 Subject: [PATCH 048/890] fix(chrome): avoid implicit any on getDirectoryDeviceId --- types/chrome/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 9946c79c38..69abf9896d 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -2316,9 +2316,11 @@ declare namespace chrome.enterprise.deviceAttributes { /** * @description Fetches the value of the device identifier of the directory API, that is generated by the server and identifies the cloud record of the device for querying in the cloud directory API. * @export - * @param {(deviceId) => void} callback Called with the device identifier of the directory API when received. + * @param callback Called with the device identifier of the directory API when received. + * The callback parameter should be a function that looks like this: + * function(string deviceId) {...}; */ - export function getDirectoryDeviceId(callback: (deviceId) => void): void; + export function getDirectoryDeviceId(callback: (deviceId: string) => void): void; } //////////////////// From 8ca0141e56fc83a0817ee907fd3c3c0a28a7b346 Mon Sep 17 00:00:00 2001 From: 43081j <43081j@localhost> Date: Sat, 16 Dec 2017 18:19:36 +0000 Subject: [PATCH 049/890] add karma client options Fixes #22216 --- types/karma/index.d.ts | 14 ++++++++++++++ types/karma/karma-tests.ts | 14 +++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/types/karma/index.d.ts b/types/karma/index.d.ts index 3a77107718..e2cce2c340 100644 --- a/types/karma/index.d.ts +++ b/types/karma/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for karma 1.7 // Project: https://github.com/karma-runner/karma // Definitions by: Tanguy Krotoff +// James Garbutt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -414,6 +415,19 @@ declare namespace karma { * @description Capture all console output and pipe it to the terminal. */ captureConsole?: boolean; + /** + * @default false + * @description Run the tests on the same window as the client, without using iframe or a new window + */ + runInParent?: boolean; + /** + * @default true + * @description Clear the context window + * If true, Karma clears the context window upon the completion of running the tests. + * If false, Karma does not clear the context window upon the completion of running the tests. + * Setting this to false is useful when embedding a Jasmine Spec Runner Template. + */ + clearContext?: boolean; } interface FilePattern { diff --git a/types/karma/karma-tests.ts b/types/karma/karma-tests.ts index 2eeed9b480..b21fa88e50 100644 --- a/types/karma/karma-tests.ts +++ b/types/karma/karma-tests.ts @@ -51,7 +51,7 @@ server.on('run_complete', (browsers, results) => { results.error = false; results.exitCode = 0; results.failed = 9; - results.success = 10; + results.success = 10; }); //var runner = require('karma').runner; => cannot use this syntax otherwise runner is of type any @@ -108,3 +108,15 @@ module.exports = function(config: karma.Config) { singleRun: true }); }; + +const foo = (config: karma.Config) => { + config.set({ + client: { + args: ['a', 'b'], + useIframe: true, + runInParent: true, + captureConsole: true, + clearContext: true + } + }); +}; From a9479a5c50afe06c9536c0b7b844f38332b344c1 Mon Sep 17 00:00:00 2001 From: simonxca Date: Sat, 16 Dec 2017 19:08:26 -0800 Subject: [PATCH 050/890] Use v3 function signature for pre method Fixes #21938 The new signatures were confusing and caused some backwards breaking changes. --- types/mongoose/index.d.ts | 29 +++++++++++++++++++++++++---- types/mongoose/mongoose-tests.ts | 6 ++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 7eb768f3c8..c804ecac42 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -698,10 +698,8 @@ declare module "mongoose" { /** * Defines a pre hook for the document. */ - pre(method: string, parallel: boolean, fn: (next: (err?: NativeError) => void, done: (err?: NativeError) => void) => void, - errorCb?: (err: Error) => void): this; - pre(method: string, fn: (next: (err?: NativeError) => void) => void, - errorCb?: (err: Error) => void): this; + pre(method: string, parallel: boolean, fn: HookAsyncCallback, errorCb?: HookErrorCallback): this; + pre(method: string, fn: HookSyncCallback, errorCb?: HookErrorCallback): this; /** * Adds a method call to the queue. @@ -760,6 +758,29 @@ declare module "mongoose" { obj: any; } + // Hook functions: https://github.com/vkarpov15/hooks-fixed + interface HookSyncCallback { + (next: HookNextFunction, ...hookArgs:any[]): any; + } + + interface HookAsyncCallback { + (next: HookNextFunction, done: HookDoneFunction, ...hookArgs: any[]): any; + } + + interface HookErrorCallback { + (error: Error): any; + } + + interface HookNextFunction { + (error: Error): any; + (...hookArgs: any[]): any; + } + + interface HookDoneFunction { + (error: Error): any; + (...hookArgs: any[]): any; + } + interface SchemaOptions { /** defaults to null (which means use the connection's autoIndex option) */ autoIndex?: boolean; diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index 9fe20cd8ad..4d59450393 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -430,6 +430,12 @@ new mongoose.Schema({ } }); +export default function(schema: mongoose.Schema) { + schema.pre('init', function(this: mongoose.Document, next: (err?: Error) => void, data: any): void { + data.name = 'Hello world'; + }); +} + /* * section document.js * http://mongoosejs.com/docs/api.html#document-js From e2971b3f4414409dcb18a7d76f8a64aa7ba14252 Mon Sep 17 00:00:00 2001 From: Peter Blazejewicz Date: Sun, 17 Dec 2017 17:02:12 +0100 Subject: [PATCH 051/890] Fix definition of ReactModal.setAppElement This comit changes: - definition of static setAppElement method to support string type - as ReactModal allows to use selector instead of element reference - sample tests to include static method coverage Thanks! --- types/react-modal/index.d.ts | 10 +++++++--- types/react-modal/react-modal-tests.tsx | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/types/react-modal/index.d.ts b/types/react-modal/index.d.ts index 715f4c3b01..16ee347cfd 100644 --- a/types/react-modal/index.d.ts +++ b/types/react-modal/index.d.ts @@ -4,7 +4,8 @@ // Drew Noakes , // Thomas B Homburg , // Tatu Tamminen , -// Uwe Wiemer +// Uwe Wiemer , +// Peter Blazejewicz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -97,6 +98,9 @@ declare namespace ReactModal { declare class ReactModal extends React.Component { /* Override base styles for all instances of this component. */ static defaultStyles: ReactModal.Styles; - /* Call this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ - static setAppElement(appElement: HTMLElement): void; + /** + * Call this to properly hide your application from assistive screenreaders + * and other assistive technologies while the modal is open. + */ + static setAppElement(appElement: string | HTMLElement): void; } diff --git a/types/react-modal/react-modal-tests.tsx b/types/react-modal/react-modal-tests.tsx index 8ce91bf15f..76958adbb3 100644 --- a/types/react-modal/react-modal-tests.tsx +++ b/types/react-modal/react-modal-tests.tsx @@ -1,6 +1,12 @@ import * as React from "react"; import ReactModal = require('react-modal'); +// tests for static method +// string +ReactModal.setAppElement("#main"); +// HTMLElement +ReactModal.setAppElement(document.getElementById("#main")); + class ExampleOfUsingReactModal extends React.Component { render() { const onAfterOpenFn = () => { }; From 3bdc4ff651d4d1549f58d1893a18fc22c96839e1 Mon Sep 17 00:00:00 2001 From: Jamie Mason Date: Sun, 17 Dec 2017 19:47:38 +0000 Subject: [PATCH 052/890] Jasmine matchers can accept many arguments refs #21327 --- types/jasmine/index.d.ts | 4 ++-- types/jasmine/jasmine-tests.ts | 14 ++++++++++++++ types/jest/index.d.ts | 4 ++-- types/jest/v16/index.d.ts | 4 ++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/types/jasmine/index.d.ts b/types/jasmine/index.d.ts index c1c15e45de..cc28931542 100644 --- a/types/jasmine/index.d.ts +++ b/types/jasmine/index.d.ts @@ -219,8 +219,8 @@ declare namespace jasmine { type CustomEqualityTester = (first: any, second: any) => boolean | void; interface CustomMatcher { - compare(actual: T, expected: T): CustomMatcherResult; - compare(actual: any, expected: any): CustomMatcherResult; + compare(actual: T, expected: T, ...args: any[]): CustomMatcherResult; + compare(actual: any, ...expected: any[]): CustomMatcherResult; } type CustomMatcherFactory = (util: MatchersUtil, customEqualityTesters: CustomEqualityTester[]) => CustomMatcher; diff --git a/types/jasmine/jasmine-tests.ts b/types/jasmine/jasmine-tests.ts index ab132d3cee..b54269aa61 100644 --- a/types/jasmine/jasmine-tests.ts +++ b/types/jasmine/jasmine-tests.ts @@ -963,6 +963,15 @@ var customMatchers: jasmine.CustomMatcherFactories = { return result; } }; + }, + toBeWithinRange: (util: jasmine.MatchersUtil, customEqualityTesters: jasmine.CustomEqualityTester[]) => { + return { + compare: (actual: any, floor: number, ceiling: number): jasmine.CustomMatcherResult => { + const pass = actual >= floor && actual <= ceiling; + const message = `expected ${actual} ${pass ? 'not ' : ''} to be within range ${floor}-${ceiling}`; + return { message, pass }; + } + }; } }; // add the custom matchers to interface jasmine.Matchers via TypeScript declaration merging @@ -977,6 +986,7 @@ var customMatchers: jasmine.CustomMatcherFactories = { declare namespace jasmine { interface Matchers { toBeGoofy(expected?: jasmine.Expected): boolean; + toBeWithinRange(expected?: jasmine.Expected, floor?: number, ceiling?: number): boolean; } } @@ -997,6 +1007,10 @@ describe("Custom matcher: 'toBeGoofy'", () => { }).toBeGoofy({ hyuk: ' is fun' }); }); + it("can take many 'expected' parameters", () => { + expect(2).toBeWithinRange(1, 3); + }); + it("can be negated", () => { expect({ hyuk: 'this is fun' diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 5c2152694f..0befb10e33 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -714,8 +714,8 @@ declare namespace jasmine { type CustomEqualityTester = (first: any, second: any) => boolean; interface CustomMatcher { - compare(actual: T, expected: T): CustomMatcherResult; - compare(actual: any, expected: any): CustomMatcherResult; + compare(actual: T, expected: T, ...args: any[]): CustomMatcherResult; + compare(actual: any, ...expected: any[]): CustomMatcherResult; } interface CustomMatcherResult { diff --git a/types/jest/v16/index.d.ts b/types/jest/v16/index.d.ts index f376ea5bcc..c1282c2c74 100644 --- a/types/jest/v16/index.d.ts +++ b/types/jest/v16/index.d.ts @@ -287,8 +287,8 @@ declare namespace jasmine { } interface CustomMatcher { - compare(actual: T, expected: T): CustomMatcherResult; - compare(actual: any, expected: any): CustomMatcherResult; + compare(actual: T, expected: T, ...args: any[]): CustomMatcherResult; + compare(actual: any, ...expected: any[]): CustomMatcherResult; } interface CustomMatcherResult { From eb79ad886b123e66d6bd5e0f45f44b7cc44fa148 Mon Sep 17 00:00:00 2001 From: Tom Van Rompaey Date: Mon, 18 Dec 2017 15:49:42 +0800 Subject: [PATCH 053/890] expexted -> expected --- types/d3-scale/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/d3-scale/index.d.ts b/types/d3-scale/index.d.ts index 38e204a6ea..d6cccdedfc 100644 --- a/types/d3-scale/index.d.ts +++ b/types/d3-scale/index.d.ts @@ -152,7 +152,7 @@ export interface ScaleContinuousNumeric { * Nicing a scale only modifies the current domain; it does not automatically nice domains that are subsequently set using continuous.domain. * You must re-nice the scale after setting the new domain, if desired. * - * @param count An optional number of ticks expexted to be used. + * @param count An optional number of ticks expected to be used. */ nice(count?: number): this; @@ -664,7 +664,7 @@ export interface ScaleIdentity { * Nicing a scale only modifies the current domain; it does not automatically nice domains that are subsequently set using continuous.domain. * You must re-nice the scale after setting the new domain, if desired. * - * @param count An optional number of ticks expexted to be used. + * @param count An optional number of ticks expected to be used. */ nice(count?: number): this; @@ -1231,7 +1231,7 @@ export interface ScaleQuantize { * Nicing a scale only modifies the current domain; it does not automatically nice domains that are subsequently set using continuous.domain. * You must re-nice the scale after setting the new domain, if desired. * - * @param count An optional number of ticks expexted to be used. + * @param count An optional number of ticks expected to be used. */ nice(count?: number): this; From 40a557091da9e371df263351a3a9f214b40956e5 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Mon, 18 Dec 2017 10:12:16 +0000 Subject: [PATCH 054/890] twitter-text: update for v2 --- types/twitter-text/index.d.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/types/twitter-text/index.d.ts b/types/twitter-text/index.d.ts index e12cfc59a9..def33e238d 100644 --- a/types/twitter-text/index.d.ts +++ b/types/twitter-text/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for twitter-text v1.13.4 +// Type definitions for twitter-text v2.0.0 // Project: https://github.com/twitter/twitter-text // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -101,3 +101,15 @@ export declare function getUnicodeTextLength(text: string): number; export declare function convertUnicodeIndices(text: string, entities: EntityWithIndices[], indicesInUTF16?: boolean): void; export declare function hitHighlight(text: string, hits?: number[][], options?: { tag: string }): string; + +export interface ParsedTweet { + weightedLength: number; + permillage: number; + valid: boolean; + displayRangeEnd: number; + displayRangeStart: number; + validRangeEnd: number; + validRangeStart: number; +} + +export declare function parseTweet(text: string): ParsedTweet; From d94485393e6abba9ecdb93f8294daedfe79ec0ce Mon Sep 17 00:00:00 2001 From: Ritorna Date: Mon, 18 Dec 2017 12:21:36 +0100 Subject: [PATCH 055/890] [react-grid-layout] Add null type to compactType When using undefined on the compactType the Component uses the compactType "vertical" instead of null. By excplicitely using null the grid works fine. --- types/react-grid-layout/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-grid-layout/index.d.ts b/types/react-grid-layout/index.d.ts index fc4f184956..8dddb624d1 100644 --- a/types/react-grid-layout/index.d.ts +++ b/types/react-grid-layout/index.d.ts @@ -140,7 +140,7 @@ declare namespace ReactGridLayout { /** * Compaction type. */ - compactType?: "vertical" | "horizontal"; + compactType?: "vertical" | "horizontal" | null; /** * This allows setting the initial width on the server side. From 550f9bf862f12f3fa64928fe9abd5dd5d56c585d Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Mon, 18 Dec 2017 14:26:14 +0100 Subject: [PATCH 056/890] updated webpack-dev-middleware with breaking changes --- types/webpack-dev-middleware/index.d.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/types/webpack-dev-middleware/index.d.ts b/types/webpack-dev-middleware/index.d.ts index e88cec98ef..89905d350f 100644 --- a/types/webpack-dev-middleware/index.d.ts +++ b/types/webpack-dev-middleware/index.d.ts @@ -6,6 +6,7 @@ // TypeScript Version: 2.2 import { NextHandleFunction } from 'connect'; +import { Logger } from 'loglevel'; import * as webpack from 'webpack'; import MemoryFileSystem = require('memory-fs'); @@ -18,8 +19,7 @@ declare function WebpackDevMiddleware( declare namespace WebpackDevMiddleware { interface Options { - noInfo?: boolean; - quiet?: boolean; + logLevel?: string; lazy?: boolean; watchOptions?: webpack.Options.WatchOptions; publicPath: string; @@ -30,22 +30,17 @@ declare namespace WebpackDevMiddleware { stats?: webpack.Options.Stats; reporter?: Reporter | null; serverSideRender?: boolean; - - log?: Logger; - warn?: Logger; - error?: Logger; + logger?: Logger; filename?: string; } interface ReporterOptions { state: boolean; - stats: webpack.Stats; - options: Options; + stats?: webpack.Stats; + log: Logger; } - type Reporter = (reporterOptions: ReporterOptions) => void; - - type Logger = (message?: any, ...optionalParams: any[]) => void; + type Reporter = (middlewareOptions: Options, reporterOptions: ReporterOptions) => void; interface WebpackDevMiddleware { close(callback?: () => void): void; From d07521305252ba0b03845ea4f629632454e24e3e Mon Sep 17 00:00:00 2001 From: Philipp Zins Date: Mon, 18 Dec 2017 14:28:12 +0100 Subject: [PATCH 057/890] update tests --- types/webpack-dev-middleware/webpack-dev-middleware-tests.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts b/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts index 8df4675595..2ccfb90a0c 100644 --- a/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts +++ b/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts @@ -7,8 +7,7 @@ const compiler = webpack({}); let webpackDevMiddlewareInstance = webpackDevMiddleware(compiler); webpackDevMiddlewareInstance = webpackDevMiddleware(compiler, { - noInfo: false, - quiet: false, + logLevel: 'silent', lazy: true, watchOptions: { aggregateTimeout: 300, From 02da1ce3f89d2d0d427d7b2e88976078be5770e5 Mon Sep 17 00:00:00 2001 From: Juraj Husar Date: Mon, 18 Dec 2017 15:05:05 +0100 Subject: [PATCH 058/890] react-dropzone Updated typings for latest version --- types/react-dropzone/index.d.ts | 71 +++++++++---------- types/react-dropzone/react-dropzone-tests.tsx | 3 +- 2 files changed, 35 insertions(+), 39 deletions(-) diff --git a/types/react-dropzone/index.d.ts b/types/react-dropzone/index.d.ts index 3ea828f350..423ce38462 100644 --- a/types/react-dropzone/index.d.ts +++ b/types/react-dropzone/index.d.ts @@ -1,51 +1,48 @@ -// Type definitions for react-dropzone 4.1.3 +// Type definitions for react-dropzone 4.2.3 // Project: https://github.com/okonet/react-dropzone // Definitions by: Mathieu Larouche Dube , // Ivo Jesus , // Luís Rodrigues , // Ben Bayard , // Karol Janyst , -// Andris Causs +// Andris Causs , +// Juraj Husar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { CSSProperties, Component, DragEvent, InputHTMLAttributes } from "react"; -declare namespace Dropzone { - export interface ImageFile extends File { - preview?: string; - } - - export type DropFileEventHandler = (acceptedOrRejected: ImageFile[], event: DragEvent) => void; - export type DropFilesEventHandler = (accepted: ImageFile[], rejected: ImageFile[], event: DragEvent) => void; - - type PickedAttributes = "accept" | "className" | "multiple" | "name" | "onClick" | "onDragStart" | "onDragEnter" | "onDragOver" | "onDragLeave" | "style"; - - export interface DropzoneProps extends Pick, PickedAttributes> { - disableClick?: boolean; - disabled?: boolean; - disablePreview?: boolean; - preventDropOnDocument?: boolean; - inputProps?: InputHTMLAttributes; - maxSize?: number; - minSize?: number; - activeClassName?: string; - acceptClassName?: string; - rejectClassName?: string; - disabledClassName?: string; - activeStyle?: CSSProperties; - acceptStyle?: CSSProperties; - rejectStyle?: CSSProperties; - disabledStyle?: CSSProperties; - onDrop?: DropFilesEventHandler; - onDropAccepted?: DropFileEventHandler; - onDropRejected?: DropFileEventHandler; - onFileDialogCancel?: () => void; - } +export interface ImageFile extends File { + preview?: string; } -declare class Dropzone extends Component { +export type DropFileEventHandler = (acceptedOrRejected: ImageFile[], event: DragEvent) => void; +export type DropFilesEventHandler = (accepted: ImageFile[], rejected: ImageFile[], event: DragEvent) => void; + +type PickedAttributes = "accept" | "className" | "multiple" | "name" | "onClick" | "onDragStart" | "onDragEnter" | "onDragOver" | "onDragLeave" | "style"; + +export interface DropzoneProps extends Pick, PickedAttributes> { + disableClick?: boolean; + disabled?: boolean; + disablePreview?: boolean; + preventDropOnDocument?: boolean; + inputProps?: InputHTMLAttributes; + maxSize?: number; + minSize?: number; + activeClassName?: string; + acceptClassName?: string; + rejectClassName?: string; + disabledClassName?: string; + activeStyle?: CSSProperties; + acceptStyle?: CSSProperties; + rejectStyle?: CSSProperties; + disabledStyle?: CSSProperties; + onDrop?: DropFilesEventHandler; + onDropAccepted?: DropFileEventHandler; + onDropRejected?: DropFileEventHandler; + onFileDialogCancel?: () => void; +} + +export default class Dropzone extends Component { open(): void; } - -export = Dropzone; diff --git a/types/react-dropzone/react-dropzone-tests.tsx b/types/react-dropzone/react-dropzone-tests.tsx index 8fcb16311a..67fa8eadb3 100644 --- a/types/react-dropzone/react-dropzone-tests.tsx +++ b/types/react-dropzone/react-dropzone-tests.tsx @@ -1,7 +1,6 @@ import * as React from "react"; import { DragEvent, SyntheticEvent } from "react"; -import Dropzone = require("react-dropzone"); -import { ImageFile } from "react-dropzone"; +import Dropzone, { ImageFile } from "react-dropzone"; class Test extends React.Component { From c65e09d6f138c3f79a21badcab6fbbe7f4c70ee2 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Mon, 18 Dec 2017 15:55:04 +0000 Subject: [PATCH 059/890] Add transformState function to redux-localstorage --- types/redux-localstorage/index.d.ts | 2 ++ types/redux-localstorage/redux-localstorage-tests.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/types/redux-localstorage/index.d.ts b/types/redux-localstorage/index.d.ts index b4af824d9b..b788fcd963 100644 --- a/types/redux-localstorage/index.d.ts +++ b/types/redux-localstorage/index.d.ts @@ -26,4 +26,6 @@ export function mergePersistedState(merge?: (initialState: A1, persisten export default function persistState(storage?: StorageAdapter, key?: string, callback?: Function): Redux.GenericStoreEnhancer; +export function transformState(down: ((state: A1) => A2) | Array<(state: any) => any>, up: ((state: A2) => A1) | Array<(state: any) => any>): (storage: StorageAdapter) => A2; + export const actionTypes: ActionTypes; diff --git a/types/redux-localstorage/redux-localstorage-tests.ts b/types/redux-localstorage/redux-localstorage-tests.ts index 49bf442fcf..17f453423a 100644 --- a/types/redux-localstorage/redux-localstorage-tests.ts +++ b/types/redux-localstorage/redux-localstorage-tests.ts @@ -2,6 +2,7 @@ import { Reducer, compose, combineReducers, createStore } from "redux"; import { default as persistState, mergePersistedState, + transformState, actionTypes } from "redux-localstorage"; import * as adapterAsyncStorage from "redux-localstorage/lib/adapters/AsyncStorage"; @@ -31,3 +32,7 @@ const createStoreLocalStorage = compose( const createStoreSessionStorage = compose( persistState(storageSessionStorage, "foo") )(createStore)(reducer); + +const storage = compose( + transformState([JSON.stringify, btoa], [atob, JSON.parse]) +)(storageLocalStorage); From aedbd38594aabe8e207a146f6a4c1ef051f05bac Mon Sep 17 00:00:00 2001 From: Flarna Date: Mon, 18 Dec 2017 20:14:45 +0100 Subject: [PATCH 060/890] [knex-postgis] fix CI build error --- types/knex-postgis/knex-postgis-tests.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/types/knex-postgis/knex-postgis-tests.ts b/types/knex-postgis/knex-postgis-tests.ts index 4639a55ea6..43a6c2f58b 100644 --- a/types/knex-postgis/knex-postgis-tests.ts +++ b/types/knex-postgis/knex-postgis-tests.ts @@ -7,13 +7,7 @@ const st: KPG.KnexPostgis = KPG(knex); const point: GeoJSON.Point = { type: 'Point', - coordinates: [23.773206, 61.506005], - crs: { - type: 'name', - properties: { - name: 'EPSG:4326' - } - } + coordinates: [23.773206, 61.506005] }; const wktPoint = 'POINT(23.773206 61.506005)'; From 984ecddc658fc48a29c77bde176f9744574a9da6 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 18 Dec 2017 11:23:09 -0800 Subject: [PATCH 061/890] log4javascript: Provides its own types --- notNeededPackages.json | 6 + types/log4javascript/index.d.ts | 1118 ------------------ types/log4javascript/log4javascript-tests.ts | 61 - types/log4javascript/tsconfig.json | 24 - types/log4javascript/tslint.json | 79 -- 5 files changed, 6 insertions(+), 1282 deletions(-) delete mode 100644 types/log4javascript/index.d.ts delete mode 100644 types/log4javascript/log4javascript-tests.ts delete mode 100644 types/log4javascript/tsconfig.json delete mode 100644 types/log4javascript/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 38c0a39808..cdfd2872ab 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -402,6 +402,12 @@ "sourceRepoURL": "https://github.com/steelsojka/lodash-decorators", "asOfVersion": "4.0.0" }, + { + "libraryName": "log4javascript", + "typingsPackageName": "log4javascript", + "sourceRepoURL": "http://log4javascript.org/", + "asOfVersion": "1.4.15" + }, { "libraryName": "log4js", "typingsPackageName": "log4js", diff --git a/types/log4javascript/index.d.ts b/types/log4javascript/index.d.ts deleted file mode 100644 index b92fe3bc98..0000000000 --- a/types/log4javascript/index.d.ts +++ /dev/null @@ -1,1118 +0,0 @@ -// Type definitions for log4javascript v1.4.13 -// Project: http://log4javascript.org/ -// Definitions by: Markus Wagner -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace log4javascript { - - // #region log4javascript static properties/methods - - /** - * Returns a logger with the specified name, creating it if a logger with that name does not already exist. - * If no name is specified, a logger is returned with name [anonymous], and subsequent calls to getLogger() - * (with no logger name specified) will return this same logger object. - * Note that the names [anonymous], [default], [null] and root are reserved for the anonymous logger, default logger, - * null logger and root logger respectively. - */ - export function getLogger(loggerName?: string): Logger; - - /** - * Convenience method that returns the default logger. The default logger has a single appender: a PopUpAppender with the default - * layout, width and height, and with focusPopUp set to false and lazyInit, useOldPopUp and complainAboutPopUpBlocking all set to true. - */ - export function getDefaultLogger(): Logger; - - /** - * Returns an empty logger with no appenders. Useful for disabling all logging. - */ - export function getNullLogger(): Logger; - - /** - * Returns the root logger from which all other loggers derive. - */ - export function getRootLogger(): Logger; - - /** - * Resets the all loggers to their default level. - */ - export function resetConfiguration(): void; - - /** - * Enables or disables all logging, depending on enabled. - */ - export function setEnabled(enabled: boolean): void; - - /** - * Returns true or false depending on whether logging is enabled. - */ - export function isEnabled(): boolean; - - /** - * Adds a function to be called when an event of the type specified occurs in log4javascript. - * Supported event types are load (occurs once the page has loaded) and error. - */ - export function addEventListener(eventType: string, listener: { (sender: any, eventType: string, eventArgs: any): void; }): void; - - /** - * Removes the event listener function supplied for the event of the type specified. - */ - export function removeEventListener(eventType: string, listener: { (sender: any, eventType: string, eventArgs: any): void; }): void; - - /** - * Raises an event of type eventType on the log4javascript object. Each of the listeners for this type of event - * (registered via addEventListener) is called and passed eventArgs as the third parameter. - */ - export function dispatchEvent(eventType: string, eventArgs: any): void; - - /** - * Used internally to specify the types of events that the log4javascript object can raise. - */ - export function setEventTypes(eventTypes: string[]): void; - - /** - * Enables or disables displaying of error stack traces, depending on show. By default, stack traces are not displayed. - * (Only works in Firefox) - */ - export function setShowStackTraces(show: boolean): void; - - /** - * This evaluates the given expression in the log4javascript scope, thus allowing scripts to access internal - * log4javascript variables and functions. This was written for the purposes of automated testing but could be used by - * custom extensions to log4javascript. - */ - export function evalInScope(expr: string): any; - - // #endregion - - // #region Levels - - /** - * Levels are available as static properties of the log4javascript.Level object. - */ - export class Level { - static ALL: Level; - static TRACE: Level; - static DEBUG: Level; - static INFO: Level; - static WARN: Level; - static ERROR: Level; - static FATAL: Level; - static OFF: Level; - - constructor(level: number, name: string); - - toString(): string; - equals(level: Level): boolean; - isGreaterOrEqual(level: Level): boolean; - } - - // #endregion - - // #region Loggers - - /** - * It is possible to have multiple loggers in log4javascript. For example, you may wish to have a logger for debugging purposes - * that logs messages to a pop-up window and a separate logger that reports any client-side application errors to the server via Ajax. - * From version 1.4, log4javascript has hierarchical loggers, implemented in the same way as log4j. In summary, you specify a - * logger's parent logger by means of a dot between the parent logger name and the child logger name. Therefore the logger - * tim.app.security inherits from tim.app, which in turn inherits from tim which, finally, inherits from the root logger. - * What inheritance means for a logger is that in the absence of a threshold level set specifically on the logger it inherits - * its level from its parent; also, a logger inherits all its parent's appenders (this is known as appender additivity in log4j. - * This behaviour can be enabled or disabled via setAdditivity(). See below). In the above example, if the root logger has a - * level of DEBUG and one appender, each of the loggers tim.app.security, tim.app and tim would inherit the root level's appender. - * If, say, tim.app's threshold level was set to WARN, tim's effective level would remain at DEBUG (inherited from the root logger) - * while tim.app.security's effective level would be WARN, inherited from tim.app. The important thing to note is that appenders - * accumulate down the logger hierarchy while levels are simply inherited from the nearest ancestor with a threshold level set. - * For a detailed explanation of the logger hierarchy, see the log4j manual. - */ - export class Logger { - /** - * Adds the given appender. - */ - addAppender(appender: Appender): void; - - /** - * Removes the given appender. - */ - removeAppender(appender: Appender): void; - - /** - * Clears all appenders for the current logger. - */ - removeAllAppenders(): void; - - /** - * Returns all appenders which will log a message. - */ - getEffectiveAppenders(): Appender[]; - - /** - * Sets the level. Log messages of a lower level than level will not be logged. Default value is DEBUG. - */ - setLevel(level: Level): void; - - /** - * Returns the level explicitly set for this logger or null if none has been set. - */ - getLevel(): Level; - - /** - * Returns the level at which the logger is operating. This is either the level explicitly set on the logger or, if no level - * has been set, the effective level of the logger's parent. - */ - getEffectiveLevel(): Level; - - /** - * Sets whether appender additivity is enabled (the default) or disabled. If set to false, this particular logger will not - * inherit any appenders form its ancestors. Any descendant of this logger, however, will inherit from its ancestors as - * normal, unless its own additivity is explicitly set to false. - * Default value is true. - */ - setAdditivity(additivity: boolean): void; - - /** - * Returns whether additivity is enabled for this logger. - */ - getAdditivity(): boolean; - - /** - * Generic logging method used by wrapper methods such as debug, error etc. - */ - log(level: Level, params: any[]): void; - - /** - * Logs one or more messages and optionally an error at level TRACE. - */ - trace(...messages: any[]): void; - - /** - * Logs one or more messages and optionally an error at level DEBUG. - */ - debug(...messages: any[]): void; - - /** - * Logs one or more messages and optionally an error at level INFO. - */ - info(...messages: any[]): void; - - /** - * Logs one or more messages and optionally an error at level WARN. - */ - warn(...messages: any[]): void; - - /** - * Logs one or more messages and optionally an error at level ERROR. - */ - error(...messages: any[]): void; - - /** - * Logs one or more messages and optionally an error at level FATAL. - */ - fatal(...messages: any[]): void; - - /** - * Returns whether the logger is enabled for the specified level. - */ - isEnabledFor(level: Level, exception: Error): boolean; - - /** - * Returns whether the logger is enabled for TRACE messages. - */ - isTraceEnabled(): boolean; - - /** - * Returns whether the logger is enabled for DEBUG messages. - */ - isDebugEnabled(): boolean; - - /** - * Returns whether the logger is enabled for INFO messages. - */ - isInfoEnabled(): boolean; - - /** - * Returns whether the logger is enabled for WARN messages. - */ - isWarnEnabled(): boolean; - - /** - * Returns whether the logger is enabled for ERROR messages. - */ - isErrorEnabled(): boolean; - - /** - * Returns whether the logger is enabled for FATAL messages. - */ - isFatalEnabled(): boolean; - - /** - * Starts a new group of log messages. In appenders that support grouping (currently PopUpAppender and InPageAppender), - * a group appears as an expandable section in the console, labelled with the name specified. Specifying initiallyExpanded - * determines whether the group starts off expanded (the default is true). Groups may be nested. - */ - group(name: string, initiallyExpanded?: boolean): void; - - /** - * Ends the current group. If there is no group then this function has no effect. - */ - groupEnd(): void; - - /** - * Starts a timer with name name. When the timer is ended with a call to timeEnd using the same name, the amount of time - * that has elapsed in milliseconds since the timer was started is logged at level level. If not level is supplied, the level - * defaults to INFO. - */ - time(name: string, level?: Level): void; - - /** - * Ends the timer with name name and logs the time elapsed. - */ - timeEnd(name: string): void; - - /** - * Asserts the given expression is true or evaluates to true. If so, nothing is logged. If not, an error is logged at the ERROR level. - */ - assert(expr: any): void; - - name: string; - } - - // #endregion - - // #region Appenders - - /** - * Logging event. - */ - export class LoggingEvent { - logger: Logger; - timeStamp: Date; - timeStampInMilliseconds: number; - timeStampInSeconds: number; - milliseconds: number; - level: Level; - messages: any[]; - exception: Error; - - constructor(logger: Logger, timeStamp: Date, level: Level, messages: string[], exception?: Error); - - getThrowableStrRep: () => string; - getCombinedMessages: () => string; - toString: () => string; - } - - /** - * There are methods common to all appenders, as listed below. - */ - export class Appender { - - /** - * Checks the logging event's level is at least as severe as the appender's threshold and calls the appender's append method if so. - * This method should not in general be used directly or overridden. - */ - doAppend(loggingEvent: LoggingEvent): void; - - /** - * Appender-specific method to append a log message. Every appender object should implement this method. - */ - append(loggingEvent: LoggingEvent): void; - - /** - * Sets the appender's layout. - */ - setLayout(layout: Layout): void; - - /** - * Returns the appender's layout. - */ - getLayout(): Layout; - - /** - * Sets the appender's threshold. Log messages of level less severe than this threshold will not be logged. - */ - setThreshold(level: Level): void; - - /** - * Returns the appender's threshold. - */ - getThreshold(): Level; - - /** - * Returns a string representation of the appender. Every appender object should implement this method. - */ - toString(): string; - - } - - /** - * Displays a log message as a JavaScript alert. - */ - export class AlertAppender extends Appender { - /** - * Constructor - */ - constructor(); - } - - /** - * A flexible appender that asynchronously sends log messages to a server via HTTP. - * The default configuration is to send each log message as a separate HTTP post request to the server using an - * HttpPostDataLayout, without waiting for a response before sending any subsequent requests. - */ - export class AjaxAppender extends Appender { - /** - * Constructor - * @param url The URL to which log messages should be sent. Note that this is subject to the usual Ajax restrictions: - * the URL should be in the same domain as that of the page making the request. - * @param withCredentials Specifies whether cookies should be sent with each request. - */ - constructor(url: string, withCredentials?: boolean); - - /** - * Whether to send all remaining unsent log messages to the server when the page unloads. - * Since version 1.4.3, the default value is false. Previously the default was true. - */ - setSendAllOnUnload(sendAllOnUnload: boolean): void; - - /** - * Returns whether all remaining unsent log messages are sent to the server when the page unloads. - */ - isSendAllOnUnload(): boolean; - - /** - * Sets the post variable name whose value will the formatted log message(s) for each request. - * Default value is data. - */ - setPostVarName(postVarName: string): void; - - /** - * Returns the post variable name whose value will the formatted log message(s) for each request. - */ - getPostVarName(): string; - - /** - * Whether to send log messages to the server at regular, timed intervals. - * Default value is false. - */ - setTimed(timed: boolean): void; - - /** - * Returns whether log messages are sent to the server at regular, timed intervals. - */ - isTimed(): boolean; - - /** - * Sets whether to wait for a response from a previous HTTP request from this appender before sending the next log - * message / batch of messages. - * Default value is false. - */ - setWaitForResponse(waitForResponse: boolean): void; - - /** - * Returns whether the appender waits for a response from a previous HTTP request from this appender before sending the next - * log message / batch of messages. - */ - isWaitForResponse(): boolean; - - /** - * Sets the number of log messages to send in each request. If not specified, defaults to 1. - */ - setBatchSize(batchSize: number): void; - - /** - * Returns the number of log messages sent in each request. See above for more details. - */ - getBatchSize(): number; - - /** - * Sets the length of time in milliseconds between each sending of queued log messages. - */ - setTimerInterval(timerInterval: number): void; - - /** - * Returns the length of time in milliseconds between each sending of queued log messages. See above for more details. - */ - getTimerInterval(): number; - - /** - * Sets the function that is called whenever a successful request is made, called at the point at which the response is - * received. This feature can be used to confirm whether a request has been successful and act accordingly. - * A single parameter, xmlHttp, is passed to the callback function. This is the XMLHttpRequest object that performed the - * request. - */ - setRequestSuccessCallback(requestSuccessCallback: { (xmlHttp: XMLHttpRequest): void; }): void; - - /** - * Sets the function that is called whenever any kind of failure occurs in the appender, including browser deficiencies or - * configuration errors (e.g. supplying a non-existent URL to the appender). This feature can be used to handle - * AjaxAppender-specific errors. - * A single parameter, message, is passed to the callback function. This is the error-specific message that caused the failure. - */ - setFailCallback(failCallback: { (message: string): void; }): void; - - /** - * Sets the session id sent to the server each time a request is made. - */ - setSessionId(sessionId: string): void; - - /** - * Returns the session id sent to the server each time a request is made. - */ - getSessionId(): string; - - /** - * Adds an HTTP header that is sent with each request. - */ - addHeader(name: string, value: string): void; - - /** - * Returns an array of the additional headers that are sent with each HTTP request. Each array item is an object with - * properties name and value. - */ - getHeaders(): Array<{ name: string; value: string; }>; - - /** - * Sends all log messages in the queue. If log messages are batched then only completed batches are sent. - */ - sendAll(): void; - } - - /** - * Logs messages to a pop-up console window (note: you will need to disable pop-up blockers to use it). The pop-up displays a - * list of all log messages. - */ - export class PopUpAppender extends Appender { - /** - * Constructor - * @param lazyInit Set this to true to open the pop-up only when the first log message reaches the appender. Otherwise, the - * pop-up window opens as soon as the appender is created. If not specified, defaults to false. - * @param initiallyMinimized Whether the console window should start off hidden / minimized. If not specified, defaults to false. - * @param useDocumentWrite Specifies how the console window is created. By default, the console window is created dynamically - * using document's write method. This has the advantage of keeping all the code in one single JavaScript file. However, - * if your page sets document.domain then the browser prevents script access to a window unless it too has the same value - * set for document.domain. To get round this issue, you can set useDocumentWrite to false and log4javascript will instead - * use the external HTML file console.html (or console_uncompressed.html if you're using an uncompressed version of - * log4javascript.js), which must be placed in the same directory as your log4javascript.js file. - * Note that if useDocumentWrite is set to true, the old pop-up window will always be closed and a new one created whenever - * the page is refreshed, even if setUseOldPopUp(true) has been called. - * In general it's simpler to use the document.write method, so unless your page needs to set document.domain, - * useDocumentWrite should be set to true. - * If not specified, defaults to true. - * @param width The outer width in pixels of the pop-up window. If not specified, defaults to 600. - * @param height The outer height in pixels of the pop-up window. If not specified, defaults to 400. - */ - constructor(lazyInit?: boolean, initiallyMinimized?: boolean, useDocumentWrite?: boolean, width?: number, height?: number); - - /** - * Returns whether the console window starts off hidden / minimized. - */ - isInitiallyMinimized(): boolean; - - /** - * Sets whether the console window should start off hidden / minimized. - */ - setInitiallyMinimized(initiallyMinimized: boolean): void; - - /** - * Returns whether the pop-up window is focussed (i.e. brought it to the front) when a new log message is added. Default value is false. - */ - isFocusPopUp(): boolean; - - /** - * Sets whether to focus the pop-up window (i.e. bring it to the front) when a new log message is added. - */ - setFocusPopUp(focusPopUp: boolean): void; - - /** - * Returns whether the same pop-up window is used if the main page is reloaded. If set to true, when the page is reloaded a - * line is drawn in the pop-up and subsequent log messages are added to the same pop-up. Otherwise, a new pop-up window is - * created that replaces the original pop-up. If not specified, defaults to true. - */ - isUseOldPopUp(): boolean; - - /** - * Sets whether to use the same pop-up window if the main page is reloaded. See isUseOldPopUp above for details. - */ - setUseOldPopUp(useOldPopUp: boolean): void; - - /** - * Returns whether an alert is shown to the user when the pop-up window cannot be created as a result of a pop-up blocker. - * Default value is true. - */ - isComplainAboutPopUpBlocking(): boolean; - - /** - * Sets whether to announce to show an alert to the user when the pop-up window cannot be created as a result of a pop-up blocker. - */ - setComplainAboutPopUpBlocking(complainAboutPopUpBlocking: boolean): void; - - /** - * Returns whether new log messages are displayed at the top of the pop-up window. Default value is false (i.e. log messages - * are appended to the bottom of the window). - */ - isNewestMessageAtTop(): boolean; - - /** - * Sets whether to display new log messages at the top inside the pop-up window. - */ - setNewestMessageAtTop(newestMessageAtTop: boolean): void; - - /** - * Returns whether the pop-up window scrolls to display the latest log message when a new message is logged. Default value is true. - */ - isScrollToLatestMessage(): boolean; - - /** - * Sets whether to scroll the pop-up window to display the latest log message when a new message is logged. - */ - setScrollToLatestMessage(scrollToLatestMessage: boolean): void; - - /** - * Returns whether the pop-up window reopens automatically after being closed when a new log message is logged. Default value is false. - */ - isReopenWhenClosed(): boolean; - - /** - * Sets whether to reopen the pop-up window automatically after being closed when a new log message is logged. - */ - setReopenWhenClosed(reopenWhenClosed: boolean): void; - - /** - * Returns the outer width in pixels of the pop-up window. - */ - getWidth(): number; - - /** - * Sets the outer width in pixels of the pop-up window. - */ - setWidth(width: number): void; - - /** - * Returns the outer height in pixels of the pop-up window. - */ - getHeight(): number; - - /** - * Sets the outer height in pixels of the pop-up window. - */ - setHeight(height: number): void; - - /** - * Returns the largest number of log messages that are displayed and stored by the the console. Once reached, a new log - * message wil cause the oldest message to be discarded. Default value is null, which means no limit is applied. - */ - getMaxMessages(): number; - - /** - * Sets the largest number of messages displayed and stored by the console window. Set this to null to make this number unlimited. - */ - setMaxMessages(maxMessages: number): void; - - /** - * Returns whether the console includes a command line. Default value is true. - */ - isShowCommandLine(): boolean; - - /** - * Sets whether the console includes a command line. - */ - setShowCommandLine(showCommandLine: boolean): void; - - /** - * Returns the number of levels to expand when an object value is logged to the console. Each property of an object above - * this threshold will be expanded if it is itself an object or array, otherwise its string representation will be displayed. - * Default value is 1 (i.e. the properties of the object logged will be displayed in their string representation but not expanded). - */ - getCommandLineObjectExpansionDepth(): number; - - /** - * Sets the number of levels to expand when an object value is logged to the console. - */ - setCommandLineObjectExpansionDepth(expansionDepth: number): void; - - /** - * Returns a reference to the window in which commands typed into the command line are currently being executed. - */ - getCommandWindow(): Window; - - /** - * Sets the window in which commands typed into the command line are executed. - */ - setCommandWindow(commandWindow: Window): void; - - /** - * Returns the layout used to format the output for commands typed into the command line. The default value is a - * PatternLayout with pattern string %m - */ - getCommandLayout(): Layout; - - /** - * Sets the layout used to format the output for commands typed into the command line. - */ - setCommandLayout(commandLayout: Layout): void; - - /** - * Clears all messages from the console window. - */ - clear(): void; - - /** - * Closes the pop-up window. - */ - close(): void; - - /** - * Opens the pop-up window, if not already open. - */ - show(): void; - - /** - * Closes the pop-up window. - */ - hide(): void; - - /** - * Brings the console window to the top and gives it the focus. - */ - focus(): void; - - /** - * Brings the console window to the top and gives the focus to the command line. - */ - focusCommandLine(): void; - - /** - * Brings the console window to the top and gives the focus to the search box. - */ - focusSearch(): void; - - /** - * Evaluates the expression and appends the result to the console. - */ - evalCommandAndAppend(expr: string): void; - - /** - * Adds a function with the name specified to the list of functions available on the command line. This feature may be used - * to add custom functions to the command line. - */ - addCommandLineFunction(functionName: string, - commandLineFunction: { (appender: Appender, args: any, returnValue: { appendResult: boolean; isError: boolean; }): any; }): void; - } - - /** - * Logs messages to a console window in the page. The console is identical to that used by the PopUpAppender, except for the - * absence of a 'Close' button. - */ - export class InPageAppender extends Appender { - /** - * Constructor - * @param container The container element for the console window. This should be an HTML element. - * @param lazyInit Set this to true to create the console only when the first log message reaches the appender. Otherwise, - * the console is initialized as soon as the appender is created. If not specified, defaults to true. - * @param initiallyMinimized Whether the console window should start off hidden / minimized. If not specified, defaults to false - * @param useDocumentWrite Specifies how the console window is created. By default, the console window is created dynamically - * using document's write method. This has the advantage of keeping all the code in one single JavaScript file. However, - * if your page sets document.domain then the browser prevents script access to a window unless it too has the same value - * set for document.domain. To get round this issue, you can set useDocumentWrite to false and log4javascript will instead - * use the external HTML file console.html (or console_uncompressed.html if you're using an uncompressed version of - * log4javascript.js), which must be placed in the same directory as your log4javascript.js file. - * In general it's simpler to use the document.write method, so unless your page needs to set document.domain, - * useDocumentWrite should be set to true. - * If not specified, defaults to true. - * @param width The width of the console window. Any valid CSS length may be used. If not specified, defaults to 100%. - * @param height The height of the console window. Any valid CSS length may be used. If not specified, defaults to 250px. - */ - constructor(container: HTMLElement, lazyInit?: boolean, initiallyMinimized?: boolean, - useDocumentWrite?: boolean, width?: number, height?: number); - - /** - * Sets a CSS style property on the HTML element containing the console iframe. - */ - addCssProperty(name: string, value: string): void; - - /** - * Returns whether the console window is currently visible. - */ - isVisible(): boolean; - - /** - * Returns whether the console window starts off hidden / minimized. - */ - isInitiallyMinimized(): boolean; - - /** - * Sets whether the console window should start off hidden / minimized. - */ - setInitiallyMinimized(initiallyMinimized: boolean): void; - - /** - * Returns whether new log messages are displayed at the top of the pop-up window. Default value is false (i.e. log messages - * are appended to the bottom of the window). - */ - isNewestMessageAtTop(): boolean; - - /** - * Sets whether to display new log messages at the top inside the pop-up window. - */ - setNewestMessageAtTop(newestMessageAtTop: boolean): void; - - /** - * Returns whether the pop-up window scrolls to display the latest log message when a new message is logged. Default value is true. - */ - isScrollToLatestMessage(): boolean; - - /** - * Sets whether to scroll the pop-up window to display the latest log message when a new message is logged. - */ - setScrollToLatestMessage(scrollToLatestMessage: boolean): void; - - /** - * Returns the outer width of the console window. - */ - getWidth(): number; - - /** - * Sets the outer width of the console window. Any valid CSS length may be used. - */ - setWidth(width: number): void; - - /** - * Returns the outer height of the console window. - */ - getHeight(): number; - - /** - * Sets the outer height of the console window. Any valid CSS length may be used. - */ - setHeight(height: number): void; - - /** - * Returns the largest number of messages displayed and stored by the console window. - */ - getMaxMessages(): number; - - /** - * Sets the largest number of messages displayed and stored by the console window. Set this to null to make this number unlimited. - */ - setMaxMessages(maxMessages: number): void; - - /** - * Returns whether the console includes a command line. Default value is true. - */ - isShowCommandLine(): boolean; - - /** - * Sets whether the console includes a command line. - */ - setShowCommandLine(showCommandLine: boolean): void; - - /** - * Returns the number of levels to expand when an object value is logged to the console. Each property of an object above - * this threshold will be expanded if it is itself an object or array, otherwise its string representation will be displayed. - * Default value is 1 (i.e. the properties of the object logged will be displayed in their string representation but not expanded). - */ - getCommandLineObjectExpansionDepth(): number; - - /** - * Sets the number of levels to expand when an object value is logged to the console. - */ - setCommandLineObjectExpansionDepth(expansionDepth: number): void; - - /** - * Returns a reference to the window in which commands typed into the command line are currently being executed. - */ - getCommandWindow(): Window; - - /** - * Sets the window in which commands typed into the command line are executed. - */ - setCommandWindow(commandWindow: Window): void; - - /** - * Returns the layout used to format the output for commands typed into the command line. The default value is a - * PatternLayout with pattern string %m - */ - getCommandLayout(): Layout; - - /** - * Sets the layout used to format the output for commands typed into the command line. - */ - setCommandLayout(commandLayout: Layout): void; - - /** - * Clears all messages from the console window. - */ - clear(): void; - - /** - * Closes the pop-up window. - */ - close(): void; - - /** - * Shows / unhides the console window. - */ - show(): void; - - /** - * Hides / minimizes the console window. - */ - hide(): void; - - /** - * Brings the console window to the top and gives it the focus. - */ - focus(): void; - - /** - * Brings the console window to the top and gives the focus to the command line. - */ - focusCommandLine(): void; - - /** - * Brings the console window to the top and gives the focus to the search box. - */ - focusSearch(): void; - - /** - * Evaluates the expression and appends the result to the console. - */ - evalCommandAndAppend(expr: string): void; - - /** - * Adds a function with the name specified to the list of functions available on the command line. This feature may be used - * to add custom functions to the command line. - */ - addCommandLineFunction(functionName: string, - commandLineFunction: { (appender: Appender, args: any, returnValue: { appendResult: boolean; isError: boolean; }): any; }): void; - } - - /** - * Writes log messages to the browser's built-in console, if present. This only works currently in Safari, Opera and Firefox - * with the excellent Firebug extension installed. - */ - export class BrowserConsoleAppender extends Appender { - /** - * Constructor - */ - constructor(); - } - - //#endregion - - // #region Layouts - - /** - * There are a few methods common to all layouts. - */ - export class Layout { - /** - * Formats the log message. You should override this method in your own layouts. - */ - format(loggingEvent: LoggingEvent): string; - - /** - * Returns whether the layout ignores an error object in a logging event passed to its format method. - */ - ignoresThrowable(): boolean; - - /** - * Returns the content type of the output of the layout. - */ - getContentType(): string; - - /** - * Returns whether the layout's output is suitable for batching. JsonLayout and XmlLayout are the only built-in layouts that - * return true for this method. - */ - allowBatching(): boolean; - - /** - * Used internally by log4javascript in constructing formatted output for some layouts. - */ - getDataValues(loggingEvent: LoggingEvent): Array; - - /** - * This method is used to change the default keys used to create formatted name-value pairs for the properties of a log - * message, for layouts that do this. These layouts are JsonLayout and HttpPostDataLayout. - * @param loggerKey Parameter to use for the log message's logger name. Default is logger. - * @param timeStampKey Parameter to use for the log message's timestamp. Default is timestamp. - * @param levelKey Parameter to use for the log message's level. Default is level. - * @param messageKey Parameter to use for the message itself. Default is message. - * @param exceptionKey Parameter to use for the log message's error (exception). Default is exception. - * @param urlKey Parameter to use for the current page URL. Default is url. - */ - setKeys(loggerKey: string, timeStampKey: string, levelKey: string, messageKey: string, exceptionKey: string, urlKey: string): void; - - /** - * Some layouts (JsonLayout, HttpPostDataLayout, PatternLayout and XmlLayout) allow you to set custom fields (e.g. a session - * id to send to the server) to the formatted output. Use this method to set a custom field. If there is already a custom - * field with the specified name, its value will be updated with value. - * @param name Name of the custom property you wish to be included in the formmtted output. - * @param value Value of the custom property you wish to be included in the formatted output. - */ - setCustomField(name: string, value: string): string; - - /** - * Returns whether the layout has any custom fields. - */ - hasCustomFields(): boolean; - - formatWithException(loggingEvent: LoggingEvent): string; - } - - /** - * The most basic layout. NullLayout's format() methods performs no formatting at all and simply returns the message logged. - */ - export class NullLayout extends Layout { - /** - * Constructor - */ - constructor(); - } - - /** - * Provides basic formatting. SimpleLayout consists of the level of the log statement, followed by " - " and then the log message - * itself. For example, "DEBUG - Hello world". - */ - export class SimpleLayout extends Layout { - /** - * Constructor - */ - constructor(); - } - - /** - * Provides a flexible way of formatting a log message by means of a conversion pattern string. The behaviour of this layout is a - * full implementation of PatternLayout in log4j, with the exception of the set of conversion characters - log4javascript's is - * necessarily a subset of that of log4j with a few additions of its own, since many of the conversion characters in log4j only - * make sense in the context of Java. - * The conversion pattern consists of literal text interspersed with special strings starting with a % symbol called conversion - * specifiers. A conversion specifier consists of the % symbol, a conversion character (possible characters are listed below) and - * format modifiers. For full documentation of the conversion pattern, see log4j's documentation. - */ - export class PatternLayout extends Layout { - /** - * Built-in conversion pattern, equivalent to %r %p %c - %m%n. - */ - static TTCC_CONVERSION_PATTERN: string; - - /** - * Built-in conversion pattern, equivalent to %m%n. - */ - static DEFAULT_CONVERSION_PATTERN: string; - - /** - * Built-in date format (and also the default), equivalent to yyyy-MM-dd HH:mm:ss,SSS. - */ - static ISO8601_DATEFORMAT: string; - - /** - * Built-in date format, equivalent to dd MMM YYYY HH:mm:ss,SSS. - */ - static DATETIME_DATEFORMAT: string; - - /** - * Built-in date format, equivalent to HH:mm:ss,SSS. - */ - static ABSOLUTETIME_DATEFORMAT: string; - - /** - * Constructor - * @param pattern The conversion pattern string to use. - */ - constructor(pattern: string); - } - - /** - * Based on log4j's XmlLayout, this layout formats a log message as a fragment of XML. - */ - export class XmlLayout extends Layout { - /** - * Constructor - * @param combineMessages Whether or not to format multiple log messages as a combined single - * element composed of each individual message separated by line breaks or to include a element for - * each message inside one element. If not specified, defaults to true. - */ - constructor(combineMessages?: boolean); - } - - /** - * Formats a logging event into JavaScript Object Notation (JSON). JSON is a subset of JavaScript's object literal syntax, - * meaning that log messages formatted with this layout can be interpreted directly by JavaScript and converted into objects. - * See json.org for more details about JSON. - */ - export class JsonLayout extends Layout { - /** - * Constructor - * @param readable Whether or not to format each log message with line breaks and tabs. If not specified, defaults to false. - * @param combineMessages Whether or not to format multiple log messages as a combined single message property composed of - * each individual message separated by line breaks or to format multiple messages as an array. If not specified, defaults to true. - */ - constructor(readable?: boolean, combineMessages?: boolean); - - /** - * Returns whether or not to each log message is formatted with line breaks and tabs. - */ - isReadable(): boolean; - } - - /** - * Formats the log message as a simple URL-encoded string from which a simple server-side script may extract parameters such as - * the log message, severity and timestamp. This is the default layout for AjaxAppender. - */ - export class HttpPostDataLayout extends Layout { - /** - * Constructor - */ - constructor(); - } - - // #endregion - - // #region log4javascript error handling - - /** - * log4javascript has a single rudimentary logger-like object of its own to handle messages generated by log4javascript itself. - * This logger is called logLog and is accessed via log4javascript.logLog. - */ - export namespace logLog { - - /** - * Sets whether logLog is in quiet mode or not. In quiet mode, no messages sent to logLog have any visible effect. By default, - * quiet mode is switched off. - * @param quietMode Whether to turn quiet mode on or off. - */ - export function setQuietMode(quietMode: boolean): void; - - /** - * Sets how many errors logLog will display alerts for. By default, only the first error encountered generates an alert to the - * user. If you turn all errors on by supplying true to this method then all errors will generate alerts. - * @param showAllErrors Whether to show all errors or just the first. - */ - export function setAlertAllErrors(alertAllErrors: boolean): void; - - /** - * Logs a debugging message to an in-memory list. - */ - export function debug(message: string, exception?: Error): void; - - /** - * Displays an alert of all debugging messages. - */ - export function displayDebug(): void; - - /** - * Currently has no effect. - */ - export function warn(message: string, exception?: Error): void; - - /** - * Generates an alert to the user if and only if the error is the first one encountered and setAlertAllErrors(true) has not been called. - */ - export function error(message: string, exception?: Error): void; - - } - - // #endregion -} diff --git a/types/log4javascript/log4javascript-tests.ts b/types/log4javascript/log4javascript-tests.ts deleted file mode 100644 index 3ba497b890..0000000000 --- a/types/log4javascript/log4javascript-tests.ts +++ /dev/null @@ -1,61 +0,0 @@ - - -function aSimpleLoggingMessageString() { - var log = log4javascript.getDefaultLogger(); - log.info("Hello World"); -} - -function compareLogLevelsAndLog() { - var log = log4javascript.getDefaultLogger(); - if (log4javascript.Level.INFO.isGreaterOrEqual(log.getLevel())) { - log.log(log4javascript.Level.INFO, ["Info"]); - } -} - -function loggingAnErrorWithAMessage() { - var log = log4javascript.getDefaultLogger(); - try { - throw new Error("Faking something going wrong!"); - } catch (e) { - log.error("An error occurred", e); - } -} - -function loggingMultipleMessagesWithOneLoggingCall() { - var log = log4javascript.getDefaultLogger(); - var a = "Hello"; - var b = 3; - log.debug(a, b); -} - -function loggingAnObject() { - var log = log4javascript.getDefaultLogger(); - var obj = { name: "Octopus", tentacles: 8 }; - log.info(obj); -} - -function tweakingTheDefaultLogger() { - var log = log4javascript.getLogger(); - var popUpAppender = new log4javascript.PopUpAppender(); - popUpAppender.setFocusPopUp(true); - popUpAppender.setNewestMessageAtTop(true); - log.addAppender(popUpAppender); - log.debug("Hello world!"); -} - -function sendingLogMessagesToTheServer() { - var log = log4javascript.getLogger("mylogger"); - var url = "???"; - var ajaxAppender = new log4javascript.AjaxAppender(url); - log.addAppender(ajaxAppender); -} - -function changingTheFormatOfLogMessages() { - var popUpAppender = new log4javascript.PopUpAppender(); - var layout = new log4javascript.PatternLayout("[%-5p] %m"); - popUpAppender.setLayout(layout); -} - -function configureLogLog() { - log4javascript.logLog.setQuietMode(true); -} \ No newline at end of file diff --git a/types/log4javascript/tsconfig.json b/types/log4javascript/tsconfig.json deleted file mode 100644 index 27a94829c1..0000000000 --- a/types/log4javascript/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "log4javascript-tests.ts" - ] -} \ No newline at end of file diff --git a/types/log4javascript/tslint.json b/types/log4javascript/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/log4javascript/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 9a675f413634e8cb76a05067e83179e8701079a7 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 12 Dec 2017 12:45:26 -0800 Subject: [PATCH 062/890] next-redux-wrapper: Fix compile error --- types/next-redux-wrapper/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/next-redux-wrapper/index.d.ts b/types/next-redux-wrapper/index.d.ts index d8222d2e3c..a6b1da550e 100644 --- a/types/next-redux-wrapper/index.d.ts +++ b/types/next-redux-wrapper/index.d.ts @@ -28,7 +28,7 @@ declare function nextReduxWrapper) => nextReduxWrapper.NextReduxWrappedComponent; declare function nextReduxWrapper( createStore: nextReduxWrapper.NextStoreCreator, - mapStateToProps?: MapStateToPropsParam, + mapStateToProps?: MapStateToPropsParam, mapDispatchToProps?: MapDispatchToPropsParam, mergeProps?: MergeProps, options?: ConnectOptions @@ -49,7 +49,7 @@ declare namespace nextReduxWrapper { createStore: NextStoreCreator; debug?: boolean; storeKey?: string; - mapStateToProps?: MapStateToPropsParam; + mapStateToProps?: MapStateToPropsParam; mapDispatchToProps?: MapDispatchToPropsParam; mergeProps?: MergeProps; connectOptions?: ConnectOptions; From 4fcb01df978db2cae460ff8d80dc4745fe53383f Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 18 Dec 2017 12:13:04 -0800 Subject: [PATCH 063/890] hexo-fs: Fix lint --- types/hexo-fs/hexo-fs-tests.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/hexo-fs/hexo-fs-tests.ts b/types/hexo-fs/hexo-fs-tests.ts index d53a790ac1..fbfb6cb53a 100644 --- a/types/hexo-fs/hexo-fs-tests.ts +++ b/types/hexo-fs/hexo-fs-tests.ts @@ -595,7 +595,7 @@ it('emptyDir() - callback', callback => { join('folder', 'i.js') ]); - Promise.map([ + const dataArray: Array<[string, boolean]> = [ [join(target, '.hidden', 'a.txt'), true], [join(target, '.hidden', 'b.js'), true], [join(target, '.hidden', 'c', 'd'), true], @@ -605,7 +605,8 @@ it('emptyDir() - callback', callback => { [join(target, 'folder', 'h.txt'), false], [join(target, 'folder', 'i.js'), false], [join(target, 'folder', '.j'), true] - ] as Array<[string, boolean]>, data => { + ]; + Promise.map(dataArray, data => { return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); From 9fe945225791c5c16b92ba75b19bbc561aba01dd Mon Sep 17 00:00:00 2001 From: Nicholas Boll Date: Mon, 18 Dec 2017 15:20:31 -0700 Subject: [PATCH 064/890] fix(chai-jquery): Fix assertions that deviate from other assertions --- types/chai-jquery/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/chai-jquery/index.d.ts b/types/chai-jquery/index.d.ts index a5ed7aadbd..e84a1ec272 100644 --- a/types/chai-jquery/index.d.ts +++ b/types/chai-jquery/index.d.ts @@ -20,11 +20,11 @@ declare namespace Chai { text(text: string): Assertion; value(text: string): Assertion; descendants(selector: string): Assertion; - visible: Assertion; - hidden: Assertion; - selected: Assertion; - checked: Assertion; - disabled: Assertion; + visible(): Assertion; + hidden(): Assertion; + selected(): Assertion; + checked(): Assertion; + disabled(): Assertion; (selector: string): Assertion; } } From 477a845579c36edbf897203c5e851888dabe6d3a Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 19 Dec 2017 13:02:53 +0900 Subject: [PATCH 065/890] Update definitions to match version 2.1 --- types/react-icon-base/index.d.ts | 12 ++++-------- types/react-icon-base/react-icon-base-tests.tsx | 2 +- types/recompose/tsconfig.json | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/types/react-icon-base/index.d.ts b/types/react-icon-base/index.d.ts index e60719a762..1ee1d0eb85 100644 --- a/types/react-icon-base/index.d.ts +++ b/types/react-icon-base/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-icon-base 2.0 +// Type definitions for react-icon-base 2.1 // Project: https://github.com/gorangajic/react-icon-base#readme // Definitions by: Alexandre Paré , Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,12 +6,8 @@ import * as React from "react"; -export = IconBaseClass; - -declare namespace IconBaseClass { - interface IconBaseProps extends React.SVGProps { - size?: string | number; - } +export interface IconBaseProps extends React.SVGProps { + size?: string | number; } -declare class IconBaseClass extends React.Component {} +export default class IconBaseClass extends React.Component {} diff --git a/types/react-icon-base/react-icon-base-tests.tsx b/types/react-icon-base/react-icon-base-tests.tsx index cb4fe929a9..d89f97a2ca 100644 --- a/types/react-icon-base/react-icon-base-tests.tsx +++ b/types/react-icon-base/react-icon-base-tests.tsx @@ -1,4 +1,4 @@ import * as React from "react"; -import * as IconBase from "react-icon-base"; +import IconBase from "react-icon-base"; export default ; diff --git a/types/recompose/tsconfig.json b/types/recompose/tsconfig.json index 4c56e4b125..4aae173e9b 100644 --- a/types/recompose/tsconfig.json +++ b/types/recompose/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "recompose-tests.tsx" ] -} \ No newline at end of file +} From 53847ce07db8bc7601fe3e10ffb1565c2531be2c Mon Sep 17 00:00:00 2001 From: Patrick Lee Date: Tue, 19 Dec 2017 15:47:30 +1100 Subject: [PATCH 066/890] Add Mousetrap.addKeycodes from 1.6 --- types/mousetrap/index.d.ts | 3 ++- types/mousetrap/test/index.ts | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/types/mousetrap/index.d.ts b/types/mousetrap/index.d.ts index afd0f42cf7..b7e245f5e5 100644 --- a/types/mousetrap/index.d.ts +++ b/types/mousetrap/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mousetrap 1.5.x +// Type definitions for Mousetrap 1.6.x // Project: http://craig.is/killing/mice // Definitions by: Dániel Tar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -11,6 +11,7 @@ interface ExtendedKeyboardEvent extends KeyboardEvent { interface MousetrapStatic { (el: Element): MousetrapInstance; new (el: Element): MousetrapInstance; + addKeycodes({ [key: number]: string }); stopCallback: (e: ExtendedKeyboardEvent, element: Element, combo: string) => boolean; bind(keys: string|string[], callback: (e: ExtendedKeyboardEvent, combo: string) => any, action?: string): void; unbind(keys: string|string[], action?: string): void; diff --git a/types/mousetrap/test/index.ts b/types/mousetrap/test/index.ts index 0ae40ea622..fae472b76f 100644 --- a/types/mousetrap/test/index.ts +++ b/types/mousetrap/test/index.ts @@ -39,6 +39,10 @@ Mousetrap.unbind('?'); Mousetrap.trigger('esc'); Mousetrap.trigger('esc', 'keyup'); +// Test that custom keycodes can be added. +Mousetrap.addKeycodes({ 144: 'numlock' }); +Mousetrap.bind('numlock', function() { console.log('numlock'); }); + Mousetrap.reset(); // Test that we can create an instance of mousetrap and attach the From 76b46e2586ac26720dc518f83909c346ee73613d Mon Sep 17 00:00:00 2001 From: Patrick Lee Date: Tue, 19 Dec 2017 16:07:46 +1100 Subject: [PATCH 067/890] Fix --- types/mousetrap/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mousetrap/index.d.ts b/types/mousetrap/index.d.ts index b7e245f5e5..d55559e3af 100644 --- a/types/mousetrap/index.d.ts +++ b/types/mousetrap/index.d.ts @@ -11,7 +11,7 @@ interface ExtendedKeyboardEvent extends KeyboardEvent { interface MousetrapStatic { (el: Element): MousetrapInstance; new (el: Element): MousetrapInstance; - addKeycodes({ [key: number]: string }); + addKeycodes(keycodes: { [key: number]: string }): void; stopCallback: (e: ExtendedKeyboardEvent, element: Element, combo: string) => boolean; bind(keys: string|string[], callback: (e: ExtendedKeyboardEvent, combo: string) => any, action?: string): void; unbind(keys: string|string[], action?: string): void; From 33e30f31eee5f7dc94c30154ce788f676c66afca Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 19 Dec 2017 14:46:44 +0900 Subject: [PATCH 068/890] Fix props type --- types/react-icon-base/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-icon-base/index.d.ts b/types/react-icon-base/index.d.ts index 1ee1d0eb85..0bd0005244 100644 --- a/types/react-icon-base/index.d.ts +++ b/types/react-icon-base/index.d.ts @@ -10,4 +10,4 @@ export interface IconBaseProps extends React.SVGProps { size?: string | number; } -export default class IconBaseClass extends React.Component {} +export default class IconBaseClass extends React.Component {} From 5777a0e08342f55f1876715356187d18682efd72 Mon Sep 17 00:00:00 2001 From: Totooria Hyperion Date: Tue, 19 Dec 2017 14:24:28 +0800 Subject: [PATCH 069/890] add missing types to loader-utils --- types/loader-utils/index.d.ts | 5 +++++ types/loader-utils/loader-utils-tests.ts | 27 +++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/types/loader-utils/index.d.ts b/types/loader-utils/index.d.ts index ba6be659f1..a178ada777 100644 --- a/types/loader-utils/index.d.ts +++ b/types/loader-utils/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for loader-utils 1.1 // Project: https://github.com/webpack/loader-utils#readme // Definitions by: Gyusun Yeom +// Totooria Hyperion // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -20,6 +21,10 @@ export type DigestType = "hex" | "base26" | "base32" | "base36" | "base49" | "ba export function getOptions(loaderContext: loader.LoaderContext): OptionObject; export function parseQuery(optionString: string): OptionObject; export function stringifyRequest(loaderContext: loader.LoaderContext, resource: string): string; +export function getRemainingRequest(loaderContext: loader.LoaderContext): string; +export function getCurrentRequest(loaderContext: loader.LoaderContext): string; +export function isUrlRequest(url: string, root?: string): boolean; +export function parseString(str: string): string; export function urlToRequest(url: string, root?: string): string; export function interpolateName(loaderContext: loader.LoaderContext, name: string, options?: any): string; export function getHashDigest(buffer: Buffer, hashType: HashType, digestType: DigestType, maxLength: number): string; diff --git a/types/loader-utils/loader-utils-tests.ts b/types/loader-utils/loader-utils-tests.ts index 6ce002a5d1..d54e773eec 100644 --- a/types/loader-utils/loader-utils-tests.ts +++ b/types/loader-utils/loader-utils-tests.ts @@ -1,11 +1,32 @@ import { loader } from "webpack"; -import { getOptions, parseQuery, stringifyRequest, urlToRequest, interpolateName, getHashDigest } from "loader-utils"; +import { + getOptions, + parseQuery, + stringifyRequest, + urlToRequest, + interpolateName, + getHashDigest, + getRemainingRequest, + getCurrentRequest, + isUrlRequest, + parseString, +} from "loader-utils"; parseQuery("?{data:{a:1},isJSON5:true}"); +parseString(`"123"`); // "123" +parseString(`'123'`); // "123" +parseString(`123`); // "123" +const jsonStr = JSON.stringify({ a: 1, b: 2 }); +const parsed = parseString(jsonStr); +jsonStr === parsed; // true function loader(this: loader.LoaderContext) { getOptions(this); + getRemainingRequest(this); + + getCurrentRequest(this); + stringifyRequest(this, "./test.js"); // "\"./test.js\"" @@ -35,6 +56,10 @@ urlToRequest("path/to/module.js"); // "./path/to/module.js" urlToRequest("~path/to/module.js"); // "path/to/module.js" urlToRequest("/path/to/module.js", "./root"); // "./root/path/to/module.js" urlToRequest("/path/to/module.js", "~"); // "path/to/module.js" +isUrlRequest("path/to/module.js"); +isUrlRequest("~path/to/module.js"); +isUrlRequest("/path/to/module.js", "./root"); +isUrlRequest("/path/to/module.js", "~"); function loader2(this: loader.LoaderContext) { // loaderContext.resourcePath = "/app/js/javascript.js" From 296fcf388e170b615f0dfa524a3040be60dddcc9 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 19 Dec 2017 17:31:01 +0800 Subject: [PATCH 070/890] fixed the lint one by one --- types/mirrorx/index.d.ts | 162 ++++++++++++++------------------- types/mirrorx/mirrorx-tests.ts | 10 +- 2 files changed, 73 insertions(+), 99 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 9cea8531dc..28a5fcf5ff 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -1,53 +1,39 @@ -// Type definitions for mirrorjs +// Type definitions for mirrorjs 0.2.10 // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import * as React from 'react'; import * as H from 'history'; -import { - ReactInstance, Component, ComponentState, - ReactElement, SFCElement, CElement, - DOMAttributes, DOMElement, ReactNode, ReactPortal -} from 'react'; -import { - History, - Location, - Path, - LocationState, - LocationDescriptor -} from 'history'; + +import * as React from 'react'; import { Connect } from 'react-redux'; import { match } from "react-router"; - export = mirror; export as namespace mirror; declare namespace mirror { - type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; + type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]; type Omit = Pick>; interface model { - name:string, - initialState?:any, - reducers?:any, - effects?:any - } - - interface _model { - name:string, - reducers:any + name: string; + initialState?: any; + reducers?: any; + effects?: any; } + interface _model { + name: string; + reducers: any; + } interface LinkProps extends React.AnchorHTMLAttributes { to: H.LocationDescriptor; replace?: boolean; } - interface NavLinkProps extends LinkProps { activeClassName?: string; activeStyle?: React.CSSProperties; @@ -99,121 +85,109 @@ declare namespace mirror { } interface RouterAction { - type:'@@router/CALL_HISTORY_METHOD', + type: '@@router/CALL_HISTORY_METHOD'; payload: LocationActionPayload; } - + interface routeActions { - push(location:any,state?:any):RouterAction, - replace(location:any,state?:any):RouterAction, - go(n:number):RouterAction, - goBack(): RouterAction, - goForward(): RouterAction + push(location: any, state?: any): RouterAction; + replace(location: any, state?: any): RouterAction; + go(n: number): RouterAction; + goBack(): RouterAction; + goForward(): RouterAction; } export interface ConnectedRouterProps { store?: any; - history?: History; -} + history?: H.History; + } interface Actions { - routing:routeActions, - [propName: string]: any + routing: routeActions; + [propName: string]: any; } interface defaultOptions { - initialState?:{}, - historyMode?:string, - middlewares:any[], - reducers:{}, - addEffect(name:string,handler:()=>any):any + initialState?: {}; + historyMode?: string; + middlewares: any[]; + reducers: {}; + addEffect(name: string, handler: () => any): any; } interface Renderer { // Deprecated(render): The return value is deprecated. // In future releases the render function's return type will be void. - ( - element: DOMElement, T>, - container: Element | null, - callback?: () => void + element: React.DOMElement, T>, + container: Element | null, + callback?: () => void ): T; ( - element: Array, any>>, - container: Element | null, - callback?: () => void + element: Array, any>>, + container: Element | null, + callback?: () => void ): Element; ( - element: SFCElement | Array>, - container: Element | null, - callback?: () => void + element: React.SFCElement | Array>, + container: Element | null, + callback?: () => void ): void; - >( - element: CElement, - container: Element | null, - callback?: () => void + >( + element: React.CElement, + container: Element | null, + callback?: () => void ): T; ( - element: Array>>, - container: Element | null, - callback?: () => void - ): Component; + element: Array>>, + container: Element | null, + callback?: () => void + ): React.Component;

( - element: ReactElement

, - container: Element | null, - callback?: () => void - ): Component | Element | void; + element: React.ReactElement

, + container: Element | null, + callback?: () => void + ): React.Component | Element | void; ( - element: Array>, - container: Element | null, - callback?: () => void - ): Component | Element | void; + element: Array>, + container: Element | null, + callback?: () => void + ): React.Component | Element | void; ( - parentComponent: Component | Array>, - element: SFCElement, - container: Element, - callback?: () => void + parentComponent: React.Component | Array>, + element: React.SFCElement, + container: Element, + callback?: () => void ): void; -} + } /** * This method is used to create and inject a model. - * @param options + * @param options */ - function model(options:model):_model + function model(options: model): _model; /** * connect connects your React component to your Redux store */ - const connect:Connect - //The actions object contains both your Redux actions and reducers. - const actions:Actions - //Add a hook to monitor actions that have been dispatched. - const hook:(subscriber:()=>any)=>any - //mirror.defaults is a pretty intuitive API, you use it to configure your Mirror app. - const defaults:(options:defaultOptions)=>void - //render is an enhanced ReactDOM.render, it starts your Mirror app. + const connect: Connect; + const actions: Actions; + const hook: (subscriber: () => any) => any; + const defaults: (options: defaultOptions) => void; const render: Renderer; - // Mirror uses react-router@4.x, so if you're from react-router 2.x/3.x, you should checkout the Migrating from v2/v3 to v4 Guide. - class Router extends React.Component> {} - class Link extends React.Component {} - - class NavLink extends React.Component {} - + class Router extends React.Component> { } + class Link extends React.Component { } + class NavLink extends React.Component { } class Redirect extends React.Component { } - class Route extends React.Component { } - class Prompt extends React.Component { } - function withRouter

>(component: React.ComponentType

): React.ComponentClass>>; - function withRouter>(target: TFunction): TFunction; -} \ No newline at end of file +} diff --git a/types/mirrorx/mirrorx-tests.ts b/types/mirrorx/mirrorx-tests.ts index 11f1af29da..50d4f3dbe7 100644 --- a/types/mirrorx/mirrorx-tests.ts +++ b/types/mirrorx/mirrorx-tests.ts @@ -1,9 +1,9 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import mirror, { actions } from 'mirrorx'; -/** - * add mirror.model.tests - */ +import mirror = require('mirrorx'); + /** + * add mirror.model.tests + */ mirror.model({ name: 'app', initialState: 0, @@ -18,7 +18,7 @@ mirror.model({ resolve(); }, 1000); }); - actions.app.increment(); + mirror.actions.app.increment(); } } }); From ef9857f1ec4f7bfe93f23ac424f8118e40ee06cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szabolcs=20Sz=C5=91ke?= Date: Tue, 19 Dec 2017 11:41:29 +0200 Subject: [PATCH 071/890] Added missing autoReload param to InfiniteLoader.resetLoadMoreRowsCache --- types/react-virtualized/dist/es/InfiniteLoader.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-virtualized/dist/es/InfiniteLoader.d.ts b/types/react-virtualized/dist/es/InfiniteLoader.d.ts index 746ddc71f0..c247ad3c0e 100644 --- a/types/react-virtualized/dist/es/InfiniteLoader.d.ts +++ b/types/react-virtualized/dist/es/InfiniteLoader.d.ts @@ -77,7 +77,7 @@ export class InfiniteLoader extends PureComponent { constructor(props: InfiniteLoaderProps, context: any); - resetLoadMoreRowsCache(): void; + resetLoadMoreRowsCache(autoReload?: boolean): void; render(): JSX.Element; } From 9d9ff815ddbbdcdef5a2fef480a6a57586c32435 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 19 Dec 2017 17:57:15 +0800 Subject: [PATCH 072/890] update code for header --- types/mirrorx/index.d.ts | 7 +++---- types/mirrorx/mirrorx-tests.ts | 12 ++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 28a5fcf5ff..1d8da94593 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for mirrorjs 0.2.10 +// Type definitions for mirrorx 0.2.10 // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -11,9 +11,6 @@ import * as React from 'react'; import { Connect } from 'react-redux'; import { match } from "react-router"; -export = mirror; -export as namespace mirror; - declare namespace mirror { type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]; @@ -191,3 +188,5 @@ declare namespace mirror { function withRouter

>(component: React.ComponentType

): React.ComponentClass>>; function withRouter>(target: TFunction): TFunction; } + +export = mirror; \ No newline at end of file diff --git a/types/mirrorx/mirrorx-tests.ts b/types/mirrorx/mirrorx-tests.ts index 50d4f3dbe7..c608828e14 100644 --- a/types/mirrorx/mirrorx-tests.ts +++ b/types/mirrorx/mirrorx-tests.ts @@ -1,9 +1,9 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; import mirror = require('mirrorx'); - /** - * add mirror.model.tests - */ +/** + * add mirror.model.tests + */ mirror.model({ name: 'app', initialState: 0, @@ -14,9 +14,9 @@ mirror.model({ effects: { async incrementAsync() { await new Promise((resolve, reject) => { - setTimeout(() => { - resolve(); - }, 1000); + setTimeout(() => { + resolve(); + }, 1000); }); mirror.actions.app.increment(); } From 51a19edb2e308469b955a2aead73c86e14cbc878 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 19 Dec 2017 18:47:47 +0800 Subject: [PATCH 073/890] fix the lint --- types/mirrorx/index.d.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 1d8da94593..e3f69f83b5 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for mirrorx 0.2.10 +// Type definitions for mirrorx 0.2 // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,7 +12,6 @@ import { Connect } from 'react-redux'; import { match } from "react-router"; declare namespace mirror { - type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]; type Omit = Pick>; @@ -36,7 +35,7 @@ declare namespace mirror { activeStyle?: React.CSSProperties; exact?: boolean; strict?: boolean; - isActive?

(match: match

, location: H.Location): boolean; + isActive?(match: match, location: H.Location): boolean; location?: H.Location; } @@ -94,7 +93,7 @@ declare namespace mirror { goForward(): RouterAction; } - export interface ConnectedRouterProps { + interface ConnectedRouterProps { store?: any; history?: H.History; } @@ -167,7 +166,6 @@ declare namespace mirror { /** * This method is used to create and inject a model. - * @param options */ function model(options: model): _model; /** @@ -175,10 +173,9 @@ declare namespace mirror { */ const connect: Connect; const actions: Actions; - const hook: (subscriber: () => any) => any; - const defaults: (options: defaultOptions) => void; + function hook():(subscriber: () => any) => any; + function defaults():(options: defaultOptions) => void; const render: Renderer; - class Router extends React.Component> { } class Link extends React.Component { } class NavLink extends React.Component { } @@ -186,7 +183,7 @@ declare namespace mirror { class Route extends React.Component { } class Prompt extends React.Component { } function withRouter

>(component: React.ComponentType

): React.ComponentClass>>; - function withRouter>(target: TFunction): TFunction; + function withRouter>(target: TFunction): TFunction; } export = mirror; \ No newline at end of file From cc4eb7aee2e321514321e45741b8eb8ccda76117 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 19 Dec 2017 19:02:09 +0800 Subject: [PATCH 074/890] update code --- types/mirrorx/index.d.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index e3f69f83b5..7d50c039aa 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -173,8 +173,8 @@ declare namespace mirror { */ const connect: Connect; const actions: Actions; - function hook():(subscriber: () => any) => any; - function defaults():(options: defaultOptions) => void; + function hook(): (subscriber: () => any) => any; + function defaults(): (options: defaultOptions) => void; const render: Renderer; class Router extends React.Component> { } class Link extends React.Component { } @@ -183,7 +183,9 @@ declare namespace mirror { class Route extends React.Component { } class Prompt extends React.Component { } function withRouter

>(component: React.ComponentType

): React.ComponentClass>>; - function withRouter>(target: TFunction): TFunction; + function withRouter>(target: TFunction): TFunction; +} +declare module "mirror" { + export = mirror; } -export = mirror; \ No newline at end of file From ab9d42ec5dd6c5b85f3f2d6ae37fa661c28a6f1f Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 19 Dec 2017 19:07:15 +0800 Subject: [PATCH 075/890] update code for css --- types/mirrorx/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 7d50c039aa..f1c112e6ed 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -11,7 +11,7 @@ import * as React from 'react'; import { Connect } from 'react-redux'; import { match } from "react-router"; -declare namespace mirror { +export namespace mirror { type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]; type Omit = Pick>; @@ -187,5 +187,4 @@ declare namespace mirror { } declare module "mirror" { export = mirror; -} - +} \ No newline at end of file From 130e9022d06e45cf31e27533b3a22fa6cba2b7dd Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 19 Dec 2017 19:15:06 +0800 Subject: [PATCH 076/890] update code for newlint --- types/mirrorx/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index f1c112e6ed..2ef6735ff4 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -186,5 +186,7 @@ export namespace mirror { function withRouter>(target: TFunction): TFunction; } declare module "mirror" { + export = mirror; + } \ No newline at end of file From 8c4a5ba399ecc7b92addfe77f22d791c8bf52b06 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 19 Dec 2017 19:26:00 +0800 Subject: [PATCH 077/890] update code for dd --- notNeededPackages.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/notNeededPackages.json b/notNeededPackages.json index 7541a88848..286e340606 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -839,6 +839,12 @@ "typingsPackageName": "zone.js", "sourceRepoURL": "https://github.com/angular/zone.js", "asOfVersion": "0.5.12" + }, + { + "libraryName": "mirror", + "typingsPackageName": "mirrorx", + "sourceRepoURL": "https://github.com/mirrorjs/mirror", + "asOfVersion": "0.2.10" } ] } From 07ef93108e5f67d3157c68bb8c3fe0b7005f4167 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 19 Dec 2017 19:31:04 +0800 Subject: [PATCH 078/890] newline fixed --- types/mirrorx/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 2ef6735ff4..910e516d4b 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -186,7 +186,5 @@ export namespace mirror { function withRouter>(target: TFunction): TFunction; } declare module "mirror" { - export = mirror; - -} \ No newline at end of file +} From 8de03ce022aa44b38c4c09d4eab062e5641f050e Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 19 Dec 2017 19:40:46 +0800 Subject: [PATCH 079/890] change the defi --- types/mirrorx/index.d.ts | 343 +++++++++++++++++++-------------------- 1 file changed, 169 insertions(+), 174 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 910e516d4b..936078e9de 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -11,180 +11,175 @@ import * as React from 'react'; import { Connect } from 'react-redux'; import { match } from "react-router"; -export namespace mirror { - type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]; - type Omit = Pick>; +type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]; +type Omit = Pick>; - interface model { - name: string; - initialState?: any; - reducers?: any; - effects?: any; - } - - interface _model { - name: string; - reducers: any; - } - interface LinkProps extends React.AnchorHTMLAttributes { - to: H.LocationDescriptor; - replace?: boolean; - } - interface NavLinkProps extends LinkProps { - activeClassName?: string; - activeStyle?: React.CSSProperties; - exact?: boolean; - strict?: boolean; - isActive?(match: match, location: H.Location): boolean; - location?: H.Location; - } - - interface SwitchProps { - children?: React.ReactNode; - location?: H.Location; - } - - interface RedirectProps { - to: H.LocationDescriptor; - push?: boolean; - from?: string; - path?: string; - exact?: boolean; - strict?: boolean; - } - - interface RouteComponentProps

{ - match: match

; - location: H.Location; - history: H.History; - staticContext?: any; - } - - interface RouteProps { - location?: H.Location; - component?: React.ComponentType> | React.ComponentType; - render?: ((props: RouteComponentProps) => React.ReactNode); - children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; - path?: string; - exact?: boolean; - strict?: boolean; - } - - interface PromptProps { - message: string | ((location: H.Location) => string | boolean); - when?: boolean; - } - - interface LocationActionPayload { - method: string; - args?: any[]; - } - - interface RouterAction { - type: '@@router/CALL_HISTORY_METHOD'; - payload: LocationActionPayload; - } - - interface routeActions { - push(location: any, state?: any): RouterAction; - replace(location: any, state?: any): RouterAction; - go(n: number): RouterAction; - goBack(): RouterAction; - goForward(): RouterAction; - } - - interface ConnectedRouterProps { - store?: any; - history?: H.History; - } - - interface Actions { - routing: routeActions; - [propName: string]: any; - } - - interface defaultOptions { - initialState?: {}; - historyMode?: string; - middlewares: any[]; - reducers: {}; - addEffect(name: string, handler: () => any): any; - } - - interface Renderer { - // Deprecated(render): The return value is deprecated. - // In future releases the render function's return type will be void. - ( - element: React.DOMElement, T>, - container: Element | null, - callback?: () => void - ): T; - - ( - element: Array, any>>, - container: Element | null, - callback?: () => void - ): Element; - - ( - element: React.SFCElement | Array>, - container: Element | null, - callback?: () => void - ): void; - - >( - element: React.CElement, - container: Element | null, - callback?: () => void - ): T; - - ( - element: Array>>, - container: Element | null, - callback?: () => void - ): React.Component; - -

( - element: React.ReactElement

, - container: Element | null, - callback?: () => void - ): React.Component | Element | void; - - ( - element: Array>, - container: Element | null, - callback?: () => void - ): React.Component | Element | void; - - ( - parentComponent: React.Component | Array>, - element: React.SFCElement, - container: Element, - callback?: () => void - ): void; - } - - /** - * This method is used to create and inject a model. - */ - function model(options: model): _model; - /** - * connect connects your React component to your Redux store - */ - const connect: Connect; - const actions: Actions; - function hook(): (subscriber: () => any) => any; - function defaults(): (options: defaultOptions) => void; - const render: Renderer; - class Router extends React.Component> { } - class Link extends React.Component { } - class NavLink extends React.Component { } - class Redirect extends React.Component { } - class Route extends React.Component { } - class Prompt extends React.Component { } - function withRouter

>(component: React.ComponentType

): React.ComponentClass>>; - function withRouter>(target: TFunction): TFunction; +interface model { + name: string; + initialState?: any; + reducers?: any; + effects?: any; } -declare module "mirror" { - export = mirror; + +interface _model { + name: string; + reducers: any; } +interface LinkProps extends React.AnchorHTMLAttributes { + to: H.LocationDescriptor; + replace?: boolean; +} +interface NavLinkProps extends LinkProps { + activeClassName?: string; + activeStyle?: React.CSSProperties; + exact?: boolean; + strict?: boolean; + isActive?(match: match, location: H.Location): boolean; + location?: H.Location; +} + +interface SwitchProps { + children?: React.ReactNode; + location?: H.Location; +} + +interface RedirectProps { + to: H.LocationDescriptor; + push?: boolean; + from?: string; + path?: string; + exact?: boolean; + strict?: boolean; +} + +interface RouteComponentProps

{ + match: match

; + location: H.Location; + history: H.History; + staticContext?: any; +} + +interface RouteProps { + location?: H.Location; + component?: React.ComponentType> | React.ComponentType; + render?: ((props: RouteComponentProps) => React.ReactNode); + children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; + path?: string; + exact?: boolean; + strict?: boolean; +} + +interface PromptProps { + message: string | ((location: H.Location) => string | boolean); + when?: boolean; +} + +interface LocationActionPayload { + method: string; + args?: any[]; +} + +interface RouterAction { + type: '@@router/CALL_HISTORY_METHOD'; + payload: LocationActionPayload; +} + +interface routeActions { + push(location: any, state?: any): RouterAction; + replace(location: any, state?: any): RouterAction; + go(n: number): RouterAction; + goBack(): RouterAction; + goForward(): RouterAction; +} + +interface ConnectedRouterProps { + store?: any; + history?: H.History; +} + +interface Actions { + routing: routeActions; + [propName: string]: any; +} + +interface defaultOptions { + initialState?: {}; + historyMode?: string; + middlewares: any[]; + reducers: {}; + addEffect(name: string, handler: () => any): any; +} + +interface Renderer { + // Deprecated(render): The return value is deprecated. + // In future releases the render function's return type will be void. + ( + element: React.DOMElement, T>, + container: Element | null, + callback?: () => void + ): T; + + ( + element: Array, any>>, + container: Element | null, + callback?: () => void + ): Element; + + ( + element: React.SFCElement | Array>, + container: Element | null, + callback?: () => void + ): void; + + >( + element: React.CElement, + container: Element | null, + callback?: () => void + ): T; + + ( + element: Array>>, + container: Element | null, + callback?: () => void + ): React.Component; + +

( + element: React.ReactElement

, + container: Element | null, + callback?: () => void + ): React.Component | Element | void; + + ( + element: Array>, + container: Element | null, + callback?: () => void + ): React.Component | Element | void; + + ( + parentComponent: React.Component | Array>, + element: React.SFCElement, + container: Element, + callback?: () => void + ): void; +} + +/** + * This method is used to create and inject a model. + */ +export function model(options: model): _model; +/** + * connect connects your React component to your Redux store + */ +export const connect: Connect; +export const actions: Actions; +export function hook(): (subscriber: () => any) => any; +export function defaults(): (options: defaultOptions) => void; +export const render: Renderer; +export class Router extends React.Component> { } +export class Link extends React.Component { } +export class NavLink extends React.Component { } +export class Redirect extends React.Component { } +export class Route extends React.Component { } +export class Prompt extends React.Component { } +export function withRouter

>(component: React.ComponentType

): React.ComponentClass>>; +export function withRouter>(target: TFunction): TFunction; From 6b2af09a5c4bdfa42af077f2d2119be58755bdf0 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 19 Dec 2017 19:46:30 +0800 Subject: [PATCH 080/890] add export --- types/mirrorx/index.d.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 936078e9de..986287c5ad 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -11,25 +11,25 @@ import * as React from 'react'; import { Connect } from 'react-redux'; import { match } from "react-router"; -type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]; -type Omit = Pick>; +export type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]; +export type Omit = Pick>; -interface model { +export interface model { name: string; initialState?: any; reducers?: any; effects?: any; } -interface _model { +export interface _model { name: string; reducers: any; } -interface LinkProps extends React.AnchorHTMLAttributes { +export interface LinkProps extends React.AnchorHTMLAttributes { to: H.LocationDescriptor; replace?: boolean; } -interface NavLinkProps extends LinkProps { +export interface NavLinkProps extends LinkProps { activeClassName?: string; activeStyle?: React.CSSProperties; exact?: boolean; @@ -38,12 +38,12 @@ interface NavLinkProps extends LinkProps { location?: H.Location; } -interface SwitchProps { +export interface SwitchProps { children?: React.ReactNode; location?: H.Location; } -interface RedirectProps { +export interface RedirectProps { to: H.LocationDescriptor; push?: boolean; from?: string; @@ -52,14 +52,14 @@ interface RedirectProps { strict?: boolean; } -interface RouteComponentProps

{ +export interface RouteComponentProps

{ match: match

; location: H.Location; history: H.History; staticContext?: any; } -interface RouteProps { +export interface RouteProps { location?: H.Location; component?: React.ComponentType> | React.ComponentType; render?: ((props: RouteComponentProps) => React.ReactNode); @@ -69,22 +69,22 @@ interface RouteProps { strict?: boolean; } -interface PromptProps { +export interface PromptProps { message: string | ((location: H.Location) => string | boolean); when?: boolean; } -interface LocationActionPayload { +export interface LocationActionPayload { method: string; args?: any[]; } -interface RouterAction { +export interface RouterAction { type: '@@router/CALL_HISTORY_METHOD'; payload: LocationActionPayload; } -interface routeActions { +export interface routeActions { push(location: any, state?: any): RouterAction; replace(location: any, state?: any): RouterAction; go(n: number): RouterAction; @@ -92,17 +92,17 @@ interface routeActions { goForward(): RouterAction; } -interface ConnectedRouterProps { +export interface ConnectedRouterProps { store?: any; history?: H.History; } -interface Actions { +export interface Actions { routing: routeActions; [propName: string]: any; } -interface defaultOptions { +export interface defaultOptions { initialState?: {}; historyMode?: string; middlewares: any[]; @@ -110,7 +110,7 @@ interface defaultOptions { addEffect(name: string, handler: () => any): any; } -interface Renderer { +export interface Renderer { // Deprecated(render): The return value is deprecated. // In future releases the render function's return type will be void. ( From d5f272b976d355f665bbdb263bcfcb06b9553450 Mon Sep 17 00:00:00 2001 From: Danilo Spinelli Date: Tue, 19 Dec 2017 15:05:06 +0100 Subject: [PATCH 081/890] documentdb: update _ts property type _ts (retrieved from documentdb documents) is a number (not a string) --- types/documentdb/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/documentdb/index.d.ts b/types/documentdb/index.d.ts index 73ec95787c..c1fbc38631 100644 --- a/types/documentdb/index.d.ts +++ b/types/documentdb/index.d.ts @@ -133,7 +133,7 @@ export interface AbstractMeta extends UniqueId { _self: string; /** The time the object was created. */ - _ts: string; + _ts: string | number; _rid?: string; _etag?: string; From 12381495d57f5ddb85ef4c56b6bc52258c892c67 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 19 Dec 2017 08:05:29 -0800 Subject: [PATCH 082/890] metismenu: Provides its own types --- notNeededPackages.json | 6 +++ types/metismenu/index.d.ts | 23 --------- types/metismenu/metismenu-tests.ts | 26 ---------- types/metismenu/tsconfig.json | 24 --------- types/metismenu/tslint.json | 79 ------------------------------ 5 files changed, 6 insertions(+), 152 deletions(-) delete mode 100644 types/metismenu/index.d.ts delete mode 100644 types/metismenu/metismenu-tests.ts delete mode 100644 types/metismenu/tsconfig.json delete mode 100644 types/metismenu/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 38c0a39808..55271eb8a9 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -432,6 +432,12 @@ "sourceRepoURL": "http://www.mendix.com", "asOfVersion": "0.8.1" }, + { + "libraryName": "metisMenu", + "typingsPackageName": "metismenu", + "sourceRepoURL": "https://github.com/onokumus/metisMenu", + "asOfVersion": "2.7.1" + }, { "libraryName": "mobservable", "typingsPackageName": "mobservable", diff --git a/types/metismenu/index.d.ts b/types/metismenu/index.d.ts deleted file mode 100644 index 6cc1eab886..0000000000 --- a/types/metismenu/index.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Type definitions for metisMenu 2.6 -// Project: https://github.com/onokumus/metisMenu -// Definitions by: onokums , denis -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -interface MetisMenuOptions { - toggle?: boolean; - activeClass?: string; - collapseClass?: string; - collapseInClass?: string; - collapsingClass?: string; - preventDefault?: boolean; -} - -type MetisMenuEvents = "show.metisMenu" | "shown.metisMenu" | "hide.metisMenu" | "hidden.metisMenu"; - -interface JQuery { - metisMenu(options?: MetisMenuOptions | "dispose"): JQuery; - on(events: MetisMenuEvents, handler: (eventObject: JQueryEventObject) => any): JQuery; -} diff --git a/types/metismenu/metismenu-tests.ts b/types/metismenu/metismenu-tests.ts deleted file mode 100644 index 64aa809cf7..0000000000 --- a/types/metismenu/metismenu-tests.ts +++ /dev/null @@ -1,26 +0,0 @@ -$('#menu').metisMenu(); - -$('.metismenu').metisMenu({toggle: false}); - -$('.test').metisMenu({ - toggle: false, - activeClass: 'active', - collapseClass: 'collapse', - collapseInClass: 'in', - collapsingClass: 'collapsing', - preventDefault: true -}); - -$('.metismenu').metisMenu('dispose'); - -$('.metismenu') - .metisMenu() - .on('show.metisMenu', function(e) { - // empty logic - }).on('shown.metisMenu', function(e) { - // empty logic - }).on('hide.metisMenu', function(e) { - // empty logic - }).on('hidden.metisMenu', function(e) { - // empty logic - }); diff --git a/types/metismenu/tsconfig.json b/types/metismenu/tsconfig.json deleted file mode 100644 index 643934b421..0000000000 --- a/types/metismenu/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "metismenu-tests.ts" - ] -} \ No newline at end of file diff --git a/types/metismenu/tslint.json b/types/metismenu/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/metismenu/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 20ae8cac13bb5bb8ee64818ef3c84818484ef56c Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 19 Dec 2017 08:39:21 -0800 Subject: [PATCH 083/890] wonder-commonlib and wonder-frp: Provide their own types --- notNeededPackages.json | 12 + types/wonder-commonlib/index.d.ts | 275 ------ types/wonder-commonlib/tsconfig.json | 24 - types/wonder-commonlib/tslint.json | 79 -- .../wonder-commonlib-tests.ts | 7 - types/wonder-frp/index.d.ts | 889 ------------------ types/wonder-frp/tsconfig.json | 24 - types/wonder-frp/tslint.json | 79 -- types/wonder-frp/wonder-frp-tests.ts | 5 - 9 files changed, 12 insertions(+), 1382 deletions(-) delete mode 100644 types/wonder-commonlib/index.d.ts delete mode 100644 types/wonder-commonlib/tsconfig.json delete mode 100644 types/wonder-commonlib/tslint.json delete mode 100644 types/wonder-commonlib/wonder-commonlib-tests.ts delete mode 100644 types/wonder-frp/index.d.ts delete mode 100644 types/wonder-frp/tsconfig.json delete mode 100644 types/wonder-frp/tslint.json delete mode 100644 types/wonder-frp/wonder-frp-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index 38c0a39808..9d75db722d 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -822,6 +822,18 @@ "sourceRepoURL": "https://github.com/tgdwyer/WebCola", "asOfVersion": "3.2.0" }, + { + "libraryName": "wonder-commonlib", + "typingsPackageName": "wonder-commonlib", + "sourceRepoURL": "https://github.com/yyc-git/Wonder-CommonLib", + "asOfVersion": "0.1.12" + }, + { + "libraryName": "wonder-frp", + "typingsPackageName": "wonder-frp", + "sourceRepoURL": "https://github.com/yyc-git/Wonder-FRP", + "asOfVersion": "0.1.25" + }, { "libraryName": "x2js", "typingsPackageName": "x2js", diff --git a/types/wonder-commonlib/index.d.ts b/types/wonder-commonlib/index.d.ts deleted file mode 100644 index 267d86538d..0000000000 --- a/types/wonder-commonlib/index.d.ts +++ /dev/null @@ -1,275 +0,0 @@ -// Type definitions for wonder-commonlib 0.2.0 -// Project: https://github.com/yyc-git/Wonder-CommonLib -// Definitions by: YYC -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -/// - -// Generated by dts-bundle v0.7.2 - -declare module 'wonder-commonlib/dist/es2015' { - export { Collection } from "wonder-commonlib/dist/es2015/Collection"; - export { $BREAK, $REMOVE } from "wonder-commonlib/dist/es2015/global/Const"; - export { root } from "wonder-commonlib/dist/es2015/global/Variable"; - export { Hash } from "wonder-commonlib/dist/es2015/Hash"; - export { List } from "wonder-commonlib/dist/es2015/List"; - export { Log } from "wonder-commonlib/dist/es2015/Log"; - export { Queue } from "wonder-commonlib/dist/es2015/Queue"; - export { Stack } from "wonder-commonlib/dist/es2015/Stack"; - export { AjaxUtils } from "wonder-commonlib/dist/es2015/utils/AjaxUtils"; - export { ArrayUtils } from "wonder-commonlib/dist/es2015/utils/ArrayUtils"; - export { ConvertUtils } from "wonder-commonlib/dist/es2015/utils/ConvertUtils"; - export { DomQuery } from "wonder-commonlib/dist/es2015/utils/DomQuery"; - export { EventUtils } from "wonder-commonlib/dist/es2015/utils/EventUtils"; - export { ExtendUtils } from "wonder-commonlib/dist/es2015/utils/ExtendUtils"; - export { FunctionUtils } from "wonder-commonlib/dist/es2015/utils/FunctionUtils"; - export { JudgeUtils } from "wonder-commonlib/dist/es2015/utils/JudgeUtils"; - export { PathUtils } from "wonder-commonlib/dist/es2015/utils/PathUtils"; -} - -declare module 'wonder-commonlib/dist/es2015/Collection' { - import { List } from "wonder-commonlib/dist/es2015/List"; - export class Collection extends List { - static create(children?: any[]): Collection; - constructor(children?: Array); - clone(): any; - clone(isDeep: boolean): any; - clone(target: Collection): any; - clone(target: Collection, isDeep: boolean): any; - filter(func: (value: T, index: number) => boolean): Collection; - findOne(func: (value: T, index: number) => boolean): T; - reverse(): Collection; - removeChild(arg: any): Collection; - sort(func: (a: T, b: T) => any, isSortSelf?: boolean): Collection; - map(func: (value: T, index: number) => any): Collection; - removeRepeatItems(): Collection; - hasRepeatItems(): boolean; - } -} - -declare module 'wonder-commonlib/dist/es2015/global/Const' { - export const $BREAK: { - break: boolean; - }; - export const $REMOVE: any; -} - -declare module 'wonder-commonlib/dist/es2015/global/Variable' { - export var root: any; -} - -declare module 'wonder-commonlib/dist/es2015/Hash' { - import { Collection } from "wonder-commonlib/dist/es2015/Collection"; - export class Hash { - static create(children?: {}): Hash; - constructor(children?: { - [s: string]: T; - }); - getChildren(): { - [s: string]: T; - }; - getCount(): number; - getKeys(): Collection; - getValues(): Collection; - getChild(key: string): T; - setValue(key: string, value: any): this; - addChild(key: string, value: any): this; - addChildren(arg: {} | Hash): this; - appendChild(key: string, value: any): this; - setChildren(children: { - [s: string]: T; - }): void; - removeChild(arg: any): Collection; - removeAllChildren(): void; - hasChild(key: string): boolean; - hasChildWithFunc(func: Function): boolean; - forEach(func: Function, context?: any): this; - filter(func: Function): Hash; - findOne(func: Function): any[]; - map(func: Function): Hash; - toCollection(): Collection; - toArray(): Array; - clone(): any; - clone(isDeep: boolean): any; - clone(target: Hash): any; - clone(target: Hash, isDeep: boolean): any; - } -} - -declare module 'wonder-commonlib/dist/es2015/List' { - export class List { - protected children: Array; - getCount(): number; - hasChild(child: any): boolean; - hasChildWithFunc(func: Function): boolean; - getChildren(): T[]; - getChild(index: number): T; - addChild(child: T): this; - addChildren(arg: Array | List | any): this; - setChildren(children: Array): this; - unShiftChild(child: T): void; - removeAllChildren(): this; - forEach(func: Function, context?: any): this; - toArray(): T[]; - protected copyChildren(): T[]; - protected removeChildHelper(arg: any): Array; - } -} - -declare module 'wonder-commonlib/dist/es2015/Log' { - export class Log { - static info: { - INVALID_PARAM: string; - helperFunc: (...args: any[]) => string; - assertion: (...args: any[]) => any; - FUNC_INVALID: (...args: any[]) => any; - FUNC_MUST: (...args: any[]) => any; - FUNC_MUST_BE: (...args: any[]) => any; - FUNC_MUST_NOT_BE: (...args: any[]) => any; - FUNC_SHOULD: (...args: any[]) => any; - FUNC_SHOULD_NOT: (...args: any[]) => any; - FUNC_SUPPORT: (...args: any[]) => any; - FUNC_NOT_SUPPORT: (...args: any[]) => any; - FUNC_MUST_DEFINE: (...args: any[]) => any; - FUNC_MUST_NOT_DEFINE: (...args: any[]) => any; - FUNC_UNKNOW: (...args: any[]) => any; - FUNC_EXPECT: (...args: any[]) => any; - FUNC_UNEXPECT: (...args: any[]) => any; - FUNC_EXIST: (...args: any[]) => any; - FUNC_NOT_EXIST: (...args: any[]) => any; - FUNC_ONLY: (...args: any[]) => any; - FUNC_CAN_NOT: (...args: any[]) => any; - }; - static log(...messages: any[]): void; - static assert(cond: any, ...messages: any[]): void; - static error(cond: any, ...message: any[]): any; - static warn(...message: any[]): void; - } -} - -declare module 'wonder-commonlib/dist/es2015/Queue' { - import { List } from "wonder-commonlib/dist/es2015/List"; - export class Queue extends List { - static create(children?: any[]): Queue; - constructor(children?: Array); - readonly front: T; - readonly rear: T; - push(element: T): void; - pop(): T; - clear(): void; - } -} - -declare module 'wonder-commonlib/dist/es2015/Stack' { - import { List } from "wonder-commonlib/dist/es2015/List"; - import { Collection } from "wonder-commonlib/dist/es2015/Collection"; - export class Stack extends List { - static create(children?: any[]): Stack; - constructor(children?: Array); - readonly top: T; - push(element: T): void; - pop(): T; - clear(): void; - clone(): any; - clone(isDeep: boolean): any; - clone(target: Stack): any; - clone(target: Stack, isDeep: boolean): any; - filter(func: (value: T, index: number) => boolean): Collection; - findOne(func: (value: T, index: number) => boolean): T; - reverse(): Collection; - removeChild(arg: any): Collection; - sort(func: (a: T, b: T) => any, isSortSelf?: boolean): Collection; - map(func: (value: T, index: number) => any): Collection; - removeRepeatItems(): Collection; - hasRepeatItems(): boolean; - } -} - -declare module 'wonder-commonlib/dist/es2015/utils/AjaxUtils' { - export class AjaxUtils { - static ajax(conf: any): void; - } -} - -declare module 'wonder-commonlib/dist/es2015/utils/ArrayUtils' { - export class ArrayUtils { - static removeRepeatItems(arr: Array, isEqual?: (a: any, b: any) => boolean): any[]; - static contain(arr: Array, ele: any): boolean; - } -} - -declare module 'wonder-commonlib/dist/es2015/utils/ConvertUtils' { - export class ConvertUtils { - static toString(obj: any): string; - } -} - -declare module 'wonder-commonlib/dist/es2015/utils/DomQuery' { - export class DomQuery { - static create(eleStr: string): any; - static create(dom: HTMLElement): any; - constructor(eleStr: string); - constructor(dom: HTMLElement); - get(index: any): HTMLElement; - prepend(eleStr: string): any; - prepend(dom: HTMLElement): any; - prependTo(eleStr: string): this; - remove(): this; - css(property: string, value: string): void; - attr(name: string): any; - attr(name: string, value: string): any; - text(str?: string): string; - } -} - -declare module 'wonder-commonlib/dist/es2015/utils/EventUtils' { - export class EventUtils { - static bindEvent(context: any, func: any): (event: any) => any; - static addEvent(dom: any, eventName: any, handler: any): void; - static removeEvent(dom: any, eventName: any, handler: any): void; - } -} - -declare module 'wonder-commonlib/dist/es2015/utils/ExtendUtils' { - export class ExtendUtils { - static extendDeep(parent: any, child?: any, filter?: (val: any, i: any) => boolean): any; - static extend(destination: any, source: any): any; - static copyPublicAttri(source: any): {}; - } -} - -declare module 'wonder-commonlib/dist/es2015/utils/FunctionUtils' { - export class FunctionUtils { - static bind(object: any, func: Function): () => any; - } -} - -declare module 'wonder-commonlib/dist/es2015/utils/JudgeUtils' { - export class JudgeUtils { - static isArray(arr: any): boolean; - static isArrayExactly(arr: any): boolean; - static isNumber(num: any): boolean; - static isNumberExactly(num: any): boolean; - static isString(str: any): boolean; - static isStringExactly(str: any): boolean; - static isBoolean(bool: any): boolean; - static isDom(obj: any): boolean; - static isObject(obj: any): boolean; - static isDirectObject(obj: any): boolean; - static isHostMethod(object: any, property: any): boolean; - static isNodeJs(): boolean; - static isFunction(func: any): boolean; - } -} - -declare module 'wonder-commonlib/dist/es2015/utils/PathUtils' { - export class PathUtils { - static basename(path: string, ext?: string): string; - static changeExtname(pathStr: string, extname: string): string; - static changeBasename(pathStr: string, basename: string, isSameExt?: boolean): string; - static extname(path: string): string; - static dirname(path: string): string; - } -} - diff --git a/types/wonder-commonlib/tsconfig.json b/types/wonder-commonlib/tsconfig.json deleted file mode 100644 index 960dbbaa5c..0000000000 --- a/types/wonder-commonlib/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "wonder-commonlib-tests.ts" - ] -} \ No newline at end of file diff --git a/types/wonder-commonlib/tslint.json b/types/wonder-commonlib/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/wonder-commonlib/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/wonder-commonlib/wonder-commonlib-tests.ts b/types/wonder-commonlib/wonder-commonlib-tests.ts deleted file mode 100644 index 602be32a6b..0000000000 --- a/types/wonder-commonlib/wonder-commonlib-tests.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Collection } from "wonder-commonlib/dist/es2015/Collection"; - -var list = Collection.create(); - -list.addChild(1); - - diff --git a/types/wonder-frp/index.d.ts b/types/wonder-frp/index.d.ts deleted file mode 100644 index e68e019ead..0000000000 --- a/types/wonder-frp/index.d.ts +++ /dev/null @@ -1,889 +0,0 @@ -// Type definitions for wonder-frp 0.2.0 -// Project: https://github.com/yyc-git/Wonder-FRP -// Definitions by: YYC -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// - -// Generated by dts-bundle v0.7.2 -// Dependencies for this module: -// ../../wonder-commonlib/dist/es2015/utils/JudgeUtils -// ../../wonder-commonlib/dist/es2015/Collection - -declare module 'wonder-frp/dist/es2015' { - export { JudgeUtils } from "wonder-frp/dist/es2015/JudgeUtils"; - export { fromNodeCallback, fromStream, fromReadableStream, fromWritableStream, fromTransformStream } from "wonder-frp/dist/es2015/binding/nodejs/NodeOperator"; - export { Entity } from "wonder-frp/dist/es2015/core/Entity"; - export { Main } from "wonder-frp/dist/es2015/core/Main"; - export { Observer } from "wonder-frp/dist/es2015/core/Observer"; - export { Scheduler } from "wonder-frp/dist/es2015/core/Scheduler"; - export { Stream } from "wonder-frp/dist/es2015/core/Stream"; - export { assert, requireCheck, ensure, requireGetter, requireSetter, ensureGetter, ensureSetter, invariant } from "wonder-frp/dist/es2015/definition/typescript/decorator/contract"; - export { GroupDisposable } from "wonder-frp/dist/es2015/Disposable/GroupDisposable"; - export { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export { InnerSubscription } from "wonder-frp/dist/es2015/Disposable/InnerSubscription"; - export { InnerSubscriptionGroup } from "wonder-frp/dist/es2015/Disposable/InnerSubscriptionGroup"; - export { SingleDisposable } from "wonder-frp/dist/es2015/Disposable/SingleDisposable"; - export { FilterState } from "wonder-frp/dist/es2015/enum/FilterState"; - export { createStream, fromArray, fromPromise, fromEventPattern, interval, intervalRequest, timeout, empty, callFunc, judge, defer, just } from "wonder-frp/dist/es2015/global/Operator"; - export { root } from "wonder-frp/dist/es2015/global/Variable"; - export { AnonymousObserver } from "wonder-frp/dist/es2015/observer/AnonymousObserver"; - export { AutoDetachObserver } from "wonder-frp/dist/es2015/observer/AutoDetachObserver"; - export { ConcatObserver } from "wonder-frp/dist/es2015/observer/ConcatObserver"; - export { DoObserver } from "wonder-frp/dist/es2015/observer/DoObserver"; - export { FilterObserver } from "wonder-frp/dist/es2015/observer/FilterObserver"; - export { FilterWithStateObserver } from "wonder-frp/dist/es2015/observer/FilterWithStateObserver"; - export { IgnoreElementsObserver } from "wonder-frp/dist/es2015/observer/IgnoreElementsObserver"; - export { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - export { ISubjectObserver } from "wonder-frp/dist/es2015/observer/ISubjectObserver"; - export { MapObserver } from "wonder-frp/dist/es2015/observer/MapObserver"; - export { MergeAllObserver } from "wonder-frp/dist/es2015/observer/MergeAllObserver"; - export { MergeObserver } from "wonder-frp/dist/es2015/observer/MergeObserver"; - export { SkipUntilOtherObserver } from "wonder-frp/dist/es2015/observer/SkipUntilOtherObserver"; - export { SkipUntilSourceObserver } from "wonder-frp/dist/es2015/observer/SkipUntilSourceObserver"; - export { SubjectObserver } from "wonder-frp/dist/es2015/observer/SubjectObserver"; - export { TakeUntilObserver } from "wonder-frp/dist/es2015/observer/TakeUntilObserver"; - export { AnonymousStream } from "wonder-frp/dist/es2015/stream/AnonymousStream"; - export { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - export { ConcatStream } from "wonder-frp/dist/es2015/stream/ConcatStream"; - export { DeferStream } from "wonder-frp/dist/es2015/stream/DeferStream"; - export { DoStream } from "wonder-frp/dist/es2015/stream/DoStream"; - export { FilterStream } from "wonder-frp/dist/es2015/stream/FilterStream"; - export { FilterWithStateStream } from "wonder-frp/dist/es2015/stream/FilterWithStateStream"; - export { FromArrayStream } from "wonder-frp/dist/es2015/stream/FromArrayStream"; - export { FromEventPatternStream } from "wonder-frp/dist/es2015/stream/FromEventPatternStream"; - export { FromPromiseStream } from "wonder-frp/dist/es2015/stream/FromPromiseStream"; - export { IgnoreElementsStream } from "wonder-frp/dist/es2015/stream/IgnoreElementsStream"; - export { IntervalRequestStream } from "wonder-frp/dist/es2015/stream/IntervalRequestStream"; - export { IntervalStream } from "wonder-frp/dist/es2015/stream/IntervalStream"; - export { MapStream } from "wonder-frp/dist/es2015/stream/MapStream"; - export { MergeAllStream } from "wonder-frp/dist/es2015/stream/MergeAllStream"; - export { MergeStream } from "wonder-frp/dist/es2015/stream/MergeStream"; - export { RepeatStream } from "wonder-frp/dist/es2015/stream/RepeatStream"; - export { SkipUntilStream } from "wonder-frp/dist/es2015/stream/SkipUntilStream"; - export { TakeUntilStream } from "wonder-frp/dist/es2015/stream/TakeUntilStream"; - export { TimeoutStream } from "wonder-frp/dist/es2015/stream/TimeoutStream"; - export { GeneratorSubject } from "wonder-frp/dist/es2015/subject/GeneratorSubject"; - export { Subject } from "wonder-frp/dist/es2015/subject/Subject"; - export { ActionType } from "wonder-frp/dist/es2015/testing/ActionType"; - export { MockObserver } from "wonder-frp/dist/es2015/testing/MockObserver"; - export { MockPromise } from "wonder-frp/dist/es2015/testing/MockPromise"; - export { Record } from "wonder-frp/dist/es2015/testing/Record"; - export { TestScheduler } from "wonder-frp/dist/es2015/testing/TestScheduler"; - export { TestStream } from "wonder-frp/dist/es2015/testing/TestStream"; - //import "./extend/root"; - //import "./global/init"; -} - -declare module 'wonder-frp/dist/es2015/JudgeUtils' { - import { JudgeUtils as JudgeUtils$ } from "wonder-commonlib/dist/es2015/utils/JudgeUtils"; - import { Entity } from "wonder-frp/dist/es2015/core/Entity"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - export class JudgeUtils extends JudgeUtils$ { - static isPromise(obj: any): boolean; - static isEqual(ob1: Entity, ob2: Entity): boolean; - static isIObserver(i: IObserver): () => any; - } -} - -declare module 'wonder-frp/dist/es2015/binding/nodejs/NodeOperator' { - import { AnonymousStream } from "wonder-frp/dist/es2015/stream/AnonymousStream"; - export var fromNodeCallback: (func: Function, context?: any) => (...funcArgs: any[]) => AnonymousStream; - export var fromStream: (stream: any, finishEventName?: string) => AnonymousStream; - export var fromReadableStream: (stream: any) => AnonymousStream; - export var fromWritableStream: (stream: any) => AnonymousStream; - export var fromTransformStream: (stream: any) => AnonymousStream; -} - -declare module 'wonder-frp/dist/es2015/core/Entity' { - export abstract class Entity { - static UID: number; - uid: string; - constructor(uidPre: string); - } -} - -declare module 'wonder-frp/dist/es2015/core/Main' { - export class Main { - static isTest: boolean; - } -} - -declare module 'wonder-frp/dist/es2015/core/Observer' { - import { Entity } from "wonder-frp/dist/es2015/core/Entity"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export abstract class Observer extends Entity implements IObserver { - isDisposed: boolean; - protected onUserNext: Function; - protected onUserError: Function; - protected onUserCompleted: Function; - constructor(observer: IObserver); - constructor(onNext: Function, onError: Function, onCompleted: Function); - next(value: any): any; - error(error: any): void; - completed(): void; - dispose(): void; - setDisposable(disposable: IDisposable): void; - protected abstract onNext(value: any): any; - protected abstract onError(error: any): any; - protected abstract onCompleted(): any; - } -} - -declare module 'wonder-frp/dist/es2015/core/Scheduler' { - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - export class Scheduler { - static create(...args: any[]): Scheduler; - requestLoopId: any; - publishRecursive(observer: IObserver, initial: any, action: Function): void; - publishInterval(observer: IObserver, initial: any, interval: number, action: Function): number; - publishIntervalRequest(observer: IObserver, action: Function): void; - publishTimeout(observer: IObserver, time: number, action: Function): number; - } -} - -declare module 'wonder-frp/dist/es2015/core/Stream' { - import { Entity } from "wonder-frp/dist/es2015/core/Entity"; - import { Scheduler } from "wonder-frp/dist/es2015/core/Scheduler"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { Subject } from "wonder-frp/dist/es2015/subject/Subject"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export abstract class Stream extends Entity { - scheduler: Scheduler; - subscribeFunc: (observer: IObserver) => Function | void; - constructor(subscribeFunc: any); - abstract subscribe(arg1: Function | Observer | Subject, onError?: Function, onCompleted?: Function): IDisposable; - buildStream(observer: IObserver): IDisposable; - do(onNext?: Function, onError?: Function, onCompleted?: Function): any; - map(selector: Function): any; - flatMap(selector: Function): any; - concatMap(selector: Function): any; - mergeAll(): any; - concatAll(): any; - skipUntil(otherStream: Stream): any; - takeUntil(otherStream: Stream): any; - take(count?: number): any; - takeLast(count?: number): any; - takeWhile(predicate: (value: any, index: number, source: Stream) => boolean, thisArg?: this): any; - lastOrDefault(defaultValue?: any): any; - filter(predicate: (value: any) => boolean, thisArg?: this): any; - filterWithState(predicate: (value: any) => boolean, thisArg?: this): any; - concat(streamArr: Array): any; - concat(...otherStream: any[]): any; - merge(maxConcurrent: number): any; - merge(streamArr: Array): any; - merge(...otherStreams: any[]): any; - repeat(count?: number): any; - ignoreElements(): any; - protected handleSubject(subject: any): boolean; - } -} - -declare module 'wonder-frp/dist/es2015/definition/typescript/decorator/contract' { - export function assert(cond: boolean, message?: string): void; - export function requireCheck(InFunc: any): (target: any, name: any, descriptor: any) => any; - export function ensure(OutFunc: any): (target: any, name: any, descriptor: any) => any; - export function requireGetter(InFunc: any): (target: any, name: any, descriptor: any) => any; - export function requireSetter(InFunc: any): (target: any, name: any, descriptor: any) => any; - export function ensureGetter(OutFunc: any): (target: any, name: any, descriptor: any) => any; - export function ensureSetter(OutFunc: any): (target: any, name: any, descriptor: any) => any; - export function invariant(func: any): (target: any) => void; -} - -declare module 'wonder-frp/dist/es2015/Disposable/GroupDisposable' { - import { Entity } from "wonder-frp/dist/es2015/core/Entity"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export class GroupDisposable extends Entity implements IDisposable { - static create(disposable?: IDisposable): GroupDisposable; - constructor(disposable?: IDisposable); - add(disposable: IDisposable): this; - remove(disposable: IDisposable): this; - dispose(): void; - } -} - -declare module 'wonder-frp/dist/es2015/Disposable/IDisposable' { - export interface IDisposable { - dispose(): void; - } -} - -declare module 'wonder-frp/dist/es2015/Disposable/InnerSubscription' { - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - import { Subject } from "wonder-frp/dist/es2015/subject/Subject"; - import { GeneratorSubject } from "wonder-frp/dist/es2015/subject/GeneratorSubject"; - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - export class InnerSubscription implements IDisposable { - static create(subject: Subject | GeneratorSubject, observer: Observer): InnerSubscription; - constructor(subject: Subject | GeneratorSubject, observer: Observer); - dispose(): void; - } -} - -declare module 'wonder-frp/dist/es2015/Disposable/InnerSubscriptionGroup' { - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export class InnerSubscriptionGroup implements IDisposable { - static create(): InnerSubscriptionGroup; - addChild(child: IDisposable): void; - dispose(): void; - } -} - -declare module 'wonder-frp/dist/es2015/Disposable/SingleDisposable' { - import { Entity } from "wonder-frp/dist/es2015/core/Entity"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export class SingleDisposable extends Entity implements IDisposable { - static create(disposeHandler?: Function): SingleDisposable; - constructor(disposeHandler: Function); - setDisposeHandler(handler: Function): void; - dispose(): void; - } -} - -declare module 'wonder-frp/dist/es2015/enum/FilterState' { - export enum FilterState { - TRIGGER = 0, - ENTER = 1, - LEAVE = 2, - } -} - -declare module 'wonder-frp/dist/es2015/global/Operator' { - import { AnonymousStream } from "wonder-frp/dist/es2015/stream/AnonymousStream"; - import { Scheduler } from "wonder-frp/dist/es2015/core/Scheduler"; - import { FromArrayStream } from "wonder-frp/dist/es2015/stream/FromArrayStream"; - import { FromPromiseStream } from "wonder-frp/dist/es2015/stream/FromPromiseStream"; - import { FromEventPatternStream } from "wonder-frp/dist/es2015/stream/FromEventPatternStream"; - import { IntervalStream } from "wonder-frp/dist/es2015/stream/IntervalStream"; - import { IntervalRequestStream } from "wonder-frp/dist/es2015/stream/IntervalRequestStream"; - import { TimeoutStream } from "wonder-frp/dist/es2015/stream/TimeoutStream"; - import { DeferStream } from "wonder-frp/dist/es2015/stream/DeferStream"; - export class Operator { - static empty(): AnonymousStream; - static createStream(subscribeFunc: any): AnonymousStream; - static fromArray(array: Array, scheduler?: Scheduler): FromArrayStream; - } - export var createStream: typeof Operator.createStream; - export var empty: typeof Operator.empty; - export var fromArray: typeof Operator.fromArray; - export var fromPromise: (promise: any, scheduler?: Scheduler) => FromPromiseStream; - export var fromEventPattern: (addHandler: Function, removeHandler: Function) => FromEventPatternStream; - export var interval: (interval: any, scheduler?: Scheduler) => IntervalStream; - export var intervalRequest: (scheduler?: Scheduler) => IntervalRequestStream; - export var timeout: (time: any, scheduler?: Scheduler) => TimeoutStream; - export var callFunc: (func: Function, context?: any) => AnonymousStream; - export var judge: (condition: Function, thenSource: Function, elseSource: Function) => any; - export var defer: (buildStreamFunc: Function) => DeferStream; - export var just: (returnValue: any) => AnonymousStream; -} - -declare module 'wonder-frp/dist/es2015/global/Variable' { - export var root: any; -} - -declare module 'wonder-frp/dist/es2015/observer/AnonymousObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - export class AnonymousObserver extends Observer { - static create(onNext: Function, onError: Function, onCompleted: Function): AnonymousObserver; - protected onNext(value: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/AutoDetachObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - export class AutoDetachObserver extends Observer { - static create(observer: IObserver): any; - static create(onNext: Function, onError: Function, onCompleted: Function): any; - dispose(): void; - protected onNext(value: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/ConcatObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - export class ConcatObserver extends Observer { - static create(currentObserver: IObserver, startNextStream: Function): ConcatObserver; - protected currentObserver: any; - constructor(currentObserver: IObserver, startNextStream: Function); - protected onNext(value: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/DoObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - export class DoObserver extends Observer { - static create(currentObserver: IObserver, prevObserver: IObserver): DoObserver; - constructor(currentObserver: IObserver, prevObserver: IObserver); - protected onNext(value: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/FilterObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - export class FilterObserver extends Observer { - static create(prevObserver: IObserver, predicate: (value: any, index?: number, source?: Stream) => boolean, source: Stream): FilterObserver; - constructor(prevObserver: IObserver, predicate: (value: any) => boolean, source: Stream); - protected prevObserver: IObserver; - protected source: Stream; - protected i: number; - protected predicate: (value: any, index?: number, source?: Stream) => boolean; - protected onNext(value: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/FilterWithStateObserver' { - import { FilterObserver } from "wonder-frp/dist/es2015/observer/FilterObserver"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - export class FilterWithStateObserver extends FilterObserver { - static create(prevObserver: IObserver, predicate: (value: any, index?: number, source?: Stream) => boolean, source: Stream): FilterWithStateObserver; - protected onNext(value: any): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/IgnoreElementsObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - export class IgnoreElementsObserver extends Observer { - static create(currentObserver: IObserver): IgnoreElementsObserver; - constructor(currentObserver: IObserver); - protected onNext(value: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/IObserver' { - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export interface IObserver extends IDisposable { - next(value: any): any; - error(error: any): any; - completed(): any; - } -} - -declare module 'wonder-frp/dist/es2015/observer/ISubjectObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - export interface ISubjectObserver { - addChild(observer: Observer): any; - removeChild(observer: Observer): any; - } -} - -declare module 'wonder-frp/dist/es2015/observer/MapObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - export class MapObserver extends Observer { - static create(currentObserver: IObserver, selector: Function): MapObserver; - constructor(currentObserver: IObserver, selector: Function); - protected onNext(value: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/MergeAllObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { Collection } from "wonder-commonlib/dist/es2015/Collection"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { GroupDisposable } from "wonder-frp/dist/es2015/Disposable/GroupDisposable"; - export class MergeAllObserver extends Observer { - static create(currentObserver: IObserver, streamGroup: Collection, groupDisposable: GroupDisposable): MergeAllObserver; - constructor(currentObserver: IObserver, streamGroup: Collection, groupDisposable: GroupDisposable); - done: boolean; - currentObserver: IObserver; - protected onNext(innerSource: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/MergeObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { Collection } from "wonder-commonlib/dist/es2015/Collection"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { GroupDisposable } from "wonder-frp/dist/es2015/Disposable/GroupDisposable"; - export class MergeObserver extends Observer { - static create(currentObserver: IObserver, maxConcurrent: number, streamGroup: Collection, groupDisposable: GroupDisposable): MergeObserver; - constructor(currentObserver: IObserver, maxConcurrent: number, streamGroup: Collection, groupDisposable: GroupDisposable); - done: boolean; - currentObserver: IObserver; - activeCount: number; - q: Array; - handleSubscribe(innerSource: any): void; - protected onNext(innerSource: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/SkipUntilOtherObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { SkipUntilStream } from "wonder-frp/dist/es2015/stream/SkipUntilStream"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export class SkipUntilOtherObserver extends Observer { - static create(prevObserver: IObserver, skipUntilStream: SkipUntilStream): SkipUntilOtherObserver; - otherDisposable: IDisposable; - constructor(prevObserver: IObserver, skipUntilStream: SkipUntilStream); - protected onNext(value: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/SkipUntilSourceObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { SkipUntilStream } from "wonder-frp/dist/es2015/stream/SkipUntilStream"; - export class SkipUntilSourceObserver extends Observer { - static create(prevObserver: IObserver, skipUntilStream: SkipUntilStream): SkipUntilSourceObserver; - constructor(prevObserver: IObserver, skipUntilStream: SkipUntilStream); - protected onNext(value: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/SubjectObserver' { - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { Collection } from "wonder-commonlib/dist/es2015/Collection"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - export class SubjectObserver implements IObserver { - observers: Collection; - isEmpty(): boolean; - next(value: any): void; - error(error: any): void; - completed(): void; - addChild(observer: Observer): void; - removeChild(observer: Observer): void; - dispose(): void; - setDisposable(disposable: IDisposable): void; - } -} - -declare module 'wonder-frp/dist/es2015/observer/TakeUntilObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - export class TakeUntilObserver extends Observer { - static create(prevObserver: IObserver): TakeUntilObserver; - constructor(prevObserver: IObserver); - protected onNext(value: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - } -} - -declare module 'wonder-frp/dist/es2015/stream/AnonymousStream' { - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { Subject } from "wonder-frp/dist/es2015/subject/Subject"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - export class AnonymousStream extends Stream { - static create(subscribeFunc: Function): AnonymousStream; - constructor(subscribeFunc: Function); - buildStream(observer: IObserver): IDisposable; - subscribe(subject: Subject): IDisposable; - subscribe(observer: IObserver): IDisposable; - subscribe(onNext: (value: any) => void): IDisposable; - subscribe(onNext: (value: any) => void, onError: (e: any) => void): IDisposable; - subscribe(onNext: (value: any) => void, onError: (e: any) => void, onComplete: () => void): IDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/BaseStream' { - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { Subject } from "wonder-frp/dist/es2015/subject/Subject"; - export abstract class BaseStream extends Stream { - abstract subscribeCore(observer: IObserver): IDisposable; - subscribe(arg1: Function | Observer | Subject, onError?: any, onCompleted?: any): IDisposable; - buildStream(observer: IObserver): IDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/ConcatStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { GroupDisposable } from "wonder-frp/dist/es2015/Disposable/GroupDisposable"; - export class ConcatStream extends BaseStream { - static create(sources: Array): ConcatStream; - constructor(sources: Array); - subscribeCore(observer: IObserver): GroupDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/DeferStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { GroupDisposable } from "wonder-frp/dist/es2015/Disposable/GroupDisposable"; - export class DeferStream extends BaseStream { - static create(buildStreamFunc: Function): DeferStream; - constructor(buildStreamFunc: Function); - subscribeCore(observer: IObserver): GroupDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/DoStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export class DoStream extends BaseStream { - static create(source: Stream, onNext?: Function, onError?: Function, onCompleted?: Function): DoStream; - constructor(source: Stream, onNext: Function, onError: Function, onCompleted: Function); - subscribeCore(observer: IObserver): IDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/FilterStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export class FilterStream extends BaseStream { - static create(source: Stream, predicate: (value: any, index?: number, source?: Stream) => boolean, thisArg: any): FilterStream; - constructor(source: Stream, predicate: (value: any, index?: number, source?: Stream) => boolean, thisArg: any); - predicate: (value: any, index?: number, source?: Stream) => boolean; - subscribeCore(observer: IObserver): IDisposable; - internalFilter(predicate: (value: any, index?: number, source?: Stream) => boolean, thisArg: any): Stream; - protected createObserver(observer: IObserver): Observer; - protected createStreamForInternalFilter(source: Stream, innerPredicate: any, thisArg: any): Stream; - } -} - -declare module 'wonder-frp/dist/es2015/stream/FilterWithStateStream' { - import { FilterStream } from "wonder-frp/dist/es2015/stream/FilterStream"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { FilterWithStateObserver } from "wonder-frp/dist/es2015/observer/FilterWithStateObserver"; - export class FilterWithStateStream extends FilterStream { - static create(source: Stream, predicate: (value: any, index?: number, source?: Stream) => boolean, thisArg: any): FilterWithStateStream; - protected createObserver(observer: IObserver): FilterWithStateObserver; - protected createStreamForInternalFilter(source: Stream, innerPredicate: any, thisArg: any): Stream; - } -} - -declare module 'wonder-frp/dist/es2015/stream/FromArrayStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Scheduler } from "wonder-frp/dist/es2015/core/Scheduler"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { SingleDisposable } from "wonder-frp/dist/es2015/Disposable/SingleDisposable"; - export class FromArrayStream extends BaseStream { - static create(array: Array, scheduler: Scheduler): FromArrayStream; - constructor(array: Array, scheduler: Scheduler); - subscribeCore(observer: IObserver): SingleDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/FromEventPatternStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { SingleDisposable } from "wonder-frp/dist/es2015/Disposable/SingleDisposable"; - export class FromEventPatternStream extends BaseStream { - static create(addHandler: Function, removeHandler: Function): FromEventPatternStream; - constructor(addHandler: Function, removeHandler: Function); - subscribeCore(observer: IObserver): SingleDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/FromPromiseStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Scheduler } from "wonder-frp/dist/es2015/core/Scheduler"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { SingleDisposable } from "wonder-frp/dist/es2015/Disposable/SingleDisposable"; - export class FromPromiseStream extends BaseStream { - static create(promise: any, scheduler: Scheduler): FromPromiseStream; - constructor(promise: any, scheduler: Scheduler); - subscribeCore(observer: IObserver): SingleDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/IgnoreElementsStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export class IgnoreElementsStream extends BaseStream { - static create(source: Stream): IgnoreElementsStream; - constructor(source: Stream); - subscribeCore(observer: IObserver): IDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/IntervalRequestStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Scheduler } from "wonder-frp/dist/es2015/core/Scheduler"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { SingleDisposable } from "wonder-frp/dist/es2015/Disposable/SingleDisposable"; - export class IntervalRequestStream extends BaseStream { - static create(scheduler: Scheduler): IntervalRequestStream; - constructor(scheduler: Scheduler); - subscribeCore(observer: IObserver): SingleDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/IntervalStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Scheduler } from "wonder-frp/dist/es2015/core/Scheduler"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { SingleDisposable } from "wonder-frp/dist/es2015/Disposable/SingleDisposable"; - export class IntervalStream extends BaseStream { - static create(interval: number, scheduler: Scheduler): IntervalStream; - constructor(interval: number, scheduler: Scheduler); - initWhenCreate(): void; - subscribeCore(observer: IObserver): SingleDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/MapStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export class MapStream extends BaseStream { - static create(source: Stream, selector: Function): MapStream; - constructor(source: Stream, selector: Function); - subscribeCore(observer: IObserver): IDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/MergeAllStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { GroupDisposable } from "wonder-frp/dist/es2015/Disposable/GroupDisposable"; - export class MergeAllStream extends BaseStream { - static create(source: Stream): MergeAllStream; - constructor(source: Stream); - subscribeCore(observer: IObserver): GroupDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/MergeStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { GroupDisposable } from "wonder-frp/dist/es2015/Disposable/GroupDisposable"; - export class MergeStream extends BaseStream { - static create(source: Stream, maxConcurrent: number): MergeStream; - constructor(source: Stream, maxConcurrent: number); - subscribeCore(observer: IObserver): GroupDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/RepeatStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { GroupDisposable } from "wonder-frp/dist/es2015/Disposable/GroupDisposable"; - export class RepeatStream extends BaseStream { - static create(source: Stream, count: number): RepeatStream; - constructor(source: Stream, count: number); - subscribeCore(observer: IObserver): GroupDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/SkipUntilStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { GroupDisposable } from "wonder-frp/dist/es2015/Disposable/GroupDisposable"; - export class SkipUntilStream extends BaseStream { - static create(source: Stream, otherSteam: Stream): SkipUntilStream; - isOpen: boolean; - constructor(source: Stream, otherStream: Stream); - subscribeCore(observer: IObserver): GroupDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/TakeUntilStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { GroupDisposable } from "wonder-frp/dist/es2015/Disposable/GroupDisposable"; - export class TakeUntilStream extends BaseStream { - static create(source: Stream, otherSteam: Stream): TakeUntilStream; - constructor(source: Stream, otherStream: Stream); - subscribeCore(observer: IObserver): GroupDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/stream/TimeoutStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Scheduler } from "wonder-frp/dist/es2015/core/Scheduler"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { SingleDisposable } from "wonder-frp/dist/es2015/Disposable/SingleDisposable"; - export class TimeoutStream extends BaseStream { - static create(time: number, scheduler: Scheduler): TimeoutStream; - constructor(time: number, scheduler: Scheduler); - subscribeCore(observer: IObserver): SingleDisposable; - } -} - -declare module 'wonder-frp/dist/es2015/subject/GeneratorSubject' { - import { Entity } from "wonder-frp/dist/es2015/core/Entity"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export class GeneratorSubject extends Entity implements IObserver { - static create(): GeneratorSubject; - isStart: boolean; - constructor(); - observer: any; - onBeforeNext(value: any): void; - onAfterNext(value: any): void; - onIsCompleted(value: any): boolean; - onBeforeError(error: any): void; - onAfterError(error: any): void; - onBeforeCompleted(): void; - onAfterCompleted(): void; - subscribe(arg1?: Function | Observer, onError?: Function, onCompleted?: Function): IDisposable; - next(value: any): void; - error(error: any): void; - completed(): void; - toStream(): any; - start(): void; - stop(): void; - remove(observer: Observer): void; - dispose(): void; - } -} - -declare module 'wonder-frp/dist/es2015/subject/Subject' { - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { Stream } from "wonder-frp/dist/es2015/core/Stream"; - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { IDisposable } from "wonder-frp/dist/es2015/Disposable/IDisposable"; - export class Subject implements IObserver { - static create(): Subject; - source: Stream; - subscribe(arg1?: Function | Observer, onError?: Function, onCompleted?: Function): IDisposable; - next(value: any): void; - error(error: any): void; - completed(): void; - start(): void; - remove(observer: Observer): void; - dispose(): void; - } -} - -declare module 'wonder-frp/dist/es2015/testing/ActionType' { - export enum ActionType { - NEXT = 0, - ERROR = 1, - COMPLETED = 2, - } -} - -declare module 'wonder-frp/dist/es2015/testing/MockObserver' { - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { TestScheduler } from "wonder-frp/dist/es2015/testing/TestScheduler"; - import { Record } from "wonder-frp/dist/es2015/testing/Record"; - export class MockObserver extends Observer { - static create(scheduler: TestScheduler): MockObserver; - messages: [Record]; - constructor(scheduler: TestScheduler); - protected onNext(value: any): void; - protected onError(error: any): void; - protected onCompleted(): void; - dispose(): void; - clone(): MockObserver; - } -} - -declare module 'wonder-frp/dist/es2015/testing/MockPromise' { - import { TestScheduler } from "wonder-frp/dist/es2015/testing/TestScheduler"; - import { Record } from "wonder-frp/dist/es2015/testing/Record"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - export class MockPromise { - static create(scheduler: TestScheduler, messages: [Record]): MockPromise; - constructor(scheduler: TestScheduler, messages: [Record]); - then(successCb: Function, errorCb: Function, observer: IObserver): void; - } -} - -declare module 'wonder-frp/dist/es2015/testing/Record' { - import { ActionType } from "wonder-frp/dist/es2015/testing/ActionType"; - export class Record { - static create(time: number, value: any, actionType?: ActionType, comparer?: Function): Record; - time: number; - value: number; - actionType: ActionType; - constructor(time: any, value: any, actionType: ActionType, comparer: Function); - equals(other: any): any; - } -} - -declare module 'wonder-frp/dist/es2015/testing/TestScheduler' { - import { Scheduler } from "wonder-frp/dist/es2015/core/Scheduler"; - import { Record } from "wonder-frp/dist/es2015/testing/Record"; - import { MockObserver } from "wonder-frp/dist/es2015/testing/MockObserver"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { Observer } from "wonder-frp/dist/es2015/core/Observer"; - import { TestStream } from "wonder-frp/dist/es2015/testing/TestStream"; - import { MockPromise } from "wonder-frp/dist/es2015/testing/MockPromise"; - export class TestScheduler extends Scheduler { - static next(tick: any, value: any): Record; - static error(tick: any, error: any): Record; - static completed(tick: any): Record; - static create(isReset?: boolean): TestScheduler; - constructor(isReset: boolean); - clock: number; - setStreamMap(observer: IObserver, messages: [Record]): void; - remove(observer: Observer): void; - publishRecursive(observer: MockObserver, initial: any, recursiveFunc: Function): void; - publishInterval(observer: IObserver, initial: any, interval: number, action: Function): number; - publishIntervalRequest(observer: IObserver, action: Function): number; - publishTimeout(observer: IObserver, time: number, action: Function): number; - startWithTime(create: Function, subscribedTime: number, disposedTime: number): MockObserver; - startWithSubscribe(create: any, subscribedTime?: number): MockObserver; - startWithDispose(create: any, disposedTime?: number): MockObserver; - publicAbsolute(time: any, handler: any): void; - start(): void; - createStream(args: any): TestStream; - createObserver(): MockObserver; - createResolvedPromise(time: number, value: any): MockPromise; - createRejectPromise(time: number, error: any): MockPromise; - } -} - -declare module 'wonder-frp/dist/es2015/testing/TestStream' { - import { BaseStream } from "wonder-frp/dist/es2015/stream/BaseStream"; - import { Record } from "wonder-frp/dist/es2015/testing/Record"; - import { TestScheduler } from "wonder-frp/dist/es2015/testing/TestScheduler"; - import { IObserver } from "wonder-frp/dist/es2015/observer/IObserver"; - import { SingleDisposable } from "wonder-frp/dist/es2015/Disposable/SingleDisposable"; - export class TestStream extends BaseStream { - static create(messages: [Record], scheduler: TestScheduler): TestStream; - scheduler: TestScheduler; - constructor(messages: [Record], scheduler: TestScheduler); - subscribeCore(observer: IObserver): SingleDisposable; - } -} - diff --git a/types/wonder-frp/tsconfig.json b/types/wonder-frp/tsconfig.json deleted file mode 100644 index 3df4543743..0000000000 --- a/types/wonder-frp/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "wonder-frp-tests.ts" - ] -} \ No newline at end of file diff --git a/types/wonder-frp/tslint.json b/types/wonder-frp/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/wonder-frp/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/wonder-frp/wonder-frp-tests.ts b/types/wonder-frp/wonder-frp-tests.ts deleted file mode 100644 index 66387b193e..0000000000 --- a/types/wonder-frp/wonder-frp-tests.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { fromArray } from "wonder-frp/dist/es2015/global/Operator"; - -fromArray([1,2,3]) - .subscribe(function(){ - }); From d646d695235ec55d4fb5d0f4130a611275f9380f Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 19 Dec 2017 08:49:14 -0800 Subject: [PATCH 084/890] egg: Provides its own types --- notNeededPackages.json | 6 + types/egg-mock/package.json | 6 + types/egg/egg-tests.ts | 33 -- types/egg/index.d.ts | 795 ------------------------------------ types/egg/tsconfig.json | 24 -- types/egg/tslint.json | 1 - 6 files changed, 12 insertions(+), 853 deletions(-) create mode 100644 types/egg-mock/package.json delete mode 100644 types/egg/egg-tests.ts delete mode 100644 types/egg/index.d.ts delete mode 100644 types/egg/tsconfig.json delete mode 100644 types/egg/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 38c0a39808..cd5fcb040a 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -186,6 +186,12 @@ "sourceRepoURL": "https://github.com/bterlson/ecmarkup", "asOfVersion": "3.4.0" }, + { + "libraryName": "Egg", + "typingsPackageName": "egg", + "sourceRepoURL": "https://github.com/eggjs/egg", + "asOfVersion": "1.5.0" + }, { "libraryName": "electron", "typingsPackageName": "electron", diff --git a/types/egg-mock/package.json b/types/egg-mock/package.json new file mode 100644 index 0000000000..f56ce22a99 --- /dev/null +++ b/types/egg-mock/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "egg": "^2.1.0" + } +} diff --git a/types/egg/egg-tests.ts b/types/egg/egg-tests.ts deleted file mode 100644 index 8caf5f0ac5..0000000000 --- a/types/egg/egg-tests.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Controller, Service, Application } from 'egg'; - -// controller -class FooController extends Controller { - async getData() { - this.ctx.body = await this.service.foo.bar(); - } -} - -// add user controller and service -declare module 'egg' { - interface IController { // tslint:disable-line - foo: FooController; - } - interface IService { // tslint:disable-line - foo: FooService; - } -} - -class FooService extends Service { - async bar() { - // - return this.config.env; - } -} - -// router - -function router(app: Application) { - const controller = app.controller; - app.get('/foo', controller.foo.getData); - app.post('/', controller.foo.getData); -} diff --git a/types/egg/index.d.ts b/types/egg/index.d.ts deleted file mode 100644 index fe0539e4c1..0000000000 --- a/types/egg/index.d.ts +++ /dev/null @@ -1,795 +0,0 @@ -// Type definitions for Egg 1.x -// Project: https://github.com/eggjs/egg -// Definitions by: Eward Song -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import * as accepts from 'accepts'; -import * as KoaApplication from 'koa'; -import * as KoaRouter from 'koa-router'; -import { Readable } from 'stream'; -/** - * BaseContextClass is a base class that can be extended, - * it's instantiated in context level, - * {@link Helper}, {@link Service} is extending it. - */ -declare class BaseContextClass { // tslint:disable-line - /** - * request context - */ - ctx: Context; - - /** - * Application - */ - app: Application; - - /** - * Application config object - */ - config: EggAppConfig; - - /** - * service - */ - service: IService; - - constructor(ctx: Context); -} - -export interface Logger { - info(info: string, ...args: string[]): void; - warn(info: string, ...args: string[]): void; - debug(info: string, ...args: string[]): void; - error(info: string, ...args: string[]): void; -} - -interface Request extends KoaApplication.Request { // tslint:disable-line - /** - * detect if response should be json - * 1. url path ends with `.json` - * 2. response type is set to json - * 3. detect by request accept header - * - * @since 1.0.0 - */ - acceptJSON: boolean; - - /** - * Request remote IPv4 address - * @example - * ```js - * this.request.ip - * => '127.0.0.1' - * => '111.10.2.1' - * ``` - */ - ip: string; - - /** - * Get all pass through ip addresses from the request. - * Enable only on `app.config.proxy = true` - * - * @example - * ```js - * this.request.ips - * => ['100.23.1.2', '201.10.10.2'] - * ``` - */ - ips: string[]; - - protocol: string; - - /** - * get params pass by querystring, all value are Array type. {@link Request#query} - * @example - * ```js - * GET http://127.0.0.1:7001?a=b&a=c&o[foo]=bar&b[]=1&b[]=2&e=val - * this.queries - * => - * { - * "a": ["b", "c"], - * "o[foo]": ["bar"], - * "b[]": ["1", "2"], - * "e": ["val"] - * } - * ``` - */ - queries: { [key: string]: string[] }; - - /** - * get params pass by querystring, all value are String type. - * @example - * ```js - * GET http://127.0.0.1:7001?name=Foo&age=20&age=21 - * this.query - * => { 'name': 'Foo', 'age': 20 } - * - * GET http://127.0.0.1:7001?a=b&a=c&o[foo]=bar&b[]=1&b[]=2&e=val - * this.query - * => - * { - * "a": "b", - * "o[foo]": "bar", - * "b[]": "1", - * "e": "val" - * } - * ``` - */ - query: { [key: string]: string }; -} - -interface Response extends KoaApplication.Response { // tslint:disable-line - /** - * read response real status code. - * - * e.g.: Using 302 status redirect to the global error page - * instead of show current 500 status page. - * And access log should save 500 not 302, - * then the `realStatus` can help us find out the real status code. - */ - realStatus: number; -} - -interface ContextView { // tslint:disable-line - /** - * Render a file by view engine - * @param name - the file path based on root - * @param [locals] - data used by template - * @param [options] - view options, you can use `options.viewEngine` to specify view engine - * @return result - return a promise with a render result - */ - render(name: string, locals: any, options?: any): Promise; - - /** - * Render a template string by view engine - * @param tpl - template string - * @param [locals] - data used by template - * @param [options] - view options, you can use `options.viewEngine` to specify view engine - * @return result - return a promise with a render result - */ - renderString(name: string, locals: any, options?: any): Promise; -} - -export type LoggerLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'NONE'; - -export interface EggAppConfig { - workerStartTimeout: number; - baseDir: string; - bodyParser: { - /** - * enable bodyParser or not - * @default true - */ - enable: boolean; - /** - * body encoding config - * @default utf8 - */ - encoding: string; - /** - * form body size limit - * @default 100kb - */ - formLimit: string; - /** - * json body size limit - * @default 100kb - */ - jsonLimit: string; - /** json body strict mode, if set strict value true, then only receive object and array json body */ - strict: true; - queryString: { - /** - * from item array length limit - * @default 100 - */ - arrayLimit: number; - /** - * json value deep lenght - * @default 5 - */ - depth: number; - /** - * paramter number limit - * @default 1000 - */ - parameterLimit: number; - }; - }; - - logger: { - /** directory of log files */ - dir: string; - /** - * log file encloding - * @default utf8 - */ - encoding: string; - env: string; - /** - * default log level, could be: DEBUG, INFO, WARN, ERROR or NONE - * @default INFO in production - */ - level: LoggerLevel; - /** - * log level of stdout - * @default INFO in local serverEnv, WARN in unittest, NONE elsewise - */ - consoleLevel: LoggerLevel; - /** log as JSON or not, defaults to false */ - outputJSON: boolean; - /** if enabled, flush logs to disk at a certain frequency to improve performance, defaults to true */ - buffer: boolean; - appLogName: string; - /** file name of coreLogger */ - coreLogName: string; - /** file name of agent worker log */ - agentLogName: string; - /** file name of errorLogger */ - errorLogName: string; - /** custom config of coreLogger */ - coreLogger: any; - }; - - httpclient: { - keepAlive: boolean; - freeSocketKeepAliveTimeout: number; - timeout: number; - maxSockets: number; - maxFreeSockets: number; - enableDNSCache: boolean; - }; - - development: { - /** - * dirs needed watch, when files under these change, application will reload, use relative path - */ - watchDirs: string[]; - /** - * dirs don't need watch, including subdirectories, use relative path - */ - ignoreDirs: string[]; - /** - * don't wait all plugins ready, default is true. - */ - fastReady: boolean; - }; - /** - * It will ignore special keys when dumpConfig - */ - dump: { - ignore: Set; - }; - - /** - * The environment of egg - */ - env: string; - - /** - * The current HOME directory - */ - HOME: string; - - hostHeaders: string; - - /** - * I18n options - */ - i18n: { - /** - * default value EN_US - */ - defaultLocale: string; - /** - * i18n resource file dir, not recommend to change default value - */ - dir: string; - /** - * custom the locale value field, default `query.locale`, you can modify this config, such as `query.lang` - */ - queryField: string; - /** - * The locale value key in the cookie, default is locale. - */ - cookieField: string; - /** - * Locale cookie expire time, default `1y`, If pass number value, the unit will be ms - */ - cookieMaxAge: string | number; - }; - - /** - * Detect request' ip from specified headers, not case-sensitive. Only worked when config.proxy set to true. - */ - ipHeaders: string; - - jsonp: { - /** - * callback method name's max length - * @default 50 - */ - limit: number; - /** - * jsonp callback method key - * @default `_callback` - */ - callback: string; - /** enable csrf check or not. default to false */ - csrf: boolean; - /** referrer white list */ - whiteList: string | RegExp | Array; - }; - - /** - * The key that signing cookies. It can contain multiple keys seperated by . - */ - keys: string; - - /** - * The name of the application - */ - name: string; - - /** - * package.json - */ - pkg: any; - - rundir: string; - - security: { - domainWhiteList: string[]; - protocolWhiteList: string[]; - defaultMiddleware: string; - csrf: any; - xframe: { - enable: boolean; - value: 'SAMEORIGIN' | 'DENY' | 'ALLOW-FROM'; - }; - hsts: any; - methodnoallow: { enable: boolean }; - noopen: { enable: boolean; } - xssProtection: any; - csp: any; - }; - - siteFile: any; - - static: any; - - view: any; - - watcher: any; -} - -export interface Router extends KoaRouter { - /** - * restful router api - */ - resources(name: string, prefix: string, middleware: any): Router; - - /** - * @param name - Router name - * @param params - more parameters - * @example - * ```js - * router.url('edit_post', { id: 1, name: 'foo', page: 2 }) - * => /posts/1/edit?name=foo&page=2 - * router.url('posts', { name: 'foo&1', page: 2 }) - * => /posts?name=foo%261&page=2 - * ``` - * @return url by path name and query params. - * @since 1.0.0 - */ - url(name: string, params: any): any; -} - -declare interface EggApplication extends KoaApplication { // tslint:disable-line - /** - * The current directory of application - */ - baseDir: string; - - /** - * The configuration of application - */ - config: EggAppConfig; - - /** - * app.env delegate app.config.env - */ - env: string; - - /** - * core logger for framework and plugins, log file is $HOME/logs/{appname}/egg-web - */ - coreLogger: Logger; - - /** - * Alias to https://npmjs.com/package/depd - */ - deprecate: any; - - /** - * HttpClient instance - */ - httpclient: any; - - /** - * The loader instance, the default class is EggLoader. If you want define - */ - loader: any; - - /** - * Logger for Application, wrapping app.coreLogger with context infomation - * - * @since 1.0.0 - * @example - * ```js - * this.logger.info('some request data: %j', this.request.body); - * this.logger.warn('WARNING!!!!'); - * ``` - */ - logger: Logger; - - /** - * All loggers contain logger, coreLogger and customLogger - */ - loggers: { [loggerName: string]: Logger }; - - /** - * messenger instance - */ - messenger: any; - - plugins: any; - - /** - * get router - */ - router: Router; - - Service: Service; - - /** - * Whether `application` or `agent` - */ - type: string; - - /** - * create a singleton instance - */ - addSingleton(name: string, create: any): void; - - /** - * Excute scope after loaded and before app start - */ - beforeStart(scrope: () => void): void; - - /** - * Close all, it wil close - * - callbacks registered by beforeClose - * - emit `close` event - * - remove add listeners - * - * If error is thrown when it's closing, the promise will reject. - * It will also reject after following call. - * @return promise - * @since 1.0.0 - */ - close(): Promise; - - /** - * http request helper base on httpclient, it will auto save httpclient log. - * Keep the same api with httpclient.request(url, args). - * See https://github.com/node-modules/urllib#api-doc for more details. - */ - curl(url: string, opt: any): Promise; - - /** - * Get logger by name, it's equal to app.loggers['name'], but you can extend it with your own logical - */ - getLogger(name: string): Logger; - - /** - * print the infomation when console.log(app) - */ - inspect(): any; - - /** - * Alias to Router#url - */ - url(name: string, params: any): any; -} - -export interface Application extends EggApplication { - /** - * global locals for view - * @see Context#locals - */ - locals: any; - - /** - * HTTP get method - */ - get(path: string, fn: string): void; - get(path: string, ...middleware: any[]): void; - - /** - * HTTP post method - */ - post(path: string, fn: string): void; - post(path: string, ...middleware: any[]): void; - - /** - * HTTP put method - */ - put(path: string, fn: string): void; - put(path: string, ...middleware: any[]): void; - - /** - * HTTP delete method - */ - delete(path: string, fn: string): void; - delete(path: string, ...middleware: any[]): void; - - /** - * restful router api - */ - resources(name: string, prefix: string, fn: string): Router; - - redirect(path: string, redirectPath: string): void; - - controller: IController; - - Controller: Controller; -} - -interface FileStream extends Readable { // tslint:disable-line - fields: any; -} - -export interface Context extends KoaApplication.Context { - app: Application; - - service: IService; - - request: Request; - - response: Response; - - /** - * Resource Parameters - * @example - * ##### ctx.params.id {string} - * - * `GET /api/users/1` => `'1'` - * - * ##### ctx.params.ids {Array} - * - * `GET /api/users/1,2,3` => `['1', '2', '3']` - * - * ##### ctx.params.fields {Array} - * - * Expect request return data fields, for example - * `GET /api/users/1?fields=name,title` => `['name', 'title']`. - * - * ##### ctx.params.data {Object} - * - * Tht request data object - * - * ##### ctx.params.page {Number} - * - * Page number, `GET /api/users?page=10` => `10` - * - * ##### ctx.params.per_page {Number} - * - * The number of every page, `GET /api/users?per_page=20` => `20` - */ - params: any; - - /** - * @see Request#accept - */ - queries: { [key: string]: string[] }; - - /** - * @see Request#accept - */ - accept: accepts.Accepts; - - /** - * @see Request#acceptJSON - */ - acceptJSON: boolean; - - /** - * @see Request#ip - */ - ip: string; - - /** - * @see Response#realStatus - */ - realStatus: number; - - /** - * 设置返回资源对象 - * set the ctx.body.data value - * - * @example - * ```js - * ctx.data = { - * id: 1, - * name: 'fengmk2' - * }; - * ``` - * - * will get responce - * - * ```js - * HTTP/1.1 200 OK - * - * { - * "data": { - * "id": 1, - * "name": "fengmk2" - * } - * } - * ``` - */ - data: any; - - /** - * set ctx.body.meta value - * - * @example - * ```js - * ctx.meta = { - * count: 100 - * }; - * ``` - * will get responce - * - * ```js - * HTTP/1.1 200 OK - * - * { - * "meta": { - * "count": 100 - * } - * } - * ``` - */ - meta: any; - - /** - * locals is an object for view, you can use `app.locals` and `ctx.locals` to set variables, - * which will be used as data when view is rendering. - * The difference between `app.locals` and `ctx.locals` is the context level, `app.locals` is global level, and `ctx.locals` is request level. when you get `ctx.locals`, it will merge `app.locals`. - * - * when you set locals, only object is available - * - * ```js - * this.locals = { - * a: 1 - * }; - * this.locals = { - * b: 1 - * }; - * this.locals.c = 1; - * console.log(this.locals); - * { - * a: 1, - * b: 1, - * c: 1, - * }; - * ``` - * - * `ctx.locals` has cache, it only merges `app.locals` once in one request. - * - */ - locals: any; - - /** - * alias to {@link locals}, compatible with koa that use this variable - */ - state: any; - - /** - * Logger for Application, wrapping app.coreLogger with context infomation - * - * @since 1.0.0 - * @example - * ```js - * this.logger.info('some request data: %j', this.request.body); - * this.logger.warn('WARNING!!!!'); - * ``` - */ - logger: Logger; - - /** - * Request start time - */ - starttime: number; - - /** - * View instance that is created every request - */ - view: ContextView; - - /** - * http request helper base on httpclient, it will auto save httpclient log. - * Keep the same api with httpclient.request(url, args). - * See https://github.com/node-modules/urllib#api-doc for more details. - */ - curl(url: string, opt: any): Promise; - - /** - * Render a file by view engine - * @param name - the file path based on root - * @param [locals] - data used by template - * @param [options] - view options, you can use `options.viewEngine` to specify view engine - * @return result - return a promise with a render result - */ - render(name: string, locals: any, options?: any): Promise; - - /** - * Render a template string by view engine - * @param tpl - template string - * @param [locals] - data used by template - * @param [options] - view options, you can use `options.viewEngine` to specify view engine - * @return result - return a promise with a render result - */ - renderString(name: string, locals: any, options?: any): Promise; - - __(key: string, ...values: string[]): string; - gettext(key: string, ...values: string[]): string; - - /** - * get upload file stream - * @example - * ```js - * const stream = yield this.getFileStream(); - * // get other fields - * console.log(stream.fields); - * ``` - * @return stream - * @since 1.0.0 - */ - getFileStream(): Promise; - - /** - * @see Responce.redirect - */ - redirect(url: string, alt?: string): void; -} - -export class Controller extends BaseContextClass { } - -export class Service extends BaseContextClass { } - -/** - * The empty interface `IService` is an placehoder, for egg - * to auto injection service to ctx.service - * - * @example - * - * import { Service } from 'egg'; - * class FooService extends Service { - * async bar() {} - * } - * - * declare module 'egg' { - * export interface IService { - * foo: FooService; - * } - * } - * - * Now I can get ctx.service.foo at controller and other service file. - */ -export interface IService { }// tslint:disable-line - -export interface IController { } // tslint:disable-line diff --git a/types/egg/tsconfig.json b/types/egg/tsconfig.json deleted file mode 100644 index 3c2ca61db1..0000000000 --- a/types/egg/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es2017", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "egg-tests.ts" - ] -} \ No newline at end of file diff --git a/types/egg/tslint.json b/types/egg/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/egg/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 02ca300ac9bded45c8c2de7447bbbc673917f7a3 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 19 Dec 2017 09:04:32 -0800 Subject: [PATCH 085/890] should: Provides its own types --- notNeededPackages.json | 6 + types/gulp-util/gulp-util-tests.ts | 22 +- types/gulp-util/tslint.json | 1 - types/should-promised/index.d.ts | 8 - .../should-promised/should-promised-tests.ts | 20 -- types/should-promised/tsconfig.json | 23 -- types/should-promised/tslint.json | 79 ----- types/should/index.d.ts | 188 ------------ types/should/should-tests.ts | 286 ------------------ types/should/tsconfig.json | 24 -- types/should/tslint.json | 79 ----- types/vinyl-fs/vinyl-fs-tests.ts | 13 +- types/vinyl/v0/vinyl-tests.ts | 20 +- 13 files changed, 54 insertions(+), 715 deletions(-) delete mode 100644 types/should-promised/index.d.ts delete mode 100644 types/should-promised/should-promised-tests.ts delete mode 100644 types/should-promised/tsconfig.json delete mode 100644 types/should-promised/tslint.json delete mode 100644 types/should/index.d.ts delete mode 100644 types/should/should-tests.ts delete mode 100644 types/should/tsconfig.json delete mode 100644 types/should/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 38c0a39808..1e15584248 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -696,6 +696,12 @@ "sourceRepoURL": "https://github.com/nozzlegear/shopify-prime", "asOfVersion": "2.0.0" }, + { + "libraryName": "should.js", + "typingsPackageName": "should", + "sourceRepoURL": "https://github.com/shouldjs/should.js", + "asOfVersion": "13.0.0" + }, { "libraryName": "SimpleSignal", "typingsPackageName": "simplesignal", diff --git a/types/gulp-util/gulp-util-tests.ts b/types/gulp-util/gulp-util-tests.ts index 67468829d3..47e705bf00 100644 --- a/types/gulp-util/gulp-util-tests.ts +++ b/types/gulp-util/gulp-util-tests.ts @@ -1,14 +1,30 @@ /// -/// import gulp = require('gulp'); import util = require('gulp-util'); import path = require('path'); -import should = require('should'); import Stream = require('stream'); import through = require('through2'); const es = require('event-stream'); -//TODO: import es = require('event-stream'); + +// TODO: These aren't useful as types tests since they take `any`. +declare const should: ShouldStatic; +interface ShouldStatic { + exist(obj: any, desc?: string): void; + not: this; +} +interface Should { + // tslint:disable-next-line ban-types + be: { instanceof(cls: Function): void; type(name: string): void; false: undefined; true: undefined; }; + equal(obj: any): void; + eql(obj: any): void; + not: this; +} +declare global { + interface Object { + should: Should; + } +} // ReSharper disable WrongExpressionStatement describe('File()', () => { diff --git a/types/gulp-util/tslint.json b/types/gulp-util/tslint.json index a1de4a6061..e1a7487f42 100644 --- a/types/gulp-util/tslint.json +++ b/types/gulp-util/tslint.json @@ -2,7 +2,6 @@ "extends": "dtslint/dt.json", "rules": { "comment-format": false, // TODO - "no-reference-import": false, // TODO: fix "should" "no-var-requires": false // TODO } } diff --git a/types/should-promised/index.d.ts b/types/should-promised/index.d.ts deleted file mode 100644 index 96d21ff534..0000000000 --- a/types/should-promised/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for should-promised -// Project: https://github.com/shouldjs/promised -// Definitions by: Yaroslav Admin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface ShouldAssertion { - // all of the extensions are now part of should itself -} diff --git a/types/should-promised/should-promised-tests.ts b/types/should-promised/should-promised-tests.ts deleted file mode 100644 index d68742938f..0000000000 --- a/types/should-promised/should-promised-tests.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// - - -var promise: Promise = new Promise(function (resolve, reject) {}); - -promise.should.be.Promise; -(10).should.not.be.a.Promise; - -promise.should.be.fulfilled(); - -promise.should.be.rejected(); - -promise.should.be.rejectedWith(Error); -promise.should.be.rejectedWith('boom'); -promise.should.be.rejectedWith(/boom/); -promise.should.be.rejectedWith(Error, { message: 'boom' }); -promise.should.be.rejectedWith({ message: 'boom' }); - -promise.should.be.eventually.equal(10); -promise.should.be.finally.equal(10); diff --git a/types/should-promised/tsconfig.json b/types/should-promised/tsconfig.json deleted file mode 100644 index fc192e4140..0000000000 --- a/types/should-promised/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "should-promised-tests.ts" - ] -} \ No newline at end of file diff --git a/types/should-promised/tslint.json b/types/should-promised/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/should-promised/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/should/index.d.ts b/types/should/index.d.ts deleted file mode 100644 index 8f10ae4a76..0000000000 --- a/types/should/index.d.ts +++ /dev/null @@ -1,188 +0,0 @@ -// Type definitions for should.js v11.2.0 -// Project: https://github.com/shouldjs/should.js -// Definitions by: Alex Varju -// Maxime LUCE -// Lukas Spieß -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface Object { - should: ShouldAssertion; -} - -interface ShouldAssertion { - // basic grammar - a: ShouldAssertion; - an: ShouldAssertion; - and: ShouldAssertion; - be: ShouldAssertion; - has: ShouldAssertion; - have: ShouldAssertion; - is: ShouldAssertion; - it: ShouldAssertion; - with: ShouldAssertion; - which: ShouldAssertion; - the: ShouldAssertion; - of: ShouldAssertion; - not: ShouldAssertion; - - // validators - arguments(): ShouldAssertion; - empty(): ShouldAssertion; - ok(): ShouldAssertion; - true(): ShouldAssertion; - false(): ShouldAssertion; - NaN(): ShouldAssertion; - Infinity(): ShouldAssertion; - Array(): ShouldAssertion; - Object(): ShouldAssertion; - String(): ShouldAssertion; - Boolean(): ShouldAssertion; - Number(): ShouldAssertion; - Error(): ShouldAssertion; - Function(): ShouldAssertion; - Date(): ShouldAssertion; - Class(): ShouldAssertion; - Undefined(): ShouldAssertion; - Null(): ShouldAssertion; - Promise(): ShouldAssertion; - generator(): ShouldAssertion; - iterable(): ShouldAssertion; - iterator(): ShouldAssertion; - eql(expected: any, description?: string): ShouldAssertion; - equal(expected: any, description?: string): ShouldAssertion; - equalOneOf(...values: any[]): ShouldAssertion; - within(start: number, finish: number, description?: string): ShouldAssertion; - approximately(value: number, delta: number, description?: string): ShouldAssertion; - type(expected: any, description?: string): ShouldAssertion; - instanceof(constructor: Function, description?: string): ShouldAssertion; - above(n: number, description?: string): ShouldAssertion; - below(n: number, description?: string): ShouldAssertion; - aboveOrEqual(n: number, description?: string): ShouldAssertion; - greaterThanOrEqual(n: number, description?: string): ShouldAssertion; - belowOrEqual(n: number, description?: string): ShouldAssertion; - lessThanOrEqual(n: number, description?: string): ShouldAssertion; - match(other: {}, description?: string): ShouldAssertion; - match(other: (val: any) => any, description?: string): ShouldAssertion; - match(regexp: RegExp, description?: string): ShouldAssertion; - match(other: any, description?: string): ShouldAssertion; - matchEach(other: {}, description?: string): ShouldAssertion; - matchEach(other: (val: any) => any, description?: string): ShouldAssertion; - matchEach(regexp: RegExp, description?: string): ShouldAssertion; - matchEach(other: any, description?: string): ShouldAssertion; - matchAny(other: {}, description?: string): ShouldAssertion; - matchAny(other: (val: any) => any, description?: string): ShouldAssertion; - matchAny(regexp: RegExp, description?: string): ShouldAssertion; - matchAny(other: any, description?: string): ShouldAssertion; - length(n: number, description?: string): ShouldAssertion; - property(name: string, description?: string): ShouldAssertion; - property(name: string, val: any, description?: string): ShouldAssertion; - properties(names: string[]): ShouldAssertion; - properties(name: string): ShouldAssertion; - properties(descriptor: any): ShouldAssertion; - properties(...properties: string[]): ShouldAssertion; - propertyByPath(...properties: string[]): ShouldAssertion; - propertyWithDescriptor(name: string, descriptor: PropertyDescriptor): ShouldAssertion; - oneOf(...values: any[]): ShouldAssertion; - ownProperty(name: string, description?: string): ShouldAssertion; - containEql(obj: any): ShouldAssertion; - containDeep(obj: any): ShouldAssertion; - containDeepOrdered(obj: any): ShouldAssertion; - keys(...allKeys: string[]): ShouldAssertion; - keys(allKeys: string[]): ShouldAssertion; - enumerable(property: string, value?: any): ShouldAssertion; - size(size: number): ShouldAssertion; - value(key: string | number, value: any): ShouldAssertion; - enumerables(...properties: string[]): ShouldAssertion; - startWith(expected: string, message?: any): ShouldAssertion; - endWith(expected: string, message?: any): ShouldAssertion; - throw(message?: any, properties?: {}): ShouldAssertion; - - //promises - eventually: ShouldAssertion; - finally: ShouldAssertion; - fulfilled(): Promise; - fulfilledWith(value: any): Promise - rejected(): Promise; - rejectedWith(message: (string | Function | RegExp), properties?: {}): Promise; - rejectedWith(errType: Object): Promise; - - //http - header(field: string, val?: string): ShouldAssertion; - status(code: number): ShouldAssertion; - json(): ShouldAssertion; - html(): ShouldAssertion; - - //stubs - alwaysCalledOn(thisTarget: any): ShouldAssertion; - alwaysCalledWith(...arguments: any[]): ShouldAssertion; - alwaysCalledWithExactly(...arguments: any[]): ShouldAssertion; - alwaysCalledWithMatch(...arguments: any[]): ShouldAssertion; - alwaysCalledWithNew(): ShouldAssertion; - alwaysThrew(exception?: any): ShouldAssertion; - callCount(count: number): ShouldAssertion; - called(): ShouldAssertion; - calledOn(thisTarget: any): ShouldAssertion; - calledOnce(): ShouldAssertion; - calledTwice(): ShouldAssertion; - calledThrice(): ShouldAssertion; - calledWith(...arguments: any[]): ShouldAssertion; - calledWithExactly(...arguments: any[]): ShouldAssertion; - calledWithMatch(...arguments: any[]): ShouldAssertion; - calledWithNew(): ShouldAssertion; - neverCalledWith(...arguments: any[]): ShouldAssertion; - neverCalledWithMatch(...arguments: any[]): ShouldAssertion; - threw(exception?: any): ShouldAssertion; - - // aliases - True(): ShouldAssertion; - False(): ShouldAssertion; - Arguments(): ShouldAssertion; - class(): ShouldAssertion; - deepEqual(expected: any, description?: string): ShouldAssertion; - exactly(expected: any, description?: string): ShouldAssertion; - instanceOf(constructor: Function, description?: string): ShouldAssertion; - throwError(message?: any, properties?: {}): ShouldAssertion; - lengthOf(n: number, description?: string): ShouldAssertion; - key(key: string): ShouldAssertion; - hasOwnProperty(name: string, description?: string): ShouldAssertion; - greaterThan(n: number, description?: string): ShouldAssertion; - lessThan(n: number, description?: string): ShouldAssertion; - null(): ShouldAssertion; - undefined(): ShouldAssertion; -} - -interface ShouldInternal { - // should.js's extras - exist(actual: any, msg?: string): void; - exists(actual: any, msg?: string): void; - not: ShouldInternal; -} - -interface Internal extends ShouldInternal { - (obj: any): ShouldAssertion; - - // node.js's assert functions - fail(actual: any, expected: any, message: string, operator: string): void; - assert(value: any, message: string): void; - ok(value: any, message?: string): void; - equal(actual: any, expected: any, message?: string): void; - notEqual(actual: any, expected: any, message?: string): void; - deepEqual(actual: any, expected: any, message?: string): void; - notDeepEqual(actual: any, expected: any, message?: string): void; - strictEqual(actual: any, expected: any, message?: string): void; - notStrictEqual(actual: any, expected: any, message?: string): void; - throws(block: any, error?: any, message?: string): void; - doesNotThrow(block: any, message?: string): void; - ifError(value: any): void; - inspect(value: any, obj: any): any; -} - -declare var should: Internal; -declare var Should: Internal; -interface Window { - Should: Internal; -} - -declare module "should" { - export = should; -} diff --git a/types/should/should-tests.ts b/types/should/should-tests.ts deleted file mode 100644 index 9f894233bd..0000000000 --- a/types/should/should-tests.ts +++ /dev/null @@ -1,286 +0,0 @@ - - -import should = require('should'); - -should.fail('actual', 'expected', 'msg', 'operator'); -should.assert('value', 'msg'); -should.ok('value'); -should.equal('actual', 'expected'); -should.notEqual('actual', 'expected'); -should.deepEqual('actual', 'expected'); -should.notDeepEqual('actual', 'expected'); -should.strictEqual('actual', 'expected'); -should.notStrictEqual('actual', 'expected'); -should.throws(() => {}); -should.doesNotThrow(() => {}); -should.ifError('value'); - -(0).should - .a - .an - .and - .be - .has - .have - .is - .it - .of - .the - .which - .with - .equal(0) - -class User { - name: string; - pets: string[]; - age: number; -} - -var user = { - name: 'tj', - pets: ['tobi', 'loki', 'jane', 'bandit'], - age: 17 -}; - -user.should.have.property('name', 'tj'); -user.should.have.property('pets').with.lengthOf(4); - -should.exist('hello'); -should.exist([]); -should.exist(null); - -should.not.exist(false); -should.not.exist(''); -should.not.exist({}); - -Should.exist(null); -window.Should.exist(null); - -user.should.have.property('pets').with.lengthOf(4); -user.pets.should.have.lengthOf(4); -user.should.be.of.type('object').and.have.property('name', 'tj'); - -'foo'.should.equal('bar'); - -should.exist({}); -should.exist([]); -should.exist(''); -should.exist(0); -should.exist(null); -should.exist(undefined); - -should.not.exist(undefined); -should.not.exist(null); -should.not.exist(''); -should.not.exist({}); - -true.should.be.ok(); -'yay'.should.be.ok(); -(1).should.be.ok(); - -false.should.not.be.ok(); -''.should.not.be.ok(); -(0).should.not.be.ok(); - -true.should.be.true(); -true.should.be.True(); -'1'.should.not.be.true(); - -false.should.be.false(); -false.should.be.False(); -(0).should.not.be.false(); - -var args = function (a: string, b: string, c: string) { return arguments; }; -args.should.be.arguments(); -args.should.be.Arguments(); -['a'].should.not.be.arguments(); - -['a'].should.be.empty(); -''.should.be.empty(); -({ length: 0 }).should.be.empty(); - -({ foo: 'bar' }).should.eql({ foo: 'bar' }); -[1, 2, 3].should.eql([1, 2, 3]); -[1, 2, 3].should.deepEqual([1, 2, 3]); - -(4).should.equal(4); -'test'.should.equal('test'); -[1, 2, 3].should.not.equal([1, 2, 3]); - -'ab'.should.equalOneOf('a', 10, 'ab'); -'ab'.should.equalOneOf(['a', 10, 'ab']); - -({a: 10}).should.be.oneOf('a', 10, 'ab', {a: 10}); -({a: 10}).should.be.oneOf(['a', 10, 'ab', {a: 10}]); - -'1'.should.be.exactly('1'); -'1'.should.not.be.exactly(1); - -user.age.should.be.within(5, 50); - -user.should.be.of.type('object'); -'test'.should.be.of.type('string'); - -user.should.be.an.instanceof(User); -['a'].should.be.an.instanceOf(Array); - -user.age.should.be.above(5); -user.age.should.not.be.above(100); - -user.age.should.be.below(100); -user.age.should.not.be.below(5); - -'username'.should.match(/^\w+$/); - -user.pets.should.have.length(5); -user.pets.should.have.lengthOf(5); - -user.should.have.property('name'); -user.should.have.property('age', 15); -user.should.not.have.property('rawr'); -user.should.not.have.property('age', 0); - -({ a: 10 }).should.have.properties('a'); -({ a: 10, b: 20 }).should.have.properties([ 'a' ]); -({ a: 10, b: 20 }).should.have.properties({ b: 20 }); -({ foo: 'bar' }).should.have.ownProperty('foo'); -({ foo: 'bar' }).should.hasOwnProperty('foo'); -({ a: {b: 10}}).should.have.propertyByPath('a', 'b').eql(10); -({ a: 10 }).should.have.propertyWithDescriptor('a', { enumerable: true }); - -NaN.should.be.NaN(); -Infinity.should.be.Infinity(); -new Date().should.be.a.Date(); -({}).should.be.an.Object(); -"".should.be.a.String(); -true.should.be.a.Boolean(); -(4).should.be.a.Number(); -new ReferenceError("error").should.be.an.Error(); -(function() {}).should.be.a.Function(); -User.should.be.a.class(); -User.should.be.a.Class(); -'a'.should.not.be.a.generator(); -[].should.be.iterable(); -[].should.be.an.iterator(); -[].should.be.an.Array(); -should(undefined).be.undefined(); -should(null).be.null(); - -var res = {}; -res.should.have.status(200); - -res.should.have.header('content-length'); -res.should.have.header('Content-Length', '123'); -res.should.have.header('content-length', '123'); - -res.should.be.json(); - -res.should.be.html(); - -[1, 2, 3].should.containEql(3); -[1, 2, 3].should.containEql(2); -[1, 2, 3].should.not.containEql(4); - -'foo bar baz'.should.containEql('foo'); -'foo bar baz'.should.containEql('bar'); -'foo bar baz'.should.containEql('baz'); -'foo bar baz'.should.not.containEql('FOO') - -var tobi = { name: 'Tobi', age: 1 }; -var jane = { name: 'Jane', age: 5 }; -var tj = { name: 'TJ', pet: tobi }; -tj.should.containEql({ pet: tobi }); -tj.should.containEql({ pet: tobi, name: 'TJ' }); -tj.should.not.containEql({ pet: jane }); -tj.should.not.containEql({ name: 'Someone' }); - -[[1], [2], [3]].should.containEql([3]); -[[1], [2], [3]].should.containEql([2]); -[[1], [2], [3]].should.not.containEql([4]); - -var spy = function() { }; -spy.should.be.alwaysCalledOn({}); -spy.should.be.alwaysCalledWith(1, 2); -spy.should.be.alwaysCalledWithExactly(1, 2); -spy.should.be.alwaysCalledWithMatch(1, 2); -spy.should.have.alwaysThrew("ReferenceError"); -spy.should.have.callCount(1); -spy.should.be.called(); -spy.should.be.calledOn({}); -spy.should.be.calledOnce(); -spy.should.be.calledTwice(); -spy.should.be.calledThrice(); -spy.should.be.calledWith(1, 2); -spy.should.be.calledWithExactly(1, 2); -spy.should.be.calledWithMatch(1, 2); -spy.should.be.calledWithNew(); -spy.should.be.neverCalledWith(1, 2); -spy.should.be.neverCalledWithMatch(1, 2); -spy.should.have.threw("ReferenceError"); - -(10).should.be.aboveOrEqual(0); -(10).should.be.aboveOrEqual(10); -(10).should.be.greaterThanOrEqual(0); -(10).should.be.greaterThanOrEqual(10); - -(0).should.be.belowOrEqual(10); -(0).should.be.belowOrEqual(0); -(0).should.be.lessThanOrEqual(10); -(0).should.be.lessThanOrEqual(0); - -(function () { - throw new Error('fail'); -}).should.throw(); - -(function () { -}).should.not.throw(); - -(function () { - throw new Error('fail'); -}).should.throw('fail'); - -(function () { - throw new Error('failed to foo'); -}).should.throw(/^fail/); - -(function () { - throw new Error('failed to foo'); -}).should.throw(Error); - -(function () { - throw new Error('failed to foo'); -}).should.throw(Error, { message: 'failed to baz' }); - -(function () { - throw new Error('failed to foo'); -}).should.throwError(Error, { message: 'failed to baz' }); - -(function () { - throw new Error('failed to baz'); -}).should.throwError(/^fail.*/); - -var obj = { foo: 'bar', baz: 'raz' }; -obj.should.have.keys('foo', 'bar'); -obj.should.have.keys(['foo', 'bar']); -obj.should.have.key('foo'); - -({ a: 10 }).should.have.size(1); - -({ a: 10 }).should.have.value('a', 10); -({ a: 10 }).should.have.value(1, 2); - -({ a: 10 }).should.have.enumerable('a'); -({ a: 10 }).should.have.enumerable('a', 10); -({ a: 10, b: 10 }).should.have.enumerables('a', 'b'); - -(1).should.eql(0, 'some useful description'); - -[ 1, 2, 3].should.containDeep([2, 1]); -[ 1, 2, [ 1, 2, 3 ]].should.containDeep([ 1, [ 3, 1 ]]); - -[ 1, 2, 3].should.containDeepOrdered([1, 2]); -[ 1, 2, [ 1, 2, 3 ]].should.containDeepOrdered([ 1, [ 2, 3 ]]); - -({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({a: 10}); -({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({b: {c: 10}}); -({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({b: {d: [1, 3]}}); diff --git a/types/should/tsconfig.json b/types/should/tsconfig.json deleted file mode 100644 index 2e4d8cdeed..0000000000 --- a/types/should/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "should-tests.ts" - ] -} \ No newline at end of file diff --git a/types/should/tslint.json b/types/should/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/should/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/vinyl-fs/vinyl-fs-tests.ts b/types/vinyl-fs/vinyl-fs-tests.ts index 573f25f086..9aa9a02513 100644 --- a/types/vinyl-fs/vinyl-fs-tests.ts +++ b/types/vinyl-fs/vinyl-fs-tests.ts @@ -13,9 +13,20 @@ import File = require('vinyl'); // const spies = require('./spy'); declare const spies: any; -import * as should from 'should'; import 'mocha'; +// TODO: These aren't useful as types tests since they take `any`. +declare const should: ShouldStatic; +interface ShouldStatic { + exist(obj: any, desc?: string): void; + not: this; +} +declare global { + interface Object { + should: { equal(obj: any): void; }; + } +} + declare const gulp: any; let bufferStream: any; diff --git a/types/vinyl/v0/vinyl-tests.ts b/types/vinyl/v0/vinyl-tests.ts index e9017f7235..27ea92a283 100644 --- a/types/vinyl/v0/vinyl-tests.ts +++ b/types/vinyl/v0/vinyl-tests.ts @@ -1,7 +1,4 @@ /// -/// - - import File = require('vinyl'); import Stream = require('stream'); @@ -9,6 +6,23 @@ import fs = require('fs'); declare var fakeStream: NodeJS.ReadWriteStream; +// TODO: These aren't useful as types tests since they take `any`. +declare const should: ShouldStatic; +interface ShouldStatic { + exist(obj: any, desc?: string): void; + not: this; +}; +interface Should { + be: { true: undefined; false: undefined; }; + equal(obj: any, desc?: string): void; + not: this; +} +declare global { + interface Object { + should: Should; + } +} + describe('File', () => { describe('constructor()', () => { From f6184ce001ea1fbf1144ab9c51c3d8b3a6510c05 Mon Sep 17 00:00:00 2001 From: tock203 Date: Tue, 19 Dec 2017 23:02:26 +0900 Subject: [PATCH 086/890] Add missing test case --- types/react-hyperscript/react-hyperscript-tests.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/react-hyperscript/react-hyperscript-tests.ts b/types/react-hyperscript/react-hyperscript-tests.ts index 9782a79248..d8737e6ca9 100644 --- a/types/react-hyperscript/react-hyperscript-tests.ts +++ b/types/react-hyperscript/react-hyperscript-tests.ts @@ -29,3 +29,13 @@ class MainComponent extends React.Component { ]); } } + +class MixedComponent extends React.Component { + render() { + return h('div', {className: 'some class'}, [ + null, + h('span', 'some tag'), + 'some text node' + ]); + } +} From c6f2ca5fd4d6904b7291dfa395e88a644cdb7cd8 Mon Sep 17 00:00:00 2001 From: tock203 Date: Tue, 19 Dec 2017 23:02:35 +0900 Subject: [PATCH 087/890] Make test green again --- types/react-hyperscript/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/react-hyperscript/index.d.ts b/types/react-hyperscript/index.d.ts index 4ead727398..1c5ccffdc5 100644 --- a/types/react-hyperscript/index.d.ts +++ b/types/react-hyperscript/index.d.ts @@ -8,10 +8,12 @@ import { ComponentClass, StatelessComponent, ReactElement } from 'react'; declare namespace h {} +type Element = ReactElement | string | null; + declare function h

( componentOrTag: ComponentClass

| StatelessComponent

| string, properties?: P, - children?: ReadonlyArray> | string + children?: ReadonlyArray | Element ): ReactElement

; export = h; From 90e1bc1afa41a87dae3fe6b785f8cd0ec1a4617c Mon Sep 17 00:00:00 2001 From: tock203 Date: Tue, 19 Dec 2017 23:51:38 +0900 Subject: [PATCH 088/890] Add testcase --- types/react-hyperscript/react-hyperscript-tests.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/types/react-hyperscript/react-hyperscript-tests.ts b/types/react-hyperscript/react-hyperscript-tests.ts index d8737e6ca9..1d037d6bc2 100644 --- a/types/react-hyperscript/react-hyperscript-tests.ts +++ b/types/react-hyperscript/react-hyperscript-tests.ts @@ -1,13 +1,17 @@ import * as React from 'react'; import * as h from 'react-hyperscript'; -class SomeComponent extends React.Component { +interface PropTypes { + foo: string; +} + +class SomeComponent extends React.Component { render() { return React.createElement('div'); } } -const StatelessComponent = () => React.createElement('div'); +const StatelessComponent: React.StatelessComponent = () => React.createElement('div'); class MainComponent extends React.Component { render() { @@ -25,7 +29,8 @@ class MainComponent extends React.Component { h('a', {href: 'http://whatever.com'}, 'One list item') ]), h('li', 'Another list item') - ]) + ]), + h('img', {src: 'https://example.com/some-image'}) ]); } } From d47c9aff6ad222e4a2bffda15828c5f5c043b63d Mon Sep 17 00:00:00 2001 From: tock203 Date: Tue, 19 Dec 2017 23:54:20 +0900 Subject: [PATCH 089/890] Stop treating Element as props --- types/react-hyperscript/index.d.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/types/react-hyperscript/index.d.ts b/types/react-hyperscript/index.d.ts index 1c5ccffdc5..2dbddcf776 100644 --- a/types/react-hyperscript/index.d.ts +++ b/types/react-hyperscript/index.d.ts @@ -10,9 +10,14 @@ declare namespace h {} type Element = ReactElement | string | null; -declare function h

( +declare function h( + componentOrTag: ComponentClass | StatelessComponent | string, + children?: ReadonlyArray | Element +): ReactElement; + +declare function h

( componentOrTag: ComponentClass

| StatelessComponent

| string, - properties?: P, + properties: P, children?: ReadonlyArray | Element ): ReactElement

; From 11e7dd40f62478cb822f701bb84cb105732a7665 Mon Sep 17 00:00:00 2001 From: tock203 Date: Wed, 20 Dec 2017 01:16:42 +0900 Subject: [PATCH 090/890] Add a testcase --- types/react-hyperscript/react-hyperscript-tests.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-hyperscript/react-hyperscript-tests.ts b/types/react-hyperscript/react-hyperscript-tests.ts index 1d037d6bc2..4be72a9b6a 100644 --- a/types/react-hyperscript/react-hyperscript-tests.ts +++ b/types/react-hyperscript/react-hyperscript-tests.ts @@ -30,7 +30,8 @@ class MainComponent extends React.Component { ]), h('li', 'Another list item') ]), - h('img', {src: 'https://example.com/some-image'}) + h('img', {src: 'https://example.com/some-image'}), + h('span', 1234) ]); } } From 185e465458b370a05f3e5e9365035f0aa7ef778f Mon Sep 17 00:00:00 2001 From: tock203 Date: Wed, 20 Dec 2017 01:17:36 +0900 Subject: [PATCH 091/890] Make tests green again --- types/react-hyperscript/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-hyperscript/index.d.ts b/types/react-hyperscript/index.d.ts index 2dbddcf776..207ffe18ce 100644 --- a/types/react-hyperscript/index.d.ts +++ b/types/react-hyperscript/index.d.ts @@ -8,7 +8,7 @@ import { ComponentClass, StatelessComponent, ReactElement } from 'react'; declare namespace h {} -type Element = ReactElement | string | null; +type Element = ReactElement | string | number | null; declare function h( componentOrTag: ComponentClass | StatelessComponent | string, From 789d28808ac1378f8691437b62025d1cc06d0f9c Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 19 Dec 2017 12:17:10 -0600 Subject: [PATCH 092/890] allow for right hand side fo a join to be a Raw value, per the docs --- types/knex/index.d.ts | 6 +++--- types/knex/knex-tests.ts | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 479e38c286..792541d6dd 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -196,19 +196,19 @@ declare namespace Knex { on(columns: { [key: string]: string | Raw }): JoinClause; on(column1: string, column2: string): JoinClause; on(column1: string, raw: Raw): JoinClause; - on(column1: string, operator: string, column2: string): JoinClause; + on(column1: string, operator: string, column2: string | Raw): JoinClause; andOn(raw: Raw): JoinClause; andOn(callback: Function): JoinClause; andOn(columns: { [key: string]: string | Raw }): JoinClause; andOn(column1: string, column2: string): JoinClause; andOn(column1: string, raw: Raw): JoinClause; - andOn(column1: string, operator: string, column2: string): JoinClause; + andOn(column1: string, operator: string, column2: string | Raw): JoinClause; orOn(raw: Raw): JoinClause; orOn(callback: Function): JoinClause; orOn(columns: { [key: string]: string | Raw }): JoinClause; orOn(column1: string, column2: string): JoinClause; orOn(column1: string, raw: Raw): JoinClause; - orOn(column1: string, operator: string, column2: string): JoinClause; + orOn(column1: string, operator: string, column2: string | Raw): JoinClause; onIn(column1: string, values: any[]): JoinClause; andOnIn(column1: string, values: any[]): JoinClause; orOnIn(column1: string, values: any[]): JoinClause; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index 910f0ee427..687b641b93 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -257,6 +257,10 @@ knex.select('*').from('users').join('accounts', function(join: Knex.JoinClause) join.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); +knex.select('*').from('user').join('contacts', () => { + this.on('users.id', '=', knex.raw(7)); +}); + knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').onIn('contacts.id', [7, 15, 23, 41]) }); From 53db8d03dfa43c9e9b9f0987b3d9a62abd0ad0e5 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 19 Dec 2017 13:31:13 -0600 Subject: [PATCH 093/890] remove key from downstream test that was causing build failure --- types/knex-postgis/knex-postgis-tests.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/types/knex-postgis/knex-postgis-tests.ts b/types/knex-postgis/knex-postgis-tests.ts index 4639a55ea6..43a6c2f58b 100644 --- a/types/knex-postgis/knex-postgis-tests.ts +++ b/types/knex-postgis/knex-postgis-tests.ts @@ -7,13 +7,7 @@ const st: KPG.KnexPostgis = KPG(knex); const point: GeoJSON.Point = { type: 'Point', - coordinates: [23.773206, 61.506005], - crs: { - type: 'name', - properties: { - name: 'EPSG:4326' - } - } + coordinates: [23.773206, 61.506005] }; const wktPoint = 'POINT(23.773206 61.506005)'; From eb806511c335c16490bb3bcd17ad2fffc02db5c6 Mon Sep 17 00:00:00 2001 From: Petr Koutny Date: Tue, 19 Dec 2017 20:38:50 +0100 Subject: [PATCH 094/890] Added overload of gulp.task method with dependencies --- types/undertaker/index.d.ts | 8 ++++++++ types/undertaker/undertaker-tests.ts | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/types/undertaker/index.d.ts b/types/undertaker/index.d.ts index f4dcb58417..f7775ce28b 100644 --- a/types/undertaker/index.d.ts +++ b/types/undertaker/index.d.ts @@ -57,6 +57,14 @@ declare class Undertaker extends EventEmitter { */ task(taskName: string, fn: Undertaker.TaskFunction): void; + /** + * Register the task by the taskName. + * @param taskName - Task name. + * @param dependencies - Task dependencies. + * @param fn - Task function. + */ + task(taskName: string, dependencies: string[], fn: Undertaker.TaskFunction): void; + /** * Register the task by the name property of the function. * @param fn - Task function. diff --git a/types/undertaker/undertaker-tests.ts b/types/undertaker/undertaker-tests.ts index c7969a3c52..d9ec56255e 100644 --- a/types/undertaker/undertaker-tests.ts +++ b/types/undertaker/undertaker-tests.ts @@ -22,6 +22,13 @@ taker.task("task3", () => { }); }); +taker.task("task3", ["task1"], () => { + return new Promise((resolve, reject) => { + // do things depending on "task1" + resolve(); // when everything is done + }); +}); + taker.task("combined", taker.series("task1", "task2")); taker.task("all", taker.parallel("combined", "task3")); From 674190e0c1238842e1a31c865de6b280089c105b Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 19 Dec 2017 12:56:38 -0800 Subject: [PATCH 095/890] firebase: Provides its own types --- notNeededPackages.json | 6 + types/angularfire/index.d.ts | 4 +- types/angularfire/package.json | 6 + types/firebase/firebase-simplelogin.d.ts | 94 -- types/firebase/index.d.ts | 418 --------- types/firebase/test/index.ts | 1050 ---------------------- types/firebase/test/simplelogin.ts | 86 -- types/firebase/tsconfig.json | 26 - types/firebase/tslint.json | 79 -- 9 files changed, 14 insertions(+), 1755 deletions(-) create mode 100644 types/angularfire/package.json delete mode 100644 types/firebase/firebase-simplelogin.d.ts delete mode 100644 types/firebase/index.d.ts delete mode 100644 types/firebase/test/index.ts delete mode 100644 types/firebase/test/simplelogin.ts delete mode 100644 types/firebase/tsconfig.json delete mode 100644 types/firebase/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 38c0a39808..10f2a41283 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -240,6 +240,12 @@ "sourceRepoURL": "http://fineuploader.com/", "asOfVersion": "5.14.0" }, + { + "libraryName": "Firebase API", + "typingsPackageName": "firebase", + "sourceRepoURL": "https://www.firebase.com/docs/javascript/firebase", + "asOfVersion": "3.2.1" + }, { "libraryName": "flatpickr", "typingsPackageName": "flatpickr", diff --git a/types/angularfire/index.d.ts b/types/angularfire/index.d.ts index de1482b0e3..a339e89bc5 100644 --- a/types/angularfire/index.d.ts +++ b/types/angularfire/index.d.ts @@ -112,7 +112,7 @@ interface AngularFireObject extends AngularFireSimpleObject { * @param {object} scope * @param {string} varName * @returns a promise which resolves to an unbind method after data is set in scope - */ + */ $bindTo(scope: ng.IScope, varName: string): ng.IPromise; /** @@ -125,7 +125,7 @@ interface AngularFireObject extends AngularFireSimpleObject { * @param {Function} cb * @param {Object} [context] * @returns {Function} invoke to stop observing events - */ + */ $watch(callback: Function, context?: any): Function; /** diff --git a/types/angularfire/package.json b/types/angularfire/package.json new file mode 100644 index 0000000000..3cf0b2f8bd --- /dev/null +++ b/types/angularfire/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "@types/firebase": "^2.4.1" + } +} diff --git a/types/firebase/firebase-simplelogin.d.ts b/types/firebase/firebase-simplelogin.d.ts deleted file mode 100644 index c03702502d..0000000000 --- a/types/firebase/firebase-simplelogin.d.ts +++ /dev/null @@ -1,94 +0,0 @@ -// Type definitions for Firebase Simple Login -// Project: https://www.firebase.com/docs/security/simple-login-overview.html -// Definitions by: Wilker Lucio -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - -interface IFirebaseSimpleLoginError { - code: string; - message: string; -} - -interface IFirebaseSimpleLoginOptions { - // general options - debug?: boolean - rememberMe?: boolean - - // email - email?: string - password?: string - - // facebook / github / google / twitter - preferRedirect?: boolean - - // facebook / github / google - scope?: string - - // facebook - access_token?: string - - // twitter - oauth_token?: string - - // persona - backgroundColor?: string - privacyPolicy?: string - siteLogo?: string - siteName?: string - termsOfService?: string -} - -interface IFirebaseSimpleLoginUser { - // general data - firebaseAuthToken: string; - id: string; - provider: string; - uid: string; - - // email / persona - md5_hash?: string; - - // email - email?: string; - - // facebook / github / google / twitter - accessToken?: string - displayName?: string - thirdPartyUserData?: Object - - // github / twitter - username?: string - - // twitter - accessTokenSecret?: string -} - -declare class FirebaseSimpleLogin { - email: string; - id: string; - provider: string; - uid: string; - username: string; - - constructor(firebase: Firebase, callback: (err: IFirebaseSimpleLoginError, user: IFirebaseSimpleLoginUser) => any); - - login(loginType: string, options?: IFirebaseSimpleLoginOptions): void; - logout(): void; - - createUser(email: string, - password: string, - callback?: (err: IFirebaseSimpleLoginError, user: IFirebaseSimpleLoginUser) => any): void; - - changePassword(email: string, - oldPassword: string, - newPassword: string, - callback?: (err: IFirebaseSimpleLoginError, success: boolean) => any): void; - - sendPasswordResetEmail(email: string, - callback?: (err: IFirebaseSimpleLoginError, success: boolean) => any): void; - - removeUser(email: string, - password: string, - callback?: (err: IFirebaseSimpleLoginError, success: boolean) => any): void; -} \ No newline at end of file diff --git a/types/firebase/index.d.ts b/types/firebase/index.d.ts deleted file mode 100644 index af121a0d02..0000000000 --- a/types/firebase/index.d.ts +++ /dev/null @@ -1,418 +0,0 @@ -// Type definitions for Firebase API 2.4.1 -// Project: https://www.firebase.com/docs/javascript/firebase -// Definitions by: Vincent Botone , Shin1 Kashimura , Sebastien Dubois , Szymon Stasik -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface FirebaseAuthResult { - auth: any; - expires: number; -} - -interface FirebaseDataSnapshot { - /** - * Returns true if this DataSnapshot contains any data. - * It is slightly more efficient than using snapshot.val() !== null. - */ - exists(): boolean; - /** - * Gets the JavaScript object representation of the DataSnapshot. - */ - val(): any; - /** - * Gets a DataSnapshot for the location at the specified relative path. - */ - child(childPath: string): FirebaseDataSnapshot; - /** - * Enumerates through the DataSnapshot’s children (in the default order). - */ - forEach(childAction: (childSnapshot: FirebaseDataSnapshot) => void): boolean; - forEach(childAction: (childSnapshot: FirebaseDataSnapshot) => boolean): boolean; - /** - * Returns true if the specified child exists. - */ - hasChild(childPath: string): boolean; - /** - * Returns true if the DataSnapshot has any children. - */ - hasChildren(): boolean; - /** - * Gets the key name of the location that generated this DataSnapshot. - */ - key(): string; - /** - * @deprecated Use key() instead. - * Gets the key name of the location that generated this DataSnapshot. - */ - name(): string; - /** - * Gets the number of children for this DataSnapshot. - */ - numChildren(): number; - /** - * Gets the Firebase reference for the location that generated this DataSnapshot. - */ - ref(): Firebase; - /** - * Gets the priority of the data in this DataSnapshot. - * @returns {string, number, null} The priority, or null if no priority was set. - */ - getPriority(): any; // string or number - /** - * Exports the entire contents of the DataSnapshot as a JavaScript object. - */ - exportVal(): Object; -} - -interface FirebaseOnDisconnect { - /** - * Ensures the data at this location is set to the specified value when the client is disconnected - * (due to closing the browser, navigating to a new page, or network issues). - */ - set(value: any, onComplete: (error: any) => void): void; - set(value: any): Promise; - /** - * Ensures the data at this location is set to the specified value and priority when the client is disconnected - * (due to closing the browser, navigating to a new page, or network issues). - */ - setWithPriority(value: any, priority: string|number, onComplete: (error: any) => void): void; - setWithPriority(value: any, priority: string|number): Promise; - /** - * Writes the enumerated children at this Firebase location when the client is disconnected - * (due to closing the browser, navigating to a new page, or network issues). - */ - update(value: Object, onComplete: (error: any) => void): void; - update(value: Object): Promise; - /** - * Ensures the data at this location is deleted when the client is disconnected - * (due to closing the browser, navigating to a new page, or network issues). - */ - remove(onComplete: (error: any) => void): void; - remove(): Promise; - /** - * Cancels all previously queued onDisconnect() set or update events for this location and all children. - */ - cancel(onComplete: (error: any) => void): void; - cancel(): Promise; -} - -interface FirebaseQuery { - /** - * Listens for data changes at a particular location. - */ - on(eventType: string, callback: (dataSnapshot: FirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: (error: any) => void, context?: Object): (dataSnapshot: FirebaseDataSnapshot, prevChildName?: string) => void; - /** - * Detaches a callback previously attached with on(). - */ - off(eventType?: string, callback?: (dataSnapshot: FirebaseDataSnapshot, prevChildName?: string) => void, context?: Object): void; - /** - * Listens for exactly one event of the specified event type, and then stops listening. - */ - once(eventType: string, successCallback: (dataSnapshot: FirebaseDataSnapshot) => void, context?: Object): void; - once(eventType: string, successCallback: (dataSnapshot: FirebaseDataSnapshot) => void, failureCallback?: (error: any) => void, context?: Object): void; - once(eventType: string): Promise - /** - * Generates a new Query object ordered by the specified child key. - */ - orderByChild(key: string): FirebaseQuery; - /** - * Generates a new Query object ordered by key name. - */ - orderByKey(): FirebaseQuery; - /** - * Generates a new Query object ordered by child values. - */ - orderByValue(): FirebaseQuery; - /** - * Generates a new Query object ordered by priority. - */ - orderByPriority(): FirebaseQuery; - /** - * @deprecated Use limitToFirst() and limitToLast() instead. - * Generates a new Query object limited to the specified number of children. - */ - limit(limit: number): FirebaseQuery; - /** - * Creates a Query with the specified starting point. - * The generated Query includes children which match the specified starting point. - */ - startAt(value: string, key?: string): FirebaseQuery; - startAt(value: number, key?: string): FirebaseQuery; - /** - * Creates a Query with the specified ending point. - * The generated Query includes children which match the specified ending point. - */ - endAt(value: string, key?: string): FirebaseQuery; - endAt(value: number, key?: string): FirebaseQuery; - /** - * Creates a Query which includes children which match the specified value. - */ - equalTo(value: string|number|boolean, key?: string): FirebaseQuery; - /** - * Generates a new Query object limited to the first certain number of children. - */ - limitToFirst(limit: number): FirebaseQuery; - /** - * Generates a new Query object limited to the last certain number of children. - */ - limitToLast(limit: number): FirebaseQuery; - /** - * Gets a Firebase reference to the Query's location. - */ - ref(): Firebase; -} - -interface Firebase extends FirebaseQuery { - /** - * @deprecated Use authWithCustomToken() instead. - * Authenticates a Firebase client using the provided authentication token or Firebase Secret. - */ - auth(authToken: string, onComplete: (error: any, result: FirebaseAuthResult) => void, onCancel?:(error: any) => void): void; - auth(authToken: string): Promise; - /** - * Authenticates a Firebase client using an authentication token or Firebase Secret. - */ - authWithCustomToken(autoToken: string, onComplete: (error: any, authData: FirebaseAuthData) => void, options?:Object): void; - authWithCustomToken(autoToken: string, options?:Object): Promise; - /** - * Authenticates a Firebase client using a new, temporary guest account. - */ - authAnonymously(onComplete: (error: any, authData: FirebaseAuthData) => void, options?: Object): void; - authAnonymously(options?: Object): Promise; - /** - * Authenticates a Firebase client using an email / password combination. - */ - authWithPassword(credentials: FirebaseCredentials, onComplete: (error: any, authData: FirebaseAuthData) => void, options?: Object): void; - authWithPassword(credentials: FirebaseCredentials, options?: Object): Promise; - /** - * Authenticates a Firebase client using a popup-based OAuth flow. - */ - authWithOAuthPopup(provider: string, onComplete:(error: any, authData: FirebaseAuthData) => void, options?: Object): void; - authWithOAuthPopup(provider: string, options?: Object): Promise; - /** - * Authenticates a Firebase client using a redirect-based OAuth flow. - */ - authWithOAuthRedirect(provider: string, onComplete: (error: any) => void, options?: Object): void; - authWithOAuthRedirect(provider: string, options?: Object): Promise; - /** - * Authenticates a Firebase client using OAuth access tokens or credentials. - */ - authWithOAuthToken(provider: string, credentials: string|Object, onComplete: (error: any, authData: FirebaseAuthData) => void, options?: Object): void; - authWithOAuthToken(provider: string, credentials: string|Object, options?: Object): Promise; - /** - * Synchronously access the current authentication state of the client. - */ - getAuth(): FirebaseAuthData; - /** - * Listen for changes to the client's authentication state. - */ - onAuth(onComplete: (authData: FirebaseAuthData) => void, context?: Object): void; - /** - * Detaches a callback previously attached with onAuth(). - */ - offAuth(onComplete: (authData: FirebaseAuthData) => void, context?: Object): void; - /** - * Unauthenticates a Firebase client. - */ - unauth(): void; - /** - * Gets a Firebase reference for the location at the specified relative path. - */ - child(childPath: string): Firebase; - /** - * Gets a Firebase reference to the parent location. - */ - parent(): Firebase; - /** - * Gets a Firebase reference to the root of the Firebase. - */ - root(): Firebase; - /** - * Returns the last token in a Firebase location. - */ - key(): string; - /** - * @deprecated Use key() instead. - * Returns the last token in a Firebase location. - */ - name(): string; - /** - * Gets the absolute URL corresponding to this Firebase reference's location. - */ - toString(): string; - /** - * Writes data to this Firebase location. - */ - set(value: any, onComplete: (error: any) => void): void; - set(value: any): Promise; - /** - * Writes the enumerated children to this Firebase location. - */ - update(value: Object, onComplete: (error: any) => void): void; - update(value: Object): Promise; - /** - * Removes the data at this Firebase location. - */ - remove(onComplete: (error: any) => void): void; - remove(): Promise; - /** - * Generates a new child location using a unique name and returns a Firebase reference to it. - * @returns {Firebase} A Firebase reference for the generated location. - */ - push(value?: any, onComplete?: (error: any) => void): FirebaseWithPromise; - /** - * Writes data to this Firebase location. Like set() but also specifies the priority for that data. - */ - setWithPriority(value: any, priority: string|number, onComplete: (error: any) => void): void; - setWithPriority(value: any, priority: string|number): Promise; - /** - * Sets a priority for the data at this Firebase location. - */ - setPriority(priority: string|number, onComplete: (error: any) => void): void; - setPriority(priority: string|number): Promise; - /** - * Atomically modifies the data at this location. - */ - transaction(updateFunction: (currentData: any)=> any, onComplete?: (error: any, committed: boolean, snapshot: FirebaseDataSnapshot) => void, applyLocally?: boolean): void; - /** - * Creates a new user account using an email / password combination. - */ - createUser(credentials: FirebaseCredentials, onComplete: (error: any, userData: any) => void): void; - /** - * Updates the email associated with an email / password user account. - */ - changeEmail(credentials: FirebaseChangeEmailCredentials, onComplete: (error: any) => void): void; - /** - * Change the password of an existing user using an email / password combination. - */ - changePassword(credentials: FirebaseChangePasswordCredentials, onComplete: (error: any) => void): void; - /** - * Removes an existing user account using an email / password combination. - */ - removeUser(credentials: FirebaseCredentials, onComplete: (error: any) => void): void; - /** - * Sends a password-reset email to the owner of the account, containing a token that may be used to authenticate and change the user password. - */ - resetPassword(credentials: FirebaseResetPasswordCredentials, onComplete: (error: any) => void): void; - onDisconnect(): FirebaseOnDisconnect; -} - -interface FirebaseWithPromise extends Firebase, Promise {} - -interface FirebaseStatic { - /** - * Constructs a new Firebase reference from a full Firebase URL. - */ - new (firebaseURL: string): Firebase; - /** - * Manually disconnects the Firebase client from the server and disables automatic reconnection. - */ - goOffline(): void; - /** - * Manually reestablishes a connection to the Firebase server and enables automatic reconnection. - */ - goOnline(): void; - - ServerValue: { - /** - * A placeholder value for auto-populating the current timestamp - * (time since the Unix epoch, in milliseconds) by the Firebase servers. - */ - TIMESTAMP: any; - }; -} -declare var Firebase: FirebaseStatic; - -declare module 'firebase' { - export = Firebase; -} - -// Reference: https://www.firebase.com/docs/web/api/firebase/getauth.html -interface FirebaseAuthData { - uid: string; - provider: string; - token: string; - expires: number; - auth: Object; - google?: FirebaseAuthDataGoogle; - twitter?: FirebaseAuthDataTwitter; - github?: FirebaseAuthDataGithub; - facebook?: FirebaseAuthDataFacebook; - password?: FirebaseAuthDataPassword; - anonymous?: any; -} - -interface FirebaseAuthDataPassword{ - email: string; - isTemporaryPassword: boolean; - profileImageURL: string; -} - -interface FirebaseAuthDataTwitter{ - id: string; - accessToken: string; - accessTokenSecret: string; - displayName: string; - username: string; - profileImageURL: string; - cachedUserProfile: any; -} - -interface FirebaseAuthDataGithub{ - id: string; - accessToken: string; - displayName: string; - email?: string; - username: string; - profileImageURL: string; - cachedUserProfile: any; -} - -interface FirebaseAuthDataFacebook{ - id: string; - accessToken: string; - displayName: string; - email?: string; - profileImageURL: string; - cachedUserProfile: any; -} - -interface FirebaseAuthDataGoogle { - accessToken: string; - cachedUserProfile: FirebaseAuthDataGoogleCachedUserProfile; - displayName: string; - email?: string; - id: string; - profileImageURL: string; -} - -interface FirebaseAuthDataGoogleCachedUserProfile { - "family name"?: string; - gender?: string; - "given name"?: string; - id?: string; - link?: string; - locale?: string; - name?: string; - picture?: string; -} - -interface FirebaseCredentials { - email: string; - password: string; -} - -interface FirebaseChangePasswordCredentials { - email: string; - oldPassword: string; - newPassword: string; -} - -interface FirebaseChangeEmailCredentials { - oldEmail: string; - newEmail: string; - password: string; -} - -interface FirebaseResetPasswordCredentials { - email: string; -} diff --git a/types/firebase/test/index.ts b/types/firebase/test/index.ts deleted file mode 100644 index dc144552ea..0000000000 --- a/types/firebase/test/index.ts +++ /dev/null @@ -1,1050 +0,0 @@ - -var AUTH_TOKEN: string = "12345"; -var dataRef:Firebase = new Firebase("https://SampleChat.firebaseio-demo.com/"); -//Log me in -dataRef.auth(AUTH_TOKEN, function(error, result) { - if(error) { - console.log("Login Failed!", error); - } else { - console.log('Authenticated successfully with payload:', result.auth); - console.log('Auth expires at:', new Date(result.expires * 1000)); - } -}); - -var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com/'); -/* - * Firebase.authWithCustomToken() - */ -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - // Log me in - dataRef.authWithCustomToken(AUTH_TOKEN, function (error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } - }); -} - -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - - var onComplete = function (authData: FirebaseAuthData) { - console.log('Synchronization succeeded'); - }; - var onError = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } - }; - - // Log me in - dataRef.authWithCustomToken(AUTH_TOKEN).then(onComplete, onError); - // Same as before but use returned Promise to handle the result -} - -/* - * Firebase.authAnonymously() - */ -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - - var onComplete = function (authData: FirebaseAuthData) { - console.log('Synchronization succeeded'); - }; - var onError = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } - }; - - // Log me in - dataRef.authAnonymously().then(onComplete, onError); - // Same as before but use returned Promise to handle the result -} - -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - // Log me in - dataRef.authAnonymously(function (error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } - }); -} - -/* - * Firebase.authWithPassword() - */ -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - // Log me in - dataRef.authWithPassword({ - "email": "bobtony@firebase.com", - "password": "correcthorsebatterystaple" - }, function (error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } - }); -} - -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - var onComplete = function (authData: FirebaseAuthData) { - console.log('Synchronization succeeded'); - }; - var onError = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } - }; - - // Log me in - dataRef.authWithPassword({ - "email": "bobtony@firebase.com", - "password": "correcthorsebatterystaple" - }).then(onComplete, onError); - // Same as before but use returned Promise to handle the result -} - -/* - * Firebase.authWithOAuthPopup() - */ -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - // Log me in - dataRef.authWithOAuthPopup("twitter", function (error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } - }); -} - -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - - var onComplete = function (authData: FirebaseAuthData) { - console.log('Synchronization succeeded'); - }; - var onError = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } - }; - - // Log me in - dataRef.authWithOAuthPopup("twitter").then(onComplete, onError); - // Same as before but use returned Promise to handle the result -} - -/* - * Firebase.authWithOAuthRedirect - */ -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - // Log me in - dataRef.authWithOAuthRedirect("twitter", function (error) { - if (error) { - console.log('Login Failed!', error); - } else { - // We'll never get here, as the page will redirect on success. - } - }); -} - -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - - var onComplete = function () { - // We'll never get here, as the page will redirect on success. - }; - var onError = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } - }; - - // Log me in - dataRef.authWithOAuthRedirect("twitter").then(onComplete, onError); - // Same as before but use returned Promise to handle the result -} - -/* - * Firebase.authWithOAuthToken() - */ -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - // Authenticate with Facebook using an existing OAuth 2.0 access token - dataRef.authWithOAuthToken("facebook", "", function (error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } - }); -} - -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - - var onComplete = function (authData: FirebaseAuthData) { - console.log('Synchronization succeeded'); - }; - var onError = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } - }; - - // Authenticate with Facebook using an existing OAuth 2.0 access token - dataRef.authWithOAuthToken("facebook", "").then(onComplete, onError); - // Same as before but use returned Promise to handle the result -} - -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - // Authenticate with Twitter using an existing OAuth 1.0a credential set - dataRef.authWithOAuthToken("twitter", { - "user_id": "", - "oauth_token": "", - "oauth_token_secret": "", - }, function (error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } - }); -} - -/* - * Firebase.getAuth() - */ -() => { - var dataRef = new Firebase('https://samplechat.firebaseio-demo.com'); - var authData = dataRef.getAuth(); - - if (authData) { - console.log('Authenticated user with uid:', authData.uid); - } -} - -/* - * Firebase.onAuth() - */ -() => { - var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com'); - firebaseRef.onAuth(function (authData) { - if (authData) { - console.log('Client is authenticated with uid ' + authData.uid); - } else { - // Client is unauthenticated - } - }); -} - -/* - * Firebase.offAuth - */ -() => { - var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com'); - var onAuthChange = function (authData: FirebaseAuthData) { /*...*/ }; - firebaseRef.onAuth(onAuthChange); - // Sometime later... - firebaseRef.offAuth(onAuthChange); -} - -//Time to log out! -dataRef.unauth(); - -var usersRef:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/'); -var fredRef:Firebase = usersRef.child('fred'); -var fredFirstNameRef:Firebase = fredRef.child('name/first'); -var x:string = fredFirstNameRef.toString(); -// x is now 'https://SampleChat.firebaseIO-demo.com/users/fred/name/first'. - -var usersRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/'); -var sampleChatRef:Firebase = usersRef2.parent(); -var x2:string = sampleChatRef.toString(); -// x is now 'https://SampleChat.firebaseIO-demo.com'. -var y:Firebase = sampleChatRef.parent(); -// y is now null, since sampleChatRef refers to the root of the Firebase. - -var fredRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred'); -var sampleChatRef2 :Firebase= fredRef2.root(); -var x3:string = sampleChatRef2.toString(); -// x is now 'https://SampleChat.firebaseIO-demo.com'. - -var fredRef3:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred'); -var x4:string = fredRef3.name(); -// x is now 'fred'. - -/* - * Firebase.key() - */ -() => { - var fredRef = new Firebase("https://samplechat.firebaseio-demo.com/users/fred"); - var key = fredRef.key(); // key === "fred" - key = fredRef.child("name/last").key(); // key === "last" -} -() => { - // Calling key() on the root of a Firebase will return null: - var rootRef = new Firebase("https://samplechat.firebaseio-demo.com"); - var key = rootRef.key(); // key === null -} - -/* - * Firebase.set() - */ -() => { - var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); - fredNameRef.child('first').set('Fred'); - fredNameRef.child('last').set('Flintstone'); - // We've written 'Fred' to the Firebase location storing fred's first name, - // and 'Flintstone' to the location storing his last name -} -() => { - var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); - fredNameRef.set({ first: 'Fred', last: 'Flintstone' }); - // Exact same effect as the previous example, except we've written - // fred's first and last name simultaneously -} -() => { - var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); - var onComplete = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } else { - console.log('Synchronization succeeded'); - } - }; - fredNameRef.set({ first: 'Fred', last: 'Flintstone' }, onComplete); - // Same as the previous example, except we will also log a message - // when the data has finished synchronizing -} - -() => { - var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); - var onComplete = function () { - console.log('Synchronization succeeded'); - }; - var onError = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } - }; - fredNameRef.set({ first: 'Fred', last: 'Flintstone' }).then(onComplete, onError); - // Same as the previous example but use returned Promise to handle the result -} - -/* - * Firebase.update() - */ -() => { - var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); - // Modify the 'first' and 'last' children, but leave other data at fredNameRef unchanged - fredNameRef.update({ first: 'Fred', last: 'Flintstone' }); -} -() => { - var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); - // Same as the previous example, except we will also display an alert - // message when the data has finished synchronizing. - var onComplete = function (error:any) { - if (error) { - console.log('Synchronization failed'); - } else { - console.log('Synchronization succeeded'); - } - }; - fredNameRef.update({ first: 'Wilma', last: 'Flintstone' }, onComplete); -} - -() => { - var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); - var onComplete = function () { - console.log('Synchronization succeeded'); - }; - var onError = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } - }; - fredNameRef.update({ first: 'Fred', last: 'Flintstone' }).then(onComplete, onError); - // Same as the previous example but use returned Promise to handle the result -} - -() => { - var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred'); - //The following 2 function calls are equivalent - fredRef.update({ name: { first: 'Fred', last: 'Flintstone' }}); - fredRef.child('name').set({ first: 'Fred', last: 'Flintstone' }); -} - -/* - * Firebase.remove() - */ -() => { - var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred'); - fredRef.remove(); - // All data at the Firebase location for user 'fred' has been deleted - // (including any child data) -} -() => { - var onComplete = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } else { - console.log('Synchronization succeeded'); - } - }; - fredRef.remove(onComplete); - // Same as the previous example, except we will also log - // a message when the delete has finished synchronizing -} - -() => { - var onComplete = function () { - console.log('Synchronization succeeded'); - }; - var onError = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } - }; - fredRef.remove().then(onComplete, onError); - // Same as the previous example but use returned Promise to handle the result -} - -/* - * Firebase.push() - */ -() => { - var messageListRef = new Firebase('https://samplechat.firebaseio-demo.com/message_list'); - var newMessageRef = messageListRef.push(); - newMessageRef.set({ 'user_id': 'fred', 'text': 'Yabba Dabba Doo!' }); - // We've appended a new message to the message_list location. - var path = newMessageRef.toString(); - // path will be something like - // 'https://samplechat.firebaseio-demo.com/message_list/-IKo28nwJLH0Nc5XeFmj' -} -() => { - var messageListRef = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list'); - messageListRef.push({ 'user_id': 'fred', 'text': 'Yabba Dabba Doo!' }); - // Same effect as the previous example, but we've combined the push() and the set(). -} - -/* - * Firebase.setWithPriority() - */ -() => { - var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred'); - - var user = { - name: { - first: 'Fred', - last: 'Flintstone' - }, - rank: 1000 - }; - - fredRef.setWithPriority(user, 1000); - // We've written Fred's name and rank to firebase, and used his rank (1000) as the - // priority of the data so he'll be ordered relative to other users by his rank -} - - -() => { - var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred'); - - var user = { - name: { - first: 'Fred', - last: 'Flintstone' - }, - rank: 1000 - }; - - fredRef.setWithPriority(user, 1000); - - var onComplete = function () { - console.log('Synchronization succeeded'); - }; - var onError = function (error: any) { - if (error) { - console.log('Synchronization failed'); - } - }; - - fredRef.setWithPriority(user, 1000).then(onComplete, onError); - // Same as the previous example but use returned Promise to handle the result -} - -/* - * Firebase.setPriority() - */ -() => { - var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred'); - fredRef.setPriority(1000); - // We have changed the priority of fred's user data to 1000 -} - -// Increment Fred's rank by 1. -var fredRankRef:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred/rank'); -fredRankRef.transaction(function(currentRank: number) { - return currentRank+1; -}); - -// Try to create a user for wilma, but only if the user id 'wilma' isn't already taken. -var wilmaRef: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/wilma'); -wilmaRef.transaction(function(currentData) { - if (currentData === null) { - return {name: {first: 'Wilma', last: 'Flintstone'} }; - } else { - console.log('User wilma already exists.'); - return; // Abort the transaction. - } -}, function(error: any, committed: boolean, snapshot: FirebaseDataSnapshot) { - if (error) - console.log('Transaction failed abnormally!', error); - else if (!committed) - console.log('We aborted the transaction (because wilma already exists).'); - else - console.log('User wilma added!'); - console.log('Wilma\'s data: ', snapshot.val()); -}); - -/* - * Firebase.createUser() - */ -() => { - var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com'); - firebaseRef.createUser({ - email: "bobtony@firebase.com", - password: "correcthorsebatterystaple" - }, function (err) { - if (err) { - switch (err.code) { - case 'EMAIL_TAKEN': - // The new user account cannot be created because the email is already in use. - case 'INVALID_EMAIL': - // The specified email is not a valid email. - default: - } - } else { - // User account created successfully! - } - }); -} - -/* - * Firebase.changePassword() - */ -() => { - var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com'); - firebaseRef.changePassword({ - email: "bobtony@firebase.com", - oldPassword: "correcthorsebatterystaple", - newPassword: "shinynewpassword" - }, function (err) { - if (err) { - switch (err.code) { - case 'INVALID_PASSWORD': - // The specified user account password is incorrect. - case 'INVALID_USER': - // The specified user account does not exist. - default: - } - } else { - // User password changed successfully! - } - }); -} - -/* - * Firebase.removeUser() - */ -() => { - var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com'); - firebaseRef.removeUser({ - email: "bobtony@firebase.com", - password: "correcthorsebatterystaple" - }, function (err) { - if (err) { - switch (err.code) { - case 'INVALID_USER': - // The specified user account does not exist. - case 'INVALID_PASSWORD': - // The specified user account password is incorrect. - default: - } - } else { - // User account deleted successfully! - } - }); -} - -/* - * Firebase.resetPassword() - */ -() => { - var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com'); - firebaseRef.resetPassword({ - email: "bobtony@firebase.com" - }, function (err) { - if (err) { - switch (err.code) { - case 'INVALID_USER': - // The specified user account does not exist. - default: - } - } else { - // Password reset email sent successfully! - } - }); -} - -//var messageListRef: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list'); -//var lastMessagesQuery:FirebaseQuery = messageListRef.endAt().limit(500); -//lastMessagesQuery.on('child_added', function(childSnapshot: FirebaseDataSnapshot) { /* handle child add */ }); - -//var messageListRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list'); -//var firstMessagesQuery:FirebaseQuery = messageListRef2.startAt().limit(500); -//firstMessagesQuery.on('child_added', function(childSnapshot: FirebaseDataSnapshot) { /* handle child add */ }); - -//var usersRef3: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users'); -//var usersQuery: FirebaseQuery = usersRef3.startAt(1000).limit(50); -//usersQuery.on('child_added', function(userSnapshot: FirebaseDataSnapshot) { /* handle user */ }); - -/* - * Firebase.goOffline() - * Firebase.goOnline() - */ -() => { - var usersRef = new Firebase('https://samplechat.firebaseio-demo.com/users'); - Firebase.goOffline(); // All Firebase instances are disconnected - Firebase.goOnline(); // All Firebase instances automatically reconnect -} - -/* - * FirebaseQuery.on() - */ -() => { - firebaseRef.on('value', function (dataSnapshot) { - // code to handle new value. - }); - - firebaseRef.on('child_added', function (childSnapshot, prevChildName) { - // code to handle new child. - }); - - firebaseRef.on('child_removed', function (oldChildSnapshot) { - // code to handle child removal. - }); - - firebaseRef.on('child_changed', function (childSnapshot, prevChildName) { - // code to handle child data changes. - }); - - firebaseRef.on('child_changed', function (childSnapshot, prevChildName) { - // code to handle child data changes. - }); -} - -/* - * FirebaseQuery.off() - */ -() => { - var onValueChange = function (dataSnapshot: FirebaseDataSnapshot) { /* handle... */ }; - firebaseRef.on('value', onValueChange); - // Sometime later... - firebaseRef.off('value', onValueChange); -} -() => { - // Or you can save a line of code by using an inline function - // and on()'s return value. - var onValueChange = firebaseRef.on('value', function (dataSnapshot) { /* handle... */ }); - // Sometime later... - firebaseRef.off('value', onValueChange); -} - -/* - * FirebaseQuery.once() - */ -() => { - // Basic usage of .once() to read the data located at firebaseRef. - firebaseRef.once('value', function (dataSnapshot) { - // handle read data. - }); -} -() => { - // Provide a failureCallback to be notified when this - // callback is revoked due to security violations. - firebaseRef.once('value', function (dataSnapshot) { - // code to handle new value - }, function (err: any) { - // code to handle read error - }); -} -() => { - // Provide a context to override "this" when callbacks are triggered. - firebaseRef.once('value', function (dataSnapshot) { - // this.x is 1 - }, { x: 1 }); -} - -() => { - // Use a Promise in place of a callback - firebaseRef.once('value').then(function(dataSnapshot){ - // handle read data - }) -} - -/* - * FirebaseQuery.orderByChild() - */ -() => { - // For example, using our sample Firebase of dinosaur facts, - // we can read all dinosaurs ordered by height using the following query: - var ref = new Firebase("https://dinosaur-facts.firebaseio.com/"); - ref.orderByChild("height").on("child_added", function (snapshot) { - console.log(snapshot.key() + " was " + snapshot.val().height + " meters tall"); - }); -} - -/* - * FirebaseQuery.orderByKey() - */ -() => { - // For example, using our sample Firebase of dinosaur facts, - // we can read all dinosaurs in alphabetical order, ignoring their priority, - // using the following query: - var ref = new Firebase("https://dinosaur-facts.firebaseio.com/"); - ref.orderByKey().on("child_added", function (snapshot) { - console.log(snapshot.key()); - }); -} - -/* - * FirebaseQuery.orderByPriority() - */ -() => { - // For example, using our sample Firebase of dinosaur facts, - // we can read all dinosaurs in priority order using the following query: - var ref = new Firebase("https://dinosaur-facts.firebaseio.com/"); - ref.orderByPriority().on("child_added", function (snapshot) { - console.log(snapshot.key()); - }); -} - -/* - * FirebaseQuery.startAt() - */ -() => { - // For example, using our sample Firebase of dinosaur facts, - // we can find all dinosaurs that are at least three meters tall - // by combining orderByChild() and startAt(): - var ref = new Firebase("https://dinosaur-facts.firebaseio.com/"); - ref.orderByChild("height").startAt(3).on("child_added", function (snapshot) { - console.log(snapshot.key()) - }); -} - -/* - * FirebaseQuery.endAt() - */ -() => { - // For example, using our sample Firebase of dinosaur facts, - // we can find all dinosaurs whose names come before Pterodactyl lexicographically - // by combining orderByKey() and endAt(): - var ref = new Firebase("https://dinosaur-facts.firebaseio.com/"); - ref.orderByKey().endAt("pterodactyl").on("child_added", function (snapshot) { - console.log(snapshot.key()); - }); -} - -/* - * FirebaseQuery.equalTo() - */ -() => { - // For example, using our sample Firebase of dinosaur facts, - // we can find all dinosaurs whose height is exactly 25 meters - // by combining orderByChild() and equalTo(): - var ref = new Firebase("https://dinosaur-facts.firebaseio.com/"); - ref.orderByChild("height").equalTo(25).on("child_added", function (snapshot) { - console.log(snapshot.key()); - }); -} - -/* - * FirebaseQuery.limitToFirst - */ -() => { - // Using our sample Firebase of dinosaur facts, - // we can find the two shortest dinosaurs with this query: - var ref = new Firebase("https://dinosaur-facts.firebaseio.com/"); - ref.orderByChild("height").limitToFirst(2).on("child_added", function (snapshot) { - console.log(snapshot.key()); - }); -} - -/* - * FirebaseQuery.limitToLast - */ -() => { - // Using our sample Firebase of dinosaur facts, - // we can find the two heaviest dinosaurs with this query: - var ref = new Firebase("https://dinosaur-facts.firebaseio.com/"); - ref.orderByChild("weight").limitToLast(2).on("child_added", function (snapshot) { - console.log(snapshot.key()); - }); -} - -/* - * FirebaseQuery.ref() - */ -() => { - // The Firebase reference returned by ref() is equivalent to the Firebase reference used to create the Query. - var ref = new Firebase("https://samplechat.firebaseio-demo.com/users"); - var query = ref.limitToFirst(5); - var refToSameLocation = query.ref(); // ref === refToSameLocation -} - -/* - * Firebase.onDisconnect().set() - */ -() => { - var disconnectRef = new Firebase('https://samplechat.firebaseio-demo.com/disconnectmessage'); - disconnectRef.onDisconnect().set('I disconnected!'); -} - -/* - * Firebase.onDisconnect().update() - */ -() => { - var disconnectRef = new Firebase('https://samplechat.firebaseio-demo.com/disconnectmessage'); - disconnectRef.onDisconnect().update({ message: 'I disconnected!' }); -} - -/* - * Firebase.onDisconnect().remove() - */ -() => { - var disconnectRef = new Firebase('https://samplechat.firebaseio-demo.com/disconnectdata'); - disconnectRef.onDisconnect().remove(); -} - -/* - * Firebase.onDisconnect().setWithPriority() - */ -() => { - var disconnectRef = new Firebase('https://samplechat.firebaseio-demo.com/disconnectMessage'); - disconnectRef.onDisconnect().setWithPriority('I disconnected', 10); -} - -/* - * Firebase.onDisconnect().cancel() - */ -() => { - var fredOnlineRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/online'); - fredOnlineRef.onDisconnect().set(false); - - // cancel the previously set onDisconnect().set() event - fredOnlineRef.onDisconnect().cancel(); -} - -/* - * Firebase.ServerValue.TIMESTAMP - */ -() => { - // Record the current time immediately, and queue an event to - // record the time at which the user disconnects. - var sessionsRef = new Firebase('https://samplechat.firebaseio-demo.com/sessions/'); - var mySessionRef = sessionsRef.push(); - mySessionRef.onDisconnect().update({ endedAt: Firebase.ServerValue.TIMESTAMP }); - mySessionRef.update({ startedAt: Firebase.ServerValue.TIMESTAMP }); -} - -/* - * DataSnapshot.val() - */ -() => { - // Demonstrate writing data and then reading it back as a Javascript object. - var fredNameRef = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred'); - fredNameRef.set({ first: 'Fred', last: 'Flintstone' }); - - fredNameRef.once('value', function (nameSnapshot) { - var val = nameSnapshot.val(); - // val now contains the object { first: 'Fred', last: 'Flintstone' }. - }); -} - -/* - * DataSnapshot.child() - */ -(dataSnapshot:FirebaseDataSnapshot) => { - // Given a DataSnapshot containing a child 'name' that has children 'first' - // (set to 'Fred') and 'last' (set to 'Flintstone'): - var nameSnapshot = dataSnapshot.child('name'); - var name = nameSnapshot.val(); - // name now contains { first: 'Fred', last: 'Flintstone'}. - - var firstNameSnapshot = dataSnapshot.child('name/first'); - var firstName = firstNameSnapshot.val(); - // firstName now contains 'Fred'. - - var favoriteColorSnapshot = dataSnapshot.child('favorite_color'); - var favoriteColor = favoriteColorSnapshot.val(); - // favoriteColor will be null, because there is no 'favorite_color' child in dataSnapshot. -} - -/* - * DataSnapshot.forEach() - */ -(dataSnapshot:FirebaseDataSnapshot) => { - // Given a DataSnapshot containing a child "fred" and a child "wilma", this callback - // function will be called twice - dataSnapshot.forEach(function (childSnapshot) { - // key will be "fred" the first time and "wilma" the second time - var key = childSnapshot.key(); - - // childData will be the actual contents of the child - var childData = childSnapshot.val(); - }); -} -(dataSnapshot:FirebaseDataSnapshot) => { - // Given a DataSnapshot containing a child "fred" and a child "wilma", this callback - // funciton will only be called once (since we return true) - dataSnapshot.forEach(function (childSnapshot) { - var key = childSnapshot.key(); // key will be "fred" - return true; - }); -} - -/* - * DataSnapshot.hasChild() - */ -(dataSnapshot: FirebaseDataSnapshot) => { - // Given a DataSnapshot with child 'fred' and no other children: - var x = dataSnapshot.hasChild('fred'); - var y = dataSnapshot.hasChild('whales'); - // x is true and y is false. -} - -/* - * DataSnapshot.hasChildren() - */ -(dataSnapshot: FirebaseDataSnapshot) => { - // Given a DataSnapshot containing a child 'name' with children 'first' - // (set to 'Fred') and 'last' (set to 'Flintstone'): - var x = dataSnapshot.hasChildren(); - // x is true. - var y = dataSnapshot.child('name').hasChildren(); - // y is true. - var z = dataSnapshot.child('name/first').hasChildren(); - // z is false since 'Fred' is a string and therefore has no children. -} - -/* - * DataSnapshot.key() - */ -() => { - // Calling key() on any DataSnapshot (except for one which represents the root of a Firebase) - // will return the key name of the location that generated it: - var fredRef = new Firebase("https://samplechat.firebaseio-demo.com/users/fred"); - fredRef.on("value", function (fredSnapshot) { - var key = fredSnapshot.key(); // key === "fred" - key = fredSnapshot.child("name/last").key(); // key === "last" - }); -} -() => { - // Calling key() on a DataSnapshot generated from a reference to the root of a Firebase return null: - var rootRef = new Firebase("https://samplechat.firebaseio-demo.com"); - rootRef.on("value", function (rootSnapshot) { - var key = rootSnapshot.key(); // key === null - }); -} - -/* - * DataSnapshot.name() - */ -() => { - var fredRef = new Firebase("https://samplechat.firebaseio-demo.com/users/fred"); - fredRef.on("value", function (fredSnapshot) { - var key = fredSnapshot.name(); // key === "fred" - key = fredSnapshot.child("name/last").name(); // key === "last" - }); -} -() => { - var rootRef = new Firebase("https://samplechat.firebaseio-demo.com"); - rootRef.on("value", function (rootSnapshot) { - var key = rootSnapshot.name(); // key === null - }); -} - -/* - * DataSnapshot.numChildren() - */ -(dataSnapshot: FirebaseDataSnapshot) => { - // Given a DataSnapshot containing a child 'name' with children 'first' - // (set to 'Fred') and 'last' (set to 'Flintstone'): - var x = dataSnapshot.numChildren(); - // x is 1. - var y = dataSnapshot.child('name').numChildren(); - // y is 2. - var z = dataSnapshot.child('name/first').numChildren(); - // z is 0 since 'Fred' is a string and therefore has no children. -} - -/* - * DataSnaphot.ref() - */ -() => { - var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred'); - fredRef.on('value', function (fredSnapshot) { - var fredRef2 = fredSnapshot.ref(); - // fredRef and fredRef2 both point to the same location. - }); -} - -/* - * DataSnapshot.getPriority() - */ -(dataSnapshot: FirebaseDataSnapshot) => { - // Given a snapshot for data with priority 1000: - var x = dataSnapshot.getPriority(); - // x is now 1000. -} - -/* - * DataSnapshot.exportVal() - */ -(dataSnapshot: FirebaseDataSnapshot) => { - firebaseRef.setWithPriority('hello', 500); - firebaseRef.once('value', function (dataSnapshot) { - var x = dataSnapshot.exportVal(); - // x now contains { '.value': 'hello', '.priority': 500 } - }); -} -(dataSnapshot: FirebaseDataSnapshot) => { - firebaseRef.set('hello'); - firebaseRef.once('value', function (dataSnapshot) { - var x = dataSnapshot.exportVal(); - // x now contains 'hello' - }); -} -(dataSnapshot: FirebaseDataSnapshot) => { - // Note: To access these variables in JavaScript, you can use x['.value'] and x['.priority']. - firebaseRef.setWithPriority({ a: 'hello', b: 'hi' }, 500); - firebaseRef.once('value', function (dataSnapshot) { - var x = dataSnapshot.exportVal(); - // x now contains { 'a': 'hello', 'b': 'hi', '.priority': 500 } - }); -} diff --git a/types/firebase/test/simplelogin.ts b/types/firebase/test/simplelogin.ts deleted file mode 100644 index a68f98aba3..0000000000 --- a/types/firebase/test/simplelogin.ts +++ /dev/null @@ -1,86 +0,0 @@ - - -var chatRef: Firebase = new Firebase('https://.firebaseio.com'); -var auth: FirebaseSimpleLogin = new FirebaseSimpleLogin(chatRef, function(error, user) { - if (error) { - // an error occurred while attempting login - switch(error.code) { - case 'INVALID_EMAIL': - case 'INVALID_PASSWORD': - default: - } - } else if (user) { - // user authenticated with Firebase - console.log('User ID: ' + user.id + ', Provider: ' + user.provider); - } else { - // user is logged out - } -}); - -var email = 'my@email.com'; -var password = 'secret'; -var oldPassword = 'secret'; -var newPassword = 'secret'; - -auth.login('password', { - email: '', - password: '', - rememberMe: true -}); - -auth.login('facebook', { - rememberMe: true, - scope: 'email,user_likes' -}); - -auth.login('github', { - rememberMe: true, - scope: 'user,gist' -}); - -auth.login('google', { - rememberMe: true, - scope: 'https://www.googleapis.com/auth/plus.login' -}); - -auth.login('persona', { - rememberMe: true -}); - -auth.login('twitter', { - rememberMe: true -}); - -auth.login('anonymous'); - -auth.createUser(email, password, function(error, user) { - if (!error) { - console.log('User Id: ' + user.id + ', Email: ' + user.email); - } -}); - -auth.createUser(email, password); - -auth.changePassword(email, oldPassword, newPassword, function(error, success) { - if (!error) { - console.log('Password changed successfully'); - } -}); - -auth.changePassword(email, oldPassword, newPassword); - -auth.sendPasswordResetEmail(email, function(error, success) { - if (!error) { - console.log('Password reset email sent successfully'); - } -}); - -auth.sendPasswordResetEmail(email); - -auth.removeUser(email, password, function(error, success) { - if (!error) { - console.log('User deleted successfully'); - } -}); - -auth.removeUser(email, password); \ No newline at end of file diff --git a/types/firebase/tsconfig.json b/types/firebase/tsconfig.json deleted file mode 100644 index 4695310ec3..0000000000 --- a/types/firebase/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "firebase-simplelogin.d.ts", - "test/index.ts", - "test/simplelogin.ts" - ] -} \ No newline at end of file diff --git a/types/firebase/tslint.json b/types/firebase/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/firebase/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 5435bc9478fd679c39263e19b6750195174879c9 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 19 Dec 2017 13:05:34 -0800 Subject: [PATCH 096/890] confirmdialog: Provides its own types --- notNeededPackages.json | 6 + types/confirmdialog/confirmdialog-tests.ts | 129 --------------------- types/confirmdialog/index.d.ts | 93 --------------- types/confirmdialog/tsconfig.json | 23 ---- types/confirmdialog/tslint.json | 1 - 5 files changed, 6 insertions(+), 246 deletions(-) delete mode 100644 types/confirmdialog/confirmdialog-tests.ts delete mode 100644 types/confirmdialog/index.d.ts delete mode 100644 types/confirmdialog/tsconfig.json delete mode 100644 types/confirmdialog/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 38c0a39808..6048746555 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -144,6 +144,12 @@ "sourceRepoURL": "https://github.com/tj/commander.js", "asOfVersion": "2.12.2" }, + { + "libraryName": "confirmdialog", + "typingsPackageName": "confirmdialog", + "sourceRepoURL": "https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js", + "asOfVersion": "1.0.0" + }, { "libraryName": "constant-case", "typingsPackageName": "constant-case", diff --git a/types/confirmdialog/confirmdialog-tests.ts b/types/confirmdialog/confirmdialog-tests.ts deleted file mode 100644 index cd2ad0e8ca..0000000000 --- a/types/confirmdialog/confirmdialog-tests.ts +++ /dev/null @@ -1,129 +0,0 @@ -class Confirm { - private title_: string; - private conTent_: string; - constructor(title: string, content: string) { - this.title_ = title; - this.conTent_ = content; - } - - confirm() { - $.confirm({ - title: 'Confirm!', - content: 'Simple confirm!', - buttons: { - confirm: () => { - $.alert('Confirmed!'); - }, - cancel: (cancel: string) => { - $.alert('Canceled! ' + cancel); - }, - somethingElse: { - text: 'Something else', - btnClass: 'btn-blue', - keys: ['enter', 'shift'], - action: () => { - alert('Something else?'); - } - } - } - }); - } - - alert() { - $.alert({ - title: 'Alert!', - content: 'Simple alert!', - }); - } - - globalSettings() { - jconfirm.defaults = { - title: 'Hello', - titleClass: '', - type: 'default', - typeAnimated: true, - draggable: true, - dragWindowGap: 15, - dragWindowBorder: true, - animateFromElement: true, - smoothContent: true, - content: 'Are you sure to continue?', - buttons: {}, - defaultButtons: { - ok: { - action: () => { - } - }, - close: { - action: () => { - } - }, - }, - - icon: '', - lazyOpen: false, - bgOpacity: null, - theme: 'light', - animation: 'scale', - closeAnimation: 'scale', - animationSpeed: 400, - animationBounce: 1, - rtl: false, - container: 'body', - containerFluid: false, - backgroundDismiss: false, - backgroundDismissAnimation: 'shake', - autoClose: false, - closeIcon: null, - closeIconClass: false, - watchInterval: 100, - columnClass: 'col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1', - boxWidth: '50%', - scrollToPreviousElement: true, - scrollToPreviousElementAnimate: true, - useBootstrap: true, - offsetTop: 40, - offsetBottom: 40, - bootstrapClasses: { - container: 'container', - containerFluid: 'container-fluid', - row: 'row', - }, - onContentReady: () => {}, - onOpenBefore: () => {}, - onOpen: () => {}, - onClose: () => {}, - onDestroy: () => {}, - onAction: () => {} -}; - } - - api() { - const jc = $.confirm({ - title: 'awesome', - onContentReady: () => { - jc.setTitle(); - } -}); - } - - confirm_84() { - $.confirm({ - closeIcon: true, - buttons: { - buttonA: { - text: 'button a', - action: (buttonA: string) => { - return false; // prevent the modal from closing - } - }, - resetButton: (resetButton: string) => { - } - } -}); - } -} - -let firstName = 'Pierre'; -let lastName = 'Yotti'; -let type = new Confirm(firstName, lastName); diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts deleted file mode 100644 index 9b98ab2389..0000000000 --- a/types/confirmdialog/index.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -// Type definitions for confirmdialog 3.3 -// Project: https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js -// Definitions by: Alli Pierre Yotti -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - - interface JQueryStatic { - /** - * confirm Dialog - * {confirmOptions} pOtions - */ - confirm(pOtions: options.confirmOptions | string, title?: string): any; - - /** - * confirm alert - * {any} pMessage - */ - alert(pMessage?: any, title?: string): any; - - /** - * confirm Dialog - * {any} pMessage - */ - dialog(pOtions: options.confirmOptions | string): any; -} - - interface JQuery { - /** - * confirm Dialog - * {confirmOptions} pOtions - */ - confirm(pOtions: options.confirmOptions | string, title?: string): any; - - /** - * confirm alert - * {any} pMessage - */ - alert(pMessage?: any, title?: string): any; - - /** - * confirm Dialog - * {any} pMessage - */ - dialog(pOtions: options.confirmOptions): any; -} - -interface Window { - setContentAppend: any; -} - -declare namespace options { - interface confirmOptions { - buttons?: any; - title?: string | boolean; - content?: any; - onContentReady?: any; - lazyOpen?: boolean; - closeIcon?: any; - type?: string; - typeAnimated?: boolean; - icon?: string; - closeIconClass?: string; - columnClass?: string; - containerFluid?: boolean; - boxWidth?: string; - useBootstrap?: boolean; - bootstrapClasses?: any; - draggable?: boolean; - dragWindowBorder?: boolean; - dragWindowGap?: number; - contentLoaded?: () => void; - autoClose?: string; - backgroundDismiss?: any; - backgroundDismissAnimation?: string; - escapeKey?: string | boolean; - onOpenBefore?: () => void; - onOpen?: () => void; - onClose?: () => void; - onDestroy?: () => void; - onAction?: () => void; - } - - interface buttonOptionss { - cancel?: () => void; - confirm?: () => void; - } -} - -declare namespace jconfirm { - let defaults: any; -} diff --git a/types/confirmdialog/tsconfig.json b/types/confirmdialog/tsconfig.json deleted file mode 100644 index 95f33eb036..0000000000 --- a/types/confirmdialog/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": ["../"], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "target": "es6" - }, - "files": [ - "index.d.ts", - "confirmdialog-tests.ts" - ] -} diff --git a/types/confirmdialog/tslint.json b/types/confirmdialog/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/confirmdialog/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 767a8a946792f276a7d4c2ed196a6e73e2cee103 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 19 Dec 2017 13:15:33 -0800 Subject: [PATCH 097/890] es6-error: Provides its own types --- notNeededPackages.json | 6 +++ types/es6-error/es6-error-tests.ts | 9 ---- types/es6-error/index.d.ts | 6 --- types/es6-error/tsconfig.json | 23 --------- types/es6-error/tslint.json | 79 ------------------------------ 5 files changed, 6 insertions(+), 117 deletions(-) delete mode 100644 types/es6-error/es6-error-tests.ts delete mode 100644 types/es6-error/index.d.ts delete mode 100644 types/es6-error/tsconfig.json delete mode 100644 types/es6-error/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 38c0a39808..7e42bfb45c 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -204,6 +204,12 @@ "sourceRepoURL": "https://github.com/stacktracejs/error-stack-parser", "asOfVersion": "2.0.0" }, + { + "libraryName": "es6-error", + "typingsPackageName": "es6-error", + "sourceRepoURL": "https://github.com/bjyoungblood/es6-error", + "asOfVersion": "4.0.2" + }, { "libraryName": "eventemitter2", "typingsPackageName": "eventemitter2", diff --git a/types/es6-error/es6-error-tests.ts b/types/es6-error/es6-error-tests.ts deleted file mode 100644 index 26ed7b6677..0000000000 --- a/types/es6-error/es6-error-tests.ts +++ /dev/null @@ -1,9 +0,0 @@ -import * as ExtendableError from "es6-error" - -class TestError extends ExtendableError { - constructor (message: string = "TestError") { - super(message) - } -} - -throw new TestError("Test Message") diff --git a/types/es6-error/index.d.ts b/types/es6-error/index.d.ts deleted file mode 100644 index c1d3d5ce21..0000000000 --- a/types/es6-error/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Type definitions for es6-error v4.0.0 -// Project: https://github.com/bjyoungblood/es6-error -// Definitions by: Karol Janyst -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = Error; diff --git a/types/es6-error/tsconfig.json b/types/es6-error/tsconfig.json deleted file mode 100644 index 1205819cd3..0000000000 --- a/types/es6-error/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "es6-error-tests.ts" - ] -} \ No newline at end of file diff --git a/types/es6-error/tslint.json b/types/es6-error/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/es6-error/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From c3cf24f103c05c6255808bb40cbb3a57ac12f03d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 19 Dec 2017 13:31:38 -0800 Subject: [PATCH 098/890] sharp-timer: Provides its own types --- notNeededPackages.json | 6 + types/sharp-timer/index.d.ts | 302 ---------------------- types/sharp-timer/sharp-timer-tests.ts | 32 --- types/sharp-timer/tsconfig.json | 23 -- types/sharp-timer/tslint.json | 3 - types/sharp-timer/v0/index.d.ts | 52 ---- types/sharp-timer/v0/sharp-timer-tests.ts | 10 - types/sharp-timer/v0/tsconfig.json | 28 -- types/sharp-timer/v0/tslint.json | 3 - 9 files changed, 6 insertions(+), 453 deletions(-) delete mode 100644 types/sharp-timer/index.d.ts delete mode 100644 types/sharp-timer/sharp-timer-tests.ts delete mode 100644 types/sharp-timer/tsconfig.json delete mode 100644 types/sharp-timer/tslint.json delete mode 100644 types/sharp-timer/v0/index.d.ts delete mode 100644 types/sharp-timer/v0/sharp-timer-tests.ts delete mode 100644 types/sharp-timer/v0/tsconfig.json delete mode 100644 types/sharp-timer/v0/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 00a05890bd..9755afc04b 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -696,6 +696,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/sentence-case", "asOfVersion": "1.1.3" }, + { + "libraryName": "sharp-timer", + "typingsPackageName": "sharp-timer", + "sourceRepoURL": "https://github.com/afractal/SharpTimer", + "asOfVersion": "0.1.3" + }, { "libraryName": "Shopify Prime", "typingsPackageName": "shopify-prime", diff --git a/types/sharp-timer/index.d.ts b/types/sharp-timer/index.d.ts deleted file mode 100644 index 944da76b4f..0000000000 --- a/types/sharp-timer/index.d.ts +++ /dev/null @@ -1,302 +0,0 @@ -// Type definitions for sharp-timer library. 1.0 -// Project: https://github.com/afractal/SharpTimer -// Definitions by: Hermes Gjini - afractal -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -export const millisPerSecond: 1000; -export const millisPerMinute: 60000; -export const millisPerHour: 3600000; -export const millisPerDay: 86400000; -export type ElapsedEvent = () => void; -export type ElapsingEvent = (intervalValue: number) => void; - -/** - * Simulates the actions of a generic timer, - * generates elapsing and elapsed events for a specified interval. - */ -export class Timer { - private _enabled: boolean; - private _stopped: boolean; - private _interval: number; - private _intervalElapsedEvents: ElapsedEvent[]; - private _intervalElapsingEvents: ElapsingEvent[]; - - /** - * Initializes a new instance of the Timer class, - * and sets all the properties to their initial values. - * @param interval - * The time, in milliseconds, in which the timer will be active. - * The value must be greater than zero. - */ - constructor(interval: number); - - /** - * Gets a boolean value to indicate the enabled state - * of the current Timer instance. - * @default true - */ - readonly enabled: boolean; - - /** - * Gets a boolean value to indicate the stopped state - * of the current Timer instance. - * @default false - */ - readonly stopped: boolean; - - /** - * Gets or sets the remaining interval in milliseconds. - * The value must be greater than zero. - */ - interval: number; - - /** - * Starts raising the Timer events - * by setting the enabled property to true. - */ - start(): void; - - /** - * Pauses the Timer instance by setting the enabled property to false. - */ - pause(): void; - - /** - * Resumes the Timer instance by setting the enabled property to true. - */ - resume(): void; - - /** - * Stops raising the Timer event - * by setting the enabled property to false. - */ - stop(): void; - - /** - * Occurs when the interval has completely elapsed. - * @param intervalElapsedHandler - * The callback which will be executed when - * the interval elapsed event occurs. - */ - onIntervalElapsed(intervalElapsedHandler: ElapsedEvent): void; - - /** - * Occurs when the interval elapses and completely elapsed. - * @param intervalElapsingHandler - * The callback which will be executed when - * the interval elapsing event occurs. - */ - onIntervalElapsing(intervalElapsingHandler: ElapsingEvent): void; - - /** - * Returns a string represenation of the remaining - * in this format: minutes:seconds. - * examples: 20:23, 00:04, 59:59 - */ - toString(): string; - - private getDoubleDigit(number: number): string; - - private checkForValidInterval(interval: number): void; -} - -/** - * Simulates the actions of a generic stopwatch. - */ -export class Stopwatch { - private _isRunning: boolean; - private _elapsedMilliseconds: number; - private _startedTimeInMillis: number; - private _intervalIds: Array; - - /** - * Initializes a new instance of the Stopwatch class. - */ - constructor(); - - /** - * Gets the elapsed time in this format: - * hrs:mins:secs:ms - */ - readonly elapsed: string; - - /** - * Gets the elapsed time in milliseconds. - */ - readonly elapsedMilliseconds: number; - - /** - * Gets the elapsed time in seconds. - */ - readonly elapsedSeconds: number; - - /** - * Gets the elapsed time in minutes. - */ - readonly elapsedMinutes: number; - - /** - * Gets the elapsed hours in hours. - */ - readonly elapsedHours: number; - - /** - * Gets the isRunning state of the current Stopwatch instance. - * @default false - */ - readonly isRunning: boolean; - - /** - * Initializes a new Stopwatch instance and - * starts measuring elapsed time. - */ - static startNew(): Stopwatch; - - /** - * Starts, or resumes the Stopwatch - * from measuring elapsed time. - */ - start(): void; - - /** - * Stops the Stopwatch from measuring elapsed time. - */ - stop(): void; - - /** - * Stops the Stopwatch and resets the elapsed time to zero. - */ - reset(): void; - - /** - * Stops the Stopwatch, - * resets the elapsed time to zero - * and starts the Stopwatch for measuring elapsed time. - * It is a shortcut for writing - * reset then start. - */ - restart(): void; - - /** - * Stops the Stopwatch and cleans up the intervals. - */ - dispose(): void; - - private getDoubleDigit(num: number): string; -} - -/** - * Simulates an object that represents a time interval. - */ -export class Timespan { - private _milliseconds: number; - private constructor(milliseconds: number); - - /** - * Gets the time interval in milliseconds. - */ - readonly milliseconds: number; - - /** - * Gets the time interval in seconds. - */ - readonly seconds: number; - - /** - * Gets the time interval in minutes. - */ - readonly minutes: number; - - /** - * Gets the time interval in hours. - */ - readonly hours: number; - - /** - * Gets the time interval in days. - */ - readonly days: number; - - /** - * Returns a Timespan that represents a specified number of days. - * @param days The number of days. - */ - static fromDays(days: number): Timespan; - - /** - * Returns a Timespan that represents a specified number of hours. - * @param hours The number of hours. - */ - static fromHours(hours: number): Timespan; - - /** - * Returns a Timespan that represents a specified number of minutes. - * @param minutes The number of minutes. - */ - static fromMinutes(minutes: number): Timespan; - - /** - * Returns a Timespan that represents a specified number of seconds. - * @param seconds The number of seconds. - */ - static fromSeconds(seconds: number): Timespan; - - /** - * Returns a Timespan that represents a specified number of milliseconds. - * @param milliseconds The number of milliseconds. - */ - static fromMilliseconds(milliseconds: number): Timespan; - - /** - * Compares two Timespan objects and - * returns an integer that indicates whether - * the first value is shorter than, equal to, - * or longer than the second value. - * @param t1 The first Timespan to compare. - * @param t2 The second Timespan to compare. - */ - static compare(t1: Timespan, t2: Timespan): 1 | 0 | -1; - - /** - * Returns a boolean value that indicates - * whether two specified instances of Timespan are equal. - * @param t1 The first Timespan to compare. - * @param t2 The second Timespan to compare. - */ - static equals(t1: Timespan, t2: Timespan): boolean; - - /** - * Adds the specified Timespan to this instance. - * @param timespan The Timespan to add. - */ - addMutable(timespan: Timespan): void; - - /** - * Substracts the specified Timespan from this instance. - * @param timespan The Timespan to substract. - */ - substractMutable(timespan: Timespan): void; - - /** - * Returns a new Timespan object whose - * value is the sum of the specified Timespan object and this instance. - * @param timespan The Timespan to add. - */ - add(timespan: Timespan): Timespan; - - /** - * Returns a new Timespan object whose - * value is the difference between the - * specified Timespan object and this instance. - * @param timespan The Timespan to substract. - */ - substract(timespan: Timespan): Timespan; - - /** - * Returns a new Timespan object - * whose value is the negated value of this instance. - */ - negate(): Timespan; -} diff --git a/types/sharp-timer/sharp-timer-tests.ts b/types/sharp-timer/sharp-timer-tests.ts deleted file mode 100644 index a2ec71ac3c..0000000000 --- a/types/sharp-timer/sharp-timer-tests.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Timer, Stopwatch, Timespan, millisPerSecond } from 'sharp-timer'; - -const millisecondsPerSecond = millisPerSecond; - -// timer test -const timer = new Timer(10); -timer.toString(); -timer.onIntervalElapsing(i => { }); -timer.onIntervalElapsed(() => { - timer.stop(); -}); - -timer.start(); - -// stopwatch test -const stopwatch = Stopwatch.startNew(); - -const intervalId = setInterval(() => { }, 10); - -setTimeout(() => { - clearInterval(intervalId); - stopwatch.dispose(); -}, 100); - -// timespan test -const { - days, - hours, - minutes, - seconds, - milliseconds -} = Timespan.fromDays(2); diff --git a/types/sharp-timer/tsconfig.json b/types/sharp-timer/tsconfig.json deleted file mode 100644 index b7ab232b28..0000000000 --- a/types/sharp-timer/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "sharp-timer-tests.ts" - ] -} \ No newline at end of file diff --git a/types/sharp-timer/tslint.json b/types/sharp-timer/tslint.json deleted file mode 100644 index d88586e5bd..0000000000 --- a/types/sharp-timer/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} diff --git a/types/sharp-timer/v0/index.d.ts b/types/sharp-timer/v0/index.d.ts deleted file mode 100644 index c5be32264c..0000000000 --- a/types/sharp-timer/v0/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Type definitions for sharp-timer 0.3 -// Project: https://github.com/afractal/SharpTimer -// Definitions by: Hermes Gjini - afractal -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export type ElapsedEvent = () => void; -export type ElapsingEvent = (intervalValue: number) => void; - -export class Timer { - private _enabled; - private _stopped; - private _interval; - private _intervalElapsedEvents; - private _intervalElapsingEvents; - constructor(interval: number); - readonly enabled: boolean; - readonly stopped: boolean; - interval: number; - start(): void; - pause(): void; - resume(): void; - stop(): void; - onIntervalElapsed(intervalElapsedHandler: ElapsedEvent): void; - onIntervalElapsing(intervalElapsingHandler: ElapsingEvent): void; - toString(): string; - private getDoubleDigit(number); - private checkForValidInterval(interval); -} - -export class Stopwatch { - private _isRunning; - private _elapsedMilliseconds; - private _startedTimeInMillis; - private _intervalIds; - private static readonly millisPerSecond; - private static readonly millisPerMinute; - private static readonly millisPerHour; - constructor(); - readonly elapsed: string; - readonly elapsedMilliseconds: number; - readonly elapsedSeconds: number; - readonly elapsedMinutes: number; - readonly elapsedHours: number; - readonly isRunning: boolean; - static startNew(): Stopwatch; - start(): void; - stop(): void; - reset(): void; - restart(): void; - dispose(): void; - private getDoubleDigit(num); -} diff --git a/types/sharp-timer/v0/sharp-timer-tests.ts b/types/sharp-timer/v0/sharp-timer-tests.ts deleted file mode 100644 index e99e550df7..0000000000 --- a/types/sharp-timer/v0/sharp-timer-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Timer, Stopwatch } from 'sharp-timer'; - -const timer = new Timer(10); - -timer.onIntervalElapsing(i => { }); -timer.onIntervalElapsed(() => { - timer.stop(); -}); - -timer.start(); diff --git a/types/sharp-timer/v0/tsconfig.json b/types/sharp-timer/v0/tsconfig.json deleted file mode 100644 index 423755928a..0000000000 --- a/types/sharp-timer/v0/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "sharp-timer": [ - "sharp-timer/v0" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "sharp-timer-tests.ts" - ] -} \ No newline at end of file diff --git a/types/sharp-timer/v0/tslint.json b/types/sharp-timer/v0/tslint.json deleted file mode 100644 index d88586e5bd..0000000000 --- a/types/sharp-timer/v0/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} From 2f15ba9a0029df6dc53bed8866ce8149f23a6d83 Mon Sep 17 00:00:00 2001 From: jodi Warren Date: Tue, 19 Dec 2017 22:54:42 +0000 Subject: [PATCH 099/890] Add static methods for fullpage.js --- types/fullpage.js/fullpage.js-tests.ts | 52 ++++++++ types/fullpage.js/index.d.ts | 168 ++++++++++++++++++++++++- types/fullpage.js/tsconfig.json | 3 +- 3 files changed, 219 insertions(+), 4 deletions(-) diff --git a/types/fullpage.js/fullpage.js-tests.ts b/types/fullpage.js/fullpage.js-tests.ts index b8990ea9c8..16f496494f 100644 --- a/types/fullpage.js/fullpage.js-tests.ts +++ b/types/fullpage.js/fullpage.js-tests.ts @@ -59,4 +59,56 @@ function test_public_methods() { onSlideLeave: (anchorLink, index, slideIndex, direction, nextSlideIndex) => {} }); }); + + $.fn.fullpage.moveSectionUp(); + + $.fn.fullpage.moveSectionDown(); + + $.fn.fullpage.moveTo('firstSlide', 2); + + $.fn.fullpage.moveTo(3, 0); + + $.fn.fullpage.moveTo(3); + + $.fn.fullpage.silentMoveTo('firstSlide', 2); + + $.fn.fullpage.moveSlideRight(); + + $.fn.fullpage.moveSlideLeft(); + + $.fn.fullpage.setAutoScrolling(false); + + $.fn.fullpage.setFitToSection(false); + + $.fn.fullpage.fitToSection(); + + $.fn.fullpage.setLockAnchors(false); + + $.fn.fullpage.setAllowScrolling(false); + + $.fn.fullpage.setAllowScrolling(false, 'down'); + + $.fn.fullpage.setAllowScrolling(false, 'down, right'); + + $.fn.fullpage.setKeyboardScrolling(false); + + $.fn.fullpage.setKeyboardScrolling(false, 'down'); + + $.fn.fullpage.setKeyboardScrolling(false, 'down, right'); + + $.fn.fullpage.setRecordHistory(false); + + $.fn.fullpage.setScrollingSpeed(700); + + $.fn.fullpage.destroy(); + + $.fn.fullpage.destroy('all'); + + $.fn.fullpage.reBuild(); + + $.fn.fullpage.setResponsive(true); + + $.fn.fullpage.responsiveSlides.toSections(); + + $.fn.fullpage.responsiveSlides.toSlides(); } diff --git a/types/fullpage.js/index.d.ts b/types/fullpage.js/index.d.ts index 869a64d6e8..8467e3a14b 100644 --- a/types/fullpage.js/index.d.ts +++ b/types/fullpage.js/index.d.ts @@ -1,11 +1,13 @@ // Type definitions for fullpage.js v2.8.0 // Project: http://alvarotrigo.com/fullPage/ -// Definitions by: Andrew Roberts +// Definitions by: Andrew Roberts , Jodi Warren // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// +import htmlString = JQuery.htmlString; + interface FullPageJsOptions { /** * (default false) A selector can be used to specify the menu to link with the sections. This way the scrolling of the sections will activate the corresponding element in the menu using the class active. This won't generate a menu but will just add the active class to the element in the given menu with the corresponding anchor links. In order to link the elements of the menu with the sections, an HTML 5 data-tag (data-menuanchor) will be needed to use with the same anchor links as used within the sections. @@ -263,6 +265,168 @@ interface FullPageJsOptions { onSlideLeave?: (anchorLink: string, index: number, slideIndex: number, direction: string, nextSlideIndex: number) => void; } +interface FullPageJSGlobalOptions { + options: FullPageJsOptions; +} + +interface FullPageJsMethods { + (options?: FullPageJsOptions): any; + + /** + * Sets the scrolling configuration in real time. + * Defines the way the page scrolling behaves. + * If it is set to true, it will use the "automatic" scrolling, + * otherwise, it will use the "manual" or "normal" scrolling of the site. + */ + setAutoScrolling(active: boolean): void; + + /** + * Defines whether to record the history for each hash change in the URL. + */ + setRecordHistory(active: boolean): void; + + /** + * Defines the scrolling speed in milliseconds. + */ + setScrollingSpeed(speed: number): void; + + /** + * Sets the value for the option fitToSection + * determining whether to fit the section in the screen or not. + */ + setFitToSection(active: boolean): void; + + /** + * Adds or remove the possibility of scrolling through sections + * by using the mouse wheel or the trackpad. + */ + setLockAnchors(active: boolean): void; + + /** + * Adds or remove the possibility of scrolling through sections + * by using the mouse wheel or the trackpad. + */ + setMouseWheelScrolling(active: boolean): void; + + /** + * Adds or remove the possibility of scrolling through sections + * by using the mouse wheel/trackpad or touch gestures. + * Optionally a second parameter can be used to specify the direction + * for which the action will be applied. + */ + setAllowScrolling(active: boolean, directions?: string): void; + + /** + * Adds or remove the possibility of scrolling through sections + * by using the keyboard arrow keys + */ + setKeyboardScrolling(active: boolean, directions?: string): void; + + /** + * Scrolls one section up + */ + moveSectionUp(): void; + + /** + * Scrolls one section down + */ + moveSectionDown(): void; + + /** + * Moves the page to the given section and slide with no animation. + * Anchors or index positions can be used as params. + */ + silentMoveTo(sectionAnchor: number | string, slideAnchor?: number | string): void; + + /** + * Scrolls the page to the given section and slide. + * The first slide, the visible one by default, will have index 0. + */ + moveTo(sectionAnchor: number | string, slideAnchor?: number | string): void; + + /** + * Slides right the slider of the active section. + * Optional `section` param. + */ + moveSlideRight(section?: number | string): void; + + /** + * Slides left the slider of the active section. + * Optional `section` param. + */ + moveSlideLeft(section?: number | string): void; + + /** + * When resizing is finished, we adjust the slides sizes and positions + */ + reBuild(): void; + + /** + * Sets the responsive mode of the page. + * When set to true the autoScrolling will be turned off + * and the result will be exactly the same one as when + * the responsiveWidth or responsiveHeight options + * get fired. + */ + setResponsive(active: boolean): void; + + /** + * Sets the value for the option fitToSection + * determining whether to fit the section + * in the screen or not. + */ + setFitToSection(active?: boolean): void; + + /** + * Scrolls to the nearest active section fitting it in the viewport. + */ + fitToSection(): void; + + /** + * Adds or remove the possibility of scrolling through sections/slides + * by using the mouse wheel/trackpad or touch gestures + * (which is active by default). + * + * Note this won't disable the keyboard scrolling. You would need to + * use setKeyboardScrolling for it. + */ + setAllowScrolling(allow: boolean, direction?: string): void; + + /** + * Destroys the plugin events and optionally its HTML markup and styles. + * Ideal to use when using AJAX to load content. + * + * If 'all' is passed, the HTML markup + * and styles used by fullpage.js will be removed. This way the + * original HTML markup, the one used before any plugin + * modification is made, will be maintained. + * + * @param {"all" | undefined} type + */ + destroy(type?: 'all'): void; + + responsiveSlides: { + /** + * Extension of fullpage.js. Requires fullpage.js >= 2.8.5. + * Turns horizontal slides into vertical sections. + */ + toSections(): void; + + /** + * Extension of fullpage.js. Requires fullpage.js >= 2.8.5. + * Turns back the original slides (now converted into + * vertical sections) into horizontal slides again. + */ + toSlides(): void; + } +} + +interface FullPageJs extends FullPageJSGlobalOptions, FullPageJsMethods {} + +interface JQueryStatic { + fullpage: FullPageJsMethods; +} + interface JQuery { - fullpage(options?: FullPageJsOptions): JQuery; + fullpage: FullPageJs; } diff --git a/types/fullpage.js/tsconfig.json b/types/fullpage.js/tsconfig.json index c8a11e250e..6fbc085728 100644 --- a/types/fullpage.js/tsconfig.json +++ b/types/fullpage.js/tsconfig.json @@ -8,7 +8,6 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, - "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -21,4 +20,4 @@ "index.d.ts", "fullpage.js-tests.ts" ] -} \ No newline at end of file +} From 572137414c8988d3d80a76b37bff7446ee2a8730 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 19 Dec 2017 16:10:50 -0700 Subject: [PATCH 100/890] Update Ember, Ember Data, Ember QUnit types. --- types/ember-data/index.d.ts | 187 +++++++-------- types/ember-data/test/model.ts | 5 +- types/ember-data/test/store.ts | 29 +-- types/ember-qunit/index.d.ts | 3 +- types/ember/index.d.ts | 405 ++++++++++++++++++++++++++------- types/ember/test/computed.ts | 37 +-- 6 files changed, 464 insertions(+), 202 deletions(-) diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index c8cfd8187e..36bda4889c 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -7,6 +7,7 @@ declare module "ember-data" { import Ember from "ember"; + import RSVP from 'rsvp'; namespace DS { /** * Convert an hash of errors into an array with errors in JSON-API format. @@ -207,7 +208,7 @@ declare module "ember-data" { * subclasses are used to indicate specific error states. The following * subclasses are provided: */ - class AdapterError {} + class AdapterError { } /** * A `DS.InvalidError` is used by an adapter to signal the external API * was unable to process a request because the content was not @@ -217,27 +218,27 @@ declare module "ember-data" { * transition to the `invalid` state and the errors will be set to the * `errors` property on the record. */ - class InvalidError {} + class InvalidError { } /** * A `DS.TimeoutError` is used by an adapter to signal that a request * to the external API has timed out. I.e. no response was received from * the external API within an allowed time period. */ - class TimeoutError {} + class TimeoutError { } /** * A `DS.AbortError` is used by an adapter to signal that a request to * the external API was aborted. For example, this can occur if the user * navigates away from the current page after a request to the external API * has been initiated but before a response has been received. */ - class AbortError {} + class AbortError { } /** * A `DS.UnauthorizedError` equates to a HTTP `401 Unauthorized` response * status. It is used by an adapter to signal that a request to the external * API was rejected because authorization is required and has failed or has not * yet been provided. */ - class UnauthorizedError {} + class UnauthorizedError { } /** * A `DS.ForbiddenError` equates to a HTTP `403 Forbidden` response status. * It is used by an adapter to signal that a request to the external API was @@ -245,13 +246,13 @@ declare module "ember-data" { * provided and is valid, then the authenticated user does not have the * necessary permissions for the request. */ - class ForbiddenError {} + class ForbiddenError { } /** * A `DS.NotFoundError` equates to a HTTP `404 Not Found` response status. * It is used by an adapter to signal that a request to the external API * was rejected because the resource could not be found on the API. */ - class NotFoundError {} + class NotFoundError { } /** * A `DS.ConflictError` equates to a HTTP `409 Conflict` response status. * It is used by an adapter to indicate that the request could not be processed @@ -259,17 +260,17 @@ declare module "ember-data" { * creating a record with a client generated id but that id is already known * to the external API. */ - class ConflictError {} + class ConflictError { } /** * A `DS.ServerError` equates to a HTTP `500 Internal Server Error` response * status. It is used by the adapter to indicate that a request has failed * because of an error in the external API. */ - class ServerError {} + class ServerError { } /** * Holds validation errors for a given record, organized by attribute names. */ - interface Errors extends Ember.Enumerable, Ember.Evented {} + interface Errors extends Ember.Enumerable, Ember.Evented { } class Errors extends Ember.Object { /** * DEPRECATED: @@ -423,7 +424,7 @@ declare module "ember-data" { * Create a JSON representation of the record, using the serialization * strategy of the store's adapter. */ - serialize(options: {}): {}; + serialize(options?: {}): {}; /** * Use [DS.JSONSerializer](DS.JSONSerializer.html) to * get the JSON representation of a record. @@ -472,7 +473,7 @@ declare module "ember-data" { /** * Same as `deleteRecord`, but saves the record immediately. */ - destroyRecord(options: {}): Promise; + destroyRecord(options: {}): RSVP.Promise; /** * Unloads the record from the store. This will cause the record to be destroyed and freed up for garbage collection. */ @@ -491,11 +492,11 @@ declare module "ember-data" { * Save the record and persist any changes to the record to an * external source via the adapter. */ - save(options?: {}): Promise; + save(options?: {}): RSVP.Promise; /** * Reload the record from the adapter. */ - reload(): Promise; + reload(): RSVP.Promise; /** * Get the reference for the specified belongsTo relationship. */ @@ -543,7 +544,7 @@ declare module "ember-data" { */ static relatedTypes: Ember.ComputedProperty< Ember.NativeArray - >; + >; /** * A map whose keys are the relationships of a model and whose values are * relationship descriptors. @@ -612,14 +613,14 @@ declare module "ember-data" { /** * ### State */ - class RootState {} + class RootState { } /** * Represents an ordered list of records whose order and membership is * determined by the adapter. For example, a query sent to the adapter * may trigger a search on the server, whose results would be loaded * into an instance of the `AdapterPopulatedRecordArray`. */ - class AdapterPopulatedRecordArray extends RecordArray {} + class AdapterPopulatedRecordArray extends RecordArray { } /** * Represents a list of records whose membership is determined by the * store. As records are created, loaded, or modified, the store @@ -640,7 +641,7 @@ declare module "ember-data" { * `DS.RecordArray` or its subclasses will be returned by your application's store * in response to queries. */ - interface RecordArray extends Ember.ArrayProxy, Ember.Evented {} + interface RecordArray extends Ember.ArrayProxy, Ember.Evented { } class RecordArray { /** * The flag to signal a `RecordArray` is finished loading data. @@ -698,7 +699,7 @@ declare module "ember-data" { * Data will treat the new data as the conanical value of this * relationship on the backend. */ - push(objectOrPromise: {} | Promise): Promise; + push(objectOrPromise: {} | RSVP.Promise): RSVP.Promise; /** * `value()` synchronously returns the current value of the belongs-to * relationship. Unlike `record.get('relationshipName')`, calling @@ -706,20 +707,20 @@ declare module "ember-data" { * relationship is not yet loaded. If the relationship is not loaded * it will always return `null`. */ - value(objectOrPromise: {} | Promise): Model; + value(objectOrPromise: {} | RSVP.Promise): Model; /** * Loads a record in a belongs to relationship if it is not already * loaded. If the relationship is already loaded this method does not * trigger a new load. */ - load(): Promise; + load(): RSVP.Promise; /** * Triggers a reload of the value in this relationship. If the * remoteType is `"link"` Ember Data will use the relationship link to * reload the relationship. Otherwise it will reload the record by its * id. */ - reload(): Promise; + reload(): RSVP.Promise; } /** * A HasManyReference is a low level API that allows users and addon @@ -750,7 +751,7 @@ declare module "ember-data" { * Data will treat the new data as the canonical value of this * relationship on the backend. */ - push(objectOrPromise: T[] | Promise): ManyArray; + push(objectOrPromise: T[] | RSVP.Promise): ManyArray; /** * `value()` synchronously returns the current value of the has-many * relationship. Unlike `record.get('relationshipName')`, calling @@ -764,11 +765,11 @@ declare module "ember-data" { * relationship is already loaded this method does not trigger a new * load. */ - load(): Promise; + load(): RSVP.Promise; /** * Reloads this has-many relationship. */ - reload(): Promise; + reload(): RSVP.Promise; } /** * An RecordReference is a low level API that allows users and @@ -791,7 +792,7 @@ declare module "ember-data" { * normalized hash of data and the object represented by the reference * will update. */ - push(payload: Promise | {}): PromiseObject & T; + push(payload: RSVP.Promise | {}): PromiseObject & T; /** * If the entity referred to by the reference is already loaded, it is * present as `reference.value`. Otherwise the value returned by this function @@ -813,7 +814,7 @@ declare module "ember-data" { * A `ManyArray` is a `MutableArray` that represents the contents of a has-many * relationship. */ - interface ManyArray extends Ember.MutableArray {} + interface ManyArray extends Ember.MutableArray { } class ManyArray extends Ember.Object.extend( Ember.MutableArray as {}, Ember.Evented @@ -851,8 +852,8 @@ declare module "ember-data" { */ interface PromiseArray extends Ember.ArrayProxy, - Ember.PromiseProxyMixin> {} - class PromiseArray {} + Ember.PromiseProxyMixin> { } + class PromiseArray { } /** * A `PromiseObject` is an object that acts like both an `Ember.Object` * and a promise. When the promise is resolved, then the resulting value @@ -862,8 +863,8 @@ declare module "ember-data" { */ interface PromiseObject extends Ember.ObjectProxy, - Ember.PromiseProxyMixin> {} - class PromiseObject {} + Ember.PromiseProxyMixin> { } + class PromiseObject { } /** * A PromiseManyArray is a PromiseArray that also proxies certain method calls * to the underlying manyArray. @@ -1042,7 +1043,7 @@ declare module "ember-data" { queryRecord( modelName: string, query: any - ): Promise; + ): RSVP.Promise; /** * `findAll` asks the adapter's `findAll` method to find the records for the * given type, and returns a promise which will resolve with all records of @@ -1077,7 +1078,7 @@ declare module "ember-data" { /** * Returns the model class for the particular `modelName`. */ - modelFor(modelName: string): Model; + modelFor(modelName: string): M; /** * Push some data for a given type into the store. */ @@ -1097,13 +1098,13 @@ declare module "ember-data" { * example, `adapterFor('person')` will return an instance of * `App.PersonAdapter`. */ - adapterFor(modelName: string): Adapter; + adapterFor(modelName: string): A; /** * Returns an instance of the serializer for a given type. For * example, `serializerFor('person')` will return an instance of * `App.PersonSerializer`. */ - serializerFor(modelName: string): Serializer; + serializerFor(modelName: string): S; } /** * The `JSONAPIAdapter` is the default adapter used by Ember Data. It @@ -1129,7 +1130,7 @@ declare module "ember-data" { /** * Takes a URL, an HTTP method and a hash of data, and makes an HTTP request. */ - ajax(url: string, type: string, options?: object): Promise; + ajax(url: string, type: string, options?: object): RSVP.Promise; /** * Generate ajax options */ @@ -1172,7 +1173,7 @@ declare module "ember-data" { type: Model, id: string, snapshot: Snapshot - ): Promise; + ): RSVP.Promise; /** * Called by the store in order to fetch a JSON array for all * of the records for a given type. @@ -1182,17 +1183,17 @@ declare module "ember-data" { type: Model, sinceToken: string, snapshotRecordArray: SnapshotRecordArray - ): Promise; + ): RSVP.Promise; /** * Called by the store in order to fetch a JSON array for * the records that match a particular query. */ - query(store: Store, type: Model, query: {}): Promise; + query(store: Store, type: Model, query: {}): RSVP.Promise; /** * Called by the store in order to fetch a JSON object for * the record that matches a particular query. */ - queryRecord(store: Store, type: Model, query: {}): Promise; + queryRecord(store: Store, type: Model, query: {}): RSVP.Promise; /** * Called by the store in order to fetch several records together if `coalesceFindRequests` is true */ @@ -1201,7 +1202,7 @@ declare module "ember-data" { type: Model, ids: any[], snapshots: any[] - ): Promise; + ): RSVP.Promise; /** * Called by the store in order to fetch a JSON array for * the unloaded records in a has-many relationship that were originally @@ -1212,7 +1213,7 @@ declare module "ember-data" { snapshot: Snapshot, url: string, relationship: {} - ): Promise; + ): RSVP.Promise; /** * Called by the store in order to fetch the JSON for the unloaded record in a * belongs-to relationship that was originally specified as a URL (inside of @@ -1222,7 +1223,7 @@ declare module "ember-data" { store: Store, snapshot: Snapshot, url: string - ): Promise; + ): RSVP.Promise; /** * Called by the store when a newly created record is * saved via the `save` method on a model record instance. @@ -1231,7 +1232,7 @@ declare module "ember-data" { store: Store, type: Model, snapshot: Snapshot - ): Promise; + ): RSVP.Promise; /** * Called by the store when an existing record is saved * via the `save` method on a model record instance. @@ -1240,7 +1241,7 @@ declare module "ember-data" { store: Store, type: Model, snapshot: Snapshot - ): Promise; + ): RSVP.Promise; /** * Called by the store when a record is deleted. */ @@ -1248,7 +1249,7 @@ declare module "ember-data" { store: Store, type: Model, snapshot: Snapshot - ): Promise; + ): RSVP.Promise; /** * Organize records into groups, each of which is to be passed to separate * calls to `findMany`. @@ -1816,7 +1817,7 @@ declare module "ember-data" { * used when `boolean` is passed as the type parameter to the * [DS.attr](../../data#method_attr) function. */ - class BooleanTransform extends Transform {} + class BooleanTransform extends Transform { } /** * The `DS.DateTransform` class is used to serialize and deserialize * date attributes on Ember Data record objects. This transform is used @@ -1824,21 +1825,21 @@ declare module "ember-data" { * [DS.attr](../../data#method_attr) function. It uses the [`ISO 8601`](https://en.wikipedia.org/wiki/ISO_8601) * standard. */ - class DateTransform extends Transform {} + class DateTransform extends Transform { } /** * The `DS.NumberTransform` class is used to serialize and deserialize * numeric attributes on Ember Data record objects. This transform is * used when `number` is passed as the type parameter to the * [DS.attr](../../data#method_attr) function. */ - class NumberTransform extends Transform {} + class NumberTransform extends Transform { } /** * The `DS.StringTransform` class is used to serialize and deserialize * string attributes on Ember Data record objects. This transform is * used when `string` is passed as the type parameter to the * [DS.attr](../../data#method_attr) function. */ - class StringTransform extends Transform {} + class StringTransform extends Transform { } /** * The `DS.Transform` class is used to serialize and deserialize model * attributes when they are saved or loaded from an @@ -1885,7 +1886,7 @@ declare module "ember-data" { type: Model, id: string, snapshot: Snapshot - ): Promise; + ): RSVP.Promise; /** * The `findAll()` method is used to retrieve all records for a given type. */ @@ -1894,7 +1895,7 @@ declare module "ember-data" { type: Model, sinceToken: string, snapshotRecordArray: SnapshotRecordArray - ): Promise; + ): RSVP.Promise; /** * This method is called when you call `query` on the store. */ @@ -1903,12 +1904,12 @@ declare module "ember-data" { type: Model, query: {}, recordArray: AdapterPopulatedRecordArray - ): Promise; + ): RSVP.Promise; /** * The `queryRecord()` method is invoked when the store is asked for a single * record through a query object. */ - queryRecord(store: Store, type: Model, query: {}): Promise; + queryRecord(store: Store, type: Model, query: {}): RSVP.Promise; /** * If the globally unique IDs for your records should be generated on the client, * implement the `generateIdForRecord()` method. This method will be invoked @@ -1932,7 +1933,7 @@ declare module "ember-data" { store: Store, type: Model, snapshot: Snapshot - ): Promise; + ): RSVP.Promise; /** * Implement this method in a subclass to handle the updating of * a record. @@ -1941,7 +1942,7 @@ declare module "ember-data" { store: Store, type: Model, snapshot: Snapshot - ): Promise; + ): RSVP.Promise; /** * Implement this method in a subclass to handle the deletion of * a record. @@ -1950,7 +1951,7 @@ declare module "ember-data" { store: Store, type: Model, snapshot: Snapshot - ): Promise; + ): RSVP.Promise; /** * By default the store will try to coalesce all `fetchRecord` calls within the same runloop * into as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call. @@ -1968,7 +1969,7 @@ declare module "ember-data" { type: Model, ids: any[], snapshots: any[] - ): Promise; + ): RSVP.Promise; /** * Organize records into groups, each of which is to be passed to separate * calls to `findMany`. @@ -2068,63 +2069,63 @@ declare module "ember" { } } declare module 'ember-data/adapter' { - import DS from 'ember-data'; - export default DS.Adapter; + import DS from 'ember-data'; + export default DS.Adapter; } declare module 'ember-data/adapters/errors' { - import DS from 'ember-data'; - const AdapterError: typeof DS.AdapterError; - const InvalidError: typeof DS.InvalidError; - const UnauthorizedError: typeof DS.UnauthorizedError; - const ForbiddenError: typeof DS.ForbiddenError; - const NotFoundError: typeof DS.NotFoundError; - const ConflictError: typeof DS.ConflictError; - const ServerError: typeof DS.ServerError; - const TimeoutError: typeof DS.TimeoutError; - const AbortError: typeof DS.AbortError; - const errorsHashToArray: typeof DS.errorsHashToArray; - const errorsArrayToHash: typeof DS.errorsArrayToHash; + import DS from 'ember-data'; + const AdapterError: typeof DS.AdapterError; + const InvalidError: typeof DS.InvalidError; + const UnauthorizedError: typeof DS.UnauthorizedError; + const ForbiddenError: typeof DS.ForbiddenError; + const NotFoundError: typeof DS.NotFoundError; + const ConflictError: typeof DS.ConflictError; + const ServerError: typeof DS.ServerError; + const TimeoutError: typeof DS.TimeoutError; + const AbortError: typeof DS.AbortError; + const errorsHashToArray: typeof DS.errorsHashToArray; + const errorsArrayToHash: typeof DS.errorsArrayToHash; } declare module 'ember-data/adapters/json-api' { - import DS from 'ember-data'; - export default DS.JSONAPIAdapter; + import DS from 'ember-data'; + export default DS.JSONAPIAdapter; } declare module 'ember-data/adapters/rest' { - import DS from 'ember-data'; - export default DS.RESTAdapter; + import DS from 'ember-data'; + export default DS.RESTAdapter; } declare module 'ember-data/attr' { - import DS from 'ember-data'; - export default DS.attr; + import DS from 'ember-data'; + export default DS.attr; } declare module 'ember-data/model' { - import DS from 'ember-data'; - export default DS.Model; + import DS from 'ember-data'; + export default DS.Model; } declare module 'ember-data/relationships' { - import DS from 'ember-data'; - const hasMany: typeof DS.hasMany; - const belongsTo: typeof DS.belongsTo; + import DS from 'ember-data'; + const hasMany: typeof DS.hasMany; + const belongsTo: typeof DS.belongsTo; } declare module 'ember-data/serializer' { - import DS from 'ember-data'; - export default DS.Serializer; + import DS from 'ember-data'; + export default DS.Serializer; } declare module 'ember-data/serializers/embedded-records-mixin' { - import DS from 'ember-data'; - export default DS.EmbeddedRecordsMixin; + import DS from 'ember-data'; + export default DS.EmbeddedRecordsMixin; } declare module 'ember-data/serializers/json-api' { - import DS from 'ember-data'; - export default DS.JSONAPISerializer; + import DS from 'ember-data'; + export default DS.JSONAPISerializer; } declare module 'ember-data/serializers/json' { - import DS from 'ember-data'; - export default DS.JSONSerializer; + import DS from 'ember-data'; + export default DS.JSONSerializer; } declare module 'ember-data/serializers/rest' { - import DS from 'ember-data'; - export default DS.RESTSerializer; + import DS from 'ember-data'; + export default DS.RESTSerializer; } declare module "ember-data/store" { import DS from "ember-data"; diff --git a/types/ember-data/test/model.ts b/types/ember-data/test/model.ts index b3fa04e086..fb076b5b3b 100644 --- a/types/ember-data/test/model.ts +++ b/types/ember-data/test/model.ts @@ -8,7 +8,7 @@ const Person = DS.Model.extend({ title: DS.attr({ defaultValue: "The default" }), title2: DS.attr({ defaultValue: () => "The default" }), - fullName: Ember.computed('firstName', 'lastName', function() { + fullName: Ember.computed('firstName', 'lastName', function () { return `${this.get('firstName')} ${this.get('lastName')}`; }) }); @@ -27,3 +27,6 @@ assertType(user.get('id')); assertType(user.get('username')); assertType(user.get('verified')); assertType(user.get('createdAt')); + +user.serialize(); +user.serialize({ someOption: 'neat' }); diff --git a/types/ember-data/test/store.ts b/types/ember-data/test/store.ts index f7560a231f..d4e14f67da 100644 --- a/types/ember-data/test/store.ts +++ b/types/ember-data/test/store.ts @@ -5,7 +5,7 @@ import { assertType } from "./lib/assert"; declare const store: DS.Store; class Post extends DS.Model { - title = DS.attr('string'); + title = DS.attr('string'); } let post = store.createRecord('post', { @@ -18,7 +18,7 @@ post.save().then((saved) => { assertType(saved); }); -store.findRecord('post', 1).then(function(post) { +store.findRecord('post', 1).then(function (post) { post.get('title'); // => "Rails is Omakase" post.set('title', 'A new post'); post.save(); // => PATCH to '/posts/1' @@ -28,13 +28,13 @@ class User extends DS.Model { username = DS.attr('string'); } -store.queryRecord('user', {}).then(function(user) { +store.queryRecord('user', {}).then(function (user) { let username = user.get('username'); console.log(`Currently logged in as ${username}`); }); store.findAll('blog-post'); // => GET /blog-posts -store.findAll('author', { reload: true }).then(function(authors) { +store.findAll('author', { reload: true }).then(function (authors) { authors.getEach('id'); // ['first', 'second'] }); store.findAll('post', { @@ -52,25 +52,25 @@ if (store.hasRecordForId('post', 1)) { } class Message extends DS.Model { - hasBeenSeen = DS.attr('boolean'); + hasBeenSeen = DS.attr('boolean'); } const messages = store.peekAll('message'); -messages.forEach(function(message) { +messages.forEach(function (message) { message.set('hasBeenSeen', true); }); messages.save(); const people = store.peekAll('person'); people.get('isUpdating'); // false -people.update().then(function() { +people.update().then(function () { people.get('isUpdating'); // false }); people.get('isUpdating'); // true const MyRoute = Ember.Route.extend({ model(params: any): any { - return this.store.findRecord('post', params.post_id, {include: 'comments,comments.author'}); + return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' }); } }); @@ -79,16 +79,16 @@ const tom = store.query('user', { filter: { email: 'tomster@example.com' } -}).then(function(users) { +}).then(function (users) { return users.get("firstObject"); }); // GET /users?isAdmin=true const admins = store.query('user', { isAdmin: true }); -admins.then(function() { +admins.then(function () { console.log(admins.get("length")); // 42 }); -admins.update().then(function() { +admins.update().then(function () { admins.get('isUpdating'); // false console.log(admins.get("length")); // 123 }); @@ -115,5 +115,8 @@ store.push({ }] }); -assertType(store.adapterFor('person')); -assertType(store.serializerFor('person')); +class UserAdapter extends DS.Adapter { } +class UserSerializer extends DS.Serializer { } + +assertType(store.adapterFor('user')); +assertType(store.serializerFor('user')); diff --git a/types/ember-qunit/index.d.ts b/types/ember-qunit/index.d.ts index 0edc5c837f..1b18c533a8 100644 --- a/types/ember-qunit/index.d.ts +++ b/types/ember-qunit/index.d.ts @@ -15,6 +15,7 @@ declare module 'ember-qunit' { setup?(assert: Assert): void; teardown?(assert: Assert): void; afterTeardown?(assert: Assert): void; + needs?: string[]; } /** @@ -43,7 +44,7 @@ declare module 'ember-qunit' { */ export function setResolver(resolver: Ember.Resolver): void; - export class QUnitAdapter extends Ember.Test.Adapter {} + export class QUnitAdapter extends Ember.Test.Adapter { } export { module, test, skip, only, todo } from 'qunit'; } diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 7839a3021c..37fabd1447 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -23,7 +23,9 @@ declare module 'ember' { /** * Deconstructs computed properties into the types which would be returned by `.get()`. */ - type ComputedProperties = { [K in keyof T]: Ember.ComputedProperty | T[K] }; + type ComputedProperties = { + [K in keyof T]: Ember.ComputedProperty | T[K] + }; /** * Check that any arguments to `create()` match the type's properties. @@ -96,7 +98,9 @@ declare module 'ember' { __ember_run_timer_brand__: any; } - type RunMethod = ((this: Target, ...args: any[]) => Ret) | keyof Target; + type RunMethod = + | ((this: Target, ...args: any[]) => Ret) + | keyof Target; type EmberRunQueues = | 'sync' | 'actions' @@ -107,7 +111,13 @@ declare module 'ember' { type ObserverMethod = | (keyof Target) - | ((this: Target, sender: Sender, key: keyof Sender, value: any, rev: number) => void); + | (( + this: Target, + sender: Sender, + key: keyof Sender, + value: any, + rev: number + ) => void); interface RenderOptions { into?: string; @@ -220,7 +230,10 @@ declare module 'ember' { Unless you have specific needs for CoreView, you will use Ember.Component in your applications. **/ - class CoreView extends Ember.Object.extend(Ember.Evented, Ember.ActionHandler) {} + class CoreView extends Ember.Object.extend( + Ember.Evented, + Ember.ActionHandler + ) {} interface ActionSupport { sendAction(action: string, ...params: any[]): void; } @@ -286,7 +299,10 @@ declare module 'ember' { on(...args: string[]): this; } - interface ArrayPrototypeExtensions extends MutableArray, Observable, Copyable {} + interface ArrayPrototypeExtensions + extends MutableArray, + Observable, + Copyable {} /** * Given a fullName return a factory manager. @@ -330,7 +346,11 @@ declare module 'ember' { /** * Register an option for a particular factory. */ - registerOption(fullName: string, optionName: string, options: {}): any; + registerOption( + fullName: string, + optionName: string, + options: {} + ): any; /** * Return a specific registered option for a particular factory. */ @@ -355,7 +375,11 @@ declare module 'ember' { * Define a dependency injection onto a specific factory or all factories * of a type. */ - inject(factoryNameOrType: string, property: string, injectionName: string): any; + inject( + factoryNameOrType: string, + property: string, + injectionName: string + ): any; } const _RegistryProxyMixin: Mixin<_RegistryProxyMixin>; /** @@ -403,7 +427,11 @@ declare module 'ember' { /** defines an injection or typeInjection **/ - inject(factoryNameOrType: string, property: string, injectionName: string): void; + inject( + factoryNameOrType: string, + property: string, + injectionName: string + ): void; /** This injects the test helpers into the window's scope. If a function of the same name has already been defined it will be cached (so that it can be reset @@ -532,14 +560,22 @@ declare module 'ember' { * invalidate any related properties. Pass the starting index of the change * as well as a delta of the amounts to change. */ - arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): this; + arrayContentWillChange( + startIdx: number, + removeAmt: number, + addAmt: number + ): this; /** * If you are implementing an object that supports `Ember.Array`, call this * method just after the array content changes to notify any observers and * invalidate any related properties. Pass the starting index of the change * as well as a delta of the amounts to change. */ - arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): this; + arrayContentDidChange( + startIdx: number, + removeAmt: number, + addAmt: number + ): this; /** * Returns a special object that can be used to observe individual properties * on the array. Just get an equivalent property on this object and it will @@ -604,7 +640,11 @@ declare module 'ember' { and actions are targeted at the view object. There is no access to the surrounding context or outer controller; all contextual information is passed in. **/ - class Component extends CoreView.extend(ViewMixin, ActionSupport, ClassNamesSupport) { + class Component extends CoreView.extend( + ViewMixin, + ActionSupport, + ClassNamesSupport + ) { // methods readDOMAttr(name: string): string; // properties @@ -804,10 +844,18 @@ declare module 'ember' { **/ toString(): string; - static create(this: EmberClassConstructor): Fix; + static create( + this: EmberClassConstructor + ): Fix; - static create>( - this: EmberClassConstructor>, + static create< + Instance, + Args, + T1 extends EmberInstanceArguments + >( + this: EmberClassConstructor< + Instance & ComputedProperties + >, arg1: T1 & ThisType> ): Fix; @@ -817,7 +865,9 @@ declare module 'ember' { T1 extends EmberInstanceArguments, T2 extends EmberInstanceArguments >( - this: EmberClassConstructor>, + this: EmberClassConstructor< + Instance & ComputedProperties + >, arg1: T1 & ThisType>, arg2: T2 & ThisType> ): Fix; @@ -829,7 +879,9 @@ declare module 'ember' { T2 extends EmberInstanceArguments, T3 extends EmberInstanceArguments >( - this: EmberClassConstructor>, + this: EmberClassConstructor< + Instance & ComputedProperties + >, arg1: T1 & ThisType>, arg2: T2 & ThisType>, arg3: T3 & ThisType> @@ -839,7 +891,12 @@ declare module 'ember' { this: Statics & EmberClassConstructor ): Objectify & EmberClassConstructor; - static extend( + static extend< + Statics, + Instance extends B1, + T1 extends EmberClassArguments, + B1 + >( this: Statics & EmberClassConstructor, arg1: MixinOrLiteral & ThisType> ): Objectify & EmberClassConstructor; @@ -869,9 +926,12 @@ declare module 'ember' { >( this: Statics & EmberClassConstructor, arg1: MixinOrLiteral & ThisType>, - arg2: MixinOrLiteral & ThisType>, - arg3: MixinOrLiteral & ThisType> - ): Objectify & EmberClassConstructor; + arg2: MixinOrLiteral & + ThisType>, + arg3: MixinOrLiteral & + ThisType> + ): Objectify & + EmberClassConstructor; static extend< Statics, @@ -887,16 +947,25 @@ declare module 'ember' { >( this: Statics & EmberClassConstructor, arg1: MixinOrLiteral & ThisType>, - arg2: MixinOrLiteral & ThisType>, - arg3: MixinOrLiteral & ThisType>, - arg4: MixinOrLiteral & ThisType> - ): Objectify & EmberClassConstructor; + arg2: MixinOrLiteral & + ThisType>, + arg3: MixinOrLiteral & + ThisType>, + arg4: MixinOrLiteral & + ThisType> + ): Objectify & + EmberClassConstructor; static reopen( this: Statics & EmberClassConstructor ): Objectify & EmberClassConstructor; - static reopen( + static reopen< + Statics, + Instance extends B1, + T1 extends EmberClassArguments, + B1 + >( this: Statics & EmberClassConstructor, arg1: MixinOrLiteral & ThisType> ): Objectify & EmberClassConstructor; @@ -926,9 +995,12 @@ declare module 'ember' { >( this: Statics & EmberClassConstructor, arg1: MixinOrLiteral & ThisType>, - arg2: MixinOrLiteral & ThisType>, - arg3: MixinOrLiteral & ThisType> - ): Objectify & EmberClassConstructor; + arg2: MixinOrLiteral & + ThisType>, + arg3: MixinOrLiteral & + ThisType> + ): Objectify & + EmberClassConstructor; static reopenClass(this: Statics): Statics; @@ -948,7 +1020,12 @@ declare module 'ember' { T1 extends EmberClassArguments, T2 extends EmberClassArguments, T3 extends EmberClassArguments - >(this: Statics, arg1: T1, arg2: T2, arg3: T3): Statics & T1 & T2 & T3; + >( + this: Statics, + arg1: T1, + arg2: T2, + arg3: T3 + ): Statics & T1 & T2 & T3; static detect( this: Statics & EmberClassConstructor, @@ -998,7 +1075,10 @@ declare module 'ember' { /** * Fetch the model types and observe them for changes. */ - watchModelTypes(typesAdded: Function, typesUpdated: Function): Function; + watchModelTypes( + typesAdded: Function, + typesUpdated: Function + ): Function; /** * Fetch the records of a given type and observe them for changes. */ @@ -1110,7 +1190,10 @@ declare module 'ember' { * item. This method corresponds to the `forEach()` method defined in * JavaScript 1.6. */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + forEach( + callbackfn: (value: T, index: number, array: T[]) => void, + thisArg?: any + ): void; /** * Alias for `mapBy` */ @@ -1126,7 +1209,10 @@ declare module 'ember' { * Maps all of the items in the enumeration to another value, returning * a new array. This method corresponds to `map()` defined in JavaScript 1.6. */ - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + map( + callbackfn: (value: T, index: number, array: T[]) => U, + thisArg?: any + ): U[]; /** * Similar to map, this specialized function returns the value of the named * property on all items in the enumeration. @@ -1141,12 +1227,18 @@ declare module 'ember' { callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any ): S[]; - filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; + filter( + callbackfn: (value: T, index: number, array: T[]) => any, + thisArg?: any + ): T[]; /** * Returns an array with all of the items in the enumeration where the passed * function returns false. This method is the inverse of filter(). */ - reject(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; + reject( + callbackfn: (value: T, index: number, array: T[]) => any, + thisArg?: any + ): T[]; /** * Returns an array with just the items with the matched property. You * can pass an optional second argument with the target value. Otherwise @@ -1192,7 +1284,10 @@ declare module 'ember' { * Returns `true` if the passed function returns true for any item in the * enumeration. */ - any(callback: (value: T, index: number, array: T[]) => boolean, target?: {}): boolean; + any( + callback: (value: T, index: number, array: T[]) => boolean, + target?: {} + ): boolean; /** * Returns `true` if the passed property resolves to the value of the second * argument for any item in the enumerable. This method is often simpler/faster @@ -1204,8 +1299,24 @@ declare module 'ember' { * is a useful way to collect a summary value from an enumeration. This * corresponds to the `reduce()` method defined in JavaScript 1.8. */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + reduce( + callbackfn: ( + previousValue: T, + currentValue: T, + currentIndex: number, + array: T[] + ) => T, + initialValue?: T + ): T; + reduce( + callbackfn: ( + previousValue: U, + currentValue: T, + currentIndex: number, + array: T[] + ) => U, + initialValue: U + ): U; /** * Invokes the named method on every object in the receiver that * implements it. This method corresponds to the implementation in @@ -1349,7 +1460,9 @@ declare module 'ember' { * The `helper` method create pure-function helpers without instances. For * example: */ - static helper(helper: (params: any[], hash?: object) => any): Helper; + static helper( + helper: (params: any[], hash?: object) => any + ): Helper; /** * Override this function when writing a class-based helper. */ @@ -1366,7 +1479,12 @@ declare module 'ember' { * for Ember. */ const Instrumentation: { - instrument(name: string, payload: any, callback: Function, binding: any): void; + instrument( + name: string, + payload: any, + callback: Function, + binding: any + ): void; reset(): void; subscribe(pattern: string, object: any): void; unsubscribe(subscriber: any): void; @@ -1479,12 +1597,31 @@ declare module 'ember' { class Mixin { /** * Mixin needs to have *something* on its prototype, otherwise it's treated like an empty interface. + * It cannot be private, sadly. */ - private __ember_mixin__: never; + __ember_mixin__: never; static create( args?: T & ThisType> ): Mixin; + + static create( + arg1: T1 & ThisType>, + arg2: T2 & ThisType> + ): Mixin; + + static create( + arg1: T1 & ThisType>, + arg2: T2 & ThisType>, + arg3: T3 & ThisType> + ): Mixin; + + static create( + arg1: T1 & ThisType>, + arg2: T2 & ThisType>, + arg3: T3 & ThisType>, + arg4: T4 & ThisType> + ): Mixin; } /** * This mixin defines the API for modifying array-like objects. These methods @@ -1591,7 +1728,11 @@ declare module 'ember' { * false, this will be applied automatically. Otherwise you can apply the mixin * at anytime by calling `Ember.NativeArray.apply(Array.prototype)`. */ - interface NativeArray extends GlobalArray, MutableArray, Observable, Copyable { + interface NativeArray + extends GlobalArray, + MutableArray, + Observable, + Copyable { /** * __Required.__ You must implement this method to apply this mixin. */ @@ -1615,8 +1756,24 @@ declare module 'ember' { * is a useful way to collect a summary value from an enumeration. This * corresponds to the `reduce()` method defined in JavaScript 1.8. */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + reduce( + callbackfn: ( + previousValue: T, + currentValue: T, + currentIndex: number, + array: T[] + ) => T, + initialValue?: T + ): T; + reduce( + callbackfn: ( + previousValue: U, + currentValue: T, + currentIndex: number, + array: T[] + ) => U, + initialValue: U + ): U; } const NativeArray: Mixin>; /** @@ -1649,12 +1806,18 @@ declare module 'ember' { /** * Retrieves the value of a property from the object. */ - get(this: ComputedProperties, key: K): T[K]; + get( + this: ComputedProperties, + key: K + ): T[K]; /** * To get the values of multiple properties at once, call `getProperties` * with a list of strings or an array: */ - getProperties(this: ComputedProperties, list: K[]): Pick; + getProperties( + this: ComputedProperties, + list: K[] + ): Pick; getProperties( this: ComputedProperties, ...list: K[] @@ -1662,7 +1825,11 @@ declare module 'ember' { /** * Sets the provided key or path to the value. */ - set(this: ComputedProperties, key: K, value: T[K]): T[K]; + set( + this: ComputedProperties, + key: K, + value: T[K] + ): T[K]; /** * Sets a list of properties at once. These properties are set inside * a single `beginPropertyChanges` and `endPropertyChanges` batch, so @@ -1723,7 +1890,10 @@ declare module 'ember' { * without accidentally invoking it if it is intended to be * generated lazily. */ - cacheFor(this: ComputedProperties, key: K): T[K] | undefined; + cacheFor( + this: ComputedProperties, + key: K + ): T[K] | undefined; } const Observable: Mixin; /** @@ -1799,7 +1969,7 @@ declare module 'ember' { logic that can only take place after the model has already resolved. */ - afterModel(resolvedModel: any, transition: Transition): Rsvp.Promise; + afterModel(resolvedModel: any, transition: Transition): any; /** This hook is the first of the route entry validation hooks @@ -1833,7 +2003,9 @@ declare module 'ember' { /** * Disconnects a view that has been rendered into an outlet. */ - disconnectOutlet(options: string | { outlet?: string; parentView?: string }): void; + disconnectOutlet( + options: string | { outlet?: string; parentView?: string } + ): void; /** * A hook you can implement to convert the URL into the model for @@ -1920,7 +2092,11 @@ declare module 'ember' { * A hook you can use to reset controller values either when the model * changes or the route is exiting. */ - resetController(controller: Controller, isExiting: boolean, transition: any): void; + resetController( + controller: Controller, + isExiting: boolean, + transition: any + ): void; /** * Sends an action to the router, which will delegate it to the currently active @@ -1939,7 +2115,7 @@ declare module 'ember' { * This method is called when `transitionTo` is called with a context * in order to populate the URL. */ - serialize(model: {}, params: string[]): string; + serialize(model: {}, params: string[]): string | object; /** * A hook you can use to setup the controller for the current route. @@ -2100,10 +2276,10 @@ declare module 'ember' { mount( name: string, options?: { - as?: string, - path?: string, - resetNamespace?: boolean, - engineInfo?: any + as?: string; + path?: string; + resetNamespace?: boolean; + engineInfo?: any; } ): void; } @@ -2219,7 +2395,9 @@ declare module 'ember' { * Used to register callbacks to be fired whenever `App.injectTestHelpers` * is called. */ - function onInjectHelpers(callback: (app: Application) => void): void; + function onInjectHelpers( + callback: (app: Application) => void + ): void; /** * This returns a thenable tailored for testing. It catches failed * `onSuccess` callbacks and invokes the `Ember.Test.adapter.exception` @@ -2237,7 +2415,10 @@ declare module 'ember' { * The only difference is this uses * an instance of `Ember.Test.Promise` */ - function resolve(value?: T | PromiseLike, label?: string): Ember.Test.Promise; + function resolve( + value?: T | PromiseLike, + label?: string + ): Ember.Test.Promise; function resolve(): Ember.Test.Promise; /** * This allows ember-testing to play nicely with other asynchronous @@ -2336,7 +2517,12 @@ declare module 'ember' { } namespace Handlebars { function compile(string: string): Function; - function compile(environment: any, options?: any, context?: any, asObject?: any): any; + function compile( + environment: any, + options?: any, + context?: any, + asObject?: any + ): any; function precompile(string: string, options: any): void; class Compiler {} class JavaScriptCompiler {} @@ -2368,8 +2554,14 @@ declare module 'ember' { } const computed: { (cb: ComputedPropertyCallback): ComputedProperty; - (k1: string, cb: ComputedPropertyCallback): ComputedProperty; - (k1: string, k2: string, cb: ComputedPropertyCallback): ComputedProperty; + (k1: string, cb: ComputedPropertyCallback): ComputedProperty< + T + >; + ( + k1: string, + k2: string, + cb: ComputedPropertyCallback + ): ComputedProperty; ( k1: string, k2: string, @@ -2442,7 +2634,10 @@ declare module 'ember' { * dependent property against a given RegExp, returning `true` * if the value matches the RegExp and `false` if it does not. */ - match(dependentKey: string, regexp: RegExp): ComputedProperty; + match( + dependentKey: string, + regexp: RegExp + ): ComputedProperty; /** * A computed property that returns true if the provided dependent property * is equal to the given value. @@ -2472,12 +2667,12 @@ declare module 'ember' { * A computed property that performs a logical `and` on the * original values for the provided dependent properties. */ - and(...dependentKeys: string[]): ComputedProperty; + and(...dependentKeys: string[]): ComputedProperty; /** * A computed property which performs a logical `or` on the * original values for the provided dependent properties. */ - or(...dependentKeys: string[]): ComputedProperty; + or(...dependentKeys: string[]): ComputedProperty; /** * Creates a new property that is an alias for another property * on an object. Calls to `get` or `set` this property behave as @@ -2547,7 +2742,10 @@ declare module 'ember' { /** * Returns an array mapped to the specified key. */ - mapBy(dependentKey: string, propertyKey: string): ComputedProperty; + mapBy( + dependentKey: string, + propertyKey: string + ): ComputedProperty; /** * Filters the array by the callback. */ @@ -2572,7 +2770,10 @@ declare module 'ember' { * A computed property which returns a new array with all the unique * elements from an array, with uniqueness determined by specific key. */ - uniqBy(dependentKey: string, propertyKey: string): ComputedProperty; + uniqBy( + dependentKey: string, + propertyKey: string + ): ComputedProperty; /** * A computed property which returns a new array with all the unique * elements from one or more dependent arrays. @@ -2588,7 +2789,10 @@ declare module 'ember' { * properties from the first dependent array that are not in the second * dependent array. */ - setDiff(setAProperty: string, setBProperty: string): ComputedProperty; + setDiff( + setAProperty: string, + setBProperty: string + ): ComputedProperty; /** * A computed property that returns the array of values * for the provided dependent properties. @@ -2617,7 +2821,10 @@ declare module 'ember' { * present it will queue itself to run on the existing run-loops action * queue. */ - join(method: (...args: any[]) => Ret, ...args: any[]): Ret | undefined; + join( + method: (...args: any[]) => Ret, + ...args: any[] + ): Ret | undefined; join( target: Target, method: RunMethod, @@ -2669,7 +2876,11 @@ declare module 'ember' { * of milliseconds. */ later(method: (...args: any[]) => any, wait: number): EmberRunTimer; - later(target: Target, method: RunMethod, wait: number): EmberRunTimer; + later( + target: Target, + method: RunMethod, + wait: number + ): EmberRunTimer; later( target: Target, method: RunMethod, @@ -2725,7 +2936,11 @@ declare module 'ember' { * Schedule a function to run one time during the current RunLoop. This is equivalent * to calling `scheduleOnce` with the "actions" queue. */ - once(target: Target, method: RunMethod, ...args: any[]): EmberRunTimer; + once( + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; /** * Schedules a function to run one time in a given queue of the current RunLoop. * Calling this method with the same queue/target/method combination will have @@ -2742,7 +2957,11 @@ declare module 'ember' { * control has been returned to the system. This is equivalent to calling * `run.later` with a wait time of 1ms. */ - next(target: Target, method: RunMethod, ...args: any[]): EmberRunTimer; + next( + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; /** * Cancels a scheduled item. Must be a value returned by `run.later()`, * `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or @@ -2966,12 +3185,20 @@ declare module 'ember' { /** * Display a warning with the provided message. */ - function warn(message: string, test: boolean, options: { id: string }): any; + function warn( + message: string, + test: boolean, + options: { id: string } + ): any; function warn(message: string, options: { id: string }): any; /** * @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options */ - function warn(message: string, test: boolean, options?: { id?: string }): any; + function warn( + message: string, + test: boolean, + options?: { id?: string } + ): any; /** * @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options */ @@ -3017,12 +3244,20 @@ declare module 'ember' { * a target is executed on the passed object. If an array of actions * is not passed, the actions stored on the passed object are invoked. */ - function sendEvent(obj: any, eventName: string, params?: any[], actions?: any[]): boolean; + function sendEvent( + obj: any, + eventName: string, + params?: any[], + actions?: any[] + ): boolean; /** * Define a property as a function that should be executed when * a specified event or events are triggered. */ - function on(eventNames: string, func: (...args: any[]) => void): (...args: any[]) => void; + function on( + eventNames: string, + func: (...args: any[]) => void + ): (...args: any[]) => void; /** * To get multiple properties at once, call `Ember.getProperties` * with an object followed by a list of strings or an array: @@ -3066,7 +3301,10 @@ declare module 'ember' { /** * Specify a method that observes property changes. */ - function observer(key1: string, func: (target: any, key: string) => void): void; + function observer( + key1: string, + func: (target: any, key: string) => void + ): void; function observer( key1: string, key2: string, @@ -3118,7 +3356,10 @@ declare module 'ember' { * the function will be invoked. If the property is not defined but the * object implements the `unknownProperty` method then that will be invoked. */ - function get(obj: ComputedProperties, key: K): T[K]; + function get( + obj: ComputedProperties, + key: K + ): T[K]; /** * Retrieves the value of a property from an Object, or a default value in the * case that the property returns `undefined`. @@ -3199,7 +3440,12 @@ declare module 'ember' { */ function assign(target: T, source: U): T & U; function assign(target: T, source1: U, source2: V): T & U & V; - function assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + function assign( + target: T, + source1: U, + source2: V, + source3: W + ): T & U & V & W; /** * Polyfill for Object.create * @deprecated Use Object.create @@ -3281,7 +3527,10 @@ declare module 'ember' { /** * Expands `pattern`, invoking `callback` for each expansion. */ - function expandProperties(pattern: string, callback: (expanded: string) => void): void; + function expandProperties( + pattern: string, + callback: (expanded: string) => void + ): void; } export default Ember; diff --git a/types/ember/test/computed.ts b/types/ember/test/computed.ts index b9bfe2ada6..7376d14639 100755 --- a/types/ember/test/computed.ts +++ b/types/ember/test/computed.ts @@ -27,13 +27,13 @@ const Person = Ember.Object.extend({ this.set('firstName', first); this.set('lastName', last); return value; - } + }, }), fullNameGetOnly: Ember.computed('fullName', { get() { return this.get('fullName'); - } + }, }), fullNameSetOnly: Ember.computed('firstName', 'lastName', { @@ -42,15 +42,16 @@ const Person = Ember.Object.extend({ this.set('firstName', first); this.set('lastName', last); return value; - } + }, }), combinators: Ember.computed(function() { return this.get('firstName'); - }).property('firstName') - .meta({ foo: 'bar' }) - .volatile() - .readOnly() + }) + .property('firstName') + .meta({ foo: 'bar' }) + .volatile() + .readOnly(), }); const person = Person.create({ @@ -79,10 +80,12 @@ assertType(person.get('fullNameGetOnly')); assertType(person.get('fullNameSetOnly')); assertType(person.get('combinators')); -assertType<{ firstName: string, fullName: string, age: number }>(person.getProperties('firstName', 'fullName', 'age')); +assertType<{ firstName: string; fullName: string; age: number }>( + person.getProperties('firstName', 'fullName', 'age') +); const person2 = Person.create({ - fullName: 'Fred Smith' + fullName: 'Fred Smith', }); assertType(person2.get('firstName')); @@ -90,7 +93,7 @@ assertType(person2.get('fullName')); const person3 = Person.extend({ firstName: 'Fred', - fullName: 'Fred Smith' + fullName: 'Fred Smith', }).create(); assertType(person3.get('firstName')); @@ -98,7 +101,7 @@ assertType(person3.get('fullName')); const person4 = Person.extend({ firstName: Ember.computed(() => 'Fred'), - fullName: Ember.computed(() => 'Fred Smith') + fullName: Ember.computed(() => 'Fred Smith'), }).create(); assertType(person4.get('firstName')); @@ -112,13 +115,13 @@ const objectWithComputedProperties = Ember.Object.extend({ collect: Ember.computed.collect('foo', 'bar', 'baz', 'qux'), deprecatingAlias: Ember.computed.deprecatingAlias('foo', { id: 'hamster.deprecate-banana', - until: '3.0.0' + until: '3.0.0', }), empty: Ember.computed.empty('foo'), equalNumber: Ember.computed.equal('foo', 1), equalString: Ember.computed.equal('foo', 'bar'), equalObject: Ember.computed.equal('foo', {}), - filter: Ember.computed.filter('foo', (item) => item === 'bar'), + filter: Ember.computed.filter('foo', item => item === 'bar'), filterBy1: Ember.computed.filterBy('foo', 'bar'), filterBy2: Ember.computed.filterBy('foo', 'bar', false), gt: Ember.computed.gt('foo', 3), @@ -152,9 +155,11 @@ const objectWithComputedProperties = Ember.Object.extend({ sum: Ember.computed.sum('foo'), union: Ember.computed.union('foo', 'bar', 'baz', 'qux'), uniq: Ember.computed.uniq('foo'), - uniqBy: Ember.computed.uniqBy('foo', 'bar') + uniqBy: Ember.computed.uniqBy('foo', 'bar'), }); const component2 = Component.extend({ - isAnimal: or('isDog', 'isCat') -}); + isAnimal: or('isDog', 'isCat'), +}).create(); + +assertType(component2.get('isAnimal')); From 8dffdd92cf965d725b5b9db79ba05a77f432c0a8 Mon Sep 17 00:00:00 2001 From: Tomasz Janusz <424941+TomaszJanusz@users.noreply.github.com> Date: Wed, 20 Dec 2017 00:12:52 +0100 Subject: [PATCH 101/890] Add isFlat method to LineUtil definition --- types/leaflet/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 71c6ea4adf..095dadcbc0 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -22,6 +22,7 @@ export class Transformation { transform(point: Point, scale?: number): Point; untransform(point: Point, scale?: number): Point; + } export namespace LineUtil { @@ -30,6 +31,8 @@ export namespace LineUtil { function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number; function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point; + + function isFlat(latlngs: LatLngExpression[]): boolean; } export namespace PolyUtil { From 93bf0e8fc2beeb3f537b31026fbcbb554dcb4e76 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 19 Dec 2017 16:18:58 -0700 Subject: [PATCH 102/890] One more tweak for ember-data; fix parens. --- types/ember-data/index.d.ts | 2 +- types/ember-data/test/model.ts | 2 +- types/ember-data/test/store.ts | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index 36bda4889c..c973ebd2ea 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -424,7 +424,7 @@ declare module "ember-data" { * Create a JSON representation of the record, using the serialization * strategy of the store's adapter. */ - serialize(options?: {}): {}; + serialize(options?: { includeId?: boolean }): {}; /** * Use [DS.JSONSerializer](DS.JSONSerializer.html) to * get the JSON representation of a record. diff --git a/types/ember-data/test/model.ts b/types/ember-data/test/model.ts index fb076b5b3b..1e96d105ed 100644 --- a/types/ember-data/test/model.ts +++ b/types/ember-data/test/model.ts @@ -8,7 +8,7 @@ const Person = DS.Model.extend({ title: DS.attr({ defaultValue: "The default" }), title2: DS.attr({ defaultValue: () => "The default" }), - fullName: Ember.computed('firstName', 'lastName', function () { + fullName: Ember.computed('firstName', 'lastName', function() { return `${this.get('firstName')} ${this.get('lastName')}`; }) }); diff --git a/types/ember-data/test/store.ts b/types/ember-data/test/store.ts index d4e14f67da..d3a564cbf8 100644 --- a/types/ember-data/test/store.ts +++ b/types/ember-data/test/store.ts @@ -18,7 +18,7 @@ post.save().then((saved) => { assertType(saved); }); -store.findRecord('post', 1).then(function (post) { +store.findRecord('post', 1).then(function(post) { post.get('title'); // => "Rails is Omakase" post.set('title', 'A new post'); post.save(); // => PATCH to '/posts/1' @@ -28,13 +28,13 @@ class User extends DS.Model { username = DS.attr('string'); } -store.queryRecord('user', {}).then(function (user) { +store.queryRecord('user', {}).then(function(user) { let username = user.get('username'); console.log(`Currently logged in as ${username}`); }); store.findAll('blog-post'); // => GET /blog-posts -store.findAll('author', { reload: true }).then(function (authors) { +store.findAll('author', { reload: true }).then(function(authors) { authors.getEach('id'); // ['first', 'second'] }); store.findAll('post', { @@ -56,14 +56,14 @@ class Message extends DS.Model { } const messages = store.peekAll('message'); -messages.forEach(function (message) { +messages.forEach(function(message) { message.set('hasBeenSeen', true); }); messages.save(); const people = store.peekAll('person'); people.get('isUpdating'); // false -people.update().then(function () { +people.update().then(function() { people.get('isUpdating'); // false }); people.get('isUpdating'); // true @@ -79,16 +79,16 @@ const tom = store.query('user', { filter: { email: 'tomster@example.com' } -}).then(function (users) { +}).then(function(users) { return users.get("firstObject"); }); // GET /users?isAdmin=true const admins = store.query('user', { isAdmin: true }); -admins.then(function () { +admins.then(function() { console.log(admins.get("length")); // 42 }); -admins.update().then(function () { +admins.update().then(function() { admins.get('isUpdating'); // false console.log(admins.get("length")); // 123 }); From f69277b063adbf16822331fd576621743bfcaf50 Mon Sep 17 00:00:00 2001 From: jodi Warren Date: Tue, 19 Dec 2017 23:20:06 +0000 Subject: [PATCH 103/890] Update fullpage.js options --- types/fullpage.js/fullpage.js-tests.ts | 43 ++++++++----- types/fullpage.js/index.d.ts | 83 +++++++++++++++++++++++++- 2 files changed, 111 insertions(+), 15 deletions(-) diff --git a/types/fullpage.js/fullpage.js-tests.ts b/types/fullpage.js/fullpage.js-tests.ts index 16f496494f..fe49995328 100644 --- a/types/fullpage.js/fullpage.js-tests.ts +++ b/types/fullpage.js/fullpage.js-tests.ts @@ -1,7 +1,7 @@ function test_public_methods() { - $(() => { + $(document).ready(function() { $('#fullpage').fullpage({ - // Navigation + //Navigation menu: '#menu', lockAnchors: false, anchors:['firstPage', 'secondPage'], @@ -9,10 +9,10 @@ function test_public_methods() { navigationPosition: 'right', navigationTooltips: ['firstSlide', 'secondSlide'], showActiveTooltip: false, - slidesNavigation: true, + slidesNavigation: false, slidesNavPosition: 'bottom', - // Scrolling + //Scrolling css3: true, scrollingSpeed: 700, autoScrolling: true, @@ -25,18 +25,27 @@ function test_public_methods() { loopTop: false, loopHorizontal: true, continuousVertical: false, + continuousHorizontal: false, + scrollHorizontally: false, + interlockedSlides: false, + dragAndMove: false, + offsetSections: false, + resetSliders: false, + fadingEffect: false, normalScrollElements: '#element1, .element2', scrollOverflow: false, + scrollOverflowReset: false, scrollOverflowOptions: null, touchSensitivity: 15, normalScrollElementTouchThreshold: 5, + bigSectionsDestination: null, - // Accessibility + //Accessibility keyboardScrolling: true, animateAnchor: true, recordHistory: true, - // Design + //Design controlArrows: true, verticalCentered: true, sectionsColor : ['#ccc', '#fff'], @@ -45,18 +54,24 @@ function test_public_methods() { fixedElements: '#header, .footer', responsiveWidth: 0, responsiveHeight: 0, + responsiveSlides: false, + parallax: false, + parallaxOptions: {type: 'reveal', percentage: 62, property: 'translate'}, - // Custom selectors + //Custom selectors sectionSelector: '.section', slideSelector: '.slide', - // Events - onLeave: (index, nextIndex, direction) => {}, - afterLoad: (anchorLink, index) => {}, - afterRender: () => {}, - afterResize: () => {}, - afterSlideLoad: (anchorLink, index, slideAnchor, slideIndex) => {}, - onSlideLeave: (anchorLink, index, slideIndex, direction, nextSlideIndex) => {} + lazyLoading: true, + + //events + onLeave: function(index, nextIndex, direction){}, + afterLoad: function(anchorLink, index){}, + afterRender: function(){}, + afterResize: function(){}, + afterResponsive: function(isResponsive){}, + afterSlideLoad: function(anchorLink, index, slideAnchor, slideIndex){}, + onSlideLeave: function(anchorLink, index, slideIndex, direction, nextSlideIndex){} }); }); diff --git a/types/fullpage.js/index.d.ts b/types/fullpage.js/index.d.ts index 8467e3a14b..3f70a6b5e0 100644 --- a/types/fullpage.js/index.d.ts +++ b/types/fullpage.js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for fullpage.js v2.8.0 +// Type definitions for fullpage.js v2.9.5 // Project: http://alvarotrigo.com/fullPage/ // Definitions by: Andrew Roberts , Jodi Warren // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -116,6 +116,47 @@ interface FullPageJsOptions { */ continuousVertical?: boolean; + /** + * (default false) Extension of fullpage.js. Defines whether sliding right in the last slide should slide right to the first one or not, and if scrolling left in the first slide should slide left to the last one or not. Not compatible with loopHorizontal. Requires fullpage.js >= 2.8.3. + */ + continuousHorizontal?: boolean; + + /** + * (default false) Extension of fullpage.js. Defines whether to slide horizontally within sliders by using the mouse wheel or trackpad. Ideal for story telling. Requires fullpage.js >= 2.8.3. + */ + scrollHorizontally?: boolean; + + /** + * (default false) Extension of fullpage.js. Determines whether moving one horizontal slider will force the sliding of sliders in other section in the same direction. Possible values are true, false or an array with the interlocked sections. For example [1,3,5] starting by 1. Requires fullpage.js >= 2.8.3. + */ + interlockedSlides?: boolean | number[]; + + /** + * Enables or disables the dragging and flicking of sections and slides by using mouse or fingers. Requires fullpage.js >= 2.8.9. Possible values are: + * true: enables the feature. + * false: disables the feature. + * vertical: enables the feature only vertically. + * horizontal: enables the feature only horizontally. + * fingersonly: enables the feature for touch devices only. + * mouseonly: enables the feature for desktop devices only (mouse and trackpad). + */ + dragAndMove?: boolean | 'vertical' | 'horizontal' | 'fingersonly' | 'mouseonly'; + + /** + * (default false)Extension of fullpage.js. Provides a way to use non full screen sections based on percentage. Ideal to show visitors there's more content in the site by showing part of the next or previous section. Requires fullPage.js >= 2.8.8 To define the percentage of each section the attribute data-percentage must be used. The centering of the section in the viewport can be determined by using a boolean value in the attribute data-centered (default to true if not specified). For example: + */ + offsetSections?: boolean; + + /** + * (default false). Extension of fullpage.js. Defines whether or not to reset every slider after leaving its section. Requires fullpage.js >= 2.8.3. + */ + resetSliders?: boolean; + + /** + * Defines whether to use a fading effect or not instead of the default scrolling one. Possible values are true, false, sections, slides. It can therefore be applied just vertically or horizontally, or to both at the time. Requires fullpage.js >= 2.8.6. + */ + fadingEffect?: boolean | 'sections' | 'slides'; + /** * (default null) If you want to avoid the auto scroll when scrolling over some elements, this is the option you need to use. (useful for maps, scrolling divs etc.) It requires a string with the jQuery selectors for those elements. (For example: normalScrollElements: '#element1, .element2') */ @@ -131,6 +172,11 @@ interface FullPageJsOptions { */ scrollOverflowOptions?: any; + /** + * When set to true it scrolls up the content of the section/slide with scroll bar when leaving to another vertical section. This way the section/slide will always show the start of its content even when scrolling from a section under it + */ + scrollOverflowReset?: boolean; + /** * (default 5) Defines a percentage of the browsers window width/height, and how far a swipe must measure for navigating to the next section / slide */ @@ -141,6 +187,11 @@ interface FullPageJsOptions { */ normalScrollElementTouchThreshold?: number; + /** + * Defines how to scroll to a section which size is bigger than the viewport. By default fullPage.js scrolls to the top if you come from a section above the destination one and to the bottom if you come from a section below the destination one. + */ + bigSectionsDestination?: 'top' | 'bottom' | null; + // Accessibility /** @@ -202,6 +253,30 @@ interface FullPageJsOptions { */ responsiveHeight?: number; + /** + * When set to true slides will be turned into vertical sections when responsive mode is fired. (by using the responsiveWidth or responsiveHeight options detailed above). Requires fullpage.js >= 2.8.5. + */ + responsiveSlides?: boolean; + + /** + * When set to true slides will be turned into vertical sections when responsive mode is fired. (by using the responsiveWidth or responsiveHeight options detailed above). Requires fullpage.js >= 2.8.5. + */ + parallax?: boolean; + + /** + * Allows to configure the parameters for the parallax backgrounds effect when using the option parallax:true. + */ + parallaxOptions?: { + type?: 'cover' | 'reveal', + percentage?: number, + property?: string, + }; + + /** + * Lazy loading is active by default which means it will lazy load any media element containing the attribute data-src as detailed in the Lazy Loading docs . If you want to use any other lazy loading library you can disable this fullpage.js feature. + */ + lazyLoading?: boolean; + // Custom selectors /** @@ -240,6 +315,12 @@ interface FullPageJsOptions { */ afterResize?: () => void; + /** + * This callback is fired after fullpage.js changes from normal to responsive mode or from responsive mode to normal mode. + * @param {boolean} isResponsive boolean that determines if it enters into responsive mode (true) or goes back to normal mode (false) + */ + afterResponsive?: (isResponsive: boolean) => void; + /** * Callback fired once the slide of a section have been loaded, after the scrolling has ended. * From fea29359dffdd3b5516365f6eba57d6713b836bc Mon Sep 17 00:00:00 2001 From: Tomasz Janusz Date: Wed, 20 Dec 2017 00:22:26 +0100 Subject: [PATCH 104/890] fix linter errors --- types/leaflet/index.d.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 095dadcbc0..310977d9f4 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -18,20 +18,14 @@ export class Class { export class Transformation { constructor(a: number, b: number, c: number, d: number); - transform(point: Point, scale?: number): Point; - untransform(point: Point, scale?: number): Point; - } export namespace LineUtil { function simplify(points: Point[], tolerance: number): Point[]; - function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number; - function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point; - function isFlat(latlngs: LatLngExpression[]): boolean; } From ff7058dcc617182fdfe874920c156a3a8bc70842 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 19 Dec 2017 16:24:18 -0700 Subject: [PATCH 105/890] Fix a test for last added Ember Data fix. --- types/ember-data/test/model.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/ember-data/test/model.ts b/types/ember-data/test/model.ts index 1e96d105ed..70dba1bd7c 100644 --- a/types/ember-data/test/model.ts +++ b/types/ember-data/test/model.ts @@ -29,4 +29,5 @@ assertType(user.get('verified')); assertType(user.get('createdAt')); user.serialize(); -user.serialize({ someOption: 'neat' }); +user.serialize({ includeId: true }); + From cb6b5b8a41d87f9b68d6b69f48b3046dfc0f4d7d Mon Sep 17 00:00:00 2001 From: Tomasz Janusz <424941+TomaszJanusz@users.noreply.github.com> Date: Wed, 20 Dec 2017 00:24:45 +0100 Subject: [PATCH 106/890] Remove linter errors --- types/leaflet/index.d.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 095dadcbc0..310977d9f4 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -18,20 +18,14 @@ export class Class { export class Transformation { constructor(a: number, b: number, c: number, d: number); - transform(point: Point, scale?: number): Point; - untransform(point: Point, scale?: number): Point; - } export namespace LineUtil { function simplify(points: Point[], tolerance: number): Point[]; - function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number; - function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point; - function isFlat(latlngs: LatLngExpression[]): boolean; } From f44b484a52200a8e58c05a9247371707fe4da53f Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 19 Dec 2017 16:32:10 -0700 Subject: [PATCH 107/890] Fix white space in Ember Data. --- types/ember-data/test/model.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/ember-data/test/model.ts b/types/ember-data/test/model.ts index 70dba1bd7c..a18167dbee 100644 --- a/types/ember-data/test/model.ts +++ b/types/ember-data/test/model.ts @@ -30,4 +30,3 @@ assertType(user.get('createdAt')); user.serialize(); user.serialize({ includeId: true }); - From 18ebf4d5f82174031d3fab899c8b2936e80a2bd2 Mon Sep 17 00:00:00 2001 From: Rayner Pupo Date: Tue, 19 Dec 2017 22:31:24 -0500 Subject: [PATCH 108/890] update invoker function signature --- types/ramda/index.d.ts | 13 ++++++------- types/ramda/ramda-tests.ts | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index be97f3ee32..21ef580006 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -11,6 +11,7 @@ // Charles-Philippe Clermont // Samson Keung // Angelo Ocana +// Rayner Pupo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -812,15 +813,13 @@ declare namespace R { invertObj(obj: { [index: string]: string } | { [index: number]: string }): { [index: string]: string }; /** - * Turns a named method of an object (or object prototype) into a function that can be - * called directly. Passing the optional `len` parameter restricts the returned function to - * the initial `len` parameters of the method. + * Turns a named method with a specified arity into a function that can be called directly + * supplied with arguments and a target object. * - * The returned function is curried and accepts `len + 1` parameters (or `method.length + 1` - * when `len` is not specified), and the final parameter is the target object. + * The returned function is curried and accepts `arity + 1` parameters where the final + * parameter is the target object. */ - invoker(name: string, obj: any, len?: number): (...a: any[]) => any; - invoker(name: string): (obj: any, len?: number) => (...a: any[]) => any; + invoker(arity: number, method: string): (...a: any[]) => any; /** * See if an object (`val`) is an instance of the supplied constructor. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 1315ced585..5ce9bb40d3 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -202,8 +202,8 @@ class F2 { }; () => { - R.invoker("charAt", String.prototype); - R.invoker("charAt", String.prototype, 1); + R.invoker(1, "slice")(6, "abcdefghijklm"); + R.invoker(2, "slice")(6)(8, "abcdefghijklm"); }; (() => { From 1ff7302d0f83c17553de05efd05ebd8234f95966 Mon Sep 17 00:00:00 2001 From: Mykola Radchenko Date: Tue, 19 Dec 2017 20:43:41 -0800 Subject: [PATCH 109/890] mongoose: Fix typo for static methods --- types/mongoose/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongoose/README.md b/types/mongoose/README.md index ad12702574..0ba91612e2 100644 --- a/types/mongoose/README.md +++ b/types/mongoose/README.md @@ -145,7 +145,7 @@ interface IUserModel extends Model { static1: () => string; } -var UserModel: IUserModel = model('User', UserSchema); +var UserModel: IUserModel = model('User', UserSchema); UserModel.static1(); // static methods are available ``` [top](#mongoosejs-typescript-docs) From 7d11f19e7f81ff064b323e640c55886bb773099a Mon Sep 17 00:00:00 2001 From: 0x6368656174 <0x6368656174@gmail.com> Date: Wed, 20 Dec 2017 15:13:15 +1000 Subject: [PATCH 110/890] Change Siema import and fix typings --- types/siema/index.d.ts | 16 ++++++++-------- types/siema/siema-tests.ts | 11 +++++++---- types/siema/tsconfig.json | 5 +++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/types/siema/index.d.ts b/types/siema/index.d.ts index 682c0e907e..09762fb7ac 100644 --- a/types/siema/index.d.ts +++ b/types/siema/index.d.ts @@ -1,8 +1,10 @@ // Type definitions for siema 1.4 // Project: https://github.com/pawelgrzybek/siema // Definitions by: Irmantas Zenkus +// Pavel Puchkov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare class Siema { + +export default class Siema { currentSlide: number; constructor(options?: SiemaOptions); @@ -11,13 +13,13 @@ declare class Siema { prev(index?: number, callback?: () => void): void; goTo(index: number, callback?: () => void): void; remove(index: number, callback?: () => void): void; - insert(item: any, index: number, callback?: () => void): void; - prepend(item: any, callback?: () => void): void; - append(item: any, callback?: () => void): void; - destroy(restoreMarkup: boolean, callback?: () => void): void; + insert(item: HTMLElement, index: number, callback?: () => void): void; + prepend(item: HTMLElement, callback?: () => void): void; + append(item: HTMLElement, callback?: () => void): void; + destroy(restoreMarkup?: boolean, callback?: () => void): void; } -interface SiemaOptions { +export interface SiemaOptions { selector?: string; duration?: number; easing?: string; @@ -30,5 +32,3 @@ interface SiemaOptions { onInit(): void; onChange?(): void; } - -export = Siema; diff --git a/types/siema/siema-tests.ts b/types/siema/siema-tests.ts index c8d9e755b2..61635ce5a3 100644 --- a/types/siema/siema-tests.ts +++ b/types/siema/siema-tests.ts @@ -1,4 +1,4 @@ -import Siema = require('siema'); +import Siema from 'siema'; const siema = new Siema({ selector: '.siema', @@ -14,11 +14,14 @@ const siema = new Siema({ onChange: () => {}, }); +const elem = new HTMLDivElement(); + siema.next(); siema.prev(); siema.goTo(siema.currentSlide); siema.remove(0, () => {}); -siema.insert('item', 0, () => {}); -siema.prepend('item', () => {}); -siema.append('item', () => {}); +siema.insert(elem, 0, () => {}); +siema.prepend(elem, () => {}); +siema.append(elem, () => {}); +siema.destroy(); siema.destroy(true, () => {}); diff --git a/types/siema/tsconfig.json b/types/siema/tsconfig.json index 4fe63d2a73..035dfc51d0 100644 --- a/types/siema/tsconfig.json +++ b/types/siema/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, @@ -20,4 +21,4 @@ "index.d.ts", "siema-tests.ts" ] -} \ No newline at end of file +} From 31248d48639db4a5adf748328fa968bcc4a86783 Mon Sep 17 00:00:00 2001 From: 0x6368656174 <0x6368656174@gmail.com> Date: Wed, 20 Dec 2017 15:18:34 +1000 Subject: [PATCH 111/890] change onInit() to optional --- types/siema/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/siema/index.d.ts b/types/siema/index.d.ts index 09762fb7ac..f323f4e619 100644 --- a/types/siema/index.d.ts +++ b/types/siema/index.d.ts @@ -29,6 +29,6 @@ export interface SiemaOptions { multipleDrag?: boolean; threshold?: number; loop?: boolean; - onInit(): void; + onInit?(): void; onChange?(): void; } From 760944edacca71d1fa5bc93592065db34599148f Mon Sep 17 00:00:00 2001 From: jodi Warren Date: Wed, 20 Dec 2017 10:18:36 +0000 Subject: [PATCH 112/890] revert misunderstood change --- types/fullpage.js/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/fullpage.js/tsconfig.json b/types/fullpage.js/tsconfig.json index 6fbc085728..d20953732c 100644 --- a/types/fullpage.js/tsconfig.json +++ b/types/fullpage.js/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 7cadcdc8666d1084eddcb565980aa89ec8d1d477 Mon Sep 17 00:00:00 2001 From: Paito Anderson Date: Wed, 20 Dec 2017 12:54:35 -0500 Subject: [PATCH 113/890] Fixed react-native-commications email --- types/react-native-communications/index.d.ts | 3 ++- .../react-native-communications-tests.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/react-native-communications/index.d.ts b/types/react-native-communications/index.d.ts index d50ce419a0..a6c572174d 100644 --- a/types/react-native-communications/index.d.ts +++ b/types/react-native-communications/index.d.ts @@ -1,11 +1,12 @@ // Type definitions for react-native-communications 2.2 // Project: https://github.com/anarchicknight/react-native-communications // Definitions by: HuHuanming +// Paito // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 export function phonecall(phoneNumber: string, isPrompt: boolean): void; -export function email(to: string, cc: string, bcc: string, subject: string, body: string): void; +export function email(to: string[] | null, cc: string[]| null, bcc: string[] | null, subject: string | null, body: string | null): void; export function text(phoneNumber?: string | null, body?: string | null): void; export function textWithoutEncoding(phoneNumber?: string | null, body?: string | null): void; export function web(address?: string | null): void; diff --git a/types/react-native-communications/react-native-communications-tests.ts b/types/react-native-communications/react-native-communications-tests.ts index 754f8a5a0c..edad4ad933 100644 --- a/types/react-native-communications/react-native-communications-tests.ts +++ b/types/react-native-communications/react-native-communications-tests.ts @@ -2,7 +2,7 @@ import { phonecall, email, text, textWithoutEncoding, web } from 'react-native-c phonecall('123456789', true); -email('a@example.com', 'a@example.com', 'a@example.com', 'subject', 'body'); +email(['a@example.com'], null, ['a@example.com'], 'subject', null); text(); text('123456789'); From 625ecc43d0365ab2ee77d8ba51c464a4743385e5 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 11:11:28 -0800 Subject: [PATCH 114/890] is-plain-object: Provides its own types --- notNeededPackages.json | 6 ++ types/is-plain-object/index.d.ts | 10 --- .../is-plain-object/is-plain-object-tests.ts | 23 ------ types/is-plain-object/tsconfig.json | 23 ------ types/is-plain-object/tslint.json | 79 ------------------- 5 files changed, 6 insertions(+), 135 deletions(-) delete mode 100644 types/is-plain-object/index.d.ts delete mode 100644 types/is-plain-object/is-plain-object-tests.ts delete mode 100644 types/is-plain-object/tsconfig.json delete mode 100644 types/is-plain-object/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index ce5c997b8e..42172b3c05 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -336,6 +336,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/is-lower-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "is-plain-object", + "typingsPackageName": "is-plain-object", + "sourceRepoURL": "https://github.com/jonschlinkert/is-plain-object", + "asOfVersion": "2.0.4" + }, { "libraryName": "is-upper-case", "typingsPackageName": "is-upper-case", diff --git a/types/is-plain-object/index.d.ts b/types/is-plain-object/index.d.ts deleted file mode 100644 index 79ad3cf63a..0000000000 --- a/types/is-plain-object/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Type definitions for is-plain-object -// Project: https://github.com/jonschlinkert/is-plain-object -// Definitions by: Kevin Zeng -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare module "is-plain-object" { - namespace isPlainObject {} - function isPlainObject(obj: any): boolean; - export = isPlainObject; -} \ No newline at end of file diff --git a/types/is-plain-object/is-plain-object-tests.ts b/types/is-plain-object/is-plain-object-tests.ts deleted file mode 100644 index be9470939d..0000000000 --- a/types/is-plain-object/is-plain-object-tests.ts +++ /dev/null @@ -1,23 +0,0 @@ -import * as isPlainObject from 'is-plain-object'; - -isPlainObject(Object.create({})); -//=> true -isPlainObject(Object.create(Object.prototype)); -//=> true -isPlainObject({foo: 'bar'}); -//=> true -isPlainObject({}); - -isPlainObject(1); -//=> false -isPlainObject(['foo', 'bar']); -//=> false -isPlainObject([]); -//=> false -class Foo {} -isPlainObject(new Foo); -//=> false -isPlainObject(null); -//=> false -isPlainObject(Object.create(null)); -//=> false \ No newline at end of file diff --git a/types/is-plain-object/tsconfig.json b/types/is-plain-object/tsconfig.json deleted file mode 100644 index 1522dc4f0e..0000000000 --- a/types/is-plain-object/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "is-plain-object-tests.ts" - ] -} \ No newline at end of file diff --git a/types/is-plain-object/tslint.json b/types/is-plain-object/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/is-plain-object/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 17c7af581326b2ec4b5fc5cc8e7cc1529f0aadbc Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 11:19:37 -0800 Subject: [PATCH 115/890] react-ga: Provides its own types --- notNeededPackages.json | 6 ++ types/react-ga/index.d.ts | 69 -------------------- types/react-ga/react-ga-tests.ts | 105 ------------------------------- types/react-ga/tsconfig.json | 23 ------- types/react-ga/tslint.json | 7 --- 5 files changed, 6 insertions(+), 204 deletions(-) delete mode 100644 types/react-ga/index.d.ts delete mode 100644 types/react-ga/react-ga-tests.ts delete mode 100644 types/react-ga/tsconfig.json delete mode 100644 types/react-ga/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4b6f20790b..311ca8cb9f 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -606,6 +606,12 @@ "sourceRepoURL": "https://github.com/gpbl/react-day-picker", "asOfVersion": "5.3.0" }, + { + "libraryName": "react-ga", + "typingsPackageName": "react-ga", + "sourceRepoURL": "https://github.com/react-ga/react-ga", + "asOfVersion": "2.3.0" + }, { "libraryName": "react-native-elements", "typingsPackageName": "react-native-elements", diff --git a/types/react-ga/index.d.ts b/types/react-ga/index.d.ts deleted file mode 100644 index d1d7eccc53..0000000000 --- a/types/react-ga/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -// Type definitions for react-ga 2.1 -// Project: https://github.com/react-ga/react-ga -// Definitions by: Tim Aldridge , Vasya Aksyonov -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export interface EventArgs { - category: string; - action: string; - label?: string; - value?: number; - nonInteraction?: boolean; -} - -export interface GaOptions { - name?: string; - clientId?: string; - sampleRate?: number; - siteSpeedSampleRate?: number; - alwaysSendReferrer?: boolean; - allowAnchor?: boolean; - cookieName?: string; - cookieDomain?: string; - cookieExpires?: number; - legacyCookieDomain?: string; - legacyHistoryImport?: boolean; - allowLinker?: boolean; - userId?: string; - language?: string; - hostName?: string; -} - -export interface InitializeOptions { - debug?: boolean; - titleCase?: boolean; - gaOptions?: GaOptions; -} - -export interface FieldsObject { - [i: string]: any; -} - -export interface TimingArgs { - category: string; - variable: string; - value: number; - label?: string; -} - -export interface Plugin { - require(name: string, options: any): void; - execute(pluginName: string, action: string, actionTypeOrPayload: string|any, payload?: any): void; -} - -export interface OutboundLinkArgs { - label: string; -} - -export function initialize(trackingCode: string, options?: InitializeOptions): void; -export function ga(): (...args: any[]) => any; -export function ga(...args: any[]): any; -export function set(fieldsObject: FieldsObject): void; -export function send(fieldsObject: FieldsObject): void; -export function pageview(path: string): void; -export function modalview(name: string): void; -export function timing(args: TimingArgs): void; -export function event(args: EventArgs): void; -export function exception(fieldsObject: FieldsObject): void; -export const plugin: Plugin; -export function outboundLink(args: OutboundLinkArgs, hitCallback: () => void): void; diff --git a/types/react-ga/react-ga-tests.ts b/types/react-ga/react-ga-tests.ts deleted file mode 100644 index 9e1ba7b23b..0000000000 --- a/types/react-ga/react-ga-tests.ts +++ /dev/null @@ -1,105 +0,0 @@ -import * as ga from "react-ga"; - -declare function describe(desc: string, f: () => void): void; -declare function it(desc: string, f: () => void): void; - -describe("Testing react-ga initialize object", () => { - it("Able to initialize react-ga object", () => { - ga.initialize("UA-65432-1"); - }); - it("Able to initailize react-ga object", () => { - const options: ga.InitializeOptions = { - debug: true, - }; - - ga.initialize("UA-65432-1", options); - }); -}); - -describe("Testing react-ga pageview calls", () => { - it("Able to make pageview calls", () => { - ga.initialize("UA-65432-1"); - ga.pageview("http://telshin.com"); - }); -}); - -describe("Testing react-ga modal calls", () => { - it("Able to make modal calls", () => { - ga.initialize("UA-65432-1"); - - ga.modalview("Test modal"); - }); -}); - -describe("Testing react-ga event calls", () => { - it("Able to make event calls", () => { - ga.initialize("UA-65432-1"); - - const options: ga.EventArgs = { - category: "Test", - action: "CI", - label: "Running Jasmine tests for react-ga typscript library", - value: 4, - nonInteraction: true, - }; - - ga.event(options); - }); -}); - -describe("Testing react-ga set calls", () => { - it("Able to make set calls", () => { - ga.initialize("UA-65432-1"); - - const fieldObject: ga.FieldsObject = { - page: '/users' - }; - - ga.set(fieldObject); - }); -}); - -describe("Testing react-ga v2.1.2", () => { - it("Able to make ga calls", () => { - ga.ga(); - }); - it("Able to make ga calls with any arguments", () => { - ga.ga("create", "UA-65432-1", "auto", "trackerName"); - }); - it("Able to make returned ga calls with any arguments", () => { - ga.ga()("create", "UA-65432-1", "auto", "trackerName"); - }); - it("Able to make send calls", () => { - const fieldObject: ga.FieldsObject = { - page: '/users' - }; - - ga.send(fieldObject); - }); - it("Able to make timing calls", () => { - ga.timing({ - category: 'string', - variable: 'string', - value: 1, - label: 'string' - }); - }); - it("Able to make exception calls", () => { - const fieldObject: ga.FieldsObject = { - page: '/users' - }; - ga.exception(fieldObject); - }); - it("Able to make plugin object calls", () => { - const execute = ga.plugin.execute; - const require = ga.plugin.require; - const payload = {}; - - execute('name', 'action', payload); - execute('name', 'action', 'type', payload); - require('name', {}); - }); - it("Able to make outboundLink calls", () => { - ga.outboundLink({label: 'string'}, () => {}); - }); -}); diff --git a/types/react-ga/tsconfig.json b/types/react-ga/tsconfig.json deleted file mode 100644 index e3bfb3b9b0..0000000000 --- a/types/react-ga/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "react-ga-tests.ts" - ] -} \ No newline at end of file diff --git a/types/react-ga/tslint.json b/types/react-ga/tslint.json deleted file mode 100644 index b1439230db..0000000000 --- a/types/react-ga/tslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-any-union": false - } -} From e152f40306fad8b812bdb021649556888ce41461 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 11:21:02 -0800 Subject: [PATCH 116/890] ss-utils: Provides its own types --- notNeededPackages.json | 6 ++ types/ss-utils/index.d.ts | 173 ------------------------------- types/ss-utils/ss-utils-tests.ts | 73 ------------- types/ss-utils/tsconfig.json | 24 ----- types/ss-utils/tslint.json | 79 -------------- 5 files changed, 6 insertions(+), 349 deletions(-) delete mode 100644 types/ss-utils/index.d.ts delete mode 100644 types/ss-utils/ss-utils-tests.ts delete mode 100644 types/ss-utils/tsconfig.json delete mode 100644 types/ss-utils/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4b6f20790b..f0b6d0f09d 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -750,6 +750,12 @@ "sourceRepoURL": "https://github.com/JMPerez/spotify-web-api-js", "asOfVersion": "0.21.0" }, + { + "libraryName": "ServiceStack Utils", + "typingsPackageName": "ss-utils", + "sourceRepoURL": "https://servicestack.net/", + "asOfVersion": "0.1.5" + }, { "libraryName": "striptags", "typingsPackageName": "striptags", diff --git a/types/ss-utils/index.d.ts b/types/ss-utils/index.d.ts deleted file mode 100644 index 3f99c785a3..0000000000 --- a/types/ss-utils/index.d.ts +++ /dev/null @@ -1,173 +0,0 @@ -// Type definitions for ServiceStack Utils v0.0.1 -// Project: https://servicestack.net/ -// Definitions by: Demis Bellot -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -declare namespace ssutils { - - interface Static { - handlers: { [index: string]: Function }; - onSubmitDisable: string; - validation: Validation; - clearAdjacentError: () => void; - todate: (s: string) => Date; - todfmt: (s: string) => string; - dfmt: (d: Date) => string; - dfmthm: (d: Date) => string; - tfmt12: (d: Date) => string; - splitOnFirst: (s: string, delimiter:string) => string[]; - splitOnLast: (s: string, delimiter: string) => string[]; - getSelection: () => string; - combinePaths: (...paths:string[]) => string; - queryString: (url: string) => { [index: string]: string }; - createPath: (route: string, args: any) => string; - createUrl: (route: string, args: any) => string; - humanize: (s: string) => string; - normalizeKey: (key: string) => string; - normalize: (dto: any, deep?:boolean) => any; - parseResponseStatus: (json: string, defaultMsg?: string) => any; - postJSON: (url: string, data: Object | String, success?: Function, error?: Function) => any; - - listenOn: string; - eventReceivers: any; - eventChannels: string[]; - eventSourceUrl: string; - updateSubscriberUrl: string; - updateChannels: (channels: string[]) => void; - updateSubscriber: (data: UpdateSubscriberOptions, cb?: (user: SSEUpdate) => void, cbError?: Function) => any; - subscribeToChannels: (channels: string[], cb?: (user: SSEUpdate) => void, cbError?: Function) => any; - unsubscribeFromChannels: (channels: string[], cb?: (user: SSEUpdate) => void, cbError?: Function) => any; - reconnectServerEvents: (opt: ReconnectServerEventsOptions) => any; - } - - interface Validation { - overrideMessages: boolean; - messages: { [index: string]: string }; - errorFilter: (errorMsg: string, errorCode: string, type: string) => void; - } - - interface ValidationOptional { - overrideMessages?: boolean; - messages?: { [index: string]: string }; - errorFilter?: (errorMsg: string, errorCode: string, type: string) => void; - } - - interface ApplyErrorsOptions extends ValidationOptional { - } - - interface BindFormOptions { - validation?: ValidationOptional; - validate?: (form: HTMLFormElement) => boolean; - onSubmitDisable?: string; - complete?: (...args: any[]) => void; - error?: (...args: any[]) => void; - } - - interface HandleServerEventsOptions { - handlers?: { [index: string]: Function }; - validate?: (op?: string, target?: string, msg?: string, json?: string) => boolean; - heartbeatUrl?: string; - heartbeatIntervalMs?: number; - unRegisterUrl?: string; - receivers?: { [index: string]: any }; - success?: (selector: string, msg: string, e: any) => void; - } - - interface UpdateSubscriberOptions { - SubscribeChannels?: string; - UnsubscribeChannels?: string; - } - - interface ResponseStatus { - errorCode: string; - message: string; - stackTrace: string; - errors: ResponseError[]; - } - interface ResponseError { - errorCode: string; - fieldName: string; - message: string; - } - - interface SSECommand { - userId: string; - displayName: string; - channels: string; - profileUrl: string; - } - - interface SSEHeartbeat extends SSECommand { } - interface SSEJoin extends SSECommand { } - interface SSELeave extends SSECommand { } - interface SSEUpdate extends SSECommand { } - - interface SSEConnect extends SSECommand { - id: string; - unRegisterUrl: string; - heartbeatUrl: string; - updateSubscriberUrl: string; - heartbeatIntervalMs: number; - idleTimeoutMs: number; - } - - interface ReconnectServerEventsOptions { - url?: string; - onerror?: (...args: any[]) => void; - onmessage?: (...args: any[]) => void; - errorArgs?: any[]; - } - - /** - * EventSource - */ - enum ReadyState { CONNECTING = 0, OPEN = 1, CLOSED = 2 } - - interface IEventSourceStatic extends EventTarget { - new (url: string, eventSourceInitDict?: IEventSourceInit): IEventSourceStatic; - url: string; - withCredentials: boolean; - CONNECTING: ReadyState; // constant, always 0 - OPEN: ReadyState; // constant, always 1 - CLOSED: ReadyState; // constant, always 2 - readyState: ReadyState; - onopen: Function; - onmessage: (event: IOnMessageEvent) => void; - onerror: Function; - close: () => void; - } - - interface IEventSourceInit { - withCredentials?: boolean; - } - - interface IOnMessageEvent { - data: string; - } -} - -//Needs to be declared locally -//declare var EventSource: ssutils.IEventSourceStatic; - -interface JQuery { - setFieldError: (name: string, msg: string) => void; - serializeMap: () => { [index: string]: any }; - applyErrors: (status: ssutils.ResponseStatus, opt?: ssutils.ApplyErrorsOptions) => JQuery; - clearErrors: () => JQuery; - bindForm: (opt?: ssutils.ApplyErrorsOptions) => JQuery; - applyValues: (values: { [index: string]: string }) => JQuery; - bindHandlers: (handlers: { [index: string]: Function }) => JQuery; - setActiveLinks: () => JQuery; - handleServerEvents: (opt?: ssutils.HandleServerEventsOptions) => void; -} - -interface JQueryStatic { - ss: ssutils.Static; -} - -declare module "ss-utils" { - export = ssutils; -} diff --git a/types/ss-utils/ss-utils-tests.ts b/types/ss-utils/ss-utils-tests.ts deleted file mode 100644 index 9bbd30da9a..0000000000 --- a/types/ss-utils/ss-utils-tests.ts +++ /dev/null @@ -1,73 +0,0 @@ -declare var EventSource : ssutils.IEventSourceStatic; - -function test_ssutils() { - $.ss.eventReceivers = { "document": document }; - - var source = new EventSource("/event-stream?channels=home,work"); - $(source).handleServerEvents({ - handlers: { - onConnect: function(connect:ssutils.SSEConnect) {}, - onHeartbeat: function(msg:ssutils.SSEHeartbeat, e:MessageEvent){}, - onJoin: function(msg:ssutils.SSEJoin) {}, - onLeave: function(msg:ssutils.SSELeave) {}, - onUpdate: function(msg:ssutils.SSEUpdate) {} - }, - receivers: { - tv: { - watch: function(){} - } - } - }); - - $(document).bindHandlers({ - announce: function (msg:string) {} - }) - .on('customEvent', function (e, msg, msgEvent) { }); - - $.ss.handlers["changeChannel"]("home"); -} - -function test_jQuery_functions(){ - $("document").setFieldError("name","message"); - var map = $("form").serializeMap(); - $("form").applyErrors({errorCode:"",message:"",stackTrace:"",errors:[]}); - $("form").clearErrors(); - $("form").bindForm({ - overrideMessages: true, - messages: {"NotFound": "Not Found"}, - errorFilter: function(errorMsg, errorCode, type){} - }); - $("form").applyValues({ - "Key": "Value" - }); - $("form").bindHandlers({ - "test": function() {} - }); -} - -function test_ssutils_Static(){ - $.ss.handlers["key"] = () => 0; - $.ss.onSubmitDisable = "class"; - $.ss.validation.messages["Code"] = "Message"; - $.ss.clearAdjacentError(); - var date:Date = $.ss.todate("2001-01-01"); - var dateFmt:String = $.ss.todfmt("2001-01-01"); - dateFmt = $.ss.dfmt(new Date(2001,1,1)); - dateFmt = $.ss.dfmthm(new Date(2001,1,1)); - dateFmt = $.ss.tfmt12(new Date(2001,1,1)); - var parts:string[] = $.ss.splitOnFirst("A;B;C",";"); - parts = $.ss.splitOnLast("A;B;C", ";"); - var selectedText = $.ss.getSelection(); - var qs:{ [index: string]: string } = $.ss.queryString("http://google.com?a=b&c=d"); - var relativePath = $.ss.createUrl("/path/to/{File}", {File:"file.js"}); - var readableText = $.ss.humanize("TheVariableName"); - $.ss.normalizeKey("aAa"); - $.ss.normalize({"AA":1,"bB":2,"C":{"A":11,"B":22},"D":[1,2],"E":[{"A":111,"B":222}]}); - $.ss.normalize({"AA":1,"bB":2,"C":{"A":11,"B":22},"D":[1,2],"E":[{"A":111,"B":222}]}, true); - $.ss.parseResponseStatus('{"message":"test"}'); - $.ss.postJSON("/path/to/url", {json:"data"}, function(r:any) {}); - - $.ss.listenOn = "click onmousedown"; - $.ss.eventReceivers = { "document": document }; - $.ss.handlers["changeChannel"]("home"); -} \ No newline at end of file diff --git a/types/ss-utils/tsconfig.json b/types/ss-utils/tsconfig.json deleted file mode 100644 index 1092eab097..0000000000 --- a/types/ss-utils/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "ss-utils-tests.ts" - ] -} \ No newline at end of file diff --git a/types/ss-utils/tslint.json b/types/ss-utils/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/ss-utils/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 94477b3e5719487d196a2c1ac94277d7c5d9569f Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 11:31:06 -0800 Subject: [PATCH 117/890] svg-pan-zoom: Provides its own types --- notNeededPackages.json | 6 + types/svg-pan-zoom/index.d.ts | 213 ----------------------- types/svg-pan-zoom/svg-pan-zoom-tests.ts | 113 ------------ types/svg-pan-zoom/tsconfig.json | 24 --- types/svg-pan-zoom/tslint.json | 79 --------- types/svg-pan-zoom/v2/index.d.ts | 151 ---------------- types/svg-pan-zoom/v2/tsconfig.json | 28 --- types/svg-pan-zoom/v2/tslint.json | 79 --------- 8 files changed, 6 insertions(+), 687 deletions(-) delete mode 100644 types/svg-pan-zoom/index.d.ts delete mode 100644 types/svg-pan-zoom/svg-pan-zoom-tests.ts delete mode 100644 types/svg-pan-zoom/tsconfig.json delete mode 100644 types/svg-pan-zoom/tslint.json delete mode 100644 types/svg-pan-zoom/v2/index.d.ts delete mode 100644 types/svg-pan-zoom/v2/tsconfig.json delete mode 100644 types/svg-pan-zoom/v2/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4b6f20790b..8a05308a69 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -762,6 +762,12 @@ "sourceRepoURL": "https://github.com/andrewplummer/Sugar", "asOfVersion": "2.0.2" }, + { + "libraryName": "svg-pan-zoom", + "typingsPackageName": "svg-pan-zoom", + "sourceRepoURL": "https://github.com/ariutta/svg-pan-zoom", + "asOfVersion": "3.4.0" + }, { "libraryName": "svg.js", "typingsPackageName": "svg.js", diff --git a/types/svg-pan-zoom/index.d.ts b/types/svg-pan-zoom/index.d.ts deleted file mode 100644 index aacf5a5d0a..0000000000 --- a/types/svg-pan-zoom/index.d.ts +++ /dev/null @@ -1,213 +0,0 @@ -// Type definitions for svg-pan-zoom v3.3.0 -// Project: https://github.com/ariutta/svg-pan-zoom -// Definitions by: César Vidril -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace SvgPanZoom { - interface Options { - viewportSelector?: string|HTMLElement|SVGElement; // can be querySelector string or SVGElement (default enabled) - panEnabled?: boolean; // enable or disable panning (default enabled) - controlIconsEnabled?: boolean; // insert icons to give user an option in addition to mouse events to control pan/zoom (default disabled) - zoomEnabled?: boolean; // enable or disable zooming (default enabled) - dblClickZoomEnabled?: boolean; // enable or disable zooming by double clicking (default enabled) - mouseWheelZoomEnabled?: boolean; // (default enabled) - preventMouseEventsDefault?: boolean; // (default enabled) - zoomScaleSensitivity?: number; // Zoom sensitivity (Default 0.2) - minZoom?: number; // Minimum Zoom level (Default 0.5) - maxZoom?: number; // Maximum Zoom level (Default 10) - fit?: boolean; // enable or disable viewport fit in SVG (default true) - contain?: boolean; // (default true) - center?: boolean; // enable or disable viewport centering in SVG (default true) - refreshRate?: number | 'auto'; // (default 'auto') - beforeZoom?: (oldScale:number, newScale:number) => boolean; - onZoom?: (newScale:number) => void; - beforePan?: (oldPan:Point, newPan:Point) => boolean | PointModifier; - onPan?: (newPan:Point) => void; - customEventsHandler?: CustomEventHandler; // (default null) - eventsListenerElement?: SVGElement; // (default null) - } - - interface CustomEventHandler { - haltEventListeners: string[], - init: (options: CustomEventOptions) => void, - destroy: Function - } - - interface CustomEventOptions { - svgElement: SVGSVGElement, - instance: Instance - } - - interface Point { - x: number; - y: number; - } - - interface PointModifier { - x: number|boolean; - y: number|boolean; - } - - interface Instance { - /** - * Creates a new SvgPanZoom instance with given element selector. - * - * @param {string|HTMLElement|SVGElement} svg selector of the tag on which it is to be applied. - * @param {Object} options provides customization options at the initialization of the object. - * @return {Instance} Current instance - */ - (svg:string|HTMLElement|SVGElement, options?:Options): Instance; - - /** - * Enables Panning on svg element - * @return {Instance} Current instance - */ - enablePan(): Instance; - - /** - * Disables panning on svg element - * @return {Instance} Current instance - */ - disablePan(): Instance; - - /** - * Checks if Panning is enabled or not - * @return {Boolean} true or false based on panning settings - */ - isPanEnabled(): boolean; - - setBeforePan(fn: (point:Point)=> void): Instance; - - setOnPan(fn: (x:number, y:number)=> void): Instance; - - /** - * Pan to a rendered position - * - * @param {Object} point {x: 0, y: 0} - * @return {Instance} Current instance - */ - pan(point: Point): Instance; - - /** - * Relatively pan the graph by a specified rendered position vector - * - * @param {Object} point {x: 0, y: 0} - * @return {Instance} Current instance - */ - panBy(point: Point): Instance; - - /** - * Get pan vector - * - * @return {Object} {x: 0, y: 0} - * @return {Instance} Current instance - */ - getPan(): Point; - - resetPan(): Instance; - - enableZoom(): Instance; - - disableZoom(): Instance; - - isZoomEnabled(): boolean; - - enableControlIcons(): Instance; - - disableControlIcons(): Instance; - - isControlIconsEnabled(): boolean; - - enableDblClickZoom(): Instance; - - disableDblClickZoom(): Instance; - - isDblClickZoomEnabled(): boolean; - - enableMouseWheelZoom(): Instance; - - disableMouseWheelZoom(): Instance; - - isMouseWheelZoomEnabled(): boolean; - - setZoomScaleSensitivity(scale: number): Instance; - - setMinZoom(zoom: number): Instance; - - setMaxZoom(zoom: number): Instance; - - setBeforeZoom(fn: (scale: number) => void): Instance; - - setOnZoom(fn: (scale: number) => void): Instance; - - zoom(scale: number):void; - - zoomIn(): Instance; - - zoomOut(): Instance; - - zoomBy(scale: number): Instance; - - zoomAtPoint(scale:number, point:Point): Instance; - - zoomAtPointBy(scale:number, point:Point): Instance; - - resetZoom(): Instance; - - /** - * Get zoom scale/level - * - * @return {float} zoom scale - */ - getZoom(): number; - - /** - * Adjust viewport size (only) so it will fit in SVG - * Does not center image - * - * @return {Instance} Current instance - */ - fit(): Instance; - - /** - * Adjust viewport size (only) so it will contain in SVG - * Does not center image - * - * @return {Instance} Current instance - */ - contain(): Instance; - - /** - * Adjust viewport pan (only) so it will be centered in SVG - * Does not zoom/fit image - * - * @return {Instance} Current instance - */ - center(): Instance; - - /** - * Recalculates cached svg dimensions and controls position - * - * @return {Instance} Current instance - */ - resize(): Instance; - - reset(): Instance; - - /** - * Update content cached BorderBox - * Use when viewport contents change - * - * @return {Instance} Current instance - */ - updateBBox(): Instance; - - destroy(): void; - } -} - -declare const svgPanZoom:SvgPanZoom.Instance; - -declare module 'svg-pan-zoom' { - export = svgPanZoom; -} diff --git a/types/svg-pan-zoom/svg-pan-zoom-tests.ts b/types/svg-pan-zoom/svg-pan-zoom-tests.ts deleted file mode 100644 index 317bb2149d..0000000000 --- a/types/svg-pan-zoom/svg-pan-zoom-tests.ts +++ /dev/null @@ -1,113 +0,0 @@ -var svgPanZoomOptions : SvgPanZoom.Options = { - panEnabled: true // enable or disable panning (default enabled) - , controlIconsEnabled: false // insert icons to give user an option in addition to mouse events to control pan/zoom (default disabled) - , zoomEnabled: true // enable or disable zooming (default enabled) - , dblClickZoomEnabled: true // enable or disable zooming by double clicking (default enabled) - , zoomScaleSensitivity: 0.2 // Zoom sensitivity - , minZoom: 0.5 // Minimum Zoom level - , maxZoom: 10 // Maximum Zoom level - , fit: true // enable or disable viewport fit in SVG (default true) - , center: true // enable or disable viewport centering in SVG (default true) - , beforeZoom: null - , onZoom: function(){} - , beforePan: null - , onPan: function(){} - , refreshRate: 60 // in hz -}; - -var panZoomTiger: SvgPanZoom.Instance = svgPanZoom('#demo-tiger'); - -var svgElement = document.querySelector('#demo-tiger'); -panZoomTiger = svgPanZoom(svgElement); - -panZoomTiger = svgPanZoom('#demo-tiger', { - panEnabled: true - , controlIconsEnabled: false - , zoomEnabled: true - , dblClickZoomEnabled: true - , mouseWheelZoomEnabled: true - , preventMouseEventsDefault: true - , zoomScaleSensitivity: 0.2 - , minZoom: 0.5 - , maxZoom: 10 - , fit: true - , contain: false - , center: true - , refreshRate: 'auto' - , beforeZoom: function(oldScale, newScale){ return true; } - , onZoom: function(newScale){} - , beforePan: function(oldPan, newPan){ return {x: true, y: true}; } - , customEventsHandler: null - , eventsListenerElement: null -}); - -/** - * PAN - */ -// Pan to rendered point x = 50, y = 50 -panZoomTiger.pan({x: 50, y: 50}); - -// Pan by x = 50, y = 50 of rendered pixels -panZoomTiger.panBy({x: 50, y: 50}); - -panZoomTiger.getPan(); - -panZoomTiger.resetPan(); - -panZoomTiger.enablePan(); -panZoomTiger.disablePan(); - -panZoomTiger.isPanEnabled(); - -/** - * ZOOM - */ -// Set zoom level to 2 -panZoomTiger.zoom(2); - -// Zoom by 130% -panZoomTiger.zoomBy(1.3); - -// Set zoom level to 2 at point -panZoomTiger.zoomAtPoint(2, {x: 50, y: 50}); - -// Zoom by 130% at point -panZoomTiger.zoomAtPointBy(1.3, {x: 50, y: 50}); - -panZoomTiger.zoomIn(); -panZoomTiger.zoomOut(); - -panZoomTiger.getZoom(); - -panZoomTiger.resetZoom(); - -panZoomTiger.enableZoom(); -panZoomTiger.disableZoom(); - -panZoomTiger.isZoomEnabled(); - -/** - * controls - */ -panZoomTiger.enableControlIcons(); -panZoomTiger.disableControlIcons(); -panZoomTiger.isControlIconsEnabled(); - -panZoomTiger.enableDblClickZoom(); -panZoomTiger.disableDblClickZoom(); -panZoomTiger.isDblClickZoomEnabled(); - -panZoomTiger.enableMouseWheelZoom(); -panZoomTiger.disableMouseWheelZoom(); -panZoomTiger.isMouseWheelZoomEnabled(); - -panZoomTiger.center(); -panZoomTiger.fit(); -panZoomTiger.contain(); - -panZoomTiger.resize(); // update SVG cached size and controls positions -panZoomTiger.updateBBox(); - -panZoomTiger.fit().center(); // can chain method - -panZoomTiger.destroy(); // destroy instance diff --git a/types/svg-pan-zoom/tsconfig.json b/types/svg-pan-zoom/tsconfig.json deleted file mode 100644 index c304d09b35..0000000000 --- a/types/svg-pan-zoom/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "svg-pan-zoom-tests.ts" - ] -} \ No newline at end of file diff --git a/types/svg-pan-zoom/tslint.json b/types/svg-pan-zoom/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/svg-pan-zoom/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/svg-pan-zoom/v2/index.d.ts b/types/svg-pan-zoom/v2/index.d.ts deleted file mode 100644 index 92b1ffeaa5..0000000000 --- a/types/svg-pan-zoom/v2/index.d.ts +++ /dev/null @@ -1,151 +0,0 @@ -// Type definitions for svg-pan-zoom v2.3.9 -// Project: https://github.com/ariutta/svg-pan-zoom -// Definitions by: Chintan Shah -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace SvgPanZoom { - - interface OptionConfig { - panEnabled?: boolean; // enable or disable panning (default enabled) - controlIconsEnabled?: boolean; // insert icons to give user an option in addition to mouse events to control pan/zoom (default disabled) - zoomEnabled?: boolean; // enable or disable zooming (default enabled) - dblClickZoomEnabled?: boolean; // enable or disable zooming by double clicking (default enabled) - zoomScaleSensitivity?: number; // Zoom sensitivity - minZoom?: number; // Minimum Zoom level - maxZoom?: number; // Maximum Zoom level - fit?: boolean; // enable or disable viewport fit in SVG (default true) - center?: boolean; // enable or disable viewport centering in SVG (default true) - beforeZoom?: (scale:number) => void; - onZoom?: (scale:number) => void; - beforePan?: (point:IPoint) => void; - onPan?: (x:number, y:number) => void; - refreshRate?: any; // in hz - } - - interface IPoint { - x: number; - y: number; - } - - interface ISvgPanZoom { - /** - * Creates a new SvgPanZoom instance with given element selector. - * - * @param svg selector of the tag on which it is to be applied. - * @param options provides customization options at the initialization of the object. - */ - (svg:any, options?:OptionConfig): ISvgPanZoom; - - /** - * Enables Panning on svg element - */ - enablePan(): void; - - /** - * Disables panning on svg element - */ - disablePan(): void; - - /** - * Checks if Panning is enabled or not - * @return true or false based on panning settings - */ - isPanEnabled(): boolean; - - - setBeforePan(fn: (point:IPoint)=> void): void; - - setOnPan(fn: (x:number, y:number)=> void): void; - - enableZoom(): void; - - disableZoom(): void; - - isZoomEnabled(): boolean; - - enableControlIcons(): void; - - disableControlIcons(): void; - - isControlIconsEnabled(): boolean; - - enableDblClickZoom(): void; - - disableDblClickZoom(): void; - - setZoomScaleSensitivity(scale: number): void; - - setMinZoom(zoom: number): void; - - setMaxZoom(zoom: number): void; - - setBeforeZoom(fn: (scale: number) => void): void; - - setOnZoom(fn: (scale: number) => void): void; - - zoom(scale: number):void; - - zoomIn(): void; - - zoomOut(): void; - - zoomBy(scale: number): void; - - resetZoom(): void; - - /** - * Get zoom scale/level - * - * @return {float} zoom scale - */ - getZoom(): number; - - /** - * Adjust viewport size (only) so it will fit in SVG - * Does not center image - * - * @param {bool} dropCache drop viewBox cache and recalculate SVG's viewport sizes. Default false - */ - fit(dropCache?: boolean): void; - - /** - * Adjust viewport pan (only) so it will be centered in SVG - * Does not zoom/fit image - * - * @param {bool} dropCache drop viewBox cache and recalculate SVG's viewport sizes. Default false - */ - center(dropCache?: boolean): void; - - /** - * Recalculates cached svg dimensions and controls position - */ - resize(): void; - - /** - * Pan to a rendered position - * - * @param {object} point {x: 0, y: 0} - */ - pan(point: IPoint): void; - - /** - * Relatively pan the graph by a specified rendered position vector - * - * @param {object} point {x: 0, y: 0} - */ - panBy(point: IPoint): void; - - /** - * Get pan vector - * - * @return {object} {x: 0, y: 0} - */ - getPan(): IPoint; - - zoomAtPoint(scale:number, point:IPoint): boolean; - - zoomAtPointBy(scale:number, point:IPoint): boolean; - } -} - -declare var svgPanZoom:SvgPanZoom.ISvgPanZoom; diff --git a/types/svg-pan-zoom/v2/tsconfig.json b/types/svg-pan-zoom/v2/tsconfig.json deleted file mode 100644 index 67cb4d7679..0000000000 --- a/types/svg-pan-zoom/v2/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "types": [], - "paths": { - "svg-pan-zoom": [ - "svg-pan-zoom/v2" - ] - }, - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts" - ] -} \ No newline at end of file diff --git a/types/svg-pan-zoom/v2/tslint.json b/types/svg-pan-zoom/v2/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/svg-pan-zoom/v2/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 89d13bb7ab15efbd9f939fd68efd8d4ed78a3e3b Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 11:34:12 -0800 Subject: [PATCH 118/890] sweetalert: Provides its own types --- notNeededPackages.json | 6 + types/sweetalert/index.d.ts | 230 --------------------------- types/sweetalert/sweetalert-tests.ts | 117 -------------- types/sweetalert/tsconfig.json | 24 --- types/sweetalert/tslint.json | 79 --------- 5 files changed, 6 insertions(+), 450 deletions(-) delete mode 100644 types/sweetalert/index.d.ts delete mode 100644 types/sweetalert/sweetalert-tests.ts delete mode 100644 types/sweetalert/tsconfig.json delete mode 100644 types/sweetalert/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4b6f20790b..4546d54683 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -774,6 +774,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/swap-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "SweetAlert", + "typingsPackageName": "sweetalert", + "sourceRepoURL": "https://github.com/t4t5/sweetalert/", + "asOfVersion": "2.0.4" + }, { "libraryName": "Tabris.js", "typingsPackageName": "tabris", diff --git a/types/sweetalert/index.d.ts b/types/sweetalert/index.d.ts deleted file mode 100644 index bb7e135e0a..0000000000 --- a/types/sweetalert/index.d.ts +++ /dev/null @@ -1,230 +0,0 @@ -// Type definitions for SweetAlert 1.1.3 -// Project: https://github.com/t4t5/sweetalert/ -// Definitions by: Markus Peloso -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare var sweetAlert: SweetAlert.SweetAlertStatic; -declare var swal: SweetAlert.SweetAlertStatic; - -declare module "sweetalert" { - export = swal; -} - -declare namespace SweetAlert { - type AlertType = "warning" | "error" | "success" | "info"; - - type PromtType = "input" | "prompt"; - - interface SettingsBase { - /** - * A description for the modal. - * Default: null - */ - text?: string; - - /** - * If set to true, the user can dismiss the modal by pressing the Escape key. - * Default: true - */ - allowEscapeKey?: boolean; - - /** - * A custom CSS class for the modal. - * Default: null - */ - customClass?: string; - - /** - * If set to true, the user can dismiss the modal by clicking outside it. - * Default: false - */ - allowOutsideClick?: boolean; - - /** - * If set to true, a "Cancel"-button will be shown, which the user can click on to dismiss the modal. - * Default: false - */ - showCancelButton?: boolean; - - /** - * If set to false, the "OK/Confirm"-button will be hidden. Make sure you set a timer or set allowOutsideClick to true when using this, in order not to annoy the user. - * Default: true - */ - showConfirmButton?: boolean; - - /** - * Use this to change the text on the "Confirm"-button. If showCancelButton is set as true, the confirm button will automatically show "Confirm" instead of "OK". - * Default: "OK" - */ - confirmButtonText?: string; - - /** - * Use this to change the background color of the "Confirm"-button (must be a HEX value). - * Default: "#8CD4F5" - */ - confirmButtonColor?: string; - - /** - * Use this to change the text on the "Cancel"-button. - * Default: "Cancel" - */ - cancelButtonText?: string; - - /** - * Set to false if you want the modal to stay open even if the user presses the "Confirm"-button. This is especially useful if the function attached to the "Confirm"-button is another SweetAlert. - * Default: true - */ - closeOnConfirm?: boolean; - - /** - * Set to false if you want the modal to stay open even if the user presses the "Cancel"-button. This is especially useful if the function attached to the "Cancel"-button is another SweetAlert. - * Default: true - */ - closeOnCancel?: boolean; - - /** - * Add a customized icon for the modal.Should contain a string with the path to the image. - * Default: null - */ - imageUrl?: string; - - /** - * If imageUrl is set, you can specify imageSize to describes how big you want the icon to be in px. Pass in a string with two values separated by an "x". The first value is the width, the second is the height. - * Default: "80x80" - */ - imageSize?: string; - - /** - * Auto close timer of the modal. Set in ms (milliseconds). - * Default: null - */ - timer?: number; - - /** - * If set to true, will not escape title and text parameters. (Set to false if you're worried about XSS attacks.) - * Default: false - */ - html?: boolean; - - /** - * If set to false, the modal's animation will be disabled. Possible animations: "slide-from-top", "slide-from-bottom", "pop" (use true instead) and "none" (use false instead). - * Default: true - */ - animation?: boolean | "slide-from-top" | "slide-from-bottom" | "pop" | "none" | string; - - /** - * Set to true to disable the buttons and show that something is loading. - * Default: false - */ - showLoaderOnConfirm?: boolean; - } - - interface AlertModalSettings extends SettingsBase { - /** - * The type of the modal. SweetAlert comes with 4 built-in types which will show a corresponding icon animation: "warning", "error", "success" and "info". You can also set it as "input" to get a prompt modal. - * Default: null - */ - type?: AlertType; - } - - interface PromtModalSettings extends SettingsBase { - /** - * The type of the modal. SweetAlert comes with 4 built-in types which will show a corresponding icon animation: "warning", "error", "success" and "info". You can also set it as "input" to get a prompt modal. - * Default: null - */ - type?: PromtType; - - /** - * Change the type of the input field when using type: "input" (this can be useful if you want users to type in their password for example). - * Default: "text" - */ - inputType?: string; - - /** - * When using the input-type, you can specify a placeholder to help the user. - * Default: null - */ - inputPlaceholder?: string; - - /** - * Specify a default text value that you want your input to show when using type: "input" - * Default: null - */ - inputValue?: string; - } - - interface Settings { - /** - * The title of the modal. - */ - title: string; - } - - interface SetDefaultsSettings { - /** - * The title of the modal. - * Default: null - */ - title?: string; - } - - interface SweetAlertStatic { - /** - * SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert. - * @param title The title of the modal. - */ - (title: string): void; - - /** - * SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert. - * @param title The title of the modal. - * @param text A description for the modal. - */ - (title: string, text: string): void; - - /** - * SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert. - * @param title The title of the modal. - * @param text A description for the modal. - * @param type The type of the modal. SweetAlert comes with 4 built-in types which will show a corresponding icon animation: "warning", "error", "success" and "info". You can also set it as "input" to get a prompt modal. - */ - (title: string, text: string, type: AlertType | PromtType): void; - - /** - * SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert. - * @param callback The callback from the users action. The value is true or false if the user confirms or cancels the alert. - */ - (settings: Settings & AlertModalSettings, callback?: (isConfirm: boolean) => any): void; - - /** - * SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert. - * @param callback The callback from the users action. When the user confirms the prompt, the argument contains the value of the input element. When the user cancels the prompt, the argument is false. - */ - (settings: Settings & PromtModalSettings, callback?: (isConfirmOrInputValue: boolean | string) => any): void; - - /** - * If you end up using a lot of the same settings when calling SweetAlert, you can use setDefaults at the start of your program to set them once and for all! - */ - setDefaults(settings: SetDefaultsSettings & AlertModalSettings & PromtModalSettings): void; - - /** - * Close the currently open SweetAlert programmatically. - */ - close(): void; - - /** - * Show an error message after validating the input field, if the user's data is bad. - */ - showInputError(errorMessage: string): void; - - /** - * Enable the user to click on the cancel and confirm buttons. - */ - enableButtons(): void; - - /** - * Disable the user to click on the cancel and confirm buttons. - */ - disableButtons(): void; - } -} diff --git a/types/sweetalert/sweetalert-tests.ts b/types/sweetalert/sweetalert-tests.ts deleted file mode 100644 index d309dacf8d..0000000000 --- a/types/sweetalert/sweetalert-tests.ts +++ /dev/null @@ -1,117 +0,0 @@ - - -// A basic message -swal("Here's a message!"); - -// A title with a text under -swal("Here's a message!", "It's pretty, isn't it?"); - -// A success message! -swal("Good job!", "You clicked the button!", "success"); - -// A warning message, with a function attached to the "Confirm"-button... -swal({ - title: "Are you sure?", - text: "You will not be able to recover this imaginary file!", - type: "warning", - showCancelButton: true, - confirmButtonColor: "#DD6B55", - confirmButtonText: "Yes, delete it!", - closeOnConfirm: false -}, - function () { - swal("Deleted!", "Your imaginary file has been deleted.", "success"); - }); - -// ... and by passing a parameter, you can execute something else for "Cancel". -swal({ - title: "Are you sure?", - text: "You will not be able to recover this imaginary file!", - type: "warning", - showCancelButton: true, - confirmButtonColor: "#DD6B55", - confirmButtonText: "Yes, delete it!", - cancelButtonText: "No, cancel plx!", - closeOnConfirm: false, - closeOnCancel: false -}, - function (isConfirm) { - if (isConfirm) { - swal("Deleted!", "Your imaginary file has been deleted.", "success"); - } else { - swal("Cancelled", "Your imaginary file is safe :)", "error"); - } - }); - -// A message with a custom icon -swal({ - title: "Sweet!", - text: "Here's a custom image.", - imageUrl: "images/thumbs-up.jpg" -}); - -// An HTML message -swal({ - title: "HTML Title!", - text: "A custom html message.", - html: true -}); - -// A message with auto close timer -swal({ - title: "Auto close alert!", - text: "I will close in 2 seconds.", - timer: 2000, - showConfirmButton: false -}, - function () { - swal("Time Out!", "The time is out of joint.", "success"); - }); - -// A replacement for the "prompt" function -swal({ - title: "An input!", - text: "Write something interesting:", - type: "input", - showCancelButton: true, - closeOnConfirm: false, - animation: "slide-from-top", - inputPlaceholder: "Write something plx", - inputValue: "Write something" -}, - function (inputValue) { - if (inputValue === false) return false; - - if (inputValue === "") { - swal.showInputError("You need to write something!"); - return false; - } - - swal("Nice!", "You wrote: " + inputValue, "success"); - } - ); - -// With a loader (for AJAX request for example) -swal({ - title: "Ajax request example", - text: "Submit to run ajax request", - type: "info", - showCancelButton: true, - closeOnConfirm: false, - showLoaderOnConfirm: true -}, - function () { - setTimeout(function () { - swal("Ajax request finished!"); - }, 2000); - }); - -swal.setDefaults({ confirmButtonColor: "#000000" }); - -swal.close(); - -swal.showInputError("Invalid email!"); - -swal.disableButtons(); - -swal.enableButtons(); \ No newline at end of file diff --git a/types/sweetalert/tsconfig.json b/types/sweetalert/tsconfig.json deleted file mode 100644 index a7294d8385..0000000000 --- a/types/sweetalert/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "sweetalert-tests.ts" - ] -} \ No newline at end of file diff --git a/types/sweetalert/tslint.json b/types/sweetalert/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/sweetalert/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 84a68824532d6addbed03037e8b1a01aa43b4a2b Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 11:43:04 -0800 Subject: [PATCH 119/890] anydb-sql-migrations: Provides its own types --- notNeededPackages.json | 6 ++ .../anydb-sql-migrations-tests.ts | 15 ---- types/anydb-sql-migrations/index.d.ts | 30 ------- types/anydb-sql-migrations/package.json | 6 -- types/anydb-sql-migrations/tsconfig.json | 23 ------ types/anydb-sql-migrations/tslint.json | 79 ------------------- 6 files changed, 6 insertions(+), 153 deletions(-) delete mode 100644 types/anydb-sql-migrations/anydb-sql-migrations-tests.ts delete mode 100644 types/anydb-sql-migrations/index.d.ts delete mode 100644 types/anydb-sql-migrations/package.json delete mode 100644 types/anydb-sql-migrations/tsconfig.json delete mode 100644 types/anydb-sql-migrations/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4b6f20790b..2d2bed17c9 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -42,6 +42,12 @@ "sourceRepoURL": "https://github.com/doxout/anydb-sql", "asOfVersion": "0.6.46" }, + { + "libraryName": "anydb-sql-migrations", + "typingsPackageName": "anydb-sql-migrations", + "sourceRepoURL": "https://github.com/spion/anydb-sql-migrations", + "asOfVersion": "2.1.1" + }, { "libraryName": "apn", "typingsPackageName": "apn", diff --git a/types/anydb-sql-migrations/anydb-sql-migrations-tests.ts b/types/anydb-sql-migrations/anydb-sql-migrations-tests.ts deleted file mode 100644 index ed79ace368..0000000000 --- a/types/anydb-sql-migrations/anydb-sql-migrations-tests.ts +++ /dev/null @@ -1,15 +0,0 @@ -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(); -} diff --git a/types/anydb-sql-migrations/index.d.ts b/types/anydb-sql-migrations/index.d.ts deleted file mode 100644 index f6e12ed752..0000000000 --- a/types/anydb-sql-migrations/index.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Type definitions for anydb-sql-migrations -// Project: https://github.com/spion/anydb-sql-migrations -// Definitions by: Gorgi Kosev -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import Promise = require('bluebird'); -import { Column, Table, Transaction, AnydbSql } from 'anydb-sql'; -export interface Migration { - version: string; -} -export interface MigrationsTable extends Table { - version: Column; -} -export interface MigFn { - (tx: Transaction): Promise; -} -export interface MigrationTask { - up: MigFn; - down: MigFn; - name: string; -} -export declare function create(db: AnydbSql, tasks: string | MigrationTask[]): { - run: () => Promise; - migrateTo: (target?: string) => Promise; - check: (f: (m: { - type: string; - items: MigrationTask[]; - }) => any) => Promise; -}; diff --git a/types/anydb-sql-migrations/package.json b/types/anydb-sql-migrations/package.json deleted file mode 100644 index 9b88fd6822..0000000000 --- a/types/anydb-sql-migrations/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "anydb-sql": "^0.6.53" - } -} diff --git a/types/anydb-sql-migrations/tsconfig.json b/types/anydb-sql-migrations/tsconfig.json deleted file mode 100644 index 33bb5ae800..0000000000 --- a/types/anydb-sql-migrations/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "anydb-sql-migrations-tests.ts" - ] -} \ No newline at end of file diff --git a/types/anydb-sql-migrations/tslint.json b/types/anydb-sql-migrations/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/anydb-sql-migrations/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 6fa92bf68822255de2ce57fd7c2b1c3bb4443add Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 11:45:39 -0800 Subject: [PATCH 120/890] applicationinsights: Provides its own types --- notNeededPackages.json | 6 + .../applicationinsights-tests.ts | 30 -- types/applicationinsights/index.d.ts | 490 ------------------ types/applicationinsights/tsconfig.json | 24 - types/applicationinsights/tslint.json | 79 --- 5 files changed, 6 insertions(+), 623 deletions(-) delete mode 100644 types/applicationinsights/applicationinsights-tests.ts delete mode 100644 types/applicationinsights/index.d.ts delete mode 100644 types/applicationinsights/tsconfig.json delete mode 100644 types/applicationinsights/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4b6f20790b..0faf1f0534 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -48,6 +48,12 @@ "sourceRepoURL": "https://github.com/node-apn/node-apn", "asOfVersion": "2.1.2" }, + { + "libraryName": "Application Insights", + "typingsPackageName": "applicationinsights", + "sourceRepoURL": "https://github.com/Microsoft/ApplicationInsights-node.js", + "asOfVersion": "0.20.0" + }, { "libraryName": "Argon2", "typingsPackageName": "argon2", diff --git a/types/applicationinsights/applicationinsights-tests.ts b/types/applicationinsights/applicationinsights-tests.ts deleted file mode 100644 index 00c303eff4..0000000000 --- a/types/applicationinsights/applicationinsights-tests.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as appInsights from "applicationinsights"; - -// basic use -appInsights.setup("").start(); - -// basic use with auto-collection configuration -appInsights.setup("") - .setAutoCollectRequests(false) - .setAutoCollectPerformance(false) - .setAutoCollectExceptions(false) - // no telemetry will be sent until .start() is called - // this prevents any of the auto-collectors from initializing - .enableVerboseLogging() - .start(); - -appInsights.client.trackEvent("custom event", {customProperty: "custom property value"}); -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 = { - environment: "dev" -}; - -// send any pending data and log the response -appInsights.client.sendPendingData(function (response) { - console.log(response); -}); diff --git a/types/applicationinsights/index.d.ts b/types/applicationinsights/index.d.ts deleted file mode 100644 index 471089a96f..0000000000 --- a/types/applicationinsights/index.d.ts +++ /dev/null @@ -1,490 +0,0 @@ -// Type definitions for Application Insights v0.15.12 -// Project: https://github.com/Microsoft/ApplicationInsights-node.js -// Definitions by: Scott Southwood -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface AutoCollectConsole { - constructor(client: Client): AutoCollectConsole; - enable(isEnabled: boolean): void; - isInitialized(): boolean; -} - -interface AutoCollectExceptions { - constructor(client:Client): AutoCollectExceptions; - isInitialized(): boolean; - enable(isEnabled:boolean): void; -} - -interface AutoCollectPerformance { - constructor(client: Client): AutoCollectPerformance; - enable(isEnabled: boolean): void; - isInitialized(): boolean; -} - -interface AutoCollectRequests { - constructor(client: Client): AutoCollectRequests; - enable(isEnabled: boolean): void; - isInitialized(): boolean; -} - - -declare namespace ContractsModule { - enum DataPointType { - Measurement = 0, - Aggregation = 1, - } - enum DependencyKind { - SQL = 0, - Http = 1, - Other = 2, - } - enum DependencySourceType { - Undefined = 0, - Aic = 1, - Apmc = 2, - } - enum SessionState { - Start = 0, - End = 1, - } - enum SeverityLevel { - Verbose = 0, - Information = 1, - Warning = 2, - Error = 3, - Critical = 4, - } - interface ContextTagKeys { - applicationVersion: string; - applicationBuild: string; - deviceId: string; - deviceIp: string; - deviceLanguage: string; - deviceLocale: string; - deviceModel: string; - deviceNetwork: string; - deviceOEMName: string; - deviceOS: string; - deviceOSVersion: string; - deviceRoleInstance: string; - deviceRoleName: string; - deviceScreenResolution: string; - deviceType: string; - deviceMachineName: string; - locationIp: string; - operationId: string; - operationName: string; - operationParentId: string; - operationRootId: string; - operationSyntheticSource: string; - operationIsSynthetic: string; - sessionId: string; - sessionIsFirst: string; - sessionIsNew: string; - userAccountAcquisitionDate: string; - userAccountId: string; - userAgent: string; - userId: string; - userStoreRegion: string; - sampleRate: string; - internalSdkVersion: string; - internalAgentVersion: string; - constructor(): ContextTagKeys; - } - interface Domain { - ver: number; - properties: any; - constructor(): Domain; - } - interface Data { - baseType: string; - baseData: TDomain; - constructor(): Data; - } - interface Envelope { - ver: number; - name: string; - time: string; - sampleRate: number; - seq: string; - iKey: string; - flags: number; - deviceId: string; - os: string; - osVer: string; - appId: string; - appVer: string; - userId: string; - tags: { - [key: string]: string; - }; - data: Data; - constructor(): Envelope; - } - interface EventData extends ContractsModule.Domain { - ver: number; - name: string; - properties: any; - measurements: any; - constructor(): EventData; - } - interface MessageData extends ContractsModule.Domain { - ver: number; - message: string; - severityLevel: ContractsModule.SeverityLevel; - properties: any; - constructor(): MessageData; - } - interface ExceptionData extends ContractsModule.Domain { - ver: number; - handledAt: string; - exceptions: ExceptionDetails[]; - severityLevel: ContractsModule.SeverityLevel; - problemId: string; - crashThreadId: number; - properties: any; - measurements: any; - constructor(): ExceptionData; - } - interface StackFrame { - level: number; - method: string; - assembly: string; - fileName: string; - line: number; - constructor(): StackFrame; - } - interface ExceptionDetails { - id: number; - outerId: number; - typeName: string; - message: string; - hasFullStack: boolean; - stack: string; - parsedStack: StackFrame[]; - constructor(): ExceptionDetails; - } - interface DataPoint { - name: string; - kind: ContractsModule.DataPointType; - value: number; - count: number; - min: number; - max: number; - stdDev: number; - constructor(): DataPoint; - } - interface MetricData extends ContractsModule.Domain { - ver: number; - metrics: DataPoint[]; - properties: any; - constructor(): MetricData; - } - interface PageViewData extends ContractsModule.EventData { - ver: number; - url: string; - name: string; - duration: string; - properties: any; - measurements: any; - constructor(): PageViewData; - } - interface PageViewPerfData extends ContractsModule.PageViewData { - ver: number; - url: string; - perfTotal: string; - name: string; - duration: string; - networkConnect: string; - sentRequest: string; - receivedResponse: string; - domProcessing: string; - properties: any; - measurements: any; - constructor(): PageViewPerfData; - } - interface RemoteDependencyData extends ContractsModule.Domain { - ver: number; - name: string; - kind: ContractsModule.DataPointType; - value: number; - count: number; - min: number; - max: number; - stdDev: number; - dependencyKind: ContractsModule.DependencyKind; - success: boolean; - async: boolean; - dependencySource: ContractsModule.DependencySourceType; - commandName: string; - dependencyTypeName: string; - properties: any; - constructor(): RemoteDependencyData; - } - interface AjaxCallData extends ContractsModule.PageViewData { - ver: number; - url: string; - ajaxUrl: string; - name: string; - duration: string; - requestSize: number; - responseSize: number; - timeToFirstByte: string; - timeToLastByte: string; - callbackDuration: string; - responseCode: string; - success: boolean; - properties: any; - measurements: any; - constructor(): AjaxCallData; - } - interface RequestData extends ContractsModule.Domain { - ver: number; - id: string; - name: string; - startTime: string; - duration: string; - responseCode: string; - success: boolean; - httpMethod: string; - url: string; - properties: any; - measurements: any; - constructor(): RequestData; - } - interface SessionStateData extends ContractsModule.Domain { - ver: number; - state: ContractsModule.SessionState; - constructor(): SessionStateData; - } - interface PerformanceCounterData extends ContractsModule.Domain { - ver: number; - categoryName: string; - counterName: string; - instanceName: string; - kind: DataPointType; - count: number; - min: number; - max: number; - stdDev: number; - value: number; - properties: any; - constructor(): PerformanceCounterData; - } -} - - -interface Channel { - constructor(isDisabled: () => boolean, getBatchSize: () => number, getBatchIntervalMs: () => number, sender: Sender): Channel; - /** - * Add a telemetry item to the send buffer - */ - send(envelope: ContractsModule.Envelope): void; - handleCrash(envelope: ContractsModule.Envelope): void; - /** - * Immediately send buffered data - */ - triggerSend(isNodeCrashing?: boolean): void; -} - -interface Client { - config: Config; - context: Context; - commonProperties: { - [key: string]: string; - }; - channel: Channel; - /** - * Constructs a new client of the client - * @param iKey the instrumentation key to use (read from environment variable if not specified) - */ - constructor(iKey?: string): Client; - /** - * Log a user action or other occurrence. - * @param name A string to identify this event in the portal. - * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. - * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty. - */ - trackEvent(name: string, properties?: { - [key: string]: string; - }, measurements?: { - [key: string]: number; - }): void; - /** - * Log a trace message - * @param message A string to identify this event in the portal. - * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. - */ - trackTrace(message: string, severityLevel?: ContractsModule.SeverityLevel, properties?: { - [key: string]: string; - }): void; - /** - * Log an exception you have caught. - * @param exception An Error from a catch clause, or the string error message. - * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. - * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty. - */ - trackException(exception: Error, properties?: { - [key: string]: string; - }): void; - /** - * Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators. - * To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the - * telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals. - * @param name A string that identifies the metric. - * @param value The value of the metric - * @param count the number of samples used to get this value - * @param min the min sample for this set - * @param max the max sample for this set - * @param stdDev the standard deviation of the set - */ - trackMetric(name: string, value: number, count?:number, min?: number, max?: number, stdDev?: number, properties?: { - [key: string]: string; - }): void; - - /** - * Log an incoming http request to your server. The request data will be tracked during the response "finish" event if it is successful or the request "error" - * event if it fails. The request duration is automatically calculated as the timespan between when the trackRequest method was called, and when the response "finish" - * or request "error" events were fired. - * @param request The http.IncomingMessage object to track - * @param response The http.ServerResponse object for this request - * @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty. - */ - trackRequest(request: any /* http.IncomingMessage */, response: any /* http.ServerResponse */, properties?: { - [key: string]: string; - }): void; - - /** - * Log an incoming http request to your server. The request data is tracked synchronously rather than waiting for the response "finish"" or request "error"" events. - * Use this if you need your request telemetry to respect custom app insights operation and user context (for example if you set any appInsights.client.context.tags). - * @param request The http.IncomingMessage object to track - * @param response The http.ServerResponse object for this request - * @param ellapsedMilliseconds The duration for this request. Defaults to 0. - * @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty. - * @param error An error that was returned for this request if it was unsuccessful. Defaults to null. - */ - trackRequestSync(request: any /*http.IncomingMessage */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: { - [key: string]: string;}, error?: any) : 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. - */ - sendPendingData(callback?: (response: string) => void): void; - getEnvelope(data: ContractsModule.Data, tagOverrides?: { - [key: string]: string; - }): ContractsModule.Envelope; - /** - * Generic track method for all telemetry types - * @param data the telemetry to send - * @param tagOverrides the context tags to use for this telemetry which overwrite default context values - */ - track(data: ContractsModule.Data, tagOverrides?: { - [key: string]: string; - }): void; -} - -interface Config { - instrumentationKey: string; - sessionRenewalMs: number; - sessionExpirationMs: number; - endpointUrl: string; - maxBatchSize: number; - maxBatchIntervalMs: number; - disableAppInsights: boolean; - constructor(instrumentationKey?: string): Config; -} - -interface Context { - keys: ContractsModule.ContextTagKeys; - tags: { - [key: string]: string; - }; - constructor(packageJsonPath?: string): Context; -} - -interface Sender { - constructor(getUrl: () => string, onSuccess?: (response: string) => void, onError?: (error: Error) => void): Sender; - send(payload: any/* Buffer */): void; - saveOnCrash(payload: string): void; - /** - * enable caching events locally on error - */ - enableCacheOnError(): void; - /** - * disable caching events locally on error - */ - disableCacheOnError(): void; -} - -/** - * The singleton meta interface for the default client of the client. This interface is used to setup/start and configure - * the auto-collection behavior of the application insights module. - */ -interface ApplicationInsights { - client: Client; - /** - * Initializes a client with the given instrumentation key, if this is not specified, the value will be - * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY - * @returns {ApplicationInsights/Client} a new client - */ - getClient(instrumentationKey?: string): Client; - /** - * Initializes the default client of the client and sets the default configuration - * @param instrumentationKey the instrumentation key to use. Optional, if this is not specified, the value will be - * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY - * @returns {ApplicationInsights} this interface - */ - setup(instrumentationKey?: string): ApplicationInsights; - /** - * Starts automatic collection of telemetry. Prior to calling start no telemetry will be collected - * @returns {ApplicationInsights} this interface - */ - start(): ApplicationInsights; - /** - * Sets the state of console tracking (enabled by default) - * @param value if true console activity will be sent to Application Insights - * @returns {ApplicationInsights} this interface - */ - setAutoCollectConsole(value: boolean): ApplicationInsights; - /** - * Sets the state of exception tracking (enabled by default) - * @param value if true uncaught exceptions will be sent to Application Insights - * @returns {ApplicationInsights} this interface - */ - setAutoCollectExceptions(value: boolean): ApplicationInsights; - /** - * Sets the state of performance tracking (enabled by default) - * @param value if true performance counters will be collected every second and sent to Application Insights - * @returns {ApplicationInsights} this interface - */ - setAutoCollectPerformance(value: boolean): ApplicationInsights; - /** - * Sets the state of request tracking (enabled by default) - * @param value if true requests will be sent to Application Insights - * @returns {ApplicationInsights} this interface - */ - setAutoCollectRequests(value: boolean): ApplicationInsights; - /** - * Enables verbose debug logging - * @returns {ApplicationInsights} this interface - */ - enableVerboseLogging(): ApplicationInsights; -} - -declare module "applicationinsights" { - const applicationinsights: ApplicationInsights; - export = applicationinsights; -} diff --git a/types/applicationinsights/tsconfig.json b/types/applicationinsights/tsconfig.json deleted file mode 100644 index abc81fb75c..0000000000 --- a/types/applicationinsights/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "applicationinsights-tests.ts" - ] -} \ No newline at end of file diff --git a/types/applicationinsights/tslint.json b/types/applicationinsights/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/applicationinsights/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 828b5144a4f3aa723891ff545a9fa6f16df8ff9d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 12:56:14 -0800 Subject: [PATCH 121/890] js-data-http: Provides its own types --- notNeededPackages.json | 6 + types/js-data-http/index.d.ts | 45 ------ types/js-data-http/js-data-http-tests.ts | 173 ----------------------- types/js-data-http/package.json | 6 - types/js-data-http/tsconfig.json | 23 --- types/js-data-http/tslint.json | 7 - 6 files changed, 6 insertions(+), 254 deletions(-) delete mode 100644 types/js-data-http/index.d.ts delete mode 100644 types/js-data-http/js-data-http-tests.ts delete mode 100644 types/js-data-http/package.json delete mode 100644 types/js-data-http/tsconfig.json delete mode 100644 types/js-data-http/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 2cd00992e5..5e55228155 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -372,6 +372,12 @@ "sourceRepoURL": "https://github.com/js-data/js-data", "asOfVersion": "3.0.0" }, + { + "libraryName": "JSData Http Adapter", + "typingsPackageName": "js-data-http", + "sourceRepoURL": "https://github.com/js-data/js-data-http", + "asOfVersion": "3.0.0" + }, { "libraryName": "JSNLog", "typingsPackageName": "jsnlog", diff --git a/types/js-data-http/index.d.ts b/types/js-data-http/index.d.ts deleted file mode 100644 index 62a2c1e25b..0000000000 --- a/types/js-data-http/index.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -// Type definitions for JSData Http Adapter 1.2 -// Project: https://github.com/js-data/js-data-http 2.2 -// Definitions by: Stefan Steinhart -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import * as JSData from 'js-data'; - -declare module 'js-data' { - interface DSHttpAdapterOptions { - serialize?(resourceName: string, data: any): any; - deserialize?(resourceName: string, data: any): any; - queryTransform?(resourceName: string, params: DSFilterParams): any; - httpConfig?: any; - forceTrailingSlash?: boolean; - log?: boolean | ((message?: any, ...optionalParams: any[]) => void); - error?: boolean | ((message?: any, ...optionalParams: any[]) => void); - basePath?: string; - verbsUseBasePath?: string; - } - - interface DSHttpAdapterPromiseResolveType { - data: any; - headers: any; - status: number; - config: any; - } - - interface DSHttpAdapter extends IDSAdapter { - new(options?: DSHttpAdapterOptions): DSHttpAdapter; - - defaults: DSHttpAdapterOptions; - http: any; - - // DSHttpAdapter uses axios so options are axios config objects. - HTTP(options?: Object): JSDataPromise; - DEL(url: string, data?: Object, options?: Object): JSDataPromise; - GET(url: string, data?: Object, options?: Object): JSDataPromise; - POST(url: string, data?: Object, options?: Object): JSDataPromise; - PUT(url: string, data?: Object, options?: Object): JSDataPromise; - } -} - -declare var DSHttpAdapter: JSData.DSHttpAdapter; -export = DSHttpAdapter; -export as namespace DSHttpAdapter; diff --git a/types/js-data-http/js-data-http-tests.ts b/types/js-data-http/js-data-http-tests.ts deleted file mode 100644 index 082d34a71f..0000000000 --- a/types/js-data-http/js-data-http-tests.ts +++ /dev/null @@ -1,173 +0,0 @@ -import * as JSData from 'js-data'; -import DSHttpAdapter = require("js-data-http"); - -declare var axios: any; - -const adapter = new DSHttpAdapter(); -const store = new JSData.DS(); -store.registerAdapter('http', adapter, { default: true }); - -adapter.defaults.basePath = '/api'; -adapter.http = axios; - -const ADocument: JSData.DSResourceDefinition = store.defineResource('document'); - -ADocument.inject({ id: 5, author: 'John' }); - -// bypass the data store -adapter.update(ADocument, 5, { author: 'Johnny' }).then((document: any) => { - document; // { id: 5, author: 'Johnny' } - - // The updated document has NOT been injected into the data store because we bypassed the data store - ADocument.get(document.id); // { id: 5, author: 'John' } -}); - -// Normally you would just go through the data store -ADocument.update(5, { author: 'Johnny' }).then((document: any) => { - document; // { id: 5, author: 'Johnny' } - - // the updated document has been injected into the data store - ADocument.get(document.id); // { id: 5, author: 'Johnny' } -}); - -ADocument.inject({ id: 5, author: 'John' }); -ADocument.inject({ id: 6, author: 'John' }); - -// bypass the data store -adapter.updateAll(ADocument, { author: 'Johnny' }, { author: 'John' }).then(documents => { - documents[0]; // { id: 5, author: 'Johnny' } - - // The updated documents have NOT been injected into the data store because we bypassed the data store - ADocument.filter({ author: 'John' }); // [{...}, {...}] - ADocument.filter({ author: 'Johnny' }); // [] -}); - -// Normally you would just go through the data store -ADocument.updateAll({ author: 'Johnny' }, { author: 'John' }).then(documents => { - documents[0]; // { id: 5, author: 'Johnny' } - - // the updated documents have been injected into the data store - ADocument.filter({ author: 'John' }); // [] - ADocument.filter({ author: 'Johnny' }); // [{...}, {...}] -}); - -adapter.PUT('/user/1', { name: 'Johnny' }).then(data => { - data.data; // { id: 1, name: 'Johnny', ... } - data.headers; // {...} - data.status; // 200 - data.config; // {...} -}); - -adapter.POST('/user/1', { name: 'John' }).then(data => { - data.data; // { id: 1, name: 'John', ... } - data.headers; // {...} - data.status; // 200 - data.config; // {...} -}); - -adapter.HTTP({ url: '/user/1', method: 'put', data: { name: 'Johnny' }}).then(data => { - data.data; // { id: 1, name: 'Johnny', ... } - data.headers; // {...} - data.status; // 200 - data.config; // {...} -}); - -adapter.GET('/user/1').then(data => { - data.data; // { id: 1, ... } - data.headers; // {...} - data.status; // 200 - data.config; // {...} -}); - -const User: JSData.DSResourceDefinition = store.defineResource('user'); - -let params: any = { - age: { - '>': 30 - } -}; - -// bypass the data store -adapter.findAll(User, params).then(users => { - // users[0].age; 55 // etc., etc. - - // the users have NOT been injected into the data store because we bypassed the data store - User.filter(params); // [] -}); - -// normally you would go through the data store -User.findAll(params).then(users => { - // users[0].age; 55 // etc., etc. - - // the users have been injected into the data store - User.filter(params); // [{...}, {...}, ...] -}); - -// bypass the data store -adapter.find(ADocument, 5).then((document: any) => { - document; // { id: 5, author: 'John Anderson' } - - // the document has NOT been injected into the data store because we bypassed the data store - ADocument.get(document.id); // undefined -}); - -// Normally you would just go through the data store -ADocument.find(5).then((document: any) => { - document; // { id: 5, author: 'John Anderson' } - - // the document has been injected into the data store - ADocument.get(document.id); // { id: 5, author: 'John Anderson' } -}); - -params = { - author: 'John' -}; - -// bypass the data store -adapter.destroyAll(ADocument, params).then(() => { - // the documents have NOT been ejected from the data store because we bypassed the data store - ADocument.filter(params); // [{...}, {...}, ...] -}); - -// normally you would go through the data store -ADocument.destroyAll(params).then(() => { - // the documents have been ejected from the data store - ADocument.filter(params); // [] -}); - -ADocument.inject({ id: 5, author: 'John' }); - -// bypass the data store -adapter.destroy(ADocument, 5).then(() => { - // the document is still in the data store because we bypassed the data store - // ADocument.get(document.id); // { id: 5, author: 'John' } -}); - -// Normally you would just go through the data store -ADocument.destroy(5).then(() => { - // the document has been ejected from the data store - // ADocument.get(document.id); // undefined -}); - -adapter.DEL('/user/1').then(data => { - data.data; // 1 - data.headers; // {...} - data.status; // 204 - data.config; // {...} -}); - -// bypass the data store -adapter.create(ADocument, { author: 'John' }).then((document: any) => { - document; // { id: 5, author: 'John' } - - // The new document has NOT been injected into the data store because we bypassed the data store - ADocument.get(document.id); // undefined -}); - -// Normally you would just go through the data store -ADocument.create({ author: 'John' }).then((document: any) => { - document; // { id: 5, author: 'John' } - - // the new document has been injected into the data store - ADocument.get(document.id); // { id: 5, author: 'John' } -}); diff --git a/types/js-data-http/package.json b/types/js-data-http/package.json deleted file mode 100644 index f932c0aa52..0000000000 --- a/types/js-data-http/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "@types/js-data": "^2.8.31" - } -} diff --git a/types/js-data-http/tsconfig.json b/types/js-data-http/tsconfig.json deleted file mode 100644 index 2dcba49575..0000000000 --- a/types/js-data-http/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "js-data-http-tests.ts" - ] -} \ No newline at end of file diff --git a/types/js-data-http/tslint.json b/types/js-data-http/tslint.json deleted file mode 100644 index 38c1ea8606..0000000000 --- a/types/js-data-http/tslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "ban-types": false, - "no-misused-new": false - } -} From a158f5cb3238d5de1ea1397e108a8b5db8c87f7d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 12:57:13 -0800 Subject: [PATCH 122/890] artyom.js: Provides its own types --- notNeededPackages.json | 6 + types/artyom.js/artyom.js-tests.ts | 32 -- types/artyom.js/index.d.ts | 473 ----------------------------- types/artyom.js/tsconfig.json | 24 -- types/artyom.js/tslint.json | 8 - 5 files changed, 6 insertions(+), 537 deletions(-) delete mode 100644 types/artyom.js/artyom.js-tests.ts delete mode 100644 types/artyom.js/index.d.ts delete mode 100644 types/artyom.js/tsconfig.json delete mode 100644 types/artyom.js/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 2cd00992e5..0546bc0bd3 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -54,6 +54,12 @@ "sourceRepoURL": "https://github.com/ranisalt/node-argon2", "asOfVersion": "0.15.0" }, + { + "libraryName": "artyom.js", + "typingsPackageName": "artyom.js", + "sourceRepoURL": "https://github.com/sdkcarlos/artyom.js", + "asOfVersion": "1.0.3" + }, { "libraryName": "askmethat-rating", "typingsPackageName": "askmethat-rating", diff --git a/types/artyom.js/artyom.js-tests.ts b/types/artyom.js/artyom.js-tests.ts deleted file mode 100644 index d301c9a6f4..0000000000 --- a/types/artyom.js/artyom.js-tests.ts +++ /dev/null @@ -1,32 +0,0 @@ -import artyomjs = require('artyom.js'); - -// Get an unique ArtyomJS instance -const artyom = artyomjs.ArtyomBuilder.getInstance(); - -// Add a command (not smart) -artyom.addCommands({ - description: 'Test command', - indexes: ['hello', 'hi'], - action: (i: number) => { - console.log('hello action'); - } -}); - -// Add a smart command -artyom.addCommands({ - description: 'Test command 2', - smart: true, - indexes: ['test *'], - action: (i: number, wildcard: string) => { - console.log('wildcard: ', wildcard); - } -}); - -// Get the browser voices -artyom.getVoices(); - -// Get all supported languages for Artyom -artyom.getLanguage(); - -// Get the artyom.js version -artyom.getVersion(); diff --git a/types/artyom.js/index.d.ts b/types/artyom.js/index.d.ts deleted file mode 100644 index 76479b9631..0000000000 --- a/types/artyom.js/index.d.ts +++ /dev/null @@ -1,473 +0,0 @@ -// Type definitions for artyom.js 1.0 -// Project: https://github.com/sdkcarlos/artyom.js -// Definitions by: Sema García (José Manuel García) -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/** - * Extension of Window interface - */ -interface ArtyomWindow extends Window { - webkitSpeechRecognition: any; - SpeechRecognition: any; - SpeechSynthesisUtterance: any; -} - -interface SpeechRecognition extends EventTarget { - grammars: SpeechGrammarList; - lang: string; - continuous: boolean; - interimResults: boolean; - maxAlternatives: number; - serviceURI: string; - start(): void; - stop(): void; - abort(): void; - onaudiostart(ev: Event): any; - onsoundstart(ev: Event): any; - onspeechstart(ev: Event): any; - onspeechend(ev: Event): any; - onsoundend(ev: Event): any; - onresult(ev: SpeechRecognitionEvent): any; - onnomatch(ev: SpeechRecognitionEvent): any; - onerror(ev: SpeechRecognitionError): any; - onstart(ev: Event): any; - onend(ev: Event): any; -} - -interface SpeechRecognitionStatic { - prototype: SpeechRecognition; - new (): SpeechRecognition; -} - -declare var SpeechRecognition: SpeechRecognitionStatic; -declare var webkitSpeechRecognition: SpeechRecognitionStatic; - -interface SpeechRecognitionError extends Event { - error: string; - message: string; -} - -interface SpeechRecognitionAlternative { - transcript: string; - confidence: number; -} - -interface SpeechRecognitionResult { - length: number; - item(index: number): SpeechRecognitionAlternative; - [index: number]: SpeechRecognitionAlternative; - isFinal: boolean; -} - -interface SpeechRecognitionResultList { - length: number; - item(index: number): SpeechRecognitionResult; - [index: number]: SpeechRecognitionResult; -} - -interface SpeechRecognitionEvent extends Event { - resultIndex: number; - results: SpeechRecognitionResultList; - interpretation: any; - emma: Document; -} - -interface SpeechGrammar { - src: string; - weight: number; -} - -interface SpeechGrammarStatic { - prototype: SpeechGrammar; - new (): SpeechGrammar; -} - -declare var SpeechGrammar: SpeechGrammarStatic; -declare var webkitSpeechGrammar: SpeechGrammarStatic; - -interface SpeechGrammarList { - length: number; - item(index: number): SpeechGrammar; - [index: number]: SpeechGrammar; - addFromURI(src: string, weight: number): void; - addFromString(string: string, weight: number): void; -} - -interface SpeechGrammarListStatic { - prototype: SpeechGrammarList; - new (): SpeechGrammarList; -} - -declare var SpeechGrammarList: SpeechGrammarListStatic; -declare var webkitSpeechGrammarList: SpeechGrammarListStatic; - -interface SpeechSynthesis extends EventTarget { - pending: boolean; - speaking: boolean; - paused: boolean; - - onvoiceschanged(ev: Event): any; - speak(utterance: SpeechSynthesisUtterance): void; - cancel(): void; - pause(): void; - resume(): void; - getVoices(): SpeechSynthesisVoice[]; -} - -interface SpeechSynthesisGetter { - speechSynthesis: SpeechSynthesis; -} - -declare var speechSynthesis: SpeechSynthesis; - -interface SpeechSynthesisUtterance extends EventTarget { - text: string; - lang: string; - voice: SpeechSynthesisVoice; - volume: number; - rate: number; - pitch: number; - - onstart(ev: SpeechSynthesisEvent): any; - onend(ev: SpeechSynthesisEvent): any; - onerror(ev: SpeechSynthesisErrorEvent): any; - onpause(ev: SpeechSynthesisEvent): any; - onresume(ev: SpeechSynthesisEvent): any; - onmark(ev: SpeechSynthesisEvent): any; - onboundary(ev: SpeechSynthesisEvent): any; -} - -interface SpeechSynthesisUtteranceStatic { - prototype: SpeechSynthesisUtterance; - new (text?: string): SpeechSynthesisUtterance; -} - -declare var SpeechSynthesisUtterance: SpeechSynthesisUtteranceStatic; - -interface SpeechSynthesisEvent extends Event { - utterance: SpeechSynthesisUtterance; - charIndex: number; - elapsedTime: number; - name: string; -} - -interface SpeechSynthesisErrorEvent extends SpeechSynthesisEvent { - error: string; -} - -interface SpeechSynthesisVoice { - voiceURI: string; - name: string; - lang: string; - localService: boolean; - default: boolean; -} - -declare namespace Artyom { - interface ArtyomDevice { - isChrome(): boolean; - isMobile(): boolean; - } - - interface ArtyomBrowserVoiceObject { - default: boolean; - lang: string; - localService: false; - name: string; - voiceURI: string; - } - - interface ArtyomConfigProperties { - /** Set the default language of artyom with this property */ - lang?: string; - recognizing?: boolean; - /** Choose if should listen one command and then stops, or listening forever */ - continuous?: boolean; - /** Moderates the speed with which Artyom talks (0 ~ 1) */ - speed?: number; - /** Adjust the volume of the voice of artyom */ - volume?: number; - /** If listen is equal to true the voice recognition will be started otherwise this property can be ignored */ - listen: boolean; - /** Recognition mode: normal, quick, remote */ - mode?: string; - /** Displays all the grammars recognized in the console */ - debug: boolean; - helpers?: { - redirectRecognizedTextOutput: any; - remoteProcessorHandler: any; - lastSay: any; - }; - /** Set a keyword that allows your command to be executed immediately when you say this word (Useful in noisy environments) */ - executionKeyword?: string; - /** Set a keyword that allows to enable the command recognition automatically if this word is recognized while artyom is paused (artyom.dontObey) */ - obeyKeyword?: string; - speaking?: boolean; - obeying?: boolean; - soundex?: boolean; - } - - interface ArtyomCommand { - /** Triggers of the command */ - indexes: string[]; - /** Logic to execute when the command is triggered */ - action(i: number, wildcard?: string, full?: string): void; - /** Description of the command */ - description?: string; - /** Flag to specify is a command is either normal or smart */ - smart?: boolean; - } - - interface ArtyomFlags { - restartRecognition: boolean; - } - - interface ArtyomRecognizer { - lang: string; - continuous: boolean; - interimResults: boolean; - start(): void; - stop(): void; - onstart(): void; - onresult(event: any): void; - onerror(event: any): void; - onend(): void; - } - - interface ArtyomJS { - /** - * Contains some basic information that artyom needs to know as the type of device and browser - * @see http://ourcodeworld.com/projects/projects-documentation/6/read-doc/artyom-device/artyom-js - */ - device: ArtyomDevice; - - /** - * Object which provides the speech interface, and set some of its attributes and event handlers - */ - artyomWSR: ArtyomRecognizer; - - /** - * Artyom can return inmediately the voices available in your browser. - * @see http://ourcodeworld.com/projects/projects-documentation/14/read-doc/artyom-getvoices/artyom-js - */ - getVoices(): SpeechSynthesisVoice[]; - - /** - * Returns an array with all the available commands for artyom. - * @see http://ourcodeworld.com/projects/projects-documentation/10/read-doc/artyom-getavailablecommands/artyom-js - */ - getAvailableCommands(): ArtyomCommand[]; - - /** - * Set up artyom for the application. This function will set the default language used by artyom - * or notice the user if artyom is not supported in the actual browser. - * @see http://ourcodeworld.com/projects/projects-documentation/15/read-doc/artyom-initialize/artyom-js - */ - initialize(config: ArtyomConfigProperties): boolean; - - /** - * Force artyom to stop listen even if is in continuos mode. - * @see http://ourcodeworld.com/projects/projects-documentation/9/read-doc/artyom-fatality/artyom-js - */ - fatality(): boolean; - - /** - * Add dinamically commands to artyom using. You can even add commands while artyom is active. - * @see http://ourcodeworld.com/projects/projects-documentation/4/read-doc/artyom-addcommands/artyom-js - */ - addCommands(newCommand: ArtyomCommand | ArtyomCommand[]): boolean; - - /** - * Remove the commands of artyom with indexes that matches with the given text. - * @see http://ourcodeworld.com/projects/projects-documentation/19/read-doc/artyom-removecommands/artyom-js - */ - removeCommands(identifier: string): number[]; - - /** - * Removes all the added commands of artyom. - * @see http://ourcodeworld.com/projects/projects-documentation/7/read-doc/artyom-emptycommands/artyom-js - */ - emptyCommands(): ArtyomCommand[]; - - /** - * Stops the actual and pendings messages that artyom have to say. - * @see http://ourcodeworld.com/projects/projects-documentation/23/read-doc/artyom-shutup/artyom-js - */ - shutUp(): void; - - /** - * Returns an object with the actual properties of artyom. - * @see http://ourcodeworld.com/projects/projects-documentation/12/read-doc/artyom-getproperties/artyom-js - */ - getProperties(): ArtyomConfigProperties; - - /** - * Create a listener when an artyom action is called. - * @see http://ourcodeworld.com/projects/projects-documentation/24/read-doc/artyom-when/artyom-js - */ - when(event: any, action: any): any; - - /** - * Returns the code language of artyom according to initialize function. - * @see http://ourcodeworld.com/projects/projects-documentation/11/read-doc/artyom-getlanguage/artyom-js - * @returns Language - */ - getLanguage(): string; - - /** - * Talks a text according to the given parameters (private function). - * @param text Text to be spoken - * @param actualChunk Number of chunk of the - */ - artyomTalk(text: any, actualChunk: any, totalChunks: any, callbacks: any): any; - - /** - * Splits a string into an array of strings with a limited size (chunk_length). - * @param input text to split into chunks - * @param chunk_length limit of characters in every chunk - */ - splitStringByChunks(input: any, chunk_length: any): string[]; - - /** - * Process the given text into chunks and execute the private function artyom_talk. - * @param message Text to be spoken - * @see http://ourcodeworld.com/projects/projects-documentation/20/read-doc/artyom-say/artyom-js - */ - say(message: any, callbacks: any): void; - - /** - * Repeats the last sentence that artyom said. Useful in noisy environments. - * @param returnObject If set to true, an object with the text and the timestamp when was executed will be returned. - * @see http://ourcodeworld.com/projects/projects-documentation/25/read-doc/artyom-repeatlastsay/artyom-js - */ - repeatLastSay(returnObject: any): void; - - /** - * Verify if the browser supports speechSynthesis. - * @see http://ourcodeworld.com/projects/projects-documentation/40/read-doc/artyom-speechsupported/artyom-js - */ - speechSupported(): boolean; - - /** - * Verify if the browser supports webkitSpeechRecognition. - * @see http://ourcodeworld.com/projects/projects-documentation/39/read-doc/artyom-recognizingsupported/artyom-js - */ - recognizingSupported(): boolean; - - /** - * Simulate a voice command via JS. - * @see http://ourcodeworld.com/projects/projects-documentation/22/read-doc/artyom-simulateinstruction/artyom-js - */ - simulateInstruction(sentence: string): boolean; - - /** - * Returns an object with data of the matched element. - * @returns . There is a result field when the function should return a boolean value. - */ - artyomExecute(voiceCommand: string): any; - - /** - * Displays a message in the console if the artyom propery DEBUG is set to true. - * @param error The error to be debugged - * @param traceLevel Error level: { error | warn | info } - * @see http://ourcodeworld.com/projects/projects-documentation/38/read-doc/artyom-debug/artyom-js - */ - debug(stringEvent: string, traceLevel: string): void; - - /** - * Allows to retrieve the recognized spoken text of artyom and do something with it everytime something is recognized. - */ - redirectRecognizedTextOutput(action: () => void): boolean; - - /** - * Says a random quote and returns it's object. - */ - sayRandom(data: any): any; - - /** - * Artyom provide an easy way to create a dictation for your user. Just create an instance and start and stop when you want. - */ - newDictation(settings: any): any; - - /** - * A voice prompt will be executed. - */ - newPrompt(config: any): any; - - /** - * Artyom awaits for orders when this function is executed. If artyom gets a first parameter the instance will be stopped. - */ - artyomHey(): any; - - /** - * This function will return the webkitSpeechRecognition object used by artyom retrieve it only to debug on it or get some - * values, do not make changes directly. - */ - getNativeApi(): any; - - /** - * This function returns a boolean according to the SpeechRecognition status if artyom is listening, will return true. - * Note: This is not a feature of SpeechRecognition, therefore this value hangs on the fiability of the onStart and onEnd - * events of the SpeechRecognition - */ - isRecognizing(): boolean; - - /** - * This function returns a boolean according to the speechSynthesis status if artyom is speaking, will return true. - * Note: This is not a feature of speechSynthesis, therefore this value hangs on the fiability of the onStart and onEnd - * events of the speechSynthesis. - */ - isSpeaking(): boolean; - - /** - * The SpeechSynthesisUtterance objects are stored in the artyom_garbage_collector variable to prevent the wrong behaviour - * of artyom.say. Use this method to clear all spoken SpeechSynthesisUtterance unused objects. - */ - clearGarbageCollection(): any; - - /** - * Returns the SpeechSynthesisUtterance garbageobjects. - */ - getGarbageCollection(): any; - - /** - * Pause the processing of commands. Artyom still listening in the background and it can be resumed after a couple of seconds. - */ - dontObey(): any; - - /** - * Allow artyom to obey commands again. - */ - obey(): any; - - /** - * A boolean to check if artyom is obeying commands or not. - */ - isObeying(): boolean; - - /** - * Process the recognized text if artyom is active in remote mode. - */ - remoteProcessorService(action: any): any; - - /** - * Returns a string with the actual version of Artyom script. - */ - getVersion(): string; - - /** - * Add commands like an artisan. If you use artyom for simple - * tasks then probably you don't like to write a lot to achieve it. - * Use the artisan syntax to write less, but with the same accuracy. - * @disclaimer Not a promise-based implementation, just syntax. - */ - on(indexes: any, smart: any): any; - } - - class ArtyomBuilder { - static getInstance(): ArtyomJS; - } -} - -export = Artyom; -export as namespace Artyom; diff --git a/types/artyom.js/tsconfig.json b/types/artyom.js/tsconfig.json deleted file mode 100644 index 1a10beb9c8..0000000000 --- a/types/artyom.js/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "noImplicitThis": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "artyom.js-tests.ts" - ] -} \ No newline at end of file diff --git a/types/artyom.js/tslint.json b/types/artyom.js/tslint.json deleted file mode 100644 index 5d72d122bf..0000000000 --- a/types/artyom.js/tslint.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // TODOs - "export-just-namespace": false, - "no-unnecessary-class": false - } -} From f3103378e6ff29b3434b2343680ad3d3978f3826 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:01:40 -0800 Subject: [PATCH 123/890] asyncblock: Provides its own types --- notNeededPackages.json | 6 + types/asyncblock/asyncblock-tests.ts | 189 --------------------------- types/asyncblock/index.d.ts | 71 ---------- types/asyncblock/tsconfig.json | 24 ---- types/asyncblock/tslint.json | 79 ----------- 5 files changed, 6 insertions(+), 363 deletions(-) delete mode 100644 types/asyncblock/asyncblock-tests.ts delete mode 100644 types/asyncblock/index.d.ts delete mode 100644 types/asyncblock/tsconfig.json delete mode 100644 types/asyncblock/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 2cd00992e5..9ac393c549 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -60,6 +60,12 @@ "sourceRepoURL": "https://github.com/AlexTeixeira/Askmethat-Rating", "asOfVersion": "0.4.0" }, + { + "libraryName": "asyncblock", + "typingsPackageName": "asyncblock", + "sourceRepoURL": "https://github.com/scriby/asyncblock", + "asOfVersion": "2.2.11" + }, { "libraryName": "aurelia-knockout", "typingsPackageName": "aurelia-knockout", diff --git a/types/asyncblock/asyncblock-tests.ts b/types/asyncblock/asyncblock-tests.ts deleted file mode 100644 index d93c9fc07a..0000000000 --- a/types/asyncblock/asyncblock-tests.ts +++ /dev/null @@ -1,189 +0,0 @@ - -/// - -import asyncblock = require('asyncblock'); -import fs = require('fs'); - - -// Sleeping in series -asyncblock((flow: asyncblock.IFlow) => { - console.time('time'); - - setTimeout(flow.add(), 1000); - flow.wait(); //Wait for the first setTimeout to finish - - setTimeout(flow.add(), 2000); - flow.wait(); //Wait for the second setTimeout to finish - - console.timeEnd('time'); //3 seconds -}); - -// Trapping results -asyncblock((flow) => { - var path1 = '', path2 = ''; - //Start two parallel file reads - fs.readFile(path1, 'utf8', flow.set('contents1')); - fs.readFile(path2, 'utf8', flow.set('contents2')); - - //Print the concatenation of the results when both reads are finished - console.log(flow.get('contents1') + flow.get('contents2')); - - var paths: string[] = []; - //Wait for a large number of tasks - for(var i = 0; i < 100; i++){ - //Add each task in parallel with i as the key - fs.readFile(paths[i], 'utf8', flow.add(i)); - } - - //Wait for all the tasks to finish. Results is an object of the form {key1: value1, key2: value2, ...} - var results = flow.wait(); - - var path = ''; - //One-liner syntax for waiting on a single task - var contents = flow.sync( fs.readFile(path, 'utf8', flow.callback()) ); - - //See overview & API docs for more extensive description of techniques -}); - -// Error handling -var asyncTask = (callback: (err: any) => void) => { - asyncblock((flow) => { - flow.errorCallback = callback; //Setting the errorCallback is the easiest way to perform error handling. If erroCallback isn't set, and an error occurs, it will be thrown instead of returned to the callback - - var path = ''; - fs.readFile(path, 'utf8', flow.add()); //If readFile encountered an error, it would automatically get passed to the callback - var contents = flow.wait(); - - console.log(contents); //If an error occured above, this code won't run - }); -}; - -// Returning results -var asyncTask2 = (callback: (err: any, res: string) => void) => { - asyncblock((flow) => { - var path = ''; - var contents = flow.sync( fs.readFile(path, 'utf8', flow.callback()) ); //If readFile encountered an error, it would automatically get passed to the callback - - return contents; //Return the value you want to be passed to the callback - }, callback); //The callback can be specified as the 2nd arg to asyncblock. It will be called with the value returned from the asyncblock as the 2nd arg. - //If an error occurs, the callback will be called with the error as the first argument. -}; - - -// Sample -asyncblock.nostack((flow) => { - fs.readFile('path1', 'utf8', flow.add('first')); - fs.readFile('path2', 'utf8', flow.add('second')); - - //Wait until done reading the first and second files, then write them to another file - fs.writeFile('path3', flow.wait('first') + flow.wait('second'), flow.add()); - flow.wait(); //Wait on all outstanding tasks - - fs.readFile('path3', 'utf8', flow.add('data')); - - console.log(flow.wait('data')); //Print the 3rd file's data - console.log('all done'); -}); - - -// Formatting results -(function() { - -var asyncTask = function(callback: (err: any, res1: number, res2: number, res3: number) => void) { - process.nextTick(function() { - callback(null, 1, 2, 3); - }); -} - -asyncblock(function(flow) { - asyncTask(flow.add()); - - var result = flow.wait(); - console.log(result); // Prints 1 -}); - -asyncblock(function(flow) { - asyncTask(flow.add(['first', 'second', 'third'])); - - var result = flow.wait(); - console.log(result); // Prints { first: 1, second: 2, third: 3 } - - asyncTask(flow.add('key1', ['first', 'second', 'third'])); - asyncTask(flow.add('key2', ['a', 'b', 'c'])); - var result = flow.wait(); - console.log(result); // Prints { key1: { first: 1, second: 2, third: 3 }, key2: { a: 1, b: 2, c: 3} } -}); - -})(); - - -// Parallel task rate limiting -(function() { - -asyncblock(function(flow) { - flow.queue(function(callback: Function) { - setTimeout(callback, 1000); - }); - - flow.wait(); //This will wait for about a second -}); - -asyncblock(function(flow) { - flow.maxParallel = 2; - - process.nextTick(function(){ - flow.queue(function(callback: Function) { - setTimeout(callback, 1000); - }); - - flow.queue(function(callback: Function) { - setTimeout(callback, 2000); - }); - - flow.queue(function(callback: Function) { - setTimeout(callback, 3000); - }); - - flow.doneAdding(); - }); - - flow.forceWait(); -}); - -asyncblock(function(flow) { - setTimeout(flow.callback(), 1000); - - flow.queue(function(callback: Function) { - setTimeout(callback, 1000); - }); - flow.queue((callback: (err: any, res: string) => void) => { - callback(null, ''); - }); - - flow.wait(); -}); - -})(); - - -// Task timeouts -(function() { - -asyncblock(function(flow){ - setTimeout(flow.add({timeout: 1000, timeoutIsError: false}), 2000); - flow.wait(); //The fiber will yield here for 1 second, then continue - - //Code here will run -}); - -asyncblock(function(flow){ - flow.timeoutIsError = false; - - setTimeout(flow.add({timeout: 1000}), 2000); - flow.wait(); //The fiber will yield here for 1 second, then continue - - //Code here will run -}); - -})(); - diff --git a/types/asyncblock/index.d.ts b/types/asyncblock/index.d.ts deleted file mode 100644 index e848f509fb..0000000000 --- a/types/asyncblock/index.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -// Type definitions for asyncblock 2.1.23 -// Project: https://github.com/scriby/asyncblock -// Definitions by: Hiroki Horiuchi -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - -declare function asyncblock(f: (flow: asyncblock.IFlow) => void, callback?: (err: any, res: T) => void): void; - -declare namespace asyncblock { - export function nostack(f: (flow: asyncblock.IFlow) => void, callback?: (err: any, res: T) => void): void; - - export interface IFlow { - add(responseFormat?: string[]): IExecuteFunction; - add(key: string, responseFormat?: string[]): IExecuteFunction; - add(key: number, responseFormat?: string[]): IExecuteFunction; - add(options: IFlowOptions): IExecuteFunction; - callback(responseFormat?: string[]): IExecuteFunction; - callback(key: string, responseFormat?: string[]): IExecuteFunction; - callback(key: number, responseFormat?: string[]): IExecuteFunction; - callback(options: IFlowOptions): IExecuteFunction; - wait(key?: string): T; - wait(key?: number): T; - - get(key: string): T; - set(key: string, responseFormat?: string[]): IExecuteFunction; - set(options: IFlowOptions): IExecuteFunction; - del(key: string): void; - - sync(task: any): T; - queue(toExecute: IExecuteFunction): void; - queue(key: string, toExecute: IExecuteFunction): void; - queue(key: number, toExecute: IExecuteFunction): void; - queue(responseFormat: string[], toExecute: IExecuteFunction): void; - queue(key: string, responseFormat: string[], toExecute: IExecuteFunction): void; - queue(key: number, responseFormat: string[], toExecute: IExecuteFunction): void; - queue(options: IFlowOptions, toExecute: IExecuteFunction): void; - doneAdding(): void; - forceWait(): T; - - maxParallel: number; - errorCallback: (err: any) => void; - taskTimeout: number; - timeoutIsError: boolean; - } - - export interface IFlowOptions { - ignoreError?: boolean; // default false - key?: string; // string | number - responseFormat?: string[]; - timeout?: number; - timeoutIsError?: boolean; - dontWait?: boolean; - firstArgIsError?: boolean; // default true - } - - export interface IExecuteFunction { - (err: any, res1: T1, res2: T2, res3: T3): any; - (err: any, res1: T1, res2: T2): any; - (err: any, res: T): any; - (err: any): any; - - // firstArgIsError === false - (res1: T1, res2: T2, res3: T3): any; - (res1: T1, res2: T2): any; - (res: T): any; - } - -} - -export = asyncblock; diff --git a/types/asyncblock/tsconfig.json b/types/asyncblock/tsconfig.json deleted file mode 100644 index c696706864..0000000000 --- a/types/asyncblock/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "asyncblock-tests.ts" - ] -} \ No newline at end of file diff --git a/types/asyncblock/tslint.json b/types/asyncblock/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/asyncblock/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 2a4a95ad1d3ae98bbc05fd35a9a669110ce69d1d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:02:34 -0800 Subject: [PATCH 124/890] monk: Provides its own types --- notNeededPackages.json | 6 +++ types/monk/index.d.ts | 69 ----------------------------------- types/monk/tsconfig.json | 22 ----------- types/monk/tslint.json | 79 ---------------------------------------- 4 files changed, 6 insertions(+), 170 deletions(-) delete mode 100644 types/monk/index.d.ts delete mode 100644 types/monk/tsconfig.json delete mode 100644 types/monk/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 2cd00992e5..0af53a949b 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -486,6 +486,12 @@ "sourceRepoURL": "https://github.com/moment/moment", "asOfVersion": "2.13.0" }, + { + "libraryName": "Monk", + "typingsPackageName": "monk", + "sourceRepoURL": "https://github.com/LearnBoost/monk.git", + "asOfVersion": "6.0.0" + }, { "libraryName": "MQTT", "typingsPackageName": "mqtt", diff --git a/types/monk/index.d.ts b/types/monk/index.d.ts deleted file mode 100644 index 8e732bd9c4..0000000000 --- a/types/monk/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -// Type definitions for Monk v1.0.1 -// Project: https://github.com/LearnBoost/monk.git -// Definitions by: Patrick Bartsch -// Definitions: https://github.com/DefinitelyTyped/Monk - -declare module "monk" { - function m(database: string): m.Monk; - module m { - export interface promise { - type:string - on(eventName:string, fn:Function):void; - error(fn:Function):promise; - success(fn:Function):promise; - } - - export interface Collection { - id(hexstring:string):string // returns ObjectId - id(obj:Object):string // returns ObjectId - id():string // returns new generated ObjectId - - /* - * All commands accept the simple data[, …], options and a callback. - * You can pass fields to select as an array: data[, …], ['field', …], fn - * You can pass fields as a string delimited by spaces: data[, …], 'field1 field2', fn - * To exclude a field, prefix the field name with '-': data[, …], '-field1', fn - */ - cast(obj?:Object):Object; - - count(needle:Object, fn?:Function):promise; - - distinct(field:string, options?:Object, fn?:Function):promise; - - drop(fn?:Function):promise; - - insert(data:Object, options?:Object, fn?:Function):promise; - - find(needle:Object, options?:Object, fn?:Function):promise; - findOne(needle:Object, options?:Object, fn?:Function):promise; - /** - * findAndModify - * - * @param {Object} search query, or { query, update } object - * @param {Object} optional, update object - * @param {Object|String|Array} optional, options or fields - * @param {Function} callback - * @return {Promise} - * @api public - */ - findAndModify(needle:Object, update?:Object, filter?:string[], options?:Object, fn?:Function):promise; - findById(id:string, options?:Object, fn?:Function):promise; - - update(needle:Object, update:Object, filter?:string[], options?:Object, fn?:Function):promise; - updateById(id:string, update:Object, filter?:string[], options?:Object, fn?:Function):promise; - - remove(needle:Object, options?:Object, fn?:Function):promise; - removeById(id:string, options?:Object, fn?:Function):promise; - - } - - export interface Monk { - (database: string): void; - close():void; - - get(collection:string):Collection; - } - } - - export = m; -} diff --git a/types/monk/tsconfig.json b/types/monk/tsconfig.json deleted file mode 100644 index 02963e3afd..0000000000 --- a/types/monk/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts" - ] -} \ No newline at end of file diff --git a/types/monk/tslint.json b/types/monk/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/monk/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 6a0da53ac4062c5c42cd8473e9474e9d82e52e45 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:06:48 -0800 Subject: [PATCH 125/890] geolib: Provides its own types --- notNeededPackages.json | 6 ++ types/geolib/geolib-tests.ts | 0 types/geolib/index.d.ts | 202 ----------------------------------- types/geolib/tsconfig.json | 24 ----- types/geolib/tslint.json | 6 -- 5 files changed, 6 insertions(+), 232 deletions(-) delete mode 100644 types/geolib/geolib-tests.ts delete mode 100644 types/geolib/index.d.ts delete mode 100644 types/geolib/tsconfig.json delete mode 100644 types/geolib/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 2cd00992e5..2ab1828763 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -282,6 +282,12 @@ "sourceRepoURL": "https://github.com/ascoders/gaea-model", "asOfVersion": "0.0.0" }, + { + "libraryName": "geolib", + "typingsPackageName": "geolib", + "sourceRepoURL": "https://github.com/manuelbieh/Geolib", + "asOfVersion": "2.0.23" + }, { "libraryName": "github", "typingsPackageName": "github", diff --git a/types/geolib/geolib-tests.ts b/types/geolib/geolib-tests.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/types/geolib/index.d.ts b/types/geolib/index.d.ts deleted file mode 100644 index b8638ecc71..0000000000 --- a/types/geolib/index.d.ts +++ /dev/null @@ -1,202 +0,0 @@ -// Type definitions for geolib 2.0 -// Project: https://github.com/manuelbieh/Geolib -// Definitions by: Vladimir Venegas , Alex Efimov -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace geolib { - interface PositionAsDecimal { - latitude: number; - longitude: number; - } - - interface PositionAsSexadecimal { - latitude: string; - longitude: string; - } - - interface PositionWithElevation extends PositionAsDecimal { - elevation?: number; - } - - interface PositionInTime extends PositionAsDecimal { - time: number; - } - - interface Bound { - minLat: number; - maxLat: number; - minLng: number; - maxLng: number; - minElev?: number; - maxElev?: number; - } - - interface CompassDirection { - rough: string; - exact: string; - } - - interface Distance { - latitude: number; - longitude: number; - distance: number; - key: string; - } - - interface SpeedOption { - unit: string; - } - - /** - * Calculates the distance between two geo coordinates - * - * Return value is always float and represents the distance in meters. - */ - function getDistance(start: PositionAsDecimal|PositionAsSexadecimal, end: PositionAsDecimal|PositionAsSexadecimal, accuracy?: number, precision?: number): number; - - /** - * Calculates the distance between two geo coordinates but this method is far more inaccurate as compared to getDistance. - * It can take up 2 to 3 arguments. start, end and accuracy can be defined in the same as in getDistance. - * - * Return value is always float that represents the distance in meters. - */ - function getDistanceSimple(start: PositionAsDecimal|PositionAsSexadecimal, end: PositionAsDecimal|PositionAsSexadecimal, accuracy?: number): number; - - /** - * Calculates the geographical center of all points in a collection of geo coordinates - * Takes an object or array of coordinates and calculates the center of it. - */ - function getCenter(coords: PositionAsDecimal[]): PositionAsDecimal; - - /** - * Calculates the center of the bounds of geo coordinates. Takes an array of coordinates, - * calculate the border of those, and gives back the center of that rectangle. On polygons - * like political borders (eg. states), this may gives a closer result to human expectation, - * than getCenter, because that function can be disturbed by uneven distribution of point in - * different sides. Imagine the US state Oklahoma: getCenter on that gives a southern point, - * because the southern border contains a lot more nodes, than the others. - */ - function getCenterOfBounds(coords: PositionAsDecimal[]): PositionAsDecimal; - - /** - * Calculates the bounds of geo coordinates. - * - * Returns maximum and minimum, latitude, longitude, and elevation (if provided) in form of an object - */ - function getBounds(coords: PositionWithElevation[]): Bound; - - /** - * Checks whether a point is inside of a polygon or not. Note: the polygon coords must be in correct order! - * - * Returns true or false - */ - function isPointInside(latlng: PositionAsDecimal, polygon: PositionAsDecimal[]): boolean; - - /** - * Similar to is point inside: checks whether a point is inside of a circle or not. - * - * Returns true or false - */ - function isPointInCircle(latlng: PositionAsDecimal, center: PositionAsDecimal, radius: number): boolean; - - /** - * Gets rhumb line bearing of two points. Find out about the difference between rhumb line and great circle bearing on Wikipedia. - * Rhumb line should be fine in most cases: http://en.wikipedia.org/wiki/Rhumb_line#General_and_mathematical_description Function - * is heavily based on Doug Vanderweide's great PHP version (licensed under GPL 3.0) - * http://www.dougv.com/2009/07/13/calculating-the-bearing-and-compass-rose-direction-between-two-latitude-longitude-coordinates-in-php/ - * - * Returns calculated bearing as integer. - */ - function getRhumbLineBearing(originLL: PositionAsDecimal, destLL: PositionAsDecimal): number; - - /** - * Gets great circle bearing of two points. See description of getRhumbLineBearing for more information. - * - * Returns calculated bearing as integer - */ - function getBearing(originLL: PositionAsDecimal, destLL: PositionAsDecimal): number; - - /** - * Gets the compass direction from an origin coordinate (originLL) to a destination coordinate (destLL). - * Bearing mode. Can be either circle or rhumbline (default). - * - * Returns an object with a rough (NESW) and an exact direction (NNE, NE, ENE, E, ESE, etc). - */ - function getCompassDirection(originLL: PositionAsDecimal, destLL: PositionAsDecimal, bearingMode?: string): CompassDirection; - - /** Sorts an object or array of coords by distance from a reference coordinate */ - function orderByDistance(latlng: PositionAsDecimal, coords: PositionAsDecimal[]): Distance[]; - - /** Finds the nearest coordinate to a reference coordinate. */ - function findNearest(latlng: PositionAsDecimal, coords: PositionAsDecimal[], offset?: number, limit?: number): Distance[]; - - /** - * Calculates the length of a collection of coordinates. - * - * Returns the length of the path in meters - */ - function getPathLength(coords: PositionAsDecimal[]): number; - - /** - * Calculates the speed between two points within a given time span. - * - * Returns the speed in options.unit (default is km/h). - */ - function getSpeed(coords: PositionInTime[], option?: SpeedOption): number; - - /** - * Calculates if given point lies in a line formed by start and end - */ - function isPointInLine(point: PositionAsDecimal, start: PositionAsDecimal, end: PositionAsDecimal): boolean; - - /** - * Converts a given distance (in meters) to another unit. - * distance distance to be converted (source must be in meter). unit can be one of: - * - m (meter) - * - km (kilometers) - * - cm (centimeters) - * - mm (millimeters) - * - mi (miles) - * - sm (seamiles) - * - ft (foot) - * - in (inch) - * - yd (yards) - */ - function convertUnit(unit: string, distance: number, round?: number): number; - - /** Converts a sexagesimal coordinate to decimal format */ - function sexagesimal2decimal(coord: string): number; - - /** Converts a decimal coordinate to sexagesimal format */ - function decimal2sexagesimal(coord: number): string; - - /** - * Returns the latitude for a given point and converts it to decimal. - * Works with: latitude, lat, 1 (GeoJSON array) - */ - function latitude(latlng: any): number; - - /** - * Returns the longitude for a given point and converts it to decimal. - * Works with: longitude, lng, lon, 0 (GeoJSON array) - */ - function longitude(latlng: any): number; - - /** - * Returns the elevation for a given point and converts it to decimal. - * Works with: elevation, elev, alt, altitude, 2 (GeoJSON array) - */ - function elevation(latlng: any): number; - - /** Checks if a coordinate is already in decimal format and, if not, converts it to */ - function useDecimal(latlng: string|number): number; - - /** - * Computes the destination point given an initial point, a distance (in meters) and a bearing (in degrees). - * If no radius is given it defaults to the mean earth radius of 6371000 meter. - * - * Returns an object: `{"latitude": destLat, "longitude": destLng}` - * (Attention: this formula is not *100%* accurate (but very close though)) - */ - function computeDestinationPoint(start: PositionAsDecimal, distance: number, bearing: number, radius?: number): PositionAsDecimal; -} diff --git a/types/geolib/tsconfig.json b/types/geolib/tsconfig.json deleted file mode 100644 index 233fe708bf..0000000000 --- a/types/geolib/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "geolib-tests.ts" - ] -} \ No newline at end of file diff --git a/types/geolib/tslint.json b/types/geolib/tslint.json deleted file mode 100644 index 946997cb87..0000000000 --- a/types/geolib/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "no-useless-files": false - } -} From 4c7b2224c0578c0fff3b25ad4d32bae38a123e51 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:08:05 -0800 Subject: [PATCH 126/890] uk.co.workingedge.phonegap.plugin.launchnavigator: Provides its own types --- notNeededPackages.json | 6 + .../index.d.ts | 258 ------------------ .../tsconfig.json | 24 -- .../tslint.json | 79 ------ ...e.phonegap.plugin.launchnavigator-tests.ts | 99 ------- 5 files changed, 6 insertions(+), 460 deletions(-) delete mode 100644 types/uk.co.workingedge.phonegap.plugin.launchnavigator/index.d.ts delete mode 100644 types/uk.co.workingedge.phonegap.plugin.launchnavigator/tsconfig.json delete mode 100644 types/uk.co.workingedge.phonegap.plugin.launchnavigator/tslint.json delete mode 100644 types/uk.co.workingedge.phonegap.plugin.launchnavigator/uk.co.workingedge.phonegap.plugin.launchnavigator-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index 2cd00992e5..9e58d18fd0 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -840,6 +840,12 @@ "sourceRepoURL": "https://github.com/dpa99c/phonegap-istablet", "asOfVersion": "1.1.3" }, + { + "libraryName": "uk.co.workingedge.phonegap.plugin.launchnavigator", + "typingsPackageName": "uk.co.workingedge.phonegap.plugin.launchnavigator", + "sourceRepoURL": "https://github.com/dpa99c/phonegap-launch-navigator", + "asOfVersion": "3.2.2" + }, { "libraryName": "upper-case", "typingsPackageName": "upper-case", diff --git a/types/uk.co.workingedge.phonegap.plugin.launchnavigator/index.d.ts b/types/uk.co.workingedge.phonegap.plugin.launchnavigator/index.d.ts deleted file mode 100644 index 378a74e09d..0000000000 --- a/types/uk.co.workingedge.phonegap.plugin.launchnavigator/index.d.ts +++ /dev/null @@ -1,258 +0,0 @@ -// Type definitions for uk.co.workingedge.phonegap.plugin.launchnavigator v3.2.1 -// Project: https://github.com/dpa99c/phonegap-launch-navigator -// Definitions by: Dave Alden -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -interface Window { - /** - * Indicates whether the current device is a tablet or a phone. - * @return {boolean} true if the device is a tablet; false if the device is a phone. - */ - LaunchNavigator(): LaunchNavigator; -} - -interface LaunchNavigatorOptions { - - /** - * A callback to invoke when the navigation app is successfully launched. - */ - successCallback?: Function; - - /** - * A callback to invoke if an error is encountered while launching the app. - * A single string argument containing the error message will be passed in. - */ - errorCallback?: (error: string) => void; - - /** - * name of the navigation app to use for directions. - * Specify using launchnavigator.APP constants. - * e.g. `launchnavigator.APP.GOOGLE_MAPS`. - * If not specified, defaults to User Selection. - */ - app?: string; - - /** - * nickname to display in app for destination. e.g. "Bob's House". - */ - destinationName?: string; - - /** - * Start point of the navigation. - * If not specified, the current device location will be used. - * Either: - * - a {string} containing the address. e.g. "Buckingham Palace, London" - * - a {string} containing a latitude/longitude coordinate. e.g. "50.1. -4.0" - * - an {array}, where the first element is the latitude and the second element is a longitude, as decimal numbers. e.g. [50.1, -4.0] - */ - start?: string | number[]; - - /** - * nickname to display in app for start . e.g. "My House". - */ - startName?: string; - - /** - * Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified. - */ - transportMode?: string; - - /** - * If true, debug log output will be generated by the plugin. Defaults to false. - */ - enableDebug?: boolean; - - /** - * a key/value map of extra app-specific parameters. For example, to tell Google Maps on Android to display Satellite view in "maps" launch mode: `{"t": "k"}` - */ - extras?: any; - - /** - * (Android only) mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified. Specify using launchnavigator.LAUNCH_MODE constants. - */ - launchMode?: string; - - /** - * text to display in the native picker which enables user to select which navigation app to launch. Defaults to "Select app for navigation" if not specified. - */ - appSelectionDialogHeader?: string; - - /** - * text to display for the cancel button in the native picker which enables user to select which navigation app to launch. Defaults to "Cancel" if not specified. - */ - appSelectionCancelButton?: string; - - /** - * List of apps, defined as `launchnavigator.APP` constants, which should be displayed in the picker if the app is available. - * This can be used to restrict which apps are displayed, even if they are installed. - * By default, all available apps will be displayed. - */ - appSelectionList?: string[]; - - /** - * Callback to invoke when the user selects an app in the native picker. - * A single string argument is passed which is the app what was selected defined as a `launchnavigator.APP` constant. - */ - appSelectionCallback?: (app: string) => void; -} - - -interface LaunchNavigator { - - /** - * Supported platforms - */ - PLATFORM: any; - - /** - * string constants, used to identify apps in native code - */ - APP: any; - - /** - * All possible transport modes - */ - TRANSPORT_MODE: any; - - /** - * Launch modes supported by Google Maps on Android - */ - LAUNCH_MODE: any; - - - /** - * Launches navigator app - * @param destination {string|number[]} Location name or coordinates (as string or array) - * Either: - * - a {string} containing the address. e.g. "Buckingham Palace, London" - * - a {string} containing a latitude/longitude coordinate. e.g. "50.1. -4.0" - * - an {array}, where the first element is the latitude and the second element is a longitude, as decimal numbers. e.g. [50.1, -4.0] - * @param options {LaunchNavigatorOptions} - * @returns {Promise} - */ - navigate: ( - destination: string | number[], - options?: LaunchNavigatorOptions - ) => void; - - logEvent: (name: string, params?: any, valueToSum?: number) => void; - - - - /** - * Determines if the given app is installed and available on the current device. - * @param app {string} - */ - isAppAvailable: ( - app: string, - successCallback: (isAvailable: boolean) => void, - errorCallback?: (error: string) => void - ) => void; - - /** - * Returns a list indicating which apps are installed and available on the current device. - * @return string[] - */ - availableApps: ( - successCallback: (apps: any ) => void, - errorCallback?: (error: string) => void - ) => void; - - /** - * Returns the display name of the specified app. - * @param {string} app - specified as a constant in `launchnavigator.APP`. e.g. `launchnavigator.APP.GOOGLE_MAPS`. - * @return {string} - app display name. e.g. "Google Maps". - */ - getAppDisplayName: (app: string) => string; - - /** - * Returns list of supported apps on a given platform. - * @param {string} platform - specified as a constant in `launchnavigator.PLATFORM`. e.g. `launchnavigator.PLATFORM.IOS`. - * @return {array} - apps supported on specified platform as a list of `launchnavigator.APP` constants. - */ - getAppsForPlatform: (platform: string) => string[]; - - /** - * Indicates if an app on a given platform supports specification of transport mode. - * @param {string} app - specified as a constant in `launchnavigator.APP`. e.g. `launchnavigator.APP.GOOGLE_MAPS`. - * @param {string} platform - specified as a constant in `launchnavigator.PLATFORM`. e.g. `launchnavigator.PLATFORM.IOS`. - * @return {boolean} - true if app/platform combination supports specification of transport mode. - */ - supportsTransportMode: ( - app: string, - platform: string - ) => boolean; - - /** - * Returns the list of transport modes supported by an app on a given platform. - * @param {string} app - specified as a constant in `launchnavigator.APP`. e.g. `launchnavigator.APP.GOOGLE_MAPS`. - * @param {string} platform - specified as a constant in `launchnavigator.PLATFORM`. e.g. `launchnavigator.PLATFORM.IOS`. - * @return {array} - list of transports modes as constants in `launchnavigator.TRANSPORT_MODE`. - * If app/platform combination doesn't support specification of transport mode, the list will be empty; - */ - getTransportModes: ( - app: string, - platform: string - ) => string[]; - - /** - * Indicates if an app on a given platform supports specification of launch mode. - * Note that currently only Google Maps on Android does. - * @param {string} app - specified as a constant in `launchnavigator.APP`. e.g. `launchnavigator.APP.GOOGLE_MAPS`. - * @param {string} platform - specified as a constant in `launchnavigator.PLATFORM`. e.g. `launchnavigator.PLATFORM.ANDROID`. - * @return {boolean} - true if app/platform combination supports specification of transport mode. - */ - supportsLaunchMode: ( - app: string, - platform: string - ) => boolean; - - /** - * Indicates if an app on a given platform supports specification of start location. - * @param {string} app - specified as a constant in `launchnavigator.APP`. e.g. `launchnavigator.APP.GOOGLE_MAPS`. - * @param {string} platform - specified as a constant in `launchnavigator.PLATFORM`. e.g. `launchnavigator.PLATFORM.IOS`. - * @return {boolean} - true if app/platform combination supports specification of start location. - */ - supportsStart: ( - app: string, - platform: string - ) => boolean; - - /** - * Indicates if an app on a given platform supports specification of a custom nickname for start location. - * @param {string} app - specified as a constant in `launchnavigator.APP`. e.g. `launchnavigator.APP.GOOGLE_MAPS`. - * @param {string} platform - specified as a constant in `launchnavigator.PLATFORM`. e.g. `launchnavigator.PLATFORM.IOS`. - * @return {boolean} - true if app/platform combination supports specification of start location. - */ - supportsStartName: ( - app: string, - platform: string - ) => boolean; - - /** - * Indicates if an app on a given platform supports specification of a custom nickname for destination location. - * @param {string} app - specified as a constant in `launchnavigator.APP`. e.g. `launchnavigator.APP.GOOGLE_MAPS`. - * @param {string} platform - specified as a constant in `launchnavigator.PLATFORM`. e.g. `launchnavigator.PLATFORM.IOS`. - * @return {boolean} - true if app/platform combination supports specification of destination location. - */ - supportsDestName: ( - app: string, - platform: string - ) => boolean; - - - /** - * Triggers the native dialog picker for user to choose wich app to use. - * @param {mixed} destination (required) - destination location to use for navigation - see launchnavigator.navigate() - * @param {object} options (optional) - optional parameters - see launchnavigator.navigate() - * @param {Function} successCallback (optional) - optional callback to be invoked on success - * @param {Function} errorCallback (optional) - optional callback to be invoked on error - */ - userSelect: ( - destination: string | number[], - options: LaunchNavigatorOptions - ) => void; -} - -declare var launchnavigator: LaunchNavigator; \ No newline at end of file diff --git a/types/uk.co.workingedge.phonegap.plugin.launchnavigator/tsconfig.json b/types/uk.co.workingedge.phonegap.plugin.launchnavigator/tsconfig.json deleted file mode 100644 index a6bd2c9ec0..0000000000 --- a/types/uk.co.workingedge.phonegap.plugin.launchnavigator/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "uk.co.workingedge.phonegap.plugin.launchnavigator-tests.ts" - ] -} \ No newline at end of file diff --git a/types/uk.co.workingedge.phonegap.plugin.launchnavigator/tslint.json b/types/uk.co.workingedge.phonegap.plugin.launchnavigator/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/uk.co.workingedge.phonegap.plugin.launchnavigator/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/uk.co.workingedge.phonegap.plugin.launchnavigator/uk.co.workingedge.phonegap.plugin.launchnavigator-tests.ts b/types/uk.co.workingedge.phonegap.plugin.launchnavigator/uk.co.workingedge.phonegap.plugin.launchnavigator-tests.ts deleted file mode 100644 index 63b02a03d4..0000000000 --- a/types/uk.co.workingedge.phonegap.plugin.launchnavigator/uk.co.workingedge.phonegap.plugin.launchnavigator-tests.ts +++ /dev/null @@ -1,99 +0,0 @@ -let app = launchnavigator.APP["GOOGLE_MAPS"]; -let platform = launchnavigator.PLATFORM["ANDROID"]; - -let destination = "Westminster, London, UK"; - -let options = { - successCallback: () => { - console.log("success"); - }, - errorCallback: (error:string) => { - console.log("error: "+error); - }, - app: app, - destinationName: "Bob's House", - start: "Buckingham Palace, London, UK", - startName: "My House", - transportMode: launchnavigator.TRANSPORT_MODE["walking"], - enableDebug: true, - extras: {"t": "k"}, - launchMode: launchnavigator.LAUNCH_MODE["maps"], - appSelectionDialogHeader: "Select app for navigation", - appSelectionCancelButton: "Cancel", - appSelectionList: [ - launchnavigator.APP["GOOGLE_MAPS"], - launchnavigator.APP["WAZE"] - ], - appSelectionCallback: (app:string) => { - console.log("selected app: "+app); - } -}; - -launchnavigator.navigate(destination, options); - -launchnavigator.userSelect(destination, options); - -launchnavigator.isAppAvailable( - app, - (isAvailable) => { - console.log("isAvailable:" + isAvailable); - }, - (error) => { - console.error("ERROR:" + error); - } -); - -launchnavigator.availableApps( - (apps) => { - for (let app of apps){ - console.log("available:" + app); - } - }, - (error) => { - console.error("ERROR:" + error); - } -); - -(function(){ - let name = launchnavigator.getAppDisplayName(app); - console.log("App Name: "+ name); -}()); - -(function(){ - let apps = launchnavigator.getAppsForPlatform(platform); - for (let app of apps){ - console.log("available for platform:" + app); - } -}()); - -(function(){ - let supported = launchnavigator.supportsTransportMode(app, platform); - console.log("supported: "+ supported); -}()); - -(function(){ - var modes = launchnavigator.getTransportModes(app, platform); - for (let mode of modes){ - console.log("transport modes for platform:" + mode); - } -}()); - -(function(){ - let supported = launchnavigator.supportsLaunchMode(app, platform); - console.log("supported: "+ supported); -}()); - -(function(){ - let supported = launchnavigator.supportsStart(app, platform); - console.log("supported: "+ supported); -}()); - -(function(){ - let supported = launchnavigator.supportsStartName(app, platform); - console.log("supported: "+ supported); -}()); - -(function(){ - let supported = launchnavigator.supportsDestName(app, platform); - console.log("supported: "+ supported); -}()); \ No newline at end of file From a50fa0449a64b9081daae019a28952276cad8638 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:10:26 -0800 Subject: [PATCH 127/890] better-scroll: Provides its own types --- notNeededPackages.json | 6 + types/better-scroll/better-scroll-tests.ts | 70 --------- types/better-scroll/index.d.ts | 169 --------------------- types/better-scroll/tsconfig.json | 24 --- types/better-scroll/tslint.json | 1 - 5 files changed, 6 insertions(+), 264 deletions(-) delete mode 100644 types/better-scroll/better-scroll-tests.ts delete mode 100644 types/better-scroll/index.d.ts delete mode 100644 types/better-scroll/tsconfig.json delete mode 100644 types/better-scroll/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 2cd00992e5..4e61cb266f 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -114,6 +114,12 @@ "sourceRepoURL": "https://github.com/brianloveswords/base64url", "asOfVersion": "2.0.0" }, + { + "libraryName": "better-scroll", + "typingsPackageName": "better-scroll", + "sourceRepoURL": "https://github.com/ustbhuangyi/better-scroll", + "asOfVersion": "1.5.0" + }, { "libraryName": "BigInteger.js", "typingsPackageName": "big-integer", diff --git a/types/better-scroll/better-scroll-tests.ts b/types/better-scroll/better-scroll-tests.ts deleted file mode 100644 index 1c8f336f4f..0000000000 --- a/types/better-scroll/better-scroll-tests.ts +++ /dev/null @@ -1,70 +0,0 @@ -import BScroll = require("better-scroll"); - -const BScroll1 = new BScroll('#wrapper'); -const BScroll2 = new BScroll('#wrapper', { scrollX: false, scrollY: false }); -const BScroll3 = new BScroll('#wrapper', { - snap: true, - wheel: false, - scrollbar: false, - pullDownRefresh: false, -}); -const BScroll4 = new BScroll('#wrapper', { - wheel: { - selectedIndex: 0, - }, -}); -if (document.querySelector('div-test')) { - const BScroll6 = new BScroll('#wrapper', { - snap: { - loop: false, - el: document.querySelector('div-test')!, - threshold: 0.1, - stepX: 100, - stepY: 100, - listenFlick: true, - }, - }); -} -const BScroll7 = new BScroll('#wrapper', { - scrollbar: { - fade: true, - }, -}); - -const BScroll8 = new BScroll('#wrapper', { - pullDownRefresh: { - threshold: 50, - stop: 20, - }, -}); - -BScroll1.refresh(); -BScroll1.scrollTo(0, 100); -BScroll1.scrollTo(0, 100, 200); - -BScroll1.scrollToElement('selectedElement'); -BScroll1.scrollToElement('selectedElement', 250); - -BScroll1.scrollToElement(document.getElementById('selectedElement')!); -BScroll1.scrollToElement(document.getElementById('selectedElement')!, 250); - -BScroll2.on('scrollStart', () => { console.log('scroll started'); }); - -const BScroll9 = new BScroll(document.getElementById('wrapper')!); -const BScroll10 = new BScroll(document.getElementById('wrapper')!, { freeScroll: true }); -const BScroll11 = new BScroll(document.getElementById('wrapper')!, { - preventDefaultException: { - tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/, - }, -}); -const BScroll12 = new BScroll(document.getElementById('wrapper')!, { - preventDefaultException: { - className: /(^|\s)test(\s|$)/, - }, -}); - -const BScroll13 = new BScroll(document.getElementById('wrapper')!, { - swipeBounceTime: 1000, -}); - -const BScroll14 = new BScroll('#wrapper', { disableMouse: true, disableTouch: false }); diff --git a/types/better-scroll/index.d.ts b/types/better-scroll/index.d.ts deleted file mode 100644 index 3f48fed9db..0000000000 --- a/types/better-scroll/index.d.ts +++ /dev/null @@ -1,169 +0,0 @@ -// Type definitions for better-scroll.js 1.4 -// Project: https://github.com/ustbhuangyi/better-scroll -// Definitions by: linxiaowu66 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 -interface WheelOption { - selectedIndex: number; - rotate?: number; - adjustTime?: number; - wheelWrapperClass?: string; - wheelItemClass?: string; -} - -interface SlideOption { - loop?: boolean; - el?: Element; - threshold?: number; - stepX?: number; - stepY?: number; - listenFlick?: boolean; - speed?: number; -} -interface ScrollBarOption { - fade?: boolean; -} -interface PullDownOption { - threshold?: number; - stop?: number; -} -interface PullUpOption { - threshold?: number; -} -interface PageOption { - x: number; - y: number; - pageX: number; - pageY: number; -} -interface BsOption { - startX?: number; - startY?: number; - scrollX?: boolean; - scrollY?: boolean; - freeScroll?: boolean; - directionLockThreshold?: number; - eventPassthrough?: string | boolean; - click?: boolean; - tap?: boolean; - bounce?: boolean; - bounceTime?: number; - momentum?: boolean; - momentumLimitTime?: number; - momentumLimitDistance?: number; - swipeTime?: number; - swipeBounceTime?: number; - deceleration?: number; - flickLimitTime?: number; - flickLimitDistance?: number; - resizePolling?: number; - probeType?: number; - preventDefault?: boolean; - preventDefaultException?: object; - HWCompositing?: boolean; - useTransition?: boolean; - useTransform?: boolean; - bindToWrapper?: boolean; - disableMouse?: boolean; - disableTouch?: boolean; - /** - * for picker - * wheel: { - * selectedIndex: 0; - * rotate: 25; - * adjustTime: 400; - * wheelWrapperClass: 'wheel-scroll'; - * wheelItemClass: 'wheel-item'; - * } - */ - wheel?: Partial | boolean; - /** - * for slide - * snap: { - * loop?: boolean; - * el: domEl; - * threshold: 0.1; - * stepX: 100; - * stepY: 100; - * listenFlick: true - * } - */ - snap?: Partial | boolean; - /** - * for scrollbar - * scrollbar: { - * fade: true - * } - */ - scrollbar?: Partial | boolean; - /** - * for pull down and refresh - * pullDownRefresh: { - * threshold: 50; - * stop: 20 - * } - */ - pullDownRefresh?: Partial | boolean; - /** - * for pull up and load - * pullUpLoad: { - * threshold: 50 - * } - */ - pullUpLoad?: Partial | boolean; -} -declare class BScroll { - constructor(element: Element | string, options?: BsOption); - // 重新计算 better-scroll,当 DOM 结构发生变化的时候务必要调用确保滚动的效果正常 - x: number; - y: number; - maxScrollX: number; - maxScrollY: number; - movingDirectionX: number; - movingDirectionY: number; - directionX: number; - directionY: number; - enabled: boolean; - isInTransition: boolean; - isAnimating: boolean; - options: BsOption; - - refresh(): void; - // 启用 better-scroll; 默认 开启 - enable(): void; - // 禁用 better-scroll,DOM 事件(如 touchstart、touchmove、touchend)的回调函数不再响应 - disable(): void; - // 相对于当前位置偏移滚动 x;y 的距离 - scrollBy(x: number, y: number, time?: number, easing?: object): void; - // 滚动到指定的位置 - scrollTo(x: number, y: number, time?: number, easing?: object): void; - // 滚动到指定的目标元素 - scrollToElement(el: HTMLElement | string, time?: number, offsetX?: number | boolean, offsetY?: number | boolean, easing?: object): void; - // 立即停止当前运行的滚动动画 - stop(): void; - // 销毁 better-scroll,解绑事件 - destroy(): void; - - // 当我们做 slide 组件的时候,slide 通常会分成多个页面。调用此方法可以滚动到指定的页面。 - goToPage(x: number, y: number, time?: number, easing?: object): void; - // 滚动到下一个页面 - next(time: number, easing: object): void; - // 滚动到上一个页面 - prev(time: number, easing: object): void; - // 获取当前页面的信息 - getCurrentPage(): PageOption; - // 当我们做 picker 组件的时候,调用该方法可以滚动到索引对应的位置 - wheelTo(index: number): void; - // 获取当前选中的索引值 - getSelectedIndex(): number; - // 当下拉刷新数据加载完毕后,需要调用此方法告诉 better-scroll 数据已加载 - finishPullDown(): void; - // 当上拉加载数据加载完毕后,需要调用此方法告诉 better-scroll 数据已加载 - finishPullUp(): void; - - // 监听事件 - on(type: string, fn: (evt?: any) => void): void; - off(type: string, fn?: (evt?: any) => void): void; -} - -export = BScroll; diff --git a/types/better-scroll/tsconfig.json b/types/better-scroll/tsconfig.json deleted file mode 100644 index 774ffc076f..0000000000 --- a/types/better-scroll/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "better-scroll-tests.ts" - ] -} \ No newline at end of file diff --git a/types/better-scroll/tslint.json b/types/better-scroll/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/better-scroll/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From b0e804b8cd96e800667761754e2420bf5a631ddc Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:20:29 -0800 Subject: [PATCH 128/890] koa-jwt: Provides its own types --- notNeededPackages.json | 6 +++++ types/koa-jwt/index.d.ts | 42 ---------------------------------- types/koa-jwt/koa-jwt-tests.ts | 23 ------------------- types/koa-jwt/tsconfig.json | 23 ------------------- types/koa-jwt/tslint.json | 1 - 5 files changed, 6 insertions(+), 89 deletions(-) delete mode 100644 types/koa-jwt/index.d.ts delete mode 100644 types/koa-jwt/koa-jwt-tests.ts delete mode 100644 types/koa-jwt/tsconfig.json delete mode 100644 types/koa-jwt/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 2cd00992e5..c4d333b0aa 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -402,6 +402,12 @@ "sourceRepoURL": "https://github.com/ErikSchierboom/knockout-pre-rendered", "asOfVersion": "0.7.1" }, + { + "libraryName": "koa-jwt", + "typingsPackageName": "koa-jwt", + "sourceRepoURL": "https://github.com/koajs/jwt", + "asOfVersion": "3.2.2" + }, { "libraryName": "lambda-phi", "typingsPackageName": "lambda-phi", diff --git a/types/koa-jwt/index.d.ts b/types/koa-jwt/index.d.ts deleted file mode 100644 index 5017be7bc2..0000000000 --- a/types/koa-jwt/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Type definitions for koa-jwt 3.2 -// Project: https://github.com/koajs/jwt -// Definitions by: Bruno Krebs -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import Koa = require("koa"); - -export = jwt; - -declare function jwt(options: jwt.Options): jwt.Middleware; - -declare namespace jwt { - interface Options { - secret: string | Buffer | SecretProvider; - key?: string; - getToken?(opts: Options): string; - passthrough?: boolean; - cookie?: string; - debug?: boolean; - } - - interface UnlessOptions { - method?: string | string[]; - path?: string | string[] | RegExp | RegExp[]; - ext?: string| string[]; - custom?(ctx?: Koa.Context): boolean; - useOriginalUrl?: boolean; - } - - type Middleware = Koa.Middleware & { - unless(options?: UnlessOptions): any; - }; - - type SecretProvider = (header: TokenHeader) => Promise; - - interface TokenHeader { - alg: string; - kid: string; - typ: string; - } -} diff --git a/types/koa-jwt/koa-jwt-tests.ts b/types/koa-jwt/koa-jwt-tests.ts deleted file mode 100644 index cdfc25fffa..0000000000 --- a/types/koa-jwt/koa-jwt-tests.ts +++ /dev/null @@ -1,23 +0,0 @@ -import koa = require('koa'); -import jwt = require('koa-jwt'); - -const app = new koa(); - -app.use(jwt({ - secret: 'some-secret-key' -})); - -app.use(jwt({ - secret: 'some-secret-key', - key: 'auth' -})); - -app.use(jwt({ - secret: 'some-secret-key' -}).unless({method: 'OPTIONS'})); - -app.use(jwt({ - secret: (header: jwt.TokenHeader): Promise => { - return Promise.resolve("some-secret-key"); - } -})); diff --git a/types/koa-jwt/tsconfig.json b/types/koa-jwt/tsconfig.json deleted file mode 100644 index 0348b0636b..0000000000 --- a/types/koa-jwt/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "koa-jwt-tests.ts" - ] -} \ No newline at end of file diff --git a/types/koa-jwt/tslint.json b/types/koa-jwt/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/koa-jwt/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From cf0c4640a37ec04ad281fc56389543ed4adcb640 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:24:56 -0800 Subject: [PATCH 129/890] graphene-pk11: Provides its own types --- notNeededPackages.json | 6 + types/graphene-pk11/graphene-pk11-tests.ts | 57 - types/graphene-pk11/index.d.ts | 2273 -------------------- types/graphene-pk11/package.json | 6 - types/graphene-pk11/tsconfig.json | 23 - types/graphene-pk11/tslint.json | 79 - 6 files changed, 6 insertions(+), 2438 deletions(-) delete mode 100644 types/graphene-pk11/graphene-pk11-tests.ts delete mode 100644 types/graphene-pk11/index.d.ts delete mode 100644 types/graphene-pk11/package.json delete mode 100644 types/graphene-pk11/tsconfig.json delete mode 100644 types/graphene-pk11/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 369b0c12e0..e25c610e2b 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -288,6 +288,12 @@ "sourceRepoURL": "https://github.com/mikedeboer/node-github", "asOfVersion": "7.1.0" }, + { + "libraryName": "graphene-pk11", + "typingsPackageName": "graphene-pk11", + "sourceRepoURL": "https://github.com/PeculiarVentures/graphene", + "asOfVersion": "2.0.31" + }, { "libraryName": "gulp-typescript", "typingsPackageName": "gulp-typescript", diff --git a/types/graphene-pk11/graphene-pk11-tests.ts b/types/graphene-pk11/graphene-pk11-tests.ts deleted file mode 100644 index e0ad0fa2c3..0000000000 --- a/types/graphene-pk11/graphene-pk11-tests.ts +++ /dev/null @@ -1,57 +0,0 @@ - -import * as graphene from "graphene-pk11"; -let Module = graphene.Module; - -let lib = "/usr/local/lib/softhsm/libsofthsm2.so"; - -let mod = Module.load(lib, "SoftHSM"); -mod.initialize(); - -let slot = mod.getSlots(0); -if (slot.flags & graphene.SlotFlag.TOKEN_PRESENT) { - let session = slot.open(); - session.login("12345"); - - // generate EC key - let keys = session.generateKeyPair(graphene.KeyGenMechanism.ECDSA, { - keyType: graphene.KeyType.ECDSA, - token: false, - derive: true, - paramsECDSA: graphene.NamedCurve.getByName("secp192r1").value - }, { - keyType: graphene.KeyType.ECDSA, - token: false, - derive: true - }); - - // derive algorithm - let alg = { - name: "ECDH1_DERIVE", - params: new graphene.EcdhParams( - graphene.EcKdf.SHA1, - null, - keys.publicKey.getAttribute({ pointEC: null }).pointEC) - }; - - // Template for derived key - let template = { - "class": graphene.ObjectClass.SECRET_KEY, - "token": false, - "keyType": graphene.KeyType.AES, - "valueLen": 256 / 8, - "encrypt": true, - "decrypt": true - }; - - // Key derivation - let dKey = session.deriveKey(alg, keys.privateKey, template); - console.log("Derived key handle:", dKey.handle); - - session.logout(); - session.close(); -} -else { - console.error("Slot is not initialized"); -} - -mod.finalize(); \ No newline at end of file diff --git a/types/graphene-pk11/index.d.ts b/types/graphene-pk11/index.d.ts deleted file mode 100644 index a31e4e0812..0000000000 --- a/types/graphene-pk11/index.d.ts +++ /dev/null @@ -1,2273 +0,0 @@ -// Type definitions for graphene-pk11 v2.0.3 -// Project: https://github.com/PeculiarVentures/graphene -// Definitions by: Stepan Miroshin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -/** - * A simple layer for interacting with PKCS #11 / PKCS11 / CryptoKI for Node - * v2.0.3 - */ - -import * as pkcs11 from "pkcs11js"; - -type Handle = Buffer; -type CryptoData = string | Buffer; - -declare class Pkcs11Error extends Error { - code: number; - func: string; - constructor(code: number, func: string); -} - -declare class BaseObject { - protected lib: pkcs11.PKCS11; - constructor(lib?: pkcs11.PKCS11); -} - -declare class HandleObject extends BaseObject { - /** - * handle to pkcs11 object - */ - handle: Handle; - - constructor(handle: Handle, lib: pkcs11.PKCS11); - - protected getInfo(): void; -} - -declare class Collection extends BaseObject { - - protected items_: Array; - protected classType: any; - - /** - * returns length of collection - */ - length: number; - - constructor(items: Array, lib: pkcs11.PKCS11, classType: any); - - /** - * returns item from collection by index - * @param {number} index of element in collection `[0..n]` - */ - items(index: number): T; -} - -declare function isString(v: any): boolean; -declare function isNumber(v: any): boolean; -declare function isBoolean(v: any): boolean; -declare function isUndefined(v: any): boolean; -declare function isNull(v: any): boolean; -declare function isEmpty(v: any): boolean; -declare function isFunction(v: any): boolean; -declare function isObject(v: any): boolean; -declare function isArray(v: any): boolean; -declare function isFlag(v: any, fv: number): boolean; -declare function dateFromString(text: string): Date; - -// ========== Crypto ========== - -declare class Cipher extends BaseObject { - - session: Session; - - constructor(session: Session, alg: MechanismType, key: Key, lib: pkcs11.PKCS11); - - protected init(alg: MechanismType, key: Key): void; - - update(data: CryptoData): Buffer; - final(): Buffer; - once(data: CryptoData, enc: Buffer): Buffer; - once(data: CryptoData, enc: Buffer, cb: (error: Error, data: Buffer) => void): void; -} - -declare class Decipher extends BaseObject { - - protected session: Session; - protected blockSize: number; - - constructor(session: Session, alg: MechanismType, key: Key, blockSize: number, lib: pkcs11.PKCS11); - - protected init(alg: MechanismType, key: Key): void; - - update(data: Buffer): Buffer; - final(): Buffer; - once(data: Buffer, dec: Buffer): Buffer; - once(data: Buffer, dec: Buffer, cb: (error: Error, data: Buffer) => void): void; -} - -declare class Digest extends BaseObject { - - session: Session; - - constructor(session: Session, alg: MechanismType, lib: pkcs11.PKCS11); - - protected init(alg: MechanismType): void; - - update(data: CryptoData): void; - final(): Buffer; - once(data: CryptoData): Buffer; - once(data: CryptoData, cb: (error: Error, data: Buffer) => void): void; -} - -declare class Sign extends BaseObject { - - session: Session; - - constructor(session: Session, alg: MechanismType, key: Key, lib: pkcs11.PKCS11); - - protected init(alg: MechanismType, key: Key): void; - - update(data: CryptoData): void; - final(): Buffer; - once(data: CryptoData): Buffer; - once(data: CryptoData, cb: (error: Error, data: Buffer) => void): void; -} - -declare class Verify extends BaseObject { - - session: Session; - - constructor(session: Session, alg: MechanismType, key: Key, lib: pkcs11.PKCS11); - - protected init(alg: MechanismType, key: Key): void; - - update(data: CryptoData): void; - final(signature: Buffer): boolean; - once(data: CryptoData, signature: Buffer): boolean; - once(data: CryptoData, signature: Buffer, cb: (error: Error, valid: boolean) => void): void; -} - -// ========== Keys ========== - -interface IParams { - toCKI(): any; -} - -declare enum MechParams { - AesCBC, - AesCCM, - AesGCM, - RsaOAEP, - RsaPSS, - EcDH, -} - -// AES - -declare class AesCbcParams implements IParams, pkcs11.AesCBC { - /** - * initialization vector - * - must have a fixed size of 16 bytes - */ - iv: Buffer; - /** - * the data - */ - data: Buffer; - type: MechParams; - constructor(iv: Buffer, data?: Buffer); - toCKI(): Buffer; -} - -declare class AesCcmParams implements IParams { - /** - * length of the data where 0 <= dataLength < 2^8L - */ - dataLength: number; - /** - * the nonce - */ - nonce: Buffer; - /** - * the additional authentication data - * - This data is authenticated but not encrypted - */ - aad: Buffer; - /** - * length of authentication tag (output following cipher text) in bits. - * - Can be any value between 0 and 128 - */ - macLength: number; - type: MechParams; - constructor(dataLength: number, nonce: Buffer, aad?: Buffer, macLength?: number); - toCKI(): pkcs11.AesCCM; -} - -declare class AesGcmParams implements IParams { - /** - * initialization vector - * - The length of the initialization vector can be any number between 1 and 256. - * 96-bit (12 byte) IV values can be processed more efficiently, - * so that length is recommended for situations in which efficiency is critical. - */ - iv: Buffer; - /** - * pointer to additional authentication data. - * This data is authenticated but not encrypted. - */ - aad: Buffer; - /** - * length of authentication tag (output following cipher text) in bits. - * Can be any value between 0 and 128. Default 128 - */ - tagBits: number; - type: MechParams; - constructor(iv: Buffer, aad?: Buffer, tagBits?: number); - toCKI(): pkcs11.AesGCM; -} - -// EC - -interface INamedCurve { - name: string; - oid: string; - value: Buffer; - size: number; -} - -declare class NamedCurve { - static getByName(name: string): INamedCurve; - static getByOid(oid: string): INamedCurve; -} - -declare enum EcKdf { - NULL, - SHA1, - SHA224, - SHA256, - SHA384, - SHA512, -} - -declare class EcdhParams implements IParams, pkcs11.ECDH1 { - /** - * key derivation function used on the shared secret value - */ - kdf: EcKdf; - /** - * some data shared between the two parties - */ - sharedData: Buffer; - /** - * other party's EC public key value - */ - publicData: Buffer; - type: MechParams; - /** - * Creates an instance of EcdhParams. - * - * @param {EcKdf} kdf key derivation function used on the shared secret value - * @param {Buffer} [sharedData=null] some data shared between the two parties - * @param {Buffer} [publicData=null] other party's EC public key value - */ - constructor(kdf: EcKdf, sharedData?: Buffer, publicData?: Buffer); - toCKI(): pkcs11.ECDH1; -} - -// Rsa - -declare enum RsaMgf { - MGF1_SHA1, - MGF1_SHA224, - MGF1_SHA256, - MGF1_SHA384, - MGF1_SHA512, -} - -declare class RsaOaepParams implements IParams { - hashAlgorithm: MechanismEnum; - mgf: RsaMgf; - source: number; - sourceData: Buffer; - type: MechParams; - constructor(hashAlg?: MechanismEnum, mgf?: RsaMgf, sourceData?: Buffer); - toCKI(): pkcs11.RsaOAEP; -} - -declare class RsaPssParams implements IParams { - /** - * hash algorithm used in the PSS encoding; - * - if the signature mechanism does not include message hashing, - * then this value must be the mechanism used by the application to generate - * the message hash; - * - if the signature mechanism includes hashing, - * then this value must match the hash algorithm indicated - * by the signature mechanism - */ - hashAlgorithm: MechanismEnum; - /** - * mask generation function to use on the encoded block - */ - mgf: RsaMgf; - /** - * length, in bytes, of the salt value used in the PSS encoding; - * - typical values are the length of the message hash and zero - */ - saltLength: number; - type: MechParams; - constructor(hashAlg?: MechanismEnum, mgf?: RsaMgf, saltLen?: number); - toCKI(): pkcs11.RsaPSS; -} - -// ========== Objects ========== - -declare enum ObjectClass { - DATA, - CERTIFICATE, - PUBLIC_KEY, - PRIVATE_KEY, - SECRET_KEY, - HW_FEATURE, - DOMAIN_PARAMETERS, - MECHANISM, - OTP_KEY, -} - -declare class SessionObject extends HandleObject { - /** - * Session - */ - session: Session; - /** - * gets the size of an object in bytes - * - * @readonly - * @type {number} - */ - size: number; - class: ObjectClass; - - /** - * Creates an instance of SessionObject. - * - * @param {SessionObject} object - */ - constructor(object: SessionObject); - /** - * Creates an instance of SessionObject. - * - * @param {Handle} handle - * @param {Session} session - * @param {pkcs11.PKCS11} lib - */ - constructor(handle: Handle, session: Session, lib: pkcs11.PKCS11); - constructor(handle: SessionObject); - - /** - * copies an object, creating a new object for the copy - * - * @param {ITemplate} template template for the new object - * @returns {SessionObject} - */ - copy(template: ITemplate): SessionObject; - /** - * destroys an object - */ - destroy(): void; - getAttribute(attr: string): ITemplate; - getAttribute(attrs: ITemplate): ITemplate; - setAttribute(attrs: string, value: any): void; - setAttribute(attrs: ITemplate): void; - get(name: string): any; - set(name: string, value: any): void; - toType(): T; -} - -declare class SessionObjectCollection extends Collection { - session: Session; - - constructor(items: Array, session: Session, lib: pkcs11.PKCS11, classType?: any); - - items(index: number): SessionObject; -} - -declare class Storage extends SessionObject { - /** - * `true` if object is a token object; - * `false` if object is a session object. Default is `false`. - */ - token: boolean; - /** - * `true` if object is a private object; - * `false` if object is a public object. - * Default value is token-specific, and may depend on the values of other attributes of the object. - */ - private: boolean; - /** - * `true` if object can be modified. Default is `false` - */ - modifiable: boolean; - /** - * Description of the object (default empty) - */ - label: string; -} - -/** - * Data objects (object declare class `CKO_DATA`) hold information defined by an application. - * Other than providing access to it, Cryptoki does not attach any special meaning to a data object - * - * @export - * @declare class Data - * @extends {Storage} - */ -declare class Data extends Storage { - /** - * Description of the application that manages the object (default empty) - * - * @type {string} - */ - application: string; - /** - * DER-encoding of the object identifier indicating the data object type (default empty) - * - * @type {Buffer} - */ - objectId: Buffer; - /** - * Value of the object (default empty) - * - * @type {Buffer} - */ - value: Buffer; -} - -declare class DomainParameters extends Storage { - /** - * Type of key the domain parameters can be used to generate. - */ - keyType: KeyType; - /** - * `CK_TRUE` only if domain parameters were either * generated locally (i.e., on the token) - * with a `C_GenerateKey` * created with a `C_CopyObject` call as a copy of domain parameters - * which had its `CKA_LOCAL` attribute set to `CK_TRUE` - */ - local: boolean; -} - -declare enum KeyType { - RSA, - DSA, - DH, - ECDSA, - EC, - X9_42_DH, - KEA, - GENERIC_SECRET, - RC2, - RC4, - DES, - DES2, - DES3, - CAST, - CAST3, - CAST5, - CAST128, - RC5, - IDEA, - SKIPJACK, - BATON, - JUNIPER, - CDMF, - AES, - GOSTR3410, - GOSTR3411, - GOST28147, - BLOWFISH, - TWOFISH, - SECURID, - HOTP, - ACTI, - CAMELLIA, - ARIA, -} -declare enum KeyGenMechanism { - AES, - RSA, - RSA_X9_31, - DSA, - DH_PKCS, - DH_X9_42, - GOSTR3410, - GOST28147, - RC2, - RC4, - DES, - DES2, - SECURID, - ACTI, - CAST, - CAST3, - CAST5, - CAST128, - RC5, - IDEA, - GENERIC_SECRET, - SSL3_PRE_MASTER, - CAMELLIA, - ARIA, - SKIPJACK, - KEA, - BATON, - ECDSA, - EC, - JUNIPER, - TWOFISH, -} - -/** - * Definition for the base key object declare class - * - defines the object declare class `CKO_PUBLIC_KEY`, `CKO_PRIVATE_KEY` and `CKO_SECRET_KEY` for type `CK_OBJECT_CLASS` - * as used in the `CKA_CLASS` attribute of objects - */ -declare class Key extends Storage { - /** - * Type of key - * - Must be specified when object is created with `C_CreateObject` - * - Must be specified when object is unwrapped with `C_UnwrapKey` - */ - type: KeyType; - /** - * Key identifier for key (default empty) - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification - * of the attribute during the course of a `C_CopyObject` call. - */ - id: Buffer; - /** - * Start date for the key (default empty) - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification - * of the attribute during the course of a `C_CopyObject` call. - */ - startDate: Date; - /** - * End date for the key (default empty) - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification - * of the attribute during the course of a `C_CopyObject` call. - */ - endDate: Date; - /** - * `CK_TRUE` if key supports key derivation - * (i.e., if other keys can be derived from this one (default `CK_FALSE`) - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification - * of the attribute during the course of a `C_CopyObject` call. - * @returns boolean - */ - derive: boolean; - /** - * `CK_TRUE` only if key was either * generated locally (i.e., on the token) - * with a `C_GenerateKey` or `C_GenerateKeyPair` call * created with a `C_CopyObject` call - * as a copy of a key which had its `CKA_LOCAL` attribute set to `CK_TRUE` - * - Must not be specified when object is created with `C_CreateObject`. - * - Must not be specified when object is generated with `C_GenerateKey` or `C_GenerateKeyPair`. - * - Must not be specified when object is unwrapped with `C_UnwrapKey`. - */ - local: boolean; - /** - * Identifier of the mechanism used to generate the key material. - * - Must not be specified when object is created with `C_CreateObject`. - * - Must not be specified when object is generated with `C_GenerateKey` or `C_GenerateKeyPair`. - * - Must not be specified when object is unwrapped with `C_UnwrapKey`. - */ - mechanism: KeyGenMechanism; - allowedMechanisms: void; -} - -/** - * Private key objects (object declare class `CKO_PRIVATE_KEY`) hold private keys - */ -declare class PrivateKey extends Key { - /** - * DER-encoding of the key subject name (default empty) - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - */ - subject: Buffer; - /** - * `CK_TRUE` if key is sensitive - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Attribute cannot be changed once set to CK_TRUE. It becomes a read only attribute. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - sensitive: boolean; - /** - * `CK_TRUE` if key supports decryption - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - decrypt: boolean; - /** - * `CK_TRUE` if key supports signatures where the signature is an appendix to the data - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - sign: boolean; - /** - * `CK_TRUE` if key supports signatures where the data can be recovered from the signature - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - signRecover: boolean; - /** - * `CK_TRUE` if key supports unwrapping (i.e., can be used to unwrap other keys) - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - unwrap: boolean; - /** - * `CK_TRUE` if key is extractable and can be wrapped - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Attribute cannot be changed once set to `CK_FALSE`. It becomes a read only attribute. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - extractable: boolean; - /** - * `CK_TRUE` if key has always had the `CKA_SENSITIVE` attribute set to `CK_TRUE` - * - Must not be specified when object is created with `C_CreateObject`. - * - Must not be specified when object is generated with `C_GenerateKey` or `C_GenerateKeyPair`. - * - Must not be specified when object is unwrapped with `C_UnwrapKey`. - */ - alwaysSensitive: boolean; - /** - * `CK_TRUE` if key has never had the `CKA_EXTRACTABLE` attribute set to `CK_TRUE` - * - Must not be specified when object is created with `C_CreateObject`. - * - Must not be specified when object is generated with `C_GenerateKey` or `C_GenerateKeyPair`. - * - Must not be specified when object is unwrapped with `C_UnwrapKey`. - */ - neverExtractable: boolean; - /** - * `CK_TRUE` if the key can only be wrapped with a wrapping key - * that has `CKA_TRUSTED` set to `CK_TRUE`. Default is `CK_FALSE`. - * - Attribute cannot be changed once set to `CK_TRUE`. It becomes a read only attribute. - */ - wrapTrusted: boolean; - /** - * For wrapping keys. The attribute template to apply to any keys unwrapped - * using this wrapping key. Any user supplied template is applied after this template - * as if the object has already been created. - */ - template: void; - alwaysAuthenticate: boolean; -} - -/** - * Public key objects (object declare class CKO_PUBLIC_KEY) hold public keys - */ -declare class PublicKey extends Key { - /** - * DER-encoding of the key subject name (default empty) - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - */ - subject: Buffer; - /** - * `CK_TRUE` if key supports encryption - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - encrypt: boolean; - /** - * `CK_TRUE` if key supports verification where the signature is an appendix to the data - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - verify: boolean; - /** - * `CK_TRUE` if key supports verification where the data is recovered from the signature - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - verifyRecover: boolean; - /** - * `CK_TRUE` if key supports wrapping (i.e., can be used to wrap other keys) - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - wrap: boolean; - /** - * The key can be trusted for the application that it was created. - * - The wrapping key can be used to wrap keys with `CKA_WRAP_WITH_TRUSTED` set to `CK_TRUE`. - * - Can only be set to CK_TRUE by the SO user. - */ - trusted: boolean; - /** - * For wrapping keys. The attribute template to match against any keys wrapped using this wrapping key. - * Keys that do not match cannot be wrapped. - */ - template: void; -} - -/** - * Secret key objects (object declare class `CKO_SECRET_KEY`) hold secret keys. - */ -declare class SecretKey extends Key { - /** - * `CK_TRUE` if key is sensitive - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Attribute cannot be changed once set to `CK_TRUE`. It becomes a read only attribute. - */ - sensitive: boolean; - /** - * `CK_TRUE` if key supports encryption - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - encrypt: boolean; - /** - * `CK_TRUE` if key supports decryption - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - decrypt: boolean; - /** - * `CK_TRUE` if key supports verification (i.e., of authentication codes) where the signature is an appendix to the data - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - verify: boolean; - /** - * `CK_TRUE` if key supports signatures (i.e., authentication codes) where the signature is an appendix to the data - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - sign: boolean; - /** - * `CK_TRUE` if key supports wrapping (i.e., can be used to wrap other keys) - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - wrap: boolean; - /** - * `CK_TRUE` if key supports unwrapping (i.e., can be used to unwrap other keys) - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - unwrap: boolean; - /** - * `CK_TRUE` if key is extractable and can be wrapped - * - May be modified after object is created with a `C_SetAttributeValue` call, - * or in the process of copying object with a `C_CopyObject` call. - * However, it is possible that a particular token may not permit modification of the attribute - * during the course of a `C_CopyObject` call. - * - Attribute cannot be changed once set to `CK_FALSE`. It becomes a read only attribute. - * - Default value is token-specific, and may depend on the values of other attributes. - */ - extractable: boolean; - /** - * `CK_TRUE` if key has always had the `CKA_SENSITIVE` attribute set to `CK_TRUE` - * - Must not be specified when object is created with `C_CreateObject`. - * - Must not be specified when object is generated with `C_GenerateKey` or `C_GenerateKeyPair`. - * - Must not be specified when object is unwrapped with `C_UnwrapKey`. - */ - alwaysSensitive: boolean; - /** - * `CK_TRUE` if key has never had the `CKA_EXTRACTABLE` attribute set to `CK_TRUE` - * - Must not be specified when object is created with `C_CreateObject`. - * - Must not be specified when object is generated with `C_GenerateKey` or `C_GenerateKeyPair`. - * - Must not be specified when object is unwrapped with `C_UnwrapKey`. - */ - neverExtractable: boolean; - /** - * Key checksum - */ - checkValue: Buffer; - /** - * `CK_TRUE` if the key can only be wrapped with a wrapping key - * that has `CKA_TRUSTED` set to `CK_TRUE`. Default is `CK_FALSE`. - * - Attribute cannot be changed once set to `CK_TRUE`. It becomes a read only attribute. - */ - wrapTrusted: boolean; - /** - * The wrapping key can be used to wrap keys with `CKA_WRAP_WITH_TRUSTED` set to `CK_TRUE`. - * - Can only be set to CK_TRUE by the SO user. - */ - trusted: boolean; - /** - * For wrapping keys. - * The attribute template to match against any keys wrapped using this wrapping key. - * Keys that do not match cannot be wrapped. - */ - wrapTemplate: void; - /** - * For wrapping keys. - * The attribute template to apply to any keys unwrapped using this wrapping key. - * Any user supplied template is applied after this template as if the object has already been created. - */ - unwrapTemplate: void; -} - -declare enum CertificateType { - X_509, - X_509_ATTR_CERT, - WTLS, -} - -declare enum CertificateCategory { - Unspecified, - TokenUser, - Authority, - OtherEntity, -} - -/** - * Certificate objects (object declare class CKO_CERTIFICATE) hold public-key or attribute certificates - */ -declare class Certificate extends Storage { - /** - * Type of certificate - */ - type: CertificateType; - /** - * The certificate can be trusted for the application that it was created. - */ - trusted: boolean; - /** - * Categorization of the certificate - */ - category: CertificateCategory; - /** - * Checksum - */ - checkValue: Buffer; - /** - * Start date for the certificate (default empty) - */ - startDate: Date; - /** - * End date for the certificate (default empty) - */ - endDate: Date; -} - -/** - * X.509 attribute certificate objects (certificate type `CKC_X_509_ATTR_CERT`) hold X.509 attribute certificates - */ -declare class AttributeCertificate extends Certificate { - /** - * DER-encoding of the attribute certificate's subject field. - * This is distinct from the `CKA_SUBJECT` attribute contained in `CKC_X_509` certificates - * because the `ASN.1` syntax and encoding are different. - * - Must be specified when the object is created - */ - owner: Buffer; - /** - * DER-encoding of the attribute certificate's issuer field. - * This is distinct from the `CKA_ISSUER` attribute contained in `CKC_X_509` certificates - * because the ASN.1 syntax and encoding are different. (default empty) - */ - issuer: Buffer; - /** - * DER-encoding of the certificate serial number (default empty) - */ - serialNumber: Buffer; - /** - * BER-encoding of a sequence of object identifier values corresponding - * to the attribute types contained in the certificate. - * When present, this field offers an opportunity for applications - * to search for a particular attribute certificate without fetching - * and parsing the certificate itself. (default empty) - */ - types: Buffer; - /** - * BER-encoding of the certificate - * - Must be specified when the object is created. - */ - value: Buffer; -} - -/** - * WTLS certificate objects (certificate type `CKC_WTLS`) hold WTLS public key certificates - */ -declare class WtlsCertificate extends Certificate { - /** - * WTLS-encoding (Identifier type) of the certificate subject - * - Must be specified when the object is created. - * - Can only be empty if `CKA_VALUE` is empty. - */ - subject: Buffer; - /** - * WTLS-encoding (Identifier type) of the certificate issuer (default empty) - */ - issuer: Buffer; - /** - * Key identifier for public/private key pair (default empty) - */ - id: Buffer; - /** - * WTLS-encoding of the certificate - * - Must be specified when the object is created. - * - Must be non-empty if `CKA_URL` is empty. - */ - value: Buffer; - /** - * If not empty this attribute gives the URL where the complete certificate - * can be obtained (default empty) - * - Must be non-empty if `CKA_VALUE` is empty - */ - url: string; - /** - * DER-encoding of the certificate serial number (default empty) - */ - serialNumber: Buffer; - /** - * SHA-1 hash of the subject public key (default empty) - * - Can only be empty if `CKA_URL` is empty. - */ - subjetcKeyIdentifier: Buffer; - /** - * SHA-1 hash of the issuer public key (default empty) - * - Can only be empty if `CKA_URL` is empty. - */ - authorityKeyIdentifier: Buffer; -} - -declare enum JavaMIDP { - Unspecified, - Manufacturer, - Operator, - ThirdParty, -} - -/** - * X.509 certificate objects (certificate type `CKC_X_509`) hold X.509 public key certificates - */ -declare class X509Certificate extends Certificate { - /** - * DER-encoding of the certificate subject name - * - Must be specified when the object is created. - * - Must be non-empty if `CKA_URL` is empty. - */ - subject: Buffer; - /** - * Key identifier for public/private key pair (default empty) - */ - id: Buffer; - /** - * DER-encoding of the certificate issuer name (default empty) - */ - issuer: Buffer; - /** - * HEX-encoding of the certificate serial number (default empty) - */ - serialNumber: string; - /** - * BER-encoding of the certificate - * - Must be specified when the object is created. - * - Must be non-empty if `CKA_URL` is empty. - */ - value: Buffer; - /** - * If not empty this attribute gives the URL where the complete certificate - * can be obtained (default empty) - * - Must be non-empty if `CKA_VALUE` is empty - */ - url: string; - /** - * SHA-1 hash of the subject public key (default empty) - * - Can only be empty if `CKA_URL` is empty. - */ - subjetcKeyIdentifier: Buffer; - /** - * SHA-1 hash of the issuer public key (default empty) - * - Can only be empty if `CKA_URL` is empty. - */ - authorityKeyIdentifier: Buffer; - /** - * Java MIDP security domain - */ - java: JavaMIDP; -} - -interface IAlgorithm { - name: string; - params: Buffer | IParams; -} - -type MechanismType = MechanismEnum | KeyGenMechanism | IAlgorithm | string; - -declare enum MechanismFlag { - /** - * `True` if the mechanism is performed by the device; `false` if the mechanism is performed in software - */ - HW, - /** - * `True` if the mechanism can be used with encrypt function - */ - ENCRYPT, - /** - * `True` if the mechanism can be used with decrypt function - */ - DECRYPT, - /** - * `True` if the mechanism can be used with digest function - */ - DIGEST, - /** - * `True` if the mechanism can be used with sign function - */ - SIGN, - /** - * `True` if the mechanism can be used with sign recover function - */ - SIGN_RECOVER, - /** - * `True` if the mechanism can be used with verify function - */ - VERIFY, - /** - * `True` if the mechanism can be used with verify recover function - */ - VERIFY_RECOVER, - /** - * `True` if the mechanism can be used with geberate function - */ - GENERATE, - /** - * `True` if the mechanism can be used with generate key pair function - */ - GENERATE_KEY_PAIR, - /** - * `True` if the mechanism can be used with wrap function - */ - WRAP, - /** - * `True` if the mechanism can be used with unwrap function - */ - UNWRAP, - /** - * `True` if the mechanism can be used with derive function - */ - DERIVE, -} - -declare class Mechanism extends BaseObject { - - protected handle: number; - protected slotHandle: Handle; - - /** - * the minimum size of the key for the mechanism - * _whether this is measured in bits or in bytes is mechanism-dependent_ - */ - minKeySize: number; - /** - * the maximum size of the key for the mechanism - * _whether this is measured in bits or in bytes is mechanism-dependent_ - */ - maxKeySize: number; - /** - * bit flag specifying mechanism capabilities - */ - flags: number; - /** - * returns string name from MechanismEnum - */ - name: string; - - constructor(handle: number, slotHandle: Handle, lib: pkcs11.PKCS11); - - protected getInfo(): void; - - static create(alg: MechanismType): pkcs11.Mechanism; - static vendor(jsonFile: string): void; - static vendor(name: string, value: number): void; -} - -declare class MechanismCollection extends Collection { - - protected slotHandle: Handle; - - constructor(items: Array, slotHandle: Handle, lib: pkcs11.PKCS11, classType?: typeof Mechanism); - /** - * returns item from collection by index - * @param {number} index of element in collection `[0..n]` - */ - items(index: number): Mechanism; -} - -declare enum MechanismEnum { - RSA_PKCS_KEY_PAIR_GEN, - RSA_PKCS, - RSA_9796, - RSA_X_509, - MD2_RSA_PKCS, - MD5_RSA_PKCS, - SHA1_RSA_PKCS, - RIPEMD128_RSA_PKCS, - RIPEMD160_RSA_PKCS, - RSA_PKCS_OAEP, - RSA_X9_31_KEY_PAIR_GEN, - RSA_X9_31, - SHA1_RSA_X9_31, - RSA_PKCS_PSS, - SHA1_RSA_PKCS_PSS, - DSA_KEY_PAIR_GEN, - DSA, - DSA_SHA1, - DSA_SHA224, - DSA_SHA256, - DSA_SHA384, - DSA_SHA512, - DH_PKCS_KEY_PAIR_GEN, - DH_PKCS_DERIVE, - X9_42_DH_KEY_PAIR_GEN, - X9_42_DH_DERIVE, - X9_42_DH_HYBRID_DERIVE, - X9_42_MQV_DERIVE, - SHA256_RSA_PKCS, - SHA384_RSA_PKCS, - SHA512_RSA_PKCS, - SHA256_RSA_PKCS_PSS, - SHA384_RSA_PKCS_PSS, - SHA512_RSA_PKCS_PSS, - SHA224_RSA_PKCS, - SHA224_RSA_PKCS_PSS, - RC2_KEY_GEN, - RC2_ECB, - RC2_CBC, - RC2_MAC, - RC2_MAC_GENERAL, - RC2_CBC_PAD, - RC4_KEY_GEN, - RC4, - DES_KEY_GEN, - DES_ECB, - DES_CBC, - DES_MAC, - DES_MAC_GENERAL, - DES_CBC_PAD, - DES2_KEY_GEN, - DES3_KEY_GEN, - DES3_ECB, - DES3_CBC, - DES3_MAC, - DES3_MAC_GENERAL, - DES3_CBC_PAD, - CDMF_KEY_GEN, - CDMF_ECB, - CDMF_CBC, - CDMF_MAC, - CDMF_MAC_GENERAL, - CDMF_CBC_PAD, - DES_OFB64, - DES_OFB8, - DES_CFB64, - DES_CFB8, - MD2, - MD2_HMAC, - MD2_HMAC_GENERAL, - MD5, - MD5_HMAC, - MD5_HMAC_GENERAL, - SHA1, - SHA, - SHA_1, - SHA_1_HMAC, - SHA_1_HMAC_GENERAL, - RIPEMD128, - RIPEMD128_HMAC, - RIPEMD128_HMAC_GENERAL, - RIPEMD160, - RIPEMD160_HMAC, - RIPEMD160_HMAC_GENERAL, - SHA256, - SHA256_HMAC, - SHA256_HMAC_GENERAL, - SHA224, - SHA224_HMAC, - SHA224_HMAC_GENERAL, - SHA384, - SHA384_HMAC, - SHA384_HMAC_GENERAL, - SHA512, - SHA512_HMAC, - SHA512_HMAC_GENERAL, - SECURID_KEY_GEN, - SECURID, - HOTP_KEY_GEN, - HOTP, - ACTI, - ACTI_KEY_GEN, - CAST_KEY_GEN, - CAST_ECB, - CAST_CBC, - CAST_MAC, - CAST_MAC_GENERAL, - CAST_CBC_PAD, - CAST3_KEY_GEN, - CAST3_ECB, - CAST3_CBC, - CAST3_MAC, - CAST3_MAC_GENERAL, - CAST3_CBC_PAD, - CAST5_KEY_GEN, - CAST128_KEY_GEN, - CAST5_ECB, - CAST128_ECB, - CAST5_CBC, - CAST128_CBC, - CAST5_MAC, - CAST128_MAC, - CAST5_MAC_GENERAL, - CAST128_MAC_GENERAL, - CAST5_CBC_PAD, - CAST128_CBC_PAD, - RC5_KEY_GEN, - RC5_ECB, - RC5_CBC, - RC5_MAC, - RC5_MAC_GENERAL, - RC5_CBC_PAD, - IDEA_KEY_GEN, - IDEA_ECB, - IDEA_CBC, - IDEA_MAC, - IDEA_MAC_GENERAL, - IDEA_CBC_PAD, - GENERIC_SECRET_KEY_GEN, - CONCATENATE_BASE_AND_KEY, - CONCATENATE_BASE_AND_DATA, - CONCATENATE_DATA_AND_BASE, - XOR_BASE_AND_DATA, - EXTRACT_KEY_FROM_KEY, - SSL3_PRE_MASTER_KEY_GEN, - SSL3_MASTER_KEY_DERIVE, - SSL3_KEY_AND_MAC_DERIVE, - SSL3_MASTER_KEY_DERIVE_DH, - TLS_PRE_MASTER_KEY_GEN, - TLS_MASTER_KEY_DERIVE, - TLS_KEY_AND_MAC_DERIVE, - TLS_MASTER_KEY_DERIVE_DH, - TLS_PRF, - SSL3_MD5_MAC, - SSL3_SHA1_MAC, - MD5_KEY_DERIVATION, - MD2_KEY_DERIVATION, - SHA1_KEY_DERIVATION, - SHA256_KEY_DERIVATION, - SHA384_KEY_DERIVATION, - SHA512_KEY_DERIVATION, - SHA224_KEY_DERIVATION, - PBE_MD2_DES_CBC, - PBE_MD5_DES_CBC, - PBE_MD5_CAST_CBC, - PBE_MD5_CAST3_CBC, - PBE_MD5_CAST5_CBC, - PBE_MD5_CAST128_CBC, - PBE_SHA1_CAST5_CBC, - PBE_SHA1_CAST128_CBC, - PBE_SHA1_RC4_128, - PBE_SHA1_RC4_40, - PBE_SHA1_DES3_EDE_CBC, - PBE_SHA1_DES2_EDE_CBC, - PBE_SHA1_RC2_128_CBC, - PBE_SHA1_RC2_40_CBC, - PKCS5_PBKD2, - PBA_SHA1_WITH_SHA1_HMAC, - WTLS_PRE_MASTER_KEY_GEN, - WTLS_MASTER_KEY_DERIVE, - WTLS_MASTER_KEY_DERIVE_DH_ECC, - WTLS_PRF, - WTLS_SERVER_KEY_AND_MAC_DERIVE, - WTLS_CLIENT_KEY_AND_MAC_DERIVE, - KEY_WRAP_LYNKS, - KEY_WRAP_SET_OAEP, - CAMELLIA_KEY_GEN, - CAMELLIA_ECB, - CAMELLIA_CBC, - CAMELLIA_MAC, - CAMELLIA_MAC_GENERAL, - CAMELLIA_CBC_PAD, - CAMELLIA_ECB_ENCRYPT_DATA, - CAMELLIA_CBC_ENCRYPT_DATA, - CAMELLIA_CTR, - ARIA_KEY_GEN, - ARIA_ECB, - ARIA_CBC, - ARIA_MAC, - ARIA_MAC_GENERAL, - ARIA_CBC_PAD, - ARIA_ECB_ENCRYPT_DATA, - ARIA_CBC_ENCRYPT_DATA, - SKIPJACK_KEY_GEN, - SKIPJACK_ECB64, - SKIPJACK_CBC64, - SKIPJACK_OFB64, - SKIPJACK_CFB64, - SKIPJACK_CFB32, - SKIPJACK_CFB16, - SKIPJACK_CFB8, - SKIPJACK_WRAP, - SKIPJACK_PRIVATE_WRAP, - SKIPJACK_RELAYX, - KEA_KEY_PAIR_GEN, - KEA_KEY_DERIVE, - FORTEZZA_TIMESTAMP, - BATON_KEY_GEN, - BATON_ECB128, - BATON_ECB96, - BATON_CBC128, - BATON_COUNTER, - BATON_SHUFFLE, - BATON_WRAP, - ECDSA_KEY_PAIR_GEN, - EC_KEY_PAIR_GEN, - ECDSA, - ECDSA_SHA1, - ECDSA_SHA224, - ECDSA_SHA256, - ECDSA_SHA384, - ECDSA_SHA512, - ECDH1_DERIVE, - ECDH1_COFACTOR_DERIVE, - ECMQV_DERIVE, - JUNIPER_KEY_GEN, - JUNIPER_ECB128, - JUNIPER_CBC128, - JUNIPER_COUNTER, - JUNIPER_SHUFFLE, - JUNIPER_WRAP, - FASTHASH, - AES_KEY_GEN, - AES_ECB, - AES_CBC, - AES_MAC, - AES_MAC_GENERAL, - AES_CBC_PAD, - AES_CTR, - AES_CMAC, - AES_CMAC_GENERAL, - BLOWFISH_KEY_GEN, - BLOWFISH_CBC, - TWOFISH_KEY_GEN, - TWOFISH_CBC, - AES_GCM, - AES_CCM, - AES_KEY_WRAP, - AES_KEY_WRAP_PAD, - DES_ECB_ENCRYPT_DATA, - DES_CBC_ENCRYPT_DATA, - DES3_ECB_ENCRYPT_DATA, - DES3_CBC_ENCRYPT_DATA, - AES_ECB_ENCRYPT_DATA, - AES_CBC_ENCRYPT_DATA, - GOSTR3410_KEY_PAIR_GEN, - GOSTR3410, - GOSTR3410_WITH_GOSTR3411, - GOSTR3410_KEY_WRAP, - GOSTR3410_DERIVE, - GOSTR3411, - GOSTR3411_HMAC, - GOST28147_KEY_GEN, - GOST28147_ECB, - GOST28147, - GOST28147_MAC, - GOST28147_KEY_WRAP, - DSA_PARAMETER_GEN, - DH_PKCS_PARAMETER_GEN, - X9_42_DH_PARAMETER_GEN, - VENDOR_DEFINED, -} - -declare enum SessionFlag { - /** - * `True` if the session is read/write; `false` if the session is read-only - */ - RW_SESSION, - /** - * This flag is provided for backward compatibility, and should always be set to `true` - */ - SERIAL_SESSION, -} - -declare enum UserType { - /** - * Security Officer - */ - SO, - /** - * User - */ - USER, - /** - * Context specific - */ - CONTEXT_SPECIFIC, -} - -interface IKeyPair { - privateKey: PrivateKey; - publicKey: PublicKey; -} - -/** - * provides information about a session - * - * @export - * @declare class Session - * @extends {core.HandleObject} - */ -declare class Session extends HandleObject { - - constructor(handle: Handle, slot: Slot, lib: pkcs11.PKCS11); - /** - * Slot - * - * @type {Slot} - */ - slot: Slot; - /** - * the state of the session - * - * @type {number} - */ - state: number; - /** - * bit flags that define the type of session - * - * @type {number} - */ - flags: number; - /** - * an error code defined by the cryptographic device. Used for errors not covered by Cryptoki - * - * @type {number} - */ - deviceError: number; - - protected getInfo(): void; - - /** - * closes a session between an application and a token - */ - close(): void; - /** - * initializes the normal user's PIN - * @param {string} pin the normal user's PIN - */ - initPin(pin: string): void; - /** - * modifies the PIN of the user who is logged in - * @param {string} oldPin - * @param {string} newPin - */ - setPin(oldPin: string, newPin: string): void; - /** - * obtains a copy of the cryptographic operations state of a session, encoded as a string of bytes - */ - getOperationState(): Buffer; - /** - * restores the cryptographic operations state of a session - * from a string of bytes obtained with getOperationState - * @param {Buffer} state the saved state - * @param {number} encryptionKey holds key which will be used for an ongoing encryption - * or decryption operation in the restored session - * (or 0 if no encryption or decryption key is needed, - * either because no such operation is ongoing in the stored session - * or because all the necessary key information is present in the saved state) - * @param {number} authenticationKey holds a handle to the key which will be used for an ongoing signature, - * MACing, or verification operation in the restored session - * (or 0 if no such key is needed, either because no such operation is ongoing in the stored session - * or because all the necessary key information is present in the saved state) - */ - setOperationState(state: Buffer, encryptionKey?: number, authenticationKey?: number): void; - /** - * logs a user into a token - * @param {string} pin the user's PIN. - * - This standard allows PIN values to contain any valid `UTF8` character, - * but the token may impose subset restrictions - * @param {} userType the user type. Default is `USER` - */ - login(pin: string, userType?: UserType): void; - /** - * logs a user out from a token - */ - logout(): void; - /** - * creates a new object - * - Only session objects can be created during a read-only session. - * - Only public objects can be created unless the normal user is logged in. - * @param {ITemplate} template the object's template - * @returns {SessionObject} - */ - create(template: ITemplate): SessionObject; - /** - * Copies an object, creating a new object for the copy - * @param {SessionObject} object the copied object - * @param {ITemplate} template template for new object - * @returns {SessionObject} - */ - copy(object: SessionObject, template: ITemplate): SessionObject; - /** - * removes all session objects matched to template - * - if template is null, removes all session objects - * - returns a number of destroied session objects - * @param {ITemplate} template template - */ - destroy(template: ITemplate): number; - /** - * @param {SessionObject} object - */ - destroy(object: SessionObject): number; - destroy(): number; - /** - * removes all session objects - * - returns a number of destroied session objects - */ - clear(): number; - /** - * returns a collection of session objects mached to template - * @param template template - * @param callback optional callback function wich is called for each founded object - * - if callback function returns false, it breaks find function. - */ - find(callback?: (obj: SessionObject) => any): SessionObjectCollection; - find(template: ITemplate, callback?: (obj: SessionObject, index: number) => any): SessionObjectCollection; - /** - * Returns object from session by handle - * @param {number} handle handle of object - * @returns T - */ - getObject(handle: Handle): T; - /** - * generates a secret key or set of domain parameters, creating a new object. - * @param mechanism generation mechanism - * @param template template for the new key or set of domain parameters - */ - generateKey(mechanism: MechanismType, template?: ITemplate): SecretKey; - generateKey(mechanism: MechanismType, template: ITemplate, callback: (err: Error, key: SecretKey) => void): void; - generateKeyPair(mechanism: MechanismType, publicTemplate: ITemplate, privateTemplate: ITemplate): IKeyPair; - generateKeyPair(mechanism: MechanismType, publicTemplate: ITemplate, privateTemplate: ITemplate, callback: (err: Error, keys: IKeyPair) => void): void; - createSign(alg: MechanismType, key: Key): Sign; - createVerify(alg: MechanismType, key: Key): Verify; - createCipher(alg: MechanismType, key: Key): Cipher; - createDecipher(alg: MechanismType, key: Key, blockSize?: number): Decipher; - createDigest(alg: MechanismType): Digest; - wrapKey(alg: MechanismType, wrappingKey: Key, key: Key): Buffer; - wrapKey(alg: MechanismType, wrappingKey: Key, key: Key, callback: (err: Error, wkey: Buffer) => void): void; - unwrapKey(alg: MechanismType, unwrappingKey: Key, wrappedKey: Buffer, template: ITemplate): Key; - unwrapKey(alg: MechanismType, unwrappingKey: Key, wrappedKey: Buffer, template: ITemplate, callback: (err: Error, key: Key) => void): void; - /** - * derives a key from a base key, creating a new key object - * @param {MechanismType} alg key deriv. mech - * @param {Key} baseKey base key - * @param {ITemplate} template new key template - */ - deriveKey(alg: MechanismType, baseKey: Key, template: ITemplate): SecretKey; - deriveKey(alg: MechanismType, baseKey: Key, template: ITemplate, callback: (err: Error, key: Key) => void): void; - /** - * generates random data - * @param {number} size \# of bytes to generate - */ - generateRandom(size: number): Buffer; -} - -interface ITemplate { - /** - * CKA_CLASS - */ - class?: number; - /** - * CKA_TOKEN - */ - token?: boolean; - /** - * CKA_PRIVATE - */ - private?: boolean; - /** - * CKA_LABEL - */ - label?: string; - /** - * CKA_APPLICATION - */ - application?: string; - /** - * CKA_VALUE - */ - value?: Buffer; - /** - * CKA_OBJECT_ID - */ - objectId?: Buffer; - /** - * CKA_CERTIFICATE_TYPE - */ - certType?: number; - /** - * CKA_ISSUER - */ - issuer?: Buffer; - /** - * CKA_SERIAL_NUMBER - */ - serial?: Buffer; - /** - * CKA_AC_ISSUER - */ - issuerAC?: Buffer; - /** - * CKA_OWNER - */ - owner?: Buffer; - /** - * CKA_ATTR_TYPES - */ - attrTypes?: Buffer; - /** - * CKA_TRUSTED - */ - trusted?: boolean; - /** - * CKA_CERTIFICATE_CATEGORY - */ - certCategory?: number; - /** - * CKA_JAVA_MIDP_SECURITY_DOMAIN - */ - javaDomain?: number; - /** - * CKA_URL - */ - url?: string; - /** - * CKA_HASH_OF_SUBJECT_PUBLIC_KEY - */ - ski?: Buffer; - /** - * CKA_HASH_OF_ISSUER_PUBLIC_KEY - */ - aki?: Buffer; - /** - * CKA_NAME_HASH_ALGORITHM - */ - digestName?: number; - /** - * CKA_CHECK_VALUE - */ - checkValue?: Buffer; - /** - * CKA_KEY_TYPE - */ - keyType?: number; - /** - * CKA_SUBJECT - */ - subject?: Buffer; - /** - * CKA_ID - */ - id?: Buffer; - /** - * CKA_SENSITIVE - */ - sensitive?: boolean; - /** - * CKA_ENCRYPT - */ - encrypt?: boolean; - /** - * CKA_DECRYPT - */ - decrypt?: boolean; - /** - * CKA_WRAP - */ - wrap?: boolean; - /** - * CKA_UNWRAP - */ - unwrap?: boolean; - /** - * CKA_SIGN - */ - sign?: boolean; - /** - * CKA_SIGN_RECOVER - */ - signRecover?: boolean; - /** - * CKA_VERIFY - */ - verify?: boolean; - /** - * CKA_VERIFY_RECOVER - */ - verifyRecover?: boolean; - /** - * CKA_DERIVE - */ - derive?: boolean; - /** - * CKA_START_DATE - */ - startDate?: Date; - /** - * CKA_END_DATE - */ - endDate?: Date; - /** - * CKA_MODULUS - */ - modulus?: Buffer; - /** - * CKA_MODULUS_BITS - */ - modulusBits?: number; - /** - * CKA_PUBLIC_EXPONENT - */ - publicExponent?: Buffer; - /** - * CKA_PRIVATE_EXPONEN - */ - privateExponent?: Buffer; - /** - * CKA_PRIME_1 - */ - prime1?: Buffer; - /** - * CKA_PRIME_2 - */ - prime2?: Buffer; - /** - * CKA_EXPONENT_1 - */ - exp1?: Buffer; - /** - * CKA_EXPONENT_2 - */ - exp2?: Buffer; - /** - * CKA_COEFFICIEN - */ - coefficient?: Buffer; - /** - * CKA_PRIME - */ - prime?: Buffer; - /** - * CKA_SUBPRIME - */ - subprime?: Buffer; - /** - * CKA_BASE - */ - base?: Buffer; - /** - * CKA_PRIME_BITS - */ - primeBits?: number; - /** - * CKA_SUBPRIME_BITS - */ - subprimeBits?: number; - /** - * CKA_VALUE_BITS - */ - valueBits?: number; - /** - * CKA_VALUE_LEN - */ - valueLen?: number; - /** - * CKA_EXTRACTABLE - */ - extractable?: boolean; - /** - * CKA_LOCAL - */ - local?: boolean; - /** - * CKA_NEVER_EXTRACTABLE - */ - neverExtractable?: boolean; - /** - * CKA_ALWAYS_SENSITIVE - */ - alwaysSensitive?: boolean; - /** - * CKA_KEY_GEN_MECHANISM - */ - keyGenMechanism?: number; - /** - * CKA_MODIFIABLE - */ - modifiable?: boolean; - /** - * CKA_COPYABLE - */ - copyable?: boolean; - /** - * CKA_ECDSA_PARAMS - */ - paramsECDSA?: Buffer; - paramsEC?: Buffer; - /** - * CKA_EC_POINT - */ - pointEC?: Buffer; - /** - * CKA_SECONDARY_AUTH - */ - secondaryAuth?: boolean; - /** - * CKA_AUTH_PIN_FLAGS - */ - authPinFlags?: Buffer; - /** - * CKA_ALWAYS_AUTHENTICATE - */ - alwaysAuth?: boolean; - /** - * CKA_WRAP_WITH_TRUSTED - */ - wrapWithTrusted?: boolean; - /** - * CKA_WRAP_TEMPLATE - */ - wrapTemplate?: any; - /** - * CKA_UNWRAP_TEMPLATE - */ - unwrapTemplate?: any; - /** - * CKA_OTP_FORMAT - */ - otpFormat?: any; - /** - * CKA_OTP_LENGTH - */ - otpLength?: any; - /** - * CKA_OTP_TIME_INTERVAL - */ - otpTimeInterval?: any; - /** - * CKA_OTP_USER_FRIENDLY_MODE - */ - otpUserFriendlyMode?: any; - /** - * CKA_OTP_CHALLENGE_REQUIREMENT - */ - otpChallengeReq?: any; - /** - * CKA_OTP_TIME_REQUIREMENT - */ - otpTimeReq?: any; - /** - * CKA_OTP_COUNTER_REQUIREMENT - */ - otpCounterReq?: any; - /** - * CKA_OTP_PIN_REQUIREMENT - */ - otppinReq?: any; - /** - * CKA_OTP_COUNTER - */ - otpCounter?: any; - /** - * CKA_OTP_TIME - */ - otpTime?: any; - /** - * CKA_OTP_USER_IDENTIFIER - */ - otpUserId?: any; - /** - * CKA_OTP_SERVICE_IDENTIFIER - */ - otpServiceId?: any; - /** - * CKA_OTP_SERVICE_LOGO - */ - otpServiceLogo?: any; - /** - * CKA_OTP_SERVICE_LOGO_TYPE - */ - otpServiceLogoType?: any; - /** - * CKA_HW_FEATURE_TYPE - */ - hwFeatureType?: any; - /** - * CKA_RESET_ON_INIT - */ - resetOnInit?: any; - /** - * CKA_HAS_RESET - */ - hasReset?: any; - /** - * CKA_PIXEL_X - */ - pixelX?: any; - /** - * CKA_PIXEL_Y - */ - pixelY?: any; - /** - * CKA_RESOLUTION - */ - resolution?: any; - /** - * CKA_CHAR_ROWS - */ - charRows?: any; - /** - * CKA_CHAR_COLUMNS - */ - charCols?: any; - /** - * CKA_COLOR - */ - color?: any; - /** - * CKA_BITS_PER_PIXEL - */ - bitsPerPixel?: any; - /** - * CKA_CHAR_SETS - */ - charSets?: any; - /** - * CKA_ENCODING_METHODS - */ - encMethod?: any; - /** - * CKA_MIME_TYPES - */ - mimeTypes?: any; - /** - * CKA_MECHANISM_TYPE - */ - mechanismType?: any; - /** - * CKA_REQUIRED_CMS_ATTRIBUTES - */ - requiredCmsAttrs?: any; - /** - * CKA_DEFAULT_CMS_ATTRIBUTES - */ - defaultCmsAttrs?: any; - /** - * CKA_SUPPORTED_CMS_ATTRIBUTES - */ - suportedCmsAttrs?: any; - /** - * CKA_ALLOWED_MECHANISMS - */ - allowedMechanisms?: any; -} - -declare class Template { - static toPkcs11(tmpl: ITemplate): pkcs11.Attribute[]; - static fromPkcs11(tmpl: pkcs11.Template): ITemplate; -} - -declare enum SlotFlag { - /** - * `True` if a token is present in the slot (e.g., a device is in the reader) - */ - TOKEN_PRESENT, - /** - * `True` if the reader supports removable devices - */ - REMOVABLE_DEVICE, - /** - * True if the slot is a hardware slot, as opposed to a software slot implementing a "soft token" - */ - HW_SLOT, -} -declare class Slot extends HandleObject { - - slotDescription: string; - manufacturerID: string; - flags: number; - hardwareVersion: pkcs11.Version; - firmwareVersion: pkcs11.Version; - module: Module; - - constructor(handle: Handle, module: Module, lib: pkcs11.PKCS11); - - /** - * Recieve information about Slot - * - * @protected - */ - protected getInfo(): void; - - /** - * Returns information about token - * - * @returns {Token} - */ - getToken(): Token; - /** - * returns list of `MechanismInfo` - * - * @returns {MechanismCollection} - */ - getMechanisms(): MechanismCollection; - /** - * initializes a token - * - * @param {string} pin the SO's initial PIN - * @returns {string} - */ - initToken(pin: string): string; - /** - * opens a session between an application and a token in a particular slot - * - * @param {SessionFlag} [flags=session.SessionFlag.SERIAL_SESSION] indicates the type of session - * @returns {Session} - */ - open(flags?: SessionFlag): Session; - /** - * closes all sessions an application has with a token - */ - closeAll(): void; -} - -/** - * Collection of slots - * - * @export - * @declare class SlotCollection - * @extends {core.Collection} - */ -declare class SlotCollection extends Collection { - module: Module; - items(index: number): Slot; - constructor(items: Array, module: Module, lib: pkcs11.PKCS11, classType?: any); -} - -declare enum TokenFlag { - RNG, - WRITE_PROTECTED, - LOGIN_REQUIRED, - USER_PIN_INITIALIZED, - RESTORE_KEY_NOT_NEEDED, - CLOCK_ON_TOKEN, - PROTECTED_AUTHENTICATION_PATH, - DUAL_CRYPTO_OPERATIONS, - TOKEN_INITIALIZED, - SECONDARY_AUTHENTICATION, - USER_PIN_COUNT_LOW, - USER_PIN_FINAL_TRY, - USER_PIN_LOCKED, - USER_PIN_TO_BE_CHANGED, - SO_PIN_COUNT_LOW, - SO_PIN_FINAL_TRY, - SO_PIN_LOCKED, - SO_PIN_TO_BE_CHANGED, - ERROR_STATE, -} - -declare class Token extends HandleObject { - /** - * application-defined label, assigned during token initialization. - * - Must be padded with the blank character (' '). - * - Should __not__ be null-terminated. - */ - label: string; - /** - * ID of the device manufacturer. - * - Must be padded with the blank character (' '). - * - Should __not__ be null-terminated. - */ - manufacturerID: string; - /** - * model of the device. - * - Must be padded with the blank character (' '). - * - Should __not__ be null-terminated. - */ - model: string; - /** - * character-string serial number of the device. - * - Must be padded with the blank character (' '). - * - Should __not__ be null-terminated. - */ - serialNumber: string; - /** - * bit flags indicating capabilities and status of the device - */ - flags: number; - /** - * maximum number of sessions that can be opened with the token at one time by a single application - */ - maxSessionCount: number; - /** - * number of sessions that this application currently has open with the token - */ - sessionCount: number; - /** - * maximum number of read/write sessions that can be opened - * with the token at one time by a single application - */ - maxRwSessionCount: number; - /** - * number of read/write sessions that this application currently has open with the token - */ - rwSessionCount: number; - /** - * maximum length in bytes of the PIN - */ - maxPinLen: number; - /** - * minimum length in bytes of the PIN - */ - minPinLen: number; - /** - * the total amount of memory on the token in bytes in which public objects may be stored - */ - totalPublicMemory: number; - /** - * the amount of free (unused) memory on the token in bytes for public objects - */ - freePublicMemory: number; - /** - * the total amount of memory on the token in bytes in which private objects may be stored - */ - totalPrivateMemory: number; - /** - * the amount of free (unused) memory on the token in bytes for private objects - */ - freePrivateMemory: number; - /** - * version number of hardware - */ - hardwareVersion: pkcs11.Version; - /** - * version number of firmware - */ - firmwareVersion: pkcs11.Version; - /** - * current time as a character-string of length 16, - * represented in the format YYYYMMDDhhmmssxx - */ - utcTime: Date; - - constructor(handle: Handle, lib: pkcs11.PKCS11); - - protected getInfo(): void; -} - -declare class Module extends BaseObject { - libFile: string; - libName: string; - /** - * Cryptoki interface version - */ - cryptokiVersion: pkcs11.Version; - /** - * blank padded manufacturer ID - */ - manufacturerID: string; - /** - * must be zero - */ - flags: number; - /** - * blank padded library description - */ - libraryDescription: string; - /** - * version of library - */ - libraryVersion: pkcs11.Version; - constructor(lib: pkcs11.PKCS11); - protected getInfo(): void; - /** - * initializes the Cryptoki library - */ - initialize(): void; - /** - * indicates that an application is done with the Cryptoki library - */ - finalize(): void; - /** - * obtains a list of slots in the system - * @param {number} index index of an element in collection - * @param {number} tokenPresent only slots with tokens. Default `True` - */ - getSlots(index: number, tokenPresent?: boolean): Slot; - /** - * @param {number} tokenPresent only slots with tokens. Default `True` - */ - getSlots(tokenPresent?: boolean): SlotCollection; - /** - * loads pkcs11 lib - * @param libFile path to PKCS11 library - * @param libName name of PKCS11 library - */ - static load(libFile: string, libName?: string): Module; -} diff --git a/types/graphene-pk11/package.json b/types/graphene-pk11/package.json deleted file mode 100644 index 6b565b11a3..0000000000 --- a/types/graphene-pk11/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "pkcs11js": "^1.0.8" - } -} diff --git a/types/graphene-pk11/tsconfig.json b/types/graphene-pk11/tsconfig.json deleted file mode 100644 index 1d66008bb3..0000000000 --- a/types/graphene-pk11/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "graphene-pk11-tests.ts" - ] -} \ No newline at end of file diff --git a/types/graphene-pk11/tslint.json b/types/graphene-pk11/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/graphene-pk11/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 66fd935c7eb855017b4d57a5f0dec98c2d8a0084 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:41:48 -0800 Subject: [PATCH 130/890] easystarjs: Provides its own types --- notNeededPackages.json | 6 +++ types/easystarjs/easystarjs-tests.ts | 45 ---------------- types/easystarjs/index.d.ts | 35 ------------ types/easystarjs/tsconfig.json | 24 --------- types/easystarjs/tslint.json | 79 ---------------------------- 5 files changed, 6 insertions(+), 183 deletions(-) delete mode 100644 types/easystarjs/easystarjs-tests.ts delete mode 100644 types/easystarjs/index.d.ts delete mode 100644 types/easystarjs/tsconfig.json delete mode 100644 types/easystarjs/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 369b0c12e0..d76814fa63 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -198,6 +198,12 @@ "sourceRepoURL": "https://github.com/dvajs/dva", "asOfVersion": "1.1.0" }, + { + "libraryName": "EasyStar.js", + "typingsPackageName": "easystarjs", + "sourceRepoURL": "http://easystarjs.com/", + "asOfVersion": "0.3.1" + }, { "libraryName": "ecmarkup", "typingsPackageName": "ecmarkup", diff --git a/types/easystarjs/easystarjs-tests.ts b/types/easystarjs/easystarjs-tests.ts deleted file mode 100644 index 206e5bf2cc..0000000000 --- a/types/easystarjs/easystarjs-tests.ts +++ /dev/null @@ -1,45 +0,0 @@ -// For node.js compile using: tsc --module commonjs easystarjs-tests.ts -// then run using: node easystarjs-tests.js -import EasyStar = require('easystarjs'); - -var test = new EasyStar.js(); - -test.setGrid([ - [0, 0, 0, 1, 0], - [0, 0, 0, 1, 0], - [0, 0, 1, 1, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 1, 0] -]); -test.setAcceptableTiles([0]); -test.setIterationsPerCalculation(1000); -test.findPath(2, 0, 4, 4, function (path: EasyStar.Position[]) -{ - if (path == null) - { - console.log("No path found!"); - return; - } - for (var i = 0; i < path.length; i++) - { - var pos = path[i]; - console.log("%d, %d", pos.x, pos.y); - } -}); - -test.calculate(); - -/* -Should log: - -2, 0 -2, 1 -1, 1 -1, 2 -1, 3 -2, 3 -3, 3 -4, 3 -4, 4 - -*/ \ No newline at end of file diff --git a/types/easystarjs/index.d.ts b/types/easystarjs/index.d.ts deleted file mode 100644 index c4da0c51a7..0000000000 --- a/types/easystarjs/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Type definitions for EasyStar.js 0.1.6 -// Project: http://easystarjs.com/ -// Definitions by: Magnus Gustafsson -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/* - easystarjs.d.ts may be freely distributed under the MIT license. - */ - -export = easystarjs; - -declare namespace easystarjs -{ - class js - { - new (): js; - setGrid(grid: number[][]): void; - setAcceptableTiles(tiles: number[]): void; - findPath(startX: number, startY: number, endX: number, endY: number, callback: (path: Position[]) => void): void; - calculate(): void; - setIterationsPerCalculation(iterations: number): void; - avoidAdditionalPoint(x: number, y: number): void; - stopAvoidingAdditionalPoint(x: number, y: number): void; - stopAvoidingAllAdditionalPoints(): void; - enableDiagonals(): void; - disableDiagonals(): void; - setTileCost(tileType: number, multiplicativeCost: number): void; - } - - interface Position - { - x: number; - y: number; - } -} \ No newline at end of file diff --git a/types/easystarjs/tsconfig.json b/types/easystarjs/tsconfig.json deleted file mode 100644 index 0f36761c26..0000000000 --- a/types/easystarjs/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "easystarjs-tests.ts" - ] -} \ No newline at end of file diff --git a/types/easystarjs/tslint.json b/types/easystarjs/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/easystarjs/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 5ff26bbdd1b5677c7ce0161c32ecd12e06218252 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:47:33 -0800 Subject: [PATCH 131/890] vue-i18n: Provides its own types --- notNeededPackages.json | 6 ++ types/vue-i18n/index.d.ts | 79 ------------------------- types/vue-i18n/package.json | 6 -- types/vue-i18n/tsconfig.json | 24 -------- types/vue-i18n/tslint.json | 8 --- types/vue-i18n/vue-i18n-tests.ts | 98 -------------------------------- 6 files changed, 6 insertions(+), 215 deletions(-) delete mode 100644 types/vue-i18n/index.d.ts delete mode 100644 types/vue-i18n/package.json delete mode 100644 types/vue-i18n/tsconfig.json delete mode 100644 types/vue-i18n/tslint.json delete mode 100644 types/vue-i18n/vue-i18n-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index e8256d8398..f4b1c443a6 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -876,6 +876,12 @@ "sourceRepoURL": "https://github.com/vuejs/vue", "asOfVersion": "2.0.0" }, + { + "libraryName": "vue-i18n", + "typingsPackageName": "vue-i18n", + "sourceRepoURL": "https://github.com/kazupon/vue-i18n", + "asOfVersion": "7.0.0" + }, { "libraryName": "vue-router", "typingsPackageName": "vue-router", diff --git a/types/vue-i18n/index.d.ts b/types/vue-i18n/index.d.ts deleted file mode 100644 index 030487a98b..0000000000 --- a/types/vue-i18n/index.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -// Type definitions for vue-i18n 6.1 -// Project: https://github.com/kazupon/vue-i18n -// Definitions by: Kombu -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import Vue, { PluginFunction } from 'vue'; - -declare namespace VueI18n { - type Path = string; - type Locale = string; - type Values = any[] | { [key: string]: any }; - type Choice = number; - type LocaleMessage = string | LocaleMessageObject | LocaleMessageArray; - interface LocaleMessageObject { [key: string]: LocaleMessage; } - interface LocaleMessageArray { [index: number]: LocaleMessage; } - interface LocaleMessages { [key: string]: LocaleMessageObject; } - type TranslateResult = string | LocaleMessageArray; - - interface Formatter { - format(message: string, values: Values): string; - } - - type MissingHandler = (locale: Locale, key: Path, vm?: Vue) => void; - - // tslint:disable-next-line:interface-name - interface I18nOptions { - locale?: Locale; - fallbackLocale?: Locale; - messages?: LocaleMessages; - formatter?: Formatter; - missing?: MissingHandler; - fallbackRoot?: boolean; - sync?: boolean; - silentTranslationWarn?: boolean; - } -} - -declare class VueI18n { - constructor(options?: VueI18n.I18nOptions) - - readonly messages: VueI18n.LocaleMessages; - - locale: VueI18n.Locale; - fallbackLocale: VueI18n.Locale; - missing: VueI18n.MissingHandler; - formatter: VueI18n.Formatter; - silentTranslationWarn: boolean; - - t(key: VueI18n.Path, values?: VueI18n.Values): VueI18n.TranslateResult; - t(key: VueI18n.Path, locale: VueI18n.Locale, values?: VueI18n.Values): VueI18n.TranslateResult; - tc(key: VueI18n.Path, choice?: VueI18n.Choice, values?: VueI18n.Values): string; - tc(key: VueI18n.Path, choice: VueI18n.Choice, locale: VueI18n.Locale, values?: VueI18n.Values): string; - te(key: VueI18n.Path, locale?: VueI18n.Locale): boolean; - - getLocaleMessage(locale: VueI18n.Locale): VueI18n.LocaleMessageObject; - setLocaleMessage(locale: VueI18n.Locale, message: VueI18n.LocaleMessageObject): void; - mergeLocaleMessage(locale: VueI18n.Locale, message: VueI18n.LocaleMessageObject): void; - - static install: PluginFunction; - static version: string; -} - -declare module 'vue/types/vue' { - interface Vue { - readonly $i18n: VueI18n; - $t: typeof VueI18n.prototype.t; - $tc: typeof VueI18n.prototype.tc; - $te: typeof VueI18n.prototype.te; - } -} - -declare module 'vue/types/options' { - interface ComponentOptions { - i18n?: VueI18n; - } -} - -export = VueI18n; diff --git a/types/vue-i18n/package.json b/types/vue-i18n/package.json deleted file mode 100644 index 2127792b46..0000000000 --- a/types/vue-i18n/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "vue": "^2.2.6" - } -} diff --git a/types/vue-i18n/tsconfig.json b/types/vue-i18n/tsconfig.json deleted file mode 100644 index a95a81b1d0..0000000000 --- a/types/vue-i18n/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "vue-i18n-tests.ts" - ] -} \ No newline at end of file diff --git a/types/vue-i18n/tslint.json b/types/vue-i18n/tslint.json deleted file mode 100644 index 099be8c124..0000000000 --- a/types/vue-i18n/tslint.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-duplicate-imports": false, - "prefer-const": false - } -} diff --git a/types/vue-i18n/vue-i18n-tests.ts b/types/vue-i18n/vue-i18n-tests.ts deleted file mode 100644 index 693b069f52..0000000000 --- a/types/vue-i18n/vue-i18n-tests.ts +++ /dev/null @@ -1,98 +0,0 @@ -/// - -const assert = console.assert; -const random = () => Math.trunc(Math.exp(Math.log(Date.now()) * Math.random())); - -import Vue, { ComponentOptions } from 'vue'; -import * as VueI18n from 'vue-i18n'; - -/** - * VueI18n.install - */ -Vue.use(VueI18n); -VueI18n.install(Vue); - -/** - * VueI18n.version - */ -assert(typeof VueI18n.version === 'string'); - -/** - * VueI18n Instance - */ -const locale = random().toString(); -const key = `_${random()}`; -const value = `${random()}|${random()}|${random()}`; -const i18n = new VueI18n({ - locale, - fallbackLocale: locale, - messages: { - [locale]: { - [key]: value, - }, - }, - formatter: { - format(message, values) { - return message; - }, - }, - missing(locale, key, vm) { - }, - fallbackRoot: false, - sync: true, - silentTranslationWarn: true, -}); -assert(i18n.messages[locale][key] === value); -assert(i18n.locale === locale); -assert(i18n.fallbackLocale === locale); -assert(typeof i18n.missing === 'function'); -assert(typeof i18n.formatter.format === 'function'); -assert(i18n.silentTranslationWarn); -i18n.setLocaleMessage(locale, {}); -assert(i18n.getLocaleMessage(locale)[key] === undefined); -i18n.mergeLocaleMessage(locale, { [key]: value }); -assert(i18n.getLocaleMessage(locale)[key] === value); -assert(typeof i18n.t === 'function'); -assert(typeof i18n.tc === 'function'); -assert(typeof i18n.te === 'function'); - -/** - * Vue - */ -const vm = new Vue({ - i18n, -}); -assert(vm.$i18n === i18n); -assert(vm.$t(key) === value); -assert(vm.$t(key, ['', 0, false, null, undefined]) === value); -assert(vm.$t(key, { x: 'x' }) === value); -assert(vm.$t(key, locale) === value); -assert(vm.$t(key, locale, ['', 0, false, null, undefined]) === value); -assert(vm.$t(key, locale, { x: 'x' }) === value); -assert(vm.$tc(key) === value); -assert(vm.$tc(key, 1) === value.split('|')[1]); -assert(vm.$tc(key, 1, []) === value.split('|')[1]); -assert(vm.$tc(key, 1, {}) === value.split('|')[1]); -assert(vm.$tc(key, 1, locale) === value.split('|')[1]); -assert(vm.$tc(key, 1, locale, []) === value.split('|')[1]); -assert(vm.$tc(key, 1, locale, {}) === value.split('|')[1]); -assert(vm.$te(key)); -assert(vm.$te(key, locale)); - -/** - * VueI18n - */ -{ - let path: VueI18n.Path; - let locale: VueI18n.Locale; - let values: VueI18n.Values; - let choice: VueI18n.Choice; - let localeMessage: VueI18n.LocaleMessage; - let localeMessageObject: VueI18n.LocaleMessageObject; - let localeMessageArray: VueI18n.LocaleMessageArray; - let localeMessages: VueI18n.LocaleMessages; - let translateResult: VueI18n.TranslateResult; - let formatter: VueI18n.Formatter; - let missingHandler: VueI18n.MissingHandler; - let i18nOptions: VueI18n.I18nOptions; -} From 2f44fcb30e76d720322cab7cb441105ec9752988 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:52:27 -0800 Subject: [PATCH 132/890] cachefactory: Provides its own types --- notNeededPackages.json | 6 + types/cachefactory/cachefactory-tests.ts | 32 -- types/cachefactory/index.d.ts | 441 ----------------------- types/cachefactory/tsconfig.json | 23 -- types/cachefactory/tslint.json | 79 ---- 5 files changed, 6 insertions(+), 575 deletions(-) delete mode 100644 types/cachefactory/cachefactory-tests.ts delete mode 100644 types/cachefactory/index.d.ts delete mode 100644 types/cachefactory/tsconfig.json delete mode 100644 types/cachefactory/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index e8256d8398..db950ee187 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -126,6 +126,12 @@ "sourceRepoURL": "https://github.com/bugsnag/bugsnag-js", "asOfVersion": "3.1.0" }, + { + "libraryName": "CacheFactory", + "typingsPackageName": "cachefactory", + "sourceRepoURL": "https://github.com/jmdobry/CacheFactory", + "asOfVersion": "3.0.0" + }, { "libraryName": "camel-case", "typingsPackageName": "camel-case", diff --git a/types/cachefactory/cachefactory-tests.ts b/types/cachefactory/cachefactory-tests.ts deleted file mode 100644 index 32eeb63257..0000000000 --- a/types/cachefactory/cachefactory-tests.ts +++ /dev/null @@ -1,32 +0,0 @@ -CacheFactory.get('test'); - -CacheFactory.createCache('test', { - deleteOnExpire: 'aggressive', - recycleFreq: 60000 -}); - -let testCache = CacheFactory.get('test'); - -testCache.put('testOne', {title: 'testOne', id: 1}); - -let item = testCache.get('testOne'); - - -let profileCache = CacheFactory('profileCache', { - maxAge: 60 * 60 * 1000, - deleteOnExpire: 'aggressive' -}); - -let localStoragePolyfill = { - getItem: (key: string) => { return ""; }, - setItem: (key: string, value: string) => { }, - removeItem: (key: string) => { } -}; - -let myAwesomeCache = CacheFactory('myAwesomeCache', { - maxAge: 15 * 60 * 1000, - cacheFlushInterval: 60 * 60 * 1000, - deleteOnExpire: 'aggressive', - storageMode: 'localStorage', - storageImpl: localStoragePolyfill -}); \ No newline at end of file diff --git a/types/cachefactory/index.d.ts b/types/cachefactory/index.d.ts deleted file mode 100644 index 658a2660f4..0000000000 --- a/types/cachefactory/index.d.ts +++ /dev/null @@ -1,441 +0,0 @@ -// Type definitions for CacheFactory 1.4.0 -// Project: https://github.com/jmdobry/CacheFactory -// Definitions by: Vaggelis Mparmpas , Daniel Massa -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace CacheFactory { - export interface IStoreImplementation { - getItem(key: string): string; - - setItem(key: string, value: string): void; - - removeItem(key: string): void; - } - - export interface CacheGetOptions { - /* - * A callback function to be executed whenever an expired item is removed from a cache when the cache is in passive - * or aggressive mode. Will be passed the key and value of the expired item. - * - * Will be passed a third done argument if the cache is in passive mode. This allows you to synchronously access the - * key and value of the expired item when you make the cache#get(key[, options]) call that is the reason the expired - * item is being removed in the first place. Default: null. - */ - onExpire?(key: string, value: any): any; - } - - export interface CachePutOptions { - /* - * The number of milliseconds until a newly inserted item expires. Default: Number.MAX_VALUE. - */ - maxAge?: number; - - /* - * If inserting a promise into a cache, also insert the rejection value if the promise rejects. Default: false. - */ - storeOnReject?: boolean; - - /* - * If inserting a promise into a cache, also insert the resolved value if the promise resolves. Default: false. - */ - storeOnResolve?: boolean; - - created?: Date; - access?: Date; - expires?: Date; - } - - export interface CacheTouchOptions extends CachePutOptions { } - - export interface CacheOptions { - /* - * If set, remove all items from a cache on an interval after the given number of milliseconds. Default: null. - */ - cacheFlushInterval?: number; - - /* - * Maximum number of items a cache can hold. Adding more items than the capacity will cause the cache to operate - * like an LRU cache, removing the least recently used items to stay under capacity. Default: Number.MAX_VALUE. - */ - - capacity?: number; - - /* - * Determines the behavior of a cache when an item expires. Default: none. - * - * Possible values: - * - * none - cache will do nothing when an item expires. - * passive - cache will do nothing when an item expires. Expired items will remain in the cache until requested, - * at which point they are removed, and undefined is returned. - * aggressive - cache will remove expired items as soon as they are discovered. - */ - deleteOnExpire?: string; - - /* - * Determines whether a cache is disabled. Default: false. - */ - disabled?: boolean; - - /* - * The number of milliseconds until a newly inserted item expires. Default: Number.MAX_VALUE. - */ - maxAge?: number; - - /* - * Determines how often a cache will scan for expired items when in aggressive mode. Default: 1000 (milliseconds). - */ - recycleFreq?: number; - - /* - * If inserting a promise into a cache, also insert the rejection value if the promise rejects. Default: false. - */ - storeOnReject?: boolean; - - /* - * If inserting a promise into a cache, also insert the resolved value if the promise resolves. Default: false. - */ - storeOnResolve?: boolean; - - /* - * Provide a custom storage medium, e.g. a polyfill for localStorage. Default: null. - * - * Must implement: - * - * setItem - Same API as localStorage.setItem(key, value) - * getItem - Same API as localStorage.getItem(key) - * removeItem - Same API as localStorage.removeItem(key) - */ - storageImpl?: IStoreImplementation; - - /* - * Determines the storage medium used by a cache. Default: memory. - * - * Possible values: - * - * memory - cache will hold data in memory. Data is cleared when the page is refreshed. - * localStorage - cache will hold data in localStorage if available. Data is not cleared when the page is refreshed. - * sessionStorage - cache will hold data in sessionStorage if available. Data is not cleared when the page is refreshed. - */ - storageMode?: string; - - /* - * Determines the namespace of a cache when storageMode is set to localStorage or sessionStorage. Make it a shorter - * string to save space. Default: angular-cache.caches. - */ - storagePrefix?: string; - - /* - * A callback function to be executed whenever an expired item is removed from a cache when the cache is in passive - * or aggressive mode. Will be passed the key and value of the expired item. - * - * Will be passed a third done argument if the cache is in passive mode. This allows you to synchronously access the - * key and value of the expired item when you make the cache#get(key[, options]) call that is the reason the expired - * item is being removed in the first place. Default: null. - */ - onExpire?(key: string, value: any): any; - } - - export interface ICache { - - $$id: string; - - /** - * Return the item with the given key.options, if provided, must be an object. - * - * If the cache is in passive mode, then options.onExpire can be a function that will be called with the key - * and value of the requested item if the requested item is expired, with the get call itself returning undefined. - * @param key - * @returns {} - */ - get(key: string, options?: CacheGetOptions): T; - - /** - * Insert the item with the given key and value into the cache.options, if provided, must be an object. - * - * If inserting a promise, options.storeOnReject determines whether to insert the rejection value if the promise - * rejects (overriding the default storeOnReject setting for the cache). If inserting a promise, options.storeOnResolve - * determines whether to insert the resolved value if the promise resolves (overriding the default storeOnResolve setting for the cache). - * - * @param key - * @param value - * @param options - */ - put(key: string, value: T, options?: CachePutOptions): void; - - /** - * Remove and return the item with the given key, if it is in the cache. - * @param key - * @returns {} - */ - remove(key: string): T; - - /** - * Remove all items in the cache. - */ - removeAll(): void; - - /** - * Remove and return all expired items in the cache. - * @returns {} - */ - removeExpired(): { [key: string]: any }; - - /** - * Completely destroy this cache and its data. - * @returns {} - */ - destroy(): void; - - /** - * Returns an object containing information about the cache. - * - * @param key - */ - info(): CacheInfo; - - /** - * Returns an object containing information about the item with the given key, if the item is in the cache. - * - * @param key - */ - info(key: string): CacheItemInfo; - - /** - * Return the keys of all items in the cache as an object. - * @returns {} - */ - keySet(): any; - - /** - * Return the keys of all items in the cache as an array. - * @returns [] - */ - keys(): Array; - - /** - * Enable the cache. - */ - enable(): void; - - /** - * Disable the cache. - */ - disable(): void; - - /** - * cache#touch() will "touch" all items in the cache. - * cache#touch(key) will "touch" the item with the given key. - * - * @param key - */ - touch(key?: string, options?: CacheTouchOptions): void; - - /** - * Set the cacheFlushInterval for the cache. - * @param cacheFlushInterval - */ - setCacheFlushInterval(cacheFlushInterval: number): void; - - /** - * Set the capacity for the cache.Setting this lower than the current item count will result in those items being removed. - * @param capacity - */ - setCapacity(capacity: number): void; - - /** - * Set the deleteOnExpire for the cache. - * @param deleteOnExpire - */ - setDeleteOnExpire(deleteOnExpire: string): void; - - /** - * Set the maxAge for the cache. - */ - setMaxAge(maxAge: number): void; - - /** - * Set the onExpire for the cache. - * @param onExpire - */ - setOnExpire(onExpire: Function): void; - - /** - * Set the recycleFreq for the cache. - * @param recycleFreq - */ - setRecycleFreq(recycleFreq: number): void; - - /** - * Set the storageMode for the cache.This will move data from the current storage medium to the new one. - * @param storageMode - */ - setStorageMode(storageMode: string): void; - - /** - * Set multiple options for the cache at a time.Setting strict to true will reset options for the cache - * that are not specifically set in the options hash to CacheFactoryProvider.defaults. - * @param options - */ - setOptions(options: CacheOptions, strict?: boolean): void; - - /** - * Return the values of all items in the cache as an array. - * @returns Array - */ - values(): Array - } - - export interface ICacheFactory { - - BinaryHeap: IBinaryHeap; - utils: IUtils; - defaults: CacheOptions; - - /** - * Create a cache. cache must not already exist. cacheId must be a string. options is an optional argument and must be an object. - * Any options you pass here will override any default options. - * @param cacheId - * @param options - * @returns ICache - */ - (cacheId: string, options?: CacheOptions): ICache; - - /** - * Create a cache. cache must not already exist. cacheId must be a string. options is an optional argument and must be an object. - * Any options you pass here will override any default options. - * @param cacheId - * @param options - * @returns ICache - */ - createCache(cacheId: string, options?: CacheOptions): ICache; - - /** - * Return the cache with the given cacheId. - * @param cacheId The id of the cache storage. - * @returns ICache - */ - get(cacheId: string, options?: CacheOptions): ICache; - - /** - * Return an object of key- value pairs, the keys being cache ids and the values being the result of .info() being called on each cache. - * @returns CacheInfo - */ - info(): CacheInfo; - - /** - * Return the ids of all registered caches as an object. - * @returns {[key: string]: ICache} - */ - keySet(): { [key: string]: ICache }; - - /** - * Return the ids of all registered caches as an array. - * @returns Array - */ - keys(): Array; - - /** - * Destroy the cache with the given cacheId. - * @param cacheId - */ - destroy(cacheId: string): void; - - /** - * Destroy all registered caches. - */ - destroyAll(): void; - - /** - * Remove all data from all registered caches. - */ - clearAll(): void; - - /** - * Enable all registered caches. - */ - enableAll(): void; - - /** - * Disable all registered caches. - */ - disableAll(): void; - - /** - * Call.touch() on all registered caches. - */ - touchAll(): void; - - /** - * Call.removeExpired() on all registered caches.Returns a hash of any expired items, keyed by cache id. - * @returns {} - */ - removeExpiredFromAll(): Array<{ [key: string]: Array<{ [key: string]: any }> }>; - } - - export interface IUtils { - isNumber(value: any): boolean; - isString(value: any): boolean; - isObject(value: any): boolean; - isFunction(value: any): boolean; - equals(a: any, b: any): boolean; - fromJson(value: any): {} - Promise: any; - } - - export interface HeapItem { - key: string; - accessed: Date; - } - - export interface IBinaryHeap { - (w?: IWeightFunc, c?: ICompareFunc): void; - - heap: Array; - weightFunc: IWeightFunc; - compareFunc: ICompareFunc; - - push(node: HeapItem): void; - pop(): HeapItem; - peek(): HeapItem; - remove(node: HeapItem): HeapItem; - removeAll(): void; - size(): Number; - } - - export interface IWeightFunc { - (x: T): T; - } - - export interface ICompareFunc { - (x: T, y: T): boolean; - } - - export interface CacheInfo { - size: Number; - caches: { [key: string]: any }; - capacity: Number; - maxAge: Number; - deleteOnExpire: string; - onExpire: Function; - cacheFlushInterval: Number; - recycleFreq: Number; - storageMode: string; - storageImpl: IStoreImplementation; - disabled: boolean; - storagePrefix: string; - storeOnResolve: boolean; - storeOnReject: boolean; - } - - export interface CacheItemInfo { - created: Date; - accessed: Date; - expires: Date; - isExpired: boolean; - } -} - -declare const CacheFactory: CacheFactory.ICacheFactory; -export = CacheFactory; -export as namespace CacheFactory; diff --git a/types/cachefactory/tsconfig.json b/types/cachefactory/tsconfig.json deleted file mode 100644 index 2008da5619..0000000000 --- a/types/cachefactory/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cachefactory-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cachefactory/tslint.json b/types/cachefactory/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/cachefactory/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 1de588ff13b1fd2a6e9b900139a42247ec9561d8 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:53:45 -0800 Subject: [PATCH 133/890] redux-saga-routines: Provides its own types --- notNeededPackages.json | 6 +++ types/redux-saga-routines/index.d.ts | 35 --------------- types/redux-saga-routines/package.json | 7 --- .../redux-saga-routines-tests.tsx | 44 ------------------- types/redux-saga-routines/tsconfig.json | 24 ---------- types/redux-saga-routines/tslint.json | 1 - 6 files changed, 6 insertions(+), 111 deletions(-) delete mode 100644 types/redux-saga-routines/index.d.ts delete mode 100644 types/redux-saga-routines/package.json delete mode 100644 types/redux-saga-routines/redux-saga-routines-tests.tsx delete mode 100644 types/redux-saga-routines/tsconfig.json delete mode 100644 types/redux-saga-routines/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index e8256d8398..17cb777e5d 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -678,6 +678,12 @@ "sourceRepoURL": "https://github.com/redux-saga/redux-saga", "asOfVersion": "0.10.5" }, + { + "libraryName": "redux-saga-routines", + "typingsPackageName": "redux-saga-routines", + "sourceRepoURL": "https://github.com/afitiskin/redux-saga-routines#readme", + "asOfVersion": "2.1.0" + }, { "libraryName": "Redux Thunk", "typingsPackageName": "redux-thunk", diff --git a/types/redux-saga-routines/index.d.ts b/types/redux-saga-routines/index.d.ts deleted file mode 100644 index 7682fd30c1..0000000000 --- a/types/redux-saga-routines/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Type definitions for redux-saga-routines 2.0 -// Project: https://github.com/afitiskin/redux-saga-routines#readme -// Definitions by: Karol Janyst -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 - -import { Action } from "redux"; -import { FormSubmitHandler } from "redux-form"; - -export const ROUTINE_PROMISE_ACTION: string; - -export interface RoutineAction extends Action { - payload?: T; -} - -export type RoutineActionCreator = (payload?: T) => RoutineAction; - -export interface ReduxRoutine { - TRIGGER: string; - REQUEST: string; - SUCCESS: string; - FAILURE: string; - FULFILL: string; - trigger: RoutineActionCreator; - request: RoutineActionCreator; - success: RoutineActionCreator; - failure: RoutineActionCreator; - fulfill: RoutineActionCreator; -} - -export function createRoutine(prefix: string): ReduxRoutine; - -export function routinePromiseWatcherSaga(): Iterator; - -export function bindRoutineToReduxForm(routine: ReduxRoutine): FormSubmitHandler; diff --git a/types/redux-saga-routines/package.json b/types/redux-saga-routines/package.json deleted file mode 100644 index ce10629c07..0000000000 --- a/types/redux-saga-routines/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "private": true, - "dependencies": { - "redux": "^3.7.2", - "redux-saga": "^0.15.6" - } -} diff --git a/types/redux-saga-routines/redux-saga-routines-tests.tsx b/types/redux-saga-routines/redux-saga-routines-tests.tsx deleted file mode 100644 index 4717750166..0000000000 --- a/types/redux-saga-routines/redux-saga-routines-tests.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import * as React from "react"; -import { reduxForm } from "redux-form"; -import createSagaMiddleware from "redux-saga"; -import { - bindRoutineToReduxForm, - createRoutine, - routinePromiseWatcherSaga, - ROUTINE_PROMISE_ACTION -} from "redux-saga-routines"; - -const sagaMiddleware = createSagaMiddleware(); - -sagaMiddleware.run(routinePromiseWatcherSaga); - -const submitFormRoutine = createRoutine("SUBMIT_MY_FORM"); -const submitFormHandler = bindRoutineToReduxForm(submitFormRoutine); - -submitFormRoutine.TRIGGER; -submitFormRoutine.REQUEST; -submitFormRoutine.SUCCESS; -submitFormRoutine.FAILURE; -submitFormRoutine.FULFILL; -submitFormRoutine.trigger(); -submitFormRoutine.trigger("test"); -submitFormRoutine.request(); -submitFormRoutine.request("test"); -submitFormRoutine.success(); -submitFormRoutine.success("test"); -submitFormRoutine.failure(); -submitFormRoutine.failure("test"); -submitFormRoutine.fulfill(); -submitFormRoutine.fulfill("test"); - -const Test = reduxForm({ - form : "test" -})( - ({ handleSubmit }) => { - return ( -

- - - ); - } -); diff --git a/types/redux-saga-routines/tsconfig.json b/types/redux-saga-routines/tsconfig.json deleted file mode 100644 index 32f2937910..0000000000 --- a/types/redux-saga-routines/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "jsx": "react", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "redux-saga-routines-tests.tsx" - ] -} diff --git a/types/redux-saga-routines/tslint.json b/types/redux-saga-routines/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/redux-saga-routines/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 5a6cd9256d5dee6a8a47e4d0b05e7ba21124e163 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:57:49 -0800 Subject: [PATCH 134/890] reflect-metadata: Provides its own types --- notNeededPackages.json | 6 + types/reflect-metadata/index.d.ts | 480 ------------------ .../reflect-metadata-tests.ts | 50 -- types/reflect-metadata/tsconfig.json | 24 - types/reflect-metadata/tslint.json | 79 --- 5 files changed, 6 insertions(+), 633 deletions(-) delete mode 100644 types/reflect-metadata/index.d.ts delete mode 100644 types/reflect-metadata/reflect-metadata-tests.ts delete mode 100644 types/reflect-metadata/tsconfig.json delete mode 100644 types/reflect-metadata/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index e8256d8398..677e50a814 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -684,6 +684,12 @@ "sourceRepoURL": "https://github.com/gaearon/redux-thunk", "asOfVersion": "2.1.0" }, + { + "libraryName": "reflect-metadata", + "typingsPackageName": "reflect-metadata", + "sourceRepoURL": "https://github.com/rbuckton/ReflectDecorators", + "asOfVersion": "0.1.0" + }, { "libraryName": "reselect", "typingsPackageName": "reselect", diff --git a/types/reflect-metadata/index.d.ts b/types/reflect-metadata/index.d.ts deleted file mode 100644 index 92ffd951a4..0000000000 --- a/types/reflect-metadata/index.d.ts +++ /dev/null @@ -1,480 +0,0 @@ -// Type definitions for reflect-metadata -// Project: https://github.com/rbuckton/ReflectDecorators -// Definitions by: Ron Buckton -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare module "reflect-metadata" { - // The "reflect-metadata" module has no imports or exports, but can be used by modules to load the polyfill. -} - -declare namespace Reflect { - /** - * Applies a set of decorators to a target object. - * @param decorators An array of decorators. - * @param target The target object. - * @returns The result of applying the provided decorators. - * @remarks Decorators are applied in reverse order of their positions in the array. - * @example - * - * class C { } - * - * // constructor - * C = Reflect.decorate(decoratorsArray, C); - * - */ - function decorate(decorators: ClassDecorator[], target: Function): Function; - /** - * Applies a set of decorators to a property of a target object. - * @param decorators An array of decorators. - * @param target The target object. - * @param targetKey The property key to decorate. - * @param descriptor A property descriptor - * @remarks Decorators are applied in reverse order. - * @example - * - * class C { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod() { } - * method() { } - * } - * - * // property (on constructor) - * Reflect.decorate(decoratorsArray, C, "staticProperty"); - * - * // property (on prototype) - * Reflect.decorate(decoratorsArray, C.prototype, "property"); - * - * // method (on constructor) - * Object.defineProperty(C, "staticMethod", - * Reflect.decorate(decoratorsArray, C, "staticMethod", - * Object.getOwnPropertyDescriptor(C, "staticMethod"))); - * - * // method (on prototype) - * Object.defineProperty(C.prototype, "method", - * Reflect.decorate(decoratorsArray, C.prototype, "method", - * Object.getOwnPropertyDescriptor(C.prototype, "method"))); - * - */ - function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, targetKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor; - /** - * A default metadata decorator factory that can be used on a class, class member, or parameter. - * @param metadataKey The key for the metadata entry. - * @param metadataValue The value for the metadata entry. - * @returns A decorator function. - * @remarks - * If `metadataKey` is already defined for the target and target key, the - * metadataValue for that key will be overwritten. - * @example - * - * // constructor - * @Reflect.metadata(key, value) - * class C { - * } - * - * // property (on constructor, TypeScript only) - * class C { - * @Reflect.metadata(key, value) - * static staticProperty; - * } - * - * // property (on prototype, TypeScript only) - * class C { - * @Reflect.metadata(key, value) - * property; - * } - * - * // method (on constructor) - * class C { - * @Reflect.metadata(key, value) - * static staticMethod() { } - * } - * - * // method (on prototype) - * class C { - * @Reflect.metadata(key, value) - * method() { } - * } - * - */ - function metadata(metadataKey: any, metadataValue: any): { - (target: Function): void; - (target: Object, propertyKey: string | symbol): void; - }; - /** - * Define a unique metadata entry on the target. - * @param metadataKey A key used to store and retrieve metadata. - * @param metadataValue A value that contains attached metadata. - * @param target The target object on which to define metadata. - * @example - * - * class C { - * } - * - * // constructor - * Reflect.defineMetadata("custom:annotation", options, C); - * - * // decorator factory as metadata-producing annotation. - * function MyAnnotation(options): ClassDecorator { - * return target => Reflect.defineMetadata("custom:annotation", options, target); - * } - * - */ - function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void; - /** - * Define a unique metadata entry on the target. - * @param metadataKey A key used to store and retrieve metadata. - * @param metadataValue A value that contains attached metadata. - * @param target The target object on which to define metadata. - * @param targetKey The property key for the target. - * @example - * - * class C { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * Reflect.defineMetadata("custom:annotation", Number, C, "staticProperty"); - * - * // property (on prototype) - * Reflect.defineMetadata("custom:annotation", Number, C.prototype, "property"); - * - * // method (on constructor) - * Reflect.defineMetadata("custom:annotation", Number, C, "staticMethod"); - * - * // method (on prototype) - * Reflect.defineMetadata("custom:annotation", Number, C.prototype, "method"); - * - * // decorator factory as metadata-producing annotation. - * function MyAnnotation(options): PropertyDecorator { - * return (target, key) => Reflect.defineMetadata("custom:annotation", options, target, key); - * } - * - */ - function defineMetadata(metadataKey: any, metadataValue: any, target: Object, targetKey: string | symbol): void; - /** - * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. - * @example - * - * class C { - * } - * - * // constructor - * result = Reflect.hasMetadata("custom:annotation", C); - * - */ - function hasMetadata(metadataKey: any, target: Object): boolean; - /** - * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param targetKey The property key for the target. - * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. - * @example - * - * class C { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); - * - */ - function hasMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean; - /** - * Gets a value indicating whether the target object has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. - * @example - * - * class C { - * } - * - * // constructor - * result = Reflect.hasOwnMetadata("custom:annotation", C); - * - */ - function hasOwnMetadata(metadataKey: any, target: Object): boolean; - /** - * Gets a value indicating whether the target object has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param targetKey The property key for the target. - * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. - * @example - * - * class C { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); - * - */ - function hasOwnMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean; - /** - * Gets the metadata value for the provided metadata key on the target object or its prototype chain. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class C { - * } - * - * // constructor - * result = Reflect.getMetadata("custom:annotation", C); - * - */ - function getMetadata(metadataKey: any, target: Object): any; - /** - * Gets the metadata value for the provided metadata key on the target object or its prototype chain. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param targetKey The property key for the target. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class C { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); - * - */ - function getMetadata(metadataKey: any, target: Object, targetKey: string | symbol): any; - /** - * Gets the metadata value for the provided metadata key on the target object. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class C { - * } - * - * // constructor - * result = Reflect.getOwnMetadata("custom:annotation", C); - * - */ - function getOwnMetadata(metadataKey: any, target: Object): any; - /** - * Gets the metadata value for the provided metadata key on the target object. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param targetKey The property key for the target. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class C { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); - * - */ - function getOwnMetadata(metadataKey: any, target: Object, targetKey: string | symbol): any; - /** - * Gets the metadata keys defined on the target object or its prototype chain. - * @param target The target object on which the metadata is defined. - * @returns An array of unique metadata keys. - * @example - * - * class C { - * } - * - * // constructor - * result = Reflect.getMetadataKeys(C); - * - */ - function getMetadataKeys(target: Object): any[]; - /** - * Gets the metadata keys defined on the target object or its prototype chain. - * @param target The target object on which the metadata is defined. - * @param targetKey The property key for the target. - * @returns An array of unique metadata keys. - * @example - * - * class C { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.getMetadataKeys(C, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getMetadataKeys(C.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getMetadataKeys(C, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getMetadataKeys(C.prototype, "method"); - * - */ - function getMetadataKeys(target: Object, targetKey: string | symbol): any[]; - /** - * Gets the unique metadata keys defined on the target object. - * @param target The target object on which the metadata is defined. - * @returns An array of unique metadata keys. - * @example - * - * class C { - * } - * - * // constructor - * result = Reflect.getOwnMetadataKeys(C); - * - */ - function getOwnMetadataKeys(target: Object): any[]; - /** - * Gets the unique metadata keys defined on the target object. - * @param target The target object on which the metadata is defined. - * @param targetKey The property key for the target. - * @returns An array of unique metadata keys. - * @example - * - * class C { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.getOwnMetadataKeys(C, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getOwnMetadataKeys(C.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getOwnMetadataKeys(C, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getOwnMetadataKeys(C.prototype, "method"); - * - */ - function getOwnMetadataKeys(target: Object, targetKey: string | symbol): any[]; - /** - * Deletes the metadata entry from the target object with the provided key. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @returns `true` if the metadata entry was found and deleted; otherwise, false. - * @example - * - * class C { - * } - * - * // constructor - * result = Reflect.deleteMetadata("custom:annotation", C); - * - */ - function deleteMetadata(metadataKey: any, target: Object): boolean; - /** - * Deletes the metadata entry from the target object with the provided key. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param targetKey The property key for the target. - * @returns `true` if the metadata entry was found and deleted; otherwise, false. - * @example - * - * class C { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); - * - */ - function deleteMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean; -} diff --git a/types/reflect-metadata/reflect-metadata-tests.ts b/types/reflect-metadata/reflect-metadata-tests.ts deleted file mode 100644 index a0f6638ba4..0000000000 --- a/types/reflect-metadata/reflect-metadata-tests.ts +++ /dev/null @@ -1,50 +0,0 @@ -let target = { - some_property: { - - } -} - -let metadataKey = "key"; -let metadataValue = "val"; -let propertyKey = "some_property"; - -// define metadata on an object or property -Reflect.defineMetadata(metadataKey, metadataValue, target); -Reflect.defineMetadata(metadataKey, metadataValue, target, propertyKey); - -// check for presence of a metadata key on the prototype chain of an object or property -let result1 = Reflect.hasMetadata(metadataKey, target); -let result2 = Reflect.hasMetadata(metadataKey, target, propertyKey); - -// check for presence of an own metadata key of an object or property -let result3 = Reflect.hasOwnMetadata(metadataKey, target); -let result4 = Reflect.hasOwnMetadata(metadataKey, target, propertyKey); - -// get metadata value of a metadata key on the prototype chain of an object or property -let result5 = Reflect.getMetadata(metadataKey, target); -let result6 = Reflect.getMetadata(metadataKey, target, propertyKey); - -// get metadata value of an own metadata key of an object or property -let result7 = Reflect.getOwnMetadata(metadataKey, target); -let result8 = Reflect.getOwnMetadata(metadataKey, target, propertyKey); - -// get all metadata keys on the prototype chain of an object or property -let result9 = Reflect.getMetadataKeys(target); -let result10 = Reflect.getMetadataKeys(target, propertyKey); - -// get all own metadata keys of an object or property -let result11 = Reflect.getOwnMetadataKeys(target); -let result12 = Reflect.getOwnMetadataKeys(target, propertyKey); - -// delete metadata from an object or property -let result13 = Reflect.deleteMetadata(metadataKey, target); -let result14 = Reflect.deleteMetadata(metadataKey, target, propertyKey); - -// apply metadata via a decorator to a constructor -@Reflect.metadata(metadataKey, metadataValue) -class C { - // apply metadata via a decorator to a method (property) - @Reflect.metadata(metadataKey, metadataValue) - method() { - } -} diff --git a/types/reflect-metadata/tsconfig.json b/types/reflect-metadata/tsconfig.json deleted file mode 100644 index 6fa34eba8e..0000000000 --- a/types/reflect-metadata/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "experimentalDecorators": true - }, - "files": [ - "index.d.ts", - "reflect-metadata-tests.ts" - ] -} \ No newline at end of file diff --git a/types/reflect-metadata/tslint.json b/types/reflect-metadata/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/reflect-metadata/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From d4d6d7f7218a796ec5f242072fad9bfb0cf7355f Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 13:59:34 -0800 Subject: [PATCH 135/890] email-validator: Provides its own types --- notNeededPackages.json | 6 ++ .../email-validator/email-validator-tests.ts | 12 --- types/email-validator/index.d.ts | 7 -- types/email-validator/tsconfig.json | 23 ------ types/email-validator/tslint.json | 79 ------------------- 5 files changed, 6 insertions(+), 121 deletions(-) delete mode 100644 types/email-validator/email-validator-tests.ts delete mode 100644 types/email-validator/index.d.ts delete mode 100644 types/email-validator/tsconfig.json delete mode 100644 types/email-validator/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index bac83690ae..e9c1f44ed0 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -216,6 +216,12 @@ "sourceRepoURL": "https://github.com/loopline-systems/electron-builder", "asOfVersion": "2.8.0" }, + { + "libraryName": "email-validator", + "typingsPackageName": "email-validator", + "sourceRepoURL": "https://github.com/Sembiance/email-validator", + "asOfVersion": "1.0.6" + }, { "libraryName": "error-stack-parser", "typingsPackageName": "error-stack-parser", diff --git a/types/email-validator/email-validator-tests.ts b/types/email-validator/email-validator-tests.ts deleted file mode 100644 index 81450bcab1..0000000000 --- a/types/email-validator/email-validator-tests.ts +++ /dev/null @@ -1,12 +0,0 @@ - -import emailValidator = require('email-validator'); -import { validate } from 'email-validator'; - -var result: boolean; - -// Trivial code requires trivial tests -result = validate('some email'); -result = validate(null); - -result = emailValidator.validate('some email'); -result = emailValidator.validate(null); diff --git a/types/email-validator/index.d.ts b/types/email-validator/index.d.ts deleted file mode 100644 index ad0fb761be..0000000000 --- a/types/email-validator/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Type definitions for email-validator 1.0.3 -// Project: https://github.com/Sembiance/email-validator -// Definitions by: Paul Lessing -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -export declare function validate(email: String): boolean; diff --git a/types/email-validator/tsconfig.json b/types/email-validator/tsconfig.json deleted file mode 100644 index d126e18174..0000000000 --- a/types/email-validator/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "email-validator-tests.ts" - ] -} \ No newline at end of file diff --git a/types/email-validator/tslint.json b/types/email-validator/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/email-validator/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 033b7847c323aba2f60115a12de7cc10c85d7e20 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 14:05:28 -0800 Subject: [PATCH 136/890] protobufjs: Provides its own types --- notNeededPackages.json | 6 + types/protobufjs/index.d.ts | 426 --------------------------- types/protobufjs/protobufjs-tests.ts | 421 -------------------------- types/protobufjs/tsconfig.json | 24 -- types/protobufjs/tslint.json | 79 ----- 5 files changed, 6 insertions(+), 950 deletions(-) delete mode 100644 types/protobufjs/index.d.ts delete mode 100644 types/protobufjs/protobufjs-tests.ts delete mode 100644 types/protobufjs/tsconfig.json delete mode 100644 types/protobufjs/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index bac83690ae..8a09f0ef1a 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -594,6 +594,12 @@ "sourceRepoURL": "https://github.com/zeh/prando", "asOfVersion": "1.0.0" }, + { + "libraryName": "ProtoBuf.js", + "typingsPackageName": "protobufjs", + "sourceRepoURL": "https://github.com/dcodeIO/ProtoBuf.js", + "asOfVersion": "6.0.0" + }, { "libraryName": "Protractor", "typingsPackageName": "protractor", diff --git a/types/protobufjs/index.d.ts b/types/protobufjs/index.d.ts deleted file mode 100644 index dd22beee44..0000000000 --- a/types/protobufjs/index.d.ts +++ /dev/null @@ -1,426 +0,0 @@ -// Type definitions for ProtoBuf.js 5.0.1 -// Project: https://github.com/dcodeIO/ProtoBuf.js -// Definitions by: Panu Horsmalahti -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// - -declare namespace ProtoBuf { - // ========== - // protobufjs/src/ProtoBuf.js - - var Builder: Builder; - var Long: LongStatic; - var DotProto: DotProto; - var Reflect: Reflect; - var Util: Util; - var convertFieldsToCamelCase: boolean; - - // var Lang: Lang; TODO: implement interface Lang - - export function loadJson(json: string, builder?: ProtoBuilder | string | {}, - filename?: string | {}): ProtoBuilder; - - export function loadJsonFile(filename: string | {}, - callback?: (error: any, builder: ProtoBuilder) => void, - builder?: ProtoBuilder): ProtoBuilder; - - export function loadProto(proto: string, builder?: ProtoBuilder | string | {}, - filename?: string | {}): ProtoBuilder; - - export function loadProtoFile(filePath: string | {}, - callback?: (error: any, builder: ProtoBuilder) => void, - builder?: ProtoBuilder): ProtoBuilder; - - export function newBuilder(options?: {[key: string]: any}): ProtoBuilder; - - export interface LongStatic { - new(low?: number, high?: number, unsigned?:boolean): Long; - - MAX_UNSIGNED_VALUE: Long; - MAX_VALUE: Long; - MIN_VALUE: Long; - NEG_ONE: Long; - ONE: Long; - UONE: Long; - UZERO: Long; - ZERO: Long; - - fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; - fromInt(value: number, unsigned?: boolean): Long; - fromNumber(value: number, unsigned?: boolean): Long; - fromString(str: string, unsigned?: boolean | number, radix?: number): Long; - fromValue(val: Long | number | string): Long; - - isLong(obj: any): boolean; - } - - // Based on https://github.com/dcodeIO/Long.js and https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/long/long.d.ts - export interface Long { - high: number; - low: number; - unsigned :boolean; - - add(other: Long | number | string): Long; - and(other: Long | number | string): Long; - compare(other: Long | number | string): number; - div(divisor: Long | number | string): Long; - equals(other: Long | number | string): boolean; - getHighBits(): number; - getHighBitsUnsigned(): number; - getLowBits(): number; - getLowBitsUnsigned(): number; - getNumBitsAbs(): number; - greaterThan(other: Long | number | string): boolean; - greaterThanOrEqual(other: Long | number | string): boolean; - isEven(): boolean; - isNegative(): boolean; - isOdd(): boolean; - isPositive(): boolean; - isZero(): boolean; - lessThan(other: Long | number | string): boolean; - lessThanOrEqual(other: Long | number | string): boolean; - modulo(divisor: Long | number | string): Long; - multiply(multiplier: Long | number | string): Long; - negate(): Long; - not(): Long; - notEquals(other: Long | number | string): boolean; - or(other: Long | number | string): Long; - shiftLeft(numBits: number | Long): Long; - shiftRight(numBits: number | Long): Long; - shiftRightUnsigned(numBits: number | Long): Long; - subtract(other: Long | number | string): Long; - toInt(): number; - toNumber(): number; - toSigned(): Long; - toString(radix?: number): string; - toUnsigned(): Long; - xor(other: Long | number | string): Long; - } - - // ========== - // protobufjs/src/ProtoBuf/Builder.js - - export interface Builder { - new(options?: {[key: string]: any}): ProtoBuilder; - Message: Message; - Service: Service; - isValidMessage(def: {[key: string]: any}): boolean; - isValidMessageField(def: {[key: string]: any}): boolean; - isValidEnum(def: {[key: string]: any}): boolean; - isValidService(def: {[key: string]: any}): boolean; - isValidExtend(def: {[key: string]: any}): boolean; - } - - /** - * TODO: Confirm that message needs no further implementation - */ - export interface Message { - new(values?: {[key: string]: any}, var_args?: string[]): Message; - $add(key: string, value: any, noAssert?: boolean): Message; - $get(key: string): T; - $set(key: string | {[key: string]: any}, value?: any | boolean, noAssert?: boolean): void; - add(key: string, value: any, noAssert?: boolean): Message; - calculate(): number; - encode(buffer?: ByteBuffer | boolean, noVerify?: boolean): ByteBuffer; - encode64(): string; - encodeAB(): ArrayBuffer; - encodeNB(): Buffer; - encodeHex(): string; - encodeJSON(): string; - encodeDelimited(buffer?: ByteBuffer | boolean, noVerify?: boolean): ByteBuffer; - get(key: string, noAssert?: boolean): T; - set(key: string | {[key: string]: any}, value?: any | boolean, noAssert?: boolean): void; - toArrayBuffer(): ArrayBuffer; - toBase64(): string; - toBuffer(): Buffer; - toHex(): string; - toRaw(binaryAsBase64?: boolean, longsAsStrings?: boolean): {[key: string]: any}; - toString(): string; - [field: string]: any; - } - - /** - * TODO: Implement service interface - */ - export interface Service { - new(rpcImpl?: Function): Service; - } - - - // ========== - // meta objects for constructing protobufs - - export interface ProtoBuilder { - ns: ReflectNamespace; - ptr: ReflectNamespace; - resolved: boolean; - result: ProtoBuf; - files: string[]; - importRoot: string; - options: {[key: string]: any}; - syntax: string; - reset(): void; - define(pkg: string, options?: {[key: string]: any}): ProtoBuilder; - create(defs?: {[key: string]: any}[]): ProtoBuilder; - resolveAll(): void; - build(path?: string | [string]): MetaMessage; - build(path?: string | [string]): MetaMessage; - lookup(path?: string): ReflectT; - } - - export interface ProtoBuf { - [package: string]: {[key: string]: MetaMessage | any}; - } - - export interface MetaMessage { - new(values?: {[key: string]: any}, var_args?: string[]): T & Message; - decode(buffer: ArrayBuffer | ByteBuffer | Buffer | string, length?: number | string, enc?: string): T & Message; - decodeDelimited(buffer: ByteBuffer | ArrayBuffer | Buffer | string, enc?: string): T & Message; - decode64(str: string): T & Message; - decodeHex(str: string): T & Message; - decodeJSON(str: string): T & Message; - } - - // ========== - // protobufjs/src/ProtoBuf/DotProto.js - - export interface DotProto { - Parser: Parser; - Tokenizer: Tokenizer; - } - - export interface Parser { - new(proto: string): Parser; - tn: Tokenizer; - parse(): MetaProto; - toString(): string; - } - - export interface Tokenizer { - new(proto: string): Tokenizer; - source: string; - index: number; - line: number; - stack: string[]; - readingString: boolean; - stringEndsWith: string; - next(): string; - peek(): string; - toString(): string; - } - - // ========== - // proto meta information returned by the Parser - - export interface MetaProto { - package: string; - messages: ProtoMessage[]; - enums: ProtoEnum[]; - imports: string[]; - options: {[key: string]: any}; - services: ProtoService[]; - } - - export interface ProtoEnum { - name: string; - values: ProtoEnumValue[]; - options: {[key: string]: any}; - } - - export interface ProtoEnumValue { - name: string; - id: string; - } - - export interface ProtoField { - rule: string; - options: {[key: string]: any}; - type: string; - name: string; - id: number; - oneof?: string; - } - - export interface ProtoMessage { - name: string; - isGroup?: boolean; - fields: ProtoField[]; - enums: ProtoEnum[]; - messages: ProtoMessage[]; - options: {[key: string]: any}; - oneofs: {[key: string]:number[]}; - } - - export interface ProtoRpcService { - request: string; - response: string; - options: {[key: string]: any}; - } - - export interface ProtoService { - name: string; - rpc: {[key: string]:ProtoRpcService}; - options: {[key: string]: any}; - } - - // ========== - // protobufjs/src/ProtoBuf/Util.js - - export interface Util { - IS_NODE: boolean - fetch(path: string, callback?: (data: string) => any): string; - toCamelCase(str: string): string; - XHR(): XMLHttpRequest; - } - - // ========== - // protobufjs/src/ProtoBuf/Reflect.js - - export interface Reflect { - T: ReflectT; - Namespace: ReflectNamespace; - Message: ReflectMessage; - Enum: ReflectEnum; - Extension: ReflectExtension; - Service: ReflectService; - } - - export interface ReflectT { - new(builder?: ProtoBuilder, parent?: ReflectT, name?: string): ReflectT; - builder: ProtoBuilder; - parent: ReflectT; - name: string; - fqn(): string; - toString(includeClass?: boolean): string; - } - - export interface ReflectNamespace extends ReflectT { - new(builder?: ProtoBuilder, parent?: ReflectNamespace, name?: string, - options?: {[key: string]: any}): ReflectNamespace; - className: string; - children: ReflectT[]; - options: {[key: string]: any}; - syntax: string; - getChildren(type?: ReflectT): ReflectT[]; - addChild(child: ReflectT): void; - getChild(nameOrId?: string | number): ReflectT; - resolve(qn: string, excludeFields?: boolean): ReflectNamespace; - build(): ProtoBuf; - buildOpt(): {[key: string]: any}; - getOption(name?: string): any; - } - - export interface ReflectMessage extends ReflectNamespace { - new(builder?: ProtoBuilder, parent?: ReflectNamespace, name?: string, - options?: {[key: string]: any}, isGroup?: boolean): ReflectMessage; - Field: ReflectField; // NOTE: only for new ProtoBuf.Reflect.Message.Field(); - ExtensionField: ReflectExtensionField; // NOTE: only for - // new ProtoBuf.Reflect.Message.ExtensionField(); - OneOf: ReflectOneOf; // NOTE: only for new ProtoBuf.Reflect.Message.OneOf(); - extensions: number[]; - clazz(): MetaMessage; - isGroup: boolean; - build(rebuild?: boolean): MetaMessage|any; - build(rebuild?: boolean): MetaMessage|any; - encode(message: Message, buffer: Buffer, noVerify?: boolean): Buffer; - calculate(message: Message): number; - decode(buffer: Buffer, length?: number, expectedGroupEndId?: number): Message; - } - - export interface ReflectEnum extends ReflectNamespace { - new(builder?: ProtoBuilder, parent?: ReflectT, name?: string, - options?: {[key: string]: any}): ReflectEnum; - Value: ReflectValue; // NOTE: only for new ProtoBuf.Reflect.Enum.Value(); - object: {[key: string]:number}; - build(): {[key: string]: any}; - } - - export interface ReflectExtension extends ReflectT { - new(builder?: ProtoBuilder, parent?: ReflectT, name?: string, - field?: ReflectField): ReflectExtension; - field: ReflectField; - } - - export interface ReflectService extends ReflectNamespace { - new(): ReflectService; - Method: ReflectMethod; // NOTE: only for new ProtoBuf.Reflect.Service.Method(); - RPCMethod: ReflectRPCMethod; // NOTE: only for new ProtoBuf.Reflect.Service.RPCMethod(); - clazz(): Function; - build(rebuild?: boolean): Function|any; - } - - // TODO: check that the runtime instance of this type reflects this definition - export interface ReflectField extends ReflectT { - new(builder: ProtoBuilder, message: ReflectMessage, rule: string, type: string, - name: string, id: number, options: {[key: string]: any}, oneof: ReflectOneOf): ReflectField; - className: string; - required: boolean; - repeated: boolean; - type: string | WireTuple; - resolvedType: ReflectT; - id: number; - options: {[key: string]: any}; - defaultValue: any; - oneof: ReflectOneOf; - originalName: string; - build(): {[key: string]: any}; - mkLong(value: any, unsigned?: boolean): number; - verifyValue(value: any, skipRepeated?: boolean): any; - encode(value: any, buffer: Buffer): Buffer; - encodeValue(value: any, buffer: Buffer): Buffer; - calculate(value: any): number; - calculateValue(value: any): number; - decode(wireType: number, buffer: Buffer, skipRepeated?: boolean): any; - } - - export interface WireTuple { - name: string; - wireType: number; - } - - // TODO: check that the runtime instance of this type reflects this definition - export interface ReflectExtensionField extends ReflectField { - new(builder: ProtoBuilder, message: ReflectMessage, rule: string, type: string, - name: string, id: number, options: {[key: string]: any}): ReflectExtensionField; - extension: ReflectExtension; - } - - export interface ReflectOneOf extends ReflectT { - new(builder?: ProtoBuilder, message?: ReflectMessage, name?: string): ReflectOneOf; - fields: ReflectField[]; - } - - export interface ReflectValue extends ReflectT { - new(builder?: ProtoBuilder, enm?: ReflectEnum, name?: string, id?: number): ReflectValue; - className: string; - id: number; - } - - export interface ReflectMethod extends ReflectT { - new(builder?: ProtoBuilder, svc?: ReflectService, name?: string, - options?: {[key: string]: any}): ReflectMethod; - className: string; - options: {[key: string]: any}; - buildOpt(): {[key: string]: any}; - } - - export interface ReflectRPCMethod extends ReflectMethod { - new(builder?: ProtoBuilder, svc?: ReflectService, name?: string, request?: string, - response?: string, options?: {[key: string]: any}): ReflectRPCMethod; - requestName: string; - responseName: string; - resolvedRequestType: ReflectMessage; - resolvedResponseType: ReflectMessage; - } - -} - -declare module "protobufjs" { - export = ProtoBuf; -} - -declare module "protobufjs/dist/protobuf-light" { - export = ProtoBuf; -} diff --git a/types/protobufjs/protobufjs-tests.ts b/types/protobufjs/protobufjs-tests.ts deleted file mode 100644 index eccb69a3c2..0000000000 --- a/types/protobufjs/protobufjs-tests.ts +++ /dev/null @@ -1,421 +0,0 @@ -/// - - -var assert = require('chai').assert; -var readFileSync = require('fs').readFileSync; -import ProtoBuf = require("protobufjs"); - -function testProtoBufJs() { - assert.ok("Builder" in ProtoBuf, "ProtoBuf should contain property Builder"); - assert.ok("ByteBuffer" in ProtoBuf, "ProtoBuf should contain property ByteBuffer"); - assert.ok("DotProto" in ProtoBuf, "ProtoBuf should contain property DotProto"); - assert.ok("Reflect" in ProtoBuf, "ProtoBuf should contain property Reflect"); - assert.ok("loadJson" in ProtoBuf, "ProtoBuf should contain property loadJson"); - assert.ok("loadJsonFile" in ProtoBuf, "ProtoBuf should contain property loadJsonFile"); - assert.ok("loadProto" in ProtoBuf, "ProtoBuf should contain property loadProto"); - assert.ok("loadProtoFile" in ProtoBuf, "ProtoBuf should contain property loadProtoFile"); - assert.ok("newBuilder" in ProtoBuf, "ProtoBuf should contain property newBuilder"); - - var jsonProto: ProtoBuf.ProtoBuilder = ProtoBuf.loadJson(readFileSync("test.json", - {"encoding": "utf8"})); - assertIsProtoBuilder(jsonProto, "loadJson"); - - var jsonFileProto: ProtoBuf.ProtoBuilder = ProtoBuf.loadJsonFile("test.json"); - assertIsProtoBuilder(jsonFileProto, "loadJsonFile"); - - ProtoBuf.loadJsonFile("test.json", (error: any, builder: ProtoBuf.ProtoBuilder) => { - assertIsProtoBuilder(builder, "loadJsonFile callback"); - }); - - var proto: ProtoBuf.ProtoBuilder = ProtoBuf.loadProto(readFileSync("test.proto", - {"encoding": "utf8"})); - assertIsProtoBuilder(proto, "loadProto"); - - var protoFile: ProtoBuf.ProtoBuilder = ProtoBuf.loadProtoFile("test.proto"); - assertIsProtoBuilder(protoFile, "loadProtoFile"); - - ProtoBuf.loadProtoFile("test.proto", (error: any, builder: ProtoBuf.ProtoBuilder) => { - assertIsProtoBuilder(builder, "loadProtoFile callback"); - }); - - var newBuilder: ProtoBuf.ProtoBuilder = ProtoBuf.newBuilder(); - assertIsProtoBuilder(newBuilder, "newBuilder"); - - assertIsNamespace(protoFile.ns, "protoFile.ns"); - assertIsNamespace(protoFile.ptr, "protoFile.ptr"); - - assertIsMetaMessage(protoFile.build(), "protoFile.build()"); - assertIsProtoBuf(protoFile.result, "protoFile.result"); - - assertIsProtoBuilder(protoFile.create(), "protoFile.create()"); - assertIsProtoBuilder(protoFile.define("js"), "protoFile.define()"); - - assertIsT(protoFile.lookup(), "protoFile.lookup()"); -} - -function testBuilderJs() { - var Builder: ProtoBuf.Builder = ProtoBuf.Builder; - assertIsBuilder(Builder, "Builder"); - - var newBuilder: ProtoBuf.ProtoBuilder = new ProtoBuf.Builder(); - assertIsProtoBuilder(newBuilder, "new Builder()"); - - var Message: ProtoBuf.Message = Builder.Message; - var Service: ProtoBuf.Service = Builder.Service; -} - -function testDotProtoJs() { - var DotProto: ProtoBuf.DotProto = ProtoBuf.DotProto; - assertIsDotProto(DotProto, "DotProto"); -} - -function testReflectJs() { - var Reflect: ProtoBuf.Reflect = ProtoBuf.Reflect; - assertIsReflect(Reflect, "Reflect"); -} - -function assertIsProtoBuilder(pb: ProtoBuf.ProtoBuilder, name: string) { - if (pb != null && pb != undefined) { - assert.ok("ns" in pb, name + " should contain property ns"); - assert.ok("ptr" in pb, name + " should contain property ptr"); - assert.ok("resolved" in pb, name + " should contain property resolved"); - assert.ok("result" in pb, name + " should contain property result"); - assert.ok("files" in pb, name + " should contain property files"); - assert.ok("importRoot" in pb, name + " should contain property importRoot"); - assert.ok("options" in pb, name + " should contain property options"); - assert.ok("reset" in pb, name + " should contain property reset"); - assert.ok("define" in pb, name + " should contain property define"); - assert.ok("create" in pb, name + " should contain property create"); - assert.ok("resolveAll" in pb, name + " should contain property resolveAll"); - assert.ok("build" in pb, name + " should contain property build"); - assert.ok("lookup" in pb, name + " should contain property lookup"); - assert.ok("syntax" in pb, name + " should contain property syntax"); - } -} - -function assertIsBuilder(b: ProtoBuf.Builder, name: string) { - assert.ok("Message" in b, name + " should contain property Message"); - assert.ok("Service" in b, name + " should contain property Service"); - assert.ok("isValidMessage" in b, name + " should contain property isValidMessage"); - assert.ok("isValidMessageField" in b, name + " should contain property isValidMessageField"); - assert.ok("isValidEnum" in b, name + " should contain property isValidEnum"); - assert.ok("isValidService" in b, name + " should contain property isValidService"); - assert.ok("isValidExtend" in b, name + " should contain property isValidExtend"); -} - -function assertIsProtoBuf(pb: ProtoBuf.ProtoBuf, name: string) { - for (var pkg in pb) { - if (pb.hasOwnProperty(pkg)) { - for (var property in pb[pkg]) { - if (typeof pb[pkg][property] == typeof Object - && pb[pkg].hasOwnProperty(property)) { - assertIsMetaMessage(pb[pkg][property], - name + "." + pkg + "." + property); - } - } - } - } -} - -function assertIsMetaMessage(mm: ProtoBuf.MetaMessage, name: string) { - assert.ok("decode" in mm, name + " should contain property decode"); - assert.ok("decodeDelimited" in mm, name + " should contain property decodeDelimited"); - assert.ok("decode64" in mm, name + " should contain property decode64"); - assert.ok("decodeHex" in mm, name + " should contain property decodeHex"); - assert.ok("decodeJSON" in mm, name + " should contain property decodeJSON"); -} - -function assertIsDotProto(dp: ProtoBuf.DotProto, name: string) { - assert.ok("Parser" in dp, name + " should contain property Parser"); - assert.ok("Tokenizer" in dp, name + " should contain property Tokenizer"); - - assertIsParser(new dp.Parser(readFileSync("test.proto", {"encoding": "utf8"})), - name + ".Parser"); - assertIsTokenizer(new dp.Tokenizer(readFileSync("test.proto", {"encoding": "utf8"})), - name + ".Tokenizer"); -} - -function assertIsParser(p: ProtoBuf.Parser, name: string) { - assert.ok("tn" in p, name + " should contain property tn"); - assert.ok("parse" in p, name + " should contain property parse"); - assert.ok("toString" in p, name + " should contain property toString"); - - assertIsTokenizer(p.tn, name + ".tn"); - assertIsMetaProto(p.parse(), name + ".parse()"); -} - -function assertIsTokenizer(t: ProtoBuf.Tokenizer, name: string) { - assert.ok("source" in t, name + " should contain property source"); - assert.ok("index" in t, name + " should contain property index"); - assert.ok("line" in t, name + " should contain property line"); - assert.ok("stack" in t, name + " should contain property stack"); - assert.ok("readingString" in t, name + " should contain property readingString"); - assert.ok("stringEndsWith" in t, name + " should contain property stringEndsWith"); - assert.ok("next" in t, name + " should contain property next"); - assert.ok("peek" in t, name + " should contain property peek"); - assert.ok("toString" in t, name + " should contain property toString"); -} - -function assertIsMetaProto(mp: ProtoBuf.MetaProto, name: string) { - assert.ok("package" in mp, name + " should contain proeprty package"); - assert.ok("messages" in mp, name + " should contain proeprty messages"); - assert.ok("enums" in mp, name + " should contain proeprty enums"); - assert.ok("imports" in mp, name + " should contain proeprty imports"); - assert.ok("options" in mp, name + " should contain proeprty options"); - assert.ok("services" in mp, name + " should contain proeprty services"); - - for (var message in mp.messages) { - assertIsProtoMessage(mp.messages[message], name + ".messages." + message); - } - for (var en in mp.enums) { - assertIsProtoEnum(mp.enums[en], name + ".enums." + en); - } - for (var serv in mp.services) { - assertIsProtoService(mp.services[serv], name + ".services." + serv); - } -} - -function assertIsProtoEnum(pe: ProtoBuf.ProtoEnum, name: string) { - assert.ok("name" in pe, name + " should contain property name"); - assert.ok("values" in pe, name + " should contain property values"); - assert.ok("options" in pe, name + " should contain property options"); - - for (var value in pe.values) { - assertIsProtoEnumValue(pe.values[value], name + ".values." + value); - } -} - -function assertIsProtoEnumValue(pev: ProtoBuf.ProtoEnumValue, name: string) { - assert.ok("name" in pev, name + " should contain property name"); - assert.ok("id" in pev, name + " should contain property id"); -} - -function assertIsProtoField(pf: ProtoBuf.ProtoField, name: string) { - assert.ok("rule" in pf, name + " should contain property rule"); - assert.ok("options" in pf, name + " should contain property options"); - assert.ok("type" in pf, name + " should contain property type"); - assert.ok("name" in pf, name + " should contain property name"); - assert.ok("id" in pf, name + " should contain property id"); -} - -function assertIsProtoMessage(pm: ProtoBuf.ProtoMessage, name: string) { - assert.ok("name" in pm, name + " should contain property name"); - assert.ok("fields" in pm, name + " should contain property fields"); - assert.ok("enums" in pm, name + " should contain property enums"); - assert.ok("messages" in pm, name + " should contain property messages"); - assert.ok("options" in pm, name + " should contain property options"); - assert.ok("oneofs" in pm, name + " should contain property oneofs"); - - for (var f in pm.fields) { - assertIsProtoField(pm.fields[f], name + ".fields." + f); - } - for (var en in pm.enums) { - assertIsProtoEnum(pm.enums[en], name + ".enums." + en); - } - for (var m in pm.messages) { - assertIsProtoMessage(pm.messages[m], name + ".messages." + m); - } -} - -function assertIsProtoRpcService(rpc: ProtoBuf.ProtoRpcService, name: string) { - assert.ok("request" in rpc, name + " should contain property request"); - assert.ok("response" in rpc, name + " should contain property response"); - assert.ok("options" in rpc, name + " should contain property options"); -} - -function assertIsProtoService(ps: ProtoBuf.ProtoService, name: string) { - assert.ok("name" in ps, name + " should contain property name"); - assert.ok("rpc" in ps, name + " should contain property rpc"); - assert.ok("options" in ps, name + " should contain property options"); - - for (var rpc in ps.rpc) { - assertIsProtoRpcService(ps.rpc[rpc], name + ".rpc." + rpc); - } -} - -function assertIsReflect(r: ProtoBuf.Reflect, name: string) { - assert.ok("T" in r, name + " should contain property T"); - assert.ok("Namespace" in r, name + " should contain property Namespace"); - assert.ok("Message" in r, name + " should contain property Message"); - assert.ok("Enum" in r, name + " should contain property Enum"); - assert.ok("Extension" in r, name + " should contain property Extension"); - assert.ok("Service" in r, name + " should contain property Service"); - - assertIsT(new ProtoBuf.Reflect.T(), "new ProtoBuf.Reflect.T()"); - assertIsNamespace(new ProtoBuf.Reflect.Namespace(), "new ProtoBuf.Reflect.Namespace()"); - assertIsMessage(new ProtoBuf.Reflect.Message(), "new ProtoBuf.Reflect.Message()"); - assertIsEnum(new ProtoBuf.Reflect.Enum(), "new ProtoBuf.Reflect.Enum()"); - assertIsExtension(new ProtoBuf.Reflect.Extension(), "new ProtoBuf.Reflect.Extension()"); - assertIsService(new ProtoBuf.Reflect.Service(), "new ProtoBuf.Reflect.Service()"); - - assertIsValue(new ProtoBuf.Reflect.Enum.Value(), "new ProtoBuf.Reflect.Enum.Value()"); - assertIsOneOf(new ProtoBuf.Reflect.Message.OneOf(), "new ProtoBuf.Reflect.Message.OneOf()"); - assertIsMethod(new ProtoBuf.Reflect.Service.Method(), "new ProtoBuf.Reflect.Service.Method()"); - assertIsRPCMethod(new ProtoBuf.Reflect.Service.RPCMethod(), - "new ProtoBuf.Reflect.Service.RPCMethod()"); -} - -function assertIsT(t: ProtoBuf.ReflectT, name: string) { - if (t != null && t != undefined) { - assertIsTNoRecursion(t, name); - - assertIsProtoBuilder(t.builder, name + ".builder"); - assertIsTNoRecursion(t.parent, name + ".parent"); - } -} - -function assertIsTNoRecursion(t: ProtoBuf.ReflectT, name: string) { - if (t != null) { - assert.ok("builder" in t, name + " should contain property builder"); - assert.ok("parent" in t, name + " should contain property parent"); - assert.ok("name" in t, name + " should contain property name"); - assert.ok("fqn" in t, name + " should contain property fqn"); - assert.ok("toString" in t, name + " should contain property toString"); - } -} - -function assertIsNamespace(ns: ProtoBuf.ReflectNamespace, name: string) { - assertIsNamespaceNoRecursion(ns, name); - - assertIsT(ns, name); - - for (var child in ns.children) { - assertIsT(ns.children[child], name + ".children." + child); - } - for (var child in ns.getChildren()) { - assertIsT(ns.getChildren()[child], name + ".getChildren()." + child); - } - assertIsT(ns.getChild(), name + ".getChild()"); -} - -function assertIsNamespaceNoRecursion(ns: ProtoBuf.ReflectNamespace, name: string) { - assert.ok("className" in ns, name + " should contain property className"); - assert.ok("children" in ns, name + " should contain property children"); - assert.ok("options" in ns, name + " should contain property options"); - assert.ok("syntax" in ns, name + " should contain property syntax"); - assert.ok("getChildren" in ns, name + " should contain property getChildren"); - assert.ok("addChild" in ns, name + " should contain property addChild"); - assert.ok("getChild" in ns, name + " should contain property getChild"); - assert.ok("resolve" in ns, name + " should contain property resolve"); - assert.ok("build" in ns, name + " should contain property build"); - assert.ok("buildOpt" in ns, name + " should contain property buildOpt"); - assert.ok("getOption" in ns, name + " should contain property getOption"); -} - -function assertIsMessage(m: ProtoBuf.ReflectMessage, name: string) { - if (m != null && m != undefined) { - assert.ok("extensions" in m, name + " should contain property extensions"); - assert.ok("clazz" in m, name + " should contain property clazz"); - assert.ok("isGroup" in m, name + " should contain property isGroup"); - assert.ok("build" in m, name + " should contain property build"); - assert.ok("encode" in m, name + " should contain property encode"); - assert.ok("calculate" in m, name + " should contain property calculate"); - assert.ok("decode" in m, name + " should contain property decode"); - - assertIsNamespace(m, name); - } -} - -function assertIsEnum(e: ProtoBuf.ReflectEnum, name: string) { - assert.ok("object" in e, name + " should contain property object"); - assert.ok("build" in e, name + " should contain property build"); - - assertIsNamespace(e, name); -} - -function assertIsExtension(e: ProtoBuf.ReflectExtension, name: string) { - assert.ok("field" in e, name + " should contain property field"); - - assertIsT(e, name); - - assertIsField(e.field, name + ".field"); -} - -function assertIsService(s: ProtoBuf.ReflectService, name: string) { - assert.ok("clazz" in s, name + " should contain property clazz"); - assert.ok("build" in s, name + " should contain property build"); - - assertIsNamespace(s, name); -} - -function assertIsField(f: ProtoBuf.ReflectField, name: string) { - if (f != null && f != undefined) { - assert.ok("className" in f, name + " should contain property className"); - assert.ok("required" in f, name + " should contain property required"); - assert.ok("repeated" in f, name + " should contain property repeated"); - assert.ok("type" in f, name + " should contain property type"); - assert.ok("resolvedType" in f, name + " should contain property resolvedType"); - assert.ok("id" in f, name + " should contain property id"); - assert.ok("options" in f, name + " should contain property options"); - assert.ok("defaultValue" in f, name + " should contain property defaultValue"); - assert.ok("oneof" in f, name + " should contain property oneof"); - assert.ok("originalName" in f, name + " should contain property originalName"); - assert.ok("build" in f, name + " should contain property build"); - assert.ok("mkLong" in f, name + " should contain property mkLong"); - assert.ok("verifyValue" in f, name + " should contain property verifyValue"); - assert.ok("encode" in f, name + " should contain property encode"); - assert.ok("encodeValue" in f, name + " should contain property encodeValue"); - assert.ok("calculate" in f, name + " should contain property calculate"); - assert.ok("calculateValue" in f, name + " should contain property calculateValue"); - assert.ok("decode" in f, name + " should contain property decode"); - - assertIsT(f, name); - - assertIsT(f.resolvedType, name + ".resolvedType"); - assertIsOneOf(f.oneof, name + ".oneof"); - } -} - -function assertIsWireTuple(wt: ProtoBuf.WireTuple, name: string) { - assert.ok("name" in wt, name + " should contain property name"); - assert.ok("wireType" in wt, name + " should contain property wireType"); -} - -function assertIsExtensionField(ef: ProtoBuf.ReflectExtensionField, name: string) { - assert.ok("extension" in ef, name + " should contain property extension"); - - assertIsField(ef, name); - - assertIsExtension(ef.extension, name + ".extension"); -} - -function assertIsOneOf(oo: ProtoBuf.ReflectOneOf, name: string) { - assert.ok("fields" in oo, name + " should contain property fields"); - - for (var f in oo.fields) { - assertIsField(oo.fields[f], name + ".fields." + f); - } -} - -function assertIsValue(v: ProtoBuf.ReflectValue, name: string) { - assert.ok("className" in v, name + " should contain property className"); - assert.ok("id" in v, name + " should contain property id"); - - assertIsT(v, name); -} - -function assertIsMethod(m: ProtoBuf.ReflectMethod, name: string) { - assert.ok("className" in m, name + " should contain property className"); - assert.ok("options" in m, name + " should contain property options"); - assert.ok("buildOpt" in m, name + " should contain property buildOpt"); - - assertIsT(m, name); -} - -function assertIsRPCMethod(rpc: ProtoBuf.ReflectRPCMethod, name: string) { - assert.ok("requestName" in rpc, name + " should contain property requestName"); - assert.ok("responseName" in rpc, name + " should contain property responseName"); - assert.ok("resolvedRequestType" in rpc, name + " should contain property resolvedRequestType"); - assert.ok("resolvedResponseType" in rpc, - name + " should contain property resolvedResponseType"); - - assertIsMethod(rpc, name); - - assertIsMessage(rpc.resolvedRequestType, name + ".resolvedRequestType"); - assertIsMessage(rpc.resolvedResponseType, name + ".resolvedResponsetype"); -} - -testProtoBufJs(); -testBuilderJs(); -testDotProtoJs(); -testReflectJs(); diff --git a/types/protobufjs/tsconfig.json b/types/protobufjs/tsconfig.json deleted file mode 100644 index 30ec4a0f3e..0000000000 --- a/types/protobufjs/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "protobufjs-tests.ts" - ] -} \ No newline at end of file diff --git a/types/protobufjs/tslint.json b/types/protobufjs/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/protobufjs/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 5add33c44d74aa9bf136d8541e65398d29a02893 Mon Sep 17 00:00:00 2001 From: Soner Koksal Date: Thu, 21 Dec 2017 01:11:38 +0300 Subject: [PATCH 137/890] BootboxDialogOptions message type extended according to jquery --- types/bootbox/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/bootbox/index.d.ts b/types/bootbox/index.d.ts index 850eb18c25..dfdf0de871 100644 --- a/types/bootbox/index.d.ts +++ b/types/bootbox/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Bootbox 4.4.0 // Project: https://github.com/makeusabrew/bootbox -// Definitions by: Vincent Bortone , Kon Pik , Anup Kattel , Dominik Schroeter , Troy McKinnon , Stanny Nuytkens +// Definitions by: Vincent Bortone , Kon Pik , Anup Kattel , Dominik Schroeter , Troy McKinnon , Stanny Nuytkens , Soner Köksal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -23,7 +23,7 @@ interface BootboxBaseOptions { /** Bootbox options available for custom modals */ interface BootboxDialogOptions extends BootboxBaseOptions { - message: string | Element; + message: JQuery|any[]|Element|DocumentFragment|Text|string|((index: number, html: string) => string|Element|JQuery); } /** Bootbox options available for alert modals */ From de7390761f2f3bf60e63a2e27a2fa8d097607e62 Mon Sep 17 00:00:00 2001 From: thephantom Date: Wed, 20 Dec 2017 17:18:39 -0500 Subject: [PATCH 138/890] [redis] hgetall cb to be optional --- types/redis/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/redis/index.d.ts b/types/redis/index.d.ts index 6417afabf9..db0dd122ba 100644 --- a/types/redis/index.d.ts +++ b/types/redis/index.d.ts @@ -472,8 +472,8 @@ export interface Commands { /** * Get all fields and values in a hash. */ - hgetall(key: string, cb: Callback<{ [key: string]: string }>): R; - HGETALL(key: string, cb: Callback<{ [key: string]: string }>): R; + hgetall(key: string, cb?: Callback<{ [key: string]: string }>): R; + HGETALL(key: string, cb?: Callback<{ [key: string]: string }>): R; /** * Increment the integer value of a hash field by the given number. From 311fd1641b998baa3cc2342f9ad722b3cc03edff Mon Sep 17 00:00:00 2001 From: Mike North Date: Wed, 20 Dec 2017 14:35:10 -0800 Subject: [PATCH 139/890] DS.Snapshot#hasMany and #belongsTo options -> optional --- types/ember-data/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index c8cfd8187e..6d83c72fd2 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -947,12 +947,12 @@ declare module "ember-data" { */ belongsTo( keyName: string, - options: {} + options?: {} ): Snapshot | string | null | undefined; /** * Returns the current value of a hasMany relationship. */ - hasMany(keyName: string, options: {}): any[] | undefined; + hasMany(keyName: string, options?: {}): any[] | undefined; /** * Iterates through all the attributes of the model, calling the passed * function on each attribute. From 2aba677c40c6f54f63c3143125f50cee11477953 Mon Sep 17 00:00:00 2001 From: Viko Date: Wed, 20 Dec 2017 17:06:01 -0600 Subject: [PATCH 140/890] Fix jDataView tests (goddammit past me) --- types/jdataview/jdataview-tests.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/jdataview/jdataview-tests.ts b/types/jdataview/jdataview-tests.ts index 1125054ab8..a587b6e2d8 100644 --- a/types/jdataview/jdataview-tests.ts +++ b/types/jdataview/jdataview-tests.ts @@ -1,6 +1,7 @@ - /// +import jDataView = require('.'); + interface TARMetaData { name: string; mode: number; @@ -71,4 +72,4 @@ $.get('jquery.tar', function (data) { $('body').append($('').val(content)); } } -}); \ No newline at end of file +}); From cad1fec4c37aceeb464d808887d821c35b11ba3f Mon Sep 17 00:00:00 2001 From: Viko Date: Wed, 20 Dec 2017 17:22:38 -0600 Subject: [PATCH 141/890] Fix jBinary, too --- types/jbinary/index.d.ts | 6 ++++-- types/jbinary/jbinary-tests.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/types/jbinary/index.d.ts b/types/jbinary/index.d.ts index 857627056d..5b19d0f19f 100644 --- a/types/jbinary/index.d.ts +++ b/types/jbinary/index.d.ts @@ -9,7 +9,7 @@ // https://github.com/jDataView/jBinary/wiki/jBinary-Constructor // https://github.com/jDataView/jBinary/wiki/jBinary-Methods -/// +import jDataView = require('jdataview'); declare class jBinary { @@ -36,4 +36,6 @@ declare class jBinary slice(start:number, end:number, forceCopy?:boolean):jBinary; as(typeSet:Object, modifyOriginal?:boolean):jBinary; -} \ No newline at end of file +} + +export = jBinary; diff --git a/types/jbinary/jbinary-tests.ts b/types/jbinary/jbinary-tests.ts index a519fa5819..b833f3ba05 100644 --- a/types/jbinary/jbinary-tests.ts +++ b/types/jbinary/jbinary-tests.ts @@ -1,4 +1,4 @@ - +import jBinary = require('jbinary'); jBinary.loadData([0x05, 0x03, 0x7F, 0x1E]); jBinary.load([0x05, 0x03, 0x7F, 0x1E]); From 71a09643ccc34a89b95a3800e3a2d59cad720812 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Thu, 21 Dec 2017 09:56:30 +0100 Subject: [PATCH 142/890] added ResourceServer to auth0 --- types/auth0/index.d.ts | 66 ++++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index 12829b5b67..c341184b4d 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for auth0 2.5 +// Type definitions for auth0 2.6 // Project: https://github.com/auth0/node-auth0 // Definitions by: Wilson Hobbs , Seth Westphal , Amiram Korach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -165,6 +165,46 @@ export interface Client { mobile?: any; } +export interface ResourceServer { + /** + * The identifier of the resource server. + */ + identifier?: string; + scopes?: { description: string, value: string }[]; + /** + * The algorithm used to sign tokens. + */ + signing_alg?: 'HS256' | 'RS256'; + /** + * The secret used to sign tokens when using symmetric algorithms. + */ + signing_secret?: string; + /** + * Allows issuance of refresh tokens for this entity. + */ + allow_offline_access?: boolean; + /** + * Flag this entity as capable of skipping consent. + */ + skip_consent_for_verifiable_first_party_clients?: boolean; + /** + * The amount of time (in seconds) that the token will be valid after being issued. + */ + token_lifetime?: number; + /** + * The amount of time (in seconds) that the token will be valid after being issued from browser based flows. Value cannot be larger than token_lifetime.. + */ + token_lifetime_for_web?: number; + /** + * The ID of the resource server. + */ + id?: string; + /** + * A friendly name for the resource server. + */ + name?: string; +} + export interface User { email?: string; email_verified?: boolean; @@ -578,22 +618,18 @@ export class ManagementClient { // Resource Server - createResourceServer(data: Data): Promise; - createResourceServer(data: Data, cb?: (err: Error, data: any) => void): void; - - getResourceServers(): Promise; - getResourceServers(cb?: (err: Error, data: any) => void): void; - - getResourceServer(data: ObjectWithId): Promise; - getResourceServer(data: ObjectWithId, cb?: (err: Error, data: any) => void): void; - - deleteResourceServer(params: ObjectWithId): Promise; - deleteResourceServer(params: ObjectWithId, cb?: (err: Error, data: any) => void): void; - - updateResourceServer(params: ObjectWithId, data: Data): Promise; - updateResourceServer(params: ObjectWithId, data: Data, cb?: (err: Error, data: any) => void): void; + createResourceServer(data: ResourceServer): Promise; + createResourceServer(data: ResourceServer, cb?: (err: Error, data: ResourceServer) => void): void; + getResourceServers(): Promise; + getResourceServers(cb?: (err: Error, data: ResourceServer[]) => void): void; + getResourceServer(data: ObjectWithId): Promise; + getResourceServer(data: ObjectWithId, cb?: (err: Error, data: ResourceServer) => void): void; + deleteResourceServer(params: ObjectWithId): Promise; + deleteResourceServer(params: ObjectWithId, cb?: (err: Error) => void): void; + updateResourceServer(params: ObjectWithId, data: ResourceServer): Promise; + updateResourceServer(params: ObjectWithId, data: ResourceServer, cb?: (err: Error, data: ResourceServer) => void): void; } From 194fa569eb81941f28b3b29075cba0c5f77ff094 Mon Sep 17 00:00:00 2001 From: alfaslash Date: Thu, 21 Dec 2017 14:01:09 +0500 Subject: [PATCH 143/890] react-select: Add typo for autoFocus prop. Add type for `autoFocus` props. Add `deprecated` comment for `autofocus`. See changet to the [PR](https://github.com/JedWatson/react-select/pull/2002). --- types/react-select/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index 7a2601a6c1..f4a0db94dc 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-select 1.0 +// Type definitions for react-select 1.1 // Project: https://github.com/JedWatson/react-select // Definitions by: ESQUIBET Hugo // Gilad Gray @@ -153,9 +153,15 @@ export interface ReactSelectProps extends React.Props Date: Thu, 21 Dec 2017 10:46:27 +0100 Subject: [PATCH 144/890] throttle-debounce --- types/throttle-debounce/index.d.ts | 105 ++++++++++++++++++ .../throttle-debounce-tests.ts | 15 +++ types/throttle-debounce/tsconfig.json | 22 ++++ types/throttle-debounce/tslint.json | 3 + 4 files changed, 145 insertions(+) create mode 100644 types/throttle-debounce/index.d.ts create mode 100644 types/throttle-debounce/throttle-debounce-tests.ts create mode 100644 types/throttle-debounce/tsconfig.json create mode 100644 types/throttle-debounce/tslint.json diff --git a/types/throttle-debounce/index.d.ts b/types/throttle-debounce/index.d.ts new file mode 100644 index 0000000000..cf4650bafa --- /dev/null +++ b/types/throttle-debounce/index.d.ts @@ -0,0 +1,105 @@ +// Type definitions for throttle-debounce 1.0.1 +// Project: https://github.com/niksy/throttle-debounce +// Definitions by: Marek Buchar +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Throttle execution of a function. Especially useful for rate limiting + * execution of handlers on events like resize and scroll. + * + * @param delay + * A zero-or-greater delay in milliseconds. For event callbacks, values around + * 100 or 250 (or even higher) are most useful. + * + * @param noTrailing + * If noTrailing is true, callback will only execute every `delay` milliseconds + * while the throttled-function is being called. If noTrailing is false or + * unspecified, callback will be executed one final time fter the last + * throttled-function call. (After the throttled-function has not been called + * for `delay` milliseconds, the internal counter is reset) + * + * @param callback + * A function to be executed after delay milliseconds. The `this` context and + * all arguments are passed through, as-is, to `callback` when the + * throttled-function is executed. + * + * @param debounceMode If `debounceMode` is true (at begin), schedule `clear` + * to execute after `delay` ms. If `debounceMode` is false (at end), schedule + * `callback` to execute after `delay` ms. + * + * @return {Function} A new, throttled, function. + */ +export function throttle( + delay: number, + noTrailing: boolean, + callback: T, + debounceMode?: boolean, +): T; + +/** + * Throttle execution of a function. Especially useful for rate limiting + * execution of handlers on events like resize and scroll. + * + * @param delay + * A zero-or-greater delay in milliseconds. For event callbacks, values around + * 100 or 250 (or even higher) are most useful. + * + * @param callback + * A function to be executed after delay milliseconds. The `this` context and + * all arguments are passed through, as-is, to `callback` when the + * throttled-function is executed. + * + * @param debounceMode If `debounceMode` is true (at begin), schedule `clear` + * to execute after `delay` ms. If `debounceMode` is false (at end), schedule + * `callback` to execute after `delay` ms. + * + * @return {Function} A new, throttled, function. + */ +export function throttle( + delay: number, + callback: T, + debounceMode?: boolean, +): T; + +/** + * Debounce execution of a function. Debouncing, unlike throttling, + * guarantees that a function is only executed a single time, either at the + * very beginning of a series of calls, or at the very end. + * + * @param {Number} delay + * A zero-or-greater delay in milliseconds. For event callbacks, values around + * 100 or 250 (or even higher) are most useful. + * + * @param {Boolean} atBegin + * If atBegin is false or unspecified, callback will only be executed `delay` + * milliseconds after the last debounced-function call. If atBegin is true, + * callback will be executed only at the first debounced-function call. (After + * the throttled-function has not been called for `delay` milliseconds, the + * internal counter is reset). + * + * @param {Function} callback + * A function to be executed after delay milliseconds. The `this` context and + * all arguments are passed through, as-is, to `callback` when the + * debounced-function is executed. + * + * @return {Function} A new, debounced function. + */ +export function debounce(delay: number, atBegin: boolean, callback: T): T; + +/** + * Debounce execution of a function. Debouncing, unlike throttling, + * guarantees that a function is only executed a single time, either at the + * very beginning of a series of calls, or at the very end. + * + * @param {Number} delay + * A zero-or-greater delay in milliseconds. For event callbacks, values around + * 100 or 250 (or even higher) are most useful. + * + * @param {Function} callback + * A function to be executed after delay milliseconds. The `this` context and + * all arguments are passed through, as-is, to `callback` when the + * debounced-function is executed. + * + * @return {Function} A new, debounced function. + */ +export function debounce(delay: number, callback: T): T; diff --git a/types/throttle-debounce/throttle-debounce-tests.ts b/types/throttle-debounce/throttle-debounce-tests.ts new file mode 100644 index 0000000000..0090eb1039 --- /dev/null +++ b/types/throttle-debounce/throttle-debounce-tests.ts @@ -0,0 +1,15 @@ +import throttleDebounce = require('throttle-debounce'); + +const { throttle, debounce } = throttleDebounce; + +type Func = () => void; + +const func: Func = () => {}; + +const throttle1: Func = throttle(42, true, func, true); +const throttle2: Func = throttle(42, true, func); +const throttle3: Func = throttle(42, func, true); +const throttle4: Func = throttle(42, func); + +const debounce1: Func = debounce(42, true, func); +const debounce2: Func = debounce(42, func); diff --git a/types/throttle-debounce/tsconfig.json b/types/throttle-debounce/tsconfig.json new file mode 100644 index 0000000000..8ad1002d0e --- /dev/null +++ b/types/throttle-debounce/tsconfig.json @@ -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", + "throttle-debounce-tests.ts" + ] +} diff --git a/types/throttle-debounce/tslint.json b/types/throttle-debounce/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/throttle-debounce/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 1b3abfb65d333fde1abd63bb9013b6f7132a1789 Mon Sep 17 00:00:00 2001 From: Marek Date: Thu, 21 Dec 2017 10:54:50 +0100 Subject: [PATCH 145/890] travis fix --- types/throttle-debounce/tsconfig.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/throttle-debounce/tsconfig.json b/types/throttle-debounce/tsconfig.json index 8ad1002d0e..f05aae2e84 100644 --- a/types/throttle-debounce/tsconfig.json +++ b/types/throttle-debounce/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -17,6 +18,6 @@ }, "files": [ "index.d.ts", - "throttle-debounce-tests.ts" + "throttle-tests.ts" ] -} +} \ No newline at end of file From e6b6991584d105fdb183e02ad643a235d0b476c3 Mon Sep 17 00:00:00 2001 From: King Wang Date: Thu, 21 Dec 2017 18:17:46 +0800 Subject: [PATCH 146/890] add missing PIXI.loaders.shared add missing PIXI.loaders.shared --- types/pixi.js/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/pixi.js/index.d.ts b/types/pixi.js/index.d.ts index 1875746d6e..43b34cc2ca 100644 --- a/types/pixi.js/index.d.ts +++ b/types/pixi.js/index.d.ts @@ -2402,6 +2402,7 @@ declare namespace PIXI { spineData: any; textures?: TextureDictionary; } + const shared: Loader; } ////////////////////////////////////////////////////////////////////////////// From ecca42450bd17346ae8eff23f1543504b8b176d0 Mon Sep 17 00:00:00 2001 From: Marek Date: Thu, 21 Dec 2017 12:16:18 +0100 Subject: [PATCH 147/890] travis fix --- types/throttle-debounce/index.d.ts | 26 +++++++++++++++----------- types/throttle-debounce/tsconfig.json | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/types/throttle-debounce/index.d.ts b/types/throttle-debounce/index.d.ts index cf4650bafa..3264fdf3b6 100644 --- a/types/throttle-debounce/index.d.ts +++ b/types/throttle-debounce/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for throttle-debounce 1.0.1 +// Type definitions for throttle-debounce 1.0 // Project: https://github.com/niksy/throttle-debounce -// Definitions by: Marek Buchar +// Definitions by: Marek Buchar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** @@ -27,7 +27,8 @@ * to execute after `delay` ms. If `debounceMode` is false (at end), schedule * `callback` to execute after `delay` ms. * - * @return {Function} A new, throttled, function. + * @return + * A new, throttled, function. */ export function throttle( delay: number, @@ -53,7 +54,8 @@ export function throttle( * to execute after `delay` ms. If `debounceMode` is false (at end), schedule * `callback` to execute after `delay` ms. * - * @return {Function} A new, throttled, function. + * @return + * A new, throttled, function. */ export function throttle( delay: number, @@ -66,23 +68,24 @@ export function throttle( * guarantees that a function is only executed a single time, either at the * very beginning of a series of calls, or at the very end. * - * @param {Number} delay + * @param delay * A zero-or-greater delay in milliseconds. For event callbacks, values around * 100 or 250 (or even higher) are most useful. * - * @param {Boolean} atBegin + * @param atBegin * If atBegin is false or unspecified, callback will only be executed `delay` * milliseconds after the last debounced-function call. If atBegin is true, * callback will be executed only at the first debounced-function call. (After * the throttled-function has not been called for `delay` milliseconds, the * internal counter is reset). * - * @param {Function} callback + * @param callback * A function to be executed after delay milliseconds. The `this` context and * all arguments are passed through, as-is, to `callback` when the * debounced-function is executed. * - * @return {Function} A new, debounced function. + * @return + * A new, debounced function. */ export function debounce(delay: number, atBegin: boolean, callback: T): T; @@ -91,15 +94,16 @@ export function debounce(delay: number, atBegin: boolean, callback: T): T; * guarantees that a function is only executed a single time, either at the * very beginning of a series of calls, or at the very end. * - * @param {Number} delay + * @param delay * A zero-or-greater delay in milliseconds. For event callbacks, values around * 100 or 250 (or even higher) are most useful. * - * @param {Function} callback + * @param callback * A function to be executed after delay milliseconds. The `this` context and * all arguments are passed through, as-is, to `callback` when the * debounced-function is executed. * - * @return {Function} A new, debounced function. + * @return + * A new, debounced function. */ export function debounce(delay: number, callback: T): T; diff --git a/types/throttle-debounce/tsconfig.json b/types/throttle-debounce/tsconfig.json index f05aae2e84..cf362d7611 100644 --- a/types/throttle-debounce/tsconfig.json +++ b/types/throttle-debounce/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "throttle-tests.ts" + "throttle-debounce-tests.ts" ] } \ No newline at end of file From b7846fa85bd456f58dcd0975ed4e087b753cc7f4 Mon Sep 17 00:00:00 2001 From: Kevin Kuszyk Date: Thu, 21 Dec 2017 11:58:35 +0000 Subject: [PATCH 148/890] [cucumber] Update hooks to take options or a string for the tags --- types/cucumber/cucumber-tests.ts | 20 ++++++++++++++++++++ types/cucumber/index.d.ts | 8 ++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/types/cucumber/cucumber-tests.ts b/types/cucumber/cucumber-tests.ts index c71e827285..4447e5a7fe 100644 --- a/types/cucumber/cucumber-tests.ts +++ b/types/cucumber/cucumber-tests.ts @@ -32,6 +32,11 @@ function StepSample() { callback(); }); + Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => { + console.log(scenarioResult.status === "failed"); + callback(); + }); + BeforeAll((callback: Callback) => { console.log("Before all"); callback(); @@ -42,6 +47,11 @@ function StepSample() { callback(); }); + BeforeAll('@tag', (callback: Callback) => { + console.log("Before all"); + callback(); + }); + Around((scenarioResult: HookScenarioResult, runScenario: (error: string | null, callback?: () => void) => void) => { if (scenarioResult.status === "failed") { runScenario(null, () => { @@ -60,6 +70,11 @@ function StepSample() { callback(); }); + After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => { + console.log("After"); + callback(); + }); + AfterAll((callback: Callback) => { console.log("After all"); callback(); @@ -70,6 +85,11 @@ function StepSample() { callback(); }); + AfterAll('@tag', (callback: Callback) => { + console.log("After all"); + callback(); + }); + registerHandler('AfterFeatures', (event: any, callback: () => void) => { callback(); }); diff --git a/types/cucumber/index.d.ts b/types/cucumber/index.d.ts index 5ac6a5d85d..56d094210d 100644 --- a/types/cucumber/index.d.ts +++ b/types/cucumber/index.d.ts @@ -66,13 +66,13 @@ export interface HookOptions { export interface Hooks { Before(code: HookCode): void; - Before(options: HookOptions, code: HookCode): void; + Before(options: HookOptions | string, code: HookCode): void; BeforeAll(code: GlobalHookCode): void; - BeforeAll(options: HookOptions, code: GlobalHookCode): void; + BeforeAll(options: HookOptions | string, code: GlobalHookCode): void; After(code: HookCode): void; - After(options: HookOptions, code: HookCode): void; + After(options: HookOptions | string, code: HookCode): void; AfterAll(code: GlobalHookCode): void; - AfterAll(options: HookOptions, code: GlobalHookCode): void; + AfterAll(options: HookOptions | string, code: GlobalHookCode): void; Around(code: AroundCode): void; setDefaultTimeout(time: number): void; // tslint:disable-next-line ban-types From 32293959a938d455d1755730fc69d2b457684b95 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Thu, 21 Dec 2017 13:21:24 +0100 Subject: [PATCH 149/890] added CreateResourceServer to auth0 --- types/auth0/index.d.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index c341184b4d..2c13b62c6c 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -166,10 +166,6 @@ export interface Client { } export interface ResourceServer { - /** - * The identifier of the resource server. - */ - identifier?: string; scopes?: { description: string, value: string }[]; /** * The algorithm used to sign tokens. @@ -205,6 +201,13 @@ export interface ResourceServer { name?: string; } +export interface CreateResourceServer extends ResourceServer { + /** + * The identifier of the resource server. + */ + identifier?: string; +} + export interface User { email?: string; email_verified?: boolean; @@ -618,8 +621,8 @@ export class ManagementClient { // Resource Server - createResourceServer(data: ResourceServer): Promise; - createResourceServer(data: ResourceServer, cb?: (err: Error, data: ResourceServer) => void): void; + createResourceServer(data: CreateResourceServer): Promise; + createResourceServer(data: CreateResourceServer, cb?: (err: Error, data: ResourceServer) => void): void; getResourceServers(): Promise; getResourceServers(cb?: (err: Error, data: ResourceServer[]) => void): void; From 81890fa4781033f3d5a07cea1b5350163fe83fee Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Thu, 21 Dec 2017 14:10:15 +0100 Subject: [PATCH 150/890] added/fixed client grant typings in auth0 --- types/auth0/index.d.ts | 51 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index 2c13b62c6c..d17cddd145 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -203,11 +203,44 @@ export interface ResourceServer { export interface CreateResourceServer extends ResourceServer { /** - * The identifier of the resource server. + * The identifier of the client. */ identifier?: string; } +export interface CreateClientGrant { + /** + * The identifier of the resource server. + */ + client_id: string; + /** + * The audience. + */ + audience: string; + scope: string[]; +} + +export type UpdateClientGrant = Pick, 'scope'>; + +export type ClientGrant = Partial & { + /** + * The id of the client grant. + */ + id?: string; +}; + +export interface CreateClientGrant { + /** + * The identifier of the resource server. + */ + client_id: string; + /** + * The audience. + */ + audience: string; + scope: string[]; +} + export interface User { email?: string; email_verified?: boolean; @@ -476,17 +509,17 @@ export class ManagementClient { // Client Grants - getClientGrants(): Promise; - getClientGrants(cb: (err: Error, data: any) => void): void; + getClientGrants(): Promise; + getClientGrants(cb: (err: Error, data: ClientGrant[]) => void): void; - createClientGrant(data: Data): Promise; - createClientGrant(data: Data, cb: (err: Error, data: any) => void): void; + createClientGrant(data: CreateClientGrant): Promise; + createClientGrant(data: CreateClientGrant, cb: (err: Error, data: ClientGrant) => void): void; - updateClientGrant(params: ObjectWithId, data: Data): Promise; - updateClientGrant(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void; + updateClientGrant(params: ObjectWithId, data: UpdateClientGrant): Promise; + updateClientGrant(params: ObjectWithId, data: UpdateClientGrant, cb: (err: Error, data: ClientGrant) => void): void; - deleteClientGrant(params: ObjectWithId): Promise; - deleteClientGrant(params: ObjectWithId, cb: (err: Error, data: any) => void): void; + deleteClientGrant(params: ObjectWithId): Promise; + deleteClientGrant(params: ObjectWithId, cb: (err: Error) => void): void; // Device Keys From 9be4e75a0b62248f5817b53455721d78c9627b40 Mon Sep 17 00:00:00 2001 From: Pablo Aguirre Date: Thu, 21 Dec 2017 16:12:39 +0100 Subject: [PATCH 151/890] docker system df type --- types/dockerode/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index ac569b2d32..7900d42769 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -945,6 +945,9 @@ declare class Dockerode { info(callback: Callback): void; info(): Promise; + df(callback: Callback): void; + df(): Promise; + version(callback: Callback): void; version(): Promise; From 16ce77ee6d9d5d57ff6f686b7257e3759e8e98c6 Mon Sep 17 00:00:00 2001 From: Tomasz Janusz Date: Thu, 21 Dec 2017 17:26:48 +0100 Subject: [PATCH 152/890] Fix proj4leaflet tests & types errors GeoJSON does not have a CRS object in the specification, so the proj4leaflet tests did not pass. Fixed :) --- types/proj4leaflet/index.d.ts | 5 ++++- types/proj4leaflet/proj4leaflet-tests.ts | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/types/proj4leaflet/index.d.ts b/types/proj4leaflet/index.d.ts index 81a16100e4..a33a3efb32 100644 --- a/types/proj4leaflet/index.d.ts +++ b/types/proj4leaflet/index.d.ts @@ -42,7 +42,7 @@ declare module 'leaflet' { class GeoJSON extends L.GeoJSON {} - const geoJson: (geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions) => GeoJSON; + const geoJson: (geojson?: Proj4GeoJSONFeature, options?: GeoJSONOptions) => GeoJSON; class ImageOverlay extends L.ImageOverlay {} @@ -57,3 +57,6 @@ declare module 'leaflet' { } } } +export type Proj4GeoJSONFeature = geojson.Feature & { + crs?: { type: string; properties: { name: string } } +}; diff --git a/types/proj4leaflet/proj4leaflet-tests.ts b/types/proj4leaflet/proj4leaflet-tests.ts index e061a4ca3a..930473d793 100644 --- a/types/proj4leaflet/proj4leaflet-tests.ts +++ b/types/proj4leaflet/proj4leaflet-tests.ts @@ -1,6 +1,5 @@ import * as L from 'leaflet'; -import 'proj4leaflet'; - +import * as proj4leaflet from "proj4leaflet"; import * as proj4 from 'proj4'; import LatLngBoundsExpression = L.LatLngBoundsExpression; @@ -43,12 +42,13 @@ const crs3 = new L.Proj.CRS('EPSG:3006', // geoJson proj4.defs("urn:ogc:def:crs:EPSG::26915", "+proj=utm +zone=15 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"); -const geojson = { +const geojson: proj4leaflet.Proj4GeoJSONFeature = { type: "Feature", geometry: { type: "Point", coordinates: [481650, 4980105] }, + properties: {}, crs: { type: "name", properties: { From 66ce3763c8381c67d77a38ad632cad3b17edb5d4 Mon Sep 17 00:00:00 2001 From: Danilo Spinelli Date: Thu, 21 Dec 2017 17:54:01 +0100 Subject: [PATCH 153/890] update documentdb index.d.ts update documentdb index.d.ts to patch _ts type from string to number --- types/documentdb/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/documentdb/index.d.ts b/types/documentdb/index.d.ts index c1fbc38631..e7962ba568 100644 --- a/types/documentdb/index.d.ts +++ b/types/documentdb/index.d.ts @@ -133,7 +133,7 @@ export interface AbstractMeta extends UniqueId { _self: string; /** The time the object was created. */ - _ts: string | number; + _ts: number; _rid?: string; _etag?: string; From 7bfe75f7fece020d25ee720c04f5067f61302890 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 09:49:42 -0800 Subject: [PATCH 154/890] qrcode-generator: Provides its own types --- notNeededPackages.json | 6 ++ types/qrcode-generator/index.d.ts | 17 ---- .../qrcode-generator-tests.ts | 10 --- types/qrcode-generator/tsconfig.json | 23 ------ types/qrcode-generator/tslint.json | 79 ------------------- 5 files changed, 6 insertions(+), 129 deletions(-) delete mode 100644 types/qrcode-generator/index.d.ts delete mode 100644 types/qrcode-generator/qrcode-generator-tests.ts delete mode 100644 types/qrcode-generator/tsconfig.json delete mode 100644 types/qrcode-generator/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 0f92b3f3ac..5919ffc230 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -642,6 +642,12 @@ "sourceRepoURL": "https://github.com/qiniu/nodejs-sdk", "asOfVersion": "7.0.1" }, + { + "libraryName": "qrcode-generator", + "typingsPackageName": "qrcode-generator", + "sourceRepoURL": "https://github.com/kazuhikoarase/qrcode-generator", + "asOfVersion": "1.0.6" + }, { "libraryName": "Raven JS", "typingsPackageName": "raven-js", diff --git a/types/qrcode-generator/index.d.ts b/types/qrcode-generator/index.d.ts deleted file mode 100644 index 1ca4fb0370..0000000000 --- a/types/qrcode-generator/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Type definitions for grcode-generator -// Project: https://github.com/kazuhikoarase/qrcode-generator -// Definitions by: Stefan Huber -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare function qrcode(type: number, errorCorrectionLevel: string) : QRCode; -export = qrcode; -export as namespace qrcode; - -interface QRCode { - addData(data: string) : void; - make() : void; - - createTableTag(cellSize: number, margin: number) : string; - createSvgTag(cellSize: number, margin: number) : string; - createImageTag(cellSize: number, margin: number) : string; -} diff --git a/types/qrcode-generator/qrcode-generator-tests.ts b/types/qrcode-generator/qrcode-generator-tests.ts deleted file mode 100644 index 55a3fe372b..0000000000 --- a/types/qrcode-generator/qrcode-generator-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import qrcode = require('qrcode-generator'); - -let qr = qrcode(4,'M'); - -qr.addData('some arbitrary data'); -qr.make(); - -let imgHtml = qr.createImageTag(5,5); -let svgHtml = qr.createSvgTag(5,5); -let tableHtml = qr.createTableTag(5,5); \ No newline at end of file diff --git a/types/qrcode-generator/tsconfig.json b/types/qrcode-generator/tsconfig.json deleted file mode 100644 index d38967f679..0000000000 --- a/types/qrcode-generator/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "qrcode-generator-tests.ts" - ] -} \ No newline at end of file diff --git a/types/qrcode-generator/tslint.json b/types/qrcode-generator/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/qrcode-generator/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 2e6a1c83cfa0d9883af21875d7e285a62dea2794 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 09:51:44 -0800 Subject: [PATCH 155/890] rvo2: Provides its own types --- notNeededPackages.json | 6 + types/rvo2/index.d.ts | 581 --------------------------------------- types/rvo2/rvo2-tests.ts | 137 --------- types/rvo2/tsconfig.json | 23 -- types/rvo2/tslint.json | 79 ------ 5 files changed, 6 insertions(+), 820 deletions(-) delete mode 100644 types/rvo2/index.d.ts delete mode 100644 types/rvo2/rvo2-tests.ts delete mode 100644 types/rvo2/tsconfig.json delete mode 100644 types/rvo2/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 0f92b3f3ac..02bde190dc 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -756,6 +756,12 @@ "sourceRepoURL": "https://github.com/router5/router5", "asOfVersion": "5.0.0" }, + { + "libraryName": "rvo2", + "typingsPackageName": "rvo2", + "sourceRepoURL": "https://github.com/TNOCS/rvo2", + "asOfVersion": "1.1.0" + }, { "libraryName": "samchon", "typingsPackageName": "samchon", diff --git a/types/rvo2/index.d.ts b/types/rvo2/index.d.ts deleted file mode 100644 index 88ee40cd96..0000000000 --- a/types/rvo2/index.d.ts +++ /dev/null @@ -1,581 +0,0 @@ -// Type definitions for rvo2 -// Project: https://github.com/TNOCS/rvo2 -// Definitions by: Erik Vullings -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace rvo2 { - - class Line { - /** - * A point on the directed line. - */ - point: Vector2; - - /** - * The direction of the directed line. - */ - direction: Vector2; - } - - /** - * The Agent class has no public members or methods. - * - * @class Agent - */ - class Agent { } - - /** - * The KdTree class has no public members or methods. - * - * @class KdTree - */ - class KdTree { } - - /** - * The Obstacle class has no public members or methods. - * - * @class Obstacle - */ - class Obstacle { } - - /** - * A simple two dimensional vector with an x and y position. - * - * @class Vector2 - */ - class Vector2 { - /** - * Creates an instance of Vector2. - * - * @param {number} x - * @param {number} y - * - * @memberOf Vector2 - */ - constructor(x: number, y: number); - - /** - * Returns the x position. - * - * @returns {number} - * - * @memberOf Vector2 - */ - x(): number; - /** - * Returns the y position. - * - * @returns {number} - * - * @memberOf Vector2 - */ - y(): number; - /** - * Add two vectors. - * - * @param {Vector2} v - * @returns {Vector2} - * - * @memberOf Vector2 - */ - add(v: Vector2): Vector2; - /** - * Subtract two vectors. - * - * @param {Vector2} v - * @returns {Vector2} - * - * @memberOf Vector2 - */ - sub(v: Vector2): Vector2; - /** - * Multiplies the vector by a scalar. - * - * @param {number} s - * @returns {Vector2} - * - * @memberOf Vector2 - */ - mul(s: number): Vector2; - } - - /** - * An array of Vector2 vectors. - * - * @class vectorvector - */ - class vectorvector { - constructor(size?: number); - - [index: number]: Vector2; - } - - /** - * Simulation engine. - * - * @class sim - */ - class RVOSimulator { - constructor(); - - /** - * Constructs a simulator instance and sets the default - * properties for any new agent that is added. - * - * @param {number} timeStep The time step of the simulation. - * Must be positive. - * @param {number} neighborDist The default maximum distance (center point - * to center point) to other agents a new agent - * takes into account in the navigation. The - * larger this number, the longer he running - * time of the simulation. If the number is too - * low, the simulation will not be safe. Must be - * non-negative. - * @param {number} maxNeighbors The default maximum number of other agents a - * new agent takes into account in the - * navigation. The larger this number, the - * longer the running time of the simulation. - * If the number is too low, the simulation - * will not be safe. - * @param {number} timeHorizon The default minimal amount of time for which - * a new agent's velocities that are computed - * by the simulation are safe with respect to - * other agents. The larger this number, the - * sooner an agent will respond to the presence - * of other agents, but the less freedom the - * agent has in choosing its velocities. - * Must be positive. - * @param {number} timeHorizonObst The default minimal amount of time for which - * a new agent's velocities that are computed - * by the simulation are safe with respect to - * obstacles. The larger this number, the - * sooner an agent will respond to the presence - * of obstacles, but the less freedom the agent - * has in choosing its velocities. - * Must be positive. - * @param {number} radius The default radius of a new agent. - * Must be non-negative. - * @param {number} maxSpeed The default maximum speed of a new agent. - * Must be non-negative. - * @param {Vector2} velocity The default initial two-dimensional linear - * velocity of a new agent (optional). - */ - constructor(timeStep: number, neighborDist: number, maxNeighbors: number, - timeHorizon: number, timeHorizonObst: number, radius: number, - maxSpeed: number, velocity?: Vector2); - - /** - * Sets the time step of the simulation. - * - * @param {number} timeStep The time step of the simulation. - * Must be positive. - * - * @memberOf sim - */ - setTimeStep(timeStep: number): void; - - /** - * Lets the simulator perform a simulation step and updates the - * two-dimensional position and two-dimensional velocity of each agent. - * - * @memberOf RVOSimulator - */ - doStep(): void; - - /** - * Sets the default properties for any new agent that is added. - * @param {number} neighborDist The default maximum distance (center point - * to center point) to other agents a new agent - * takes into account in the navigation. The - * larger this number, the longer he running - * time of the simulation. If the number is too - * low, the simulation will not be safe. - * Must be non-negative. - * @param {number} maxNeighbors The default maximum number of other agents a - * new agent takes into account in the - * navigation. The larger this number, the - * longer the running time of the simulation. - * If the number is too low, the simulation - * will not be safe. - * @param {number} timeHorizon The default minimal amount of time for which - * a new agent's velocities that are computed - * by the simulation are safe with respect to - * other agents. The larger this number, the - * sooner an agent will respond to the presence - * of other agents, but the less freedom the - * agent has in choosing its velocities. - * Must be positive. - * @param {number} timeHorizonObst The default minimal amount of time for which - * a new agent's velocities that are computed - * by the simulation are safe with respect to - * obstacles. The larger this number, the - * sooner an agent will respond to the presence - * of obstacles, but the less freedom the agent - * has in choosing its velocities. - * Must be positive. - * @param {number} radius The default radius of a new agent. - * Must be non-negative. - * @param {number} maxSpeed The default maximum speed of a new agent. - * Must be non-negative. - * @param {Vector2} velocity The default initial two-dimensional linear - * velocity of a new agent (optional). - */ - setAgentDefaults(neighborDist: number, maxNeighbors: number, timeHorizon: number, timeHorizonObst: number, radius: number, maxSpeed: number, velocity?: Vector2): void; - /** - * Adds a new agent with default properties to the simulation. - * - * @param {Vector2} position The two-dimensional starting position of this agent. - - * @returns {number} The number of the agent, or RVO::RVO_ERROR when the * agent defaults have not been set. - * - * @membeim - */ - addAgent(position: Vector2): number; - - /** - * Adds a new agent to the simulation. - * - * @param {Vector2} position The two-dimensional starting position of - * this agent. - * @param {number} neighborDist The maximum distance (center point to - * center point) to other agents this agent - * takes into account in the navigation. The - * larger this number, the longer the running - * of the simulation. If the number is too - * low, the simulation will not be safe. - * Must be non-negative. - * @param {number} maxNeighbors The maximum number of other agents this - * agent takes into account in the navigation. - * The larger this number, the longer the - * running time of the simulation. If the - * number is too low, the simulation will not - * safe. - * @param {number} timeHorizon The minimal amount of time for which this - * agent's velocities that are computed by the - * simulation are safe with respect to other - * agents. The larger this number, the sooner - * this agent will respond to the presence of - * other agents, but the less freedom this - * agent has in choosing its velocities. - * be positive. - * @param {number} timeHorizonObst The minimal amount of time for which this - * agevelocities that are computed by the - * simulation are safe with respect to - * obst. The larger this number, the - * sooner this agent will respond to the - * presence of obstacles, but the less freedom - * this agent has in choosing its velocities. - * Must be positive. - * @param {number} radius The radius of this agent. - * Must be non-negative. - * @param {number} maxSpeed The maximum speed of this agent. - * Must be non-negative. - * @param {number} velocity The initial two-dimensional linear velocity - * of this agent (optional). - * @returns {number} The number of the agent. - */ - addAgent(position: Vector2, neighborDist: number, maxNeighbors: number, - timeHorizon: number, timeHorizonObst: number, radius: number, - maxSpeed: number, velocity: Vector2): number; - - /** - * Adds a new obstacle to the simulation. - * - * To add a "negative" obstacle, e.g. a bounding polygon around - * the environment, the vertices should be listed in clockwise order. - * - * @param {vectorvector} vertices List of the vertices of the polygonal - * obstacle in counterclockwise order. - * @returns {number} The number of the first vertex of the obstacle, - * or RVO::RVO_ERROR when the number of vertices is less than two. - */ - addObstacle(vertices: vectorvector): number; - - /** - * Returns the position of agent at the specified index. - * - * @param {number} index Index of the agent. Must be >= 0. - * @returns {Vector2} Position of the agent. - * - * @memberOf sim - */ - getAgentPosition(index: number): Vector2; - - /** - * Sets the two-dimensional preferred velocity of a specified agent. - * @param {number} agentNo The number of the agent whose two-dimensional - * preferred velocity is to be modified. - * @param {Vector2} prefVelocity The replacement of the two-dimensional - * preferred velocity. - */ - setAgentPrefVelocity(agentNo: number, prefVelocity: Vector2): void; - - /** - * Returns the specified agent neighbor of the specified agent. - * - * @param {number} agentNo The number of the agent whose agent - * neighbor is to be retrieved. - * @param {number} neighborNo The number of the agent neighbor to be - * retrieved. - * @returns The number of the neighboring agent. - */ - getAgentAgentNeighbor(agentNo: number, neighborNo: number): number; - - /** - * Returns the maximum neighbor count of a specified agent. - * - * @param {number} agentNo The number of the agent whose maximum neighbor count is - * to be retrieved. - * @return {number} The present maximum neighbor count of the agent. - */ - getAgentMaxNeighbors(agentNo: number): number; - - /** - * Returns the maximum speed of a specified agent. - * - * @param {number} agentNo The number of the agent whose maximum speed is to be retrieved. - * @return {number} The present maximum speed of the agent. - */ - getAgentMaxSpeed(agentNo: number): number; - - /** - * Returns the maximum neighbor distance of a specified agent. - * @param {number} agentNo The number of the agent whose maximum - * neighbor distance is to be retrieved. - * @return The present maximum neighbor distance of the agent. - */ - getAgentNeighborDist(agentNo: number): number; - - /** - * Returns the count of agent neighbors taken into account to - * compute the current velocity for the specified agent. - * - * @param {number} agentNo The number of the agent whose count of agent - * neighbors is to be retrieved. - * @return {number} The count of agent neighbors taken into account to compute - * the current velocity for the specified agent. - */ - getAgentNumAgentNeighbors(agentNo: number): number; - - /** - * Returns the count of obstacle neighbors taken into account - * to compute the current velocity for the specified agent. - * - * @param {number} agentNo The number of the agent whose count of - * obstacle neighbors is to be retrieved. - * @return {number} The count of obstacle neighbors taken into account to - * compute the current velocity for the specified agent. - */ - getAgentNumObstacleNeighbors(agentNo: number): number; - - - /** - * Returns the count of ORCAconstraints used to compute - * - * the current velocity for the specified agent. - * - * @param {number} agentNo The number of the agent whose count of ORCA - * constraints is to be retrieved. - * - * @return {number} The count of ORCAconstraints used to compute the current - * - * velocity for the specified agent. - */ - getAgentNumORCALines(agentNo: number): number; - - /** - * Returns the specified obstacle neighbor of the specified agent. - * - * @param {number} agentNo The number of the agent whose obstacle - * neighbor is to be retrieved. - * @param {number} neighborNo The number of the obstacle neighbor to be - * retrieved. - * @return {number} The number of the first vertex of the neighboring obstacle edge. - */ - getAgentObstacleNeighbor(agentNo: number, neighborNo: number): number; - - /** - * Returns the specified ORCA constraint of the specified agent. - * - * The halfplane to the left of the line is the region of - * permissible velocities with respect to the specified - * ORCAconstraint. - * - * @param {number} agentNo The number of the agent whose ORCA constraint is to be retrieved. - * - * @param {number} lineNo The number of the ORCAconstraint to be retrieved. - * @return {number} A line representing the specified ORCAconstraint. - * - * - */ - getAgentORCALine(agentNo: number, lineNo: number): Line; - - /** - * Returns the two-dimensional position of a specified - * agent. - * @param {number} agentNo The number of the agent whose two-dimensional position - * is to be retrieved. - * @return {number} The present two-dimensional position of the (center of the) agent. - */ - getAgentPosition(agentNo: number): Vector2; - - /** - * Returns the two-dimensional preferred velocity of a - * specified agent. - * @param {number} agentNo The number of the agent whose two-dimensional - * preferred velocity is to be retrieved. - * @return {number} The present two-dimensional preferred velocity of the agent. - */ - getAgentPrefVelocity(agentNo: number): Vector2; - - /** - * Returns the radius of a specified agent. - * @param {number} agentNo The number of the agent whose radius is to be retrieved. - * @return {number} The present radius of the agent. - */ - getAgentRadius(agentNo: number): number; - - /** - * Returns the time horizon of a specified agent. - * @param {number} agentNo The number of the agent whose time horizon is to be retrieved. - * @return {number} The present time horizon of the agent. - */ - getAgentTimeHorizon(agentNo: number): number; - - /** - * Returns the time horizon with respect to obstacles of a specified agent. - * - * @param {number} agentNo The number of the agent whose time horizon - * with respect to obstacles is to be retrieved. - * @return {number} The present time horizon with respect to obstacles of the - * agent. - */ - getAgentTimeHorizonObst(agentNo: number): number; - - /** - * Returns the two-dimensional linear velocity of a - * specified agent. - * @param {number} agentNo The number of the agent whose two-dimensional linear - * velocity is to be retrieved. - * @return {Vector2} The present two-dimensional linear velocity of the agent. - */ - getAgentVelocity(agentNo: number): Vector2; - - /** - * Returns the global time of the simulation. - * - * @return {number} The present global time of the simulation (zero initially). - */ - getGlobalTime(): number; - - /** - * Returns the count of agents in the simulation. - * - * @return {number} The count of agents in the simulation. - */ - getNumAgents(): number; - - /** - * Returns the count of obstacle vertices in the simulation. - * - * @return {number} The count of obstacle vertices in the simulation. - */ - getNumObstacleVertices(): number; - - /** - * Returns the two-dimensional position of a specified obstacle vertex. - * @param {number} vertexNo The number of the obstacle vertex to be retrieved. - * @return {Vector2} The two-dimensional position of the specified obstacle vertex. - */ - getObstacleVertex(vertexNo: number): Vector2; - - /** - * Returns the number of the obstacle vertex succeeding the specified obstacle vertex in its polygon. - * - * @param {number} vertexNo The number of the obstacle vertex whose - * successor is to be retrieved. - * @return {number} The number of the obstacle vertex succeeding the specified - * obstacle vertex in its polygon. - */ - getNextObstacleVertexNo(vertexNo: number): number; - - /** - * Returns the number of the obstacle vertex preceding the specified obstacle - * vertex in its polygon. - * - * @param {number} vertexNo The number of the obstacle vertex whose - * predecessor is to be retrieved. - * @return {number} The number of the obstacle vertex preceding the specified - * obstacle vertex in its polygon. - */ - getPrevObstacleVertexNo(vertexNo: number): number; - - /** - * Returns the time step of the simulation. - * - * @return {number} The present time step of the simulation. - */ - getTimeStep(): number; - - /** - * Processes the obstacles that have been added so that they are accounted for in - * the simulation. - * - * Obstacles added to the simulation after this function has - * been called are not accounted for in the simulation. - */ - processObstacles(): void; - - /** - * Performs a visibility query between the two specified points with respect to - * the obstacles - * - * @param {number} point1 The first point of the query. - * @param {number} point2 The second point of the query. - * @param {number} radius The minimal distance between the line - * connecting the two points and the obstacles - * in order for the points to be mutually - * visible (optional). Must be non-negative. - * @return {number} A boolean specifying whether the two points are mutually - * visible. Returns true when the obstacles have not been processed. - */ - queryVisibility(point1: Vector2, point2: Vector2, radius?: number): number; - } - - /** - * Computes the length of a specified two-dimensional vector. - * - * @param {Vector2} v The two-dimensional vector whose length is to be computed. - * @returns {number} The length of the two-dimensional vector. - * - * @memberOf sim - */ - function abs(v: Vector2): number; - - /** - * Computes the squared length of a specified two-dimensional vector. - * @param {Vector2} v The two-dimensional vector whose squared length is to be computed. - * @returns {number} The squared length of the two-dimensional vector. - */ - function absSq(v: Vector2): number; - - /** - * Computes the determinant of a two-dimensional square matrix with - * rows consisting of the specified two-dimensional vectors. - * @param {Vector2} v1 The top row of the two-dimensional square matrix. - * @param {Vector2} v2 The bottom row of the two-dimensional square matrix. - * @returns {number} The determinant of the two-dimensional square matrix. - */ - function det(v1: Vector2, v2: Vector2): number; - - /** - * Computes the normalization of the specified two-dimensional vector. - * @param {Vector2} vector The two-dimensional vector whose normalization - * is to be computed. - * returns {Vector2} The normalization of the two-dimensional vector. - */ - function normalize(vector: Vector2): Vector2 - -} - -export = rvo2; \ No newline at end of file diff --git a/types/rvo2/rvo2-tests.ts b/types/rvo2/rvo2-tests.ts deleted file mode 100644 index 80906011e9..0000000000 --- a/types/rvo2/rvo2-tests.ts +++ /dev/null @@ -1,137 +0,0 @@ -import { Vector2, vectorvector, RVOSimulator, absSq, normalize } from './index'; - -// Some examples of vector functions. -const v1 = new Vector2(-1, 2); -const v2 = new Vector2(1, 2); -const v3 = v1.mul(3); // -3, 6 -const v4 = v1.sub(v2); // -2, 0 -const v5 = v1.add(v2); // 0, 4 - -function setupScenario(sim: RVOSimulator, goals: vectorvector) { - sim.setTimeStep(0.25); - /* Specify the default parameters for agents that are subsequently added. */ - sim.setAgentDefaults(15, 10, 5, 5, 2, 2); - - /* - * Add agents, specifying their start position, and store their goals on the - * opposite side of the environment. - */ - for (var i = 0; i < 5; ++i) { - for (var j = 0; j < 5; ++j) { - var index = sim.addAgent(new Vector2(55 + i * 10, 55 + j * 10)); - goals[index] = new Vector2(-75, -75); - - index = sim.addAgent(new Vector2(-55 - i * 10, 55 + j * 10)); - goals[index] = new Vector2(75, -75); - - index = sim.addAgent(new Vector2(55 + i * 10, -55 - j * 10)); - goals[index] = new Vector2(-75, 75); - - index = sim.addAgent(new Vector2(-55 - i * 10, -55 - j * 10)); - goals[index] = new Vector2(75, 75); - } - } - - /* - * Add (polygonal) obstacles, specifying their vertices in counterclockwise - * order. - */ - const obstacle1 = new vectorvector(4) - , obstacle2 = new vectorvector(4) - , obstacle3 = new vectorvector(4) - , obstacle4 = new vectorvector(4); - - obstacle1[0] = new Vector2(-10, 40); - obstacle1[1] = new Vector2(-40, 40); - obstacle1[2] = new Vector2(-40, 10); - obstacle1[3] = new Vector2(-10, 10); - - obstacle2[0] = new Vector2(10, 40); - obstacle2[1] = new Vector2(10, 10); - obstacle2[2] = new Vector2(40, 10); - obstacle2[3] = new Vector2(40, 40); - - obstacle3[0] = new Vector2(10, -40); - obstacle3[1] = new Vector2(40, -40); - obstacle3[2] = new Vector2(40, -10); - obstacle3[3] = new Vector2(10, -10); - - obstacle4[0] = new Vector2(-10, -40); - obstacle4[1] = new Vector2(-10, -10); - obstacle4[2] = new Vector2(-40, -10); - obstacle4[3] = new Vector2(-40, -40); - - sim.addObstacle(obstacle1); - sim.addObstacle(obstacle2); - sim.addObstacle(obstacle3); - sim.addObstacle(obstacle4); - - /* Process the obstacles so that they are accounted for in the simulation. */ - sim.processObstacles(); -} - -function updateVisualization(sim: RVOSimulator) -{ - /* Output the current global time. */ - const time = sim.getGlobalTime(); - // console.log(`Time: ${time}`); - /* Output the current position of all the agents. */ - for (let i = 0; i < sim.getNumAgents(); ++i) { - const p = sim.getAgentPosition(i); - // console.log(`#${i}) x: ${p.x()}, y: ${p.y()}`); - } -} - -function setPreferredVelocity(sim: RVOSimulator, goals: vectorvector) { - for (var i = 0; i < sim.getNumAgents(); i++) { - const delta = goals[i].sub(sim.getAgentPosition(i)); - - /* - * Perturb a little to avoid deadlocks due to perfect symmetry. - */ - const angle = Math.random() * 2.0 * Math.PI; - const dist = Math.random() * 0.0001; - - var goalVector = new Vector2(delta.x() + dist * Math.cos(angle), delta.y() + dist * Math.sin(angle)); - - if (absSq(goalVector) > 1.0) { - goalVector = normalize(goalVector); - } - - sim.setAgentPrefVelocity(i, goalVector); - } -} - -function reachedGoal(sim: RVOSimulator, goals: vectorvector) { - /* Check if all agents have reached their goals. */ - for (var i = 0; i < sim.getNumAgents(); ++i) { - const dist = sim.getAgentPosition(i).sub(goals[i]); - if (absSq(dist) > 400) { // 400 <= 20 x 20 - return false; - } - } - return true; -} - -function main(debug = false) { - const nbrAgents = 100; - const sim = new RVOSimulator(); - const goals = new vectorvector(nbrAgents); - - setupScenario(sim, goals); - - // sim.addObstacle(vv); - var i = 0; - do { - if (++i % 10 === 0) { - // console.log('TIME: ' + i); - } - setPreferredVelocity(sim, goals); - if (debug) { updateVisualization(sim); } - sim.doStep(); - } while (!reachedGoal(sim, goals)); - - // console.log('Done'); -} - -main(); diff --git a/types/rvo2/tsconfig.json b/types/rvo2/tsconfig.json deleted file mode 100644 index 5c3ed8e702..0000000000 --- a/types/rvo2/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "rvo2-tests.ts" - ] -} \ No newline at end of file diff --git a/types/rvo2/tslint.json b/types/rvo2/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/rvo2/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 58b3c009e5e993357d53d0c9e16b301f764101d5 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 10:01:59 -0800 Subject: [PATCH 156/890] xadesjs: Provides its own types --- notNeededPackages.json | 6 + types/xadesjs/index.d.ts | 1085 -------------------------------- types/xadesjs/tsconfig.json | 24 - types/xadesjs/tslint.json | 79 --- types/xadesjs/xadesjs-tests.ts | 45 -- 5 files changed, 6 insertions(+), 1233 deletions(-) delete mode 100644 types/xadesjs/index.d.ts delete mode 100644 types/xadesjs/tsconfig.json delete mode 100644 types/xadesjs/tslint.json delete mode 100644 types/xadesjs/xadesjs-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index 0f92b3f3ac..7d756d6545 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -942,6 +942,12 @@ "sourceRepoURL": "https://code.google.com/p/x2js/", "asOfVersion": "3.1.0" }, + { + "libraryName": "xadesjs", + "typingsPackageName": "xadesjs", + "sourceRepoURL": "https://github.com/PeculiarVentures/xadesjs", + "asOfVersion": "2.0.2" + }, { "libraryName": "xlsx", "typingsPackageName": "xlsx", diff --git a/types/xadesjs/index.d.ts b/types/xadesjs/index.d.ts deleted file mode 100644 index cad137db05..0000000000 --- a/types/xadesjs/index.d.ts +++ /dev/null @@ -1,1085 +0,0 @@ -// Type definitions for xadesjs v1.0.0 -// Project: https://github.com/PeculiarVentures/xadesjs -// Definitions by: Stepan Miroshin -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/** - * A pure Javascript implementation of XMLDSIG and XAdES based on Web Crypto https://xadesjs.com - * v1.0.0 - */ - -declare namespace xadesjs { - - type PromiseType = any; - - const APPLICATION_XML: string; - - class XmlError extends Error { - stack: any; - constructor(code: XE, ...args: any[]); - } - - enum XE { - NONE = 0, - NULL_REFERENCE = 1, - METHOD_NOT_IMPLEMENTED = 2, - METHOD_NOT_SUPPORTED = 3, - PARAM_REQUIRED = 4, - CONVERTER_UNSUPPORTED = 5, - ELEMENT_MALFORMED = 6, - CRYPTOGRAPHIC = 7, - CRYPTOGRAPHIC_NO_MODULE = 8, - CRYPTOGRAPHIC_UNKNOWN_TRANSFORM = 9, - ALGORITHM_NOT_SUPPORTED = 10, - ALGORITHM_WRONG_NAME = 11, - XML_EXCEPTION = 12, - } - - interface CryptoEx extends Crypto { - name: string; - } - - class Application { - /** - * Sets crypto engine for the current Application - * @param {string} name - * @param {Crypto} crypto - * @returns void - */ - static setEngine(name: string, crypto: Crypto): void; - /** - * Gets the crypto module from the Application - */ - static crypto: CryptoEx; - static isNodePlugin(): boolean; - } - - enum XmlNodeType { - None = 0, - Element = 1, - Attribute = 2, - Text = 3, - CDATA = 4, - EntityReference = 5, - Entity = 6, - ProcessingInstruction = 7, - Comment = 8, - Document = 9, - DocumentType = 10, - DocumentFragment = 11, - Notation = 12, - Whitespace = 13, - SignificantWhitespace = 14, - EndElement = 15, - EndEntity = 16, - XmlDeclaration = 17, - } - - interface IXmlSerializable { - Prefix: string; - /** - * Writes object to XML node - * @returns Node - */ - GetXml(): Node; - /** - * Reads XML from string - * @param {Node} node - * @returns void - */ - LoadXml(node: Node): void; - } - - abstract class XmlObject implements IXmlSerializable { - protected m_prefix: string; - Prefix: string; - protected GetPrefix(): string; - GetXml(): Node; - GetXml(document: Document): Node; - LoadXml(node: Node): void; - toString(): string; - protected getAttribute(xel: Element, attribute: string): string; - } - - const DEFAULT_ROOT_NAME: string; - function IsEqualsEmptyStrings(s1: string, s2: string): boolean; - /** - * Creates new instance of XmlDocument with given name of root element - * @param {string} root Name of root element - * @param {string} namespaceUri - * @param {string} prefix - * @returns Document - */ - function CreateDocument(root?: string, namespaceUri?: string, prefix?: string): Document; - /** - * Returns signle Node from given Node - * @param {Node} node - * @param {string} path - * @returns Node - */ - function SelectSingleNode(node: Node, path: string): Node; - - function findAttr(node: Node, localName: string, nameSpace?: string): Attr; - function findFirst(doc: Node, xpath: string): Node; - function findChilds(node: Node, localName: string, nameSpace?: string): Node[]; - interface IAssocArray { - [index: string]: string; - } - function encodeSpecialCharactersInAttribute(attributeValue: string): string; - function encodeSpecialCharactersInText(text: string): string; - function SelectNamespaces(node: Element): Node[]; - - class Convert { - static ToBase64UrlString(text: string): string; - static FromBase64UrlString(base64UrlText: string): string; - static ToBase64String(text: string): string; - static FromBase64String(base64Text: string): string; - static Base64UrlToBase64(base64url: string): string; - static Base64ToBase64Url(base64: string): string; - static ToBufferUtf8String(text: string): Uint8Array; - static FromBufferUtf8String(buffer: Uint8Array): string; - static ToBufferString(text: string): Uint8Array; - static FromBufferString(buffer: ArrayBuffer): string; - static FromBufferString(buffer: Uint8Array): string; - } - - interface IAlgorithm { - algorithm: Algorithm; - xmlNamespace: string; - getAlgorithmName(): string; - } - interface IHashAlgorithm extends IAlgorithm { - getHash(xml: string): PromiseType; - } - interface IHashAlgorithmConstructable { - new (): IHashAlgorithm; - } - abstract class XmlAlgorithm implements IAlgorithm { - algorithm: Algorithm; - xmlNamespace: string; - getAlgorithmName(): string; - } - abstract class HashAlgorithm extends XmlAlgorithm implements IHashAlgorithm { - getHash(xml: string): PromiseType; - } - interface ISignatureAlgorithm extends IAlgorithm { - getSignature(signedInfo: string, signingKey: CryptoKey, algorithm: Algorithm): PromiseType; - verifySignature(signedInfo: string, key: CryptoKey, signatureValue: string, algorithm?: Algorithm): PromiseType; - } - interface ISignatureAlgorithmConstructable { - new (): ISignatureAlgorithm; - } - abstract class SignatureAlgorithm extends XmlAlgorithm implements ISignatureAlgorithm { - /** - * Sign the given string using the given key - */ - getSignature(signedInfo: string, signingKey: CryptoKey, algorithm: Algorithm): PromiseType; - /** - * Verify the given signature of the given string using key - */ - verifySignature(signedInfo: string, key: CryptoKey, signatureValue: string, algorithm?: Algorithm): PromiseType; - } - - const SHA1: string; - const SHA224: string; - const SHA256: string; - const SHA384: string; - const SHA512: string; - const SHA1_NAMESPACE: string; - const SHA224_NAMESPACE: string; - const SHA256_NAMESPACE: string; - const SHA384_NAMESPACE: string; - const SHA512_NAMESPACE: string; - class Sha1 extends HashAlgorithm { - algorithm: { - name: string; - }; - xmlNamespace: string; - } - class Sha224 extends HashAlgorithm { - algorithm: { - name: string; - }; - xmlNamespace: string; - } - class Sha256 extends HashAlgorithm { - algorithm: { - name: string; - }; - xmlNamespace: string; - } - class Sha384 extends HashAlgorithm { - algorithm: { - name: string; - }; - xmlNamespace: string; - } - class Sha512 extends HashAlgorithm { - algorithm: { - name: string; - }; - xmlNamespace: string; - } - - // RSA PKCS1 - - const RSA_PKCS1: string; - const RSA_PKCS1_SHA1_NAMESPACE: string; - const RSA_PKCS1_SHA224_NAMESPACE: string; - const RSA_PKCS1_SHA256_NAMESPACE: string; - const RSA_PKCS1_SHA384_NAMESPACE: string; - const RSA_PKCS1_SHA512_NAMESPACE: string; - - class RsaPkcs1Sha1 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class RsaPkcs1Sha224 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class RsaPkcs1Sha256 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class RsaPkcs1Sha384 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class RsaPkcs1Sha512 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - - // RSA PSS - - const RSA_PSS: string; - const RSA_PSS_WITH_PARAMS_NAMESPACE: string; - const RSA_PSS_WITH_PARAMS_MGF1_NAMESPACE: string; - - class RsaPssSha1 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class RsaPssSha224 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class RsaPssSha256 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class RsaPssSha384 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class RsaPssSha512 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class PssAlgorithmParams extends XmlObject { - private m_digest_method; - private m_salt_length; - private m_mgf; - private element; - dsPrefix: string; - DigestMethod: string; - SaltLength: number; - MGF: string; - GetXml(): Element; - LoadXml(value: Element): void; - } - - // HMAC - - const HMAC_ALGORITHM: string; - const HMAC_SHA1_NAMESPACE: string; - const HMAC_SHA256_NAMESPACE: string; - const HMAC_SHA384_NAMESPACE: string; - const HMAC_SHA512_NAMESPACE: string; - - class HmacSha1 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class HmacSha256 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class HmacSha384 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class HmacSha512 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - - // ECDSA - - const ECDSA_SIGN_ALGORITHM: string; - const ECDSA_SHA1_NAMESPACE: string; - const ECDSA_SHA224_NAMESPACE: string; - const ECDSA_SHA256_NAMESPACE: string; - const ECDSA_SHA384_NAMESPACE: string; - const ECDSA_SHA512_NAMESPACE: string; - class EcdsaSha1 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class EcdsaSha224 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class EcdsaSha256 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class EcdsaSha384 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - class EcdsaSha512 extends SignatureAlgorithm { - algorithm: any; - xmlNamespace: string; - } - - /** - * Represents an element. - */ - class X509Certificate { - protected raw: Uint8Array; - protected cert_simpl: any; - protected publicKey: CryptoKey; - constructor(rawData?: Uint8Array); - /** - * Loads X509Certificate from DER data - * @param {Uint8Array} rawData - */ - protected LoadFromRawData(rawData: Uint8Array): void; - /** - * Gets the public key from the X509Certificate - */ - PublicKey: CryptoKey; - /** - * Returns DER raw of X509Certificate - */ - GetRawCertData(): Uint8Array; - /** - * Returns public key from X509Certificate - * @param {Algorithm} algorithm - * @returns PromiseType - */ - exportKey(algorithm: Algorithm): PromiseType; - } - - enum X509IncludeOption { - None = 0, - EndCertOnly = 1, - ExcludeRoot = 2, - WholeChain = 3, - } - interface X509IssuerSerial { - issuerName: string; - serialNumber: string; - } - /** - * Represents an subelement of an XMLDSIG or XML Encryption element. - */ - class KeyInfoX509Data extends XmlObject implements KeyInfoClause { - - constructor(); - constructor(rgbCert: Uint8Array); - constructor(cert: X509Certificate); - /** - * Gets public key of the X509Data - */ - Key: CryptoKey; - importKey(key: CryptoKey): PromiseType; - /** - * Exports key from X509Data object - * @param {Algorithm} alg - * @returns PromiseType - */ - exportKey(alg: Algorithm): PromiseType; - /** - * Gets a list of the X.509v3 certificates contained in the KeyInfoX509Data object. - */ - Certificates: X509Certificate[]; - /** - * Gets or sets the Certificate Revocation List (CRL) contained within the KeyInfoX509Data object. - */ - CRL: Uint8Array; - /** - * Gets a list of X509IssuerSerial structures that represent an issuer name and serial number pair. - */ - IssuerSerials: X509IssuerSerial[]; - /** - * Gets a list of the subject key identifiers (SKIs) contained in the KeyInfoX509Data object. - */ - SubjectKeyIds: Uint8Array[]; - /** - * Gets a list of the subject names of the entities contained in the KeyInfoX509Data object. - */ - SubjectNames: string[]; - /** - * Adds the specified X.509v3 certificate to the KeyInfoX509Data. - * @param {X509Certificate} certificate - * @returns void - */ - AddCertificate(certificate: X509Certificate): void; - /** - * Adds the specified issuer name and serial number pair to the KeyInfoX509Data object. - * @param {string} issuerName - * @param {string} serialNumber - * @returns void - */ - AddIssuerSerial(issuerName: string, serialNumber: string): void; - /** - * Adds the specified subject key identifier (SKI) to the KeyInfoX509Data object. - * @param {string | Uint8Array} subjectKeyId - * @returns void - */ - AddSubjectKeyId(subjectKeyId: string): void; - AddSubjectKeyId(subjectKeyId: Uint8Array): void; - /** - * Adds the subject name of the entity that was issued an X.509v3 certificate to the KeyInfoX509Data object. - * @param {string} subjectName - * @returns void - */ - AddSubjectName(subjectName: string): void; - /** - * Returns an XML representation of the KeyInfoX509Data object. - * @returns Element - */ - GetXml(): Element; - /** - * Parses the input XmlElement object and configures the internal state of the KeyInfoX509Data object to match. - * @param {Element} element - * @returns void - */ - LoadXml(element: Element): void; - } - - interface IJwkRsa { - alg: string; - kty: string; - e: string; - n: string; - ext: boolean; - } - /** - * Represents the element of an XML signature. - */ - class RsaKeyValue extends XmlObject implements KeyInfoClause { - /** - * Gets or sets the instance of RSA that holds the public key. - */ - Key: CryptoKey; - /** - * Gets the algorithm of the public key - */ - Algorithm: ISignatureAlgorithm; - /** - * Gets the Modulus of the public key - */ - Modulus: Uint8Array; - /** - * Gets the Exponent of the public key - */ - Exponent: Uint8Array; - constructor(); - /** - * Imports key to the RSAKeyValue object - * @param {CryptoKey} key - * @returns PromiseType - */ - importKey(key: CryptoKey): PromiseType; - /** - * Exports key from the RSAKeyValue object - * @param {Algorithm} alg - * @returns PromiseType - */ - exportKey(alg: Algorithm): PromiseType; - /** - * Returns the XML representation of the RSA key clause. - * @returns Element - */ - GetXml(): Element; - /** - * Loads an RSA key clause from an XML element. - * @param {Element} element - * @returns void - */ - LoadXml(element: Element): void; - } - - type NamedCurve = "P-256" | "P-384" | "P-521"; - - interface IJwkEcdsa { - crv: NamedCurve; - kty: "EC"; - x: string; - y: string; - ext: boolean; - } - - /** - * Represents the element of an XML signature. - */ - class EcdsaKeyValue extends XmlObject implements KeyInfoClause { - /** - * Gets or sets the instance of ECDSA that holds the public key. - */ - Key: CryptoKey; - /** - * Gets the algorithm of the public key - */ - Algorithm: ISignatureAlgorithm; - /** - * Gets the X point value of then public key - */ - X: Uint8Array; - /** - * Gets the Y point value of then public key - */ - Y: Uint8Array; - /** - * Gets the NamedCurve value of then public key - */ - NamedCurve: NamedCurve; - constructor(); - /** - * Imports key to the ECKeyValue object - * @param {CryptoKey} key - * @returns PromiseType - */ - importKey(key: CryptoKey): PromiseType; - /** - * Exports key from the ECKeyValue object - * @param {Algorithm} alg - * @returns PromiseType - */ - exportKey(alg: Algorithm): PromiseType; - /** - * Returns the XML representation of the ECDSA key clause. - * @returns Element - */ - GetXml(): Element; - /** - * Loads an ECDSA key clause from an XML element. - * @param {Element} element - * @returns void - */ - LoadXml(element: Element): void; - } - - type XmlNamespace = { - prefix: string; - namespace: string; - }; - - enum XmlCanonicalizerState { - BeforeDocElement = 0, - InsideDocElement = 1, - AfterDocElement = 2, - } - - class XmlCanonicalizer { - constructor(withComments: boolean, excC14N: boolean, propagatedNamespaces?: XmlNamespace[]); - InclusiveNamespacesPrefixList: string; - Canonicalize(node: Node): string; - } - - interface Transform extends IXmlSerializable { - Algorithm: string; - LoadInnerXml(node: Node): void; - GetInnerXml(): Node; - GetOutput(): string; - } - - interface ICanonicalizationAlgorithmConstructable { - new (): Transform; - } - /** - * Represents the abstract base class from which all elements - * that can be used in an XML digital signature derive. - */ - abstract class Transform extends XmlObject implements Transform { - protected innerXml: Node; - LoadXml(value: Node): void; - /** - * Returns the XML representation of the current Transform object. - * @returns Element - */ - GetXml(): Element; - } - - /** - * Represents the enveloped signature transform for an XML digital signature as defined by the W3C. - */ - class XmlDsigEnvelopedSignatureTransform extends Transform { - Algorithm: string; - /** - * Returns the output of the current XmlDsigEnvelopedSignatureTransform object. - * @returns string - */ - GetOutput(): string; - } - - /** - * Represents the C14N XML canonicalization transform for a digital signature - * as defined by the World Wide Web Consortium (W3C), without comments. - */ - class XmlDsigC14NTransform extends Transform { - protected xmlCanonicalizer: XmlCanonicalizer; - Algorithm: string; - /** - * Returns the output of the current XmlDsigC14NTransform object. - * @returns string - */ - GetOutput(): string; - } - /** - * Represents the C14N XML canonicalization transform for a digital signature - * as defined by the World Wide Web Consortium (W3C), with comments. - */ - class XmlDsigC14NWithCommentsTransform extends XmlDsigC14NTransform { - Algorithm: string; - protected xmlCanonicalizer: XmlCanonicalizer; - } - - /** - * Represents the exclusive C14N XML canonicalization transform for a digital signature - * as defined by the World Wide Web Consortium (W3C), without comments. - */ - class XmlDsigExcC14NTransform extends Transform { - protected xmlCanonicalizer: XmlCanonicalizer; - Algorithm: string; - /** - * Gets or sets a string that contains namespace prefixes to canonicalize - * using the standard canonicalization algorithm. - */ - InclusiveNamespacesPrefixList: string; - /** - * Returns the output of the current XmlDsigExcC14NTransform object - */ - GetOutput(): string; - } - /** - * Represents the exclusive C14N XML canonicalization transform for a digital signature - * as defined by the World Wide Web Consortium (W3C), with comments. - */ - class XmlDsigExcC14NWithCommentsTransform extends XmlDsigExcC14NTransform { - Algorithm: string; - protected xmlCanonicalizer: XmlCanonicalizer; - } - - class CryptoConfig { - static CreateFromName(name: string): Transform; - static CreateSignatureAlgorithm(namespace: string): SignatureAlgorithm; - static CreateHashAlgorithm(namespace: string): HashAlgorithm; - } - - /** - * Represents the object element of an XML signature that holds data to be signed. - */ - class DataObject extends XmlObject { - constructor(); - constructor(id?: string, mimeType?: string, encoding?: string, data?: Element); - /** - * Gets or sets the data value of the current DataObject object. - */ - Data: NodeList; - /** - * Gets or sets the encoding of the current DataObject object. - */ - Encoding: string; - /** - * Gets or sets the identification of the current DataObject object. - */ - Id: string; - /** - * Gets or sets the MIME type of the current DataObject object. - */ - MimeType: string; - /** - * Returns the XML representation of the DataObject object. - * @returns Element - */ - GetXml(): Element; - /** - * Loads a DataObject state from an XML element. - * @param {Element} value - * @returns void - */ - LoadXml(value: Element): void; - } - - /** - * Represents the element of an XML signature. - */ - class Reference extends XmlObject { - - constructor(p?: string); - /** - * Gets or sets the digest method Uniform Resource Identifier (URI) of the current - */ - DigestMethod: string; - /** - * Gets or sets the digest value of the current Reference. - */ - DigestValue: ArrayBuffer; - /** - * Gets or sets the ID of the current Reference. - */ - Id: string; - /** - * Gets the transform chain of the current Reference. - */ - TransformChain: Transform[]; - /** - * Gets or sets the type of the object being signed. - */ - Type: string; - /** - * Gets or sets the Uri of the current Reference. - */ - Uri: string; - /** - * Adds a Transform object to the list of transforms to be performed - * on the data before passing it to the digest algorithm. - * @param {Transform} transform The transform to be added to the list of transforms. - * @returns void - */ - AddTransform(transform: Transform): void; - /** - * Returns the XML representation of the Reference. - * @returns Element - */ - GetXml(): Element; - /** - * Loads a Reference state from an XML element. - * @param {Element} value - */ - LoadXml(value: Element): void; - } - - /** - * Represents an XML digital signature or XML encryption element. - */ - class KeyInfo extends XmlObject { - constructor(); - /** - * Gets the number of KeyInfoClause objects contained in the KeyInfo object. - */ - length: number; - /** - * Gets or sets the key information identity. - */ - Id: string; - /** - * Returns an enumerator of the KeyInfoClause objects in the KeyInfo object. - * @param {any} requestedObjectType? - */ - GetEnumerator(): Array; - GetEnumerator(requestedObjectType: any): Array; - /** - * Returns an enumerator of the KeyInfoClause objects in the KeyInfo object. - * @param {KeyInfoClause} clause The KeyInfoClause to add to the KeyInfo object. - * @returns void - */ - AddClause(clause: KeyInfoClause): void; - /** - * Returns the XML representation of the KeyInfo object. - * @returns Node - */ - GetXml(): Node; - /** - * Loads a KeyInfo state from an XML element. - * @param {Element} value - * @returns void - */ - LoadXml(value: Element): void; - } - interface KeyInfoClause extends IXmlSerializable { - Key: CryptoKey; - importKey(key: CryptoKey): PromiseType; - exportKey(alg: Algorithm): PromiseType; - } - - /** - * Represents the element of an XML signature. - */ - class Signature extends XmlObject { - - constructor(); - /** - * Gets or sets the ID of the current Signature. - */ - Id: string; - /** - * Gets or sets the KeyInfo of the current Signature. - */ - KeyInfo: KeyInfo; - /** - * Gets or sets a list of objects to be signed. - */ - ObjectList: Array; - /** - * Gets or sets the value of the digital signature. - */ - SignatureValue: Uint8Array; - /** - * Gets or sets the SignedInfo of the current Signature. - */ - SignedInfo: SignedInfo; - /** - * Adds a DataObject to the list of objects to be signed. - * @param {DataObject} dataObject The DataObject to be added to the list of objects to be signed. - * @returns void - */ - AddObject(dataObject: DataObject): void; - /** - * Returns the XML representation of the Signature. - * @returns Element - */ - GetXml(): Element; - /** - * Loads a Signature state from an XML element. - * @param {Element} value - * @returns void - */ - LoadXml(value: Element): void; - } - const XmlSignature: { - ElementNames: { - CanonicalizationMethod: string; - DigestMethod: string; - DigestValue: string; - DSAKeyValue: string; - EncryptedKey: string; - HMACOutputLength: string; - RSAPSSParams: string; - MaskGenerationFunction: string; - SaltLength: string; - KeyInfo: string; - KeyName: string; - KeyValue: string; - Modulus: string; - Exponent: string; - Manifest: string; - Object: string; - Reference: string; - RetrievalMethod: string; - RSAKeyValue: string; - ECKeyValue: string; - NamedCurve: string; - PublicKey: string; - Signature: string; - SignatureMethod: string; - SignatureValue: string; - SignedInfo: string; - Transform: string; - Transforms: string; - X509Data: string; - X509IssuerSerial: string; - X509IssuerName: string; - X509SerialNumber: string; - X509SKI: string; - X509SubjectName: string; - X509Certificate: string; - X509CRL: string; - }; - AttributeNames: { - Algorithm: string; - Encoding: string; - Id: string; - MimeType: string; - Type: string; - URI: string; - }; - AlgorithmNamespaces: { - XmlDsigBase64Transform: string; - XmlDsigC14NTransform: string; - XmlDsigC14NWithCommentsTransform: string; - XmlDsigEnvelopedSignatureTransform: string; - XmlDsigXPathTransform: string; - XmlDsigXsltTransform: string; - XmlDsigExcC14NTransform: string; - XmlDsigExcC14NWithCommentsTransform: string; - XmlDecryptionTransform: string; - XmlLicenseTransform: string; - }; - Uri: { - Manifest: string; - }; - NamespaceURI: string; - NamespaceURIMore: string; - NamespaceURIPss: string; - Prefix: string; - GetChildElement: (xel: Node, element: string, ns: string) => Element; - GetAttributeFromElement: (xel: Element, attribute: string, element: string) => string; - GetChildElements: (xel: Element, element: string) => Element[]; - }; - - /** - * The SignedInfo class represents the element - * of an XML signature defined by the XML digital signature specification - */ - class SignedInfo extends XmlObject { - - constructor(signedXml?: SignedXml); - /** - * Gets or sets the canonicalization algorithm that is used before signing - * for the current SignedInfo object. - */ - CanonicalizationMethod: string; - /** - * Gets a Transform object used for canonicalization. - * @returns Transform - */ - CanonicalizationMethodObject: Transform; - /** - * Gets the number of references in the current SignedInfo object. - */ - Count: number; - /** - * Gets or sets the ID of the current SignedInfo object. - */ - Id: string; - /** - * Gets a value that indicates whether the collection is read-only. - * @returns boolean - */ - IsReadOnly: boolean; - /** - * Gets a value that indicates whether the collection is synchronized. - * @returns boolean - */ - IsSynchronized: boolean; - /** - * Gets a list of the Reference objects of the current SignedInfo object. - */ - References: Reference[]; - /** - * Gets or sets the length of the signature for the current SignedInfo object. - */ - SignatureLength: string; - /** - * Gets or sets the name of the algorithm used for signature generation - * and validation for the current SignedInfo object. - */ - SignatureMethod: string; - SignatureParams: XmlObject; - /** - * Gets an object to use for synchronization. - */ - SyncRoot: any; - /** - * Adds a Reference object to the list of references to digest and sign. - * @param {Reference} reference The reference to add to the list of references. - * @returns void - */ - AddReference(reference: Reference): void; - /** - * Copies the elements of this instance into an Array object, starting at a specified index in the array. - * @param {any[]} array - * @param {number} index - * @returns void - */ - CopyTo(array: any[], index: number): void; - /** - * Returns the XML representation of the SignedInfo object. - * @returns Node - */ - GetXml(): Node; - /** - * Loads a SignedInfo state from an XML element. - * @param {Element} value - * @returns void - */ - LoadXml(value: Element): void; - } - - /** - * Provides a wrapper on a core XML signature object to facilitate creating XML signatures. - */ - class SignedXml extends XmlObject { - /** - * Gets or sets the KeyInfo object of the current SignedXml object. - */ - KeyInfo: KeyInfo; - /** - * Gets the Signature object of the current SignedXml object. - */ - Signature: Signature; - /** - * Gets or sets the prefix for the current SignedXml object. - */ - Prefix: string; - /** - * Gets the length of the signature for the current SignedXml object. - */ - SignatureLength: number; - SignatureMethod: string; - /** - * Gets the signature value of the current SignedXml object. - */ - SignatureValue: ArrayBuffer; - /** - * Gets the CanonicalizationMethod of the current SignedXml object. - */ - CanonicalizationMethod: string; - /** - * Gets the SignedInfo object of the current SignedXml object. - */ - SignedInfo: SignedInfo; - /** - * Gets or sets the asymmetric algorithm key used for signing a SignedXml object. - */ - SigningKey: CryptoKey; - /** - * Gets or sets the name of the installed key to be used for signing the SignedXml object. - */ - SigningKeyName: string; - /** - * @param {string} idMode. Value of "wssecurity" will create/validate id's with the ws-security namespace - */ - constructor(); - constructor(node: Document); - constructor(node: Element); - /** - * Adds a Reference object to the SignedXml object that describes a digest method, - * digest value, and transform to use for creating an XML digital signature. - * @param {Reference} reference The Reference object that describes a digest method, digest value, - * and transform to use for creating an XML digital signature. - * @returns void - */ - AddReference(reference: Reference): void; - /** - * Computes an XML digital signature using the specified algorithm. - * @param {Algorithm} algorithm Specified WebCrypto Algoriithm - * @returns PromiseType - */ - ComputeSignature(algorithm: Algorithm): PromiseType; - /** - * Determines whether the SignedXml.Signature property verifies using the public key in the signature. - * @returns PromiseType - */ - CheckSignature(): PromiseType; - CheckSignature(key: CryptoKey): PromiseType; - CheckSignature(cert: X509Certificate): PromiseType; - /** - * Loads a SignedXml state from an XML element. - * @param {Element} value The XML element to load the SignedXml state from. - * @returns void - */ - LoadXml(value: Element): void; - /** - * Returns the XML representation of a SignedXml object. - * @returns Element - */ - GetXml(): Element; - } -} diff --git a/types/xadesjs/tsconfig.json b/types/xadesjs/tsconfig.json deleted file mode 100644 index 1a5e5c7ca1..0000000000 --- a/types/xadesjs/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "xadesjs-tests.ts" - ] -} \ No newline at end of file diff --git a/types/xadesjs/tslint.json b/types/xadesjs/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/xadesjs/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/xadesjs/xadesjs-tests.ts b/types/xadesjs/xadesjs-tests.ts deleted file mode 100644 index d2f97683d9..0000000000 --- a/types/xadesjs/xadesjs-tests.ts +++ /dev/null @@ -1,45 +0,0 @@ -let xmlString = ""; -let xmlDoc = new DOMParser().parseFromString(xmlString, "application/xml"); -let signedXml = new xadesjs.SignedXml(xmlDoc); - -let alg = { - name: "ECDSA", - namedCurve: "P-256" -}; -xadesjs.Application.crypto.subtle.generateKey( - alg, - false, - ["sign", "verify"] -) - .then((keys: CryptoKeyPair) => { - signedXml.SigningKey = keys.privateKey; - - // Add the key to the SignedXml document. - // Create a reference to be signed. - let reference = new xadesjs.Reference(); - reference.Uri = ""; - // Add an enveloped transformation to the reference. - reference.AddTransform(new xadesjs.XmlDsigEnvelopedSignatureTransform()); - // Add the reference to the SignedXml object. - signedXml.AddReference(reference); - // Set prefix for Signature namespace - signedXml.Prefix = "ds"; - - // Compute the signature. - return signedXml.ComputeSignature({ name: "ECDSA", hash: { name: "SHA-256" } } as any); - }) - .then(function () { - // Append signature - let xmlDigitalSignature = signedXml.GetXml(); - xmlDoc.documentElement.appendChild(xmlDigitalSignature); - - // Serialize XML document - let signedDocument = new XMLSerializer().serializeToString(xmlDoc); - return Promise.resolve(signedDocument); - }) - .then((doc: string) => { - console.log("Signed document:", doc); - }) - // .catch((e: any) => { - // console.error("Error", e); - // }); \ No newline at end of file From 56ddf05a18b978ced223803d202f7738864e7e09 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 10:04:58 -0800 Subject: [PATCH 157/890] react-chartjs-2: Provides its own types --- notNeededPackages.json | 6 ++ types/react-chartjs-2/index.d.ts | 58 ------------- types/react-chartjs-2/test/bar.tsx | 35 -------- types/react-chartjs-2/test/bubble.tsx | 40 --------- types/react-chartjs-2/test/doughnut.tsx | 34 -------- .../react-chartjs-2/test/dynamic-doughnut.tsx | 48 ----------- types/react-chartjs-2/test/horizontalBar.tsx | 28 ------- types/react-chartjs-2/test/index.tsx | 47 ----------- types/react-chartjs-2/test/line.tsx | 40 --------- types/react-chartjs-2/test/mix.tsx | 84 ------------------- types/react-chartjs-2/test/pie.tsx | 34 -------- types/react-chartjs-2/test/polar.tsx | 40 --------- types/react-chartjs-2/test/radar.tsx | 39 --------- types/react-chartjs-2/test/randomizedLine.tsx | 70 ---------------- types/react-chartjs-2/tsconfig.json | 36 -------- types/react-chartjs-2/tslint.json | 1 - 16 files changed, 6 insertions(+), 634 deletions(-) delete mode 100644 types/react-chartjs-2/index.d.ts delete mode 100644 types/react-chartjs-2/test/bar.tsx delete mode 100755 types/react-chartjs-2/test/bubble.tsx delete mode 100755 types/react-chartjs-2/test/doughnut.tsx delete mode 100755 types/react-chartjs-2/test/dynamic-doughnut.tsx delete mode 100755 types/react-chartjs-2/test/horizontalBar.tsx delete mode 100644 types/react-chartjs-2/test/index.tsx delete mode 100755 types/react-chartjs-2/test/line.tsx delete mode 100755 types/react-chartjs-2/test/mix.tsx delete mode 100755 types/react-chartjs-2/test/pie.tsx delete mode 100755 types/react-chartjs-2/test/polar.tsx delete mode 100755 types/react-chartjs-2/test/radar.tsx delete mode 100755 types/react-chartjs-2/test/randomizedLine.tsx delete mode 100644 types/react-chartjs-2/tsconfig.json delete mode 100644 types/react-chartjs-2/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 0f92b3f3ac..29da78aae5 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -654,6 +654,12 @@ "sourceRepoURL": "https://github.com/stream-utils/raw-body", "asOfVersion": "2.3.0" }, + { + "libraryName": "react-chartjs-2", + "typingsPackageName": "react-chartjs-2", + "sourceRepoURL": "https://github.com/gor181/react-chartjs-2", + "asOfVersion": "2.5.7" + }, { "libraryName": "react-day-picker", "typingsPackageName": "react-day-picker", diff --git a/types/react-chartjs-2/index.d.ts b/types/react-chartjs-2/index.d.ts deleted file mode 100644 index d6b0fe41c4..0000000000 --- a/types/react-chartjs-2/index.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -// Type definitions for react-chartjs-2 2.0 -// Project: https://github.com/gor181/react-chartjs-2 -// Definitions by: Alexandre Paré -// Fabien Lavocat -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import * as React from "react"; -import * as chartjs from "chart.js"; - -export type ChartDataFunction = (element: HTMLElement) => T; -export type ChartData = ChartDataFunction| T; - -export interface ChartComponentProps { - data: ChartData; - type?: chartjs.ChartType; - getDatasetAtEvent?(e: any): void; - getElementAtEvent?(e: any): void; - getElementsAtEvent?(e: any): void; - height?: number; - legend?: chartjs.ChartLegendOptions; - onElementsClick?(e: any): void; // alias for getElementsAtEvent (backward compatibility) - options?: chartjs.ChartOptions; - redraw?: boolean; - width?: number; -} - -export interface LinearComponentProps extends ChartComponentProps { - data: ChartData; -} - -export default class ChartComponent

extends React.Component

{ - chart_instance: chartjs; -} - -export class Doughnut extends ChartComponent { -} - -export class Pie extends ChartComponent { -} - -export class Line extends ChartComponent { -} - -export class Bar extends ChartComponent { -} - -export class HorizontalBar extends ChartComponent { -} - -export class Radar extends ChartComponent { -} - -export class Polar extends ChartComponent { -} - -export class Bubble extends ChartComponent { -} diff --git a/types/react-chartjs-2/test/bar.tsx b/types/react-chartjs-2/test/bar.tsx deleted file mode 100644 index 7f05c9925b..0000000000 --- a/types/react-chartjs-2/test/bar.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import * as React from 'react'; -import { Bar } from 'react-chartjs-2'; - -const data = { - labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], - datasets: [ - { - label: 'My First dataset', - backgroundColor: 'rgba(255,99,132,0.2)', - borderColor: 'rgba(255,99,132,1)', - borderWidth: 1, - hoverBackgroundColor: 'rgba(255,99,132,0.4)', - hoverBorderColor: 'rgba(255,99,132,1)', - data: [65, 59, 80, 81, 56, 55, 40] - } - ] -}; - -export default class BarExample extends React.Component { - render() { - return ( -

-

Bar Example (custom size)

- -
- ); - } -} diff --git a/types/react-chartjs-2/test/bubble.tsx b/types/react-chartjs-2/test/bubble.tsx deleted file mode 100755 index 726113c1ea..0000000000 --- a/types/react-chartjs-2/test/bubble.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import * as React from 'react'; -import { Bubble } from 'react-chartjs-2'; - -const data = { - labels: ['January'], - datasets: [ - { - label: 'My First dataset', - fill: false, - lineTension: 0.1, - backgroundColor: 'rgba(75,192,192,0.4)', - borderColor: 'rgba(75,192,192,1)', - borderCapStyle: 'butt', - borderDash: [] as any[], - borderDashOffset: 0.0, - borderJoinStyle: 'miter', - pointBorderColor: 'rgba(75,192,192,1)', - pointBackgroundColor: '#fff', - pointBorderWidth: 1, - pointHoverRadius: 5, - pointHoverBackgroundColor: 'rgba(75,192,192,1)', - pointHoverBorderColor: 'rgba(220,220,220,1)', - pointHoverBorderWidth: 2, - pointRadius: 1, - pointHitRadius: 10, - data: [{ x: 10, y: 20, r: 5 }] - } - ] -}; - -export default class BubbleExample extends React.Component { - render() { - return ( -
-

Bubble Example

- -
- ); - } -} diff --git a/types/react-chartjs-2/test/doughnut.tsx b/types/react-chartjs-2/test/doughnut.tsx deleted file mode 100755 index 0743ee448b..0000000000 --- a/types/react-chartjs-2/test/doughnut.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import * as React from 'react'; -import { Doughnut } from 'react-chartjs-2'; - -const data = { - labels: [ - 'Red', - 'Green', - 'Yellow' - ], - datasets: [{ - data: [300, 50, 100], - backgroundColor: [ - '#FF6384', - '#36A2EB', - '#FFCE56' - ], - pointHoverBackgroundColor: [ - '#FF6384', - '#36A2EB', - '#FFCE56' - ] - }] -}; - -export default class DoughnutExample extends React.Component { - render() { - return ( -
-

Doughnut Example

- -
- ); - } -} diff --git a/types/react-chartjs-2/test/dynamic-doughnut.tsx b/types/react-chartjs-2/test/dynamic-doughnut.tsx deleted file mode 100755 index 977c5a9801..0000000000 --- a/types/react-chartjs-2/test/dynamic-doughnut.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import * as React from 'react'; -import { Doughnut } from 'react-chartjs-2'; - -function getRandomInt(min: number, max: number) { - return Math.floor(Math.random() * (max - min + 1)) + min; -} - -const getState = () => ({ - labels: [ - 'Red', - 'Green', - 'Yellow' - ], - datasets: [{ - data: [getRandomInt(50, 200), getRandomInt(100, 150), getRandomInt(150, 250)], - backgroundColor: [ - '#CCC', - '#36A2EB', - '#FFCE56' - ], - hoverBackgroundColor: [ - '#FF6384', - '#36A2EB', - '#FFCE56' - ] - }] -}); - -export default class DynamicDoughnutExample extends React.Component { - getInitialState() { - return getState(); - } - - componentWillMount() { - setInterval(() => { - this.setState(getState()); - }, 5000); - } - - render() { - return ( -
-

Dynamically refreshed Doughnut Example

- -
- ); - } -} diff --git a/types/react-chartjs-2/test/horizontalBar.tsx b/types/react-chartjs-2/test/horizontalBar.tsx deleted file mode 100755 index f63d21b51b..0000000000 --- a/types/react-chartjs-2/test/horizontalBar.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import * as React from 'react'; -import { HorizontalBar } from 'react-chartjs-2'; - -const data = { - labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], - datasets: [ - { - label: 'My First dataset', - backgroundColor: 'rgba(255,99,132,0.2)', - borderColor: 'rgba(255,99,132,1)', - borderWidth: 1, - hoverBackgroundColor: 'rgba(255,99,132,0.4)', - hoverBorderColor: 'rgba(255,99,132,1)', - data: [65, 59, 80, 81, 56, 55, 40] - } - ] -}; - -export default class HorizontalBarExample extends React.Component { - render() { - return ( -
-

Horizontal Bar Example

- -
- ); - } -} diff --git a/types/react-chartjs-2/test/index.tsx b/types/react-chartjs-2/test/index.tsx deleted file mode 100644 index 4032fe82e2..0000000000 --- a/types/react-chartjs-2/test/index.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; - -import DoughnutExample from './doughnut'; -import DynamicDoughnutExample from './dynamic-doughnut'; -import PieExample from './pie'; -import LineExample from './line'; -import BarExample from './bar'; -import HorizontalBarExample from './horizontalBar'; -import RadarExample from './radar'; -import PolarExample from './polar'; -import BubbleExample from './bubble'; -import MixedDataExample from './mix'; -import RandomizedDataLineExample from './randomizedLine'; - -class App extends React.Component { - render() { - return ( -
-
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- ); - } -} - -ReactDOM.render(, document.getElementById('app')); diff --git a/types/react-chartjs-2/test/line.tsx b/types/react-chartjs-2/test/line.tsx deleted file mode 100755 index 132b345dce..0000000000 --- a/types/react-chartjs-2/test/line.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import * as React from 'react'; -import { Line } from 'react-chartjs-2'; - -const data = { - labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], - datasets: [ - { - label: 'My First dataset', - fill: false, - lineTension: 0.1, - backgroundColor: 'rgba(75,192,192,0.4)', - borderColor: 'rgba(75,192,192,1)', - borderCapStyle: 'butt', - borderDash: [] as any[], - borderDashOffset: 0.0, - borderJoinStyle: 'miter', - pointBorderColor: 'rgba(75,192,192,1)', - pointBackgroundColor: '#fff', - pointBorderWidth: 1, - pointHoverRadius: 5, - pointHoverBackgroundColor: 'rgba(75,192,192,1)', - pointHoverBorderColor: 'rgba(220,220,220,1)', - pointHoverBorderWidth: 2, - pointRadius: 1, - pointHitRadius: 10, - data: [65, 59, 80, 81, 56, 55, 40] - } - ] -}; - -export default class LineExample extends React.Component { - render() { - return ( -
-

Line Example

- -
- ); - } -} diff --git a/types/react-chartjs-2/test/mix.tsx b/types/react-chartjs-2/test/mix.tsx deleted file mode 100755 index 56c6e01cdc..0000000000 --- a/types/react-chartjs-2/test/mix.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import * as React from 'react'; -import { Bar } from 'react-chartjs-2'; -import { ChartData, ChartOptions } from 'chart.js'; - -const data: ChartData = { - labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], - datasets: [{ - label: 'Sales', - type: 'line', - data: [51, 65, 40, 49, 60, 37, 40], - fill: false, - borderColor: '#EC932F', - backgroundColor: '#EC932F', - pointBorderColor: '#EC932F', - pointBackgroundColor: '#EC932F', - pointHoverBackgroundColor: '#EC932F', - pointHoverBorderColor: '#EC932F', - yAxisID: 'y-axis-2' - }, { - type: 'bar', - label: 'Visitor', - data: [200, 185, 590, 621, 250, 400, 95], - fill: false, - backgroundColor: '#71B37C', - borderColor: '#71B37C', - yAxisID: 'y-axis-1' - }] -}; - -const options: ChartOptions = { - responsive: true, - tooltips: { - mode: 'label' - }, - elements: { - line: { - fill: false - } - }, - scales: { - xAxes: [ - { - display: true, - gridLines: { - display: false - } - } - ], - yAxes: [ - { - type: 'linear', - display: true, - position: 'left', - id: 'y-axis-1', - gridLines: { - display: false - } - }, - { - type: 'linear', - display: true, - position: 'right', - id: 'y-axis-2', - gridLines: { - display: false - } - } - ] - } -}; - -export default class MixExample extends React.Component { - render() { - return ( -
-

Mixed data Example

- -
- ); - } -} diff --git a/types/react-chartjs-2/test/pie.tsx b/types/react-chartjs-2/test/pie.tsx deleted file mode 100755 index 6aaedbb20f..0000000000 --- a/types/react-chartjs-2/test/pie.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import * as React from 'react'; -import { Pie } from 'react-chartjs-2'; - -const data = { - labels: [ - 'Red', - 'Green', - 'Yellow' - ], - datasets: [{ - data: [300, 50, 100], - backgroundColor: [ - '#FF6384', - '#36A2EB', - '#FFCE56' - ], - pointHoverBackgroundColor: [ - '#FF6384', - '#36A2EB', - '#FFCE56' - ] - }] -}; - -export default class PieExample extends React.Component { - render() { - return ( -
-

Pie Example

- -
- ); - } -} diff --git a/types/react-chartjs-2/test/polar.tsx b/types/react-chartjs-2/test/polar.tsx deleted file mode 100755 index 264c3d9f2b..0000000000 --- a/types/react-chartjs-2/test/polar.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import * as React from 'react'; -import { Polar } from 'react-chartjs-2'; - -const data = { - datasets: [{ - data: [ - 11, - 16, - 7, - 3, - 14 - ], - backgroundColor: [ - '#FF6384', - '#4BC0C0', - '#FFCE56', - '#E7E9ED', - '#36A2EB' - ], - label: 'My dataset' // for legend - }], - labels: [ - 'Red', - 'Green', - 'Yellow', - 'Grey', - 'Blue' - ] -}; - -export default class PolarExample extends React.Component { - render() { - return ( -
-

Polar Example

- -
- ); - } -} diff --git a/types/react-chartjs-2/test/radar.tsx b/types/react-chartjs-2/test/radar.tsx deleted file mode 100755 index 886b111ae6..0000000000 --- a/types/react-chartjs-2/test/radar.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import * as React from 'react'; -import { Radar } from 'react-chartjs-2'; - -const data = { - labels: ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running'], - datasets: [ - { - label: 'My First dataset', - backgroundColor: 'rgba(179,181,198,0.2)', - borderColor: 'rgba(179,181,198,1)', - pointBackgroundColor: 'rgba(179,181,198,1)', - pointBorderColor: '#fff', - pointHoverBackgroundColor: '#fff', - pointHoverBorderColor: 'rgba(179,181,198,1)', - data: [65, 59, 90, 81, 56, 55, 40] - }, - { - label: 'My Second dataset', - backgroundColor: 'rgba(255,99,132,0.2)', - borderColor: 'rgba(255,99,132,1)', - pointBackgroundColor: 'rgba(255,99,132,1)', - pointBorderColor: '#fff', - pointHoverBackgroundColor: '#fff', - pointHoverBorderColor: 'rgba(255,99,132,1)', - data: [28, 48, 40, 19, 96, 27, 100] - } - ] -}; - -export default class RadarExample extends React.Component { - render() { - return ( -
-

Radar Example

- -
- ); - } -} diff --git a/types/react-chartjs-2/test/randomizedLine.tsx b/types/react-chartjs-2/test/randomizedLine.tsx deleted file mode 100755 index fc63f75141..0000000000 --- a/types/react-chartjs-2/test/randomizedLine.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import * as React from 'react'; -import { Line } from 'react-chartjs-2'; - -const initialState = { - labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], - datasets: [ - { - label: 'My First dataset', - fill: false, - lineTension: 0.1, - backgroundColor: 'rgba(75,192,192,0.4)', - borderColor: 'rgba(75,192,192,1)', - borderCapStyle: 'butt', - borderDash: [] as any[], - borderDashOffset: 0.0, - borderJoinStyle: 'miter', - pointBorderColor: 'rgba(75,192,192,1)', - pointBackgroundColor: '#fff', - pointBorderWidth: 1, - pointHoverRadius: 5, - pointHoverBackgroundColor: 'rgba(75,192,192,1)', - pointHoverBorderColor: 'rgba(220,220,220,1)', - pointHoverBorderWidth: 2, - pointRadius: 1, - pointHitRadius: 10, - data: [65, 59, 80, 81, 56, 55, 40] - } - ] -}; - -class Graph extends React.Component { - componentWillMount() { - this.setState(initialState); - } - - componentDidMount() { - setInterval(() => { - const oldDataSet = this.state; - const newData: number[] = []; - - this.state.labels.forEach(() => { - newData.push(Math.floor(Math.random() * 100)); - }); - - const newDataSet = { - ...oldDataSet, - data: newData - }; - - this.setState({ datasets: [newDataSet] }); - }, 5000); - } - - render() { - return ( - - ); - } -} - -export default class RandomizedDataLineExample extends React.Component { - render() { - return ( -
-

Random Animated Line Example

- -
- ); - } -} diff --git a/types/react-chartjs-2/tsconfig.json b/types/react-chartjs-2/tsconfig.json deleted file mode 100644 index ef5b3e00c9..0000000000 --- a/types/react-chartjs-2/tsconfig.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "jsx": "react" - }, - "files": [ - "index.d.ts", - "test/index.tsx", - "test/bar.tsx", - "test/bubble.tsx", - "test/doughnut.tsx", - "test/dynamic-doughnut.tsx", - "test/horizontalBar.tsx", - "test/line.tsx", - "test/mix.tsx", - "test/pie.tsx", - "test/polar.tsx", - "test/radar.tsx", - "test/randomizedLine.tsx" - ] -} \ No newline at end of file diff --git a/types/react-chartjs-2/tslint.json b/types/react-chartjs-2/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/react-chartjs-2/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 2a5f37c650bc0a99549bcc2505fd465780623615 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 10:09:29 -0800 Subject: [PATCH 158/890] smoothie: Provides its own types --- notNeededPackages.json | 6 + types/smoothie/index.d.ts | 186 ------------------------------- types/smoothie/smoothie-tests.ts | 31 ------ types/smoothie/tsconfig.json | 24 ---- types/smoothie/tslint.json | 79 ------------- 5 files changed, 6 insertions(+), 320 deletions(-) delete mode 100644 types/smoothie/index.d.ts delete mode 100644 types/smoothie/smoothie-tests.ts delete mode 100644 types/smoothie/tsconfig.json delete mode 100644 types/smoothie/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 0f92b3f3ac..14e0d8d710 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -804,6 +804,12 @@ "sourceRepoURL": "https://github.com/zeh/simplesignal", "asOfVersion": "1.0.0" }, + { + "libraryName": "Smoothie Charts", + "typingsPackageName": "smoothie", + "sourceRepoURL": "https://github.com/joewalnes/smoothie", + "asOfVersion": "1.29.1" + }, { "libraryName": "snake-case", "typingsPackageName": "snake-case", diff --git a/types/smoothie/index.d.ts b/types/smoothie/index.d.ts deleted file mode 100644 index 853b1fbc25..0000000000 --- a/types/smoothie/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -// Type definitions for Smoothie Charts 1.25 -// Project: https://github.com/joewalnes/smoothie -// Definitions by: Drew Noakes , Mike H. Hawley -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/smoothie - -// NOTE this reference is here to make the DefinitelyTyped `npm test` suite pass and -// may be removed if you are using this module declaration in isolation from the -// rest of DefinitelyTyped. -/// - - -export interface ITimeSeriesOptions { - resetBounds?: boolean; - resetBoundsInterval?: number; -} - -export interface ITimeSeriesPresentationOptions { - strokeStyle?: string; - fillStyle?: string; - lineWidth?: number; -} - -export declare class TimeSeries { - /** - * Initialises a new TimeSeries with optional data options. - * - * Options are of the form (defaults shown): - * - *
-     * {
-     *   resetBounds: true,        // enables/disables automatic scaling of the y-axis
-     *   resetBoundsInterval: 3000 // the period between scaling calculations, in millis
-     * }
-     * 
- * - * Presentation options for TimeSeries are specified as an argument to SmoothieChart.addTimeSeries. - */ - constructor(options?: ITimeSeriesOptions); - - /** - * Clears all data and state from this TimeSeries object. - */ - clear(): void; - - /** - * Recalculate the min/max values for this TimeSeries object. - * - * This causes the graph to scale itself in the y-axis. - */ - resetBounds(): void; - - /** - * Adds a new data point to the TimeSeries, preserving chronological order. - * - * @param timestamp the position, in time, of this data point - * @param value the value of this data point - * @param sumRepeatedTimeStampValues if timestamp has an exact match in the series, this flag controls - * whether it is replaced, or the values summed (defaults to false.) - */ - append(timestamp: number, value: number, sumRepeatedTimeStampValues?: boolean): void; - - dropOldData(oldestValidTime: number, maxDataSetLength: number): void; -} - -export interface IGridOptions { - /** The background colour of the chart. */ - fillStyle?: string; - /** The pixel width of grid lines. */ - lineWidth?: number; - /** Colour of grid lines. */ - strokeStyle?: string; - /** Distance between vertical grid lines. */ - millisPerLine?: number; - /** Controls whether grid lines are 1px sharp, or softened. */ - sharpLines?: boolean; - /** Number of vertical sections marked out by horizontal grid lines. */ - verticalSections?: number; - /** Whether the grid lines trace the border of the chart or not. */ - borderVisible?: boolean; -} - -export interface ILabelOptions { - /** Enables/disables labels showing the min/max values. */ - disabled?: boolean; - /** Colour for text of labels. */ - fillStyle?: string; - fontSize?: number; - fontFamily?: string; - precision?: number; -} - -export interface IRange { min: number; max: number } - -export interface IHorizontalLine { - value?: number; - color?: string; - lineWidth?: number; -} - -export interface IChartOptions { - /** Specify to clamp the lower y-axis to a given value. */ - minValue?: number; - /** Specify to clamp the upper y-axis to a given value. */ - maxValue?: number; - /** Allows proportional padding to be added above the chart. for 10% padding, specify 1.1. */ - maxValueScale?: number; - yRangeFunction?: (range: IRange) => IRange; - /** Controls the rate at which y-value zoom animation occurs. */ - scaleSmoothing?: number; - /** Sets the speed at which the chart pans by. */ - millisPerPixel?: number; - /** Whether to render at different DPI depending upon the device. Enabled by default. */ - enableDpiScaling?: boolean; - yMinFormatter?: (min: number, precision: number) => string; - yMaxFormatter?: (max: number, precision: number) => string; - maxDataSetLength?: number; - /** One of: 'bezier', 'linear', 'step' */ - interpolation?: string; - /** Optional function to format time stamps for bottom of chart. You may use SmoothieChart.timeFormatter, or your own/ */ - timestampFormatter?: (date: Date) => string; - horizontalLines?: IHorizontalLine[]; - - grid?: IGridOptions; - - labels?: ILabelOptions; -} - -/** - * Initialises a new SmoothieChart. - * - * Options are optional and may be sparsely populated. Just specify the values you - * need and the rest will be given sensible defaults. - */ -export declare class SmoothieChart { - options: IChartOptions; - - constructor(chartOptions?: IChartOptions); - - /** - * Adds a TimeSeries to this chart, with optional presentation options. - */ - addTimeSeries(series: TimeSeries, seriesOptions?: ITimeSeriesPresentationOptions): void; - - /** - * Removes the specified TimeSeries from the chart. - */ - removeTimeSeries(series: TimeSeries): void; - - /** - * Gets render options for the specified TimeSeries. - * - * As you may use a single TimeSeries in multiple charts with different formatting in each usage, - * these settings are stored in the chart. - */ - getTimeSeriesOptions(timeSeries: TimeSeries): ITimeSeriesPresentationOptions; - - /** - * Brings the specified TimeSeries to the top of the chart. It will be rendered last. - */ - bringToFront(timeSeries: TimeSeries): void; - - /** - * Instructs the SmoothieChart to start rendering to the provided canvas, with specified delay. - * - * @param canvas the target canvas element - * @param delayMillis an amount of time to wait before a data point is shown. This can prevent the end of the series - * from appearing on screen, with new values flashing into view, at the expense of some latency. - */ - streamTo(canvas: HTMLCanvasElement, delayMillis?: number): void; - - /** - * Starts the animation of this chart. Called by streamTo. - */ - start(): void; - - /** - * Stops the animation of this chart. - */ - stop(): void; - - updateValueRange(): void; - - render(canvas?: HTMLCanvasElement, time?: number): void; - - static timeFormatter(date: Date): string; -} diff --git a/types/smoothie/smoothie-tests.ts b/types/smoothie/smoothie-tests.ts deleted file mode 100644 index 5a89014192..0000000000 --- a/types/smoothie/smoothie-tests.ts +++ /dev/null @@ -1,31 +0,0 @@ - -// Smoothie supports browserify -import smoothie = require('smoothie'); - -var canvas: HTMLCanvasElement = document.createElement('canvas'); - -document.body.appendChild(canvas); - -var series: smoothie.TimeSeries = new smoothie.TimeSeries(), - chart: smoothie.SmoothieChart = new smoothie.SmoothieChart({ - grid : { - strokeStyle : '#404040' - }, - maxValue : 1, - minValue : 0 -}); - -chart.addTimeSeries(series, { - strokeStyle : '#FFFFFF', - fillStyle : 'rgba(64, 64, 64, 0.25)', - lineWidth : 2 -}); - -var DELAY: number = 500; - -chart.streamTo(canvas, DELAY); -chart.addTimeSeries(series); - -setInterval(() => - series.append(Date.now(), Math.random()), - DELAY); diff --git a/types/smoothie/tsconfig.json b/types/smoothie/tsconfig.json deleted file mode 100644 index 7e9fd9b698..0000000000 --- a/types/smoothie/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "smoothie-tests.ts" - ] -} \ No newline at end of file diff --git a/types/smoothie/tslint.json b/types/smoothie/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/smoothie/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From a45413b2805714b99a279b58839c8b48863c4070 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 10:11:35 -0800 Subject: [PATCH 159/890] soap: Provides its own types --- notNeededPackages.json | 6 +++ types/soap/index.d.ts | 87 --------------------------------- types/soap/soap-tests.ts | 101 --------------------------------------- types/soap/tsconfig.json | 23 --------- types/soap/tslint.json | 79 ------------------------------ 5 files changed, 6 insertions(+), 290 deletions(-) delete mode 100644 types/soap/index.d.ts delete mode 100644 types/soap/soap-tests.ts delete mode 100644 types/soap/tsconfig.json delete mode 100644 types/soap/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 0f92b3f3ac..0d1aa313dc 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -810,6 +810,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/snake-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "soap", + "typingsPackageName": "soap", + "sourceRepoURL": "https://www.npmjs.com/package/soap", + "asOfVersion": "0.21.0" + }, { "libraryName": "Spin.js", "typingsPackageName": "spin.js", diff --git a/types/soap/index.d.ts b/types/soap/index.d.ts deleted file mode 100644 index 762b803d12..0000000000 --- a/types/soap/index.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -// Type definitions for soap 0.18 -// Project: https://www.npmjs.com/package/soap -// Definitions by: Leo Liang , Cage Fox -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -import * as events from 'events'; - -interface Security { -} - -export interface SoapMethod { - (args: any, callback: (err: any, result: any) => void, options?: any, extraHeaders?: any): void; -} - -export class BasicAuthSecurity implements Security { - constructor(username: string, password: string); -} - -export class BearerSecurity implements Security { - constructor(token: string); -} - -export class WSSecurity implements Security { - constructor(username: string, password: string, options?: any); -} - -export class ClientSSLSecurity implements Security { - constructor(key: Buffer | string, cert: Buffer | string, ca: Buffer | string, defaults?: any); - constructor(key: Buffer | string, cert: Buffer | string, defaults?: any); -} - -export interface Client extends events.EventEmitter { - addBodyAttribute(bodyAttribute: any, name?: string, namespace?: string, xmlns?: string): void; - addHttpHeader(name: string, value: any): void; - addSoapHeader(soapHeader: any, name?: string, namespace?: string, xmlns?: string): number; - changeSoapHeader(index: number, soapHeader: any, name?: string, namespace?: string, xmlns?: string): void; - clearBodyAttributes(): void; - clearHttpHeaders(): void; - clearSoapHeaders(): void; - describe(): any; - getBodyAttributes(): any[]; - getHttpHeaders(): any[]; - getSoapHeaders(): any[]; - setEndpoint(endpoint: string): void; - setSOAPAction(action: string): void; - setSecurity(s: Security): void; - [method: string]: SoapMethod | Function; -} - -export interface Server extends events.EventEmitter { - addSoapHeader(soapHeader: any, name: any, namespace: any, xmlns: any): any; - changeSoapHeader(index: any, soapHeader: any, name: any, namespace: any, xmlns: any): any; - getSoapHeaders(): any; - clearSoapHeaders(): any; - log(type: any, data: any): any; -} -export function listen(server: any, path: string, service: any, wsdl: string): Server; -declare function createClient(wsdlPath: string, options: Option, fn: (err: any, client: Client) => void): void; - -export interface Option { - attributesKey?: string; - disableCache?: boolean; - endpoint?: string; - envelopeKey?: string; - escapeXML?: boolean; - forceSoap12Headers?: boolean; - httpClient?: HttpClient; - ignoreBaseNameSpaces?: boolean, - ignoredNamespaces?: string[] | { namespaces: string[], override: boolean }; - overrideRootElement?: { namespace: string, xmlnsAttributes?: string[] }; - request?: (options: any, callback?: (error: any, res: any, body: any) => void) => void; - stream?: boolean; - valueKey?: string; - wsdl_headers?: { [key: string]: any }; - wsdl_options?: { [key: string]: any }; - xmlKey?: string; -} - -export class HttpClient { - constructor(options?: Option); - buildRequest(rurl: string, data: any | string, exheaders?: { [key: string]: any }, exoptions?: { [key: string]: any }): any; - handleResponse(req: any, res: any, body: any | string): any | string; - request(rurl: string, data: any | string, callback: (err: any, res: any, body: any | string) => void, exheaders?: { [key: string]: any }, exoptions?: { [key: string]: any }): any; - requestStream(rurl: string, data: any | string, exheaders?: { [key: string]: any }, exoptions?: { [key: string]: any }): any; -} diff --git a/types/soap/soap-tests.ts b/types/soap/soap-tests.ts deleted file mode 100644 index 72a1d1a85d..0000000000 --- a/types/soap/soap-tests.ts +++ /dev/null @@ -1,101 +0,0 @@ -import * as soap from 'soap'; -import * as events from 'events'; -import * as fs from 'fs'; -import * as http from 'http'; - -const url = 'http://example.com/wsdl?wsdl'; -// wsdlOptions set only default values -const wsdlOptions = { - attributesKey: 'attributes', - disableCache: false, - endpoint: url, - envelopeKey: 'soap', - escapeXML: true, - forceSoap12Headers: false, - httpClient: new soap.HttpClient(), - ignoreBaseNameSpaces: false, - ignoredNamespaces: ['tns', 'targetNamespace', 'typedNamespace'], - request: require('request'), - stream: false, - wsdl_headers: [], - wsdl_options: [], - valueKey: '$value', - xmlKey: '$xml' -}; - -soap.createClient(url, wsdlOptions, (err: any, client: soap.Client) => { - let securityOptions = { hasTimeStamp: false }; - client.setSecurity(new soap.WSSecurity('user', 'password', securityOptions)); - client.setSecurity(new soap.BasicAuthSecurity('user', 'password')); - client.setSecurity(new soap.BearerSecurity('token')); - client.setSecurity(new soap.WSSecurity('user', 'password', securityOptions)); - let defaults = { rejectUnauthorized: false }; - client.setSecurity(new soap.ClientSSLSecurity('/path/to/key', '/path/to/cert', '/path/to/ca', defaults)); - client.setSecurity(new soap.ClientSSLSecurity('/path/to/key', '/path/to/cert', defaults)); - client.setSecurity(new soap.ClientSSLSecurity('/path/to/key', '/path/to/cert', '/path/to/ca')); - client.setEndpoint('http://localhost'); - client.describe(); - client.addBodyAttribute({}); - client.addHttpHeader('test', true); - client.addSoapHeader({}); - client.changeSoapHeader(0, {}); - client.clearBodyAttributes(); - client.clearHttpHeaders(); - client.clearSoapHeaders(); - client.getBodyAttributes(); - client.getHttpHeaders(); - client.getSoapHeaders(); - client.setSOAPAction('action'); - (client['create'] as soap.SoapMethod)({ name: 'value' }, (err: any, result: any) => { - // result is an object - }); - (client['create'] as soap.SoapMethod)({ name: 'value' }, (err: any, result: any) => { - // result is an object - }, {}); - client.on('request', (obj: any) => { - //obj is an object - }); -}); - -var myService = { - MyService: { - MyPort: { - MyFunction: (args: any) => { - return { - name: args.name - }; - }, - - // This is how to define an asynchronous function. - MyAsyncFunction: (args: any, callback: any) => { - // do some work - callback({ - name: args.name - }); - }, - - // This is how to receive incoming headers - HeadersAwareFunction: (args: any, cb: any, headers: any) => { - return { - name: headers.Token - }; - }, - - // You can also inspect the original `req` - reallyDeatailedFunction: (args: any, cb: any, headers: any, req: any) => { - console.log('SOAP `reallyDeatailedFunction` request from ' + req.connection.remoteAddress); - return { - name: headers.Token - }; - } - } - } -}; - -var xml = fs.readFileSync('myservice.wsdl', 'utf8'), - server = http.createServer((request, response) => { - response.end('404: Not Found: ' + request.url); - }); - -server.listen(8000); -soap.listen(server, '/wsdl', myService, xml); diff --git a/types/soap/tsconfig.json b/types/soap/tsconfig.json deleted file mode 100644 index 5f207207ac..0000000000 --- a/types/soap/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "soap-tests.ts" - ] -} \ No newline at end of file diff --git a/types/soap/tslint.json b/types/soap/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/soap/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From fa1324e2e5826d1610c4c93ea6eb8334d4f8928a Mon Sep 17 00:00:00 2001 From: Brian Buchalter Date: Thu, 21 Dec 2017 11:39:37 -0700 Subject: [PATCH 160/890] Generic param default for MockStoreCreator As of TypeScript 2.3, there is now [support for Generic parameter defaults](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-3.html). By setting a reasonable default type on `MockStoreCreator`, we can eliminate unneeded verbosity. --- types/redux-mock-store/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/redux-mock-store/index.d.ts b/types/redux-mock-store/index.d.ts index 20a94b33f5..4f8114731a 100644 --- a/types/redux-mock-store/index.d.ts +++ b/types/redux-mock-store/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for Redux Mock Store 0.0 +// Type definitions for Redux Mock Store 0.0.1 // Project: https://github.com/arnaudbenard/redux-mock-store // Definitions by: Marian Palkus , Cap3 // Definitions: https://github.com/borisyankov/DefinitelyTyped +// TypeScript Version: 2.3 import * as Redux from 'redux'; @@ -10,7 +11,7 @@ export interface MockStore extends Redux.Store { clearActions(): void; } -export type MockStoreCreator = (state?: T) => MockStore; +export type MockStoreCreator = (state?: T) => MockStore; declare function createMockStore(middlewares?: Redux.Middleware[]): MockStoreCreator; From 82acd03b68b44856fff0708cbe43c2b103939ebb Mon Sep 17 00:00:00 2001 From: Maarten Mulders Date: Thu, 21 Dec 2017 20:34:08 +0100 Subject: [PATCH 161/890] Replace on*IconButtonTouchTap with on*IconButtonClick --- types/material-ui/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 55b34dff34..8831696635 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -578,8 +578,8 @@ declare namespace __MaterialUI { iconElementRight?: React.ReactElement; iconStyleRight?: React.CSSProperties; iconStyleLeft?: React.CSSProperties; - onLeftIconButtonTouchTap?: TouchTapEventHandler; - onRightIconButtonTouchTap?: TouchTapEventHandler; + onLeftIconButtonClick?: TouchTapEventHandler; + onRightIconButtonClick?: TouchTapEventHandler; onTitleTouchTap?: TouchTapEventHandler; showMenuIconButton?: boolean; style?: React.CSSProperties; From 55eb5e8a72b17c74f6c5fd5f433b898d1088ea1d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 12:33:25 -0800 Subject: [PATCH 162/890] ngwysiwyg: Fix name and lint --- types/ngwysiwyg/index.d.ts | 6 +-- types/ngwysiwyg/ngwysiwyg-tests.ts | 8 +-- types/ngwysiwyg/tslint.json | 80 +----------------------------- 3 files changed, 6 insertions(+), 88 deletions(-) diff --git a/types/ngwysiwyg/index.d.ts b/types/ngwysiwyg/index.d.ts index 4b7a61b3bc..8a1fe1b8e2 100644 --- a/types/ngwysiwyg/index.d.ts +++ b/types/ngwysiwyg/index.d.ts @@ -1,15 +1,15 @@ -// Type definitions for Marked +// Type definitions for ngWYSIWYG 0.6 // Project: https://github.com/psergus/ngWYSIWYG // Definitions by: Patrick Mac Kay // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace ngWYSIWYG { - export interface Toolbar { + interface Toolbar { name: string; items: string[]; } - export interface Config { + interface Config { sanitize: boolean; toolbar?: Toolbar[]; } diff --git a/types/ngwysiwyg/ngwysiwyg-tests.ts b/types/ngwysiwyg/ngwysiwyg-tests.ts index fd6eaf1ee8..0a31c38498 100644 --- a/types/ngwysiwyg/ngwysiwyg-tests.ts +++ b/types/ngwysiwyg/ngwysiwyg-tests.ts @@ -1,8 +1,4 @@ - - -//import ngWYSIWYG = require("ngWYSIWYG"); - -var complete: ngWYSIWYG.Config = { +const complete: ngWYSIWYG.Config = { sanitize: false, toolbar: [ { name: "basicStyling", items: ["bold", "italic", "underline", "strikethrough", "subscript", "superscript", "-", "leftAlign", "centerAlign", "rightAlign", "blockJustify", "-"] }, @@ -15,6 +11,6 @@ var complete: ngWYSIWYG.Config = { ] }; -var partial: ngWYSIWYG.Config = { +const partial: ngWYSIWYG.Config = { sanitize: false }; diff --git a/types/ngwysiwyg/tslint.json b/types/ngwysiwyg/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/ngwysiwyg/tslint.json +++ b/types/ngwysiwyg/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } From 96d73c7256246180e1dbad742acf3715dcfd1b4e Mon Sep 17 00:00:00 2001 From: Grzegorz Rozdzialik Date: Thu, 21 Dec 2017 21:41:05 +0100 Subject: [PATCH 163/890] cannon: add cone twist constraint --- types/cannon/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/cannon/index.d.ts b/types/cannon/index.d.ts index 8516d968dd..ccb9c6541f 100644 --- a/types/cannon/index.d.ts +++ b/types/cannon/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for cannon 0.1 // Project: https://github.com/clark-stevenson/cannon.d.ts // Definitions by: Clark Stevenson +// Grzegorz Rozdzialik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -148,6 +149,8 @@ declare module CANNON { constructor(bodyA: Body, bodyB: Body, options?: IConstraintOptions); update(): void; + disable(): void; + enable(): void; } @@ -193,6 +196,19 @@ declare module CANNON { constructor(bodyA: Body, bodyB: Body, options?:any); } + export interface IConeTwistConstraintOptions { + pivotA?: Vec3; + pivotB?: Vec3; + axisA?: Vec3; + axisB?: Vec3; + maxForce?: number; + } + + export class ConeTwistConstraint extends Constraint { + constructor(bodyA: Body, bodyB: Body, options?: IConeTwistConstraintOptions); + + } + export class Equation { From eba05bf2acf3859753b1a87aabe67d93878c2f29 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Thu, 21 Dec 2017 15:31:49 -0500 Subject: [PATCH 164/890] Updates declarations for "which" - Enables strictNullChecks - Adds options: `nothrow`, `all`, `path`, and `pathExt` - Uses function overloading to pick most specific return types based on `all` and `nothrow` options --- types/which/index.d.ts | 64 +++++++++++++++++++++++++++++++++++--- types/which/tsconfig.json | 2 +- types/which/which-tests.ts | 26 ++++++++++++++++ 3 files changed, 86 insertions(+), 6 deletions(-) diff --git a/types/which/index.d.ts b/types/which/index.d.ts index 1fcfbc60e3..0a1b131799 100644 --- a/types/which/index.d.ts +++ b/types/which/index.d.ts @@ -1,12 +1,66 @@ -// Type definitions for which 1.0.8 +// Type definitions for which 1.3.0 // Project: https://github.com/isaacs/node-which -// Definitions by: vvakame +// Definitions by: vvakame , cspotcoxe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function when(cmd: string, cb: (err: Error, path: string) => void): void; -declare namespace when { +/** Finds all instances of a specified executable in the PATH environment variable */ +declare function which(cmd: string, options: which.AsyncOptions & which.OptionsAll, cb: (err: Error | null, paths: Array | undefined) => void): void; +/** Finds the first instance of a specified executable in the PATH environment variable */ +declare function which(cmd: string, options: which.AsyncOptions & which.OptionsFirst, cb: (err: Error | null, path: string | undefined) => void): void; +/** Finds the first instance of a specified executable in the PATH environment variable */ +declare function which(cmd: string, options: which.AsyncOptions, cb: (err: Error | null, path: string | Array | undefined) => void): void; +/** Finds the first instance of a specified executable in the PATH environment variable */ +declare function which(cmd: string, cb: (err: Error | null, path: string | undefined) => void): void; +declare namespace which { + /** Finds all instances of a specified executable in the PATH environment variable */ + function sync(cmd: string, options: which.Options & which.OptionsAll & which.OptionsNoThrow): Array | null; + /** Finds the first instance of a specified executable in the PATH environment variable */ + function sync(cmd: string, options: which.Options & which.OptionsFirst & which.OptionsNoThrow): string | null; + /** Finds all instances of a specified executable in the PATH environment variable */ + function sync(cmd: string, options: which.Options & which.OptionsAll & which.OptionsThrow): Array; + /** Finds the first instance of a specified executable in the PATH environment variable */ + function sync(cmd: string, options: which.Options & which.OptionsFirst & which.OptionsThrow): string; + /** Finds the first instance of a specified executable in the PATH environment variable */ + function sync(cmd: string, options: which.Options): string | Array | null; + /** Finds the first instance of a specified executable in the PATH environment variable */ function sync(cmd: string): string; + + /** Options that ask for all matches. */ + interface OptionsAll extends AsyncOptions { + all: true; + } + + /** Options that ask for the first match (the default behavior) */ + interface OptionsFirst extends AsyncOptions { + all?: false | undefined; + } + + /** Options that ask to receive null instead of a thrown error */ + interface OptionsNoThrow extends Options { + nothrow: true; + } + + /** Options that ask for a thrown error if executable is not found (the default behavior) */ + interface OptionsThrow extends Options { + nothrow?: false | undefined; + } + + /** Options for which() async API */ + interface AsyncOptions { + /** If true, return all matches, instead of just the first one. Note that this means the function returns an array of strings instead of a single string. */ + all?: boolean; + /** Use instead of the PATH environment variable. */ + path?: string; + /** Use instead of the PATHEXT environment variable. */ + pathExt?: string; + } + + /** Options for which() sync and async APIs */ + interface Options extends AsyncOptions { + /** If true, returns null when not found */ + nothrow?: boolean; + } } -export = when; +export = which; diff --git a/types/which/tsconfig.json b/types/which/tsconfig.json index 3c3883a801..2ee304960e 100644 --- a/types/which/tsconfig.json +++ b/types/which/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/which/which-tests.ts b/types/which/which-tests.ts index 68cd2c03ac..0220c3ad14 100644 --- a/types/which/which-tests.ts +++ b/types/which/which-tests.ts @@ -7,3 +7,29 @@ which("cat", (err, path) => { var path = which.sync("cat"); console.log(path); + +which("cat", {all: true}, (err, paths) => { + if(err) return; + if(paths) { + for(let path of paths) { + console.log(path); + } + } +}); + +var paths = which.sync("cat", {all: true}); +for(let path of paths) { + console.log(path); +} + +var paths2 = which.sync("cat", {all: true, nothrow: true}); +if(paths2 !== null) { + for(let path of paths2) { + console.log(path); + } +} + +var path2 = which.sync("cat", {path: 'replacement path', pathExt: 'replacement pathext'}); +which("cat", {path: 'replacement path', pathExt: 'replacement pathext'}, (err, path) => { + const a: string = path!; +}); From 9e8b85a964b076d8648b4b06780d96dd87e55f36 Mon Sep 17 00:00:00 2001 From: Grzegorz Rozdzialik Date: Thu, 21 Dec 2017 21:48:23 +0100 Subject: [PATCH 165/890] cannon: fill AABB and ArrayCollisionMatrix classes, add proper LockConstraint constructor options --- types/cannon/index.d.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/types/cannon/index.d.ts b/types/cannon/index.d.ts index ccb9c6541f..56272a6b1f 100644 --- a/types/cannon/index.d.ts +++ b/types/cannon/index.d.ts @@ -21,10 +21,14 @@ declare module CANNON { constructor(options?: IAABBOptions); - setFromPoints(points: Vec3[], position?: Vec3, quaternion?: Quaternion, skinSize?: number): void; + clone(): AABB; copy(aabb: AABB): void; extend(aabb: AABB): void; + getCorners(a: Vec3, b: Vec3, c: Vec3, d: Vec3, e: Vec3, f: Vec3, g: Vec3, h: Vec3): void; overlaps(aabb: AABB): boolean; + setFromPoints(points: Vec3[], position?: Vec3, quaternion?: Quaternion, skinSize?: number): AABB; + toLocalFrame(frame: Transform, target: AABB): AABB; + toWorldFrame(frame: Transform, target: AABB): AABB; } @@ -33,7 +37,7 @@ declare module CANNON { matrix: Mat3[]; get(i: number, j: number): number; - set(i: number, j: number, value?: number): void; + set(i: number, j: number, value: number): void; reset(): void; setNumObjects(n: number): void; @@ -191,9 +195,12 @@ declare module CANNON { } + export interface ILockConstraintOptions { + maxForce?: number; + } export class LockConstraint extends Constraint { - constructor(bodyA: Body, bodyB: Body, options?:any); + constructor(bodyA: Body, bodyB: Body, options?: ILockConstraintOptions); } export interface IConeTwistConstraintOptions { @@ -206,7 +213,6 @@ declare module CANNON { export class ConeTwistConstraint extends Constraint { constructor(bodyA: Body, bodyB: Body, options?: IConeTwistConstraintOptions); - } From ed83ceded1ce6d45ff2758a9e257269ff1d4748b Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 12:47:08 -0800 Subject: [PATCH 166/890] socket.io-parser: Fix name and lint --- types/socket.io-parser/index.d.ts | 54 ++++++------- .../socket.io-parser-tests.ts | 44 +++++----- types/socket.io-parser/tslint.json | 80 +------------------ 3 files changed, 47 insertions(+), 131 deletions(-) diff --git a/types/socket.io-parser/index.d.ts b/types/socket.io-parser/index.d.ts index 5f1a7a104e..66ca1be4c5 100644 --- a/types/socket.io-parser/index.d.ts +++ b/types/socket.io-parser/index.d.ts @@ -1,39 +1,33 @@ -// Type definitions for json-editor +// Type definitions for socket.io-parser 2.2 // Project: https://github.com/socketio/socket.io-parser -// Definitions by: York Yao +// Definitions by: York Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// -declare module "socket.io-parser" { - namespace Parser { - type Packet = { - type: number, - data: any, - id: number - } - type EncodedPacket = string | Buffer | ArrayBuffer | Blob; +export interface Packet { + type: number; + data: any; + id: number; +} +export type EncodedPacket = string | Buffer | ArrayBuffer | Blob; - var types: string[]; +export const types: string[]; - var CONNECT: number; - var DISCONNECT: number; - var EVENT: number; - var ACK: number; - var ERROR: number; - var BINARY_EVENT: number; - var BINARY_ACK: number; +export const CONNECT: number; +export const DISCONNECT: number; +export const EVENT: number; +export const ACK: number; +export const ERROR: number; +export const BINARY_EVENT: number; +export const BINARY_ACK: number; - class Encoder { - encode(packet: Packet, callback: (encodedPackets: EncodedPacket[]) => void): void; - } +export class Encoder { + encode(packet: Packet, callback: (encodedPackets: EncodedPacket[]) => void): void; +} - class Decoder { - on(event: string, callback: (decodedPacket: Packet) => void): void; - add(encodedPacket: EncodedPacket): void; - destroy(): void; - } - } - - export = Parser; +export class Decoder { + on(event: string, callback: (decodedPacket: Packet) => void): void; + add(encodedPacket: EncodedPacket): void; + destroy(): void; } diff --git a/types/socket.io-parser/socket.io-parser-tests.ts b/types/socket.io-parser/socket.io-parser-tests.ts index 07646f48ce..b30a32aff0 100644 --- a/types/socket.io-parser/socket.io-parser-tests.ts +++ b/types/socket.io-parser/socket.io-parser-tests.ts @@ -1,38 +1,38 @@ import * as parser from 'socket.io-parser'; -var encoder = new parser.Encoder(); -var packet = { +const encoder = new parser.Encoder(); +const packet = { type: parser.EVENT, data: 'test-packet', - id: 13 + id: 13, }; -encoder.encode(packet, function (encodedPackets) { - var decoder = new parser.Decoder(); - decoder.on('decoded', function (decodedPacket) { - decodedPacket.type == parser.EVENT - decodedPacket.data == 'test-packet' - decodedPacket.id == 13 +encoder.encode(packet, encodedPackets => { + const decoder = new parser.Decoder(); + decoder.on('decoded', decodedPacket => { + decodedPacket.type === parser.EVENT; + decodedPacket.data === 'test-packet'; + decodedPacket.id === 13; }); - for (var i = 0; i < encodedPackets.length; i++) { - decoder.add(encodedPackets[i]); + for (const encoded of encodedPackets) { + decoder.add(encoded); } }); -var packet2 = { +const packet2 = { type: parser.BINARY_EVENT, data: { i: new Buffer(1234), j: new Blob([new ArrayBuffer(2)]) }, - id: 15 + id: 15, }; -encoder.encode(packet2, function (encodedPackets) { - var decoder = new parser.Decoder(); - decoder.on('decoded', function (decodedPacket) { - decodedPacket.type == parser.BINARY_EVENT - Buffer.isBuffer(decodedPacket.data.i) == true - Buffer.isBuffer(decodedPacket.data.j) == true - decodedPacket.id == 15 +encoder.encode(packet2, encodedPackets => { + const decoder = new parser.Decoder(); + decoder.on('decoded', decodedPacket => { + decodedPacket.type === parser.BINARY_EVENT; + Buffer.isBuffer(decodedPacket.data.i); // $ExpectType boolean + Buffer.isBuffer(decodedPacket.data.j); // $ExpectType boolean + decodedPacket.id === 15; }); - for (var i = 0; i < encodedPackets.length; i++) { - decoder.add(encodedPackets[i]); + for (const encoded of encodedPackets) { + decoder.add(encoded); } }); diff --git a/types/socket.io-parser/tslint.json b/types/socket.io-parser/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/socket.io-parser/tslint.json +++ b/types/socket.io-parser/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } From 2b1c1de4ec288506fd75e776a4aeed462f43e132 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 13:00:13 -0800 Subject: [PATCH 167/890] Disambiguate "notify.js" packages --- types/{notify.js => notifyjs-browser}/index.d.ts | 0 .../notifyjs-browser-tests.ts} | 0 types/{notify.js => notifyjs-browser}/tsconfig.json | 2 +- types/{notify.js => notifyjs-browser}/tslint.json | 0 types/notifyjs/index.d.ts | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) rename types/{notify.js => notifyjs-browser}/index.d.ts (100%) rename types/{notify.js/notify.js-tests.ts => notifyjs-browser/notifyjs-browser-tests.ts} (100%) rename types/{notify.js => notifyjs-browser}/tsconfig.json (93%) rename types/{notify.js => notifyjs-browser}/tslint.json (100%) diff --git a/types/notify.js/index.d.ts b/types/notifyjs-browser/index.d.ts similarity index 100% rename from types/notify.js/index.d.ts rename to types/notifyjs-browser/index.d.ts diff --git a/types/notify.js/notify.js-tests.ts b/types/notifyjs-browser/notifyjs-browser-tests.ts similarity index 100% rename from types/notify.js/notify.js-tests.ts rename to types/notifyjs-browser/notifyjs-browser-tests.ts diff --git a/types/notify.js/tsconfig.json b/types/notifyjs-browser/tsconfig.json similarity index 93% rename from types/notify.js/tsconfig.json rename to types/notifyjs-browser/tsconfig.json index 4e338e2e8b..53861036b0 100644 --- a/types/notify.js/tsconfig.json +++ b/types/notifyjs-browser/tsconfig.json @@ -19,6 +19,6 @@ }, "files": [ "index.d.ts", - "notify.js-tests.ts" + "notifyjs-browser-tests.ts" ] } \ No newline at end of file diff --git a/types/notify.js/tslint.json b/types/notifyjs-browser/tslint.json similarity index 100% rename from types/notify.js/tslint.json rename to types/notifyjs-browser/tslint.json diff --git a/types/notifyjs/index.d.ts b/types/notifyjs/index.d.ts index e31753b69e..d01ae91a92 100644 --- a/types/notifyjs/index.d.ts +++ b/types/notifyjs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for notify.js 1.2.8 +// Type definitions for notifyjs 1.2.8 // Project: https://github.com/alexgibson/notify.js // Definitions by: soundTricker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 25bf971c33fca786fd8612b451ef215bcc4ccd95 Mon Sep 17 00:00:00 2001 From: Robin Keller Date: Thu, 21 Dec 2017 13:03:39 -0800 Subject: [PATCH 168/890] Update angular.module to accept an Injectable as the configFn. This is undocumented behavior in Angular, but works because this argument is passed to $injector.invoke. See https://github.com/angular/angular.js/blob/49aba51e6bfd3f6d59c0f28628cc983d84438cfa/src/loader.js lines 81, 370, and 111 --- types/angular/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index f3b64e2136..5d8b6315b0 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -159,7 +159,7 @@ declare namespace angular { module( name: string, requires?: string[], - configFn?: Function): IModule; + configFn?: Injectable): IModule; noop(...args: any[]): void; reloadWithDebugInfo(): void; From 90e995391ae0e251a02ee2ad5765fdb64ea66eeb Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 13:17:31 -0800 Subject: [PATCH 169/890] Merge duplicate scroller types --- types/scroller/index.d.ts | 76 ++++--- types/scroller/scroller-tests.ts | 228 +++++++++++-------- types/scroller/tsconfig.json | 2 +- types/scroller/tslint.json | 80 +------ types/zynga-scroller/index.d.ts | 50 ---- types/zynga-scroller/tsconfig.json | 23 -- types/zynga-scroller/tslint.json | 79 ------- types/zynga-scroller/zynga-scroller-tests.ts | 36 --- 8 files changed, 172 insertions(+), 402 deletions(-) delete mode 100644 types/zynga-scroller/index.d.ts delete mode 100644 types/zynga-scroller/tsconfig.json delete mode 100644 types/zynga-scroller/tslint.json delete mode 100644 types/zynga-scroller/zynga-scroller-tests.ts diff --git a/types/scroller/index.d.ts b/types/scroller/index.d.ts index 2e481395aa..9230285414 100644 --- a/types/scroller/index.d.ts +++ b/types/scroller/index.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Zynga Scroller -// Project: https://github.com/zynga/scroller -// Definitions by: Boris Yankov +// Type definitions for Zynga Scroller 0.1 +// Project: http://zynga.github.com/scroller/ +// Definitions by: Marcelo Haskell Camargo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface ScrollerOptions { +declare namespace Scroller { + interface Options { scrollingX?: boolean; scrollingY?: boolean; animating?: boolean; @@ -13,46 +13,48 @@ interface ScrollerOptions { locking?: boolean; paging?: boolean; snapping?: boolean; - zooming?: boolean; + zooming?: number; minZoom?: number; maxZoom?: number; - speedMultiplier?: number; -} - -interface ScrollValues { - left: number; - top: number; -} - -interface ScrollValuesWithZoom extends ScrollValues { - zoom: number; + } } declare class Scroller { - constructor (callback: (left: number, top: number, zoom: number) => void , options: ScrollerOptions); + constructor(callback: (left: number, top: number, zoom: number) => void, options?: Scroller.Options); + setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, contentHeight: number): void; + setPosition(clientLeft: number, clientTop: number): void; + setSnapSize(width: number, height: number): void; + activatePullToRefresh(height: number, activate: () => void, deactivate: () => void, start: () => void): void; + finishPullToRefresh(): void; + getValues(): { + left: number; + top: number; + zoom: number + }; + getScrollMax(): { left: number; top: number; }; + zoomTo(level: number, animate?: boolean, originLeft?: number, + originTop?: number, callback?: () => void): void; + zoomBy(factor: number, animate?: boolean, originLeft?: number, + originTop?: number, callback?: () => void): void; + scrollTo(left: number, top: number, animate?: boolean, zoom?: number): void; + scrollBy(leftOffset: number, topOffset: number, animate?: boolean): void; - setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, contentHeight: number): void; - setPosition(left: number, top: number): void; - setSnapSize(width: number, height: number): void; - activatePullToRefresh(height: number, activateCallback: Function, deactivateCallback: Function, startCallback: Function): void; - finishPullToRefresh(): void; - getValues(): ScrollValuesWithZoom; - getScrollMax(): ScrollValues; - zoomTo(level: number, animate?: boolean, originLeft?: number, originTop?: number, callback?: Function): void; - zoomBy(factor: number, animate?: boolean, originLeft?: number, originTop?: number, callback?: Function): void; - scrollTo(left?: number, top?: number, animate?: boolean, zoom?: number): void; - scrollBy(left?: number, top?: number, animate?: boolean): void; - - doMouseZoom(wheelDelta: number, timeStamp: number, pageX: number, pageY: number): void; - doTouchStart(touches: any[], timeStamp: number): void; - doTouchMove(touches: any[], timeStamp: number, scale?: number): void; - doTouchEnd(timeStamp: number): void; + doMouseZoom(wheelData: number, timeStamp: number, pageX: number, pageY: number): void; + doTouchStart(touches: Array<{ + pageX: number; + pageY: number + }>, timeStamp: number): void; + doTouchMove(touches: Array<{ + pageX: number; + pageY: number + }>, timeStamp: number, scale?: number): void; + doTouchEnd(timeStamp: number): void; } declare class EasyScroller { - constructor (content: any, options: ScrollerOptions); + constructor(content: any, options: Scroller.Options); - render(): void; - reflow(): void; - bindEvents(): void; + render(): void; + reflow(): void; + bindEvents(): void; } diff --git a/types/scroller/scroller-tests.ts b/types/scroller/scroller-tests.ts index a4ac515b6c..bd681ead8c 100644 --- a/types/scroller/scroller-tests.ts +++ b/types/scroller/scroller-tests.ts @@ -1,11 +1,45 @@ -var clientWidth: any; -var clientHeight: any; -var render: any; +let scroller: Scroller = new Scroller((left, top, zoom) => { }); +scroller = new Scroller((left, top, zoom) => { }, { + scrollingX: true, + scrollingY: true, + animating: true, + animationDuration: 400, + bouncing: false, + locking: false, + paging: false, + snapping: true, + zooming: 10, + minZoom: 1, + maxZoom: 2 +}); -var Tiling: any; +scroller.setDimensions(10, 10, 10, 10); +scroller.setPosition(200, 300); +scroller.setSnapSize(300, 300); +scroller.activatePullToRefresh(200, () => { }, () => { }, () => { }); +scroller.finishPullToRefresh(); +const data: { + left: number; + top: number; + zoom: number +} = scroller.getValues(); +scroller.zoomTo(10); +scroller.zoomBy(10); +scroller.doMouseZoom(10, 10, 10, 10); +scroller.doTouchStart([{ + pageX: 10, + pageY: 20 +}], 200); +scroller.doTouchEnd(300); + +declare const clientWidth: number; +declare const clientHeight: number; +declare function render(left: number, top: number, zoom: number): void; + +declare const Tiling: any; // TODO: What is this? function test_basic() { - var scrollerObj = new Scroller(function (left, top, zoom) { + const scrollerObj = new Scroller((left, top, zoom) => { }, { scrollingY: false }); @@ -13,106 +47,106 @@ function test_basic() { } function test_canvas() { - var contentWidth = 2000; - var contentHeight = 2000; - var cellWidth = 100; - var cellHeight = 100; - var content = document.getElementById('content'); - var context = content.getContext('2d'); - var tiling = new Tiling(); - var render = function (left, top, zoom) { + const contentWidth = 2000; + const contentHeight = 2000; + const cellWidth = 100; + const cellHeight = 100; + const content = document.getElementById('content') as HTMLCanvasElement; + const context = content.getContext('2d'); + const tiling = new Tiling(); + function render(left: number, top: number, zoom: number) { content.width = clientWidth; content.height = clientHeight; context.clearRect(0, 0, clientWidth, clientHeight); tiling.setup(clientWidth, clientHeight, contentWidth, contentHeight, cellWidth, cellHeight); tiling.render(left, top, zoom, paint); - }; - var paint = function (row, col, left, top, width, height, zoom) { + } + function paint(row: number, col: number, left: number, top: number, width: number, height: number, zoom: number) { context.fillStyle = row % 2 + col % 2 > 0 ? "#ddd" : "#fff"; context.fillRect(left, top, width, height); context.fillStyle = "black"; context.font = (14 * zoom).toFixed(2) + 'px "Helvetica Neue", Helvetica, Arial, sans-serif'; - context.fillText(row + "," + col, left + (6 * zoom), top + (18 * zoom)); - }; + context.fillText(`${row},${col}`, left + (6 * zoom), top + (18 * zoom)); + } } function test_domlist() { - var container = document.getElementById("container"); - var content = document.getElementById("content"); - var refreshElem = content.getElementsByTagName("div")[0]; - var scroller = new Scroller(render, { + const container = document.getElementById("container"); + const content = document.getElementById("content"); + const refreshElem = content.getElementsByTagName("div")[0]; + const scroller = new Scroller(render, { scrollingX: false }); - scroller.activatePullToRefresh(50, function () { + scroller.activatePullToRefresh(50, () => { refreshElem.className += " active"; refreshElem.innerHTML = "Release to Refresh"; - }, function () { + }, () => { refreshElem.className = refreshElem.className.replace(" active", ""); refreshElem.innerHTML = "Pull to Refresh"; - }, function () { + }, () => { refreshElem.className += " running"; refreshElem.innerHTML = "Refreshing..."; - setTimeout(function () { + setTimeout(() => { refreshElem.className = refreshElem.className.replace(" running", ""); insertItems(); scroller.finishPullToRefresh(); }, 2000); }); - var rect = container.getBoundingClientRect(); + const rect = container.getBoundingClientRect(); scroller.setPosition(rect.left + container.clientLeft, rect.top + container.clientTop); - var insertItems = function () { - for (var i = 0; i < 15; i++) { - var row = document.createElement("div"); + const insertItems = () => { + for (let i = 0; i < 15; i++) { + const row = document.createElement("div"); row.className = "row"; row.style.backgroundColor = i % 2 > 0 ? "#ddd" : ""; - row.innerHTML = Math.random(); - if (content.firstChild == content.lastChild) { + row.innerHTML = Math.random().toString(); + if (content.firstChild === content.lastChild) { content.appendChild(row); } else { - content.insertBefore(row, content.childNodes[1]) + content.insertBefore(row, content.childNodes[1]); } } scroller.setDimensions(container.clientWidth, container.clientHeight, content.offsetWidth, content.offsetHeight - 50); }; insertItems(); if ('ontouchstart' in window) { - container.addEventListener("touchstart", function (e) { + container.addEventListener("touchstart", e => { // Don't react if initial down happens on a form element - if ((e.target).tagName.match(/input|textarea|select/i)) { + if ((e.target as any).tagName.match(/input|textarea|select/i)) { return; } - scroller.doTouchStart((e).touches, e.timeStamp); + scroller.doTouchStart((e as any).touches, e.timeStamp); e.preventDefault(); }, false); - document.addEventListener("touchmove", function (e) { - scroller.doTouchMove((e).touches, e.timeStamp); + document.addEventListener("touchmove", e => { + scroller.doTouchMove((e as any).touches, e.timeStamp); }, false); - document.addEventListener("touchend", function (e) { + document.addEventListener("touchend", e => { scroller.doTouchEnd(e.timeStamp); }, false); } else { - var mousedown = false; - container.addEventListener("mousedown", function (e) { - if ((e.target).tagName.match(/input|textarea|select/i)) { + let mousedown = false; + container.addEventListener("mousedown", e => { + if ((e.target as any).tagName.match(/input|textarea|select/i)) { return; } scroller.doTouchStart([{ - pageX: (e).pageX, - pageY: (e).pageY + pageX: (e as any).pageX, + pageY: (e as any).pageY }], e.timeStamp); mousedown = true; }, false); - document.addEventListener("mousemove", function (e) { + document.addEventListener("mousemove", e => { if (!mousedown) { return; } scroller.doTouchMove([{ - pageX: (e).pageX, - pageY: (e).pageY + pageX: (e as any).pageX, + pageY: (e as any).pageY }], e.timeStamp); mousedown = true; }, false); - document.addEventListener("mouseup", function (e) { + document.addEventListener("mouseup", e => { if (!mousedown) { return; } @@ -123,63 +157,63 @@ function test_domlist() { } function test_dompaging() { - var container = document.getElementById("container"); - var content = document.getElementById("content"); - var size = 400; - var frag = document.createDocumentFragment(); - for (var cell = 0, cl = content.clientWidth / size; cell < cl; cell++) { - var elem = document.createElement("div"); + const container = document.getElementById("container"); + const content = document.getElementById("content"); + const size = 400; + const frag = document.createDocumentFragment(); + for (let cell = 0, cl = content.clientWidth / size; cell < cl; cell++) { + const elem = document.createElement("div"); elem.className = "cell"; elem.style.backgroundColor = cell % 2 > 0 ? "#ddd" : ""; - elem.innerHTML = cell; + elem.innerHTML = cell.toString(); frag.appendChild(elem); } content.appendChild(frag); - var scroller = new Scroller(render, { + const scroller = new Scroller(render, { scrollingY: false, paging: true }); - var rect = container.getBoundingClientRect(); + const rect = container.getBoundingClientRect(); scroller.setPosition(rect.left + container.clientLeft, rect.top + container.clientTop); scroller.setDimensions(container.clientWidth, container.clientHeight, content.offsetWidth, content.offsetHeight); if ('ontouchstart' in window) { - container.addEventListener("touchstart", function (e) { - if ((e.target).tagName.match(/input|textarea|select/i)) { + container.addEventListener("touchstart", e => { + if ((e.target as any).tagName.match(/input|textarea|select/i)) { return; } - scroller.doTouchStart((e).touches, e.timeStamp); + scroller.doTouchStart((e as any).touches, e.timeStamp); e.preventDefault(); }, false); - document.addEventListener("touchmove", function (e) { - scroller.doTouchMove((e).touches, e.timeStamp); + document.addEventListener("touchmove", e => { + scroller.doTouchMove((e as any).touches, e.timeStamp); }, false); - document.addEventListener("touchend", function (e) { + document.addEventListener("touchend", e => { scroller.doTouchEnd(e.timeStamp); }, false); } else { - var mousedown = false; - container.addEventListener("mousedown", function (e) { - if ((e.target).tagName.match(/input|textarea|select/i)) { + let mousedown = false; + container.addEventListener("mousedown", e => { + if ((e.target as any).tagName.match(/input|textarea|select/i)) { return; } scroller.doTouchStart([{ - pageX: (e).pageX, - pageY: (e).pageY + pageX: (e as any).pageX, + pageY: (e as any).pageY }], e.timeStamp); mousedown = true; }, false); - document.addEventListener("mousemove", function (e) { + document.addEventListener("mousemove", e => { if (!mousedown) { return; } scroller.doTouchMove([{ - pageX: (e).pageX, - pageY: (e).pageY + pageX: (e as any).pageX, + pageY: (e as any).pageY }], e.timeStamp); mousedown = true; }, false); - document.addEventListener("mouseup", function (e) { + document.addEventListener("mouseup", e => { if (!mousedown) { return; } @@ -190,64 +224,64 @@ function test_dompaging() { } function test_domsnapping() { - var container = document.getElementById("container"); - var content = document.getElementById("content"); - var size = 100; - var frag = document.createDocumentFragment(); - for (var row = 0, rl = content.clientHeight / size; row < rl; row++) { - for (var cell = 0, cl = content.clientWidth / size; cell < cl; cell++) { - var elem = document.createElement("div"); + const container = document.getElementById("container"); + const content = document.getElementById("content"); + const size = 100; + const frag = document.createDocumentFragment(); + for (let row = 0, rl = content.clientHeight / size; row < rl; row++) { + for (let cell = 0, cl = content.clientWidth / size; cell < cl; cell++) { + const elem = document.createElement("div"); elem.className = "cell"; elem.style.backgroundColor = row % 2 + cell % 2 > 0 ? "#ddd" : ""; - elem.innerHTML = row + "," + cell; + elem.innerHTML = `${row},${cell}`; frag.appendChild(elem); } } content.appendChild(frag); - var scroller = new Scroller(render, { + const scroller = new Scroller(render, { snapping: true }); - var rect = container.getBoundingClientRect(); + const rect = container.getBoundingClientRect(); scroller.setPosition(rect.left + container.clientLeft, rect.top + container.clientTop); scroller.setDimensions(container.clientWidth, container.clientHeight, content.offsetWidth, content.offsetHeight); scroller.setSnapSize(100, 100); if ('ontouchstart' in window) { - container.addEventListener("touchstart", function (e) { - if ((e.target).tagName.match(/input|textarea|select/i)) { + container.addEventListener("touchstart", e => { + if ((e.target as any).tagName.match(/input|textarea|select/i)) { return; } - scroller.doTouchStart((e).touches, e.timeStamp); + scroller.doTouchStart((e as any).touches, e.timeStamp); e.preventDefault(); }, false); - document.addEventListener("touchmove", function (e) { - scroller.doTouchMove((e).touches, e.timeStamp); + document.addEventListener("touchmove", e => { + scroller.doTouchMove((e as any).touches, e.timeStamp); }, false); - document.addEventListener("touchend", function (e) { + document.addEventListener("touchend", e => { scroller.doTouchEnd(e.timeStamp); }, false); } else { - var mousedown = false; - container.addEventListener("mousedown", function (e) { - if ((e.target).tagName.match(/input|textarea|select/i)) { + let mousedown = false; + container.addEventListener("mousedown", e => { + if ((e.target as any).tagName.match(/input|textarea|select/i)) { return; } scroller.doTouchStart([{ - pageX: (e).pageX, - pageY: (e).pageY + pageX: (e as any).pageX, + pageY: (e as any).pageY }], e.timeStamp); mousedown = true; }, false); - document.addEventListener("mousemove", function (e) { + document.addEventListener("mousemove", e => { if (!mousedown) { return; } scroller.doTouchMove([{ - pageX: (e).pageX, - pageY: (e).pageY + pageX: (e as any).pageX, + pageY: (e as any).pageY }], e.timeStamp); mousedown = true; }, false); - document.addEventListener("mouseup", function (e) { + document.addEventListener("mouseup", e => { if (!mousedown) { return; } @@ -255,4 +289,4 @@ function test_domsnapping() { mousedown = false; }, false); } -} \ No newline at end of file +} diff --git a/types/scroller/tsconfig.json b/types/scroller/tsconfig.json index 5db383d25b..e0caa39d51 100644 --- a/types/scroller/tsconfig.json +++ b/types/scroller/tsconfig.json @@ -5,7 +5,7 @@ "es6", "dom" ], - "noImplicitAny": false, + "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, "strictFunctionTypes": true, diff --git a/types/scroller/tslint.json b/types/scroller/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/scroller/tslint.json +++ b/types/scroller/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } diff --git a/types/zynga-scroller/index.d.ts b/types/zynga-scroller/index.d.ts deleted file mode 100644 index 1ecf7e5f49..0000000000 --- a/types/zynga-scroller/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -// Type definitions for Zynga Scroller -// Project: http://zynga.github.com/scroller/ -// Definitions by: Marcelo Haskell Camargo -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare class Scroller { - constructor(a: (left: number, top: number, zoom: number) => void, b?: { - scrollingX?: boolean; - scrollingY?: boolean; - animating?: boolean; - animationDuration?: number; - bouncing?: boolean; - locking?: boolean; - paging?: boolean; - snapping?: boolean; - zooming?: number; - minZoom?: number; - maxZoom?: number - }); - setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, - contentHeight: number): void; - setPosition(clientLeft: number, clientTop: number): void; - setSnapSize(width: number, height: number): void; - activatePullToRefresh(height: number, activate: () => void, - deactivate: () => void, start: () => void): void; - finishPullToRefresh(): void; - getValues(): { - left: number; - top: number; - zoom: number - }; - zoomTo(level: number, animate?: boolean, originLeft?: number, - originTop?: number): void; - zoomBy(factor: number, animate?: boolean, originLeft?: number, - originTop?: number): void; - scrollTo(left: number, top: number, animate?: boolean): void; - scrollBy(leftOffset: number, topOffset: number, animate?: boolean): void; - doMouseZoom(wheelData: number, timeStamp: number, pageX: number, - pageY: number): void; - doTouchStart(touches: { - pageX: number; - pageY: number - }, timeStamp: number): void; - doTouchMove(touches: { - pageX: number; - pageY: number - }, timeStamp: number, scale?: number): void; - doTouchMove(touches: [any], timeStamp: number): void; - doTouchEnd(timeStamp: number): void; -} \ No newline at end of file diff --git a/types/zynga-scroller/tsconfig.json b/types/zynga-scroller/tsconfig.json deleted file mode 100644 index 94cb1cf919..0000000000 --- a/types/zynga-scroller/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "zynga-scroller-tests.ts" - ] -} \ No newline at end of file diff --git a/types/zynga-scroller/tslint.json b/types/zynga-scroller/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/zynga-scroller/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/zynga-scroller/zynga-scroller-tests.ts b/types/zynga-scroller/zynga-scroller-tests.ts deleted file mode 100644 index 61f6008a33..0000000000 --- a/types/zynga-scroller/zynga-scroller-tests.ts +++ /dev/null @@ -1,36 +0,0 @@ - - -var scroller: Scroller = new Scroller((left, top, zoom) => { }); -scroller = new Scroller((left, top, zoom) => { }, { - scrollingX: true, - scrollingY: true, - animating: true, - animationDuration: 400, - bouncing: false, - locking: false, - paging: false, - snapping: true, - zooming: 10, - minZoom: 1, - maxZoom: 2 -}); - -scroller.setDimensions(10, 10, 10, 10); -scroller.setPosition(200, 300); -scroller.setSnapSize(300, 300); -scroller.activatePullToRefresh(200, () => { }, () => { }, () => { }); -scroller.finishPullToRefresh(); -var data: { - left: number; - top: number; - zoom: number -} = scroller.getValues(); -scroller.zoomTo(10); -scroller.zoomBy(10); -scroller.doMouseZoom(10, 10, 10, 10); -scroller.doTouchStart({ - pageX: 10, - pageY: 20 -}, 200); -scroller.doTouchMove([10], 200); -scroller.doTouchEnd(300); \ No newline at end of file From cfe9e218310196b6609850a23f2587ffb8166b50 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 13:42:36 -0800 Subject: [PATCH 170/890] wnumb: Fix name and lint --- types/wnumb/index.d.ts | 150 ++++++++++++++++++------------------- types/wnumb/tslint.json | 80 +------------------- types/wnumb/wnumb-tests.ts | 21 ++---- 3 files changed, 78 insertions(+), 173 deletions(-) diff --git a/types/wnumb/index.d.ts b/types/wnumb/index.d.ts index 664942b20e..03fd0c81af 100644 --- a/types/wnumb/index.d.ts +++ b/types/wnumb/index.d.ts @@ -1,86 +1,78 @@ -// Type definitions for nouislider v1.0.0 +// Type definitions for wnumb 1.0 // Project: https://github.com/leongersen/wnumb // Definitions by: Corey Jepperson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare var wNumb: wNumb; -interface wNumbOptions { - /** - * decimals The number of decimals to include in the result. Limited to 7. - */ - decimals?: number; - /** - * The decimal separator. - * Defaults to '.' if thousand isn't already set to '.'. - */ - mark?: string; - /** - * Separator for large numbers. For example: ' ' would result in a formatted number of 1 000 000. - */ - thousand?: string; - /** - * A string to prepend to the number. Use cases include prefixing with money symbols such as '$' or '€'. - */ - prefix?: string; - /** - * A number to append to a number. For example: ',-'. - */ - postfix?: string; - /** - * The prefix for negative values. Defaults to '-' if negativeBefore isn't set. - */ - negative?: string; - /** - * The prefix for a negative number. Inserted before prefix. - */ - negativeBefore?: string; - /**This is a powerful option to manually modify the slider output. - * - *For example, to show a number in another currency: - * function( value ){ - * return value * 1.32; - * } - */ - encoder?: (value: number) => number; - /** - * Reverse the operations set in encoder. - * Use this option to undo modifications made while encoding the value. - * function( value ){ - * return value / 1.32; - * } - */ - decoder?: (value: number) => number; - /** - * Similar to encoder, but applied after all other formatting options are applied. - */ - edit?: (value: number) => number; - /** - * Similar to decoder and the reverse for edit. - * Applied before all other formatting options are applied. - */ - undo?: (value: number) => number; -} +/** + * Create a wNumb + */ +declare function wNumb(options?: wNumb.Options): wNumb.Instance; +declare namespace wNumb { + interface Options { + /** The number of decimals to include in the result. Limited to 7. */ + decimals?: number; + /** + * The decimal separator. + * Defaults to '.' if thousand isn't already set to '.'. + */ + mark?: string; + /** + * Separator for large numbers. For example: ' ' would result in a formatted number of 1 000 000. + */ + thousand?: string; + /** + * A string to prepend to the number. Use cases include prefixing with money symbols such as '$' or '€'. + */ + prefix?: string; + /** + * A number to append to a number. For example: ',-'. + */ + postfix?: string; + /** + * The prefix for negative values. Defaults to '-' if negativeBefore isn't set. + */ + negative?: string; + /** + * The prefix for a negative number. Inserted before prefix. + */ + negativeBefore?: string; + /** + * This is a powerful option to manually modify the slider output. + * + * For example, to show a number in another currency: + * function( value ){ + * return value * 1.32; + * } + */ + encoder?: (value: number) => number; + /** + * Reverse the operations set in encoder. + * Use this option to undo modifications made while encoding the value. + * function( value ){ + * return value / 1.32; + * } + */ + decoder?: (value: number) => number; + /** + * Similar to encoder, but applied after all other formatting options are applied. + */ + edit?: (value: number) => number; + /** + * Similar to decoder and the reverse for edit. + * Applied before all other formatting options are applied. + */ + undo?: (value: number) => number; + } -interface wNumb { - /** - * Create a wNumb - * - * @param options - the options - */ - (options?: wNumbOptions): wNumbInstance; -} - -interface wNumbInstance { - - - - /** - * format to string - */ - to(val: number): string; - /** - * get number from formatted string - */ - from(val: string): number; + interface Instance { + /** + * format to string + */ + to(val: number): string; + /** + * get number from formatted string + */ + from(val: string): number; + } } diff --git a/types/wnumb/tslint.json b/types/wnumb/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/wnumb/tslint.json +++ b/types/wnumb/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } diff --git a/types/wnumb/wnumb-tests.ts b/types/wnumb/wnumb-tests.ts index 31989e6127..be34fb98bb 100644 --- a/types/wnumb/wnumb-tests.ts +++ b/types/wnumb/wnumb-tests.ts @@ -1,18 +1,15 @@ - - - -var moneyFormat = wNumb({ +const moneyFormat = wNumb({ mark: '.', thousand: ',', prefix: '$ ', postfix: ' p.p.' }); -moneyFormat.to( 301980.62 ); +moneyFormat.to(301980.62); -moneyFormat.from( '$ 301,980.62 p.p.' ); +moneyFormat.from('$ 301,980.62 p.p.'); -var Format = wNumb({ +let Format = wNumb({ prefix: '$ ', decimals: 3, thousand: ',' @@ -20,12 +17,8 @@ var Format = wNumb({ Format = wNumb({ thousand: '.', - encoder: function( a ){ - return a * 1E7; - }, - decoder: function( a ){ - return a / 1E7; - } + encoder: a => a * 1E7, + decoder: a => a / 1E7, }); Format = wNumb({ @@ -34,9 +27,7 @@ Format = wNumb({ thousand: ',' }); - Format = wNumb({ prefix: '$', negativeBefore: '[NEGATIVE] ' }); - From f0c8d9463f49529856fe15baa87c90d213779974 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 13:44:33 -0800 Subject: [PATCH 171/890] deep-assign: Fix name and lint --- types/deep-assign/index.d.ts | 2 +- types/deep-assign/tslint.json | 80 +---------------------------------- 2 files changed, 2 insertions(+), 80 deletions(-) diff --git a/types/deep-assign/index.d.ts b/types/deep-assign/index.d.ts index 46d4cf09f2..e03eb76323 100644 --- a/types/deep-assign/index.d.ts +++ b/types/deep-assign/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for clone 0.1.11 +// Type definitions for deep-assign 0.1 // Project: https://github.com/sindresorhus/deep-assign // Definitions by: Ionut Costica // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/deep-assign/tslint.json b/types/deep-assign/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/deep-assign/tslint.json +++ b/types/deep-assign/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } From 468aaed260d81fb7e3879fc4a9a2c300df5d723c Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 14:04:09 -0800 Subject: [PATCH 172/890] deep-extend: Fix name and lint --- types/deep-extend/deep-extend-tests.ts | 11 ++-- types/deep-extend/index.d.ts | 7 +-- types/deep-extend/tsconfig.json | 2 +- types/deep-extend/tslint.json | 80 +------------------------- 4 files changed, 8 insertions(+), 92 deletions(-) diff --git a/types/deep-extend/deep-extend-tests.ts b/types/deep-extend/deep-extend-tests.ts index 7c909e74c8..f6db47b8d0 100644 --- a/types/deep-extend/deep-extend-tests.ts +++ b/types/deep-extend/deep-extend-tests.ts @@ -1,6 +1,5 @@ - import * as deepExtend from 'deep-extend'; -var obj1 = { +const obj1 = { a: 1, b: 2, d: { @@ -13,7 +12,7 @@ var obj1 = { i: 321, j: [1, 2] }; -var obj2 = { +const obj2 = { b: 3, c: 5, d: { @@ -22,14 +21,12 @@ var obj2 = { }, e: { one: 1, two: 2 }, f: [42], - g: function(){}, + g() {}, h: /abc/g, - i: null as {aaa: boolean}, + i: null, j: [3, 4] }; deepExtend(obj1, obj2); deepExtend(obj1, obj2, {ccc: 3}); deepExtend(obj1, obj2, {ccc: 3}, {ddd: 4}); - - diff --git a/types/deep-extend/index.d.ts b/types/deep-extend/index.d.ts index 8c03cb9d10..b3b183682f 100644 --- a/types/deep-extend/index.d.ts +++ b/types/deep-extend/index.d.ts @@ -1,12 +1,9 @@ -// Type definitions for open 0.4.1 +// Type definitions for deep-extend 0.4 // Project: https://github.com/unclechu/node-deep-extend // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/* - * Recursive object extending. - */ +/** Recursive object extending. */ declare function deepExtend(target: T, source: U): T & U; declare function deepExtend(target: T, source1: U, source2: V): T & U & V; declare function deepExtend(target: T, source1: U, source2: V, source3: W): T & U & V & W; diff --git a/types/deep-extend/tsconfig.json b/types/deep-extend/tsconfig.json index c41646d000..768b1ac92d 100644 --- a/types/deep-extend/tsconfig.json +++ b/types/deep-extend/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/deep-extend/tslint.json b/types/deep-extend/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/deep-extend/tslint.json +++ b/types/deep-extend/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } From e5c9eb26e0b6035681a0501dd16ed6ce1a3768c5 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 14:22:07 -0800 Subject: [PATCH 173/890] react-sortable-hoc: Fix name and lint --- types/react-sortable-hoc/index.d.ts | 146 +++++++++--------- .../react-sortable-hoc-tests.tsx | 16 +- types/react-sortable-hoc/tslint.json | 80 +--------- 3 files changed, 81 insertions(+), 161 deletions(-) diff --git a/types/react-sortable-hoc/index.d.ts b/types/react-sortable-hoc/index.d.ts index 767cf1405c..199156100e 100644 --- a/types/react-sortable-hoc/index.d.ts +++ b/types/react-sortable-hoc/index.d.ts @@ -1,83 +1,81 @@ -// Type definitions for nes 0.6.3 +// Type definitions for react-sortable-hoc 0.6 // Project: https://github.com/clauderic/react-sortable-hoc // Definitions by: Ivo Stratev , Charles Rey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -declare module 'react-sortable-hoc' { - import * as React from 'react'; +import * as React from 'react'; - export type Axis = 'x' | 'y' | 'xy'; +export type Axis = 'x' | 'y' | 'xy'; - export type Offset = number | string; +export type Offset = number | string; - export interface SortStart { - node: Element; - index: number; - collection: Offset; - } - - export type SortEvent = React.MouseEvent | React.TouchEvent; - - export type SortStartHandler = (sort: SortStart, event: SortEvent) => void; - - export type SortMoveHandler = (event: SortEvent) => void; - - export interface SortEnd { - oldIndex: number; - newIndex: number; - collection: Offset; - } - - export type SortEndHandler = (sort: SortEnd, event: SortEvent) => void; - - export type ContainerGetter = (element: React.ReactElement) => HTMLElement; - - export interface Dimensions { - width: number; - height: number; - } - - export interface SortableContainerProps { - axis?: Axis; - lockAxis?: Axis; - helperClass?: string; - transitionDuration?: number; - pressDelay?: number; - pressThreshold?: number; - distance?: number; - shouldCancelStart?: (event: SortEvent) => boolean; - onSortStart?: SortStartHandler; - onSortMove?: SortMoveHandler; - onSortEnd?: SortEndHandler; - useDragHandle?: boolean; - useWindowAsScrollContainer?: boolean; - hideSortableGhost?: boolean; - lockToContainerEdges?: boolean; - lockOffset?: Offset | [Offset, Offset]; - getContainer?: ContainerGetter; - getHelperDimensions?: (sort: SortStart) => Dimensions; - } - - export interface SortableElementProps { - index: number; - collection?: Offset; - disabled?: boolean; - } - - export interface Config { - withRef: boolean; - } - - export type WrappedComponentFactory

= (props: P) => JSX.Element; - - export type WrappedComponent

= React.ComponentClass

| WrappedComponentFactory

; - - export function SortableContainer

(wrappedComponent: WrappedComponent

, config?: Config): React.ComponentClass

; - - export function SortableElement

(wrappedComponent: WrappedComponent

, config?: Config): React.ComponentClass

; - - export function SortableHandle

(wrappedComponent: WrappedComponent

, config?: Config): React.ComponentClass

; - - export function arrayMove(collection: Array, previousIndex: number, newIndex: number): Array; +export interface SortStart { + node: Element; + index: number; + collection: Offset; } + +export type SortEvent = React.MouseEvent | React.TouchEvent; + +export type SortStartHandler = (sort: SortStart, event: SortEvent) => void; + +export type SortMoveHandler = (event: SortEvent) => void; + +export interface SortEnd { + oldIndex: number; + newIndex: number; + collection: Offset; +} + +export type SortEndHandler = (sort: SortEnd, event: SortEvent) => void; + +export type ContainerGetter = (element: React.ReactElement) => HTMLElement; + +export interface Dimensions { + width: number; + height: number; +} + +export interface SortableContainerProps { + axis?: Axis; + lockAxis?: Axis; + helperClass?: string; + transitionDuration?: number; + pressDelay?: number; + pressThreshold?: number; + distance?: number; + shouldCancelStart?: (event: SortEvent) => boolean; + onSortStart?: SortStartHandler; + onSortMove?: SortMoveHandler; + onSortEnd?: SortEndHandler; + useDragHandle?: boolean; + useWindowAsScrollContainer?: boolean; + hideSortableGhost?: boolean; + lockToContainerEdges?: boolean; + lockOffset?: Offset | [Offset, Offset]; + getContainer?: ContainerGetter; + getHelperDimensions?: (sort: SortStart) => Dimensions; +} + +export interface SortableElementProps { + index: number; + collection?: Offset; + disabled?: boolean; +} + +export interface Config { + withRef: boolean; +} + +export type WrappedComponentFactory

= (props: P) => JSX.Element; + +export type WrappedComponent

= React.ComponentClass

| WrappedComponentFactory

; + +export function SortableContainer

(wrappedComponent: WrappedComponent

, config?: Config): React.ComponentClass

; + +export function SortableElement

(wrappedComponent: WrappedComponent

, config?: Config): React.ComponentClass

; + +export function SortableHandle

(wrappedComponent: WrappedComponent

, config?: Config): React.ComponentClass

; + +export function arrayMove(collection: T[], previousIndex: number, newIndex: number): T[]; diff --git a/types/react-sortable-hoc/react-sortable-hoc-tests.tsx b/types/react-sortable-hoc/react-sortable-hoc-tests.tsx index db08db3e0e..1d3b3d5da7 100644 --- a/types/react-sortable-hoc/react-sortable-hoc-tests.tsx +++ b/types/react-sortable-hoc/react-sortable-hoc-tests.tsx @@ -7,18 +7,18 @@ interface SortableItemProps { } interface SortableListProps { - items: Array; - axis: 'x' | 'y' | 'xy' + items: string[]; + axis: 'x' | 'y' | 'xy'; } type SortableComponentState = SortableListProps; class Item extends React.Component { - public constructor(props: SortableItemProps) { + constructor(props: SortableItemProps) { super(props); } - public render(): JSX.Element { + render(): JSX.Element { return

  • {this.props.value}
  • ; } } @@ -26,7 +26,7 @@ class Item extends React.Component { const SortableItem = ReactSortableHOC.SortableElement(Item); const SortableList = ReactSortableHOC.SortableContainer((props: SortableListProps): JSX.Element => { - const items: Array = props.items.map((value: string, index: number): JSX.Element => { + const items: JSX.Element[] = props.items.map((value: string, index: number): JSX.Element => { return ; }); return
      {items}
    ; @@ -49,7 +49,7 @@ class SortableComponent extends React.Component<{}, SortableComponentState> { return {width: 0, height: 0}; } - public constructor() { + constructor() { super({}); this.state = { items: ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6'], @@ -58,7 +58,7 @@ class SortableComponent extends React.Component<{}, SortableComponentState> { this._onSortEnd = this._handleSortEnd.bind(this); } - public render(): JSX.Element { + render(): JSX.Element { return { } } -let bootstrapNode: HTMLDivElement = document.createElement('div'); +const bootstrapNode: HTMLDivElement = document.createElement('div'); ReactDOM.render(, bootstrapNode); document.body.appendChild(bootstrapNode); diff --git a/types/react-sortable-hoc/tslint.json b/types/react-sortable-hoc/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/react-sortable-hoc/tslint.json +++ b/types/react-sortable-hoc/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } From 48d44c8035add8df5ff86f2be76e0479aa288579 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 14:34:54 -0800 Subject: [PATCH 174/890] csrf: Fix name --- types/csrf/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/csrf/index.d.ts b/types/csrf/index.d.ts index d6c3b69006..27e1c7929c 100644 --- a/types/csrf/index.d.ts +++ b/types/csrf/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for b_ 1.3 +// Type definitions for csrf 1.3 // Project: https://github.com/pillarjs/csrf // Definitions by: Markis Taylor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 32212ee6349a1db9c8a4520aa09686517b88c306 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 14:39:59 -0800 Subject: [PATCH 175/890] hystrixjs: Fix name and lint --- types/hystrixjs/hystrixjs-tests.ts | 24 ++++---- types/hystrixjs/index.d.ts | 97 +++++++++++++++--------------- types/hystrixjs/tslint.json | 76 +---------------------- 3 files changed, 62 insertions(+), 135 deletions(-) diff --git a/types/hystrixjs/hystrixjs-tests.ts b/types/hystrixjs/hystrixjs-tests.ts index 7ed7819fb7..72c709068d 100644 --- a/types/hystrixjs/hystrixjs-tests.ts +++ b/types/hystrixjs/hystrixjs-tests.ts @@ -1,9 +1,9 @@ import hystrixjs = require('hystrixjs'); import q = require('q'); -var commandFactory = hystrixjs.commandFactory; +const commandFactory = hystrixjs.commandFactory; -var command = commandFactory +const command = commandFactory .getOrCreate('testCommand', 'testGroup') .circuitBreakerSleepWindowInMilliseconds(5000) .errorHandler((error) => { @@ -29,16 +29,16 @@ var command = commandFactory command.execute('something').then((result) => { console.log(result); -}) +}); commandFactory.resetCache(); -var metricsFactory = hystrixjs.metricsFactory; +const metricsFactory = hystrixjs.metricsFactory; -var metrics = metricsFactory.getOrCreate({ +const metrics = metricsFactory.getOrCreate({ commandKey: 'metricsKey', commandGroup: 'metricsGroup' -}) +}); metrics.markSuccess(); metrics.markFailure(); metrics.markRejected(); @@ -48,7 +48,7 @@ metrics.decrementExecutionCount(); metrics.getCurrentExecutionCount(); metrics.addExecutionTime(3000); metrics.getRollingCount("FAILURE"); -var healthcounts = metrics.getHealthCounts(); +const healthcounts = metrics.getHealthCounts(); console.log(healthcounts.totalCount); console.log(healthcounts.errorCount); console.log(healthcounts.errorPercentage); @@ -59,7 +59,7 @@ metricsFactory.getAllMetrics().map((metrics) => { console.log(metrics.getCurrentExecutionCount()); }); -var hystrixConfig = hystrixjs.hystrixConfig; +const hystrixConfig = hystrixjs.hystrixConfig; console.log(hystrixConfig.metricsPercentileWindowBuckets()); console.log(hystrixConfig.circuitBreakerForceClosed()); console.log(hystrixConfig.circuitBreakerForceOpened()); @@ -73,11 +73,11 @@ console.log(hystrixConfig.metricsStatisticalWindowBuckets()); console.log(hystrixConfig.metricsStatisticalWindowInMilliseconds()); console.log(hystrixConfig.metricsPercentileWindowInMilliseconds()); console.log(hystrixConfig.requestVolumeRejectionThreshold()); -console.log(hystrixConfig.resetProperties()); -console.log(hystrixConfig.init({})); +hystrixConfig.resetProperties(); +hystrixConfig.init({}); -var hystrixSSEStream = hystrixjs.hystrixSSEStream; +const hystrixSSEStream = hystrixjs.hystrixSSEStream; hystrixSSEStream.toObservable().subscribe((result) => { console.log(result); -}) +}); diff --git a/types/hystrixjs/index.d.ts b/types/hystrixjs/index.d.ts index b49cd40ba4..d3ee7bb416 100644 --- a/types/hystrixjs/index.d.ts +++ b/types/hystrixjs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for dragula v2.1.2 +// Type definitions for hystrixjs 0.2 // Project: https://bitbucket.org/igor_sechyn/hystrixjs // Definitions by: Igor Sechyn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -10,20 +10,20 @@ export as namespace hystrixjs; export as namespace HystrixJS; export interface HystrixProperties { - "hystrix.force.circuit.open"?: boolean, - "hystrix.force.circuit.closed"?: boolean, - "hystrix.circuit.sleepWindowInMilliseconds"?: number, - "hystrix.circuit.errorThresholdPercentage"?: number, - "hystrix.circuit.volumeThreshold"?: number, - "hystrix.circuit.volumeThreshold.forceOverride"?: boolean, - "hystrix.circuit.volumeThreshold.override"?: number, - "hystrix.execution.timeoutInMilliseconds"?: number, - "hystrix.metrics.statistical.window.timeInMilliseconds"?: number, - "hystrix.metrics.statistical.window.bucketsNumber"?: number, - "hystrix.metrics.percentile.window.timeInMilliseconds"?: number, - "hystrix.metrics.percentile.window.bucketsNumber"?: number, - "hystrix.request.volume.rejectionThreshold"?: number, - "hystrix.promise.implementation"?: PromiseConstructorLike, + "hystrix.force.circuit.open"?: boolean; + "hystrix.force.circuit.closed"?: boolean; + "hystrix.circuit.sleepWindowInMilliseconds"?: number; + "hystrix.circuit.errorThresholdPercentage"?: number; + "hystrix.circuit.volumeThreshold"?: number; + "hystrix.circuit.volumeThreshold.forceOverride"?: boolean; + "hystrix.circuit.volumeThreshold.override"?: number; + "hystrix.execution.timeoutInMilliseconds"?: number; + "hystrix.metrics.statistical.window.timeInMilliseconds"?: number; + "hystrix.metrics.statistical.window.bucketsNumber"?: number; + "hystrix.metrics.percentile.window.timeInMilliseconds"?: number; + "hystrix.metrics.percentile.window.bucketsNumber"?: number; + "hystrix.request.volume.rejectionThreshold"?: number; + "hystrix.promise.implementation"?: PromiseConstructorLike; } export interface HystrixConfig { @@ -39,46 +39,45 @@ export interface HystrixConfig { metricsStatisticalWindowBuckets(): number; metricsStatisticalWindowInMilliseconds(): number; metricsPercentileWindowInMilliseconds(): number; - metricsPercentileWindowBuckets(): number; requestVolumeRejectionThreshold(): number; resetProperties(): void; init(properties: HystrixProperties): void; } export interface Command { - execute(...args: any[]): PromiseLike + execute(...args: any[]): PromiseLike; } export interface CommandA0 { - execute(): PromiseLike + execute(): PromiseLike; } export interface CommandA1 { - execute(t: T): PromiseLike + execute(t: T): PromiseLike; } export interface CommandA2 { - execute(t: T, u: U): PromiseLike + execute(t: T, u: U): PromiseLike; } export interface CommandA3 { - execute(t: T, u: U, v: V): PromiseLike + execute(t: T, u: U, v: V): PromiseLike; } export interface CommandA4 { - execute(t: T, u: U, v: V, w: W): PromiseLike + execute(t: T, u: U, v: V, w: W): PromiseLike; } export interface CommandA5 { - execute(t: T, u: U, v: V, w: W, x: X): PromiseLike + execute(t: T, u: U, v: V, w: W, x: X): PromiseLike; } export interface CommandA6 { - execute(t: T, u: U, v: V, w: W, x: X, y: Y): PromiseLike + execute(t: T, u: U, v: V, w: W, x: X, y: Y): PromiseLike; } export interface CommandA7 { - execute(t: T, u: U, v: V, w: W, x: X, y: Y, z: Z): PromiseLike + execute(t: T, u: U, v: V, w: W, x: X, y: Y, z: Z): PromiseLike; } export interface CommandBuilder { @@ -97,7 +96,7 @@ export interface CommandBuilder { context(value: any): CommandBuilder; run(value: (...args: any[]) => PromiseLike): CommandBuilder; fallbackTo(value: (error: Error, args ?: any[]) => PromiseLike): CommandBuilder; - build() : Command; + build(): Command; } export interface CommandBuilderA0 { @@ -116,7 +115,7 @@ export interface CommandBuilderA0 { context(value: any): CommandBuilderA0; run(value: () => PromiseLike): CommandBuilderA0; fallbackTo(value: (error: Error) => PromiseLike): CommandBuilderA0; - build() : CommandA0; + build(): CommandA0; } export interface CommandBuilderA1 { @@ -134,7 +133,7 @@ export interface CommandBuilderA1 { circuitBreakerErrorThresholdPercentage(value: number): CommandBuilderA1; context(value: any): CommandBuilderA1; run(value: (t: T) => PromiseLike): CommandBuilderA1; - fallbackTo(value: (error: Error, args : [T]) => PromiseLike): CommandBuilderA1; + fallbackTo(value: (error: Error, args: [T]) => PromiseLike): CommandBuilderA1; build(): CommandA1; } @@ -288,28 +287,28 @@ export interface CommandMetrics { } export interface MetricsProperties { - commandKey: string, - commandGroup: string, - statisticalWindowTimeInMilliSeconds?: number, - statisticalWindowNumberOfBuckets?: number, - percentileWindowTimeInMilliSeconds?: number, - percentileWindowNumberOfBuckets?: number + commandKey: string; + commandGroup: string; + statisticalWindowTimeInMilliSeconds?: number; + statisticalWindowNumberOfBuckets?: number; + percentileWindowTimeInMilliSeconds?: number; + percentileWindowNumberOfBuckets?: number; } export interface MetricsFactory { getOrCreate(config: MetricsProperties): CommandMetrics; resetCache(): void; - getAllMetrics(): Array; + getAllMetrics(): CommandMetrics[]; } export interface CirctuiBreakerConfig { - circuitBreakerSleepWindowInMilliseconds: number, - commandKey: string, - circuitBreakerErrorThresholdPercentage: number, - circuitBreakerRequestVolumeThreshold: number, - commandGroup: string, - circuitBreakerForceClosed: boolean, - circuitBreakerForceOpened: boolean + circuitBreakerSleepWindowInMilliseconds: number; + commandKey: string; + circuitBreakerErrorThresholdPercentage: number; + circuitBreakerRequestVolumeThreshold: number; + commandGroup: string; + circuitBreakerForceClosed: boolean; + circuitBreakerForceOpened: boolean; } export interface CircuitBreaker { @@ -321,16 +320,16 @@ export interface CircuitBreaker { export interface CircuitFactory { getOrCreate(config: CirctuiBreakerConfig): CircuitBreaker; - getCache(): Array; + getCache(): CircuitBreaker[]; resetCache(): void; } export interface HystrixSSEStream { - toObservable(): Rx.Observable + toObservable(): Rx.Observable; } -export var commandFactory: CommandFactory; -export var metricsFactory: MetricsFactory; -export var circuitFactory: CircuitFactory; -export var hystrixSSEStream: HystrixSSEStream; -export var hystrixConfig: HystrixConfig; +export const commandFactory: CommandFactory; +export const metricsFactory: MetricsFactory; +export const circuitFactory: CircuitFactory; +export const hystrixSSEStream: HystrixSSEStream; +export const hystrixConfig: HystrixConfig; diff --git a/types/hystrixjs/tslint.json b/types/hystrixjs/tslint.json index a41bf5d19a..3fc34b8203 100644 --- a/types/hystrixjs/tslint.json +++ b/types/hystrixjs/tslint.json @@ -1,79 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + // TODO + "no-unnecessary-generics": false } } From b710efd71c36261207ac2ea65c5ed25f0a137cd9 Mon Sep 17 00:00:00 2001 From: Tate Date: Thu, 21 Dec 2017 14:40:57 -0800 Subject: [PATCH 176/890] Throng improvements - Relax workers value to be a string or number. The library handles both, and this value is frequently supplied as an ENV. - Relax master in config object to be optional --- types/throng/index.d.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/types/throng/index.d.ts b/types/throng/index.d.ts index 76a64932db..f962ce1ca9 100644 --- a/types/throng/index.d.ts +++ b/types/throng/index.d.ts @@ -1,18 +1,21 @@ // Type definitions for throng 4.0 // Project: https://github.com/hunterloftis/throng // Definitions by: Cyril Schumacher +// Tate Thurston // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function throng(options: throng.WorkerCallback | throng.Options | number, startFunction?: throng.WorkerCallback): void; +declare function throng(startOrOptions: throng.ProcessCallback | throng.Options): void; +declare function throng(workers: throng.WorkerCount, start: throng.ProcessCallback): void; declare namespace throng { - type WorkerCallback = (id: number) => void; + type WorkerCount = number | string; + type ProcessCallback = (id: number) => any; interface Options { grace?: number; lifetime?: number; - master(): void; - start: WorkerCallback; - workers: number; + master?: ProcessCallback; + start: ProcessCallback; + workers?: WorkerCount; } } From b7f594330daf03b9891298debe9ec635250ee628 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 14:46:02 -0800 Subject: [PATCH 177/890] leaflet-gpx: Fix name --- types/leaflet-gpx/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/leaflet-gpx/index.d.ts b/types/leaflet-gpx/index.d.ts index 7eac361403..1071ef7b2f 100644 --- a/types/leaflet-gpx/index.d.ts +++ b/types/leaflet-gpx/index.d.ts @@ -1,5 +1,5 @@ -// Type definitions for leaflet-polylinedecorator 1.1 -// Project: https://github.com/bbecquet/Leaflet.PolylineDecorator#readme +// Type definitions for leaflet-gpx 1.1 +// Project: https://github.com/mpetazzoni/leaflet-gpx // Definitions by: Viktor Soucek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 5176ece26443dcd298ff86c8b756a7254ecd258c Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 15:09:00 -0800 Subject: [PATCH 178/890] Remove 'atmosphere' in favor of 'atmosphere.js' --- types/atmosphere/atmosphere-tests.ts | 46 ----------- types/atmosphere/index.d.ts | 110 --------------------------- types/atmosphere/tsconfig.json | 24 ------ types/atmosphere/tslint.json | 79 ------------------- 4 files changed, 259 deletions(-) delete mode 100644 types/atmosphere/atmosphere-tests.ts delete mode 100644 types/atmosphere/index.d.ts delete mode 100644 types/atmosphere/tsconfig.json delete mode 100644 types/atmosphere/tslint.json diff --git a/types/atmosphere/atmosphere-tests.ts b/types/atmosphere/atmosphere-tests.ts deleted file mode 100644 index b353c2c947..0000000000 --- a/types/atmosphere/atmosphere-tests.ts +++ /dev/null @@ -1,46 +0,0 @@ - - -var socket = atmosphere; - -var request1:Atmosphere.Request = new atmosphere.AtmosphereRequest(); - -request1.url = document.location.toString() + 'chat'; -request1.contentType = "application/json"; -request1.transport = 'websocket'; -request1.fallbackTransport = 'long-polling'; - -var request2:Atmosphere.Request = { - url: 'http://localhost:8080/chat', - contentType: "application/json", - logLevel: 'debug', - transport: 'websocket', - fallbackTransport: 'long-polling' -}; - -request1.onError = function (response?:Atmosphere.Response) {}; -request1.onClose = function (response?:Atmosphere.Response) {}; -request1.onOpen = function (response?:Atmosphere.Response) {}; -request1.onMessage = function (response:Atmosphere.Response) {}; -request1.onReopen = function (request?:Atmosphere.Request, response?:Atmosphere.Response) {}; -request1.onReconnect = function (request?:Atmosphere.Request, response?:Atmosphere.Response) {}; -request1.onMessagePublished = function (response?:Atmosphere.Response) {}; -request1.onTransportFailure = function (reason?:string, response?:Atmosphere.Response) {}; -request1.onLocalMessage = function (request?:Atmosphere.Request) {}; -request1.onFailureToReconnect = function (request?:Atmosphere.Request, response?:Atmosphere.Response) {}; -request1.onClientTimeout = function (request?:Atmosphere.Request) {}; - -request1.subscribe = function (options:Atmosphere.Request) {}; -request1.execute = function () {}; -request1.close = function () {}; -request1.disconnect = function () {}; -request1.getUrl = function ():string { return "http://www.toedter.com" }; -request1.push = function (message:string, dispatchUrl?:string) {}; -request1.getUUID = function () {}; -request1.pushLocal = function (message:string) {}; - -var subSocket:Atmosphere.Request = socket.subscribe(request1); -var subSocket2:Atmosphere.Request = socket.subscribe('http://chat.com', function() {}, request2); -subSocket2.close(); - -subSocket.push("test"); -socket.unsubscribe(); \ No newline at end of file diff --git a/types/atmosphere/index.d.ts b/types/atmosphere/index.d.ts deleted file mode 100644 index 7b5565cb1d..0000000000 --- a/types/atmosphere/index.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -// Type definitions for Atmosphere v2.1.5 -// Project: https://github.com/Atmosphere/atmosphere-javascript -// Definitions by: Kai Toedter -// Fedor Kirpichev -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// This is deprecated due to module name change. Please use 'atmosphere.js' for future development.. - -declare namespace Atmosphere { - interface Atmosphere { - /** - * The atmosphere API is a little bit special here: the first parameter can either be - * a URL string or a Request object. If it is a URL string, then the additional parameters are expected. - */ - subscribe?: (requestOrUrl:any, callback?:Function, request?:Request) => Request; - unsubscribe?: () => void; - - AtmosphereRequest?: AtmosphereRequest; - } - - // needed to fit JavaScript "new atmosphere.AtmosphereRequest()" - // and compile with --noImplicitAny - interface AtmosphereRequest { - new(): Request; - } - - interface Request { - timeout?: number; - method?: string; - headers?: any; - contentType?: string; - callback?: Function; - url?: string; - data?: string; - suspend?: boolean; - maxRequest?: number; - reconnect?: boolean; - maxStreamingLength?: number; - lastIndex?: number; - logLevel?: string; - requestCount?: number; - fallbackMethod?: string; - fallbackTransport?: string; - transport?: string; - webSocketImpl?: any; - webSocketBinaryType?: any; - dispatchUrl?: string; - webSocketPathDelimiter?: string; - enableXDR?: boolean; - rewriteURL?: boolean; - attachHeadersAsQueryString?: boolean; - executeCallbackBeforeReconnect?: boolean; - readyState?: number; - lastTimestamp?: number; - withCredentials?: boolean; - trackMessageLength?: boolean; - messageDelimiter?: string; - connectTimeout?: number; - reconnectInterval?: number; - dropHeaders?: boolean; - uuid?: string; - async?: boolean; - shared?: boolean; - readResponsesHeaders?: boolean; - maxReconnectOnClose?: number; - enableProtocol?: boolean; - pollingInterval?: number; - - onError?: (response?:Response) => void; - onClose?: (response?:Response) => void; - onOpen?: (response?:Response) => void; - onMessage?: (response:Response) => void; - onReopen?: (request?:Request, response?:Response) => void; - onReconnect?: (request?:Request, response?:Response) => void; - onMessagePublished?: (response?:Response) => void; - onTransportFailure?: (reason?:string, response?:Response) => void; - onLocalMessage?: (request?:Request) => void; - onFailureToReconnect?: (request?:Request, response?:Response) => void; - onClientTimeout?: (request?:Request) => void; - - subscribe?: (options:Request) => void; - execute?: () => void; - close?: () => void; - disconnect?: () => void; - getUrl?: () => string; - push?: (message:string, dispatchUrl?:string) => void; - getUUID?: () => void; - pushLocal?: (message:string) => void; - } - - interface Response { - status?: number; - reasonPhrase?: string; - responseBody?: string; - messages?: string[]; - headers?: string[]; - state?: string; - transport?: string; - error?: string; - request?: Request; - partialMessage?: string; - errorHandled?: boolean; - closedByClientTimeout?: boolean; - } -} - -declare var atmosphere:Atmosphere.Atmosphere; -declare module 'atmosphere' { - export = atmosphere; -} diff --git a/types/atmosphere/tsconfig.json b/types/atmosphere/tsconfig.json deleted file mode 100644 index 2fb820bd91..0000000000 --- a/types/atmosphere/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "atmosphere-tests.ts" - ] -} \ No newline at end of file diff --git a/types/atmosphere/tslint.json b/types/atmosphere/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/atmosphere/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 2690b9c7c835a12ccbfc76b51ad4fefe3e608d41 Mon Sep 17 00:00:00 2001 From: El Youssoufi Naoufal Date: Thu, 21 Dec 2017 23:15:30 +0000 Subject: [PATCH 179/890] react-native: adding visible-password keyboardType --- types/react-native/index.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index a1634eac57..2dd574507c 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -5,6 +5,7 @@ // Kyle Roach // Tim Wang // Kamal Mahyuddin +// Naoufal El Yousfi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -1045,6 +1046,7 @@ export type KeyboardTypeIOS = | "decimal-pad" | "twitter" | "web-search"; +export type KeyboardTypeAndroid = "visible-password"; export type ReturnKeyType = "done" | "go" | "next" | "search" | "send"; export type ReturnKeyTypeAndroid = "none" | "previous"; @@ -1097,11 +1099,13 @@ export interface TextInputProperties editable?: boolean; /** - * enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad', 'decimal-pad', 'twitter', 'web-search') + * enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad', 'decimal-pad', 'twitter', 'web-search', 'visible-password') * Determines which keyboard to open, e.g.numeric. * The following values work across platforms: - default - numeric - email-address - phone-pad + * The following values work on iOS: - ascii-capable - numbers-and-punctuation - url - number-pad - name-phone-pad - decimal-pad - twitter - web-search + * The following values work on Android: - visible-password */ - keyboardType?: KeyboardType | KeyboardTypeIOS; + keyboardType?: KeyboardType | KeyboardTypeIOS | KeyboardTypeAndroid; /** * Limits the maximum number of characters that can be entered. From 918887a965baaf5cd7e5efe373b0eeac9a77a85c Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 15:16:45 -0800 Subject: [PATCH 180/890] Merge duplicate 'grecaptcha' and 'recaptcha' types --- .../v0/grecaptcha-tests.ts} | 0 types/{recaptcha => grecaptcha/v0}/index.d.ts | 0 types/{recaptcha => grecaptcha/v0}/tsconfig.json | 11 ++++++++--- types/{recaptcha => grecaptcha/v0}/tslint.json | 0 4 files changed, 8 insertions(+), 3 deletions(-) rename types/{recaptcha/recaptcha-tests.ts => grecaptcha/v0/grecaptcha-tests.ts} (100%) rename types/{recaptcha => grecaptcha/v0}/index.d.ts (100%) rename types/{recaptcha => grecaptcha/v0}/tsconfig.json (69%) rename types/{recaptcha => grecaptcha/v0}/tslint.json (100%) diff --git a/types/recaptcha/recaptcha-tests.ts b/types/grecaptcha/v0/grecaptcha-tests.ts similarity index 100% rename from types/recaptcha/recaptcha-tests.ts rename to types/grecaptcha/v0/grecaptcha-tests.ts diff --git a/types/recaptcha/index.d.ts b/types/grecaptcha/v0/index.d.ts similarity index 100% rename from types/recaptcha/index.d.ts rename to types/grecaptcha/v0/index.d.ts diff --git a/types/recaptcha/tsconfig.json b/types/grecaptcha/v0/tsconfig.json similarity index 69% rename from types/recaptcha/tsconfig.json rename to types/grecaptcha/v0/tsconfig.json index 3fb78fba81..b75ce228e8 100644 --- a/types/recaptcha/tsconfig.json +++ b/types/grecaptcha/v0/tsconfig.json @@ -8,16 +8,21 @@ "noImplicitThis": true, "strictNullChecks": false, "strictFunctionTypes": true, - "baseUrl": "../", + "baseUrl": "../../", "typeRoots": [ - "../" + "../../" ], "types": [], + "paths": { + "grecaptcha": [ + "grecaptcha/v0" + ] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "recaptcha-tests.ts" + "grecaptcha-tests.ts" ] } \ No newline at end of file diff --git a/types/recaptcha/tslint.json b/types/grecaptcha/v0/tslint.json similarity index 100% rename from types/recaptcha/tslint.json rename to types/grecaptcha/v0/tslint.json From f2ca1cdbf663150b14137395b47035823bf83c67 Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 22 Dec 2017 00:36:58 +0100 Subject: [PATCH 181/890] Add owasp-password-strength-test --- types/owasp-password-strength-test/index.d.ts | 73 +++++++++++++++++++ .../owasp-password-strength-test-tests.ts | 18 +++++ .../tsconfig.json | 23 ++++++ .../owasp-password-strength-test/tslint.json | 1 + 4 files changed, 115 insertions(+) create mode 100644 types/owasp-password-strength-test/index.d.ts create mode 100644 types/owasp-password-strength-test/owasp-password-strength-test-tests.ts create mode 100644 types/owasp-password-strength-test/tsconfig.json create mode 100644 types/owasp-password-strength-test/tslint.json diff --git a/types/owasp-password-strength-test/index.d.ts b/types/owasp-password-strength-test/index.d.ts new file mode 100644 index 0000000000..c12a93ed82 --- /dev/null +++ b/types/owasp-password-strength-test/index.d.ts @@ -0,0 +1,73 @@ +// Type definitions for owasp-password-strength-test 1.3 +// Project: https://github.com/nowsecure/owasp-password-strength-test +// Definitions by: Stephan Troyer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export as namespace owaspPasswordStrengthTest; + +export interface PasswordTestResult { + /** error messages associated with the failed tests */ + errors: string[]; + /** enumerates which tests have failed, beginning from 0 with the first required test */ + failedTests: number[]; + /** enumerates which tests have succeeded, beginning from 0 with the first required test */ + passedTests: number[]; + /** error messages of required tests that have failed */ + requiredTestErrors: string[]; + /** error messages of optional tests that have failed */ + optionalTestErrors: string[]; + /** indicates whether or not the password was considered to be a passphrase */ + isPassphrase: boolean; + /** indicates whether or not the user's password satisfied the strength requirements */ + strong: boolean; + /** + * indicates how many of the optional tests were passed; + * In order for the password to be considered "strong", it (by default) must either be a passphrase, + * or must pass a number of optional tests that is equal to or greater than configs.minOptionalTestsToPass + */ + optionalTestsPassed: number; +} +export interface PasswordTestConfiguration { + /** + * toggles the "passphrase" mechanism on and off; + * If set to false, the strength-checker will abandon the notion of "passphrases", + * and will subject all passwords to the same complexity requirements. + */ + allowPassphrases?: boolean; + /** constraint on a password's maximum length */ + maxLength?: number; + /** constraint on a password's minimum length */ + minLength?: number; + /** + * minimum length a password needs to achieve in order to be considered a "passphrase" + * (and thus exempted from the optional complexity tests by default) + */ + minPhraseLength?: number; + /** + * minimum number of optional tests that a password must pass in order to be considered "strong"; + * By default (per the OWASP guidelines), four optional complexity tests are made, + * and a password must pass at least three of them in order to be considered "strong" + */ + minOptionalTestsToPass?: number; + + // // to add support for https://github.com/nowsecure/owasp-password-strength-test/pull/5 + // /** + // * toggles the i18n error keys in place of english error messages. + // * This can be useful when translating the errors using a 3rd party i18n library. + // * When true the following keys can be returned: + // * `failedMinLength`, `failedMaxLength`, `failedThreeRepeatedChars`, `optionalLowercaseRequired`, `optionalUppercaseRequired`, `optionalNumberRequired` and `optionalSpecialCharRequired`. + // */ + // i18nErrorKeys?: boolean; +} + +export type PasswordTest = (password: string) => string | undefined; + +export function test(password: string): PasswordTestResult; +export function config(configuration: PasswordTestConfiguration): void; + +export let tests: { + required: PasswordTest[]; + optional: PasswordTest[]; +}; +export const configs: Readonly; diff --git a/types/owasp-password-strength-test/owasp-password-strength-test-tests.ts b/types/owasp-password-strength-test/owasp-password-strength-test-tests.ts new file mode 100644 index 0000000000..0cdd336a20 --- /dev/null +++ b/types/owasp-password-strength-test/owasp-password-strength-test-tests.ts @@ -0,0 +1,18 @@ +import * as owasp from 'owasp-password-strength-test'; + +owasp.config({ + allowPassphrases: true, + maxLength: 128, + minLength: 10, + minPhraseLength: 20, + minOptionalTestsToPass: 4, +}); + +owasp.tests.required.push(password => { + if (password === 'one two three four five') { + return "That's the kind of thing an idiot would have on his luggage!"; + } +}); + +const result = owasp.test('correct horse battery staple'); +result.errors.length; diff --git a/types/owasp-password-strength-test/tsconfig.json b/types/owasp-password-strength-test/tsconfig.json new file mode 100644 index 0000000000..0206d30034 --- /dev/null +++ b/types/owasp-password-strength-test/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "owasp-password-strength-test-tests.ts" + ] +} diff --git a/types/owasp-password-strength-test/tslint.json b/types/owasp-password-strength-test/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/owasp-password-strength-test/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 9a204103dbd7f3d9bbe85076b6d9d8f0ca55b1db Mon Sep 17 00:00:00 2001 From: El Youssoufi Naoufal Date: Thu, 21 Dec 2017 23:45:12 +0000 Subject: [PATCH 182/890] Fixing lint --- types/react-native/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 2dd574507c..362cd41478 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1099,7 +1099,8 @@ export interface TextInputProperties editable?: boolean; /** - * enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad', 'decimal-pad', 'twitter', 'web-search', 'visible-password') + * enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad', + * 'decimal-pad', 'twitter', 'web-search', 'visible-password') * Determines which keyboard to open, e.g.numeric. * The following values work across platforms: - default - numeric - email-address - phone-pad * The following values work on iOS: - ascii-capable - numbers-and-punctuation - url - number-pad - name-phone-pad - decimal-pad - twitter - web-search From 85d5b85df01011fb0b329d28e4567fb9b7de0074 Mon Sep 17 00:00:00 2001 From: El Youssoufi Naoufal Date: Thu, 21 Dec 2017 23:50:25 +0000 Subject: [PATCH 183/890] Fixing lint --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 362cd41478..c6e683ebd4 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1099,7 +1099,7 @@ export interface TextInputProperties editable?: boolean; /** - * enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad', + * enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad', * 'decimal-pad', 'twitter', 'web-search', 'visible-password') * Determines which keyboard to open, e.g.numeric. * The following values work across platforms: - default - numeric - email-address - phone-pad From c57d03a6808965863fc3ea156b36f09839778d7f Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Fri, 22 Dec 2017 11:29:24 +0800 Subject: [PATCH 184/890] remove the mirror --- notNeededPackages.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/notNeededPackages.json b/notNeededPackages.json index 286e340606..7541a88848 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -839,12 +839,6 @@ "typingsPackageName": "zone.js", "sourceRepoURL": "https://github.com/angular/zone.js", "asOfVersion": "0.5.12" - }, - { - "libraryName": "mirror", - "typingsPackageName": "mirrorx", - "sourceRepoURL": "https://github.com/mirrorjs/mirror", - "asOfVersion": "0.2.10" } ] } From 15eda67c8b77e2e73c16f5020fef582181fee12f Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Fri, 22 Dec 2017 12:36:37 +0700 Subject: [PATCH 185/890] [screeps] update to version 2.1.0 --- types/screeps/index.d.ts | 8 ++++---- types/screeps/tsconfig.json | 3 +-- types/screeps/tslint.json | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/types/screeps/index.d.ts b/types/screeps/index.d.ts index 4b8f0f76f6..145c240b39 100644 --- a/types/screeps/index.d.ts +++ b/types/screeps/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Screeps +// Type definitions for Screeps 2.1 // Project: https://github.com/screeps/screeps // Definitions by: Marko Sulamägi // Nhan Ho @@ -1110,7 +1110,7 @@ interface Game { notify(message: string, groupInterval?: number): undefined; } -declare const Game: Game; +declare let Game: Game; interface _HasRoomPosition { pos: RoomPosition; } @@ -3259,7 +3259,7 @@ interface StructureController extends OwnedStructure { /** * An object with the controller reservation info if present: username, ticksToEnd */ - reservation: ReservationDefinition; + reservation: ReservationDefinition | undefined; /** * How many ticks of safe mode are remaining, or undefined. */ @@ -3275,7 +3275,7 @@ interface StructureController extends OwnedStructure { /** * An object with the controller sign info if present */ - sign: SignDefinition; + sign: SignDefinition | undefined; /** * The amount of game ticks when this controller will lose one level. This timer can be reset by using Creep.upgradeController. */ diff --git a/types/screeps/tsconfig.json b/types/screeps/tsconfig.json index 95f515e31c..0e153958c2 100644 --- a/types/screeps/tsconfig.json +++ b/types/screeps/tsconfig.json @@ -20,5 +20,4 @@ "index.d.ts", "screeps-tests.ts" ] -} - \ No newline at end of file + } diff --git a/types/screeps/tslint.json b/types/screeps/tslint.json index a94a85698c..f3ea5020c6 100644 --- a/types/screeps/tslint.json +++ b/types/screeps/tslint.json @@ -1,12 +1,12 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-redundant-jsdoc-2": false, - "dt-header": false, - "no-empty-interface": false, - "no-unnecessary-generics": false, - "no-misused-new": false, - "no-any-union": false, - "no-redundant-undefined": false - } + "extends": "dtslint/dt.json", + "rules": { + "no-redundant-jsdoc-2": false, + "dt-header": false, + "no-empty-interface": false, + "no-unnecessary-generics": false, + "no-misused-new": false, + "no-any-union": false, + "no-redundant-undefined": false + } } From 0135579e800d60af5cc9c540a73d5e226736307f Mon Sep 17 00:00:00 2001 From: Marek Date: Fri, 22 Dec 2017 09:10:09 +0100 Subject: [PATCH 186/890] comments fix --- types/throttle-debounce/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/throttle-debounce/index.d.ts b/types/throttle-debounce/index.d.ts index 3264fdf3b6..2d6f5beb17 100644 --- a/types/throttle-debounce/index.d.ts +++ b/types/throttle-debounce/index.d.ts @@ -23,9 +23,9 @@ * all arguments are passed through, as-is, to `callback` when the * throttled-function is executed. * - * @param debounceMode If `debounceMode` is true (at begin), schedule `clear` - * to execute after `delay` ms. If `debounceMode` is false (at end), schedule - * `callback` to execute after `delay` ms. + * @param debounceMode If `debounceMode` is true (at begin), schedule + * `callback` to execute after `delay` ms. If `debounceMode` is false (at end), + * schedule `callback` to execute after `delay` ms. * * @return * A new, throttled, function. @@ -50,9 +50,9 @@ export function throttle( * all arguments are passed through, as-is, to `callback` when the * throttled-function is executed. * - * @param debounceMode If `debounceMode` is true (at begin), schedule `clear` - * to execute after `delay` ms. If `debounceMode` is false (at end), schedule - * `callback` to execute after `delay` ms. + * @param debounceMode If `debounceMode` is true (at begin), schedule + * `callback` to execute after `delay` ms. If `debounceMode` is false (at end), + * schedule `callback` to execute after `delay` ms. * * @return * A new, throttled, function. From 340cdf7f316d4c387c9689e87d175e1f632fc5d7 Mon Sep 17 00:00:00 2001 From: Marek Date: Fri, 22 Dec 2017 09:14:35 +0100 Subject: [PATCH 187/890] formating ... --- types/throttle-debounce/index.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/types/throttle-debounce/index.d.ts b/types/throttle-debounce/index.d.ts index 2d6f5beb17..ded0507caf 100644 --- a/types/throttle-debounce/index.d.ts +++ b/types/throttle-debounce/index.d.ts @@ -23,7 +23,7 @@ * all arguments are passed through, as-is, to `callback` when the * throttled-function is executed. * - * @param debounceMode If `debounceMode` is true (at begin), schedule + * @param debounceMode If `debounceMode` is true (at begin), schedule * `callback` to execute after `delay` ms. If `debounceMode` is false (at end), * schedule `callback` to execute after `delay` ms. * @@ -31,10 +31,10 @@ * A new, throttled, function. */ export function throttle( - delay: number, - noTrailing: boolean, - callback: T, - debounceMode?: boolean, + delay: number, + noTrailing: boolean, + callback: T, + debounceMode?: boolean, ): T; /** @@ -50,7 +50,7 @@ export function throttle( * all arguments are passed through, as-is, to `callback` when the * throttled-function is executed. * - * @param debounceMode If `debounceMode` is true (at begin), schedule + * @param debounceMode If `debounceMode` is true (at begin), schedule * `callback` to execute after `delay` ms. If `debounceMode` is false (at end), * schedule `callback` to execute after `delay` ms. * @@ -58,9 +58,9 @@ export function throttle( * A new, throttled, function. */ export function throttle( - delay: number, - callback: T, - debounceMode?: boolean, + delay: number, + callback: T, + debounceMode?: boolean, ): T; /** From 9c3c46a81b7c77d487dd59a7c4c880ef668f6df5 Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 22 Dec 2017 11:35:43 +0100 Subject: [PATCH 188/890] renaming, using Partial --- types/owasp-password-strength-test/index.d.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/types/owasp-password-strength-test/index.d.ts b/types/owasp-password-strength-test/index.d.ts index c12a93ed82..352bc694cf 100644 --- a/types/owasp-password-strength-test/index.d.ts +++ b/types/owasp-password-strength-test/index.d.ts @@ -6,7 +6,7 @@ export as namespace owaspPasswordStrengthTest; -export interface PasswordTestResult { +export interface TestResult { /** error messages associated with the failed tests */ errors: string[]; /** enumerates which tests have failed, beginning from 0 with the first required test */ @@ -28,28 +28,28 @@ export interface PasswordTestResult { */ optionalTestsPassed: number; } -export interface PasswordTestConfiguration { +export interface TestConfig { /** * toggles the "passphrase" mechanism on and off; * If set to false, the strength-checker will abandon the notion of "passphrases", * and will subject all passwords to the same complexity requirements. */ - allowPassphrases?: boolean; + allowPassphrases: boolean; /** constraint on a password's maximum length */ - maxLength?: number; + maxLength: number; /** constraint on a password's minimum length */ - minLength?: number; + minLength: number; /** * minimum length a password needs to achieve in order to be considered a "passphrase" * (and thus exempted from the optional complexity tests by default) */ - minPhraseLength?: number; + minPhraseLength: number; /** * minimum number of optional tests that a password must pass in order to be considered "strong"; * By default (per the OWASP guidelines), four optional complexity tests are made, * and a password must pass at least three of them in order to be considered "strong" */ - minOptionalTestsToPass?: number; + minOptionalTestsToPass: number; // // to add support for https://github.com/nowsecure/owasp-password-strength-test/pull/5 // /** @@ -63,11 +63,11 @@ export interface PasswordTestConfiguration { export type PasswordTest = (password: string) => string | undefined; -export function test(password: string): PasswordTestResult; -export function config(configuration: PasswordTestConfiguration): void; +export function test(password: string): TestResult; +export function config(configuration: Partial): void; export let tests: { required: PasswordTest[]; optional: PasswordTest[]; }; -export const configs: Readonly; +export const configs: Readonly; From d1a7e180f21ab6bec8d19416760e98b7e327ab6b Mon Sep 17 00:00:00 2001 From: Troy Lamerton Date: Fri, 22 Dec 2017 12:39:51 +0100 Subject: [PATCH 189/890] add more definitions for the wait method --- types/nightmare/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index 7be47c2d30..7eba323bc4 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -31,7 +31,7 @@ declare class Nightmare { select(seletor: string, option: string): Nightmare; upload(selector: string, path: string): Nightmare; download(path:string): Nightmare; - download(action: "cancel" | "continue"): Nightmare; + download(action: "cancel" | "continue"): Nightmare; scrollTo(top: number, left: number): Nightmare; viewport(width: number, height: number): Nightmare; inject(type: string, file: string): Nightmare; @@ -44,6 +44,11 @@ declare class Nightmare { wait(): Nightmare; wait(ms: number): Nightmare; wait(selector: string): Nightmare; + wait(fn: (arg1: T) => any, value1: T): Nightmare; + wait(fn: (arg1: T, arg2: U) => any, value1: T, value2: U): Nightmare; + wait(fn: (arg1: T, arg2: U, arg3: V) => any, value1: T, value2: U, value3: V): Nightmare; + wait(fn: (arg1: T, arg2: U, arg3: V, arg4: W) => any, value1: T, value2: U, value3: V, value4: W): Nightmare; + wait(fn: (arg1: T, arg2: U, arg3: V, arg4: W, arg5: X) => any, value1: T, value2: U, value3: V, value4: W, value5: X): Nightmare; wait(fn: () => any, value: any, delay?: number): Nightmare; header(header: string, value: string): Nightmare; use(plugin: (nightmare: Nightmare) => void): Nightmare; From 15da395508fb6269f53ccd6944c50fb002e12cee Mon Sep 17 00:00:00 2001 From: Troy Lamerton Date: Fri, 22 Dec 2017 12:58:35 +0100 Subject: [PATCH 190/890] update wait() types to be like evaluate() --- types/nightmare/index.d.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index 7eba323bc4..737137f22e 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -41,15 +41,16 @@ declare class Nightmare { evaluate(fn: (arg: T) => void, cb: () => void, arg: T): Nightmare; evaluate(fn: () => R, cb: (result: R) => void): Nightmare; evaluate(fn: () => void): Nightmare; - wait(): Nightmare; + wait(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => any, value1: T1, value2: T2, value3: T3, value4: T4, value5: T5): Nightmare; + wait(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => any, value1: T1, value2: T2, value3: T3, value4: T4): Nightmare; + wait(fn: (arg1: T1, arg2: T2, arg3: T3) => any, value1: T1, value2: T2, value3: T3): Nightmare; + wait(fn: (arg1: T1, arg2: T2) => any, value1: T1, value2: T2): Nightmare; + wait(fn: (arg1: T1) => any, value1: T1): Nightmare; + wait(fn: () => any, value: any, delay?: number): Nightmare; + wait(fn: () => any): Nightmare; wait(ms: number): Nightmare; wait(selector: string): Nightmare; - wait(fn: (arg1: T) => any, value1: T): Nightmare; - wait(fn: (arg1: T, arg2: U) => any, value1: T, value2: U): Nightmare; - wait(fn: (arg1: T, arg2: U, arg3: V) => any, value1: T, value2: U, value3: V): Nightmare; - wait(fn: (arg1: T, arg2: U, arg3: V, arg4: W) => any, value1: T, value2: U, value3: V, value4: W): Nightmare; - wait(fn: (arg1: T, arg2: U, arg3: V, arg4: W, arg5: X) => any, value1: T, value2: U, value3: V, value4: W, value5: X): Nightmare; - wait(fn: () => any, value: any, delay?: number): Nightmare; + wait(): Nightmare; header(header: string, value: string): Nightmare; use(plugin: (nightmare: Nightmare) => void): Nightmare; run(cb?: (err: any, nightmare: Nightmare) => void): Nightmare; From 96571a8aee82917412b2d50d0cfa09bfdafe54bf Mon Sep 17 00:00:00 2001 From: rsouza Date: Fri, 22 Dec 2017 11:32:24 -0300 Subject: [PATCH 191/890] Downgrade TS from 2.6 to 2.4 to make compatible with /types/hapi --- types/iron/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/iron/index.d.ts b/types/iron/index.d.ts index 14ccfcbc2f..f4399434b5 100644 --- a/types/iron/index.d.ts +++ b/types/iron/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Simon Schick // Rafael Souza Fijalkowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.4 /// From 78a845c6580a8f34f0b7483c7749acf5cf869edf Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 22 Dec 2017 16:03:18 +0100 Subject: [PATCH 192/890] Add empty object as possible argument for UpsertDiffCallback --- types/pouchdb-upsert/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/pouchdb-upsert/index.d.ts b/types/pouchdb-upsert/index.d.ts index 3a34073935..003f310ad7 100644 --- a/types/pouchdb-upsert/index.d.ts +++ b/types/pouchdb-upsert/index.d.ts @@ -55,7 +55,7 @@ declare namespace PouchDB { callback: Core.Callback): void; } - type UpsertDiffCallback = (doc: Core.Document) => Core.Document | boolean; + type UpsertDiffCallback = (doc: Core.Document | {}) => Core.Document | boolean; interface UpsertResponse { id: Core.DocumentId; From db3f1adf7dffe1e18a208fc7e6a15308fc2fb1d3 Mon Sep 17 00:00:00 2001 From: John Gainfort Jr Date: Fri, 22 Dec 2017 11:01:40 -0700 Subject: [PATCH 193/890] updated to match current api --- types/hls.js/index.d.ts | 3560 ++++++++++++++++++++------------------- 1 file changed, 1810 insertions(+), 1750 deletions(-) diff --git a/types/hls.js/index.d.ts b/types/hls.js/index.d.ts index 3567db3f87..b47d49a236 100644 --- a/types/hls.js/index.d.ts +++ b/types/hls.js/index.d.ts @@ -1,472 +1,1768 @@ -// Type definitions for hls.js 0.7 +// Type definitions for hls.js 0.8 // Project: https://github.com/video-dev/hls.js // Definitions by: John G. Gainfort, Jr. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 declare class Loader { - constructor(config: Hls.LoaderConfig) - /** - * Start retrieving content located at given URL (HTTP GET). - */ - load(context: Hls.LoaderContext, config: Hls.LoaderConfig, callbacks: Hls.LoaderCallbacks): void; - /** - * Abort any loading in progress. - */ - abort(): void; - /** - * Destroy loading context. - */ - destroy(): void; + constructor(config: Hls.LoaderConfig) + /** + * Start retrieving content located at given URL (HTTP GET). + */ + load(context: Hls.LoaderContext, config: Hls.LoaderConfig, callbacks: Hls.LoaderCallbacks): void; + /** + * Abort any loading in progress. + */ + abort(): void; + /** + * Destroy loading context. + */ + destroy(): void; } declare namespace Hls { - /** - * Hls events - */ - namespace Events { /** - * fired to attach Media to hls instance - * data: { video , mediaSource } + * Hls events */ - const MEDIA_ATTACHING: string; - /** - * fired when Media has been succesfully attached to hls instance - * data: { video , mediaSource } - */ - const MEDIA_ATTACHED: string; - /** - * fired before detaching Media from hls instance - * data: { } - */ - const MEDIA_DETACHING: string; - /** - * fired when Media has been detached from hls instance - * data: { } - */ - const MEDIA_DETACHED: string; - /** - * fired when the buffer is going to be reset - * data: { } - */ - const BUFFER_RESET: string; - /** - * fired when we know about the codecs that we need buffers for to push into - * data: { tracks : { container, codec, levelCodec, initSegment, metadata } } - */ - const BUFFER_CODECS: string; - /** - * fired when sourcebuffers have been created - * data: { tracks: tracks } - */ - const BUFFER_CREATED: string; - /** - * fired when we append a segment to the buffer - * data: { segment: segment object } - */ - const BUFFER_APPENDING: string; - /** - * fired when we are done with appending a media segment to the buffer - * data: { parent : segment parent that triggered BUFFER_APPENDING, pending : nb of segments waiting for appending for this segment parent } - */ - const BUFFER_APPENDED: string; - /** - * fired when the stream is finished and we want to notify the media buffer that there will be no more data - * data: { } - */ - const BUFFER_EOS: string; - /** - * fired when the media buffer should be flushed - * data: { } - */ - const BUFFER_FLUSHING: string; - /** - * fired when the media buffer has been flushed - * data: { } - */ - const BUFFER_FLUSHED: string; - /** - * fired to signal that a manifest loading starts - * data: { url : manifestURL } - */ - const MANIFEST_LOADING: string; - /** - * fired after manifest has been loaded - * data: { levels : [available quality levels] , audioTracks : [ available audio tracks], url : manifestURL, stats : { trequest, tfirst, tload, mtime}} - */ - const MANIFEST_LOADED: string; - /** - * fired after manifest has been parsed - * data: { levels : [ available quality levels ], firstLevel : index of first quality level appearing in Manifest } - */ - const MANIFEST_PARSED: string; - /** - * fired when a level playlist loading starts - * data: { url : level URL, level : id of level being loaded } - */ - const LEVEL_LOADING: string; - /** - * fired when a level playlist loading finishes - * data: { details : levelDetails object, levelId : id of loaded level, stats : { trequest, tfirst, tload, mtime } } - */ - const LEVEL_LOADED: string; - /** - * fired when a level's details have been updated based on previous details, after it has been loaded - * data: { details : levelDetails object, level : id of updated level } - */ - const LEVEL_UPDATED: string; - /** - * fired when a level's PTS information has been updated after parsing a fragment - * data: { details: levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment } - */ - const LEVEL_PTS_UPDATED: string; - /** - * fired when a level switch is requested - * data: { level: Level } - */ - const LEVEL_SWITCHING: string; - /** - * fired when a level switch is effective - * data: { level: level object } - */ - const LEVEL_SWITCHED: string; - /** - * fired to notify that audio track lists has been updated - * data: { audioTracks : audioTracks } - */ - const AUDIO_TRACKS_UPDATED: string; - /** - * fired when an audio track switch occurs. deprecated in favor AUDIO_TRACK_SWITCHING - * data: { id : audio track id } - */ - const AUDIO_TRACK_SWTICH: string; - /** - * fired when an audio track switching is requested - * data: { id : audio track id } - */ - const AUDIO_TRACK_SWITCHING: string; - /** - * fired when an audio track switch actually occurs - * data: { id : audio track id } - */ - const AUDIO_TRACK_SWITCHED: string; - /** - * fired when an audio track loading starts - * data: { url : audio track URL, id : audio track id } - */ - const AUDIO_TRACK_LOADING: string; - /** - * fired when an audio track loading finishes - * data: { details : levelDetails object, id : audio track id, stats : { trequest, tfirst, tload, mtime } } - */ - const AUDIO_TRACK_LOADED: string; - /** - * fired to notify that subtitle track lists has been updated - * data: { subtitleTracks : subtitleTracks } - */ - const SUBTITLE_TRACKS_UPDATED: string; - /** - * fired when an subtitle track switch occurs - * data: { id : subtitle track id } - */ - const SUBTITLE_TRACK_SWITCH: string; - /** - * fired when a subtitle track loading starts - * data: { url : subtitle track URL, id : subtitle track id } - */ - const SUBTITLE_TRACK_LOADING: string; - /** - * fired when a subtitle track loading finishes - * data: { details : levelDetails object, id : subtitle track id, stats : { trequest, tfirst, tload, mtime } } - */ - const SUBTITLE_TRACK_LOADED: string; - /** - * fired when a subtitle fragment has been processed - * data: { success : boolean, frag : the processed frag } - */ - const SUBTITLE_FRAG_PROCESSED: string; - /** - * fired when a decryption key loading starts - * data: { frag: fragment object } - */ - const KEY_LOADING: string; - /** - * fired when a decryption key loading is completed - * data: { frag: fragment object } - */ - const KEY_LOADED: string; - /** - * fired when first timestamp has been found - * data: { id: demuxer id, frag: fragment object, initPTS: initPTS } - */ - const INIT_PTS_FOUND: string; - /** - * fired when a fragment loading starts - * data: { frag : fragment object } - */ - const FRAG_LOADING: string; - /** - * fired when a fragment load is in progress - * data: { frag : fragment object with frag.loaded=stats.loaded, stats : { trequest, tfirst, loaded, total } } - */ - const FRAG_LOAD_PROGRESS: string; - /** - * identifier for fragment load aborting for emergency switch down - * data: { frag: fragment object } - */ - const FRAG_LOAD_ERMERGENCY_ABORTED: string; - /** - * fired when a fragment loading is completed - * data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length}} - */ - const FRAG_LOADED: string; - /** - * fired when a fragment decryption is completed - * data: { id: demuxer id, frag: fragment object, stats: { tstart, tdecrypt } } - */ - const FRAG_DECRYPTED: string; - /** - * fired when Init Segment has been extracted from fragment - * data: { id: demuxer id, moov : moov MP4 box, codecs : codecs found while parsing fragment} - */ - const FRAG_PARSING_INIT_SEGMENT: string; - /** - * fired when parsing id3 is completed - * data: { id: demuxer id, samples : [ id3 pes - pts and dts timestamp are relative, values are in seconds]} - */ - const FRAG_PARSING_METADATA: string; - /** - * fired when moof/mdat have been extracted from fragment - * data: { id: demuxer id, - * moof : moof MP4 box, - * mdat : mdat MP4 box, - * startPTS : PTS of first sample, - * endPTS : PTS of last sample, - * startDTS : DTS of first sample, - * endDTS : DTS of last sample, - * type : stream type (audio or video), - * nb : number of samples} - */ - const FRAG_PARSING_DATA: string; - /** - * fired when fragment parsing is completed - * data: { id: demuxer id} - */ - const FRAG_PARSED: string; - /** - * fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer - * data: { id: demuxer id, frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length} } - */ - const FRAG_BUFFERED: string; - /** - * fired when fragment matching with current video position is changing - * data: { frag : fragment object } - */ - const FRAG_CHANGED: string; - /** - * triggered when FPS drop in last monitoring period is higher than given threshold - * data: { curentDropped : nb of dropped frames in last monitoring period, - * currentDecoded : nb of decoded frames in last monitoring period, - * totalDropped : total dropped frames on this video element } - */ - const FPS_DROP: string; - /** - * triggered when FPS drop triggers auto level capping - * data: { level: suggested new auto level capping by fps controller, droppedLevel : level has to much dropped frame will be restricted } - */ - const FPS_DROP_LEVEL_CAPPING: string; - /** - * Identifier for an error event - * data: { type : error type, details : error details, fatal : is error fatal or not, other error specific data } - */ - const ERROR: string; - /** - * fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a video to the instance of hls.js to handle mid-rolls for example. - * data: { } - */ - const DESTROYING: string; - /** - * fired upon stream controller state transitions - * data: { previousState, nextState } - */ - const STREAM_STATE_TRANSITION: string; - } + namespace Events { + /** + * fired to attach Media to hls instance + * data: { video , mediaSource } + */ + const MEDIA_ATTACHING: string; + /** + * fired when Media has been succesfully attached to hls instance + * data: { video , mediaSource } + */ + const MEDIA_ATTACHED: string; + /** + * fired before detaching Media from hls instance + * data: { } + */ + const MEDIA_DETACHING: string; + /** + * fired when Media has been detached from hls instance + * data: { } + */ + const MEDIA_DETACHED: string; + /** + * fired when the buffer is going to be reset + * data: { } + */ + const BUFFER_RESET: string; + /** + * fired when we know about the codecs that we need buffers for to push into + * data: { tracks : { container, codec, levelCodec, initSegment, metadata } } + */ + const BUFFER_CODECS: string; + /** + * fired when sourcebuffers have been created + * data: { tracks: tracks } + */ + const BUFFER_CREATED: string; + /** + * fired when we append a segment to the buffer + * data: { segment: segment object } + */ + const BUFFER_APPENDING: string; + /** + * fired when we are done with appending a media segment to the buffer + * data: { parent : segment parent that triggered BUFFER_APPENDING, pending : nb of segments waiting for appending for this segment parent } + */ + const BUFFER_APPENDED: string; + /** + * fired when the stream is finished and we want to notify the media buffer that there will be no more data + * data: { } + */ + const BUFFER_EOS: string; + /** + * fired when the media buffer should be flushed + * data: { } + */ + const BUFFER_FLUSHING: string; + /** + * fired when the media buffer has been flushed + * data: { } + */ + const BUFFER_FLUSHED: string; + /** + * fired to signal that a manifest loading starts + * data: { url : manifestURL } + */ + const MANIFEST_LOADING: string; + /** + * fired after manifest has been loaded + * data: { levels : [available quality levels] , audioTracks : [ available audio tracks], url : manifestURL, stats : { trequest, tfirst, tload, mtime}} + */ + const MANIFEST_LOADED: string; + /** + * fired after manifest has been parsed + * data: { levels : [ available quality levels ], firstLevel : index of first quality level appearing in Manifest } + */ + const MANIFEST_PARSED: string; + /** + * fired when a level playlist loading starts + * data: { url : level URL, level : id of level being loaded } + */ + const LEVEL_LOADING: string; + /** + * fired when a level playlist loading finishes + * data: { details : levelDetails object, levelId : id of loaded level, stats : { trequest, tfirst, tload, mtime } } + */ + const LEVEL_LOADED: string; + /** + * fired when a level's details have been updated based on previous details, after it has been loaded + * data: { details : levelDetails object, level : id of updated level } + */ + const LEVEL_UPDATED: string; + /** + * fired when a level's PTS information has been updated after parsing a fragment + * data: { details: levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment } + */ + const LEVEL_PTS_UPDATED: string; + /** + * fired when a level switch is requested + * data: { level: Level } + */ + const LEVEL_SWITCHING: string; + /** + * fired when a level switch is effective + * data: { level: level object } + */ + const LEVEL_SWITCHED: string; + /** + * fired to notify that audio track lists has been updated + * data: { audioTracks : audioTracks } + */ + const AUDIO_TRACKS_UPDATED: string; + /** + * fired when an audio track switch occurs. deprecated in favor AUDIO_TRACK_SWITCHING + * data: { id : audio track id } + */ + const AUDIO_TRACK_SWTICH: string; + /** + * fired when an audio track switching is requested + * data: { id : audio track id } + */ + const AUDIO_TRACK_SWITCHING: string; + /** + * fired when an audio track switch actually occurs + * data: { id : audio track id } + */ + const AUDIO_TRACK_SWITCHED: string; + /** + * fired when an audio track loading starts + * data: { url : audio track URL, id : audio track id } + */ + const AUDIO_TRACK_LOADING: string; + /** + * fired when an audio track loading finishes + * data: { details : levelDetails object, id : audio track id, stats : { trequest, tfirst, tload, mtime } } + */ + const AUDIO_TRACK_LOADED: string; + /** + * fired to notify that subtitle track lists has been updated + * data: { subtitleTracks : subtitleTracks } + */ + const SUBTITLE_TRACKS_UPDATED: string; + /** + * fired when an subtitle track switch occurs + * data: { id : subtitle track id } + */ + const SUBTITLE_TRACK_SWITCH: string; + /** + * fired when a subtitle track loading starts + * data: { url : subtitle track URL, id : subtitle track id } + */ + const SUBTITLE_TRACK_LOADING: string; + /** + * fired when a subtitle track loading finishes + * data: { details : levelDetails object, id : subtitle track id, stats : { trequest, tfirst, tload, mtime } } + */ + const SUBTITLE_TRACK_LOADED: string; + /** + * fired when a subtitle fragment has been processed + * data: { success : boolean, frag : the processed frag } + */ + const SUBTITLE_FRAG_PROCESSED: string; + /** + * fired when a decryption key loading starts + * data: { frag: fragment object } + */ + const KEY_LOADING: string; + /** + * fired when a decryption key loading is completed + * data: { frag: fragment object } + */ + const KEY_LOADED: string; + /** + * fired when first timestamp has been found + * data: { id: demuxer id, frag: fragment object, initPTS: initPTS } + */ + const INIT_PTS_FOUND: string; + /** + * fired when a fragment loading starts + * data: { frag : fragment object } + */ + const FRAG_LOADING: string; + /** + * fired when a fragment load is in progress + * data: { frag : fragment object with frag.loaded=stats.loaded, stats : { trequest, tfirst, loaded, total } } + */ + const FRAG_LOAD_PROGRESS: string; + /** + * identifier for fragment load aborting for emergency switch down + * data: { frag: fragment object } + */ + const FRAG_LOAD_ERMERGENCY_ABORTED: string; + /** + * fired when a fragment loading is completed + * data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length}} + */ + const FRAG_LOADED: string; + /** + * fired when a fragment decryption is completed + * data: { id: demuxer id, frag: fragment object, stats: { tstart, tdecrypt } } + */ + const FRAG_DECRYPTED: string; + /** + * fired when Init Segment has been extracted from fragment + * data: { id: demuxer id, moov : moov MP4 box, codecs : codecs found while parsing fragment} + */ + const FRAG_PARSING_INIT_SEGMENT: string; + /** + * fired when parsing id3 is completed + * data: { id: demuxer id, samples : [ id3 pes - pts and dts timestamp are relative, values are in seconds]} + */ + const FRAG_PARSING_METADATA: string; + /** + * fired when moof/mdat have been extracted from fragment + * data: { id: demuxer id, + * moof : moof MP4 box, + * mdat : mdat MP4 box, + * startPTS : PTS of first sample, + * endPTS : PTS of last sample, + * startDTS : DTS of first sample, + * endDTS : DTS of last sample, + * type : stream type (audio or video), + * nb : number of samples} + */ + const FRAG_PARSING_DATA: string; + /** + * fired when fragment parsing is completed + * data: { id: demuxer id} + */ + const FRAG_PARSED: string; + /** + * fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer + * data: { id: demuxer id, frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length} } + */ + const FRAG_BUFFERED: string; + /** + * fired when fragment matching with current video position is changing + * data: { frag : fragment object } + */ + const FRAG_CHANGED: string; + /** + * triggered when FPS drop in last monitoring period is higher than given threshold + * data: { curentDropped : nb of dropped frames in last monitoring period, + * currentDecoded : nb of decoded frames in last monitoring period, + * totalDropped : total dropped frames on this video element } + */ + const FPS_DROP: string; + /** + * triggered when FPS drop triggers auto level capping + * data: { level: suggested new auto level capping by fps controller, droppedLevel : level has to much dropped frame will be restricted } + */ + const FPS_DROP_LEVEL_CAPPING: string; + /** + * Identifier for an error event + * data: { type : error type, details : error details, fatal : is error fatal or not, other error specific data } + */ + const ERROR: string; + /** + * fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a video to the instance of hls.js to handle mid-rolls for example. + * data: { } + */ + const DESTROYING: string; + /** + * fired upon stream controller state transitions + * data: { previousState, nextState } + */ + const STREAM_STATE_TRANSITION: string; + } - /** - * Hls error details - */ - namespace ErrorDetails { - // NETWORK_ERRORS // /** - * raised when manifest loading fails because of a network error - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_LOAD_ERROR, fatal : true, url : manifest URL, response : { code: error code, text: error text }, loader : URL loader } + * Hls error details */ - const MANIFEST_LOAD_ERROR: string; - /** - * raised when manifest loading fails because of a timeout - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT, fatal : true, url : manifest URL, loader : URL loader } - */ - const MANIFEST_LOAD_TIMEOUT: string; - /** - * raised when manifest parsing failed to find proper content - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_PARSING_ERROR, fatal : true, url : manifest URL, reason : parsing error reason } - */ - const MANIFEST_PARSING_ERROR: string; - /** - * raised when level loading fails because of a network error - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.LEVEL_LOAD_ERROR, fatal : true, url : level URL, response : { code: error code, text: error text }, loader : URL loader } - */ - const LEVEL_LOAD_ERROR: string; - /** - * raised when level loading fails because of a timeout - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.LEVEL_LOAD_TIMEOUT, fatal : true, url : level URL, loader : URL loader } - */ - const LEVEL_LOAD_TIMEOUT: string; - /** - * raised when audio track loading fails because of a network error - * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.AUDIO_TRACK_LOAD_ERROR, fatal: false, url: audio URL, loader: URL loader } - */ - const AUDIO_TRACK_LOAD_ERROR: string; - /** - * raised when audio track loading fails because of a timeout - * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT, fatal: false, url: audio URL, response: { code: error code, text: error text }, loader: URL loader } - */ - const AUDIO_TRACK_LOAD_TIMEOUT: string; - /** - * raised when fragment loading fails because of a network error - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOAD_ERROR, fatal : true or false, frag : fragment object, response : { code: error code, text: error text } } - */ - const FRAG_LOAD_ERROR: string; - /** - * raised when fragment loading fails because of a timeout - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOAD_TIMEOUT, fatal : true or false, frag : fragment object } - */ - const FRAG_LOAD_TIMEOUT: string; - /** - * raised when decrypt key loading fails because of a network error - * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.KEY_LOAD_ERROR, fatal: false, frag: fragment object } - */ - const KEY_LOAD_ERROR: string; - /** - * raised when decrypt key loading fails because of timeout - * data: { type: NETWORK_EROR, details: Hls.ErrorDetails.KEY_LOAD_TIMEOUT, fatal: true, frag: fragment object } - */ - const KEY_LOAD_TIMEOUT: string; + namespace ErrorDetails { + // NETWORK_ERRORS // + /** + * raised when manifest loading fails because of a network error + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_LOAD_ERROR, fatal : true, url : manifest URL, response : { code: error code, text: error text }, loader : URL loader } + */ + const MANIFEST_LOAD_ERROR: string; + /** + * raised when manifest loading fails because of a timeout + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT, fatal : true, url : manifest URL, loader : URL loader } + */ + const MANIFEST_LOAD_TIMEOUT: string; + /** + * raised when manifest parsing failed to find proper content + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_PARSING_ERROR, fatal : true, url : manifest URL, reason : parsing error reason } + */ + const MANIFEST_PARSING_ERROR: string; + /** + * raised when level loading fails because of a network error + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.LEVEL_LOAD_ERROR, fatal : true, url : level URL, response : { code: error code, text: error text }, loader : URL loader } + */ + const LEVEL_LOAD_ERROR: string; + /** + * raised when level loading fails because of a timeout + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.LEVEL_LOAD_TIMEOUT, fatal : true, url : level URL, loader : URL loader } + */ + const LEVEL_LOAD_TIMEOUT: string; + /** + * raised when audio track loading fails because of a network error + * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.AUDIO_TRACK_LOAD_ERROR, fatal: false, url: audio URL, loader: URL loader } + */ + const AUDIO_TRACK_LOAD_ERROR: string; + /** + * raised when audio track loading fails because of a timeout + * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT, fatal: false, url: audio URL, response: { code: error code, text: error text }, loader: URL loader } + */ + const AUDIO_TRACK_LOAD_TIMEOUT: string; + /** + * raised when fragment loading fails because of a network error + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOAD_ERROR, fatal : true or false, frag : fragment object, response : { code: error code, text: error text } } + */ + const FRAG_LOAD_ERROR: string; + /** + * raised when fragment loading fails because of a timeout + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOAD_TIMEOUT, fatal : true or false, frag : fragment object } + */ + const FRAG_LOAD_TIMEOUT: string; + /** + * raised when decrypt key loading fails because of a network error + * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.KEY_LOAD_ERROR, fatal: false, frag: fragment object } + */ + const KEY_LOAD_ERROR: string; + /** + * raised when decrypt key loading fails because of timeout + * data: { type: NETWORK_EROR, details: Hls.ErrorDetails.KEY_LOAD_TIMEOUT, fatal: true, frag: fragment object } + */ + const KEY_LOAD_TIMEOUT: string; - // MEDIA_ERRORS // - /** - * raised when manifest only contains quality level with codecs incompatible with MediaSource Engine. - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR, fatal : true, url : manifest URL } - */ - const MANIFEST_INCOMPATIBLE_CODECS_ERROR: string; - /** - * raised upon detection of same fragment being requested in loop - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR, fatal : true or false, frag : fragment object } - */ - const FRAG_LOOP_LOADING_ERROR: string; - /** - * raised when fragment decryption fails - * data: { type: MEDIA_ERROR, details: Hls.ErrorDetails.FRAG_DECRYPT_ERROR, fatal: true, reason: failure reason } - */ - const FRAG_DECRYPT_ERROR: string; - /** - * raised when fragment parsing fails - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_PARSING_ERROR, fatal : true or false, reason : failure reason } - */ - const FRAG_PARSING_ERROR: string; - /** - * raised when MediaSource fails to add new sourceBuffer - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_ADD_CODEC_ERROR, fatal : false, err : error raised by MediaSource, mimeType: mimeType on which the failure happened } - */ - const BUFFER_ADD_CODEC_ERROR: string; - /** - * raised when exception is raised while calling buffer append - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_APPEND_ERROR, fatal : true, frag : fragment object } - */ - const BUFFER_APPEND_ERROR: string; - /** - * raised when exception is raised during buffer appending - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_APPENDING_ERROR, fatal : false } - */ - const BUFFER_APPENDING_ERROR: string; - /** - * raised when playback is stuck because buffer is running out of data - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_STALLED_ERROR, fatal : false } - */ - const BUFFER_STALLED_ERROR: string; - /** - * raised when no data can be appended anymore in media buffer because it is full. - * This error is recovered automatically by performing a smooth level switching that empty buffers (without disrupting the playback) and reducing the max buffer length. - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_FULL_ERROR, fatal : false } - */ - const BUFFER_FULL_ERROR: string; - /** - * raised after hls.js seeks over a buffer hole to unstuck the playback, - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal : false, hole : hole duration } - */ - const BUFFER_SEEK_OVER_HOLE: string; - /** - * raised when playback is stuck although currentTime is in a buffered aread - * data: { type: MEDIA_ERROR, details: Hls.ErrorDetails.BUFFERED_STALLED_ERROR, fatal: true } - */ - const BUFFER_NUDGE_ON_STALL: string; + // MEDIA_ERRORS // + /** + * raised when manifest only contains quality level with codecs incompatible with MediaSource Engine. + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR, fatal : true, url : manifest URL } + */ + const MANIFEST_INCOMPATIBLE_CODECS_ERROR: string; + /** + * raised upon detection of same fragment being requested in loop + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR, fatal : true or false, frag : fragment object } + */ + const FRAG_LOOP_LOADING_ERROR: string; + /** + * raised when fragment decryption fails + * data: { type: MEDIA_ERROR, details: Hls.ErrorDetails.FRAG_DECRYPT_ERROR, fatal: true, reason: failure reason } + */ + const FRAG_DECRYPT_ERROR: string; + /** + * raised when fragment parsing fails + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_PARSING_ERROR, fatal : true or false, reason : failure reason } + */ + const FRAG_PARSING_ERROR: string; + /** + * raised when MediaSource fails to add new sourceBuffer + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_ADD_CODEC_ERROR, fatal : false, err : error raised by MediaSource, mimeType: mimeType on which the failure happened } + */ + const BUFFER_ADD_CODEC_ERROR: string; + /** + * raised when exception is raised while calling buffer append + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_APPEND_ERROR, fatal : true, frag : fragment object } + */ + const BUFFER_APPEND_ERROR: string; + /** + * raised when exception is raised during buffer appending + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_APPENDING_ERROR, fatal : false } + */ + const BUFFER_APPENDING_ERROR: string; + /** + * raised when playback is stuck because buffer is running out of data + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_STALLED_ERROR, fatal : false } + */ + const BUFFER_STALLED_ERROR: string; + /** + * raised when no data can be appended anymore in media buffer because it is full. + * This error is recovered automatically by performing a smooth level switching that empty buffers (without disrupting the playback) and reducing the max buffer length. + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_FULL_ERROR, fatal : false } + */ + const BUFFER_FULL_ERROR: string; + /** + * raised after hls.js seeks over a buffer hole to unstuck the playback, + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal : false, hole : hole duration } + */ + const BUFFER_SEEK_OVER_HOLE: string; + /** + * raised when playback is stuck although currentTime is in a buffered aread + * data: { type: MEDIA_ERROR, details: Hls.ErrorDetails.BUFFERED_STALLED_ERROR, fatal: true } + */ + const BUFFER_NUDGE_ON_STALL: string; - // MUX_ERROR // - /** - * raised when memory allocation fails during remuxing - * data: { type: MUX_ERROR, details: Hls.ErrorDetails.REMUX_ALLOC_ERROR, fatal: false, bytes: mdat size, reason: failure reason } - */ - const REMUX_ALLOC_ERROR: string; + // MUX_ERROR // + /** + * raised when memory allocation fails during remuxing + * data: { type: MUX_ERROR, details: Hls.ErrorDetails.REMUX_ALLOC_ERROR, fatal: false, bytes: mdat size, reason: failure reason } + */ + const REMUX_ALLOC_ERROR: string; - // OTHER_ERROR // - /** - * raised when level switching fails - * data: { type : OTHER_ERROR, details : Hls.ErrorDetails.LEVEL_SWITCH_ERROR, fatal : false, level : failed level index, reason : failure reason } - */ - const LEVEL_SWITCH_ERROR: string; - /** - * raised when an exception occurs in an internal hls.js event handler - * data: { type: OTHER_ERROR, details: Hls.ErrorDetails.INTERNAL_EXCEPTION, fatal: true or false, event: event object or string, error: { message: error message } } - */ - const INTERNAL_EXCEPTION: string; - } + // OTHER_ERROR // + /** + * raised when level switching fails + * data: { type : OTHER_ERROR, details : Hls.ErrorDetails.LEVEL_SWITCH_ERROR, fatal : false, level : failed level index, reason : failure reason } + */ + const LEVEL_SWITCH_ERROR: string; + /** + * raised when an exception occurs in an internal hls.js event handler + * data: { type: OTHER_ERROR, details: Hls.ErrorDetails.INTERNAL_EXCEPTION, fatal: true or false, event: event object or string, error: { message: error message } } + */ + const INTERNAL_EXCEPTION: string; + } - /** - * Hls error types - */ - namespace ErrorTypes { /** - * network related errors + * Hls error types */ - const NETWORK_ERROR: string; + namespace ErrorTypes { + /** + * network related errors + */ + const NETWORK_ERROR: string; + /** + * media/video related errors + */ + const MEDIA_ERROR: string; + /** + * muxing related errors + */ + const MUX_ERROR: string; + /** + * all other erros + */ + const OTHER_ERROR: string; + } /** - * media/video related errors + * override Hls default configuration + * this configuration will be applied by default to all instances */ - const MEDIA_ERROR: string; + let DefaultConfig: Config; /** - * muxing related errors + * checks whether your browser is supporting MediaSource Extensions */ - const MUX_ERROR: string; + function isSupported(): boolean; /** - * all other erros + * returns hls.js dist version number */ - const OTHER_ERROR: string; - } - /** - * override Hls default configuration - * this configuration will be applied by default to all instances - */ - let DefaultConfig: Config; - /** - * checks whether your browser is supporting MediaSource Extensions - */ - function isSupported(): boolean; - /** - * returns hls.js dist version number - */ - const version: string; + const version: string; - interface Config { + interface Config { + /** + * (default: false) + * if set to true, the adaptive algorithm with limit levels usable in auto-quality by the HTML video element dimensions (width and height) + * if set to false, levels will not be limited. All available levels could be used in auto-quality mode taking only bandwidth into consideration. + */ + capLevelToPlayerSize: boolean; + /** + * (default: false) + * setting config.debug = true; will turn on debug logs on JS console. + * a logger object could also be provided for custom logging: config.debug = customLogger; + */ + debug: boolean; + /** + * (default: true) + * if set to true, start level playlist and first fragments will be loaded automatically, after triggering of Hls.Events.MANIFEST_PARSED event + * if set to false, an explicit API call (hls.startLoad(startPosition=-1)) will be needed to start quality level/fragment loading. + */ + autoStartLoad: boolean; + /** + * (default -1) + * if set to -1, playback will start from initialTime=0 for VoD and according to liveSyncDuration/liveSyncDurationCount config params for Live + * otherwise, playback will start from predefined value. (unless stated otherwise in autoStartLoad=false mode : in that case startPosition can be overrided using hls.startLoad(startPosition)). + */ + startPosition: number; + /** + * (default: undefined) + * if audio codec is not signaled in variant manifest, or if only a stream manifest is provided, hls.js tries to guess audio codec by parsing audio sampling rate in ADTS header. + * If sampling rate is less or equal than 22050 Hz, then hls.js assumes it is HE-AAC, otherwise it assumes it is AAC-LC. + * This could result in bad guess, leading to audio decode error, ending up in media error. + * It is possible to hint default audiocodec to hls.js by configuring this value as below: + * mp4a.40.2 (AAC-LC) or + * mp4a.40.5 (HE-AAC) or + * undefined (guess based on sampling rate) + */ + defaultAudioCodec: string; + /** + * (default: 1) + * number of segments needed to start a playback of Live stream. + */ + initialLiveManifestSize: number; + /** + * (default: 30 seconds) + * Maximum buffer length in seconds. If buffer length is/become less than this value, a new fragment will be loaded. + * This is the guaranteed buffer length hls.js will try to reach, regardless of maxBufferSize. + */ + maxBufferLength: number; + /** + * (default 600s) + * Maximum buffer length in seconds. Hls.js will never exceed this value, even if maxBufferSize is not reached yet. + * hls.js tries to buffer up to a maximum number of bytes (60 MB by default) rather than to buffer up to a maximum nb of seconds. + * This is to mimic the browser behaviour (the buffer eviction algorithm is starting after the browser detects that video buffer size reaches a limit in bytes) + * maxBufferLength is the minimum guaranteed buffer length that hls.js will try to achieve, even if that value exceeds the amount of bytes 60 MB of memory. + * maxMaxBufferLength acts as a capping value, as if bitrate is really low, you could need more than one hour of buffer to fill 60 MB. + */ + maxMaxBufferLength: number; + /** + * (default: 60 MB) + * 'Minimum' maximum buffer size in bytes. If buffer size upfront is bigger than this value, no fragment will be loaded + */ + maxBufferSize: number; + /** + * (default: 0.5 seconds) + * 'Maximum' inter-fragment buffer hole tolerance that hls.js can cope with when searching for the next fragment to load. When switching between quality level, + * fragments might not be perfectly aligned. + * This could result in small overlapping or hole in media buffer. This tolerance factor helps cope with this. + */ + maxBufferHole: number; + /** + * (default: 2s) + * In case playback is stalled, and a buffered range is available upfront, less than maxSeekHole seconds from current media position, + * hls.js will jump over this buffer hole to reach the beginning of this following buffered range. + * maxSeekHole allows to configure this jumpable threshold. + */ + maxSeekHole: number; + /** + * (default: 4s) + * + * ABR algorithm will always try to choose a quality level that should avoid rebuffering. In case no quality level with this criteria can + * be found (lets say for example that buffer length is 1s, but fetching a fragment at lowest quality is predicted to take around 2s ... + * ie we can forecast around 1s of rebuffering ...) then ABR algorithm will try to find a level that should guarantee less than + * maxStarvationDelay of buffering. + */ + maxStarvationDelay: number; + /** + * (default 0.2s) + * This tolerance factor is used during fragment lookup. + * Instead of checking whether buffered.end is located within [start, end] range, frag lookup will be done by checking within [start-maxFragLookUpTolerance, end-maxFragLookUpTolerance] range. + * This tolerance factor is used to cope with situations like: + * buffered.end = 9.991 + * frag[0] : [0,10] + * frag[1] : [10,20] + * buffered.end is within frag[0] range, but as we are close to frag[1], frag[1] should be choosen instead + * If maxFragLookUpTolerance = 0.2, this lookup will be adjusted to + * frag[0] : [-0.2,9.8] + * frag[1] : [9.8,19.8] + * This time, buffered.end is within frag[1] range, and frag[1] will be the next fragment to be loaded, as expected + */ + maxLoadingDelay: number; + /** + * (default: 0.5s) + * media element is expected to play and if currentTime has not moved for more than lowBufferWatchdogPeriod and if there are less than maxBufferHole seconds buffered upfront, + * hls.js will try to nudge playhead to recover playback + */ + lowBufferWatchdogPeriod: number; + /** + * (default: 3s) + * if media element is expected to play and if currentTime has not moved for more than highBufferWatchdogPeriod and if there are more than maxBufferHole seconds buffered upfront, + * hls.js will try to nudge playhead to recover playback + */ + highBufferWatchdogPeriod: number; + /** + * (default: 0.1s) + * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. + * media.currentTime += (nb nudge retry -1)*nudgeOffset + */ + nudgeOffset: number; + /** + * (default: 3s) + * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. + * media.currentTime += (nb nudge retry -1)*nudgeOffset + */ + nudgeMaxRetry: number; + /** + * (default 4s) + * + * max video loading delay used in automatic start level selection : in that mode ABR controller will ensure that video loading time (ie + * the time to fetch the first fragment at lowest quality level + the time to fetch the fragment at the appropriate quality level is less + * than maxLoadingDelay ) + */ + maxFragLookUpTolerance: number; + /** + * (default: 3) + * edge of live delay, expressed in multiple of EXT-X-TARGETDURATION. if set to 3, playback will start from fragment N-3, N being the last fragment of the live playlist. + * Decreasing this value is likely to cause playback stalls. + */ + liveSyncDurationCount: number; + /** + * (default: Infinity) + * maximum delay allowed from edge of live, expressed in multiple of EXT-X-TARGETDURATION. + * If set to 10, the player will seek back to liveSyncDurationCount whenever the next fragment to be loaded is older than N-10, N being the last fragment of the live playlist. + * If set, this value must be stricly superior to liveSyncDurationCount a value too close from liveSyncDurationCount is likely to cause playback stalls. + */ + liveMaxLatencyDurationCount: number; + /** + * (default: undefined) + * Alternative parameter to liveSyncDurationCount, expressed in seconds vs number of segments. + * If defined in the configuration object, liveSyncDuration will take precedence over the default liveSyncDurationCount. + * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. + * A value too low (inferior to ~3 segment durations) is likely to cause playback stalls. + */ + liveSyncDuration: number; + /** + * (default: undefined) + * Alternative parameter to liveMaxLatencyDurationCount, expressed in seconds vs number of segments. + * If defined in the configuration object, liveMaxLatencyDuration will take precedence over the default liveMaxLatencyDurationCount. + * If set, this value must be stricly superior to liveSyncDuration which must be defined as well. + * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. + * A value too close from liveSyncDuration is likely to cause playback stalls. + */ + liveMaxLatencyDuration: number; + /** + * (default: false) + * Override current Media Source duration to Infinity for a live broadcast. Useful, if you are building a player which relies + * on native UI capabilities in modern browsers. If you want to have a native Live UI in environments like iOS Safari, Safari, + * Android Google Chrome, etc. set this value to true. + */ + liveDurationInfinity: boolean; + /** + * (default: true) + * Enable WebWorker (if available on browser) for TS demuxing/MP4 remuxing, to improve performance and avoid lag/frame drops. + */ + enableWorker: boolean; + /** + * (default: true) + * Enable to use JavaScript version AES decryption for fallback of WebCrypto API. + */ + enableSoftwareAES: boolean; + /** + * (default: undefined) + * When set, use this level as the default hls.startLevel. Keep in mind that the startLevel set with the API takes precedence over + * config.startLevel configuration parameter. + */ + startLevel: number; + /** + * (default: 10000ms for level and manifest) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + manifestLoadingTimeOut: number; + /** + * (default: 3) + * Max number of load retries. + */ + manifestLoadingMaxRetry: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + manifestLoadingRetryDelay: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + manifestLoadingMaxRetryTimeout: number; + /** + * (default: 60000ms for fragment) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + levelLoadingTimeOut: number; + /** + * (default: 3) + * Max number of load retries. + */ + levelLoadingMaxRetry: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + levelLoadingRetryDelay: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + levelLoadingMaxRetryTimeout: number; + /** + * (default: 60000ms for fragment) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + fragLoadingTimeOut: number; + /** + * (default: 3) + * Max number of load retries. + */ + fragLoadingMaxRetry: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + fragLoadingRetryDelay: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + fragLoadingMaxRetryDelay: number; + /** + * (default: false) + * Start prefetching start fragment although media not attached yet. Max number of append retries. + */ + startFragPrefech: boolean; + /** + * (default: 3) + * Max number of sourceBuffer.appendBuffer() retry upon error. Such error could happen in loop with UHD streams, when internal buffer is full. (Quota Exceeding Error will be triggered). + * In that case we need to wait for the browser to evict some data before being able to append buffer correctly. + */ + appendErrorMaxRetry: number; + /** + * (default: standard XMLHttpRequest-based URL loader) + * Override standard URL loader by a custom one. Could be useful for P2P or stubbing (testing). + * Use this, if you want to overwrite both the fragment and the playlist loader. + * Note: If fLoader or pLoader are used, they overwrite loader! + */ + loader: typeof Loader; + /** + * (default: undefined) + * This enables the manipulation of the fragment loader. + * Note: This will overwrite the default loader, as well as your own loader function. + */ + fLoader?: typeof Loader; + /** + * (default: undefined) + * This enables the manipulation of the playlist loader. + * Note: This will overwrite the default loader, as well as your own loader function. + */ + pLoader?: typeof Loader; + /** + * (default: undefined) + * XMLHttpRequest customization callback for default XHR based loader. + * Parameter should be a function with two arguments (xhr: XMLHttpRequest, url: string). + * If xhrSetup is specified, default loader will invoke it before calling xhr.send(). This allows user to easily modify/setup XHR. + */ + xhrSetup?(xhr: XMLHttpRequest, url: string): void; + /** + * (default: undefined) + * Fetch customization callback for Fetch based loader. + * Parameter should be a function with two arguments (context and Request Init Params). + * If fetchSetup is specified and Fetch loader is used, fetchSetup will be triggered to instantiate Request Object. This allows user to easily tweak Fetch loader. + */ + fetchSetup?(context: any, initParams: any): Request; + /** + * (default: internal ABR controller) + * Customized Adaptive Bitrate Streaming Controller. + * Parameter should be a class providing 2 getters, 2 setters and a destroy() method: + * get/set nextAutoLevel: return next auto-quality level/force next auto-quality level that should be returned (currently used for emergency switch down) + * get/set autoLevelCapping: capping/max level value that could be used by ABR Controller + * destroy(): should clean-up all used resources + */ + abrController: AbrController; + /** + * (default: internal track timeline controller) + * Customized text track syncronization controller. + * Parameter should be a class with a destroy() method: + * destroy() : should clean-up all used resources + */ + timelineController: TimelineController; + /** + * (default: true) + * Whether or not to enable WebVTT captions on HLS + */ + enableWebVTT?: boolean; + /** + * (default: true) + * whether or not to enable CEA-708 captions + */ + enableCEA708Captions: boolean; + /** + * (default: English) + * Label for the text track generated for CEA-708 captions track 1. This is how it will appear in the browser's native menu for subtitles and captions. + */ + captionsTextTrack1Label: string; + /** + * (default: en) + * RFC 3066 language code for the text track generated for CEA-708 captions track 1. + */ + captionsTextTrack1LanguagedCode: string; + /** + * (default: Spanish) + * Label for the text track generated for CEA-708 captions track 2. This is how it will appear in the browser's native menu for subtitles and captions. + */ + captionsTextTrack2Label: string; + /** + * (default: es) + * RFC 3066 language code for the text track generated for CEA-708 captions track 2. + */ + captionsTextTrack2LanguageCode: string; + /** + * (default: false) + * If a segment's video track is shorter than its audio track by > min(maxSeekHole, maxBufferHole), extend the final video frame's duration to match the audio track's duration. + * This helps playback continue in certain cases that might otherwise get stuck. + */ + stretchShortVideoTrack: boolean; + /** + * (default: 1) + * Browsers are really strict about audio frames timings. They usually play audio frames one after the other, regardless of + * the timestamps advertised in the fmp4. If audio timestamps are not consistent (consecutive audio frames too close or too far + * from each other), audio will easily drift. hls.js is restamping audio frames so that the distance between consecutive audio + * frame remains constant. If the distance is larger than the max allowed drift, hls.js will either + * * drop the next audio frame if distance is too small (if next audio frame timestamp is smaller than expected + * timestamp - max allowed drifter) + * * insert silent frames if distance is too big (next audio frame timestamp is bigger than expected + * timestamp + max allowed drift) + * Parameter should be an integer representing the max number of audio frames allowed to drifter. Keep in mind that one + * audio frame is 1024 audio samples (if using AAC), at 44.1 kHz, it gives 1024/44100 = 23ms. + */ + maxAudioFramesDrift: number; + /** + * (default: true) + * Whether or not to force having a key frame in the first AVC sample after a discontinuity. + * If set to true, after a discontinuity, the AVC samples without any key frame will be dropped until finding one that contains a key frame. + * If set to false, all AVC samples will be kept, which can help avoid holes in the stream. + * Setting this parameter to false can also generate decoding weirdness when switching level or seeking. + */ + forceKeyFrameOnDiscontinuity: boolean; + /** + * (default: 5.0) + * Fast bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. + * Half of the estimate is based on the last abrEwmaFastLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than 0 + */ + abrEwmaFastLive: number; + /** + * (default: 9.0) + * Slow bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. + * Half of the estimate is based on the last abrEwmaSlowLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than abrEwmaFastLive + */ + abrEwmaSlowLive: number; + /** + * (default: 4.0) + * Fast bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. + * Half of the estimate is based on the last abrEwmaFastVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than 0 + */ + abrEwmaFastVod: number; + /** + * (default: 15.0) + * Slow bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. + * Half of the estimate is based on the last abrEwmaSlowVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than abrEwmaFastVoD + */ + abrEwmaSlowVod: number; + /** + * (default: 500000) + * Default bandwidth estimate in bits/second prior to collecting fragment bandwidth samples. + * parameter should be a float + */ + abrEwmaDefaultEstimate: number; + /** + * (default: 0.8) + * Scale factor to be applied against measured bandwidth average, to determine whether we can stay on current or lower quality level. + * If abrBandWidthFactor * bandwidth average < level.bitrate then ABR can switch to that level providing that it is equal or less than current level. + */ + abrBandWidthFactor: number; + /** + * (default: 0.7) + * Scale factor to be applied against measured bandwidth average, to determine whether we can switch up to a higher quality level. + * If abrBandWidthUpFactor * bandwidth average < level.bitrate then ABR can switch up to that quality level. + */ + abrBandWidthUpFactor: number; + /** + * (default: false) + * max bitrate used in ABR by avg measured bitrate i.e. if bitrate signaled in variant manifest for a given level is 2Mb/s but average bitrate measured on this level is 2.5Mb/s, + * then if config value is set to true, ABR will use 2.5 Mb/s for this quality level. + */ + abrMaxWithRealBitrate: boolean; + /** + * (default: 0) + * Return the capping/min bandwidth value that could be used by automatic level selection algorithm. + * Useful when browser or tab of the browser is not in the focus and bandwidth drops + */ + minAutoBitrate: number; + } + + interface OptionalConfig { + /** + * (default: false) + * if set to true, the adaptive algorithm with limit levels usable in auto-quality by the HTML video element dimensions (width and height) + * if set to false, levels will not be limited. All available levels could be used in auto-quality mode taking only bandwidth into consideration. + */ + capLevelToPlayerSize?: boolean; + /** + * (default: false) + * setting config.debug = true; will turn on debug logs on JS console. + * a logger object could also be provided for custom logging: config.debug = customLogger; + */ + debug?: boolean; + /** + * (default: true) + * if set to true, start level playlist and first fragments will be loaded automatically, after triggering of Hls.Events.MANIFEST_PARSED event + * if set to false, an explicit API call (hls.startLoad(startPosition=-1)) will be needed to start quality level/fragment loading. + */ + autoStartLoad?: boolean; + /** + * (default -1) + * if set to -1, playback will start from initialTime=0 for VoD and according to liveSyncDuration/liveSyncDurationCount config params for Live + * otherwise, playback will start from predefined value. (unless stated otherwise in autoStartLoad=false mode : in that case startPosition can be overrided using hls.startLoad(startPosition)). + */ + startPosition?: number; + /** + * (default: undefined) + * if audio codec is not signaled in variant manifest, or if only a stream manifest is provided, hls.js tries to guess audio codec by parsing audio sampling rate in ADTS header. + * If sampling rate is less or equal than 22050 Hz, then hls.js assumes it is HE-AAC, otherwise it assumes it is AAC-LC. + * This could result in bad guess, leading to audio decode error, ending up in media error. + * It is possible to hint default audiocodec to hls.js by configuring this value as below: + * mp4a.40.2 (AAC-LC) or + * mp4a.40.5 (HE-AAC) or + * undefined (guess based on sampling rate) + */ + defaultAudioCodec?: string; + /** + * (default: 1) + * number of segments needed to start a playback of Live stream. + */ + initialLiveManifestSize?: number; + /** + * (default: 30 seconds) + * Maximum buffer length in seconds. If buffer length is/become less than this value, a new fragment will be loaded. + * This is the guaranteed buffer length hls.js will try to reach, regardless of maxBufferSize. + */ + maxBufferLength?: number; + /** + * (default 600s) + * Maximum buffer length in seconds. Hls.js will never exceed this value, even if maxBufferSize is not reached yet. + * hls.js tries to buffer up to a maximum number of bytes (60 MB by default) rather than to buffer up to a maximum nb of seconds. + * This is to mimic the browser behaviour (the buffer eviction algorithm is starting after the browser detects that video buffer size reaches a limit in bytes) + * maxBufferLength is the minimum guaranteed buffer length that hls.js will try to achieve, even if that value exceeds the amount of bytes 60 MB of memory. + * maxMaxBufferLength acts as a capping value, as if bitrate is really low, you could need more than one hour of buffer to fill 60 MB. + */ + maxMaxBufferLength?: number; + /** + * (default: 60 MB) + * 'Minimum' maximum buffer size in bytes. If buffer size upfront is bigger than this value, no fragment will be loaded + */ + maxBufferSize?: number; + /** + * (default: 0.5 seconds) + * 'Maximum' inter-fragment buffer hole tolerance that hls.js can cope with when searching for the next fragment to load. When switching between quality level, + * fragments might not be perfectly aligned. + * This could result in small overlapping or hole in media buffer. This tolerance factor helps cope with this. + */ + maxBufferHole?: number; + /** + * (default: 2s) + * In case playback is stalled, and a buffered range is available upfront, less than maxSeekHole seconds from current media position, + * hls.js will jump over this buffer hole to reach the beginning of this following buffered range. + * maxSeekHole allows to configure this jumpable threshold. + */ + maxSeekHole?: number; + /** + * (default: 4s) + * + * ABR algorithm will always try to choose a quality level that should avoid rebuffering. In case no quality level with this criteria can + * be found (lets say for example that buffer length is 1s, but fetching a fragment at lowest quality is predicted to take around 2s ... + * ie we can forecast around 1s of rebuffering ...) then ABR algorithm will try to find a level that should guarantee less than + * maxStarvationDelay of buffering. + */ + maxStarvationDelay?: number; + /** + * (default 0.2s) + * This tolerance factor is used during fragment lookup. + * Instead of checking whether buffered.end is located within [start, end] range, frag lookup will be done by checking within [start-maxFragLookUpTolerance, end-maxFragLookUpTolerance] range. + * This tolerance factor is used to cope with situations like: + * buffered.end = 9.991 + * frag[0] : [0,10] + * frag[1] : [10,20] + * buffered.end is within frag[0] range, but as we are close to frag[1], frag[1] should be choosen instead + * If maxFragLookUpTolerance = 0.2, this lookup will be adjusted to + * frag[0] : [-0.2,9.8] + * frag[1] : [9.8,19.8] + * This time, buffered.end is within frag[1] range, and frag[1] will be the next fragment to be loaded, as expected + */ + maxLoadingDelay?: number; + /** + * (default: 0.5s) + * media element is expected to play and if currentTime has not moved for more than lowBufferWatchdogPeriod and if there are less than maxBufferHole seconds buffered upfront, + * hls.js will try to nudge playhead to recover playback + */ + lowBufferWatchdogPeriod?: number; + /** + * (default: 3s) + * if media element is expected to play and if currentTime has not moved for more than highBufferWatchdogPeriod and if there are more than maxBufferHole seconds buffered upfront, + * hls.js will try to nudge playhead to recover playback + */ + highBufferWatchdogPeriod?: number; + /** + * (default: 0.1s) + * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. + * media.currentTime += (nb nudge retry -1)*nudgeOffset + */ + nudgeOffset?: number; + /** + * (default: 3s) + * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. + * media.currentTime += (nb nudge retry -1)*nudgeOffset + */ + nudgeMaxRetry?: number; + /** + * (default 4s) + * + * max video loading delay used in automatic start level selection : in that mode ABR controller will ensure that video loading time (ie + * the time to fetch the first fragment at lowest quality level + the time to fetch the fragment at the appropriate quality level is less + * than maxLoadingDelay ) + */ + maxFragLookUpTolerance?: number; + /** + * (default: 3) + * edge of live delay, expressed in multiple of EXT-X-TARGETDURATION. if set to 3, playback will start from fragment N-3, N being the last fragment of the live playlist. + * Decreasing this value is likely to cause playback stalls. + */ + liveSyncDurationCount?: number; + /** + * (default: Infinity) + * maximum delay allowed from edge of live, expressed in multiple of EXT-X-TARGETDURATION. + * If set to 10, the player will seek back to liveSyncDurationCount whenever the next fragment to be loaded is older than N-10, N being the last fragment of the live playlist. + * If set, this value must be stricly superior to liveSyncDurationCount a value too close from liveSyncDurationCount is likely to cause playback stalls. + */ + liveMaxLatencyDurationCount?: number; + /** + * (default: undefined) + * Alternative parameter to liveSyncDurationCount, expressed in seconds vs number of segments. + * If defined in the configuration object, liveSyncDuration will take precedence over the default liveSyncDurationCount. + * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. + * A value too low (inferior to ~3 segment durations) is likely to cause playback stalls. + */ + liveSyncDuration?: number; + /** + * (default: undefined) + * Alternative parameter to liveMaxLatencyDurationCount, expressed in seconds vs number of segments. + * If defined in the configuration object, liveMaxLatencyDuration will take precedence over the default liveMaxLatencyDurationCount. + * If set, this value must be stricly superior to liveSyncDuration which must be defined as well. + * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. + * A value too close from liveSyncDuration is likely to cause playback stalls. + */ + liveMaxLatencyDuration?: number; + /** + * (default: false) + * Override current Media Source duration to Infinity for a live broadcast. Useful, if you are building a player which relies + * on native UI capabilities in modern browsers. If you want to have a native Live UI in environments like iOS Safari, Safari, + * Android Google Chrome, etc. set this value to true. + */ + liveDurationInfinity?: boolean; + /** + * (default: true) + * Enable WebWorker (if available on browser) for TS demuxing/MP4 remuxing, to improve performance and avoid lag/frame drops. + */ + enableWorker?: boolean; + /** + * (default: true) + * Enable to use JavaScript version AES decryption for fallback of WebCrypto API. + */ + enableSoftwareAES?: boolean; + /** + * (default: undefined) + * When set, use this level as the default hls.startLevel. Keep in mind that the startLevel set with the API takes precedence over + * config.startLevel configuration parameter. + */ + startLevel?: number; + /** + * (default: 10000ms for level and manifest) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + manifestLoadingTimeOut?: number; + /** + * (default: 3) + * Max number of load retries. + */ + manifestLoadingMaxRetry?: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + manifestLoadingRetryDelay?: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + manifestLoadingMaxRetryTimeout?: number; + /** + * (default: 60000ms for fragment) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + levelLoadingTimeOut?: number; + /** + * (default: 3) + * Max number of load retries. + */ + levelLoadingMaxRetry?: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + levelLoadingRetryDelay?: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + levelLoadingMaxRetryTimeout?: number; + /** + * (default: 60000ms for fragment) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + fragLoadingTimeOut?: number; + /** + * (default: 3) + * Max number of load retries. + */ + fragLoadingMaxRetry?: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + fragLoadingRetryDelay?: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + fragLoadingMaxRetryDelay?: number; + /** + * (default: false) + * Start prefetching start fragment although media not attached yet. Max number of append retries. + */ + startFragPrefetch?: boolean; + /** + * (default: 3) + * Max number of sourceBuffer.appendBuffer() retry upon error. Such error could happen in loop with UHD streams, when internal buffer is full. (Quota Exceeding Error will be triggered). + * In that case we need to wait for the browser to evict some data before being able to append buffer correctly. + */ + appendErrorMaxRetry?: number; + /** + * (default: standard XMLHttpRequest-based URL loader) + * Override standard URL loader by a custom one. Could be useful for P2P or stubbing (testing). + * Use this, if you want to overwrite both the fragment and the playlist loader. + * Note: If fLoader or pLoader are used, they overwrite loader! + */ + loader?: typeof Loader; + /** + * (default: undefined) + * This enables the manipulation of the fragment loader. + * Note: This will overwrite the default loader, as well as your own loader function. + */ + fLoader?: typeof Loader; + /** + * (default: undefined) + * This enables the manipulation of the playlist loader. + * Note: This will overwrite the default loader, as well as your own loader function. + */ + pLoader?: typeof Loader; + /** + * (default: undefined) + * XMLHttpRequest customization callback for default XHR based loader. + * Parameter should be a function with two arguments (xhr: XMLHttpRequest, url: string). + * If xhrSetup is specified, default loader will invoke it before calling xhr.send(). This allows user to easily modify/setup XHR. + */ + xhrSetup?(xhr: XMLHttpRequest, url: string): void; + /** + * (default: undefined) + * Fetch customization callback for Fetch based loader. + * Parameter should be a function with two arguments (context and Request Init Params). + * If fetchSetup is specified and Fetch loader is used, fetchSetup will be triggered to instantiate Request Object. This allows user to easily tweak Fetch loader. + */ + fetchSetup?(context: any, initParams: any): Request; + /** + * (default: internal ABR controller) + * Customized Adaptive Bitrate Streaming Controller. + * Parameter should be a class providing 2 getters, 2 setters and a destroy() method: + * get/set nextAutoLevel: return next auto-quality level/force next auto-quality level that should be returned (currently used for emergency switch down) + * get/set autoLevelCapping: capping/max level value that could be used by ABR Controller + * destroy(): should clean-up all used resources + */ + abrController?: AbrController; + /** + * (default: internal track timeline controller) + * Customized text track syncronization controller. + * Parameter should be a class with a destroy() method: + * destroy() : should clean-up all used resources + */ + timelineController?: TimelineController; + /** + * (default: true) + * Whether or not to enable WebVTT captions on HLS + */ + enableWebVTT?: boolean; + /** + * (default: true) + * whether or not to enable CEA-708 captions + */ + enableCEA708Captions?: boolean; + /** + * (default: English) + * Label for the text track generated for CEA-708 captions track 1. This is how it will appear in the browser's native menu for subtitles and captions. + */ + captionsTextTrack1Label?: string; + /** + * (default: en) + * RFC 3066 language code for the text track generated for CEA-708 captions track 1. + */ + captionsTextTrack1LanguagedCode?: string; + /** + * (default: Spanish) + * Label for the text track generated for CEA-708 captions track 2. This is how it will appear in the browser's native menu for subtitles and captions. + */ + captionsTextTrack2Label?: string; + /** + * (default: es) + * RFC 3066 language code for the text track generated for CEA-708 captions track 2. + */ + captionsTextTrack2LanguageCode?: string; + /** + * (default: false) + * If a segment's video track is shorter than its audio track by > min(maxSeekHole, maxBufferHole), extend the final video frame's duration to match the audio track's duration. + * This helps playback continue in certain cases that might otherwise get stuck. + */ + stretchShortVideoTrack?: boolean; + /** + * (default: 1) + * Browsers are really strict about audio frames timings. They usually play audio frames one after the other, regardless of + * the timestamps advertised in the fmp4. If audio timestamps are not consistent (consecutive audio frames too close or too far + * from each other), audio will easily drift. hls.js is restamping audio frames so that the distance between consecutive audio + * frame remains constant. If the distance is larger than the max allowed drift, hls.js will either + * * drop the next audio frame if distance is too small (if next audio frame timestamp is smaller than expected + * timestamp - max allowed drifter) + * * insert silent frames if distance is too big (next audio frame timestamp is bigger than expected + * timestamp + max allowed drift) + * Parameter should be an integer representing the max number of audio frames allowed to drifter. Keep in mind that one + * audio frame is 1024 audio samples (if using AAC), at 44.1 kHz, it gives 1024/44100 = 23ms. + */ + maxAudioFramesDrift?: number; + /** + * (default: true) + * Whether or not to force having a key frame in the first AVC sample after a discontinuity. + * If set to true, after a discontinuity, the AVC samples without any key frame will be dropped until finding one that contains a key frame. + * If set to false, all AVC samples will be kept, which can help avoid holes in the stream. + * Setting this parameter to false can also generate decoding weirdness when switching level or seeking. + */ + forceKeyFrameOnDiscontinuity?: boolean; + /** + * (default: 5.0) + * Fast bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. + * Half of the estimate is based on the last abrEwmaFastLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than 0 + */ + abrEwmaFastLive?: number; + /** + * (default: 9.0) + * Slow bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. + * Half of the estimate is based on the last abrEwmaSlowLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than abrEwmaFastLive + */ + abrEwmaSlowLive?: number; + /** + * (default: 4.0) + * Fast bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. + * Half of the estimate is based on the last abrEwmaFastVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than 0 + */ + abrEwmaFastVod?: number; + /** + * (default: 15.0) + * Slow bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. + * Half of the estimate is based on the last abrEwmaSlowVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than abrEwmaFastVoD + */ + abrEwmaSlowVod?: number; + /** + * (default: 500000) + * Default bandwidth estimate in bits/second prior to collecting fragment bandwidth samples. + * parameter should be a float + */ + abrEwmaDefaultEstimate?: number; + /** + * (default: 0.8) + * Scale factor to be applied against measured bandwidth average, to determine whether we can stay on current or lower quality level. + * If abrBandWidthFactor * bandwidth average < level.bitrate then ABR can switch to that level providing that it is equal or less than current level. + */ + abrBandWidthFactor?: number; + /** + * (default: 0.7) + * Scale factor to be applied against measured bandwidth average, to determine whether we can switch up to a higher quality level. + * If abrBandWidthUpFactor * bandwidth average < level.bitrate then ABR can switch up to that quality level. + */ + abrBandWidthUpFactor?: number; + /** + * (default: false) + * max bitrate used in ABR by avg measured bitrate i.e. if bitrate signaled in variant manifest for a given level is 2Mb/s but average bitrate measured on this level is 2.5Mb/s, + * then if config value is set to true, ABR will use 2.5 Mb/s for this quality level. + */ + abrMaxWithRealBitrate?: boolean; + /** + * (default: 0) + * Return the capping/min bandwidth value that could be used by automatic level selection algorithm. + * Useful when browser or tab of the browser is not in the focus and bandwidth drops + */ + minAutoBitrate?: number; + } + + /** + * a Level object represents a given quality level and contains quality level related info + */ + interface Level { + /** + * level url. might contain sever items if failover/redundant streams are found in the manifest + */ + url: string[]; + /** + * level bitrate + */ + bitrate: number; + /** + * level name + */ + name: string; + /** + * used codecs + */ + codecs: string; + /** + * video width + */ + width: number; + /** + * video height + */ + height: number; + /** + * level details + */ + details: LevelDetails; + } + + /** + * a LevelDetails object contains level details retrieved after level playlist parsing + */ + interface LevelDetails { + /** + * protocol version + */ + version: number; + /** + * playlist type + */ + type: string; + /** + * start sequence number + */ + startSN: number; + /** + * end sequence number + */ + endSN: number; + /** + * level total duration + */ + totalduration: number; + /** + * level fragment target duration + */ + targetduration: number; + /** + * average fragment duration + */ + averagetargetduration: number; + /** + * array of fragments info + */ + fragments: Fragment[]; + /** + * is this level a live playlist or not? + */ + live: boolean; + } + + /** + * the Fragment object contains fragment related info + */ + interface Fragment { + /** + * fragment duration + */ + duration: number; + /** + * fragment level identifier + */ + level: number; + /** + * fragment sequence number + */ + sn: number; + /** + * fragment start offset + */ + start: number; + /** + * fragment url + */ + url: string; + /** + * stream start date and time + */ + programDateTime: Date; + /** + * continuity count + */ + cc: number; + /** + * list of tags associated with the fragment + */ + tagList: string[][]; + /** + * fragment title + */ + title: string; + } + + interface Data { + /** + * videoElement + */ + video?: HTMLVideoElement; + /** + * media source + */ + mediaSource?: string; + /** + * manifest url + */ + url?: string; + /** + * available quality levels + */ + levels?: number[]; + /** + * available audio tracks + */ + audioTracks?: AudioTrack[]; + /** + * XMLHttp request stats + */ + stats?: HlsStats; + /** + * index of first quality level appearing in Manifest + */ + firstLevel?: number; + /** + * id of updated level + */ + level?: number; + /** + * id of loaded level + */ + levelId?: number; + /** + * ErrorDetails type or Level Details + */ + details?: string | LevelDetails; + /** + * PTS drift observed when parsing last fragment + */ + drift?: number; + /** + * fragment object with frag.loaded=stats.loaded + */ + frag?: Fragment; + /** + * fragment payload + */ + payload?: any; // TODO: what is the payload? + /** + * id of level or demuxer + */ + id?: number; + /** + * moof MP4 box + */ + moof?: any; // TODO: whats is the moof? + /** + * mdat MP4 box + */ + mdat?: any; // TODO: what is mdat? + /** + * PTS of first sample + */ + startPTS?: number; + /** + * PTS of last sample + */ + endPTS?: number; + /** + * DTS of first sample + */ + startDTS?: number; + /** + * DTS of last sample + */ + endDTS?: number; + /** + * stream type (audio or video) + */ + type?: string; + /** + * number of samples + */ + nb?: number; + /** + * number of dropped frames in last monitoring period + */ + currentDropped?: number; + /** + * number of decoded frames in last monitoring period + */ + currentDecode?: number; + /** + * total dropped frames on this video element + */ + totalDropped?: number; + /** + * level has to much dropped frame will be restricted + */ + droppedLevel?: number; + /** + * is error fatal or not. + * if error is not fatal, hls.js will try to recover it + * if error is fatal, an action is required to (try to) recover it + */ + fatal?: boolean; + } + + /** + * (default: internal ABR controller) + * Customized Adaptive Bitrate Streaming Controller. + */ + interface AbrController { + /** + * get: capping/max level value that could be used by ABR Controller + * set: capping/max level value that could be used by ABR Controller + */ + autoLevelCapping: number; + /** + * accumulated handled events + */ + handledEvents: string[]; + /** + * current hls instance + */ + hls: Hls; + /** + * last fragments corresponding level + */ + lastLoadedFragLevel: number; + /** + * get: next auto-quality levele/force next auto-quality level that should be returned + * set: next auto-quality levele/force next auto-quality level that should be returned + * - currently used for emergency switch down + */ + nextAutoLevel: number; + useGenericHandler: boolean; + } + + /** + * Customized text track syncronization controller. + */ + interface TimelineController { + /** + * clean-up all used resources + */ + destory(): void; + } + + interface LoaderResponse { + url: string; + data: string | ArrayBuffer; + } + + interface LoaderStats { + /** + * performance.now() just after load() has been called + */ + trequest: number; + /** + * performance.now() of first received byte + */ + tfirst: number; + /** + * performance.now() on load complete + */ + tload: number; + /** + * number of loaded bytes + */ + loaded: number; + /** + * download bandwitdh in bit/s + */ + bw: number; + /** + * total nb of bytes + */ + total: number; + } + + interface LoaderError { + /** + * error code + */ + code: number; + /** + * error description + */ + text: string; + } + + interface HlsStats { + /** + * performance.now() just after load() has been called + */ + trequest: number; + /** + * performance.now() of first received byte + */ + tfirst: number; + /** + * performance.now() on load complete + */ + tload: number; + mtime: number; + tbuffered?: number; + length?: number; + } + + interface LoaderContext { + /** + * target URL + */ + url: string; + /** + * loader response type (arraybuffer or default response type for playlist) + */ + responseType: string; + /** + * start byte range offset + */ + rangeStart?: number; + /** + * end byte range offset + */ + rangeEnd?: number; + /** + * true if onProgress should report partial chunk of loaded content + */ + progressData?: boolean; + /** + * fragment object + */ + frag: Fragment; + /** + * request type + * - level, manifest + */ + type: string; + /** + * level id + */ + level: number; + } + + interface LoaderConfig { + /** + * Max number of load retries + */ + maxRetry: number; + /** + * Timeout after which `onTimeOut` callback will be triggered (if loading is still not finished after that delay) + */ + timeout: number; + /** + * Delay between an I/O error and following connection retry (ms). This to avoid spamming the server + */ + retryDelay: number; + /** + * max connection retry delay (ms) + */ + maxRetryDelay: number; + } + + interface LoaderCallbacks { + onSuccess(response: LoaderResponse, stats: LoaderStats, context: LoaderContext): void; + onProgress(stats: LoaderStats, context: LoaderContext, data: string | ArrayBuffer): void; + onError(error: LoaderError, context: LoaderContext): void; + onTimeout(stats: LoaderStats, context: LoaderContext): void; + } +} + +declare class Hls { + /** + * Constructor. Can be provided an HlsConfig object as default properties and or overrides + */ + constructor(config?: Hls.OptionalConfig) + /** + * return array of available quality levels + */ + levels: Hls.Level[]; + /** + * get: return current playback quality level + * set: trigger an immediate quality level switch to new quality level + * this will pause the video if it was playing, flush the whole buffer, + * and fetch fragment matching with current position and requested quality level + * then resume the video if needed once fetched fragment will have been buffered + * + * set to -1 for automatic level selection + */ + currentLevel: number; + /** + * capping/max level (index of level) that could be used by ABR Controller. Defaults to -1 + * which means no limit + * set: max level value that could be used by the ABR Controller + */ + autoLevelCapping: number; + /** + * return start level index (level of first fragment that will be played back) + * if not overrided by user: first level appearing in manifest will be used as start level + * if -1: automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment) + * + * default valus is hls.firstLevel + */ + startLevel: number; /** * (default: true) * if set to true, start level playlist and first fragments will be loaded automatically, after triggering of Hls.Events.MANIFEST_PARSED event @@ -474,1347 +1770,111 @@ declare namespace Hls { */ autoStartLoad: boolean; /** - * (default -1) - * if set to -1, playback will start from initialTime=0 for VoD and according to liveSyncDuration/liveSyncDurationCount config params for Live - * otherwise, playback will start from predefined value. (unless stated otherwise in autoStartLoad=false mode : in that case startPosition can be overrided using hls.startLoad(startPosition)). + * get: Return the bound videoElement from the hls instance */ - startPosition: number; + media: HTMLVideoElement; /** - * (default: false) - * if set to true, the adaptive algorithm with limit levels usable in auto-quality by the HTML video element dimensions (width and height) - * if set to false, levels will not be limited. All available levels could be used in auto-quality mode taking only bandwidth into consideration. + * hls.js config */ - capLevelToPlayerSize: boolean; + config: Hls.Config; /** - * (default: false) - * setting config.debug = true; will turn on debug logs on JS console. - * a logger object could also be provided for custom logging: config.debug = customLogger; - */ - debug: boolean; - /** - * (default: undefined) - * if audio codec is not signaled in variant manifest, or if only a stream manifest is provided, hls.js tries to guess audio codec by parsing audio sampling rate in ADTS header. - * If sampling rate is less or equal than 22050 Hz, then hls.js assumes it is HE-AAC, otherwise it assumes it is AAC-LC. - * This could result in bad guess, leading to audio decode error, ending up in media error. - * It is possible to hint default audiocodec to hls.js by configuring this value as below: - * mp4a.40.2 (AAC-LC) or - * mp4a.40.5 (HE-AAC) or - * undefined (guess based on sampling rate) - */ - defaultAudioCodec: string; - /** - * (default: 1) - * number of segments needed to start a playback of Live stream. - */ - initialLiveManifestSize: number; - /** - * (default: 30 seconds) - * Maximum buffer length in seconds. If buffer length is/become less than this value, a new fragment will be loaded. - * This is the guaranteed buffer length hls.js will try to reach, regardless of maxBufferSize. - */ - maxBufferLength: number; - /** - * (default 600s) - * Maximum buffer length in seconds. Hls.js will never exceed this value, even if maxBufferSize is not reached yet. - * hls.js tries to buffer up to a maximum number of bytes (60 MB by default) rather than to buffer up to a maximum nb of seconds. - * This is to mimic the browser behaviour (the buffer eviction algorithm is starting after the browser detects that video buffer size reaches a limit in bytes) - * maxBufferLength is the minimum guaranteed buffer length that hls.js will try to achieve, even if that value exceeds the amount of bytes 60 MB of memory. - * maxMaxBufferLength acts as a capping value, as if bitrate is really low, you could need more than one hour of buffer to fill 60 MB. - */ - maxMaxBufferLength: number; - /** - * (default: 60 MB) - * 'Minimum' maximum buffer size in bytes. If buffer size upfront is bigger than this value, no fragment will be loaded - */ - maxBufferSize: number; - /** - * (default: 0.5 seconds) - * 'Maximum' inter-fragment buffer hole tolerance that hls.js can cope with when searching for the next fragment to load. When switching between quality level, - * fragments might not be perfectly aligned. - * This could result in small overlapping or hole in media buffer. This tolerance factor helps cope with this. - */ - maxBufferHole: number; - /** - * (default: 4s) + * get: return next playback quality level (playback quality level for next buffered fragment) + * return -1 if next fragment not buffered yet + * set: trigger a quality level switch for next fragment + * this could eventually flush already buffered next fragment * - * ABR algorithm will always try to choose a quality level that should avoid rebuffering. In case no quality level with this criteria can - * be found (lets say for example that buffer length is 1s, but fetching a fragment at lowest quality is predicted to take around 2s ... - * ie we can forecast around 1s of rebuffering ...) then ABR algorithm will try to find a level that should guarantee less than - * maxStarvationDelay of buffering. + * set to -1 for automatic level selection */ - maxStarvationDelay: number; + nextLevel: number; /** - * (default: 2s) - * In case playback is stalled, and a buffered range is available upfront, less than maxSeekHole seconds from current media position, - * hls.js will jump over this buffer hole to reach the beginning of this following buffered range. - * maxSeekHole allows to configure this jumpable threshold. + * get: return last loaded fragment quality level + * set: quality level for next loaded fragment + * set to -1 for automatic level selection */ - maxSeekHole: number; + loadLevel: number; /** - * (default: 0.5s) - * media element is expected to play and if currentTime has not moved for more than lowBufferWatchdogPeriod and if there are less than maxBufferHole seconds buffered upfront, - * hls.js will try to nudge playhead to recover playback + * get: return quality level that will be used to load next fragment + * set: force quality level for next loaded fragment + * quality level will be forced only for that fragment + * after a fragment at this quality level has been loaded, hls.loadLevel will prevail */ - lowBufferWatchdogPeriod: number; + nextLoadLevel: number; /** - * (default: 3s) - * if media element is expected to play and if currentTime has not moved for more than highBufferWatchdogPeriod and if there are more than maxBufferHole seconds buffered upfront, - * hls.js will try to nudge playhead to recover playback + * first level index (index of first level appearing in Manifest. it is usually defined as start level hint for player) */ - highBufferWatchdogPeriod: number; + firstLevel: number; /** - * (default: 0.1s) - * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. - * media.currentTime += (nb nudge retry -1)*nudgeOffset + * array of audio tracks exposed in manifest */ - nudgeOffset: number; + audioTracks: AudioTrack[]; /** - * (default: 3s) - * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. - * media.currentTime += (nb nudge retry -1)*nudgeOffset + * get: returns audio track id + * set: sets audio track id (returned by) */ - nudgeMaxRetry: number; + audioTrack: number; /** - * (default 0.2s) - * This tolerance factor is used during fragment lookup. - * Instead of checking whether buffered.end is located within [start, end] range, frag lookup will be done by checking within [start-maxFragLookUpTolerance, end-maxFragLookUpTolerance] range. - * This tolerance factor is used to cope with situations like: - * buffered.end = 9.991 - * frag[0] : [0,10] - * frag[1] : [10,20] - * buffered.end is within frag[0] range, but as we are close to frag[1], frag[1] should be choosen instead - * If maxFragLookUpTolerance = 0.2, this lookup will be adjusted to - * frag[0] : [-0.2,9.8] - * frag[1] : [9.8,19.8] - * This time, buffered.end is within frag[1] range, and frag[1] will be the next fragment to be loaded, as expected + * position of live sync point (ie edge of live position minus safety delay defined by hls.config.liveSyncDuration) */ - maxLoadingDelay: number; + liveSyncPosition: number; /** - * (default 4s) + * calling this method will: + * bind videoElement and hls instances + * create MediaSource and set it as video source + * once MediaSource object is successfully created, MEDIA_ATTACHED event will be fired + */ + attachMedia(videoElement: HTMLVideoElement): void; + /** + * calling this method will: + * unbind VideoElement from hls instance + * signal the end of the stream on MediaSource + * reset video source ( video.src = '' ) + */ + detachMedia(): void; + /** + * tell whether auto level selection is enabled or not + */ + autoLevelEnabled(enabled: boolean): boolean; + /** + * loads provided url as media source + */ + loadSource(source: string): void; + /** + * by default, hls.js will automatically start loading quality level playlists, and fragments after Hls.Events.MANIFEST_PARSED event has been triggered (and video element has been attached) + * however if config.autoStartLoad is set to false, hls.startLoad() needs to be called to manually start playlist and fragments loading * - * max video loading delay used in automatic start level selection : in that mode ABR controller will ensure that video loading time (ie - * the time to fetch the first fragment at lowest quality level + the time to fetch the fragment at the appropriate quality level is less - * than maxLoadingDelay ) + * start/restart playlist/fragment loading. this is only effective if MANIFEST_PARSED event has been triggered and video element has been attached to hls object + * startPosition is the initial position in the playlist + * ff startPosition is not set to -1, it allows to override default startPosition to the one you want + * (it will bypass hls.config.liveSync* config params for Live for example, so that user can start playback from whatever position) */ - maxFragLookUpTolerance: number; + startLoad(startPosition?: number): void; /** - * (default: 3) - * edge of live delay, expressed in multiple of EXT-X-TARGETDURATION. if set to 3, playback will start from fragment N-3, N being the last fragment of the live playlist. - * Decreasing this value is likely to cause playback stalls. + * stop playlist/fragment loading. could be resumed later on by calling hls.startLoad() */ - liveSyncDurationCount: number; + stopLoad(): void; /** - * (default: undefined) - * Alternative parameter to liveSyncDurationCount, expressed in seconds vs number of segments. - * If defined in the configuration object, liveSyncDuration will take precedence over the default liveSyncDurationCount. - * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. - * A value too low (inferior to ~3 segment durations) is likely to cause playback stalls. + * should be invoked to recover media error. */ - liveSyncDuration: number; + recoverMediaError(): void; /** - * (default: Infinity) - * maximum delay allowed from edge of live, expressed in multiple of EXT-X-TARGETDURATION. - * If set to 10, the player will seek back to liveSyncDurationCount whenever the next fragment to be loaded is older than N-10, N being the last fragment of the live playlist. - * If set, this value must be stricly superior to liveSyncDurationCount a value too close from liveSyncDurationCount is likely to cause playback stalls. + * if media error are still raised after calling hls.recoverMediaError(), calling this method, could be useful to workaround audio codec mismatch. + * the workflow should be: + * on First Media Error : call hls.recoverMediaError() + * if another Media Error is raised 'quickly' after this first Media Error : first call hls.swapAudioCodec(), then call hls.recoverMediaError() */ - liveMaxLatencyDurationCount: number; + swapAudioCodec(): void; /** - * (default: undefined) - * Alternative parameter to liveMaxLatencyDurationCount, expressed in seconds vs number of segments. - * If defined in the configuration object, liveMaxLatencyDuration will take precedence over the default liveMaxLatencyDurationCount. - * If set, this value must be stricly superior to liveSyncDuration which must be defined as well. - * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. - * A value too close from liveSyncDuration is likely to cause playback stalls. + * should be called to free used resources and destroy hls context */ - liveMaxLatencyDuration: number; + destroy(): void; /** - * (default: true) - * Enable WebWorker (if available on browser) for TS demuxing/MP4 remuxing, to improve performance and avoid lag/frame drops. + * hls.js event listener */ - enableWorker: boolean; + on(event: string, callback: (event: string, data: Hls.Data) => void): void; /** - * (default: true) - * Enable to use JavaScript version AES decryption for fallback of WebCrypto API. + * remove hls.js event listener */ - enableSoftwareAES: boolean; - /** - * (default: undefined) - * When set, use this level as the default hls.startLevel. Keep in mind that the startLevel set with the API takes precedence over - * config.startLevel configuration parameter. - */ - startLevel: number; - /** - * (default: 10000ms for level and manifest) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - manifestLoadingTimeOut: number; - /** - * (default: 3) - * Max number of load retries. - */ - manifestLoadingMaxRetry: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - manifestLoadingRetryDelay: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - manifestLoadingMaxRetryTimeout: number; - /** - * (default: 60000ms for fragment) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - levelLoadingTimeOut: number; - /** - * (default: 3) - * Max number of load retries. - */ - levelLoadingMaxRetry: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - levelLoadingRetryDelay: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - levelLoadingMaxRetryTimeout: number; - /** - * (default: 60000ms for fragment) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - fragLoadingTimeOut: number; - /** - * (default: 3) - * Max number of load retries. - */ - fragLoadingMaxRetry: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - fragLoadingRetryDelay: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - fragLoadingMaxRetryDelay: number; - /** - * (default: false) - * Start prefetching start fragment although media not attached yet. Max number of append retries. - */ - startFragPrefech: boolean; - /** - * (default: 3) - * Max number of sourceBuffer.appendBuffer() retry upon error. Such error could happen in loop with UHD streams, when internal buffer is full. (Quota Exceeding Error will be triggered). - * In that case we need to wait for the browser to evict some data before being able to append buffer correctly. - */ - appendErrorMaxRetry: number; - /** - * (default: standard XMLHttpRequest-based URL loader) - * Override standard URL loader by a custom one. Could be useful for P2P or stubbing (testing). - * Use this, if you want to overwrite both the fragment and the playlist loader. - * Note: If fLoader or pLoader are used, they overwrite loader! - */ - loader: typeof Loader; - /** - * (default: undefined) - * This enables the manipulation of the fragment loader. - * Note: This will overwrite the default loader, as well as your own loader function. - */ - fLoader?: typeof Loader; - /** - * (default: undefined) - * This enables the manipulation of the playlist loader. - * Note: This will overwrite the default loader, as well as your own loader function. - */ - pLoader?: typeof Loader; - /** - * (default: undefined) - * XMLHttpRequest customization callback for default XHR based loader. - * Parameter should be a function with two arguments (xhr: XMLHttpRequest, url: string). - * If xhrSetup is specified, default loader will invoke it before calling xhr.send(). This allows user to easily modify/setup XHR. - */ - xhrSetup?(xhr: XMLHttpRequest, url: string): void; - /** - * (default: undefined) - * Fetch customization callback for Fetch based loader. - * Parameter should be a function with two arguments (context and Request Init Params). - * If fetchSetup is specified and Fetch loader is used, fetchSetup will be triggered to instantiate Request Object. This allows user to easily tweak Fetch loader. - */ - fetchSetup?(context: any, initParams: any): Request; - /** - * (default: internal ABR controller) - * Customized Adaptive Bitrate Streaming Controller. - * Parameter should be a class providing 2 getters, 2 setters and a destroy() method: - * get/set nextAutoLevel: return next auto-quality level/force next auto-quality level that should be returned (currently used for emergency switch down) - * get/set autoLevelCapping: capping/max level value that could be used by ABR Controller - * destroy(): should clean-up all used resources - */ - abrController: AbrController; - /** - * (default: internal track timeline controller) - * Customized text track syncronization controller. - * Parameter should be a class with a destroy() method: - * destroy() : should clean-up all used resources - */ - timelineController: TimelineController; - /** - * (default: true) - * whether or not to enable CEA-708 captions - */ - enableCEA708Captions: boolean; - /** - * (default: English) - * Label for the text track generated for CEA-708 captions track 1. This is how it will appear in the browser's native menu for subtitles and captions. - */ - captionsTextTrack1Label: string; - /** - * (default: en) - * RFC 3066 language code for the text track generated for CEA-708 captions track 1. - */ - captionsTextTrack1LanguagedCode: string; - /** - * (default: Spanish) - * Label for the text track generated for CEA-708 captions track 2. This is how it will appear in the browser's native menu for subtitles and captions. - */ - captionsTextTrack2Label: string; - /** - * (default: es) - * RFC 3066 language code for the text track generated for CEA-708 captions track 2. - */ - captionsTextTrack2LanguageCode: string; - /** - * (default: false) - * If a segment's video track is shorter than its audio track by > min(maxSeekHole, maxBufferHole), extend the final video frame's duration to match the audio track's duration. - * This helps playback continue in certain cases that might otherwise get stuck. - */ - stretchShortVideoTrack: boolean; - /** - * (default: true) - * Whether or not to force having a key frame in the first AVC sample after a discontinuity. - * If set to true, after a discontinuity, the AVC samples without any key frame will be dropped until finding one that contains a key frame. - * If set to false, all AVC samples will be kept, which can help avoid holes in the stream. Setting this parameter to false can also generate decoding weirdness when switching level or seeking. - */ - forceKeyFrameOnDiscontinuity: boolean; - /** - * (default: 5.0) - * Fast bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. - * Half of the estimate is based on the last abrEwmaFastLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than 0 - */ - abrEwmaFastLive: number; - /** - * (default: 9.0) - * Slow bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. - * Half of the estimate is based on the last abrEwmaSlowLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than abrEwmaFastLive - */ - abrEwmaSlowLive: number; - /** - * (default: 4.0) - * Fast bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. - * Half of the estimate is based on the last abrEwmaFastVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than 0 - */ - abrEwmaFastVod: number; - /** - * (default: 15.0) - * Slow bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. - * Half of the estimate is based on the last abrEwmaSlowVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than abrEwmaFastVoD - */ - abrEwmaSlowVod: number; - /** - * (default: 500000) - * Default bandwidth estimate in bits/second prior to collecting fragment bandwidth samples. - * parameter should be a float - */ - abrEwmaDefaultEstimate: number; - /** - * (default: 0.8) - * Scale factor to be applied against measured bandwidth average, to determine whether we can stay on current or lower quality level. - * If abrBandWidthFactor * bandwidth average < level.bitrate then ABR can switch to that level providing that it is equal or less than current level. - */ - abrBandWidthFactor: number; - /** - * (default: 0.7) - * Scale factor to be applied against measured bandwidth average, to determine whether we can switch up to a higher quality level. - * If abrBandWidthUpFactor * bandwidth average < level.bitrate then ABR can switch up to that quality level. - */ - abrBandWidthUpFactor: number; - /** - * (default: false) - * max bitrate used in ABR by avg measured bitrate i.e. if bitrate signaled in variant manifest for a given level is 2Mb/s but average bitrate measured on this level is 2.5Mb/s, - * then if config value is set to true, ABR will use 2.5 Mb/s for this quality level. - */ - abrMaxWithRealBitrate: boolean; - /** - * (default: 0) - * Return the capping/min bandwidth value that could be used by automatic level selection algorithm. - * Useful when browser or tab of the browser is not in the focus and bandwidth drops - */ - minAutoBitrate: number; - } - - interface OptionalConfig { - /** - * (default: true) - * if set to true, start level playlist and first fragments will be loaded automatically, after triggering of Hls.Events.MANIFEST_PARSED event - * if set to false, an explicit API call (hls.startLoad(startPosition=-1)) will be needed to start quality level/fragment loading. - */ - autoStartLoad?: boolean; - /** - * (default -1) - * if set to -1, playback will start from initialTime=0 for VoD and according to liveSyncDuration/liveSyncDurationCount config params for Live - * otherwise, playback will start from predefined value. (unless stated otherwise in autoStartLoad=false mode : in that case startPosition can be overrided using hls.startLoad(startPosition)). - */ - startPosition?: number; - /** - * (default: false) - * if set to true, the adaptive algorithm with limit levels usable in auto-quality by the HTML video element dimensions (width and height) - * if set to false, levels will not be limited. All available levels could be used in auto-quality mode taking only bandwidth into consideration. - */ - capLevelToPlayerSize?: boolean; - /** - * (default: false) - * setting config.debug = true; will turn on debug logs on JS console. - * a logger object could also be provided for custom logging: config.debug = customLogger; - */ - debug?: boolean; - /** - * (default: undefined) - * if audio codec is not signaled in variant manifest, or if only a stream manifest is provided, hls.js tries to guess audio codec by parsing audio sampling rate in ADTS header. - * If sampling rate is less or equal than 22050 Hz, then hls.js assumes it is HE-AAC, otherwise it assumes it is AAC-LC. - * This could result in bad guess, leading to audio decode error, ending up in media error. - * It is possible to hint default audiocodec to hls.js by configuring this value as below: - * mp4a.40.2 (AAC-LC) or - * mp4a.40.5 (HE-AAC) or - * undefined (guess based on sampling rate) - */ - defaultAudioCodec?: string; - /** - * (default: 1) - * number of segments needed to start a playback of Live stream. - */ - initialLiveManifestSize?: number; - /** - * (default: 30 seconds) - * Maximum buffer length in seconds. If buffer length is/become less than this value, a new fragment will be loaded. - * This is the guaranteed buffer length hls.js will try to reach, regardless of maxBufferSize. - */ - maxBufferLength?: number; - /** - * (default 600s) - * Maximum buffer length in seconds. Hls.js will never exceed this value, even if maxBufferSize is not reached yet. - * hls.js tries to buffer up to a maximum number of bytes (60 MB by default) rather than to buffer up to a maximum nb of seconds. - * This is to mimic the browser behaviour (the buffer eviction algorithm is starting after the browser detects that video buffer size reaches a limit in bytes) - * maxBufferLength is the minimum guaranteed buffer length that hls.js will try to achieve, even if that value exceeds the amount of bytes 60 MB of memory. - * maxMaxBufferLength acts as a capping value, as if bitrate is really low, you could need more than one hour of buffer to fill 60 MB. - */ - maxMaxBufferLength?: number; - /** - * (default: 60 MB) - * 'Minimum' maximum buffer size in bytes. If buffer size upfront is bigger than this value, no fragment will be loaded - */ - maxBufferSize?: number; - /** - * (default: 0.5 seconds) - * 'Maximum' inter-fragment buffer hole tolerance that hls.js can cope with when searching for the next fragment to load. When switching between quality level, - * fragments might not be perfectly aligned. - * This could result in small overlapping or hole in media buffer. This tolerance factor helps cope with this. - */ - maxBufferHole?: number; - /** - * (default: 4s) - * - * ABR algorithm will always try to choose a quality level that should avoid rebuffering. In case no quality level with this criteria can - * be found (lets say for example that buffer length is 1s, but fetching a fragment at lowest quality is predicted to take around 2s ... - * ie we can forecast around 1s of rebuffering ...) then ABR algorithm will try to find a level that should guarantee less than - * maxStarvationDelay of buffering. - */ - maxStarvationDelay?: number; - /** - * (default: 2s) - * In case playback is stalled, and a buffered range is available upfront, less than maxSeekHole seconds from current media position, - * hls.js will jump over this buffer hole to reach the beginning of this following buffered range. - * maxSeekHole allows to configure this jumpable threshold. - */ - maxSeekHole?: number; - /** - * (default: 0.5s) - * media element is expected to play and if currentTime has not moved for more than lowBufferWatchdogPeriod and if there are less than maxBufferHole seconds buffered upfront, - * hls.js will try to nudge playhead to recover playback - */ - lowBufferWatchdogPeriod?: number; - /** - * (default: 3s) - * if media element is expected to play and if currentTime has not moved for more than highBufferWatchdogPeriod and if there are more than maxBufferHole seconds buffered upfront, - * hls.js will try to nudge playhead to recover playback - */ - highBufferWatchdogPeriod?: number; - /** - * (default: 0.1s) - * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. - * media.currentTime += (nb nudge retry -1)*nudgeOffset - */ - nudgeOffset?: number; - /** - * (default: 3s) - * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. - * media.currentTime += (nb nudge retry -1)*nudgeOffset - */ - nudgeMaxRetry?: number; - /** - * (default 0.2s) - * This tolerance factor is used during fragment lookup. - * Instead of checking whether buffered.end is located within [start, end] range, frag lookup will be done by checking within [start-maxFragLookUpTolerance, end-maxFragLookUpTolerance] range. - * This tolerance factor is used to cope with situations like: - * buffered.end = 9.991 - * frag[0] : [0,10] - * frag[1] : [10,20] - * buffered.end is within frag[0] range, but as we are close to frag[1], frag[1] should be choosen instead - * If maxFragLookUpTolerance = 0.2, this lookup will be adjusted to - * frag[0] : [-0.2,9.8] - * frag[1] : [9.8,19.8] - * This time, buffered.end is within frag[1] range, and frag[1] will be the next fragment to be loaded, as expected - */ - maxLoadingDelay?: number; - /** - * (default 4s) - * - * max video loading delay used in automatic start level selection : in that mode ABR controller will ensure that video loading time (ie - * the time to fetch the first fragment at lowest quality level + the time to fetch the fragment at the appropriate quality level is less - * than maxLoadingDelay ) - */ - maxFragLookUpTolerance?: number; - /** - * (default: 3) - * edge of live delay, expressed in multiple of EXT-X-TARGETDURATION. if set to 3, playback will start from fragment N-3, N being the last fragment of the live playlist. - * Decreasing this value is likely to cause playback stalls. - */ - liveSyncDurationCount?: number; - /** - * (default: undefined) - * Alternative parameter to liveSyncDurationCount, expressed in seconds vs number of segments. - * If defined in the configuration object, liveSyncDuration will take precedence over the default liveSyncDurationCount. - * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. - * A value too low (inferior to ~3 segment durations) is likely to cause playback stalls. - */ - liveSyncDuration?: number; - /** - * (default: Infinity) - * maximum delay allowed from edge of live, expressed in multiple of EXT-X-TARGETDURATION. - * If set to 10, the player will seek back to liveSyncDurationCount whenever the next fragment to be loaded is older than N-10, N being the last fragment of the live playlist. - * If set, this value must be stricly superior to liveSyncDurationCount a value too close from liveSyncDurationCount is likely to cause playback stalls. - */ - liveMaxLatencyDurationCount?: number; - /** - * (default: undefined) - * Alternative parameter to liveMaxLatencyDurationCount, expressed in seconds vs number of segments. - * If defined in the configuration object, liveMaxLatencyDuration will take precedence over the default liveMaxLatencyDurationCount. - * If set, this value must be stricly superior to liveSyncDuration which must be defined as well. - * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. - * A value too close from liveSyncDuration is likely to cause playback stalls. - */ - liveMaxLatencyDuration?: number; - /** - * (default: true) - * Enable WebWorker (if available on browser) for TS demuxing/MP4 remuxing, to improve performance and avoid lag/frame drops. - */ - enableWorker?: boolean; - /** - * (default: true) - * Enable to use JavaScript version AES decryption for fallback of WebCrypto API. - */ - enableSoftwareAES?: boolean; - /** - * (default: undefined) - * When set, use this level as the default hls.startLevel. Keep in mind that the startLevel set with the API takes precedence over - * config.startLevel configuration parameter. - */ - startLevel?: number; - /** - * (default: 10000ms for level and manifest) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - manifestLoadingTimeOut?: number; - /** - * (default: 3) - * Max number of load retries. - */ - manifestLoadingMaxRetry?: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - manifestLoadingRetryDelay?: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - manifestLoadingMaxRetryTimeout?: number; - /** - * (default: 60000ms for fragment) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - levelLoadingTimeOut?: number; - /** - * (default: 3) - * Max number of load retries. - */ - levelLoadingMaxRetry?: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - levelLoadingRetryDelay?: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - levelLoadingMaxRetryTimeout?: number; - /** - * (default: 60000ms for fragment) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - fragLoadingTimeOut?: number; - /** - * (default: 3) - * Max number of load retries. - */ - fragLoadingMaxRetry?: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - fragLoadingRetryDelay?: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - fragLoadingMaxRetryDelay?: number; - /** - * (default: false) - * Start prefetching start fragment although media not attached yet. Max number of append retries. - */ - startFragPrefech?: boolean; - /** - * (default: 3) - * Max number of sourceBuffer.appendBuffer() retry upon error. Such error could happen in loop with UHD streams, when internal buffer is full. (Quota Exceeding Error will be triggered). - * In that case we need to wait for the browser to evict some data before being able to append buffer correctly. - */ - appendErrorMaxRetry?: number; - /** - * (default: standard XMLHttpRequest-based URL loader) - * Override standard URL loader by a custom one. Could be useful for P2P or stubbing (testing). - * Use this, if you want to overwrite both the fragment and the playlist loader. - * Note: If fLoader or pLoader are used, they overwrite loader! - */ - loader?: typeof Loader; - /** - * (default: undefined) - * This enables the manipulation of the fragment loader. - * Note: This will overwrite the default loader, as well as your own loader function. - */ - fLoader?: typeof Loader; - /** - * (default: undefined) - * This enables the manipulation of the playlist loader. - * Note: This will overwrite the default loader, as well as your own loader function. - */ - pLoader?: typeof Loader; - /** - * (default: undefined) - * XMLHttpRequest customization callback for default XHR based loader. - * Parameter should be a function with two arguments (xhr: XMLHttpRequest, url: string). - * If xhrSetup is specified, default loader will invoke it before calling xhr.send(). This allows user to easily modify/setup XHR. - */ - xhrSetup?(xhr: XMLHttpRequest, url: string): void; - /** - * (default: undefined) - * Fetch customization callback for Fetch based loader. - * Parameter should be a function with two arguments (context and Request Init Params). - * If fetchSetup is specified and Fetch loader is used, fetchSetup will be triggered to instantiate Request Object. This allows user to easily tweak Fetch loader. - */ - fetchSetup?(context: any, initParams: any): Request; - /** - * (default: internal ABR controller) - * Customized Adaptive Bitrate Streaming Controller. - * Parameter should be a class providing 2 getters, 2 setters and a destroy() method: - * get/set nextAutoLevel: return next auto-quality level/force next auto-quality level that should be returned (currently used for emergency switch down) - * get/set autoLevelCapping: capping/max level value that could be used by ABR Controller - * destroy(): should clean-up all used resources - */ - abrController?: AbrController; - /** - * (default: internal track timeline controller) - * Customized text track syncronization controller. - * Parameter should be a class with a destroy() method: - * destroy() : should clean-up all used resources - */ - timelineController?: TimelineController; - /** - * (default: true) - * whether or not to enable CEA-708 captions - */ - enableCEA708Captions?: boolean; - /** - * (default: English) - * Label for the text track generated for CEA-708 captions track 1. This is how it will appear in the browser's native menu for subtitles and captions. - */ - captionsTextTrack1Label?: string; - /** - * (default: en) - * RFC 3066 language code for the text track generated for CEA-708 captions track 1. - */ - captionsTextTrack1LanguagedCode?: string; - /** - * (default: Spanish) - * Label for the text track generated for CEA-708 captions track 2. This is how it will appear in the browser's native menu for subtitles and captions. - */ - captionsTextTrack2Label?: string; - /** - * (default: es) - * RFC 3066 language code for the text track generated for CEA-708 captions track 2. - */ - captionsTextTrack2LanguageCode?: string; - /** - * (default: false) - * If a segment's video track is shorter than its audio track by > min(maxSeekHole, maxBufferHole), extend the final video frame's duration to match the audio track's duration. - * This helps playback continue in certain cases that might otherwise get stuck. - */ - stretchShortVideoTrack?: boolean; - /** - * (default: true) - * Whether or not to force having a key frame in the first AVC sample after a discontinuity. - * If set to true, after a discontinuity, the AVC samples without any key frame will be dropped until finding one that contains a key frame. - * If set to false, all AVC samples will be kept, which can help avoid holes in the stream. Setting this parameter to false can also generate decoding weirdness when switching level or seeking. - */ - forceKeyFrameOnDiscontinuity?: boolean; - /** - * (default: 5.0) - * Fast bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. - * Half of the estimate is based on the last abrEwmaFastLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than 0 - */ - abrEwmaFastLive?: number; - /** - * (default: 9.0) - * Slow bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. - * Half of the estimate is based on the last abrEwmaSlowLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than abrEwmaFastLive - */ - abrEwmaSlowLive?: number; - /** - * (default: 4.0) - * Fast bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. - * Half of the estimate is based on the last abrEwmaFastVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than 0 - */ - abrEwmaFastVod?: number; - /** - * (default: 15.0) - * Slow bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. - * Half of the estimate is based on the last abrEwmaSlowVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than abrEwmaFastVoD - */ - abrEwmaSlowVod?: number; - /** - * (default: 500000) - * Default bandwidth estimate in bits/second prior to collecting fragment bandwidth samples. - * parameter should be a float - */ - abrEwmaDefaultEstimate?: number; - /** - * (default: 0.8) - * Scale factor to be applied against measured bandwidth average, to determine whether we can stay on current or lower quality level. - * If abrBandWidthFactor * bandwidth average < level.bitrate then ABR can switch to that level providing that it is equal or less than current level. - */ - abrBandWidthFactor?: number; - /** - * (default: 0.7) - * Scale factor to be applied against measured bandwidth average, to determine whether we can switch up to a higher quality level. - * If abrBandWidthUpFactor * bandwidth average < level.bitrate then ABR can switch up to that quality level. - */ - abrBandWidthUpFactor?: number; - /** - * (default: false) - * max bitrate used in ABR by avg measured bitrate i.e. if bitrate signaled in variant manifest for a given level is 2Mb/s but average bitrate measured on this level is 2.5Mb/s, - * then if config value is set to true, ABR will use 2.5 Mb/s for this quality level. - */ - abrMaxWithRealBitrate?: boolean; - /** - * (default: 0) - * Return the capping/min bandwidth value that could be used by automatic level selection algorithm. - * Useful when browser or tab of the browser is not in the focus and bandwidth drops - */ - minAutoBitrate?: number; - } - - /** - * a Level object represents a given quality level and contains quality level related info - */ - interface Level { - /** - * level url. might contain sever items if failover/redundant streams are found in the manifest - */ - url: string[]; - /** - * level bitrate - */ - bitrate: number; - /** - * level name - */ - name: string; - /** - * used codecs - */ - codecs: string; - /** - * video width - */ - width: number; - /** - * video height - */ - height: number; - /** - * level details - */ - details: LevelDetails; - } - - /** - * a LevelDetails object contains level details retrieved after level playlist parsing - */ - interface LevelDetails { - /** - * protocol version - */ - version: number; - /** - * playlist type - */ - type: string; - /** - * start sequence number - */ - startSN: number; - /** - * end sequence number - */ - endSN: number; - /** - * level total duration - */ - totalduration: number; - /** - * level fragment target duration - */ - targetduration: number; - /** - * average fragment duration - */ - averagetargetduration: number; - /** - * array of fragments info - */ - fragments: Fragment[]; - /** - * is this level a live playlist or not? - */ - live: boolean; - } - - /** - * the Fragment object contains fragment related info - */ - interface Fragment { - /** - * fragment duration - */ - duration: number; - /** - * fragment level identifier - */ - level: number; - /** - * fragment sequence number - */ - sn: number; - /** - * fragment start offset - */ - start: number; - /** - * fragment url - */ - url: string; - /** - * stream start date and time - */ - programDateTime: Date; - /** - * continuity count - */ - cc: number; - /** - * list of tags associated with the fragment - */ - tagList: string[][]; - /** - * fragment title - */ - title: string; - } - - interface Data { - /** - * videoElement - */ - video?: HTMLVideoElement; - /** - * media source - */ - mediaSource?: string; - /** - * manifest url - */ - url?: string; - /** - * available quality levels - */ - levels?: number[]; - /** - * available audio tracks - */ - audioTracks?: AudioTrack[]; - /** - * XMLHttp request stats - */ - stats?: HlsStats; - /** - * index of first quality level appearing in Manifest - */ - firstLevel?: number; - /** - * id of updated level - */ - level?: number; - /** - * id of loaded level - */ - levelId?: number; - /** - * ErrorDetails type or Level Details - */ - details?: string | LevelDetails; - /** - * PTS drift observed when parsing last fragment - */ - drift?: number; - /** - * fragment object with frag.loaded=stats.loaded - */ - frag?: Fragment; - /** - * fragment payload - */ - payload?: any; // TODO: what is the payload? - /** - * id of level or demuxer - */ - id?: number; - /** - * moof MP4 box - */ - moof?: any; // TODO: whats is the moof? - /** - * mdat MP4 box - */ - mdat?: any; // TODO: what is mdat? - /** - * PTS of first sample - */ - startPTS?: number; - /** - * PTS of last sample - */ - endPTS?: number; - /** - * DTS of first sample - */ - startDTS?: number; - /** - * DTS of last sample - */ - endDTS?: number; - /** - * stream type (audio or video) - */ - type?: string; - /** - * number of samples - */ - nb?: number; - /** - * number of dropped frames in last monitoring period - */ - currentDropped?: number; - /** - * number of decoded frames in last monitoring period - */ - currentDecode?: number; - /** - * total dropped frames on this video element - */ - totalDropped?: number; - /** - * level has to much dropped frame will be restricted - */ - droppedLevel?: number; - /** - * is error fatal or not. - * if error is not fatal, hls.js will try to recover it - * if error is fatal, an action is required to (try to) recover it - */ - fatal?: boolean; - } - - /** - * (default: internal ABR controller) - * Customized Adaptive Bitrate Streaming Controller. - */ - interface AbrController { - /** - * get: capping/max level value that could be used by ABR Controller - * set: capping/max level value that could be used by ABR Controller - */ - autoLevelCapping: number; - /** - * accumulated handled events - */ - handledEvents: string[]; - /** - * current hls instance - */ - hls: Hls; - /** - * last fragments corresponding level - */ - lastLoadedFragLevel: number; - /** - * get: next auto-quality levele/force next auto-quality level that should be returned - * set: next auto-quality levele/force next auto-quality level that should be returned - * - currently used for emergency switch down - */ - nextAutoLevel: number; - useGenericHandler: boolean; - } - - /** - * Customized text track syncronization controller. - */ - interface TimelineController { - /** - * clean-up all used resources - */ - destory(): void; - } - - interface LoaderResponse { - url: string; - data: string | ArrayBuffer; - } - - interface LoaderStats { - /** - * performance.now() just after load() has been called - */ - trequest: number; - /** - * performance.now() of first received byte - */ - tfirst: number; - /** - * performance.now() on load complete - */ - tload: number; - /** - * number of loaded bytes - */ - loaded: number; - /** - * download bandwitdh in bit/s - */ - bw: number; - /** - * total nb of bytes - */ - total: number; - } - - interface LoaderError { - /** - * error code - */ - code: number; - /** - * error description - */ - text: string; - } - - interface HlsStats { - /** - * performance.now() just after load() has been called - */ - trequest: number; - /** - * performance.now() of first received byte - */ - tfirst: number; - /** - * performance.now() on load complete - */ - tload: number; - mtime: number; - tbuffered?: number; - length?: number; - } - - interface LoaderContext { - /** - * target URL - */ - url: string; - /** - * loader response type (arraybuffer or default response type for playlist) - */ - responseType: string; - /** - * start byte range offset - */ - rangeStart?: number; - /** - * end byte range offset - */ - rangeEnd?: number; - /** - * true if onProgress should report partial chunk of loaded content - */ - progressData?: boolean; - /** - * fragment object - */ - frag: Fragment; - /** - * request type - * - level, manifest - */ - type: string; - /** - * level id - */ - level: number; - } - - interface LoaderConfig { - /** - * Max number of load retries - */ - maxRetry: number; - /** - * Timeout after which `onTimeOut` callback will be triggered (if loading is still not finished after that delay) - */ - timeout: number; - /** - * Delay between an I/O error and following connection retry (ms). This to avoid spamming the server - */ - retryDelay: number; - /** - * max connection retry delay (ms) - */ - maxRetryDelay: number; - } - - interface LoaderCallbacks { - onSuccess(response: LoaderResponse, stats: LoaderStats, context: LoaderContext): void; - onProgress(stats: LoaderStats, context: LoaderContext, data: string | ArrayBuffer): void; - onError(error: LoaderError, context: LoaderContext): void; - onTimeout(stats: LoaderStats, context: LoaderContext): void; - } -} - -declare class Hls { - /** - * Constructor. Can be provided an HlsConfig object as default properties and or overrides - */ - constructor(config?: Hls.OptionalConfig) - /** - * return array of available quality levels - */ - levels: Hls.Level[]; - /** - * get: return current playback quality level - * set: trigger an immediate quality level switch to new quality level - * this will pause the video if it was playing, flush the whole buffer, - * and fetch fragment matching with current position and requested quality level - * then resume the video if needed once fetched fragment will have been buffered - * - * set to -1 for automatic level selection - */ - currentLevel: number; - /** - * capping/max level (index of level) that could be used by ABR Controller. Defaults to -1 - * which means no limit - * set: max level value that could be used by the ABR Controller - */ - autoLevelCapping: number; - /** - * return start level index (level of first fragment that will be played back) - * if not overrided by user: first level appearing in manifest will be used as start level - * if -1: automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment) - * - * default valus is hls.firstLevel - */ - startLevel: number; - /** - * (default: true) - * if set to true, start level playlist and first fragments will be loaded automatically, after triggering of Hls.Events.MANIFEST_PARSED event - * if set to false, an explicit API call (hls.startLoad(startPosition=-1)) will be needed to start quality level/fragment loading. - */ - autoStartLoad: boolean; - /** - * get: Return the bound videoElement from the hls instance - */ - media: HTMLVideoElement; - /** - * hls.js config - */ - config: Hls.Config; - /** - * get: return next playback quality level (playback quality level for next buffered fragment) - * return -1 if next fragment not buffered yet - * set: trigger a quality level switch for next fragment - * this could eventually flush already buffered next fragment - * - * set to -1 for automatic level selection - */ - nextLevel: number; - /** - * get: return last loaded fragment quality level - * set: quality level for next loaded fragment - * set to -1 for automatic level selection - */ - loadLevel: number; - /** - * get: return quality level that will be used to load next fragment - * set: force quality level for next loaded fragment - * quality level will be forced only for that fragment - * after a fragment at this quality level has been loaded, hls.loadLevel will prevail - */ - nextLoadLevel: number; - /** - * first level index (index of first level appearing in Manifest. it is usually defined as start level hint for player) - */ - firstLevel: number; - /** - * array of audio tracks exposed in manifest - */ - audioTracks: AudioTrack[]; - /** - * get: returns audio track id - * set: sets audio track id (returned by) - */ - audioTrack: number; - /** - * position of live sync point (ie edge of live position minus safety delay defined by hls.config.liveSyncDuration) - */ - liveSyncPosition: number; - /** - * calling this method will: - * bind videoElement and hls instances - * create MediaSource and set it as video source - * once MediaSource object is successfully created, MEDIA_ATTACHED event will be fired - */ - attachMedia(videoElement: HTMLVideoElement): void; - /** - * calling this method will: - * unbind VideoElement from hls instance - * signal the end of the stream on MediaSource - * reset video source ( video.src = '' ) - */ - detachMedia(): void; - /** - * tell whether auto level selection is enabled or not - */ - autoLevelEnabled(enabled: boolean): boolean; - /** - * loads provided url as media source - */ - loadSource(source: string): void; - /** - * by default, hls.js will automatically start loading quality level playlists, and fragments after Hls.Events.MANIFEST_PARSED event has been triggered (and video element has been attached) - * however if config.autoStartLoad is set to false, hls.startLoad() needs to be called to manually start playlist and fragments loading - * - * start/restart playlist/fragment loading. this is only effective if MANIFEST_PARSED event has been triggered and video element has been attached to hls object - * startPosition is the initial position in the playlist - * ff startPosition is not set to -1, it allows to override default startPosition to the one you want - * (it will bypass hls.config.liveSync* config params for Live for example, so that user can start playback from whatever position) - */ - startLoad(startPosition?: number): void; - /** - * stop playlist/fragment loading. could be resumed later on by calling hls.startLoad() - */ - stopLoad(): void; - /** - * should be invoked to recover media error. - */ - recoverMediaError(): void; - /** - * if media error are still raised after calling hls.recoverMediaError(), calling this method, could be useful to workaround audio codec mismatch. - * the workflow should be: - * on First Media Error : call hls.recoverMediaError() - * if another Media Error is raised 'quickly' after this first Media Error : first call hls.swapAudioCodec(), then call hls.recoverMediaError() - */ - swapAudioCodec(): void; - /** - * should be called to free used resources and destroy hls context - */ - destroy(): void; - /** - * hls.js event listener - */ - on(event: string, callback: (event: string, data: Hls.Data) => void): void; - /** - * remove hls.js event listener - */ - off(event: string, callback: (event: string, data: Hls.Data) => void): void; + off(event: string, callback: (event: string, data: Hls.Data) => void): void; } export as namespace Hls; From a67ad40c72d3fd988ce072692f173be12f996795 Mon Sep 17 00:00:00 2001 From: John Gainfort Jr Date: Fri, 22 Dec 2017 11:06:42 -0700 Subject: [PATCH 194/890] changed indentation --- types/hls.js/index.d.ts | 3594 +++++++++++++++++++-------------------- 1 file changed, 1797 insertions(+), 1797 deletions(-) diff --git a/types/hls.js/index.d.ts b/types/hls.js/index.d.ts index b47d49a236..ea26719b22 100644 --- a/types/hls.js/index.d.ts +++ b/types/hls.js/index.d.ts @@ -5,1764 +5,480 @@ // TypeScript Version: 2.2 declare class Loader { - constructor(config: Hls.LoaderConfig) - /** - * Start retrieving content located at given URL (HTTP GET). - */ - load(context: Hls.LoaderContext, config: Hls.LoaderConfig, callbacks: Hls.LoaderCallbacks): void; - /** - * Abort any loading in progress. - */ - abort(): void; - /** - * Destroy loading context. - */ - destroy(): void; + constructor(config: Hls.LoaderConfig) + /** + * Start retrieving content located at given URL (HTTP GET). + */ + load(context: Hls.LoaderContext, config: Hls.LoaderConfig, callbacks: Hls.LoaderCallbacks): void; + /** + * Abort any loading in progress. + */ + abort(): void; + /** + * Destroy loading context. + */ + destroy(): void; } declare namespace Hls { + /** + * Hls events + */ + namespace Events { /** - * Hls events + * fired to attach Media to hls instance + * data: { video , mediaSource } */ - namespace Events { - /** - * fired to attach Media to hls instance - * data: { video , mediaSource } - */ - const MEDIA_ATTACHING: string; - /** - * fired when Media has been succesfully attached to hls instance - * data: { video , mediaSource } - */ - const MEDIA_ATTACHED: string; - /** - * fired before detaching Media from hls instance - * data: { } - */ - const MEDIA_DETACHING: string; - /** - * fired when Media has been detached from hls instance - * data: { } - */ - const MEDIA_DETACHED: string; - /** - * fired when the buffer is going to be reset - * data: { } - */ - const BUFFER_RESET: string; - /** - * fired when we know about the codecs that we need buffers for to push into - * data: { tracks : { container, codec, levelCodec, initSegment, metadata } } - */ - const BUFFER_CODECS: string; - /** - * fired when sourcebuffers have been created - * data: { tracks: tracks } - */ - const BUFFER_CREATED: string; - /** - * fired when we append a segment to the buffer - * data: { segment: segment object } - */ - const BUFFER_APPENDING: string; - /** - * fired when we are done with appending a media segment to the buffer - * data: { parent : segment parent that triggered BUFFER_APPENDING, pending : nb of segments waiting for appending for this segment parent } - */ - const BUFFER_APPENDED: string; - /** - * fired when the stream is finished and we want to notify the media buffer that there will be no more data - * data: { } - */ - const BUFFER_EOS: string; - /** - * fired when the media buffer should be flushed - * data: { } - */ - const BUFFER_FLUSHING: string; - /** - * fired when the media buffer has been flushed - * data: { } - */ - const BUFFER_FLUSHED: string; - /** - * fired to signal that a manifest loading starts - * data: { url : manifestURL } - */ - const MANIFEST_LOADING: string; - /** - * fired after manifest has been loaded - * data: { levels : [available quality levels] , audioTracks : [ available audio tracks], url : manifestURL, stats : { trequest, tfirst, tload, mtime}} - */ - const MANIFEST_LOADED: string; - /** - * fired after manifest has been parsed - * data: { levels : [ available quality levels ], firstLevel : index of first quality level appearing in Manifest } - */ - const MANIFEST_PARSED: string; - /** - * fired when a level playlist loading starts - * data: { url : level URL, level : id of level being loaded } - */ - const LEVEL_LOADING: string; - /** - * fired when a level playlist loading finishes - * data: { details : levelDetails object, levelId : id of loaded level, stats : { trequest, tfirst, tload, mtime } } - */ - const LEVEL_LOADED: string; - /** - * fired when a level's details have been updated based on previous details, after it has been loaded - * data: { details : levelDetails object, level : id of updated level } - */ - const LEVEL_UPDATED: string; - /** - * fired when a level's PTS information has been updated after parsing a fragment - * data: { details: levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment } - */ - const LEVEL_PTS_UPDATED: string; - /** - * fired when a level switch is requested - * data: { level: Level } - */ - const LEVEL_SWITCHING: string; - /** - * fired when a level switch is effective - * data: { level: level object } - */ - const LEVEL_SWITCHED: string; - /** - * fired to notify that audio track lists has been updated - * data: { audioTracks : audioTracks } - */ - const AUDIO_TRACKS_UPDATED: string; - /** - * fired when an audio track switch occurs. deprecated in favor AUDIO_TRACK_SWITCHING - * data: { id : audio track id } - */ - const AUDIO_TRACK_SWTICH: string; - /** - * fired when an audio track switching is requested - * data: { id : audio track id } - */ - const AUDIO_TRACK_SWITCHING: string; - /** - * fired when an audio track switch actually occurs - * data: { id : audio track id } - */ - const AUDIO_TRACK_SWITCHED: string; - /** - * fired when an audio track loading starts - * data: { url : audio track URL, id : audio track id } - */ - const AUDIO_TRACK_LOADING: string; - /** - * fired when an audio track loading finishes - * data: { details : levelDetails object, id : audio track id, stats : { trequest, tfirst, tload, mtime } } - */ - const AUDIO_TRACK_LOADED: string; - /** - * fired to notify that subtitle track lists has been updated - * data: { subtitleTracks : subtitleTracks } - */ - const SUBTITLE_TRACKS_UPDATED: string; - /** - * fired when an subtitle track switch occurs - * data: { id : subtitle track id } - */ - const SUBTITLE_TRACK_SWITCH: string; - /** - * fired when a subtitle track loading starts - * data: { url : subtitle track URL, id : subtitle track id } - */ - const SUBTITLE_TRACK_LOADING: string; - /** - * fired when a subtitle track loading finishes - * data: { details : levelDetails object, id : subtitle track id, stats : { trequest, tfirst, tload, mtime } } - */ - const SUBTITLE_TRACK_LOADED: string; - /** - * fired when a subtitle fragment has been processed - * data: { success : boolean, frag : the processed frag } - */ - const SUBTITLE_FRAG_PROCESSED: string; - /** - * fired when a decryption key loading starts - * data: { frag: fragment object } - */ - const KEY_LOADING: string; - /** - * fired when a decryption key loading is completed - * data: { frag: fragment object } - */ - const KEY_LOADED: string; - /** - * fired when first timestamp has been found - * data: { id: demuxer id, frag: fragment object, initPTS: initPTS } - */ - const INIT_PTS_FOUND: string; - /** - * fired when a fragment loading starts - * data: { frag : fragment object } - */ - const FRAG_LOADING: string; - /** - * fired when a fragment load is in progress - * data: { frag : fragment object with frag.loaded=stats.loaded, stats : { trequest, tfirst, loaded, total } } - */ - const FRAG_LOAD_PROGRESS: string; - /** - * identifier for fragment load aborting for emergency switch down - * data: { frag: fragment object } - */ - const FRAG_LOAD_ERMERGENCY_ABORTED: string; - /** - * fired when a fragment loading is completed - * data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length}} - */ - const FRAG_LOADED: string; - /** - * fired when a fragment decryption is completed - * data: { id: demuxer id, frag: fragment object, stats: { tstart, tdecrypt } } - */ - const FRAG_DECRYPTED: string; - /** - * fired when Init Segment has been extracted from fragment - * data: { id: demuxer id, moov : moov MP4 box, codecs : codecs found while parsing fragment} - */ - const FRAG_PARSING_INIT_SEGMENT: string; - /** - * fired when parsing id3 is completed - * data: { id: demuxer id, samples : [ id3 pes - pts and dts timestamp are relative, values are in seconds]} - */ - const FRAG_PARSING_METADATA: string; - /** - * fired when moof/mdat have been extracted from fragment - * data: { id: demuxer id, - * moof : moof MP4 box, - * mdat : mdat MP4 box, - * startPTS : PTS of first sample, - * endPTS : PTS of last sample, - * startDTS : DTS of first sample, - * endDTS : DTS of last sample, - * type : stream type (audio or video), - * nb : number of samples} - */ - const FRAG_PARSING_DATA: string; - /** - * fired when fragment parsing is completed - * data: { id: demuxer id} - */ - const FRAG_PARSED: string; - /** - * fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer - * data: { id: demuxer id, frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length} } - */ - const FRAG_BUFFERED: string; - /** - * fired when fragment matching with current video position is changing - * data: { frag : fragment object } - */ - const FRAG_CHANGED: string; - /** - * triggered when FPS drop in last monitoring period is higher than given threshold - * data: { curentDropped : nb of dropped frames in last monitoring period, - * currentDecoded : nb of decoded frames in last monitoring period, - * totalDropped : total dropped frames on this video element } - */ - const FPS_DROP: string; - /** - * triggered when FPS drop triggers auto level capping - * data: { level: suggested new auto level capping by fps controller, droppedLevel : level has to much dropped frame will be restricted } - */ - const FPS_DROP_LEVEL_CAPPING: string; - /** - * Identifier for an error event - * data: { type : error type, details : error details, fatal : is error fatal or not, other error specific data } - */ - const ERROR: string; - /** - * fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a video to the instance of hls.js to handle mid-rolls for example. - * data: { } - */ - const DESTROYING: string; - /** - * fired upon stream controller state transitions - * data: { previousState, nextState } - */ - const STREAM_STATE_TRANSITION: string; - } - + const MEDIA_ATTACHING: string; /** - * Hls error details + * fired when Media has been succesfully attached to hls instance + * data: { video , mediaSource } */ - namespace ErrorDetails { - // NETWORK_ERRORS // - /** - * raised when manifest loading fails because of a network error - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_LOAD_ERROR, fatal : true, url : manifest URL, response : { code: error code, text: error text }, loader : URL loader } - */ - const MANIFEST_LOAD_ERROR: string; - /** - * raised when manifest loading fails because of a timeout - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT, fatal : true, url : manifest URL, loader : URL loader } - */ - const MANIFEST_LOAD_TIMEOUT: string; - /** - * raised when manifest parsing failed to find proper content - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_PARSING_ERROR, fatal : true, url : manifest URL, reason : parsing error reason } - */ - const MANIFEST_PARSING_ERROR: string; - /** - * raised when level loading fails because of a network error - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.LEVEL_LOAD_ERROR, fatal : true, url : level URL, response : { code: error code, text: error text }, loader : URL loader } - */ - const LEVEL_LOAD_ERROR: string; - /** - * raised when level loading fails because of a timeout - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.LEVEL_LOAD_TIMEOUT, fatal : true, url : level URL, loader : URL loader } - */ - const LEVEL_LOAD_TIMEOUT: string; - /** - * raised when audio track loading fails because of a network error - * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.AUDIO_TRACK_LOAD_ERROR, fatal: false, url: audio URL, loader: URL loader } - */ - const AUDIO_TRACK_LOAD_ERROR: string; - /** - * raised when audio track loading fails because of a timeout - * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT, fatal: false, url: audio URL, response: { code: error code, text: error text }, loader: URL loader } - */ - const AUDIO_TRACK_LOAD_TIMEOUT: string; - /** - * raised when fragment loading fails because of a network error - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOAD_ERROR, fatal : true or false, frag : fragment object, response : { code: error code, text: error text } } - */ - const FRAG_LOAD_ERROR: string; - /** - * raised when fragment loading fails because of a timeout - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOAD_TIMEOUT, fatal : true or false, frag : fragment object } - */ - const FRAG_LOAD_TIMEOUT: string; - /** - * raised when decrypt key loading fails because of a network error - * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.KEY_LOAD_ERROR, fatal: false, frag: fragment object } - */ - const KEY_LOAD_ERROR: string; - /** - * raised when decrypt key loading fails because of timeout - * data: { type: NETWORK_EROR, details: Hls.ErrorDetails.KEY_LOAD_TIMEOUT, fatal: true, frag: fragment object } - */ - const KEY_LOAD_TIMEOUT: string; - - // MEDIA_ERRORS // - /** - * raised when manifest only contains quality level with codecs incompatible with MediaSource Engine. - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR, fatal : true, url : manifest URL } - */ - const MANIFEST_INCOMPATIBLE_CODECS_ERROR: string; - /** - * raised upon detection of same fragment being requested in loop - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR, fatal : true or false, frag : fragment object } - */ - const FRAG_LOOP_LOADING_ERROR: string; - /** - * raised when fragment decryption fails - * data: { type: MEDIA_ERROR, details: Hls.ErrorDetails.FRAG_DECRYPT_ERROR, fatal: true, reason: failure reason } - */ - const FRAG_DECRYPT_ERROR: string; - /** - * raised when fragment parsing fails - * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_PARSING_ERROR, fatal : true or false, reason : failure reason } - */ - const FRAG_PARSING_ERROR: string; - /** - * raised when MediaSource fails to add new sourceBuffer - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_ADD_CODEC_ERROR, fatal : false, err : error raised by MediaSource, mimeType: mimeType on which the failure happened } - */ - const BUFFER_ADD_CODEC_ERROR: string; - /** - * raised when exception is raised while calling buffer append - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_APPEND_ERROR, fatal : true, frag : fragment object } - */ - const BUFFER_APPEND_ERROR: string; - /** - * raised when exception is raised during buffer appending - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_APPENDING_ERROR, fatal : false } - */ - const BUFFER_APPENDING_ERROR: string; - /** - * raised when playback is stuck because buffer is running out of data - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_STALLED_ERROR, fatal : false } - */ - const BUFFER_STALLED_ERROR: string; - /** - * raised when no data can be appended anymore in media buffer because it is full. - * This error is recovered automatically by performing a smooth level switching that empty buffers (without disrupting the playback) and reducing the max buffer length. - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_FULL_ERROR, fatal : false } - */ - const BUFFER_FULL_ERROR: string; - /** - * raised after hls.js seeks over a buffer hole to unstuck the playback, - * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal : false, hole : hole duration } - */ - const BUFFER_SEEK_OVER_HOLE: string; - /** - * raised when playback is stuck although currentTime is in a buffered aread - * data: { type: MEDIA_ERROR, details: Hls.ErrorDetails.BUFFERED_STALLED_ERROR, fatal: true } - */ - const BUFFER_NUDGE_ON_STALL: string; - - // MUX_ERROR // - /** - * raised when memory allocation fails during remuxing - * data: { type: MUX_ERROR, details: Hls.ErrorDetails.REMUX_ALLOC_ERROR, fatal: false, bytes: mdat size, reason: failure reason } - */ - const REMUX_ALLOC_ERROR: string; - - // OTHER_ERROR // - /** - * raised when level switching fails - * data: { type : OTHER_ERROR, details : Hls.ErrorDetails.LEVEL_SWITCH_ERROR, fatal : false, level : failed level index, reason : failure reason } - */ - const LEVEL_SWITCH_ERROR: string; - /** - * raised when an exception occurs in an internal hls.js event handler - * data: { type: OTHER_ERROR, details: Hls.ErrorDetails.INTERNAL_EXCEPTION, fatal: true or false, event: event object or string, error: { message: error message } } - */ - const INTERNAL_EXCEPTION: string; - } - + const MEDIA_ATTACHED: string; /** - * Hls error types + * fired before detaching Media from hls instance + * data: { } */ - namespace ErrorTypes { - /** - * network related errors - */ - const NETWORK_ERROR: string; - /** - * media/video related errors - */ - const MEDIA_ERROR: string; - /** - * muxing related errors - */ - const MUX_ERROR: string; - /** - * all other erros - */ - const OTHER_ERROR: string; - } + const MEDIA_DETACHING: string; /** - * override Hls default configuration - * this configuration will be applied by default to all instances + * fired when Media has been detached from hls instance + * data: { } */ - let DefaultConfig: Config; + const MEDIA_DETACHED: string; /** - * checks whether your browser is supporting MediaSource Extensions + * fired when the buffer is going to be reset + * data: { } */ - function isSupported(): boolean; + const BUFFER_RESET: string; /** - * returns hls.js dist version number + * fired when we know about the codecs that we need buffers for to push into + * data: { tracks : { container, codec, levelCodec, initSegment, metadata } } */ - const version: string; - - interface Config { - /** - * (default: false) - * if set to true, the adaptive algorithm with limit levels usable in auto-quality by the HTML video element dimensions (width and height) - * if set to false, levels will not be limited. All available levels could be used in auto-quality mode taking only bandwidth into consideration. - */ - capLevelToPlayerSize: boolean; - /** - * (default: false) - * setting config.debug = true; will turn on debug logs on JS console. - * a logger object could also be provided for custom logging: config.debug = customLogger; - */ - debug: boolean; - /** - * (default: true) - * if set to true, start level playlist and first fragments will be loaded automatically, after triggering of Hls.Events.MANIFEST_PARSED event - * if set to false, an explicit API call (hls.startLoad(startPosition=-1)) will be needed to start quality level/fragment loading. - */ - autoStartLoad: boolean; - /** - * (default -1) - * if set to -1, playback will start from initialTime=0 for VoD and according to liveSyncDuration/liveSyncDurationCount config params for Live - * otherwise, playback will start from predefined value. (unless stated otherwise in autoStartLoad=false mode : in that case startPosition can be overrided using hls.startLoad(startPosition)). - */ - startPosition: number; - /** - * (default: undefined) - * if audio codec is not signaled in variant manifest, or if only a stream manifest is provided, hls.js tries to guess audio codec by parsing audio sampling rate in ADTS header. - * If sampling rate is less or equal than 22050 Hz, then hls.js assumes it is HE-AAC, otherwise it assumes it is AAC-LC. - * This could result in bad guess, leading to audio decode error, ending up in media error. - * It is possible to hint default audiocodec to hls.js by configuring this value as below: - * mp4a.40.2 (AAC-LC) or - * mp4a.40.5 (HE-AAC) or - * undefined (guess based on sampling rate) - */ - defaultAudioCodec: string; - /** - * (default: 1) - * number of segments needed to start a playback of Live stream. - */ - initialLiveManifestSize: number; - /** - * (default: 30 seconds) - * Maximum buffer length in seconds. If buffer length is/become less than this value, a new fragment will be loaded. - * This is the guaranteed buffer length hls.js will try to reach, regardless of maxBufferSize. - */ - maxBufferLength: number; - /** - * (default 600s) - * Maximum buffer length in seconds. Hls.js will never exceed this value, even if maxBufferSize is not reached yet. - * hls.js tries to buffer up to a maximum number of bytes (60 MB by default) rather than to buffer up to a maximum nb of seconds. - * This is to mimic the browser behaviour (the buffer eviction algorithm is starting after the browser detects that video buffer size reaches a limit in bytes) - * maxBufferLength is the minimum guaranteed buffer length that hls.js will try to achieve, even if that value exceeds the amount of bytes 60 MB of memory. - * maxMaxBufferLength acts as a capping value, as if bitrate is really low, you could need more than one hour of buffer to fill 60 MB. - */ - maxMaxBufferLength: number; - /** - * (default: 60 MB) - * 'Minimum' maximum buffer size in bytes. If buffer size upfront is bigger than this value, no fragment will be loaded - */ - maxBufferSize: number; - /** - * (default: 0.5 seconds) - * 'Maximum' inter-fragment buffer hole tolerance that hls.js can cope with when searching for the next fragment to load. When switching between quality level, - * fragments might not be perfectly aligned. - * This could result in small overlapping or hole in media buffer. This tolerance factor helps cope with this. - */ - maxBufferHole: number; - /** - * (default: 2s) - * In case playback is stalled, and a buffered range is available upfront, less than maxSeekHole seconds from current media position, - * hls.js will jump over this buffer hole to reach the beginning of this following buffered range. - * maxSeekHole allows to configure this jumpable threshold. - */ - maxSeekHole: number; - /** - * (default: 4s) - * - * ABR algorithm will always try to choose a quality level that should avoid rebuffering. In case no quality level with this criteria can - * be found (lets say for example that buffer length is 1s, but fetching a fragment at lowest quality is predicted to take around 2s ... - * ie we can forecast around 1s of rebuffering ...) then ABR algorithm will try to find a level that should guarantee less than - * maxStarvationDelay of buffering. - */ - maxStarvationDelay: number; - /** - * (default 0.2s) - * This tolerance factor is used during fragment lookup. - * Instead of checking whether buffered.end is located within [start, end] range, frag lookup will be done by checking within [start-maxFragLookUpTolerance, end-maxFragLookUpTolerance] range. - * This tolerance factor is used to cope with situations like: - * buffered.end = 9.991 - * frag[0] : [0,10] - * frag[1] : [10,20] - * buffered.end is within frag[0] range, but as we are close to frag[1], frag[1] should be choosen instead - * If maxFragLookUpTolerance = 0.2, this lookup will be adjusted to - * frag[0] : [-0.2,9.8] - * frag[1] : [9.8,19.8] - * This time, buffered.end is within frag[1] range, and frag[1] will be the next fragment to be loaded, as expected - */ - maxLoadingDelay: number; - /** - * (default: 0.5s) - * media element is expected to play and if currentTime has not moved for more than lowBufferWatchdogPeriod and if there are less than maxBufferHole seconds buffered upfront, - * hls.js will try to nudge playhead to recover playback - */ - lowBufferWatchdogPeriod: number; - /** - * (default: 3s) - * if media element is expected to play and if currentTime has not moved for more than highBufferWatchdogPeriod and if there are more than maxBufferHole seconds buffered upfront, - * hls.js will try to nudge playhead to recover playback - */ - highBufferWatchdogPeriod: number; - /** - * (default: 0.1s) - * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. - * media.currentTime += (nb nudge retry -1)*nudgeOffset - */ - nudgeOffset: number; - /** - * (default: 3s) - * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. - * media.currentTime += (nb nudge retry -1)*nudgeOffset - */ - nudgeMaxRetry: number; - /** - * (default 4s) - * - * max video loading delay used in automatic start level selection : in that mode ABR controller will ensure that video loading time (ie - * the time to fetch the first fragment at lowest quality level + the time to fetch the fragment at the appropriate quality level is less - * than maxLoadingDelay ) - */ - maxFragLookUpTolerance: number; - /** - * (default: 3) - * edge of live delay, expressed in multiple of EXT-X-TARGETDURATION. if set to 3, playback will start from fragment N-3, N being the last fragment of the live playlist. - * Decreasing this value is likely to cause playback stalls. - */ - liveSyncDurationCount: number; - /** - * (default: Infinity) - * maximum delay allowed from edge of live, expressed in multiple of EXT-X-TARGETDURATION. - * If set to 10, the player will seek back to liveSyncDurationCount whenever the next fragment to be loaded is older than N-10, N being the last fragment of the live playlist. - * If set, this value must be stricly superior to liveSyncDurationCount a value too close from liveSyncDurationCount is likely to cause playback stalls. - */ - liveMaxLatencyDurationCount: number; - /** - * (default: undefined) - * Alternative parameter to liveSyncDurationCount, expressed in seconds vs number of segments. - * If defined in the configuration object, liveSyncDuration will take precedence over the default liveSyncDurationCount. - * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. - * A value too low (inferior to ~3 segment durations) is likely to cause playback stalls. - */ - liveSyncDuration: number; - /** - * (default: undefined) - * Alternative parameter to liveMaxLatencyDurationCount, expressed in seconds vs number of segments. - * If defined in the configuration object, liveMaxLatencyDuration will take precedence over the default liveMaxLatencyDurationCount. - * If set, this value must be stricly superior to liveSyncDuration which must be defined as well. - * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. - * A value too close from liveSyncDuration is likely to cause playback stalls. - */ - liveMaxLatencyDuration: number; - /** - * (default: false) - * Override current Media Source duration to Infinity for a live broadcast. Useful, if you are building a player which relies - * on native UI capabilities in modern browsers. If you want to have a native Live UI in environments like iOS Safari, Safari, - * Android Google Chrome, etc. set this value to true. - */ - liveDurationInfinity: boolean; - /** - * (default: true) - * Enable WebWorker (if available on browser) for TS demuxing/MP4 remuxing, to improve performance and avoid lag/frame drops. - */ - enableWorker: boolean; - /** - * (default: true) - * Enable to use JavaScript version AES decryption for fallback of WebCrypto API. - */ - enableSoftwareAES: boolean; - /** - * (default: undefined) - * When set, use this level as the default hls.startLevel. Keep in mind that the startLevel set with the API takes precedence over - * config.startLevel configuration parameter. - */ - startLevel: number; - /** - * (default: 10000ms for level and manifest) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - manifestLoadingTimeOut: number; - /** - * (default: 3) - * Max number of load retries. - */ - manifestLoadingMaxRetry: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... - * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - manifestLoadingRetryDelay: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - manifestLoadingMaxRetryTimeout: number; - /** - * (default: 60000ms for fragment) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - levelLoadingTimeOut: number; - /** - * (default: 3) - * Max number of load retries. - */ - levelLoadingMaxRetry: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... - * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - levelLoadingRetryDelay: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - levelLoadingMaxRetryTimeout: number; - /** - * (default: 60000ms for fragment) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - fragLoadingTimeOut: number; - /** - * (default: 3) - * Max number of load retries. - */ - fragLoadingMaxRetry: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... - * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - fragLoadingRetryDelay: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - fragLoadingMaxRetryDelay: number; - /** - * (default: false) - * Start prefetching start fragment although media not attached yet. Max number of append retries. - */ - startFragPrefech: boolean; - /** - * (default: 3) - * Max number of sourceBuffer.appendBuffer() retry upon error. Such error could happen in loop with UHD streams, when internal buffer is full. (Quota Exceeding Error will be triggered). - * In that case we need to wait for the browser to evict some data before being able to append buffer correctly. - */ - appendErrorMaxRetry: number; - /** - * (default: standard XMLHttpRequest-based URL loader) - * Override standard URL loader by a custom one. Could be useful for P2P or stubbing (testing). - * Use this, if you want to overwrite both the fragment and the playlist loader. - * Note: If fLoader or pLoader are used, they overwrite loader! - */ - loader: typeof Loader; - /** - * (default: undefined) - * This enables the manipulation of the fragment loader. - * Note: This will overwrite the default loader, as well as your own loader function. - */ - fLoader?: typeof Loader; - /** - * (default: undefined) - * This enables the manipulation of the playlist loader. - * Note: This will overwrite the default loader, as well as your own loader function. - */ - pLoader?: typeof Loader; - /** - * (default: undefined) - * XMLHttpRequest customization callback for default XHR based loader. - * Parameter should be a function with two arguments (xhr: XMLHttpRequest, url: string). - * If xhrSetup is specified, default loader will invoke it before calling xhr.send(). This allows user to easily modify/setup XHR. - */ - xhrSetup?(xhr: XMLHttpRequest, url: string): void; - /** - * (default: undefined) - * Fetch customization callback for Fetch based loader. - * Parameter should be a function with two arguments (context and Request Init Params). - * If fetchSetup is specified and Fetch loader is used, fetchSetup will be triggered to instantiate Request Object. This allows user to easily tweak Fetch loader. - */ - fetchSetup?(context: any, initParams: any): Request; - /** - * (default: internal ABR controller) - * Customized Adaptive Bitrate Streaming Controller. - * Parameter should be a class providing 2 getters, 2 setters and a destroy() method: - * get/set nextAutoLevel: return next auto-quality level/force next auto-quality level that should be returned (currently used for emergency switch down) - * get/set autoLevelCapping: capping/max level value that could be used by ABR Controller - * destroy(): should clean-up all used resources - */ - abrController: AbrController; - /** - * (default: internal track timeline controller) - * Customized text track syncronization controller. - * Parameter should be a class with a destroy() method: - * destroy() : should clean-up all used resources - */ - timelineController: TimelineController; - /** - * (default: true) - * Whether or not to enable WebVTT captions on HLS - */ - enableWebVTT?: boolean; - /** - * (default: true) - * whether or not to enable CEA-708 captions - */ - enableCEA708Captions: boolean; - /** - * (default: English) - * Label for the text track generated for CEA-708 captions track 1. This is how it will appear in the browser's native menu for subtitles and captions. - */ - captionsTextTrack1Label: string; - /** - * (default: en) - * RFC 3066 language code for the text track generated for CEA-708 captions track 1. - */ - captionsTextTrack1LanguagedCode: string; - /** - * (default: Spanish) - * Label for the text track generated for CEA-708 captions track 2. This is how it will appear in the browser's native menu for subtitles and captions. - */ - captionsTextTrack2Label: string; - /** - * (default: es) - * RFC 3066 language code for the text track generated for CEA-708 captions track 2. - */ - captionsTextTrack2LanguageCode: string; - /** - * (default: false) - * If a segment's video track is shorter than its audio track by > min(maxSeekHole, maxBufferHole), extend the final video frame's duration to match the audio track's duration. - * This helps playback continue in certain cases that might otherwise get stuck. - */ - stretchShortVideoTrack: boolean; - /** - * (default: 1) - * Browsers are really strict about audio frames timings. They usually play audio frames one after the other, regardless of - * the timestamps advertised in the fmp4. If audio timestamps are not consistent (consecutive audio frames too close or too far - * from each other), audio will easily drift. hls.js is restamping audio frames so that the distance between consecutive audio - * frame remains constant. If the distance is larger than the max allowed drift, hls.js will either - * * drop the next audio frame if distance is too small (if next audio frame timestamp is smaller than expected - * timestamp - max allowed drifter) - * * insert silent frames if distance is too big (next audio frame timestamp is bigger than expected - * timestamp + max allowed drift) - * Parameter should be an integer representing the max number of audio frames allowed to drifter. Keep in mind that one - * audio frame is 1024 audio samples (if using AAC), at 44.1 kHz, it gives 1024/44100 = 23ms. - */ - maxAudioFramesDrift: number; - /** - * (default: true) - * Whether or not to force having a key frame in the first AVC sample after a discontinuity. - * If set to true, after a discontinuity, the AVC samples without any key frame will be dropped until finding one that contains a key frame. - * If set to false, all AVC samples will be kept, which can help avoid holes in the stream. - * Setting this parameter to false can also generate decoding weirdness when switching level or seeking. - */ - forceKeyFrameOnDiscontinuity: boolean; - /** - * (default: 5.0) - * Fast bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. - * Half of the estimate is based on the last abrEwmaFastLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than 0 - */ - abrEwmaFastLive: number; - /** - * (default: 9.0) - * Slow bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. - * Half of the estimate is based on the last abrEwmaSlowLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than abrEwmaFastLive - */ - abrEwmaSlowLive: number; - /** - * (default: 4.0) - * Fast bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. - * Half of the estimate is based on the last abrEwmaFastVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than 0 - */ - abrEwmaFastVod: number; - /** - * (default: 15.0) - * Slow bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. - * Half of the estimate is based on the last abrEwmaSlowVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than abrEwmaFastVoD - */ - abrEwmaSlowVod: number; - /** - * (default: 500000) - * Default bandwidth estimate in bits/second prior to collecting fragment bandwidth samples. - * parameter should be a float - */ - abrEwmaDefaultEstimate: number; - /** - * (default: 0.8) - * Scale factor to be applied against measured bandwidth average, to determine whether we can stay on current or lower quality level. - * If abrBandWidthFactor * bandwidth average < level.bitrate then ABR can switch to that level providing that it is equal or less than current level. - */ - abrBandWidthFactor: number; - /** - * (default: 0.7) - * Scale factor to be applied against measured bandwidth average, to determine whether we can switch up to a higher quality level. - * If abrBandWidthUpFactor * bandwidth average < level.bitrate then ABR can switch up to that quality level. - */ - abrBandWidthUpFactor: number; - /** - * (default: false) - * max bitrate used in ABR by avg measured bitrate i.e. if bitrate signaled in variant manifest for a given level is 2Mb/s but average bitrate measured on this level is 2.5Mb/s, - * then if config value is set to true, ABR will use 2.5 Mb/s for this quality level. - */ - abrMaxWithRealBitrate: boolean; - /** - * (default: 0) - * Return the capping/min bandwidth value that could be used by automatic level selection algorithm. - * Useful when browser or tab of the browser is not in the focus and bandwidth drops - */ - minAutoBitrate: number; - } - - interface OptionalConfig { - /** - * (default: false) - * if set to true, the adaptive algorithm with limit levels usable in auto-quality by the HTML video element dimensions (width and height) - * if set to false, levels will not be limited. All available levels could be used in auto-quality mode taking only bandwidth into consideration. - */ - capLevelToPlayerSize?: boolean; - /** - * (default: false) - * setting config.debug = true; will turn on debug logs on JS console. - * a logger object could also be provided for custom logging: config.debug = customLogger; - */ - debug?: boolean; - /** - * (default: true) - * if set to true, start level playlist and first fragments will be loaded automatically, after triggering of Hls.Events.MANIFEST_PARSED event - * if set to false, an explicit API call (hls.startLoad(startPosition=-1)) will be needed to start quality level/fragment loading. - */ - autoStartLoad?: boolean; - /** - * (default -1) - * if set to -1, playback will start from initialTime=0 for VoD and according to liveSyncDuration/liveSyncDurationCount config params for Live - * otherwise, playback will start from predefined value. (unless stated otherwise in autoStartLoad=false mode : in that case startPosition can be overrided using hls.startLoad(startPosition)). - */ - startPosition?: number; - /** - * (default: undefined) - * if audio codec is not signaled in variant manifest, or if only a stream manifest is provided, hls.js tries to guess audio codec by parsing audio sampling rate in ADTS header. - * If sampling rate is less or equal than 22050 Hz, then hls.js assumes it is HE-AAC, otherwise it assumes it is AAC-LC. - * This could result in bad guess, leading to audio decode error, ending up in media error. - * It is possible to hint default audiocodec to hls.js by configuring this value as below: - * mp4a.40.2 (AAC-LC) or - * mp4a.40.5 (HE-AAC) or - * undefined (guess based on sampling rate) - */ - defaultAudioCodec?: string; - /** - * (default: 1) - * number of segments needed to start a playback of Live stream. - */ - initialLiveManifestSize?: number; - /** - * (default: 30 seconds) - * Maximum buffer length in seconds. If buffer length is/become less than this value, a new fragment will be loaded. - * This is the guaranteed buffer length hls.js will try to reach, regardless of maxBufferSize. - */ - maxBufferLength?: number; - /** - * (default 600s) - * Maximum buffer length in seconds. Hls.js will never exceed this value, even if maxBufferSize is not reached yet. - * hls.js tries to buffer up to a maximum number of bytes (60 MB by default) rather than to buffer up to a maximum nb of seconds. - * This is to mimic the browser behaviour (the buffer eviction algorithm is starting after the browser detects that video buffer size reaches a limit in bytes) - * maxBufferLength is the minimum guaranteed buffer length that hls.js will try to achieve, even if that value exceeds the amount of bytes 60 MB of memory. - * maxMaxBufferLength acts as a capping value, as if bitrate is really low, you could need more than one hour of buffer to fill 60 MB. - */ - maxMaxBufferLength?: number; - /** - * (default: 60 MB) - * 'Minimum' maximum buffer size in bytes. If buffer size upfront is bigger than this value, no fragment will be loaded - */ - maxBufferSize?: number; - /** - * (default: 0.5 seconds) - * 'Maximum' inter-fragment buffer hole tolerance that hls.js can cope with when searching for the next fragment to load. When switching between quality level, - * fragments might not be perfectly aligned. - * This could result in small overlapping or hole in media buffer. This tolerance factor helps cope with this. - */ - maxBufferHole?: number; - /** - * (default: 2s) - * In case playback is stalled, and a buffered range is available upfront, less than maxSeekHole seconds from current media position, - * hls.js will jump over this buffer hole to reach the beginning of this following buffered range. - * maxSeekHole allows to configure this jumpable threshold. - */ - maxSeekHole?: number; - /** - * (default: 4s) - * - * ABR algorithm will always try to choose a quality level that should avoid rebuffering. In case no quality level with this criteria can - * be found (lets say for example that buffer length is 1s, but fetching a fragment at lowest quality is predicted to take around 2s ... - * ie we can forecast around 1s of rebuffering ...) then ABR algorithm will try to find a level that should guarantee less than - * maxStarvationDelay of buffering. - */ - maxStarvationDelay?: number; - /** - * (default 0.2s) - * This tolerance factor is used during fragment lookup. - * Instead of checking whether buffered.end is located within [start, end] range, frag lookup will be done by checking within [start-maxFragLookUpTolerance, end-maxFragLookUpTolerance] range. - * This tolerance factor is used to cope with situations like: - * buffered.end = 9.991 - * frag[0] : [0,10] - * frag[1] : [10,20] - * buffered.end is within frag[0] range, but as we are close to frag[1], frag[1] should be choosen instead - * If maxFragLookUpTolerance = 0.2, this lookup will be adjusted to - * frag[0] : [-0.2,9.8] - * frag[1] : [9.8,19.8] - * This time, buffered.end is within frag[1] range, and frag[1] will be the next fragment to be loaded, as expected - */ - maxLoadingDelay?: number; - /** - * (default: 0.5s) - * media element is expected to play and if currentTime has not moved for more than lowBufferWatchdogPeriod and if there are less than maxBufferHole seconds buffered upfront, - * hls.js will try to nudge playhead to recover playback - */ - lowBufferWatchdogPeriod?: number; - /** - * (default: 3s) - * if media element is expected to play and if currentTime has not moved for more than highBufferWatchdogPeriod and if there are more than maxBufferHole seconds buffered upfront, - * hls.js will try to nudge playhead to recover playback - */ - highBufferWatchdogPeriod?: number; - /** - * (default: 0.1s) - * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. - * media.currentTime += (nb nudge retry -1)*nudgeOffset - */ - nudgeOffset?: number; - /** - * (default: 3s) - * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. - * media.currentTime += (nb nudge retry -1)*nudgeOffset - */ - nudgeMaxRetry?: number; - /** - * (default 4s) - * - * max video loading delay used in automatic start level selection : in that mode ABR controller will ensure that video loading time (ie - * the time to fetch the first fragment at lowest quality level + the time to fetch the fragment at the appropriate quality level is less - * than maxLoadingDelay ) - */ - maxFragLookUpTolerance?: number; - /** - * (default: 3) - * edge of live delay, expressed in multiple of EXT-X-TARGETDURATION. if set to 3, playback will start from fragment N-3, N being the last fragment of the live playlist. - * Decreasing this value is likely to cause playback stalls. - */ - liveSyncDurationCount?: number; - /** - * (default: Infinity) - * maximum delay allowed from edge of live, expressed in multiple of EXT-X-TARGETDURATION. - * If set to 10, the player will seek back to liveSyncDurationCount whenever the next fragment to be loaded is older than N-10, N being the last fragment of the live playlist. - * If set, this value must be stricly superior to liveSyncDurationCount a value too close from liveSyncDurationCount is likely to cause playback stalls. - */ - liveMaxLatencyDurationCount?: number; - /** - * (default: undefined) - * Alternative parameter to liveSyncDurationCount, expressed in seconds vs number of segments. - * If defined in the configuration object, liveSyncDuration will take precedence over the default liveSyncDurationCount. - * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. - * A value too low (inferior to ~3 segment durations) is likely to cause playback stalls. - */ - liveSyncDuration?: number; - /** - * (default: undefined) - * Alternative parameter to liveMaxLatencyDurationCount, expressed in seconds vs number of segments. - * If defined in the configuration object, liveMaxLatencyDuration will take precedence over the default liveMaxLatencyDurationCount. - * If set, this value must be stricly superior to liveSyncDuration which must be defined as well. - * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. - * A value too close from liveSyncDuration is likely to cause playback stalls. - */ - liveMaxLatencyDuration?: number; - /** - * (default: false) - * Override current Media Source duration to Infinity for a live broadcast. Useful, if you are building a player which relies - * on native UI capabilities in modern browsers. If you want to have a native Live UI in environments like iOS Safari, Safari, - * Android Google Chrome, etc. set this value to true. - */ - liveDurationInfinity?: boolean; - /** - * (default: true) - * Enable WebWorker (if available on browser) for TS demuxing/MP4 remuxing, to improve performance and avoid lag/frame drops. - */ - enableWorker?: boolean; - /** - * (default: true) - * Enable to use JavaScript version AES decryption for fallback of WebCrypto API. - */ - enableSoftwareAES?: boolean; - /** - * (default: undefined) - * When set, use this level as the default hls.startLevel. Keep in mind that the startLevel set with the API takes precedence over - * config.startLevel configuration parameter. - */ - startLevel?: number; - /** - * (default: 10000ms for level and manifest) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - manifestLoadingTimeOut?: number; - /** - * (default: 3) - * Max number of load retries. - */ - manifestLoadingMaxRetry?: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... - * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - manifestLoadingRetryDelay?: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - manifestLoadingMaxRetryTimeout?: number; - /** - * (default: 60000ms for fragment) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - levelLoadingTimeOut?: number; - /** - * (default: 3) - * Max number of load retries. - */ - levelLoadingMaxRetry?: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... - * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - levelLoadingRetryDelay?: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - levelLoadingMaxRetryTimeout?: number; - /** - * (default: 60000ms for fragment) - * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. - * It is up to the application to catch this event and treat it as needed. - */ - fragLoadingTimeOut?: number; - /** - * (default: 3) - * Max number of load retries. - */ - fragLoadingMaxRetry?: number; - /** - * (default: 1000 ms) - * Initial delay between XMLHttpRequest error and first load retry (in ms). - * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... - * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). - * Prefetch start fragment although media not attached. - */ - fragLoadingRetryDelay?: number; - /** - * (default: 64000 ms) - * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. - */ - fragLoadingMaxRetryDelay?: number; - /** - * (default: false) - * Start prefetching start fragment although media not attached yet. Max number of append retries. - */ - startFragPrefetch?: boolean; - /** - * (default: 3) - * Max number of sourceBuffer.appendBuffer() retry upon error. Such error could happen in loop with UHD streams, when internal buffer is full. (Quota Exceeding Error will be triggered). - * In that case we need to wait for the browser to evict some data before being able to append buffer correctly. - */ - appendErrorMaxRetry?: number; - /** - * (default: standard XMLHttpRequest-based URL loader) - * Override standard URL loader by a custom one. Could be useful for P2P or stubbing (testing). - * Use this, if you want to overwrite both the fragment and the playlist loader. - * Note: If fLoader or pLoader are used, they overwrite loader! - */ - loader?: typeof Loader; - /** - * (default: undefined) - * This enables the manipulation of the fragment loader. - * Note: This will overwrite the default loader, as well as your own loader function. - */ - fLoader?: typeof Loader; - /** - * (default: undefined) - * This enables the manipulation of the playlist loader. - * Note: This will overwrite the default loader, as well as your own loader function. - */ - pLoader?: typeof Loader; - /** - * (default: undefined) - * XMLHttpRequest customization callback for default XHR based loader. - * Parameter should be a function with two arguments (xhr: XMLHttpRequest, url: string). - * If xhrSetup is specified, default loader will invoke it before calling xhr.send(). This allows user to easily modify/setup XHR. - */ - xhrSetup?(xhr: XMLHttpRequest, url: string): void; - /** - * (default: undefined) - * Fetch customization callback for Fetch based loader. - * Parameter should be a function with two arguments (context and Request Init Params). - * If fetchSetup is specified and Fetch loader is used, fetchSetup will be triggered to instantiate Request Object. This allows user to easily tweak Fetch loader. - */ - fetchSetup?(context: any, initParams: any): Request; - /** - * (default: internal ABR controller) - * Customized Adaptive Bitrate Streaming Controller. - * Parameter should be a class providing 2 getters, 2 setters and a destroy() method: - * get/set nextAutoLevel: return next auto-quality level/force next auto-quality level that should be returned (currently used for emergency switch down) - * get/set autoLevelCapping: capping/max level value that could be used by ABR Controller - * destroy(): should clean-up all used resources - */ - abrController?: AbrController; - /** - * (default: internal track timeline controller) - * Customized text track syncronization controller. - * Parameter should be a class with a destroy() method: - * destroy() : should clean-up all used resources - */ - timelineController?: TimelineController; - /** - * (default: true) - * Whether or not to enable WebVTT captions on HLS - */ - enableWebVTT?: boolean; - /** - * (default: true) - * whether or not to enable CEA-708 captions - */ - enableCEA708Captions?: boolean; - /** - * (default: English) - * Label for the text track generated for CEA-708 captions track 1. This is how it will appear in the browser's native menu for subtitles and captions. - */ - captionsTextTrack1Label?: string; - /** - * (default: en) - * RFC 3066 language code for the text track generated for CEA-708 captions track 1. - */ - captionsTextTrack1LanguagedCode?: string; - /** - * (default: Spanish) - * Label for the text track generated for CEA-708 captions track 2. This is how it will appear in the browser's native menu for subtitles and captions. - */ - captionsTextTrack2Label?: string; - /** - * (default: es) - * RFC 3066 language code for the text track generated for CEA-708 captions track 2. - */ - captionsTextTrack2LanguageCode?: string; - /** - * (default: false) - * If a segment's video track is shorter than its audio track by > min(maxSeekHole, maxBufferHole), extend the final video frame's duration to match the audio track's duration. - * This helps playback continue in certain cases that might otherwise get stuck. - */ - stretchShortVideoTrack?: boolean; - /** - * (default: 1) - * Browsers are really strict about audio frames timings. They usually play audio frames one after the other, regardless of - * the timestamps advertised in the fmp4. If audio timestamps are not consistent (consecutive audio frames too close or too far - * from each other), audio will easily drift. hls.js is restamping audio frames so that the distance between consecutive audio - * frame remains constant. If the distance is larger than the max allowed drift, hls.js will either - * * drop the next audio frame if distance is too small (if next audio frame timestamp is smaller than expected - * timestamp - max allowed drifter) - * * insert silent frames if distance is too big (next audio frame timestamp is bigger than expected - * timestamp + max allowed drift) - * Parameter should be an integer representing the max number of audio frames allowed to drifter. Keep in mind that one - * audio frame is 1024 audio samples (if using AAC), at 44.1 kHz, it gives 1024/44100 = 23ms. - */ - maxAudioFramesDrift?: number; - /** - * (default: true) - * Whether or not to force having a key frame in the first AVC sample after a discontinuity. - * If set to true, after a discontinuity, the AVC samples without any key frame will be dropped until finding one that contains a key frame. - * If set to false, all AVC samples will be kept, which can help avoid holes in the stream. - * Setting this parameter to false can also generate decoding weirdness when switching level or seeking. - */ - forceKeyFrameOnDiscontinuity?: boolean; - /** - * (default: 5.0) - * Fast bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. - * Half of the estimate is based on the last abrEwmaFastLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than 0 - */ - abrEwmaFastLive?: number; - /** - * (default: 9.0) - * Slow bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. - * Half of the estimate is based on the last abrEwmaSlowLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than abrEwmaFastLive - */ - abrEwmaSlowLive?: number; - /** - * (default: 4.0) - * Fast bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. - * Half of the estimate is based on the last abrEwmaFastVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than 0 - */ - abrEwmaFastVod?: number; - /** - * (default: 15.0) - * Slow bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. - * Half of the estimate is based on the last abrEwmaSlowVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. - * parameter should be a float greater than abrEwmaFastVoD - */ - abrEwmaSlowVod?: number; - /** - * (default: 500000) - * Default bandwidth estimate in bits/second prior to collecting fragment bandwidth samples. - * parameter should be a float - */ - abrEwmaDefaultEstimate?: number; - /** - * (default: 0.8) - * Scale factor to be applied against measured bandwidth average, to determine whether we can stay on current or lower quality level. - * If abrBandWidthFactor * bandwidth average < level.bitrate then ABR can switch to that level providing that it is equal or less than current level. - */ - abrBandWidthFactor?: number; - /** - * (default: 0.7) - * Scale factor to be applied against measured bandwidth average, to determine whether we can switch up to a higher quality level. - * If abrBandWidthUpFactor * bandwidth average < level.bitrate then ABR can switch up to that quality level. - */ - abrBandWidthUpFactor?: number; - /** - * (default: false) - * max bitrate used in ABR by avg measured bitrate i.e. if bitrate signaled in variant manifest for a given level is 2Mb/s but average bitrate measured on this level is 2.5Mb/s, - * then if config value is set to true, ABR will use 2.5 Mb/s for this quality level. - */ - abrMaxWithRealBitrate?: boolean; - /** - * (default: 0) - * Return the capping/min bandwidth value that could be used by automatic level selection algorithm. - * Useful when browser or tab of the browser is not in the focus and bandwidth drops - */ - minAutoBitrate?: number; - } - + const BUFFER_CODECS: string; /** - * a Level object represents a given quality level and contains quality level related info + * fired when sourcebuffers have been created + * data: { tracks: tracks } */ - interface Level { - /** - * level url. might contain sever items if failover/redundant streams are found in the manifest - */ - url: string[]; - /** - * level bitrate - */ - bitrate: number; - /** - * level name - */ - name: string; - /** - * used codecs - */ - codecs: string; - /** - * video width - */ - width: number; - /** - * video height - */ - height: number; - /** - * level details - */ - details: LevelDetails; - } - + const BUFFER_CREATED: string; /** - * a LevelDetails object contains level details retrieved after level playlist parsing + * fired when we append a segment to the buffer + * data: { segment: segment object } */ - interface LevelDetails { - /** - * protocol version - */ - version: number; - /** - * playlist type - */ - type: string; - /** - * start sequence number - */ - startSN: number; - /** - * end sequence number - */ - endSN: number; - /** - * level total duration - */ - totalduration: number; - /** - * level fragment target duration - */ - targetduration: number; - /** - * average fragment duration - */ - averagetargetduration: number; - /** - * array of fragments info - */ - fragments: Fragment[]; - /** - * is this level a live playlist or not? - */ - live: boolean; - } - + const BUFFER_APPENDING: string; /** - * the Fragment object contains fragment related info + * fired when we are done with appending a media segment to the buffer + * data: { parent : segment parent that triggered BUFFER_APPENDING, pending : nb of segments waiting for appending for this segment parent } */ - interface Fragment { - /** - * fragment duration - */ - duration: number; - /** - * fragment level identifier - */ - level: number; - /** - * fragment sequence number - */ - sn: number; - /** - * fragment start offset - */ - start: number; - /** - * fragment url - */ - url: string; - /** - * stream start date and time - */ - programDateTime: Date; - /** - * continuity count - */ - cc: number; - /** - * list of tags associated with the fragment - */ - tagList: string[][]; - /** - * fragment title - */ - title: string; - } - - interface Data { - /** - * videoElement - */ - video?: HTMLVideoElement; - /** - * media source - */ - mediaSource?: string; - /** - * manifest url - */ - url?: string; - /** - * available quality levels - */ - levels?: number[]; - /** - * available audio tracks - */ - audioTracks?: AudioTrack[]; - /** - * XMLHttp request stats - */ - stats?: HlsStats; - /** - * index of first quality level appearing in Manifest - */ - firstLevel?: number; - /** - * id of updated level - */ - level?: number; - /** - * id of loaded level - */ - levelId?: number; - /** - * ErrorDetails type or Level Details - */ - details?: string | LevelDetails; - /** - * PTS drift observed when parsing last fragment - */ - drift?: number; - /** - * fragment object with frag.loaded=stats.loaded - */ - frag?: Fragment; - /** - * fragment payload - */ - payload?: any; // TODO: what is the payload? - /** - * id of level or demuxer - */ - id?: number; - /** - * moof MP4 box - */ - moof?: any; // TODO: whats is the moof? - /** - * mdat MP4 box - */ - mdat?: any; // TODO: what is mdat? - /** - * PTS of first sample - */ - startPTS?: number; - /** - * PTS of last sample - */ - endPTS?: number; - /** - * DTS of first sample - */ - startDTS?: number; - /** - * DTS of last sample - */ - endDTS?: number; - /** - * stream type (audio or video) - */ - type?: string; - /** - * number of samples - */ - nb?: number; - /** - * number of dropped frames in last monitoring period - */ - currentDropped?: number; - /** - * number of decoded frames in last monitoring period - */ - currentDecode?: number; - /** - * total dropped frames on this video element - */ - totalDropped?: number; - /** - * level has to much dropped frame will be restricted - */ - droppedLevel?: number; - /** - * is error fatal or not. - * if error is not fatal, hls.js will try to recover it - * if error is fatal, an action is required to (try to) recover it - */ - fatal?: boolean; - } - + const BUFFER_APPENDED: string; /** - * (default: internal ABR controller) - * Customized Adaptive Bitrate Streaming Controller. + * fired when the stream is finished and we want to notify the media buffer that there will be no more data + * data: { } */ - interface AbrController { - /** - * get: capping/max level value that could be used by ABR Controller - * set: capping/max level value that could be used by ABR Controller - */ - autoLevelCapping: number; - /** - * accumulated handled events - */ - handledEvents: string[]; - /** - * current hls instance - */ - hls: Hls; - /** - * last fragments corresponding level - */ - lastLoadedFragLevel: number; - /** - * get: next auto-quality levele/force next auto-quality level that should be returned - * set: next auto-quality levele/force next auto-quality level that should be returned - * - currently used for emergency switch down - */ - nextAutoLevel: number; - useGenericHandler: boolean; - } - + const BUFFER_EOS: string; /** - * Customized text track syncronization controller. + * fired when the media buffer should be flushed + * data: { } */ - interface TimelineController { - /** - * clean-up all used resources - */ - destory(): void; - } - - interface LoaderResponse { - url: string; - data: string | ArrayBuffer; - } - - interface LoaderStats { - /** - * performance.now() just after load() has been called - */ - trequest: number; - /** - * performance.now() of first received byte - */ - tfirst: number; - /** - * performance.now() on load complete - */ - tload: number; - /** - * number of loaded bytes - */ - loaded: number; - /** - * download bandwitdh in bit/s - */ - bw: number; - /** - * total nb of bytes - */ - total: number; - } - - interface LoaderError { - /** - * error code - */ - code: number; - /** - * error description - */ - text: string; - } - - interface HlsStats { - /** - * performance.now() just after load() has been called - */ - trequest: number; - /** - * performance.now() of first received byte - */ - tfirst: number; - /** - * performance.now() on load complete - */ - tload: number; - mtime: number; - tbuffered?: number; - length?: number; - } - - interface LoaderContext { - /** - * target URL - */ - url: string; - /** - * loader response type (arraybuffer or default response type for playlist) - */ - responseType: string; - /** - * start byte range offset - */ - rangeStart?: number; - /** - * end byte range offset - */ - rangeEnd?: number; - /** - * true if onProgress should report partial chunk of loaded content - */ - progressData?: boolean; - /** - * fragment object - */ - frag: Fragment; - /** - * request type - * - level, manifest - */ - type: string; - /** - * level id - */ - level: number; - } - - interface LoaderConfig { - /** - * Max number of load retries - */ - maxRetry: number; - /** - * Timeout after which `onTimeOut` callback will be triggered (if loading is still not finished after that delay) - */ - timeout: number; - /** - * Delay between an I/O error and following connection retry (ms). This to avoid spamming the server - */ - retryDelay: number; - /** - * max connection retry delay (ms) - */ - maxRetryDelay: number; - } - - interface LoaderCallbacks { - onSuccess(response: LoaderResponse, stats: LoaderStats, context: LoaderContext): void; - onProgress(stats: LoaderStats, context: LoaderContext, data: string | ArrayBuffer): void; - onError(error: LoaderError, context: LoaderContext): void; - onTimeout(stats: LoaderStats, context: LoaderContext): void; - } -} - -declare class Hls { + const BUFFER_FLUSHING: string; /** - * Constructor. Can be provided an HlsConfig object as default properties and or overrides + * fired when the media buffer has been flushed + * data: { } */ - constructor(config?: Hls.OptionalConfig) + const BUFFER_FLUSHED: string; /** - * return array of available quality levels + * fired to signal that a manifest loading starts + * data: { url : manifestURL } */ - levels: Hls.Level[]; + const MANIFEST_LOADING: string; /** - * get: return current playback quality level - * set: trigger an immediate quality level switch to new quality level - * this will pause the video if it was playing, flush the whole buffer, - * and fetch fragment matching with current position and requested quality level - * then resume the video if needed once fetched fragment will have been buffered - * - * set to -1 for automatic level selection + * fired after manifest has been loaded + * data: { levels : [available quality levels] , audioTracks : [ available audio tracks], url : manifestURL, stats : { trequest, tfirst, tload, mtime}} */ - currentLevel: number; + const MANIFEST_LOADED: string; /** - * capping/max level (index of level) that could be used by ABR Controller. Defaults to -1 - * which means no limit - * set: max level value that could be used by the ABR Controller + * fired after manifest has been parsed + * data: { levels : [ available quality levels ], firstLevel : index of first quality level appearing in Manifest } */ - autoLevelCapping: number; + const MANIFEST_PARSED: string; /** - * return start level index (level of first fragment that will be played back) - * if not overrided by user: first level appearing in manifest will be used as start level - * if -1: automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment) - * - * default valus is hls.firstLevel + * fired when a level playlist loading starts + * data: { url : level URL, level : id of level being loaded } */ - startLevel: number; + const LEVEL_LOADING: string; + /** + * fired when a level playlist loading finishes + * data: { details : levelDetails object, levelId : id of loaded level, stats : { trequest, tfirst, tload, mtime } } + */ + const LEVEL_LOADED: string; + /** + * fired when a level's details have been updated based on previous details, after it has been loaded + * data: { details : levelDetails object, level : id of updated level } + */ + const LEVEL_UPDATED: string; + /** + * fired when a level's PTS information has been updated after parsing a fragment + * data: { details: levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment } + */ + const LEVEL_PTS_UPDATED: string; + /** + * fired when a level switch is requested + * data: { level: Level } + */ + const LEVEL_SWITCHING: string; + /** + * fired when a level switch is effective + * data: { level: level object } + */ + const LEVEL_SWITCHED: string; + /** + * fired to notify that audio track lists has been updated + * data: { audioTracks : audioTracks } + */ + const AUDIO_TRACKS_UPDATED: string; + /** + * fired when an audio track switch occurs. deprecated in favor AUDIO_TRACK_SWITCHING + * data: { id : audio track id } + */ + const AUDIO_TRACK_SWTICH: string; + /** + * fired when an audio track switching is requested + * data: { id : audio track id } + */ + const AUDIO_TRACK_SWITCHING: string; + /** + * fired when an audio track switch actually occurs + * data: { id : audio track id } + */ + const AUDIO_TRACK_SWITCHED: string; + /** + * fired when an audio track loading starts + * data: { url : audio track URL, id : audio track id } + */ + const AUDIO_TRACK_LOADING: string; + /** + * fired when an audio track loading finishes + * data: { details : levelDetails object, id : audio track id, stats : { trequest, tfirst, tload, mtime } } + */ + const AUDIO_TRACK_LOADED: string; + /** + * fired to notify that subtitle track lists has been updated + * data: { subtitleTracks : subtitleTracks } + */ + const SUBTITLE_TRACKS_UPDATED: string; + /** + * fired when an subtitle track switch occurs + * data: { id : subtitle track id } + */ + const SUBTITLE_TRACK_SWITCH: string; + /** + * fired when a subtitle track loading starts + * data: { url : subtitle track URL, id : subtitle track id } + */ + const SUBTITLE_TRACK_LOADING: string; + /** + * fired when a subtitle track loading finishes + * data: { details : levelDetails object, id : subtitle track id, stats : { trequest, tfirst, tload, mtime } } + */ + const SUBTITLE_TRACK_LOADED: string; + /** + * fired when a subtitle fragment has been processed + * data: { success : boolean, frag : the processed frag } + */ + const SUBTITLE_FRAG_PROCESSED: string; + /** + * fired when a decryption key loading starts + * data: { frag: fragment object } + */ + const KEY_LOADING: string; + /** + * fired when a decryption key loading is completed + * data: { frag: fragment object } + */ + const KEY_LOADED: string; + /** + * fired when first timestamp has been found + * data: { id: demuxer id, frag: fragment object, initPTS: initPTS } + */ + const INIT_PTS_FOUND: string; + /** + * fired when a fragment loading starts + * data: { frag : fragment object } + */ + const FRAG_LOADING: string; + /** + * fired when a fragment load is in progress + * data: { frag : fragment object with frag.loaded=stats.loaded, stats : { trequest, tfirst, loaded, total } } + */ + const FRAG_LOAD_PROGRESS: string; + /** + * identifier for fragment load aborting for emergency switch down + * data: { frag: fragment object } + */ + const FRAG_LOAD_ERMERGENCY_ABORTED: string; + /** + * fired when a fragment loading is completed + * data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length}} + */ + const FRAG_LOADED: string; + /** + * fired when a fragment decryption is completed + * data: { id: demuxer id, frag: fragment object, stats: { tstart, tdecrypt } } + */ + const FRAG_DECRYPTED: string; + /** + * fired when Init Segment has been extracted from fragment + * data: { id: demuxer id, moov : moov MP4 box, codecs : codecs found while parsing fragment} + */ + const FRAG_PARSING_INIT_SEGMENT: string; + /** + * fired when parsing id3 is completed + * data: { id: demuxer id, samples : [ id3 pes - pts and dts timestamp are relative, values are in seconds]} + */ + const FRAG_PARSING_METADATA: string; + /** + * fired when moof/mdat have been extracted from fragment + * data: { id: demuxer id, + * moof : moof MP4 box, + * mdat : mdat MP4 box, + * startPTS : PTS of first sample, + * endPTS : PTS of last sample, + * startDTS : DTS of first sample, + * endDTS : DTS of last sample, + * type : stream type (audio or video), + * nb : number of samples} + */ + const FRAG_PARSING_DATA: string; + /** + * fired when fragment parsing is completed + * data: { id: demuxer id} + */ + const FRAG_PARSED: string; + /** + * fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer + * data: { id: demuxer id, frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length} } + */ + const FRAG_BUFFERED: string; + /** + * fired when fragment matching with current video position is changing + * data: { frag : fragment object } + */ + const FRAG_CHANGED: string; + /** + * triggered when FPS drop in last monitoring period is higher than given threshold + * data: { curentDropped : nb of dropped frames in last monitoring period, + * currentDecoded : nb of decoded frames in last monitoring period, + * totalDropped : total dropped frames on this video element } + */ + const FPS_DROP: string; + /** + * triggered when FPS drop triggers auto level capping + * data: { level: suggested new auto level capping by fps controller, droppedLevel : level has to much dropped frame will be restricted } + */ + const FPS_DROP_LEVEL_CAPPING: string; + /** + * Identifier for an error event + * data: { type : error type, details : error details, fatal : is error fatal or not, other error specific data } + */ + const ERROR: string; + /** + * fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a video to the instance of hls.js to handle mid-rolls for example. + * data: { } + */ + const DESTROYING: string; + /** + * fired upon stream controller state transitions + * data: { previousState, nextState } + */ + const STREAM_STATE_TRANSITION: string; + } + + /** + * Hls error details + */ + namespace ErrorDetails { + // NETWORK_ERRORS // + /** + * raised when manifest loading fails because of a network error + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_LOAD_ERROR, fatal : true, url : manifest URL, response : { code: error code, text: error text }, loader : URL loader } + */ + const MANIFEST_LOAD_ERROR: string; + /** + * raised when manifest loading fails because of a timeout + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT, fatal : true, url : manifest URL, loader : URL loader } + */ + const MANIFEST_LOAD_TIMEOUT: string; + /** + * raised when manifest parsing failed to find proper content + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_PARSING_ERROR, fatal : true, url : manifest URL, reason : parsing error reason } + */ + const MANIFEST_PARSING_ERROR: string; + /** + * raised when level loading fails because of a network error + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.LEVEL_LOAD_ERROR, fatal : true, url : level URL, response : { code: error code, text: error text }, loader : URL loader } + */ + const LEVEL_LOAD_ERROR: string; + /** + * raised when level loading fails because of a timeout + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.LEVEL_LOAD_TIMEOUT, fatal : true, url : level URL, loader : URL loader } + */ + const LEVEL_LOAD_TIMEOUT: string; + /** + * raised when audio track loading fails because of a network error + * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.AUDIO_TRACK_LOAD_ERROR, fatal: false, url: audio URL, loader: URL loader } + */ + const AUDIO_TRACK_LOAD_ERROR: string; + /** + * raised when audio track loading fails because of a timeout + * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT, fatal: false, url: audio URL, response: { code: error code, text: error text }, loader: URL loader } + */ + const AUDIO_TRACK_LOAD_TIMEOUT: string; + /** + * raised when fragment loading fails because of a network error + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOAD_ERROR, fatal : true or false, frag : fragment object, response : { code: error code, text: error text } } + */ + const FRAG_LOAD_ERROR: string; + /** + * raised when fragment loading fails because of a timeout + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOAD_TIMEOUT, fatal : true or false, frag : fragment object } + */ + const FRAG_LOAD_TIMEOUT: string; + /** + * raised when decrypt key loading fails because of a network error + * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.KEY_LOAD_ERROR, fatal: false, frag: fragment object } + */ + const KEY_LOAD_ERROR: string; + /** + * raised when decrypt key loading fails because of timeout + * data: { type: NETWORK_EROR, details: Hls.ErrorDetails.KEY_LOAD_TIMEOUT, fatal: true, frag: fragment object } + */ + const KEY_LOAD_TIMEOUT: string; + + // MEDIA_ERRORS // + /** + * raised when manifest only contains quality level with codecs incompatible with MediaSource Engine. + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR, fatal : true, url : manifest URL } + */ + const MANIFEST_INCOMPATIBLE_CODECS_ERROR: string; + /** + * raised upon detection of same fragment being requested in loop + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR, fatal : true or false, frag : fragment object } + */ + const FRAG_LOOP_LOADING_ERROR: string; + /** + * raised when fragment decryption fails + * data: { type: MEDIA_ERROR, details: Hls.ErrorDetails.FRAG_DECRYPT_ERROR, fatal: true, reason: failure reason } + */ + const FRAG_DECRYPT_ERROR: string; + /** + * raised when fragment parsing fails + * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_PARSING_ERROR, fatal : true or false, reason : failure reason } + */ + const FRAG_PARSING_ERROR: string; + /** + * raised when MediaSource fails to add new sourceBuffer + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_ADD_CODEC_ERROR, fatal : false, err : error raised by MediaSource, mimeType: mimeType on which the failure happened } + */ + const BUFFER_ADD_CODEC_ERROR: string; + /** + * raised when exception is raised while calling buffer append + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_APPEND_ERROR, fatal : true, frag : fragment object } + */ + const BUFFER_APPEND_ERROR: string; + /** + * raised when exception is raised during buffer appending + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_APPENDING_ERROR, fatal : false } + */ + const BUFFER_APPENDING_ERROR: string; + /** + * raised when playback is stuck because buffer is running out of data + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_STALLED_ERROR, fatal : false } + */ + const BUFFER_STALLED_ERROR: string; + /** + * raised when no data can be appended anymore in media buffer because it is full. + * This error is recovered automatically by performing a smooth level switching that empty buffers (without disrupting the playback) and reducing the max buffer length. + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_FULL_ERROR, fatal : false } + */ + const BUFFER_FULL_ERROR: string; + /** + * raised after hls.js seeks over a buffer hole to unstuck the playback, + * data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal : false, hole : hole duration } + */ + const BUFFER_SEEK_OVER_HOLE: string; + /** + * raised when playback is stuck although currentTime is in a buffered aread + * data: { type: MEDIA_ERROR, details: Hls.ErrorDetails.BUFFERED_STALLED_ERROR, fatal: true } + */ + const BUFFER_NUDGE_ON_STALL: string; + + // MUX_ERROR // + /** + * raised when memory allocation fails during remuxing + * data: { type: MUX_ERROR, details: Hls.ErrorDetails.REMUX_ALLOC_ERROR, fatal: false, bytes: mdat size, reason: failure reason } + */ + const REMUX_ALLOC_ERROR: string; + + // OTHER_ERROR // + /** + * raised when level switching fails + * data: { type : OTHER_ERROR, details : Hls.ErrorDetails.LEVEL_SWITCH_ERROR, fatal : false, level : failed level index, reason : failure reason } + */ + const LEVEL_SWITCH_ERROR: string; + /** + * raised when an exception occurs in an internal hls.js event handler + * data: { type: OTHER_ERROR, details: Hls.ErrorDetails.INTERNAL_EXCEPTION, fatal: true or false, event: event object or string, error: { message: error message } } + */ + const INTERNAL_EXCEPTION: string; + } + + /** + * Hls error types + */ + namespace ErrorTypes { + /** + * network related errors + */ + const NETWORK_ERROR: string; + /** + * media/video related errors + */ + const MEDIA_ERROR: string; + /** + * muxing related errors + */ + const MUX_ERROR: string; + /** + * all other erros + */ + const OTHER_ERROR: string; + } + /** + * override Hls default configuration + * this configuration will be applied by default to all instances + */ + let DefaultConfig: Config; + /** + * checks whether your browser is supporting MediaSource Extensions + */ + function isSupported(): boolean; + /** + * returns hls.js dist version number + */ + const version: string; + + interface Config { + /** + * (default: false) + * if set to true, the adaptive algorithm with limit levels usable in auto-quality by the HTML video element dimensions (width and height) + * if set to false, levels will not be limited. All available levels could be used in auto-quality mode taking only bandwidth into consideration. + */ + capLevelToPlayerSize: boolean; + /** + * (default: false) + * setting config.debug = true; will turn on debug logs on JS console. + * a logger object could also be provided for custom logging: config.debug = customLogger; + */ + debug: boolean; /** * (default: true) * if set to true, start level playlist and first fragments will be loaded automatically, after triggering of Hls.Events.MANIFEST_PARSED event @@ -1770,111 +486,1395 @@ declare class Hls { */ autoStartLoad: boolean; /** - * get: Return the bound videoElement from the hls instance + * (default -1) + * if set to -1, playback will start from initialTime=0 for VoD and according to liveSyncDuration/liveSyncDurationCount config params for Live + * otherwise, playback will start from predefined value. (unless stated otherwise in autoStartLoad=false mode : in that case startPosition can be overrided using hls.startLoad(startPosition)). */ - media: HTMLVideoElement; + startPosition: number; /** - * hls.js config + * (default: undefined) + * if audio codec is not signaled in variant manifest, or if only a stream manifest is provided, hls.js tries to guess audio codec by parsing audio sampling rate in ADTS header. + * If sampling rate is less or equal than 22050 Hz, then hls.js assumes it is HE-AAC, otherwise it assumes it is AAC-LC. + * This could result in bad guess, leading to audio decode error, ending up in media error. + * It is possible to hint default audiocodec to hls.js by configuring this value as below: + * mp4a.40.2 (AAC-LC) or + * mp4a.40.5 (HE-AAC) or + * undefined (guess based on sampling rate) */ - config: Hls.Config; + defaultAudioCodec: string; /** - * get: return next playback quality level (playback quality level for next buffered fragment) - * return -1 if next fragment not buffered yet - * set: trigger a quality level switch for next fragment - * this could eventually flush already buffered next fragment + * (default: 1) + * number of segments needed to start a playback of Live stream. + */ + initialLiveManifestSize: number; + /** + * (default: 30 seconds) + * Maximum buffer length in seconds. If buffer length is/become less than this value, a new fragment will be loaded. + * This is the guaranteed buffer length hls.js will try to reach, regardless of maxBufferSize. + */ + maxBufferLength: number; + /** + * (default 600s) + * Maximum buffer length in seconds. Hls.js will never exceed this value, even if maxBufferSize is not reached yet. + * hls.js tries to buffer up to a maximum number of bytes (60 MB by default) rather than to buffer up to a maximum nb of seconds. + * This is to mimic the browser behaviour (the buffer eviction algorithm is starting after the browser detects that video buffer size reaches a limit in bytes) + * maxBufferLength is the minimum guaranteed buffer length that hls.js will try to achieve, even if that value exceeds the amount of bytes 60 MB of memory. + * maxMaxBufferLength acts as a capping value, as if bitrate is really low, you could need more than one hour of buffer to fill 60 MB. + */ + maxMaxBufferLength: number; + /** + * (default: 60 MB) + * 'Minimum' maximum buffer size in bytes. If buffer size upfront is bigger than this value, no fragment will be loaded + */ + maxBufferSize: number; + /** + * (default: 0.5 seconds) + * 'Maximum' inter-fragment buffer hole tolerance that hls.js can cope with when searching for the next fragment to load. When switching between quality level, + * fragments might not be perfectly aligned. + * This could result in small overlapping or hole in media buffer. This tolerance factor helps cope with this. + */ + maxBufferHole: number; + /** + * (default: 2s) + * In case playback is stalled, and a buffered range is available upfront, less than maxSeekHole seconds from current media position, + * hls.js will jump over this buffer hole to reach the beginning of this following buffered range. + * maxSeekHole allows to configure this jumpable threshold. + */ + maxSeekHole: number; + /** + * (default: 4s) * - * set to -1 for automatic level selection + * ABR algorithm will always try to choose a quality level that should avoid rebuffering. In case no quality level with this criteria can + * be found (lets say for example that buffer length is 1s, but fetching a fragment at lowest quality is predicted to take around 2s ... + * ie we can forecast around 1s of rebuffering ...) then ABR algorithm will try to find a level that should guarantee less than + * maxStarvationDelay of buffering. */ - nextLevel: number; + maxStarvationDelay: number; /** - * get: return last loaded fragment quality level - * set: quality level for next loaded fragment - * set to -1 for automatic level selection + * (default 0.2s) + * This tolerance factor is used during fragment lookup. + * Instead of checking whether buffered.end is located within [start, end] range, frag lookup will be done by checking within [start-maxFragLookUpTolerance, end-maxFragLookUpTolerance] range. + * This tolerance factor is used to cope with situations like: + * buffered.end = 9.991 + * frag[0] : [0,10] + * frag[1] : [10,20] + * buffered.end is within frag[0] range, but as we are close to frag[1], frag[1] should be choosen instead + * If maxFragLookUpTolerance = 0.2, this lookup will be adjusted to + * frag[0] : [-0.2,9.8] + * frag[1] : [9.8,19.8] + * This time, buffered.end is within frag[1] range, and frag[1] will be the next fragment to be loaded, as expected */ - loadLevel: number; + maxLoadingDelay: number; /** - * get: return quality level that will be used to load next fragment - * set: force quality level for next loaded fragment - * quality level will be forced only for that fragment - * after a fragment at this quality level has been loaded, hls.loadLevel will prevail + * (default: 0.5s) + * media element is expected to play and if currentTime has not moved for more than lowBufferWatchdogPeriod and if there are less than maxBufferHole seconds buffered upfront, + * hls.js will try to nudge playhead to recover playback */ - nextLoadLevel: number; + lowBufferWatchdogPeriod: number; /** - * first level index (index of first level appearing in Manifest. it is usually defined as start level hint for player) + * (default: 3s) + * if media element is expected to play and if currentTime has not moved for more than highBufferWatchdogPeriod and if there are more than maxBufferHole seconds buffered upfront, + * hls.js will try to nudge playhead to recover playback */ - firstLevel: number; + highBufferWatchdogPeriod: number; /** - * array of audio tracks exposed in manifest + * (default: 0.1s) + * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. + * media.currentTime += (nb nudge retry -1)*nudgeOffset */ - audioTracks: AudioTrack[]; + nudgeOffset: number; /** - * get: returns audio track id - * set: sets audio track id (returned by) + * (default: 3s) + * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. + * media.currentTime += (nb nudge retry -1)*nudgeOffset */ - audioTrack: number; + nudgeMaxRetry: number; /** - * position of live sync point (ie edge of live position minus safety delay defined by hls.config.liveSyncDuration) - */ - liveSyncPosition: number; - /** - * calling this method will: - * bind videoElement and hls instances - * create MediaSource and set it as video source - * once MediaSource object is successfully created, MEDIA_ATTACHED event will be fired - */ - attachMedia(videoElement: HTMLVideoElement): void; - /** - * calling this method will: - * unbind VideoElement from hls instance - * signal the end of the stream on MediaSource - * reset video source ( video.src = '' ) - */ - detachMedia(): void; - /** - * tell whether auto level selection is enabled or not - */ - autoLevelEnabled(enabled: boolean): boolean; - /** - * loads provided url as media source - */ - loadSource(source: string): void; - /** - * by default, hls.js will automatically start loading quality level playlists, and fragments after Hls.Events.MANIFEST_PARSED event has been triggered (and video element has been attached) - * however if config.autoStartLoad is set to false, hls.startLoad() needs to be called to manually start playlist and fragments loading + * (default 4s) * - * start/restart playlist/fragment loading. this is only effective if MANIFEST_PARSED event has been triggered and video element has been attached to hls object - * startPosition is the initial position in the playlist - * ff startPosition is not set to -1, it allows to override default startPosition to the one you want - * (it will bypass hls.config.liveSync* config params for Live for example, so that user can start playback from whatever position) + * max video loading delay used in automatic start level selection : in that mode ABR controller will ensure that video loading time (ie + * the time to fetch the first fragment at lowest quality level + the time to fetch the fragment at the appropriate quality level is less + * than maxLoadingDelay ) */ - startLoad(startPosition?: number): void; + maxFragLookUpTolerance: number; /** - * stop playlist/fragment loading. could be resumed later on by calling hls.startLoad() + * (default: 3) + * edge of live delay, expressed in multiple of EXT-X-TARGETDURATION. if set to 3, playback will start from fragment N-3, N being the last fragment of the live playlist. + * Decreasing this value is likely to cause playback stalls. */ - stopLoad(): void; + liveSyncDurationCount: number; /** - * should be invoked to recover media error. + * (default: Infinity) + * maximum delay allowed from edge of live, expressed in multiple of EXT-X-TARGETDURATION. + * If set to 10, the player will seek back to liveSyncDurationCount whenever the next fragment to be loaded is older than N-10, N being the last fragment of the live playlist. + * If set, this value must be stricly superior to liveSyncDurationCount a value too close from liveSyncDurationCount is likely to cause playback stalls. */ - recoverMediaError(): void; + liveMaxLatencyDurationCount: number; /** - * if media error are still raised after calling hls.recoverMediaError(), calling this method, could be useful to workaround audio codec mismatch. - * the workflow should be: - * on First Media Error : call hls.recoverMediaError() - * if another Media Error is raised 'quickly' after this first Media Error : first call hls.swapAudioCodec(), then call hls.recoverMediaError() + * (default: undefined) + * Alternative parameter to liveSyncDurationCount, expressed in seconds vs number of segments. + * If defined in the configuration object, liveSyncDuration will take precedence over the default liveSyncDurationCount. + * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. + * A value too low (inferior to ~3 segment durations) is likely to cause playback stalls. */ - swapAudioCodec(): void; + liveSyncDuration: number; /** - * should be called to free used resources and destroy hls context + * (default: undefined) + * Alternative parameter to liveMaxLatencyDurationCount, expressed in seconds vs number of segments. + * If defined in the configuration object, liveMaxLatencyDuration will take precedence over the default liveMaxLatencyDurationCount. + * If set, this value must be stricly superior to liveSyncDuration which must be defined as well. + * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. + * A value too close from liveSyncDuration is likely to cause playback stalls. */ - destroy(): void; + liveMaxLatencyDuration: number; /** - * hls.js event listener + * (default: false) + * Override current Media Source duration to Infinity for a live broadcast. Useful, if you are building a player which relies + * on native UI capabilities in modern browsers. If you want to have a native Live UI in environments like iOS Safari, Safari, + * Android Google Chrome, etc. set this value to true. */ - on(event: string, callback: (event: string, data: Hls.Data) => void): void; + liveDurationInfinity: boolean; /** - * remove hls.js event listener + * (default: true) + * Enable WebWorker (if available on browser) for TS demuxing/MP4 remuxing, to improve performance and avoid lag/frame drops. */ - off(event: string, callback: (event: string, data: Hls.Data) => void): void; + enableWorker: boolean; + /** + * (default: true) + * Enable to use JavaScript version AES decryption for fallback of WebCrypto API. + */ + enableSoftwareAES: boolean; + /** + * (default: undefined) + * When set, use this level as the default hls.startLevel. Keep in mind that the startLevel set with the API takes precedence over + * config.startLevel configuration parameter. + */ + startLevel: number; + /** + * (default: 10000ms for level and manifest) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + manifestLoadingTimeOut: number; + /** + * (default: 3) + * Max number of load retries. + */ + manifestLoadingMaxRetry: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + manifestLoadingRetryDelay: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + manifestLoadingMaxRetryTimeout: number; + /** + * (default: 60000ms for fragment) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + levelLoadingTimeOut: number; + /** + * (default: 3) + * Max number of load retries. + */ + levelLoadingMaxRetry: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + levelLoadingRetryDelay: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + levelLoadingMaxRetryTimeout: number; + /** + * (default: 60000ms for fragment) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + fragLoadingTimeOut: number; + /** + * (default: 3) + * Max number of load retries. + */ + fragLoadingMaxRetry: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + fragLoadingRetryDelay: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + fragLoadingMaxRetryDelay: number; + /** + * (default: false) + * Start prefetching start fragment although media not attached yet. Max number of append retries. + */ + startFragPrefech: boolean; + /** + * (default: 3) + * Max number of sourceBuffer.appendBuffer() retry upon error. Such error could happen in loop with UHD streams, when internal buffer is full. (Quota Exceeding Error will be triggered). + * In that case we need to wait for the browser to evict some data before being able to append buffer correctly. + */ + appendErrorMaxRetry: number; + /** + * (default: standard XMLHttpRequest-based URL loader) + * Override standard URL loader by a custom one. Could be useful for P2P or stubbing (testing). + * Use this, if you want to overwrite both the fragment and the playlist loader. + * Note: If fLoader or pLoader are used, they overwrite loader! + */ + loader: typeof Loader; + /** + * (default: undefined) + * This enables the manipulation of the fragment loader. + * Note: This will overwrite the default loader, as well as your own loader function. + */ + fLoader?: typeof Loader; + /** + * (default: undefined) + * This enables the manipulation of the playlist loader. + * Note: This will overwrite the default loader, as well as your own loader function. + */ + pLoader?: typeof Loader; + /** + * (default: undefined) + * XMLHttpRequest customization callback for default XHR based loader. + * Parameter should be a function with two arguments (xhr: XMLHttpRequest, url: string). + * If xhrSetup is specified, default loader will invoke it before calling xhr.send(). This allows user to easily modify/setup XHR. + */ + xhrSetup?(xhr: XMLHttpRequest, url: string): void; + /** + * (default: undefined) + * Fetch customization callback for Fetch based loader. + * Parameter should be a function with two arguments (context and Request Init Params). + * If fetchSetup is specified and Fetch loader is used, fetchSetup will be triggered to instantiate Request Object. This allows user to easily tweak Fetch loader. + */ + fetchSetup?(context: any, initParams: any): Request; + /** + * (default: internal ABR controller) + * Customized Adaptive Bitrate Streaming Controller. + * Parameter should be a class providing 2 getters, 2 setters and a destroy() method: + * get/set nextAutoLevel: return next auto-quality level/force next auto-quality level that should be returned (currently used for emergency switch down) + * get/set autoLevelCapping: capping/max level value that could be used by ABR Controller + * destroy(): should clean-up all used resources + */ + abrController: AbrController; + /** + * (default: internal track timeline controller) + * Customized text track syncronization controller. + * Parameter should be a class with a destroy() method: + * destroy() : should clean-up all used resources + */ + timelineController: TimelineController; + /** + * (default: true) + * Whether or not to enable WebVTT captions on HLS + */ + enableWebVTT?: boolean; + /** + * (default: true) + * whether or not to enable CEA-708 captions + */ + enableCEA708Captions: boolean; + /** + * (default: English) + * Label for the text track generated for CEA-708 captions track 1. This is how it will appear in the browser's native menu for subtitles and captions. + */ + captionsTextTrack1Label: string; + /** + * (default: en) + * RFC 3066 language code for the text track generated for CEA-708 captions track 1. + */ + captionsTextTrack1LanguagedCode: string; + /** + * (default: Spanish) + * Label for the text track generated for CEA-708 captions track 2. This is how it will appear in the browser's native menu for subtitles and captions. + */ + captionsTextTrack2Label: string; + /** + * (default: es) + * RFC 3066 language code for the text track generated for CEA-708 captions track 2. + */ + captionsTextTrack2LanguageCode: string; + /** + * (default: false) + * If a segment's video track is shorter than its audio track by > min(maxSeekHole, maxBufferHole), extend the final video frame's duration to match the audio track's duration. + * This helps playback continue in certain cases that might otherwise get stuck. + */ + stretchShortVideoTrack: boolean; + /** + * (default: 1) + * Browsers are really strict about audio frames timings. They usually play audio frames one after the other, regardless of + * the timestamps advertised in the fmp4. If audio timestamps are not consistent (consecutive audio frames too close or too far + * from each other), audio will easily drift. hls.js is restamping audio frames so that the distance between consecutive audio + * frame remains constant. If the distance is larger than the max allowed drift, hls.js will either + * * drop the next audio frame if distance is too small (if next audio frame timestamp is smaller than expected + * timestamp - max allowed drifter) + * * insert silent frames if distance is too big (next audio frame timestamp is bigger than expected + * timestamp + max allowed drift) + * Parameter should be an integer representing the max number of audio frames allowed to drifter. Keep in mind that one + * audio frame is 1024 audio samples (if using AAC), at 44.1 kHz, it gives 1024/44100 = 23ms. + */ + maxAudioFramesDrift: number; + /** + * (default: true) + * Whether or not to force having a key frame in the first AVC sample after a discontinuity. + * If set to true, after a discontinuity, the AVC samples without any key frame will be dropped until finding one that contains a key frame. + * If set to false, all AVC samples will be kept, which can help avoid holes in the stream. + * Setting this parameter to false can also generate decoding weirdness when switching level or seeking. + */ + forceKeyFrameOnDiscontinuity: boolean; + /** + * (default: 5.0) + * Fast bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. + * Half of the estimate is based on the last abrEwmaFastLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than 0 + */ + abrEwmaFastLive: number; + /** + * (default: 9.0) + * Slow bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. + * Half of the estimate is based on the last abrEwmaSlowLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than abrEwmaFastLive + */ + abrEwmaSlowLive: number; + /** + * (default: 4.0) + * Fast bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. + * Half of the estimate is based on the last abrEwmaFastVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than 0 + */ + abrEwmaFastVod: number; + /** + * (default: 15.0) + * Slow bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. + * Half of the estimate is based on the last abrEwmaSlowVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than abrEwmaFastVoD + */ + abrEwmaSlowVod: number; + /** + * (default: 500000) + * Default bandwidth estimate in bits/second prior to collecting fragment bandwidth samples. + * parameter should be a float + */ + abrEwmaDefaultEstimate: number; + /** + * (default: 0.8) + * Scale factor to be applied against measured bandwidth average, to determine whether we can stay on current or lower quality level. + * If abrBandWidthFactor * bandwidth average < level.bitrate then ABR can switch to that level providing that it is equal or less than current level. + */ + abrBandWidthFactor: number; + /** + * (default: 0.7) + * Scale factor to be applied against measured bandwidth average, to determine whether we can switch up to a higher quality level. + * If abrBandWidthUpFactor * bandwidth average < level.bitrate then ABR can switch up to that quality level. + */ + abrBandWidthUpFactor: number; + /** + * (default: false) + * max bitrate used in ABR by avg measured bitrate i.e. if bitrate signaled in variant manifest for a given level is 2Mb/s but average bitrate measured on this level is 2.5Mb/s, + * then if config value is set to true, ABR will use 2.5 Mb/s for this quality level. + */ + abrMaxWithRealBitrate: boolean; + /** + * (default: 0) + * Return the capping/min bandwidth value that could be used by automatic level selection algorithm. + * Useful when browser or tab of the browser is not in the focus and bandwidth drops + */ + minAutoBitrate: number; + } + + interface OptionalConfig { + /** + * (default: false) + * if set to true, the adaptive algorithm with limit levels usable in auto-quality by the HTML video element dimensions (width and height) + * if set to false, levels will not be limited. All available levels could be used in auto-quality mode taking only bandwidth into consideration. + */ + capLevelToPlayerSize?: boolean; + /** + * (default: false) + * setting config.debug = true; will turn on debug logs on JS console. + * a logger object could also be provided for custom logging: config.debug = customLogger; + */ + debug?: boolean; + /** + * (default: true) + * if set to true, start level playlist and first fragments will be loaded automatically, after triggering of Hls.Events.MANIFEST_PARSED event + * if set to false, an explicit API call (hls.startLoad(startPosition=-1)) will be needed to start quality level/fragment loading. + */ + autoStartLoad?: boolean; + /** + * (default -1) + * if set to -1, playback will start from initialTime=0 for VoD and according to liveSyncDuration/liveSyncDurationCount config params for Live + * otherwise, playback will start from predefined value. (unless stated otherwise in autoStartLoad=false mode : in that case startPosition can be overrided using hls.startLoad(startPosition)). + */ + startPosition?: number; + /** + * (default: undefined) + * if audio codec is not signaled in variant manifest, or if only a stream manifest is provided, hls.js tries to guess audio codec by parsing audio sampling rate in ADTS header. + * If sampling rate is less or equal than 22050 Hz, then hls.js assumes it is HE-AAC, otherwise it assumes it is AAC-LC. + * This could result in bad guess, leading to audio decode error, ending up in media error. + * It is possible to hint default audiocodec to hls.js by configuring this value as below: + * mp4a.40.2 (AAC-LC) or + * mp4a.40.5 (HE-AAC) or + * undefined (guess based on sampling rate) + */ + defaultAudioCodec?: string; + /** + * (default: 1) + * number of segments needed to start a playback of Live stream. + */ + initialLiveManifestSize?: number; + /** + * (default: 30 seconds) + * Maximum buffer length in seconds. If buffer length is/become less than this value, a new fragment will be loaded. + * This is the guaranteed buffer length hls.js will try to reach, regardless of maxBufferSize. + */ + maxBufferLength?: number; + /** + * (default 600s) + * Maximum buffer length in seconds. Hls.js will never exceed this value, even if maxBufferSize is not reached yet. + * hls.js tries to buffer up to a maximum number of bytes (60 MB by default) rather than to buffer up to a maximum nb of seconds. + * This is to mimic the browser behaviour (the buffer eviction algorithm is starting after the browser detects that video buffer size reaches a limit in bytes) + * maxBufferLength is the minimum guaranteed buffer length that hls.js will try to achieve, even if that value exceeds the amount of bytes 60 MB of memory. + * maxMaxBufferLength acts as a capping value, as if bitrate is really low, you could need more than one hour of buffer to fill 60 MB. + */ + maxMaxBufferLength?: number; + /** + * (default: 60 MB) + * 'Minimum' maximum buffer size in bytes. If buffer size upfront is bigger than this value, no fragment will be loaded + */ + maxBufferSize?: number; + /** + * (default: 0.5 seconds) + * 'Maximum' inter-fragment buffer hole tolerance that hls.js can cope with when searching for the next fragment to load. When switching between quality level, + * fragments might not be perfectly aligned. + * This could result in small overlapping or hole in media buffer. This tolerance factor helps cope with this. + */ + maxBufferHole?: number; + /** + * (default: 2s) + * In case playback is stalled, and a buffered range is available upfront, less than maxSeekHole seconds from current media position, + * hls.js will jump over this buffer hole to reach the beginning of this following buffered range. + * maxSeekHole allows to configure this jumpable threshold. + */ + maxSeekHole?: number; + /** + * (default: 4s) + * + * ABR algorithm will always try to choose a quality level that should avoid rebuffering. In case no quality level with this criteria can + * be found (lets say for example that buffer length is 1s, but fetching a fragment at lowest quality is predicted to take around 2s ... + * ie we can forecast around 1s of rebuffering ...) then ABR algorithm will try to find a level that should guarantee less than + * maxStarvationDelay of buffering. + */ + maxStarvationDelay?: number; + /** + * (default 0.2s) + * This tolerance factor is used during fragment lookup. + * Instead of checking whether buffered.end is located within [start, end] range, frag lookup will be done by checking within [start-maxFragLookUpTolerance, end-maxFragLookUpTolerance] range. + * This tolerance factor is used to cope with situations like: + * buffered.end = 9.991 + * frag[0] : [0,10] + * frag[1] : [10,20] + * buffered.end is within frag[0] range, but as we are close to frag[1], frag[1] should be choosen instead + * If maxFragLookUpTolerance = 0.2, this lookup will be adjusted to + * frag[0] : [-0.2,9.8] + * frag[1] : [9.8,19.8] + * This time, buffered.end is within frag[1] range, and frag[1] will be the next fragment to be loaded, as expected + */ + maxLoadingDelay?: number; + /** + * (default: 0.5s) + * media element is expected to play and if currentTime has not moved for more than lowBufferWatchdogPeriod and if there are less than maxBufferHole seconds buffered upfront, + * hls.js will try to nudge playhead to recover playback + */ + lowBufferWatchdogPeriod?: number; + /** + * (default: 3s) + * if media element is expected to play and if currentTime has not moved for more than highBufferWatchdogPeriod and if there are more than maxBufferHole seconds buffered upfront, + * hls.js will try to nudge playhead to recover playback + */ + highBufferWatchdogPeriod?: number; + /** + * (default: 0.1s) + * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. + * media.currentTime += (nb nudge retry -1)*nudgeOffset + */ + nudgeOffset?: number; + /** + * (default: 3s) + * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. + * media.currentTime += (nb nudge retry -1)*nudgeOffset + */ + nudgeMaxRetry?: number; + /** + * (default 4s) + * + * max video loading delay used in automatic start level selection : in that mode ABR controller will ensure that video loading time (ie + * the time to fetch the first fragment at lowest quality level + the time to fetch the fragment at the appropriate quality level is less + * than maxLoadingDelay ) + */ + maxFragLookUpTolerance?: number; + /** + * (default: 3) + * edge of live delay, expressed in multiple of EXT-X-TARGETDURATION. if set to 3, playback will start from fragment N-3, N being the last fragment of the live playlist. + * Decreasing this value is likely to cause playback stalls. + */ + liveSyncDurationCount?: number; + /** + * (default: Infinity) + * maximum delay allowed from edge of live, expressed in multiple of EXT-X-TARGETDURATION. + * If set to 10, the player will seek back to liveSyncDurationCount whenever the next fragment to be loaded is older than N-10, N being the last fragment of the live playlist. + * If set, this value must be stricly superior to liveSyncDurationCount a value too close from liveSyncDurationCount is likely to cause playback stalls. + */ + liveMaxLatencyDurationCount?: number; + /** + * (default: undefined) + * Alternative parameter to liveSyncDurationCount, expressed in seconds vs number of segments. + * If defined in the configuration object, liveSyncDuration will take precedence over the default liveSyncDurationCount. + * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. + * A value too low (inferior to ~3 segment durations) is likely to cause playback stalls. + */ + liveSyncDuration?: number; + /** + * (default: undefined) + * Alternative parameter to liveMaxLatencyDurationCount, expressed in seconds vs number of segments. + * If defined in the configuration object, liveMaxLatencyDuration will take precedence over the default liveMaxLatencyDurationCount. + * If set, this value must be stricly superior to liveSyncDuration which must be defined as well. + * You can't define this parameter and either liveSyncDurationCount or liveMaxLatencyDurationCount in your configuration object at the same time. + * A value too close from liveSyncDuration is likely to cause playback stalls. + */ + liveMaxLatencyDuration?: number; + /** + * (default: false) + * Override current Media Source duration to Infinity for a live broadcast. Useful, if you are building a player which relies + * on native UI capabilities in modern browsers. If you want to have a native Live UI in environments like iOS Safari, Safari, + * Android Google Chrome, etc. set this value to true. + */ + liveDurationInfinity?: boolean; + /** + * (default: true) + * Enable WebWorker (if available on browser) for TS demuxing/MP4 remuxing, to improve performance and avoid lag/frame drops. + */ + enableWorker?: boolean; + /** + * (default: true) + * Enable to use JavaScript version AES decryption for fallback of WebCrypto API. + */ + enableSoftwareAES?: boolean; + /** + * (default: undefined) + * When set, use this level as the default hls.startLevel. Keep in mind that the startLevel set with the API takes precedence over + * config.startLevel configuration parameter. + */ + startLevel?: number; + /** + * (default: 10000ms for level and manifest) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + manifestLoadingTimeOut?: number; + /** + * (default: 3) + * Max number of load retries. + */ + manifestLoadingMaxRetry?: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + manifestLoadingRetryDelay?: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + manifestLoadingMaxRetryTimeout?: number; + /** + * (default: 60000ms for fragment) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + levelLoadingTimeOut?: number; + /** + * (default: 3) + * Max number of load retries. + */ + levelLoadingMaxRetry?: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + levelLoadingRetryDelay?: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + levelLoadingMaxRetryTimeout?: number; + /** + * (default: 60000ms for fragment) + * URL Loader timeout. A timeout callback will be triggered if loading duration exceeds this timeout. no further action will be done : the load operation will not be cancelled/aborted. + * It is up to the application to catch this event and treat it as needed. + */ + fragLoadingTimeOut?: number; + /** + * (default: 3) + * Max number of load retries. + */ + fragLoadingMaxRetry?: number; + /** + * (default: 1000 ms) + * Initial delay between XMLHttpRequest error and first load retry (in ms). + * Any I/O error will trigger retries every 500ms,1s,2s,4s,8s, ... + * capped to fragLoadingMaxRetryTimeout / manifestLoadingMaxRetryTimeout / levelLoadingMaxRetryTimeout value (exponential backoff). + * Prefetch start fragment although media not attached. + */ + fragLoadingRetryDelay?: number; + /** + * (default: 64000 ms) + * Maximum frag/manifest/key retry timeout (in milliseconds) in case I/O errors are met. + */ + fragLoadingMaxRetryDelay?: number; + /** + * (default: false) + * Start prefetching start fragment although media not attached yet. Max number of append retries. + */ + startFragPrefetch?: boolean; + /** + * (default: 3) + * Max number of sourceBuffer.appendBuffer() retry upon error. Such error could happen in loop with UHD streams, when internal buffer is full. (Quota Exceeding Error will be triggered). + * In that case we need to wait for the browser to evict some data before being able to append buffer correctly. + */ + appendErrorMaxRetry?: number; + /** + * (default: standard XMLHttpRequest-based URL loader) + * Override standard URL loader by a custom one. Could be useful for P2P or stubbing (testing). + * Use this, if you want to overwrite both the fragment and the playlist loader. + * Note: If fLoader or pLoader are used, they overwrite loader! + */ + loader?: typeof Loader; + /** + * (default: undefined) + * This enables the manipulation of the fragment loader. + * Note: This will overwrite the default loader, as well as your own loader function. + */ + fLoader?: typeof Loader; + /** + * (default: undefined) + * This enables the manipulation of the playlist loader. + * Note: This will overwrite the default loader, as well as your own loader function. + */ + pLoader?: typeof Loader; + /** + * (default: undefined) + * XMLHttpRequest customization callback for default XHR based loader. + * Parameter should be a function with two arguments (xhr: XMLHttpRequest, url: string). + * If xhrSetup is specified, default loader will invoke it before calling xhr.send(). This allows user to easily modify/setup XHR. + */ + xhrSetup?(xhr: XMLHttpRequest, url: string): void; + /** + * (default: undefined) + * Fetch customization callback for Fetch based loader. + * Parameter should be a function with two arguments (context and Request Init Params). + * If fetchSetup is specified and Fetch loader is used, fetchSetup will be triggered to instantiate Request Object. This allows user to easily tweak Fetch loader. + */ + fetchSetup?(context: any, initParams: any): Request; + /** + * (default: internal ABR controller) + * Customized Adaptive Bitrate Streaming Controller. + * Parameter should be a class providing 2 getters, 2 setters and a destroy() method: + * get/set nextAutoLevel: return next auto-quality level/force next auto-quality level that should be returned (currently used for emergency switch down) + * get/set autoLevelCapping: capping/max level value that could be used by ABR Controller + * destroy(): should clean-up all used resources + */ + abrController?: AbrController; + /** + * (default: internal track timeline controller) + * Customized text track syncronization controller. + * Parameter should be a class with a destroy() method: + * destroy() : should clean-up all used resources + */ + timelineController?: TimelineController; + /** + * (default: true) + * Whether or not to enable WebVTT captions on HLS + */ + enableWebVTT?: boolean; + /** + * (default: true) + * whether or not to enable CEA-708 captions + */ + enableCEA708Captions?: boolean; + /** + * (default: English) + * Label for the text track generated for CEA-708 captions track 1. This is how it will appear in the browser's native menu for subtitles and captions. + */ + captionsTextTrack1Label?: string; + /** + * (default: en) + * RFC 3066 language code for the text track generated for CEA-708 captions track 1. + */ + captionsTextTrack1LanguagedCode?: string; + /** + * (default: Spanish) + * Label for the text track generated for CEA-708 captions track 2. This is how it will appear in the browser's native menu for subtitles and captions. + */ + captionsTextTrack2Label?: string; + /** + * (default: es) + * RFC 3066 language code for the text track generated for CEA-708 captions track 2. + */ + captionsTextTrack2LanguageCode?: string; + /** + * (default: false) + * If a segment's video track is shorter than its audio track by > min(maxSeekHole, maxBufferHole), extend the final video frame's duration to match the audio track's duration. + * This helps playback continue in certain cases that might otherwise get stuck. + */ + stretchShortVideoTrack?: boolean; + /** + * (default: 1) + * Browsers are really strict about audio frames timings. They usually play audio frames one after the other, regardless of + * the timestamps advertised in the fmp4. If audio timestamps are not consistent (consecutive audio frames too close or too far + * from each other), audio will easily drift. hls.js is restamping audio frames so that the distance between consecutive audio + * frame remains constant. If the distance is larger than the max allowed drift, hls.js will either + * * drop the next audio frame if distance is too small (if next audio frame timestamp is smaller than expected + * timestamp - max allowed drifter) + * * insert silent frames if distance is too big (next audio frame timestamp is bigger than expected + * timestamp + max allowed drift) + * Parameter should be an integer representing the max number of audio frames allowed to drifter. Keep in mind that one + * audio frame is 1024 audio samples (if using AAC), at 44.1 kHz, it gives 1024/44100 = 23ms. + */ + maxAudioFramesDrift?: number; + /** + * (default: true) + * Whether or not to force having a key frame in the first AVC sample after a discontinuity. + * If set to true, after a discontinuity, the AVC samples without any key frame will be dropped until finding one that contains a key frame. + * If set to false, all AVC samples will be kept, which can help avoid holes in the stream. + * Setting this parameter to false can also generate decoding weirdness when switching level or seeking. + */ + forceKeyFrameOnDiscontinuity?: boolean; + /** + * (default: 5.0) + * Fast bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. + * Half of the estimate is based on the last abrEwmaFastLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than 0 + */ + abrEwmaFastLive?: number; + /** + * (default: 9.0) + * Slow bitrate Exponential moving average half-life, used to compute average bitrate for Live streams. + * Half of the estimate is based on the last abrEwmaSlowLive seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than abrEwmaFastLive + */ + abrEwmaSlowLive?: number; + /** + * (default: 4.0) + * Fast bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. + * Half of the estimate is based on the last abrEwmaFastVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than 0 + */ + abrEwmaFastVod?: number; + /** + * (default: 15.0) + * Slow bitrate Exponential moving average half-life, used to compute average bitrate for VoD streams. + * Half of the estimate is based on the last abrEwmaSlowVoD seconds of sample history. Each of the sample is weighted by the fragment loading duration. + * parameter should be a float greater than abrEwmaFastVoD + */ + abrEwmaSlowVod?: number; + /** + * (default: 500000) + * Default bandwidth estimate in bits/second prior to collecting fragment bandwidth samples. + * parameter should be a float + */ + abrEwmaDefaultEstimate?: number; + /** + * (default: 0.8) + * Scale factor to be applied against measured bandwidth average, to determine whether we can stay on current or lower quality level. + * If abrBandWidthFactor * bandwidth average < level.bitrate then ABR can switch to that level providing that it is equal or less than current level. + */ + abrBandWidthFactor?: number; + /** + * (default: 0.7) + * Scale factor to be applied against measured bandwidth average, to determine whether we can switch up to a higher quality level. + * If abrBandWidthUpFactor * bandwidth average < level.bitrate then ABR can switch up to that quality level. + */ + abrBandWidthUpFactor?: number; + /** + * (default: false) + * max bitrate used in ABR by avg measured bitrate i.e. if bitrate signaled in variant manifest for a given level is 2Mb/s but average bitrate measured on this level is 2.5Mb/s, + * then if config value is set to true, ABR will use 2.5 Mb/s for this quality level. + */ + abrMaxWithRealBitrate?: boolean; + /** + * (default: 0) + * Return the capping/min bandwidth value that could be used by automatic level selection algorithm. + * Useful when browser or tab of the browser is not in the focus and bandwidth drops + */ + minAutoBitrate?: number; + } + + /** + * a Level object represents a given quality level and contains quality level related info + */ + interface Level { + /** + * level url. might contain sever items if failover/redundant streams are found in the manifest + */ + url: string[]; + /** + * level bitrate + */ + bitrate: number; + /** + * level name + */ + name: string; + /** + * used codecs + */ + codecs: string; + /** + * video width + */ + width: number; + /** + * video height + */ + height: number; + /** + * level details + */ + details: LevelDetails; + } + + /** + * a LevelDetails object contains level details retrieved after level playlist parsing + */ + interface LevelDetails { + /** + * protocol version + */ + version: number; + /** + * playlist type + */ + type: string; + /** + * start sequence number + */ + startSN: number; + /** + * end sequence number + */ + endSN: number; + /** + * level total duration + */ + totalduration: number; + /** + * level fragment target duration + */ + targetduration: number; + /** + * average fragment duration + */ + averagetargetduration: number; + /** + * array of fragments info + */ + fragments: Fragment[]; + /** + * is this level a live playlist or not? + */ + live: boolean; + } + + /** + * the Fragment object contains fragment related info + */ + interface Fragment { + /** + * fragment duration + */ + duration: number; + /** + * fragment level identifier + */ + level: number; + /** + * fragment sequence number + */ + sn: number; + /** + * fragment start offset + */ + start: number; + /** + * fragment url + */ + url: string; + /** + * stream start date and time + */ + programDateTime: Date; + /** + * continuity count + */ + cc: number; + /** + * list of tags associated with the fragment + */ + tagList: string[][]; + /** + * fragment title + */ + title: string; + } + + interface Data { + /** + * videoElement + */ + video?: HTMLVideoElement; + /** + * media source + */ + mediaSource?: string; + /** + * manifest url + */ + url?: string; + /** + * available quality levels + */ + levels?: number[]; + /** + * available audio tracks + */ + audioTracks?: AudioTrack[]; + /** + * XMLHttp request stats + */ + stats?: HlsStats; + /** + * index of first quality level appearing in Manifest + */ + firstLevel?: number; + /** + * id of updated level + */ + level?: number; + /** + * id of loaded level + */ + levelId?: number; + /** + * ErrorDetails type or Level Details + */ + details?: string | LevelDetails; + /** + * PTS drift observed when parsing last fragment + */ + drift?: number; + /** + * fragment object with frag.loaded=stats.loaded + */ + frag?: Fragment; + /** + * fragment payload + */ + payload?: any; // TODO: what is the payload? + /** + * id of level or demuxer + */ + id?: number; + /** + * moof MP4 box + */ + moof?: any; // TODO: whats is the moof? + /** + * mdat MP4 box + */ + mdat?: any; // TODO: what is mdat? + /** + * PTS of first sample + */ + startPTS?: number; + /** + * PTS of last sample + */ + endPTS?: number; + /** + * DTS of first sample + */ + startDTS?: number; + /** + * DTS of last sample + */ + endDTS?: number; + /** + * stream type (audio or video) + */ + type?: string; + /** + * number of samples + */ + nb?: number; + /** + * number of dropped frames in last monitoring period + */ + currentDropped?: number; + /** + * number of decoded frames in last monitoring period + */ + currentDecode?: number; + /** + * total dropped frames on this video element + */ + totalDropped?: number; + /** + * level has to much dropped frame will be restricted + */ + droppedLevel?: number; + /** + * is error fatal or not. + * if error is not fatal, hls.js will try to recover it + * if error is fatal, an action is required to (try to) recover it + */ + fatal?: boolean; + } + + /** + * (default: internal ABR controller) + * Customized Adaptive Bitrate Streaming Controller. + */ + interface AbrController { + /** + * get: capping/max level value that could be used by ABR Controller + * set: capping/max level value that could be used by ABR Controller + */ + autoLevelCapping: number; + /** + * accumulated handled events + */ + handledEvents: string[]; + /** + * current hls instance + */ + hls: Hls; + /** + * last fragments corresponding level + */ + lastLoadedFragLevel: number; + /** + * get: next auto-quality levele/force next auto-quality level that should be returned + * set: next auto-quality levele/force next auto-quality level that should be returned + * - currently used for emergency switch down + */ + nextAutoLevel: number; + useGenericHandler: boolean; + } + + /** + * Customized text track syncronization controller. + */ + interface TimelineController { + /** + * clean-up all used resources + */ + destory(): void; + } + + interface LoaderResponse { + url: string; + data: string | ArrayBuffer; + } + + interface LoaderStats { + /** + * performance.now() just after load() has been called + */ + trequest: number; + /** + * performance.now() of first received byte + */ + tfirst: number; + /** + * performance.now() on load complete + */ + tload: number; + /** + * number of loaded bytes + */ + loaded: number; + /** + * download bandwitdh in bit/s + */ + bw: number; + /** + * total nb of bytes + */ + total: number; + } + + interface LoaderError { + /** + * error code + */ + code: number; + /** + * error description + */ + text: string; + } + + interface HlsStats { + /** + * performance.now() just after load() has been called + */ + trequest: number; + /** + * performance.now() of first received byte + */ + tfirst: number; + /** + * performance.now() on load complete + */ + tload: number; + mtime: number; + tbuffered?: number; + length?: number; + } + + interface LoaderContext { + /** + * target URL + */ + url: string; + /** + * loader response type (arraybuffer or default response type for playlist) + */ + responseType: string; + /** + * start byte range offset + */ + rangeStart?: number; + /** + * end byte range offset + */ + rangeEnd?: number; + /** + * true if onProgress should report partial chunk of loaded content + */ + progressData?: boolean; + /** + * fragment object + */ + frag: Fragment; + /** + * request type + * - level, manifest + */ + type: string; + /** + * level id + */ + level: number; + } + + interface LoaderConfig { + /** + * Max number of load retries + */ + maxRetry: number; + /** + * Timeout after which `onTimeOut` callback will be triggered (if loading is still not finished after that delay) + */ + timeout: number; + /** + * Delay between an I/O error and following connection retry (ms). This to avoid spamming the server + */ + retryDelay: number; + /** + * max connection retry delay (ms) + */ + maxRetryDelay: number; + } + + interface LoaderCallbacks { + onSuccess(response: LoaderResponse, stats: LoaderStats, context: LoaderContext): void; + onProgress(stats: LoaderStats, context: LoaderContext, data: string | ArrayBuffer): void; + onError(error: LoaderError, context: LoaderContext): void; + onTimeout(stats: LoaderStats, context: LoaderContext): void; + } +} + +declare class Hls { + /** + * Constructor. Can be provided an HlsConfig object as default properties and or overrides + */ + constructor(config?: Hls.OptionalConfig) + /** + * return array of available quality levels + */ + levels: Hls.Level[]; + /** + * get: return current playback quality level + * set: trigger an immediate quality level switch to new quality level + * this will pause the video if it was playing, flush the whole buffer, + * and fetch fragment matching with current position and requested quality level + * then resume the video if needed once fetched fragment will have been buffered + * + * set to -1 for automatic level selection + */ + currentLevel: number; + /** + * capping/max level (index of level) that could be used by ABR Controller. Defaults to -1 + * which means no limit + * set: max level value that could be used by the ABR Controller + */ + autoLevelCapping: number; + /** + * return start level index (level of first fragment that will be played back) + * if not overrided by user: first level appearing in manifest will be used as start level + * if -1: automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment) + * + * default valus is hls.firstLevel + */ + startLevel: number; + /** + * (default: true) + * if set to true, start level playlist and first fragments will be loaded automatically, after triggering of Hls.Events.MANIFEST_PARSED event + * if set to false, an explicit API call (hls.startLoad(startPosition=-1)) will be needed to start quality level/fragment loading. + */ + autoStartLoad: boolean; + /** + * get: Return the bound videoElement from the hls instance + */ + media: HTMLVideoElement; + /** + * hls.js config + */ + config: Hls.Config; + /** + * get: return next playback quality level (playback quality level for next buffered fragment) + * return -1 if next fragment not buffered yet + * set: trigger a quality level switch for next fragment + * this could eventually flush already buffered next fragment + * + * set to -1 for automatic level selection + */ + nextLevel: number; + /** + * get: return last loaded fragment quality level + * set: quality level for next loaded fragment + * set to -1 for automatic level selection + */ + loadLevel: number; + /** + * get: return quality level that will be used to load next fragment + * set: force quality level for next loaded fragment + * quality level will be forced only for that fragment + * after a fragment at this quality level has been loaded, hls.loadLevel will prevail + */ + nextLoadLevel: number; + /** + * first level index (index of first level appearing in Manifest. it is usually defined as start level hint for player) + */ + firstLevel: number; + /** + * array of audio tracks exposed in manifest + */ + audioTracks: AudioTrack[]; + /** + * get: returns audio track id + * set: sets audio track id (returned by) + */ + audioTrack: number; + /** + * position of live sync point (ie edge of live position minus safety delay defined by hls.config.liveSyncDuration) + */ + liveSyncPosition: number; + /** + * calling this method will: + * bind videoElement and hls instances + * create MediaSource and set it as video source + * once MediaSource object is successfully created, MEDIA_ATTACHED event will be fired + */ + attachMedia(videoElement: HTMLVideoElement): void; + /** + * calling this method will: + * unbind VideoElement from hls instance + * signal the end of the stream on MediaSource + * reset video source ( video.src = '' ) + */ + detachMedia(): void; + /** + * tell whether auto level selection is enabled or not + */ + autoLevelEnabled(enabled: boolean): boolean; + /** + * loads provided url as media source + */ + loadSource(source: string): void; + /** + * by default, hls.js will automatically start loading quality level playlists, and fragments after Hls.Events.MANIFEST_PARSED event has been triggered (and video element has been attached) + * however if config.autoStartLoad is set to false, hls.startLoad() needs to be called to manually start playlist and fragments loading + * + * start/restart playlist/fragment loading. this is only effective if MANIFEST_PARSED event has been triggered and video element has been attached to hls object + * startPosition is the initial position in the playlist + * ff startPosition is not set to -1, it allows to override default startPosition to the one you want + * (it will bypass hls.config.liveSync* config params for Live for example, so that user can start playback from whatever position) + */ + startLoad(startPosition?: number): void; + /** + * stop playlist/fragment loading. could be resumed later on by calling hls.startLoad() + */ + stopLoad(): void; + /** + * should be invoked to recover media error. + */ + recoverMediaError(): void; + /** + * if media error are still raised after calling hls.recoverMediaError(), calling this method, could be useful to workaround audio codec mismatch. + * the workflow should be: + * on First Media Error : call hls.recoverMediaError() + * if another Media Error is raised 'quickly' after this first Media Error : first call hls.swapAudioCodec(), then call hls.recoverMediaError() + */ + swapAudioCodec(): void; + /** + * should be called to free used resources and destroy hls context + */ + destroy(): void; + /** + * hls.js event listener + */ + on(event: string, callback: (event: string, data: Hls.Data) => void): void; + /** + * remove hls.js event listener + */ + off(event: string, callback: (event: string, data: Hls.Data) => void): void; } export as namespace Hls; From 30e92bb2c31d62c9c5dcc3b0dea0c7e4b7d3d95d Mon Sep 17 00:00:00 2001 From: PostCrafter Date: Fri, 22 Dec 2017 21:04:40 +0100 Subject: [PATCH 195/890] Add types for is-scoped --- types/is-scoped/index.d.ts | 8 ++++++++ types/is-scoped/is-scoped-tests.ts | 6 ++++++ types/is-scoped/tsconfig.json | 23 +++++++++++++++++++++++ types/is-scoped/tslint.json | 1 + 4 files changed, 38 insertions(+) create mode 100644 types/is-scoped/index.d.ts create mode 100644 types/is-scoped/is-scoped-tests.ts create mode 100644 types/is-scoped/tsconfig.json create mode 100644 types/is-scoped/tslint.json diff --git a/types/is-scoped/index.d.ts b/types/is-scoped/index.d.ts new file mode 100644 index 0000000000..8c35dcdf9c --- /dev/null +++ b/types/is-scoped/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for is-scoped 1.0 +// Project: https://github.com/sindresorhus/is-scoped#readme +// Definitions by: Leo Friedrichs +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = isScoped; + +declare function isScoped(input: string): boolean; diff --git a/types/is-scoped/is-scoped-tests.ts b/types/is-scoped/is-scoped-tests.ts new file mode 100644 index 0000000000..9fb34bc3d2 --- /dev/null +++ b/types/is-scoped/is-scoped-tests.ts @@ -0,0 +1,6 @@ +import isScoped = require('is-scoped'); + +const tests: boolean[] = [ + isScoped('is-scoped'), + isScoped('@types/is-scoped'), +]; diff --git a/types/is-scoped/tsconfig.json b/types/is-scoped/tsconfig.json new file mode 100644 index 0000000000..e6ffa2ab86 --- /dev/null +++ b/types/is-scoped/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "is-scoped-tests.ts" + ] +} diff --git a/types/is-scoped/tslint.json b/types/is-scoped/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/is-scoped/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 626f4832f9d084de43c4a6e7f3b4b421664ce5e2 Mon Sep 17 00:00:00 2001 From: Frank Tan Date: Fri, 22 Dec 2017 16:39:31 -0500 Subject: [PATCH 196/890] ember-qunit: Copy files into v3 with minor updates --- types/ember-qunit/v3/ember-qunit-tests.ts | 115 +++++++++++++++++++++ types/ember-qunit/v3/index.d.ts | 118 ++++++++++++++++++++++ types/ember-qunit/v3/tsconfig.json | 29 ++++++ types/ember-qunit/v3/tslint.json | 9 ++ 4 files changed, 271 insertions(+) create mode 100644 types/ember-qunit/v3/ember-qunit-tests.ts create mode 100644 types/ember-qunit/v3/index.d.ts create mode 100644 types/ember-qunit/v3/tsconfig.json create mode 100644 types/ember-qunit/v3/tslint.json diff --git a/types/ember-qunit/v3/ember-qunit-tests.ts b/types/ember-qunit/v3/ember-qunit-tests.ts new file mode 100644 index 0000000000..5f8b9f4fd9 --- /dev/null +++ b/types/ember-qunit/v3/ember-qunit-tests.ts @@ -0,0 +1,115 @@ +import Ember from 'ember'; +import hbs from 'htmlbars-inline-precompile'; +import { module } from 'qunit'; +import { + test, + skip, + moduleFor, + moduleForModel, + moduleForComponent, + setResolver, +} from 'ember-qunit'; + +moduleForComponent('x-foo', { + integration: true +}); + +moduleForComponent('x-foo', { + unit: true, + needs: ['helper:pluralize-string'] +}); + +moduleForModel('user', { + needs: ['model:child'] +}); + +moduleFor('controller:home'); + +moduleFor('component:x-foo', 'Some description'); + +moduleFor('component:x-foo', 'TestModule callbacks', { + beforeSetup() { + }, + + beforeEach(assert) { + this.registry.register('helper:i18n', {}); + this.register('service:i18n', {}); + this.inject.service('i18n'); + this.inject.service('i18n', { as: 'i18n' }); + this.factory('object:user').create(); + assert.ok(true); + }, + + afterEach(assert) { + assert.ok(true); + }, + + afterTeardown(assert) { + assert.ok(true); + } +}); + +// if you don't have a custom resolver, do it like this: +setResolver(Ember.DefaultResolver.create()); + +test('it renders', function(assert) { + assert.expect(2); + + // setup the outer context + this.set('value', 'cat'); + this.on('action', function(result) { + assert.equal(result, 'bar', 'The correct result was returned'); + assert.equal(this.get('value'), 'cat'); + }); + + // render the component + this.render(hbs` + {{ x-foo value=value action="result" }} + `); + this.render('{{ x-foo value=value action="result" }}'); + this.render([ + '{{ x-foo value=value action="result" }}' + ]); + + assert.equal(this.$('div>.value').text(), 'cat', 'The component shows the correct value'); + + this.$('button').click(); +}); + +test('it renders', function(assert) { + assert.expect(1); + + // creates the component instance + const subject = this.subject(); + + const subject2 = this.subject({ + item: 42 + }); + + const { inputFormat } = this.setProperties({ + inputFormat: 'M/D/YY', + outputFormat: 'MMMM D, YYYY', + date: '5/3/10' + }); + + const { inputFormat: if2, outputFormat } = this.getProperties('inputFormat', 'outputFormat'); + + const inputFormat2 = this.get('inputFormat'); + + // render the component on the page + this.render(); + assert.equal(this.$('.foo').text(), 'bar'); +}); + +test('It can calculate the result', function(assert) { + assert.expect(1); + + const subject = this.subject(); + + subject.set('value', 'foo'); + assert.equal(subject.get('result'), 'bar'); +}); + +skip('disabled test'); + +skip('disabled test', function(assert) { }); diff --git a/types/ember-qunit/v3/index.d.ts b/types/ember-qunit/v3/index.d.ts new file mode 100644 index 0000000000..1eb74bc430 --- /dev/null +++ b/types/ember-qunit/v3/index.d.ts @@ -0,0 +1,118 @@ +// Type definitions for ember-qunit 3.0 +// Project: https://github.com/emberjs/ember-qunit#readme +// Definitions by: Derek Wickern +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// + +declare module 'ember-qunit' { + import Ember from 'ember'; + import { ModuleCallbacks } from "ember-test-helpers"; + + interface QUnitModuleCallbacks extends ModuleCallbacks, Hooks { + beforeSetup?(assert: Assert): void; + setup?(assert: Assert): void; + teardown?(assert: Assert): void; + afterTeardown?(assert: Assert): void; + } + + /** + * @param fullName The full name of the unit, ie controller:application, route:index. + * @param description The description of the module + */ + export function moduleFor(fullName: string, description: string, callbacks?: QUnitModuleCallbacks): void; + export function moduleFor(fullName: string, callbacks?: QUnitModuleCallbacks): void; + + /** + * @param fullName the short name of the component that you'd use in a template, ie x-foo, ic-tabs, etc. + * @param description The description of the module + */ + export function moduleForComponent(fullName: string, description: string, callbacks?: QUnitModuleCallbacks): void; + export function moduleForComponent(fullName: string, callbacks?: QUnitModuleCallbacks): void; + + /** + * @param fullName the short name of the model you'd use in store operations ie user, assignmentGroup, etc. + * @param description The description of the module + */ + export function moduleForModel(fullName: string, description: string, callbacks?: QUnitModuleCallbacks): void; + export function moduleForModel(fullName: string, callbacks?: QUnitModuleCallbacks): void; + + /** + * Sets a Resolver globally which will be used to look up objects from each test's container. + */ + export function setResolver(resolver: Ember.Resolver): void; + + export class QUnitAdapter extends Ember.Test.Adapter {} + + export { module, test, skip, only, todo } from 'qunit'; +} + +declare module 'qunit' { + import { TestContext } from "ember-test-helpers"; + + export const module: typeof QUnit.module; + + /** + * Add a test to run. + * + * Add a test to run using `QUnit.test()`. + * + * The `assert` argument to the callback contains all of QUnit's assertion + * methods. Use this argument to call your test assertions. + * + * `QUnit.test()` can automatically handle the asynchronous resolution of a + * Promise on your behalf if you return a thenable Promise as the result of + * your callback function. + * + * @param name Title of unit being tested + * @param callback Function to close over assertions + */ + export function test(name: string, callback: (this: TestContext, assert: Assert) => void): void; + + /** + * Adds a test to exclusively run, preventing all other tests from running. + * + * Use this method to focus your test suite on a specific test. QUnit.only + * will cause any other tests in your suite to be ignored. + * + * Note, that if more than one QUnit.only is present only the first instance + * will run. + * + * This is an alternative to filtering tests to run in the HTML reporter. It + * is especially useful when you use a console reporter or in a codebase + * with a large set of long running tests. + * + * @param name Title of unit being tested + * @param callback Function to close over assertions + */ + export function only(name: string, callback: (this: TestContext, assert: Assert) => void): void; + + /** + * Use this method to test a unit of code which is still under development (in a “todo” state). + * The test will pass as long as one failing assertion is present. + * + * If all assertions pass, then the test will fail signaling that `QUnit.todo` should + * be replaced by `QUnit.test`. + * + * @param name Title of unit being tested + * @param callback Function to close over assertions + */ + export function todo(name: string, callback: (this: TestContext, assert: Assert) => void): void; + + /** + * Adds a test like object to be skipped. + * + * Use this method to replace QUnit.test() instead of commenting out entire + * tests. + * + * This test's prototype will be listed on the suite as a skipped test, + * ignoring the callback argument and the respective global and module's + * hooks. + * + * @param Title of unit being tested + */ + export const skip: typeof QUnit.skip; + + export default QUnit; +} diff --git a/types/ember-qunit/v3/tsconfig.json b/types/ember-qunit/v3/tsconfig.json new file mode 100644 index 0000000000..c1b85f31c8 --- /dev/null +++ b/types/ember-qunit/v3/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "ember-qunit": [ + "ember-qunit/v3" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ember-qunit-tests.ts" + ] +} diff --git a/types/ember-qunit/v3/tslint.json b/types/ember-qunit/v3/tslint.json new file mode 100644 index 0000000000..5070b08af9 --- /dev/null +++ b/types/ember-qunit/v3/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "only-arrow-functions": false, + "strict-export-declare-modifiers": false, + "no-duplicate-imports": false, + "no-declare-current-package": false + } +} From d76f2715f9194483d2919feff73ecdb1b457c1fa Mon Sep 17 00:00:00 2001 From: Frank Tan Date: Fri, 22 Dec 2017 18:21:38 -0500 Subject: [PATCH 197/890] ember-qunit: Add setupTest and setupRenderingTest --- types/ember-qunit/v3/ember-qunit-tests.ts | 24 +++++++++++++++ types/ember-qunit/v3/index.d.ts | 37 +++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/types/ember-qunit/v3/ember-qunit-tests.ts b/types/ember-qunit/v3/ember-qunit-tests.ts index 5f8b9f4fd9..42768a42ca 100644 --- a/types/ember-qunit/v3/ember-qunit-tests.ts +++ b/types/ember-qunit/v3/ember-qunit-tests.ts @@ -8,6 +8,8 @@ import { moduleForModel, moduleForComponent, setResolver, + setupRenderingTest, + setupTest, } from 'ember-qunit'; moduleForComponent('x-foo', { @@ -113,3 +115,25 @@ test('It can calculate the result', function(assert) { skip('disabled test'); skip('disabled test', function(assert) { }); + +// https://github.com/emberjs/rfcs/blob/master/text/0232-simplify-qunit-testing-api.md#qunit-nested-modules-api +QUnit.module('some description', function(hooks) { + hooks.before(() => {}); + hooks.beforeEach(() => {}); + hooks.afterEach(() => {}); + hooks.after(() => {}); + + QUnit.test('it blends', function(assert) { + assert.ok(true, 'of course!'); + }); +}); + +// http://rwjblue.com/2017/10/23/ember-qunit-simplication/#setuprenderingtest +module('x-foo', function(hooks) { + setupRenderingTest(hooks); +}); + +// http://rwjblue.com/2017/10/23/ember-qunit-simplication/#setuprenderingtest +module('foo service', function(hooks) { + setupTest(hooks); +}); diff --git a/types/ember-qunit/v3/index.d.ts b/types/ember-qunit/v3/index.d.ts index 1eb74bc430..a42b5107af 100644 --- a/types/ember-qunit/v3/index.d.ts +++ b/types/ember-qunit/v3/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for ember-qunit 3.0 // Project: https://github.com/emberjs/ember-qunit#readme // Definitions by: Derek Wickern +// Frank Tan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -43,6 +44,42 @@ declare module 'ember-qunit' { */ export function setResolver(resolver: Ember.Resolver): void; + /** + * Sets up tests that need to render snippets of templates. + * + * The setupRenderingTest method is used for tests that need to render + * snippets of templates. It is also invoked in the callback scope of a + * QUnit module (aka "nested module"). + * + * Once invoked, all subsequent hooks.beforeEach and test invocations will + * have access to the following: + * * All of the methods / properties listed for `setupTest` + * * this.render(...) - Renders the provided template snippet returning a + * promise that resolves once rendering has completed + * * An importable render function that de-sugars into this.render will be + * the default output of blueprints + * * this.element - Returns the native DOM element representing the element + * that was rendered via this.render + * * this.$(...) - When jQuery is present, executes a jQuery selector with + * the current this.element as its root + */ + export function setupRenderingTest(hooks: NestedHooks): void; + + /** + * Sets up tests that do not need to render snippets of templates. + * + * The `setupTest` method is used for all types of tests except for those + * that need to render snippets of templates. It is invoked in the callback + * scope of a QUnit module (aka "nested module"). + * + * Once invoked, all subsequent hooks.beforeEach and test invocations will + * have access to the following: + * * this.owner - This exposes the standard "owner API" for the test environment. + * * this.set / this.setProperties - Allows setting values on the test context. + * * this.get / this.getProperties - Retrieves values from the test context. + */ + export function setupTest(hooks: NestedHooks): void; + export class QUnitAdapter extends Ember.Test.Adapter {} export { module, test, skip, only, todo } from 'qunit'; From 01899e7f31bd06cdb1c9b4d423747a5728851547 Mon Sep 17 00:00:00 2001 From: Nikita Moshensky Date: Mon, 18 Dec 2017 11:56:29 +0200 Subject: [PATCH 198/890] [ramda] type one of eqProps definitions the same as prop and add groupWith definition --- types/ramda/index.d.ts | 4 +++- types/ramda/ramda-tests.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index a8c3c9ab47..cd7e750da7 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -12,6 +12,7 @@ // Samson Keung // Angelo Ocana // Miika Hänninen +// Nikita Moshensky // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -581,7 +582,7 @@ declare namespace R { * Reports whether two functions have the same value for the specified property. */ eqProps(prop: string, obj1: T, obj2: U): boolean; - eqProps(prop: string): (obj1: T, obj2: U) => boolean; + eqProps

    (prop: P): (obj1: Record, obj2: Record) => boolean; eqProps(prop: string, obj1: T): (obj2: U) => boolean; /** @@ -681,6 +682,7 @@ declare namespace R { /** * Takes a list and returns a list of lists where each sublist's elements are all "equal" according to the provided equality function */ + groupWith(fn: (x: T, y: T) => boolean): (list: ReadonlyArray) => T[][]; groupWith(fn: (x: T, y: T) => boolean, list: ReadonlyArray): T[][]; groupWith(fn: (x: T, y: T) => boolean, list: string): string[]; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 1315ced585..321242da00 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -658,6 +658,8 @@ interface Obj { }; () => { + R.groupWith(R.equals)([0, 1, 1, 2, 3, 5, 8, 13, 21]); + R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21]); // [[0], [1, 1], [2, 3, 5, 8, 13, 21]] @@ -1223,7 +1225,7 @@ type Pair = KeyValuePair; const o2 = {a: 10, b: 20, c: 3, d: 40}; const a1 = R.eqProps("a", o1, o2); // => false const a2 = R.eqProps("c", o1, o2); // => true - const a3: (obj1: T, obj2: U) => boolean = R.eqProps("c"); + const a3: (obj1: T, obj2: U) => boolean = R.eqProps("c"); const a4: (obj2: U) => boolean = R.eqProps("c", o1); }; From 78c5458e4339a172d0eb00373a42fa1bc12e3e22 Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Sat, 23 Dec 2017 10:31:47 +0100 Subject: [PATCH 199/890] jest: update ProjectConfig to jest@22.0 From https://github.com/facebook/jest/blob/e879099db1024f106757ee55cb0e9a6935488b43/types/Config.js#L24-L69 --- types/jest/index.d.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 5e27577d3c..7cee1f62e3 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jest 21.1 +// Type definitions for Jest 22.0 // Project: http://facebook.github.io/jest/ // Definitions by: Asana // Ivo Stratev @@ -9,6 +9,7 @@ // Ika // Waseem Dahman // Jamie Mason +// Douglas Duteil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -808,13 +809,17 @@ declare namespace jest { watchman: boolean; } - interface ProjectConfig { + interface ProjectConfig { automock: boolean; browser: boolean; cache: boolean; cacheDirectory: Path; clearMocks: boolean; coveragePathIgnorePatterns: string[]; + cwd: Path; + detectLeaks: boolean; + displayName: Maybe; + forceCoverageMatch: Glob[]; globals: ConfigGlobals; haste: HasteConfig; moduleDirectories: string[]; @@ -829,11 +834,14 @@ declare namespace jest { resolver: Maybe; rootDir: Path; roots: Path[]; + runner: string; setupFiles: Path[]; setupTestFrameworkScriptFile: Path; skipNodeResolution: boolean; snapshotSerializers: Path[]; testEnvironment: string; + testEnvironmentOptions: object; + testLocationInResults: boolean; testMatch: Glob[]; testPathIgnorePatterns: string[]; testRegex: string; @@ -843,6 +851,7 @@ declare namespace jest { transform: Array<[string, Path]>; transformIgnorePatterns: Glob[]; unmockedModulePathPatterns: Maybe; + watchPathIgnorePatterns: string[]; } // Console From de20d2d9a02856037a72276973d03940ef11456b Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Sat, 23 Dec 2017 10:35:19 +0100 Subject: [PATCH 200/890] Update index.d.ts --- types/jest/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 7cee1f62e3..696a3161f3 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -809,7 +809,7 @@ declare namespace jest { watchman: boolean; } - interface ProjectConfig { + interface ProjectConfig { automock: boolean; browser: boolean; cache: boolean; From a026855b11801d20d5d014649870dace1963be86 Mon Sep 17 00:00:00 2001 From: Mick Charuwichitratana Date: Sat, 23 Dec 2017 19:14:40 +0700 Subject: [PATCH 201/890] [@types/bip38] Add bip38 type definition --- types/bip38/bip38-tests.ts | 30 ++++++++++++++++++++++++++++ types/bip38/index.d.ts | 41 ++++++++++++++++++++++++++++++++++++++ types/bip38/tsconfig.json | 23 +++++++++++++++++++++ types/bip38/tslint.json | 3 +++ 4 files changed, 97 insertions(+) create mode 100644 types/bip38/bip38-tests.ts create mode 100644 types/bip38/index.d.ts create mode 100644 types/bip38/tsconfig.json create mode 100644 types/bip38/tslint.json diff --git a/types/bip38/bip38-tests.ts b/types/bip38/bip38-tests.ts new file mode 100644 index 0000000000..c48fc9597b --- /dev/null +++ b/types/bip38/bip38-tests.ts @@ -0,0 +1,30 @@ +import * as bip38 from 'bip38'; + +const myWifString = '5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR'; + +// Result from wif.decode for testing +const decoded = { + version: 48, + privateKey: Buffer.from('12345678901234567890123456789012'), + compressed: true +}; + +// Test encrypt without progressCallback +const encryptedKey = bip38.encrypt(decoded.privateKey, decoded.compressed, 'TestingOneTwoThree'); + +// Test encrypt with progressCallback +bip38.encrypt(decoded.privateKey, decoded.compressed, 'TestingOneTwoThree', (status: bip38.ProgressStatus) => { + status.current; + status.total; + status.percent; +}); + +// Test decrypt without progressCallback +const decryptedKey = bip38.decrypt(encryptedKey, 'TestingOneTwoThree'); + +// Test decrypt with progressCallback +bip38.decrypt(encryptedKey, 'TestingOneTwoThree', (status: bip38.ProgressStatus) => { + status.current; + status.total; + status.percent; +}); diff --git a/types/bip38/index.d.ts b/types/bip38/index.d.ts new file mode 100644 index 0000000000..8842c6a241 --- /dev/null +++ b/types/bip38/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for bip38 2.0 +// Project: https://github.com/bitcoinjs/bip38 +// Definitions by: Satana Charuwichitratana +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +// Note: When there is @types/scryptsy, ProgressStatus and ScryptParams should be referred from the definition instead +export interface ProgressStatus { + current: number; + total: number; + percent: number; +} +export interface ScryptParams { + N: number; + r: number; + p: number; +} + +export function decrypt(string: string, passphrase: string, + progressCallback?: (status: ProgressStatus) => void, + scryptParams?: ScryptParams): { privateKey: Buffer, compressed: boolean }; + +export function decryptECMult(buffer: Buffer, passphrase: string, + progressCallback?: (status: ProgressStatus) => void, + scryptParams?: ScryptParams): { privateKey: Buffer, compressed: boolean }; + +export function decryptRaw(buffer: Buffer, passphrase: string, + progressCallback?: (status: ProgressStatus) => void, + scryptParams?: ScryptParams): { privateKey: Buffer, compressed: boolean }; + +export function encrypt(buffer: Buffer, compressed: boolean, passphrase: string, + progressCallback?: (status: ProgressStatus) => void, + scryptParams?: ScryptParams): string; + +export function encryptRaw(buffer: Buffer, compressed: boolean, passphrase: string, + progressCallback?: (status: ProgressStatus) => void, + scryptParams?: ScryptParams): Buffer; + +export function verify(string: string): boolean; diff --git a/types/bip38/tsconfig.json b/types/bip38/tsconfig.json new file mode 100644 index 0000000000..6ce875b1d1 --- /dev/null +++ b/types/bip38/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bip38-tests.ts" + ] +} diff --git a/types/bip38/tslint.json b/types/bip38/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/bip38/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From b201c7e42bdd833379e83931efee1e83131d79d6 Mon Sep 17 00:00:00 2001 From: Mick Charuwichitratana Date: Sat, 23 Dec 2017 19:32:23 +0700 Subject: [PATCH 202/890] [@types/bitcoinjs-lib] Improve bitcoinjs-lib type definition to support version 3.3 --- types/bitcoinjs-lib/bitcoinjs-lib-tests.ts | 89 +++++++++------------- types/bitcoinjs-lib/index.d.ts | 23 +++++- types/bitcoinjs-lib/tslint.json | 4 +- 3 files changed, 59 insertions(+), 57 deletions(-) diff --git a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts index 868659e6b6..669c00d77a 100644 --- a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts +++ b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts @@ -1,62 +1,43 @@ import bigi = require('bigi'); import bitcoin = require('bitcoinjs-lib'); -declare const it: any; -declare const describe: any; -declare const assert: any; +// For testing only +function rng() { + return new Buffer('12345678901234567890123456789012'); +} -describe('bitcoinjs-lib (basic)', () => { - it('can generate a random bitcoin address', () => { - // for testing only - function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); } +// Generate a random bitcoin address +const keyPair1 = bitcoin.ECPair.makeRandom({rng}); +const address = keyPair1.getAddress(); +keyPair1.toWIF(); - // generate random keyPair - const keyPair = bitcoin.ECPair.makeRandom({ rng }); - const address = keyPair.getAddress(); +// Generate an address from a SHA256 hash +const hash = bitcoin.crypto.sha256(Buffer.from('correct horse battery staple', 'utf8')); +const d = bigi.fromBuffer(hash); +const keyPair2 = new bitcoin.ECPair(d); - assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64'); - }); +// Generate a random keypair for alternative networks +const keyPair3 = bitcoin.ECPair.makeRandom({network: bitcoin.networks.litecoin, rng}); +keyPair3.toWIF(); +keyPair3.getAddress(); +const network = keyPair3.getNetwork(); - it('can generate an address from a SHA256 hash', () => { - const hash = bitcoin.crypto.sha256(Buffer.from('correct horse battery staple', 'utf8')); - const d = bigi.fromBuffer(hash); +// Test TransactionBuilder and Transaction +const txb = new bitcoin.TransactionBuilder(); +txb.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0); +txb.addOutput(Buffer.from('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 'utf8'), 15000); +txb.sign(0, keyPair1); +const tx = txb.build(); +tx.toHex(); +tx.hasWitnesses(); +tx.hashForWitnessV0(1, new Buffer('12345678901234567890123456789012'), 2, 3); - const keyPair = new bitcoin.ECPair(d); - const address = keyPair.getAddress(); - - assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8'); - }); - - it('can generate a random keypair for alternative networks', () => { - // for testing only - function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); } - - const litecoin = bitcoin.networks.litecoin; - - const keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng }); - const wif = keyPair.toWIF(); - const address = keyPair.getAddress(); - - assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn'); - assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS'); - }); - - it('can import an address via WIF', () => { - const keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct', bitcoin.networks.testnet); - const address = keyPair.getAddress(); - - assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31'); - }); - - it('can create a Transaction', () => { - const keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy', bitcoin.networks.testnet); - const tx = new bitcoin.TransactionBuilder(); - - tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0); - tx.addOutput(Buffer.from('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 'utf8'), 15000); - tx.sign(0, keyPair); - - // tslint:disable-next-line:max-line-length - assert.strictEqual(tx.build().toHex(), '0100000001313eb630b128102b60241ca895f1d0ffca2170d5a0990e094f2182c102ab94aa000000006b483045022100aefbcf847900b01dd3e3debe054d3b6d03d715d50aea8525f5ea3396f168a1fb022013d181d05b15b90111808b22ef4f9ebe701caf2ab48db269691fdf4e9048f4f60121029f50f51d63b345039a290c94bffd3180c99ed659ff6ea6b1242bca47eb93b59fffffffff01983a0000000000001976a914ad618cf4333b3b248f9744e8e81db2964d0ae39788ac00000000'); - }); -}); +// Test functions in address +const rsBase58Check = bitcoin.address.fromBase58Check(address); +const rsBech32 = bitcoin.address.fromBech32(address); +const rsOutputScript = bitcoin.address.fromOutputScript(new Buffer('12345678901234567890123456789012')); +const rsOutputScriptWithNetwork = bitcoin.address.fromOutputScript(new Buffer('12345678901234567890123456789012'), network); +bitcoin.address.toBase58Check(rsBase58Check.hash, rsBase58Check.version); +bitcoin.address.toBech32(rsBech32.data, rsBech32.version, rsBech32.prefix); +bitcoin.address.toOutputScript(address); +bitcoin.address.toOutputScript(address, network); diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index 1f5abfd2f3..141524f5eb 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -1,14 +1,16 @@ -// Type definitions for bitcoinjs-lib 3.0 +// Type definitions for bitcoinjs-lib 3.3 // Project: https://github.com/bitcoinjs/bitcoinjs-lib // Definitions by: Mohamed Hegazy // Daniel // Ron Buckton +// Satana Charuwichitratana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Declaration file initially generated by dts-gen for bitcoinjs-lib 3.0.3 // based on the flow version found at https://github.com/flowtype/flow-typed/blob/master/definitions/npm/bitcoinjs-lib_v2.x.x/flow_v0.17.x-/bitcoinjs-lib_v2.x.x.js /// -import BigInteger = require("bigi"); + +import BigInteger = require('bigi'); export interface Out { script: Buffer; @@ -168,22 +170,32 @@ export class Transaction { getId(): string; + /** @since 3.0.0 */ hasWitnesses(): boolean; hashForSignature(inIndex: number, prevOutScript: Buffer, hashType: number): Buffer; + /** @since 3.0.0 */ hashForWitnessV0(inIndex: number, prevOutScript: Buffer, value: number, hashType: number): Buffer; isCoinbase(): boolean; setInputScript(index: number, scriptSig: Buffer): void; + /** @since 3.0.0 */ setWitness(index: number, witness: any, ...args: any[]): void; + /** @since 3.0.0 */ toBuffer(buffer?: Buffer, initialOffset?: number): Buffer; toHex(): string; + /** @since 3.1.0 */ + virtualSize(): number; + + /** @since 3.1.0 */ + weight(): number; + static ADVANCED_TRANSACTION_FLAG: number; static ADVANCED_TRANSACTION_MARKER: number; @@ -233,6 +245,7 @@ export class TransactionBuilder { setVersion(version: number): void; + /** @since 3.0.0 */ sign(vin: number, keyPair: ECPair, redeemScript?: Buffer, hashType?: number, witnessValue?: number, witnessScript?: Buffer): void; static fromTransaction(transaction: Transaction, network: Network): TransactionBuilder; @@ -367,10 +380,16 @@ export const opcodes: { export namespace address { function fromBase58Check(address: string): { hash: Buffer, version: number }; + /** @since 3.2.0 */ + function fromBech32(address: string): { data: Buffer, prefix: string, version: number }; + function fromOutputScript(outputScript: Buffer, network?: Network): Buffer; function toBase58Check(hash: Buffer, version: number): string; + /** @since 3.2.0 */ + function toBech32(data: Buffer, version: number, prefix: string): string; + function toOutputScript(address: string, network?: Network): Buffer; } diff --git a/types/bitcoinjs-lib/tslint.json b/types/bitcoinjs-lib/tslint.json index 3db14f85ea..f93cf8562a 100644 --- a/types/bitcoinjs-lib/tslint.json +++ b/types/bitcoinjs-lib/tslint.json @@ -1 +1,3 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json" +} From 70a51b86a063619ec364dbc58948b76a39a6e522 Mon Sep 17 00:00:00 2001 From: vsun Date: Sat, 23 Dec 2017 09:40:12 -0500 Subject: [PATCH 203/890] fixed DialogButton textStyle type --- types/react-native-popup-dialog/index.d.ts | 5 +- .../react-native-popup-dialog-tests.tsx | 73 ++++++++++--------- 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/types/react-native-popup-dialog/index.d.ts b/types/react-native-popup-dialog/index.d.ts index b1e1bb0fff..73466d1b9d 100644 --- a/types/react-native-popup-dialog/index.d.ts +++ b/types/react-native-popup-dialog/index.d.ts @@ -1,11 +1,12 @@ // Type definitions for react-native-popup-dialog 0.9 // Project: https://github.com/jacklam718/react-native-popup-dialog/blob/master/README.md // Definitions by: Paito Anderson +// connectdotz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import * as React from 'react'; -import { GestureResponderEvent, StyleProp, ViewStyle } from 'react-native'; +import { GestureResponderEvent, StyleProp, ViewStyle, TextStyle } from 'react-native'; export type AlignTypes = 'left' | 'right' | 'center'; export type OverlayPointerEventTypes = 'auto' | 'none'; @@ -16,7 +17,7 @@ export interface DialogButtonProps { align?: AlignTypes; onPress?: (event: GestureResponderEvent) => void; buttonStyle?: StyleProp; - textStyle?: StyleProp; + textStyle?: StyleProp; textContainerStyle?: StyleProp; disabled?: boolean; activeOpacity?: number; diff --git a/types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx b/types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx index 6646111d89..fdc53cfb88 100644 --- a/types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx +++ b/types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx @@ -6,7 +6,7 @@ import PopupDialog, { SlideAnimation, ScaleAnimation, FadeAnimation, - } from 'react-native-popup-dialog'; +} from 'react-native-popup-dialog'; const slideAnimation = new SlideAnimation({ slideFrom: 'bottom' }); const scaleAnimation = new ScaleAnimation(); @@ -15,41 +15,42 @@ const fadeAnimation = new FadeAnimation({ animationDuration: 150 }); class Test extends React.Component { render() { return ( - - } - dialogAnimation={fadeAnimation} - /> - } - dialogAnimation={scaleAnimation} - actions={[ - {}} - key="button-1" - />, - ]} - /> - } - width={300} - height={300} - dialogAnimation={slideAnimation} - containerStyle={styles.testStyle} - dialogStyle={styles.testStyle} - animationDuration={150} - overlayPointerEvents='auto' - overlayBackgroundColor='white' - overlayOpacity={0.5} - dismissOnTouchOutside={false} - dismissOnHardwareBackPress={false} - haveOverlay={true} - show={true} - onShown={() => { console.log('onShown'); }} - onDismissed={() => { console.log('onDismissed'); }} - /> - ); + + } + dialogAnimation={fadeAnimation} + /> + } + dialogAnimation={scaleAnimation} + actions={[ + { }} + textStyle={{ color: "red" }} + key="button-1" + />, + ]} + /> + } + width={300} + height={300} + dialogAnimation={slideAnimation} + containerStyle={styles.testStyle} + dialogStyle={styles.testStyle} + animationDuration={150} + overlayPointerEvents='auto' + overlayBackgroundColor='white' + overlayOpacity={0.5} + dismissOnTouchOutside={false} + dismissOnHardwareBackPress={false} + haveOverlay={true} + show={true} + onShown={() => { console.log('onShown'); }} + onDismissed={() => { console.log('onDismissed'); }} + /> + ); } } From ebab4eed1c93e0d80fe3f809b9cc9d463e75050c Mon Sep 17 00:00:00 2001 From: Mick Charuwichitratana Date: Sat, 23 Dec 2017 21:42:12 +0700 Subject: [PATCH 204/890] [@types/scryptsy] Add scryptsy type definition --- types/scryptsy/index.d.ts | 15 +++++++++++++++ types/scryptsy/scryptsy-tests.ts | 14 ++++++++++++++ types/scryptsy/tsconfig.json | 23 +++++++++++++++++++++++ types/scryptsy/tslint.json | 3 +++ 4 files changed, 55 insertions(+) create mode 100644 types/scryptsy/index.d.ts create mode 100644 types/scryptsy/scryptsy-tests.ts create mode 100644 types/scryptsy/tsconfig.json create mode 100644 types/scryptsy/tslint.json diff --git a/types/scryptsy/index.d.ts b/types/scryptsy/index.d.ts new file mode 100644 index 0000000000..e716f7c56c --- /dev/null +++ b/types/scryptsy/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for scryptsy 2.0 +// Project: https://github.com/cryptocoinjs/scryptsy +// Definitions by: Satana Charuwichitratana +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export = scryptsy; + +declare function scryptsy(key: Buffer | string, salt: Buffer | string, N: number, r: number, p: number, dkLen: number, + progressCallback?: (status: { current: number, total: number, percent: number }) => void): Buffer; + +declare namespace scryptsy { + const prototype: {}; +} diff --git a/types/scryptsy/scryptsy-tests.ts b/types/scryptsy/scryptsy-tests.ts new file mode 100644 index 0000000000..885cf7ae00 --- /dev/null +++ b/types/scryptsy/scryptsy-tests.ts @@ -0,0 +1,14 @@ +import * as scrypt from 'scryptsy'; + +const key = 'TheKey'; +const salt = 'Salty'; + +// Test without processCallback +const data: Buffer = scrypt(key, salt, 16384, 8, 1, 64); + +// Test with processCallback +scrypt(key, salt, 16384, 8, 1, 64, (status) => { + status.current; + status.total; + status.percent; +}); diff --git a/types/scryptsy/tsconfig.json b/types/scryptsy/tsconfig.json new file mode 100644 index 0000000000..ae751a1eb0 --- /dev/null +++ b/types/scryptsy/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "scryptsy-tests.ts" + ] +} diff --git a/types/scryptsy/tslint.json b/types/scryptsy/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/scryptsy/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From e3f52cd4ce2a4e7b8de5cc8c8f5ade6e25c369fd Mon Sep 17 00:00:00 2001 From: Dasa Paddock Date: Sat, 23 Dec 2017 10:46:39 -0800 Subject: [PATCH 205/890] Add `@deprecated` tags --- types/arcgis-js-api/v3/index.d.ts | 110 ++++++++++++++++++++++++------ 1 file changed, 90 insertions(+), 20 deletions(-) diff --git a/types/arcgis-js-api/v3/index.d.ts b/types/arcgis-js-api/v3/index.d.ts index 9d3126ee63..391dfb6e0a 100644 --- a/types/arcgis-js-api/v3/index.d.ts +++ b/types/arcgis-js-api/v3/index.d.ts @@ -110,7 +110,10 @@ declare module "esri" { resourceInfo?: any; /** When true, the layer's attribution is displayed on the map. */ showAttribution?: boolean; - /** By default, images are exported in MIME format, and the image is streamed to the client. */ + /** + * By default, images are exported in MIME format, and the image is streamed to the client. + * @deprecated + */ useMapImage?: boolean; /** When true, the layer will update its content based on the map's time extent. */ useMapTime?: boolean; @@ -2156,9 +2159,15 @@ declare module "esri" { export interface SymbolStylerOptions { /** Added at v. */ portal?: string | any; - /** Self response of Portal used as symbol provider. */ + /** + * Self response of Portal used as symbol provider. + * @deprecated + */ portalSelf?: any; - /** URL to Portal used as symbol provider. */ + /** + * URL to Portal used as symbol provider. + * @deprecated + */ portalUrl?: string; } export interface TemplatePickerOptions { @@ -3931,7 +3940,10 @@ declare module "esri/dijit/Directions" { * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. */ constructor(options: esri.DirectionsOptions, srcNodeRef: Node | string); - /** Deprecated at v3.13. */ + /** + * Deprecated at v3.13. + * @deprecated + */ activate(): void; /** * Add a stop to the directions widget at the specified index location. @@ -3952,7 +3964,10 @@ declare module "esri/dijit/Directions" { centerAtSegmentStart(index: number): void; /** Remove the route directions from the directions list. */ clearDirections(): void; - /** Deprecated at v3.13. */ + /** + * Deprecated at v3.13. + * @deprecated + */ deactivate(): void; /** Destroy the Directions widget. */ destroy(): void; @@ -4116,7 +4131,10 @@ declare module "esri/dijit/FeatureTable" { featureLayer: FeatureLayer; /** An array of objects representing field information. */ fieldInfos: any[]; - /** Reference to the dGrid. */ + /** + * Reference to the dGrid. + * @deprecated + */ grid: any; /** Reference to the 'Options' drop-down menu. */ gridMenu: any; @@ -8593,6 +8611,7 @@ declare module "esri/geometry/screenUtils" { * @param width The current width of the map in screen units. * @param height The current height of the map in screen units. * @param screenPoint The screenPoint to convert from screen to map units. + * @deprecated */ toMapPoint(extent: Extent, width: number, height: number, screenPoint: ScreenPoint): Point; /** @@ -8609,6 +8628,7 @@ declare module "esri/geometry/screenUtils" { * @param width The current width of the map in screen units. * @param height The current height of the map in screen units. * @param mapPoint The point to convert from map to screen units. + * @deprecated */ toScreenPoint(extent: Extent, width: number, height: number, mapPoint: Point): ScreenPoint; }; @@ -8705,7 +8725,10 @@ declare module "esri/graphic" { getChildGraphics(): Graphic[]; /** Returns the content string based on attributes and infoTemplate values. */ getContent(): string; - /** Returns the dojo/gfx/shape.Shape of the Esri graphic. */ + /** + * Returns the dojo/gfx/shape.Shape of the Esri graphic. + * @deprecated + */ getDojoShape(): any; /** Returns the info template associated with the graphic. */ getInfoTemplate(): InfoTemplate; @@ -8887,7 +8910,10 @@ declare module "esri/layers/ArcGISDynamicMapServiceLayer" { timeInfo: TimeInfo; /** Default units of the layer as defined by the service. */ units: string; - /** When true, the image is saved to the server, and a JSON formatted response is sent to the client with the URL location of the image. */ + /** + * When true, the image is saved to the server, and a JSON formatted response is sent to the client with the URL location of the image. + * @deprecated + */ useMapImage: boolean; /** The version of ArcGIS Server where the map service is published. */ version: number; @@ -10843,7 +10869,10 @@ declare module "esri/layers/RasterDataSource" { declare module "esri/layers/RasterFunction" { /** Specifies the processing to be done to the image service. */ class RasterFunction { - /** Deprecated at v3.10, use functionArguments instead. */ + /** + * Deprecated at v3.10, use functionArguments instead. + * @deprecated + */ arguments: any; /** The arguments for the raster function. */ functionArguments: any; @@ -12333,7 +12362,10 @@ declare module "esri/opsdashboard/ExtensionBase" { portalHelperServices: any; /** Read-only: The URL to the ArcGIS.com site or in-house portal that you are currently signed in to. */ portalUrl: string; - /** Get the collection of data sources from the host application. */ + /** + * Get the collection of data sources from the host application. + * @deprecated + */ getDataSourceProxies(): any; /** * Get the data source corresponding to the data source id from the host application. @@ -12961,7 +12993,10 @@ declare module "esri/renderers/ClassBreaksRenderer" { attributeField: string; /** To symbolize polygon features with graduated symbols, use backgroundFillSymbol to specify a simple fill symbol to represent polygon features, and use marker symbols of varying sizes in class breaks to indicate the quantity. */ backgroundFillSymbol: FillSymbol; - /** Deprecated at v2.0, use infos instead. */ + /** + * Deprecated at v2.0, use infos instead. + * @deprecated + */ breaks: any[]; /** The classification method used to generate class breaks. */ classificationMethod: string; @@ -13143,13 +13178,25 @@ declare module "esri/renderers/Renderer" { /** The base class for the renderers - SimpleRenderer, ClassBreaksRenderer, UniqueValueRenderer, DotDensityRenderer, ScaleDependentRenderer, TemporalRenderer, HeatmapRenderer, and VectorFieldRenderer used with a GraphicsLayer and FeatureLayer. */ class Renderer { - /** Deprecated. */ + /** + * Deprecated. + * @deprecated + */ colorInfo: any; - /** Deprecated. */ + /** + * Deprecated. + * @deprecated + */ opacityInfo: any; - /** Deprecated. */ + /** + * Deprecated. + * @deprecated + */ rotationInfo: any; - /** Deprecated. */ + /** + * Deprecated. + * @deprecated + */ sizeInfo: any; /** This property allows you to define how to render values in a layer. */ visualVariables: any[]; @@ -13192,21 +13239,25 @@ declare module "esri/renderers/Renderer" { /** * Deprecated. * @param info An info object that defines the color. + * @deprecated */ setColorInfo(info: any): Renderer; /** * Deprecated. * @param info The info parameter is an object with the same properties as opacityInfo. + * @deprecated */ setOpacityInfo(info: any): Renderer; /** * Deprecated. * @param info An object with the same properties as rotationInfo. + * @deprecated */ setRotationInfo(info: any): Renderer; /** * Deprecated. * @param info An object with the same properties as sizeInfo. + * @deprecated */ setSizeInfo(info: any): Renderer; /** @@ -13424,7 +13475,10 @@ declare module "esri/renderers/UniqueValueRenderer" { valueExpression: string; /** The title identifying and describing the associated Arcade expression as defined in the valueExpression property. */ valueExpressionTitle: string; - /** Deprecated at v2.0, use infos instead. */ + /** + * Deprecated at v2.0, use infos instead. + * @deprecated + */ values: string[]; /** * Creates a new UniqueValueRenderer object. @@ -13739,7 +13793,10 @@ declare module "esri/symbols/Font" { size: number; /** Text style. */ style: string; - /** Text variant (deprecated). */ + /** + * Text variant (deprecated). + * @deprecated + */ variant: string; /** Text weight. */ weight: string; @@ -13782,6 +13839,7 @@ declare module "esri/symbols/Font" { /** * Sets the font variant (deprecated). * @param variant Font variant. + * @deprecated */ setVariant(variant: string): Font; /** @@ -14171,11 +14229,17 @@ declare module "esri/symbols/TextSymbol" { static DECORATION_OVERLINE: any; /** Text is underlined. */ static DECORATION_UNDERLINE: any; - /** The text alignment in relation to the point. */ + /** + * The text alignment in relation to the point. + * @deprecated + */ align: string; /** Text angle. */ angle: number; - /** The decoration on the text. */ + /** + * The decoration on the text. + * @deprecated + */ decoration: string; /** Font for displaying text. */ font: Font; @@ -14217,6 +14281,7 @@ declare module "esri/symbols/TextSymbol" { /** * Sets the alignment of the text. * @param align The text alignment. + * @deprecated */ setAlign(align: string): TextSymbol; /** @@ -14227,6 +14292,7 @@ declare module "esri/symbols/TextSymbol" { /** * Sets the decoration for the text. * @param decoration The decoration on the text. + * @deprecated */ setDecoration(decoration: string): TextSymbol; /** @@ -15178,7 +15244,10 @@ declare module "esri/tasks/Geoprocessor" { /** Represents a GP Task resource exposed by the ArcGIS Server REST API. */ class Geoprocessor { - /** Deprecated at v2.0, use outSpatialReference instead. */ + /** + * Deprecated at v2.0, use outSpatialReference instead. + * @deprecated + */ outputSpatialReference: SpatialReference; /** The spatial reference of the output geometries. */ outSpatialReference: SpatialReference; @@ -15247,6 +15316,7 @@ declare module "esri/tasks/Geoprocessor" { /** * Deprecated at v2.0, use setOutSpatialReference instead. * @param spatialReference The well-known ID of a spatial reference. + * @deprecated */ setOutputSpatialReference(spatialReference: SpatialReference): void; /** From 75c8ba719c60d74b0a54a20bee088ee319f0b905 Mon Sep 17 00:00:00 2001 From: Yuri Pereira Constante Date: Sat, 23 Dec 2017 20:45:09 -0200 Subject: [PATCH 206/890] cytoscape: join layout options declarations --- types/cytoscape/index.d.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index 85b3a97e46..b7dc39f596 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -176,9 +176,7 @@ declare namespace cytoscape { * leaving your nodes in their current positions * (e.g. specified in options.elements at initialisation time) */ - layout?: NullLayoutOptions | RandomLayoutOptions | PresetLayoutOptions | - GridLayoutOptions | CircleLayoutOptions | ConcentricLayoutOptions | - BreadthFirstLayoutOptions | CoseLayoutOptions | BaseLayoutOptions; + layout?: LayoutOptions; /////////////////////////////////////// // initial viewport state: @@ -4142,9 +4140,9 @@ declare namespace cytoscape { interface Layouts extends LayoutManipulation, LayoutEvents { } type LayoutOptions = - NullLayoutOptions | PresetLayoutOptions | GridLayoutOptions | - CircleLayoutOptions | ConcentricLayoutOptions | BreadthFirstLayoutOptions | - CoseLayoutOptions | BaseLayoutOptions; + NullLayoutOptions | RandomLayoutOptions | PresetLayoutOptions | + GridLayoutOptions | CircleLayoutOptions | ConcentricLayoutOptions | + BreadthFirstLayoutOptions | CoseLayoutOptions | BaseLayoutOptions; type LayoutHandler = () => void; From e2b3df89629a3cd465b88d91b7f99330b291f22a Mon Sep 17 00:00:00 2001 From: Yuri Pereira Constante Date: Sat, 23 Dec 2017 20:46:38 -0200 Subject: [PATCH 207/890] cytoscape: layout events with LayoutEventObject as parameter --- types/cytoscape/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index b7dc39f596..237a65cebb 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -4144,7 +4144,7 @@ declare namespace cytoscape { GridLayoutOptions | CircleLayoutOptions | ConcentricLayoutOptions | BreadthFirstLayoutOptions | CoseLayoutOptions | BaseLayoutOptions; - type LayoutHandler = () => void; + type LayoutHandler = (e: LayoutEventObject) => void; interface BaseLayoutOptions { name: string; From 785b3b7d2092fbd26fb94c52032c0ec85fa9e4a9 Mon Sep 17 00:00:00 2001 From: Yuri Pereira Constante Date: Sat, 23 Dec 2017 20:46:57 -0200 Subject: [PATCH 208/890] cytoscape: add type to cy property in AbstractEventObject --- types/cytoscape/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index 237a65cebb..cb37a31099 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -3961,7 +3961,7 @@ declare namespace cytoscape { */ interface AbstractEventObject { /** a reference to the corresponding core Core */ - cy: any; + cy: Core; /** indicates the element or core that first caused the event */ target?: any; /** the event type string (e.g. "tap") */ From 190d645dd62e9bb885610be99411770e35eb24f6 Mon Sep 17 00:00:00 2001 From: Yuri Pereira Constante Date: Sat, 23 Dec 2017 20:47:13 -0200 Subject: [PATCH 209/890] cytoscape: add myself to the 'Definitions by' --- types/cytoscape/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index cb37a31099..bf3439324b 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -2,6 +2,7 @@ // Project: http://js.cytoscape.org/ // Definitions by: Fabian Schmidt and Fred Eisele // Shenghan Gao +// Yuri Pereira Constante // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Translation from Objects in help to Typescript interface. From a50d608c1be64370870b7eb0f3be3dbfd900908b Mon Sep 17 00:00:00 2001 From: Krystof Celba Date: Sun, 24 Dec 2017 00:15:15 +0100 Subject: [PATCH 210/890] react-native: fix Dimensions event handler type --- types/react-native/index.d.ts | 4 ++-- types/react-native/test/index.tsx | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index c6e683ebd4..8063ada6fd 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -5250,7 +5250,7 @@ export interface Dimensions { * @param type the type of event to listen to * @param handler the event handler */ - addEventListener(type: "change", handler: () => void): void; + addEventListener(type: "change", handler: ({ window, screen }: { window: ScaledSize, screen: ScaledSize }) => void): void; /** * Remove an event listener @@ -5258,7 +5258,7 @@ export interface Dimensions { * @param type the type of event * @param handler the event handler */ - removeEventListener(type: "change", handler: () => void): void; + removeEventListener(type: "change", handler: ({ window, screen }: { window: ScaledSize, screen: ScaledSize }) => void): void; } export type SimpleTask = { diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 493de97949..666ad12aca 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -34,6 +34,7 @@ import { ViewPagerAndroid, FlatList, FlatListProperties, + ScaledSize, SectionList, SectionListProperties, findNodeHandle, @@ -60,8 +61,16 @@ NativeModules.NativeUntypedModule; NativeModules.NativeTypedModule.someFunction(); NativeModules.NativeTypedModule.someProperty = ""; +function dimensionsListener(dimensions: { window: ScaledSize, screen: ScaledSize }) { + console.log("window dimensions: ", dimensions.window); + console.log("screen dimensions: ", dimensions.screen); +} + function testDimensions() { const { width, height, scale, fontScale } = Dimensions.get(1 === 1 ? "window" : "screen"); + + Dimensions.addEventListener('change', dimensionsListener); + Dimensions.removeEventListener('change', dimensionsListener); } BackAndroid.addEventListener("hardwareBackPress", () => {}); From ce55e95240b58874ab8521ddedf42442e431a618 Mon Sep 17 00:00:00 2001 From: Mick Charuwichitratana Date: Sun, 24 Dec 2017 11:37:46 +0700 Subject: [PATCH 211/890] [@types/bip39] Add type definition for bip39 version 2.4 --- types/bip39/bip39-tests.ts | 14 ++++++++++++++ types/bip39/index.d.ts | 30 ++++++++++++++++++++++++++++++ types/bip39/tsconfig.json | 23 +++++++++++++++++++++++ types/bip39/tslint.json | 3 +++ 4 files changed, 70 insertions(+) create mode 100644 types/bip39/bip39-tests.ts create mode 100644 types/bip39/index.d.ts create mode 100644 types/bip39/tsconfig.json create mode 100644 types/bip39/tslint.json diff --git a/types/bip39/bip39-tests.ts b/types/bip39/bip39-tests.ts new file mode 100644 index 0000000000..1ec9611bb8 --- /dev/null +++ b/types/bip39/bip39-tests.ts @@ -0,0 +1,14 @@ +import * as bip39 from 'bip39'; + +// Test generate a random mnemonic +const mnemonic: string = bip39.generateMnemonic(); + +// Test generate a random mnemonic with strength +bip39.generateMnemonic(64); + +// Test mnemonic to seed +const seedHex: string = bip39.mnemonicToSeedHex('basket actual'); +const seed: Buffer = bip39.mnemonicToSeed('basket actual'); + +// Test validation +bip39.validateMnemonic(mnemonic); diff --git a/types/bip39/index.d.ts b/types/bip39/index.d.ts new file mode 100644 index 0000000000..a5d58cf961 --- /dev/null +++ b/types/bip39/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for bip39 2.4 +// Project: https://github.com/bitcoinjs/bip39 +// Definitions by: Satana Charuwichitratana +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export const wordlists: { + EN: string[]; + JA: string[]; + chinese_simplified: string[]; + chinese_traditional: string[]; + english: string[]; + french: string[]; + italian: string[]; + japanese: string[]; + spanish: string[]; +}; + +export function entropyToMnemonic(entropyHex: string, wordlist?: string[]): string; + +export function generateMnemonic(strength?: number, rng?: (size: number) => Buffer, wordlist?: string[]): string; + +export function mnemonicToEntropy(mnemonic: string, wordlist?: string[]): string; + +export function mnemonicToSeed(mnemonic: string, password?: string): Buffer; + +export function mnemonicToSeedHex(mnemonic: string, password?: string): string; + +export function validateMnemonic(mnemonic: string, wordlist?: string[]): boolean; diff --git a/types/bip39/tsconfig.json b/types/bip39/tsconfig.json new file mode 100644 index 0000000000..d44c1197ad --- /dev/null +++ b/types/bip39/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bip39-tests.ts" + ] +} diff --git a/types/bip39/tslint.json b/types/bip39/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/bip39/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 2ec048ca71b7a9e7f9f18eff7cc32a186576a1ec Mon Sep 17 00:00:00 2001 From: Mick Charuwichitratana Date: Sun, 24 Dec 2017 11:45:09 +0700 Subject: [PATCH 212/890] [@types/scryptsy] Change import statement in test file --- types/scryptsy/scryptsy-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/scryptsy/scryptsy-tests.ts b/types/scryptsy/scryptsy-tests.ts index 885cf7ae00..12c5a89d6d 100644 --- a/types/scryptsy/scryptsy-tests.ts +++ b/types/scryptsy/scryptsy-tests.ts @@ -1,4 +1,4 @@ -import * as scrypt from 'scryptsy'; +import scrypt = require('scryptsy'); const key = 'TheKey'; const salt = 'Salty'; From 64bff52527e653ffb2a06db449ab2a9d2f8717d7 Mon Sep 17 00:00:00 2001 From: Mick Charuwichitratana Date: Sun, 24 Dec 2017 12:24:48 +0700 Subject: [PATCH 213/890] [@types/bech32] Add bech32 definition version 1.1 --- types/bech32/bech32-tests.ts | 19 +++++++++++++++++++ types/bech32/index.d.ts | 14 ++++++++++++++ types/bech32/tsconfig.json | 23 +++++++++++++++++++++++ types/bech32/tslint.json | 3 +++ 4 files changed, 59 insertions(+) create mode 100644 types/bech32/bech32-tests.ts create mode 100644 types/bech32/index.d.ts create mode 100644 types/bech32/tsconfig.json create mode 100644 types/bech32/tslint.json diff --git a/types/bech32/bech32-tests.ts b/types/bech32/bech32-tests.ts new file mode 100644 index 0000000000..a7ecfb9db1 --- /dev/null +++ b/types/bech32/bech32-tests.ts @@ -0,0 +1,19 @@ +import * as bech32 from 'bech32'; + +// Test decode +const testString = 'abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw'; +const decoded = bech32.decode(testString); +// Test decode with limit +bech32.decode(testString, testString.length); +decoded.prefix; +decoded.words; + +// Test convert from/to words +const words: number[] = bech32.toWords(Buffer.from('foobar', 'utf8')); +bech32.fromWords(words); + +// Test encode +const testPrefix = 'foo'; +bech32.encode(testPrefix, words); +// Test encode with limit +bech32.encode(testPrefix, words, testPrefix.length + 7 + words.length); diff --git a/types/bech32/index.d.ts b/types/bech32/index.d.ts new file mode 100644 index 0000000000..be5e7bbe54 --- /dev/null +++ b/types/bech32/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for bech32 1.1 +// Project: https://github.com/bitcoinjs/bech32 +// Definitions by: Satana Charuwichitratana +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export function decode(str: string, LIMIT?: number): { prefix: string, words: number[] }; + +export function encode(prefix: string, words: number[], LIMIT?: number): string; + +export function fromWords(words: number[]): number[]; + +export function toWords(bytes: Buffer): number[]; diff --git a/types/bech32/tsconfig.json b/types/bech32/tsconfig.json new file mode 100644 index 0000000000..886ec79796 --- /dev/null +++ b/types/bech32/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bech32-tests.ts" + ] +} diff --git a/types/bech32/tslint.json b/types/bech32/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/bech32/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 5eb1fe94b944039b088f542e46267a7bc9e058f9 Mon Sep 17 00:00:00 2001 From: downace Date: Sun, 24 Dec 2017 14:42:35 +0900 Subject: [PATCH 214/890] [@types/caseless] Add type definition for caseless version 0.12 --- types/caseless/caseless-tests.ts | 35 ++++++++++++++++++++++++++++++++ types/caseless/index.d.ts | 25 +++++++++++++++++++++++ types/caseless/tsconfig.json | 23 +++++++++++++++++++++ types/caseless/tslint.json | 1 + 4 files changed, 84 insertions(+) create mode 100644 types/caseless/caseless-tests.ts create mode 100644 types/caseless/index.d.ts create mode 100644 types/caseless/tsconfig.json create mode 100644 types/caseless/tslint.json diff --git a/types/caseless/caseless-tests.ts b/types/caseless/caseless-tests.ts new file mode 100644 index 0000000000..941a5afb72 --- /dev/null +++ b/types/caseless/caseless-tests.ts @@ -0,0 +1,35 @@ +import caseless, { httpify } from "caseless"; + +caseless(); // $ExpectType Caseless +caseless({}); // $ExpectType Caseless +caseless(null); // $ExpectError +caseless(1); // $ExpectError +caseless("2"); // $ExpectError + +const c = caseless(); + +c.set({}); // $ExpectType void +c.set('foo', 'bar'); // $ExpectType string | false +c.set('foo', 'bar', false); // $ExpectType string | false +c.set('foo', new Date()); // $ExpectType string | false +c.set(10, 'bar'); // $ExpectError + +c.get('foo'); // $ExpectType any +c.get(10); // $ExpectError + +c.has('foo'); // $ExpectType string | false +c.has(10); // $ExpectError + +c.swap('foo'); // $ExpectType void +c.swap(10); // $ExpectError + +c.del('foo'); // $ExpectType boolean + +httpify(null, {}); // $ExpectError +httpify(1, {}); // $ExpectError +httpify("2", {}); // $ExpectError +httpify({}, null); // $ExpectError +httpify({}, 1); // $ExpectError +httpify({}, "2"); // $ExpectError + +httpify({}, {}); // $ExpectType Caseless diff --git a/types/caseless/index.d.ts b/types/caseless/index.d.ts new file mode 100644 index 0000000000..9cbf874e84 --- /dev/null +++ b/types/caseless/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for caseless 0.12 +// Project: https://github.com/mikeal/caseless +// Definitions by: downace +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +type KeyType = string; +type ValueType = any; +type RawDict = object; + +declare class Caseless { + constructor(dict?: RawDict); + set(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false; + set(dict: RawDict): void; + has(name: KeyType): KeyType | false; + get(name: KeyType): ValueType | undefined; + swap(name: KeyType): void; + del(name: KeyType): boolean; +} + +export function httpify(resp: object, headers: RawDict): Caseless; + +declare function caseless(dict?: RawDict): Caseless; + +export default caseless; diff --git a/types/caseless/tsconfig.json b/types/caseless/tsconfig.json new file mode 100644 index 0000000000..c7dace4424 --- /dev/null +++ b/types/caseless/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "caseless-tests.ts" + ] +} diff --git a/types/caseless/tslint.json b/types/caseless/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/caseless/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e8dd3f5ab1f3588a362de73c0081e7f7c53de094 Mon Sep 17 00:00:00 2001 From: 0x6368656174 <0x6368656174@gmail.com> Date: Sun, 24 Dec 2017 16:34:12 +1000 Subject: [PATCH 215/890] remove I prefix --- types/siema/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/siema/index.d.ts b/types/siema/index.d.ts index 6da4178e9b..8c1739d58c 100644 --- a/types/siema/index.d.ts +++ b/types/siema/index.d.ts @@ -8,7 +8,7 @@ export default class Siema { currentSlide: number; - constructor(options?: ISiemaOptions); + constructor(options?: SiemaOptions); next(index?: number, callback?: () => void): void; prev(index?: number, callback?: () => void): void; @@ -20,15 +20,15 @@ export default class Siema { destroy(restoreMarkup?: boolean, callback?: () => void): void; } -export interface IPageInterface { +export interface PageInterface { [key: number]: number; } -export interface ISiemaOptions { +export interface SiemaOptions { selector?: string | HTMLElement; duration?: number; easing?: string; - perPage?: number | IPageInterface; + perPage?: number | PageInterface; startIndex?: number; draggable?: boolean; multipleDrag?: boolean; From 922ea86c8982610c3602f4c21fa1022f5d3e7a19 Mon Sep 17 00:00:00 2001 From: mtsg Date: Sun, 24 Dec 2017 16:15:17 +0900 Subject: [PATCH 216/890] Add type definitions for fs-readfile-promise. --- .../fs-readfile-promise-tests.ts | 32 +++++++++++++++++++ types/fs-readfile-promise/index.d.ts | 29 +++++++++++++++++ types/fs-readfile-promise/tsconfig.json | 24 ++++++++++++++ types/fs-readfile-promise/tslint.json | 1 + 4 files changed, 86 insertions(+) create mode 100644 types/fs-readfile-promise/fs-readfile-promise-tests.ts create mode 100644 types/fs-readfile-promise/index.d.ts create mode 100644 types/fs-readfile-promise/tsconfig.json create mode 100644 types/fs-readfile-promise/tslint.json diff --git a/types/fs-readfile-promise/fs-readfile-promise-tests.ts b/types/fs-readfile-promise/fs-readfile-promise-tests.ts new file mode 100644 index 0000000000..9bd1ac070c --- /dev/null +++ b/types/fs-readfile-promise/fs-readfile-promise-tests.ts @@ -0,0 +1,32 @@ +import * as readFile from "fs-readfile-promise"; + +declare const path: string; +declare const encoding: string; +declare const nullable: null; +declare const options: { encoding: string, flag: string }; + +async function testPathOnly() { + return readFile(path); +} +async function testPathEncoding() { + return readFile(path, encoding); +} +async function testPathNull() { + return readFile(path, nullable); +} +async function testPathOption() { + return readFile(path, options); +} + +testPathOnly() + .then(console.log) + .catch(console.log); +testPathEncoding() + .then(console.log) + .catch(console.log); +testPathNull() + .then(console.log) + .catch(console.log); +testPathOption() + .then(console.log) + .catch(console.log); diff --git a/types/fs-readfile-promise/index.d.ts b/types/fs-readfile-promise/index.d.ts new file mode 100644 index 0000000000..b2d6aeab61 --- /dev/null +++ b/types/fs-readfile-promise/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for fs-readfile-promise 3.0 +// Project: https://github.com/shinnn/fs-readfile-promise +// Definitions by: Motosugi Murata +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +import { PathLike } from "fs"; +type PathType = PathLike | number; +type OptionsType = { encoding: string; flag?: string; } | string; + +export = fsReadFilePromise; + +/** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ +declare function fsReadFilePromise(path: PathType, options: OptionsType): Promise; + +/** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + */ +declare function fsReadFilePromise(path: PathType, options?: null): Promise; + +declare namespace fsReadFilePromise { } diff --git a/types/fs-readfile-promise/tsconfig.json b/types/fs-readfile-promise/tsconfig.json new file mode 100644 index 0000000000..3496c329e5 --- /dev/null +++ b/types/fs-readfile-promise/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "fs-readfile-promise-tests.ts" + ] +} \ No newline at end of file diff --git a/types/fs-readfile-promise/tslint.json b/types/fs-readfile-promise/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/fs-readfile-promise/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 9daa98d1775dafe79f1eabbbb6172a65ee5aa367 Mon Sep 17 00:00:00 2001 From: sa Date: Sun, 24 Dec 2017 03:05:51 -0500 Subject: [PATCH 217/890] correct typings for twit --- types/twit/index.d.ts | 21 ++++++++++++++++----- types/twit/twit-tests.ts | 6 ++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 337a51b476..91d683833e 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for twit 2.2 // Project: https://github.com/ttezel/twit // Definitions by: Volox +// lostfictions // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -208,12 +209,22 @@ declare module 'twit' { query?: string, max_id_str?: string } + + export interface Errors { + errors: { + code: number + message: string + }[] + } + + export interface SearchResults { + statuses: Twitter.Status[], + search_metadata: Twitter.Metadata, + } } - export interface Response { - statuses: Twitter.Status[], - search_metadata: Twitter.Metadata, - } + export type Response = object + interface MediaParam { file_path: string } @@ -250,7 +261,7 @@ declare module 'twit' { } export interface PromiseResponse { data: Response, - responde: IncomingMessage, + resp: IncomingMessage, } export interface Callback { (err: Error, result: Response, response: IncomingMessage): void diff --git a/types/twit/twit-tests.ts b/types/twit/twit-tests.ts index e346771f35..c74f5d6855 100644 --- a/types/twit/twit-tests.ts +++ b/types/twit/twit-tests.ts @@ -5,3 +5,9 @@ const t = new Twit( { consumer_secret: '', app_only_auth: true, } ); + +t.post('statuses/update', { status: 'hello!' }).then(res => { + const status = res.data as Twit.Twitter.Status + console.log(status.id_str) + console.log(res.resp.statusCode) +}) From 281c89468c1aa0bfbbccaccfd618e377e0b203b6 Mon Sep 17 00:00:00 2001 From: downace Date: Sun, 24 Dec 2017 18:26:16 +0900 Subject: [PATCH 218/890] [@types/caseless] exposed Caseless interface --- types/caseless/caseless-tests.ts | 33 ++++++++++++++++++-------------- types/caseless/index.d.ts | 3 +-- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/types/caseless/caseless-tests.ts b/types/caseless/caseless-tests.ts index 941a5afb72..2fb16afaad 100644 --- a/types/caseless/caseless-tests.ts +++ b/types/caseless/caseless-tests.ts @@ -1,4 +1,9 @@ -import caseless, { httpify } from "caseless"; +import caseless, { Caseless, httpify } from "caseless"; + +new Caseless(); // $ExpectError + +// tslint:disable-next-line: prefer-const +let c1: Caseless; caseless(); // $ExpectType Caseless caseless({}); // $ExpectType Caseless @@ -6,24 +11,24 @@ caseless(null); // $ExpectError caseless(1); // $ExpectError caseless("2"); // $ExpectError -const c = caseless(); +const c2 = caseless(); -c.set({}); // $ExpectType void -c.set('foo', 'bar'); // $ExpectType string | false -c.set('foo', 'bar', false); // $ExpectType string | false -c.set('foo', new Date()); // $ExpectType string | false -c.set(10, 'bar'); // $ExpectError +c2.set({}); // $ExpectType void +c2.set('foo', 'bar'); // $ExpectType string | false +c2.set('foo', 'bar', false); // $ExpectType string | false +c2.set('foo', new Date()); // $ExpectType string | false +c2.set(10, 'bar'); // $ExpectError -c.get('foo'); // $ExpectType any -c.get(10); // $ExpectError +c2.get('foo'); // $ExpectType any +c2.get(10); // $ExpectError -c.has('foo'); // $ExpectType string | false -c.has(10); // $ExpectError +c2.has('foo'); // $ExpectType string | false +c2.has(10); // $ExpectError -c.swap('foo'); // $ExpectType void -c.swap(10); // $ExpectError +c2.swap('foo'); // $ExpectType void +c2.swap(10); // $ExpectError -c.del('foo'); // $ExpectType boolean +c2.del('foo'); // $ExpectType boolean httpify(null, {}); // $ExpectError httpify(1, {}); // $ExpectError diff --git a/types/caseless/index.d.ts b/types/caseless/index.d.ts index 9cbf874e84..db295a8f89 100644 --- a/types/caseless/index.d.ts +++ b/types/caseless/index.d.ts @@ -8,8 +8,7 @@ type KeyType = string; type ValueType = any; type RawDict = object; -declare class Caseless { - constructor(dict?: RawDict); +export interface Caseless { set(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false; set(dict: RawDict): void; has(name: KeyType): KeyType | false; From a7f3f6fe3457a2ef1ad74c7495e723ff3fb0fd26 Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Mon, 25 Dec 2017 10:02:21 +0800 Subject: [PATCH 219/890] update code for jsdoc --- types/mirrorx/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 986287c5ad..66f85e14e7 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -111,8 +111,6 @@ export interface defaultOptions { } export interface Renderer { - // Deprecated(render): The return value is deprecated. - // In future releases the render function's return type will be void. ( element: React.DOMElement, T>, container: Element | null, From 4567db0f97b596e79374446ad76c91cbdabe7757 Mon Sep 17 00:00:00 2001 From: Timur Manyanov Date: Mon, 25 Dec 2017 15:56:21 +0100 Subject: [PATCH 220/890] Add @types/lasso definitions --- types/lasso/index.d.ts | 53 +++++++ types/lasso/lasso-tests.ts | 201 +++++++++++++++++++++++++++ types/lasso/lib/Lasso.d.ts | 79 +++++++++++ types/lasso/lib/LassoContext.d.ts | 21 +++ types/lasso/lib/LassoPageResult.d.ts | 32 +++++ types/lasso/lib/dependencies.d.ts | 112 +++++++++++++++ types/lasso/middleware.d.ts | 9 ++ types/lasso/node-require-no-op.d.ts | 1 + types/lasso/tsconfig.json | 29 ++++ types/lasso/tslint.json | 3 + 10 files changed, 540 insertions(+) create mode 100644 types/lasso/index.d.ts create mode 100644 types/lasso/lasso-tests.ts create mode 100644 types/lasso/lib/Lasso.d.ts create mode 100644 types/lasso/lib/LassoContext.d.ts create mode 100644 types/lasso/lib/LassoPageResult.d.ts create mode 100644 types/lasso/lib/dependencies.d.ts create mode 100644 types/lasso/middleware.d.ts create mode 100644 types/lasso/node-require-no-op.d.ts create mode 100644 types/lasso/tsconfig.json create mode 100644 types/lasso/tslint.json diff --git a/types/lasso/index.d.ts b/types/lasso/index.d.ts new file mode 100644 index 0000000000..64546a91c3 --- /dev/null +++ b/types/lasso/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for lasso 2.4 +// Project: https://github.com/lasso-js/lasso +// Definitions by: Timur Manyanov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import Lasso, { LassoConfig, LassoResource, LassoPage } from './lib/Lasso'; +import LassoContext from './lib/LassoContext'; + +export namespace transforms { + function createTransformer(unfilteredTransforms: any[], lassoContext: LassoContext, callback: (err: Error | null, result?: any) => any): void; +} + +export namespace writers { + interface Writer { + lasso: Lasso; + config: LassoConfig; + } + + function Writer(impl: any): Writer; + function fileWriter(fileWriterConfig: any, lassoConfig: LassoConfig): any; + function createWriter(impl: any): Writer; +} + +export const defaultConfig: LassoConfig; + +export const defaultConfigBaseDir: string; + +export const defaultConfigFilename: string | null; + +export const lassoPage: LassoPage; + +export const lassoResource: LassoResource; + +export function getDefaultLasso(): Lasso; + +export function create(config?: LassoConfig | string, baseDir?: string, filename?: string): Lasso; + +export function configure(config?: LassoConfig | string, baseDir?: string, filename?: string): void; + +export function setDevelopmentMode(): void; + +export function createFlagSet(flags: any): any; + +export function isFlagSet(o: any): boolean; + +export function flushAllCaches(callback?: any): void; + +export function handleWatchedFileChanged(path: string): void; + +export function clearCaches(): void; + +export function getClientPath(path: string, options?: any): string; diff --git a/types/lasso/lasso-tests.ts b/types/lasso/lasso-tests.ts new file mode 100644 index 0000000000..bc944817ee --- /dev/null +++ b/types/lasso/lasso-tests.ts @@ -0,0 +1,201 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import { transforms, configure, create, lassoPage, getDefaultLasso } from 'lasso'; +import { serveStatic } from 'lasso/middleware'; +import { enable } from 'lasso/node-require-no-op'; +import LassoContext from 'lasso/lib/LassoContext'; +import LassoPageResult from 'lasso/lib/LassoPageResult'; + +// $ExpectType void +configure('lasso-config.json'); + +// $ExpectType void +configure({}); + +// $ExpectType Lasso +create({}); + +const lasso = getDefaultLasso(); +// $ExpectType Lasso +lasso; + +// $ExpectType Promise +lassoPage({ + name: 'my-page', + dependencies: [ + './style.less', + 'require-run: ./main' + ] +}, +(err, lassoPageResult) => { + if (err) { + console.log('Failed to lasso page: ', err); + return; + } + + // $ExpectType string + lassoPageResult.getHeadHtml(); + + // $ExpectType string + lassoPageResult.getBodyHtml(); +}); + +lassoPage({ + dependencies: [{ + path: './hello-mobile.js', + 'if-flag': 'mobile' + }], + flags: ['mobile', 'foo', 'bar'] +}); + +configure({ + cspNonceProvider(out) { + const res = out.stream; + + return res.csp && res.csp.nonce; + } +}); + +configure({ + require: { + extensions: [ '.js' ], + transforms: [ 'deamdify' ] + } +}); + +// $ExpectType Lasso +lasso.on('afterLassoPage', (event) => { + const lassoPageResult: LassoPageResult = event.result; + const fingerprints = lassoPageResult.getInlineCodeFingerprints(); + // $ExpectType string + fingerprints.map(fingerprint => `script-src 'self' 'sha256-${fingerprint}'`).join('; '); +}); + +const dependencies = lasso.dependencies; + +// $ExpectType void +dependencies.registerJavaScriptType('my-js-type', require('./dependency-my-js-type')); // tslint:disable-line: no-var-requires + +// $ExpectType void +dependencies.registerJavaScriptType('my-custom-type', { + properties: { + path: 'string' + }, + + init(context: any, callback: any) { + if (!this.path) { + throw new Error('"path" is required'); + } + + this.path = this.resolvePath(this.path); + callback(); + }, + + read(context: any, callback: any) { + const path = this.path; + + fs.readFile(path, {encoding: 'utf8'}, (err, src) => { + if (err) { + return callback(err); + } + + // myCompiler.compile(src, callback); + }); + }, + + getSourceFile() { + return this.path; + } +}); + +// $ExpectType void +dependencies.registerStyleSheetType('my-custom-type', {}); + +// $ExpectType void +dependencies.registerPackageType('dir', { + properties: { + path: 'string' + }, + + init(context: any, callback: any) { + let path = this.path; + + if (!path) { + callback(new Error('"path" is required')); + } + + this.path = path = this.resolvePath(path); + + fs.stat(path, (err, stat) => { + if (err) { + return callback(err); + } + + if (!stat.isDirectory()) { + return callback(new Error('Directory expected: ' + path)); + } + + callback(); + }); + }, + + getDependencies(context: any, callback: any) { + const dir = this.path; + + fs.readdir(dir, (err, filenames) => { + if (err) { + return callback(err); + } + + const dependencies = filenames.map(filename => path.join(dir, filename)); + + callback(null, dependencies); + }); + }, + + getDir() { + return this.path; + } +}); + +// $ExpectType void +dependencies.registerRequireExtension('test', (path: string, context: any, callback: any) => { + callback(null, "exports.sayHello = function() { console.log('Hello!'); }"); +}); + +// $ExpectType void +lasso.lassoResource('path/to/foo.png', (err: any, result: any) => { + if (err) { + console.log(err); + } else { + const url = result.url; + } +}); + +// $ExpectType void +lasso.addTransform(require('./my-transform')); // tslint:disable-line: no-var-requires + +// $ExpectType void +lasso.addTransform({ + contentType: 'js', + name: module.id, + stream: false, + transform(code: string, lassoContext: LassoContext) { + return code.toUpperCase(); + } +}); + +// $ExpectType void +transforms.createTransformer([], new LassoContext(), (err, result) => {}); + +// $ExpectType RequestHandler +serveStatic(); + +// $ExpectType RequestHandler +serveStatic({ + lasso, + sendOptions: {} +}); + +// $ExpectType void +enable(); diff --git a/types/lasso/lib/Lasso.d.ts b/types/lasso/lib/Lasso.d.ts new file mode 100644 index 0000000000..56e0d195f5 --- /dev/null +++ b/types/lasso/lib/Lasso.d.ts @@ -0,0 +1,79 @@ +/// + +import { EventEmitter } from 'events'; +import LassoContext from './LassoContext'; +import { Bundle, DependencyConfig, DependencyRegistry } from './dependencies'; +import { writers } from '../index'; +import LassoPageResult from './LassoPageResult'; + +export interface PageConfig { + name?: string; + dependencies: DependencyConfig[] | string[] | string | null; + flags?: string[]; + from?: string; + packagePath?: string; + packagePaths?: string[]; + lassoContext?: LassoContext; + cache?: any; + cacheKey?: string; + pageName?: string; + data?: any; +} + +export type Callback = (err: Error | null, result?: any) => any; +export type LassoPage = (options: PageConfig, callback?: (err: Error | null, result: LassoPageResult) => void) => Promise; +export type LassoResource = (path: string, options?: any, callback?: Callback) => void; + +export interface CustomPlugin { + plugin: string; + config: any; +} + +export interface LassoConfig { + baseDir?: string; + plugins?: string[] | CustomPlugin[]; + require?: any; + outputDir?: string; + urlPrefix?: string; + fingerprintsEnabled?: boolean; + includeSlotNames?: boolean; + minify?: boolean; + minifyJS?: boolean; + minifyCSS?: boolean; + minifyInlineOnly?: boolean; + minifyInlineJSOnly?: boolean; + minifyInlineCSSOnly?: boolean; + resolveCssUrls?: boolean; + relativeUrlsEnabled?: boolean; + bundlingEnabled?: boolean; + bundles?: Bundle[]; + noConflict?: string; + + cspNonceProvider?(out: any): string; + fingerprintInlineCode?(code: any): string; +} + +export default class Lasso extends EventEmitter { + constructor(config: LassoConfig); + + config: LassoConfig; + lassoCacheLookup: any; + dependencies: DependencyRegistry; + writer: writers.Writer; + + initPlugins(): void; + createAppBundleMappings(bundleSetConfig: any, lassoContext: LassoContext, callback: Callback): any; + buildPageBundles(options: any, lassoContext: LassoContext, callback: Callback): void; + getAppBundleMappingsCached(bundleSetConfig: any, lassoContext: LassoContext, callback: Callback): void; + buildLassoCacheKey(lassoContext: LassoContext): { value: string; parts: string[]; }; + getLassoCache(lassoContext: LassoContext): any; + getConfig(): LassoConfig; + getJavaScriptDependencyHtml(url: string, attributes?: any): string; + getCSSDependencyHtml(url: string, attributes?: any): string; + createLassoContext(options?: any): LassoContext; + setCSPNonceProvider(func: any): any; + addTransform(transform: any): void; + getDependencyRegistry(): DependencyRegistry; + lassoPage: LassoPage; + lassoResource: LassoResource; +} diff --git a/types/lasso/lib/LassoContext.d.ts b/types/lasso/lib/LassoContext.d.ts new file mode 100644 index 0000000000..ae01277558 --- /dev/null +++ b/types/lasso/lib/LassoContext.d.ts @@ -0,0 +1,21 @@ +/// +import { EventEmitter } from 'events'; +import Lasso from './Lasso'; +import { DependencyRegistry } from './dependencies'; +import { writers } from '../index'; + +export default class LassoContext extends EventEmitter { + constructor(); + + LassoContext: boolean; + basePath?: string; + contentType?: string; + data?: any; + dependencyRegistry: DependencyRegistry; + flags: any[]; + config: any; + writer: writers.Writer; + lasso: Lasso; + cache: any; + options: any; +} diff --git a/types/lasso/lib/LassoPageResult.d.ts b/types/lasso/lib/LassoPageResult.d.ts new file mode 100644 index 0000000000..8d51ae052f --- /dev/null +++ b/types/lasso/lib/LassoPageResult.d.ts @@ -0,0 +1,32 @@ +import LassoContext from './LassoContext'; + +export default interface LassoPageResult { + addFile(filePath: string, contentType: string, isAsync: boolean, slot: any): void; + addUrl(url: string, slot: any, contentType: string, isAsync: boolean): void; + deserialize(reader: any, callback: any): void; + getBodyHtml(data?: any): string; + getCSSFiles(): any[]; + getCSSUrls(): any[]; + getFileByAsyncBundleName(bundleName: string): any; + getFileByBundleName(bundleName: string): any; + getFilePathsByContentType(...args: any[]): void; + getHeadHtml(data?: any): string; + getHtmlBySlot(): any; + getHtmlForSlot(slotName: string, data?: any): any; + getInlineCodeFingerprints(): string[]; + getJavaScriptFiles(): any[]; + getJavaScriptUrls(): any[]; + getOutputFiles(): any[]; + getOutputFilesWithInfo(...args: any[]): void; + getSlotHtml(slotName: string, data?: any): any; + getUrlByAsyncBundleName(bundleName: string): any; + getUrlByBundleName(bundleName: string): any; + getUrlsForSlot(slot: any): any; + htmlSlotsToJSON(indentation: any): any; + registerBundle(bundle: any, async: any, lassoContext: LassoContext): void; + registerResource(resource: any): void; + serialize(lassoPageResult: LassoPageResult): any; + setHtmlBySlot(htmlBySlot: any): void; + setInlineCodeFingerprints(inlineCodeFingerprints: string[]): void; + toJSON(): any; +} diff --git a/types/lasso/lib/dependencies.d.ts b/types/lasso/lib/dependencies.d.ts new file mode 100644 index 0000000000..682b6b3c30 --- /dev/null +++ b/types/lasso/lib/dependencies.d.ts @@ -0,0 +1,112 @@ +/// + +import LassoContext from './LassoContext'; +import { EventEmitter } from 'events'; + +export type Callback = (err: Error | null, result?: any) => any; + +export interface Bundle { + name: string; + dependencies: Array; +} + +export interface DependencyConfig { + type?: string; + attributes?: { + integrity: string; + crossorigin: string; + }; + inline?: string; + slot?: string; + 'css-slot'?: string; + 'js-slot'?: string; + url?: string; + path?: string; + external?: boolean; + 'if-flag'?: string; + 'if-not-flag'?: string; + if?: string; + from?: string; + to?: string; + require?: string; + 'require-run'?: string; + dependencies?: Array; +} + +export interface Dependency extends EventEmitter, DependencyConfig { + _packageDependency?: boolean; + contentType?: string; + properties?: { [key: string]: string }; + + (dependencyConfig: DependencyConfig, dirname: string, filename?: string): Dependency; + calculateKey(lassoContext: LassoContext, callback: Callback): any; + doCalculateKey(lassoContext: LassoContext, callback: Callback): any; + calculateKeyFromProps(): string; + createPackageManifest(manifest?: any, dirname?: string, filename?: string): any; + createReadStream(lassoContext: LassoContext): any; + doGetLastModified(lassoContext: any, callback: Callback): any; + getContentType(): any; + getDefaultBundleName(pageBundleName?: string, lassoContext?: LassoContext): string; + getDir(): string | null; + getFileLastModified(path: string, callback: Callback): any; + getJavaScriptSlot(): any; + getKey(): any; + getLastModified(lassoContext: LassoContext, callback: Callback): any; + getPackageManifest(lassoContext: LassoContext, callback: Callback): any; + getParentManifestDir(): string; + getParentManifestPath(): string; + getPropsKey(): any; + getReadCacheKey(): any; + getSlot(): any; + getSourceFile(): any; + getStyleSheetSlot(): any; + hasContent(): boolean; + hasModifiedFingerprint(): boolean; + init(lassoContext: LassoContext, callback: Callback): any; + doInit(lassoContext: LassoContext, callback: Callback): void; + inspect(): any; + isCompiled(): boolean; + isExternalResource(): boolean; + isInPlaceDeploymentAllowed(): boolean; + isJavaScript(): boolean; + isPackageDependency(): boolean; + isPageBundleOnlyDependency(): boolean; + isStyleSheet(): boolean; + onAddToAsyncPageBundle(bundle: Bundle, lassoContext: LassoContext): void; + onAddToPageBundle(bundle: Bundle, lassoContext: LassoContext): void; + read(context: any, callback: Callback): any; + resolvePath(path: string, from?: string): string; + set(props: any): void; + shouldCache(lassoContext: LassoContext): boolean; +} + +export interface DependencyRegistry { + registeredTypes: any; + extensions: any; + requireExtensions: any; + requireExtensionNames: any; + + addNormalizer(normalizerFunc: any): any; + createDependency(config: any, dirname: string, filename?: string): any; + createRequireHandler(path: string, lassoContext: LassoContext, userOptions: any): any; + createResourceTransformType(transformFunc: any): any; + getRequireExtensionNames(): any; + getRequireHandler(path: string, lassoContext: LassoContext): any; + getType(type: string): any; + normalizeDependencies(dependencies: any[], dirname: string, filename: string, callback: Callback): any; + registerDefaults(): void; + registerExtension(extension: string, type: string): void; + registerJavaScriptType(type: string, mixins: any): void; + registerPackageType(type: string, mixins: any): void; + registerRequireExtension(ext: string, options: any): void; + registerRequireType(type: string, options: any): void; + registerStyleSheetType(type: string, mixins: any): void; + registerType(type: string, mixins: any): void; + typeForPath(path: string): string; +} + +export function createRegistry(): DependencyRegistry; + +export function isRegistry(o: any): boolean; + +export function isDependency(d: any): boolean; diff --git a/types/lasso/middleware.d.ts b/types/lasso/middleware.d.ts new file mode 100644 index 0000000000..948de1a03f --- /dev/null +++ b/types/lasso/middleware.d.ts @@ -0,0 +1,9 @@ +import { RequestHandler } from 'express'; +import Lasso from './lib/Lasso'; + +export interface MiddlewareOptions { + lasso?: Lasso; + sendOptions?: any; +} + +export function serveStatic(options?: MiddlewareOptions): RequestHandler; diff --git a/types/lasso/node-require-no-op.d.ts b/types/lasso/node-require-no-op.d.ts new file mode 100644 index 0000000000..713a4aafe4 --- /dev/null +++ b/types/lasso/node-require-no-op.d.ts @@ -0,0 +1 @@ +export function enable(...extensions: string[]): void; diff --git a/types/lasso/tsconfig.json b/types/lasso/tsconfig.json new file mode 100644 index 0000000000..2386e1e1f5 --- /dev/null +++ b/types/lasso/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "lasso-tests.ts", + "middleware.d.ts", + "node-require-no-op.d.ts", + "lib/dependencies.d.ts", + "lib/Lasso.d.ts", + "lib/LassoContext.d.ts" + ] +} diff --git a/types/lasso/tslint.json b/types/lasso/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/lasso/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From c3ae4fe64d21e41ed384aa390ef5523d25049645 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Mon, 25 Dec 2017 16:13:34 +0100 Subject: [PATCH 221/890] add typings for ansi-colors --- types/ansi-colors/ansi-colors-tests.ts | 30 +++++++++++++++++++++++++ types/ansi-colors/index.d.ts | 31 ++++++++++++++++++++++++++ types/ansi-colors/tsconfig.json | 23 +++++++++++++++++++ types/ansi-colors/tslint.json | 1 + 4 files changed, 85 insertions(+) create mode 100644 types/ansi-colors/ansi-colors-tests.ts create mode 100644 types/ansi-colors/index.d.ts create mode 100644 types/ansi-colors/tsconfig.json create mode 100644 types/ansi-colors/tslint.json diff --git a/types/ansi-colors/ansi-colors-tests.ts b/types/ansi-colors/ansi-colors-tests.ts new file mode 100644 index 0000000000..9a9afc43f4 --- /dev/null +++ b/types/ansi-colors/ansi-colors-tests.ts @@ -0,0 +1,30 @@ +import * as colors from 'ansi-colors'; + +let s: string; + +s = colors.bgblack("hello"); +s = colors.bgblue("hello"); +s = colors.bgcyan("hello"); +s = colors.bggreen("hello"); +s = colors.bgmagenta("hello"); +s = colors.bgred("hello"); +s = colors.bgwhite("hello"); +s = colors.bgyellow("hello"); +s = colors.black("hello"); +s = colors.blue("hello"); +s = colors.bold("hello"); +s = colors.cyan("hello"); +s = colors.dim("hello"); +s = colors.gray("hello"); +s = colors.green("hello"); +s = colors.grey("hello"); +s = colors.hidden("hello"); +s = colors.inverse("hello"); +s = colors.italic("hello"); +s = colors.magenta("hello"); +s = colors.red("hello"); +s = colors.reset("hello"); +s = colors.strikethrough("hello"); +s = colors.underline("hello"); +s = colors.white("hello"); +s = colors.yellow("hello"); diff --git a/types/ansi-colors/index.d.ts b/types/ansi-colors/index.d.ts new file mode 100644 index 0000000000..092c4c1f2b --- /dev/null +++ b/types/ansi-colors/index.d.ts @@ -0,0 +1,31 @@ +// Type definitions for ansi-colors 1.0 +// Project: https://github.com/doowb/ansi-colors +// Definitions by: Rogier Schouten +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function bgblack(s: string): string; +export function bgblue(s: string): string; +export function bgcyan(s: string): string; +export function bggreen(s: string): string; +export function bgmagenta(s: string): string; +export function bgred(s: string): string; +export function bgwhite(s: string): string; +export function bgyellow(s: string): string; +export function black(s: string): string; +export function blue(s: string): string; +export function bold(s: string): string; +export function cyan(s: string): string; +export function dim(s: string): string; +export function gray(s: string): string; +export function green(s: string): string; +export function grey(s: string): string; +export function hidden(s: string): string; +export function inverse(s: string): string; +export function italic(s: string): string; +export function magenta(s: string): string; +export function red(s: string): string; +export function reset(s: string): string; +export function strikethrough(s: string): string; +export function underline(s: string): string; +export function white(s: string): string; +export function yellow(s: string): string; diff --git a/types/ansi-colors/tsconfig.json b/types/ansi-colors/tsconfig.json new file mode 100644 index 0000000000..8a0f980cbc --- /dev/null +++ b/types/ansi-colors/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ansi-colors-tests.ts" + ] +} diff --git a/types/ansi-colors/tslint.json b/types/ansi-colors/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ansi-colors/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From ff530246cf07b797175efc8d2d49ca556d9e2146 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Mon, 25 Dec 2017 16:28:52 +0100 Subject: [PATCH 222/890] Add typings for plugin-error --- types/plugin-error/index.d.ts | 58 ++++++++++++++++++++++++ types/plugin-error/plugin-error-tests.ts | 23 ++++++++++ types/plugin-error/tsconfig.json | 23 ++++++++++ types/plugin-error/tslint.json | 1 + 4 files changed, 105 insertions(+) create mode 100644 types/plugin-error/index.d.ts create mode 100644 types/plugin-error/plugin-error-tests.ts create mode 100644 types/plugin-error/tsconfig.json create mode 100644 types/plugin-error/tslint.json diff --git a/types/plugin-error/index.d.ts b/types/plugin-error/index.d.ts new file mode 100644 index 0000000000..87aa892832 --- /dev/null +++ b/types/plugin-error/index.d.ts @@ -0,0 +1,58 @@ +// Type definitions for plugin-error 0.1 +// Project: https://github.com/jonschlinkert/plugin-error +// Definitions by: Rogier Schouten +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'plugin-error' { + namespace PluginError { + interface PluginErrorOpts { + /** + * By default the stack will not be shown. Set options.showStack to true if you think the stack is important for your error. + */ + showStack?: boolean; + /** + * Error properties will be included in err.toString(), but may be omitted by including {showProperties: false} in the options + */ + showProperties?: boolean; + } + + interface PluginErrorOpts2 extends PluginErrorOpts { + /** + * If you pass an error object as the message the stack will be pulled from that, otherwise one will be created. + */ + message?: string | Error; + } + + interface PluginErrorOpts3 extends PluginErrorOpts2 { + /** + * The name of the plugin + */ + plugin?: string; + } + } + + class PluginError extends Error { + /** + * Constructor + * @param pluginName + * @param message If you pass an error object as the message the stack will be pulled from that, otherwise one will be created. + * @param options + */ + constructor(pluginName: string, message: string | Error, options?: PluginError.PluginErrorOpts); + + /** + * Constructor + * @param pluginName + * @param options + */ + constructor(pluginName: string, options: PluginError.PluginErrorOpts2); + + /** + * Constructor + * @param options + */ + constructor(options: PluginError.PluginErrorOpts3); + } + + export = PluginError; +} diff --git a/types/plugin-error/plugin-error-tests.ts b/types/plugin-error/plugin-error-tests.ts new file mode 100644 index 0000000000..590e8db0fc --- /dev/null +++ b/types/plugin-error/plugin-error-tests.ts @@ -0,0 +1,23 @@ +import * as PluginError from 'plugin-error'; + +let e: PluginError; + +// string message +e = new PluginError('my-plugin', 'message'); +e = new PluginError('my-plugin', 'message', { showProperties: false, showStack: false }); +e = new PluginError('my-plugin', { showProperties: false, showStack: false, message: 'message' }); +e = new PluginError({ showProperties: false, showStack: false, message: 'message', plugin: 'my-plugin' }); + +// error instead of message +e = new PluginError('my-plugin', new Error('message')); +e = new PluginError('my-plugin', new Error('message'), { showProperties: false, showStack: false }); +e = new PluginError('my-plugin', { showProperties: false, showStack: false, message: new Error('message') }); +e = new PluginError({ showProperties: false, showStack: false, message: new Error('message'), plugin: 'my-plugin' }); + +// without non-mandatory options +e = new PluginError('my-plugin', 'message', {}); +e = new PluginError('my-plugin', { message: 'message' }); +e = new PluginError({ message: 'message', plugin: 'my-plugin' }); + +// check Error base class +const f: Error = e; diff --git a/types/plugin-error/tsconfig.json b/types/plugin-error/tsconfig.json new file mode 100644 index 0000000000..ee9cd8e61f --- /dev/null +++ b/types/plugin-error/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "plugin-error-tests.ts" + ] +} diff --git a/types/plugin-error/tslint.json b/types/plugin-error/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/plugin-error/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 18f1ee49d491ac198364cced85d002c29528705a Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Mon, 25 Dec 2017 16:45:32 +0100 Subject: [PATCH 223/890] Attempt at fixing travis errors. --- types/plugin-error/index.d.ts | 88 +++++++++++++++++----------------- types/plugin-error/tslint.json | 7 ++- 2 files changed, 49 insertions(+), 46 deletions(-) diff --git a/types/plugin-error/index.d.ts b/types/plugin-error/index.d.ts index 87aa892832..9f1d8833c5 100644 --- a/types/plugin-error/index.d.ts +++ b/types/plugin-error/index.d.ts @@ -3,56 +3,54 @@ // Definitions by: Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module 'plugin-error' { - namespace PluginError { - interface PluginErrorOpts { - /** - * By default the stack will not be shown. Set options.showStack to true if you think the stack is important for your error. - */ - showStack?: boolean; - /** - * Error properties will be included in err.toString(), but may be omitted by including {showProperties: false} in the options - */ - showProperties?: boolean; - } +export = PluginError; - interface PluginErrorOpts2 extends PluginErrorOpts { - /** - * If you pass an error object as the message the stack will be pulled from that, otherwise one will be created. - */ - message?: string | Error; - } - - interface PluginErrorOpts3 extends PluginErrorOpts2 { - /** - * The name of the plugin - */ - plugin?: string; - } +declare namespace PluginError { + export interface PluginErrorOpts { + /** + * By default the stack will not be shown. Set options.showStack to true if you think the stack is important for your error. + */ + showStack?: boolean; + /** + * Error properties will be included in err.toString(), but may be omitted by including {showProperties: false} in the options + */ + showProperties?: boolean; } - class PluginError extends Error { + export interface PluginErrorOpts2 extends PluginErrorOpts { /** - * Constructor - * @param pluginName - * @param message If you pass an error object as the message the stack will be pulled from that, otherwise one will be created. - * @param options + * If you pass an error object as the message the stack will be pulled from that, otherwise one will be created. */ - constructor(pluginName: string, message: string | Error, options?: PluginError.PluginErrorOpts); - - /** - * Constructor - * @param pluginName - * @param options - */ - constructor(pluginName: string, options: PluginError.PluginErrorOpts2); - - /** - * Constructor - * @param options - */ - constructor(options: PluginError.PluginErrorOpts3); + message?: string | Error; } - export = PluginError; + export interface PluginErrorOpts3 extends PluginErrorOpts2 { + /** + * The name of the plugin + */ + plugin?: string; + } +} + +declare class PluginError extends Error { + /** + * Constructor + * @param pluginName The name of your plugin + * @param message If you pass an error object as the message the stack will be pulled from that, otherwise one will be created. + * @param options Options + */ + constructor(pluginName: string, message: string | Error, options?: PluginError.PluginErrorOpts); + + /** + * Constructor + * @param pluginName The name of your plugin + * @param options Options, including message + */ + constructor(pluginName: string, options: PluginError.PluginErrorOpts2); + + /** + * Constructor + * @param options Options, including message and plugin name + */ + constructor(options: PluginError.PluginErrorOpts3); } diff --git a/types/plugin-error/tslint.json b/types/plugin-error/tslint.json index 3db14f85ea..4c4fc86ace 100644 --- a/types/plugin-error/tslint.json +++ b/types/plugin-error/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "strict-export-declare-modifiers": false + } +} From 60af25b105bdd2b1040366153a14d01502abea3a Mon Sep 17 00:00:00 2001 From: bobby77 Date: Tue, 26 Dec 2017 16:02:27 +0100 Subject: [PATCH 224/890] Update index.d.ts Changed error in "transform" and "inverseTransform" return type: Point instead of Matrix (L307) Changed error in clone parameters : object instead of boolean (L1358-1360) --- types/paper/index.d.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index 64d961ed10..2c78fd6e6d 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -290,7 +290,7 @@ declare module paper { * Transforms a point and returns the result. * @param point - the point to be transformed */ - transform(point: Point): Matrix; + transform(point: Point): Point; /** * Transforms an array of coordinates by this matrix and stores the results into the destination array, which is also returned. @@ -304,7 +304,7 @@ declare module paper { * Inverse transforms a point and returns the result. * @param point - the point to be transformed */ - inverseTransform(point: Point): Matrix; + inverseTransform(point: Point): Point; /** * Attempts to decompose the affine transformation described by this matrix into scaling, rotation and shearing, and returns an object with these properties if it succeeded, null otherwise. @@ -1353,9 +1353,11 @@ declare module paper { /** * Clones the item within the same project and places the copy above the item. - * @param insert [optional] - specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options [optional] - object with 2 parameters + * insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * deep: specifies whether the item’s children should also be cloned — default: true */ - clone(insert?: boolean): Item; + clone(options?: any): Item; /** * When passed a project, copies the item to the project, or duplicates it within the same project. When passed an item, copies the item into the specified item. From 9def24f9416b57f59d133c990c6d6fd3fae2e3ec Mon Sep 17 00:00:00 2001 From: GlenCFL Date: Sun, 24 Dec 2017 23:15:03 -0500 Subject: [PATCH 225/890] atom: support version 1.23 --- types/atom/atom-tests.ts | 23 ++++++++++++++--- types/atom/index.d.ts | 53 ++++++++++++++++++++++++++++++---------- 2 files changed, 60 insertions(+), 16 deletions(-) diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index f401b8e7fe..9bb03e4e60 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -277,6 +277,12 @@ function testCommandRegistry() { "test-function": (event) => event.currentTarget.getModel(), "test-function2": (event) => event.currentTarget.getComponent(), }); + atom.commands.add("atom-workspace", { + "test-command": { + didDispatch: (event) => {}, + hiddenInCommandPalette: true + } + }); const commands = atom.commands.findCommands({ target: element }); atom.commands.dispatch(element, "test:function"); @@ -515,6 +521,8 @@ function testDecoration() { // Decoration Details num = decoration.getId(); displayMarker = decoration.getMarker(); + bool = decoration.isType("line-number"); + bool = decoration.isType(["line-number", "line"]); // Properties const decorationProps = decoration.getProperties(); @@ -1077,6 +1085,7 @@ function testGrammarRegistry() { // Event Subscription subscription = registry.onDidAddGrammar(grammar => grammar.name); subscription = registry.onDidUpdateGrammar(grammar => grammar.name); + subscription = registry.onDidRemoveGrammar(grammar => grammar.name); // Managing Grammars grammars = registry.getGrammars(); @@ -1896,7 +1905,7 @@ function testSelection() { selection.insertText("Replacement", { undo: "skip" }); selection.insertText("Replacement", { select: true, autoIndent: true, autoIndentNewline: true, autoDecreaseIndent: true, normalizeLineEndings: true, - undo: "skip" }); + undo: "skip", preserveTrailingLineIndentation: false }); selection.backspace(); selection.deleteToPreviousWordBoundary(); @@ -1998,7 +2007,14 @@ function testTextBuffer() { // Event Subscription subscription = buffer.onWillChange(() => void {}); - subscription = buffer.onDidChange(() => void {}); + + subscription = buffer.onDidChange((event): void => { + range = event.newRange; + for (const change of event.changes) { + range = change.newRange; + } + }); + subscription = buffer.onDidChangeText(() => void {}); subscription = buffer.onDidStopChanging((event): void => { @@ -2389,7 +2405,8 @@ function testTextEditor() { editor.insertText("Test", { select: true }); editor.insertText("Test", { undo: "skip" }); editor.insertText("Text", { autoDecreaseIndent: false, autoIndent: false, - autoIndentNewline: false, normalizeLineEndings: false, select: false, undo: "skip" }); + autoIndentNewline: false, normalizeLineEndings: false, select: false, + undo: "skip", preserveTrailingLineIndentation: true }); editor.insertNewline(); editor.delete(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 461211786a..33c650d2c6 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Atom 1.22 +// Type definitions for Atom 1.23 // Project: https://github.com/atom/atom // Definitions by: GlenCFL // smhxx @@ -7,7 +7,7 @@ // TypeScript Version: 2.3 // NOTE: only those classes exported within this file should be retain that status below. -// https://github.com/atom/atom/blob/v1.22.0/exports/atom.js +// https://github.com/atom/atom/blob/v1.23.0/exports/atom.js /// /// @@ -268,6 +268,7 @@ export type CommandRegistryListener = { didDispatch(event: CommandEvent): void, displayName?: string, description?: string, + hiddenInCommandPalette?: boolean, } | ((event: CommandEvent) => void); /** @@ -280,6 +281,7 @@ export interface CommandRegistry { target: T, commandName: string, listener: CommandRegistryListener ): Disposable; + /** Register a single command. */ add( target: T, commandName: string, listener: CommandRegistryListener @@ -287,10 +289,11 @@ export interface CommandRegistry { /** Register multiple commands. */ add(target: T, commands: { - [key: string]: (event: CommandEvent) => void + [key: string]: CommandRegistryListener }): CompositeDisposable; + /** Register multiple commands. */ add(target: T, commands: { - [key: string]: (event: CommandEvent) => void + [key: string]: CommandRegistryListener }): CompositeDisposable; /** Find all registered commands matching a query. */ @@ -467,6 +470,14 @@ export interface Decoration { /** Returns the marker associated with this Decoration. */ getMarker(): DisplayMarker; + /** + * Check if this decoration is of the given type. + * @param type A decoration type, such as `line-number` or `line`. This may also + * be an array of decoration types, with isType returning true if the decoration's + * type matches any in the array. + */ + isType(type: string|string[]): boolean; + // Properties /** Returns the Decoration's properties. */ getProperties(): DecorationOptions; @@ -1483,14 +1494,7 @@ export class TextEditor { { normalizeLineEndings?: boolean, undo?: "skip" }): Range; /* For each selection, replace the selected text with the given text. */ - insertText(text: string, options?: { - select?: boolean, - autoIndent?: boolean, - autoIndentNewline?: boolean, - autoDecreaseIndent?: boolean, - normalizeLineEndings?: boolean, - undo?: "skip" - }): Range|boolean; + insertText(text: string, options?: TextInsertionOptions): Range|false; /** For each selection, replace the selected text with a newline. */ insertNewline(): void; @@ -3760,6 +3764,13 @@ export interface GrammarRegistry { */ onDidUpdateGrammar(callback: (grammar: Grammar) => void): Disposable; + /** + * Invoke the given callback when a grammar is removed from the registry. + * @param callback The callback to be invoked whenever a grammar is removed. + * @return A Disposable on which `.dispose()` can be called to unsubscribe. + */ + onDidRemoveGrammar(callback: (grammar: Grammar) => void): Disposable; + // Managing Grammars /** * Get all the grammars in this registry. @@ -5344,6 +5355,21 @@ export interface BufferChangingEvent { } export interface BufferChangedEvent { + /** + * An array of objects summarizing the aggregated changes that occurred + * during the transaction. + */ + changes: Array<{ + /** + * The Range of the deleted text in the contents of the buffer as it existed + * before the batch of changes reported by this event. + */ + oldRange: Range; + + /** The Range of the inserted text in the current contents of the buffer. */ + newRange: Range; + }>; + /** Range of the old text. */ oldRange: Range; @@ -5665,7 +5691,7 @@ export interface TextEditorObservedEvent { // information under certain contexts. // NOTE: the config schema with these defaults can be found here: -// https://github.com/atom/atom/blob/v1.22.0/src/config-schema.js +// https://github.com/atom/atom/blob/v1.23.0/src/config-schema.js /** * Allows you to strongly type Atom configuration variables. Additional key:value * pairings merged into this interface will result in configuration values under @@ -6269,6 +6295,7 @@ export interface TextInsertionOptions { autoIndent?: boolean; autoIndentNewline?: boolean; autoDecreaseIndent?: boolean; + preserveTrailingLineIndentation?: boolean; normalizeLineEndings?: boolean; undo?: "skip"; } From 40bacbfde090e928f888d2e5566437f6c5918f0a Mon Sep 17 00:00:00 2001 From: William Lohan Date: Tue, 26 Dec 2017 12:47:53 -0800 Subject: [PATCH 226/890] add provinces package --- types/provinces/index.d.ts | 39 ++++++++++++++++++++++++++++++ types/provinces/provinces-tests.ts | 16 ++++++++++++ types/provinces/tsconfig.json | 23 ++++++++++++++++++ types/provinces/tslint.json | 6 +++++ 4 files changed, 84 insertions(+) create mode 100644 types/provinces/index.d.ts create mode 100644 types/provinces/provinces-tests.ts create mode 100644 types/provinces/tsconfig.json create mode 100644 types/provinces/tslint.json diff --git a/types/provinces/index.d.ts b/types/provinces/index.d.ts new file mode 100644 index 0000000000..2601d14da4 --- /dev/null +++ b/types/provinces/index.d.ts @@ -0,0 +1,39 @@ +// Type definitions for provinces 1.11 +// Project: https://github.com/substack/provinces +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare global { + /** + * @see {@link https://github.com/substack/provinces#data-format} + */ + interface Province { + /** + * full name of the province or state + */ + name: string; + /** + * country abbreviation + */ + country: string; + /** + * optional 2 or 3 character short name + */ + short?: string; + /** + * optional array of additional names and abbreviations + */ + alt?: string[]; + /** + * optional region of a country (for example: "Wales") + */ + region?: string; + } +} + +/** + * @see {@link https://github.com/substack/provinces#methods} + */ +declare const provinces: Province[]; + +export = provinces; diff --git a/types/provinces/provinces-tests.ts b/types/provinces/provinces-tests.ts new file mode 100644 index 0000000000..cd81d2d36a --- /dev/null +++ b/types/provinces/provinces-tests.ts @@ -0,0 +1,16 @@ +import * as provinces from 'provinces'; + +provinces.forEach((province: Province) => { + // https://github.com/substack/provinces#data-format + let name: string; + let country: string; + let short: string; + let alt: string[]; + let region: string; + + name = province.name; + country = province.country; + short = province.short ? province.short : ''; + alt = province.alt ? province.alt : []; + region = province.region ? province.region : ''; +}); diff --git a/types/provinces/tsconfig.json b/types/provinces/tsconfig.json new file mode 100644 index 0000000000..d08b599b71 --- /dev/null +++ b/types/provinces/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "provinces-tests.ts" + ] +} diff --git a/types/provinces/tslint.json b/types/provinces/tslint.json new file mode 100644 index 0000000000..1e30988418 --- /dev/null +++ b/types/provinces/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-var-requires": false + } +} From 6e88f6eb9adf9c461404c7791a7348e9ee8c4159 Mon Sep 17 00:00:00 2001 From: GlenCFL Date: Tue, 26 Dec 2017 14:34:06 -0500 Subject: [PATCH 227/890] atom: document the properties of TextInsertionOptions. --- types/atom/index.d.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 33c650d2c6..b989671920 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -6291,12 +6291,33 @@ export interface SpawnProcessOptions { } export interface TextInsertionOptions { + /** If true, selects the newly added text. */ select?: boolean; + + /** If true, indents all inserted text appropriately. */ autoIndent?: boolean; + + /** If true, indent newline appropriately. */ autoIndentNewline?: boolean; + + /** + * If true, decreases indent level appropriately (for example, when a closing + * bracket is inserted). + */ autoDecreaseIndent?: boolean; + + /** + * By default, when pasting multiple lines, Atom attempts to preserve the relative + * indent level between the first line and trailing lines, even if the indent + * level of the first line has changed from the copied text. If this option is + * true, this behavior is suppressed. + */ preserveTrailingLineIndentation?: boolean; + + /** If true, all line endings will be normalized to match the editor's current mode. */ normalizeLineEndings?: boolean; + + /** If skip, skips the undo stack for this operation. */ undo?: "skip"; } From 4637a4f590cf677583ea9d6f59bb54699435b022 Mon Sep 17 00:00:00 2001 From: Timur Manyanov Date: Wed, 27 Dec 2017 17:04:30 +0100 Subject: [PATCH 228/890] Add more consistency with the real code --- types/lasso/index.d.ts | 48 +------------------------ types/lasso/lasso-tests.ts | 54 +++++++++++++++++++---------- types/lasso/lib/index.d.ts | 39 +++++++++++++++++++++ types/lasso/lib/writers/Writer.d.ts | 23 ++++++++++++ types/lasso/lib/writers/index.d.ts | 8 +++++ types/lasso/middleware.d.ts | 9 ----- types/lasso/middleware/index.d.ts | 4 +++ types/lasso/tsconfig.json | 9 +++-- types/lasso/tslint.json | 5 ++- 9 files changed, 121 insertions(+), 78 deletions(-) create mode 100644 types/lasso/lib/index.d.ts create mode 100644 types/lasso/lib/writers/Writer.d.ts create mode 100644 types/lasso/lib/writers/index.d.ts delete mode 100644 types/lasso/middleware.d.ts create mode 100644 types/lasso/middleware/index.d.ts diff --git a/types/lasso/index.d.ts b/types/lasso/index.d.ts index 64546a91c3..a29f0af431 100644 --- a/types/lasso/index.d.ts +++ b/types/lasso/index.d.ts @@ -4,50 +4,4 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import Lasso, { LassoConfig, LassoResource, LassoPage } from './lib/Lasso'; -import LassoContext from './lib/LassoContext'; - -export namespace transforms { - function createTransformer(unfilteredTransforms: any[], lassoContext: LassoContext, callback: (err: Error | null, result?: any) => any): void; -} - -export namespace writers { - interface Writer { - lasso: Lasso; - config: LassoConfig; - } - - function Writer(impl: any): Writer; - function fileWriter(fileWriterConfig: any, lassoConfig: LassoConfig): any; - function createWriter(impl: any): Writer; -} - -export const defaultConfig: LassoConfig; - -export const defaultConfigBaseDir: string; - -export const defaultConfigFilename: string | null; - -export const lassoPage: LassoPage; - -export const lassoResource: LassoResource; - -export function getDefaultLasso(): Lasso; - -export function create(config?: LassoConfig | string, baseDir?: string, filename?: string): Lasso; - -export function configure(config?: LassoConfig | string, baseDir?: string, filename?: string): void; - -export function setDevelopmentMode(): void; - -export function createFlagSet(flags: any): any; - -export function isFlagSet(o: any): boolean; - -export function flushAllCaches(callback?: any): void; - -export function handleWatchedFileChanged(path: string): void; - -export function clearCaches(): void; - -export function getClientPath(path: string, options?: any): string; +export * from './lib'; diff --git a/types/lasso/lasso-tests.ts b/types/lasso/lasso-tests.ts index bc944817ee..a41deb0aed 100644 --- a/types/lasso/lasso-tests.ts +++ b/types/lasso/lasso-tests.ts @@ -1,10 +1,13 @@ import * as fs from 'fs'; import * as path from 'path'; -import { transforms, configure, create, lassoPage, getDefaultLasso } from 'lasso'; -import { serveStatic } from 'lasso/middleware'; -import { enable } from 'lasso/node-require-no-op'; + +import { transforms, configure, create, lassoPage, getDefaultLasso, writers } from 'lasso'; import LassoContext from 'lasso/lib/LassoContext'; import LassoPageResult from 'lasso/lib/LassoPageResult'; +import { serveStatic } from 'lasso/middleware'; +import { enable } from 'lasso/node-require-no-op'; + +// configure() tests // $ExpectType void configure('lasso-config.json'); @@ -12,6 +15,23 @@ configure('lasso-config.json'); // $ExpectType void configure({}); +// $ExpectType void +configure({ + cspNonceProvider(out) { + const res = out.stream; + + return res.csp && res.csp.nonce; + } +}); + +// $ExpectType void +configure({ + require: { + extensions: [ '.js' ], + transforms: [ 'deamdify' ] + } +}); + // $ExpectType Lasso create({}); @@ -48,21 +68,6 @@ lassoPage({ flags: ['mobile', 'foo', 'bar'] }); -configure({ - cspNonceProvider(out) { - const res = out.stream; - - return res.csp && res.csp.nonce; - } -}); - -configure({ - require: { - extensions: [ '.js' ], - transforms: [ 'deamdify' ] - } -}); - // $ExpectType Lasso lasso.on('afterLassoPage', (event) => { const lassoPageResult: LassoPageResult = event.result; @@ -73,6 +78,8 @@ lasso.on('afterLassoPage', (event) => { const dependencies = lasso.dependencies; +// Register new types + // $ExpectType void dependencies.registerJavaScriptType('my-js-type', require('./dependency-my-js-type')); // tslint:disable-line: no-var-requires @@ -172,6 +179,8 @@ lasso.lassoResource('path/to/foo.png', (err: any, result: any) => { } }); +// Transformer tests + // $ExpectType void lasso.addTransform(require('./my-transform')); // tslint:disable-line: no-var-requires @@ -188,6 +197,8 @@ lasso.addTransform({ // $ExpectType void transforms.createTransformer([], new LassoContext(), (err, result) => {}); +// Middleware tests + // $ExpectType RequestHandler serveStatic(); @@ -197,5 +208,12 @@ serveStatic({ sendOptions: {} }); +// node-require-no-op tests + // $ExpectType void enable(); + +// Writer tests + +// $ExpectType Writer +writers.createWriter({}); diff --git a/types/lasso/lib/index.d.ts b/types/lasso/lib/index.d.ts new file mode 100644 index 0000000000..1331872c68 --- /dev/null +++ b/types/lasso/lib/index.d.ts @@ -0,0 +1,39 @@ +import Lasso, { LassoConfig, LassoPage, LassoResource } from './Lasso'; +import LassoContext from './LassoContext'; +import * as _writers from './writers'; + +export namespace transforms { + function createTransformer(unfilteredTransforms: any[], lassoContext: LassoContext, callback: (err: Error | null, result?: any) => any): void; +} + +export { _writers as writers }; + +export const defaultConfig: LassoConfig; + +export const defaultConfigBaseDir: string; + +export const defaultConfigFilename: string | null; + +export const lassoPage: LassoPage; + +export const lassoResource: LassoResource; + +export function getDefaultLasso(): Lasso; + +export function create(config?: LassoConfig | string, baseDir?: string, filename?: string): Lasso; + +export function configure(config?: LassoConfig | string, baseDir?: string, filename?: string): void; + +export function setDevelopmentMode(): void; + +export function createFlagSet(flags: any): any; + +export function isFlagSet(o: any): boolean; + +export function flushAllCaches(callback?: any): void; + +export function handleWatchedFileChanged(path: string): void; + +export function clearCaches(): void; + +export function getClientPath(path: string, options?: any): string; diff --git a/types/lasso/lib/writers/Writer.d.ts b/types/lasso/lib/writers/Writer.d.ts new file mode 100644 index 0000000000..1ebaa55f24 --- /dev/null +++ b/types/lasso/lib/writers/Writer.d.ts @@ -0,0 +1,23 @@ +import { EventEmitter } from 'events'; + +import Lasso, { LassoConfig } from '../Lasso'; +import LassoContext from '../LassoContext'; +import { Bundle } from '../dependencies'; + +export default interface Writer extends EventEmitter { + impl: any; + lasso: Lasso; + config: LassoConfig; + + (impl: any): Writer; + getLasso(): Lasso; + setLasso(lasso: Lasso): void; + getInPlaceUrlForFile(path: string, lassoContext: LassoContext): string | null; + getInPlaceUrlForBundle(bundle: Bundle, lassoContext: LassoContext): string; + writeBundle(bundle: Bundle, onBundleWrittenCallback: any, lassoContext: LassoContext, callback: any): any; + writeResource(path: string, lassoContext: LassoContext, callback: any): any; + checkBundleUpToDate(bundle: Bundle, lassoContext: LassoContext, callback: any): any; + checkResourceUpToDate(path: string, lassoContext: LassoContext, callback: any): any; + writeBundles(iteratorFunc: any, onBundleWrittenCallback: any, lassoContext: LassoContext, callback: any): void; + buildResourceCacheKey(cacheKey: string, lassoContext: LassoContext): string; +} diff --git a/types/lasso/lib/writers/index.d.ts b/types/lasso/lib/writers/index.d.ts new file mode 100644 index 0000000000..087397f03b --- /dev/null +++ b/types/lasso/lib/writers/index.d.ts @@ -0,0 +1,8 @@ +import { LassoConfig } from '../Lasso'; +import _Writer from './Writer'; + +export interface Writer extends _Writer {} + +export function fileWriter(fileWriterConfig: any, lassoConfig: LassoConfig): any; + +export function createWriter(writerImpl: any): Writer; diff --git a/types/lasso/middleware.d.ts b/types/lasso/middleware.d.ts deleted file mode 100644 index 948de1a03f..0000000000 --- a/types/lasso/middleware.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { RequestHandler } from 'express'; -import Lasso from './lib/Lasso'; - -export interface MiddlewareOptions { - lasso?: Lasso; - sendOptions?: any; -} - -export function serveStatic(options?: MiddlewareOptions): RequestHandler; diff --git a/types/lasso/middleware/index.d.ts b/types/lasso/middleware/index.d.ts new file mode 100644 index 0000000000..1d502980dc --- /dev/null +++ b/types/lasso/middleware/index.d.ts @@ -0,0 +1,4 @@ +import { RequestHandler } from 'express'; +import Lasso from '../lib/Lasso'; + +export function serveStatic(options?: { lasso?: Lasso; sendOptions?: any; }): RequestHandler; diff --git a/types/lasso/tsconfig.json b/types/lasso/tsconfig.json index 2386e1e1f5..210de56a0d 100644 --- a/types/lasso/tsconfig.json +++ b/types/lasso/tsconfig.json @@ -18,12 +18,15 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts", "lasso-tests.ts", - "middleware.d.ts", "node-require-no-op.d.ts", + "index.d.ts", + "lib/index.d.ts", "lib/dependencies.d.ts", "lib/Lasso.d.ts", - "lib/LassoContext.d.ts" + "lib/LassoContext.d.ts", + "lib/writers/index.d.ts", + "lib/writers/Writer.d.ts", + "middleware/index.d.ts" ] } diff --git a/types/lasso/tslint.json b/types/lasso/tslint.json index f93cf8562a..4f44991c3c 100644 --- a/types/lasso/tslint.json +++ b/types/lasso/tslint.json @@ -1,3 +1,6 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false + } } From 36ac40506bff0e0275f53e90db564788472d54f8 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Wed, 27 Dec 2017 21:49:27 +0100 Subject: [PATCH 229/890] Updated ReadMe FAQ (#22197) * Updated ReadMe FaQ regarding fake namespaces as discussed in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/22052 * Changet wording * Addressed review changes --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 7e543c937a..854cae7e40 100644 --- a/README.md +++ b/README.md @@ -313,6 +313,18 @@ When `dts-gen` is used to scaffold a scoped package, the `paths` property has to GitHub doesn't [support](http://stackoverflow.com/questions/5646174/how-to-make-github-follow-directory-history-after-renames) file history for renamed files. Use [`git log --follow`](https://www.git-scm.com/docs/git-log) instead. +#### Should I add an empty namespace to a package that doesn't export a module to use ES6 style imports? + +Some packages, like [chai-http](https://github.com/chaijs/chai-http), export a function. + +Importing this module with an ES6 style import in the form `import * as foo from "foo";` leads to the error: + +> error TS2497: Module 'foo' resolves to a non-module entity and cannot be imported using this construct + +This error can be suppressed by merging the function declaration with an empty namespace of the same name, but this practice is discouraged. +This is a commonly cited [Stack Overflow answer](https://stackoverflow.com/questions/39415661/what-does-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this) regarding this matter. + +It is more appropriate to import the module using the `import foo = require("foo");` syntax, or to use a default import like `import foo from "foo";` if using the `--allowSyntheticDefaultImports` flag if your module runtime supports an interop scheme for non-ECMAScript modules as such. ## License From b0a6e2d2bd226d0d19d35d3fef1bd92b5a9e84ad Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 27 Dec 2017 12:50:01 -0800 Subject: [PATCH 230/890] passport-client-cert: Fix name (#22449) --- types/passport-client-cert/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/passport-client-cert/index.d.ts b/types/passport-client-cert/index.d.ts index 7ec8153651..98998c567f 100644 --- a/types/passport-client-cert/index.d.ts +++ b/types/passport-client-cert/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for passport-jwt 2.0 +// Type definitions for passport-client-cert 2.0 // Project: https://github.com/ripjar/passport-client-cert // Definitions by: Sean Warner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From c62b1125adce6722956c4b686a9ad3bfb45fee16 Mon Sep 17 00:00:00 2001 From: Matthew James Date: Wed, 27 Dec 2017 20:55:28 +0000 Subject: [PATCH 231/890] trash (#22011) * Added definition and tests * Added author details * Targetting es2015 * Added strictFunctionTypes to keep Travis happy * Fixed dtslint issues --- types/trash/index.d.ts | 12 ++++++++++++ types/trash/trash-tests.ts | 15 +++++++++++++++ types/trash/tsconfig.json | 25 +++++++++++++++++++++++++ types/trash/tslint.json | 1 + 4 files changed, 53 insertions(+) create mode 100644 types/trash/index.d.ts create mode 100644 types/trash/trash-tests.ts create mode 100644 types/trash/tsconfig.json create mode 100644 types/trash/tslint.json diff --git a/types/trash/index.d.ts b/types/trash/index.d.ts new file mode 100644 index 0000000000..772b86c434 --- /dev/null +++ b/types/trash/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for trash 4.2 +// Project: https://github.com/sindresorhus/trash#readme +// Definitions by: Matthew James +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface TrashOptions { + glob: boolean; +} + +declare function trash(iterable: Iterable, opts?: TrashOptions): Promise; + +export default trash; diff --git a/types/trash/trash-tests.ts b/types/trash/trash-tests.ts new file mode 100644 index 0000000000..88a29c80f4 --- /dev/null +++ b/types/trash/trash-tests.ts @@ -0,0 +1,15 @@ +import trash from "trash"; + +async function testTrashNoArgs() { + await trash(["/path/to/item1", "/path/to/item2"]); +} + +async function testTrashWithArgs() { + await trash(["/path/to/item1", "/path/to/item2"], { glob: false }); +} + +async function testTrashPerDocumentation() { + trash(["*.png", "!rainbow.png"]).then(() => { + console.log("done"); + }); +} diff --git a/types/trash/tsconfig.json b/types/trash/tsconfig.json new file mode 100644 index 0000000000..92b58c4679 --- /dev/null +++ b/types/trash/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "target": "es2015", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "trash-tests.ts" + ] +} diff --git a/types/trash/tslint.json b/types/trash/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/trash/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f15552392a347f7b182362e6f4b55cf456df1098 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Wed, 27 Dec 2017 21:45:33 +0000 Subject: [PATCH 232/890] Update from review --- types/twitter-text/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/twitter-text/index.d.ts b/types/twitter-text/index.d.ts index df71654bb4..746def795a 100644 --- a/types/twitter-text/index.d.ts +++ b/types/twitter-text/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for twitter-text v2.0.0 // Project: https://github.com/twitter/twitter-text -// Definitions by: rhysd +// Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 0f74394e27e883a6945874b5ca73121de2008ebc Mon Sep 17 00:00:00 2001 From: William Lohan Date: Wed, 27 Dec 2017 15:35:12 -0800 Subject: [PATCH 233/890] remove custom tslint rules --- types/provinces/tslint.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/types/provinces/tslint.json b/types/provinces/tslint.json index 1e30988418..f93cf8562a 100644 --- a/types/provinces/tslint.json +++ b/types/provinces/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-var-requires": false - } + "extends": "dtslint/dt.json" } From 4a305e5ce7d14ce2c9027d147e4c92febf79bb14 Mon Sep 17 00:00:00 2001 From: saranshkataria Date: Wed, 27 Dec 2017 10:59:53 +0530 Subject: [PATCH 234/890] added type definitions for element-resize-detector --- .../element-resize-detector-tests.ts | 19 +++++ types/element-resize-detector/index.d.ts | 23 ++++++ types/element-resize-detector/tsconfig.json | 24 ++++++ types/element-resize-detector/tslint.json | 79 +++++++++++++++++++ 4 files changed, 145 insertions(+) create mode 100644 types/element-resize-detector/element-resize-detector-tests.ts create mode 100644 types/element-resize-detector/index.d.ts create mode 100644 types/element-resize-detector/tsconfig.json create mode 100644 types/element-resize-detector/tslint.json diff --git a/types/element-resize-detector/element-resize-detector-tests.ts b/types/element-resize-detector/element-resize-detector-tests.ts new file mode 100644 index 0000000000..e59860ad1f --- /dev/null +++ b/types/element-resize-detector/element-resize-detector-tests.ts @@ -0,0 +1,19 @@ +import * as elementResizeDetectorMaker from 'element-resize-detector' + +let erd = elementResizeDetectorMaker({ + strategy: "scroll" + }); + +const testElement: HTMLElement = null; + + erd.listenTo(testElement, function(element) { + var width = element.offsetWidth; + var height = element.offsetHeight; + console.log("Size: " + width + "x" + height); + }); + + erd.removeListener(testElement, (testElement) => {}); + + erd.removeAllListeners(testElement); + + erd.uninstall(testElement); diff --git a/types/element-resize-detector/index.d.ts b/types/element-resize-detector/index.d.ts new file mode 100644 index 0000000000..e7f1659b43 --- /dev/null +++ b/types/element-resize-detector/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for element-resize-detector 1.1.12 +// Project: https://github.com/wnr/element-resize-detector +// Definitions by: Saransh Kataria +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'element-resize-detector' { + function elementResizeDetectorMaker(options?: elementResizeDetectorMaker.ErdmOptions) + : elementResizeDetectorMaker.Erd; + + namespace elementResizeDetectorMaker { + interface ErdmOptions { + strategy?: 'scroll' | 'object'; + } + + interface Erd { + listenTo(element: HTMLElement, callback: (elem: HTMLElement) => void): void; + removeListener(element: HTMLElement, callback: (elem: HTMLElement) => void): void; + removeAllListeners(element: HTMLElement): void; + uninstall(element: HTMLElement): void; + } + } + export = elementResizeDetectorMaker; +} diff --git a/types/element-resize-detector/tsconfig.json b/types/element-resize-detector/tsconfig.json new file mode 100644 index 0000000000..9400053488 --- /dev/null +++ b/types/element-resize-detector/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "element-resize-detector-tests.ts" + ] +} diff --git a/types/element-resize-detector/tslint.json b/types/element-resize-detector/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/element-resize-detector/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} From 5d4239dcc57a0bac30d07b5e73578e9d53306572 Mon Sep 17 00:00:00 2001 From: saranshkataria Date: Thu, 28 Dec 2017 09:50:29 +0530 Subject: [PATCH 235/890] removed disabled rules from tslint --- types/element-resize-detector/tslint.json | 78 +---------------------- 1 file changed, 1 insertion(+), 77 deletions(-) diff --git a/types/element-resize-detector/tslint.json b/types/element-resize-detector/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/element-resize-detector/tslint.json +++ b/types/element-resize-detector/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } From 25d9efa9becb2026164e283c7ac4453de69b59c0 Mon Sep 17 00:00:00 2001 From: saranshkataria Date: Thu, 28 Dec 2017 10:02:57 +0530 Subject: [PATCH 236/890] fixed tslint issues --- .../element-resize-detector-tests.ts | 12 ++++----- types/element-resize-detector/index.d.ts | 27 +++++++++---------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/types/element-resize-detector/element-resize-detector-tests.ts b/types/element-resize-detector/element-resize-detector-tests.ts index e59860ad1f..3c7af76280 100644 --- a/types/element-resize-detector/element-resize-detector-tests.ts +++ b/types/element-resize-detector/element-resize-detector-tests.ts @@ -1,15 +1,15 @@ -import * as elementResizeDetectorMaker from 'element-resize-detector' +import * as elementResizeDetectorMaker from 'element-resize-detector'; -let erd = elementResizeDetectorMaker({ +const erd = elementResizeDetectorMaker({ strategy: "scroll" }); const testElement: HTMLElement = null; - erd.listenTo(testElement, function(element) { - var width = element.offsetWidth; - var height = element.offsetHeight; - console.log("Size: " + width + "x" + height); + erd.listenTo(testElement, (element) => { + const width = element.offsetWidth; + const height = element.offsetHeight; + console.log(`Size: " + ${width} + "x" + ${height}`); }); erd.removeListener(testElement, (testElement) => {}); diff --git a/types/element-resize-detector/index.d.ts b/types/element-resize-detector/index.d.ts index e7f1659b43..cfe3141a89 100644 --- a/types/element-resize-detector/index.d.ts +++ b/types/element-resize-detector/index.d.ts @@ -1,23 +1,20 @@ -// Type definitions for element-resize-detector 1.1.12 +// Type definitions for element-resize-detector 1.1 // Project: https://github.com/wnr/element-resize-detector // Definitions by: Saransh Kataria // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module 'element-resize-detector' { - function elementResizeDetectorMaker(options?: elementResizeDetectorMaker.ErdmOptions) - : elementResizeDetectorMaker.Erd; +declare function elementResizeDetectorMaker(options?: elementResizeDetectorMaker.ErdmOptions) : elementResizeDetectorMaker.Erd; - namespace elementResizeDetectorMaker { - interface ErdmOptions { - strategy?: 'scroll' | 'object'; - } +declare namespace elementResizeDetectorMaker { + interface ErdmOptions { + strategy?: 'scroll' | 'object'; + } - interface Erd { - listenTo(element: HTMLElement, callback: (elem: HTMLElement) => void): void; - removeListener(element: HTMLElement, callback: (elem: HTMLElement) => void): void; - removeAllListeners(element: HTMLElement): void; - uninstall(element: HTMLElement): void; - } + interface Erd { + listenTo(element: HTMLElement, callback: (elem: HTMLElement) => void): void; + removeListener(element: HTMLElement, callback: (elem: HTMLElement) => void): void; + removeAllListeners(element: HTMLElement): void; + uninstall(element: HTMLElement): void; } - export = elementResizeDetectorMaker; } +export = elementResizeDetectorMaker; From 03cceeea2d89c8bdc773fe7c5653c8409136ca8c Mon Sep 17 00:00:00 2001 From: saranshkataria Date: Thu, 28 Dec 2017 10:11:33 +0530 Subject: [PATCH 237/890] removed extra whitespace in index file --- types/element-resize-detector/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/element-resize-detector/index.d.ts b/types/element-resize-detector/index.d.ts index cfe3141a89..5b6c1f00aa 100644 --- a/types/element-resize-detector/index.d.ts +++ b/types/element-resize-detector/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Saransh Kataria // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function elementResizeDetectorMaker(options?: elementResizeDetectorMaker.ErdmOptions) : elementResizeDetectorMaker.Erd; +declare function elementResizeDetectorMaker(options?: elementResizeDetectorMaker.ErdmOptions): elementResizeDetectorMaker.Erd; declare namespace elementResizeDetectorMaker { interface ErdmOptions { From 6e277252e70084a7d1e0568f8b4e5006caca0df8 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Thu, 28 Dec 2017 07:03:06 +0100 Subject: [PATCH 238/890] added test for retry option in auth0 --- types/auth0/auth0-tests.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/types/auth0/auth0-tests.ts b/types/auth0/auth0-tests.ts index 521738db7e..e9e347cc69 100644 --- a/types/auth0/auth0-tests.ts +++ b/types/auth0/auth0-tests.ts @@ -120,3 +120,14 @@ management.getUsersByEmail('email@address.com', (err, users) => { management.getUsersByEmail('email@address.com').then((users) => { console.log(users); }); + +// Using different client settings. + +const retryableManagementClient = new auth0.ManagementClient({ + clientId: '', + clientSecret: '', + domain: 'xxx.auth0.com', + retry: { + enabled : true + } +}); From ff51b14db0699e9d62059c40478e3f22c260f3b9 Mon Sep 17 00:00:00 2001 From: Alaa Masoud Date: Thu, 28 Dec 2017 09:15:00 +0300 Subject: [PATCH 239/890] Add type definitions for react-content-loader --- types/react-content-loader/index.d.ts | 38 +++++++++++++++++++ .../react-content-loader-tests.tsx | 21 ++++++++++ types/react-content-loader/tsconfig.json | 24 ++++++++++++ types/react-content-loader/tslint.json | 1 + 4 files changed, 84 insertions(+) create mode 100644 types/react-content-loader/index.d.ts create mode 100644 types/react-content-loader/react-content-loader-tests.tsx create mode 100644 types/react-content-loader/tsconfig.json create mode 100644 types/react-content-loader/tslint.json diff --git a/types/react-content-loader/index.d.ts b/types/react-content-loader/index.d.ts new file mode 100644 index 0000000000..64cd21b15c --- /dev/null +++ b/types/react-content-loader/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for react-content-loader 1.7 +// Project: https://github.com/danilowoz/react-content-loader +// Definitions by: Alaa Masoud +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; + +export interface ContentLoaderProps { + style?: React.CSSProperties; + type?: 'facebook' | 'instagram' | 'list' | 'bullet-list' | 'code'; + speed?: number; + width?: number; + height?: number; + primaryColor?: string; + secondaryColor?: string; + preserveAspectRatio?: 'none' | 'xMinYMin meet' | 'xMidYMin meet' | 'xMaxYMin meet' | 'xMinYMid meet' | 'xMidYMid meet' | 'xMaxYMid meet' | + 'xMinYMax meet' | 'xMidYMax meet' | 'xMaxYMax meet' | 'xMinYMin slice' | 'xMidYMin slice' | 'xMaxYMin slice' | 'xMinYMid slice' | + 'xMidYMid slice' | 'xMaxYMid slice' | 'xMinYMax slice' | 'xMidYMax slice' | 'xMaxYMax slice'; + className?: string; +} +export default class ContentLoader extends React.Component { } + +export interface CircleProps { + x: number; + y: number; + radius: number; +} +export class Circle extends React.Component { } + +export interface RectProps { + x: number; + y: number; + radius: number; + width: number; + height: number; +} +export class Rect extends React.Component { } diff --git a/types/react-content-loader/react-content-loader-tests.tsx b/types/react-content-loader/react-content-loader-tests.tsx new file mode 100644 index 0000000000..e5434746ae --- /dev/null +++ b/types/react-content-loader/react-content-loader-tests.tsx @@ -0,0 +1,21 @@ +import * as React from 'react'; +import ContentLoader, { Circle, Rect } from 'react-content-loader'; + +const CustomComponent = () => { + return ( + + + + + + ); +}; diff --git a/types/react-content-loader/tsconfig.json b/types/react-content-loader/tsconfig.json new file mode 100644 index 0000000000..4385503dc9 --- /dev/null +++ b/types/react-content-loader/tsconfig.json @@ -0,0 +1,24 @@ +{ + "files": [ + "index.d.ts", + "react-content-loader-tests.tsx" + ], + "compilerOptions": { + "jsx": "react", + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/react-content-loader/tslint.json b/types/react-content-loader/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-content-loader/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 558e10c9098769a40645e05e94c1541078184893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miika=20H=C3=A4nninen?= Date: Fri, 15 Dec 2017 15:55:40 +0200 Subject: [PATCH 240/890] Ramda: nth might return undefined If the index points outside the range of the input array, the return value will be undefined. http://ramdajs.com/docs/#nth --- types/ramda/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index cd7e750da7..a40bab0b64 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1149,8 +1149,8 @@ declare namespace R { /** * Returns the nth element in a list. */ - nth(n: number, list: ReadonlyArray): T; - nth(n: number): (list: ReadonlyArray) => T; + nth(n: number, list: ReadonlyArray): T | undefined; + nth(n: number): (list: ReadonlyArray) => T | undefined; /** * Returns a function which returns its nth argument. From 4ab4a67990c54528d6a68d43aae97fa8367ab1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miika=20H=C3=A4nninen?= Date: Fri, 15 Dec 2017 16:00:50 +0200 Subject: [PATCH 241/890] Ramda: Fix splitAt signature - `splitAt` accepts either arrays or strings, not any arbitrary T. - the output will always be an array of two elements, so switched to using the tuple syntax there. - ensures that the overloading after first partial application works http://ramdajs.com/docs/#splitAt fixup splitat --- types/ramda/index.d.ts | 10 ++++++---- types/ramda/ramda-tests.ts | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index a40bab0b64..aa8b8cec66 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1644,10 +1644,12 @@ declare namespace R { /** * Splits a given list or string at a given index. */ - splitAt(index: number, list: T): T[]; - splitAt(index: number): (list: T) => T[]; - splitAt(index: number, list: ReadonlyArray): T[][]; - splitAt(index: number): (list: ReadonlyArray) => T[][]; + splitAt(index: number, list: ReadonlyArray): [T[], T[]]; + splitAt(index: number, list: string): [string, string]; + splitAt(index: number): { + (list: ReadonlyArray): [T[], T[]]; + (list: string): [string, string]; + }; /** * Splits a collection into slices of the specified length. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 321242da00..e25048b768 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1899,6 +1899,7 @@ class Rectangle { const b: number[][] = R.splitAt(1)([1, 2, 3]); // => [[1], [2, 3]] const c: string[] = R.splitAt(5, "hello world"); // => ['hello', ' world'] const d: string[] = R.splitAt(-1, "foobar"); // => ['fooba', 'r'] + const e: string[] = R.splitAt(-1)("foobar"); // => ['fooba', 'r'] }; () => { From 134f9290a240a93404f1801c959079be66ae4261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miika=20H=C3=A4nninen?= Date: Fri, 15 Dec 2017 16:02:29 +0200 Subject: [PATCH 242/890] Ramda: add string overload for splitEvery `splitEvery` works for either an array of any type or a string. http://ramdajs.com/docs/#splitEvery --- types/ramda/index.d.ts | 6 +++++- types/ramda/ramda-tests.ts | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index aa8b8cec66..93c04dc277 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1655,7 +1655,11 @@ declare namespace R { * Splits a collection into slices of the specified length. */ splitEvery(a: number, list: ReadonlyArray): T[][]; - splitEvery(a: number): (list: ReadonlyArray) => T[][]; + splitEvery(a: number, list: string): string[]; + splitEvery(a: number): { + (list: string): string[]; + (list: ReadonlyArray): T[][]; + }; /** * Takes a list and a predicate and returns a pair of lists with the following properties: diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index e25048b768..5d9200070b 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1902,6 +1902,13 @@ class Rectangle { const e: string[] = R.splitAt(-1)("foobar"); // => ['fooba', 'r'] }; +() => { + const a: number[][] = R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); // => [[1, 2, 3], [4, 5, 6], [7]] + const b: number[][] = R.splitEvery(3)([1, 2, 3, 4, 5, 6, 7]); // => [[1, 2, 3], [4, 5, 6], [7]] + const c: string[] = R.splitEvery(3, 'foobarbaz'); // => ['foo', 'bar', 'baz'] + const d: string[] = R.splitEvery(3)('foobarbaz'); // => ['foo', 'bar', 'baz'] +}; + () => { const a: number[][] = R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]); // => [[1], [2, 3, 1, 2, 3]] const b: number[][] = R.splitWhen(R.equals(2))([1, 2, 3, 1, 2, 3]); // => [[1], [2, 3, 1, 2, 3]] From 4915b607329b17eee7c18153f4da3c8b3370a261 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Thu, 28 Dec 2017 10:19:23 +0000 Subject: [PATCH 243/890] Feedback from code review --- types/twitter-text/index.d.ts | 15 ++++++++++++++- types/twitter-text/twitter-text-tests.ts | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/types/twitter-text/index.d.ts b/types/twitter-text/index.d.ts index 746def795a..977aa03049 100644 --- a/types/twitter-text/index.d.ts +++ b/types/twitter-text/index.d.ts @@ -113,6 +113,19 @@ export declare function convertUnicodeIndices(text: string, entities: EntityWith export declare function hitHighlight(text: string, hits?: number[][], options?: { tag: string }): string; +export interface ParseTweetOptions { + version?: number; + maxWeightedTweetLength?: number; + scale?: number; + defaultWeight?: number; + transformedURLLength?: number; + ranges?: Array<{ + start: number; + end: number; + weight: number; + }>; +} + export interface ParsedTweet { weightedLength: number; permillage: number; @@ -123,4 +136,4 @@ export interface ParsedTweet { validRangeStart: number; } -export declare function parseTweet(text: string): ParsedTweet; +export declare function parseTweet(text: string, options?: ParseTweetOptions): ParsedTweet; diff --git a/types/twitter-text/twitter-text-tests.ts b/types/twitter-text/twitter-text-tests.ts index a8e198e410..fdf816ec8f 100644 --- a/types/twitter-text/twitter-text-tests.ts +++ b/types/twitter-text/twitter-text-tests.ts @@ -60,3 +60,6 @@ const linked: string = twitter.autoLink("link @user, and expand url... http://t. ]}); const usernames: string[] = twitter.extractMentions("Mentioning @twitter and @jack"); + +const tweet = twitter.parseTweet('foo'); +const tweetWithOptions = twitter.parseTweet('foo', {maxWeightedTweetLength: 140}); From 8c430a8713e4ba395279285596d6e72644d82a13 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Thu, 28 Dec 2017 10:21:59 +0000 Subject: [PATCH 244/890] Format code --- types/twitter-text/index.d.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/types/twitter-text/index.d.ts b/types/twitter-text/index.d.ts index 977aa03049..370b46abff 100644 --- a/types/twitter-text/index.d.ts +++ b/types/twitter-text/index.d.ts @@ -115,25 +115,25 @@ export declare function hitHighlight(text: string, hits?: number[][], options?: export interface ParseTweetOptions { version?: number; - maxWeightedTweetLength?: number; - scale?: number; - defaultWeight?: number; - transformedURLLength?: number; - ranges?: Array<{ - start: number; - end: number; - weight: number; - }>; + maxWeightedTweetLength?: number; + scale?: number; + defaultWeight?: number; + transformedURLLength?: number; + ranges?: Array<{ + start: number; + end: number; + weight: number; + }>; } export interface ParsedTweet { - weightedLength: number; - permillage: number; - valid: boolean; - displayRangeEnd: number; - displayRangeStart: number; - validRangeEnd: number; - validRangeStart: number; + weightedLength: number; + permillage: number; + valid: boolean; + displayRangeEnd: number; + displayRangeStart: number; + validRangeEnd: number; + validRangeStart: number; } export declare function parseTweet(text: string, options?: ParseTweetOptions): ParsedTweet; From 627cc0eb929c7bd1f9613029dbb3142a1460cb1b Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Thu, 28 Dec 2017 10:25:52 +0000 Subject: [PATCH 245/890] Update index.d.ts --- types/twitter-text/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/twitter-text/index.d.ts b/types/twitter-text/index.d.ts index 370b46abff..652f93da51 100644 --- a/types/twitter-text/index.d.ts +++ b/types/twitter-text/index.d.ts @@ -119,11 +119,11 @@ export interface ParseTweetOptions { scale?: number; defaultWeight?: number; transformedURLLength?: number; - ranges?: Array<{ - start: number; - end: number; - weight: number; - }>; + ranges?: Array<{ + start: number; + end: number; + weight: number; + }>; } export interface ParsedTweet { From 23d825ca66a225d937884f8e59547ec21de8f002 Mon Sep 17 00:00:00 2001 From: york yao Date: Thu, 28 Dec 2017 18:26:12 +0800 Subject: [PATCH 246/890] add types of react-native-document-picker --- types/react-native-document-picker/index.d.ts | 28 +++++++++++++++++++ .../react-native-document-picker-tests.tsx | 7 +++++ .../tsconfig.json | 25 +++++++++++++++++ .../react-native-document-picker/tslint.json | 1 + 4 files changed, 61 insertions(+) create mode 100644 types/react-native-document-picker/index.d.ts create mode 100644 types/react-native-document-picker/react-native-document-picker-tests.tsx create mode 100644 types/react-native-document-picker/tsconfig.json create mode 100644 types/react-native-document-picker/tslint.json diff --git a/types/react-native-document-picker/index.d.ts b/types/react-native-document-picker/index.d.ts new file mode 100644 index 0000000000..986da6e611 --- /dev/null +++ b/types/react-native-document-picker/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for react-native-document-picker 2.0 +// Project: https://github.com/Elyx0/react-native-document-picker +// Definitions by: Jacob Baskin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export const DocumentPicker: { + show(options: Options, callback: (error: Error, result: Result) => void): void; +}; + +export const DocumentPickerUtil: { + allFiles(): string; + pdf(): string; + audio(): string; + plainText(): string; +}; + +export interface Options { + top?: number; + left?: number; + filetype: string[]; +} + +export interface Result { + uri: string; + type: string; + fileName: string; + fileSize: number; +} diff --git a/types/react-native-document-picker/react-native-document-picker-tests.tsx b/types/react-native-document-picker/react-native-document-picker-tests.tsx new file mode 100644 index 0000000000..a293a20c37 --- /dev/null +++ b/types/react-native-document-picker/react-native-document-picker-tests.tsx @@ -0,0 +1,7 @@ +import { DocumentPicker, DocumentPickerUtil } from "react-native-document-picker"; + +DocumentPicker.show({ + filetype: [DocumentPickerUtil.allFiles()], +}, (error, res) => { + // do nothing +}); diff --git a/types/react-native-document-picker/tsconfig.json b/types/react-native-document-picker/tsconfig.json new file mode 100644 index 0000000000..25f0fcb7b7 --- /dev/null +++ b/types/react-native-document-picker/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-native-document-picker-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-native-document-picker/tslint.json b/types/react-native-document-picker/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-document-picker/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 76aaf0ac91fd156d20a9f8e71cd2f46002359a4d Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Thu, 28 Dec 2017 15:22:37 +0100 Subject: [PATCH 247/890] Review comments --- types/plugin-error/index.d.ts | 6 +++--- types/plugin-error/plugin-error-tests.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/plugin-error/index.d.ts b/types/plugin-error/index.d.ts index 9f1d8833c5..800f0932ba 100644 --- a/types/plugin-error/index.d.ts +++ b/types/plugin-error/index.d.ts @@ -6,7 +6,7 @@ export = PluginError; declare namespace PluginError { - export interface PluginErrorOpts { + interface PluginErrorOpts { /** * By default the stack will not be shown. Set options.showStack to true if you think the stack is important for your error. */ @@ -17,14 +17,14 @@ declare namespace PluginError { showProperties?: boolean; } - export interface PluginErrorOpts2 extends PluginErrorOpts { + interface PluginErrorOpts2 extends PluginErrorOpts { /** * If you pass an error object as the message the stack will be pulled from that, otherwise one will be created. */ message?: string | Error; } - export interface PluginErrorOpts3 extends PluginErrorOpts2 { + interface PluginErrorOpts3 extends PluginErrorOpts2 { /** * The name of the plugin */ diff --git a/types/plugin-error/plugin-error-tests.ts b/types/plugin-error/plugin-error-tests.ts index 590e8db0fc..590d5868ce 100644 --- a/types/plugin-error/plugin-error-tests.ts +++ b/types/plugin-error/plugin-error-tests.ts @@ -1,4 +1,4 @@ -import * as PluginError from 'plugin-error'; +import PluginError = require('plugin-error'); let e: PluginError; From 5913e4fcb108e1fade59fc69802428c29a5bdf49 Mon Sep 17 00:00:00 2001 From: Frank Tan Date: Thu, 28 Dec 2017 10:05:57 -0500 Subject: [PATCH 248/890] ember-test-helpers: Update types to v0.7 --- types/ember-qunit/v3/ember-qunit-tests.ts | 2 +- .../ember-test-helpers-tests.ts | 30 ++++++++++++++++++- types/ember-test-helpers/index.d.ts | 10 +++++-- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/types/ember-qunit/v3/ember-qunit-tests.ts b/types/ember-qunit/v3/ember-qunit-tests.ts index 42768a42ca..6ddb4e5454 100644 --- a/types/ember-qunit/v3/ember-qunit-tests.ts +++ b/types/ember-qunit/v3/ember-qunit-tests.ts @@ -133,7 +133,7 @@ module('x-foo', function(hooks) { setupRenderingTest(hooks); }); -// http://rwjblue.com/2017/10/23/ember-qunit-simplication/#setuprenderingtest +// http://rwjblue.com/2017/10/23/ember-qunit-simplication/#setuptest module('foo service', function(hooks) { setupTest(hooks); }); diff --git a/types/ember-test-helpers/ember-test-helpers-tests.ts b/types/ember-test-helpers/ember-test-helpers-tests.ts index f21d554cfa..705d0c76b1 100644 --- a/types/ember-test-helpers/ember-test-helpers-tests.ts +++ b/types/ember-test-helpers/ember-test-helpers-tests.ts @@ -1,8 +1,10 @@ /// -import { ModuleCallbacks, TestModule } from "ember-test-helpers"; +import { ModuleCallbacks, TestContext, TestModule } from "ember-test-helpers"; import wait from 'ember-test-helpers/wait'; import hasEmberVersion from 'ember-test-helpers/has-ember-version'; +import hbs from 'htmlbars-inline-precompile'; + function moduleFor(name: string, description: string, callbacks: ModuleCallbacks) { const module = new TestModule(name, description, callbacks); @@ -23,3 +25,29 @@ async function testWait() { if (hasEmberVersion(2, 10)) { // ... } + +// https://github.com/emberjs/ember-test-helpers/blob/f07e86914f2a3823c4cb6787307f9ba2bf447e68/tests/unit/setup-context-test.js +QUnit.test('it sets up this.owner', function(this: TestContext, assert: Assert) { + const { owner } = this; + assert.ok(owner, 'owner was setup'); + assert.equal(typeof owner.lookup, 'function', 'has expected lookup interface'); + + if (hasEmberVersion(2, 12)) { + assert.equal(typeof owner.factoryFor, 'function', 'has expected factory interface'); + } +}); + +QUnit.test('can pauseTest to be resumed "later"', async function(this: TestContext, assert: Assert) { + const promise = this.pauseTest(); + + this.resumeTest(); + + await promise; +}); + +// https://github.com/emberjs/ember-test-helpers/blob/fb4c8d4cd36b54728ce180227f865b1fa0162632/tests/unit/setup-rendering-context-test.js +QUnit.test('render exposes an `.element` property', async function(this: TestContext, assert: Assert) { + await this.render(hbs`

    Hello!

    `); + + assert.equal(this.element.textContent, 'Hello!'); +}); diff --git a/types/ember-test-helpers/index.d.ts b/types/ember-test-helpers/index.d.ts index 26591d7d23..f098c49a84 100644 --- a/types/ember-test-helpers/index.d.ts +++ b/types/ember-test-helpers/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ember-test-helpers 0.6 +// Type definitions for ember-test-helpers 0.7 // Project: https://github.com/emberjs/ember-test-helpers#readme // Definitions by: Derek Wickern // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -34,7 +34,7 @@ declare module 'ember-test-helpers' { send(actionName: string): void; $: JQueryStatic; subject(options?: {}): any; - render(template?: string | string[] | TemplateFactory): void; + render(template?: string | string[] | TemplateFactory): Promise; clearRender(): void; registry: Ember.Registry; container: Ember.Container; @@ -47,6 +47,12 @@ declare module 'ember-test-helpers' { controller(name: string, options?: { as: string }): any; service(name: string, options?: { as: string }): any; }; + owner: Ember.ApplicationInstance & { + factoryFor(fullName: string, options?: {}): any; + }; + pauseTest(): Promise; + resumeTest(): void; + element: Element; } class TestModule { From 89b2d164a3e5b854914827fda7f989b78f381faa Mon Sep 17 00:00:00 2001 From: Frank Tan Date: Thu, 28 Dec 2017 14:17:54 -0500 Subject: [PATCH 249/890] ember-qunit: Remove self as author --- types/ember-qunit/v3/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/ember-qunit/v3/index.d.ts b/types/ember-qunit/v3/index.d.ts index a42b5107af..2dfa6eaf86 100644 --- a/types/ember-qunit/v3/index.d.ts +++ b/types/ember-qunit/v3/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for ember-qunit 3.0 // Project: https://github.com/emberjs/ember-qunit#readme // Definitions by: Derek Wickern -// Frank Tan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 From d027062888e43a566a6a4d9a8576ded205052682 Mon Sep 17 00:00:00 2001 From: Daniel Perez Alvarez Date: Thu, 21 Dec 2017 20:48:39 -0800 Subject: [PATCH 250/890] Add types for redux-injectable-store 1.0 --- types/redux-injectable-store/index.d.ts | 28 +++++++++++++++++++ types/redux-injectable-store/package.json | 6 ++++ .../redux-injectable-store-tests.ts | 24 ++++++++++++++++ types/redux-injectable-store/tsconfig.json | 23 +++++++++++++++ types/redux-injectable-store/tslint.json | 1 + 5 files changed, 82 insertions(+) create mode 100644 types/redux-injectable-store/index.d.ts create mode 100644 types/redux-injectable-store/package.json create mode 100644 types/redux-injectable-store/redux-injectable-store-tests.ts create mode 100644 types/redux-injectable-store/tsconfig.json create mode 100644 types/redux-injectable-store/tslint.json diff --git a/types/redux-injectable-store/index.d.ts b/types/redux-injectable-store/index.d.ts new file mode 100644 index 0000000000..14c5ac3062 --- /dev/null +++ b/types/redux-injectable-store/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for redux-injectable-store 1.0 +// Project: https://github.com/lelandrichardson/redux-injectable-store#readme +// Definitions by: Daniel Perez Alvarez +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Reducer, Store, StoreEnhancer } from "redux"; + +export interface InjectableStore extends Store { + inject(namespace: string, reducer: Reducer): void; + injectAll(reducers: { [key: string]: Reducer }): void; + clearReducers(): void; +} + +export type WrapReducer = (reducer: Reducer) => Reducer; + +export interface InjectableStoreCreator { + ( + enhancer?: StoreEnhancer, + wrapReducer?: WrapReducer + ): InjectableStore; + ( + preloadedState: S, + enhancer?: StoreEnhancer, + wrapReducer?: WrapReducer + ): InjectableStore; +} + +export const createInjectableStore: InjectableStoreCreator; diff --git a/types/redux-injectable-store/package.json b/types/redux-injectable-store/package.json new file mode 100644 index 0000000000..6d68bf2f9b --- /dev/null +++ b/types/redux-injectable-store/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "redux": "^3.6.0" + } +} diff --git a/types/redux-injectable-store/redux-injectable-store-tests.ts b/types/redux-injectable-store/redux-injectable-store-tests.ts new file mode 100644 index 0000000000..35e01684f1 --- /dev/null +++ b/types/redux-injectable-store/redux-injectable-store-tests.ts @@ -0,0 +1,24 @@ +import { createInjectableStore } from "redux-injectable-store"; +import { applyMiddleware, compose, AnyAction, Middleware } from "redux"; + +interface State { + foo: string; + bar?: string; + baz?: string; +} + +const initialState: State = { foo: "bar" }; + +const middleware: Middleware[] = []; +const enhancer = applyMiddleware(...middleware); +const store = createInjectableStore(initialState, enhancer); +const anotherStore = createInjectableStore(initialState, enhancer, reducer => reducer); + +const dummyReducer = (state: string) => state; + +store.inject("foo", dummyReducer); + +anotherStore.injectAll({ + bar: dummyReducer, + baz: dummyReducer +}); diff --git a/types/redux-injectable-store/tsconfig.json b/types/redux-injectable-store/tsconfig.json new file mode 100644 index 0000000000..1fcc143ead --- /dev/null +++ b/types/redux-injectable-store/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "redux-injectable-store-tests.ts" + ] +} diff --git a/types/redux-injectable-store/tslint.json b/types/redux-injectable-store/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/redux-injectable-store/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 6ba8518b4414f21ff362f8d3ce8e3e09121b5f27 Mon Sep 17 00:00:00 2001 From: Paito Anderson Date: Thu, 28 Dec 2017 15:02:16 -0500 Subject: [PATCH 251/890] Added empty overload for email() --- types/react-native-communications/index.d.ts | 1 + .../react-native-communications-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/react-native-communications/index.d.ts b/types/react-native-communications/index.d.ts index a6c572174d..4f8d28564e 100644 --- a/types/react-native-communications/index.d.ts +++ b/types/react-native-communications/index.d.ts @@ -6,6 +6,7 @@ // TypeScript Version: 2.3 export function phonecall(phoneNumber: string, isPrompt: boolean): void; +export function email(): void; export function email(to: string[] | null, cc: string[]| null, bcc: string[] | null, subject: string | null, body: string | null): void; export function text(phoneNumber?: string | null, body?: string | null): void; export function textWithoutEncoding(phoneNumber?: string | null, body?: string | null): void; diff --git a/types/react-native-communications/react-native-communications-tests.ts b/types/react-native-communications/react-native-communications-tests.ts index edad4ad933..136dadd77f 100644 --- a/types/react-native-communications/react-native-communications-tests.ts +++ b/types/react-native-communications/react-native-communications-tests.ts @@ -2,6 +2,7 @@ import { phonecall, email, text, textWithoutEncoding, web } from 'react-native-c phonecall('123456789', true); +email(); email(['a@example.com'], null, ['a@example.com'], 'subject', null); text(); From 65f86f46e68add4c0eda50f5531ca55df87046ce Mon Sep 17 00:00:00 2001 From: Frank Tan Date: Thu, 28 Dec 2017 16:34:26 -0500 Subject: [PATCH 252/890] ember-qunit: Move existing root files to v2 --- types/ember-qunit/{ => v2}/ember-qunit-tests.ts | 0 types/ember-qunit/{ => v2}/index.d.ts | 0 types/ember-qunit/{ => v2}/tsconfig.json | 10 +++++++--- types/ember-qunit/{ => v2}/tslint.json | 0 4 files changed, 7 insertions(+), 3 deletions(-) rename types/ember-qunit/{ => v2}/ember-qunit-tests.ts (100%) rename types/ember-qunit/{ => v2}/index.d.ts (100%) rename types/ember-qunit/{ => v2}/tsconfig.json (69%) rename types/ember-qunit/{ => v2}/tslint.json (100%) diff --git a/types/ember-qunit/ember-qunit-tests.ts b/types/ember-qunit/v2/ember-qunit-tests.ts similarity index 100% rename from types/ember-qunit/ember-qunit-tests.ts rename to types/ember-qunit/v2/ember-qunit-tests.ts diff --git a/types/ember-qunit/index.d.ts b/types/ember-qunit/v2/index.d.ts similarity index 100% rename from types/ember-qunit/index.d.ts rename to types/ember-qunit/v2/index.d.ts diff --git a/types/ember-qunit/tsconfig.json b/types/ember-qunit/v2/tsconfig.json similarity index 69% rename from types/ember-qunit/tsconfig.json rename to types/ember-qunit/v2/tsconfig.json index 845f5b1023..e173bc0d73 100644 --- a/types/ember-qunit/tsconfig.json +++ b/types/ember-qunit/v2/tsconfig.json @@ -2,14 +2,18 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": false, - "baseUrl": "../", - "typeRoots": ["../"], + "baseUrl": "../../", + "typeRoots": ["../../"], + "paths": { + "ember-qunit": ["ember-qunit/v2"] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/ember-qunit/tslint.json b/types/ember-qunit/v2/tslint.json similarity index 100% rename from types/ember-qunit/tslint.json rename to types/ember-qunit/v2/tslint.json From 126f9bb5f3698d58fa899e7f97d8bc0decae0812 Mon Sep 17 00:00:00 2001 From: Frank Tan Date: Thu, 28 Dec 2017 16:37:28 -0500 Subject: [PATCH 253/890] ember-qunit: Move v3 files to root --- types/ember-qunit/{v3 => }/ember-qunit-tests.ts | 0 types/ember-qunit/{v3 => }/index.d.ts | 0 types/ember-qunit/{v3 => }/tsconfig.json | 11 ++--------- types/ember-qunit/{v3 => }/tslint.json | 0 4 files changed, 2 insertions(+), 9 deletions(-) rename types/ember-qunit/{v3 => }/ember-qunit-tests.ts (100%) rename types/ember-qunit/{v3 => }/index.d.ts (100%) rename types/ember-qunit/{v3 => }/tsconfig.json (69%) rename types/ember-qunit/{v3 => }/tslint.json (100%) diff --git a/types/ember-qunit/v3/ember-qunit-tests.ts b/types/ember-qunit/ember-qunit-tests.ts similarity index 100% rename from types/ember-qunit/v3/ember-qunit-tests.ts rename to types/ember-qunit/ember-qunit-tests.ts diff --git a/types/ember-qunit/v3/index.d.ts b/types/ember-qunit/index.d.ts similarity index 100% rename from types/ember-qunit/v3/index.d.ts rename to types/ember-qunit/index.d.ts diff --git a/types/ember-qunit/v3/tsconfig.json b/types/ember-qunit/tsconfig.json similarity index 69% rename from types/ember-qunit/v3/tsconfig.json rename to types/ember-qunit/tsconfig.json index c1b85f31c8..1f9e626103 100644 --- a/types/ember-qunit/v3/tsconfig.json +++ b/types/ember-qunit/tsconfig.json @@ -9,15 +9,8 @@ "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": false, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "ember-qunit": [ - "ember-qunit/v3" - ] - }, + "baseUrl": "../", + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/ember-qunit/v3/tslint.json b/types/ember-qunit/tslint.json similarity index 100% rename from types/ember-qunit/v3/tslint.json rename to types/ember-qunit/tslint.json From c888d958dbe25a54c54a5d61eb338af7760b3e1e Mon Sep 17 00:00:00 2001 From: Frank Tan Date: Thu, 28 Dec 2017 17:15:14 -0500 Subject: [PATCH 254/890] rsvp: Add [Symbol.toStringTag] This is required for compatibility with `lib.es6.d.ts`. See https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es6.d.ts --- types/rsvp/index.d.ts | 2 ++ types/rsvp/rsvp-tests.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/types/rsvp/index.d.ts b/types/rsvp/index.d.ts index 4e9b8edda9..e32ad96363 100755 --- a/types/rsvp/index.d.ts +++ b/types/rsvp/index.d.ts @@ -122,6 +122,8 @@ declare module 'rsvp' { finally(onFinally?: U | PromiseLike): RSVP.Promise; + readonly [Symbol.toStringTag]: "Promise"; + static all( values: [ Arg, diff --git a/types/rsvp/rsvp-tests.ts b/types/rsvp/rsvp-tests.ts index 7805c40fa5..1f14a3318b 100755 --- a/types/rsvp/rsvp-tests.ts +++ b/types/rsvp/rsvp-tests.ts @@ -324,3 +324,7 @@ function testOnAndOff() { ); }); } + +function testAssignableToPromise() { + const promise: Promise = RSVP.resolve(0); +} From 99b908fdb88def87f9e292c7953360c92a09b373 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Thu, 28 Dec 2017 15:17:25 -0700 Subject: [PATCH 255/890] Revert Prettier-induced spacing, comma changes. --- types/ember-data/index.d.ts | 116 +++++----- types/ember-data/test/store.ts | 6 +- types/ember-qunit/index.d.ts | 2 +- types/ember/index.d.ts | 377 +++++++-------------------------- types/ember/test/computed.ts | 33 ++- 5 files changed, 150 insertions(+), 384 deletions(-) diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index c973ebd2ea..8043ad894e 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -208,7 +208,7 @@ declare module "ember-data" { * subclasses are used to indicate specific error states. The following * subclasses are provided: */ - class AdapterError { } + class AdapterError {} /** * A `DS.InvalidError` is used by an adapter to signal the external API * was unable to process a request because the content was not @@ -218,27 +218,27 @@ declare module "ember-data" { * transition to the `invalid` state and the errors will be set to the * `errors` property on the record. */ - class InvalidError { } + class InvalidError {} /** * A `DS.TimeoutError` is used by an adapter to signal that a request * to the external API has timed out. I.e. no response was received from * the external API within an allowed time period. */ - class TimeoutError { } + class TimeoutError {} /** * A `DS.AbortError` is used by an adapter to signal that a request to * the external API was aborted. For example, this can occur if the user * navigates away from the current page after a request to the external API * has been initiated but before a response has been received. */ - class AbortError { } + class AbortError {} /** * A `DS.UnauthorizedError` equates to a HTTP `401 Unauthorized` response * status. It is used by an adapter to signal that a request to the external * API was rejected because authorization is required and has failed or has not * yet been provided. */ - class UnauthorizedError { } + class UnauthorizedError {} /** * A `DS.ForbiddenError` equates to a HTTP `403 Forbidden` response status. * It is used by an adapter to signal that a request to the external API was @@ -246,13 +246,13 @@ declare module "ember-data" { * provided and is valid, then the authenticated user does not have the * necessary permissions for the request. */ - class ForbiddenError { } + class ForbiddenError {} /** * A `DS.NotFoundError` equates to a HTTP `404 Not Found` response status. * It is used by an adapter to signal that a request to the external API * was rejected because the resource could not be found on the API. */ - class NotFoundError { } + class NotFoundError {} /** * A `DS.ConflictError` equates to a HTTP `409 Conflict` response status. * It is used by an adapter to indicate that the request could not be processed @@ -260,17 +260,17 @@ declare module "ember-data" { * creating a record with a client generated id but that id is already known * to the external API. */ - class ConflictError { } + class ConflictError {} /** * A `DS.ServerError` equates to a HTTP `500 Internal Server Error` response * status. It is used by the adapter to indicate that a request has failed * because of an error in the external API. */ - class ServerError { } + class ServerError {} /** * Holds validation errors for a given record, organized by attribute names. */ - interface Errors extends Ember.Enumerable, Ember.Evented { } + interface Errors extends Ember.Enumerable, Ember.Evented {} class Errors extends Ember.Object { /** * DEPRECATED: @@ -544,7 +544,7 @@ declare module "ember-data" { */ static relatedTypes: Ember.ComputedProperty< Ember.NativeArray - >; + >; /** * A map whose keys are the relationships of a model and whose values are * relationship descriptors. @@ -613,14 +613,14 @@ declare module "ember-data" { /** * ### State */ - class RootState { } + class RootState {} /** * Represents an ordered list of records whose order and membership is * determined by the adapter. For example, a query sent to the adapter * may trigger a search on the server, whose results would be loaded * into an instance of the `AdapterPopulatedRecordArray`. */ - class AdapterPopulatedRecordArray extends RecordArray { } + class AdapterPopulatedRecordArray extends RecordArray {} /** * Represents a list of records whose membership is determined by the * store. As records are created, loaded, or modified, the store @@ -641,7 +641,7 @@ declare module "ember-data" { * `DS.RecordArray` or its subclasses will be returned by your application's store * in response to queries. */ - interface RecordArray extends Ember.ArrayProxy, Ember.Evented { } + interface RecordArray extends Ember.ArrayProxy, Ember.Evented {} class RecordArray { /** * The flag to signal a `RecordArray` is finished loading data. @@ -814,7 +814,7 @@ declare module "ember-data" { * A `ManyArray` is a `MutableArray` that represents the contents of a has-many * relationship. */ - interface ManyArray extends Ember.MutableArray { } + interface ManyArray extends Ember.MutableArray {} class ManyArray extends Ember.Object.extend( Ember.MutableArray as {}, Ember.Evented @@ -852,8 +852,8 @@ declare module "ember-data" { */ interface PromiseArray extends Ember.ArrayProxy, - Ember.PromiseProxyMixin> { } - class PromiseArray { } + Ember.PromiseProxyMixin> {} + class PromiseArray {} /** * A `PromiseObject` is an object that acts like both an `Ember.Object` * and a promise. When the promise is resolved, then the resulting value @@ -863,8 +863,8 @@ declare module "ember-data" { */ interface PromiseObject extends Ember.ObjectProxy, - Ember.PromiseProxyMixin> { } - class PromiseObject { } + Ember.PromiseProxyMixin> {} + class PromiseObject {} /** * A PromiseManyArray is a PromiseArray that also proxies certain method calls * to the underlying manyArray. @@ -1817,7 +1817,7 @@ declare module "ember-data" { * used when `boolean` is passed as the type parameter to the * [DS.attr](../../data#method_attr) function. */ - class BooleanTransform extends Transform { } + class BooleanTransform extends Transform {} /** * The `DS.DateTransform` class is used to serialize and deserialize * date attributes on Ember Data record objects. This transform is used @@ -1825,21 +1825,21 @@ declare module "ember-data" { * [DS.attr](../../data#method_attr) function. It uses the [`ISO 8601`](https://en.wikipedia.org/wiki/ISO_8601) * standard. */ - class DateTransform extends Transform { } + class DateTransform extends Transform {} /** * The `DS.NumberTransform` class is used to serialize and deserialize * numeric attributes on Ember Data record objects. This transform is * used when `number` is passed as the type parameter to the * [DS.attr](../../data#method_attr) function. */ - class NumberTransform extends Transform { } + class NumberTransform extends Transform {} /** * The `DS.StringTransform` class is used to serialize and deserialize * string attributes on Ember Data record objects. This transform is * used when `string` is passed as the type parameter to the * [DS.attr](../../data#method_attr) function. */ - class StringTransform extends Transform { } + class StringTransform extends Transform {} /** * The `DS.Transform` class is used to serialize and deserialize model * attributes when they are saved or loaded from an @@ -2069,63 +2069,63 @@ declare module "ember" { } } declare module 'ember-data/adapter' { - import DS from 'ember-data'; - export default DS.Adapter; + import DS from 'ember-data'; + export default DS.Adapter; } declare module 'ember-data/adapters/errors' { - import DS from 'ember-data'; - const AdapterError: typeof DS.AdapterError; - const InvalidError: typeof DS.InvalidError; - const UnauthorizedError: typeof DS.UnauthorizedError; - const ForbiddenError: typeof DS.ForbiddenError; - const NotFoundError: typeof DS.NotFoundError; - const ConflictError: typeof DS.ConflictError; - const ServerError: typeof DS.ServerError; - const TimeoutError: typeof DS.TimeoutError; - const AbortError: typeof DS.AbortError; - const errorsHashToArray: typeof DS.errorsHashToArray; - const errorsArrayToHash: typeof DS.errorsArrayToHash; + import DS from 'ember-data'; + const AdapterError: typeof DS.AdapterError; + const InvalidError: typeof DS.InvalidError; + const UnauthorizedError: typeof DS.UnauthorizedError; + const ForbiddenError: typeof DS.ForbiddenError; + const NotFoundError: typeof DS.NotFoundError; + const ConflictError: typeof DS.ConflictError; + const ServerError: typeof DS.ServerError; + const TimeoutError: typeof DS.TimeoutError; + const AbortError: typeof DS.AbortError; + const errorsHashToArray: typeof DS.errorsHashToArray; + const errorsArrayToHash: typeof DS.errorsArrayToHash; } declare module 'ember-data/adapters/json-api' { - import DS from 'ember-data'; - export default DS.JSONAPIAdapter; + import DS from 'ember-data'; + export default DS.JSONAPIAdapter; } declare module 'ember-data/adapters/rest' { - import DS from 'ember-data'; - export default DS.RESTAdapter; + import DS from 'ember-data'; + export default DS.RESTAdapter; } declare module 'ember-data/attr' { - import DS from 'ember-data'; - export default DS.attr; + import DS from 'ember-data'; + export default DS.attr; } declare module 'ember-data/model' { - import DS from 'ember-data'; - export default DS.Model; + import DS from 'ember-data'; + export default DS.Model; } declare module 'ember-data/relationships' { - import DS from 'ember-data'; - const hasMany: typeof DS.hasMany; - const belongsTo: typeof DS.belongsTo; + import DS from 'ember-data'; + const hasMany: typeof DS.hasMany; + const belongsTo: typeof DS.belongsTo; } declare module 'ember-data/serializer' { - import DS from 'ember-data'; - export default DS.Serializer; + import DS from 'ember-data'; + export default DS.Serializer; } declare module 'ember-data/serializers/embedded-records-mixin' { - import DS from 'ember-data'; - export default DS.EmbeddedRecordsMixin; + import DS from 'ember-data'; + export default DS.EmbeddedRecordsMixin; } declare module 'ember-data/serializers/json-api' { - import DS from 'ember-data'; - export default DS.JSONAPISerializer; + import DS from 'ember-data'; + export default DS.JSONAPISerializer; } declare module 'ember-data/serializers/json' { - import DS from 'ember-data'; - export default DS.JSONSerializer; + import DS from 'ember-data'; + export default DS.JSONSerializer; } declare module 'ember-data/serializers/rest' { - import DS from 'ember-data'; - export default DS.RESTSerializer; + import DS from 'ember-data'; + export default DS.RESTSerializer; } declare module "ember-data/store" { import DS from "ember-data"; diff --git a/types/ember-data/test/store.ts b/types/ember-data/test/store.ts index d3a564cbf8..46b0987981 100644 --- a/types/ember-data/test/store.ts +++ b/types/ember-data/test/store.ts @@ -5,7 +5,7 @@ import { assertType } from "./lib/assert"; declare const store: DS.Store; class Post extends DS.Model { - title = DS.attr('string'); + title = DS.attr('string'); } let post = store.createRecord('post', { @@ -52,7 +52,7 @@ if (store.hasRecordForId('post', 1)) { } class Message extends DS.Model { - hasBeenSeen = DS.attr('boolean'); + hasBeenSeen = DS.attr('boolean'); } const messages = store.peekAll('message'); @@ -70,7 +70,7 @@ people.get('isUpdating'); // true const MyRoute = Ember.Route.extend({ model(params: any): any { - return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' }); + return this.store.findRecord('post', params.post_id, {include: 'comments,comments.author'}); } }); diff --git a/types/ember-qunit/index.d.ts b/types/ember-qunit/index.d.ts index 1b18c533a8..b6b6038758 100644 --- a/types/ember-qunit/index.d.ts +++ b/types/ember-qunit/index.d.ts @@ -44,7 +44,7 @@ declare module 'ember-qunit' { */ export function setResolver(resolver: Ember.Resolver): void; - export class QUnitAdapter extends Ember.Test.Adapter { } + export class QUnitAdapter extends Ember.Test.Adapter {} export { module, test, skip, only, todo } from 'qunit'; } diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 37fabd1447..7039669b39 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -23,9 +23,7 @@ declare module 'ember' { /** * Deconstructs computed properties into the types which would be returned by `.get()`. */ - type ComputedProperties = { - [K in keyof T]: Ember.ComputedProperty | T[K] - }; + type ComputedProperties = { [K in keyof T]: Ember.ComputedProperty | T[K] }; /** * Check that any arguments to `create()` match the type's properties. @@ -98,9 +96,7 @@ declare module 'ember' { __ember_run_timer_brand__: any; } - type RunMethod = - | ((this: Target, ...args: any[]) => Ret) - | keyof Target; + type RunMethod = ((this: Target, ...args: any[]) => Ret) | keyof Target; type EmberRunQueues = | 'sync' | 'actions' @@ -111,13 +107,7 @@ declare module 'ember' { type ObserverMethod = | (keyof Target) - | (( - this: Target, - sender: Sender, - key: keyof Sender, - value: any, - rev: number - ) => void); + | ((this: Target, sender: Sender, key: keyof Sender, value: any, rev: number) => void); interface RenderOptions { into?: string; @@ -230,10 +220,7 @@ declare module 'ember' { Unless you have specific needs for CoreView, you will use Ember.Component in your applications. **/ - class CoreView extends Ember.Object.extend( - Ember.Evented, - Ember.ActionHandler - ) {} + class CoreView extends Ember.Object.extend(Ember.Evented, Ember.ActionHandler) {} interface ActionSupport { sendAction(action: string, ...params: any[]): void; } @@ -299,10 +286,7 @@ declare module 'ember' { on(...args: string[]): this; } - interface ArrayPrototypeExtensions - extends MutableArray, - Observable, - Copyable {} + interface ArrayPrototypeExtensions extends MutableArray, Observable, Copyable {} /** * Given a fullName return a factory manager. @@ -346,11 +330,7 @@ declare module 'ember' { /** * Register an option for a particular factory. */ - registerOption( - fullName: string, - optionName: string, - options: {} - ): any; + registerOption(fullName: string, optionName: string, options: {}): any; /** * Return a specific registered option for a particular factory. */ @@ -375,11 +355,7 @@ declare module 'ember' { * Define a dependency injection onto a specific factory or all factories * of a type. */ - inject( - factoryNameOrType: string, - property: string, - injectionName: string - ): any; + inject(factoryNameOrType: string, property: string, injectionName: string): any; } const _RegistryProxyMixin: Mixin<_RegistryProxyMixin>; /** @@ -427,11 +403,7 @@ declare module 'ember' { /** defines an injection or typeInjection **/ - inject( - factoryNameOrType: string, - property: string, - injectionName: string - ): void; + inject(factoryNameOrType: string, property: string, injectionName: string): void; /** This injects the test helpers into the window's scope. If a function of the same name has already been defined it will be cached (so that it can be reset @@ -560,22 +532,14 @@ declare module 'ember' { * invalidate any related properties. Pass the starting index of the change * as well as a delta of the amounts to change. */ - arrayContentWillChange( - startIdx: number, - removeAmt: number, - addAmt: number - ): this; + arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): this; /** * If you are implementing an object that supports `Ember.Array`, call this * method just after the array content changes to notify any observers and * invalidate any related properties. Pass the starting index of the change * as well as a delta of the amounts to change. */ - arrayContentDidChange( - startIdx: number, - removeAmt: number, - addAmt: number - ): this; + arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): this; /** * Returns a special object that can be used to observe individual properties * on the array. Just get an equivalent property on this object and it will @@ -640,11 +604,7 @@ declare module 'ember' { and actions are targeted at the view object. There is no access to the surrounding context or outer controller; all contextual information is passed in. **/ - class Component extends CoreView.extend( - ViewMixin, - ActionSupport, - ClassNamesSupport - ) { + class Component extends CoreView.extend(ViewMixin, ActionSupport, ClassNamesSupport) { // methods readDOMAttr(name: string): string; // properties @@ -844,18 +804,10 @@ declare module 'ember' { **/ toString(): string; - static create( - this: EmberClassConstructor - ): Fix; + static create(this: EmberClassConstructor): Fix; - static create< - Instance, - Args, - T1 extends EmberInstanceArguments - >( - this: EmberClassConstructor< - Instance & ComputedProperties - >, + static create>( + this: EmberClassConstructor>, arg1: T1 & ThisType> ): Fix; @@ -865,9 +817,7 @@ declare module 'ember' { T1 extends EmberInstanceArguments, T2 extends EmberInstanceArguments >( - this: EmberClassConstructor< - Instance & ComputedProperties - >, + this: EmberClassConstructor>, arg1: T1 & ThisType>, arg2: T2 & ThisType> ): Fix; @@ -879,9 +829,7 @@ declare module 'ember' { T2 extends EmberInstanceArguments, T3 extends EmberInstanceArguments >( - this: EmberClassConstructor< - Instance & ComputedProperties - >, + this: EmberClassConstructor>, arg1: T1 & ThisType>, arg2: T2 & ThisType>, arg3: T3 & ThisType> @@ -891,12 +839,7 @@ declare module 'ember' { this: Statics & EmberClassConstructor ): Objectify & EmberClassConstructor; - static extend< - Statics, - Instance extends B1, - T1 extends EmberClassArguments, - B1 - >( + static extend( this: Statics & EmberClassConstructor, arg1: MixinOrLiteral & ThisType> ): Objectify & EmberClassConstructor; @@ -926,12 +869,9 @@ declare module 'ember' { >( this: Statics & EmberClassConstructor, arg1: MixinOrLiteral & ThisType>, - arg2: MixinOrLiteral & - ThisType>, - arg3: MixinOrLiteral & - ThisType> - ): Objectify & - EmberClassConstructor; + arg2: MixinOrLiteral & ThisType>, + arg3: MixinOrLiteral & ThisType> + ): Objectify & EmberClassConstructor; static extend< Statics, @@ -947,25 +887,16 @@ declare module 'ember' { >( this: Statics & EmberClassConstructor, arg1: MixinOrLiteral & ThisType>, - arg2: MixinOrLiteral & - ThisType>, - arg3: MixinOrLiteral & - ThisType>, - arg4: MixinOrLiteral & - ThisType> - ): Objectify & - EmberClassConstructor; + arg2: MixinOrLiteral & ThisType>, + arg3: MixinOrLiteral & ThisType>, + arg4: MixinOrLiteral & ThisType> + ): Objectify & EmberClassConstructor; static reopen( this: Statics & EmberClassConstructor ): Objectify & EmberClassConstructor; - static reopen< - Statics, - Instance extends B1, - T1 extends EmberClassArguments, - B1 - >( + static reopen( this: Statics & EmberClassConstructor, arg1: MixinOrLiteral & ThisType> ): Objectify & EmberClassConstructor; @@ -995,12 +926,9 @@ declare module 'ember' { >( this: Statics & EmberClassConstructor, arg1: MixinOrLiteral & ThisType>, - arg2: MixinOrLiteral & - ThisType>, - arg3: MixinOrLiteral & - ThisType> - ): Objectify & - EmberClassConstructor; + arg2: MixinOrLiteral & ThisType>, + arg3: MixinOrLiteral & ThisType> + ): Objectify & EmberClassConstructor; static reopenClass(this: Statics): Statics; @@ -1020,12 +948,7 @@ declare module 'ember' { T1 extends EmberClassArguments, T2 extends EmberClassArguments, T3 extends EmberClassArguments - >( - this: Statics, - arg1: T1, - arg2: T2, - arg3: T3 - ): Statics & T1 & T2 & T3; + >(this: Statics, arg1: T1, arg2: T2, arg3: T3): Statics & T1 & T2 & T3; static detect( this: Statics & EmberClassConstructor, @@ -1075,10 +998,7 @@ declare module 'ember' { /** * Fetch the model types and observe them for changes. */ - watchModelTypes( - typesAdded: Function, - typesUpdated: Function - ): Function; + watchModelTypes(typesAdded: Function, typesUpdated: Function): Function; /** * Fetch the records of a given type and observe them for changes. */ @@ -1190,10 +1110,7 @@ declare module 'ember' { * item. This method corresponds to the `forEach()` method defined in * JavaScript 1.6. */ - forEach( - callbackfn: (value: T, index: number, array: T[]) => void, - thisArg?: any - ): void; + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; /** * Alias for `mapBy` */ @@ -1209,10 +1126,7 @@ declare module 'ember' { * Maps all of the items in the enumeration to another value, returning * a new array. This method corresponds to `map()` defined in JavaScript 1.6. */ - map( - callbackfn: (value: T, index: number, array: T[]) => U, - thisArg?: any - ): U[]; + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; /** * Similar to map, this specialized function returns the value of the named * property on all items in the enumeration. @@ -1227,18 +1141,12 @@ declare module 'ember' { callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any ): S[]; - filter( - callbackfn: (value: T, index: number, array: T[]) => any, - thisArg?: any - ): T[]; + filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; /** * Returns an array with all of the items in the enumeration where the passed * function returns false. This method is the inverse of filter(). */ - reject( - callbackfn: (value: T, index: number, array: T[]) => any, - thisArg?: any - ): T[]; + reject(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; /** * Returns an array with just the items with the matched property. You * can pass an optional second argument with the target value. Otherwise @@ -1284,10 +1192,7 @@ declare module 'ember' { * Returns `true` if the passed function returns true for any item in the * enumeration. */ - any( - callback: (value: T, index: number, array: T[]) => boolean, - target?: {} - ): boolean; + any(callback: (value: T, index: number, array: T[]) => boolean, target?: {}): boolean; /** * Returns `true` if the passed property resolves to the value of the second * argument for any item in the enumerable. This method is often simpler/faster @@ -1299,24 +1204,8 @@ declare module 'ember' { * is a useful way to collect a summary value from an enumeration. This * corresponds to the `reduce()` method defined in JavaScript 1.8. */ - reduce( - callbackfn: ( - previousValue: T, - currentValue: T, - currentIndex: number, - array: T[] - ) => T, - initialValue?: T - ): T; - reduce( - callbackfn: ( - previousValue: U, - currentValue: T, - currentIndex: number, - array: T[] - ) => U, - initialValue: U - ): U; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; /** * Invokes the named method on every object in the receiver that * implements it. This method corresponds to the implementation in @@ -1460,9 +1349,7 @@ declare module 'ember' { * The `helper` method create pure-function helpers without instances. For * example: */ - static helper( - helper: (params: any[], hash?: object) => any - ): Helper; + static helper(helper: (params: any[], hash?: object) => any): Helper; /** * Override this function when writing a class-based helper. */ @@ -1479,12 +1366,7 @@ declare module 'ember' { * for Ember. */ const Instrumentation: { - instrument( - name: string, - payload: any, - callback: Function, - binding: any - ): void; + instrument(name: string, payload: any, callback: Function, binding: any): void; reset(): void; subscribe(pattern: string, object: any): void; unsubscribe(subscriber: any): void; @@ -1728,11 +1610,7 @@ declare module 'ember' { * false, this will be applied automatically. Otherwise you can apply the mixin * at anytime by calling `Ember.NativeArray.apply(Array.prototype)`. */ - interface NativeArray - extends GlobalArray, - MutableArray, - Observable, - Copyable { + interface NativeArray extends GlobalArray, MutableArray, Observable, Copyable { /** * __Required.__ You must implement this method to apply this mixin. */ @@ -1756,24 +1634,8 @@ declare module 'ember' { * is a useful way to collect a summary value from an enumeration. This * corresponds to the `reduce()` method defined in JavaScript 1.8. */ - reduce( - callbackfn: ( - previousValue: T, - currentValue: T, - currentIndex: number, - array: T[] - ) => T, - initialValue?: T - ): T; - reduce( - callbackfn: ( - previousValue: U, - currentValue: T, - currentIndex: number, - array: T[] - ) => U, - initialValue: U - ): U; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } const NativeArray: Mixin>; /** @@ -1806,18 +1668,12 @@ declare module 'ember' { /** * Retrieves the value of a property from the object. */ - get( - this: ComputedProperties, - key: K - ): T[K]; + get(this: ComputedProperties, key: K): T[K]; /** * To get the values of multiple properties at once, call `getProperties` * with a list of strings or an array: */ - getProperties( - this: ComputedProperties, - list: K[] - ): Pick; + getProperties(this: ComputedProperties, list: K[]): Pick; getProperties( this: ComputedProperties, ...list: K[] @@ -1825,11 +1681,7 @@ declare module 'ember' { /** * Sets the provided key or path to the value. */ - set( - this: ComputedProperties, - key: K, - value: T[K] - ): T[K]; + set(this: ComputedProperties, key: K, value: T[K]): T[K]; /** * Sets a list of properties at once. These properties are set inside * a single `beginPropertyChanges` and `endPropertyChanges` batch, so @@ -1890,10 +1742,7 @@ declare module 'ember' { * without accidentally invoking it if it is intended to be * generated lazily. */ - cacheFor( - this: ComputedProperties, - key: K - ): T[K] | undefined; + cacheFor(this: ComputedProperties, key: K): T[K] | undefined; } const Observable: Mixin; /** @@ -2003,9 +1852,7 @@ declare module 'ember' { /** * Disconnects a view that has been rendered into an outlet. */ - disconnectOutlet( - options: string | { outlet?: string; parentView?: string } - ): void; + disconnectOutlet(options: string | { outlet?: string; parentView?: string }): void; /** * A hook you can implement to convert the URL into the model for @@ -2092,11 +1939,7 @@ declare module 'ember' { * A hook you can use to reset controller values either when the model * changes or the route is exiting. */ - resetController( - controller: Controller, - isExiting: boolean, - transition: any - ): void; + resetController(controller: Controller, isExiting: boolean, transition: any): void; /** * Sends an action to the router, which will delegate it to the currently active @@ -2276,10 +2119,10 @@ declare module 'ember' { mount( name: string, options?: { - as?: string; - path?: string; - resetNamespace?: boolean; - engineInfo?: any; + as?: string, + path?: string, + resetNamespace?: boolean, + engineInfo?: any } ): void; } @@ -2395,9 +2238,7 @@ declare module 'ember' { * Used to register callbacks to be fired whenever `App.injectTestHelpers` * is called. */ - function onInjectHelpers( - callback: (app: Application) => void - ): void; + function onInjectHelpers(callback: (app: Application) => void): void; /** * This returns a thenable tailored for testing. It catches failed * `onSuccess` callbacks and invokes the `Ember.Test.adapter.exception` @@ -2415,11 +2256,7 @@ declare module 'ember' { * The only difference is this uses * an instance of `Ember.Test.Promise` */ - function resolve( - value?: T | PromiseLike, - label?: string - ): Ember.Test.Promise; - function resolve(): Ember.Test.Promise; + function resolve(value?: T | PromiseLike, label?: string): Ember.Test.Promise; /** * This allows ember-testing to play nicely with other asynchronous * events, such as an application that is waiting for a CSS3 @@ -2517,12 +2354,7 @@ declare module 'ember' { } namespace Handlebars { function compile(string: string): Function; - function compile( - environment: any, - options?: any, - context?: any, - asObject?: any - ): any; + function compile(environment: any, options?: any, context?: any, asObject?: any): any; function precompile(string: string, options: any): void; class Compiler {} class JavaScriptCompiler {} @@ -2554,14 +2386,8 @@ declare module 'ember' { } const computed: { (cb: ComputedPropertyCallback): ComputedProperty; - (k1: string, cb: ComputedPropertyCallback): ComputedProperty< - T - >; - ( - k1: string, - k2: string, - cb: ComputedPropertyCallback - ): ComputedProperty; + (k1: string, cb: ComputedPropertyCallback): ComputedProperty; + (k1: string, k2: string, cb: ComputedPropertyCallback): ComputedProperty; ( k1: string, k2: string, @@ -2634,10 +2460,7 @@ declare module 'ember' { * dependent property against a given RegExp, returning `true` * if the value matches the RegExp and `false` if it does not. */ - match( - dependentKey: string, - regexp: RegExp - ): ComputedProperty; + match(dependentKey: string, regexp: RegExp): ComputedProperty; /** * A computed property that returns true if the provided dependent property * is equal to the given value. @@ -2742,10 +2565,7 @@ declare module 'ember' { /** * Returns an array mapped to the specified key. */ - mapBy( - dependentKey: string, - propertyKey: string - ): ComputedProperty; + mapBy(dependentKey: string, propertyKey: string): ComputedProperty; /** * Filters the array by the callback. */ @@ -2770,10 +2590,7 @@ declare module 'ember' { * A computed property which returns a new array with all the unique * elements from an array, with uniqueness determined by specific key. */ - uniqBy( - dependentKey: string, - propertyKey: string - ): ComputedProperty; + uniqBy(dependentKey: string, propertyKey: string): ComputedProperty; /** * A computed property which returns a new array with all the unique * elements from one or more dependent arrays. @@ -2789,10 +2606,7 @@ declare module 'ember' { * properties from the first dependent array that are not in the second * dependent array. */ - setDiff( - setAProperty: string, - setBProperty: string - ): ComputedProperty; + setDiff(setAProperty: string, setBProperty: string): ComputedProperty; /** * A computed property that returns the array of values * for the provided dependent properties. @@ -2821,10 +2635,7 @@ declare module 'ember' { * present it will queue itself to run on the existing run-loops action * queue. */ - join( - method: (...args: any[]) => Ret, - ...args: any[] - ): Ret | undefined; + join(method: (...args: any[]) => Ret, ...args: any[]): Ret | undefined; join( target: Target, method: RunMethod, @@ -2876,11 +2687,7 @@ declare module 'ember' { * of milliseconds. */ later(method: (...args: any[]) => any, wait: number): EmberRunTimer; - later( - target: Target, - method: RunMethod, - wait: number - ): EmberRunTimer; + later(target: Target, method: RunMethod, wait: number): EmberRunTimer; later( target: Target, method: RunMethod, @@ -2936,11 +2743,7 @@ declare module 'ember' { * Schedule a function to run one time during the current RunLoop. This is equivalent * to calling `scheduleOnce` with the "actions" queue. */ - once( - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; + once(target: Target, method: RunMethod, ...args: any[]): EmberRunTimer; /** * Schedules a function to run one time in a given queue of the current RunLoop. * Calling this method with the same queue/target/method combination will have @@ -2957,11 +2760,7 @@ declare module 'ember' { * control has been returned to the system. This is equivalent to calling * `run.later` with a wait time of 1ms. */ - next( - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; + next(target: Target, method: RunMethod, ...args: any[]): EmberRunTimer; /** * Cancels a scheduled item. Must be a value returned by `run.later()`, * `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or @@ -3185,20 +2984,12 @@ declare module 'ember' { /** * Display a warning with the provided message. */ - function warn( - message: string, - test: boolean, - options: { id: string } - ): any; + function warn(message: string, test: boolean, options: { id: string }): any; function warn(message: string, options: { id: string }): any; /** * @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options */ - function warn( - message: string, - test: boolean, - options?: { id?: string } - ): any; + function warn(message: string, test: boolean, options?: { id?: string }): any; /** * @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options */ @@ -3244,20 +3035,12 @@ declare module 'ember' { * a target is executed on the passed object. If an array of actions * is not passed, the actions stored on the passed object are invoked. */ - function sendEvent( - obj: any, - eventName: string, - params?: any[], - actions?: any[] - ): boolean; + function sendEvent(obj: any, eventName: string, params?: any[], actions?: any[]): boolean; /** * Define a property as a function that should be executed when * a specified event or events are triggered. */ - function on( - eventNames: string, - func: (...args: any[]) => void - ): (...args: any[]) => void; + function on(eventNames: string, func: (...args: any[]) => void): (...args: any[]) => void; /** * To get multiple properties at once, call `Ember.getProperties` * with an object followed by a list of strings or an array: @@ -3301,10 +3084,7 @@ declare module 'ember' { /** * Specify a method that observes property changes. */ - function observer( - key1: string, - func: (target: any, key: string) => void - ): void; + function observer(key1: string, func: (target: any, key: string) => void): void; function observer( key1: string, key2: string, @@ -3356,10 +3136,7 @@ declare module 'ember' { * the function will be invoked. If the property is not defined but the * object implements the `unknownProperty` method then that will be invoked. */ - function get( - obj: ComputedProperties, - key: K - ): T[K]; + function get(obj: ComputedProperties, key: K): T[K]; /** * Retrieves the value of a property from an Object, or a default value in the * case that the property returns `undefined`. @@ -3440,12 +3217,7 @@ declare module 'ember' { */ function assign(target: T, source: U): T & U; function assign(target: T, source1: U, source2: V): T & U & V; - function assign( - target: T, - source1: U, - source2: V, - source3: W - ): T & U & V & W; + function assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; /** * Polyfill for Object.create * @deprecated Use Object.create @@ -3527,10 +3299,7 @@ declare module 'ember' { /** * Expands `pattern`, invoking `callback` for each expansion. */ - function expandProperties( - pattern: string, - callback: (expanded: string) => void - ): void; + function expandProperties(pattern: string, callback: (expanded: string) => void): void; } export default Ember; diff --git a/types/ember/test/computed.ts b/types/ember/test/computed.ts index 7376d14639..c812ef62b3 100755 --- a/types/ember/test/computed.ts +++ b/types/ember/test/computed.ts @@ -27,13 +27,13 @@ const Person = Ember.Object.extend({ this.set('firstName', first); this.set('lastName', last); return value; - }, + } }), fullNameGetOnly: Ember.computed('fullName', { get() { return this.get('fullName'); - }, + } }), fullNameSetOnly: Ember.computed('firstName', 'lastName', { @@ -42,16 +42,15 @@ const Person = Ember.Object.extend({ this.set('firstName', first); this.set('lastName', last); return value; - }, + } }), combinators: Ember.computed(function() { return this.get('firstName'); - }) - .property('firstName') - .meta({ foo: 'bar' }) - .volatile() - .readOnly(), + }).property('firstName') + .meta({ foo: 'bar' }) + .volatile() + .readOnly() }); const person = Person.create({ @@ -80,12 +79,10 @@ assertType(person.get('fullNameGetOnly')); assertType(person.get('fullNameSetOnly')); assertType(person.get('combinators')); -assertType<{ firstName: string; fullName: string; age: number }>( - person.getProperties('firstName', 'fullName', 'age') -); +assertType<{ firstName: string, fullName: string, age: number }>(person.getProperties('firstName', 'fullName', 'age')); const person2 = Person.create({ - fullName: 'Fred Smith', + fullName: 'Fred Smith' }); assertType(person2.get('firstName')); @@ -93,7 +90,7 @@ assertType(person2.get('fullName')); const person3 = Person.extend({ firstName: 'Fred', - fullName: 'Fred Smith', + fullName: 'Fred Smith' }).create(); assertType(person3.get('firstName')); @@ -101,7 +98,7 @@ assertType(person3.get('fullName')); const person4 = Person.extend({ firstName: Ember.computed(() => 'Fred'), - fullName: Ember.computed(() => 'Fred Smith'), + fullName: Ember.computed(() => 'Fred Smith') }).create(); assertType(person4.get('firstName')); @@ -115,13 +112,13 @@ const objectWithComputedProperties = Ember.Object.extend({ collect: Ember.computed.collect('foo', 'bar', 'baz', 'qux'), deprecatingAlias: Ember.computed.deprecatingAlias('foo', { id: 'hamster.deprecate-banana', - until: '3.0.0', + until: '3.0.0' }), empty: Ember.computed.empty('foo'), equalNumber: Ember.computed.equal('foo', 1), equalString: Ember.computed.equal('foo', 'bar'), equalObject: Ember.computed.equal('foo', {}), - filter: Ember.computed.filter('foo', item => item === 'bar'), + filter: Ember.computed.filter('foo', (item) => item === 'bar'), filterBy1: Ember.computed.filterBy('foo', 'bar'), filterBy2: Ember.computed.filterBy('foo', 'bar', false), gt: Ember.computed.gt('foo', 3), @@ -155,11 +152,11 @@ const objectWithComputedProperties = Ember.Object.extend({ sum: Ember.computed.sum('foo'), union: Ember.computed.union('foo', 'bar', 'baz', 'qux'), uniq: Ember.computed.uniq('foo'), - uniqBy: Ember.computed.uniqBy('foo', 'bar'), + uniqBy: Ember.computed.uniqBy('foo', 'bar') }); const component2 = Component.extend({ - isAnimal: or('isDog', 'isCat'), + isAnimal: or('isDog', 'isCat') }).create(); assertType(component2.get('isAnimal')); From 59fb243c3d8e4a32ae994974b640cb0be03346f1 Mon Sep 17 00:00:00 2001 From: ark120202 Date: Fri, 29 Dec 2017 05:05:50 +0500 Subject: [PATCH 256/890] Add types for "markdownlint" --- types/markdownlint/index.d.ts | 49 ++++++++++++++++++++++++ types/markdownlint/markdownlint-tests.ts | 38 ++++++++++++++++++ types/markdownlint/tsconfig.json | 23 +++++++++++ types/markdownlint/tslint.json | 1 + 4 files changed, 111 insertions(+) create mode 100644 types/markdownlint/index.d.ts create mode 100644 types/markdownlint/markdownlint-tests.ts create mode 100644 types/markdownlint/tsconfig.json create mode 100644 types/markdownlint/tslint.json diff --git a/types/markdownlint/index.d.ts b/types/markdownlint/index.d.ts new file mode 100644 index 0000000000..5e66f15185 --- /dev/null +++ b/types/markdownlint/index.d.ts @@ -0,0 +1,49 @@ +// Type definitions for markdownlint 0.6 +// Project: https://github.com/DavidAnson/markdownlint +// Definitions by: ark120202 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function markdownlint( + options: markdownlint.MarkdownlintOptions, + callback: (err: Error | null, result: markdownlint.MarkdownlintResults) => any, +): void; + +declare namespace markdownlint { + function sync(options: MarkdownlintOptions): MarkdownlintResults; + + function readConfig( + file: string, + callback: (err: Error | null, result: MarkdownlintConfig) => any, + ): void; + function readConfigSync(file: string): MarkdownlintConfig; + + interface MarkdownlintConfig { + [rule: string]: boolean | { [key: string]: any }; + } + + interface MarkdownlintOptions { + files?: ReadonlyArray | string; + strings?: { [identifier: string]: string }; + config?: MarkdownlintConfig; + frontMatter?: RegExp; + noInlineConfig?: boolean; + resultVersion?: number; + } + + interface MarkdownlintResult { + lineNumber: number; + ruleName: string; + ruleAlias: string; + ruleDescription: string; + errorDetail?: string; + errorContext: string; + errorRange?: [number, number]; + } + + interface MarkdownlintResults { + [source: string]: MarkdownlintResult[] | ((useAlias?: boolean) => string); + toString(useAlias?: boolean): string; + } +} + +export = markdownlint; diff --git a/types/markdownlint/markdownlint-tests.ts b/types/markdownlint/markdownlint-tests.ts new file mode 100644 index 0000000000..faca81872d --- /dev/null +++ b/types/markdownlint/markdownlint-tests.ts @@ -0,0 +1,38 @@ +import * as markdownlint from 'markdownlint'; + +const config: markdownlint.MarkdownlintConfig = { + default: true, + MD003: { style: 'atx_closed' }, + MD007: { indent: 4 }, + 'no-hard-tabs': false, + whitespace: false, +}; + +const options: markdownlint.MarkdownlintOptions = { + files: ['README.md'], + strings: { 'file.md': 'Header' }, + config, + noInlineConfig: false, + resultVersion: 1, +}; + +// $ExpectType MarkdownlintResults +const results = markdownlint.sync(options); + +markdownlint(options, (err, results) => { + // $ExpectType Error | null + err; + + // $ExpectType MarkdownlintResults + results; + + const resultString: string = results.toString(); + // $ExpectError + results.toString() as markdownlint.MarkdownlintResult[]; + + const fileErrors: markdownlint.MarkdownlintResult[] = results[ + 'file.md' + ] as markdownlint.MarkdownlintResult[]; + const firstFileError: markdownlint.MarkdownlintResult = fileErrors[0]; + const firstFileErrorRule: string = firstFileError.ruleName; +}); diff --git a/types/markdownlint/tsconfig.json b/types/markdownlint/tsconfig.json new file mode 100644 index 0000000000..53b9ae46aa --- /dev/null +++ b/types/markdownlint/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "markdownlint-tests.ts" + ] +} diff --git a/types/markdownlint/tslint.json b/types/markdownlint/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/markdownlint/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f0a90ecec79960954a7fbe74fe5e9406e77fc001 Mon Sep 17 00:00:00 2001 From: Daniel Perez Alvarez Date: Thu, 28 Dec 2017 16:25:20 -0800 Subject: [PATCH 257/890] Add types for adal-angular 1.0 --- types/adal-angular/adal-angular-tests.ts | 84 +++++++ types/adal-angular/index.d.ts | 277 +++++++++++++++++++++++ types/adal-angular/tsconfig.json | 24 ++ types/adal-angular/tslint.json | 1 + 4 files changed, 386 insertions(+) create mode 100644 types/adal-angular/adal-angular-tests.ts create mode 100644 types/adal-angular/index.d.ts create mode 100644 types/adal-angular/tsconfig.json create mode 100644 types/adal-angular/tslint.json diff --git a/types/adal-angular/adal-angular-tests.ts b/types/adal-angular/adal-angular-tests.ts new file mode 100644 index 0000000000..272591d56e --- /dev/null +++ b/types/adal-angular/adal-angular-tests.ts @@ -0,0 +1,84 @@ +import AuthenticationContext, { + AuthenticationContextOptions, + TokenCallback, + UserCallback +} from "adal-angular"; + +const onLogin: TokenCallback = (errorDescription, idToken, error) => { + if (error) { + console.error(errorDescription, error); + return; + } + if (config.popUp) { + authenticationContext.getUser(onUser); + } +}; + +const onToken: TokenCallback = (errorDesc, token, error) => { + if (error) { + console.error(error); + return; + } + console.log('Making request with token:', token); +}; + +const onUser: UserCallback = (error, user) => { + if (error) { + console.error(error); + return; + } + acquireAnAccessToken(); +}; + +const acquireAnAccessToken = () => { + const resourceId = "https://graph.microsoft.net"; + authenticationContext.acquireToken( + resourceId, + (errorDesc, token, error) => { + if (error) { + if (config.popUp) { + authenticationContext.acquireTokenPopup( + resourceId, + null, + null, + onToken + ); + } else { + authenticationContext.acquireTokenRedirect( + resourceId, + null, + null + ); + } + } else { + onToken(errorDesc, token, error); + } + } + ); +}; + +const config: AuthenticationContextOptions = { + clientId: "7cee0f68-5051-41f6-9e45-80463d21d65d", + redirectUri: "http://localhost:16969/", + instance: "https://login.microsoftonline.com/", + tenant: "contoso.onmicrosoft.com", + extraQueryParameter: "nux=1", + correlationId: "123", + popUp: true, + cacheLocation: "localStorage", + callback: onLogin +}; + +const authenticationContext = new AuthenticationContext(config); + +if (authenticationContext.isCallback(window.location.hash)) { + authenticationContext.handleWindowCallback(); +} else if (authenticationContext.getCachedUser() == null) { + authenticationContext.login(); +} else { + acquireAnAccessToken(); +} + +setTimeout(() => { + authenticationContext.logOut(); +}, 60000); diff --git a/types/adal-angular/index.d.ts b/types/adal-angular/index.d.ts new file mode 100644 index 0000000000..00dc813ee8 --- /dev/null +++ b/types/adal-angular/index.d.ts @@ -0,0 +1,277 @@ +// Type definitions for adal-angular 1.0 +// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js#readme +// Definitions by: Daniel Perez Alvarez +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export enum LoggingLevel { + ERROR = 0, + WARNING = 1, + INFO = 2, + VERBOSE = 3 +} + +export type RequestType = "LOGIN" | "RENEW_TOKEN" | "UNKNOWN"; + +export type ResponseType = "id_token token" | "token"; + +export interface RequestInfo { + /** + * Object comprising of fields such as id_token/error, session_state, state, e.t.c. + */ + parameters: any; + /** + * Request type. + */ + requestType: RequestType; + /** + * Whether state is valid. + */ + stateMatch: boolean; + /** + * Unique guid used to match the response with the request. + */ + stateResponse: string; + /** + * Whether `requestType` contains `id_token`, `access_token` or error. + */ + valid: boolean; +} + +export interface UserInfo { + /** + * Username assigned from UPN or email. + */ + userName: string; + /** + * Properties parsed from `id_token`. + */ + profile: any; +} + +export type TokenCallback = ( + errorDesc: string | null, + token: string, + error: any +) => void; + +export type UserCallback = (errorDesc: string | null, user: UserInfo) => void; + +export interface AuthenticationContextOptions { + /** + * Client ID assigned to your app by Azure Active Directory. + */ + clientId: string; + /** + * Endpoint at which you expect to receive tokens.Defaults to `window.location.href`. + */ + redirectUri: string; + /** + * Azure Active Directory instance. Defaults to `https://login.microsoftonline.com/`. + */ + instance?: string; + /** + * Your target tenant. Defaults to `common`. + */ + tenant?: string; + /** + * Query parameters to add to the authentication request. + */ + extraQueryParameter?: string; + /** + * Unique identifier used to map the request with the response. Defaults to RFC4122 version 4 guid (128 bits). + */ + correlationId?: string; + /** + * User defined function of handling the navigation to Azure AD authorization endpoint in case of login. + */ + displayCall?: (url: string) => void; + /** + * Set this to true to enable login in a popup winodow instead of a full redirect. Defaults to `false`. + */ + popUp?: boolean; + /** + * Set this to the resource to request on login. Defaults to `clientId`. + */ + loginResource?: string; + /** + * Set this to redirect the user to a custom login page. + */ + localLoginUrl?: string; + /** + * Redirects to start page after login. Defaults to `true`. + */ + navigateToLoginRequestUrl?: boolean; + /** + * Set this to redirect the user to a custom logout page. + */ + logOutUri?: string; + /** + * Redirects the user to postLogoutRedirectUri after logout. Defaults to `redirectUri`. + */ + postLogoutRedirectUri?: string; + /** + * Sets browser storage to either 'localStorage' or sessionStorage'. Defaults to `sessionStorage`. + */ + cacheLocation?: "localStorage" | "sessionStorage"; + /** + * Array of keywords or URIs. Adal will attach a token to outgoing requests that have these keywords or URIs. + */ + endpoints?: { [resource: string]: string }; + /** + * Array of keywords or URIs. Adal will not attach a token to outgoing requests that have these keywords or URIs. + */ + anonymousEndpoints?: string[]; + /** + * If the cached token is about to be expired in the expireOffsetSeconds (in seconds), Adal will renew the token instead of using the cached token. Defaults to 300 seconds. + */ + expireOffsetSeconds?: number; + /** + * The number of milliseconds of inactivity before a token renewal response from AAD should be considered timed out. Defaults to 6 seconds. + */ + loadFrameTimeout?: number; + /** + * Callback to be invoked when a token is acquired. + */ + callback?: TokenCallback; +} + +export default class AuthenticationContext { + constructor(options: AuthenticationContextOptions); + /** + * Initiates the login process by redirecting the user to Azure AD authorization endpoint. + */ + login(): void; + /** + * Returns whether a login is in progress. + */ + loginInProgress(): boolean; + /** + * Gets token for the specified resource from the cache. + * @param resource A URI that identifies the resource for which the token is requested. + */ + getCachedToken(resource: string): string; + /** + * If user object exists, returns it. Else creates a new user object by decoding `id_token` from the cache. + */ + getCachedUser(): UserInfo; + /** + * Adds the passed callback to the array of callbacks for the specified resource. + * @param resource A URI that identifies the resource for which the token is requested. + * @param expectedState A unique identifier (guid). + * @param callback The callback provided by the caller. It will be called with token or error. + */ + registerCallback( + expectedState: string, + resource: string, + callback: TokenCallback + ): void; + /** + * Acquires token from the cache if it is not expired. Otherwise sends request to AAD to obtain a new token. + * @param resource Resource URI identifying the target resource. + * @param callback The callback provided by the caller. It will be called with token or error. + */ + acquireToken(resource: string, callback: TokenCallback): void; + /** + * Acquires token (interactive flow using a popup window) by sending request to AAD to obtain a new token. + * @param resource Resource URI identifying the target resource. + * @param extraQueryParameters Query parameters to add to the authentication request. + * @param claims Claims to add to the authentication request. + * @param callback The callback provided by the caller. It will be called with token or error. + */ + acquireTokenPopup( + resource: string, + extraQueryParameters: string | null | undefined, + claims: string | null | undefined, + callback: TokenCallback + ): void; + /** + * Acquires token (interactive flow using a redirect) by sending request to AAD to obtain a new token. In this case the callback passed in the authentication request constructor will be called. + * @param resource Resource URI identifying the target resource. + * @param extraQueryParameters Query parameters to add to the authentication request. + * @param claims Claims to add to the authentication request. + */ + acquireTokenRedirect( + resource: string, + extraQueryParameters?: string | null, + claims?: string | null + ): void; + /** + * Redirects the browser to Azure AD authorization endpoint. + * @param urlNavigate URL of the authorization endpoint. + */ + promptUser(urlNavigate: string): void; + /** + * Clears cache items. + */ + clearCache(): void; + /** + * Clears cache items for a given resource. + * @param resource Resource URI identifying the target resource. + */ + clearCacheForResource(resource: string): void; + /** + * Redirects user to logout endpoint. After logout, it will redirect to `postLogoutRedirectUri` if added as a property on the config object. + */ + logOut(): void; + /** + * Calls the passed in callback with the user object or error message related to the user. + * @param callback The callback provided by the caller. It will be called with user or error. + */ + getUser(callback: UserCallback): void; + /** + * Checks if the URL fragment contains access token, id token or error description. + * @param hash Hash passed from redirect page. + */ + isCallback(hash: string): boolean; + /** + * Gets login error. + */ + getLoginError(): string; + /** + * Creates a request info object from the URL fragment and returns it. + */ + getRequestInfo(hash: string): RequestInfo; + /** + * Saves token or error received in the response from AAD in the cache. In case of `id_token`, it also creates the user object. + */ + saveTokenFromHash(requestInfo: RequestInfo): void; + /** + * Gets resource for given endpoint if mapping is provided with config. + * @param endpoint Resource URI identifying the target resource. + */ + getResourceForEndpoint(resource: string): string; + /** + * This method must be called for processing the response received from AAD. It extracts the hash, processes the token or error, saves it in the cache and calls the callbacks with the result. + * @param hash Hash fragment of URL. Defaults to `window.location.hash`. + */ + handleWindowCallback(hash?: string): void; + + /** + * Checks the logging Level, constructs the log message and logs it. Users need to implement/override this method to turn on logging. + * @param level Level can be set 0, 1, 2 and 3 which turns on 'error', 'warning', 'info' or 'verbose' level logging respectively. + * @param message Message to log. + * @param error Error to log. + */ + log(level: LoggingLevel, message: string, error: any): void; + /** + * Logs messages when logging level is set to 0. + * @param message Message to log. + * @param error Error to log. + */ + error(message: string, error: any): void; + /** + * Logs messages when logging level is set to 1. + * @param message Message to log. + */ + warn(message: string): void; + /** + * Logs messages when logging level is set to 2. + * @param message Message to log. + */ + info(message: string): void; + /** + * Logs messages when logging level is set to 3. + * @param message Message to log. + */ + verbose(message: string): void; +} diff --git a/types/adal-angular/tsconfig.json b/types/adal-angular/tsconfig.json new file mode 100644 index 0000000000..9052e3fc04 --- /dev/null +++ b/types/adal-angular/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "adal-angular-tests.ts" + ] +} \ No newline at end of file diff --git a/types/adal-angular/tslint.json b/types/adal-angular/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/adal-angular/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 8fec052c16fab6818126876541159b90c21aaf46 Mon Sep 17 00:00:00 2001 From: Timur Manyanov Date: Fri, 29 Dec 2017 11:48:41 +0100 Subject: [PATCH 258/890] Fix callback arguments type, add more tests, reduce redundancy --- types/kraken-js/index.d.ts | 10 ++++--- types/kraken-js/kraken-js-tests.ts | 46 ++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/types/kraken-js/index.d.ts b/types/kraken-js/index.d.ts index 776228f0ac..0980e31eb1 100644 --- a/types/kraken-js/index.d.ts +++ b/types/kraken-js/index.d.ts @@ -5,22 +5,24 @@ // TypeScript Version: 2.2 import { Express } from 'express'; +import { EventEmitter } from 'events'; declare function k(options?: k.Options | string): Express; declare namespace k { - interface Kraken extends Express { - once(name: string, cb: (err: Error | null, result?: any) => any): void; + interface Kraken extends Express, EventEmitter { kraken: Kraken; } interface Options { protocols?: object; basedir?: string; + configdir?: string; mountpath?: string; inheritViews?: boolean; - startupHeaders?: Map; - onconfig?(config: object, next: (err: Error | null, config?: object) => any): any; + startupHeaders?: { [key: string]: string; }; + onconfig?(config: Map, next: (err: Error | null, config?: object) => any): any; + uncaughtException?(err: Error): any; } } diff --git a/types/kraken-js/kraken-js-tests.ts b/types/kraken-js/kraken-js-tests.ts index 86e44caae1..f3b7eea8c7 100644 --- a/types/kraken-js/kraken-js-tests.ts +++ b/types/kraken-js/kraken-js-tests.ts @@ -2,6 +2,7 @@ import express = require('express'); import kraken = require('kraken-js'); import * as http from 'http'; import * as https from 'https'; +import { readFile } from 'fs'; const app = express() as kraken.Kraken; @@ -13,16 +14,55 @@ kraken('path/to/options'); // $ExpectType Express kraken({ - onconfig: (config, next) => { + basedir: __dirname, + onconfig(config, next) { + config.get('view engines:js:renderer:arguments').push(app); + config.set('some:string', '/foo'); + config.set('some:complex:type', [{ + uncaughtException(error: Error) { + next(error); + } + }]); next(null, config); + }, + protocols: { + file(value: string, callback: any) { + readFile(value, 'utf8', callback); + } + }, + startupHeaders: { + 'Custom-Header1': 'Header1', + 'Custom-Header2': 'Header2' + }, + uncaughtException(err) { + console.error(err); } }); // $ExpectType Kraken app.use(kraken()); -// $ExpectType void -app.once('event', (err, result) => {}); +// $ExpectType Kraken +app.use(kraken(__dirname)); + +// $ExpectType Kraken +app.use(kraken({ + configdir: 'config', + protocols: { + custom(value: any) { + return `Hello, ${ value }!`; + } + } +})); + +app.listen(8080, (err?: Error) => { + console.log('[%s] Listening on http://localhost:%d', app.settings.env, 8080); +}); + +new Promise(resolve => { + // $ExpectType Kraken + app.once('event', resolve); +}); // $ExpectType any app.kraken.get('configProp'); From 6e8155c0c6d21460d80c9baccb0d18b145406ba1 Mon Sep 17 00:00:00 2001 From: york yao Date: Fri, 29 Dec 2017 20:32:28 +0800 Subject: [PATCH 259/890] add types of react-native-qrcode --- types/react-native-qrcode/index.d.ts | 16 ++++++ .../react-native-qrcode-tests.tsx | 50 +++++++++++++++++++ types/react-native-qrcode/tsconfig.json | 25 ++++++++++ types/react-native-qrcode/tslint.json | 1 + 4 files changed, 92 insertions(+) create mode 100644 types/react-native-qrcode/index.d.ts create mode 100644 types/react-native-qrcode/react-native-qrcode-tests.tsx create mode 100644 types/react-native-qrcode/tsconfig.json create mode 100644 types/react-native-qrcode/tslint.json diff --git a/types/react-native-qrcode/index.d.ts b/types/react-native-qrcode/index.d.ts new file mode 100644 index 0000000000..11b54f3a95 --- /dev/null +++ b/types/react-native-qrcode/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for react-native-qrcode 0.2 +// Project: https://github.com/cssivision/react-native-qrcode +// Definitions by: York Yao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; + +export default class QRCode extends React.Component { } + +export interface QRCodeProperties { + value?: string; + size?: number; + bgColor?: string; + fgColor?: string; +} diff --git a/types/react-native-qrcode/react-native-qrcode-tests.tsx b/types/react-native-qrcode/react-native-qrcode-tests.tsx new file mode 100644 index 0000000000..2fd4b22750 --- /dev/null +++ b/types/react-native-qrcode/react-native-qrcode-tests.tsx @@ -0,0 +1,50 @@ +import * as React from 'react'; +import QRCode from 'react-native-qrcode'; + +import { + AppRegistry, + StyleSheet, + View, + TextInput +} from 'react-native'; + +class HelloWorld extends React.Component { + state = { + text: 'http://facebook.github.io/react-native/', + }; + + render() { + return ( + + this.setState({ text })} + value={this.state.text} + /> + + + ); + } +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + backgroundColor: 'white', + alignItems: 'center', + justifyContent: 'center' + }, + + input: { + height: 40, + borderColor: 'gray', + borderWidth: 1, + margin: 10, + borderRadius: 5, + padding: 5, + } +}); diff --git a/types/react-native-qrcode/tsconfig.json b/types/react-native-qrcode/tsconfig.json new file mode 100644 index 0000000000..b21253194b --- /dev/null +++ b/types/react-native-qrcode/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-native-qrcode-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-native-qrcode/tslint.json b/types/react-native-qrcode/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-qrcode/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b102c8b5db70c83167b9417b71c1e245fb343d72 Mon Sep 17 00:00:00 2001 From: Timon van Spronsen Date: Fri, 29 Dec 2017 14:30:55 +0100 Subject: [PATCH 260/890] Update types for Boom 7.1.1 --- types/boom/boom-tests.ts | 82 +++++---- types/boom/index.d.ts | 108 ++++++------ types/boom/v4/boom-tests.ts | 193 +++++++++++++++++++++ types/boom/v4/index.d.ts | 335 ++++++++++++++++++++++++++++++++++++ types/boom/v4/tsconfig.json | 28 +++ types/boom/v4/tslint.json | 79 +++++++++ 6 files changed, 736 insertions(+), 89 deletions(-) create mode 100644 types/boom/v4/boom-tests.ts create mode 100644 types/boom/v4/index.d.ts create mode 100644 types/boom/v4/tsconfig.json create mode 100644 types/boom/v4/tslint.json diff --git a/types/boom/boom-tests.ts b/types/boom/boom-tests.ts index 1819be25cb..a3e4f137ee 100644 --- a/types/boom/boom-tests.ts +++ b/types/boom/boom-tests.ts @@ -5,7 +5,7 @@ import * as Hapi from 'hapi'; const badRequestError = Boom.badRequest('message', {some: 'data'}); badRequestError.data.some; -const badRequestError2: Boom.BoomError = Boom.badImplementation('message'); +const badRequestError2: Boom.Boom = Boom.badImplementation('message'); const unauthorizedError1 = Boom.unauthorized('message', 'scheme', {some: 'attribute'}); unauthorizedError1.output.payload.attributes === { some: 'attribute', error: 'message' }; @@ -25,125 +25,131 @@ unauthorizedError4.output.headers === { 'WWW-Authenticate': 'scheme some="attrib const paymentRequiredError = Boom.paymentRequired('message', {some: 'data'}); paymentRequiredError.data.some; -const paymentRequiredError2: Boom.BoomError = Boom.paymentRequired('message'); +const paymentRequiredError2: Boom.Boom = Boom.paymentRequired('message'); const forbiddenError = Boom.forbidden('message', {some: 'data'}); forbiddenError.data.some; -const forbiddenError2: Boom.BoomError = Boom.forbidden('message'); +const forbiddenError2: Boom.Boom = Boom.forbidden('message'); const notFoundError = Boom.notFound('message', {some: 'data'}); notFoundError.data.some; -const notFoundError2: Boom.BoomError = Boom.notFound('message'); +const notFoundError2: Boom.Boom = Boom.notFound('message'); const methodNotAllowedError = Boom.methodNotAllowed('message', {some: 'data'}); methodNotAllowedError.data.some; -const methodNotAllowedError2: Boom.BoomError = Boom.methodNotAllowed('message'); +const methodNotAllowedError2: Boom.Boom = Boom.methodNotAllowed('message'); const notAcceptableError = Boom.notAcceptable('message', {some: 'data'}); notAcceptableError.data.some; -const notAcceptableError2: Boom.BoomError = Boom.notAcceptable('message'); +const notAcceptableError2: Boom.Boom = Boom.notAcceptable('message'); const proxyAuthRequiredError = Boom.proxyAuthRequired('message', {some: 'data'}); proxyAuthRequiredError.data.some; -const proxyAuthRequiredError2: Boom.BoomError = Boom.proxyAuthRequired('message'); +const proxyAuthRequiredError2: Boom.Boom = Boom.proxyAuthRequired('message'); const clientTimeoutError = Boom.clientTimeout('message', {some: 'data'}); clientTimeoutError.data.some; -const clientTimeoutError2: Boom.BoomError = Boom.clientTimeout('message'); +const clientTimeoutError2: Boom.Boom = Boom.clientTimeout('message'); const conflictError = Boom.conflict('message', {some: 'data'}); conflictError.data.some; const resourceGoneError = Boom.resourceGone('message', {some: 'data'}); resourceGoneError.data.some; -const resourceGoneError2: Boom.BoomError = Boom.resourceGone('message'); +const resourceGoneError2: Boom.Boom = Boom.resourceGone('message'); const lengthRequiredError = Boom.lengthRequired('message', {some: 'data'}); lengthRequiredError.data.some; -const lengthRequiredError2: Boom.BoomError = Boom.lengthRequired('message'); +const lengthRequiredError2: Boom.Boom = Boom.lengthRequired('message'); const preconditionFailedError = Boom.preconditionFailed('message', {some: 'data'}); preconditionFailedError.data.some; -const preconditionFailedError2: Boom.BoomError = Boom.preconditionFailed('message'); +const preconditionFailedError2: Boom.Boom = Boom.preconditionFailed('message'); const entityTooLargeError = Boom.entityTooLarge('message', {some: 'data'}); entityTooLargeError.data.some; -const entityTooLargeError2: Boom.BoomError = Boom.lengthRequired('message'); +const entityTooLargeError2: Boom.Boom = Boom.lengthRequired('message'); const uriTooLongError = Boom.uriTooLong('message', {some: 'data'}); uriTooLongError.data.some; -const uriTooLongError2: Boom.BoomError = Boom.uriTooLong('message'); +const uriTooLongError2: Boom.Boom = Boom.uriTooLong('message'); const unsupportedMediaTypeError = Boom.unsupportedMediaType('message', {some: 'data'}); unsupportedMediaTypeError.data.some; -const unsupportedMediaTypeError2: Boom.BoomError = Boom.unsupportedMediaType('message'); +const unsupportedMediaTypeError2: Boom.Boom = Boom.unsupportedMediaType('message'); const rangeNotSatisfiableError = Boom.rangeNotSatisfiable('message', {some: 'data'}); rangeNotSatisfiableError.data.some; -const rangeNotSatisfiableError2: Boom.BoomError = Boom.rangeNotSatisfiable('message'); +const rangeNotSatisfiableError2: Boom.Boom = Boom.rangeNotSatisfiable('message'); const expectationFailedError = Boom.expectationFailed('message', {some: 'data'}); expectationFailedError.data.some; -const expectationFailedError2: Boom.BoomError = Boom.expectationFailed('message'); +const expectationFailedError2: Boom.Boom = Boom.expectationFailed('message'); const teapotError = Boom.teapot('message', {some: 'data'}); teapotError.data.some; -const teapotError2: Boom.BoomError = Boom.teapot('message'); +const teapotError2: Boom.Boom = Boom.teapot('message'); const badDataError = Boom.badData('message', {some: 'data'}); badDataError.data.some; -const badDataError2: Boom.BoomError = Boom.badData('message'); +const badDataError2: Boom.Boom = Boom.badData('message'); const lockedError = Boom.locked('message', {some: 'data'}); lockedError.data.some; -const lockedError2: Boom.BoomError = Boom.locked('message'); +const lockedError2: Boom.Boom = Boom.locked('message'); const preconditionRequiredError = Boom.preconditionRequired('message', {some: 'data'}); preconditionRequiredError.data.some; -const preconditionRequiredError2: Boom.BoomError = Boom.preconditionRequired('message'); +const preconditionRequiredError2: Boom.Boom = Boom.preconditionRequired('message'); const tooManyRequestsError = Boom.tooManyRequests('message', {some: 'data'}); tooManyRequestsError.data.some; -const tooManyRequestsError2: Boom.BoomError = Boom.tooManyRequests('message'); +const tooManyRequestsError2: Boom.Boom = Boom.tooManyRequests('message'); const illegalError = Boom.illegal('message', {some: 'data'}); illegalError.data.some; -const illegalError2: Boom.BoomError = Boom.illegal('message'); +const illegalError2: Boom.Boom = Boom.illegal('message'); // 5xx and data type const badImplementationError = Boom.badImplementation('message', {some: 'data'}); badImplementationError.data.some; -const badImplementationError2: Boom.BoomError = Boom.badImplementation('message'); +const badImplementationError2: Boom.Boom = Boom.badImplementation('message'); const internalError = Boom.internal('message', {some: 'data'}); internalError.data.some; -const internalError2: Boom.BoomError = Boom.internal('message'); +const internalError2: Boom.Boom = Boom.internal('message'); const notImplementedError = Boom.notImplemented('message', {some: 'data'}); notImplementedError.data.some; -const notImplementedError2: Boom.BoomError = Boom.notImplemented('message'); +const notImplementedError2: Boom.Boom = Boom.notImplemented('message'); const badGatewayError = Boom.badGateway('message', {some: 'data'}); badGatewayError.data.some; -const badGatewayError2: Boom.BoomError = Boom.badGateway('message'); +const badGatewayError2: Boom.Boom = Boom.badGateway('message'); const serverUnavailableError = Boom.serverUnavailable('message', {some: 'data'}); serverUnavailableError.data.some; -const serverUnavailableError2: Boom.BoomError = Boom.serverUnavailable('message'); +const serverUnavailableError2: Boom.Boom = Boom.serverUnavailable('message'); const gatewayTimeoutError = Boom.gatewayTimeout('message', {some: 'data'}); gatewayTimeoutError.data.some; -const gatewayTimeoutError2: Boom.BoomError = Boom.gatewayTimeout('message'); +const gatewayTimeoutError2: Boom.Boom = Boom.gatewayTimeout('message'); -// boomify, wrap, and create -const boomifiedError = Boom.boomify(new Error('test'), { statusCode: 400, message: 'some message' }) +// boomify +const boomifiedError = Boom.boomify(new Error('test'), { statusCode: 400, message: 'some message' }); -const wrappedError = Boom.wrap(new Error('test'), 400, 'some message'); +// isBoom -const error1 = Boom.create(500, 'Internal server error', { timestamp: Date.now() }); -error1.data.timestamp; -const error2: Boom.BoomError = Boom.create(500, 'Internal server error'); +const isBoomError = new Boom.Boom('test') + +Boom.isBoom(isBoomError); + +// constructor + +const constructorError: Boom.Boom = new Boom.Boom('test'); + +constructorError.message; // type widen asserting @@ -169,11 +175,11 @@ interface CustomPayload extends Boom.Payload { * Test assignment of custom error data: */ const errorWithData = Boom.badImplementation('', { custom1: 'test', customType: 'Custom1', isCustom: true } as CustomData1); -const errorWithNoExplicitDataType: Boom.BoomError = errorWithData; // can assign to error without explicit data type -const errorWithExplicitType: Boom.BoomError = errorWithData; // can assign to union data type -const errorWithConcreteCustomData: Boom.BoomError = errorWithData; // can assign to concrete data type +const errorWithNoExplicitDataType: Boom.Boom = errorWithData; // can assign to error without explicit data type +const errorWithExplicitType: Boom.Boom = errorWithData; // can assign to union data type +const errorWithConcreteCustomData: Boom.Boom = errorWithData; // can assign to concrete data type // assignment to CustomData2 would not be possible -// const errorWithConcreteCustomData2: Boom.BoomError = errorWithData; +// const errorWithConcreteCustomData2: Boom.Boom = errorWithData; // Some complex error data types for testing purposes: interface CustomDataBase { diff --git a/types/boom/index.d.ts b/types/boom/index.d.ts index 76cd2d6b46..89ca580561 100644 --- a/types/boom/index.d.ts +++ b/types/boom/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for boom 4.3 +// Type definitions for boom 7.1.1 // Project: https://github.com/hapijs/boom // Definitions by: Igor Rogatty // AJP // Jinesh Shah +// Timon van Spronsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -14,7 +15,9 @@ declare namespace Boom { * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: * @see {@link https://github.com/hapijs/boom#boom} */ - export interface BoomError extends Error { + export class Boom extends Error { + /** Creates a new Boom object using the provided message and then calling boomify() to decorate the error with the Boom properties. */ + constructor(message?: string | Error, options?: Options); /** isBoom - if true, indicates this is a Boom object instance. */ isBoom: boolean; /** isServer - convenience bool indicating status code >= 500. */ @@ -31,6 +34,21 @@ declare namespace Boom { data: Data; } + interface Options { + /** statusCode - the HTTP status code. Defaults to 500 if no status code is already set. */ + statusCode?: number; + /** data - additional error information (assigned to error.data). */ + data?: Data; + /** decorate - an option with extra properties to set on the error object. */ + decorate?: object; + /** ctor - constructor reference used to crop the exception call stack output. */ + ctor?: any; + /** message - error message string. If the error already has a message, the provided message is added as a prefix. Defaults to no message. */ + message?: string; + /** override - if false, the err provided is a Boom object, and a statusCode or message are provided, the values are ignored. Defaults to true (apply the provided statusCode and message options to the error regardless of its type, Error or Boom object). */ + override?: boolean; + } + export interface Output { /** statusCode - the HTTP status code (typically 4xx or 5xx). */ statusCode: number; @@ -62,25 +80,13 @@ declare namespace Boom { * @param options optional additional options * @see {@link https://github.com/hapijs/boom#boomifyerror-options} */ - export function boomify(error: Error, options?: { statusCode?: number, message?: string, override?: boolean }): BoomError; + export function boomify(error: Error, options?: { statusCode?: number, message?: string, override?: boolean }): Boom; /** - * Decorates an error with the boom properties - * @param error the error object to wrap. If error is already a boom object, returns back the same object. - * @param statusCode optional HTTP status code. Defaults to 500. - * @param message optional message string. If the error already has a message, it adds the message as a prefix. Defaults to no message. - * @see {@link https://github.com/hapijs/boom#wraperror-statuscode-message} + * Identifies whether an error is a Boom object. Same as calling instanceof Boom. + * @param error the error object to identify. */ - export function wrap(error: Error, statusCode?: number, message?: string): BoomError; - - /** - * Generates an Error object with the boom decorations - * @param statusCode an HTTP error code number. Must be greater or equal 400. - * @param message optional message string. - * @param data additional error data set to error.data property. - * @see {@link https://github.com/hapijs/boom#createstatuscode-message-data} - */ - export function create(statusCode: number, message?: string, data?: Data): BoomError; + export function isBoom(error: Error): boolean // 4xx /** @@ -89,7 +95,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombadrequestmessage-data} */ - export function badRequest(message?: string, data?: Data): BoomError; + export function badRequest(message?: string, data?: Data): Boom; /** * Returns a 401 Unauthorized error @@ -100,10 +106,10 @@ declare namespace Boom { * @param attributes an object of values to use while setting the 'WWW-Authenticate' header. This value is only used when scheme is a string, otherwise it is ignored. Every key/value pair will be included in the 'WWW-Authenticate' in the format of 'key="value"' as well as in the response payload under the attributes key. Alternatively value can be a string which is use to set the value of the scheme, for example setting the token value for negotiate header. If string is used message parameter must be null. null and undefined will be replaced with an empty string. If attributes is set, message will be used as the 'error' segment of the 'WWW-Authenticate' header. If message is unset, the 'error' segment of the header will not be present and isMissing will be true on the error object. * @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes} */ - export function unauthorized(message?: string, scheme?: string, attributes?: {[index: string]: string}): BoomError; - export function unauthorized(message?: string, scheme?: string[]): BoomError; - export function unauthorized(message?: null, scheme?: string, attributes?: {[index: string]: string} | string): BoomError; - export function unauthorized(message?: null, scheme?: string[]): BoomError; + export function unauthorized(message?: string, scheme?: string, attributes?: {[index: string]: string}): Boom; + export function unauthorized(message?: string, scheme?: string[]): Boom; + export function unauthorized(message?: null, scheme?: string, attributes?: {[index: string]: string} | string): Boom; + export function unauthorized(message?: null, scheme?: string[]): Boom; /** * Returns a 402 Payment Required error @@ -111,7 +117,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boompaymentrequiredmessage-data} */ - export function paymentRequired(message?: string, data?: Data): BoomError; + export function paymentRequired(message?: string, data?: Data): Boom; /** * Returns a 403 Forbidden error @@ -119,7 +125,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomforbiddenmessage-data} */ - export function forbidden(message?: string, data?: Data): BoomError; + export function forbidden(message?: string, data?: Data): Boom; /** * Returns a 404 Not Found error @@ -127,7 +133,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomnotfoundmessage-data} */ - export function notFound(message?: string, data?: Data): BoomError; + export function notFound(message?: string, data?: Data): Boom; /** * Returns a 405 Method Not Allowed error @@ -136,7 +142,7 @@ declare namespace Boom { * @param allow optional string or array of strings (to be combined and separated by ', ') which is set to the 'Allow' header. * @see {@link https://github.com/hapijs/boom#boommethodnotallowedmessage-data-allow} */ - export function methodNotAllowed(message?: string, data?: Data, allow?: string | string[]): BoomError; + export function methodNotAllowed(message?: string, data?: Data, allow?: string | string[]): Boom; /** * Returns a 406 Not Acceptable error @@ -144,7 +150,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomnotacceptablemessage-data} */ - export function notAcceptable(message?: string, data?: Data): BoomError; + export function notAcceptable(message?: string, data?: Data): Boom; /** * Returns a 407 Proxy Authentication Required error @@ -152,7 +158,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomproxyauthrequiredmessage-data} */ - export function proxyAuthRequired(message?: string, data?: Data): BoomError; + export function proxyAuthRequired(message?: string, data?: Data): Boom; /** * Returns a 408 Request Time-out error @@ -160,7 +166,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomclienttimeoutmessage-data} */ - export function clientTimeout(message?: string, data?: Data): BoomError; + export function clientTimeout(message?: string, data?: Data): Boom; /** * Returns a 409 Conflict error @@ -168,7 +174,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomconflictmessage-data} */ - export function conflict(message?: string, data?: Data): BoomError; + export function conflict(message?: string, data?: Data): Boom; /** * Returns a 410 Gone error @@ -176,7 +182,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomresourcegonemessage-data} */ - export function resourceGone(message?: string, data?: Data): BoomError; + export function resourceGone(message?: string, data?: Data): Boom; /** * Returns a 411 Length Required error @@ -184,7 +190,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomlengthrequiredmessage-data} */ - export function lengthRequired(message?: string, data?: Data): BoomError; + export function lengthRequired(message?: string, data?: Data): Boom; /** * Returns a 412 Precondition Failed error @@ -192,7 +198,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boompreconditionfailedmessage-data} */ - export function preconditionFailed(message?: string, data?: Data): BoomError; + export function preconditionFailed(message?: string, data?: Data): Boom; /** * Returns a 413 Request Entity Too Large error @@ -200,7 +206,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomentitytoolargemessage-data} */ - export function entityTooLarge(message?: string, data?: Data): BoomError; + export function entityTooLarge(message?: string, data?: Data): Boom; /** * Returns a 414 Request-URI Too Large error @@ -208,7 +214,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomuritoolongmessage-data} */ - export function uriTooLong(message?: string, data?: Data): BoomError; + export function uriTooLong(message?: string, data?: Data): Boom; /** * Returns a 415 Unsupported Media Type error @@ -216,7 +222,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomunsupportedmediatypemessage-data} */ - export function unsupportedMediaType(message?: string, data?: Data): BoomError; + export function unsupportedMediaType(message?: string, data?: Data): Boom; /** * Returns a 416 Requested Range Not Satisfiable error @@ -224,7 +230,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomrangenotsatisfiablemessage-data} */ - export function rangeNotSatisfiable(message?: string, data?: Data): BoomError; + export function rangeNotSatisfiable(message?: string, data?: Data): Boom; /** * Returns a 417 Expectation Failed error @@ -232,7 +238,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomexpectationfailedmessage-data} */ - export function expectationFailed(message?: string, data?: Data): BoomError; + export function expectationFailed(message?: string, data?: Data): Boom; /** * Returns a 418 I'm a Teapot error @@ -240,7 +246,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomteapotmessage-data} */ - export function teapot(message?: string, data?: Data): BoomError; + export function teapot(message?: string, data?: Data): Boom; /** * Returns a 422 Unprocessable Entity error @@ -248,7 +254,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombaddatamessage-data} */ - export function badData(message?: string, data?: Data): BoomError; + export function badData(message?: string, data?: Data): Boom; /** * Returns a 423 Locked error @@ -256,7 +262,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomlockedmessage-data} */ - export function locked(message?: string, data?: Data): BoomError; + export function locked(message?: string, data?: Data): Boom; /** * Returns a 428 Precondition Required error @@ -264,7 +270,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boompreconditionrequiredmessage-data} */ - export function preconditionRequired(message?: string, data?: Data): BoomError; + export function preconditionRequired(message?: string, data?: Data): Boom; /** * Returns a 429 Too Many Requests error @@ -272,7 +278,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomtoomanyrequestsmessage-data} */ - export function tooManyRequests(message?: string, data?: Data): BoomError; + export function tooManyRequests(message?: string, data?: Data): Boom; /** * Returns a 451 Unavailable For Legal Reasons error @@ -280,7 +286,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomillegalmessage-data} */ - export function illegal(message?: string, data?: Data): BoomError; + export function illegal(message?: string, data?: Data): Boom; // 5xx /** @@ -290,7 +296,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombadimplementationmessage-data---alias-internal} */ - export function badImplementation(message?: string, data?: Data): BoomError; + export function badImplementation(message?: string, data?: Data): Boom; /** * Returns a 500 Internal Server Error error @@ -299,7 +305,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombadimplementationmessage-data---alias-internal} */ - export function internal(message?: string, data?: Data): BoomError; + export function internal(message?: string, data?: Data): Boom; /** * Returns a 501 Not Implemented error with your error message to the user @@ -307,7 +313,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomnotimplementedmessage-data} */ - export function notImplemented(message?: string, data?: Data): BoomError; + export function notImplemented(message?: string, data?: Data): Boom; /** * Returns a 502 Bad Gateway error with your error message to the user @@ -315,7 +321,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombadgatewaymessage-data} */ - export function badGateway(message?: string, data?: Data): BoomError; + export function badGateway(message?: string, data?: Data): Boom; /** * Returns a 503 Service Unavailable error with your error message to the user @@ -323,7 +329,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomserverunavailablemessage-data} */ - export function serverUnavailable(message?: string, data?: Data): BoomError; + export function serverUnavailable(message?: string, data?: Data): Boom; /** * Returns a 504 Gateway Time-out error with your error message to the user @@ -331,5 +337,5 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomgatewaytimeoutmessage-data} */ - export function gatewayTimeout(message?: string, data?: Data): BoomError; + export function gatewayTimeout(message?: string, data?: Data): Boom; } diff --git a/types/boom/v4/boom-tests.ts b/types/boom/v4/boom-tests.ts new file mode 100644 index 0000000000..1819be25cb --- /dev/null +++ b/types/boom/v4/boom-tests.ts @@ -0,0 +1,193 @@ +import Boom = require('boom'); +import * as Hapi from 'hapi'; + +// 4xx and data type + +const badRequestError = Boom.badRequest('message', {some: 'data'}); +badRequestError.data.some; +const badRequestError2: Boom.BoomError = Boom.badImplementation('message'); + +const unauthorizedError1 = Boom.unauthorized('message', 'scheme', {some: 'attribute'}); +unauthorizedError1.output.payload.attributes === { some: 'attribute', error: 'message' }; +unauthorizedError1.output.headers === { 'WWW-Authenticate': 'scheme some="attribute", error="message"' }; + +const unauthorizedError2 = Boom.unauthorized('message', ['scheme']); +unauthorizedError2.output.payload.attributes === undefined; +unauthorizedError2.output.headers === { 'WWW-Authenticate': 'scheme' }; + +const unauthorizedError3 = Boom.unauthorized(null, 'scheme', 'attribute'); +unauthorizedError3.output.payload.attributes === 'attribute'; +unauthorizedError3.output.headers === { 'WWW-Authenticate': 'scheme attribute' }; + +const unauthorizedError4 = Boom.unauthorized(null, 'scheme', {some: 'attribute'}); +unauthorizedError4.output.payload.attributes === { some: 'attribute' }; +unauthorizedError4.output.headers === { 'WWW-Authenticate': 'scheme some="attribute"' }; + +const paymentRequiredError = Boom.paymentRequired('message', {some: 'data'}); +paymentRequiredError.data.some; +const paymentRequiredError2: Boom.BoomError = Boom.paymentRequired('message'); + +const forbiddenError = Boom.forbidden('message', {some: 'data'}); +forbiddenError.data.some; +const forbiddenError2: Boom.BoomError = Boom.forbidden('message'); + +const notFoundError = Boom.notFound('message', {some: 'data'}); +notFoundError.data.some; +const notFoundError2: Boom.BoomError = Boom.notFound('message'); + +const methodNotAllowedError = Boom.methodNotAllowed('message', {some: 'data'}); +methodNotAllowedError.data.some; +const methodNotAllowedError2: Boom.BoomError = Boom.methodNotAllowed('message'); + +const notAcceptableError = Boom.notAcceptable('message', {some: 'data'}); +notAcceptableError.data.some; +const notAcceptableError2: Boom.BoomError = Boom.notAcceptable('message'); + +const proxyAuthRequiredError = Boom.proxyAuthRequired('message', {some: 'data'}); +proxyAuthRequiredError.data.some; +const proxyAuthRequiredError2: Boom.BoomError = Boom.proxyAuthRequired('message'); + +const clientTimeoutError = Boom.clientTimeout('message', {some: 'data'}); +clientTimeoutError.data.some; +const clientTimeoutError2: Boom.BoomError = Boom.clientTimeout('message'); + +const conflictError = Boom.conflict('message', {some: 'data'}); +conflictError.data.some; + +const resourceGoneError = Boom.resourceGone('message', {some: 'data'}); +resourceGoneError.data.some; +const resourceGoneError2: Boom.BoomError = Boom.resourceGone('message'); + +const lengthRequiredError = Boom.lengthRequired('message', {some: 'data'}); +lengthRequiredError.data.some; +const lengthRequiredError2: Boom.BoomError = Boom.lengthRequired('message'); + +const preconditionFailedError = Boom.preconditionFailed('message', {some: 'data'}); +preconditionFailedError.data.some; +const preconditionFailedError2: Boom.BoomError = Boom.preconditionFailed('message'); + +const entityTooLargeError = Boom.entityTooLarge('message', {some: 'data'}); +entityTooLargeError.data.some; +const entityTooLargeError2: Boom.BoomError = Boom.lengthRequired('message'); + +const uriTooLongError = Boom.uriTooLong('message', {some: 'data'}); +uriTooLongError.data.some; +const uriTooLongError2: Boom.BoomError = Boom.uriTooLong('message'); + +const unsupportedMediaTypeError = Boom.unsupportedMediaType('message', {some: 'data'}); +unsupportedMediaTypeError.data.some; +const unsupportedMediaTypeError2: Boom.BoomError = Boom.unsupportedMediaType('message'); + +const rangeNotSatisfiableError = Boom.rangeNotSatisfiable('message', {some: 'data'}); +rangeNotSatisfiableError.data.some; +const rangeNotSatisfiableError2: Boom.BoomError = Boom.rangeNotSatisfiable('message'); + +const expectationFailedError = Boom.expectationFailed('message', {some: 'data'}); +expectationFailedError.data.some; +const expectationFailedError2: Boom.BoomError = Boom.expectationFailed('message'); + +const teapotError = Boom.teapot('message', {some: 'data'}); +teapotError.data.some; +const teapotError2: Boom.BoomError = Boom.teapot('message'); + +const badDataError = Boom.badData('message', {some: 'data'}); +badDataError.data.some; +const badDataError2: Boom.BoomError = Boom.badData('message'); + +const lockedError = Boom.locked('message', {some: 'data'}); +lockedError.data.some; +const lockedError2: Boom.BoomError = Boom.locked('message'); + +const preconditionRequiredError = Boom.preconditionRequired('message', {some: 'data'}); +preconditionRequiredError.data.some; +const preconditionRequiredError2: Boom.BoomError = Boom.preconditionRequired('message'); + +const tooManyRequestsError = Boom.tooManyRequests('message', {some: 'data'}); +tooManyRequestsError.data.some; +const tooManyRequestsError2: Boom.BoomError = Boom.tooManyRequests('message'); + +const illegalError = Boom.illegal('message', {some: 'data'}); +illegalError.data.some; +const illegalError2: Boom.BoomError = Boom.illegal('message'); + +// 5xx and data type + +const badImplementationError = Boom.badImplementation('message', {some: 'data'}); +badImplementationError.data.some; +const badImplementationError2: Boom.BoomError = Boom.badImplementation('message'); + +const internalError = Boom.internal('message', {some: 'data'}); +internalError.data.some; +const internalError2: Boom.BoomError = Boom.internal('message'); + +const notImplementedError = Boom.notImplemented('message', {some: 'data'}); +notImplementedError.data.some; +const notImplementedError2: Boom.BoomError = Boom.notImplemented('message'); + +const badGatewayError = Boom.badGateway('message', {some: 'data'}); +badGatewayError.data.some; +const badGatewayError2: Boom.BoomError = Boom.badGateway('message'); + +const serverUnavailableError = Boom.serverUnavailable('message', {some: 'data'}); +serverUnavailableError.data.some; +const serverUnavailableError2: Boom.BoomError = Boom.serverUnavailable('message'); + +const gatewayTimeoutError = Boom.gatewayTimeout('message', {some: 'data'}); +gatewayTimeoutError.data.some; +const gatewayTimeoutError2: Boom.BoomError = Boom.gatewayTimeout('message'); + +// boomify, wrap, and create +const boomifiedError = Boom.boomify(new Error('test'), { statusCode: 400, message: 'some message' }) + +const wrappedError = Boom.wrap(new Error('test'), 400, 'some message'); + +const error1 = Boom.create(500, 'Internal server error', { timestamp: Date.now() }); +error1.data.timestamp; +const error2: Boom.BoomError = Boom.create(500, 'Internal server error'); + +// type widen asserting + +const unauthorizedError = Boom.unauthorized() as Error; + +// status code and reformat + +const error = Boom.badRequest('Cannot feed after midnight'); +error.output.statusCode = 499; // Assign a custom error code +error.reformat(); + +/** + * Add a custom key to the payload + */ + +interface CustomPayload extends Boom.Payload { + custom: string; +} + +(error.output.payload as CustomPayload).custom = 'abc_123'; + +/** + * Test assignment of custom error data: + */ +const errorWithData = Boom.badImplementation('', { custom1: 'test', customType: 'Custom1', isCustom: true } as CustomData1); +const errorWithNoExplicitDataType: Boom.BoomError = errorWithData; // can assign to error without explicit data type +const errorWithExplicitType: Boom.BoomError = errorWithData; // can assign to union data type +const errorWithConcreteCustomData: Boom.BoomError = errorWithData; // can assign to concrete data type +// assignment to CustomData2 would not be possible +// const errorWithConcreteCustomData2: Boom.BoomError = errorWithData; + +// Some complex error data types for testing purposes: +interface CustomDataBase { + isCustom: true; +} + +interface CustomData1 extends CustomDataBase { + customType: 'Custom1'; + custom1: string; +} + +interface CustomData2 extends CustomDataBase { + customType: 'Custom2'; + custom2: string; +} + +type CustomData = CustomData1 | CustomData2; diff --git a/types/boom/v4/index.d.ts b/types/boom/v4/index.d.ts new file mode 100644 index 0000000000..76cd2d6b46 --- /dev/null +++ b/types/boom/v4/index.d.ts @@ -0,0 +1,335 @@ +// Type definitions for boom 4.3 +// Project: https://github.com/hapijs/boom +// Definitions by: Igor Rogatty +// AJP +// Jinesh Shah +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +export = Boom; + +declare namespace Boom { + + /** + * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: + * @see {@link https://github.com/hapijs/boom#boom} + */ + export interface BoomError extends Error { + /** isBoom - if true, indicates this is a Boom object instance. */ + isBoom: boolean; + /** isServer - convenience bool indicating status code >= 500. */ + isServer: boolean; + /** message - the error message. */ + message: string; + /** output - the formatted response. Can be directly manipulated after object construction to return a custom error response. Allowed root keys: */ + output: Output; + /** reformat() - rebuilds error.output using the other object properties. */ + reformat: () => string; + /** "If message is unset, the 'error' segment of the header will not be present and isMissing will be true on the error object." mentioned in @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes} */ + isMissing?: boolean; + /** https://github.com/hapijs/boom#createstatuscode-message-data and https://github.com/hapijs/boom/blob/v4.3.0/lib/index.js#L99 */ + data: Data; + } + + export interface Output { + /** statusCode - the HTTP status code (typically 4xx or 5xx). */ + statusCode: number; + /** headers - an object containing any HTTP headers where each key is a header name and value is the header content. (Limited value type to string https://github.com/hapijs/boom/issues/151 ) */ + headers: {[index: string]: string}; + /** payload - the formatted object used as the response payload (stringified). Can be directly manipulated but any changes will be lost if reformat() is called. Any content allowed and by default includes the following content: */ + payload: Payload; + } + + export interface Payload { + /** statusCode - the HTTP status code, derived from error.output.statusCode. */ + statusCode: number; + /** error - the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from statusCode. */ + error: string; + /** message - the error message derived from error.message. */ + message: string; + /** + * "Every key/value pair will be included ... in the response payload under the attributes key." + * [see docs](https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes) + */ + attributes?: any; + // Excluded this to aid typing of the other values. See tests for example casting to a custom interface to manipulate the payload + // [anyContent: string]: any; + } + + /** + * Decorates an error with the boom properties + * @param error the error object to wrap. If error is already a boom object, it defaults to overriding the object with the new status code and message. + * @param options optional additional options + * @see {@link https://github.com/hapijs/boom#boomifyerror-options} + */ + export function boomify(error: Error, options?: { statusCode?: number, message?: string, override?: boolean }): BoomError; + + /** + * Decorates an error with the boom properties + * @param error the error object to wrap. If error is already a boom object, returns back the same object. + * @param statusCode optional HTTP status code. Defaults to 500. + * @param message optional message string. If the error already has a message, it adds the message as a prefix. Defaults to no message. + * @see {@link https://github.com/hapijs/boom#wraperror-statuscode-message} + */ + export function wrap(error: Error, statusCode?: number, message?: string): BoomError; + + /** + * Generates an Error object with the boom decorations + * @param statusCode an HTTP error code number. Must be greater or equal 400. + * @param message optional message string. + * @param data additional error data set to error.data property. + * @see {@link https://github.com/hapijs/boom#createstatuscode-message-data} + */ + export function create(statusCode: number, message?: string, data?: Data): BoomError; + + // 4xx + /** + * Returns a 400 Bad Request error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boombadrequestmessage-data} + */ + export function badRequest(message?: string, data?: Data): BoomError; + + /** + * Returns a 401 Unauthorized error + * @param message optional message. + * @param scheme can be one of the following: + * * an authentication scheme name + * * an array of string values. These values will be separated by ', ' and set to the 'WWW-Authenticate' header. + * @param attributes an object of values to use while setting the 'WWW-Authenticate' header. This value is only used when scheme is a string, otherwise it is ignored. Every key/value pair will be included in the 'WWW-Authenticate' in the format of 'key="value"' as well as in the response payload under the attributes key. Alternatively value can be a string which is use to set the value of the scheme, for example setting the token value for negotiate header. If string is used message parameter must be null. null and undefined will be replaced with an empty string. If attributes is set, message will be used as the 'error' segment of the 'WWW-Authenticate' header. If message is unset, the 'error' segment of the header will not be present and isMissing will be true on the error object. + * @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes} + */ + export function unauthorized(message?: string, scheme?: string, attributes?: {[index: string]: string}): BoomError; + export function unauthorized(message?: string, scheme?: string[]): BoomError; + export function unauthorized(message?: null, scheme?: string, attributes?: {[index: string]: string} | string): BoomError; + export function unauthorized(message?: null, scheme?: string[]): BoomError; + + /** + * Returns a 402 Payment Required error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boompaymentrequiredmessage-data} + */ + export function paymentRequired(message?: string, data?: Data): BoomError; + + /** + * Returns a 403 Forbidden error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomforbiddenmessage-data} + */ + export function forbidden(message?: string, data?: Data): BoomError; + + /** + * Returns a 404 Not Found error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomnotfoundmessage-data} + */ + export function notFound(message?: string, data?: Data): BoomError; + + /** + * Returns a 405 Method Not Allowed error + * @param message optional message. + * @param data optional additional error data. + * @param allow optional string or array of strings (to be combined and separated by ', ') which is set to the 'Allow' header. + * @see {@link https://github.com/hapijs/boom#boommethodnotallowedmessage-data-allow} + */ + export function methodNotAllowed(message?: string, data?: Data, allow?: string | string[]): BoomError; + + /** + * Returns a 406 Not Acceptable error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomnotacceptablemessage-data} + */ + export function notAcceptable(message?: string, data?: Data): BoomError; + + /** + * Returns a 407 Proxy Authentication Required error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomproxyauthrequiredmessage-data} + */ + export function proxyAuthRequired(message?: string, data?: Data): BoomError; + + /** + * Returns a 408 Request Time-out error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomclienttimeoutmessage-data} + */ + export function clientTimeout(message?: string, data?: Data): BoomError; + + /** + * Returns a 409 Conflict error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomconflictmessage-data} + */ + export function conflict(message?: string, data?: Data): BoomError; + + /** + * Returns a 410 Gone error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomresourcegonemessage-data} + */ + export function resourceGone(message?: string, data?: Data): BoomError; + + /** + * Returns a 411 Length Required error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomlengthrequiredmessage-data} + */ + export function lengthRequired(message?: string, data?: Data): BoomError; + + /** + * Returns a 412 Precondition Failed error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boompreconditionfailedmessage-data} + */ + export function preconditionFailed(message?: string, data?: Data): BoomError; + + /** + * Returns a 413 Request Entity Too Large error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomentitytoolargemessage-data} + */ + export function entityTooLarge(message?: string, data?: Data): BoomError; + + /** + * Returns a 414 Request-URI Too Large error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomuritoolongmessage-data} + */ + export function uriTooLong(message?: string, data?: Data): BoomError; + + /** + * Returns a 415 Unsupported Media Type error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomunsupportedmediatypemessage-data} + */ + export function unsupportedMediaType(message?: string, data?: Data): BoomError; + + /** + * Returns a 416 Requested Range Not Satisfiable error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomrangenotsatisfiablemessage-data} + */ + export function rangeNotSatisfiable(message?: string, data?: Data): BoomError; + + /** + * Returns a 417 Expectation Failed error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomexpectationfailedmessage-data} + */ + export function expectationFailed(message?: string, data?: Data): BoomError; + + /** + * Returns a 418 I'm a Teapot error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomteapotmessage-data} + */ + export function teapot(message?: string, data?: Data): BoomError; + + /** + * Returns a 422 Unprocessable Entity error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boombaddatamessage-data} + */ + export function badData(message?: string, data?: Data): BoomError; + + /** + * Returns a 423 Locked error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomlockedmessage-data} + */ + export function locked(message?: string, data?: Data): BoomError; + + /** + * Returns a 428 Precondition Required error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boompreconditionrequiredmessage-data} + */ + export function preconditionRequired(message?: string, data?: Data): BoomError; + + /** + * Returns a 429 Too Many Requests error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomtoomanyrequestsmessage-data} + */ + export function tooManyRequests(message?: string, data?: Data): BoomError; + + /** + * Returns a 451 Unavailable For Legal Reasons error + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomillegalmessage-data} + */ + export function illegal(message?: string, data?: Data): BoomError; + + // 5xx + /** + * Returns a 500 Internal Server Error error + * Only 500 errors will hide your message from the end user. Your message is recorded in the server log. + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boombadimplementationmessage-data---alias-internal} + */ + export function badImplementation(message?: string, data?: Data): BoomError; + + /** + * Returns a 500 Internal Server Error error + * Only 500 errors will hide your message from the end user. Your message is recorded in the server log. + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boombadimplementationmessage-data---alias-internal} + */ + export function internal(message?: string, data?: Data): BoomError; + + /** + * Returns a 501 Not Implemented error with your error message to the user + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomnotimplementedmessage-data} + */ + export function notImplemented(message?: string, data?: Data): BoomError; + + /** + * Returns a 502 Bad Gateway error with your error message to the user + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boombadgatewaymessage-data} + */ + export function badGateway(message?: string, data?: Data): BoomError; + + /** + * Returns a 503 Service Unavailable error with your error message to the user + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomserverunavailablemessage-data} + */ + export function serverUnavailable(message?: string, data?: Data): BoomError; + + /** + * Returns a 504 Gateway Time-out error with your error message to the user + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boomgatewaytimeoutmessage-data} + */ + export function gatewayTimeout(message?: string, data?: Data): BoomError; +} diff --git a/types/boom/v4/tsconfig.json b/types/boom/v4/tsconfig.json new file mode 100644 index 0000000000..58f1109eee --- /dev/null +++ b/types/boom/v4/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "boom": [ + "boom/v4" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "boom-tests.ts" + ] +} diff --git a/types/boom/v4/tslint.json b/types/boom/v4/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/boom/v4/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} From b12e2e61a08bcc49ca2fbce9ccf9c058397f8cc0 Mon Sep 17 00:00:00 2001 From: Geovani de Souza Date: Fri, 29 Dec 2017 14:10:01 -0200 Subject: [PATCH 261/890] Add typings for jest-in-case --- types/jest-in-case/index.d.ts | 25 +++++ types/jest-in-case/jest-in-case-tests.ts | 121 +++++++++++++++++++++++ types/jest-in-case/tsconfig.json | 23 +++++ types/jest-in-case/tslint.json | 1 + 4 files changed, 170 insertions(+) create mode 100644 types/jest-in-case/index.d.ts create mode 100644 types/jest-in-case/jest-in-case-tests.ts create mode 100644 types/jest-in-case/tsconfig.json create mode 100644 types/jest-in-case/tslint.json diff --git a/types/jest-in-case/index.d.ts b/types/jest-in-case/index.d.ts new file mode 100644 index 0000000000..02d7d08af9 --- /dev/null +++ b/types/jest-in-case/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for jest-in-case 1.0 +// Project: https://github.com/thinkmill/jest-in-case#readme +// Definitions by: Geovani de Souza +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// +/// + +declare const global: NodeJS.Global; + +interface Config { + name?: string; + only?: boolean; + skip?: boolean; + [key: string]: any; +} + +type Tester = (opts: Opts, done: jest.DoneCallback) => any; + +type TestCases = ReadonlyArray | { [name: string]: Opts }; + +declare function cases(title: string, tester: Tester, testCases: TestCases): void; + +export = cases; diff --git a/types/jest-in-case/jest-in-case-tests.ts b/types/jest-in-case/jest-in-case-tests.ts new file mode 100644 index 0000000000..e0e5de4f89 --- /dev/null +++ b/types/jest-in-case/jest-in-case-tests.ts @@ -0,0 +1,121 @@ +/// +/// + +declare const global: any; + +import cases = require("jest-in-case"); + +function add(augend: number, addend: number) { + return augend + addend; +} + +function subtract(minuend: number, subtrahend: number) { + return minuend - subtrahend; +} + +beforeEach(() => { + jest.spyOn(global, 'describe').mockImplementation((title, fn) => fn()); + jest.spyOn(global, 'test').mockImplementation((name, fn) => fn()); + global.test.skip = jest.fn((name, fn) => fn()); + global.test.only = jest.fn((name, fn) => fn()); +}); + +afterEach(() => { + global.describe.mockRestore(); + global.test.mockRestore(); +}); + +test('array', () => { + const title = 'add(augend, addend)'; + + const tester = jest.fn(opts => { + expect(add(opts.augend, opts.addend)).toBe(opts.total); + }); + + const testCases = [ + { name: '1 + 1 = 2', augend: 1, addend: 1, total: 2 }, + { name: '2 + 1 = 3', augend: 2, addend: 1, total: 3 }, + { name: '3 + 1 = 4', augend: 3, addend: 1, total: 4 }, + ]; + + cases(title, tester, testCases); + + expect(global.describe).toHaveBeenCalledTimes(1); + expect(global.test).toHaveBeenCalledTimes(3); + expect(tester).toHaveBeenCalledTimes(3); + + expect(global.describe.mock.calls[0][0]).toBe(title); + expect(global.test.mock.calls[0][0]).toBe(testCases[0].name); + expect(global.test.mock.calls[1][0]).toBe(testCases[1].name); + expect(global.test.mock.calls[2][0]).toBe(testCases[2].name); + expect(global.test.mock.calls[0][1]).toHaveLength(0); + expect(global.test.mock.calls[1][1]).toHaveLength(0); + expect(global.test.mock.calls[2][1]).toHaveLength(0); + expect(tester).toHaveBeenCalledWith(testCases[0]); + expect(tester).toHaveBeenCalledWith(testCases[1]); + expect(tester).toHaveBeenCalledWith(testCases[2]); +}); + +test('object', () => { + jest.spyOn(global, 'describe').mockImplementation((title, fn) => fn()); + jest.spyOn(global, 'test').mockImplementation((name, fn) => fn()); + + const title = 'add(augend, addend)'; + + const tester = jest.fn(opts => { + expect(subtract(opts.minuend, opts.subtrahend)).toBe(opts.difference); + }); + + const testCases = { + '1 - 1 = 0': { minuend: 1, subtrahend: 1, difference: 0 }, + '2 - 1 = 1': { minuend: 2, subtrahend: 1, difference: 1 }, + '3 - 1 = 2': { minuend: 3, subtrahend: 1, difference: 2 }, + }; + + cases(title, tester, testCases); + + expect(global.describe).toHaveBeenCalledTimes(1); + expect(global.test).toHaveBeenCalledTimes(3); + expect(tester).toHaveBeenCalledTimes(3); + + expect(global.describe.mock.calls[0][0]).toBe(title); + expect(global.test.mock.calls[0][0]).toBe('1 - 1 = 0'); + expect(global.test.mock.calls[1][0]).toBe('2 - 1 = 1'); + expect(global.test.mock.calls[2][0]).toBe('3 - 1 = 2'); + expect(global.test.mock.calls[0][1]).toHaveLength(0); + expect(global.test.mock.calls[1][1]).toHaveLength(0); + expect(global.test.mock.calls[2][1]).toHaveLength(0); + expect(tester.mock.calls[0][0]).toMatchObject(testCases['1 - 1 = 0']); + expect(tester.mock.calls[1][0]).toMatchObject(testCases['2 - 1 = 1']); + expect(tester.mock.calls[2][0]).toMatchObject(testCases['3 - 1 = 2']); +}); + +test('no names', () => { + cases('foo', () => { }, [ + {}, + {}, + ]); + + expect(global.test.mock.calls[0][0]).toBe('case: 1'); + expect(global.test.mock.calls[1][0]).toBe('case: 2'); +}); + +test('only', () => { + cases('foo', () => { }, [ + {}, + { only: true }, + ]); + + expect(global.test.mock.calls[0][0]).toBe('case: 1'); + expect(global.test.only.mock.calls[0][0]).toBe('case: 2'); +}); + +test('skip', () => { + cases('foo', () => { }, [ + {}, + { skip: true }, + ]); + + expect(global.test.mock.calls[0][0]).toBe('case: 1'); + expect(global.test.skip.mock.calls[0][0]).toBe('case: 2'); +}); diff --git a/types/jest-in-case/tsconfig.json b/types/jest-in-case/tsconfig.json new file mode 100644 index 0000000000..a561ae813a --- /dev/null +++ b/types/jest-in-case/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jest-in-case-tests.ts" + ] +} diff --git a/types/jest-in-case/tslint.json b/types/jest-in-case/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jest-in-case/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 21a6df9b7fe7e0eb76ff8abab97672786f1b9db4 Mon Sep 17 00:00:00 2001 From: Geovani de Souza Date: Fri, 29 Dec 2017 15:09:53 -0200 Subject: [PATCH 262/890] Remove unnecessary typing reference --- types/jest-in-case/jest-in-case-tests.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/types/jest-in-case/jest-in-case-tests.ts b/types/jest-in-case/jest-in-case-tests.ts index e0e5de4f89..283ade76c1 100644 --- a/types/jest-in-case/jest-in-case-tests.ts +++ b/types/jest-in-case/jest-in-case-tests.ts @@ -1,6 +1,3 @@ -/// -/// - declare const global: any; import cases = require("jest-in-case"); From 8ebd2dfd05ae64ccdb868c521676ccaf8ede1c93 Mon Sep 17 00:00:00 2001 From: Maarten Mulders Date: Fri, 29 Dec 2017 20:04:24 +0100 Subject: [PATCH 263/890] Implement suggestion from @openscript --- types/material-ui/index.d.ts | 53 +++++---------- types/material-ui/material-ui-tests.tsx | 88 ++++++++++++------------- 2 files changed, 60 insertions(+), 81 deletions(-) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 8831696635..98a1e8d8ba 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -147,10 +147,6 @@ declare module "material-ui" { export import ToolbarSeparatorProps = __MaterialUI.Toolbar.ToolbarSeparatorProps; export import ToolbarTitle = __MaterialUI.Toolbar.ToolbarTitle; export import ToolbarTitleProps = __MaterialUI.Toolbar.ToolbarTitleProps; - - // export type definitions - export type TouchTapEvent = __MaterialUI.TouchTapEvent; - export type TouchTapEventHandler = __MaterialUI.TouchTapEventHandler; } declare namespace __MaterialUI { @@ -160,19 +156,6 @@ declare namespace __MaterialUI { requestChange(newValue: T): void; } - // What's common between React.TouchEvent and React.MouseEvent - interface TouchTapEvent extends React.SyntheticEvent<{}> { - altKey: boolean; - ctrlKey: boolean; - getModifierState(key: string): boolean; - metaKey: boolean; - shiftKey: boolean; - } - - // What's common between React.TouchEventHandler and React.MouseEventHandler - interface TouchTapEventHandler extends React.EventHandler { - } - export interface ThemeWrapperProps { theme: Styles.MuiTheme; } @@ -578,9 +561,9 @@ declare namespace __MaterialUI { iconElementRight?: React.ReactElement; iconStyleRight?: React.CSSProperties; iconStyleLeft?: React.CSSProperties; - onLeftIconButtonClick?: TouchTapEventHandler; - onRightIconButtonClick?: TouchTapEventHandler; - onTitleTouchTap?: TouchTapEventHandler; + onLeftIconButtonClick?: React.MouseEventHandler<{}>; + onRightIconButtonClick?: React.MouseEventHandler<{}>; + onTitleClick?: React.MouseEventHandler<{}>; showMenuIconButton?: boolean; style?: React.CSSProperties; title?: React.ReactNode; @@ -715,7 +698,6 @@ declare namespace __MaterialUI { onKeyboardFocus?(e: React.FocusEvent<{}>, isKeyboardFocused: boolean): void; onKeyDown?: React.KeyboardEventHandler<{}>; onKeyUp?: React.KeyboardEventHandler<{}>; - onTouchTap?: TouchTapEventHandler; onClick?: React.MouseEventHandler<{}>; style?: React.CSSProperties; tabIndex?: number; @@ -1048,7 +1030,6 @@ declare namespace __MaterialUI { export interface DialogAction { id?: string; onClick?: React.MouseEventHandler<{}>; - onTouchTap?: TouchTapEventHandler; ref?: string; text: string; } @@ -1129,7 +1110,7 @@ declare namespace __MaterialUI { titleBackground?: string; titlePosition?: "top" | "bottom"; titleStyle?: React.CSSProperties; - onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler<{}>; } export class GridTile extends React.Component { } @@ -1186,7 +1167,7 @@ declare namespace __MaterialUI { onMouseLeave?: React.MouseEventHandler<{}>; onNestedListToggle?(item: ListItem): void; onTouchStart?: React.TouchEventHandler<{}>; - onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler<{}>; open?: boolean; primaryText?: React.ReactNode; primaryTogglesNestedList?: boolean; @@ -1203,7 +1184,7 @@ declare namespace __MaterialUI { } export interface SelectableProps { - onChange?(e: TouchTapEvent, value: any): void; + onChange?(e: React.SyntheticEvent<{}>, value: any): void; selectedItemStyle?: React.CSSProperties; value?: any; } @@ -1222,9 +1203,9 @@ declare namespace __MaterialUI { listStyle?: React.CSSProperties; maxHeight?: number; multiple?: boolean; - onChange?(e: TouchTapEvent, itemValue: any | any[]): void; + onChange?(e: React.SyntheticEvent<{}>, itemValue: any | any[]): void; onEscKeyDown?: React.KeyboardEventHandler<{}>; - onItemTouchTap?(e: TouchTapEvent, item: MenuItem): void; + onItemTouchTap?(e: React.SyntheticEvent<{}>, item: MenuItem): void; onKeyDown?: React.KeyboardEventHandler<{}>; selectedMenuItemStyle?: React.CSSProperties; style?: React.CSSProperties; @@ -1247,7 +1228,7 @@ declare namespace __MaterialUI { label?: string | React.ReactNode; leftIcon?: React.ReactElement; menuItems?: React.ReactNode; - onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler<{}>; primaryText?: React.ReactNode; rightIcon?: React.ReactElement; secondaryText?: React.ReactNode; @@ -1265,14 +1246,14 @@ declare namespace __MaterialUI { iconButtonElement: React.ReactElement; iconStyle?: React.CSSProperties; menuStyle?: React.CSSProperties; - onItemTouchTap?(e: TouchTapEvent, item: MenuItem): void; + onItemTouchTap?(e: React.SyntheticEvent<{}>, item: MenuItem): void; onKeyboardFocus?(e: React.FocusEvent<{}>, isKeyboardFocused: boolean): void; onMouseDown?: React.MouseEventHandler<{}>; onMouseEnter?: React.MouseEventHandler<{}>; onMouseLeave?: React.MouseEventHandler<{}>; onMouseUp?: React.MouseEventHandler<{}>; onRequestChange?(opening: boolean, reason: string): void; - onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler<{}>; open?: boolean; style?: React.CSSProperties; targetOrigin?: propTypes.origin; @@ -1285,7 +1266,7 @@ declare namespace __MaterialUI { listStyle?: React.CSSProperties; maxHeight?: number; multiple?: boolean; - onChange?(e: TouchTapEvent, itemValue: any | any[]): void; + onChange?(e: React.SyntheticEvent<{}>, itemValue: any | any[]): void; onKeyDown?: React.KeyboardEventHandler<{}>; selectedMenuItemStyle?: React.CSSProperties; value?: any | any[]; @@ -1311,8 +1292,8 @@ declare namespace __MaterialUI { menuItemStyle?: React.CSSProperties; menuStyle?: React.CSSProperties; multiple?: boolean; - onChange?(e: TouchTapEvent, index: number, menuItemValue: any): void; - onClose?(e: TouchTapEvent): void; + onChange?(e: React.SyntheticEvent<{}>, index: number, menuItemValue: any): void; + onClose?(e: React.SyntheticEvent<{}>): void; openImmediately?: boolean; selectedMenuItemStyle?: React.CSSProperties; selectionRenderer?(value: any, menuItem: any): void; @@ -1330,7 +1311,6 @@ declare namespace __MaterialUI { show?: boolean; transitionEnabled?: boolean; onClick?: React.MouseEventHandler<{}>; - onTouchTap?: TouchTapEventHandler; } export class Overlay extends React.Component { } @@ -1444,7 +1424,7 @@ declare namespace __MaterialUI { labelStyle?: React.CSSProperties; multiple?: boolean; onBlur?: React.FocusEventHandler<{}>; - onChange?(e: TouchTapEvent, index: number, menuItemValue: any): void; + onChange?(e: React.SyntheticEvent<{}>, index: number, menuItemValue: any): void; onFocus?: React.FocusEventHandler<{}>; selectFieldRoot?: React.CSSProperties; selectionRenderer?(value: any): React.ReactNode; @@ -1957,7 +1937,7 @@ declare namespace __MaterialUI { onDismiss?(): void; onFocus?: React.FocusEventHandler<{}>; onShow?(): void; - onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler<{}>; pedantic?: boolean; style?: React.CSSProperties; textFieldStyle?: React.CSSProperties; @@ -9015,7 +8995,6 @@ declare module 'material-ui/internal/Overlay' { style?: React.CSSProperties; transitionEnabled?: boolean; onClick?: React.MouseEventHandler<{}>; - onTouchTap?: __MaterialUI.TouchTapEventHandler; } class Overlay extends React.Component { } export default Overlay; diff --git a/types/material-ui/material-ui-tests.tsx b/types/material-ui/material-ui-tests.tsx index 3187188e99..c47383573e 100644 --- a/types/material-ui/material-ui-tests.tsx +++ b/types/material-ui/material-ui-tests.tsx @@ -2344,7 +2344,7 @@ const AppBarExampleIcon = () => ( const AppBarExampleIconButton = () => ( Title} - onTitleTouchTap={handleTouchTap} + onTitleClick={handleTouchTap} iconElementLeft={} iconElementRight={} /> @@ -3014,8 +3014,8 @@ class CardExampleControlled extends Component<{}, {expanded: boolean}> { Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. - - + + ); @@ -3247,19 +3247,19 @@ class DialogExampleSimple extends Component<{}, {open?: boolean}> { , , ]; return (
    - + { , , ]; return (
    - + { , , ]; return (
    - + { label="Ok" primary={true} keyboardFocused={true} - onTouchTap={this.handleClose} + onClick={this.handleClose} />, ]; return (
    - + { , , ]; @@ -3445,7 +3445,7 @@ class DialogExampleScrollable extends Component<{}, {open?: boolean}> { return (
    - + { , , ]; return (
    - + {
    Menu Item @@ -3583,7 +3583,7 @@ class DrawerUndockedExample extends Component<{}, {open?: boolean}> {
    { open={this.state.open} onRequestChange={(open) => this.setState({open})} > - Menu Item - Menu Item 2 + Menu Item + Menu Item 2
    ); @@ -3612,7 +3612,7 @@ class DrawerOpenRightExample extends Component<{}, {open?: boolean}> {
    @@ -4567,7 +4567,7 @@ class IconMenuExampleControlled extends Component<{}, IconMenuExampleControlledS - +
    ); } @@ -4844,7 +4844,7 @@ class PopoverExampleSimple extends Component<{}, {open?: boolean, anchorEl?: Rea return (

    Current Settings

    @@ -5705,7 +5705,7 @@ class SnackbarExampleSimple extends Component<{}, {open?: boolean}> { return (

    @@ -5820,7 +5820,7 @@ class SnackbarExampleTwice extends Component<{}, {open?: boolean, message?: stri return (
    @@ -5955,7 +5955,7 @@ class VerticalLinearStepper extends Component<{}, {stepIndex?: number, finished? disableTouchRipple={true} disableFocusRipple={true} primary={true} - onTouchTap={this.handleNext} + onClick={this.handleNext} style={{marginRight: 12}} /> {step > 0 && ( @@ -5964,7 +5964,7 @@ class VerticalLinearStepper extends Component<{}, {stepIndex?: number, finished? disabled={stepIndex === 0} disableTouchRipple={true} disableFocusRipple={true} - onTouchTap={this.handlePrev} + onClick={this.handlePrev} /> )}
    @@ -6087,14 +6087,14 @@ class HorizontalNonLinearStepper extends Component<{}, {stepIndex?: number}> {
    @@ -6130,7 +6130,7 @@ class VerticalNonLinear extends Component<{}, {stepIndex?: number}> { disableTouchRipple={true} disableFocusRipple={true} primary={true} - onTouchTap={this.handleNext} + onClick={this.handleNext} style={{marginRight: 12}} /> {step > 0 && ( @@ -6138,7 +6138,7 @@ class VerticalNonLinear extends Component<{}, {stepIndex?: number}> { label="Back" disableTouchRipple={true} disableFocusRipple={true} - onTouchTap={this.handlePrev} + onClick={this.handlePrev} /> )}
    @@ -6302,13 +6302,13 @@ class GranularControlStepper extends Component<{}, {stepIndex?: number, visited?
    )} @@ -7011,8 +7011,8 @@ class BottomNavigationExample extends Component<{}, { } render() { return - } onTouchTap={() => this.setState({index: 0})}/> - } onTouchTap={() => this.setState({index: 1})}/> + } onClick={() => this.setState({index: 0})}/> + } onClick={() => this.setState({index: 1})}/> ; } } From a3e3626477c60f42c2e41bf09734fd3fe9c3a75a Mon Sep 17 00:00:00 2001 From: Tim Su Date: Fri, 15 Dec 2017 11:46:24 -0800 Subject: [PATCH 264/890] Add placeholder document type Currently, if you compile typescript without the "dom" lib, there is no 'Document' type available, and so the cheerio type definitions will output an error: `error TS2304: Cannot find name 'Document'.`. This adds a blank Document interface so no error is produced. --- types/cheerio/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index 8250848374..42bcae6eff 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -271,6 +271,8 @@ interface CheerioAPI extends CheerioSelector, CheerioStatic { load(element: CheerioElement, options?: CheerioOptionsInterface): CheerioStatic; } +interface Document { } + declare var cheerio:CheerioAPI; declare module "cheerio" { From 0868ebcbccd557c22955e6568c00c82fad15734a Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 10:39:36 -0500 Subject: [PATCH 265/890] Update type to include OnDragStart OnDragEnter OnDrop --- types/rc-tree/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 8091b2edd5..793a10bd6f 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -149,6 +149,12 @@ export interface TreeProps extends Props { * whether can drag treeNode. */ draggable?: boolean; + /* + * On Drag Start Called + */ + onDragStart?: Function; + onDragEnter?: Function; + onDrop?: Function; } export default class Tree extends Component { } From d3a97d4d25dc243a44f45d3f0356b83cca50df43 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:00:58 -0500 Subject: [PATCH 266/890] Update onDrag types with Data Interfaces --- types/rc-tree/index.d.ts | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 793a10bd6f..4db24c2410 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -58,6 +58,24 @@ export interface SelectData { event: "select"; } +interface OnDragStartData { + event: Event, + node: TreeNode +} + +interface OnDragEnterData { + event: Event; + node: TreeNode; + expandedKeys: string[]; +} + +interface OnDropData { + event: Event; + node: TreeNode; + dragNode: TreeNode; + dragNodesKeys: string[]; +} + export interface TreeProps extends Props { /** * additional css class of root dom node @@ -149,12 +167,18 @@ export interface TreeProps extends Props { * whether can drag treeNode. */ draggable?: boolean; - /* - * On Drag Start Called + /** + * Event on Drag Start */ - onDragStart?: Function; - onDragEnter?: Function; - onDrop?: Function; + onDragStart?: (props: OnDragStartData) => void; + /** + * Event on Drag Enter + */ + onDragEnter?: (props: OnDragEnterData) => void; + /** + * Event on Drag Drop + */ + onDrop?: (props: OnDropData) => void; } export default class Tree extends Component { } From 82a4eba664eba92c8090deec3322399b9b8e246e Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:07:31 -0500 Subject: [PATCH 267/890] Fix comma interface to semicolon --- types/rc-tree/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 4db24c2410..df3db12c15 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -59,8 +59,8 @@ export interface SelectData { } interface OnDragStartData { - event: Event, - node: TreeNode + event: Event; + node: TreeNode; } interface OnDragEnterData { From 9a5a154ff88ff68bac20d27c19344a290fecd0ab Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:17:34 -0500 Subject: [PATCH 268/890] export onDrag interfaces --- types/rc-tree/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index df3db12c15..103bd60adf 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -58,18 +58,18 @@ export interface SelectData { event: "select"; } -interface OnDragStartData { +export interface OnDragStartData { event: Event; node: TreeNode; } -interface OnDragEnterData { +export interface OnDragEnterData { event: Event; node: TreeNode; expandedKeys: string[]; } -interface OnDropData { +export interface OnDropData { event: Event; node: TreeNode; dragNode: TreeNode; From 448e451dc1a188d80dea97e21184d4c4d90bea47 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:26:02 -0500 Subject: [PATCH 269/890] align asteriks for onDrag properties --- types/rc-tree/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 103bd60adf..a8e5780b97 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -169,15 +169,15 @@ export interface TreeProps extends Props { draggable?: boolean; /** * Event on Drag Start - */ + */ onDragStart?: (props: OnDragStartData) => void; /** * Event on Drag Enter - */ + */ onDragEnter?: (props: OnDragEnterData) => void; /** * Event on Drag Drop - */ + */ onDrop?: (props: OnDropData) => void; } From e100608648cb0e61cee3b059c737076fe5a794e4 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:34:21 -0500 Subject: [PATCH 270/890] lowercase letters --- types/rc-tree/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index a8e5780b97..4dc789824d 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -168,15 +168,15 @@ export interface TreeProps extends Props { */ draggable?: boolean; /** - * Event on Drag Start + * event on drag start */ onDragStart?: (props: OnDragStartData) => void; /** - * Event on Drag Enter + * event on drag enter */ onDragEnter?: (props: OnDragEnterData) => void; /** - * Event on Drag Drop + * event on drag drop */ onDrop?: (props: OnDropData) => void; } From c3dd0698c4e817274466f89f90e781b25db6a6d2 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 15:45:17 -0500 Subject: [PATCH 271/890] add onDrag tests --- types/rc-tree/rc-tree-tests.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/types/rc-tree/rc-tree-tests.tsx b/types/rc-tree/rc-tree-tests.tsx index c57866284f..290e3658cc 100644 --- a/types/rc-tree/rc-tree-tests.tsx +++ b/types/rc-tree/rc-tree-tests.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import Tree, { TreeNode, SelectData, CheckData } from 'rc-tree'; +import { TreeNode as TreeNodeInterface } from './index.d.ts'; interface Props { keys: string[]; @@ -43,6 +44,18 @@ export class Demo extends React.Component { onCheck(checkedKeys: string[], info: CheckData) { console.log('onCheck', checkedKeys, info); } + + onDragStart(params: {event: Event, node: TreeNodeInterface}) { + console.log('onDragStart', params.event, params.node); + } + + OnDragEnterData(params: {event: Event, node: TreeNodeInterface, expandedKeys: string[]}) { + console.log('OnDragEnterData', params.event, params.node, params.expandedKeys); + } + + OnDropData(params: {event: Event, node: TreeNode, dragNode: TreeNode, dragNodesKeys: string[]}) { + console.log('OnDropData', params.event, params.node, params.dragNode, params.dragNodesKeys); + } onEdit() { setTimeout(() => { @@ -73,6 +86,8 @@ export class Demo extends React.Component { defaultSelectedKeys={this.state.defaultSelectedKeys} defaultCheckedKeys={this.state.defaultCheckedKeys} onSelect={this.onSelect} onCheck={this.onCheck} + onDragStart={this.onDragStart} OnDragEnterData={this.OnDragEnterData} + OnDragEnterData={this.OnDragEnterData} > From 311b5961e8076626358650a17168cd624fe101a0 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 16:09:53 -0500 Subject: [PATCH 272/890] OnDropData in Tree Prop --- types/rc-tree/rc-tree-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rc-tree/rc-tree-tests.tsx b/types/rc-tree/rc-tree-tests.tsx index 290e3658cc..ff73beda86 100644 --- a/types/rc-tree/rc-tree-tests.tsx +++ b/types/rc-tree/rc-tree-tests.tsx @@ -87,7 +87,7 @@ export class Demo extends React.Component { defaultCheckedKeys={this.state.defaultCheckedKeys} onSelect={this.onSelect} onCheck={this.onCheck} onDragStart={this.onDragStart} OnDragEnterData={this.OnDragEnterData} - OnDragEnterData={this.OnDragEnterData} + OnDropData={this.OnDropData} > From 3bcf6f3ab2098a1660555581d4becded01075e5d Mon Sep 17 00:00:00 2001 From: Timon van Spronsen Date: Tue, 2 Jan 2018 09:27:33 +0100 Subject: [PATCH 273/890] Change Boom version for dependents --- types/boom/boom-tests.ts | 1 - types/catbox/tsconfig.json | 5 ++++- types/h2o2/tsconfig.json | 5 ++++- types/hapi-auth-basic/tsconfig.json | 5 ++++- types/hapi-auth-jwt2/tsconfig.json | 5 ++++- types/hapi-decorators/tsconfig.json | 5 ++++- types/hapi/tsconfig.json | 5 ++++- types/inert/tsconfig.json | 5 ++++- types/nes/tsconfig.json | 5 ++++- types/optics-agent/tsconfig.json | 5 ++++- types/swagger-express-mw/tsconfig.json | 5 ++++- types/swagger-hapi/tsconfig.json | 5 ++++- types/swagger-node-runner/tsconfig.json | 5 ++++- types/swagger-restify-mw/tsconfig.json | 5 ++++- types/swagger-sails-hook/tsconfig.json | 5 ++++- types/vision/tsconfig.json | 5 ++++- 16 files changed, 60 insertions(+), 16 deletions(-) diff --git a/types/boom/boom-tests.ts b/types/boom/boom-tests.ts index a3e4f137ee..f989128b4e 100644 --- a/types/boom/boom-tests.ts +++ b/types/boom/boom-tests.ts @@ -1,5 +1,4 @@ import Boom = require('boom'); -import * as Hapi from 'hapi'; // 4xx and data type diff --git a/types/catbox/tsconfig.json b/types/catbox/tsconfig.json index feb19f81dc..16f6fb780e 100644 --- a/types/catbox/tsconfig.json +++ b/types/catbox/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "catbox-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/h2o2/tsconfig.json b/types/h2o2/tsconfig.json index 57ff1914fc..30a156a786 100644 --- a/types/h2o2/tsconfig.json +++ b/types/h2o2/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "h2o2-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/hapi-auth-basic/tsconfig.json b/types/hapi-auth-basic/tsconfig.json index b1fb0f67e0..56ac44dbdd 100644 --- a/types/hapi-auth-basic/tsconfig.json +++ b/types/hapi-auth-basic/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "hapi-auth-basic-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/hapi-auth-jwt2/tsconfig.json b/types/hapi-auth-jwt2/tsconfig.json index 3bdb692c52..78a8423cc4 100644 --- a/types/hapi-auth-jwt2/tsconfig.json +++ b/types/hapi-auth-jwt2/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "hapi-auth-jwt2-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/hapi-decorators/tsconfig.json b/types/hapi-decorators/tsconfig.json index fb06375c84..80aa56a21e 100644 --- a/types/hapi-decorators/tsconfig.json +++ b/types/hapi-decorators/tsconfig.json @@ -15,6 +15,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -22,4 +25,4 @@ "index.d.ts", "hapi-decorators-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/hapi/tsconfig.json b/types/hapi/tsconfig.json index 2a3f7dbd5d..96790b3bff 100644 --- a/types/hapi/tsconfig.json +++ b/types/hapi/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -94,4 +97,4 @@ "test/server/table.ts", "test/server/version.ts" ] -} \ No newline at end of file +} diff --git a/types/inert/tsconfig.json b/types/inert/tsconfig.json index ad4e395bca..da982b9122 100644 --- a/types/inert/tsconfig.json +++ b/types/inert/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "inert-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/nes/tsconfig.json b/types/nes/tsconfig.json index d0100330cd..374b67b515 100644 --- a/types/nes/tsconfig.json +++ b/types/nes/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -33,4 +36,4 @@ "test/subscriptions-client.ts", "test/subscriptions-server.ts" ] -} \ No newline at end of file +} diff --git a/types/optics-agent/tsconfig.json b/types/optics-agent/tsconfig.json index 046bfaad81..e7dbc8958b 100644 --- a/types/optics-agent/tsconfig.json +++ b/types/optics-agent/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "optics-agent-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/swagger-express-mw/tsconfig.json b/types/swagger-express-mw/tsconfig.json index 8495da733e..c529b14c27 100644 --- a/types/swagger-express-mw/tsconfig.json +++ b/types/swagger-express-mw/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "swagger-express-mw-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/swagger-hapi/tsconfig.json b/types/swagger-hapi/tsconfig.json index 78127356a4..ea5343eb59 100644 --- a/types/swagger-hapi/tsconfig.json +++ b/types/swagger-hapi/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "swagger-hapi-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/swagger-node-runner/tsconfig.json b/types/swagger-node-runner/tsconfig.json index 3d7cac28ea..1d3ae44a1a 100644 --- a/types/swagger-node-runner/tsconfig.json +++ b/types/swagger-node-runner/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "swagger-node-runner-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/swagger-restify-mw/tsconfig.json b/types/swagger-restify-mw/tsconfig.json index 1ebe8fc759..a9dcb8c0da 100644 --- a/types/swagger-restify-mw/tsconfig.json +++ b/types/swagger-restify-mw/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "swagger-restify-mw-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/swagger-sails-hook/tsconfig.json b/types/swagger-sails-hook/tsconfig.json index 8700d1e356..44a316b98b 100644 --- a/types/swagger-sails-hook/tsconfig.json +++ b/types/swagger-sails-hook/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "swagger-sails-hook-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/vision/tsconfig.json b/types/vision/tsconfig.json index b5a7337fa7..d00003dd52 100644 --- a/types/vision/tsconfig.json +++ b/types/vision/tsconfig.json @@ -13,6 +13,9 @@ "../" ], "types": [], + "paths": { + "boom": ["boom/v4"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -20,4 +23,4 @@ "index.d.ts", "vision-tests.ts" ] -} \ No newline at end of file +} From 52472357ed8f68e0dcad9d6fe8d46bfcdabcc3ea Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 08:50:48 -0800 Subject: [PATCH 274/890] survey-knockout: Provides its own types (#22324) --- notNeededPackages.json | 6 + types/survey-knockout/index.d.ts | 1176 ----------------- .../survey-knockout/survey-knockout-tests.ts | 22 - types/survey-knockout/tsconfig.json | 24 - types/survey-knockout/tslint.json | 80 -- 5 files changed, 6 insertions(+), 1302 deletions(-) delete mode 100644 types/survey-knockout/index.d.ts delete mode 100644 types/survey-knockout/survey-knockout-tests.ts delete mode 100644 types/survey-knockout/tsconfig.json delete mode 100644 types/survey-knockout/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 89bb525c18..6786c3d526 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1056,6 +1056,12 @@ "sourceRepoURL": "https://github.com/andrewplummer/Sugar", "asOfVersion": "2.0.2" }, + { + "libraryName": "survey-knockout", + "typingsPackageName": "survey-knockout", + "sourceRepoURL": "http://surveyjs.org/", + "asOfVersion": "0.10.0" + }, { "libraryName": "svg-pan-zoom", "typingsPackageName": "svg-pan-zoom", diff --git a/types/survey-knockout/index.d.ts b/types/survey-knockout/index.d.ts deleted file mode 100644 index cb0f7776ac..0000000000 --- a/types/survey-knockout/index.d.ts +++ /dev/null @@ -1,1176 +0,0 @@ -// Type definitions for Survey JavaScript library v0.9.7 -// Project: http://surveyjs.org/ -// Definitions by: Andrew Telnov -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare module Survey { - interface HashTable { - [key: string]: T; - } - interface ISurvey { - getValue(name: string): any; - setValue(name: string, newValue: any): any; - getComment(name: string): string; - setComment(name: string, newValue: string): any; - pageVisibilityChanged(page: IPage, newValue: boolean): any; - questionVisibilityChanged(question: IQuestion, newValue: boolean): any; - questionAdded(question: IQuestion, index: number): any; - questionRemoved(question: IQuestion): any; - validateQuestion(name: string): SurveyError; - processHtml(html: string): string; - processText(text: string): string; - isDesignMode: boolean; - requiredText: string; - } - interface IQuestion { - name: string; - visible: boolean; - hasTitle: boolean; - setVisibleIndex(value: number): any; - onSurveyValueChanged(newValue: any): any; - } - interface IPage { - visible: boolean; - } - class ItemValue { - static Separator: string; - static setData(items: Array, values: Array): void; - static getData(items: Array): any; - private itemValue; - private itemText; - constructor(value: any, text?: string); - getType(): string; - value: any; - hasText: boolean; - text: string; - } - class Base { - getType(): string; - } - class SurveyError { - getText(): string; - } - class Event { - private callbacks; - isEmpty: boolean; - fire(sender: any, options: Options): void; - add(func: T): void; - remove(func: T): void; - } -} - -declare module Survey { - class dxSurveyService { - static serviceUrl: string; - constructor(); - loadSurvey(surveyId: string, onLoad: (success: boolean, result: string, response: any) => void): void; - sendResult(postId: string, result: JSON, onSendResult: (success: boolean, response: any) => void, clientId?: string, isPartialCompleted?: boolean): void; - getResult(resultId: string, name: string, onGetResult: (success: boolean, data: any, dataList: Array, response: any) => void): void; - isCompleted(resultId: string, clientId: string, onIsCompleted: (success: boolean, result: string, response: any) => void): void; - } -} - -declare module Survey { - var surveyLocalization: { - currentLocale: string; - locales: {}; - getString: (strName: string) => any; - getLocales: () => string[]; - }; - var surveyStrings: { - pagePrevText: string; - pageNextText: string; - completeText: string; - otherItemText: string; - progressText: string; - emptySurvey: string; - completingSurvey: string; - loadingSurvey: string; - optionsCaption: string; - requiredError: string; - numericError: string; - textMinLength: string; - minSelectError: string; - maxSelectError: string; - numericMinMax: string; - numericMin: string; - numericMax: string; - invalidEmail: string; - otherRequiredError: string; - }; -} - -/// -/// -declare module Survey { - class AnswerRequiredError extends SurveyError { - constructor(); - getText(): string; - } - class RequreNumericError extends SurveyError { - constructor(); - getText(): string; - } - class CustomError extends SurveyError { - private text; - constructor(text: string); - getText(): string; - } -} - -/// -declare module Survey { - class JsonObjectProperty { - name: string; - private typeValue; - private choicesValue; - private choicesfunc; - className: string; - classNamePart: string; - baseClassName: string; - defaultValue: any; - onGetValue: (obj: any) => any; - onSetValue: (obj: any, value: any, jsonConv: JsonObject) => any; - constructor(name: string); - type: string; - hasToUseGetValue: (obj: any) => any; - isDefaultValue(value: any): boolean; - getValue(obj: any): any; - hasToUseSetValue: (obj: any, value: any, jsonConv: JsonObject) => any; - setValue(obj: any, value: any, jsonConv: JsonObject): void; - getObjType(objType: string): string; - getClassName(className: string): string; - choices: Array; - setChoices(value: Array, valueFunc: () => Array): void; - } - class JsonMetadataClass { - name: string; - creator: () => any; - parentName: string; - static requiredSymbol: string; - static typeSymbol: string; - properties: Array; - requiredProperties: Array; - constructor(name: string, propertiesNames: Array, creator?: () => any, parentName?: string); - find(name: string): JsonObjectProperty; - private getPropertyName(propertyName); - } - class JsonMetadata { - private classes; - private childrenClasses; - private classProperties; - private classRequiredProperties; - addClass(name: string, propertiesNames: Array, creator?: () => any, parentName?: string): JsonMetadataClass; - overrideClassCreatore(name: string, creator: () => any): void; - setPropertyValues(name: string, propertyName: string, propertyClassName: string, defaultValue?: any, onGetValue?: (obj: any) => any, onSetValue?: (obj: any, value: any, jsonConv: JsonObject) => any): void; - setPropertyChoices(name: string, propertyName: string, choices: Array, choicesFunc?: () => Array): void; - setPropertyClassInfo(name: string, propertyName: string, baseClassName: string, classNamePart?: string): void; - getProperties(name: string): Array; - createClass(name: string): any; - getChildrenClasses(name: string, canBeCreated?: boolean): Array; - getRequiredProperties(name: string): Array; - private fillChildrenClasses(name, canBeCreated, result); - private findClass(name); - private findProperty(name, propertyName); - private fillProperties(name, list); - private addProperty(property, list, endIndex); - private fillRequiredProperties(name, list); - } - class JsonError { - type: string; - message: string; - description: string; - at: Number; - constructor(type: string, message: string); - getFullDescription(): string; - } - class JsonUnknownPropertyError extends JsonError { - propertyName: string; - className: string; - constructor(propertyName: string, className: string); - } - class JsonMissingTypeErrorBase extends JsonError { - baseClassName: string; - type: string; - message: string; - constructor(baseClassName: string, type: string, message: string); - } - class JsonMissingTypeError extends JsonMissingTypeErrorBase { - propertyName: string; - baseClassName: string; - constructor(propertyName: string, baseClassName: string); - } - class JsonIncorrectTypeError extends JsonMissingTypeErrorBase { - propertyName: string; - baseClassName: string; - constructor(propertyName: string, baseClassName: string); - } - class JsonRequiredPropertyError extends JsonError { - propertyName: string; - className: string; - constructor(propertyName: string, className: string); - } - class JsonObject { - private static typePropertyName; - private static positionPropertyName; - private static metaDataValue; - static metaData: JsonMetadata; - errors: JsonError[]; - toJsonObject(obj: any): any; - toObject(jsonObj: any, obj: any): void; - protected toJsonObjectCore(obj: any, property: JsonObjectProperty): any; - protected valueToJson(obj: any, result: any, property: JsonObjectProperty): void; - protected valueToObj(value: any, obj: any, key: any, property: JsonObjectProperty): void; - private isValueArray(value); - private createNewObj(value, property); - private checkNewObjectOnErrors(newObj, value, property, className); - private addNewError(error, jsonObj); - private valueToArray(value, obj, key, property); - private findProperty(properties, key); - } -} - -/// -/// -declare module Survey { - class QuestionBase extends Base implements IQuestion { - name: string; - protected data: ISurvey; - private visibleValue; - private visibleIndexValue; - width: string; - visibilityChangedCallback: () => void; - visibleIndexChangedCallback: () => void; - constructor(name: string); - visible: boolean; - visibleIndex: number; - hasErrors(): boolean; - hasTitle: boolean; - hasComment: boolean; - setData(newValue: ISurvey): void; - protected fireCallback(callback: () => void): void; - protected onSetData(): void; - protected onCreating(): void; - onSurveyValueChanged(newValue: any): void; - setVisibleIndex(value: number): void; - } -} - -/// -/// -declare module Survey { - class QuestionFactory { - static Instance: QuestionFactory; - static DefaultChoices: (string | { - value: number; - text: string; - })[]; - private creatorHash; - registerQuestion(questionType: string, questionCreator: (name: string) => QuestionBase): void; - getAllTypes(): Array; - createQuestion(questionType: string, name: string): QuestionBase; - } -} - -/// -/// -/// -declare module Survey { - class PageModel extends Base implements IPage { - name: string; - questions: Array; - data: ISurvey; - title: string; - visibleIndex: number; - private numValue; - private visibleValue; - constructor(name?: string); - processedTitle: string; - num: number; - visible: boolean; - getType(): string; - isVisible: boolean; - addQuestion(question: QuestionBase, index?: number): void; - addNewQuestion(questionType: string, name: string): QuestionBase; - removeQuestion(question: QuestionBase): void; - hasErrors(): boolean; - addQuestionsToList(list: Array, visibleOnly?: boolean): void; - protected onNumChanged(value: number): void; - } -} - -/// -/// -/// -declare module Survey { - class ValidatorResult { - value: any; - error: SurveyError; - constructor(value: any, error?: SurveyError); - } - class SurveyValidator extends Base { - text: string; - constructor(); - protected getErrorText(name: string): string; - protected getDefaultErrorText(name: string): string; - validate(value: any, name?: string): ValidatorResult; - } - interface IValidatorOwner { - validators: Array; - value: any; - getValidatorTitle(): string; - } - class ValidatorRunner { - run(owner: IValidatorOwner): SurveyError; - } - class NumericValidator extends SurveyValidator { - minValue: number; - maxValue: number; - constructor(minValue?: number, maxValue?: number); - getType(): string; - validate(value: any, name?: string): ValidatorResult; - protected getDefaultErrorText(name: string): any; - private isNumber(value); - } - class TextValidator extends SurveyValidator { - minLength: number; - constructor(minLength?: number); - getType(): string; - validate(value: any, name?: string): ValidatorResult; - protected getDefaultErrorText(name: string): any; - } - class AnswerCountValidator extends SurveyValidator { - minCount: number; - maxCount: number; - constructor(minCount?: number, maxCount?: number); - getType(): string; - validate(value: any, name?: string): ValidatorResult; - protected getDefaultErrorText(name: string): string; - } - class RegexValidator extends SurveyValidator { - regex: string; - constructor(regex?: string); - getType(): string; - validate(value: any, name?: string): ValidatorResult; - } - class EmailValidator extends SurveyValidator { - private re; - constructor(); - getType(): string; - validate(value: any, name?: string): ValidatorResult; - protected getDefaultErrorText(name: string): any; - } -} - -/// -/// -/// -/// -/// -declare module Survey { - class Question extends QuestionBase implements IValidatorOwner { - name: string; - private titleValue; - private questionValue; - private isRequiredValue; - private hasCommentValue; - private hasOtherValue; - errors: Array; - validators: Array; - valueChangedCallback: () => void; - commentChangedCallback: () => void; - errorsChangedCallback: () => void; - constructor(name: string); - hasTitle: boolean; - title: string; - processedTitle: string; - supportComment(): boolean; - supportOther(): boolean; - isRequired: boolean; - hasComment: boolean; - hasOther: boolean; - protected onSetData(): void; - value: any; - comment: string; - isEmpty(): boolean; - hasErrors(): boolean; - requiredText: string; - private checkForErrors(); - protected onCheckForErrors(errors: Array): void; - protected runValidators(): SurveyError; - private isValueChangedInSurvey; - protected setNewValue(newValue: any): void; - protected onValueChanged(): void; - private setNewComment(newValue); - onSurveyValueChanged(newValue: any): void; - getValidatorTitle(): string; - } -} - -/// -/// -declare module Survey { - class QuestionSelectBase extends Question { - otherItem: ItemValue; - choicesValues: Array; - otherErrorText: string; - choicesOrderValue: string; - constructor(name: string); - isOtherSelected: boolean; - choices: Array; - choicesOrder: string; - otherText: string; - visibleChoices: Array; - supportComment(): boolean; - supportOther(): boolean; - protected onCheckForErrors(errors: Array): void; - sortVisibleChoices(array: Array): Array; - sortArray(array: Array, mult: number): Array; - randomizeArray(array: Array): Array; - } - class QuestionCheckboxBase extends QuestionSelectBase { - name: string; - private colCountValue; - colCountChangedCallback: () => void; - constructor(name: string); - colCount: number; - } -} - -/// -/// -declare module Survey { - class QuestionCheckboxModel extends QuestionCheckboxBase { - name: string; - constructor(name: string); - isOtherSelected: boolean; - getType(): string; - } -} - -/// -/// -declare module Survey { - class QuestionCommentModel extends Question { - name: string; - rows: number; - cols: number; - constructor(name: string); - getType(): string; - isEmpty(): boolean; - } -} - -/// -/// -declare module Survey { - class QuestionDropdownModel extends QuestionSelectBase { - name: string; - private optionsCaptionValue; - constructor(name: string); - optionsCaption: string; - getType(): string; - } -} - -/// -/// -declare module Survey { - class QuestionHtmlModel extends QuestionBase { - name: string; - private htmlValue; - constructor(name: string); - getType(): string; - html: string; - processedHtml: string; - } -} - -/// -/// -declare module Survey { - interface IMatrixData { - onMatrixRowChanged(row: MatrixRowModel): any; - } - class MatrixRowModel extends Base { - name: any; - text: string; - fullName: string; - private data; - protected rowValue: any; - constructor(name: any, text: string, fullName: string, data: IMatrixData, value: any); - value: any; - protected onValueChanged(): void; - } - class QuestionMatrixModel extends Question implements IMatrixData { - name: string; - private columnsValue; - private rowsValue; - private isRowChanging; - private generatedVisibleRows; - constructor(name: string); - getType(): string; - hasRows: boolean; - columns: Array; - rows: Array; - visibleRows: Array; - protected createMatrixRow(name: any, text: string, fullName: string, value: any): MatrixRowModel; - protected onValueChanged(): void; - onMatrixRowChanged(row: MatrixRowModel): void; - } -} - -/// -/// -declare module Survey { - class QuestionRadiogroupModel extends QuestionCheckboxBase { - name: string; - constructor(name: string); - getType(): string; - } -} - -/// -/// -declare module Survey { - class QuestionTextModel extends Question { - name: string; - size: number; - constructor(name: string); - getType(): string; - isEmpty(): boolean; - } -} - -/// -/// -/// -/// -/// -/// -/// -/// -declare module Survey { - interface IMatrixDropdownData { - onCellChanged(cell: MatrixDropdownCellModel): any; - columns: Array; - choices: Array; - optionsCaption: string; - } - class MatrixDropdownColumn extends Base { - name: string; - private choicesValue; - private titleValue; - optionsCaption: string; - private cellTypeValue; - private colCountValue; - constructor(name: string, title?: string); - getType(): string; - title: string; - choices: Array; - cellType: string; - colCount: number; - } - class MatrixDropdownCellModel { - column: MatrixDropdownColumn; - row: MatrixDropdownRowModel; - private data; - private questionValue; - constructor(column: MatrixDropdownColumn, row: MatrixDropdownRowModel, data: IMatrixDropdownData, value: any); - choices: Array; - optionsCaption: string; - question: Question; - value: any; - protected onValueChanged(): void; - protected createQuestion(): Question; - protected createDropdown(name: string): QuestionDropdownModel; - protected createCheckbox(name: string): QuestionCheckboxModel; - protected createRadiogroup(name: string): QuestionRadiogroupModel; - protected createText(name: string): QuestionTextModel; - protected createComment(name: string): QuestionCommentModel; - protected createDropdownCore(name: string): QuestionDropdownModel; - protected createCheckboxCore(name: string): QuestionCheckboxModel; - protected createRadiogroupCore(name: string): QuestionRadiogroupModel; - protected getQuestionName(): string; - } - class MatrixDropdownRowModel { - name: any; - text: string; - protected data: IMatrixDropdownData; - protected rowValue: any; - cells: Array; - constructor(name: any, text: string, data: IMatrixDropdownData, value: any); - value: any; - private buildCells(); - protected createCell(column: MatrixDropdownColumn, value: any): MatrixDropdownCellModel; - protected getCellValue(column: MatrixDropdownColumn): any; - } - class QuestionMatrixDropdownModel extends Question implements IMatrixDropdownData { - name: string; - private columnsValue; - private rowsValue; - private choicesValue; - private optionsCaptionValue; - private isRowChanging; - private generatedVisibleRows; - constructor(name: string); - getType(): string; - columns: Array; - rows: Array; - choices: Array; - optionsCaption: string; - addColumn(name: string, title?: string): MatrixDropdownColumn; - visibleRows: Array; - protected createMatrixRow(name: any, text: string, value: any): MatrixDropdownRowModel; - protected onValueChanged(): void; - onCellChanged(cell: MatrixDropdownCellModel): void; - } -} - -/// -/// -declare module Survey { - interface IMultipleTextData { - getMultipleTextValue(name: string): any; - setMultipleTextValue(name: string, value: any): any; - } - class MultipleTextItemModel extends Base implements IValidatorOwner { - name: any; - private data; - private titleValue; - validators: Array; - constructor(name?: any, title?: string); - getType(): string; - setData(data: IMultipleTextData): void; - title: string; - value: any; - onValueChanged(newValue: any): void; - getValidatorTitle(): string; - } - class QuestionMultipleTextModel extends Question implements IMultipleTextData { - name: string; - private colCountValue; - colCountChangedCallback: () => void; - itemSize: number; - private itemsValues; - constructor(name: string); - getType(): string; - items: Array; - AddItem(name: string, title?: string): MultipleTextItemModel; - colCount: number; - getRows(): Array; - private isMultipleItemValueChanging; - protected onValueChanged(): void; - protected createTextItem(name: string, title: string): MultipleTextItemModel; - protected onItemValueChanged(): void; - protected runValidators(): SurveyError; - getMultipleTextValue(name: string): any; - setMultipleTextValue(name: string, value: any): void; - } -} - -/// -/// -declare module Survey { - class QuestionRatingModel extends Question { - name: string; - static defaultRateValues: ItemValue[]; - private rates; - mininumRateDescription: string; - maximumRateDescription: string; - rateValuesChangedCallback: () => void; - constructor(name: string); - rateValues: Array; - visibleRateValues: ItemValue[]; - getType(): string; - supportComment(): boolean; - supportOther(): boolean; - } -} - -/// -/// -declare module Survey { - class Trigger extends Base { - static operatorsValue: HashTable; - static operators: HashTable; - private opValue; - value: any; - constructor(); - operator: string; - check(value: any): void; - protected onSuccess(): void; - protected onFailure(): void; - } - interface ISurveyTriggerOwner { - getObjects(pages: string[], questions: string[]): any[]; - doComplete(): any; - setTriggerValue(name: string, value: any, isVariable: boolean): any; - } - class SurveyTrigger extends Trigger { - name: string; - protected owner: ISurveyTriggerOwner; - constructor(); - setOwner(owner: ISurveyTriggerOwner): void; - isOnNextPage: boolean; - } - class SurveyTriggerVisible extends SurveyTrigger { - pages: string[]; - questions: string[]; - constructor(); - getType(): string; - protected onSuccess(): void; - protected onFailure(): void; - private onTrigger(func); - protected onItemSuccess(item: any): void; - protected onItemFailure(item: any): void; - } - class SurveyTriggerComplete extends SurveyTrigger { - constructor(); - getType(): string; - isOnNextPage: boolean; - protected onSuccess(): void; - } - class SurveyTriggerSetValue extends SurveyTrigger { - setToName: string; - setValue: any; - isVariable: boolean; - constructor(); - getType(): string; - protected onSuccess(): void; - } -} - -declare module Survey { - class TextPreProcessor { - onProcess: (name: string) => any; - onHasValue: (name: string) => boolean; - constructor(); - process(text: string): string; - private getItems(text); - private getName(name); - private canProcessName(name); - } -} - -/// -/// -/// -/// -/// -/// -declare module Survey { - class SurveyModel extends Base implements ISurvey, ISurveyTriggerOwner { - surveyId: string; - surveyPostId: string; - clientId: string; - cookieName: string; - sendResultOnPageNext: boolean; - commentPrefix: string; - title: string; - showNavigationButtons: boolean; - showTitle: boolean; - showPageTitles: boolean; - completedHtml: string; - requiredText: string; - showProgressBar: string; - pages: Array; - triggers: Array; - private currentPageValue; - private valuesHash; - private variablesHash; - private pagePrevTextValue; - private pageNextTextValue; - private completeTextValue; - private showPageNumbersValue; - private showQuestionNumbersValue; - private localeValue; - private isCompleted; - private isLoading; - private processedTextValues; - private textPreProcessor; - onComplete: Event<(sender: SurveyModel) => any, any>; - onCurrentPageChanged: Event<(sender: SurveyModel, options: any) => any, any>; - onValueChanged: Event<(sender: SurveyModel, options: any) => any, any>; - onVisibleChanged: Event<(sender: SurveyModel, options: any) => any, any>; - onPageVisibleChanged: Event<(sender: SurveyModel, options: any) => any, any>; - onQuestionAdded: Event<(sender: SurveyModel, options: any) => any, any>; - onQuestionRemoved: Event<(sender: SurveyModel, options: any) => any, any>; - onValidateQuestion: Event<(sender: SurveyModel, options: any) => any, any>; - onProcessHtml: Event<(sender: SurveyModel, options: any) => any, any>; - onSendResult: Event<(sender: SurveyModel, options: any) => any, any>; - onGetResult: Event<(sender: SurveyModel, options: any) => any, any>; - jsonErrors: Array; - mode: string; - constructor(jsonObj?: any); - getType(): string; - locale: string; - getLocString(str: string): any; - emptySurveyText: string; - pagePrevText: string; - pageNextText: string; - completeText: string; - showPageNumbers: boolean; - showQuestionNumbers: string; - data: any; - comments: any; - visiblePages: Array; - isEmpty: boolean; - PageCount: number; - visiblePageCount: number; - currentPage: PageModel; - state: string; - clear(): void; - protected mergeValues(src: any, dest: any): void; - protected currentPageChanged(newValue: PageModel, oldValue: PageModel): void; - getProgress(): number; - isDesignMode: boolean; - hasCookie: boolean; - setCookie(): void; - deleteCookie(): void; - nextPage(): boolean; - isCurrentPageHasErrors: boolean; - prevPage(): boolean; - completeLastPage(): boolean; - isFirstPage: boolean; - isLastPage: boolean; - doComplete(): void; - protected setCompleted(): void; - processedCompletedHtml: string; - processedLoadingHtml: string; - progressText: string; - getPage(index: number): PageModel; - addPage(page: PageModel): void; - addNewPage(name: string): PageModel; - removePage(page: PageModel): void; - getQuestionByName(name: string, caseInsensitive?: boolean): IQuestion; - getQuestionsByNames(names: string[], caseInsensitive?: boolean): IQuestion[]; - getPageByQuestion(question: IQuestion): PageModel; - getPageByName(name: string): PageModel; - getPagesByNames(names: string[]): PageModel[]; - getAllQuestions(visibleOnly?: boolean): Array; - protected createNewPage(name: string): PageModel; - private notifyQuestionOnValueChanged(name, newValue); - private notifyAllQuestionsOnValueChanged(); - protected doSurveyValueChanged(question: IQuestion, newValue: any): void; - private checkOnPageTriggers(); - private checkTriggers(name, newValue, isOnNextPage); - sendResult(postId?: string, clientId?: string, isPartialCompleted?: boolean): void; - getResult(resultId: string, name: string): void; - loadSurveyFromService(surveyId?: string): void; - protected onLoadingSurveyFromService(): void; - protected onLoadSurveyFromService(): void; - private updateVisibleIndexes(); - private updatePageVisibleIndexes(showIndex); - private updateQuestionVisibleIndexes(questions, showIndex); - private setJsonObject(jsonObj); - protected onBeforeCreating(): void; - protected onCreating(): void; - private updateProcessedTextValues(); - private addQuestionToProcessedTextValues(question); - private getProcessedTextValue(name); - getVariable(name: string): any; - setVariable(name: string, newValue: any): void; - getValue(name: string): any; - setValue(name: string, newValue: any): void; - getComment(name: string): string; - setComment(name: string, newValue: string): void; - questionVisibilityChanged(question: IQuestion, newValue: boolean): void; - pageVisibilityChanged(page: IPage, newValue: boolean): void; - questionAdded(question: IQuestion, index: number): void; - questionRemoved(question: IQuestion): void; - validateQuestion(name: string): SurveyError; - processHtml(html: string): string; - processText(text: string): string; - getObjects(pages: string[], questions: string[]): any[]; - setTriggerValue(name: string, value: any, isVariable: boolean): void; - } -} - -declare module Survey { - class SurveyWindowModel extends Base { - static surveyElementName: string; - surveyValue: SurveyModel; - windowElement: HTMLDivElement; - isShowingValue: boolean; - isExpandedValue: boolean; - titleValue: string; - templateValue: string; - constructor(jsonObj: any); - getType(): string; - survey: SurveyModel; - isShowing: boolean; - isExpanded: boolean; - title: string; - expand(): void; - collapse(): void; - protected createSurvey(jsonObj: any): SurveyModel; - protected expandcollapse(value: boolean): void; - } -} - -declare module Survey { -} - -declare module Survey { -} - -declare module Survey { -} - -declare module Survey { - class Page extends PageModel { - koNo: any; - constructor(name?: string); - protected onCreating(): void; - protected onNumChanged(value: number): void; - } -} - -declare module Survey { - class QuestionImplementorBase { - question: QuestionBase; - koVisible: any; - koNo: any; - koErrors: any; - constructor(question: QuestionBase); - protected onVisibilityChanged(): void; - protected onVisibleIndexChanged(): void; - protected getNo(): string; - } -} - -declare module Survey { - class QuestionImplementor extends QuestionImplementorBase { - question: Question; - private isUpdating; - koValue: any; - koComment: any; - constructor(question: Question); - protected onValueChanged(): void; - protected onCommentChanged(): void; - protected onVisibilityChanged(): void; - protected onVisibleIndexChanged(): void; - protected onErrorsChanged(): void; - protected createkoValue(): any; - protected setkoValue(newValue: any): void; - protected updateValue(newValue: any): void; - protected updateComment(newValue: any): void; - protected getNo(): string; - } -} - -/// -declare module Survey { - class QuestionSelectBaseImplementor extends QuestionImplementor { - koOtherVisible: any; - constructor(question: Question); - protected isOtherSelected: boolean; - } - class QuestionCheckboxBaseImplementor extends QuestionSelectBaseImplementor { - koWidth: any; - constructor(question: Question); - protected onColCountChanged(): void; - protected colWidth: string; - private koAfterRender(el, con); - } -} - -declare module Survey { - class QuestionCheckbox extends QuestionCheckboxModel { - name: string; - constructor(name: string); - } -} - -declare module Survey { - class QuestionComment extends QuestionCommentModel { - name: string; - constructor(name: string); - } -} - -declare module Survey { - class QuestionDropdown extends QuestionDropdownModel { - name: string; - constructor(name: string); - } -} - -declare module Survey { - class QuestionHtml extends QuestionHtmlModel { - name: string; - constructor(name: string); - } -} - -declare module Survey { - class MatrixRow extends MatrixRowModel { - name: any; - text: string; - fullName: string; - private isValueUpdating; - koValue: any; - constructor(name: any, text: string, fullName: string, data: IMatrixData, value: any); - protected onValueChanged(): void; - } - class QuestionMatrix extends QuestionMatrixModel { - name: string; - constructor(name: string); - protected createMatrixRow(name: any, text: string, fullName: string, value: any): MatrixRowModel; - } -} - -declare module Survey { - class QuestionRadiogroup extends QuestionRadiogroupModel { - name: string; - constructor(name: string); - } -} - -declare module Survey { - class QuestionText extends QuestionTextModel { - name: string; - constructor(name: string); - } -} - -declare module Survey { - class MatrixDropdownCell extends MatrixDropdownCellModel { - column: MatrixDropdownColumn; - row: MatrixDropdownRowModel; - constructor(column: MatrixDropdownColumn, row: MatrixDropdownRowModel, data: IMatrixDropdownData, value: any); - protected createText(name: string): QuestionTextModel; - protected createComment(name: string): QuestionCommentModel; - protected createDropdownCore(name: string): QuestionDropdownModel; - protected createCheckboxCore(name: string): QuestionCheckboxModel; - protected createRadiogroupCore(name: string): QuestionRadiogroupModel; - } - class MatrixDropdownRow extends MatrixDropdownRowModel { - name: any; - text: string; - constructor(name: any, text: string, data: IMatrixDropdownData, value: any); - protected createCell(column: MatrixDropdownColumn, value: any): MatrixDropdownCellModel; - } - class QuestionMatrixDropdown extends QuestionMatrixDropdownModel { - name: string; - constructor(name: string); - protected createMatrixRow(name: any, text: string, value: any): MatrixDropdownRowModel; - } -} - -declare module Survey { - class MultipleTextItem extends MultipleTextItemModel { - name: any; - private isKOValueUpdating; - koValue: any; - constructor(name?: any, title?: string); - onValueChanged(newValue: any): void; - } - class QuestionMultipleTextImplementor extends QuestionImplementor { - koRows: any; - constructor(question: Question); - protected onColCountChanged(): void; - } - class QuestionMultipleText extends QuestionMultipleTextModel { - name: string; - constructor(name: string); - protected createTextItem(name: string, title: string): MultipleTextItemModel; - } -} - -declare module Survey { - class QuestionRating extends QuestionRatingModel { - name: string; - itemCss: string; - constructor(name: string); - protected onSetData(): void; - } -} - -declare module Survey { - class SurveyBase extends SurveyModel { - private renderedElement; - private cssValue; - onRendered: Event<(sender: SurveyModel) => any, any>; - koCurrentPage: any; - koIsFirstPage: any; - koIsLastPage: any; - dummyObservable: any; - koState: any; - koProgress: any; - koProgressText: any; - constructor(jsonObj?: any, renderedElement?: any, css?: any); - css: any; - render(element?: any): void; - loadSurveyFromService(surveyId?: string, renderedElement?: any): void; - protected setCompleted(): void; - protected createNewPage(name: string): Page; - protected createCssObject(): any; - protected getTemplate(): string; - protected onBeforeCreating(): void; - protected currentPageChanged(newValue: PageModel, oldValue: PageModel): void; - protected onLoadSurveyFromService(): void; - protected onLoadingSurveyFromService(): void; - private applyBinding(); - private updateKoCurrentPage(); - } -} - -declare module Survey { - class SurveyWindowBase extends SurveyWindowModel { - koExpanded: any; - doExpand: any; - constructor(jsonObj: any); - protected createSurvey(jsonObj: any): SurveyModel; - protected expandcollapse(value: boolean): void; - protected template: string; - show(): void; - protected getDefaultTemplate(): string; - hide(): void; - private changeExpanded(); - private onComplete(); - } -} - -declare module Survey { - class SurveyTemplateTextBase { - constructor(); - replaceText(replaceText: string, id: string, questionType?: string): void; - protected getId(id: string, questionType: string): string; - protected text: string; - } -} - -declare module template.ko { - var html: string; -} - -declare module Survey { - class Survey extends SurveyBase { - constructor(jsonObj?: any, renderedElement?: any, css?: any); - protected getTemplate(): string; - protected createCssObject(): any; - } -} - -declare module Survey { - class SurveyWindow extends SurveyWindowBase { - koExpanded: any; - doExpand: any; - constructor(jsonObj: any); - protected createSurvey(jsonObj: any): SurveyModel; - protected getDefaultTemplate(): string; - } -} - -declare module template.window.ko { - var html: string; -} - - -declare module Survey { - class SurveyTemplateText extends SurveyTemplateTextBase { - protected text: string; - } -} diff --git a/types/survey-knockout/survey-knockout-tests.ts b/types/survey-knockout/survey-knockout-tests.ts deleted file mode 100644 index e658b88002..0000000000 --- a/types/survey-knockout/survey-knockout-tests.ts +++ /dev/null @@ -1,22 +0,0 @@ - - -function createFromCodeTests() { - var survey = new Survey.SurveyModel(); - var page = survey.addNewPage("Page 1"); - page.addNewQuestion("text", "question1"); - page.addNewQuestion("comment", "question2"); - page = survey.addNewPage("Page 2"); - page.addNewQuestion("matrix", "question3"); - page.addNewQuestion("matrixdropdown", "question4"); - return survey; -} -function createFromJSONTests() { - var survey = new Survey.SurveyModel({ - pages: [{ - "name": "page1", - "questions": [{ "type": "text", "name": "textQuestion", "isRequired": "true" }, { "type": "checkbox", "name": "checkboxQuestion", "isRequired": "true", "choices": ["red", "white"] }] - }] - }); - survey.setValue("textQuestion", "newValue"); - return survey; -} diff --git a/types/survey-knockout/tsconfig.json b/types/survey-knockout/tsconfig.json deleted file mode 100644 index 362b411778..0000000000 --- a/types/survey-knockout/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "survey-knockout-tests.ts" - ] -} \ No newline at end of file diff --git a/types/survey-knockout/tslint.json b/types/survey-knockout/tslint.json deleted file mode 100644 index ff695c3894..0000000000 --- a/types/survey-knockout/tslint.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-dead-reference": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 0ed1b1d0c525f3ff99cc70dfe735be5285c2c434 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 08:50:59 -0800 Subject: [PATCH 275/890] react-flip-move: Provides its own types (#22346) --- notNeededPackages.json | 6 + types/react-flip-move/index.d.ts | 220 ------------------ .../react-flip-move/react-flip-move-tests.tsx | 70 ------ types/react-flip-move/tsconfig.json | 25 -- types/react-flip-move/tslint.json | 1 - 5 files changed, 6 insertions(+), 316 deletions(-) delete mode 100644 types/react-flip-move/index.d.ts delete mode 100644 types/react-flip-move/react-flip-move-tests.tsx delete mode 100644 types/react-flip-move/tsconfig.json delete mode 100644 types/react-flip-move/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 6786c3d526..f55a79a5a7 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -828,6 +828,12 @@ "sourceRepoURL": "https://github.com/gpbl/react-day-picker", "asOfVersion": "5.3.0" }, + { + "libraryName": "react-flip-move", + "typingsPackageName": "react-flip-move", + "sourceRepoURL": "https://github.com/joshwcomeau/react-flip-move", + "asOfVersion": "2.9.12" + }, { "libraryName": "react-ga", "typingsPackageName": "react-ga", diff --git a/types/react-flip-move/index.d.ts b/types/react-flip-move/index.d.ts deleted file mode 100644 index 8480d50c28..0000000000 --- a/types/react-flip-move/index.d.ts +++ /dev/null @@ -1,220 +0,0 @@ -// Type definitions for react-flip-move 2.9 -// Project: https://github.com/joshwcomeau/react-flip-move -// Definitions by: Joey Hain -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import { Component, ReactElement } from "react"; - -export as namespace FlipMove; -export = FlipMove; - -declare class FlipMove extends Component { } - -declare namespace FlipMove { - type AnimationPreset = "elevator" | "fade" | "accordionVertical" | "accordionHorizontal" | "none"; - - interface Animation { - from: Partial; - to: Partial; - } - - interface FlipMoveProps { - className?: string; - - /** - * Any valid CSS3 timing function (eg. "linear", "ease-in", "cubic-bezier(1, 0, 0, 1)"). - * - * @default "ease-in-out" - */ - easing?: string; - - /** - * The length, in milliseconds, that the transition ought to take. - * - * @default 350 - */ - duration?: number; - - /** - * The length, in milliseconds, to wait before the animation begins. - * - * @default 0 - */ - delay?: number; - - /** - * The length, in milliseconds, to be added to the duration of each subsequent element. - * - * For example, if you are animating 4 elements with a `duration` of 200 and a `staggerDurationBy` of 20: - * - * - The first element will take 200ms to transition. - * - The second element will take 220ms to transition. - * - The third element will take 240ms to transition. - * - The fourth element will take 260ms to transition. - * - * This effect is great for "humanizing" transitions and making them feel less robotic. - */ - staggerDurationBy?: number; - - /** - * The length, in milliseconds, to be added to the delay of each subsequent element. - * - * For example, if you are animating 4 elements with a `delay` of 0 and a `staggerDelayBy` of 20: - * - * - The first element will start transitioning immediately. - * - The second element will start transitioning after 20ms. - * - The third element will start transitioning after 40ms. - * - The fourth element will start transitioning after 60ms. - * - * Similarly to staggerDurationBy, This effect is great for "humanizing" transitions and making them feel less - * robotic. - * - * **Protip**: You can make elements animate one-at-a-time by using an identical duration and staggerDelayBy. - * - * @default 0 - */ - staggerDelayBy?: number; - - /** - * Control the appear animation that runs when the component mounts. Works identically to enterAnimation below, but - * only fires on the initial children. - */ - appearAnimation?: AnimationPreset | Animation | boolean; - - /** - * Control the onEnter animation that runs when new items are added to the DOM. - * - * Accepts several types: - * - * **String:** You can enter one of the following presets to select that as your enter animation: - * - * - `elevator` (default) - * - `fade` - * - `accordionVertical` - * - `accordionHorizontal` - * - `none` - * - * **Boolean:** You can enter `false` to disable the enter animation, or `true` to select the default enter animation (elevator). - * - * **Object:** For fully granular control, you can pass in an object that contains the styles you'd like to animate. - * - * It requires two keys: `from` and `to`. Each key holds an object of CSS properties. You can supply any valid - * camelCase CSS properties, and flip-move will transition between the two, over the course of the specified - * `duration`. - * - * Example: - * - * const customEnterAnimation = { - * from: { transform: 'scale(0.5, 1)' }, - * to: { transform: 'scale(1, 1)' } - * }; - * - * - * {renderChildren()} - * - * - * @default "elevator" - */ - enterAnimation?: AnimationPreset | Animation | boolean; - - /** - * Control the onLeave animation that runs when new items are removed from the DOM. - * - * This property functions identically to `enterAnimation`. - * - * @default "elevator" - */ - leaveAnimation?: AnimationPreset | Animation | boolean; - - /** - * Do not collapse container height until after leaving animations complete. - * - * When false, children are immediately removed from the DOM flow as they animate away. Setting this value to true - * will maintain the height of the container until after their leaving animation completes. - * - * @default false - */ - maintainContainerHeight?: boolean; - - /** - * A callback to be invoked **once per child element** at the start of the animation. - * - * In general, it is advisable to ignore the domNode argument and work with the childElement. The domNode is just - * an escape hatch for doing complex things not otherwise possible. - * - * @param childElement A reference to the React Element being animated. - * @param domNode A reference to the unadulterated DOM node being animated. - */ - onStart?(childElement: ReactElement, domNode: HTMLElement): void; - - /** - * A callback to be invoked **once per child element** at the end of the animation. - * - * In general, it is advisable to ignore the `domNode` argument and work with the `childElement`. The `domNode` is - * just an escape hatch for doing complex things not otherwise possible. - * - * @param childElement A reference to the React Element being animated. - * @param domNode A reference to the unadulterated DOM node being animated. - */ - onFinish?(childElement: ReactElement, domNode: HTMLElement): void; - - /** - * A callback to be invoked **once per group** at the start of the animation. - * - * The callback arguments are similar to the ones provided for onStart, except we provide an array of the elements - * and nodes. The order of both arguments is guaranteed; this means you can use a zipping function like lodash's - * .zip to get pairs of element/node, if needed. - * - * In general, it is advisable to ignore the `domNodes` argument and work with the `childElements` The `domNodes` - * - * are just an escape hatch for doing complex things not otherwise possible. - * - * @param childElements An array of the references to the React Element(s) being animated. - * @param domNodes An array of the references to the unadulterated DOM node(s) being animated. - */ - onStartAll?(childElements: Array>, domNodes: HTMLElement[]): void; - - /** - * A callback to be invoked **once per group** at the end of the animation. - * - * The callback arguments are similar to the ones provided for onFinish, except we provide an array of the elements - * and nodes. The order of both arguments is guaranteed; this means you can use a zipping function like lodash's - * .zip to get pairs of element/node, if needed. - * - * In general, it is advisable to ignore the `domNodes` argument and work with the `childElements` The `domNodes` - * are just an escape hatch for doing complex things not otherwise possible. - * - * @param childElements An array of the references to the React Element(s) being animated. - * @param domNodes An array of the references to the unadulterated DOM node(s) being animated. - */ - onFinishAll?(childElements: Array>, domNodes: HTMLElement[]): void; - - /** - * Flip Move wraps your children in a container element. By default, this element is a div, but you may wish to - * provide a custom HTML element (for example, if your children are list items, you may wish to set this to ul). - * - * Any valid HTML element type is accepted, but peculiar things may happen if you use an unconventional element. - * - * @default "div" - */ - typeName?: string; - - /** - * Sometimes, you may wish to temporarily disable the animations and have the normal behaviour resumed. Setting this - * flag to true skips all animations. - * - * @default false - */ - disableAllAnimations?: boolean; - - /** - * This function is called with a DOM node as the only argument. It should return an object as specified by the - * getBoundingClientRect() spec. - * - * For normal usage of FlipMove you won't need this. An example of usage is when FlipMove is used in a container - * that is scaled using CSS. You can correct the values from getBoundingClientRect by using this prop. - */ - getPosition?(node: HTMLElement): ClientRect; - } -} diff --git a/types/react-flip-move/react-flip-move-tests.tsx b/types/react-flip-move/react-flip-move-tests.tsx deleted file mode 100644 index 19dac88a65..0000000000 --- a/types/react-flip-move/react-flip-move-tests.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import * as React from "react"; -import * as FlipMove from "react-flip-move"; - -class DefaultTest extends React.Component { - render() { - return ; - } -} - -class PresetTest extends React.Component { - render() { - return ( - - ); - } -} - -class CustomAnimationTest extends React.Component { - render() { - const enterAnimation: FlipMove.Animation = { - from: { opacity: "0" }, - to: { opacity: "1" } - }; - - const leaveAnimation: FlipMove.Animation = { - from: { opacity: "1" }, - to: { opacity: "0" } - }; - - return ( - - ); - } -} - -class FlipMoveTest extends React.Component { - onStart = (childElement: React.ReactElement, domNode: HTMLElement) => {}; - - onFinish = (childElement: React.ReactElement, domNode: HTMLElement) => {}; - - onStartAll = (childElements: Array>, domNodes: HTMLElement[]) => {}; - - onFinishAll = (childElements: Array>, domNodes: HTMLElement[]) => {}; - - render() { - return ( - - ); - } -} diff --git a/types/react-flip-move/tsconfig.json b/types/react-flip-move/tsconfig.json deleted file mode 100644 index 9472de4695..0000000000 --- a/types/react-flip-move/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "jsx": "react" - }, - "files": [ - "index.d.ts", - "react-flip-move-tests.tsx" - ] -} \ No newline at end of file diff --git a/types/react-flip-move/tslint.json b/types/react-flip-move/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/react-flip-move/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 5808430bfa0cd6802e203f1467931dd724c71f6d Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 08:52:34 -0800 Subject: [PATCH 276/890] microgears: Provides its own types (#22356) --- notNeededPackages.json | 6 +++ types/microgears/index.d.ts | 31 ----------- types/microgears/microgears-tests.ts | 58 -------------------- types/microgears/tsconfig.json | 24 --------- types/microgears/tslint.json | 79 ---------------------------- 5 files changed, 6 insertions(+), 192 deletions(-) delete mode 100644 types/microgears/index.d.ts delete mode 100644 types/microgears/microgears-tests.ts delete mode 100644 types/microgears/tsconfig.json delete mode 100644 types/microgears/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index f55a79a5a7..8fa7f1aa44 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -642,6 +642,12 @@ "sourceRepoURL": "https://github.com/onokumus/metisMenu", "asOfVersion": "2.7.1" }, + { + "libraryName": "microgears", + "typingsPackageName": "microgears", + "sourceRepoURL": "https://github.com/marcusdb/microgears", + "asOfVersion": "4.0.5" + }, { "libraryName": "mobservable", "typingsPackageName": "mobservable", diff --git a/types/microgears/index.d.ts b/types/microgears/index.d.ts deleted file mode 100644 index 8611096d59..0000000000 --- a/types/microgears/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Type definitions for microgears v4.0.0 -// Project: https://github.com/marcusdb/microgears -// Definitions by: Marcus David Bronstein -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace microgears { - export interface Service { - name: string; - async?: boolean; - pathname?: string; - namespace: string; - } - - interface MetaInformation { - serviceName: string; - methodName: string; - serviceNameSpace: string; - extra: any; - } - - interface Plugin { - name: string; - beforeChain(args: Array, metaInfo: MetaInformation): Array; - afterChain(result: T, metaInfo: MetaInformation): T; - } - - function addService(service: Service): Service; - function addPlugin(plugin: Plugin): void; -} - -export = microgears; \ No newline at end of file diff --git a/types/microgears/microgears-tests.ts b/types/microgears/microgears-tests.ts deleted file mode 100644 index 376d0b8172..0000000000 --- a/types/microgears/microgears-tests.ts +++ /dev/null @@ -1,58 +0,0 @@ -import microgears = require("microgears"); - - -function verify_module_file() { - var tracePlugin = new TracePlugin(); - microgears.addPlugin(tracePlugin); - var service = new UserService(); - var userService = microgears.addService(service); - - -} - -class TracePlugin implements microgears.Plugin { - name: 'TracePlugin'; - public beforeChain(args:Array, _meta: microgears.MetaInformation) { - var serviceName = _meta.serviceName, - method = _meta.methodName; - console.log('before call-> ' + serviceName + '.' + method); - - _meta.extra = { - count: 1 - }; - - return args - } - public afterChain(result:any, _meta: microgears.MetaInformation) { - var serviceName = _meta.serviceName, - method = _meta.methodName; - - console.log('after of-> ' + serviceName + '.' + method); - if (_meta.extra.count) { - console.log('this number comes to the beforeChain: ' + _meta.extra.count); - } - - return result; - } -} - -class User { - name: string; - email: string; - - constructor(name: string, email: string) { - this.email = email; - this.name = name; - } -} - -class UserService implements microgears.Service { - name: string = "userService"; - namespace: string = "services.user"; - - public findUserById(id: number) { - return new User('test', 'test@example.com'); - } - -} - diff --git a/types/microgears/tsconfig.json b/types/microgears/tsconfig.json deleted file mode 100644 index 7c4170d1af..0000000000 --- a/types/microgears/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "microgears-tests.ts" - ] -} \ No newline at end of file diff --git a/types/microgears/tslint.json b/types/microgears/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/microgears/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 1278e50708d44a3985b2d7c66619adc689dbd602 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 08:59:35 -0800 Subject: [PATCH 277/890] griddle-react: Provides its own types (#22383) --- notNeededPackages.json | 6 + types/griddle-react/index.d.ts | 168 ------------------ .../test/CustomColumnComponent.tsx | 70 -------- .../test/CustomFilterComponent.tsx | 89 ---------- .../test/CustomHeaderComponent.tsx | 94 ---------- types/griddle-react/test/index.tsx | 78 -------- types/griddle-react/tsconfig.json | 28 --- types/griddle-react/tslint.json | 3 - 8 files changed, 6 insertions(+), 530 deletions(-) delete mode 100644 types/griddle-react/index.d.ts delete mode 100644 types/griddle-react/test/CustomColumnComponent.tsx delete mode 100644 types/griddle-react/test/CustomFilterComponent.tsx delete mode 100644 types/griddle-react/test/CustomHeaderComponent.tsx delete mode 100644 types/griddle-react/test/index.tsx delete mode 100644 types/griddle-react/tsconfig.json delete mode 100644 types/griddle-react/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 8fa7f1aa44..a8a262b5f4 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -402,6 +402,12 @@ "sourceRepoURL": "https://github.com/PeculiarVentures/graphene", "asOfVersion": "2.0.31" }, + { + "libraryName": "griddle-react", + "typingsPackageName": "griddle-react", + "sourceRepoURL": "https://github.com/griddlegriddle/griddle", + "asOfVersion": "1.3.0" + }, { "libraryName": "gulp-typescript", "typingsPackageName": "gulp-typescript", diff --git a/types/griddle-react/index.d.ts b/types/griddle-react/index.d.ts deleted file mode 100644 index ea40fb2130..0000000000 --- a/types/griddle-react/index.d.ts +++ /dev/null @@ -1,168 +0,0 @@ -// Type definitions for griddle-react 0.7 -// Project: https://github.com/griddlegriddle/griddle -// Definitions by: David Hara -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/* -The MIT License (MIT) - -Copyright (c) 2016 David Hara - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -import * as React from 'react'; - -type ReactClass = React.ComponentClass | React.StatelessComponent; - -export interface CustomColumnComponentProps { - data: any; - rowData: T; - metaData: ColumnMetaData; -} - -export interface CustomRowComponentProps { - data: T; -} - -export interface CustomGridComponentProps { - data: T[]; -} - -export interface CustomPagerComponentProps { - currentPage: number; - maxPage: number; - nextText: string; - previousText: string; - next(): void; - previous(): void; - setPage(number: number): void; -} - -export interface CustomHeaderComponentProps { - filterByColumn?(filter: string, columnName: string): void; - columnName: string; - displayName: string; -} - -export interface CustomFilterComponentProps { - placeholderText?: string; - changeFilter(val: any): void; -} - -export interface ColumnMetaData { - columnName: string; - cssClassName?: string; - customComponent?: ReactClass>; - customHeaderComponent?: ReactClass; - customHeaderComponentProps?: {}; - displayName?: string; - locked?: boolean; - order?: number; - sortable?: boolean; - visible?: boolean; -} - -export type BodyCssClassNameFunction = (rowData: T) => string; - -export interface RowMetaData { - bodyCssClassName?: BodyCssClassNameFunction | string; -} - -export interface GriddleProps { - columns?: string[]; - columnMetadata?: Array>; - rowMetadata?: RowMetaData; - results?: T[]; - resultsPerPage?: number; - initialSort?: string; - initialSortAscending?: boolean; - gridClassName?: string; - tableClassName?: string; - customFormatClassName?: string; - settingsText?: string; - filterPlaceholderText?: string; - nextText?: string; - previousText?: string; - maxRowsText?: string; - enableCustomFormatText?: string; - childrenColumnName?: string; - metadataColumns?: string[]; - showFilter?: boolean; - showSettings?: boolean; - useCustomRowComponent?: boolean; - useCustomGridComponent?: boolean; - useCustomPagerComponent?: boolean; - useCustomFilterer?: boolean; - useCustomFilterComponent?: boolean; - useGriddleStyles?: boolean; - customRowComponent?: ReactClass>; - customGridComponent?: ReactClass>; - customPagerComponent?: ReactClass; - customFilterComponent?: ReactClass; - customFilterer?(items: T[], query: any): T[]; - enableToggleCustom?: boolean; - noDataMessage?: string; - noDataClassName?: string; - customNoDataComponent?: ReactClass; - showTableHeading?: boolean; - showPager?: boolean; - useFixedHeader?: boolean; - useExternal?: boolean; - externalSetPage?(index: number): void; - externalChangeSort?(sort: string, sortAscending: boolean): void; - externalSetFilter?(filter: string): void; - externalSetPageSize?(size: number): void; - externalMaxPage?: number; - externalCurrentPage?: number; - externalSortColumn?: string; - externalSortAscending?: boolean; - externalLoadingComponent?: ReactClass; - externalIsLoading?: boolean; - enableInfiniteScroll?: boolean; - bodyHeight?: number; - paddingHeight?: number; - rowHeight?: number; - infiniteScrollLoadTreshold?: number; - useFixedLayout?: boolean; - isSubGriddle?: boolean; - enableSort?: boolean; - sortAscendingClassName?: string; - sortDescendingClassName?: string; - parentRowCollapsedClassName?: string; - parentRowExpandedClassName?: string; - settingsToggleClassName?: string; - nextClassName?: string; - previousClassName?: string; - sortAscendingComponent?: string | React.ReactElement; - sortDescendingComponent?: string | React.ReactElement; - sortDefaultComponent?: string | React.ReactElement; - parentRowCollapsedComponent?: string | React.ReactElement; - parentRowExpandedComponent?: string | React.ReactElement; - settingsIconComponent?: string | React.ReactElement; - nextIconComponent?: string | React.ReactElement; - previousIconComponent?: string | React.ReactElement; - onRowClick?(): void; -} - -declare class Griddle extends React.Component> { -} - -export default Griddle; diff --git a/types/griddle-react/test/CustomColumnComponent.tsx b/types/griddle-react/test/CustomColumnComponent.tsx deleted file mode 100644 index f344796538..0000000000 --- a/types/griddle-react/test/CustomColumnComponent.tsx +++ /dev/null @@ -1,70 +0,0 @@ -/* -Licensed under the MIT License (MIT) - -Copyright (c) 2016 David Hara -*/ - -import * as React from 'react'; -import Griddle, { CustomColumnComponentProps } from 'griddle-react'; - -interface MyCustomResult { - name: string; - test: string; -} - -class LinkComponent extends React.Component> { - render() { - const url = `speakers/${this.props.rowData.test}/${this.props.data}`; - return
    {this.props.data}; - } -} - -const StatelessFunctionComponent = (props: CustomColumnComponentProps) => { - const url = `speakers/${props.rowData.test}/${props.data}`; - return {props.data}; -}; - -const columnMeta = [ - { - columnName: "name", - order: 1, - locked: false, - visible: true, - customComponent: StatelessFunctionComponent - }]; - -const results: MyCustomResult[] = [ - { - name: 'David Hara', - test: 'blah' - }, - { - name: 'Hara, David', - test: 'blah2' - } -]; - -const rowMetaData = { - bodyCssClassName: (rowData: MyCustomResult) => { - return rowData.test; - } -}; - -class CustomColumnComponentGrid extends React.Component { - render() { - type TypedGriddle = new () => Griddle; - const TypedGriddle = Griddle as TypedGriddle; - - return ( - } - sortDescendingComponent={} - customRowComponent={LinkComponent} /> - ); - } -} - -export default CustomColumnComponentGrid; diff --git a/types/griddle-react/test/CustomFilterComponent.tsx b/types/griddle-react/test/CustomFilterComponent.tsx deleted file mode 100644 index 5c8b8d629c..0000000000 --- a/types/griddle-react/test/CustomFilterComponent.tsx +++ /dev/null @@ -1,89 +0,0 @@ -/* -Licensed under the MIT License (MIT) - -Copyright (c) 2016 David Hara -*/ - -import * as _ from 'lodash'; -import * as React from 'react'; -import Griddle, { CustomFilterComponentProps } from 'griddle-react'; - -const CustomFilterFunction = (items: ResultType[], query: string): ResultType[] => { - return _.filter(items, (item) => { - let match = false; - _.forIn(item, (value, key) => { - if (String(value).toLowerCase().indexOf(query.toLowerCase()) >= 0) { - match = true; - return; - } - }); - - return match; - }); -}; - -class CustomFilterComponent extends React.Component { - query = ''; - - searchChange(event: React.FormEvent) { - this.query = event.currentTarget.value; - this.props.changeFilter(this.query); - } - - render() { - return ( -
    - -
    - ); - } -} - -interface ResultType { - id: number; - name: string; - city: string; - state: string; - country: string; - company: string; - favoriteNumber: number; -} - -const someData: ResultType[] = [ - { - id: 0, - name: "Mayer Leonard", - city: "Kapowsin", - state: "Hawaii", - country: "United Kingdom", - company: "Ovolo", - favoriteNumber: 7 - }, - { - id: 1, - name: "Koch Becker", - city: "Johnsonburg", - state: "New Jersey", - country: "Madagascar", - company: "Eventage", - favoriteNumber: 2 - } -]; - -class CustomFilterComponentGrid extends React.Component { - render() { - type TypedGriddle = new () => Griddle; - const TypedGriddle = Griddle as TypedGriddle; - - return ( - - ); - } -} - -export default CustomFilterComponentGrid; diff --git a/types/griddle-react/test/CustomHeaderComponent.tsx b/types/griddle-react/test/CustomHeaderComponent.tsx deleted file mode 100644 index c5256956fc..0000000000 --- a/types/griddle-react/test/CustomHeaderComponent.tsx +++ /dev/null @@ -1,94 +0,0 @@ -/* -Licensed under the MIT License (MIT) - -Copyright (c) 2016 David Hara -*/ - -import * as React from 'react'; -import Griddle, { ColumnMetaData, CustomHeaderComponentProps } from 'griddle-react'; - -interface MoreCustomHeaderComponentProps extends CustomHeaderComponentProps { - color: string; -} - -class HeaderComponent extends React.Component { - textOnClick(e: React.FormEvent) { - e.stopPropagation(); - } - - filterText(e: React.FormEvent) { - this.props.filterByColumn(e.currentTarget.value, this.props.columnName); - } - - render() { - return ( - -
    {this.props.displayName}
    - -
    - ); - } -} - -interface ResultType { - id: number; - name: string; - city: string; - state: string; - country: string; - company: string; - favoriteNumber: number; -} - -const someData: ResultType[] = [ - { - id: 0, - name: "Mayer Leonard", - city: "Kapowsin", - state: "Hawaii", - country: "United Kingdom", - company: "Ovolo", - favoriteNumber: 7 - }, - { - id: 1, - name: "Koch Becker", - city: "Johnsonburg", - state: "New Jersey", - country: "Madagascar", - company: "Eventage", - favoriteNumber: 2 - } -]; - -const columnMeta: Array> = [ - { - columnName: 'name', - order: 1, - sortable: false, - visible: true, - }, - { - columnName: 'city', - customHeaderComponent: HeaderComponent, - customHeaderComponentProps: {color: 'red'} - }, - { - columnName: 'state', - customHeaderComponent: HeaderComponent, - customHeaderComponentProps: {color: 'blue'} - } -]; - -class CustomHeaderComponentGrid extends React.Component { - render() { - type TypedGriddle = new () => Griddle; - const TypedGriddle = Griddle as TypedGriddle; - - return ( - - ); - } -} - -export default CustomHeaderComponentGrid; diff --git a/types/griddle-react/test/index.tsx b/types/griddle-react/test/index.tsx deleted file mode 100644 index b42513a34d..0000000000 --- a/types/griddle-react/test/index.tsx +++ /dev/null @@ -1,78 +0,0 @@ -/* -Licensed under the MIT License (MIT) - -Copyright (c) 2016 David Hara -*/ - -import * as React from 'react'; -import { render } from 'react-dom'; -import Griddle, { CustomColumnComponentProps } from 'griddle-react'; -import CustomColumnComponentGrid from './CustomColumnComponent'; -import CustomHeaderComponentGrid from './CustomHeaderComponent'; -import CustomFilterComponentGrid from './CustomFilterComponent'; - -interface MyCustomResult { - name: string; - test: string; -} - -class LinkComponent extends React.Component> { - render() { - const url = `speakers/${this.props.rowData.test}/${this.props.data}`; - return {this.props.data}; - } -} - -const StatelessFunctionComponent = (props: CustomColumnComponentProps) => { - const url = `speakers/${props.rowData.test}/${props.data}`; - return {props.data}; -}; - -const columnMeta = [ - { - columnName: "name", - order: 1, - locked: false, - visible: true, - customComponent: StatelessFunctionComponent - }]; - -const results: MyCustomResult[] = [ - { - name: 'David Hara', - test: 'blah' - }, - { - name: 'Hara, David', - test: 'blah2' - } -]; - -const rowMetaData = { - bodyCssClassName: (rowData: MyCustomResult) => { - return rowData.test; - } -}; - -type TypedGriddle = new () => Griddle; -const TypedGriddle = Griddle as TypedGriddle; - -render( -
    -

    Custom Column Component Grid

    - -

    Custom Header Component Grid

    - -

    Custom Filter Component Grid

    - - } - sortDescendingComponent={} - customRowComponent={LinkComponent} - /> -
    , - document.getElementById('root') -); diff --git a/types/griddle-react/tsconfig.json b/types/griddle-react/tsconfig.json deleted file mode 100644 index 8f233e8e23..0000000000 --- a/types/griddle-react/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "jsx": "preserve", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "test/index.tsx", - "test/CustomColumnComponent.tsx", - "test/CustomFilterComponent.tsx", - "test/CustomHeaderComponent.tsx" - ] -} \ No newline at end of file diff --git a/types/griddle-react/tslint.json b/types/griddle-react/tslint.json deleted file mode 100644 index f93cf8562a..0000000000 --- a/types/griddle-react/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} From 87ffe549539800b6180f856f9445c646d8580775 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:01:50 -0800 Subject: [PATCH 278/890] email-addresses: Provides its own types (#22391) --- notNeededPackages.json | 6 ++ .../email-addresses/email-addresses-tests.ts | 6 -- types/email-addresses/index.d.ts | 7 -- types/email-addresses/tsconfig.json | 23 ------ types/email-addresses/tslint.json | 79 ------------------- 5 files changed, 6 insertions(+), 115 deletions(-) delete mode 100644 types/email-addresses/email-addresses-tests.ts delete mode 100644 types/email-addresses/index.d.ts delete mode 100644 types/email-addresses/tsconfig.json delete mode 100644 types/email-addresses/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index a8a262b5f4..c19a53659b 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -294,6 +294,12 @@ "sourceRepoURL": "https://github.com/loopline-systems/electron-builder", "asOfVersion": "2.8.0" }, + { + "libraryName": "email-addresses", + "typingsPackageName": "email-addresses", + "sourceRepoURL": "https://github.com/jackbowman/email-addresses", + "asOfVersion": "3.0.0" + }, { "libraryName": "email-validator", "typingsPackageName": "email-validator", diff --git a/types/email-addresses/email-addresses-tests.ts b/types/email-addresses/email-addresses-tests.ts deleted file mode 100644 index 7bf713e2c5..0000000000 --- a/types/email-addresses/email-addresses-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ -import addrs = require('email-addresses'); - -var result: Object; - -result = addrs.parseOneAddress('Jack Bowman '); -result = addrs.parseAddressList(['foo@bar.com', 'Foo Bar ']); diff --git a/types/email-addresses/index.d.ts b/types/email-addresses/index.d.ts deleted file mode 100644 index 85161906ea..0000000000 --- a/types/email-addresses/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Type definitions for email-addresses 2.0.1 -// Project: https://github.com/jackbowman/email-addresses -// Definitions by: John Grimsey -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export function parseOneAddress(opts: any): any; -export function parseAddressList(opts: any): any; diff --git a/types/email-addresses/tsconfig.json b/types/email-addresses/tsconfig.json deleted file mode 100644 index 2cda1ddc36..0000000000 --- a/types/email-addresses/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "email-addresses-tests.ts" - ] -} \ No newline at end of file diff --git a/types/email-addresses/tslint.json b/types/email-addresses/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/email-addresses/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 212d4b8399d6e83cd056220e83823d5b6ec34f92 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:02:03 -0800 Subject: [PATCH 279/890] webgme: Provides its own types (#22394) --- notNeededPackages.json | 6 + types/webgme/index.d.ts | 960 ----------------------------------- types/webgme/tsconfig.json | 25 - types/webgme/tslint.json | 80 --- types/webgme/webgme-tests.ts | 590 --------------------- 5 files changed, 6 insertions(+), 1655 deletions(-) delete mode 100644 types/webgme/index.d.ts delete mode 100644 types/webgme/tsconfig.json delete mode 100644 types/webgme/tslint.json delete mode 100644 types/webgme/webgme-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index c19a53659b..f6dc3f972d 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1218,6 +1218,12 @@ "sourceRepoURL": "https://github.com/tgdwyer/WebCola", "asOfVersion": "3.2.0" }, + { + "libraryName": "webgme", + "typingsPackageName": "webgme", + "sourceRepoURL": "https://webgme.org", + "asOfVersion": "2.11.0" + }, { "libraryName": "wonder-commonlib", "typingsPackageName": "wonder-commonlib", diff --git a/types/webgme/index.d.ts b/types/webgme/index.d.ts deleted file mode 100644 index 01a70c73f2..0000000000 --- a/types/webgme/index.d.ts +++ /dev/null @@ -1,960 +0,0 @@ -// Type definitions for webgme -// Project: https://webgme.org -// Definitions by: Fred Eisele -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -// Based on examination of -// Example: https://github.com/typed-typings/env-node/blob/master/0.12/node.d.ts -// Source: https://raw.githubusercontent.com/phreed/typed-npm-webgme/master/webgme.d.ts -// Documentation: https://editor.webgme.org/docs/source/index.html - -declare module "blob/BlobMetadata" { - export default class BlobMetadata implements Blobs.BlobMetadata { - constructor(); - name: string; - size: number; - mime: string; - context: Common.DataObject; - contentType: string; - } -} - -declare module "plugin/PluginBase" { - export = Core.PluginBase; -} - -declare module "plugin/PluginConfig" { - export = Config.PluginConfig; -} - -declare module "webgme/config/config.default" { - export = Config.config; -} - -declare module "webgme/common" { - export = Common; -} - -declare module "common/util/canon" { - export = Util.CANON; -} - -declare module "common/util/assert" { - export = Util.ASSERT; -} - - -declare namespace Common { - - export type ISO8601 = string; - export type ErrorStr = string; - export type MetadataHash = string; - export type MetadataHashArray = string[]; - export type ArtifactHash = string; - export type Name = string; - - export type Metadata = {} - export class Node { - constructor(); - } - - export type DataObject = {} - export type Buffer = GLbyte[]; - export type Payload = string | Buffer | Buffer[]; - export type Content = DataObject | Buffer | Buffer[]; - export type ContentString = string; - export type Primitive = string | number; - export type OutAttr = DataObject | Primitive | undefined | null; - export type InAttr = DataObject | Primitive | null; - export type OutPath = string | undefined | null; - - export type VoidFn = () => void; - - export type MetadataHashCallback = (err: Error, result: MetadataHash) => void; - export type MetadataHashArrayCallback = (err: Error, result: MetadataHashArray) => void; - export type MetadataCallback = (err: Error, result: Metadata) => void; - export type ObjectCallback = (err: Error, result: DataObject) => void; - export type ObjectArrayCallback = (err: Error, result: DataObject[]) => void; - export type JSONCallback = (err: Error, result: JSON) => void; -} - -declare namespace Util { - - class Canon { - stringify(thing: any): string; - parse(thing: any): string; - } - - export let CANON: Canon; - - export function ASSERT(condition: boolean): never; -} - -declare namespace Blobs { - - export type ObjectBlob = string; - - export interface BlobMetadata { - name: string; - size: number; - mime: string; - context: Common.DataObject; - contentType: string; - } - - export type BlobMetadataDescriptor = {} - - export class BlobClient { - constructor(); - - createArtifact(name: Common.Name): Core.Artifact; - getArtifact: { - (metadataHash: Common.MetadataHash, callback: Core.ArtifactCallback): void; - (metadataHash: Common.MetadataHash): Promise; - } - getMetadataURL(metadataHash: Common.MetadataHash): string; - getRelativeMetadataURL(metadataHash: Common.MetadataHash): string; - getViewURL(metadataHash: Common.MetadataHash, subpath: string): string; - getDownloadURL(metadataHash: Common.MetadataHash, subpath: string): string; - getRelativeDownloadURL(metadataHash: Common.MetadataHash, subpath: string): string; - getCreateURL(filename: Common.Name, isMetadata: boolean): string; - getRelativeCreateURL(filename: Common.Name, isMetadata: boolean): string; - getSubObject: { - (metadataHash: Common.MetadataHash, subpath: string, callback: Common.ObjectCallback): void; - (metadataHash: Common.MetadataHash, subpath: string): Promise; - } - getObject: { - (metadataHash: Common.MetadataHash, callback: Common.ObjectCallback, subpath: string): Common.Content; - (metadataHash: Common.MetadataHash, subpath: string): Promise; - } - getObjectAsString: { - (metadataHash: Common.MetadataHash, callback: Common.MetadataHashCallback): Common.ContentString; - (metadataHash: Common.MetadataHash): Promise; - } - getObjectAsJSON: { - (metadataHash: Common.MetadataHash, callback: Common.JSONCallback): void; - (metadataHash: Common.MetadataHash): Promise; - } - getMetadata: { - (metadataHash: Common.MetadataHash, callback: Common.MetadataCallback): Common.Metadata; - (metadataHash: Common.MetadataHash): Promise; - } - getHumanSize(bytes: number, si: boolean): string; - putFile: { - (name: Common.Name, data: Common.Payload, callback: Common.MetadataHashCallback): void; - (name: Common.Name, data: Common.Payload): Promise; - } - putMetadata: { - (metadataDescriptor: BlobMetadataDescriptor, callback: Common.MetadataHashCallback): void; - (metadataDescriptor: BlobMetadataDescriptor): Promise; - } - putFiles: { - (o: { [name: string]: Common.Payload }, callback: Common.MetadataHashArrayCallback): void; - (o: { [name: string]: Common.Payload }): Promise; - } - saveAllArtifacts: { - (callback: Common.MetadataHashArrayCallback): void; - (): Promise; - } - } - -} - - -/** -Describe plugins -*/ -declare namespace Core { - - export interface ResultCallback { - (err: Error | null, result: Result): void; - } - - export interface Message { - msg: string; - } - - export type ArtifactCallback = (err: Error, result: Artifact) => void; - - export interface Artifact { - name: Common.Name; - blobClient: Blobs.BlobClient; - descriptor: Blobs.BlobMetadata; - - constructor(name: Common.Name, blobClient: Blobs.BlobClient, descriptor: Blobs.BlobMetadata): void; - - /** Adds content to the artifact as a file. */ - addFile: { - (name: Common.Name, content: Blobs.ObjectBlob, callback: Common.MetadataHashCallback): void; - (name: Common.Name, content: Blobs.ObjectBlob): Promise; - } - /** Adds files as soft-link. */ - addFileAsSoftLink: { - (name: Common.Name, content: Blobs.ObjectBlob, callback: Common.MetadataHashCallback): void; - (name: Common.Name, content: Blobs.ObjectBlob): Promise; - } - /** Adds multiple files. */ - addFiles: { - (files: { [name: string]: Blobs.ObjectBlob }, callback: Common.MetadataHashArrayCallback): void; - (files: { [name: string]: Blobs.ObjectBlob }): Promise | Promise; - } - /** Adds multiple files as soft-links. */ - addFilesAsSoftLinks: { - (files: { [name: string]: Blobs.ObjectBlob }, callback: Common.MetadataHashArrayCallback): void; - (files: { [name: string]: Blobs.ObjectBlob }): Promise; - } - /** Adds a metadataHash to the artifact using the given file path. */ - addMetadataHash: { - (name: Common.Name, metadataHash: Common.MetadataHash, size: number, callback: Common.MetadataHashCallback): void; - (name: Common.Name, metadataHash: Common.MetadataHash, size?: number): Promise; - - (objectHashes: { [name: string]: string }, callback: Common.MetadataHashCallback): void; - (objectHashes: { [name: string]: string }): Promise; - } - /** Adds metadataHashes to the artifact using the given file paths. */ - addMetadataHashes: { - (name: Common.Name, metadataHash: Common.MetadataHash, size: number, callback: Common.MetadataHashArrayCallback): void; - (name: Common.Name, metadataHash: Common.MetadataHash, size?: number): Promise; - - (objectHashes: { [name: string]: string }, callback: Common.MetadataHashArrayCallback): void; - (objectHashes: { [name: string]: string }): Promise; - } - /** Adds a metadataHash to the artifact using the given file path. */ - addObjectHash: { - (name: Common.Name, metadataHash: Common.MetadataHash, callback: Common.MetadataHashCallback): void; - (name: Common.Name, metadataHash: Common.MetadataHash): Promise; - } - /** Adds metadataHashes to the artifact using the given file paths. */ - addObjectHashes: { - (objectHashes: { [name: string]: string }, callback: Common.MetadataHashArrayCallback): void; - (objectHashes: { [name: string]: string }): Promise; - } - /** Saves this artifact and uploads the metadata to the server's storage. */ - save: { - (callback: Common.MetadataHashCallback): void; - (message?: string): Promise; - } - } - /** - commitHash - metadataHash of the commit. - status - storage.constants./SYNCED/FORKED/MERGED - */ - export interface Commit { - commitHash: Common.MetadataHash; - status: string; - branchName: string; - } - - export interface Result { - success: boolean; - messages: string[]; // array of PluginMessages - artifacts: Common.ArtifactHash[]; // array of hashes - pluginName: string; - startTime: Date; - finishTime: Date; - error: Error; - projectId: any; - commits: any[]; - - /** - * Gets the success flag of this result object - */ - getSuccess(): boolean; - /** - * Sets the success flag of this result. - */ - setSuccess(value: boolean): void; - /** - * Returns with the plugin messages. - */ - getMessages(): Message[]; - /** - * Adds a new plugin message to the messages list. - */ - addMessage(pluginMessage: Message): void; - /** - * Returns the plugin artifacts. - */ - getArtifacts(): Artifact[]; - /** - * Adds a saved artifact to the result - linked via its metadataHash. - * Takes the metadataHash of saved artifact. - */ - addArtifact(metadataHash: Common.MetadataHash): void; - /** - * Adds a commit to the commit container. - */ - addCommit(commitData: Commit): void; - /** - * Gets the name of the plugin to which the result object belongs. - */ - getPluginName(): string; - //------------------------------------------ - // Methods used by the plugin manager - //----------------------------------------- - /** - * Sets the name of the plugin to which the result object belongs to. - */ - setPluginName(pluginName: string): string; - /** - * Sets the name of the projectId the result was generated from. - */ - setProjectId(projectId: string): void; - /** - * Gets the ISO 8601 representation of the time when the plugin started its execution. - */ - getStartTime(): Common.ISO8601; - /** - * Sets the ISO 8601 representation of the time when the plugin started its execution. - */ - setStartTime(time: Common.ISO8601): void; - /** - * Gets the ISO 8601 representation of the time when the plugin finished its execution. - */ - getFinishTime(): Common.ISO8601; - /** - * Sets the ISO 8601 representation of the time when the plugin finished its execution. - */ - setFinishTime(time: Common.ISO8601): void; - /** - * Gets error if any error occured during execution. - * FIXME: should this return an Error object? - */ - getError(): Common.ErrorStr; - /** - * Sets the error string if any error occured during execution. - */ - setError(error: Common.ErrorStr | Error): void; - /** - * Serializes this object to a JSON representation. - */ - serialize(): { success: boolean, messages: Message[], pluginName: string, finishTime: string }; - } - - - export interface RelationRule { - /** The minimum amount of target necessary for the relationship (if not present or '-1' then there is no minimum rule that applies) */ - min?: number; - /** The maximum amount of target necessary for the relationship (if not present or '-1' then there is no maximum rule that applies) */ - max?: number; - absolutePathOfTarget?: { - min?: number; - max?: number; - } - } - - export interface Constraint { - script: string; - info: string; - priority: string; - } - - export interface MixinViolation { - severity?: string; - type?: string; - ruleName?: string | undefined; - targetInfo?: string | undefined; - targetNode?: Common.Node | undefined; - collisionPaths?: string[]; - collisionNodes?: Common.Node[]; - message?: string; - hint?: string; - } - export interface GmePersisted { rootHash: Common.MetadataHash } - export enum TraversalOrder { 'BFS', 'DFS' } - export type GUID = string; - - export interface NodeParameters { - parent: Common.Node | null; - base: Common.Node | null; - relid?: string; - guid?: GUID; - } - export interface LibraryInfo { - projectId: string; - branchName: string; - commitHash: string; - } - export interface MetaNodeParameters { - object: { node: Common.Node, children: Common.Node[] }; - sensitive: boolean; - multiplicity: boolean; - aspect: string; - } - export interface MetaRule { - type: string | number | boolean; - enum: string[]; - } - - export interface TraversalOptions { - excludeRoot?: boolean; - order?: TraversalOrder; - maxParallelLoad?: number; - stopOnError?: boolean; - } - - export interface Core { - - addLibrary: { - (node: Common.Node, name: Common.Name, libraryRootHash: string, - libraryInfo: LibraryInfo, callback: Common.ObjectCallback): void; - (node: Common.Node, name: Common.Name, libraryRootHash: string, - libraryInfo: LibraryInfo): Promise; - } - addMember(node: Common.Node, name: Common.Name, member: Common.Node): undefined | Error; - addMixin(node: Common.Node, mixinPath: string): undefined | Error; - applyResolution(conflict: {}): {}; - applyTreeDiff: { - (root: Common.Node, patch: Common.DataObject, callback: Common.ObjectCallback): void; - (root: Common.Node, patch: Common.DataObject): Promise; - } - canSetAsMixin(node: Common.Node, mixinPath: string): boolean | string; - clearMetaRules(node: Common.Node): undefined | Error; - clearMixins(node: Common.Node): undefined | Error; - copyNode(node: Common.Node, parent: Common.Node): Common.Node | Error; - copyNodes(nodes: Common.Node[], parent: Common.Node): Common.Node[] | Error; - createNode(parameters: NodeParameters): Common.Node | Error; - createSet(node: Common.Node, name: Common.Name): undefined | Error; - delAspectMeta(node: Common.Node, name: Common.Name): undefined | Error; - delAspectMetaTarget(node: Common.Node, name: Common.Name, targetPath: string): undefined | Error; - delAttribute(node: Common.Node, name: Common.Name): undefined | Error; - delAttributeMeta(node: Common.Node, name: Common.Name): undefined | Error; - delChildMeta(node: Common.Node, childPath: string): undefined | Error; - delConstraint(node: Common.Node, name: Common.Name): undefined | Error; - deleteNode(node: Common.Node): undefined | Error; - deletePointer(node: Common.Node, name: Common.Name): undefined | Error; - deleteSet(node: Common.Node, name: Common.Name): undefined | Error; - delMember(node: Common.Node, name: Common.Name, path: string): undefined | Error; - delMemberAttribute(node: Common.Node, setName: string, memberPath: string, attrName: string): undefined | Error; - delMemberRegistry(node: Common.Node, setName: string, memberPath: string, regName: string): undefined | Error; - delMixin(node: Common.Node, mixinPath: string): undefined | Error; - delPointerMeta(node: Common.Node, name: Common.Name): undefined | Error; - delPointerMetaTarget(node: Common.Node, name: Common.Name, targetPath: string): undefined | Error; - delRegistry(node: Common.Node, name: Common.Name): undefined | Error; - generateTreeDiff: { - (sourceRoot: Common.Node, targetRoot: Common.Node, callBack: Common.ObjectCallback): void; - (sourceRoot: Common.Node, targetRoot: Common.Node): Promise; - } - getAllMetaNodes(node: Common.Node): { [name: string]: Common.Node }; - getAspectMeta(node: Common.Node, name: Common.Name): string[]; - /** - * Retrieves the value of the given attribute of the given node. - * @param node - the node in question. - * @param name - the name of the attribute. - * - * @return The function returns the value of the attribute of the node. - * The retrieved attribute should not be modified as is - it should be copied first! - * The value can be an object or any primitive type. - * If the return value is undefined; the node does not have such attribute defined. - * If the node is undefined the returned value is null. - */ - getAttribute(node: Common.Node | undefined, name: Common.Name): Common.OutAttr; - getAttributeMeta(node: Common.Node, name: Common.Name): {}; - /** Get the defined attribute names */ - getAttributeNames(node: Common.Node): string[]; - /** Get the base node */ - getBase(node: Common.Node): Common.Node; // null - /** Get the base node at the top of the inheritance chain (typically the fco). */ - getBaseRoot(node: Common.Node): Common.Node; - /** Get the most specific meta node. */ - getBaseType(node: Common.Node): Common.Node; // null - getChild(node: Common.Node, relativeId: string): Common.Node; - getChildrenHashes(node: Common.Node): { [name: string]: Common.MetadataHash }; - getChildrenMeta(node: Common.Node): RelationRule; - /** The children paths are available from the node. */ - getChildrenPaths(parent: Common.Node): string[]; - getChildrenRelids(parent: Common.Node): string[]; - getCollectionNames(node: Common.Node): string[]; - getCollectionPaths(node: Common.Node, name: Common.Name): string[]; - getConstraint(node: Common.Node, name: Common.Name): Constraint; // null - getConstraintNames(node: Common.Node): string[]; - getFCO(node: Common.Node): Common.Node; - getFullyQualifiedName(node: Common.Node): string; - getGuid(node: Common.Node): GUID; - getHash(node: Common.Node): Common.MetadataHash; - getJsonMeta(node: Common.Node): {}; - getLibraryGuid(node: Common.Node, name: Common.Name): GUID | Error; - getLibraryInfo(node: Common.Node, name: Common.Name): LibraryInfo; - getLibraryMetaNodes(node: Common.Node, name: Common.Name, onlyOwn?: boolean): Common.Node[]; - getLibraryNames(node: Common.Node): string[]; - getLibraryRoot(node: Common.Node, name: Common.Name): Common.Node; // null - getMemberAttribute(node: Common.Node, setName: string, memberPath: string, attrName: string): Common.OutAttr; - getMemberAttributeNames(node: Common.Node, name: Common.Name, memberPath: string): string[]; - getMemberOwnAttributeNames(node: Common.Node, name: Common.Name, memberPath: string): string[]; - getMemberOwnRegistry(node: Common.Node, name: Common.Name, memberPath: string): string[]; - getMemberPaths(node: Common.Node, name: Common.Name): string[]; - getMemberRegistry(node: Common.Node, setName: string, memberPath: string, regName: string): Common.OutAttr; - getMemberRegistryNames(node: Common.Node, name: Common.Name, memberpath: string): string[]; - getMixinErrors(node: Common.Node): MixinViolation[]; - getMixinNodes(node: Common.Node): { [name: string]: Common.Node }; - getMixinPaths(node: Common.Node): string[]; - getNamespace(node: Common.Node): string; - getOwnAttribute(node: Common.Node, name: Common.Name): Common.OutAttr; - getOwnAttributeNames(node: Common.Node): string[]; - getOwnChildrenPaths(parent: Common.Node): string[]; - getOwnChildrenRelids(parent: Common.Node): string[]; - getOwnConstraintNames(node: Common.Node): string[]; - getOwnJsonMeta(node: Common.Node): Common.DataObject; - getOwnMemberPaths(node: Common.Node, name: Common.Name): string[]; - getOwnMixinNodes(node: Common.Node): { [name: string]: Common.Node }; - getOwnMixinPaths(node: Common.Node): string[]; - getOwnPointerNames(node: Common.Node): string[]; - getOwnPointerPath(node: Common.Node, name: Common.Name): Common.OutPath; - getOwnRegistry(node: Common.Node, name: Common.Name): Common.OutAttr; - getOwnRegistryNames(node: Common.Node): string[]; - getOwnValidAspectNames(node: Common.Node): string[]; - getOwnValidAttributeNames(node: Common.Node): string[]; - /** The parent paths are available from the node. */ - getParent(node: Common.Node): Common.Node; - /** Get the path/id */ - getPath(node: Common.Node): string; - getPointerMeta(node: Common.Node, name: Common.Name): RelationRule; - getPointerNames(node: Common.Node): string[]; - getPointerPath(node: Common.Node, name: Common.Name): Common.OutPath; - /** Get the assigned registry */ - getRegistry(node: Common.Node, name: Common.Name): Common.OutAttr; - /** Get the defined registry names */ - getRegistryNames(node: Common.Node): string[]; - /** Get the relative id */ - getRelid(node: Common.Node): string; - getRoot(node: Common.Node): Common.Node; - getSetNames(node: Common.Node): string[]; - getTypeRoot(node: Common.Node): Common.Node; - getValidAspectNames(node: Common.Node): string[]; - getValidAttributeNames(node: Common.Node): string[]; - getValidChildrenMetaNodes(parameters: MetaNodeParameters): Common.Node[]; - getValidChildrenPaths(node: Common.Node): string[]; - getValidPointerNames(node: Common.Node): string[]; - getValidSetMetaNodes(parameters: MetaNodeParameters): Common.Node[]; - getValidSetNames(node: Common.Node): string[]; - isAbstract(node: Common.Node): boolean; - /** Connections are just nodes with two pointers named "src" and "dst". */ - isConnection(node: Common.Node): boolean; - isEmpty(node: Common.Node): boolean; - isFullyOverriddenMember(node: Common.Node, setName: string, memberPath: string): boolean; - isInstanceOf(node: Common.Node, name: Common.Name): boolean; - isLibraryElement(node: Common.Node): boolean; - isLibraryRoot(node: Common.Node): boolean; - isMemberOf(node: Common.Node): Common.DataObject; - isMetaNode(node: Common.Node): boolean; - isTypeOf(node: Common.Node, type: Common.Node): boolean; - isValidAttributeValueOf(node: Common.Node, name: Common.Name, value: Common.InAttr): boolean; - isValidChildOf(node: Common.Node, parent: Common.Node): boolean; - isValidTargetOf(node: Common.Node, source: Common.Node, name: Common.Name): boolean; - loadByPath: { - (startNode: Common.Node, relativePath: string, callback: Common.ObjectCallback): void; - (startNode: Common.Node, relativePath: string): Promise; - }; - loadChild: { - (parent: Common.Node, relativeId: string, callback: Common.ObjectCallback): void; - (parent: Common.Node, relativeId: string): Promise; - }; - /** Loading the children however requires data that is not (necessarily) available */ - loadChildren: { - (parent: Common.Node, callback: Common.ObjectArrayCallback): void; - (parent: Common.Node): Promise; - } - loadCollection: { - (target: Common.Node, pointerName: string, callback: Common.ObjectCallback): void; - (target: Common.Node, pointerName: string): Promise; - }; - loadOwnSubTree: { - (node: Common.Node, callback: Common.ObjectCallback): void; - (node: Common.Node): Promise; - }; - loadPointer: { - (node: Common.Node, pointerName: string, callback: Common.ObjectCallback): void; - (node: Common.Node, pointerName: string): Promise; - }; - loadRoot: { - (metadataHash: Common.MetadataHash, callback: Common.ObjectCallback): void; - (metadataHash: Common.MetadataHash): Promise; - }; - loadSubTree: { - (node: Common.Node, callback: Common.ObjectCallback): void; - (node: Common.Node): Promise; - }; - loadTree: { - (rootHash: Common.MetadataHash, callback: Common.ObjectCallback): void; - (rootHash: Common.MetadataHash): Promise; - }; - moveNode(node: Common.Node, parent: Common.Node): Common.Node | Error; - persist(node: Common.Node): GmePersisted; - removeLibrary(node: Common.Node, name: Common.Name): void; - renameLibrary(node: Common.Node, oldName: string, newName: string): void; - setAspectMetaTarget(node: Common.Node, name: Common.Name, target: Common.Node): undefined | Error; - setAttribute(node: Common.Node, name: Common.Name, value: Common.InAttr): undefined | Error; - setAttributeMeta(node: Common.Node, name: Common.Name, rule: MetaRule): undefined | Error; - setBase(node: Common.Node, base: Common.Node): undefined | Error; - setChildMeta(node: Common.Node, child: Common.Node, min?: number, max?: number): undefined | Error; - setChildrenMetaLimits(node: Common.Node, min?: number, max?: number): undefined | Error; - setConstraint(node: Common.Node, name: Common.Name, constraint: Constraint): undefined | Error; - setGuid: { - (node: Common.Node, guid: GUID, callback: Common.ObjectCallback): undefined | Error; - (node: Common.Node, guid: GUID): Promise; - }; - setMemberAttribute: { - (node: Common.Node, setName: string, memberPath: string, - SVGPathSegLinetoHorizontalAbsme: string, - value?: Common.InAttr): undefined | Error; - }; - setMemberRegistry(node: Common.Node, setName: string, memberPath: string, regName: string, - value?: Common.InAttr): undefined | Error; - setPointer(node: Common.Node, name: Common.Name, target: Common.Node | null): undefined | Error; - setPointerMetaLimits(node: Common.Node, memberPath: string, - min?: number, max?: number): undefined | Error; - setPointerMetaTarget(node: Common.Node, name: Common.Name, target: Common.Node, min?: number, max?: number): undefined | Error; - /** Get the assigned registry */ - setRegistry(node: Common.Node, name: Common.Name, value: Common.InAttr): undefined | Error; - - /** - * the visitation function will be called for - * every node in the sub-tree, the second parameter of the function - * is a callback that should be called to - * note to the traversal function that the visitation for a given node is finished. - */ - traverse: { - // takes a callback & returning *no* promise - (node: Common.Node, - options: TraversalOptions, - visitFn: (node: Common.Node, finished: Common.VoidFn) => void, - callback: Common.ObjectCallback) - : void; - // takes *no* callback & returns a promise - (node: Common.Node, - options: TraversalOptions, - visitFn: (node: Common.Node, finished: Common.VoidFn) => void) - : Promise; - } - tryToConcatChanges(mine: Common.DataObject, theirs: Common.DataObject): Common.DataObject; - updateLibrary: { - (node: Common.Node, name: Common.Name, libraryRootHash: Common.MetadataHash, - libraryInfo: LibraryInfo, callback: Common.ObjectCallback): void; - (node: Common.Node, name: Common.Name, libraryRootHash: Common.MetadataHash, - libraryInfo: LibraryInfo): Promise; - } - } - - export interface Dictionary { - // allow any number of 'other' properties. - [propName: string]: any; - } - - - /** - Logs debug messages - https://editor.webgme.org/docs/source/global.html#GmeLogger - */ - export interface GmeLogger { - debug(fmt: string, msg?: string | undefined): void; - info(fmt: string, msg?: string | undefined): void; - warn(fmt: string, msg?: string | undefined): void; - error(fmt: string, msg?: string | undefined): void; - /** - Creates a new logger with the same settings - and a name that is an augmentation of this logger and the - provided string. - If the second argument is true - - the provided name will be used as is. - */ - fork(fmt: string, reuse: boolean): GmeLogger; - } - export interface ProjectInterface { - - } - - - export interface ThenCallback { - (): void; - } - export interface CatchCallback { - (err: Error): void; - } - - export interface Promisable { - then(callback: ThenCallback): Promisable; - catch(callback: CatchCallback): Promisable; - } - - /** - The base plugin object from which all plugins should inherit. - */ - export interface Base { - - activeNode: Common.Node; - activeSelection: Common.Node[]; - blobClient: Blobs.BlobClient; - core: Core; - gmeConfig: Config.GmeConfig; - isConfigured: boolean; - logger: GmeLogger; - /** - * The resolved META nodes based on the active namespace. Index by the fully qualified meta node names - * with the namespace stripped off at the start. - * - * For example, if a project has a library A with a library B. If the project and the libraries all have - * two meta nodes named a and b. Depending on the namespace the META will have the following keys: - * - * 1) namespace = '' -> ['a', 'b', 'A.a', 'A.b', 'A.B.a', 'A.B.b'] - * 2) namespace = 'A' -> ['a', 'b', 'B.a', 'B.b'] - * 3) namespace = 'A.B' -> ['a', 'b'] - * - * (N.B. 'a' and 'b' in example 3) are pointing to the meta nodes defined in A.B.) - */ - META: any; - /** - * The namespace the META nodes are coming from (set by invoker). - * The default is the full meta, i.e. the empty string namespace. - * For example, if a project has a library A with a library B. The possible namespaces are: - * '', 'A' and 'A.B'. - */ - namespace: string; - notificationHandlers: any[]; - pluginMetadata: Common.Metadata; - project: ProjectInterface; - result: Result; - rootNode: Common.Node; - - addCommitToResult(status: string): void; - baseIsMeta(node: any): boolean; - - configure(config: Config.GmeConfig): void; - createMessage(node: any, message: string, serverity: string): void; - /** - * Gets the configuration structure for the plugin. - * The ConfigurationStructure defines the configuration for the plugin - * and will be used to populate the GUI when invoking the plugin from webGME. - */ - getConfigStructure(): Config.ConfigItem[]; - getCurrentConfig(): Config.GmeConfig; - getDefaultConfig(): Config.GmeConfig; - /** - * Gets the description of the plugin. - */ - getDescription(): string; - getMetadata(): any; - getMetaType(node: any): any; - /** - * Gets the name of the plugin. - */ - getName(): string; - /** - * Gets the semantic version (semver.org) of the plugin. - */ - getVersion(): string; - initialize(logger: GmeLogger, blobClient: Blobs.BlobClient, gmeConfig: Config.GmeConfig): void; - isInvalidActiveNode(pluginId: any): any; - isMetaTypeOf(node: any, metaNode: any): boolean; - /** - Main function for the plugin to execute. - Notes: - - Always log with the provided logger.[error,warning,info,debug]. - - Do NOT put any user interaction logic UI, etc. inside this method. - - handler always has to be called even if error happened. - - When this runs the core api is used to extract the essential - meta-model and the model-instance, these are then written to the mega-model. - The mega-model contains all of the models used to describe the target system. - - https://github.com/ptaoussanis/sente - and https://github.com/cognitect/transit-format - will be used to connect to the - graph database (immortals) where the mega-model is stored. - - @param {function(string, plugin.PluginResult)} handler - the result handler - */ - main(callback: ResultCallback): void; - save(message?: string): Promisable; // returns a promise? - sendNotification: { - (message: string, callback: Common.ObjectCallback): void; - (message: string): Promise; - } - setCurrentConfig(newConfig: Config.GmeConfig): void; - updateMeta(generatedMeta: any): void; - updateSuccess(value: boolean, message: TemplateStringsArray): void; - } - - class PluginBase implements Base { - constructor(); - - activeNode: Common.Node; - activeSelection: Common.Node[]; - blobClient: Blobs.BlobClient; - core: Core.Core; - gmeConfig: Config.GmeConfig; - isConfigured: boolean; - logger: Core.GmeLogger; - META: any; - namespace: string; - notificationHandlers: any[]; - pluginMetadata: Common.Metadata; - project: Core.ProjectInterface; - result: Core.Result; - rootNode: Common.Node; - - addCommitToResult(status: string): void; - baseIsMeta(node: any): boolean; - configure(config: Config.GmeConfig): void; - createMessage(node: any, message: string, serverity: string): void; - getConfigStructure(): any; - getCurrentConfig(): Config.GmeConfig; - getDefaultConfig(): Config.GmeConfig; - getDescription(): string; - getMetadata(): any; - getMetaType(node: any): any; - getName(): string; - getVersion(): string; - initialize(logger: GmeLogger, blobClient: Blobs.BlobClient, gmeConfig: Config.GmeConfig): void; - isInvalidActiveNode(pluginId: any): any; - isMetaTypeOf(node: any, metaNode: any): boolean; - main(callback: Core.ResultCallback): void; - save(message?: string): Core.Promisable; - sendNotification: { - (message: string, callback: Core.ResultCallback): void; - (message: string): Promise; - } - setCurrentConfig(newConfig: Config.GmeConfig): void; - updateMeta(generatedMeta: any): void; - updateSuccess(value: boolean, message: TemplateStringsArray): void; - } - -} - -/** - * Each Plugin has a configuration specified via a metadata.json file. - * This interface prescribes that configuration file. - * - */ -declare namespace Config { - - type StringDictionary = { [key: string]: string }; - - export interface ConfigItem { - // a unique name for the configuration item - name: Common.Name; - // a human comprehensible name - displayName: string; - // a detailed description fo the item - description: string; - // the value of the item: if valueItem is provided it must be one of those values. - value: string; - // the datatype of the value: 'string', 'integer', ... - valueType: string, - // an enumeration of the allowed values for the value field - valueItems?: string[]; - // a regular expression limiting the values allowed. - // e.g. '^[a-zA-Z]+$' - regex?: RegExp; - // a description of the regex grammar - // e.g. 'Name can only contain English characters!' - regexMessage?: string; - // can the value be changed? - readOnly?: boolean; - } - - - /** - https://editor.webgme.org/docs/source/global.html#GmeConfig - https://github.com/webgme/webgme/blob/master/config/README.md - */ - export class GmeConfig { - constructor(); - /** Add-on related settings. */ - addOns: any; - /** Authentication related settings. */ - authentication: { - enable: boolean, - jwt: { privateKey: string, publicKey: string }, - logInUrl: string, - logOutUrl: string - }; - /** Bin script related settings. */ - bin: any; - /** Blob related settings. */ - blob: Blobs.ObjectBlob; - /** Client related settings. */ - client: { log: { level: string } }; - /** Client related settings. */ - core: Core.Core; - /** Enables debug mode. */ - public debug: boolean; - /** Executor related settings. */ - executor: any; - /** Mongo database related settings. */ - mongo: { uri: string }; - /** Plugin related settings. */ - plugin: { - basePaths: string[], - allowBrowserExecution: boolean, - allowServerExecution: boolean - }; - /** Additional paths to for requirejs. */ - requirejsPaths: StringDictionary; - /** REST related settings. */ - rest: any; - /** Seed related settings. */ - seedProjects: { - basePaths: string[], - panelPaths: string[], - enable: boolean, - allowDuplication: boolean - }; - /** Server related settings. */ - server: { - port: number, handle: { fd: number }, - log: any - }; - /** Socket IO related settings. */ - socketIO: any; - /** Storage related settings. */ - storage: any; - /** Visualization related settings. */ - visualization: { - panelPaths: string[], - visualizerDescriptors: string[], - extraCss: string[] - }; - - serialize(): any; - } - - - export class PluginConfig extends Config.GmeConfig { - [propName: string]: any; - } - - export let config: PluginConfig; - -} - -/** -Things in this module are deprecated. -This was a serialization supported in version 1. -*/ -declare module "webgme/v1" { - export type GUID = string; - - export interface JsonContainment { - [index: string]: JsonContainment; - } - export interface JsonNode { - attributes: any; - base: string; - meta: any; - parent: string; - pointers: any; - registry: any; - sets: any; - constratints: any; - } - export interface JsonObj { - root: { path: string; guid: GUID }; - containment: JsonContainment; // guid tree of hashes - bases: any; // - nodes: any; - relids: any; - metaSheets: any; - } -} \ No newline at end of file diff --git a/types/webgme/tsconfig.json b/types/webgme/tsconfig.json deleted file mode 100644 index 20b15fd0c0..0000000000 --- a/types/webgme/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "webgme-tests.ts" - ] -} \ No newline at end of file diff --git a/types/webgme/tslint.json b/types/webgme/tslint.json deleted file mode 100644 index a403f5da2b..0000000000 --- a/types/webgme/tslint.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "await-promise": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/webgme/webgme-tests.ts b/types/webgme/webgme-tests.ts deleted file mode 100644 index 1cb2c78814..0000000000 --- a/types/webgme/webgme-tests.ts +++ /dev/null @@ -1,590 +0,0 @@ -/** - * In actual usage the MetaDataStr would most likely - * be initialized with an import... - * - import MetaDataStr = require("text!metadata.json"); - * - * Which would require a declaration, like... - * `text.d.ts` - * - declare module "text!*" { - var text: string; - export = text; - } - * - */ -const MetaDataStr = ""; - -import PluginBase = require("plugin/PluginBase"); - -import * as fs from "fs"; -import * as stream from "stream"; -import * as Common from "webgme/common"; - -/** - * The following items are not created directly by the - * plugin driver. - * - * self is an instance of the PluginBase class. - */ -let self = new PluginBase(); -let node = new Common.Node(); -let connNode = new Common.Node(); -let sourceNode = new Common.Node(); -let destinationNode = new Common.Node(); - -/** - * These tests are derived from... - * https://github.com/webgme/webgme/wiki/GME-Core-API - * - * Nearly all core functions takes a CoreNode as its first argument. - * When using the Core API externally each CoreNode corresponds - * to one node/model in the project tree. - * To access data from the node the Core API should be used - * and the properties on the CoreNode itself should - * not be accessed or modified directly. - * - * Below follows a handpicked selection of basic core functions. - */ - -/** - * https://github.com/webgme/webgme/wiki/GME-Core-API#common-properties - */ -function test_core_common_properties() { - let path = self.core.getPath(node); - let relid = self.core.getRelid(node); - let guid = self.core.getGuid(node); -} - -/** -https://github.com/webgme/webgme/wiki/GME-Core-API#attributes -*/ -function test_core_attributes() { - let name = self.core.getAttribute(node, 'name'); - self.core.setAttribute(node, 'name', 'newName'); - let attributeNames = self.core.getAttributeNames(node); -} - -/** -https://github.com/webgme/webgme/wiki/GME-Core-API#registries -*/ -function test_core_registries() { - let position = self.core.getRegistry(node, 'position'); - self.core.setRegistry(node, 'position', { x: 100, y: 100 }); - let registryNames = self.core.getRegistryNames(node); -} - -/** - * https://github.com/webgme/webgme/wiki/GME-Core-API#inheritance - */ -function test_core_inheritance() { - let baseNode = self.core.getBase(node); - let fcoNode = self.core.getBaseRoot(node); - let aMetaNode = self.core.getBaseType(node); -} - -/** - * https://github.com/webgme/webgme/wiki/GME-Core-API#the-traverse-method - */ -function test_core_containment_traversal() { - function atNode(node: Common.Node, done: Common.VoidFn) { - let metaNode = self.core.getBaseType(node); - let nodeName = self.core.getAttribute(node, 'name'); - // Library-roots do not have a meta-type either. - let metaName = metaNode ? self.core.getAttribute(metaNode, 'name') : ':LibraryRoot:'; - - console.log(`${nodeName} at ${self.core.getPath(node)} is of meta type ${metaName}`); - done(); - } - // Traversal from the root-node (itself will be excluded since it doesn't have a meta-type). - self.core.traverse(self.rootNode, { excludeRoot: true }, atNode, (err): void => { - if (err) { - // Something went wrong! - // Handle the error and return. - } - // At this point we have successfully visited all nodes. - }); -} - -/** - * https://github.com/webgme/webgme/wiki/GME-Core-API#containment-methods - */ -function test_core_containment_methods() { - let childrenPaths = self.core.getChildrenPaths(node); - let parentNode = self.core.getParent(node); - let baseNode = self.core.getBase(node); - let rootNode = self.core.getRoot; - - // Loading the children however requires data that is not (necessarily) available - self.core.loadChildren(node, (err, children) => { - if (err) { - // Something went wrong! - // Handle the error and return. - } - // We have an array of the children and can get information from them. - for (let child of children) { - console.log(self.core.getAttribute(child, 'name')); - } - }); - // This line will be hit before the callback of loadChildren - - // Create a new node, the new node is available directly. - let params = { - parent: parentNode, - base: baseNode - }; - - var newNode = self.core.createNode(params); - - // Copy a node. - var copiedNode = self.core.copyNode(node, parentNode); - - // Delete a node. - self.core.deleteNode(newNode); - - // Loading nodes by paths - // N.B. the path provided is relative the node in the first argument, - // here the root-node is passed to the path is the absolute (i.e. same - // as self.core.getPath(someNode);) - self.core.loadByPath(rootNode, '/1', (err, node) => { - if (err) { - // Handle error - } - // Here we have access to the node. - }); - - // Loading an entire sub-tree of nodes - // N.B. this requires all nodes to be loaded at the same time. - // For larger models core.traverse is preferred. - self.core.loadSubTree(node, (err, nodes) => { - if (err) { - // Handle error - } - // Here we have access to all the nodes that is contained in node - // at any level. - }); -} - -/** - * https://github.com/webgme/webgme/wiki/GME-Core-API#pointers-and-connections - */ - -function test_core_pointers_connections() { - - // - let isConn = self.core.isConnection(connNode); - - // Get the path of the node that is pointed to, via 'src', from connNode. - // (Here the paths to the source node of the connection.) - var sourceNodePath = self.core.getPointerPath(connNode, 'src'); - - // Load the node node that is pointed to, via 'src', from connNode. - // (Here the source node of the connection.) - self.core.loadPointer(connNode, 'src', (err, sourceNode) => { - if (err) { - // Handle error - } - // Here we have access to the sourceNode. - }); - - // Get the paths of the nodes with pointers named 'src' to the sourceNode. - // (Here the paths to the connections that have sourceNode as source.) - let connectionPaths = self.core.getCollectionPaths(sourceNode, 'src'); - - // Load the nodes with pointers named 'src' to the sourceNode. - // (Here the connections that have sourceNode as source.) - self.core.loadCollection(sourceNode, 'src', (err, connNodes) => { - if (err) { - // Handle error - } - // connNodes is an array (a node can have multiple connections/pointers) - // connNode above is within connNodes. - }); - - // Creating new pointers. - // (Since we create both the 'src' and 'dst' this will be rendered as a connection between the two nodes.) - self.core.setPointer(connNode, 'src', sourceNode); - self.core.setPointer(connNode, 'dst', destinationNode); -} - - -/** - * https://github.com/webgme/webgme/wiki/GME-Blob-Storage-API - * - * File-like objects/artifacts - * (which are neither a meta archetype model, nor an instance model) - * are stored separately from the WebGME meta-models and models. - * An example of such an artifact would be a resource - * file that is associated with a model - * (e.g., data for an instance model, or a generated artifact from analyzing a model). - * - * One reason for treating these objects differently is that they do not conform to the data model, - * and they might not be well-suited for storage in a database - * (the Blob is suited to handle binary objects of any size and structure). - */ - -/** - * https://github.com/webgme/webgme/wiki/GME-Blob-Storage-API#usage - */ -function test_client_creating_an_instance() { - // let client = new GME.classes.Client(GME.gmeConfig); -} - -/** - * Add the remaining tests. - */ - - -/** - * https://github.com/webgme/webgme/wiki/GME-Blob-Storage-API - * - * File-like objects/artifacts - * (which are neither a meta archetype model, nor an instance model) - * are stored separately from the WebGME meta-models and models. - * An example of such an artifact would be a resource - * file that is associated with a model - * (e.g., data for an instance model, or a generated artifact from analyzing a model). - * - * One reason for treating these objects differently is that they do not conform to the data model, - * and they might not be well-suited for storage in a database - * (the Blob is suited to handle binary objects of any size and structure). - */ - - - -/** - * The following items are not created directly by the - * plugin driver. - * - * self is an instance of the PluginBase class. - */ - -interface DataModel { - stateMachine: { - name: string, - initialState: string | null, - finalStates: any[], states: any[] - } -}; - -/** - * https://github.com/webgme/webgme/wiki/GME-Blob-Storage-API#usage - */ -function test_client_using_a_blob() { - - class SamplePlugin extends PluginBase { - pluginMetadata: any; - private dataModel: DataModel; - - constructor() { - super(); - this.pluginMetadata = JSON.parse(MetaDataStr); - } - - extractDataModel(): DataModel { - return { stateMachine: { name: "dm", initialState: null, finalStates: [], states: [] } }; - } - - async main(mainHandler: Core.ResultCallback): Promise { - let artifact: Core.Artifact; - - const dataModel = this.extractDataModel(); - var dataModelStr = JSON.stringify(dataModel, null, 4); - this.dataModel = dataModel; - - this.logger.info('Extracted dataModel', dataModelStr); - - const jsonFileHash = await self.blobClient.putFile('dataModel.json', dataModelStr); - // Add link from result to this file. - self.result.addArtifact(jsonFileHash); - - // Create a complex artifact, with links to multiple files. - artifact = self.blobClient.createArtifact('simulator'); - - let programJS = "some javascript file"; - self.logger.info('program.js', programJS); - - return artifact.addFilesAsSoftLinks({ - 'program.js': programJS, - 'index.html': this.pluginMetadata - }); - } - } -} - -/** - * Add the remaining tests. - */ - -/** - * This is an extract from a Darpa project. - */ - - -type DictionaryAny = { [key: string]: any }; - -/** -* Visit the node and perform the function. -* Related example using traverse. -* https://github.com/webgme/xmi-tools/blob/master/src/plugins/XMIExporter/XMIExporter.js#L430 -*/ -async function test_core_containment_traversal_complete() { - const BLANK = ""; - const NULL_OBJECT = "_OBJECT" - const NULL_GUID = "00000000-0000-0000-0000-000000000000"; - - async function getEdgesModel(sponsor: PluginBase, core: Core.Core, - _rootNode: Common.Node, _metaNode: Common.Node): Promise { - - let fcoName = core.getAttribute(core.getFCO(sponsor.rootNode), "name"); - let languageName = core.getAttribute(sponsor.rootNode, "name"); - sponsor.logger.info(`get model edges : ${languageName} : ${fcoName}`); - - let rootEntry - = { - "version": "0.0.1", - "pointers": {}, "inv_pointers": {}, - "sets": {}, "inv_sets": {}, - "base": { - "name": NULL_OBJECT, - "guid": NULL_GUID, - }, - "name": { - "name": NULL_OBJECT, "uriExt": BLANK, "uriPrefix": BLANK, - "uriName": BLANK, "uriGen": BLANK - }, - "type": { - "domain": languageName, - "meta": NULL_GUID, "root": NULL_GUID, "base": NULL_GUID, "parent": NULL_GUID - }, - "attributes": {}, - "children": {}, - "guid": NULL_GUID - }; - let nodeGuidMap: Core.Dictionary = { - [NULL_GUID]: rootEntry - }; - - sponsor.logger.info("A dictionary: look up nodes based on their path name."); - let path2entry: Core.Dictionary = { [BLANK]: rootEntry }; - - /** - * A filter mechanism to effectively eliminate containment branches. - * Any path included in the prune-list will be the root of a - * pruned subtree. - */ - let pruneList: string[] = []; - - /** - * The base node makes reference to inheritance. - * The parent node makes reference to containment. - * The traverse function follows the containment tree. - * @type {[type]} - */ - let visitFn = async (node: Node, done: Common.VoidFn): Promise => { - try { - let core = sponsor.core; - let nodePath: string = core.getPath(node); - - let prunedRootPath: string | null = null; - for (let pl of pruneList) { - if (nodePath.indexOf(pl) !== 0) { continue; } - // console.log(`pruned: ${nodePath}::${pl}`); - prunedRootPath = pl; - } - - let nodeNameAttr = core.getAttribute(node, "name"); - if (typeof nodeNameAttr !== "string") { return; } - - // sponsor.logger.info(`visitor function with ${nodeNameAttr}`); - - let baseNodeGuid: string = core.getGuid(core.getBase(node)); - let baseNodeTypeGuid: string = core.getGuid(core.getBaseType(node)); - let baseNodeRootGuid: string = core.getGuid(core.getBaseRoot(node)); - - // set the nodes sourceGuid - let sourceGuid: string = core.getGuid(node); - let sourceEntry - = { - "guid": sourceGuid, - "name": {}, - "type": { - "domain": languageName, - "meta": baseNodeTypeGuid, - "root": baseNodeRootGuid, - "base": baseNodeGuid - }, - "pointers": {}, "inv_pointers": {}, - "sets": {}, "inv_sets": {}, - "base": { - "name": NULL_OBJECT, - "guid": NULL_GUID - }, - "attributes": {}, - "children": {} - }; - nodeGuidMap[sourceGuid] = sourceEntry; - - let metaName: string; - let metaNodeGuid: string; - if (node === sponsor.rootNode) { - metaName = ":Root:"; - sourceEntry.type = { - "domain": BLANK, - "meta": NULL_GUID, - "root": NULL_GUID, - "base": NULL_GUID - }; - metaNodeGuid = NULL_GUID; - } else if (core.isLibraryRoot(node)) { - metaName = ":LibraryRoot:"; - metaNodeGuid = core.getGuid(node); - - // console.log(`prune: ${nodePath}`); - pruneList.push(nodePath); - prunedRootPath = nodePath; - } else { - let metaNameAttr = core.getAttribute(core.getBaseType(node), "name"); - if (typeof metaNameAttr !== "string") { return; } - metaName = metaNameAttr; - metaNodeGuid = core.getGuid(core.getParent(node)); - } - let containRel = metaName; - path2entry[nodePath] = sourceEntry; - - // set the parent to know its child the root node has no parent - // if a non-pruned item has a pruned parent then bring it in. - if (node !== sponsor.rootNode) { - let parent: Common.Node = core.getParent(node); - let parentPath: string = core.getPath(parent); - - let parentData = path2entry[parentPath]; - let children = parentData.children; - children[containRel] = children[containRel] || []; - // children[containRel].push(sourceEntry); - children[containRel].push(sourceGuid); - } - - // set the nodes attributes - core.getAttributeNames(node).forEach((attrName: string) => { - let attrValueRaw = core.getAttribute(node, attrName); - let attrValue: string; - if (typeof attrValueRaw === "string") { - attrValue = attrValueRaw; - } else { - attrValue = ""; - } - let sen = sourceEntry.name; - }); - - // get pointers & inv_pointers - const ptrNames = await core.getPointerNames(node); - Promise.all(ptrNames.map(async ptrName => { - let targetPathRaw = core.getPointerPath(node, ptrName); - if (typeof targetPathRaw !== "string") { return; } - - let targetPath: string = targetPathRaw; - const targetNode = core.loadByPath(sponsor.rootNode, targetPath); - let targetGuid = core.getGuid(targetNode); - if (ptrName === "base") { - - } else { - let pointers: DictionaryAny = sourceEntry.pointers; - let targetMetaNode = core.getBaseType(targetNode); - let targetMetaName = core.getAttribute(targetMetaNode, "name"); - if (typeof targetMetaName === "string") { - pointers[ptrName] = { - name: targetMetaName, - guid: targetGuid - }; - } - let targetEntry = nodeGuidMap[targetGuid]; - if (targetEntry === undefined) { - targetEntry = { - "name": {}, - "guid": targetGuid, - "pointers": {}, "inv_pointers": {}, - "sets": {}, "inv_sets": {} - }; - nodeGuidMap[targetGuid] = targetEntry; - } - targetEntry.inv_pointers[ptrName] = { - name: targetMetaName, - guid: sourceGuid - }; - } - })); - - // get sets & inv_set - const setNames = await core.getValidSetNames(node); - Promise.all(setNames.map(setName => { - let targetMemberPathsRaw = core.getMemberPaths(node, setName); - for (let targetMemberPath of targetMemberPathsRaw) { - if (typeof targetMemberPath !== "string") { return; } - let targetPath: string = targetMemberPath; - - try { - const targetNode = core.loadByPath(sponsor.rootNode, targetPath); - let targetGuid = core.getGuid(targetNode); - let sets: DictionaryAny = sourceEntry.sets; - let targetMetaNode = core.getBaseType(targetNode); - let targetMetaName = core.getAttribute(targetMetaNode, "name"); - if (typeof targetMetaName === "string") { - let load = { - name: targetMetaName, - guid: targetGuid - }; - let sourceSet = sets[setName]; - if (sourceSet === undefined) { - sets[setName] = [load]; - } else { - sourceSet.push(load); - } - } - let targetEntry = nodeGuidMap[targetGuid]; - if (targetEntry === undefined) { - targetEntry = { - "name": {}, - "guid": targetGuid, - "pointers": {}, "inv_pointers": {}, - "sets": {}, "inv_sets": {} - }; - nodeGuidMap[targetGuid] = targetEntry; - } - let invSets = targetEntry.inv_sets; - let targetSet = invSets[setName]; - let invLoad = { - name: targetMetaName, - guid: sourceGuid - }; - if (targetSet === undefined) { - invSets[setName] = [invLoad]; - } else { - targetSet.push(invLoad); - }; - } - catch (err) { - console.log(`difficulty loading target path: ${targetPath} with err: ${err.message}`); - let load = { - "fault": `could not load member path: ${targetPath}` - }; - let sets: DictionaryAny = sourceEntry.sets; - let sourceSet = sets[setName]; - if (sourceSet === undefined) { - sets[setName] = [load]; - } else { - sourceSet.push(load); - } - } - } - })); - } finally { - done(); - } - }; - - await core.traverse(sponsor.rootNode, { excludeRoot: false }, visitFn); - return nodeGuidMap; - } -} - From dec0baa18134d2c74272c4a04ccde1042f70588a Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:02:14 -0800 Subject: [PATCH 280/890] es6-promise: Provides its own types (#22420) --- notNeededPackages.json | 6 + types/es6-promise/es6-promise-tests.ts | 193 ------------------------- types/es6-promise/index.d.ts | 84 ----------- types/es6-promise/tsconfig.json | 24 --- types/es6-promise/tslint.json | 79 ---------- 5 files changed, 6 insertions(+), 380 deletions(-) delete mode 100644 types/es6-promise/es6-promise-tests.ts delete mode 100644 types/es6-promise/index.d.ts delete mode 100644 types/es6-promise/tsconfig.json delete mode 100644 types/es6-promise/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index f6dc3f972d..220f79c24e 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -318,6 +318,12 @@ "sourceRepoURL": "https://github.com/bjyoungblood/es6-error", "asOfVersion": "4.0.2" }, + { + "libraryName": "es6-promise", + "typingsPackageName": "es6-promise", + "sourceRepoURL": "https://github.com/jakearchibald/ES6-Promise", + "asOfVersion": "3.3.0" + }, { "libraryName": "eventemitter2", "typingsPackageName": "eventemitter2", diff --git a/types/es6-promise/es6-promise-tests.ts b/types/es6-promise/es6-promise-tests.ts deleted file mode 100644 index ac9910df46..0000000000 --- a/types/es6-promise/es6-promise-tests.ts +++ /dev/null @@ -1,193 +0,0 @@ - - - -var promiseString: Promise, - promiseStringArr: Promise, - arrayOfPromise: Promise[], - promiseNumber: Promise, - promiseAny: Promise, - thenable: Thenable; - -// constructor test -var constructResult = new Promise((resolve, reject) => { - resolve('a string'); -}); -promiseString = constructResult; - - -var constructResult1 = new Promise((resolve:(promise: Thenable) => void) => { - resolve(Promise.resolve('a string')); -}); -promiseString = constructResult1; - -//resolve test -var resolveResult = Promise.resolve('a string'); -promiseString = resolveResult; - -var resolveResult1 = Promise.resolve(thenable); -promiseString = resolveResult1; - -//reject test -var rejectResult = Promise.reject('there is an error'); -promiseAny = rejectResult; - -//all test -var allResult = Promise.all(arrayOfPromise); -promiseStringArr = allResult; - -//race test -var raceResult = Promise.race(arrayOfPromise); -promiseString = raceResult; - - -//then test -var thenWithPromiseResult = promiseString.then(word => Promise.resolve(word.length)); -promiseNumber = thenWithPromiseResult; - -var thenWithPromiseResultAndPromiseReject = promiseString.then(word => Promise.resolve(word.length), error => Promise.resolve(10)); -promiseNumber = thenWithPromiseResultAndPromiseReject; - -var thenWithPromiseResultAndSimpleReject = promiseString.then(word => Promise.resolve(word.length), error => 10); -promiseNumber = thenWithPromiseResultAndSimpleReject; - -var thenWithSimpleResult = promiseString.then(word => word.length); -promiseNumber = thenWithSimpleResult; - -var thenWithSimpleResultAndPromiseReject = promiseString.then(word => word.length, error => Promise.resolve(10)); -promiseNumber = thenWithSimpleResultAndPromiseReject; - -var thenWithSimpleResultAndSimpleReject = promiseString.then(word => word.length, error => 10); -promiseNumber = thenWithSimpleResultAndSimpleReject; - -var thenWithUndefinedFullFillAndSimpleReject = promiseString.then(undefined, error => 10); -promiseNumber = thenWithUndefinedFullFillAndSimpleReject; - -var thenWithUndefinedFullFillAndPromiseReject = promiseString.then(undefined, error => Promise.resolve(10)); -promiseNumber = thenWithUndefinedFullFillAndPromiseReject; - -var thenWithNoResultAndNoReject = promiseString.then(); -promiseNumber = thenWithNoResultAndNoReject; - -var catchAfterThen = promiseString.then().catch(); -promiseNumber = catchAfterThen; - -var voidPromise = new Promise(function (resolve) { resolve(); }); - -//catch test -var catchWithSimpleResult = promiseString.catch(error => 10); -promiseNumber = catchWithSimpleResult; - -var catchWithPromiseResult = promiseString.catch(error => Promise.resolve(10)); -promiseNumber = catchWithPromiseResult; - -promiseString = promiseString.catch(function (): string { - throw new Error('Better error msg'); -}); - -//examples coming from http://www.html5rocks.com/en/tutorials/es6/promises/ - -function get(url: string) { - // Return a new promise. - return new Promise(function(resolve, reject) { - // Do the usual XHR stuff - var req = new XMLHttpRequest(); - req.open('GET', url); - - req.onload = function() { - // This is called even on 404 etc - // so check the status - if (req.status == 200) { - // Resolve the promise with the response text - resolve(req.response); - } - else { - // Otherwise reject with the status text - // which will hopefully be a meaningful error - reject(Error(req.statusText)); - } - }; - - // Handle network errors - req.onerror = function() { - reject(Error("Network Error")); - }; - - // Make the request - req.send(); - }); -} - - - -function getJSON(url: string) { - return get(url).then(JSON.parse); -} - -function addHtmlToPage(html: string) { - -} - -function addTextToPage(text: string) { - -} - -interface Story { - heading: string; - chapterUrls: string[] -} - -getJSON('story.json').then(function(story: Story) { - addHtmlToPage(story.heading); - - // Map our array of chapter urls to - // an array of chapter json promises. - // This makes sure they all download parallel. - return story.chapterUrls.map(getJSON) - .reduce(function(sequence, chapterPromise) { - // Use reduce to chain the promises together, - // adding content to the page for each chapter - return sequence.then(function() { - // Wait for everything in the sequence so far, - // then wait for this chapter to arrive. - return chapterPromise; - }).then(function(chapter) { - addHtmlToPage(chapter.html); - }); - }, Promise.resolve()); -}).then(function() { - addTextToPage("All done"); -}).catch(function(err) { - // catch any error that happened along the way - addTextToPage("Argh, broken: " + err.message); -}).then(function() { - (document.querySelector('.spinner')).style.display = 'none'; -}); - -interface T1 { - __t1: string; -} - -interface T2 { - __t2: string; -} - -interface T3 { - __t3: string; -} - -function f1(): Promise { - return Promise.resolve({ __t1: "foo_t1" }); -} - -function f2(x: T1): T2 { - return { __t2: x.__t1 + ":foo_21" }; -} - -var x3 = f1() - .then(f2, (e: Error) => { - console.log("error 1"); - throw e; -}) - .then((x: T2) => { - return { __t3: x.__t2 + "bar" }; -}); \ No newline at end of file diff --git a/types/es6-promise/index.d.ts b/types/es6-promise/index.d.ts deleted file mode 100644 index 56e0682491..0000000000 --- a/types/es6-promise/index.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -// Type definitions for es6-promise -// Project: https://github.com/jakearchibald/ES6-Promise -// Definitions by: François de Campredon , vvakame -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface Thenable { - then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; - then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => void): Thenable; -} - -declare class Promise implements Thenable { - /** - * If you call resolve in the body of the callback passed to the constructor, - * your promise is fulfilled with result object passed to resolve. - * If you call reject your promise is rejected with the object passed to reject. - * For consistency and debugging (eg stack traces), obj should be an instanceof Error. - * Any errors thrown in the constructor callback will be implicitly passed to reject(). - */ - constructor(callback: (resolve : (value?: T | Thenable) => void, reject: (error?: any) => void) => void); - - /** - * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. - * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. - * Both callbacks have a single parameter , the fulfillment value or rejection reason. - * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. - * If an error is thrown in the callback, the returned promise rejects with that error. - * - * @param onFulfilled called when/if "promise" resolves - * @param onRejected called when/if "promise" rejects - */ - then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; - then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => void): Promise; - - /** - * Sugar for promise.then(undefined, onRejected) - * - * @param onRejected called when/if "promise" rejects - */ - catch(onRejected?: (error: any) => U | Thenable): Promise; -} - -declare namespace Promise { - /** - * Make a new promise from the thenable. - * A thenable is promise-like in as far as it has a "then" method. - */ - function resolve(value?: T | Thenable): Promise; - - /** - * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error - */ - function reject(error: any): Promise; - function reject(error: T): Promise; - - /** - * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. - * the array passed to all can be a mixture of promise-like objects and other objects. - * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. - */ - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable, T10 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable]): Promise<[T1, T2, T3, T4, T5]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable ]): Promise<[T1, T2, T3, T4]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable]): Promise<[T1, T2, T3]>; - function all(values: [T1 | Thenable, T2 | Thenable]): Promise<[T1, T2]>; - function all(values: (T | Thenable)[]): Promise; - - /** - * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. - */ - function race(promises: (T | Thenable)[]): Promise; -} - -declare module 'es6-promise' { - var foo: typeof Promise; // Temp variable to reference Promise in local context - namespace rsvp { - export var Promise: typeof foo; - export function polyfill(): void; - } - export = rsvp; -} diff --git a/types/es6-promise/tsconfig.json b/types/es6-promise/tsconfig.json deleted file mode 100644 index 8b3cc9da2a..0000000000 --- a/types/es6-promise/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es5", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "es6-promise-tests.ts" - ] -} \ No newline at end of file diff --git a/types/es6-promise/tslint.json b/types/es6-promise/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/es6-promise/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From e621bc63787aa838663b7e8564193544afee89ec Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:05:41 -0800 Subject: [PATCH 281/890] easy-x-headers and easy-xapi-supertest: Provide their own types (#22451) --- notNeededPackages.json | 12 +++ types/easy-x-headers/easy-x-headers-tests.ts | 16 ---- types/easy-x-headers/index.d.ts | 19 ----- types/easy-x-headers/tsconfig.json | 23 ------ types/easy-x-headers/tslint.json | 79 ------------------- .../easy-xapi-supertest-tests.ts | 26 ------ types/easy-xapi-supertest/index.d.ts | 29 ------- types/easy-xapi-supertest/tsconfig.json | 23 ------ types/easy-xapi-supertest/tslint.json | 79 ------------------- 9 files changed, 12 insertions(+), 294 deletions(-) delete mode 100644 types/easy-x-headers/easy-x-headers-tests.ts delete mode 100644 types/easy-x-headers/index.d.ts delete mode 100644 types/easy-x-headers/tsconfig.json delete mode 100644 types/easy-x-headers/tslint.json delete mode 100644 types/easy-xapi-supertest/easy-xapi-supertest-tests.ts delete mode 100644 types/easy-xapi-supertest/index.d.ts delete mode 100644 types/easy-xapi-supertest/tsconfig.json delete mode 100644 types/easy-xapi-supertest/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 220f79c24e..82fad099af 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -270,6 +270,18 @@ "sourceRepoURL": "http://easystarjs.com/", "asOfVersion": "0.3.1" }, + { + "libraryName": "easy-x-headers", + "typingsPackageName": "easy-x-headers", + "sourceRepoURL": "https://github.com/DeadAlready/easy-x-headers", + "asOfVersion": "1.0.0" + }, + { + "libraryName": "easy-xapi-supertest", + "typingsPackageName": "easy-xapi-supertest", + "sourceRepoURL": "https://github.com/DeadAlready/easy-xapi-supertest", + "asOfVersion": "1.0.0" + }, { "libraryName": "ecmarkup", "typingsPackageName": "ecmarkup", diff --git a/types/easy-x-headers/easy-x-headers-tests.ts b/types/easy-x-headers/easy-x-headers-tests.ts deleted file mode 100644 index 6887570225..0000000000 --- a/types/easy-x-headers/easy-x-headers-tests.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Created by karl on 14/07/15. - */ - - - - -import express = require('express'); -import xHeaders = require('easy-x-headers'); - -var app = express(); -app.use(xHeaders.getMiddleware()); - -app.get('/', function (req, res) { - res.json(req.info); -}); diff --git a/types/easy-x-headers/index.d.ts b/types/easy-x-headers/index.d.ts deleted file mode 100644 index 1dffb8adc8..0000000000 --- a/types/easy-x-headers/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Type definitions for easy-x-headers -// Project: https://github.com/DeadAlready/easy-x-headers -// Definitions by: Karl Düüna -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -/// - -declare namespace Express { - export interface Request { - info: any; - } -} - -declare module "easy-x-headers" { - import express = require('express'); - - export function getMiddleware(defaults?: Object): express.RequestHandler; -} diff --git a/types/easy-x-headers/tsconfig.json b/types/easy-x-headers/tsconfig.json deleted file mode 100644 index e2b2378af6..0000000000 --- a/types/easy-x-headers/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "easy-x-headers-tests.ts" - ] -} \ No newline at end of file diff --git a/types/easy-x-headers/tslint.json b/types/easy-x-headers/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/easy-x-headers/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/easy-xapi-supertest/easy-xapi-supertest-tests.ts b/types/easy-xapi-supertest/easy-xapi-supertest-tests.ts deleted file mode 100644 index 76dad2c8f8..0000000000 --- a/types/easy-xapi-supertest/easy-xapi-supertest-tests.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Created by karl on 14/07/15. - */ - - - -import express = require('express'); -import eSupertest = require('easy-xapi-supertest'); - -var app = express(); - -var getAgent = eSupertest.getAgentFactory(app); - -var agent = getAgent({ - user: 'Jack', - role: 'user' -}); - -var getAgent2 = eSupertest.getAgentFactory(app, function (user:string, role?:string) { - return { - user: user, - role: role || 'user' - } -}); - -var agent = getAgent2('Jack'); diff --git a/types/easy-xapi-supertest/index.d.ts b/types/easy-xapi-supertest/index.d.ts deleted file mode 100644 index 6f8b6764fd..0000000000 --- a/types/easy-xapi-supertest/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Type definitions for easy-x-headers -// Project: https://github.com/DeadAlready/easy-x-headers -// Definitions by: Karl Düüna -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - - - - -import express = require('express'); - -export interface BodyAgent { - send(data: Object): any; - attach(arg1: any, arg2?: any): any; -} - -export interface Agent { - get(url: string): any; - delete(url: string): any; - post(url: string): BodyAgent; - patch(url: string): BodyAgent; - put(url: string): BodyAgent; -} - -interface getAgent { - (...args: any[]): Agent -} - -export declare function getAgentFactory(app: express.Application, transform?: Function): getAgent; diff --git a/types/easy-xapi-supertest/tsconfig.json b/types/easy-xapi-supertest/tsconfig.json deleted file mode 100644 index 91c132409e..0000000000 --- a/types/easy-xapi-supertest/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "easy-xapi-supertest-tests.ts" - ] -} \ No newline at end of file diff --git a/types/easy-xapi-supertest/tslint.json b/types/easy-xapi-supertest/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/easy-xapi-supertest/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 760a91d3077287b34ff0c6a3d944c8ce6b354d6d Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:14:31 -0800 Subject: [PATCH 282/890] wolfy87-eventemitter: Provides its own types (#22423) --- notNeededPackages.json | 6 + types/wolfy87-eventemitter/index.d.ts | 509 ------------------ types/wolfy87-eventemitter/tsconfig.json | 24 - types/wolfy87-eventemitter/tslint.json | 79 --- .../wolfy87-eventemitter-tests.ts | 108 ---- 5 files changed, 6 insertions(+), 720 deletions(-) delete mode 100644 types/wolfy87-eventemitter/index.d.ts delete mode 100644 types/wolfy87-eventemitter/tsconfig.json delete mode 100644 types/wolfy87-eventemitter/tslint.json delete mode 100644 types/wolfy87-eventemitter/wolfy87-eventemitter-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index 82fad099af..19750122cf 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1242,6 +1242,12 @@ "sourceRepoURL": "https://webgme.org", "asOfVersion": "2.11.0" }, + { + "libraryName": "wolfy87-eventemitter", + "typingsPackageName": "wolfy87-eventemitter", + "sourceRepoURL": "https://github.com/Wolfy87/EventEmitter", + "asOfVersion": "5.2.0" + }, { "libraryName": "wonder-commonlib", "typingsPackageName": "wonder-commonlib", diff --git a/types/wolfy87-eventemitter/index.d.ts b/types/wolfy87-eventemitter/index.d.ts deleted file mode 100644 index 8932d8db7a..0000000000 --- a/types/wolfy87-eventemitter/index.d.ts +++ /dev/null @@ -1,509 +0,0 @@ -// Type definitions for wolfy87-eventemitter v4.2.9 -// Project: https://github.com/Wolfy87/EventEmitter -// Definitions by: ryiwamoto -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare class EventEmitter extends Wolfy87EventEmitter.EventEmitter {} -export = EventEmitter; -export as namespace EventEmitter; - -declare namespace Wolfy87EventEmitter { - - /** - * Hash Object for manipulating multiple events. - */ - interface MultipleEvents { - [event: string]: any //Function | Function[] - } - - /** - * Class for managing events. - * Can be extended to provide event functionality in other classes. - * - * @class EventEmitter Manages event registering and emitting. - */ - export class EventEmitter { - /** - * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. - * @return {Function} Non conflicting EventEmitter class. - */ - static noConflict(): typeof EventEmitter; - - /** - * Returns the listener array for the specified event. - * Will initialise the event object and listener arrays if required. - * Will return an object if you use a regex search. The object contains keys for each matched event. - * So /ba[rz]/ might return an object containing bar and baz. - * But only if you have either defined them with defineEvent or added some listeners to them. - * Each property in the object response is an array of listener functions. - * - * @param {string|RegExp} event Name of the event to return the listeners from. - * @return {Function[|Object]} All listener functions for the event. - */ - getListeners(event: string): Function[]; - - /** - * Returns the listener array for the specified event. - * Will initialise the event object and listener arrays if required. - * Will return an object if you use a regex search. The object contains keys for each matched event. - * So /ba[rz]/ might return an object containing bar and baz. - * But only if you have either defined them with defineEvent or added some listeners to them. - * Each property in the object response is an array of listener functions. - * - * @param {string|RegExp} event Name of the event to return the listeners from. - * @return {Function[]|Object} All listener functions for the event. - */ - getListeners(event: RegExp): {[event:string]: Function}; - - - /** - * Adds a listener function to the specified event. - * The listener will not be added if it is a duplicate. - * If the listener returns true then it will be removed after it is called. - * If you pass a regular expression as the event name then the listener will be added to all events that match it. - * - * @param {string|RegExp} event Name of the event to attach the listener to. - * @param {Function} listener Method to be called when the event is emitted. - * If the function returns true then it will be removed after calling. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - addListener(event: string, listener: Function): EventEmitter; - - /** - * Adds a listener function to the specified event. - * The listener will not be added if it is a duplicate. - * If the listener returns true then it will be removed after it is called. - * If you pass a regular expression as the event name then the listener will be added to all events that match it. - * - * @param {string|RegExp} event Name of the event to attach the listener to. - * @param {Function} listener Method to be called when the event is emitted. - * If the function returns true then it will be removed after calling. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - addListener(event: RegExp, listener: Function): EventEmitter; - - /** - * Adds a listener function to the specified event. - * The listener will not be added if it is a duplicate. - * If the listener returns true then it will be removed after it is called. - * If you pass a regular expression as the event name then the listener will be added to all events that match it. - * - * @param {string|RegExp} event Name of the event to attach the listener to. - * @param {Function} listener Method to be called when the event is emitted. - * If the function returns true then it will be removed after calling. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - on(event: string, listener: Function): EventEmitter; - - /** - * Adds a listener function to the specified event. - * The listener will not be added if it is a duplicate. - * If the listener returns true then it will be removed after it is called. - * If you pass a regular expression as the event name then the listener will be added to all events that match it. - * - * @param {string|RegExp} event Name of the event to attach the listener to. - * @param {Function} listener Method to be called when the event is emitted. - * If the function returns true then it will be removed after calling. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - on(event: RegExp, listener: Function): EventEmitter; - - /** - * Takes a list of listener objects and flattens it into a list of listener functions. - * - * @param {Object[]} listeners Raw listener objects. - * @return {Function[]} Just the listener functions. - */ - flattenListeners(listeners: {listener: Function}[]): Function[]; - - /** - * Fetches the requested listeners via getListeners but will always return the results inside an object. - * This is mainly for internal use but others may find it useful. - * - * @param event {string|RegExp} Name of the event to return the listeners from. - * @return {Object} All listener functions for an event in object - */ - getListenersAsObject(event: string): {[event:string]: Function}; - - /** - * Fetches the requested listeners via getListeners but will always return the results inside an object. - * This is mainly for internal use but others may find it useful. - * - * @param event {string|RegExp} Name of the event to return the listeners from. - * @return {Object} All listener functions for an event in object - */ - getListenersAsObject(event: RegExp): {[event:string]: Function}; - - /** - * Semi-alias of addListener. It will add a listener that will be - * automatically removed after it's first execution. - * - * @param event {string|RegExp} Name of the event to attach the listener to. - * @param listener {Function} Method to be called when the event is emitted. - * If the function returns true then it will be removed after calling. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - addOnceListener(event: string, listener: Function): EventEmitter; - - /** - * Semi-alias of addListener. It will add a listener that will be - * automatically removed after it's first execution. - * - * @param event {string|RegExp} Name of the event to attach the listener to. - * @param listener {Function} Method to be called when the event is emitted. - * If the function returns true then it will be removed after calling. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - addOnceListener(event: RegExp, listener: Function): EventEmitter; - - /** - * Semi-alias of addListener. It will add a listener that will be - * automatically removed after it's first execution. - * - * @param event {string|RegExp} Name of the event to attach the listener to. - * @param listener {Function} Method to be called when the event is emitted. - * If the function returns true then it will be removed after calling. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - once(event: string, listener: Function): EventEmitter; - - /** - * Semi-alias of addListener. It will add a listener that will be - * automatically removed after it's first execution. - * - * @param event {string|RegExp} Name of the event to attach the listener to. - * @param listener {Function} Method to be called when the event is emitted. - * If the function returns true then it will be removed after calling. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - once(event: RegExp, listener: Function): EventEmitter; - - /** - * Defines an event name. - * This is required if you want to use a regex to add a listener to multiple events at once. - * If you don't do this then how do you expect it to know what event to add to? - * Should it just add to every possible match for a regex? No. That is scary and bad. - * You need to tell it what event names should be matched by a regex. - * - * @param {string} event Name of the event to create. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - defineEvent(event: string): EventEmitter; - - /** - * Defines an event name. - * This is required if you want to use a regex to add a listener to multiple events at once. - * If you don't do this then how do you expect it to know what event to add to? - * Should it just add to every possible match for a regex? No. That is scary and bad. - * You need to tell it what event names should be matched by a regex. - * - * @param {string[]} events Name of the event to create. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - defineEvents(events: string[]): EventEmitter; - - /** - * Removes a listener function from the specified event. - * When passed a regular expression as the event name, it will remove the listener from all events that match it. - * - * @param {String|RegExp} event Name of the event to remove the listener from. - * @param {Function} listener Method to remove from the event. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - removeListener(event: string, listener: Function): EventEmitter; - - /** - * Removes a listener function from the specified event. - * When passed a regular expression as the event name, it will remove the listener from all events that match it. - * - * @param {String|RegExp} event Name of the event to remove the listener from. - * @param {Function} listener Method to remove from the event. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - removeListener(event: RegExp, listener: Function): EventEmitter; - - /** - * Removes a listener function from the specified event. - * When passed a regular expression as the event name, it will remove the listener from all events that match it. - * - * @param {String|RegExp} event Name of the event to remove the listener from. - * @param {Function} listener Method to remove from the event. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - off(event: string, listener: Function): EventEmitter; - - /** - * Removes a listener function from the specified event. - * When passed a regular expression as the event name, it will remove the listener from all events that match it. - * - * @param {String|RegExp} event Name of the event to remove the listener from. - * @param {Function} listener Method to remove from the event. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - off(event: RegExp, listener: Function): EventEmitter; - - /** - * Adds listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can add to multiple events at once. - * The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be added. - * You can also pass it a regular expression to add the array of listeners to all events that match it. - * Yeah, this function does quite a bit. That's probably a bad thing. - * - * @param {String|Object|RegExp} event An event name if you will pass an array of listeners next. - * An object if you wish to add to multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - addListeners(event: string, listeners: Function[]): EventEmitter; - - /** - * Adds listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can add to multiple events at once. - * The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be added. - * You can also pass it a regular expression to add the array of listeners to all events that match it. - * Yeah, this function does quite a bit. That's probably a bad thing. - * - * @param {String|Object|RegExp} event An event name if you will pass an array of listeners next. - * An object if you wish to add to multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - addListeners(event: RegExp, listeners: Function[]): EventEmitter; - - /** - * Adds listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can add to multiple events at once. - * The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be added. - * You can also pass it a regular expression to add the array of listeners to all events that match it. - * Yeah, this function does quite a bit. That's probably a bad thing. - * - * @param {String|Object|RegExp} event An event name if you will pass an array of listeners next. - * An object if you wish to add to multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - addListeners(event: MultipleEvents): EventEmitter; - - /** - * Removes listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can remove from multiple events at once. - * The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be removed. - * You can also pass it a regular expression to remove the listeners from all events that match it. - * - * @param {String|Object|RegExp} event An event name if you will pass an array of listeners next. - * An object if you wish to remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to remove. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - removeListeners(event: string, listeners: Function[]): EventEmitter; - - /** - * Removes listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can remove from multiple events at once. - * The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be removed. - * You can also pass it a regular expression to remove the listeners from all events that match it. - * - * @param {String|Object|RegExp} event An event name if you will pass an array of listeners next. - * An object if you wish to remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to remove. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - removeListeners(event: RegExp, listeners: Function[]): EventEmitter; - - /** - * Removes listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can remove from multiple events at once. - * The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be removed. - * You can also pass it a regular expression to remove the listeners from all events that match it. - * - * @param {String|Object|RegExp} event An event name if you will pass an array of listeners next. - * An object if you wish to remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to remove. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - removeListeners(event: MultipleEvents): EventEmitter; - - /** - * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. - * You should really use those instead, this is a little lower level. - * The first argument will determine if the listeners are removed (true) or added (false). - * If you pass an object as the second argument you can add/remove from multiple events at once. - * The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be added/removed. - * You can also pass it a regular expression to manipulate the listeners of all events that match it. - * - * @param {Boolean} remove True if you want to remove listeners, false if you want to add. - * @param {String|Object|RegExp} event An event name if you will pass an array of listeners next. - * An object if you wish to add/remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add/remove. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - manipulateListeners(remove: boolean, event: string, listeners: Function[]): EventEmitter; - - /** - * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. - * You should really use those instead, this is a little lower level. - * The first argument will determine if the listeners are removed (true) or added (false). - * If you pass an object as the second argument you can add/remove from multiple events at once. - * The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be added/removed. - * You can also pass it a regular expression to manipulate the listeners of all events that match it. - * - * @param {Boolean} remove True if you want to remove listeners, false if you want to add. - * @param {String|Object|RegExp} event An event name if you will pass an array of listeners next. - * An object if you wish to add/remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add/remove. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - manipulateListeners(remove: boolean, event: RegExp, listeners: Function[]): EventEmitter; - - /** - * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. - * You should really use those instead, this is a little lower level. - * The first argument will determine if the listeners are removed (true) or added (false). - * If you pass an object as the second argument you can add/remove from multiple events at once. - * The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be added/removed. - * You can also pass it a regular expression to manipulate the listeners of all events that match it. - * - * @param {Boolean} remove True if you want to remove listeners, false if you want to add. - * @param {String|Object|RegExp} event An event name if you will pass an array of listeners next. - * An object if you wish to add/remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add/remove. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - manipulateListeners(remove: boolean, event: MultipleEvents): EventEmitter; - - /** - * Removes all listeners from a specified event. - * If you do not specify an event then all listeners will be removed. - * That means every event will be emptied. - * You can also pass a regex to remove all events that match it. - * - * @param {String|RegExp} [event] Optional name of the event to remove all listeners for. - * Will remove from every event if not passed. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - removeEvent(event?: string): EventEmitter; - - /** - * Removes all listeners from a specified event. - * If you do not specify an event then all listeners will be removed. - * That means every event will be emptied. - * You can also pass a regex to remove all events that match it. - * - * @param {String|RegExp} [event] Optional name of the event to remove all listeners for. - * Will remove from every event if not passed. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - removeEvent(event?: RegExp): EventEmitter; - - /** - * Alias of removeEvent. - * - * Added to mirror the node API. - */ - removeAllListeners(event?: string): EventEmitter; - - /** - * Alias of removeEvent. - * - * Added to mirror the node API. - */ - removeAllListeners(event?: RegExp): EventEmitter; - - /** - * Emits an event of your choice. - * When emitted, every listener attached to that event will be executed. - * If you pass the optional argument array then those arguments will be passed to every listener upon execution. - * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. - * So they will not arrive within the array on the other side, they will be separate. - * You can also pass a regular expression to emit to all events that match it. - * - * @param {String|RegExp} event Name of the event to emit and execute listeners for. - * @param {Array} [args] Optional array of arguments to be passed to each listener. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - emitEvent(event: string, ...args: any[]): EventEmitter; - - /** - * Emits an event of your choice. - * When emitted, every listener attached to that event will be executed. - * If you pass the optional argument array then those arguments will be passed to every listener upon execution. - * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. - * So they will not arrive within the array on the other side, they will be separate. - * You can also pass a regular expression to emit to all events that match it. - * - * @param {String|RegExp} event Name of the event to emit and execute listeners for. - * @param {Array} [args] Optional array of arguments to be passed to each listener. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - emitEvent(event: RegExp, ...args: any[]): EventEmitter; - - /** - * Emits an event of your choice. - * When emitted, every listener attached to that event will be executed. - * If you pass the optional argument array then those arguments will be passed to every listener upon execution. - * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. - * So they will not arrive within the array on the other side, they will be separate. - * You can also pass a regular expression to emit to all events that match it. - * - * @param {String|RegExp} event Name of the event to emit and execute listeners for. - * @param {Array} [args] Optional array of arguments to be passed to each listener. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - trigger(event: string, ...args: any[]): EventEmitter; - - /** - * Emits an event of your choice. - * When emitted, every listener attached to that event will be executed. - * If you pass the optional argument array then those arguments will be passed to every listener upon execution. - * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. - * So they will not arrive within the array on the other side, they will be separate. - * You can also pass a regular expression to emit to all events that match it. - * - * @param {String|RegExp} event Name of the event to emit and execute listeners for. - * @param {Array} [args] Optional array of arguments to be passed to each listener. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - trigger(event: RegExp, ...args: any[]): EventEmitter; - - /** - * Subtly different from emitEvent in that it will pass its arguments on to the listeners, - * as opposed to taking a single array of arguments to pass on. - * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. - * - * @param {String|RegExp} event Name of the event to emit and execute listeners for. - * @param {... any[]} args Optional additional arguments to be passed to each listener. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - emit(event: string, ...args: any[]): EventEmitter; - - /** - * Subtly different from emitEvent in that it will pass its arguments on to the listeners, - * as opposed to taking a single array of arguments to pass on. - * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. - * - * @param {String|RegExp} event Name of the event to emit and execute listeners for. - * @param {... any[]} args Optional additional arguments to be passed to each listener. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - emit(event: RegExp, ...args: any[]): EventEmitter; - - /** - * Sets the current value to check against when executing listeners. If a - * listeners return value matches the one set here then it will be removed - * after execution. This value defaults to true. - * - * @param {any} value The new value to check for when executing listeners. - * @return {EventEmitter} Current instance of EventEmitter for chaining. - */ - setOnceReturnValue(value: any): EventEmitter; - } -} diff --git a/types/wolfy87-eventemitter/tsconfig.json b/types/wolfy87-eventemitter/tsconfig.json deleted file mode 100644 index 9ab352c8d4..0000000000 --- a/types/wolfy87-eventemitter/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "wolfy87-eventemitter-tests.ts" - ] -} \ No newline at end of file diff --git a/types/wolfy87-eventemitter/tslint.json b/types/wolfy87-eventemitter/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/wolfy87-eventemitter/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/wolfy87-eventemitter/wolfy87-eventemitter-tests.ts b/types/wolfy87-eventemitter/wolfy87-eventemitter-tests.ts deleted file mode 100644 index b521f773bf..0000000000 --- a/types/wolfy87-eventemitter/wolfy87-eventemitter-tests.ts +++ /dev/null @@ -1,108 +0,0 @@ -import EventEmitter = require("wolfy87-eventemitter"); - -var emitter = new EventEmitter(); - -var listener = function (value: any) { - console.log("The event was raised."); -}; - -function testGetListeners() { - var listeners: Function[] = emitter.getListeners("foo"); - var listenersSearchedByRegexp: {[key:string]: Function} = emitter.getListeners(/^foo/); -} - -function testFlattenListeners() { - var listeners: Function[] = emitter.flattenListeners([{listener: listener}]); -} - -function testGetListenersAsObject() { - emitter.getListenersAsObject("foo"); - emitter.getListenersAsObject(/^foo/); -} - -function testAddListener() { - var e = emitter - .addListener("foo", listener) - .addListener(/^foo/, listener); -} - -function testOn() { - var e = emitter - .on("foo", listener) - .on(/^foo/, listener); -} - -function testAddOnceListener() { - var e = emitter - .addOnceListener("foo", listener) - .addOnceListener(/^foo/, listener); -} - -function testOnce() { - var e = emitter - .once("foo", listener) - .once(/^foo/, listener); -} - -function testDefineEvent() { - var e = emitter.defineEvent("foo"); -} - -function testDefineEvents() { - var e = emitter.defineEvents(["foo", "bar"]); -} - -function testAddListeners() { - var e = emitter - .addListeners("foo", [listener]) - .addListeners({ - "foo": listener, - "bar": [listener] - }); -} - -function testRemoveListeners() { - var e = emitter - .removeListeners("foo", [listener]) - .removeListeners({ - "foo": listener, - "bar": [listener] - }); -} - -function testRemoveListener() { - var e = emitter.removeListener("foo", listener); -} - -function testManipulateListeners() { - var e = emitter - .manipulateListeners(true, "foo", [listener]) - .manipulateListeners(true, { - "foo": listener - }); -} - -function testRemoveEvent() { - var e = emitter.removeEvent("foo").removeEvent(); -} - -function testEmitEvent() { - var e = emitter.emitEvent("foo", ["arg1", "arg2"]).emitEvent("foo"); -} - -function testTrigger() { - var e = emitter.trigger("foo", ["arg1", "arg2"]).trigger("foo"); -} - -function testEmit() { - var e = emitter.emit("foo", ["arg1", "arg2"]).emit("foo"); -} - -function testSetOnceReturnValue() { - var e = emitter.setOnceReturnValue(false); -} - -function testNoConflict() { - var NoConflictEventEmitter = EventEmitter.noConflict(); - var e = new NoConflictEventEmitter(); -} From a75a79482f17cb47a59e15265147745fc03822a4 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:14:43 -0800 Subject: [PATCH 283/890] gulp-tslint: Provides its own types (#22390) --- notNeededPackages.json | 6 ++ types/gulp-tslint/gulp-tslint-tests.ts | 90 -------------------------- types/gulp-tslint/index.d.ts | 48 -------------- types/gulp-tslint/tsconfig.json | 23 ------- types/gulp-tslint/tslint.json | 79 ---------------------- 5 files changed, 6 insertions(+), 240 deletions(-) delete mode 100644 types/gulp-tslint/gulp-tslint-tests.ts delete mode 100644 types/gulp-tslint/index.d.ts delete mode 100644 types/gulp-tslint/tsconfig.json delete mode 100644 types/gulp-tslint/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 19750122cf..c92266c335 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -432,6 +432,12 @@ "sourceRepoURL": "https://github.com/griddlegriddle/griddle", "asOfVersion": "1.3.0" }, + { + "libraryName": "gulp-tslint", + "typingsPackageName": "gulp-tslint", + "sourceRepoURL": "https://github.com/panuhorsmalahti/gulp-tslint", + "asOfVersion": "4.2.0" + }, { "libraryName": "gulp-typescript", "typingsPackageName": "gulp-typescript", diff --git a/types/gulp-tslint/gulp-tslint-tests.ts b/types/gulp-tslint/gulp-tslint-tests.ts deleted file mode 100644 index efadfa9bb1..0000000000 --- a/types/gulp-tslint/gulp-tslint-tests.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as gulp from 'gulp'; -import * as tslint from 'gulp-tslint'; -import vinyl = require('vinyl'); - -// Taken from gulp-tslint README https://github.com/panuhorsmalahti/gulp-tslint/blob/master/README.md - -gulp.task('tslint', function(){ - return gulp.src('source.ts') - .pipe(tslint()) - .pipe(tslint.report('verbose')); -}); - -gulp.task('invalid-noemit', function(){ - return gulp.src('input.ts') - .pipe(tslint()) - .pipe(tslint.report('prose', { - emitError: false - })); -}); - -gulp.task('invalid-noemit', function(){ - return gulp.src('input.ts') - .pipe(tslint()) - .pipe(tslint.report('prose', { - summarizeFailureOutput: true - })); -}); - -/* output is in the following form: - * [{ - * "name": "invalid.ts", - * "failure": "missing whitespace", - * // Lines and characters start from 0 - * "startPosition": {"position": 8, "line": 0, "character": 8}, - * "endPosition": {"position": 9, "line": 0, "character": 9}, - * "ruleName": "one-line" - * }] - */ -const testReporter: tslint.Reporter = function (output, file, options) { - // file is a reference to the vinyl File object - console.log("Found " + output.length + " errors in " + file.path); - // options is a reference to the reporter options, e.g. including the emitError boolean -}; - -gulp.task('invalid-custom', function(){ - return gulp.src('input.ts') - .pipe(tslint()) - .pipe(tslint.report(testReporter)); -}); - -gulp.task('tslint-json', function(){ - return gulp.src('input.ts') - .pipe(tslint({ - configuration: { - rules: { - "class-name": true, - // ... - } - } - })) - .pipe(tslint.report('prose'));; -}); - -gulp.task('tslint', function(){ - return gulp.src(['input.ts',]) - .pipe(tslint()) - .pipe(tslint.report('prose', { - reportLimit: 2 - })); -}); - - -gulp.task('tslint', function(){ - return gulp.src(['input.ts',]) - .pipe(tslint({ - tslint: require('tslint') - })); -}); - -const tslintOptions: tslint.Options = { - configuration: {}, - rulesDirectory: null, - tslint: null -}; - -const reportOptions: tslint.ReportOptions = { - emitError: true, - reportLimit: 0, - summarizeFailureOutput: false -}; diff --git a/types/gulp-tslint/index.d.ts b/types/gulp-tslint/index.d.ts deleted file mode 100644 index b5972dbae7..0000000000 --- a/types/gulp-tslint/index.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Type definitions for gulp-tslint 3.6.0 -// Project: https://github.com/panuhorsmalahti/gulp-tslint -// Definitions by: Asana -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// - -import vinyl = require("vinyl"); - -declare namespace gulpTsLint { - interface GulpTsLint { - (options?: Options): NodeJS.ReadWriteStream; - report(reporter?: Reporter, options?: ReportOptions): NodeJS.ReadWriteStream; - report(options?: ReportOptions): NodeJS.ReadWriteStream; - } - - interface Options { - configuration?: {}, - rulesDirectory?: string, - tslint?: GulpTsLint - } - - interface ReportOptions { - emitError?: boolean, - reportLimit?: number, - summarizeFailureOutput?: boolean - } - - interface Position { - position: number; - line: number; - character: number; - } - - interface Output { - name: string; - failure: string; - startPosition: Position; - endPosition: Position; - ruleName: string; - } - - type Reporter = string | ((output: Output[], file: vinyl, options: ReportOptions) => any); -} - -declare var gulpTsLint: gulpTsLint.GulpTsLint; -export = gulpTsLint; diff --git a/types/gulp-tslint/tsconfig.json b/types/gulp-tslint/tsconfig.json deleted file mode 100644 index 9ffec0b2cc..0000000000 --- a/types/gulp-tslint/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "gulp-tslint-tests.ts" - ] -} \ No newline at end of file diff --git a/types/gulp-tslint/tslint.json b/types/gulp-tslint/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/gulp-tslint/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From f77d579ff7e43552231d4ed781b7d03ee83f10cf Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:14:54 -0800 Subject: [PATCH 284/890] mobile-detect: Provides its own types (#22361) --- notNeededPackages.json | 6 ++ types/mobile-detect/index.d.ts | 23 ------- types/mobile-detect/mobile-detect-tests.ts | 14 ---- types/mobile-detect/tsconfig.json | 24 ------- types/mobile-detect/tslint.json | 79 ---------------------- 5 files changed, 6 insertions(+), 140 deletions(-) delete mode 100644 types/mobile-detect/index.d.ts delete mode 100644 types/mobile-detect/mobile-detect-tests.ts delete mode 100644 types/mobile-detect/tsconfig.json delete mode 100644 types/mobile-detect/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index c92266c335..3fb43da2c0 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -684,6 +684,12 @@ "sourceRepoURL": "https://github.com/marcusdb/microgears", "asOfVersion": "4.0.5" }, + { + "libraryName": "mobile-detect", + "typingsPackageName": "mobile-detect", + "sourceRepoURL": "http://hgoebl.github.io/mobile-detect.js/", + "asOfVersion": "1.3.4" + }, { "libraryName": "mobservable", "typingsPackageName": "mobservable", diff --git a/types/mobile-detect/index.d.ts b/types/mobile-detect/index.d.ts deleted file mode 100644 index 61bde9d853..0000000000 --- a/types/mobile-detect/index.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Type definitions for mobile-detect v1.2.0 -// Project: http://hgoebl.github.io/mobile-detect.js/ -// Definitions by: Martin McWhorter -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare class MobileDetect { - - constructor(userAgent: string, maxPhoneWidth?: number); - - is(key: string): boolean; - match(pattern: string|RegExp): boolean; - mobile(): string; - mobileGrade(): string; - os(): string; - phone(): string; - tablet(): string; - userAgent(): string; - version(value: string): number; - versionStr(value: string): string; -} - -export = MobileDetect; -export as namespace MobileDetect; \ No newline at end of file diff --git a/types/mobile-detect/mobile-detect-tests.ts b/types/mobile-detect/mobile-detect-tests.ts deleted file mode 100644 index 7a3e814612..0000000000 --- a/types/mobile-detect/mobile-detect-tests.ts +++ /dev/null @@ -1,14 +0,0 @@ - - -var md: MobileDetect = new MobileDetect(window.navigator.userAgent); - -var mobie: string = md.mobile() -var phone: string = md.phone() -var tablet: string = md.tablet() -var userAgent: string = md.userAgent() -var os: string = md.os() -var isPhone: boolean = md.is('iPhone') -var bot: boolean = md.is('bot') -var version: number = md.version('Webkit') -var versionStr: string = md.versionStr('Build') -var match: boolean = md.match('playstation|xbox') \ No newline at end of file diff --git a/types/mobile-detect/tsconfig.json b/types/mobile-detect/tsconfig.json deleted file mode 100644 index d728b72f0e..0000000000 --- a/types/mobile-detect/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "mobile-detect-tests.ts" - ] -} \ No newline at end of file diff --git a/types/mobile-detect/tslint.json b/types/mobile-detect/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/mobile-detect/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From fd322cc327bb69f67faf715af331c351f9171a42 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:21:30 -0800 Subject: [PATCH 285/890] react-native-goby: Provides its own types (#22315) --- notNeededPackages.json | 6 + types/react-native-goby/index.d.ts | 410 ------------------ .../react-native-goby-tests.tsx | 23 - types/react-native-goby/tsconfig.json | 24 - types/react-native-goby/tslint.json | 22 - 5 files changed, 6 insertions(+), 479 deletions(-) delete mode 100644 types/react-native-goby/index.d.ts delete mode 100644 types/react-native-goby/react-native-goby-tests.tsx delete mode 100644 types/react-native-goby/tsconfig.json delete mode 100644 types/react-native-goby/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 3fb43da2c0..453801c711 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -894,6 +894,12 @@ "sourceRepoURL": "https://github.com/react-native-training/react-native-elements", "asOfVersion": "0.18.0" }, + { + "libraryName": "react-native-goby", + "typingsPackageName": "react-native-goby", + "sourceRepoURL": "https://gitlab.com/MessageDream/react-native-goby", + "asOfVersion": "0.0.5" + }, { "libraryName": "react-native-google-analytics-bridge", "typingsPackageName": "react-native-google-analytics-bridge", diff --git a/types/react-native-goby/index.d.ts b/types/react-native-goby/index.d.ts deleted file mode 100644 index 08a9b7e3f3..0000000000 --- a/types/react-native-goby/index.d.ts +++ /dev/null @@ -1,410 +0,0 @@ -// Type definitions for react-native-goby 0.04 -// Project: https://gitlab.com/MessageDream/react-native-goby -// Definitions by: jaydenzhao -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -export type DownloadProgressCallback = (progress: DownloadProgress) => void; -export type SyncStatusChangedCallback = (status: Goby.SyncStatus) => void; - -export interface GobyOptions extends SyncOptions { - /** - * Specifies when you would like to synchronize updates with the Goby server. - * Defaults to goby.CheckFrequency.ON_APP_START. - */ - checkFrequency: Goby.CheckFrequency; -} - -export interface DownloadProgress { - /** - * The total number of bytes expected to be received for this update. - */ - totalBytes: number; - - /** - * The number of bytes downloaded thus far. - */ - receivedBytes: number; -} - -export interface LocalPackage extends Package { - /** - * Installs the update by saving it to the location on disk where the runtime expects to find the latest version of the app. - * - * @param installMode Indicates when you would like the update changes to take affect for the end-user. - * @param minimumBackgroundDuration For resume-based installs, this specifies the number of seconds the app needs to be in the background before forcing a restart. Defaults to 0 if unspecified. - */ - install(installMode: Goby.InstallMode, minimumBackgroundDuration?: number): Promise; -} - -export interface Package { - /** - * The app binary version that this update is dependent on. This is the value that was - * specified via the appStoreVersion parameter when calling the CLI's release command. - */ - appVersion: string; - - /** - * The deployment key that was used to originally download this update. - */ - deploymentKey: string; - - /** - * The description of the update. This is the same value that you specified in the CLI when you released the update. - */ - description: string; - - /** - * Indicates whether this update has been previously installed but was rolled back. - */ - failedInstall: boolean; - - /** - * Indicates whether this is the first time the update has been run after being installed. - */ - isFirstRun: boolean; - - /** - * Indicates whether the update is considered mandatory. This is the value that was specified in the CLI when the update was released. - */ - isMandatory: boolean; - - /** - * Indicates whether this update is in a "pending" state. When true, that means the update has been downloaded and installed, but the app restart - * needed to apply it hasn't occurred yet, and therefore, its changes aren't currently visible to the end-user. - */ - isPending: boolean; - - /** - * The internal label automatically given to the update by the Goby server. This value uniquely identifies the update within its deployment. - */ - label: string; - - /** - * The SHA hash value of the update. - */ - packageHash: string; - - /** - * The size of the code contained within the update, in bytes. - */ - packageSize: number; -} - -export interface RemotePackage extends Package { - /** - * Downloads the available update from the Goby service. - * - * @param downloadProgressCallback An optional callback that allows tracking the progress of the update while it is being downloaded. - */ - download(downloadProgressCallback?: DownloadProgressCallback): Promise; - - /** - * The URL at which the package is available for download. - */ - downloadUrl: string; -} - -export interface SyncOptions { - /** - * Specifies the deployment key you want to query for an update against. By default, this value is derived from the Info.plist - * file (iOS) and MainActivity.java file (Android), but this option allows you to override it from the script-side if you need to - * dynamically use a different deployment for a specific call to sync. - */ - deploymentKey?: string; - - /** - * Specifies when you would like to install optional updates (i.e. those that aren't marked as mandatory). - * Defaults to goby.InstallMode.ON_NEXT_RESTART. - */ - installMode?: Goby.InstallMode; - - /** - * Specifies when you would like to install updates which are marked as mandatory. - * Defaults to goby.InstallMode.IMMEDIATE. - */ - mandatoryInstallMode?: Goby.InstallMode; - - /** - * Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property - * only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME`, and can be useful for getting your update in front - * of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying the update immediately after a - * resume, regardless how long it was in the background. - */ - minimumBackgroundDuration?: number; - - /** - * An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available, - * and if so, what strings to use. Defaults to null, which has the effect of disabling the dialog completely. Setting this to any truthy - * value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as - * overriding one or more of the default strings. - */ - updateDialog?: boolean | UpdateDialog; -} - -export interface UpdateDialog { - /** - * Indicates whether you would like to append the description of an available release to the - * notification message which is displayed to the end user. Defaults to false. - */ - appendReleaseDescription?: boolean; - - /** - * Indicates the string you would like to prefix the release description with, if any, when - * displaying the update notification to the end user. Defaults to " Description: " - */ - descriptionPrefix?: string; - - /** - * The text to use for the button the end user must press in order to install a mandatory update. Defaults to "Continue". - */ - mandatoryContinueButtonLabel?: string; - - /** - * The text used as the body of an update notification, when the update is specified as mandatory. - * Defaults to "An update is available that must be installed.". - */ - mandatoryUpdateMessage?: string; - - /** - * The text to use for the button the end user can press in order to ignore an optional update that is available. Defaults to "Ignore". - */ - optionalIgnoreButtonLabel?: string; - - /** - * The text to use for the button the end user can press in order to install an optional update. Defaults to "Install". - */ - optionalInstallButtonLabel?: string; - - /** - * The text used as the body of an update notification, when the update is optional. Defaults to "An update is available. Would you like to install it?". - */ - optionalUpdateMessage?: string; - - /** - * The text used as the header of an update notification that is displayed to the end user. Defaults to "Update available". - */ - title?: string; -} - -export interface StatusReport { - /** - * Whether the deployment succeeded or failed. - */ - status: Goby.DeploymentStatus; - - /** - * The version of the app that was deployed (for a native app upgrade). - */ - appVersion?: string; - - /** - * Details of the package that was deployed (or attempted to). - */ - package?: Package; - - /** - * Deployment key used when deploying the previous package. - */ - previousDeploymentKey?: string; - - /** - * The label (v#) of the package that was upgraded from. - */ - previousLabelOrAppVersion?: string; -} - -/** - * Decorates a React Component configuring it to sync for updates with the Goby server. - * - * @param options Options used to configure the end-user sync and update experience (e.g. when to check for updates?, show an prompt?, install the update immediately?). - */ -declare function Goby(options?: GobyOptions): Function; - -declare namespace Goby { - /** - * Represents the default settings that will be used by the sync method if - * an update dialog is configured to be displayed. - */ - const DEFAULT_UPDATE_DIALOG: UpdateDialog; - - /** - * Asks the Goby service whether the configured app deployment has an update available. - * - * @param deploymentKey The deployment key to use to query the Goby server for an update. - */ - function checkForUpdate(deploymentKey?: string): Promise; - - /** - * Retrieves the metadata for an installed update (e.g. description, mandatory). - * - * @param updateState The state of the update you want to retrieve the metadata for. Defaults to UpdateState.RUNNING. - */ - function getUpdateMetadata(updateState?: UpdateState): Promise; - - /** - * Notifies the Goby runtime that an installed update is considered successful. - */ - function notifyAppReady(): Promise; - - /** - * Allow Goby to restart the app. - */ - function allowRestart(): void; - - /** - * Forbid Goby to restart the app. - */ - function disallowRestart(): void; - - /** - * Immediately restarts the app. - * - * @param onlyIfUpdateIsPending Indicates whether you want the restart to no-op if there isn't currently a pending update. - */ - function restartApp(onlyIfUpdateIsPending?: boolean): void; - - /** - * Allows checking for an update, downloading it and installing it, all with a single call. - * - * @param options Options used to configure the end-user update experience (e.g. show an prompt?, install the update immediately?). - * @param syncStatusChangedCallback An optional callback that allows tracking the status of the sync operation, as opposed to simply checking the resolved state via the returned Promise. - * @param downloadProgressCallback An optional callback that allows tracking the progress of an update while it is being downloaded. - */ - function sync(options?: SyncOptions, syncStatusChangedCallback?: SyncStatusChangedCallback, downloadProgressCallback?: DownloadProgressCallback): Promise; - - /** - * Indicates when you would like an installed update to actually be applied. - */ - enum InstallMode { - /** - * Indicates that you want to install the update and restart the app immediately. - */ - IMMEDIATE, - - /** - * Indicates that you want to install the update, but not forcibly restart the app. - */ - ON_NEXT_RESTART, - - /** - * Indicates that you want to install the update, but don't want to restart the - * app until the next time the end user resumes it from the background. - */ - ON_NEXT_RESUME - } - - /** - * Indicates the current status of a sync operation. - */ - enum SyncStatus { - /** - * The Goby server is being queried for an update. - */ - CHECKING_FOR_UPDATE, - - /** - * An update is available, and a confirmation dialog was shown - * to the end user. (This is only applicable when the updateDialog is used) - */ - AWAITING_USER_ACTION, - - /** - * An available update is being downloaded from the Goby server. - */ - DOWNLOADING_PACKAGE, - - /** - * An available update was downloaded and is about to be installed. - */ - INSTALLING_UPDATE, - - /** - * The app is up-to-date with the Goby server. - */ - UP_TO_DATE, - - /** - * The app had an optional update which the end user chose to ignore. - * (This is only applicable when the updateDialog is used) - */ - UPDATE_IGNORED, - - /** - * An available update has been installed and will be run either immediately after the - * syncStatusChangedCallback function returns or the next time the app resumes/restarts, - * depending on the InstallMode specified in SyncOptions - */ - UPDATE_INSTALLED, - - /** - * There is an ongoing sync operation running which prevents the current call from being executed. - */ - SYNC_IN_PROGRESS, - - /** - * The sync operation encountered an unknown error. - */ - UNKNOWN_ERROR - } - - /** - * Indicates the state that an update is currently in. - */ - enum UpdateState { - /** - * Indicates that an update represents the - * version of the app that is currently running. - */ - RUNNING, - - /** - * Indicates than an update has been installed, but the - * app hasn't been restarted yet in order to apply it. - */ - PENDING, - - /** - * Indicates than an update represents the latest available - * release, and can be either currently running or pending. - */ - LATEST - } - - /** - * Indicates the status of a deployment (after installing and restarting). - */ - enum DeploymentStatus { - /** - * The deployment failed (and was rolled back). - */ - FAILED, - - /** - * The deployment succeeded. - */ - SUCCEEDED - } - - /** - * Indicates when you would like to check for (and install) updates from the Goby server. - */ - enum CheckFrequency { - /** - * When the app is fully initialized (or more specifically, when the root component is mounted). - */ - ON_APP_START, - - /** - * When the app re-enters the foreground. - */ - ON_APP_RESUME, - - /** - * Don't automatically check for updates, but only do it when goby.sync() is manully called inside app code. - */ - MANUAL - } -} - -export default Goby; diff --git a/types/react-native-goby/react-native-goby-tests.tsx b/types/react-native-goby/react-native-goby-tests.tsx deleted file mode 100644 index a72cf0ecf7..0000000000 --- a/types/react-native-goby/react-native-goby-tests.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import * as React from 'react'; - -import { - View, - AppRegistry -} from 'react-native'; - -import Goby from "react-native-goby"; - -class Home extends React.Component { - render() { - return ( - - ); - } -} - - -AppRegistry.registerComponent('home', () => Goby({ - updateDialog: false, - checkFrequency: Goby.CheckFrequency.ON_APP_RESUME, - installMode: Goby.InstallMode.IMMEDIATE -})(Home)); diff --git a/types/react-native-goby/tsconfig.json b/types/react-native-goby/tsconfig.json deleted file mode 100644 index 0c0b3ab77c..0000000000 --- a/types/react-native-goby/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "jsx": "react", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "react-native-goby-tests.tsx" - ] -} \ No newline at end of file diff --git a/types/react-native-goby/tslint.json b/types/react-native-goby/tslint.json deleted file mode 100644 index d774391cd1..0000000000 --- a/types/react-native-goby/tslint.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // Lowercase `object` is available in TypeScript 2.2 only. - "ban-types": false, - // Below are all TODO - "align": false, - "array-type": false, - "comment-format": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "no-misused-new": false, - "no-consecutive-blank-lines": false, - "no-empty-interface": false, - "no-padding": false, - "no-var": false, - "prefer-declare-function": false, - "prefer-method-signature": false, - "semicolon": false, - "strict-export-declare-modifiers": false - } -} From 063b2152a737cd83ece590ede9a656dd1a63139f Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:21:44 -0800 Subject: [PATCH 286/890] jodata: Provides its own types (#22317) --- notNeededPackages.json | 6 + types/jodata/index.d.ts | 229 ----------------------------------- types/jodata/jodata-tests.ts | 192 ----------------------------- types/jodata/tsconfig.json | 23 ---- types/jodata/tslint.json | 79 ------------ 5 files changed, 6 insertions(+), 523 deletions(-) delete mode 100644 types/jodata/index.d.ts delete mode 100644 types/jodata/jodata-tests.ts delete mode 100644 types/jodata/tsconfig.json delete mode 100644 types/jodata/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 453801c711..032eb2a2b7 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -528,6 +528,12 @@ "sourceRepoURL": "https://github.com/oliver-moran/jimp#readme", "asOfVersion": "0.2.28" }, + { + "libraryName": "joData", + "typingsPackageName": "jodata", + "sourceRepoURL": "https://github.com/mccow002/joData", + "asOfVersion": "1.0.13" + }, { "libraryName": "jpush-react-native", "typingsPackageName": "jpush-react-native", diff --git a/types/jodata/index.d.ts b/types/jodata/index.d.ts deleted file mode 100644 index 1aa54980fe..0000000000 --- a/types/jodata/index.d.ts +++ /dev/null @@ -1,229 +0,0 @@ -// Type definitions for joData v1.1 -// Project: https://github.com/mccow002/joData -// Definitions by: Chris Wrench -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare class jo -{ - constructor(baseUri: string); - - baseUri: string; - ExpandSettings: jo.ExpandSettings; - FilterSettings: jo.InlineCountSettings; - FormatSettings: jo.FormatSettings; - InlineCountSettings: jo.InlineCountSettings; - OrderBySettings: jo.OrderBySettings; - SelectSettings: jo.SelectSettings; - SkipSettings: jo.SkipSettings; - TopSettings: jo.TopSettings; - - currentHashRoute: string; - updateHashRoute: (hashRoute: string) => void; - - // Order by - setOrderByDefault(property: string, order?: string): jo; - toggleOrderBy(property: string, callback?: Function): jo; - orderBy(property: string): jo; - desc(): jo; - asc(): jo; - resetOrderBy(): jo; - - // Top - setTopDefault(top: number): jo; - top(top: number): jo; - resetTop(): jo; - - // Skip - setSkipDefault(skip: number): jo; - skip(skip: number): jo; - resetSkip(): jo; - - // Select - setSelectDefault(select: string[]): jo; - select(select: string[]): jo; - resetSelect(): jo; - - // Expand - setExpandDefault(expand: string): jo; - expand(expand: string): jo; - resetExpand(): jo; - - // Format - format(): jo.FormatOptions; - formatDefault(): jo.FormatOptions; - resetFormat(): void; - - // Inline count - inlineCount(): jo.InlineCountOptions; - inlineCountDefault(): jo.InlineCountOptions; - resetInlineCount(): void; - - // Filter - filter(filterClause: jo.FilterClause|jo.PrecedenceGroup): jo; - andFilter(filterClause: jo.FilterClause|jo.PrecedenceGroup): jo; - orFilter(filterClause: jo.FilterClause|jo.PrecedenceGroup): jo; - removeFilter(property: string): jo; - captureFilter(): void; - resetFilter(): jo; - resetToCapturedFilter(): jo; - defaultFilter(filterClause: jo.FilterClause): jo; - defaultAndFilter(filterClause: jo.FilterClause): jo; - defaultOrFilter(filterClause: jo.FilterClause): jo; - - // Casts - static literal: (stringLiteral: string) => string; - static datetime: (stringLiteral: string) => string; - static guid: (stringLiteral: string) => string; - static decimal: (stringLiteral: number) => string; - static double: (stringLiteral: number) => string; - static single: (stringLiteral: number) => string; - - toString: () => string; - toJson: () => string; - saveLocal: (key?: string) => void; - - static loadLocal: (key?: string) => jo; -} - -declare namespace jo { - interface FormatOptions { - atom(): jo; - custom(value: string): jo; - json(): jo; - xml(): jo; - } - - interface InlineCountOptions { - allPages(): jo; - none(): jo; - } - - export class FilterClause { - constructor(); - constructor(property: string); - - toString(): string; - isEmpty(): Boolean; - - Property: string; - Components: string[]; - IsClauseEmpty: Boolean; - PropertyIncluded: Boolean; - UsingNot: Boolean; - Value: any; - FuncReturnType: any; - transformFunc: Function; - - // Logical operators - eq(value: string|number|boolean): jo.FilterClause; - ne(value: string|number|boolean): jo.FilterClause; - gt(value: string|number|boolean): jo.FilterClause; - ge(value: string|number|boolean): jo.FilterClause; - lt(value: string|number|boolean): jo.FilterClause; - le(value: string|number|boolean): jo.FilterClause; - not(): jo.FilterClause; - - // Arithmetic methods - add(amount: number): jo.FilterClause; - sub(amount: number): jo.FilterClause; - mul(amount: number): jo.FilterClause; - div(amount: number): jo.FilterClause; - mod(amount: number): jo.FilterClause; - - // String functions - substringof(value: string): jo.FilterClause; - substring(position: number, length?: number): jo.FilterClause; - toLower(): jo.FilterClause; - toUpper(): jo.FilterClause; - trim(): jo.FilterClause; - endswith(value: string): jo.FilterClause; - startswith(value: string): jo.FilterClause; - length(): jo.FilterClause; - indexof(value: string): jo.FilterClause; - replace(find: string, replace: string): jo.FilterClause; - - // Concat - Concat(concat: jo.Concat): jo.FilterClause; - - // Date functions - day(): jo.FilterClause; - hour(): jo.FilterClause; - minute(): jo.FilterClause; - month(): jo.FilterClause; - second(): jo.FilterClause; - year(): jo.FilterClause; - - // Math functions - round(): jo.FilterClause; - floor(): jo.FilterClause; - ceiling() : jo.FilterClause; - } - - // Precedence groups - export class PrecedenceGroup { - constructor(filterClause: jo.FilterClause) - andFilter(filterClause: jo.FilterClause): jo.FilterClause; - orFilter(filterClause: jo.FilterClause): jo.FilterClause; - } - - // Concat - export class Concat { - constructor(value1: string|jo.Concat, value2: string|jo.Concat) - LeftSide: string|jo.Concat; - RightSide: string|jo.Concat; - toString(): string; - } - - // TODO What is the most appropriate place for these interfaces? - // They are only required by the `jo` class. - interface ISettings { - toString: () => string; - reset: () => void; - isSet: () => Boolean; - } - - interface OrderBySettings extends ISettings { - Property: string; - Order: string; - DefaultProperty:string; - DefaultOrder: string; - } - - interface TopSettings extends ISettings { - Top: number; - DefaultTop: number; - } - - interface SkipSettings extends ISettings { - Skip: number; - DefaultSkip: number; - } - - interface SelectSettings extends ISettings { - Select: string[]; - DefaultSelect: string[]; - } - - interface ExpandSettings extends ISettings { - Expand: string; - DefaultExpand: string; - } - - interface FormatSettings extends ISettings { - Format: string; - DefaultFormat: string; - } - - interface InlineCountSettings extends ISettings { - InlineCount: string; - DefaultInlineCount: string; - } - - interface FilterSettings extends ISettings { - Filters: FilterClause[]; - DefaultFilters: FilterClause[]; - CapturedFilter: FilterClause[]; - fullReset: () => void; - loadFromJson: (filterSettings: any) => void; - } -} diff --git a/types/jodata/jodata-tests.ts b/types/jodata/jodata-tests.ts deleted file mode 100644 index 3327a23603..0000000000 --- a/types/jodata/jodata-tests.ts +++ /dev/null @@ -1,192 +0,0 @@ - - -var query = new jo('http://test.com'); - -// Base URI -query.baseUri; - -// To string -query.toString(); - -// Order by -query.orderBy('PropertyName'); -query.orderBy('PropertyName').asc(); -query.orderBy('PropertyName').desc(); -query.orderBy('PropertyName').asc().desc(); -query.resetOrderBy(); -query.setOrderByDefault('PropertyName'); -query.toggleOrderBy('CustomerId'); // TODO Example with callback. - -query - .setOrderByDefault('p1', 'desc') - .orderBy('p2') - .asc(); - -// Top -query.top(10); -query.resetTop(); -query.setTopDefault(5); -query - .setTopDefault(5) - .top(10); - -// Skip -query.skip(5); -query.resetSkip(); -query.setSkipDefault(5); -query - .setSkipDefault(5) - .skip(10); - -// Select -query.select(['Property1', 'Property2']); -query.resetSelect(); -query.setSelectDefault(['CustomerId', 'CustomerName']); -query - .setSelectDefault(['CustomerId', 'CustomerName']) - .select(['CustomerId', 'CustomerName', 'Address']); - -// Expand -query.expand('Customer'); -query.resetExpand(); -query.setExpandDefault('Customer'); -query - .setExpandDefault('Customer') - .expand('Product'); - -// Format -query.format().atom(); -query.format().xml(); -query.format().json(); -query.format().custom('text/csv'); - -query.formatDefault().atom(); - -query - .formatDefault() - .atom() - .format() - .json(); - -query.resetFormat(); - -// Inlinecount -query.inlineCount().allPages(); -query.inlineCount().none(); - -query.inlineCountDefault().allPages(); - -query - .inlineCountDefault() - .allPages() - .inlineCount() - .none(); - -query.resetInlineCount(); - -// Filter -var clause = new jo.FilterClause('PropertyName'); -clause.eq(5); -query.filter(clause); - -query - .andFilter(new jo.FilterClause('Property1').eq(5)) - .andFilter(new jo.FilterClause('Property2').eq(10)); - -query - .orFilter(new jo.FilterClause('Property1').eq(5)) - .orFilter(new jo.FilterClause('Property2').eq(10)); - -query - .filter(new jo.FilterClause('p1').eq(1)) - .andFilter(new jo.FilterClause('p2').eq(5)) - .orFilter(new jo.FilterClause('p3').eq(10)); - -query.removeFilter('CustomerName'); - -var clause = new jo.FilterClause('CustomerId'); -clause.isEmpty(); - -var clause = new jo.FilterClause('CustomerId').eq(1); -clause.isEmpty(); - -query.andFilter(new jo.FilterClause('Status').eq('Pending')); -query.captureFilter(); -query.resetToCapturedFilter(); -query.resetFilter(); - -// Casts -query.filter(new jo.FilterClause('DateAdded').eq(jo.datetime('2013-03-01'))); -query.filter(new jo.FilterClause('CustomerId').eq(jo.guid('3F2504E0-4F89-11D3-9A0C-0305E82C3301'))); -query.filter(new jo.FilterClause('Price').eq(jo.decimal(24.97))); -query.filter(new jo.FilterClause('Price').eq(jo.single(24.97))); -query.filter(new jo.FilterClause('Price').eq(jo.double(24.97))); - -// Logical Operators -query.filter(new jo.FilterClause('PropertyName').eq('test')); -query.filter(new jo.FilterClause('PropertyName').eq(10)); -query.filter(new jo.FilterClause('CustomerName').not().eq('bob')); -query.filter(new jo.FilterClause('CustomerName').not().endswith('bob')); - -// Precedence Groups -var group = new jo.PrecedenceGroup(new jo.FilterClause('Name').eq('Bob')); -query.filter(group); - -var group2 = new jo.PrecedenceGroup(new jo.FilterClause('Name').eq('Bob')).orFilter(new jo.FilterClause('Name').eq('George')); -query.filter(group2); - -query - .filter(new jo.FilterClause('Id').eq(1)) - .andFilter(new jo.PrecedenceGroup(new jo.FilterClause('Name').startswith('a').eq(true)) - .orFilter(new jo.FilterClause('Name').startswith('b').eq(true))); - -// Setting filter defaults -query.defaultFilter(new jo.FilterClause('Id').eq(1)); -query - .defaultFilter(new jo.FilterClause('Id').eq(1)) - .filter(new jo.FilterClause('Name').eq('bob')); -query - .defaultFilter(new jo.FilterClause('Id').eq(1)) - .filter(new jo.FilterClause('Name').eq('bob')); -query.resetFilter(); - -// Arithmetic Methods -query.filter(new jo.FilterClause('PropertyName').add(5).eq(10)); - -// String Functions -query.filter(new jo.FilterClause('PropertyName').substringof('test').eq(true)); -query.filter(new jo.FilterClause('PropertyName').toLower().substringof('test').eq(true)); -query.filter(new jo.FilterClause('PropertyName').endswith('test').eq(true)); -query.filter(new jo.FilterClause('PropertyName').startswith('test').eq(true)); -query.filter(new jo.FilterClause('PropertyName').length().eq(10)); -query.filter(new jo.FilterClause('PropertyName').indexof('test').eq(1)); -query.filter(new jo.FilterClause('PropertyName').replace('test', 'bob').eq('bob')); -query.filter(new jo.FilterClause('PropertyName').substring(1).eq('test')); -query.filter(new jo.FilterClause('PropertyName').substring(1,2).eq('test')); -query.filter(new jo.FilterClause('PropertyName').toLower().eq('test')); -query.filter(new jo.FilterClause('PropertyName').toUpper().eq('TEST')); -query.filter(new jo.FilterClause('PropertyName').trim().eq('test')); - -// Concat -query.filter(new jo.FilterClause().Concat(new jo.Concat('FirstName', 'LastName')).eq('BobSmith')); -query.filter(new jo.FilterClause().Concat(new jo.Concat(new jo.Concat('City', jo.literal(', ')), 'State')).eq('Birmingham, Alabama')); - -// Date Functions -query.filter(new jo.FilterClause('Birthday').day().eq(2)); -query.filter(new jo.FilterClause('Birthday').hour().eq(2)); -query.filter(new jo.FilterClause('Birthday').minute().eq(2)); -query.filter(new jo.FilterClause('Birthday').month().eq(2)); -query.filter(new jo.FilterClause('Birthday').second().eq(2)); -query.filter(new jo.FilterClause('Birthday').year().eq(2)); - -// Math Functions -query.filter(new jo.FilterClause('Price').round().eq(2)); -query.filter(new jo.FilterClause('Price').floor().eq(2)); -query.filter(new jo.FilterClause('Price').ceiling().eq(2)); - -// Saving Local -query.saveLocal(); -jo.loadLocal(); - -query.saveLocal("key"); -jo.loadLocal("key"); \ No newline at end of file diff --git a/types/jodata/tsconfig.json b/types/jodata/tsconfig.json deleted file mode 100644 index be177ebe58..0000000000 --- a/types/jodata/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "jodata-tests.ts" - ] -} \ No newline at end of file diff --git a/types/jodata/tslint.json b/types/jodata/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/jodata/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From b33e569877e55ed3642321d922135db869f0591c Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:23:06 -0800 Subject: [PATCH 287/890] perfect-scrollbar: Provides its own types (#22326) --- notNeededPackages.json | 6 + types/perfect-scrollbar/index.d.ts | 197 ------------------ .../perfect-scrollbar-tests.ts | 40 ---- types/perfect-scrollbar/tsconfig.json | 24 --- types/perfect-scrollbar/tslint.json | 79 ------- 5 files changed, 6 insertions(+), 340 deletions(-) delete mode 100644 types/perfect-scrollbar/index.d.ts delete mode 100644 types/perfect-scrollbar/perfect-scrollbar-tests.ts delete mode 100644 types/perfect-scrollbar/tsconfig.json delete mode 100644 types/perfect-scrollbar/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 032eb2a2b7..f2710b8e9b 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -780,6 +780,12 @@ "sourceRepoURL": "https://github.com/pillarjs/path-to-regexp", "asOfVersion": "1.7.0" }, + { + "libraryName": "perfect-scrollbar", + "typingsPackageName": "perfect-scrollbar", + "sourceRepoURL": "https://github.com/noraesae/perfect-scrollbar", + "asOfVersion": "1.3.0" + }, { "libraryName": "pg-connection-string", "typingsPackageName": "pg-connection-string", diff --git a/types/perfect-scrollbar/index.d.ts b/types/perfect-scrollbar/index.d.ts deleted file mode 100644 index 61d76e6ed4..0000000000 --- a/types/perfect-scrollbar/index.d.ts +++ /dev/null @@ -1,197 +0,0 @@ -// Type definitions for perfect-scrollbar v0.7.1 -// Project: https://github.com/noraesae/perfect-scrollbar -// Definitions by: Kombu -// Cyrus -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -interface HTMLElementEventMap { - /** - * This event fires when the y-axis is scrolled in either direction. - */ - 'ps-scroll-y': CustomEvent, - /** - * This event fires when the x-axis is scrolled in either direction. - */ - 'ps-scroll-x': CustomEvent, - /** - * This event fires when scrolling upwards. - */ - 'ps-scroll-up': CustomEvent, - /** - * This event fires when scrolling downwards. - */ - 'ps-scroll-down': CustomEvent, - /** - * This event fires when scrolling to the left. - */ - 'ps-scroll-left': CustomEvent, - /** - * This event fires when scrolling to the right. - */ - 'ps-scroll-right': CustomEvent, - /** - * This event fires when scrolling reaches the start of the y-axis. - */ - 'ps-y-reach-start': CustomEvent, - /** - * This event fires when scrolling reaches the end of the y-axis (useful for infinite scroll). - */ - 'ps-y-reach-end': CustomEvent, - /** - * This event fires when scrolling reaches the start of the x-axis. - */ - 'ps-x-reach-start': CustomEvent, - /** - * This event fires when scrolling reaches the end of the x-axis. - */ - 'ps-x-reach-end': CustomEvent -} - -/** - * @see https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/plugin/default-setting.js#L3 - * @see https://github.com/noraesae/perfect-scrollbar#optional-parameters - */ -interface PerfectScrollbarSettings { - - /** - * It is a list of handlers to use to scroll the element. - * @see https://github.com/noraesae/perfect-scrollbar#handlers - * @see https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/plugin/initialize.js#L9 - * @default ['click-rail', 'drag-scrollbar', 'keyboard', 'wheel', 'touch'] - */ - handlers?: ('click-rail' | - 'drag-scrollbar' | - 'keyboard' | - 'wheel' | - 'touch' | - 'selection')[]; - - /** - * When set to an integer value, the thumb part of the scrollbar will not expand over that number of pixels. - * @see https://github.com/noraesae/perfect-scrollbar#maxscrollbarlength - * @default null - */ - maxScrollbarLength?: number; - - /** - * When set to an integer value, the thumb part of the scrollbar will not shrink below that number of pixels. - * @see https://github.com/noraesae/perfect-scrollbar#minscrollbarlength - * @default null - */ - minScrollbarLength?: number; - - /** - * The number of pixels the content width can surpass the container width without enabling the X axis scroll bar. - * Allows some "wiggle room" or "offset break", so that X axis scroll bar is not enabled just because of a few pixels. - * @see https://github.com/noraesae/perfect-scrollbar#scrollxmarginoffset - * @default 0 - */ - scrollXMarginOffset?: number; - - /** - * The number of pixels the content height can surpass the container height without enabling the Y axis scroll bar. - * Allows some "wiggle room" or "offset break", so that Y axis scroll bar is not enabled just because of a few pixels. - * @see https://github.com/noraesae/perfect-scrollbar#scrollymarginoffset - * @default 0 - */ - scrollYMarginOffset?: number; - - /** - * When set to true, the scroll bar in X axis will not be available, regardless of the content width. - * @see https://github.com/noraesae/perfect-scrollbar#suppressscrollx - * @default false - */ - suppressScrollX?: boolean; - - /** - * When set to true, the scroll bar in Y axis will not be available, regardless of the content height. - * @see https://github.com/noraesae/perfect-scrollbar#suppressscrolly - * @default false - */ - suppressScrollY?: boolean; - - /** - * If this option is true, when the scroll reaches the end of the side, touch scrolling will be propagated to parent element. - * @see https://github.com/noraesae/perfect-scrollbar#swipepropagation - * @default true - */ - swipePropagation?: boolean; - - /** - * If this option is true, swipe scrolling will be eased. - * @see https://github.com/noraesae/perfect-scrollbar#swipeeasing - * @default true - */ - swipeEasing?:boolean; - - /** - * When set to true, and only one (vertical or horizontal) scrollbar is visible then both vertical and horizontal scrolling will affect the scrollbar. - * @see https://github.com/noraesae/perfect-scrollbar#usebothwheelaxes - * @default false - */ - useBothWheelAxes?: boolean; - - /** - * If this option is true, when the scroll reaches the end of the side, mousewheel event will be propagated to parent element. - * @see https://github.com/noraesae/perfect-scrollbar#wheelpropagation - * @default false - */ - wheelPropagation?: boolean; - - /** - * The scroll speed applied to mousewheel event. - * @see https://github.com/noraesae/perfect-scrollbar#wheelspeed - * @default 1 - */ - wheelSpeed?: number; - - /** - * A string. - * It's a class name added to the container element. - * The class name is prepended with `ps-theme-`. - * So default theme class name is `ps-theme-default`. - * In order to create custom themes with scss use `ps-container($theme)` mixin, where `$theme` is a scss map. - * @see https://github.com/noraesae/perfect-scrollbar#theme - * @default 'default' - */ - theme?: string; -} - -interface PerfectScrollbar { - /** - * @see https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/plugin/initialize.js#L19 - */ - initialize(element: HTMLElement, settings?: PerfectScrollbarSettings): void; - - /** - * @see https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/plugin/update.js#L9 - */ - update(element: HTMLElement): void; - - /** - * @see https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/plugin/destroy.js#L7 - */ - destroy(element: HTMLElement): void; -} - -declare const Ps: PerfectScrollbar; - -declare module 'perfect-scrollbar' { - export = Ps; -} - -interface JQuery { - - /** - * @see https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/adaptor/jquery.js#L6 - */ - perfectScrollbar(settingOrCommand?: PerfectScrollbarSettings | 'update' | 'destroy'): JQuery; -} - -declare module 'perfect-scrollbar/jquery' { - function mountJQuery(jQuery: JQueryStatic): void; - export = mountJQuery; -} diff --git a/types/perfect-scrollbar/perfect-scrollbar-tests.ts b/types/perfect-scrollbar/perfect-scrollbar-tests.ts deleted file mode 100644 index 4ba80d1294..0000000000 --- a/types/perfect-scrollbar/perfect-scrollbar-tests.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * https://github.com/noraesae/perfect-scrollbar#how-to-use - */ - -import * as Ps from 'perfect-scrollbar' -const container = document.body - -// To initialise the plugin, `Ps.initialize` is used. -Ps.initialize(container) - -// It can be initialised with optional parameters. -Ps.initialize(container, { - wheelSpeed: 2, - wheelPropagation: true, - minScrollbarLength: 20 -}) - -// If the size of your container or content changes, call `update`. -Ps.update(container) - -// If you want to destroy the scrollbar, use `destroy`. -Ps.destroy(container) - -// If you want to scroll to somewhere, just use a `scrollTop` property and update. -container.scrollTop = 0 -Ps.update(container) - -/** - * https://github.com/noraesae/perfect-scrollbar#jquery - */ - -import mountJQuery = require('perfect-scrollbar/jquery') -mountJQuery($) - -$('#container').perfectScrollbar() // Initialize -$('#container').perfectScrollbar({ /*...*/ }) // with options -$('#container').perfectScrollbar('update') // Update -$('#container').perfectScrollbar('destroy') // Destroy - -container.addEventListener('ps-x-reach-start', () => { }); diff --git a/types/perfect-scrollbar/tsconfig.json b/types/perfect-scrollbar/tsconfig.json deleted file mode 100644 index a3bd2529c9..0000000000 --- a/types/perfect-scrollbar/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "perfect-scrollbar-tests.ts" - ] -} \ No newline at end of file diff --git a/types/perfect-scrollbar/tslint.json b/types/perfect-scrollbar/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/perfect-scrollbar/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 314f649d8641f4c15b46e099b1a5409b2a3b32be Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:23:23 -0800 Subject: [PATCH 288/890] react-native-modal: Provides its own types (#22327) --- notNeededPackages.json | 6 + types/react-native-modal/index.d.ts | 221 ------------------ .../react-native-modal-tests.tsx | 43 ---- types/react-native-modal/tsconfig.json | 24 -- types/react-native-modal/tslint.json | 1 - 5 files changed, 6 insertions(+), 289 deletions(-) delete mode 100644 types/react-native-modal/index.d.ts delete mode 100644 types/react-native-modal/react-native-modal-tests.tsx delete mode 100644 types/react-native-modal/tsconfig.json delete mode 100644 types/react-native-modal/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index f2710b8e9b..c078a0adde 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -918,6 +918,12 @@ "sourceRepoURL": "https://github.com/idehub/react-native-google-analytics-bridge", "asOfVersion": "5.3.3" }, + { + "libraryName": "react-native-modal", + "typingsPackageName": "react-native-modal", + "sourceRepoURL": "https://github.com/react-native-community/react-native-modal", + "asOfVersion": "4.1.1" + }, { "libraryName": "react-split-pane", "typingsPackageName": "react-split-pane", diff --git a/types/react-native-modal/index.d.ts b/types/react-native-modal/index.d.ts deleted file mode 100644 index 979efc3578..0000000000 --- a/types/react-native-modal/index.d.ts +++ /dev/null @@ -1,221 +0,0 @@ -// Type definitions for react-native-modal 3.1 -// Project: https://github.com/react-native-community/react-native-modal -// Definitions by: Ifiok Jr. -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import { ComponentClass, ReactNode } from 'react'; -import { ViewStyle } from 'react-native'; -export interface ReactNativeModalProps { - /** - * Modal show animation - * - * @default 'slideInUp' - */ - animationIn?: SlidingEntrances | string; - - /** - * Timing for the modal show animation (in ms) - * - * @default 300 - */ - animationInTiming?: number; - - /** - * Modal hide animation - * - * @default 'slideOutDown' - */ - animationOut?: SlidingExits | string; - - /** - * Timing for the modal hide animation (in ms) - * - * @default 300 - */ - animationOutTiming?: number; - - /** - * Move the modal up if the keyboard is open - * - * @default false - */ - avoidKeyboard?: boolean; - - /** - * The backdrop background color - * - * @default 'black' - */ - backdropColor?: string; - - /** - * The backdrop opacity when the modal is visible - * - * @default 0.70 - */ - backdropOpacity?: number; - - /** - * The backdrop show timing (in ms) - * - * @default 300 - */ - backdropTransitionInTiming?: number; - - /** - * The backdrop hide timing (in ms) - * - * @default 300 - */ - backdropTransitionOutTiming?: number; - - /** - * The modal content - * - */ - children: ReactNode[] | ReactNode; - - /** - * Show the modal? - * - * @default false - */ - isVisible: boolean; - - /** - * Style applied to the modal - * - * @default null - */ - style?: ViewStyle[] | ViewStyle; - - /** - * Called when the modal is completely visible - * - * @default () => {} - */ - onModalShow?(): void; - - /** - * Called when the modal is completely hidden - * - * @default () => {} - */ - onModalHide?(): void; - - /** - * Called when the Android back button is pressed - * - * @default () => {} - */ - onBackButtonPress?(): void; - - /** - * Called when the backdrop is pressed - * - * @default () => {} - */ - onBackdropPress?(): void; -} - -export interface ReactNativeModal - extends ComponentClass { - _close(): void; -} - -declare const ReactNativeModal: ReactNativeModal; - -export default ReactNativeModal; - -type AttentionSeekers = - | 'bounce' - | 'flash' - | 'jello' - | 'pulse' - | 'rotate' - | 'shake' - | 'swing' - | 'rubberBand' - | 'tada' - | 'wobble'; -type BouncingEntrances = - | 'bounceIn' - | 'bounceInUp' - | 'bounceInDown' - | 'bounceInRight' - | 'bounceInLeft'; -type BouncingExits = - | 'bounceOut' - | 'bounceOutUp' - | 'bounceOutDown' - | 'bounceOutRight' - | 'bounceOutLeft'; -type FadingEntrances = - | 'fadeIn' - | 'fadeInDown' - | 'fadeInUp' - | 'fadeInLeft' - | 'fadeInRight' - | 'fadeInDownBig' - | 'fadeInUpBig' - | 'fadeInLeftBig' - | 'fadeInRightBig'; -type FadingExits = - | 'fadeOut' - | 'fadeOutDown' - | 'fadeOutUp' - | 'fadeOutLeft' - | 'fadeOutRight' - | 'fadeOutDownBig' - | 'fadeOutUpBig' - | 'fadeOutLeftBig' - | 'fadeOutRightBig'; -type Flippers = 'flipInX' | 'flipInY' | 'flipOutX' | 'flipOutY'; -type LightSpeed = 'lightSpeedIn' | 'lightSpeedOut'; -export type SlidingEntrances = - | 'slideInDown' - | 'slideInUp' - | 'slideInLeft' - | 'slideInRight'; -export type SlidingExits = - | 'slideOutDown' - | 'slideOutUp' - | 'slideOutLeft' - | 'slideOutRight'; -type ZoomingEntrances = - | 'zoomIn' - | 'zoomInDown' - | 'zoomInUp' - | 'zoomInLeft' - | 'zoomInRight'; -type ZoomingExits = - | 'zoomOut' - | 'zoomOutDown' - | 'zoomOutUp' - | 'zoomOutLeft' - | 'zoomOutRight'; - -export type EntranceDefinitions = - | BouncingEntrances - | FadingEntrances - | SlidingEntrances - | ZoomingEntrances; -export type ExitDefinitions = - | BouncingExits - | FadingExits - | SlidingExits - | ZoomingExits; - -export type AnimationDefinitions = - | AttentionSeekers - | BouncingEntrances - | BouncingExits - | FadingEntrances - | FadingExits - | Flippers - | LightSpeed - | SlidingEntrances - | SlidingExits - | ZoomingEntrances - | ZoomingExits; diff --git a/types/react-native-modal/react-native-modal-tests.tsx b/types/react-native-modal/react-native-modal-tests.tsx deleted file mode 100644 index 787740c19d..0000000000 --- a/types/react-native-modal/react-native-modal-tests.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import * as React from 'react'; -import { Text, TouchableOpacity, View } from 'react-native'; -import Modal, { ReactNativeModal } from 'react-native-modal'; - -interface State { - isModalVisible: boolean; -} -class ModalTester extends React.Component<{}, State> { - modal: ReactNativeModal; - state = { - isModalVisible: false, - }; - - private showModal = () => this.setState({ isModalVisible: true }); - - private hideModal = () => this.setState({ isModalVisible: false }); - - close = () => { - this.modal._close(); - } - - storeRef: React.Ref = ref => { - this.modal = ref; - } - - render() { - return ( - - - Show Modal - - - - Hello! - - - - ); - } -} diff --git a/types/react-native-modal/tsconfig.json b/types/react-native-modal/tsconfig.json deleted file mode 100644 index d496497592..0000000000 --- a/types/react-native-modal/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "jsx": "react-native" - }, - "files": [ - "index.d.ts", - "react-native-modal-tests.tsx" - ] -} \ No newline at end of file diff --git a/types/react-native-modal/tslint.json b/types/react-native-modal/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/react-native-modal/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 9fa88b517f7514c15493ba787f21680fef5030dd Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:28:51 -0800 Subject: [PATCH 289/890] foundation-sites: Provides its own types (#22343) --- notNeededPackages.json | 6 + .../foundation-sites-tests.ts | 91 ---- types/foundation-sites/index.d.ts | 457 ------------------ types/foundation-sites/tsconfig.json | 24 - types/foundation-sites/tslint.json | 79 --- 5 files changed, 6 insertions(+), 651 deletions(-) delete mode 100644 types/foundation-sites/foundation-sites-tests.ts delete mode 100644 types/foundation-sites/index.d.ts delete mode 100644 types/foundation-sites/tsconfig.json delete mode 100644 types/foundation-sites/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index c078a0adde..ad55f97020 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -402,6 +402,12 @@ "sourceRepoURL": "https://github.com/acdlite/flux-standard-action", "asOfVersion": "1.1.0" }, + { + "libraryName": "Foundation Sites", + "typingsPackageName": "foundation-sites", + "sourceRepoURL": "http://foundation.zurb.com/", + "asOfVersion": "6.4.3" + }, { "libraryName": "gaea-model", "typingsPackageName": "gaea-model", diff --git a/types/foundation-sites/foundation-sites-tests.ts b/types/foundation-sites/foundation-sites-tests.ts deleted file mode 100644 index 574f2b7b76..0000000000 --- a/types/foundation-sites/foundation-sites-tests.ts +++ /dev/null @@ -1,91 +0,0 @@ -$(document).foundation(); -$(document).foundation('method5'); -$(document).foundation('method', 'method2'); - -Foundation.Abide($('.selector')); -Foundation.Abide($('.selector'), {}); - -Foundation.Accordion($('.selector')); -Foundation.Accordion($('.selector'), {}); - -Foundation.AccordionMenu($('.selector')); -Foundation.AccordionMenu($('.selector'), {}); - -Foundation.DrillDown($('.selector')); -Foundation.DrillDown($('.selector'), {}); - -Foundation.Dropdown($('.selector')); -Foundation.Dropdown($('.selector'), {}); - -Foundation.DropdownMenu($('.selector')); -Foundation.DropdownMenu($('.selector'), {}); - -Foundation.Equalizer($('.selector')); -Foundation.Equalizer($('.selector'), {}); - -Foundation.Interchange($('.selector')); -Foundation.Interchange($('.selector'), {}); - -Foundation.Magellan($('.selector')); -Foundation.Magellan($('.selector'), {}); - -Foundation.OffCanvas($('.selector')); -Foundation.OffCanvas($('.selector'), {}); - -Foundation.Orbit($('.selector')); -Foundation.Orbit($('.selector'), {}); - -Foundation.Reveal($('.selector')); -Foundation.Reveal($('.selector'), {}); - -Foundation.Slider($('.selector')); -Foundation.Slider($('.selector'), {}); - -Foundation.Sticky($('.selector')); -Foundation.Sticky($('.selector'), {}); - -Foundation.Tabs($('.selector')); -Foundation.Tabs($('.selector'), {}); - -Foundation.Toggler($('.selector')); -Foundation.Toggler($('.selector'), {}); - -Foundation.Tooltip($('.selector')); -Foundation.Tooltip($('.selector'), {}); - -/* - TODO: fix this: - error TS7017: Index signature of object type implicitly has an 'any' type. - - function pluginList() { - - 'use strict'; - - return [ - 'Abide', - 'Accordion', - 'AccordionMenu', - 'DrillDown', - 'Dropdown', - 'DropdownMenu', - 'Equalizer', - 'Interchange', - 'Magellan', - 'OffCanvas', - 'Orbit', - 'Reveal', - 'Slider', - 'Sticky', - 'Tabs', - 'Toggler', - 'Tooltip' - ]; - } - - pluginList().forEach((value:string) => { - Foundation[value]($('.selector')); - Foundation[value]($('.selector'), {}); - }); - */ - - diff --git a/types/foundation-sites/index.d.ts b/types/foundation-sites/index.d.ts deleted file mode 100644 index e9f42f6db5..0000000000 --- a/types/foundation-sites/index.d.ts +++ /dev/null @@ -1,457 +0,0 @@ -// Type definitions for Foundation Sites v6.1.1 -// Project: http://foundation.zurb.com/ -// Definitions by: Sam Vloeberghs -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -// please also see the typings project and prefer to use it! -// typings project: https://github.com/typings/typings -// typings: https://github.com/samvloeberghs/foundation-sites-typings - -/// - -declare namespace FoundationSites { - - // http://foundation.zurb.com/sites/docs/abide.html#javascript-reference - interface Abide { - requiredChecked(element:Object): boolean; - findFormError($el:Object): Object; - findLabel(element:Object): boolean; - addErrorClasses(element:Object): void; - removeErrorClasses(element:Object): void; - validateInput(element:Object, form:Object): void; - validateForm(element:Object): void; - validateText(element:Object): boolean; - validateRadio(group:string): boolean; - matchValidation($el:Object, validators:string, required:boolean): boolean; - resetForm($form:Object): void; - destroy(): void; - } - - interface IAbidePatterns { - alpha?: RegExp; - alpha_numeric?: RegExp; - integer?: RegExp; - number?: RegExp; - card?: RegExp; - cvv?: RegExp; - email ?: RegExp; - url?: RegExp; - domain?: RegExp; - datetime?: RegExp; - date?: RegExp; - time?: RegExp; - dateISO?: RegExp; - month_day_year?: RegExp; - day_month_year?: RegExp; - color?: RegExp; - } - - interface IAbideOptions { - validateOn?: string; - labelErrorClass?: string; - inputErrorClass?: string; - formErrorSelector?: string; - formErrorClass?: string; - liveValidate?: boolean; - validators?:any; - } - - // http://foundation.zurb.com/sites/docs/accordion.html#javascript-reference - interface Accordion { - toggle($target:JQuery): void; - down($target:JQuery, firstTime:boolean): void; - up($target:JQuery): void; - destroy(): void; - } - - interface IAccordionOptions { - slideSpeed?: number - multiOpen?: boolean; - allowAllClosed?: boolean; - } - - // http://foundation.zurb.com/sites/docs/accordion-menu.html#javascript-reference - interface AccordionMenu { - hideAll(): void; - toggle($target:JQuery): void; - down($target:JQuery, firstTime:boolean): void; - up($target:JQuery): void; - destroy(): void; - } - - interface IAccordionMenuOptions { - slideSpeed?: number; - multiOpen?: boolean; - } - - // http://foundation.zurb.com/sites/docs/drilldown-menu.html#javascript-reference - interface Drilldown { - _hideAll(): void; - _back($elem:JQuery): void; - _show($elem:JQuery): void; - _hide($elem:JQuery): void; - destroy(): void; - } - - interface IDrilldownOptions { - backButton?: string; - wrapper?: string - closeOnClick?: boolean - } - - // http://foundation.zurb.com/sites/docs/dropdown.html#javascript-reference - interface Dropdown { - getPositionClass(): string; - open(): void; - close(): void; - toggle(): void; - destroy(): void; - } - - interface IDropdownOptions { - hoverDelay?: number; - hover?: boolean; - hoverPane?: boolean; - vOffset?: number; - hOffset?: number; - positionClass?: string; - trapFocus?: boolean; - autoFocus?: boolean; - closeOnClick?: boolean; - } - - // http://foundation.zurb.com/sites/docs/dropdown-menu.html#javascript-reference - interface DropdownMenu { - destroy(): void; - } - - interface IDropdownMenuOptions { - disableHover?: boolean; - autoclose?: boolean; - hoverDelay?: number; - clickOpen?: boolean; - closingTime?: number; - alignment?: string; - closeOnClick?:boolean; - verticalClass?: string; - rightClass?: string; - forceFollow?: boolean; - } - - // http://foundation.zurb.com/sites/docs/equalizer.html#javascript-reference - interface Equalizer { - getHeights(element:Object): Array; - getHeightsByRow(cb:Function): void; - applyHeight(heights:Array): void; - applyHeightByRow(groups:Array):void; - destroy(): void; - } - - interface IEqualizerOptions { - equalizeOnStack?: boolean; - equalizeByRow?: boolean; - equalizeOn?:string; - } - - // http://foundation.zurb.com/sites/docs/interchange.html#javascript-reference - interface Interchange { - replace(path:string): void; - destroy(): void; - } - - interface IInterchangeOptions { - rules?: Array - } - - // http://foundation.zurb.com/sites/docs/magellan.html#javascript-reference - interface Magellan { - calcPoints(): void; - reflow(): void; - destroy(): void; - } - - interface IMagellanOptions { - animationDuration?: number; - animationEasing?: string; - threshold?: number; - activeClass?: string; - deepLinking?: boolean; - barOffset?: number; - } - - // http://foundation.zurb.com/sites/docs/offcanvas.html#javascript-reference - interface OffCanvas { - reveal(isRevealed:boolean): void; - open(event:Object, trigger:JQuery): void; - close(): void; - toggle(event:Object, trigger:JQuery): void; - destroy(): void; - } - - interface IOffCanvasOptions { - closeOnClick?: boolean; - transitionTime?: number; - position?: string; - forceTop?: boolean; - isRevealed?: boolean; - revealOn?: string; - autoFocus?: boolean; - revealClass?: string; - } - - // http://foundation.zurb.com/sites/docs/orbit.html#javascript-reference - interface Orbit { - geoSync(): void; - changeSlide(isLTR:boolean, chosenSlide?:Object, idx?:number): void; - destroy(): void; - } - - interface IOrbitOptions { - bullets?: boolean; - navButtons?: boolean; - animInFromRight?: string; - animOutToRight?: string; - animInFromLeft?: string; - animOutToLeft?: string; - autoPlay?: boolean; - timerDelay?: number; - infiniteWrap?: boolean; - swipe?: boolean; - pauseOnHover?: boolean; - accessible?: boolean; - containerClass?: string; - slideClass?: string; - boxOfBullets?: string; - nextClass?: string; - prevClass?: string; - useMUI?: boolean; - } - - // http://foundation.zurb.com/sites/docs/reveal.html#javascript-reference - interface Reveal { - open(): void; - toggle(): void; - close(): void; - destroy(): void; - } - - interface IRevealOptions { - animationIn?: string; - animationOut?: string; - showDelay?: number; - hideDelay?: number; - closeOnClick?: boolean; - closeOnEsc?: boolean; - multipleOpened?: boolean; - vOffset?: number; - hOffset?: number; - fullScreen?: boolean; - btmOffsetPct?: number; - overlay?: boolean; - resetOnClose?: boolean; - } - - // http://foundation.zurb.com/sites/docs/slider.html#javascript-reference - interface Slider { - destroy(): void; - } - - interface ISliderOptions { - start?: number; - end?: number; - step?: number; - initialStart ?: number; - initialEnd?: number; - binding?: boolean; - clickSelect?: boolean; - vertical?: boolean; - draggable?: boolean; - disabled?: boolean; - doubleSided?: boolean; - decimal?: number; - moveTime?: number; - disabledClass?: string; - } - - // http://foundation.zurb.com/sites/docs/sticky.html#javascript-reference - interface Sticky { - _pauseListeners(scrollListener:string): void; - _calc(checkSizes:boolean, scroll:number): void; - destroy(): void; - emCalc(Number:number): void; - } - - interface IStickyOptions { - container?: string; - stickTo?: string; - anchor?: string; - topAnchor?: string; - btmAnchor?: string; - marginTop?: number; - marginBottom?: number; - stickyOn?: string; - stickyClass?: string; - containerClass?: string; - checkEvery?: number; - } - - // http://foundation.zurb.com/sites/docs/tabs.html#javascript-reference - interface Tabs { - _handleTabChange($target:JQuery): void; - selectTab($target:JQuery): void; - destroy(): void; - } - - interface ITabsOptions { - autoFocus?: boolean; - wrapOnKeys?: boolean; - matchHeight?: boolean; - linkClass?: string; - panelClass?: string; - } - - // http://foundation.zurb.com/sites/docs/toggler.html#javascript-reference - interface Toggler { - toggle(): void; - destroy(): void; - } - - interface ITogglerOptions { - animate?: boolean; - } - - // http://foundation.zurb.com/sites/docs/tooltip.html#javascript-reference - interface Tooltip { - show(): void; - hide(): void; - toggle(): void; - destroy(): void; - } - - interface ITooltipOptions { - hoverDelay?: number; - fadeInDuration?: number; - fadeOutDuration?: number; - disableHover?: boolean; - templateClasses?: string; - tooltipClass?: string; - triggerClass?: string; - showOn?: string; - template?: string; - tipText?: string; - clickOpen?: boolean; - positionClass?: string; - vOffset?: number; - hOffset?:number; - } - - // Utilities - // --------- - - interface Box { - ImNotTouchingYou(element:Object, parent?:Object, lrOnly?:boolean, tbOnly?:boolean): boolean; - GetDimensions(element:Object): Object; - GetOffsets(element:Object, anchor:Object, position:string, vOffset:number, hOffset:number, isOverflow:boolean): Object; - } - - interface KeyBoard { - parseKey(event:any): string; - handleKey(event:any, component:any, functions:any):void; - findFocusable($element:Object): Object; - } - - interface MediaQuery { - get(size:string): string; - atLeast(size:string): boolean; - queries:Array; - current:string; - } - - interface Motion { - animateIn(element:Object, animation:any, cb:Function): void; - animateOut(element:Object, animation:any, cb:Function): void; - } - - interface Move { - // TODO - } - - interface Nest { - Feather(menu:any, type:any):void; - Burn(menu:any, type:any):void; - } - - interface Timer { - start(): void; - restart(): void; - pause(): void; - } - - interface Touch { - // TODO :extension on jQuery - } - - interface Triggers { - // TODO :extension on jQuery - } - - interface FoundationSitesStatic { - version : string; - - rtl(): boolean; - plugin(plugin:Object, name:string): void; - registerPlugin(plugin:Object): void; - unregisterPlugin(plugin:Object): void; - reInit(plugins:Array):void; - GetYoDigits(length:number, namespace?:string): string; - reflow(elem:Object, plugins?:Array|string): void; - getFnName(fn:string): string; - transitionend(): string; - - util : { - throttle(func:(...args:any[]) => any, delay:number): (...args:any[]) => any; - }; - - Abide(element:Object, options?:IAbideOptions): Abide; - Accordion(element:Object, options?:IAccordionOptions): Accordion; - AccordionMenu(element:Object, options?:IAccordionMenuOptions): AccordionMenu; - DrillDown(element:Object, options?:IDrilldownOptions): Drilldown; - Dropdown(element:Object, options?:IDropdownOptions): Dropdown; - DropdownMenu(element:Object, options?:IDropdownMenuOptions): DropdownMenu; - Equalizer(element:Object, options?:IEqualizerOptions): Equalizer; - Interchange(element:Object, options?:IInterchangeOptions): Interchange; - Magellan(element:Object, options?:IMagellanOptions): Magellan; - OffCanvas(element:Object, options?:IOffCanvasOptions): OffCanvas; - Orbit(element:Object, options?:IOrbitOptions): Orbit; - Reveal(element:Object, options?:IRevealOptions): Reveal; - Slider(element:Object, options?:ISliderOptions): Slider; - Sticky(element:Object, options?:IStickyOptions): Sticky; - Tabs(element:Object, options?:ITabsOptions): Tabs; - Toggler(element:Object, options?:ITogglerOptions): Toggler; - Tooltip(element:Object, options?:ITooltipOptions): Tooltip; - - // utils - Box: Box; - KeyBoard: KeyBoard; - MediaQuery: MediaQuery; - Motion: Motion; - Move: Move; - Nest: Nest; - Timer: Timer; - Touch: Touch; - Triggers: Triggers; - - } - -} - -interface JQuery { - foundation(method?: string, ...args: any[]): JQuery; -} - -declare var Foundation:FoundationSites.FoundationSitesStatic; - -declare module "foundation-sites" { - export = Foundation; -} diff --git a/types/foundation-sites/tsconfig.json b/types/foundation-sites/tsconfig.json deleted file mode 100644 index 301e0bc66b..0000000000 --- a/types/foundation-sites/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "foundation-sites-tests.ts" - ] -} \ No newline at end of file diff --git a/types/foundation-sites/tslint.json b/types/foundation-sites/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/foundation-sites/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From a43a5ddeb0d2a5790a0c951b7bf58ad79ef806b9 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 09:29:03 -0800 Subject: [PATCH 290/890] core-decorators: Provides its own types (#22349) --- notNeededPackages.json | 6 + .../core-decorators/core-decorators-tests.ts | 295 ------------------ types/core-decorators/index.d.ts | 116 ------- types/core-decorators/tsconfig.json | 26 -- types/core-decorators/tslint.json | 9 - 5 files changed, 6 insertions(+), 446 deletions(-) delete mode 100644 types/core-decorators/core-decorators-tests.ts delete mode 100644 types/core-decorators/index.d.ts delete mode 100644 types/core-decorators/tsconfig.json delete mode 100644 types/core-decorators/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index ad55f97020..580a4dce60 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -216,6 +216,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/constant-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "core-decorators.js", + "typingsPackageName": "core-decorators", + "sourceRepoURL": "https://github.com/jayphelps/core-decorators.js", + "asOfVersion": "0.20.0" + }, { "libraryName": "cypress", "typingsPackageName": "cypress", diff --git a/types/core-decorators/core-decorators-tests.ts b/types/core-decorators/core-decorators-tests.ts deleted file mode 100644 index c617de5fcc..0000000000 --- a/types/core-decorators/core-decorators-tests.ts +++ /dev/null @@ -1,295 +0,0 @@ -// -// @autobind -// - -import { autobind } from 'core-decorators'; - -@autobind -class Person { - @autobind - getPerson() { - return this; - } - - getPersonAgain() { - return this; - } -} - -const person = new Person(); -const { getPerson, getPersonAgain } = person; - -getPerson() === person; - -getPersonAgain() === person; - -// -// @readonly -// - -import { readonly } from 'core-decorators'; - -class Meal { - @readonly - entree = 'steak'; -} - -const dinner = new Meal(); -dinner.entree = 'salmon'; - -// -// @override -// - -import { override } from 'core-decorators'; - -class Parent { - speak(first: string, second: string) {} -} - -class Child extends Parent { - @override - speak() {} - // SyntaxError: Child#speak() does not properly override Parent#speak(first, second) -} - -// or - -class Child2 extends Parent { - @override - speaks() {} - // SyntaxError: No descriptor matching Child#speaks() was found on the prototype chain. - // - // Did you mean "speak"? -} - -// -// @deprecate (alias: @deprecated) -// - -import { deprecate, deprecated } from 'core-decorators'; - -class Person2 { - @deprecate - facepalm() {} - - @deprecate('We stopped facepalming') - facepalmHard() {} - - @deprecate('We stopped facepalming', { url: 'http://knowyourmeme.com/memes/facepalm' }) - facepalmHarder() {} -} - -const person2 = new Person2(); - -person2.facepalm(); -// DEPRECATION Person#facepalm: This function will be removed in future versions. - -person2.facepalmHard(); -// DEPRECATION Person#facepalmHard: We stopped facepalming - -person2.facepalmHarder(); -// DEPRECATION Person#facepalmHarder: We stopped facepalming -// -// See http://knowyourmeme.com/memes/facepalm for more details. -// - -// -// @debounce -// - -import { debounce } from 'core-decorators'; - -class Editor { - content = ''; - - @debounce(500) - updateContent(content: string) { - this.content = content; - } -} - -// -// @throttle -// - -import { throttle } from 'core-decorators'; - -class Editor2 { - content = ''; - - @throttle(500, {leading: false}) - updateContent(content: string) { - this.content = content; - } -} - -// -// @suppressWarnings -// - -import { suppressWarnings } from 'core-decorators'; - -class Person3 { - @deprecated - facepalm() {} - - @suppressWarnings - facepalmWithoutWarning() { - this.facepalm(); - } -} - -const person3 = new Person3(); - -person3.facepalmWithoutWarning(); -// no warning is logged - -// -// @nonenumerable -// - -import { nonenumerable } from 'core-decorators'; - -class Meal2 { - entree = 'steak'; - - @nonenumerable - cost = 4.44; -} - -const dinner2 = new Meal2(); -for (const key in dinner2) { - key; - // "entree" only, not "cost" -} - -Object.keys(dinner2); -// ["entree"] - -// -// @nonconfigurable -// - -import { nonconfigurable } from 'core-decorators'; - -class Meal3 { - @nonconfigurable - entree = 'steak'; -} - -const dinner3 = new Meal3(); - -Object.defineProperty(dinner3, 'entree', { - enumerable: false -}); -// Cannot redefine property: entree - -// -// @decorate -// - -declare function memoize(func: T): T; -import { decorate } from 'core-decorators'; - -let count = 0; - -class Task { - @decorate(memoize) - doSomethingExpensive(data: any) { - count++; - // something expensive; - return data; - } -} - -const task = new Task(); -const data = [1, 2, 3]; - -task.doSomethingExpensive(data); -task.doSomethingExpensive(data); - -count === 1; -// true - -// -// @lazyInitialize -// - -import { lazyInitialize } from 'core-decorators'; - -function createHugeBuffer() { - console.log('huge buffer created'); - return new Array(1000000); -} - -class Editor3 { - @lazyInitialize - hugeBuffer = createHugeBuffer(); -} - -const editor = new Editor3(); -// createHugeBuffer() has not been called yet - -editor.hugeBuffer; -// logs 'huge buffer created', now it has been called - -editor.hugeBuffer; -// already initialized and equals our buffer, so -// createHugeBuffer() is not called again - -// TODO: For @mixin, I don't know how we can make it work for TypeScript... -// -// @mixin (alias: @mixins) -// - -import { mixin } from 'core-decorators'; - -const SingerMixin = { - sing(sound: string) { - alert(sound); - } -}; - -const FlyMixin = { - // All types of property descriptors are supported - get speed(): number { return 42; }, - fly() {}, - land() {} -}; - -@mixin(SingerMixin, FlyMixin) -class Bird { - singMatingCall() { - // TODO: For @mixin, I don't know how we can make it work for TypeScript... - // this.sing('tweet tweet'); - } -} - -const bird = new Bird(); -bird.singMatingCall(); -// alerts "tweet tweet" - -// -// @time -// - -import { time } from 'core-decorators'; - -const myConsole = { - time(label: string) { /* custom time() method */ }, - timeEnd(label: string) { /* custom timeEnd method */ }, - log(str: any) { /* custom log method */ } -}; - -class Bird2 { - @time('sing') - sing() {} - - @time('sing2', myConsole) - sing2() {} -} - -const bird2 = new Bird2(); -bird2.sing(); // console.time label will be 'sing-0' -bird2.sing(); // console.time label will be 'sing-1' diff --git a/types/core-decorators/index.d.ts b/types/core-decorators/index.d.ts deleted file mode 100644 index 4af9fd5fa5..0000000000 --- a/types/core-decorators/index.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -// Type definitions for core-decorators.js 0.10 -// Project: https://github.com/jayphelps/core-decorators.js -// Definitions by: Qubo -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 - -export interface ClassDecorator { - (target: TFunction): TFunction | void; -} - -export interface ParameterDecorator { - (target: Object, propertyKey: string | symbol, parameterIndex: number): void; -} - -export interface PropertyDecorator { - (target: Object, propertyKey: string | symbol): void; -} - -export interface MethodDecorator { - (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor | void; -} - -export interface PropertyOrMethodDecorator extends MethodDecorator, PropertyDecorator { - (target: Object, propertyKey: string | symbol): void; -} - -export interface Deprecate extends MethodDecorator { - (message?: string, option?: DeprecateOption): MethodDecorator; -} - -export interface DeprecateOption { - url: string; -} - -export interface ThrottleOptions { - /** allows to trigger function on the leading. */ - leading?: boolean; - /** allows to trigger function on the trailing edge of the wait interval. */ - trailing?: boolean; -} - -export interface Console { - log(message?: any, ...optionalParams: any[]): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; -} - -/** - * Forces invocations of this function to always have this refer to the class instance, - * even if the function is passed around or would otherwise lose its this context. e.g. var fn = context.method; - */ -export const autobind: Function; -/** - * Marks a property or method as not being writable. - */ -export const readonly: PropertyOrMethodDecorator; -/** - * Checks that the marked method indeed overrides a function with the same signature somewhere on the prototype chain. - */ -export const override: MethodDecorator; -/** - * Calls console.warn() with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url, for further reading. - */ -export const deprecate: Deprecate; -/** - * Calls console.warn() with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url, for further reading. - */ -export const deprecated: Deprecate; -/** - * Creates a new debounced function which will be invoked after wait milliseconds since the time it was invoked. Default timeout is 300 ms. - */ -export function debounce(wait: number): MethodDecorator; -/** - * Creates a new throttled function which will be invoked in every wait milliseconds. Default timeout is 300 ms. - */ -export function throttle(wait: number, options?: ThrottleOptions): MethodDecorator; -/** - * Suppresses any JavaScript console.warn() call while the decorated function is called. (i.e. on the stack) - */ -export const suppressWarnings: MethodDecorator; -/** - * Marks a property or method as not being enumerable. - */ -export const nonenumerable: PropertyOrMethodDecorator; -/** - * Marks a property or method as not being writable. - */ -export const nonconfigurable: PropertyOrMethodDecorator; -/** - * Initial implementation included, likely slow. WIP. - */ -export const memoize: MethodDecorator; -/** - * Immediately applies the provided function and arguments to the method, allowing you to wrap methods with arbitrary helpers like those provided by lodash. - * The first argument is the function to apply, all further arguments will be passed to that decorating function. - */ -export function decorate(func: Function, ...args: any[]): MethodDecorator; -/** - * Prevents a property initializer from running until the decorated property is actually looked up. - * Useful to prevent excess allocations that might otherwise not be used, but be careful not to over-optimize things. - */ -export const lazyInitialize: PropertyDecorator; -/** - * Mixes in all property descriptors from the provided Plain Old JavaScript Objects (aka POJOs) as arguments. - * Mixins are applied in the order they are passed, but do not override descriptors already on the class, including those inherited traditionally. - */ -export function mixin(...mixins: any[]): ClassDecorator; -/** - * Mixes in all property descriptors from the provided Plain Old JavaScript Objects (aka POJOs) as arguments. - * Mixins are applied in the order they are passed, but do not override descriptors already on the class, including those inherited traditionally. - */ -export function mixins(...mixins: any[]): ClassDecorator; -/** - * Uses console.time and console.timeEnd to provide function timings with a unique label whose default prefix is ClassName.method. Supply a first argument to override the prefix: - */ -export function time(label: string, console?: Console): MethodDecorator; diff --git a/types/core-decorators/tsconfig.json b/types/core-decorators/tsconfig.json deleted file mode 100644 index af573cbe86..0000000000 --- a/types/core-decorators/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "experimentalDecorators": true, - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "core-decorators-tests.ts" - ] -} \ No newline at end of file diff --git a/types/core-decorators/tslint.json b/types/core-decorators/tslint.json deleted file mode 100644 index bade6d465f..0000000000 --- a/types/core-decorators/tslint.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // TODOs - "callable-types": false, - "ban-types": false, - "no-duplicate-imports": false - } -} From 39f18d53a212fb21e7eb59dd6410a6ad2a5c6375 Mon Sep 17 00:00:00 2001 From: Flarna Date: Tue, 2 Jan 2018 19:25:18 +0100 Subject: [PATCH 291/890] [karma-webpack] Fix build by adding type for Logger (#22572) --- types/karma-webpack/index.d.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/types/karma-webpack/index.d.ts b/types/karma-webpack/index.d.ts index 06f45e3cbf..bfb9634ce8 100644 --- a/types/karma-webpack/index.d.ts +++ b/types/karma-webpack/index.d.ts @@ -9,6 +9,8 @@ import webpack = require('webpack'); import webpackDevMiddleware = require('webpack-dev-middleware'); declare module 'karma' { + type Logger = (message?: any, ...optionalParams: any[]) => void; + // Note: karma-webpack will set publicPath for us, so it is optional here. // Unfortuantely, Typescript doesn't let you overload properties, so // the entire definition is duplicated here. @@ -26,9 +28,9 @@ declare module 'karma' { reporter?: webpackDevMiddleware.Reporter | null; serverSideRender?: boolean; - log?: webpackDevMiddleware.Logger; - warn?: webpackDevMiddleware.Logger; - error?: webpackDevMiddleware.Logger; + log?: Logger; + warn?: Logger; + error?: Logger; filename?: string; } From 900b0420890c0a58277fc18ab74b595818aa28a8 Mon Sep 17 00:00:00 2001 From: Flarna Date: Tue, 2 Jan 2018 19:25:45 +0100 Subject: [PATCH 292/890] [koa-webpack] Fix build by adapting test to changes in webpack-dev-middleware (#22576) --- types/koa-webpack/koa-webpack-tests.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/koa-webpack/koa-webpack-tests.ts b/types/koa-webpack/koa-webpack-tests.ts index c153a874d5..12062302de 100644 --- a/types/koa-webpack/koa-webpack-tests.ts +++ b/types/koa-webpack/koa-webpack-tests.ts @@ -12,8 +12,6 @@ const middleware = koaWebpack({ compiler, config, dev: { - noInfo: false, - quiet: false, lazy: true, watchOptions: { aggregateTimeout: 300, From 1792bfaa20fcc1d279b84c9b32d794e567948233 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 10:33:00 -0800 Subject: [PATCH 293/890] source-map: Provides its own types (#22307) --- notNeededPackages.json | 6 + .../istanbul-lib-instrument-tests.ts | 5 +- types/istanbul-lib-instrument/package.json | 6 + .../istanbul-lib-source-maps-tests.ts | 5 +- types/istanbul-lib-source-maps/package.json | 6 + types/rollup/package.json | 6 + types/source-map/index.d.ts | 334 ------------------ types/source-map/source-map-tests.ts | 206 ----------- types/source-map/tsconfig.json | 23 -- types/source-map/tslint.json | 7 - types/uglify-js/package.json | 6 + types/webpack-sources/package.json | 6 + 12 files changed, 42 insertions(+), 574 deletions(-) create mode 100644 types/istanbul-lib-instrument/package.json create mode 100644 types/istanbul-lib-source-maps/package.json create mode 100644 types/rollup/package.json delete mode 100644 types/source-map/index.d.ts delete mode 100644 types/source-map/source-map-tests.ts delete mode 100644 types/source-map/tsconfig.json delete mode 100644 types/source-map/tslint.json create mode 100644 types/uglify-js/package.json create mode 100644 types/webpack-sources/package.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 580a4dce60..f62f91bfe4 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1116,6 +1116,12 @@ "sourceRepoURL": "https://www.npmjs.com/package/soap", "asOfVersion": "0.21.0" }, + { + "libraryName": "source-map", + "typingsPackageName": "source-map", + "sourceRepoURL": "https://github.com/mozilla/source-map", + "asOfVersion": "0.5.7" + }, { "libraryName": "Spin.js", "typingsPackageName": "spin.js", diff --git a/types/istanbul-lib-instrument/istanbul-lib-instrument-tests.ts b/types/istanbul-lib-instrument/istanbul-lib-instrument-tests.ts index 54d66314d4..2a4ac328c2 100644 --- a/types/istanbul-lib-instrument/istanbul-lib-instrument-tests.ts +++ b/types/istanbul-lib-instrument/istanbul-lib-instrument-tests.ts @@ -5,6 +5,7 @@ import { } from 'istanbul-lib-instrument'; import * as babelTypes from 'babel-types'; +import { RawSourceMap } from 'source-map'; const code = 'foo'; const filename = 'bar.txt'; @@ -24,8 +25,8 @@ const instrumenter = createInstrumenter({ debug: false }); -const sourceMap = { - version: 1, +const sourceMap: RawSourceMap = { + version: 1 as any as string, // Fixed by https://github.com/mozilla/source-map/pull/293 but the fix is not yet published sources: ['foo', 'bar'], names: ['foo', 'bar'], mappings: 'foo', diff --git a/types/istanbul-lib-instrument/package.json b/types/istanbul-lib-instrument/package.json new file mode 100644 index 0000000000..100334a89f --- /dev/null +++ b/types/istanbul-lib-instrument/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "source-map": "^0.6.1" + } +} diff --git a/types/istanbul-lib-source-maps/istanbul-lib-source-maps-tests.ts b/types/istanbul-lib-source-maps/istanbul-lib-source-maps-tests.ts index be03e785fc..844205df8d 100644 --- a/types/istanbul-lib-source-maps/istanbul-lib-source-maps-tests.ts +++ b/types/istanbul-lib-source-maps/istanbul-lib-source-maps-tests.ts @@ -1,5 +1,6 @@ import { createSourceMapStore } from 'istanbul-lib-source-maps'; import { CoverageMap } from 'istanbul-lib-coverage'; +import { RawSourceMap } from 'source-map'; createSourceMapStore(); createSourceMapStore({}); @@ -12,8 +13,8 @@ const store = createSourceMapStore({ store.data['foo'].type.trim(); -const sourceMap = { - version: 1, +const sourceMap: RawSourceMap = { + version: 1 as any as string, // Fixed by https://github.com/mozilla/source-map/pull/293 but the fix is not yet published sources: ['foo', 'bar'], names: ['foo', 'bar'], mappings: 'foo', diff --git a/types/istanbul-lib-source-maps/package.json b/types/istanbul-lib-source-maps/package.json new file mode 100644 index 0000000000..100334a89f --- /dev/null +++ b/types/istanbul-lib-source-maps/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "source-map": "^0.6.1" + } +} diff --git a/types/rollup/package.json b/types/rollup/package.json new file mode 100644 index 0000000000..100334a89f --- /dev/null +++ b/types/rollup/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "source-map": "^0.6.1" + } +} diff --git a/types/source-map/index.d.ts b/types/source-map/index.d.ts deleted file mode 100644 index ae1f025860..0000000000 --- a/types/source-map/index.d.ts +++ /dev/null @@ -1,334 +0,0 @@ -// Type definitions for source-map 0.5 -// Project: https://github.com/mozilla/source-map -// Definitions by: Morten Houston Ludvigsen , -// Ron Buckton -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export as namespace sourceMap; - -export type SourceMapUrl = string; - -export interface StartOfSourceMap { - file?: string; - sourceRoot?: string; - skipValidation?: boolean; -} - -export interface RawSourceMap { - version: number; - sources: string[]; - names: string[]; - sourceRoot?: string; - sourcesContent?: string[]; - mappings: string; - file: string; -} - -export interface RawIndexMap extends StartOfSourceMap { - version: number; - sections: RawSection[]; -} - -export interface RawSection { - offset: Position; - map: RawSourceMap; -} - -export interface Position { - line: number; - column: number; -} - -export interface NullablePosition { - line: number | null; - column: number | null; - lastColumn: number | null; -} - -export interface MappedPosition { - source: string; - line: number; - column: number; - name?: string; -} - -export interface NullableMappedPosition { - source: string | null; - line: number | null; - column: number | null; - name: string | null; -} - -export interface MappingItem { - source: string; - generatedLine: number; - generatedColumn: number; - originalLine: number; - originalColumn: number; - name: string; -} - -export interface Mapping { - generated: Position; - original: Position; - source: string; - name?: string; -} - -export interface CodeWithSourceMap { - code: string; - map: SourceMapGenerator; -} - -export interface SourceMapConsumer { - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - computeColumnSpans(): void; - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - originalPositionFor(generatedPosition: Position & { bias?: number }): NullableMappedPosition; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - generatedPositionFor(originalPosition: MappedPosition & { bias?: number }): NullablePosition; - - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: Optional. the column number in the original source. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - allGeneratedPositionsFor(originalPosition: MappedPosition): NullablePosition[]; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - hasContentsOfAllSources(): boolean; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - sourceContentFor(source: string, returnNullOnMissing?: boolean): string | null; - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param callback - * The function that is called with each mapping. - * @param context - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param order - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void; -} - -export interface SourceMapConsumerConstructor { - prototype: SourceMapConsumer; - - GENERATED_ORDER: number; - ORIGINAL_ORDER: number; - GREATEST_LOWER_BOUND: number; - LEAST_UPPER_BOUND: number; - - new (rawSourceMap: RawSourceMap, sourceMapUrl?: SourceMapUrl): BasicSourceMapConsumer; - new (rawSourceMap: RawIndexMap, sourceMapUrl?: SourceMapUrl): IndexedSourceMapConsumer; - new (rawSourceMap: RawSourceMap | RawIndexMap | string, sourceMapUrl?: SourceMapUrl): BasicSourceMapConsumer | IndexedSourceMapConsumer; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param sourceMap - * The source map that will be consumed. - */ - fromSourceMap(sourceMap: SourceMapGenerator, sourceMapUrl?: SourceMapUrl): BasicSourceMapConsumer; -} - -export const SourceMapConsumer: SourceMapConsumerConstructor; - -export interface BasicSourceMapConsumer extends SourceMapConsumer { - file: string; - sourceRoot: string; - sources: string[]; - sourcesContent: string[]; -} - -export interface BasicSourceMapConsumerConstructor { - prototype: BasicSourceMapConsumer; - - new (rawSourceMap: RawSourceMap | string): BasicSourceMapConsumer; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param sourceMap - * The source map that will be consumed. - */ - fromSourceMap(sourceMap: SourceMapGenerator): BasicSourceMapConsumer; -} - -export const BasicSourceMapConsumer: BasicSourceMapConsumerConstructor; - -export interface IndexedSourceMapConsumer extends SourceMapConsumer { - sources: string[]; -} - -export interface IndexedSourceMapConsumerConstructor { - prototype: IndexedSourceMapConsumer; - - new (rawSourceMap: RawIndexMap | string): IndexedSourceMapConsumer; -} - -export const IndexedSourceMapConsumer: IndexedSourceMapConsumerConstructor; - -export class SourceMapGenerator { - constructor(startOfSourceMap?: StartOfSourceMap); - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param sourceMapConsumer The SourceMap. - */ - static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator; - - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - addMapping(mapping: Mapping): void; - - /** - * Set the source content for a source file. - */ - setSourceContent(sourceFile: string, sourceContent: string): void; - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param sourceMapConsumer The source map to be applied. - * @param sourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param sourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void; - - toString(): string; - - toJSON(): RawSourceMap; -} - -export class SourceNode { - children: SourceNode[]; - sourceContents: any; - line: number; - column: number; - source: string; - name: string; - - constructor(); - constructor( - line: number | null, - column: number | null, - source: string | null, - chunks?: Array<(string | SourceNode)> | SourceNode | string, - name?: string - ); - - static fromStringWithSourceMap( - code: string, - sourceMapConsumer: SourceMapConsumer, - relativePath?: string - ): SourceNode; - - add(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode; - - prepend(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode; - - setSourceContent(sourceFile: string, sourceContent: string): void; - - walk(fn: (chunk: string, mapping: MappedPosition) => void): void; - - walkSourceContents(fn: (file: string, content: string) => void): void; - - join(sep: string): SourceNode; - - replaceRight(pattern: string, replacement: string): SourceNode; - - toString(): string; - - toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap; -} diff --git a/types/source-map/source-map-tests.ts b/types/source-map/source-map-tests.ts deleted file mode 100644 index f87194395b..0000000000 --- a/types/source-map/source-map-tests.ts +++ /dev/null @@ -1,206 +0,0 @@ -import SourceMap = require('source-map'); - -function testSourceMapConsumer() { - function testConstructor() { - let scm: SourceMap.SourceMapConsumer; - - // create with full RawSourceMap - scm = new SourceMap.SourceMapConsumer({ - version: 3, - sources: ['foo', 'bar'], - names: ['foo', 'bar'], - sourcesContent: ['foo'], - mappings: 'foo', - file: 'sdf' - }); - - scm = new SourceMap.SourceMapConsumer(JSON.stringify({ - version: 3, - sources: ['foo', 'bar'], - names: ['foo', 'bar'], - sourcesContent: ['foo'], - mappings: 'foo', - file: 'sdf' - })); - - // create with partial RawSourceMap - scm = new SourceMap.SourceMapConsumer({ - version: 3, - sources: ['foo', 'bar'], - names: ['foo', 'bar'], - mappings: 'foo', - file: 'sdf' - }); - - // create from index map - const iscm: SourceMap.IndexedSourceMapConsumer = new SourceMap.SourceMapConsumer({ - version: 3, - sections: [ - { offset: { line: 0, column: 0 }, map: { - version: 3, - sources: ['foo', 'bar'], - names: ['foo', 'bar'], - mappings: 'foo', - file: 'foo' - } } - ] - }); - - let scg: SourceMap.SourceMapGenerator; - const bscm: SourceMap.BasicSourceMapConsumer = SourceMap.SourceMapConsumer.fromSourceMap(scg); - } - - function testOriginalPositionFor(scm: SourceMap.SourceMapConsumer) { - let origPos: SourceMap.MappedPosition; - origPos = scm.originalPositionFor({ line: 42, column: 42 }); - origPos = scm.originalPositionFor({ line: 42, column: 42, bias: SourceMap.SourceMapConsumer.LEAST_UPPER_BOUND }); - } - - function testAllGeneratedPositionsFor(scm: SourceMap.SourceMapConsumer) { - let origPos: SourceMap.MappedPosition; - let origPoses: SourceMap.Position[]; - origPoses = scm.allGeneratedPositionsFor(origPos); - } - - function testGeneratedPositionFor(scm: SourceMap.SourceMapConsumer) { - let genPos: SourceMap.Position; - genPos = scm.generatedPositionFor({ line: 42, column: 42, source: 'foo' }); - genPos = scm.generatedPositionFor({ line: 42, column: 42, source: 'foo', name: 'bar' }); - genPos = scm.generatedPositionFor({ line: 42, column: 42, source: 'foo', name: 'bar', bias: SourceMap.SourceMapConsumer.LEAST_UPPER_BOUND }); - } - - function testSourceContentFor(scm: SourceMap.SourceMapConsumer) { - let content: string; - content = scm.sourceContentFor('foo'); - } - - function testEachMapping(scm: SourceMap.SourceMapConsumer) { - let x: SourceMap.MappingItem; - let context: {}; - - scm.eachMapping(mapping => { x = mapping; }); - scm.eachMapping(mapping => { x = mapping; }, context); - scm.eachMapping(mapping => { x = mapping; }, context, SourceMap.SourceMapConsumer.GENERATED_ORDER); - scm.eachMapping(mapping => { x = mapping; }, context, SourceMap.SourceMapConsumer.ORIGINAL_ORDER); - } -} - -function testSourceMapGenerator() { - function testConstructor() { - let generator: SourceMap.SourceMapGenerator; - - generator = new SourceMap.SourceMapGenerator(); - generator = new SourceMap.SourceMapGenerator({ - file: 'foo' - }); - generator = new SourceMap.SourceMapGenerator({ - sourceRoot: 'foo' - }); - generator = new SourceMap.SourceMapGenerator({ - file: 'foo', - sourceRoot: 'bar' - }); - } - - function testFromSourceMap(generator: SourceMap.SourceMapGenerator, scm: SourceMap.SourceMapConsumer) { - generator = SourceMap.SourceMapGenerator.fromSourceMap(scm); - } - - function testAddMapping(generator: SourceMap.SourceMapGenerator) { - generator.addMapping({ - generated: { line: 42, column: 42 }, - original: { line: 42, column: 42 }, - source: 'foo', - name: 'foo' - }); - - generator.addMapping({ - generated: { line: 42, column: 42 }, - original: { line: 42, column: 42 }, - source: 'foo' - }); - } - - function testSetSourceContent(generator: SourceMap.SourceMapGenerator) { - generator.setSourceContent('foo', 'bar'); - } - - function testApplySourceMap(generator: SourceMap.SourceMapGenerator, scm: SourceMap.SourceMapConsumer) { - generator.applySourceMap(scm); - generator.applySourceMap(scm, 'foo'); - generator.applySourceMap(scm, 'foo', 'bar'); - } - - function testToString(generator: SourceMap.SourceMapGenerator) { - let str: string; - str = generator.toString(); - } -} - -function testSourceNode() { - function testConstructor() { - let node: SourceMap.SourceNode; - - node = new SourceMap.SourceNode(); - node = new SourceMap.SourceNode(42, 42, 'foo'); - node = new SourceMap.SourceNode(42, 42, 'foo', 'bar'); - node = new SourceMap.SourceNode(42, 42, 'foo', 'bar', 'slam'); - node = new SourceMap.SourceNode(42, 42, 'foo', ['bar', 'slam']); - } - - function testFromStringWithSourceMap(scm: SourceMap.SourceMapConsumer) { - let node: SourceMap.SourceNode; - - node = SourceMap.SourceNode.fromStringWithSourceMap('foo', scm); - node = SourceMap.SourceNode.fromStringWithSourceMap('foo', scm, 'bar'); - } - - function testAdd(node: SourceMap.SourceNode) { - node.add('foo'); - node.add(new SourceMap.SourceNode()); - node.add([new SourceMap.SourceNode(), 'bar']); - } - - function testPrepend(node: SourceMap.SourceNode) { - node.prepend('foo'); - node.prepend(new SourceMap.SourceNode()); - node.prepend([new SourceMap.SourceNode(), 'bar']); - } - - function testSetSourceContent(node: SourceMap.SourceNode) { - node.setSourceContent('foo', 'bar'); - } - - function testWalk(node: SourceMap.SourceNode) { - let chunk: string; - let mapping: SourceMap.MappedPosition; - - node.walk((c, m) => { chunk = c; mapping = m; }); - } - - function testWalkSourceContents(node: SourceMap.SourceNode) { - let file: string; - let content: string; - - node.walkSourceContents((f, c) => { file = f; content = c; }); - } - - function testJoin(node: SourceMap.SourceNode) { - node = node.join('foo'); - } - - function testReplaceRight(node: SourceMap.SourceNode) { - node = node.replaceRight('foo', 'bar'); - } - - function testToString(node: SourceMap.SourceNode) { - let str: string; - str = node.toString(); - } - - function testToStringWithSourceMap(node: SourceMap.SourceNode, sos: SourceMap.StartOfSourceMap) { - let result: SourceMap.CodeWithSourceMap; - result = node.toStringWithSourceMap(); - result = node.toStringWithSourceMap(sos); - } -} diff --git a/types/source-map/tsconfig.json b/types/source-map/tsconfig.json deleted file mode 100644 index f625e560df..0000000000 --- a/types/source-map/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "source-map-tests.ts" - ] -} \ No newline at end of file diff --git a/types/source-map/tslint.json b/types/source-map/tslint.json deleted file mode 100644 index 7210289f52..0000000000 --- a/types/source-map/tslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // TODO - "prefer-const": false - } -} \ No newline at end of file diff --git a/types/uglify-js/package.json b/types/uglify-js/package.json new file mode 100644 index 0000000000..100334a89f --- /dev/null +++ b/types/uglify-js/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "source-map": "^0.6.1" + } +} diff --git a/types/webpack-sources/package.json b/types/webpack-sources/package.json new file mode 100644 index 0000000000..100334a89f --- /dev/null +++ b/types/webpack-sources/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "source-map": "^0.6.1" + } +} From f279174ea77c561b3c098bd3d75fe863de302c3a Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 10:33:16 -0800 Subject: [PATCH 294/890] fullcalendar: Provides its own types (#22350) --- notNeededPackages.json | 6 + types/fullcalendar/fullcalendar-tests.ts | 854 -------------- types/fullcalendar/index.d.ts | 1134 ------------------- types/fullcalendar/package.json | 6 - types/fullcalendar/tsconfig.json | 24 - types/fullcalendar/tslint.json | 7 - types/fullcalendar/v1/fullcalendar-tests.ts | 793 ------------- types/fullcalendar/v1/index.d.ts | 427 ------- types/fullcalendar/v1/package.json | 6 - types/fullcalendar/v1/tsconfig.json | 29 - types/fullcalendar/v1/tslint.json | 7 - 11 files changed, 6 insertions(+), 3287 deletions(-) delete mode 100644 types/fullcalendar/fullcalendar-tests.ts delete mode 100644 types/fullcalendar/index.d.ts delete mode 100644 types/fullcalendar/package.json delete mode 100644 types/fullcalendar/tsconfig.json delete mode 100644 types/fullcalendar/tslint.json delete mode 100644 types/fullcalendar/v1/fullcalendar-tests.ts delete mode 100644 types/fullcalendar/v1/index.d.ts delete mode 100644 types/fullcalendar/v1/package.json delete mode 100644 types/fullcalendar/v1/tsconfig.json delete mode 100644 types/fullcalendar/v1/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index f62f91bfe4..f1736daaf4 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -414,6 +414,12 @@ "sourceRepoURL": "http://foundation.zurb.com/", "asOfVersion": "6.4.3" }, + { + "libraryName": "FullCalendar", + "typingsPackageName": "fullcalendar", + "sourceRepoURL": "http://arshaw.com/fullcalendar/", + "asOfVersion": "3.8.0" + }, { "libraryName": "gaea-model", "typingsPackageName": "gaea-model", diff --git a/types/fullcalendar/fullcalendar-tests.ts b/types/fullcalendar/fullcalendar-tests.ts deleted file mode 100644 index 13df4e3853..0000000000 --- a/types/fullcalendar/fullcalendar-tests.ts +++ /dev/null @@ -1,854 +0,0 @@ -/// - -import * as FullCalendar from 'fullcalendar'; -import * as moment from 'moment'; - -// All examples from http://arshaw.com/fullcalendar/docs/ - -$('#calendar').fullCalendar({}); - -$('#calendar').fullCalendar({ - weekends: false -}); - -$('#calendar').fullCalendar({ - dayClick() { - alert('a day has been clicked!'); - } -}); - -$('#calendar').fullCalendar('next'); - -$('#calendar').fullCalendar({ - events: 'http://www.google.com/your_feed_url/' -}); - -$('#calendar').fullCalendar({ - events: { - url: 'http://www.google.com/your_feed_url/', - className: 'gcal-event', // an option! - currentTimezone: 'America/Chicago' // an option! - } -}); - -$('#calendar').fullCalendar({ - eventSources: [ - // source with no options - "http://www.google.com/your_feed_url1/", - - // source with no options - "http://www.google.com/your_feed_url2/", - - // source WITH options - { - url: "http://www.google.com/your_feed_url3/", - className: 'nice-event' - } - ] -}); - -$('#calendar').fullCalendar({ - height: 650 -}); - -$('#calendar').fullCalendar('option', 'height', 700); - -$('#calendar').fullCalendar({ - contentHeight: 600 -}); - -$('#calendar').fullCalendar('option', 'contentHeight', 650); - -$('#calendar').fullCalendar({ - aspectRatio: 2 -}); - -$('#calendar').fullCalendar('option', 'aspectRatio', 1.8); - -$('#calendar').fullCalendar({ - viewRender(view) { - alert('The new title of the view is ' + view.title); - } -}); - -$('#calendar').fullCalendar({ - windowResize(view) { - alert('The calendar has adjusted to a window resize'); - } -}); - -$('#calendar').fullCalendar('render'); - -$('#calendar').fullCalendar({ - dragOpacity: .5 -}); - -const view = $('#calendar').fullCalendar('getView'); -alert("The view's title is " + view.title); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,basicWeek,basicDay' - }, - editable: true, - events: [ - { - title: 'All Day Event', - start: new Date(y, m, 1) - }, - { - title: 'Long Event', - start: new Date(y, m, d - 5), - end: new Date(y, m, d - 2) - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d - 3, 16, 0), - allDay: false - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d + 4, 16, 0), - allDay: false - }, - { - title: 'Meeting', - start: new Date(y, m, d, 10, 30), - allDay: false - }, - { - title: 'Lunch', - start: new Date(y, m, d, 12, 0), - end: new Date(y, m, d, 14, 0), - allDay: false - }, - { - title: 'Birthday Party', - start: new Date(y, m, d + 1, 19, 0), - end: new Date(y, m, d + 1, 22, 30), - allDay: false - }, - { - title: 'Click for Google', - start: new Date(y, m, 28), - end: new Date(y, m, 29), - url: 'http://google.com/' - } - ] - }); -}); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,basicWeek,basicDay' - }, - defaultView: 'basicWeek', - editable: true, - events: [ - { - title: 'All Day Event', - start: new Date(y, m, 1) - }, - { - title: 'Long Event', - start: new Date(y, m, d - 5), - end: new Date(y, m, d - 2) - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d - 3, 16, 0), - allDay: false - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d + 4, 16, 0), - allDay: false - }, - { - title: 'Meeting', - start: new Date(y, m, d, 10, 30), - allDay: false - }, - { - title: 'Lunch', - start: new Date(y, m, d, 12, 0), - end: new Date(y, m, d, 14, 0), - allDay: false - }, - { - title: 'Birthday Party', - start: new Date(y, m, d + 1, 19, 0), - end: new Date(y, m, d + 1, 22, 30), - allDay: false - }, - { - title: 'Click for Google', - start: new Date(y, m, 28), - end: new Date(y, m, 29), - url: 'http://google.com/' - } - ] - }); -}); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,basicWeek,basicDay' - }, - defaultView: 'basicDay', - editable: true, - events: [ - { - id: 1, - title: "Long Event", - start: new Date(y, m, d, 14, 0), - end: new Date(y, m, d + 3), - allDay: false - }, - { - id: 2, - title: "Repeating Event", - start: new Date(y, m, d - 1), - allDay: true - }, - { - id: 2, - title: "Repeating Event", - start: new Date(y, m, d + 6), - allDay: true - }, - { - id: 3, - title: "Meeting", - start: new Date(y, m, d, 9, 0), - allDay: false - }, - { - id: 4, - title: "Click for Facebook", - start: new Date(y, m, d, 16), - end: new Date(y, m, d), - url: "http://facebook.com/", - allDay: false - } - ] - }); -}); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - editable: true, - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - defaultView: 'agendaWeek', - events: [ - { - title: 'All Day Event', - start: new Date(y, m, 1) - }, - { - title: 'Long Event', - start: new Date(y, m, d - 5), - end: new Date(y, m, d - 2) - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d - 3, 16, 0), - allDay: false - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d + 4, 16, 0), - allDay: false - }, - { - title: 'Meeting', - start: new Date(y, m, d, 10, 30), - allDay: false - }, - { - title: 'Lunch', - start: new Date(y, m, d, 12, 0), - end: new Date(y, m, d, 14, 0), - allDay: false - }, - { - title: 'Birthday Party', - start: new Date(y, m, d + 1, 19, 0), - end: new Date(y, m, d + 1, 22, 30), - allDay: false - }, - { - title: 'Click for Google', - start: new Date(y, m, 28), - end: new Date(y, m, 29), - url: 'http://google.com/' - } - ] - }); -}); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - defaultView: 'agendaDay', - editable: true, - events: [ - { - id: 1, - title: "Long Event", - start: new Date(y, m, d), - end: new Date(y, m, d + 3), - allDay: true - }, - { - id: 2, - title: "Repeating Event", - start: new Date(y, m, d - 1), - allDay: true - }, - { - id: 2, - title: "Repeating Event", - start: new Date(y, m, d + 6), - allDay: true - }, - { - id: 3, - title: "Meeting", - start: new Date(y, m, d, 10, 0), - allDay: false - }, - { - id: 4, - title: "Click for Facebook", - start: new Date(y, m, d, 11, 30), - end: new Date(y, m, d), - url: "http://facebook.com/", - allDay: false - } - ] - }); -}); - -$('#my-prev-button').click(() => { - $('#calendar').fullCalendar('prev'); -}); - -$('#my-next-button').click(() => { - $('#calendar').fullCalendar('next'); -}); - -$('#my-today-button').click(() => { - $('#calendar').fullCalendar('today'); -}); - -$('#calendar').fullCalendar('gotoDate', 1, 0, 1); - -$('#my-button').click(() => { - const d = $('#calendar').fullCalendar('getDate'); - alert("The current date of the calendar is " + d); -}); - -$('#calendar').fullCalendar({ - events: [ - { - title: 'My Event', - start: '2010-01-01T14:30:00', - allDay: false - } - // other events here... - ], - timeFormat: 'H(:mm)' // uppercase H for 24-hour clock -}); - -$('#calendar').fullCalendar({ - buttonText: { - prev: '<', - next: '>' - } -}); - -$('#calendar').fullCalendar({ - dayClick(date, jsEvent, view) { - alert(`Coordinates: ${jsEvent.pageX},${jsEvent.pageY}`); - - alert('Current view: ' + view.name); - - // change the day's background color just for fun - $(this).css('background-color', 'red'); - } -}); - -$('#calendar').fullCalendar({ - eventClick(calEvent, jsEvent, view) { - alert('Event: ' + calEvent.title); - alert(`Coordinates: ${jsEvent.pageX},${jsEvent.pageY}`); - alert('View: ' + view.name); - - // change the border color just for fun - $(this).css('border-color', 'red'); - } -}); - -$('#calendar').fullCalendar({ - events: [ - { - title: 'My Event', - start: '2010-01-01', - url: 'http://google.com/' - } - // other events here - ], - eventClick(event) { - if (event.url) { - window.open(event.url); - return false; - } - } -}); - -$('#calendar').fullCalendar({ - eventSources: [ - // your event source - { - url: '/myfeed.php', - type: 'POST', - data: { - custom_param1: 'something', - custom_param2: 'somethingelse' - }, - error() { - alert('there was an error while fetching events!'); - }, - color: 'yellow', // a non-ajax option - textColor: 'black' // a non-ajax option - } - - // any other sources... - ] -}); - -$('#calendar').fullCalendar({ - events: { - url: '/myfeed.php', - type: 'POST', - data: { - custom_param1: 'something', - custom_param2: 'somethingelse' - }, - error() { - alert('there was an error while fetching events!'); - }, - color: 'yellow', // a non-ajax option - textColor: 'black' // a non-ajax option - } -}); - -$('#calendar').fullCalendar({ - events: { - url: '/myfeed.php', - cache: true - } -}); - -$('#calendar').fullCalendar({ - eventSources: [ - // your event source - { - url: '/myfeed.php', // use the `url` property - color: 'yellow', // an option! - textColor: 'black' // an option! - } - - // any other sources... - ] -}); - -$('#calendar').fullCalendar({ - events: '/myfeed.php' -}); - -$('#calendar').fullCalendar({ - events: [ - { - title: 'event1', - start: '2010-01-01' - }, - { - title: 'event2', - start: '2010-01-05', - end: '2010-01-07' - }, - { - title: 'event3', - start: '2010-01-09 12:30:00', - allDay: false // will make the time show - } - ] -}); - -$('#calendar').fullCalendar({ - eventSources: [ - // your event source - { - events: [ // put the array in the `events` property - { - title: 'event1', - start: '2010-01-01' - }, - { - title: 'event2', - start: '2010-01-05', - end: '2010-01-07' - }, - { - title: 'event3', - start: '2010-01-09 12:30:00', - } - ], - color: 'black', // an option! - textColor: 'yellow' // an option! - } - - // any other event sources... - ] -}); - -$('#calendar').fullCalendar({ - events(start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: (events: FullCalendar.EventObject[]) => void) { - $.ajax({ - url: 'myxmlfeed.php', - dataType: 'xml', - data: { - // our hypothetical feed requires UNIX timestamps - start: Math.round(start.toDate().getTime() / 1000), - end: Math.round(end.toDate().getTime() / 1000) - }, - success(doc) { - const events: any[] = []; - $(doc).find('event').each(() => { - events.push({ - title: $(this).attr('title'), - start: $(this).attr('start') // will be parsed - }); - }); - callback(events); - } - }); - } -}); - -$('#calendar').fullCalendar({ - eventSources: [ - // your event source - { - events(start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: (events: FullCalendar.EventObject[]) => void) { - // ... - }, - color: 'yellow', // an option! - textColor: 'black' // an option! - } - // any other sources... - ] -}); - -$('#calendar').fullCalendar({ - eventSources: [ - '/feed1.php', - '/feed2.php' - ] -}); - -$('#calendar').fullCalendar({ - eventClick(event, element) { - event.title = "CLICKED!"; - - $('#calendar').fullCalendar('updateEvent', event); - } -}); - -$('#calendar').fullCalendar({ - events: [ - // my event data - ], - eventColor: '#378006' -}); - -interface JQueryQTip extends JQuery { - qtip(options: Object): JQuery; // dummy plugin interface -} - -$('#calendar').fullCalendar({ - events: [ - { - title: 'My Event', - start: '2010-01-01', - description: 'This is a cool event' - } - // more events here - ], - eventRender(event: FullCalendar.EventObject, element: JQueryQTip, view: FullCalendar.ViewObject) { - element.qtip({ - content: event.description - }); - } -}); -$('#my-draggable').draggable({ - revert: true, // immediately snap back to original position - revertDuration: 0 // -}); - -$('#calendar').fullCalendar({ - droppable: true, - drop(date, allDay) { - alert(`Dropped on ${date} with allDay=${allDay}`); - } -}); - -$('#calendar').fullCalendar({ - droppable: true, - dropAccept: '.cool-event', - drop() { - alert('dropped!'); - } -}); - -$('#draggable1').draggable(); -$('#draggable2').draggable(); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - editable: true, - events: [ - { - title: 'All Day Event', - start: new Date(y, m, 1) - }, - { - title: 'Long Event', - start: new Date(y, m, d - 5), - end: new Date(y, m, d - 2) - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d - 3, 16, 0), - allDay: false - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d + 4, 16, 0), - allDay: false - }, - { - title: 'Meeting', - start: new Date(y, m, d, 10, 30), - allDay: false - }, - { - title: 'Lunch', - start: new Date(y, m, d, 12, 0), - end: new Date(y, m, d, 14, 0), - allDay: false - }, - { - title: 'Birthday Party', - start: new Date(y, m, d + 1, 19, 0), - end: new Date(y, m, d + 1, 22, 30), - allDay: false - }, - { - title: 'Click for Google', - start: new Date(y, m, 28), - end: new Date(y, m, 29), - url: 'http://google.com/' - } - ] - }); -}); - -$(document).ready(() => { - /* initialize the external events - -----------------------------------------------------------------*/ - $('#external-events div.external-event').each(() => { - // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/) - // it doesn't need to have a start or end - const eventObject = { - title: $.trim($(this).text()) // use the element's text as the event title - }; - - // store the Event Object in the DOM element so we can get to it later - $(this).data('eventObject', eventObject); - - // make the event draggable using jQuery UI - $(this).draggable({ - zIndex: 999, - revert: true, // will cause the event to go back to its - revertDuration: 0 // original position after the drag - }); - }); - /* initialize the calendar - -----------------------------------------------------------------*/ - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - editable: true, - droppable: true, // this allows things to be dropped onto the calendar !!! - drop(date, allDay) { // this function is called when something is dropped - - // retrieve the dropped element's stored Event Object - const originalEventObject = $(this).data('eventObject'); - - // we need to copy it, so that multiple events don't have a reference to the same object - const copiedEventObject: any = $.extend({}, originalEventObject); - - // assign it the date that was reported - copiedEventObject.start = date; - copiedEventObject.allDay = allDay; - - // render the event on the calendar - // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/) - $('#calendar').fullCalendar('renderEvent', copiedEventObject, true); - - // is the "remove after drop" checkbox checked? - if ($('#drop-remove').is(':checked')) { - // if so, remove the element from the "Draggable Events" list - $(this).remove(); - } - } - }); -}); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - editable: true, - events: [{ - id: 'test1', - title: 'event full of features', - start: new Date(y, m, 1), - startEditable: true, - allDay: false, - url: 'http://www.google.com', - className: 'gcal-event', - editable: false, - durationEditable: false, - rendering: 'background', - overlap: false, - constraint: { - start: '10:00', - end: '18:00', - dow: [ 1, 2 ], - // days of week. an array of zero-based day of week integers (0=Sunday) - // (Monday-Tuesday in this example) - }, - color: 'white', - backgroundColor: 'black', - borderColor: 'grey', - textColor: 'white', - }], - }); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - editable: true, - events: [{ - id: 'test2', - title: 'just an event', - start: new Date(y, m, 1), - }], - eventConstraint: 'businessHours', - eventLimit: true, - businessHours: [{ - start: '10:00', - end: '18:00', - dow: [ 1, 2 ], - // days of week. an array of zero-based day of week integers (0=Sunday) - // (Monday-Tuesday in this example) - }, { - start: '09:00', - end: '19:00', - dow: [ 3, 4 ], - }], - }); - - $('#calendar').fullCalendar('refetchEventSources', 'http://www.google.com/your_feed_url1/'); -}); - -$('#calendar').fullCalendar('refetchEvents'); diff --git a/types/fullcalendar/index.d.ts b/types/fullcalendar/index.d.ts deleted file mode 100644 index 3d5ff28f12..0000000000 --- a/types/fullcalendar/index.d.ts +++ /dev/null @@ -1,1134 +0,0 @@ -// Type definitions for FullCalendar 3.5 -// Project: http://fullcalendar.io/ -// Definitions by: Neil Stalker , -// Marcelo Camargo , -// Patrick Niemann -// Hadrien Milano -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -import * as moment from 'moment'; - -export as namespace FC; - -export interface Calendar { - /** - * Gets the version of Fullcalendar - */ - version: string; -} - -export interface BusinessHours { - start: moment.Duration | string | Date; - end: moment.Duration | string | Date; - dow: number[]; -} - -export interface Timespan { - start: moment.Moment | string | Date; - end?: moment.Moment | string | Date; -} - -export interface Header { - left: string; - center: string; - right: string; -} - -export interface CustomButtonDefinition { - text: string; - click(element: JQuery): void; - icon?: string; - themeIcon?: string; - bootstrapGlyphicon?: string; -} - -export interface ButtonIconsDefinition { - prev: string; - next: string; - prevYear: string; - nextYear: string; -} - -export interface EventSegment { - /** - * the Event Object - */ - event: EventObject; - - /** - * the Moment for when this stretch of the event begins - */ - start: moment.Moment; - - /** - * the Moment for when this stretch of the event ends (exclusive) - */ - end: moment.Moment; - - /** - * boolean if this is chronologically the first segment for the event - */ - isStart: boolean; - - /** - * boolean if this is chronologically the last segment for the event - */ - isEnd: boolean; -} - -export interface CellInfo { - /** - * the Moment date of the day - */ - date: moment.Moment; - - /** - * jQuery element for the day cell - */ - dayEl: JQuery; - - /** - * jQuery element for the "more" link - */ - moreEl: JQuery; - - /** - * array of all event "segment" objects for the given day - */ - segs: EventSegment[]; - - /** - * array of only the segment objects that were not displayed prior - */ - hiddenSegs: EventSegment[]; -} - -export interface TimeRange { - start: string | Date | moment.Moment; - end: string | Date | moment.Moment; -} - -export interface DropInfo { - start: moment.Moment; - - /** - * exclusive end date/time - */ - end: moment.Moment; - - /** - * if you are using a Resource View - */ - resourceId?: string; -} - -export interface Options extends - GeneralDisplayOptions, - TimezoneOptions, - ViewsOptions, - AgendaOptions, - ListViewOptions, - CurrentDateOptions, - TextTimeCustomizationOptions, - ClickingAndHoveringOptions, - SelectionOptions, - EventDataOptions, - EventRenderingOptions, - EventDraggingResizingOptions, - DroppingExternalElementsOptions { - // scheduler options - resourceAreaWidth?: number; - schedulerLicenseKey?: string; - resourceLabelText?: any; - resourceColumns?: any; - displayEventTime?: any; -} - -/** - * General display - https://fullcalendar.io/docs/display/ - */ -export interface GeneralDisplayOptions { - /** - * Defines the buttons and title at the top of the calendar. - * - * default: - * { - * left: 'title', - * center: '', - * right: 'today prev,next' - * } - */ - header?: boolean | Header; - - /** - * Renders a set of controls at the bottom of the calendar. - * - * default: false - */ - footer?: boolean | Header; - - /** - * Defines custom buttons that can be used in the header. - */ - customButtons?: { [name: string]: CustomButtonDefinition }; - - /** - * Determines which icons are displayed in buttons of the header. - * - * default: - * { - * prev: 'left-single-arrow', - * next: 'right-single-arrow', - * prevYear: 'left-double-arrow', - * nextYear: 'right-double-arrow' - * } - * - */ - buttonIcons?: boolean | ButtonIconsDefinition; - - /** - * Renders the calendar with a given theme system. - * - * default: 'standard' - */ - themeSystem?: 'standard' | 'bootstrap3' | 'jquery-ui'; - - /** - * Determines which icons are displayed in buttons of the header when jQuery UI theming is on. - */ - themeButtonIcons?: boolean | ButtonIconsDefinition; - - /** - * Determines which icons are displayed in buttons of the header when Bootstrap theming is on. - */ - bootstrapGlyphicons?: boolean | ButtonIconsDefinition; - - /** - * The day that each week begins. - * - * 0 = Sunday - * - * default: set by the current `locale` - */ - firstDay?: number; - - /** - * Displays the calendar in right-to-left mode. - * - * default: false - */ - isRTL?: boolean; - - /** - * Whether to include Saturday/Sunday columns in any of the calendar views. - * - * default: true - */ - weekends?: boolean; - - /** - * Exclude certain days-of-the-week from being displayed. - * - * default: [] - */ - hiddenDays?: number[]; - - /** - * Determines the number of weeks displayed in a month view. - * - * default: true - */ - fixedWeekCount?: boolean; - - /** - * Determines if week numbers should be displayed on the calendar. - * - * default: false - */ - weekNumbers?: boolean; - - /** - * Determines the styling for week numbers in month view and the basic views. - * - * default: false - */ - weekNumbersWithinDays?: boolean; - - /** - * The method for calculating week numbers that are displayed with the weekNumbers setting. - * - * default: 'local' - */ - weekNumberCalculation?: 'local' | 'ISO' | ((m: moment.Moment) => number); - - /** - * Emphasizes certain time slots on the calendar. By default, Monday-Friday, 9am-5pm. - * - * default: false - */ - businessHours?: boolean | BusinessHours | BusinessHours[]; - - /** - * In month view, whether dates in the previous or next month should be rendered at all. - * - * default: true - */ - showNonCurrentDates?: boolean; - - /** - * Will make the entire calendar (including header) a pixel height. - * - * default: undefined - */ - height?: number | 'auto' | 'parent' | (() => number); - - /** - * Will make the calendar's content area a pixel height. - */ - contentHeight?: number | 'auto' | (() => number); - - /** - * Determines the width-to-height aspect ratio of the calendar. - * - * default: 1.35 - */ - aspectRatio?: number; - - /** - * Whether to automatically resize the calendar when the browser window resizes. - * - * default: true - */ - handleWindowResize?: boolean; - - /** - * Time, in milliseconds, the calendar will wait to adjust its size after a window resize event occurs. - * - * default: 100 - */ - windowResizeDelay?: number; - - /** - * Limits the number of events displayed on a day. - * - * default: false - */ - eventLimit?: boolean | number; - - /** - * Determines the action taken when the user clicks on a "more" link created by the eventLimit option. - */ - eventLimitClick?: 'popover' | 'week' | 'day' | string | ((cellinfo: CellInfo, jsevent: Event) => void); - - /** - * Triggered when a new date-range is rendered, or when the view type switches. - */ - viewRender?(view: ViewObject, element: JQuery): void; - - /** - * Triggered when a rendered date-range needs to be torn down. - */ - viewDestroy?(view: ViewObject, element: JQuery): void; - - /** - * A hook for modifying a day cell. - */ - dayRender?(date: moment.Moment, cell: JQuery): void; - - /** - * Triggered after the calendar's dimensions have been changed due to the browser window being resized. - */ - windowResize?(view: ViewObject): void; -} - -/** - * Timezone - https://fullcalendar.io/docs/timezone/ - */ -export interface TimezoneOptions { - /** - * Determines the timezone in which dates throughout the API are parsed and rendered. - * - * default: false - */ - timezone?: string | boolean; - - /** - * Explicitly sets the "today" date of the calendar. This is the day that is normally highlighted in yellow. - */ - now?: moment.Moment | Date | string | (() => moment.Moment); -} - -/** - * Views - https://fullcalendar.io/docs/views/ - */ -export interface ViewsOptions { - /** - * The initial view when the calendar loads. - * - * default: 'month' - */ - defaultView?: string; - - views?: ViewSpecificOptions; -} - -/** - * Agenda Options - https://fullcalendar.io/docs/agenda/ - */ -export interface AgendaOptions { - /** - * Determines if the "all-day" slot is displayed at the top of the calendar. - * - * default: true - */ - allDaySlot?: boolean; - - /** - * The text titling the "all-day" slot at the top of the calendar. - * - * default: 'all-day' - */ - allDayText?: string; - - /** - * The frequency for displaying time slots. - * - * default: '00:30:00' - */ - slotDuration?: moment.Duration; - - /** - * Determines the time-text that will be displayed on the vertical axis of the agenda views. - * - * default: 'h(:mm)a' - */ - slotLabelFormat?: string; - - /** - * Determines how often the time-axis is labeled with text displaying the date/time of slots. - */ - slotLabelInterval?: moment.Duration; - - /** - * The time interval at which a dragged event will snap to the agenda view time grid. Also affects the granularity at which `selections` can be made. - */ - snapDuration?: moment.Duration; - - /** - * Determines how far down the scroll pane is initially scrolled down. - * - * default: '06:00:00' (6am) - */ - scrollTime?: moment.Duration; - - /** - * Determines the starting time that will be displayed, even when the scrollbars have been scrolled all the way up. - * - * default: "00:00:00" - */ - minTime?: moment.Duration; - - /** - * Determines the end time (exclusively) that will be displayed, even when the scrollbars have been scrolled all the way down. - * - * default: "24:00:00" - */ - maxTime?: moment.Duration; - - /** - * Determines if timed events in agenda view should visually overlap. - * - * default: true - */ - slotEventOverlap?: boolean; -} - -/** - * List View - https://fullcalendar.io/docs/list_view/ - */ -export interface ListViewOptions { - /** - * A date formatting string that affects the text on the left side of the day headings in list view. - */ - listDayFormat?: string | boolean; - - /** - * A date formatting string that affects the text on the right side of the day headings in list view. - */ - listDayAltFormat?: string | boolean; - - /** - * The text that is displayed in the middle of list view, alerting the user that there are no events within the given range. - * - * default: "No events to display" - */ - noEventsMessage?: string; -} - -/** - * Current Date - https://fullcalendar.io/docs/current_date/ - */ -export interface CurrentDateOptions { - /** - * The initial date displayed when the calendar first loads. - */ - defaultDate?: moment.Moment | Date | string; - - /** - * Whether or not to display a marker indicating the current time. - * - * default: false - */ - nowIndicator?: boolean; - - /** - * Sets the exact date range that is visible in a view. - */ - visibleRange?: ((currentDate: moment.Moment) => TimeRange) | TimeRange; - - /** - * Limits which dates the user can navigate to and where events can go. - */ - validRange?: TimeRange; - - /** - * How far into the future/past the calendar navigates when prev/next is executed. - */ - dateIncrement?: moment.Duration; - - /** - * Determines the first visible day for a Custom or Generic view. - */ - dateAlignment?: string; - - /** - * Sets the exact duration of a Custom or Generic view. - */ - duration?: moment.Duration; - - /** - * Sets the exact number of days displayed in a Custom or Generic view, regardless of weekends or hiddenDays. - */ - dayCount?: number; -} - -/** - * Text/Time Customization - https://fullcalendar.io/docs/text/ - */ -export interface TextTimeCustomizationOptions { - /** - * Customize the language and localization options for the calendar. - * - * default 'en' - */ - locale?: string; - - /** - * Determines the time-text that will be displayed on each event. - */ - timeFormat?: string; - - /** - * Determines the text that will be displayed on the calendar's column headings. - */ - columnFormat?: string; - - /** - * Determines the text that will be displayed in the header's title. - */ - titleFormat?: string; - - /** - * Text that will be displayed on buttons of the header. - */ - buttonText?: ButtonTextObject; - - /** - * Full names of months. - */ - monthNames?: string[]; - - /** - * Abbreviated names of months. - */ - monthNamesShort?: string[]; - - /** - * Full names of days-of-week. - */ - dayNames?: string[]; - - /** - * Abbreviated names of days-of-week. - */ - dayNamesShort?: string[]; - - /** - * The heading text for week numbers. - * - * default: 'W' - */ - weekNumberTitle?: string; - - /** - * Whether or not to display the text for an event's time. - */ - displayEventTime?: boolean; - - /** - * Whether or not to display an event's end time text when it is rendered on the calendar. - */ - displayEventEnd?: boolean; - - /** - * Determines the text of the link created by eventLimit setting. - * - * default: "more" - */ - eventLimitText?: string | ((nEvents: number) => string); - - /** - * Determines the date format of title of the popover created by the eventLimitClick option. - */ - dayPopoverFormat?: string; -} - -/** - * Clicking & Hovering - https://fullcalendar.io/docs/mouse/ - */ -export interface ClickingAndHoveringOptions { - /** - * Determines if day names and week names are clickable. - * - * default: false - */ - navLinks?: boolean; - - /** - * Determines what happens upon a day heading nav-link click. - */ - navLinkDayClick?: string | ((date: any, jsEvent: Event) => void); - - /** - * Determines what happens upon a week-number nav-link click. - */ - navLinkWeekClick?: string | ((weekStart: any, jsEvent: Event) => void); - - /** - * Triggered when the user clicks on a day. - */ - dayClick?(date: Date, jsEvent: MouseEvent, view: ViewObject): void; - - /** - * Triggered when the user clicks an event. - */ - eventClick?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): boolean | void; // return type boolean or void - - /** - * Triggered when the user mouses over an event. - */ - eventMouseover?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): void; - - /** - * Triggered when the user mouses out of an event. - */ - eventMouseout?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): void; -} - -/** - * Selection - https://fullcalendar.io/docs/selection/ - */ -export interface SelectionOptions { - selectable?: boolean; - selectHelper?: boolean; - unselectAuto?: boolean; - unselectCancel?: string; - selectOverlap?: boolean | ((event: EventObject) => boolean); - selectConstraint?: Timespan | BusinessHours; - select?(start: moment.Moment, end: moment.Moment, jsEvent: MouseEvent, view: ViewObject, resource?: any): void; - unselect?(view: ViewObject, jsEvent: Event): void; -} - -/** - * Event Data - https://fullcalendar.io/docs/event_data/ - * - * TODO: update interface to v3 - */ -export interface EventDataOptions { - /** - * This has one of the following types: - * - * - EventObject[] - * - string (JSON feed) - * - (start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: {(events: EventObject[]) => void;}) => void; - */ - events?: any; - - /** - * An array, each element being one of the following types: - * - * - EventSource - * - EventObject[] - * - string (JSON feed) - * - (start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: {(events: EventObject[]) => void;}) => void; - */ - eventSources?: any[]; - - allDayDefault?: boolean; - startParam?: string; - endParam?: string; - lazyFetching?: boolean; - eventDataTransform?(eventData: any): EventObject; - loading?(isLoading: boolean, view: ViewObject): void; -} - -/** - * Event Rendering - https://fullcalendar.io/docs/event_rendering/ - */ -export interface EventRenderingOptions { - /** - * Sets the background and border colors for all events on the calendar. - */ - eventColor?: string; - - /** - * Sets the background color for all events on the calendar. - */ - eventBackgroundColor?: string; - - /** - * Sets the border color for all events on the calendar. - */ - eventBorderColor?: string; - - /** - * Sets the text color for all events on the calendar. - */ - eventTextColor?: string; - - /** - * When an event's end time spans into another day, the minimum time it must be in order for it to render as if it were on that day. - * - * default: "09:00:00" (9am) - */ - nextDayThreshold?: moment.Duration; - - /** - * Determines the vertical ordering events that have the same dates / times. - * - * default 'title' - */ - eventOrder?: string | Array<((a: EventObject, b: EventObject) => number) | (string | ((a: EventObject, b: EventObject) => number))>; - - /** - * The amount of milliseconds to wait after an operation, before rendering events. - * - * default: null - */ - eventRenderWait?: number | null; - - /** - * Triggered while an event is being rendered. - */ - eventRender?(event: EventObject, element: JQuery, view: ViewObject): void; - - /** - * Triggered after an event has been placed on the calendar in its final position. - */ - eventAfterRender?(event: EventObject, element: JQuery, view: ViewObject): void; - - /** - * Triggered after all events have finished rendering. - */ - eventAfterAllRender?(view: ViewObject): void; - - /** - * Called before an event's element is removed from the DOM. - */ - eventDestroy?(event: EventObject, element: JQuery, view: ViewObject): void; -} - -/** - * Event Dragging & Resizing - https://fullcalendar.io/docs/event_ui/ - */ -export interface EventDraggingResizingOptions { - /** - * Determines whether the events on the calendar can be modified. - * - * default: false - */ - editable?: boolean; - - /** - * Allow events' start times to be editable through dragging. - * - * default: true - */ - eventStartEditable?: boolean; - - /** - * Allow events' durations to be editable through resizing. - * - * default: true - */ - eventDurationEditable?: boolean; - - /** - * Time it takes for an event to revert to its original position after an unsuccessful drag. - * - * default: 500 - */ - dragRevertDuration?: number; // integer, milliseconds - - /** - * The opacity of an event while it is being dragged. - * - * default: .75 - */ - dragOpacity?: number; - - /** - * Whether to automatically move scroll containers during event drag-and-drop or while selecting. - * - * default: true - */ - dragScroll?: boolean; - - /** - * Determines if events on the calendar, when dragged and resized, are allowed to overlap each other. - * - * default: true - */ - eventOverlap?: boolean | ((stillEvent: EventObject, movingEvent: EventObject) => boolean); - - /** - * Limits event dragging and resizing to certain windows of time. - */ - eventConstraint?: "businessHours" | BusinessHours | Timespan | string; - - /** - * Exact programmatic control over where an event can be dropped. - */ - eventAllow?: ((dropInfo: DropInfo, draggedEvent: Event) => boolean); - - /** - * For touch devices, the amount of time the user most hold down before an event becomes draggable or a date becomes selectable. - * - * default: 1000 - */ - longPressDelay?: number; - - /** - * For touch devices, the amount of time the user most hold down before an event becomes draggable. - * - * default: 1000 - */ - eventLongPressDelay?: number; - - /** - * Triggered when event dragging begins. - */ - eventDragStart?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void; - - /** - * Triggered when event dragging stops. - */ - eventDragStop?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void; - - /** - * Triggered when dragging stops and the event has moved to a different day/time. - */ - eventDrop?(event: EventObject, delta: moment.Duration, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject): void; - - /** - * Triggered when event resizing begins. - */ - eventResizeStart?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void; - - /** - * Triggered when event resizing stops. - */ - eventResizeStop?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void; - - /** - * Triggered when resizing stops and the event has changed in duration. - */ - eventResize?(event: EventObject, delta: moment.Duration, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject): void; -} - -/** - * Dropping External Elements - https://fullcalendar.io/docs/dropping/ - */ -export interface DroppingExternalElementsOptions { - /** - * Determines if jQuery UI draggables can be dropped onto the calendar. - * - * default: false - */ - droppable?: boolean; - - /** - * Provides a way to filter which elements can be dropped onto the calendar. - */ - dropAccept?: string | ((draggable: any) => boolean); - - /** - * Called when a valid jQuery UI draggable has been dropped onto the calendar. - */ - drop?(date: moment.Moment, jsEvent: MouseEvent, ui: any): void; - - /** - * Called when an external element, containing event data, is dropped on the calendar. - */ - eventReceive?(event: EventObject): void; -} - -export interface ButtonTextObject { - prev?: string; - next?: string; - prevYear?: string; - nextYear?: string; - today?: string; - month?: string; - week?: string; - day?: string; - list?: string; -} - -// TODO: check compatibility with v3 and update if necessary -/* Refer to http://fullcalendar.io/docs/event_data/Event_Object/ */ -export interface EventObject extends Timespan { - id?: any; // String/number - title: string; - allDay?: boolean; - url?: string; - className?: string | string[]; - editable?: boolean; - startEditable?: boolean; - durationEditable?: boolean; - rendering?: string; - overlap?: boolean; - constraint?: Timespan | BusinessHours; - source?: EventSource; - color?: string; - backgroundColor?: string; - borderColor?: string; - textColor?: string; - // non-standard fields, see https://fullcalendar.io/docs/event_data/Event_Object/ and https://fullcalendar.io/docs/event_rendering/eventRender/ - [x: string]: any; -} - -// TODO: check compatibility with v3 and update if necessary -export interface ViewObject extends Timespan { - name: string; - title: string; - intervalStart: moment.Moment; - intervalEnd: moment.Moment; -} - -// TODO: check compatibility with v3 and update if necessary -export interface EventSource extends JQueryAjaxSettings { - /** - * This has one of the following types: - * - * - EventObject[] - * - string (JSON feed) - * - (start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: {(events: EventObject[]) => void;}) => void; - */ - events?: any; - - color?: string; - backgroundColor?: string; - borderColor?: string; - textColor?: string; - className?: any; // string/string[] - editable?: boolean; - allDayDefault?: boolean; - ignoreTimezone?: boolean; - eventTransform?: any; - startParam?: string; - endParam?: string; -} - -/* -* View Specific Options - http://fullcalendar.io/docs/views/View-Specific-Options/ -* TODO: check compatibility with v3 and update if necessary -*/ -export interface ViewSpecificOptions { - basic?: Options; - agenda?: Options; - week?: Options; - day?: Options; - month?: Options; - basicWeek?: Options; - basicDay?: Options; - agendaWeek?: Options; - agendaDay?: Options; -} - -declare global { - // TODO: check compatibility with v3 and update if necessary - interface JQuery { - /** - * Get/Set option value - */ - fullCalendar(method: 'option', option: string, value?: any): void; - - /** - * Immediately forces the calendar to render and/or readjusts its size. - */ - fullCalendar(method: 'render'): void; - - /** - * Restores the element to the state before FullCalendar was initialized. - */ - fullCalendar(method: 'destroy'): void; - - /** - * Returns the View Object for the current view. - */ - fullCalendar(method: 'getView'): ViewObject; - - /** - * Immediately switches to a different view. - */ - fullCalendar(method: 'changeView', viewName: string, dateOrRange?: moment.Moment | Date | string | TimeRange): void; - - /** - * Moves the calendar one step back (either by a month, week, or day). - */ - fullCalendar(method: 'prev'): void; - - /** - * Moves the calendar one step forward (either by a month, week, or day). - */ - fullCalendar(method: 'next'): void; - - /** - * Moves the calendar back one year. - */ - fullCalendar(method: 'prevYear'): void; - - /** - * Moves the calendar forward one year. - */ - fullCalendar(method: 'nextYear'): void; - - /** - * Moves the calendar to the current date. - */ - fullCalendar(method: 'today'): void; - - /** - * Moves the calendar to an arbitrary year/month/date. - */ - fullCalendar(method: 'gotoDate', year: number, month?: number, date?: number): void; - - /** - * Moves the calendar to an arbitrary date. - */ - fullCalendar(method: 'gotoDate', date: moment.Moment | Date | string): void; - - /** - * Moves the calendar forward/backward an arbitrary amount of time. - */ - fullCalendar(method: 'incrementDate', year: number, month?: number, date?: number): void; - - /** - * Returns a Date object for the current date of the calendar. - */ - fullCalendar(method: 'getDate'): Date; - - /** - * A method for programmatically selecting a period of time. - */ - fullCalendar(method: 'select', startDate: Date, endDate: Date, allDay: boolean): void; - - /** - * A method for programmatically clearing the current selection. - */ - fullCalendar(method: 'unselect'): void; - - /** - * Reports changes to an event and renders them on the calendar. - */ - fullCalendar(method: 'updateEvent', event: EventObject): void; - - /** - * Reports changes for multiple events and renders them on the calendar. - */ - fullCalendar(method: 'updateEvents', events: EventObject[]): void; - - /** - * Retrieves events that FullCalendar has in memory. - */ - fullCalendar(method: 'clientEvents', idOrfilter?: any): EventObject[]; - - /** - * Retrieves events that FullCalendar has in memory. - */ - fullCalendar(method: 'clientEvents', idOrfilter?: (e: EventObject) => boolean): EventObject[]; - - /** - * Removes events from the calendar. - */ - fullCalendar(method: 'removeEvents', idOrfilter?: any): void; - - /** - * Removes events from the calendar. - */ - fullCalendar(method: 'removeEvents', idOrfilter?: (e: EventObject) => boolean): void; - - /** - * Refetches events from all sources and rerenders them on the screen. - */ - fullCalendar(method: 'refetchEvents'): void; - - /** - * Dynamically adds an event source. - */ - fullCalendar(method: 'addEventSource', source: any): void; - - /** - * Dynamically removes an event source. - */ - fullCalendar(method: 'removeEventSource', source: any): void; - - /** - * Renders a new event on the calendar. - */ - fullCalendar(method: 'renderEvent', event: EventObject, stick?: boolean): void; - - /** - * Renders new events on the calendar. - */ - fullCalendar(method: 'renderEvents', events: EventObject[], stick?: boolean): void; - - /** - * Rerenders all events on the calendar. - */ - fullCalendar(method: 'rerenderEvents'): void; - - /** - * Refetches one or more specific event sources. - */ - fullCalendar(method: 'refetchEventSources', source: any): void; - - /** - * Create calendar object - */ - fullCalendar(options: Options): JQuery; - - /** - * Generic method function - */ - fullCalendar(method: string, arg1: any, arg2: any, arg3: any): void; - } - - interface JQueryStatic { - fullCalendar: Calendar; - } -} diff --git a/types/fullcalendar/package.json b/types/fullcalendar/package.json deleted file mode 100644 index 19e5fb0d14..0000000000 --- a/types/fullcalendar/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "moment": ">=2.14.0" - } -} diff --git a/types/fullcalendar/tsconfig.json b/types/fullcalendar/tsconfig.json deleted file mode 100644 index 289c13f80e..0000000000 --- a/types/fullcalendar/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": false, - "noImplicitThis": false, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "fullcalendar-tests.ts" - ] -} \ No newline at end of file diff --git a/types/fullcalendar/tslint.json b/types/fullcalendar/tslint.json deleted file mode 100644 index 1b62a88e52..0000000000 --- a/types/fullcalendar/tslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "ban-types": false, - "unified-signatures": false - } -} diff --git a/types/fullcalendar/v1/fullcalendar-tests.ts b/types/fullcalendar/v1/fullcalendar-tests.ts deleted file mode 100644 index f5c81c0727..0000000000 --- a/types/fullcalendar/v1/fullcalendar-tests.ts +++ /dev/null @@ -1,793 +0,0 @@ -/// - -// All examples from http://arshaw.com/fullcalendar/docs/ - -$('#calendar').fullCalendar({}); - -$('#calendar').fullCalendar({ - weekends: false -}); - -$('#calendar').fullCalendar({ - dayClick: () => { - alert('a day has been clicked!'); - } -}); - -$('#calendar').fullCalendar('next'); - -$('#calendar').fullCalendar({ - events: 'http://www.google.com/your_feed_url/' -}); - -$('#calendar').fullCalendar({ - events: { - url: 'http://www.google.com/your_feed_url/', - className: 'gcal-event', // an option! - currentTimezone: 'America/Chicago' // an option! - } -}); - -$('#calendar').fullCalendar({ - eventSources: [ - // source with no options - "http://www.google.com/your_feed_url1/", - - // source with no options - "http://www.google.com/your_feed_url2/", - - // source WITH options - { - url: "http://www.google.com/your_feed_url3/", - className: 'nice-event' - } - ] -}); - -$('#calendar').fullCalendar({ - height: 650 -}); - -$('#calendar').fullCalendar('option', 'height', 700); - -$('#calendar').fullCalendar({ - contentHeight: 600 -}); - -$('#calendar').fullCalendar('option', 'contentHeight', 650); - -$('#calendar').fullCalendar({ - aspectRatio: 2 -}); - -$('#calendar').fullCalendar('option', 'aspectRatio', 1.8); - -$('#calendar').fullCalendar({ - viewRender: view => { - alert('The new title of the view is ' + view.title); - } -}); - -$('#calendar').fullCalendar({ - windowResize: view => { - alert('The calendar has adjusted to a window resize'); - } -}); - -$('#calendar').fullCalendar('render'); - -$('#calendar').fullCalendar({ - dragOpacity: .5 -}); - -const view = $('#calendar').fullCalendar('getView'); -alert("The view's title is " + view.title); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,basicWeek,basicDay' - }, - editable: true, - events: [ - { - title: 'All Day Event', - start: new Date(y, m, 1) - }, - { - title: 'Long Event', - start: new Date(y, m, d - 5), - end: new Date(y, m, d - 2) - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d - 3, 16, 0), - allDay: false - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d + 4, 16, 0), - allDay: false - }, - { - title: 'Meeting', - start: new Date(y, m, d, 10, 30), - allDay: false - }, - { - title: 'Lunch', - start: new Date(y, m, d, 12, 0), - end: new Date(y, m, d, 14, 0), - allDay: false - }, - { - title: 'Birthday Party', - start: new Date(y, m, d + 1, 19, 0), - end: new Date(y, m, d + 1, 22, 30), - allDay: false - }, - { - title: 'Click for Google', - start: new Date(y, m, 28), - end: new Date(y, m, 29), - url: 'http://google.com/' - } - ] - }); -}); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,basicWeek,basicDay' - }, - defaultView: 'basicWeek', - editable: true, - events: [ - { - title: 'All Day Event', - start: new Date(y, m, 1) - }, - { - title: 'Long Event', - start: new Date(y, m, d - 5), - end: new Date(y, m, d - 2) - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d - 3, 16, 0), - allDay: false - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d + 4, 16, 0), - allDay: false - }, - { - title: 'Meeting', - start: new Date(y, m, d, 10, 30), - allDay: false - }, - { - title: 'Lunch', - start: new Date(y, m, d, 12, 0), - end: new Date(y, m, d, 14, 0), - allDay: false - }, - { - title: 'Birthday Party', - start: new Date(y, m, d + 1, 19, 0), - end: new Date(y, m, d + 1, 22, 30), - allDay: false - }, - { - title: 'Click for Google', - start: new Date(y, m, 28), - end: new Date(y, m, 29), - url: 'http://google.com/' - } - ] - }); -}); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,basicWeek,basicDay' - }, - defaultView: 'basicDay', - editable: true, - events: [ - { - id: 1, - title: "Long Event", - start: new Date(y, m, d, 14, 0), - end: new Date(y, m, d + 3), - allDay: false - }, - { - id: 2, - title: "Repeating Event", - start: new Date(y, m, d - 1), - allDay: true - }, - { - id: 2, - title: "Repeating Event", - start: new Date(y, m, d + 6), - allDay: true - }, - { - id: 3, - title: "Meeting", - start: new Date(y, m, d, 9, 0), - allDay: false - }, - { - id: 4, - title: "Click for Facebook", - start: new Date(y, m, d, 16), - end: new Date(y, m, d), - url: "http://facebook.com/", - allDay: false - } - ] - }); -}); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - editable: true, - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - defaultView: 'agendaWeek', - events: [ - { - title: 'All Day Event', - start: new Date(y, m, 1) - }, - { - title: 'Long Event', - start: new Date(y, m, d - 5), - end: new Date(y, m, d - 2) - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d - 3, 16, 0), - allDay: false - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d + 4, 16, 0), - allDay: false - }, - { - title: 'Meeting', - start: new Date(y, m, d, 10, 30), - allDay: false - }, - { - title: 'Lunch', - start: new Date(y, m, d, 12, 0), - end: new Date(y, m, d, 14, 0), - allDay: false - }, - { - title: 'Birthday Party', - start: new Date(y, m, d + 1, 19, 0), - end: new Date(y, m, d + 1, 22, 30), - allDay: false - }, - { - title: 'Click for Google', - start: new Date(y, m, 28), - end: new Date(y, m, 29), - url: 'http://google.com/' - } - ] - }); -}); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - defaultView: 'agendaDay', - editable: true, - events: [ - { - id: 1, - title: "Long Event", - start: new Date(y, m, d), - end: new Date(y, m, d + 3), - allDay: true - }, - { - id: 2, - title: "Repeating Event", - start: new Date(y, m, d - 1), - allDay: true - }, - { - id: 2, - title: "Repeating Event", - start: new Date(y, m, d + 6), - allDay: true - }, - { - id: 3, - title: "Meeting", - start: new Date(y, m, d, 10, 0), - allDay: false - }, - { - id: 4, - title: "Click for Facebook", - start: new Date(y, m, d, 11, 30), - end: new Date(y, m, d), - url: "http://facebook.com/", - allDay: false - } - ] - }); -}); - -$('#my-prev-button').click(() => { - $('#calendar').fullCalendar('prev'); -}); - -$('#my-next-button').click(() => { - $('#calendar').fullCalendar('next'); -}); - -$('#my-today-button').click(() => { - $('#calendar').fullCalendar('today'); -}); - -$('#calendar').fullCalendar('gotoDate', 1, 0, 1); - -$('#my-button').click(() => { - const d = $('#calendar').fullCalendar('getDate'); - alert("The current date of the calendar is " + d); -}); - -$('#calendar').fullCalendar({ - events: [ - { - title: 'My Event', - start: '2010-01-01T14:30:00', - allDay: false - } - // other events here... - ], - timeFormat: 'H(:mm)' // uppercase H for 24-hour clock -}); - -$('#calendar').fullCalendar({ - buttonText: { - prev: '<', - next: '>' - } -}); - -$('#calendar').fullCalendar({ - dayClick(date, allDay, jsEvent, view) { - if (allDay) { - alert('Clicked on the entire day: ' + date); - } else { - alert('Clicked on the slot: ' + date); - } - - alert(`Coordinates: ${jsEvent.pageX},${jsEvent.pageY}`); - - alert('Current view: ' + view.name); - - // change the day's background color just for fun - $(this).css('background-color', 'red'); - } -}); - -$('#calendar').fullCalendar({ - eventClick(calEvent, jsEvent, view) { - alert('Event: ' + calEvent.title); - alert(`Coordinates: ${jsEvent.pageX},${jsEvent.pageY}`); - alert('View: ' + view.name); - - // change the border color just for fun - $(this).css('border-color', 'red'); - } -}); - -$('#calendar').fullCalendar({ - events: [ - { - title: 'My Event', - start: '2010-01-01', - url: 'http://google.com/' - } - // other events here - ], - eventClick(event) { - if (event.url) { - window.open(event.url); - return false; - } - } -}); - -$('#calendar').fullCalendar({ - eventSources: [ - // your event source - { - url: '/myfeed.php', - type: 'POST', - data: { - custom_param1: 'something', - custom_param2: 'somethingelse' - }, - error: () => { - alert('there was an error while fetching events!'); - }, - color: 'yellow', // a non-ajax option - textColor: 'black' // a non-ajax option - } - - // any other sources... - ] -}); - -$('#calendar').fullCalendar({ - events: { - url: '/myfeed.php', - type: 'POST', - data: { - custom_param1: 'something', - custom_param2: 'somethingelse' - }, - error: () => { - alert('there was an error while fetching events!'); - }, - color: 'yellow', // a non-ajax option - textColor: 'black' // a non-ajax option - } -}); - -$('#calendar').fullCalendar({ - events: { - url: '/myfeed.php', - cache: true - } -}); - -$('#calendar').fullCalendar({ - eventSources: [ - // your event source - { - url: '/myfeed.php', // use the `url` property - color: 'yellow', // an option! - textColor: 'black' // an option! - } - - // any other sources... - ] -}); - -$('#calendar').fullCalendar({ - events: '/myfeed.php' -}); - -$('#calendar').fullCalendar({ - events: [ - { - title: 'event1', - start: '2010-01-01' - }, - { - title: 'event2', - start: '2010-01-05', - end: '2010-01-07' - }, - { - title: 'event3', - start: '2010-01-09 12:30:00', - allDay: false // will make the time show - } - ] -}); - -$('#calendar').fullCalendar({ - eventSources: [ - // your event source - { - events: [ // put the array in the `events` property - { - title: 'event1', - start: '2010-01-01' - }, - { - title: 'event2', - start: '2010-01-05', - end: '2010-01-07' - }, - { - title: 'event3', - start: '2010-01-09 12:30:00', - } - ], - color: 'black', // an option! - textColor: 'yellow' // an option! - } - - // any other event sources... - ] -}); - -$('#calendar').fullCalendar({ - events(start: any, end: any, callback: any) { - $.ajax({ - url: 'myxmlfeed.php', - dataType: 'xml', - data: { - // our hypothetical feed requires UNIX timestamps - start: Math.round(start.getTime() / 1000), - end: Math.round(end.getTime() / 1000) - }, - success(doc) { - const events: any[] = []; - $(doc).find('event').each(() => { - events.push({ - title: $(this).attr('title'), - start: $(this).attr('start') // will be parsed - }); - }); - callback(events); - } - }); - } -}); - -$('#calendar').fullCalendar({ - eventSources: [ - // your event source - { - events(start: any, end: any, callback: any) { - // ... - }, - color: 'yellow', // an option! - textColor: 'black' // an option! - } - - // any other sources... - ] -}); - -$('#calendar').fullCalendar({ - eventSources: [ - '/feed1.php', - '/feed2.php' - ] -}); - -$('#calendar').fullCalendar({ - eventClick(event, element) { - event.title = "CLICKED!"; - - $('#calendar').fullCalendar('updateEvent', event); - } -}); - -$('#calendar').fullCalendar({ - events: [ - // my event data - ], - eventColor: '#378006' -}); - -interface EventWithDescription extends FullCalendar.EventObject { - description: string; -} -interface JQuery { - qtip: any; // dummy plugin interface -} - -$('#calendar').fullCalendar({ - events: [ - { - title: 'My Event', - start: '2010-01-01', - description: 'This is a cool event' - } - // more events here - ], - eventRender(event: EventWithDescription, element: any) { - element.qtip({ - content: event.description - }); - } -}); -$('#my-draggable').draggable({ - revert: true, // immediately snap back to original position - revertDuration: 0 // -}); - -$('#calendar').fullCalendar({ - droppable: true, - drop(date, allDay) { - alert(`Dropped on ${date} with allDay=${allDay}`); - } -}); - -$('#calendar').fullCalendar({ - droppable: true, - dropAccept: '.cool-event', - drop: () => { - alert('dropped!'); - } -}); - -$('#draggable1').draggable(); -$('#draggable2').draggable(); - -$(document).ready(() => { - const date = new Date(); - const d = date.getDate(); - const m = date.getMonth(); - const y = date.getFullYear(); - - $('#calendar').fullCalendar({ - theme: true, - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - editable: true, - events: [ - { - title: 'All Day Event', - start: new Date(y, m, 1) - }, - { - title: 'Long Event', - start: new Date(y, m, d - 5), - end: new Date(y, m, d - 2) - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d - 3, 16, 0), - allDay: false - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d + 4, 16, 0), - allDay: false - }, - { - title: 'Meeting', - start: new Date(y, m, d, 10, 30), - allDay: false - }, - { - title: 'Lunch', - start: new Date(y, m, d, 12, 0), - end: new Date(y, m, d, 14, 0), - allDay: false - }, - { - title: 'Birthday Party', - start: new Date(y, m, d + 1, 19, 0), - end: new Date(y, m, d + 1, 22, 30), - allDay: false - }, - { - title: 'Click for Google', - start: new Date(y, m, 28), - end: new Date(y, m, 29), - url: 'http://google.com/' - } - ] - }); -}); - -$(document).ready(() => { - /* initialize the external events - -----------------------------------------------------------------*/ - $('#external-events div.external-event').each(() => { - // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/) - // it doesn't need to have a start or end - const eventObject = { - title: $.trim($(this).text()) // use the element's text as the event title - }; - - // store the Event Object in the DOM element so we can get to it later - $(this).data('eventObject', eventObject); - - // make the event draggable using jQuery UI - $(this).draggable({ - zIndex: 999, - revert: true, // will cause the event to go back to its - revertDuration: 0 // original position after the drag - }); - }); - /* initialize the calendar - -----------------------------------------------------------------*/ - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, - editable: true, - droppable: true, // this allows things to be dropped onto the calendar !!! - drop(date, allDay) { // this function is called when something is dropped - - // retrieve the dropped element's stored Event Object - const originalEventObject = $(this).data('eventObject'); - - // we need to copy it, so that multiple events don't have a reference to the same object - const copiedEventObject: any = $.extend({}, originalEventObject); - - // assign it the date that was reported - copiedEventObject.start = date; - copiedEventObject.allDay = allDay; - - // render the event on the calendar - // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/) - $('#calendar').fullCalendar('renderEvent', copiedEventObject, true); - - // is the "remove after drop" checkbox checked? - if ($('#drop-remove').is(':checked')) { - // if so, remove the element from the "Draggable Events" list - $(this).remove(); - } - } - }); -}); - -$('#calendar').fullCalendar('refetchEvents'); diff --git a/types/fullcalendar/v1/index.d.ts b/types/fullcalendar/v1/index.d.ts deleted file mode 100644 index 63b70c9cc7..0000000000 --- a/types/fullcalendar/v1/index.d.ts +++ /dev/null @@ -1,427 +0,0 @@ -// Type definitions for FullCalendar 1.6 -// Project: http://arshaw.com/fullcalendar/ -// Definitions by: Neil Stalker , Marcelo Camargo -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// -import * as moment from "moment"; - -declare global { - namespace FullCalendar { - interface Calendar { - /** - * Formats a Date object into a string. - */ - formatDate(date: Date, format: string, options?: Options): string; - - /** - * Formats a date range (two Date objects) into a string. - */ - formatDates(date1: Date, date2: Date, format: string, options?: Options): string; - - /** - * Parses a string into a Date object. - */ - parseDate(dateString: string, ignoreTimezone?: boolean): Date; - - /** - * Parses an ISO8601 string into a Date object. - */ - parseISO8601(dateString: string, ignoreTimezone?: boolean): Date; - - /** - * Gets the version of Fullcalendar - */ - version: string; - } - - interface BusinessHours { - start: moment.Duration; - end: moment.Duration; - dow: number[]; - } - - interface Timespan { - start: moment.Moment; - end: moment.Moment; - } - - interface Options extends AgendaOptions, EventDraggingResizingOptions, DroppingExternalElementsOptions, SelectionOptions { - // General display - http://arshaw.com/fullcalendar/docs/display/ - - header?: { - left: string; - center: string; - right: string; - }; - theme?: boolean; - buttonIcons?: { - prev: string; - next: string; - }; - firstDay?: number; - isRTL?: boolean; - weekends?: boolean; - hiddenDays?: number[]; - weekMode?: string; - weekNumbers?: boolean; - weekNumberCalculation?: any; // String/Function - businessHours?: boolean | BusinessHours; - height?: number; - contentHeight?: number; - aspectRatio?: number; - handleWindowResize?: boolean; - viewRender?(view: ViewObject, element: JQuery): void; - viewDestroy?(view: ViewObject, element: JQuery): void; - dayRender?(date: Date, cell: HTMLTableDataCellElement): void; - windowResize?(view: ViewObject): void; - - // Timezone - timezone?: string | boolean; - now?: moment.Moment | Date | string | (() => moment.Moment); - - // Views - http://arshaw.com/fullcalendar/docs/views/ - - defaultView?: string; - - // Current Date - http://arshaw.com/fullcalendar/docs/current_date/ - - defaultDate?: moment.Moment | Date | string; - year?: number; - month?: number; - date?: number; - - // Text/Time Customization - http://arshaw.com/fullcalendar/docs/text/ - - timeFormat?: any; // String/ViewOptionHash - columnFormat?: any; // String/ViewOptionHash - titleFormat?: any; // String/ViewOptionHash - - buttonText?: ButtonTextObject; - monthNames?: string[]; - monthNamesShort?: string[]; - dayNames?: string[]; - dayNamesShort?: string[]; - weekNumberTitle?: string; - - // Clicking & Hovering - http://arshaw.com/fullcalendar/docs/mouse/ - - dayClick?(date: Date, allDay: boolean, jsEvent: MouseEvent, view: ViewObject): void; - eventClick?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): any; // return type boolean or void - eventMouseover?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): void; - eventMouseout?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): void; - - // Event Data - http://arshaw.com/fullcalendar/docs/event_data/ - - /** - * This has one of the following types: - * - * - EventObject[] - * - string (JSON feed) - * - (start: Date | string, end: Date | string, callback: {(events: EventObject[]) => void;}) => void; - */ - events?: any; - - /** - * An array, each element being one of the following types: - * - * - EventSource - * - EventObject[] - * - string (JSON feed) - * - (start: Date | string, end: Date | string, callback: {(events: EventObject[]) => void;}) => void; - */ - eventSources?: any[]; - - allDayDefault?: boolean; - ignoreTimezone?: boolean; - startParam?: string; - endParam?: string; - lazyFetching?: boolean; - eventDataTransform?(eventData: any): EventObject; - loading?(isLoading: boolean, view: ViewObject): void; - - // Event Rendering - http://arshaw.com/fullcalendar/docs/event_rendering/ - - eventColor?: string; - eventBackgroundColor?: string; - eventBorderColor?: string; - eventTextColor?: string; - eventRender?(event: EventObject, element: HTMLDivElement, view: ViewObject): void; - eventAfterRender?(event: EventObject, element: HTMLDivElement, view: ViewObject): void; - eventAfterAllRender?(view: ViewObject): void; - eventDestroy?(event: EventObject, element: JQuery, view: ViewObject): void; - } - - interface ViewOptionHash { - month?: any; - week?: any; - day?: any; - agenda?: any; - agendaDay?: any; - agendaWeek?: any; - basic?: any; - basicDay?: any; - basicWeek?: any; - ''?: any; - } - - /** - * Agenda Options - http://arshaw.com/fullcalendar/docs/agenda/ - */ - interface AgendaOptions { - allDaySlot?: boolean; - allDayText?: string; - slotDuration?: moment.Duration; - slotLabelFormat?: string; - slotLabelInterval?: moment.Duration; - snapDuration?: moment.Duration; - scrollTime?: moment.Duration; - minTime?: moment.Duration; // Integer/String - maxTime?: moment.Duration; // Integer/String - slotEventOverlap?: boolean; - } - - /* - * Event Dragging & Resizing - */ - interface EventDraggingResizingOptions { - editable?: boolean; - eventStartEditable?: boolean; - eventDurationEditable?: boolean; - dragRevertDuration?: number; // integer, milliseconds - dragOpacity?: number; // float - dragScroll?: boolean; - eventOverlap?: boolean | ((stillEvent: EventObject, movingEvent: EventObject) => boolean); - eventConstraint?: BusinessHours | Timespan; - eventDragStart?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void; - eventDragStop?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void; - eventDrop?(event: EventObject, delta: moment.Duration, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject): void; - eventResizeStart?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void; - eventResizeStop?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void; - eventResize?(event: EventObject, delta: moment.Duration, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject): void; - } - /* - * Selection - http://arshaw.com/fullcalendar/docs/selection/ - */ - interface SelectionOptions { - selectable?: boolean; - selectHelper?: boolean | ((start: moment.Moment, end: moment.Moment) => HTMLElement); - unselectAuto?: boolean; - unselectCancel?: string; - selectOverlap?: boolean | ((event: EventObject) => boolean); - selectConstraint?: Timespan | BusinessHours; - select?(start: moment.Moment, end: moment.Moment, jsEvent: MouseEvent, view: ViewObject, resource?: any): void; - unselect?(view: ViewObject, jsEvent: Event): void; - } - - interface DroppingExternalElementsOptions { - droppable?: boolean; - dropAccept?: string | ((draggable: any) => boolean); - drop?(date: moment.Moment, jsEvent: MouseEvent, ui: any): void; - eventReceive?(event: EventObject): void; - } - - interface ButtonTextObject { - prev?: string; - next?: string; - prevYear?: string; - nextYear?: string; - today?: string; - month?: string; - week?: string; - day?: string; - } - - interface EventObject extends Timespan { - id?: any; // String/number - title: string; - allDay?: boolean; - url?: string; - className?: any; // string/Array - editable?: boolean; - source?: EventSource; - color?: string; - backgroundColor?: string; - borderColor?: string; - textColor?: string; - rendering?: string; - } - - interface ViewObject extends Timespan { - name: string; - title: string; - intervalStart: moment.Moment; - intervalEnd: moment.Moment; - } - - interface EventSource extends JQueryAjaxSettings { - /** - * This has one of the following types: - * - * - EventObject[] - * - string (JSON feed) - * - (start: Date | string, end: Date | string, callback: {(events: EventObject[]) => void;}) => void; - */ - events?: any; - - color?: string; - backgroundColor?: string; - borderColor?: string; - textColor?: string; - className?: any; // string/Array - editable?: boolean; - allDayDefault?: boolean; - ignoreTimezone?: boolean; - eventTransform?: any; - startParam?: string; - endParam?: string; - } - } - - interface JQuery { - /** - * Get/Set option value - */ - fullCalendar(method: 'option', option: string, value?: any): void; - - /** - * Immediately forces the calendar to render and/or readjusts its size. - */ - fullCalendar(method: 'render'): void; - - /** - * Restores the element to the state before FullCalendar was initialized. - */ - fullCalendar(method: 'destroy'): void; - - /** - * Returns the View Object for the current view. - */ - fullCalendar(method: 'getView'): FullCalendar.ViewObject; - - /** - * Immediately switches to a different view. - */ - fullCalendar(method: 'changeView', viewName: string): void; - - /** - * Moves the calendar one step back (either by a month, week, or day). - */ - fullCalendar(method: 'prev'): void; - - /** - * Moves the calendar one step forward (either by a month, week, or day). - */ - fullCalendar(method: 'next'): void; - - /** - * Moves the calendar back one year. - */ - fullCalendar(method: 'prevYear'): void; - - /** - * Moves the calendar forward one year. - */ - fullCalendar(method: 'nextYear'): void; - - /** - * Moves the calendar to the current date. - */ - fullCalendar(method: 'today'): void; - - /** - * Moves the calendar to an arbitrary year/month/date. - */ - fullCalendar(method: 'gotoDate', year: number, month?: number, date?: number): void; - - /** - * Moves the calendar to an arbitrary date. - */ - fullCalendar(method: 'gotoDate', date: Date | string): void; - - /** - * Moves the calendar forward/backward an arbitrary amount of time. - */ - fullCalendar(method: 'incrementDate', year: number, month?: number, date?: number): void; - - /** - * Returns a Date object for the current date of the calendar. - */ - fullCalendar(method: 'getDate'): Date; - - /** - * A method for programmatically selecting a period of time. - */ - fullCalendar(method: 'select', startDate: Date, endDate: Date, allDay: boolean): void; - - /** - * A method for programmatically clearing the current selection. - */ - fullCalendar(method: 'unselect'): void; - - /** - * Reports changes to an event and renders them on the calendar. - */ - fullCalendar(method: 'updateEvent', event: FullCalendar.EventObject): void; - - /** - * Retrieves events that FullCalendar has in memory. - */ - fullCalendar(method: 'clientEvents', idOrfilter?: any): FullCalendar.EventObject[]; - - /** - * Retrieves events that FullCalendar has in memory. - */ - fullCalendar(method: 'clientEvents', idOrfilter?: (e: FullCalendar.EventObject) => boolean): FullCalendar.EventObject[]; - - /** - * Removes events from the calendar. - */ - fullCalendar(method: 'removeEvents', idOrfilter?: any): void; - - /** - * Removes events from the calendar. - */ - fullCalendar(method: 'removeEvents', idOrfilter?: (e: FullCalendar.EventObject) => boolean): void; - - /** - * Refetches events from all sources and rerenders them on the screen. - */ - fullCalendar(method: 'refetchEvents'): void; - - /** - * Dynamically adds an event source. - */ - fullCalendar(method: 'addEventSource', source: any): void; - - /** - * Dynamically removes an event source. - */ - fullCalendar(method: 'removeEventSource', source: any): void; - - /** - * Renders a new event on the calendar. - */ - fullCalendar(method: 'renderEvent', event: FullCalendar.EventObject, stick?: boolean): void; - - /** - * Rerenders all events on the calendar. - */ - fullCalendar(method: 'rerenderEvents'): void; - - /** - * Create calendar object - */ - fullCalendar(options: FullCalendar.Options): JQuery; - - /** - * Generic method function - */ - fullCalendar(method: string, arg1: any, arg2: any, arg3: any): void; - } - - interface JQueryStatic { - fullCalendar: FullCalendar.Calendar; - } -} diff --git a/types/fullcalendar/v1/package.json b/types/fullcalendar/v1/package.json deleted file mode 100644 index 19e5fb0d14..0000000000 --- a/types/fullcalendar/v1/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "moment": ">=2.14.0" - } -} diff --git a/types/fullcalendar/v1/tsconfig.json b/types/fullcalendar/v1/tsconfig.json deleted file mode 100644 index c6612c5858..0000000000 --- a/types/fullcalendar/v1/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "types": [], - "paths": { - "fullcalendar": [ - "fullcalendar/v1" - ] - }, - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "fullcalendar-tests.ts" - ] -} \ No newline at end of file diff --git a/types/fullcalendar/v1/tslint.json b/types/fullcalendar/v1/tslint.json deleted file mode 100644 index 1b62a88e52..0000000000 --- a/types/fullcalendar/v1/tslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "ban-types": false, - "unified-signatures": false - } -} From 6c6ebcf3ebb21d3abd319e61d438993accc41535 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 10:33:26 -0800 Subject: [PATCH 295/890] jasmine-expect: Provides its own types (#22351) --- notNeededPackages.json | 6 + types/jasmine-expect/index.d.ts | 154 -- types/jasmine-expect/jasmine-expect-tests.ts | 1959 ------------------ types/jasmine-expect/tsconfig.json | 23 - types/jasmine-expect/tslint.json | 80 - 5 files changed, 6 insertions(+), 2216 deletions(-) delete mode 100644 types/jasmine-expect/index.d.ts delete mode 100644 types/jasmine-expect/jasmine-expect-tests.ts delete mode 100644 types/jasmine-expect/tsconfig.json delete mode 100644 types/jasmine-expect/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index f1736daaf4..4bdbda9f3a 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -540,6 +540,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/is-upper-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "jasmine-expect", + "typingsPackageName": "jasmine-expect", + "sourceRepoURL": "https://github.com/JamieMason/Jasmine-Matchers", + "asOfVersion": "3.8.1" + }, { "libraryName": "jimp", "typingsPackageName": "jimp", diff --git a/types/jasmine-expect/index.d.ts b/types/jasmine-expect/index.d.ts deleted file mode 100644 index ca5c2dbfc3..0000000000 --- a/types/jasmine-expect/index.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -// Type definitions for jasmine-expect 3.6.0 -// Project: https://github.com/JamieMason/Jasmine-Matchers -// Definitions by: GeneralCss -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 - -/// - -declare namespace jasmine { - interface Matchers { - // toBe - toBeArray(): boolean; - toBeArrayOfBooleans(): boolean; - toBeArrayOfNumbers(): boolean; - toBeArrayOfObjects(): boolean; - toBeArrayOfSize(size: number): boolean; - toBeArrayOfStrings(): boolean; - toBeEmptyArray(): boolean; - toBeNonEmptyArray(): boolean; - - // Booleans - toBeBoolean(): boolean; - toBeFalse(): boolean; - toBeTrue(): boolean; - - // Dates - toBeAfter(date: Date): boolean - toBeBefore(date: Date): boolean - toBeDate(): boolean; - toBeValidDate(): boolean; - - // Functions - toBeFunction(): boolean; - toThrowAnyError(): boolean; - toThrowErrorOfType(constructorName: string): boolean - - // Numbers - toBeCalculable(): boolean; - toBeEvenNumber(): boolean; - toBeGreaterThanOrEqualTo(number: number): boolean; - toBeLessThanOrEqualTo(number: number): boolean; - toBeNear(number: number, epsilon: number): boolean; - toBeNumber(): boolean; - toBeOddNumber(): boolean - toBeWholeNumber(): boolean; - toBeWithinRange(floor: number, ceiling: number): boolean; - - // Strings - toBeEmptyString(): boolean; - toBeHtmlString(): boolean; - toBeIso8601(): boolean; - toBeJsonString(): boolean; - toBeLongerThan(string: string): boolean; - toBeNonEmptyString(): boolean; - toBeSameLengthAs(string: string): boolean; - toBeShorterThan(string: string): boolean; - toBeString(): boolean; - toBeWhitespace(): boolean; - toEndWith(string: string): boolean; - toStartWith(string: string): boolean; - - // Objects - toBeEmptyObject(): boolean; - toBeNonEmptyObject(): boolean; - toBeObject(): boolean; - - // Regular Expression - toBeRegExp(): boolean; - - // Members, Properties, Methods - toHaveArray(memberName: string): boolean; - toHaveArrayOfBooleans(memberName: string): boolean; - toHaveArrayOfNumbers(memberName: string): boolean; - toHaveArrayOfObjects(memberName: string): boolean; - toHaveArrayOfSize(memberName: string, size: number): boolean; - toHaveArrayOfStrings(memberName: string): boolean; - toHaveBoolean(memberName: string): boolean; - toHaveCalculable(memberName: string): boolean; - toHaveDate(memberName: string): boolean; - toHaveDateAfter(memberName: string, date: Date): boolean; - toHaveDateBefore(memberName: string, date: Date): boolean; - toHaveEmptyArray(memberName: string): boolean; - toHaveEmptyObject(memberName: string): boolean; - toHaveEmptyString(memberName: string): boolean; - toHaveEvenNumber(memberName: string): boolean; - toHaveFalse(memberName: string): boolean; - toHaveHtmlString(memberName: string): boolean; - toHaveIso8601(memberName: string): boolean; - toHaveJsonString(memberName: string): boolean; - toHaveMember(memberName: string): boolean; - toHaveMethod(memberName: string): boolean; - toHaveNonEmptyArray(memberName: string): boolean; - toHaveNonEmptyObject(memberName: string): boolean; - toHaveNonEmptyString(memberName: string): boolean; - toHaveNumber(memberName: string): boolean; - toHaveNumberWithinRange(memberName: string, floor: number, ceiling: number): boolean; - toHaveObject(memberName: string): boolean; - toHaveOddNumber(memberName: string): boolean; - toHaveString(memberName: string): boolean; - toHaveStringLongerThan(memberName: string, string: string): boolean; - toHaveStringSameLengthAs(memberName: string, string: string): boolean; - toHaveStringShorterThan(memberName: string, string: string): boolean; - toHaveTrue(memberName: string): boolean; - toHaveUndefined(memberName: string): boolean; - toHaveWhitespaceString(memberName: string): boolean; - toHaveWholeNumber(memberName: string): boolean; - } - - interface AssymetricMatchers { - - // Arrays - arrayOfBooleans(): boolean; - arrayOfNumbers(): boolean; - arrayOfObjects(): boolean; - arrayOfSize(number: number): boolean; - arrayOfStrings(): boolean; - emptyArray(): boolean; - nonEmptyArray(): boolean; - - // Dates - after(date: Date): boolean; - before(date: Date): boolean; - - // Numbers - calculable(): boolean; - evenNumber(): boolean; - greaterThanOrEqualTo(number: number): boolean; - lessThanOrEqualTo(number: number): boolean; - oddNumber(): boolean; - wholeNumber(): boolean; - withinRange(floor: number, ceiling: number): boolean; - - // Strings - endingWith(string: string): boolean; - iso8601(): boolean; - jsonString(): boolean; - longerThan(string: string): boolean; - nonEmptyString(string: string): boolean; - sameLengthAs(string: string): boolean; - shorterThan(string: string): boolean; - startingWith(string: string): boolean; - whitespace(): boolean; - - //Objects - emptyObject(): boolean; - nonEmptyObject(): boolean; - - // Regular expressions - regExp(): boolean; - } -} - -declare var any: jasmine.AssymetricMatchers; - diff --git a/types/jasmine-expect/jasmine-expect-tests.ts b/types/jasmine-expect/jasmine-expect-tests.ts deleted file mode 100644 index 4a8cbb3855..0000000000 --- a/types/jasmine-expect/jasmine-expect-tests.ts +++ /dev/null @@ -1,1959 +0,0 @@ -// Taken directly from the test directory of the original repo - -declare var describeWhenNotArray: (arr: string) => void; -declare var describeToBeArrayOfX: (arr: string, descriptor: {}) => void; -declare var describeToHaveArrayX: (arr: string, descriptor: () => void) => void; -declare var describeToHaveX: (arr: string, descriptor: () => void) => void; -declare var describeToHaveBooleanX: (arr: string, descriptor: () => void) => void; -declare var badReference: { someValue: any }; -var _undefined: any = undefined; - -describe('toBeAfter', function() { - describe('when invoked', function() { - describe('when value is a Date', function() { - describe('when date occurs after another', function() { - it('should confirm', function() { - expect(new Date('2013-01-01T01:00:00.000Z')).toBeAfter(new Date('2013-01-01T00:00:00.000Z')); - }); - }); - describe('when date does NOT occur after another', function() { - it('should deny', function() { - expect(new Date('2013-01-01T00:00:00.000Z')).not.toBeAfter(new Date('2013-01-01T01:00:00.000Z')); - }); - }); - }); - }); -}); - - -describe('toBeArray', function() { - describe('when invoked', function() { - describe('when subject is a true Array', function() { - it('should confirm', function() { - expect([]).toBeArray(); - expect(new Array()).toBeArray(); - }); - }); - describeWhenNotArray('toBeArray'); - }); -}); - - -describe('toBeArrayOfBooleans', function() { - describeToBeArrayOfX('toBeArrayOfBooleans', { - type: 'Boolean', - whenValid: function() { - expect([true]).toBeArrayOfBooleans(); - expect([new Boolean(true)]).toBeArrayOfBooleans(); - expect([new Boolean(false)]).toBeArrayOfBooleans(); - expect([false, true]).toBeArrayOfBooleans(); - }, - whenInvalid: function() { - expect([null]).not.toBeArrayOfBooleans(); - }, - whenMixed: function() { - expect([null, false]).not.toBeArrayOfBooleans(); - expect([null, true]).not.toBeArrayOfBooleans(); - } - }); -}); - - -describe('toBeArrayOfNumbers', function() { - describeToBeArrayOfX('toBeArrayOfNumbers', { - type: 'Number', - whenValid: function() { - expect([1]).toBeArrayOfNumbers(); - expect([new Number(1)]).toBeArrayOfNumbers(); - expect([new Number(0)]).toBeArrayOfNumbers(); - expect([0, 1]).toBeArrayOfNumbers(); - }, - whenInvalid: function() { - expect([null]).not.toBeArrayOfNumbers(); - }, - whenMixed: function() { - expect([null, 0]).not.toBeArrayOfNumbers(); - } - }); -}); - -describe('toBeArrayOfObjects', function() { - describeToBeArrayOfX('toBeArrayOfObjects', { - type: 'Object', - whenValid: function() { - expect([{}, {}]).toBeArrayOfObjects(); - }, - whenInvalid: function() { - expect([null]).not.toBeArrayOfObjects(); - expect(['Object']).not.toBeArrayOfObjects(); - expect(['[object Object]']).not.toBeArrayOfObjects(); - }, - whenMixed: function() { - expect([null, {}]).not.toBeArrayOfObjects(); - } - }); -}); - -describe('toBeArrayOfSize', function() { - describe('when invoked', function() { - describe('when subject is a true Array', function() { - describe('when subject has the expected number of members', function() { - it('should confirm', function() { - expect([]).toBeArrayOfSize(0); - expect([null]).toBeArrayOfSize(1); - expect([false, false]).toBeArrayOfSize(2); - expect([_undefined, _undefined]).toBeArrayOfSize(2); - }); - }); - describe('when subject has an unexpected number of members', function() { - it('should deny', function() { - expect([]).not.toBeArrayOfSize(1); - expect([null]).not.toBeArrayOfSize(0); - expect([true, true]).not.toBeArrayOfSize(1); - }); - }); - }); - describeWhenNotArray('toBeArrayOfSize'); - }); -}); - - -describe('toBeArrayOfStrings', function() { - describeToBeArrayOfX('toBeArrayOfStrings', { - type: 'String', - whenValid: function() { - expect(['truthy']).toBeArrayOfStrings(); - expect([new String('truthy')]).toBeArrayOfStrings(); - expect([new String('')]).toBeArrayOfStrings(); - expect(['', 'truthy']).toBeArrayOfStrings(); - }, - whenInvalid: function() { - expect([null]).not.toBeArrayOfStrings(); - }, - whenMixed: function() { - expect([null, '']).not.toBeArrayOfStrings(); - } - }); -}); - -describe('toBeBefore', function() { - describe('when invoked', function() { - describe('when value is a Date', function() { - describe('when date occurs before another', function() { - it('should confirm', function() { - expect(new Date('2013-01-01T00:00:00.000Z')).toBeBefore(new Date('2013-01-01T01:00:00.000Z')); - }); - }); - describe('when date does NOT occur before another', function() { - it('should deny', function() { - expect(new Date('2013-01-01T01:00:00.000Z')).not.toBeBefore(new Date('2013-01-01T00:00:00.000Z')); - }); - }); - }); - }); -}); - - -describe('toBeBoolean', function() { - describe('when invoked', function() { - describe('when subject not only truthy or falsy, but a boolean', function() { - it('should confirm', function() { - expect(true).toBeBoolean(); - expect(false).toBeBoolean(); - expect(new Boolean(true)).toBeBoolean(); - expect(new Boolean(false)).toBeBoolean(); - }); - }); - describe('when subject is truthy or falsy', function() { - it('should deny', function() { - expect(1).not.toBeBoolean(); - expect(0).not.toBeBoolean(); - }); - }); - }); -}); - -describe('toBeCalculable', function() { - describe('when invoked', function() { - describe('when subject CAN be coerced to be used in mathematical operations', function() { - it('should confirm', function() { - expect('1').toBeCalculable(); - expect('').toBeCalculable(); - expect(null).toBeCalculable(); - }); - }); - describe('when subject can NOT be coerced by JavaScript to be used in mathematical operations', function() { - it('should deny', function() { - expect({}).not.toBeCalculable(); - expect(NaN).not.toBeCalculable(); - }); - }); - }); -}); - -describe('toBeDate', function() { - describe('when invoked', function() { - describe('when value is an instance of Date', function() { - it('should confirm', function() { - expect(new Date()).toBeDate(); - }); - }); - describe('when value is NOT an instance of Date', function() { - it('should deny', function() { - expect(null).not.toBeDate(); - }); - }); - }); -}); - -describe('toBeEmptyArray', function() { - describe('when invoked', function() { - describe('when subject is a true Array', function() { - describe('when subject has members', function() { - it('should confirm', function() { - expect([]).toBeEmptyArray(); - }); - }); - describe('when subject has no members', function() { - it('should deny', function() { - expect([null]).not.toBeEmptyArray(); - expect(['']).not.toBeEmptyArray(); - expect([1]).not.toBeEmptyArray(); - expect([true]).not.toBeEmptyArray(); - expect([false]).not.toBeEmptyArray(); - }); - }); - }); - describeWhenNotArray('toBeEmptyArray'); - }); -}); - -describe('toBeEmptyObject', function() { - beforeEach(function() { - this.Foo = function() { }; - }); - describe('when invoked', function() { - describe('when subject IS an Object with no instance members', function() { - beforeEach(function() { - this.Foo.prototype = { - b: 2 - }; - }); - it('should confirm', function() { - expect(new this.Foo()).toBeEmptyObject(); - expect({}).toBeEmptyObject(); - }); - }); - describe('when subject is NOT an Object with no instance members', function() { - it('should deny', function() { - expect({ - a: 1 - }).not.toBeEmptyObject(); - expect(null).not.toBeNonEmptyObject(); - }); - }); - }); -}); - -describe('toBeEmptyString', function() { - describe('when invoked', function() { - describe('when subject IS a string with no characters', function() { - it('should confirm', function() { - expect('').toBeEmptyString(); - }); - }); - describe('when subject is NOT a string with no characters', function() { - it('should deny', function() { - expect(' ').not.toBeEmptyString(); - }); - }); - }); -}); - -describe('toBeEvenNumber', function() { - describe('when invoked', function() { - describe('when subject IS an even number', function() { - it('should confirm', function() { - expect(2).toBeEvenNumber(); - }); - }); - describe('when subject is NOT an even number', function() { - it('should deny', function() { - expect(1).not.toBeEvenNumber(); - expect(NaN).not.toBeEvenNumber(); - }); - }); - }); -}); - - -describe('toBeFalse', function() { - describe('when invoked', function() { - describe('when subject is not only falsy, but a boolean false', function() { - it('should confirm', function() { - expect(false).toBeFalse(); - expect(new Boolean(false)).toBeFalse(); - }); - }); - describe('when subject is falsy', function() { - it('should deny', function() { - expect(1).not.toBeFalse(); - }); - }); - }); -}); - -describe('toBeFunction', function() { - describe('when invoked', function() { - describe('when subject IS a function', function() { - it('should confirm', function() { - expect(function() { }).toBeFunction(); - }); - }); - describe('when subject is NOT a function', function() { - it('should deny', function() { - expect(/regexp/).not.toBeFunction(); - }); - }); - }); -}); - -describe('toBeHtmlString', function() { - describe('when invoked', function() { - describe('when subject IS a string of HTML markup', function() { - beforeEach(function() { - this.ngMultiLine = ''; - this.ngMultiLine += ''; - this.ngMultiLine += '\n'; - this.ngMultiLine += ' Watch with Google TV'; - this.ngMultiLine += '\n'; - this.ngMultiLine += ''; - this.ngMultiLine += '\n'; - }); - it('should confirm', function() { - expect('text').toBeHtmlString(); - expect('baz').toBeHtmlString(); - expect('
    ').toBeHtmlString(); - expect('
  • ').toBeHtmlString(); - expect(this.ngMultiLine).toBeHtmlString(); - }); - }); - describe('when subject is NOT a string of HTML markup', function() { - it('should deny', function() { - expect('div').not.toBeHtmlString(); - expect(null).not.toBeHtmlString(); - }); - }); - }); -}); - -describe('toBeIso8601', function() { - describe('when invoked', function() { - describe('when value is a Date String conforming to the ISO 8601 standard', function() { - describe('when specified date is valid', function() { - it('should confirm', function() { - expect('2013-07-08T07:29:15.863Z').toBeIso8601(); - expect('2013-07-08T07:29:15.863').toBeIso8601(); - expect('2013-07-08T07:29:15').toBeIso8601(); - expect('2013-07-08T07:29').toBeIso8601(); - expect('2013-07-08').toBeIso8601(); - }); - }); - describe('when specified date is NOT valid', function() { - it('should deny', function() { - expect('2013-99-12T00:00:00.000Z').not.toBeIso8601(); - expect('2013-12-99T00:00:00.000Z').not.toBeIso8601(); - expect('2013-01-01T99:00:00.000Z').not.toBeIso8601(); - expect('2013-01-01T99:99:00.000Z').not.toBeIso8601(); - expect('2013-01-01T00:00:99.000Z').not.toBeIso8601(); - }); - }); - }); - describe('when value is a String NOT conforming to the ISO 8601 standard', function() { - it('should deny', function() { - expect('2013-07-08T07:29:15.').not.toBeIso8601(); - expect('2013-07-08T07:29:').not.toBeIso8601(); - expect('2013-07-08T07:2').not.toBeIso8601(); - expect('2013-07-08T07:').not.toBeIso8601(); - expect('2013-07-08T07').not.toBeIso8601(); - expect('2013-07-08T').not.toBeIso8601(); - expect('2013-07-0').not.toBeIso8601(); - expect('2013-07-').not.toBeIso8601(); - expect('2013-07').not.toBeIso8601(); - expect('2013-0').not.toBeIso8601(); - expect('2013-').not.toBeIso8601(); - expect('2013').not.toBeIso8601(); - expect('201').not.toBeIso8601(); - expect('20').not.toBeIso8601(); - expect('2').not.toBeIso8601(); - expect('').not.toBeIso8601(); - }); - }); - }); -}); -var _undefined; - -describe('toBeJsonString', function() { - describe('when invoked', function() { - describe('when subject IS a string of parseable JSON', function() { - it('should confirm', function() { - expect('{}').toBeJsonString(); - expect('[]').toBeJsonString(); - expect('[1]').toBeJsonString(); - }); - }); - describe('when subject is NOT a string of parseable JSON', function() { - it('should deny', function() { - expect('[1,]').not.toBeJsonString(); - expect('<>').not.toBeJsonString(); - expect(null).not.toBeJsonString(); - expect('').not.toBeJsonString(); - expect(_undefined).not.toBeJsonString(); - }); - }); - }); -}); - -describe('toBeLongerThan', function() { - describe('when invoked', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS longer than the comparision string', function() { - it('should confirm', function() { - expect('abc').toBeLongerThan('ab'); - expect('a').toBeLongerThan(''); - }); - }); - describe('when the subject is NOT longer than the comparision string', function() { - it('should deny', function() { - expect('ab').not.toBeLongerThan('abc'); - expect('').not.toBeLongerThan('a'); - }); - }); - }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect('truthy').not.toBeLongerThan(_undefined); - expect(_undefined).not.toBeLongerThan('truthy'); - expect('').not.toBeLongerThan(_undefined); - expect(_undefined).not.toBeLongerThan(''); - }); - }); - }); -}); - -describe('toBeNonEmptyArray', function() { - describe('when invoked', function() { - describe('when subject is a true Array', function() { - describe('when subject has members', function() { - it('should confirm', function() { - expect([null]).toBeNonEmptyArray(); - expect([_undefined]).toBeNonEmptyArray(); - expect(['']).toBeNonEmptyArray(); - }); - }); - describe('when subject has no members', function() { - it('should deny', function() { - expect([]).not.toBeNonEmptyArray(); - }); - }); - }); - describeWhenNotArray('toBeNonEmptyArray'); - }); -}); - -describe('toBeNonEmptyObject', function() { - beforeEach(function() { - this.Foo = function() { }; - }); - describe('when invoked', function() { - describe('when subject IS an Object with at least one instance member', function() { - it('should confirm', function() { - expect({ - a: 1 - }).toBeNonEmptyObject(); - }); - }); - describe('when subject is NOT an Object with at least one instance member', function() { - beforeEach(function() { - this.Foo.prototype = { - b: 2 - }; - }); - it('should deny', function() { - expect(new this.Foo()).not.toBeNonEmptyObject(); - expect({}).not.toBeNonEmptyObject(); - expect(null).not.toBeNonEmptyObject(); - }); - }); - }); -}); - -describe('toBeNonEmptyString', function() { - describe('when invoked', function() { - describe('when subject IS a string with at least one character', function() { - it('should confirm', function() { - expect(' ').toBeNonEmptyString(); - }); - }); - describe('when subject is NOT a string with at least one character', function() { - it('should deny', function() { - expect('').not.toBeNonEmptyString(); - expect(null).not.toBeNonEmptyString(); - }); - }); - }); -}); - -describe('toBeNumber', function() { - describe('when invoked', function() { - describe('when subject IS a number', function() { - it('should confirm', function() { - expect(1).toBeNumber(); - expect(1.11).toBeNumber(); - expect(1e3).toBeNumber(); - expect(0.11).toBeNumber(); - expect(-11).toBeNumber(); - }); - }); - describe('when subject is NOT a number', function() { - it('should deny', function() { - expect('1').not.toBeNumber(); - expect(NaN).not.toBeNumber(); - }); - }); - }); -}); - - -describe('toBeObject', function() { - beforeEach(function() { - this.Foo = function() { }; - }); - describe('when invoked', function() { - describe('when subject IS an Object', function() { - it('should confirm', function() { - expect(new Object()).toBeObject(); - expect(new this.Foo()).toBeObject(); - expect({}).toBeObject(); - }); - }); - describe('when subject is NOT an Object', function() { - it('should deny', function() { - expect(null).not.toBeObject(); - expect(123).not.toBeObject(); - expect('[object Object]').not.toBeObject(); - }); - }); - }); -}); - -describe('toBeOddNumber', function() { - describe('when invoked', function() { - describe('when subject IS an odd number', function() { - it('should confirm', function() { - expect(1).toBeOddNumber(); - }); - }); - describe('when subject is NOT an odd number', function() { - it('should deny', function() { - expect(2).not.toBeOddNumber(); - expect(NaN).not.toBeOddNumber(); - }); - }); - }); -}); -var _undefined; - -describe('toBeSameLengthAs', function() { - describe('when invoked', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS the same length as the comparision string', function() { - it('should confirm', function() { - expect('ab').toBeSameLengthAs('ab'); - }); - }); - describe('when the subject is NOT the same length as the comparision string', function() { - it('should deny', function() { - expect('abc').not.toBeSameLengthAs('ab'); - expect('a').not.toBeSameLengthAs(''); - expect('').not.toBeSameLengthAs('a'); - }); - }); - }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect('truthy').not.toBeSameLengthAs(_undefined); - expect(_undefined).not.toBeSameLengthAs('truthy'); - expect('').not.toBeSameLengthAs(_undefined); - expect(_undefined).not.toBeSameLengthAs(''); - }); - }); - }); -}); -var _undefined; - -describe('toBeShorterThan', function() { - describe('when invoked', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS shorter than the comparision string', function() { - it('should confirm', function() { - expect('ab').toBeShorterThan('abc'); - expect('').toBeShorterThan('a'); - }); - }); - describe('when the subject is NOT shorter than the comparision string', function() { - it('should deny', function() { - expect('abc').not.toBeShorterThan('ab'); - expect('a').not.toBeShorterThan(''); - }); - }); - }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect('truthy').not.toBeShorterThan(_undefined); - expect(_undefined).not.toBeShorterThan('truthy'); - expect('').not.toBeShorterThan(_undefined); - expect(_undefined).not.toBeShorterThan(''); - }); - }); - }); -}); - -describe('toBeString', function() { - describe('when invoked', function() { - describe('when subject IS a string of any length', function() { - it('should confirm', function() { - expect('').toBeString(); - expect(' ').toBeString(); - }); - }); - describe('when subject is NOT a string of any length', function() { - it('should deny', function() { - expect(null).not.toBeString(); - }); - }); - }); -}); - - -describe('toBeTrue', function() { - describe('when invoked', function() { - describe('when subject is not only truthy, but a boolean true', function() { - it('should confirm', function() { - expect(true).toBeTrue(); - expect(new Boolean(true)).toBeTrue(); - }); - }); - describe('when subject is truthy', function() { - it('should deny', function() { - expect(1).not.toBeTrue(); - }); - }); - }); -}); - -describe('toBeWhitespace', function() { - describe('when invoked', function() { - describe('when subject IS a string containing only tabs, spaces, returns etc', function() { - it('should confirm', function() { - expect(' ').toBeWhitespace(); - expect('').toBeWhitespace(); - }); - }); - describe('when subject is NOT a string containing only tabs, spaces, returns etc', function() { - it('should deny', function() { - expect('has-no-whitespace').not.toBeWhitespace(); - expect('has whitespace').not.toBeWhitespace(); - expect(null).not.toBeWhitespace(); - }); - }); - }); -}); - -describe('toBeWholeNumber', function() { - describe('when invoked', function() { - describe('when subject IS a number with no positive decimal places', function() { - it('should confirm', function() { - expect(1).toBeWholeNumber(); - expect(0).toBeWholeNumber(); - expect(0.0).toBeWholeNumber(); - }); - }); - describe('when subject is NOT a number with no positive decimal places', function() { - it('should deny', function() { - expect(NaN).not.toBeWholeNumber(); - expect(1.1).not.toBeWholeNumber(); - expect(0.1).not.toBeWholeNumber(); - }); - }); - }); -}); - -describe('toBeWithinRange', function() { - describe('when invoked', function() { - describe('when subject IS a number >= floor and <= ceiling', function() { - it('should confirm', function() { - expect(0).toBeWithinRange(0, 2); - expect(1).toBeWithinRange(0, 2); - expect(2).toBeWithinRange(0, 2); - }); - }); - describe('when subject is NOT a number >= floor and <= ceiling', function() { - it('should deny', function() { - expect(-3).not.toBeWithinRange(0, 2); - expect(-2).not.toBeWithinRange(0, 2); - expect(-1).not.toBeWithinRange(0, 2); - expect(3).not.toBeWithinRange(0, 2); - expect(NaN).not.toBeWithinRange(0, 2); - }); - }); - }); -}); -var _undefined; - -describe('toEndWith', function() { - describe('when invoked', function() { - describe('when subject is NOT an undefined or empty string', function() { - describe('when subject is a string whose trailing characters match the expected string', function() { - it('should confirm', function() { - expect('jamie').toEndWith('mie'); - }); - }); - describe('when subject is a string whose trailing characters DO NOT match the expected string', function() { - it('should deny', function() { - expect('jamie ').not.toEndWith('mie'); - expect('jamiE').not.toEndWith('mie'); - }); - }); - }); - describe('when subject IS an undefined or empty string', function() { - it('should deny', function() { - expect('').not.toEndWith(''); - expect(_undefined).not.toEndWith(''); - expect(_undefined).not.toEndWith('undefined'); - expect('undefined').not.toEndWith(_undefined); - }); - }); - }); -}); - -describe('toHaveArray', function() { - describeToHaveArrayX('toHaveArray', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArray('memberName'); - expect({ - memberName: [1, 2, 3] - }).toHaveArray('memberName'); - }); - }); -}); - - -describe('toHaveArrayOfBooleans', function() { - describeToHaveArrayX('toHaveArrayOfBooleans', function() { - describe('when named Array is empty', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArrayOfBooleans('memberName'); - }); - }); - describe('when named Array has items', function() { - describe('when all items are booleans', function() { - it('should confirm', function() { - expect({ - memberName: [true] - }).toHaveArrayOfBooleans('memberName'); - expect({ - memberName: [new Boolean(true)] - }).toHaveArrayOfBooleans('memberName'); - expect({ - memberName: [new Boolean(false)] - }).toHaveArrayOfBooleans('memberName'); - expect({ - memberName: [false, true] - }).toHaveArrayOfBooleans('memberName'); - }); - }); - describe('when any item is not a boolean', function() { - it('should deny', function() { - expect({ - memberName: [null] - }).not.toHaveArrayOfBooleans('memberName'); - expect({ - memberName: [null, false] - }).not.toHaveArrayOfBooleans('memberName'); - }); - }); - }); - }); -}); - - -describe('toHaveArrayOfNumbers', function() { - describeToHaveArrayX('toHaveArrayOfNumbers', function() { - describe('when named Array is empty', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArrayOfNumbers('memberName'); - }); - }); - describe('when named Array has items', function() { - describe('when all items are numbers', function() { - it('should confirm', function() { - expect({ - memberName: [1] - }).toHaveArrayOfNumbers('memberName'); - expect({ - memberName: [new Number(1)] - }).toHaveArrayOfNumbers('memberName'); - expect({ - memberName: [new Number(0)] - }).toHaveArrayOfNumbers('memberName'); - expect({ - memberName: [0, 1] - }).toHaveArrayOfNumbers('memberName'); - }); - }); - describe('when any item is not a number', function() { - it('should deny', function() { - expect({ - memberName: [null] - }).not.toHaveArrayOfNumbers('memberName'); - expect({ - memberName: [null, 0] - }).not.toHaveArrayOfNumbers('memberName'); - }); - }); - }); - }); -}); - -describe('toHaveArrayOfObjects', function() { - describeToHaveArrayX('toHaveArrayOfObjects', function() { - describe('when named Array is empty', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArrayOfObjects('memberName'); - }); - }); - describe('when named Array has items', function() { - describe('when all items are objects', function() { - it('should confirm', function() { - expect({ - memberName: [{}] - }).toHaveArrayOfObjects('memberName'); - expect({ - memberName: [{}, {}] - }).toHaveArrayOfObjects('memberName'); - }); - }); - describe('when any item is not an object', function() { - it('should deny', function() { - expect({ - memberName: [null] - }).not.toHaveArrayOfObjects('memberName'); - expect({ - memberName: [null, {}] - }).not.toHaveArrayOfObjects('memberName'); - }); - }); - }); - }); -}); - -describe('toHaveArrayOfSize', function() { - describeToHaveArrayX('toHaveArrayOfSize', function() { - describe('when number of expected items does not match', function() { - it('should deny', function() { - var xpToFail = expect; - xpToFail({ - memberName: '' - }).not.toHaveArrayOfSize('memberName'); - - expect({ - memberName: ['bar'] - }).not.toHaveArrayOfSize('memberName', 0); - }); - }); - describe('when number of expected items does match', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArrayOfSize('memberName', 0); - expect({ - memberName: ['bar'] - }).toHaveArrayOfSize('memberName', 1); - expect({ - memberName: ['bar', 'baz'] - }).toHaveArrayOfSize('memberName', 2); - }); - }); - }); -}); - - -describe('toHaveArrayOfStrings', function() { - describeToHaveArrayX('toHaveArrayOfStrings', function() { - describe('when named Array is empty', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArrayOfStrings('memberName'); - }); - }); - describe('when named Array has items', function() { - describe('when all items are strings', function() { - it('should confirm', function() { - expect({ - memberName: ['truthy'] - }).toHaveArrayOfStrings('memberName'); - expect({ - memberName: [new String('truthy')] - }).toHaveArrayOfStrings('memberName'); - expect({ - memberName: [new String('')] - }).toHaveArrayOfStrings('memberName'); - expect({ - memberName: ['', 'truthy'] - }).toHaveArrayOfStrings('memberName'); - }); - }); - describe('when any item is not a string', function() { - it('should deny', function() { - expect({ - memberName: [null] - }).not.toHaveArrayOfStrings('memberName'); - expect({ - memberName: [null, ''] - }).not.toHaveArrayOfStrings('memberName'); - }); - }); - }); - }); -}); - - -describe('toHaveBoolean', function() { - describeToHaveBooleanX('toHaveBoolean', function() { - describe('when primitive', function() { - it('should confirm', function() { - expect({ - memberName: true - }).toHaveBoolean('memberName'); - expect({ - memberName: false - }).toHaveBoolean('memberName'); - }); - }); - describe('when Boolean object', function() { - it('should confirm', function() { - expect({ - memberName: new Boolean(true) - }).toHaveBoolean('memberName'); - expect({ - memberName: new Boolean(false) - }).toHaveBoolean('memberName'); - }); - }); - }); -}); - -describe('toHaveCalculable', function() { - describeToHaveX('toHaveCalculable', function() { - describe('when subject CAN be coerced to be used in mathematical operations', function() { - it('should confirm', function() { - expect({ - memberName: '1' - }).toHaveCalculable('memberName'); - expect({ - memberName: '' - }).toHaveCalculable('memberName'); - expect({ - memberName: null - }).toHaveCalculable('memberName'); - }); - }); - describe('when subject can NOT be coerced by JavaScript to be used in mathematical operations', function() { - it('should deny', function() { - expect({ - memberName: {} - }).not.toHaveCalculable('memberName'); - expect({ - memberName: NaN - }).not.toHaveCalculable('memberName'); - }); - }); - }); -}); - -describe('toHaveDate', function() { - var mockDate: any; - beforeEach(function() { - mockDate = { - any: new Date(), - early: new Date('2013-01-01T00:00:00.000Z'), - late: new Date('2013-01-01T01:00:00.000Z') - }; - }); - describeToHaveX('toHaveDate', function() { - describe('when member is an instance of Date', function() { - it('should confirm', function() { - expect({ - memberName: mockDate.any - }).toHaveDate('memberName'); - }); - }); - describe('when member is NOT an instance of Date', function() { - it('should deny', function() { - expect({ - memberName: null - }).not.toHaveDate('memberName'); - }); - }); - }); -}); - -describe('toHaveDateAfter', function() { - var mockDate: any; - beforeEach(function() { - mockDate = { - any: new Date(), - early: new Date('2013-01-01T00:00:00.000Z'), - late: new Date('2013-01-01T01:00:00.000Z') - }; - }); - describeToHaveX('toHaveDateAfter', function() { - describe('when member is an instance of Date', function() { - describe('when date occurs before another', function() { - it('should confirm', function() { - expect({ - memberName: mockDate.late - }).toHaveDateAfter('memberName', mockDate.early); - }); - }); - describe('when date does NOT occur before another', function() { - it('should deny', function() { - expect({ - memberName: mockDate.early - }).not.toHaveDateAfter('memberName', mockDate.late); - }); - }); - }); - describe('when member is NOT an instance of Date', function() { - it('should deny', function() { - expect({ - memberName: null - }).not.toHaveDateAfter('memberName', mockDate.any); - }); - }); - }); -}); - -describeToHaveX('toHaveDateBefore', function() { - var mockDate: any; - beforeEach(function() { - mockDate = { - any: new Date(), - early: new Date('2013-01-01T00:00:00.000Z'), - late: new Date('2013-01-01T01:00:00.000Z') - }; - }); - describe('when member is an instance of Date', function() { - describe('when date occurs before another', function() { - it('should confirm', function() { - expect({ - memberName: mockDate.early - }).toHaveDateBefore('memberName', mockDate.late); - }); - }); - describe('when date does NOT occur before another', function() { - it('should deny', function() { - expect({ - memberName: mockDate.late - }).not.toHaveDateBefore('memberName', mockDate.early); - }); - }); - }); - describe('when member is NOT an instance of Date', function() { - it('should deny', function() { - expect({ - memberName: null - }).not.toHaveDateBefore('memberName', mockDate.any); - }); - }); -}); - -describe('toHaveEmptyArray', function() { - describeToHaveArrayX('toHaveEmptyArray', function() { - describe('when named array has members', function() { - it('should deny', function() { - expect({ - memberName: [1, 2, 3] - }).not.toHaveEmptyArray('memberName'); - expect({ - memberName: '' - }).not.toHaveEmptyArray('memberName'); - }); - }); - describe('when named array has no members', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveEmptyArray('memberName'); - }); - }); - }); -}); - -describe('toHaveEmptyObject', function() { - beforeEach(function() { - this.Foo = function() { }; - }); - describeToHaveX('toHaveEmptyObject', function() { - describe('when subject IS an Object with no instance members', function() { - beforeEach(function() { - this.Foo.prototype = { - b: 2 - }; - }); - it('should confirm', function() { - expect({ - memberName: new this.Foo() - }).toHaveEmptyObject('memberName'); - expect({ - memberName: {} - }).toHaveEmptyObject('memberName'); - }); - }); - describe('when subject is NOT an Object with no instance members', function() { - it('should deny', function() { - expect({ - memberName: { - a: 1 - } - }).not.toHaveEmptyObject('memberName'); - expect({ - memberName: null - }).not.toHaveNonEmptyObject('memberName'); - }); - }); - }); -}); - -describe('toHaveEmptyString', function() { - describeToHaveX('toHaveEmptyString', function() { - describe('when subject IS a string with no characters', function() { - it('should confirm', function() { - expect({ - memberName: '' - }).toHaveEmptyString('memberName'); - }); - }); - describe('when subject is NOT a string with no characters', function() { - it('should deny', function() { - expect({ - memberName: ' ' - }).not.toHaveEmptyString('memberName'); - }); - }); - }); -}); - -describe('toHaveEvenNumber', function() { - describeToHaveX('toHaveEvenNumber', function() { - describe('when subject IS an even number', function() { - it('should confirm', function() { - expect({ - memberName: 2 - }).toHaveEvenNumber('memberName'); - }); - }); - describe('when subject is NOT an even number', function() { - it('should deny', function() { - expect({ - memberName: 1 - }).not.toHaveEvenNumber('memberName'); - expect({ - memberName: NaN - }).not.toHaveEvenNumber('memberName'); - }); - }); - }); -}); - -describe('toHaveFalse', function() { - describeToHaveBooleanX('toHaveFalse', function() { - describe('when primitive', function() { - describe('when true', function() { - it('should deny', function() { - expect({ - memberName: true - }).not.toHaveFalse('memberName'); - }); - }); - describe('when false', function() { - it('should confirm', function() { - expect({ - memberName: false - }).toHaveFalse('memberName'); - }); - }); - }); - describe('when Boolean object', function() { - describe('when true', function() { - it('should deny', function() { - expect({ - memberName: new Boolean(true) - }).not.toHaveFalse('memberName'); - }); - }); - describe('when false', function() { - it('should confirm', function() { - expect({ - memberName: new Boolean(false) - }).toHaveFalse('memberName'); - }); - }); - }); - }); -}); - -describe('toHaveHtmlString', function() { - describeToHaveX('toHaveHtmlString', function() { - describe('when subject IS a string of HTML markup', function() { - beforeEach(function() { - this.ngMultiLine = ''; - this.ngMultiLine += ''; - this.ngMultiLine += '\n'; - this.ngMultiLine += ' Watch with Google TV'; - this.ngMultiLine += '\n'; - this.ngMultiLine += ''; - this.ngMultiLine += '\n'; - }); - it('should confirm', function() { - expect({ - memberName: 'text' - }).toHaveHtmlString('memberName'); - expect({ - memberName: 'baz' - }).toHaveHtmlString('memberName'); - expect({ - memberName: '
    ' - }).toHaveHtmlString('memberName'); - expect({ - memberName: '
  • ' - }).toHaveHtmlString('memberName'); - expect({ - memberName: this.ngMultiLine - }).toHaveHtmlString('memberName'); - }); - }); - describe('when subject is NOT a string of HTML markup', function() { - it('should deny', function() { - expect({ - memberName: 'div' - }).not.toHaveHtmlString('memberName'); - expect({ - memberName: null - }).not.toHaveHtmlString('memberName'); - }); - }); - }); -}); - -describe('toHaveIso8601', function() { - describeToHaveX('toHaveIso8601', function() { - describe('when member is a Date String conforming to the ISO 8601 standard', - function() { - describe('when specified date is valid', function() { - it('should confirm', function() { - expect({ - memberName: '2013-07-08T07:29:15.863Z' - }).toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:29:15.863' - }).toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:29:15' - }).toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:29' - }).toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08' - }).toHaveIso8601('memberName'); - }); - }); - describe('when specified date is NOT valid', function() { - it('should deny', function() { - expect({ - memberName: '2013-99-12T00:00:00.000Z' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-12-99T00:00:00.000Z' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-01-01T99:00:00.000Z' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-01-01T99:99:00.000Z' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-01-01T00:00:99.000Z' - }).not.toHaveIso8601('memberName'); - }); - }); - }); - describe('when member is a String NOT conforming to the ISO 8601 standard', - function() { - it('should deny', function() { - expect({ - memberName: '2013-07-08T07:29:15.' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:29:' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:2' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-0' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-0' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '201' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '20' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '' - }).not.toHaveIso8601('memberName'); - }); - }); - }); -}); - -describe('toHaveJsonString', function() { - describeToHaveX('toHaveJsonString', function() { - describe('when subject IS a string of parseable JSON', function() { - it('should confirm', function() { - expect({ - memberName: '{}' - }).toHaveJsonString('memberName'); - expect({ - memberName: '[]' - }).toHaveJsonString('memberName'); - expect({ - memberName: '[1]' - }).toHaveJsonString('memberName'); - }); - }); - describe('when subject is NOT a string of parseable JSON', function() { - it('should deny', function() { - expect({ - memberName: '[1,]' - }).not.toHaveJsonString('memberName'); - expect({ - memberName: '<>' - }).not.toHaveJsonString('memberName'); - expect({ - memberName: null - }).not.toHaveJsonString('memberName'); - expect({ - memberName: '' - }).not.toHaveJsonString('memberName'); - expect({ - memberName: _undefined - }).not.toHaveJsonString('memberName'); - }); - }); - }); -}); - -describe('toHaveMember', function() { - describeToHaveX('toHaveMember', function() { }); -}); - -describe('toHaveMethod', function() { - describeToHaveX('toHaveMethod', function() { - describe('when subject IS a function', function() { - it('should confirm', function() { - expect({ - memberName: function() { } - }).toHaveMethod('memberName'); - }); - }); - describe('when subject is NOT a function', function() { - it('should deny', function() { - expect({ - memberName: /regexp/ - }).not.toHaveMethod('memberName'); - }); - }); - }); -}); - -describe('toHaveNonEmptyArray', function() { - describeToHaveArrayX('toHaveNonEmptyArray', function() { - describe('when named array has no members', function() { - it('should deny', function() { - expect({ - memberName: [] - }).not.toHaveNonEmptyArray('memberName'); - }); - }); - describe('when named array has members', function() { - it('should confirm', function() { - expect({ - memberName: [1, 2, 3] - }).toHaveNonEmptyArray('memberName'); - }); - }); - }); -}); - -describe('toHaveNonEmptyObject', function() { - describeToHaveX('toHaveNonEmptyObject', function() { - beforeEach(function() { - this.Foo = function() { }; - }); - describe('when subject IS an Object with at least one instance member', function() { - it('should confirm', function() { - expect({ - memberName: { - a: 1 - } - }).toHaveNonEmptyObject('memberName'); - }); - }); - describe('when subject is NOT an Object with at least one instance member', function() { - beforeEach(function() { - this.Foo.prototype = { - b: 2 - }; - }); - it('should deny', function() { - expect({ - memberName: new this.Foo() - }).not.toHaveNonEmptyObject('memberName'); - expect({ - memberName: {} - }).not.toHaveNonEmptyObject('memberName'); - expect({ - memberName: null - }).not.toHaveNonEmptyObject('memberName'); - }); - }); - }); -}); - -describe('toHaveNonEmptyString', function() { - describeToHaveX('toHaveNonEmptyString', function() { - describe('when subject IS a string with at least one character', function() { - it('should confirm', function() { - expect({ - memberName: ' ' - }).toHaveNonEmptyString('memberName'); - }); - }); - describe('when subject is NOT a string with at least one character', function() { - it('should deny', function() { - expect({ - memberName: '' - }).not.toHaveNonEmptyString('memberName'); - expect({ - memberName: null - }).not.toHaveNonEmptyString('memberName'); - }); - }); - }); -}); - -describe('toHaveNumber', function() { - describeToHaveX('toHaveNumber', function() { - describe('when subject IS a number', function() { - it('should confirm', function() { - expect({ - memberName: 1 - }).toHaveNumber('memberName'); - expect({ - memberName: 1.11 - }).toHaveNumber('memberName'); - expect({ - memberName: 1e3 - }).toHaveNumber('memberName'); - expect({ - memberName: 0.11 - }).toHaveNumber('memberName'); - expect({ - memberName: -11 - }).toHaveNumber('memberName'); - }); - }); - describe('when subject is NOT a number', function() { - it('should deny', function() { - expect({ - memberName: '1' - }).not.toHaveNumber('memberName'); - expect({ - memberName: NaN - }).not.toHaveNumber('memberName'); - }); - }); - }); -}); - -describe('toHaveNumberWithinRange', function() { - describeToHaveX('toHaveNumberWithinRange', function() { - describe('when subject IS a number >= floor and <= ceiling', function() { - it('should confirm', function() { - expect({ - memberName: 0 - }).toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: 1 - }).toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: 2 - }).toHaveNumberWithinRange('memberName', 0, 2); - }); - }); - describe('when subject is NOT a number >= floor and <= ceiling', function() { - it('should deny', function() { - expect({ - memberName: -3 - }).not.toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: -2 - }).not.toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: -1 - }).not.toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: 3 - }).not.toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: NaN - }).not.toHaveNumberWithinRange('memberName', 0, 2); - }); - }); - }); -}); - -describe('toHaveObject', function() { - describeToHaveX('toHaveObject', function() { - beforeEach(function() { - this.Foo = function() { }; - }); - describe('when subject IS an Object', function() { - it('should confirm', function() { - expect({ - memberName: new Object() - }).toHaveObject('memberName'); - expect({ - memberName: new this.Foo() - }).toHaveObject('memberName'); - expect({ - memberName: {} - }).toHaveObject('memberName'); - }); - }); - describe('when subject is NOT an Object', function() { - it('should deny', function() { - expect({ - memberName: null - }).not.toHaveObject('memberName'); - expect({ - memberName: 123 - }).not.toHaveObject('memberName'); - expect({ - memberName: '[object Object]' - }).not.toHaveObject('memberName'); - }); - }); - }); -}); - -describe('toHaveOddNumber', function() { - describeToHaveX('toHaveOddNumber', function() { - describe('when subject IS an odd number', function() { - it('should confirm', function() { - expect({ - memberName: 1 - }).toHaveOddNumber('memberName'); - }); - }); - describe('when subject is NOT an odd number', function() { - it('should deny', function() { - expect({ - memberName: 2 - }).not.toHaveOddNumber('memberName'); - expect({ - memberName: NaN - }).not.toHaveOddNumber('memberName'); - }); - }); - }); -}); - -describe('toHaveString', function() { - describeToHaveX('toHaveString', function() { - describe('when subject IS a string of any length', function() { - it('should confirm', function() { - expect({ - memberName: '' - }).toHaveString('memberName'); - expect({ - memberName: ' ' - }).toHaveString('memberName'); - }); - }); - describe('when subject is NOT a string of any length', function() { - it('should deny', function() { - expect({ - memberName: null - }).not.toHaveString('memberName'); - }); - }); - }); -}); - -describe('toHaveStringLongerThan', function() { - describeToHaveX('toHaveStringLongerThan', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS longer than the comparision string', function() { - it('should confirm', function() { - expect({ - memberName: 'abc' - }).toHaveStringLongerThan('memberName', 'ab'); - expect({ - memberName: 'a' - }).toHaveStringLongerThan('memberName', ''); - }); - }); - describe('when the subject is NOT longer than the comparision string', function() { - it('should deny', function() { - expect({ - memberName: 'ab' - }).not.toHaveStringLongerThan('memberName', 'abc'); - expect({ - memberName: '' - }).not.toHaveStringLongerThan('memberName', 'a'); - }); - }); - }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect({ - memberName: 'truthy' - }).not.toHaveStringLongerThan('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringLongerThan('memberName', 'truthy'); - expect({ - memberName: '' - }).not.toHaveStringLongerThan('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringLongerThan('memberName', ''); - }); - }); - }); -}); - -describe('toHaveStringSameLengthAs', function() { - describeToHaveX('toHaveStringSameLengthAs', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS the same length as the comparision string', function() { - it('should confirm', function() { - expect({ - memberName: 'ab' - }).toHaveStringSameLengthAs('memberName', 'ab'); - }); - }); - describe('when the subject is NOT the same length as the comparision string', function() { - it('should deny', function() { - expect({ - memberName: 'abc' - }).not.toHaveStringSameLengthAs('memberName', 'ab'); - expect({ - memberName: 'a' - }).not.toHaveStringSameLengthAs('memberName', ''); - expect({ - memberName: '' - }).not.toHaveStringSameLengthAs('memberName', 'a'); - }); - }); - }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect({ - memberName: 'truthy' - }).not.toHaveStringSameLengthAs('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringSameLengthAs('memberName', 'truthy'); - expect({ - memberName: '' - }).not.toHaveStringSameLengthAs('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringSameLengthAs('memberName', ''); - }); - }); - }); -}); - -describe('toHaveStringShorterThan', function() { - describeToHaveX('toHaveStringShorterThan', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS shorter than the comparision string', function() { - it('should confirm', function() { - expect({ - memberName: 'ab' - }).toHaveStringShorterThan('memberName', 'abc'); - expect({ - memberName: '' - }).toHaveStringShorterThan('memberName', 'a'); - }); - }); - describe('when the subject is NOT shorter than the comparision string', function() { - it('should deny', function() { - expect({ - memberName: 'abc' - }).not.toHaveStringShorterThan('memberName', 'ab'); - expect({ - memberName: 'a' - }).not.toHaveStringShorterThan('memberName', ''); - }); - }); - }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect({ - memberName: 'truthy' - }).not.toHaveStringShorterThan('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringShorterThan('memberName', 'truthy'); - expect({ - memberName: '' - }).not.toHaveStringShorterThan('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringShorterThan('memberName', ''); - }); - }); - }); -}); - - -describe('toHaveTrue', function() { - describeToHaveBooleanX('toHaveTrue', function() { - describe('when primitive', function() { - describe('when true', function() { - it('should confirm', function() { - expect({ - memberName: true - }).toHaveTrue('memberName'); - }); - }); - describe('when false', function() { - it('should deny', function() { - expect({ - memberName: false - }).not.toHaveTrue('memberName'); - }); - }); - }); - describe('when Boolean object', function() { - describe('when true', function() { - it('should confirm', function() { - expect({ - memberName: new Boolean(true) - }).toHaveTrue('memberName'); - }); - }); - describe('when false', function() { - it('should deny', function() { - expect({ - memberName: new Boolean(false) - }).not.toHaveTrue('memberName'); - }); - }); - }); - }); -}); - -describe('toHaveWhitespaceString', function() { - describeToHaveX('toHaveWhitespaceString', function() { - describe('when subject IS a string containing only tabs, spaces, returns etc', function() { - it('should confirm', function() { - expect({ - memberName: ' ' - }).toHaveWhitespaceString('memberName'); - expect({ - memberName: '' - }).toHaveWhitespaceString('memberName'); - }); - }); - describe('when subject is NOT a string containing only tabs, spaces, returns etc', function() { - it('should deny', function() { - expect({ - memberName: 'has-no-whitespace' - }).not.toHaveWhitespaceString('memberName'); - expect({ - memberName: 'has whitespace' - }).not.toHaveWhitespaceString('memberName'); - expect({ - memberName: null - }).not.toHaveWhitespaceString('memberName'); - }); - }); - }); -}); - -describe('toHaveWholeNumber', function() { - describeToHaveX('toHaveWholeNumber', function() { - describe('when subject IS a number with no positive decimal places', function() { - it('should confirm', function() { - expect({ - memberName: 1 - }).toHaveWholeNumber('memberName'); - expect({ - memberName: 0 - }).toHaveWholeNumber('memberName'); - expect({ - memberName: 0.0 - }).toHaveWholeNumber('memberName'); - }); - }); - describe('when subject is NOT a number with no positive decimal places', function() { - it('should deny', function() { - expect({ - memberName: NaN - }).not.toHaveWholeNumber('memberName'); - expect({ - memberName: 1.1 - }).not.toHaveWholeNumber('memberName'); - expect({ - memberName: 0.1 - }).not.toHaveWholeNumber('memberName'); - }); - }); - }); -}); - -describe('toStartWith', function() { - describe('when invoked', function() { - describe('when subject is NOT an undefined or empty string', function() { - describe('when subject is a string whose leading characters match the expected string', function() { - it('should confirm', function() { - expect('jamie').toStartWith('jam'); - }); - }); - describe('when subject is a string whose leading characters DO NOT match the expected string', function() { - it('should deny', function() { - expect(' jamie').not.toStartWith('jam'); - expect('Jamie').not.toStartWith('jam'); - }); - }); - }); - describe('when subject IS an undefined or empty string', function() { - it('should deny', function() { - expect('').not.toStartWith(''); - expect(_undefined).not.toStartWith(''); - expect(_undefined).not.toStartWith('undefined'); - expect('undefined').not.toStartWith(_undefined); - }); - }); - }); -}); - - -describe('toThrowAnyError', function() { - describe('when supplied a function', function() { - describe('when function errors when invoked', function() { - beforeEach(function() { - this.throwError = function() { - throw new Error('wut?'); - }; - this.badReference = function() { - return badReference.someValue; - }; - }); - it('should confirm', function() { - expect(this.throwError).toThrowAnyError(); - expect(this.badReference).toThrowAnyError(); - }); - }); - describe('when function does NOT error when invoked', function() { - beforeEach(function() { - this.noErrors = function() { }; - }); - it('should deny', function() { - expect(this.noErrors).not.toThrowAnyError(); - }); - }); - }); -}); - - -describe('toThrowErrorOfType', function() { - describe('when supplied a function', function() { - describe('when function errors when invoked', function() { - beforeEach(function() { - this.throwError = function() { - throw new Error('wut?'); - }; - this.badReference = function() { - return badReference.someValue; - }; - }); - describe('when the error is of the expected type', function() { - it('should confirm', function() { - expect(this.throwError).toThrowErrorOfType('Error'); - expect(this.badReference).toThrowErrorOfType('ReferenceError'); - }); - }); - describe('when the error is NOT of the expected type', function() { - it('should confirm', function() { - expect(this.throwError).not.toThrowErrorOfType('ReferenceError'); - expect(this.badReference).not.toThrowErrorOfType('Error'); - }); - }); - }); - }); -}); diff --git a/types/jasmine-expect/tsconfig.json b/types/jasmine-expect/tsconfig.json deleted file mode 100644 index 62a373d410..0000000000 --- a/types/jasmine-expect/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "jasmine-expect-tests.ts" - ] -} \ No newline at end of file diff --git a/types/jasmine-expect/tslint.json b/types/jasmine-expect/tslint.json deleted file mode 100644 index 7f51cc6e38..0000000000 --- a/types/jasmine-expect/tslint.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-initializer": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 673dc99623f30e84d9b5f220a3acda00a8746c27 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 10:33:38 -0800 Subject: [PATCH 296/890] passport-client-cert: Provides its own types (#22369) --- notNeededPackages.json | 6 ++++ types/passport-client-cert/index.d.ts | 35 ------------------- .../passport-client-cert-tests.ts | 14 -------- types/passport-client-cert/tsconfig.json | 23 ------------ types/passport-client-cert/tslint.json | 1 - 5 files changed, 6 insertions(+), 73 deletions(-) delete mode 100644 types/passport-client-cert/index.d.ts delete mode 100644 types/passport-client-cert/passport-client-cert-tests.ts delete mode 100644 types/passport-client-cert/tsconfig.json delete mode 100644 types/passport-client-cert/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4bdbda9f3a..c85ca69af7 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -792,6 +792,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/pascal-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "passport-client-cert", + "typingsPackageName": "passport-client-cert", + "sourceRepoURL": "https://github.com/ripjar/passport-client-cert", + "asOfVersion": "2.1.0" + }, { "libraryName": "path-case", "typingsPackageName": "path-case", diff --git a/types/passport-client-cert/index.d.ts b/types/passport-client-cert/index.d.ts deleted file mode 100644 index 98998c567f..0000000000 --- a/types/passport-client-cert/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Type definitions for passport-client-cert 2.0 -// Project: https://github.com/ripjar/passport-client-cert -// Definitions by: Sean Warner -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import { Strategy as PassportStrategy } from 'passport-strategy'; -import { Request } from 'express'; - -export class Strategy extends PassportStrategy { - constructor(verify: PkiCallback); - constructor(opt: StrategyOptions, verify: PkiCallback | PkiCallbackWithRequest); -} - -export interface StrategyOptions { - passReqToCallback?: boolean; -} - -export type PkiCallback = (payload: ClientCert, done: PkiVerifiedCallback) => void; - -export type PkiCallbackWithRequest = (req: Request, payload: ClientCert, done: PkiVerifiedCallback) => void; - -export interface ClientCert { - exponent: string; - fingerprint: string; - issuer: any; - modulus: string; - raw: Uint8Array; - serialNumber: string; - subject: any; - valid_from: string; - valid_to: string; -} - -export type PkiVerifiedCallback = (error: any, user?: any, info?: any) => void; diff --git a/types/passport-client-cert/passport-client-cert-tests.ts b/types/passport-client-cert/passport-client-cert-tests.ts deleted file mode 100644 index d0790ba4f2..0000000000 --- a/types/passport-client-cert/passport-client-cert-tests.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as passport from "passport"; -import { ClientCert, PkiVerifiedCallback, Strategy as ClientCertStrategy } from "passport-client-cert"; - -passport.use(new ClientCertStrategy((clientCert: ClientCert, done: PkiVerifiedCallback) => { - const cn = clientCert.subject.cn; - let user = null; - - // The CN will typically be checked against a database - if (cn === 'test-cn') { - user = { name: 'Test User' }; - } - - done(null, user); -})); diff --git a/types/passport-client-cert/tsconfig.json b/types/passport-client-cert/tsconfig.json deleted file mode 100644 index fbf48f7438..0000000000 --- a/types/passport-client-cert/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "passport-client-cert-tests.ts" - ] -} \ No newline at end of file diff --git a/types/passport-client-cert/tslint.json b/types/passport-client-cert/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/passport-client-cert/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From d7ceadf91f52453f887ae792bc8d3d1dafc80cea Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 10:38:44 -0800 Subject: [PATCH 297/890] bignumber.js: Provides its own types (#22374) --- notNeededPackages.json | 6 + types/bignumber.js/bignumber.js-tests.ts | 443 --------------- types/bignumber.js/index.d.ts | 676 ----------------------- types/bignumber.js/tsconfig.json | 23 - types/bignumber.js/tslint.json | 1 - 5 files changed, 6 insertions(+), 1143 deletions(-) delete mode 100644 types/bignumber.js/bignumber.js-tests.ts delete mode 100644 types/bignumber.js/index.d.ts delete mode 100644 types/bignumber.js/tsconfig.json delete mode 100644 types/bignumber.js/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index c85ca69af7..359204f8b1 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -150,6 +150,12 @@ "sourceRepoURL": "https://github.com/peterolson/BigInteger.js", "asOfVersion": "0.0.31" }, + { + "libraryName": "bignumber.js", + "typingsPackageName": "bignumber.js", + "sourceRepoURL": "https://github.com/MikeMcl/bignumber.js/", + "asOfVersion": "4.0.3" + }, { "libraryName": "Bowser", "typingsPackageName": "bowser", diff --git a/types/bignumber.js/bignumber.js-tests.ts b/types/bignumber.js/bignumber.js-tests.ts deleted file mode 100644 index 424665d8ba..0000000000 --- a/types/bignumber.js/bignumber.js-tests.ts +++ /dev/null @@ -1,443 +0,0 @@ -let x: BigNumber.BigNumber = new BigNumber(9); -let y = new BigNumber(x); - -BigNumber(435.345); - -new BigNumber('5032485723458348569331745.33434346346912144534543'); -new BigNumber('4.321e+4'); -new BigNumber('-735.0918e-430'); -new BigNumber(Infinity); -new BigNumber(NaN); -new BigNumber('.5'); -new BigNumber('+2'); -new BigNumber(-10110100.1, 2); -new BigNumber(-0b10110100); -new BigNumber('123412421.234324', 5); -new BigNumber('ff.8', 16); -new BigNumber('0xff.8'); - -new BigNumber(9, 2); - -new BigNumber(96517860459076817.4395); - -new BigNumber('blurgh'); - -BigNumber.config({ DECIMAL_PLACES: 5 }); -new BigNumber(1.23456789); -new BigNumber(1.23456789, 10); - -BigNumber.config({ DECIMAL_PLACES: 5 }); -let BN = BigNumber.another({ DECIMAL_PLACES: 9 }); - -x = new BigNumber(1); -y = new BN(1); - -x.div(3); -y.div(3); - -BN = BigNumber.another(); -BN.config({ DECIMAL_PLACES: 9 }); - -BigNumber.config({ DECIMAL_PLACES: 5 }); -BigNumber.set({ DECIMAL_PLACES: 5 }); -BigNumber.config(5); - -BigNumber.config({ ROUNDING_MODE: 0 }); -BigNumber.config(undefined, BigNumber.ROUND_UP); - -BigNumber.config({ EXPONENTIAL_AT: 2 }); -new BigNumber(12.3); -new BigNumber(123); -new BigNumber(0.123); -new BigNumber(0.0123); - -BigNumber.config({ EXPONENTIAL_AT: [-7, 20] }); -new BigNumber(123456789); -new BigNumber(0.000000123); - -BigNumber.config({ EXPONENTIAL_AT: 1e+9 }); - -BigNumber.config({ EXPONENTIAL_AT: 0 }); - -BigNumber.config({ RANGE: 500 }); -BigNumber.config().RANGE; -new BigNumber('9.999e499'); -new BigNumber('1e500'); -new BigNumber('1e-499'); -new BigNumber('1e-500'); - -BigNumber.config({ RANGE: [-3, 4] }); -new BigNumber(99999); -new BigNumber(100000); -new BigNumber(0.001); -new BigNumber(0.0001); - -BigNumber.config({ ERRORS: false }); - -BigNumber.config({ CRYPTO: true }); -BigNumber.config().CRYPTO; -BigNumber.random(); - -BigNumber.config({ MODULO_MODE: BigNumber.EUCLID }); -BigNumber.config({ MODULO_MODE: 9 }); - -BigNumber.config({ POW_PRECISION: 100 }); - -BigNumber.config({ - FORMAT: { - decimalSeparator: '.', - groupSeparator: ',', - groupSize: 3, - secondaryGroupSize: 0, - fractionGroupSeparator: ' ', - fractionGroupSize: 0 - } -}); - -BigNumber.config({ - DECIMAL_PLACES: 40, - ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL, - EXPONENTIAL_AT: [-10, 20], - RANGE: [-500, 500], - ERRORS: true, - CRYPTO: true, - MODULO_MODE: BigNumber.ROUND_FLOOR, - POW_PRECISION: 80, - FORMAT: { - groupSize: 3, - groupSeparator: ' ', - decimalSeparator: ',' - } -}); - -BigNumber.config(40, 7, [-10, 20], 500, 1, 1, 3, 80); - -const obj = BigNumber.config(); -obj.ERRORS; -obj.RANGE; - -x = new BigNumber('3257869345.0378653'); -BigNumber.max(4e9, x, '123456789.9'); - -let arr = [12, '13', new BigNumber(14)]; -BigNumber.max(arr); - -x = new BigNumber('3257869345.0378653'); -BigNumber.min(4e9, x, '123456789.9'); - -arr = [2, new BigNumber(-14), '-15.9999', -12]; -BigNumber.min(arr); - -BigNumber.config({ DECIMAL_PLACES: 10 }); -BigNumber.random(); -BigNumber.random(20); - -BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_CEIL }); -BigNumber.config({ ROUNDING_MODE: 2 }); - -x = new BigNumber(-0.8); -y = x.absoluteValue(); -let z = y.abs(); - -x = new BigNumber(1.3); -x.ceil(); -y = new BigNumber(-1.8); -y.ceil(); - -x = new BigNumber(Infinity); -y = new BigNumber(5); -x.comparedTo(y); -x.comparedTo(x.minus(1)); -y.cmp(NaN); -y.cmp('110', 2); - -x = new BigNumber(123.45); -x.decimalPlaces(); -y = new BigNumber('9.9e-101'); -y.dp(); - -x = new BigNumber(355); -y = new BigNumber(113); -x.dividedBy(y); -x.div(5); -x.div(47, 16); - -x = new BigNumber(5); -y = new BigNumber(3); -x.dividedToIntegerBy(y); -x.divToInt(0.7); -x.divToInt('0.f', 16); - -0 === 1e-324; -x = new BigNumber(0); -x.equals('1e-324'); -BigNumber(-0).eq(x); -BigNumber(255).eq('ff', 16); - -y = new BigNumber(NaN); -y.equals(NaN); - -x = new BigNumber(1.8); -x.floor(); -y = new BigNumber(-1.3); -y.floor(); - -0.1 > (0.3 - 0.2); // tslint:disable-line binary-expression-operand-order -x = new BigNumber(0.1); -x.greaterThan(BigNumber(0.3).minus(0.2)); -BigNumber(0).gt(x); -BigNumber(11, 3).gt(11.1, 2); - -x = new BigNumber(0.3).minus(0.2); -x.greaterThanOrEqualTo(0.1); -BigNumber(1).gte(x); -BigNumber(10, 18).gte('i', 36); - -x = new BigNumber(1); -x.isFinite(); -y = new BigNumber(Infinity); -y.isFinite(); - -x = new BigNumber(1); -x.isInteger(); -y = new BigNumber(123.456); -y.isInt(); - -x = new BigNumber(NaN); -x.isNaN(); -y = new BigNumber('Infinity'); -y.isNaN(); - -x = new BigNumber(-0); -x.isNegative(); -y = new BigNumber(2); -y.isNeg(); - -x = new BigNumber(-0); -x.isZero() && x.isNeg(); -y = new BigNumber(Infinity); -y.isZero(); - -x = new BigNumber(0.3).minus(0.2); -x.lessThan(0.1); -BigNumber(0).lt(x); -BigNumber(11.1, 2).lt(11, 3); - -x = new BigNumber(0.1); -x.lessThanOrEqualTo(BigNumber(0.3).minus(0.2)); -BigNumber(-1).lte(x); -BigNumber(10, 18).lte('i', 36); - -x = new BigNumber(0.3); -x.minus(0.1); -x.sub(0.6, 20); - -x = new BigNumber(1); -x.modulo(0.9); -y = new BigNumber(33); -y.mod('a', 33); - -x = new BigNumber(1.8); -x.negated(); -y = new BigNumber(-1.3); -y.neg(); - -x = new BigNumber(0.1); -y = x.plus(0.2); -BigNumber(0.7).plus(x).add(y); -x.plus('0.1', 8); - -x = new BigNumber(1.234); -x.precision(); -y = new BigNumber(987000); -y.sd(); -y.sd(true); - -y = new BigNumber(x); -y.round(); -y.round(1); -y.round(2); -y.round(10); -y.round(0, 1); -y.round(0, 6); -y.round(1, 1); -y.round(1, BigNumber.ROUND_HALF_EVEN); - -x = new BigNumber(1.23); -x.shift(3); -x.shift(-3); - -x = new BigNumber(16); -x.squareRoot(); -y = new BigNumber(3); -y.sqrt(); - -x = new BigNumber(0.6); -y = x.times(3); -BigNumber('7e+500').times(y); -x.times('-a', 16); - -BigNumber.config({ DECIMAL_PLACES: 5, ROUNDING_MODE: 4 }); -x = new BigNumber(9876.54321); - -x.toDigits(); -x.toDigits(6); -x.toDigits(6, BigNumber.ROUND_UP); -x.toDigits(2); -x.toDigits(2, 1); - -y = new BigNumber(45.6); -y.toExponential(); -y.toExponential(0); -y.toExponential(1); -y.toExponential(1, 1); -y.toExponential(3); - -y = new BigNumber(3.456); -y.toFixed(); -y.toFixed(0); -y.toFixed(2); -y.toFixed(2, 1); -y.toFixed(5); - -const format = { - decimalSeparator: '.', - groupSeparator: ',', - groupSize: 3, - secondaryGroupSize: 0, - fractionGroupSeparator: ' ', - fractionGroupSize: 0 -}; -BigNumber.config({ FORMAT: format }); - -x = new BigNumber('123456789.123456789'); -x.toFormat(); -x.toFormat(1); - -format.groupSeparator = ' '; -format.fractionGroupSize = 5; -x.toFormat(); - -BigNumber.config({ - FORMAT: { - decimalSeparator: ',', - groupSeparator: '.', - groupSize: 3, - secondaryGroupSize: 2 - } -}); - -x.toFormat(6); - -x = new BigNumber(1.75); -x.toFraction(); - -const pi = new BigNumber('3.14159265358'); -pi.toFraction(); -pi.toFraction(100000); -pi.toFraction(10000); -pi.toFraction(100); -pi.toFraction(10); -pi.toFraction(1); - -x = new BigNumber('177.7e+457'); -y = new BigNumber(235.4325); -z = new BigNumber('0.0098074'); - -const str = JSON.stringify([x, y, z]); - -JSON.parse(str, (key, val) => key === '' ? val : new BigNumber(val)); - -x = new BigNumber(456.789); -x.toNumber(); -{ +x; } - -y = new BigNumber('45987349857634085409857349856430985'); -y.toNumber(); - -z = new BigNumber(-0); -1 / +z; -1 / z.toNumber(); - -x = new BigNumber(0.7); -x.toPower(2); -BigNumber(3).pow(-2); - -y = new BigNumber(45.6); -x.toPrecision(); -y.toPrecision(); -x.toPrecision(1); -y.toPrecision(1); -y.toPrecision(2, 0); -y.toPrecision(2, 1); -x.toPrecision(5); -y.toPrecision(5); - -x = new BigNumber(750000); -x.toString(); -BigNumber.config({ EXPONENTIAL_AT: 5 }); -x.toString(); - -y = new BigNumber(362.875); -y.toString(2); -y.toString(9); -y.toString(32); - -BigNumber.config({ DECIMAL_PLACES: 4 }); -z = new BigNumber('1.23456789'); -z.toString(); -z.toString(10); - -x = new BigNumber(123.456); -x.truncated(); -y = new BigNumber(-12.3); -y.trunc(); - -x = new BigNumber('-0'); -x.toString(); -x.valueOf(); -y = new BigNumber('1.777e+457'); -y.valueOf(); - -x = new BigNumber(0.123); -x.toExponential(); -x.c; -x.e; -x.s; - -z = new BigNumber('-123.4567000e+2'); -z.toExponential(); -z.c; -z.e; -z.s; - -x = new BigNumber(3); -x instanceof BigNumber; -x.isBigNumber; - -BN = BigNumber.another(); - -y = new BN(3); -y instanceof BigNumber; -y.isBigNumber; - -y = new BigNumber(-0); -y.c; -y.e; -y.s; - -try { - // ... -} catch (e) { - if (e instanceof Error && e.name === 'BigNumber Error') { - // ... - } -} - -x = new BigNumber("1.0"); -y = new BigNumber("1.1000"); -z = x.add(y); - -x = new BigNumber("1.20"); -y = new BigNumber("3.45000"); -z = x.mul(y); diff --git a/types/bignumber.js/index.d.ts b/types/bignumber.js/index.d.ts deleted file mode 100644 index ae7ec5b6f7..0000000000 --- a/types/bignumber.js/index.d.ts +++ /dev/null @@ -1,676 +0,0 @@ -// Type definitions for bignumber.js 4.0 -// Project: https://github.com/MikeMcl/bignumber.js/ -// Definitions by: Viktor Smirnov -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 - -declare var BigNumber: BigNumber.BigNumberStatic; - -export as namespace BigNumber; -export = BigNumber; - -declare namespace BigNumber { - interface FormatConfig { - /** - * The decimal separator. - */ - decimalSeparator: string; - - /** - * The grouping separator of the integer part. - */ - groupSeparator: string; - - /** - * The primary grouping size of the integer part. - */ - groupSize: number; - - /** - * The secondary grouping size of the integer part. - */ - secondaryGroupSize: number; - - /** - * The grouping separator of the fraction part. - */ - fractionGroupSeparator: string; - - /** - * The grouping size of the fraction part. - */ - fractionGroupSize: number; - } - - interface BigNumberConfig { - /** - * The maximum number of decimal places of the results of operations involving division, - * i.e. division, square root and base conversion operations, and power operations with negative exponents. - */ - DECIMAL_PLACES: number; - - /** - * The rounding mode used in the above operations and the default rounding mode of round, `toExponential`, `toFixed`, `toFormat` and `toPrecision`. - */ - ROUNDING_MODE: RoundingMode; - - /** - * The exponent value(s) at which `toString` returns exponential notation. - * - * If a single number is assigned, the value is the exponent magnitude. - * - * If an array of two numbers is assigned then the first number is the negative exponent value at and beneath which exponential notation is used, - * and the second number is the positive exponent value at and above which the same. - */ - EXPONENTIAL_AT: number | number[]; - - /** - * The exponent value(s) beyond which overflow to `Infinity` and underflow to zero occurs. - * - * If a single number is assigned, it is the maximum exponent magnitude: - * values wth a positive exponent of greater magnitude become `Infinity` - * and those with a negative exponent of greater magnitude become zero. - * - * If an array of two numbers is assigned then the first number is the negative exponent limit and the second number is the positive exponent limit. - */ - RANGE: number | number[]; - - /** - * The value that determines whether BigNumber Errors are thrown. - * - * If `ERRORS` is false, no errors will be thrown. - */ - ERRORS: boolean | 0 | 1; - - /** - * The value that determines whether cryptographically-secure pseudo-random number generation is used. - * - * If `CRYPTO` is set to `true` then the `random` method will generate random digits using `crypto.getRandomValues` in browsers that support it, - * or `crypto.randomBytes` if using a version of Node.js that supports it. - * - * If neither function is supported by the host environment then attempting to set `CRYPTO` to `true` will fail, and if `ERRORS` is `true` an exception will be thrown. - * - * If `CRYPTO` is `false` then the source of randomness used will be `Math.random` (which is assumed to generate at least `30` bits of randomness). - */ - CRYPTO: boolean | 0 | 1; - - /** - * The modulo mode used when calculating the modulus: `a mod n`. - * - * The quotient, `q = a / n`, is calculated according to the `ROUNDING_MODE` that corresponds to the chosen `MODULO_MODE`. - * - * The remainder, `r`, is calculated as: `r = a - n * q`. - */ - MODULO_MODE: ModuloMode; - - /** - * The maximum number of significant digits of the result of the power operation (unless a modulus is specified). - * - * If set to `0`, the number of signifcant digits will not be limited. - */ - POW_PRECISION: number; - - /** - * The `FORMAT` object configures the format of the string returned by the toFormat method. - */ - FORMAT: Partial; - } - - type NumberLike = number | string | BigNumber; - type RoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; - type ModuloMode = RoundingMode | 9; - - interface BigNumberStatic { - /** - * Returns a new instance of a BigNumber object. - */ - (value: NumberLike, base?: number): BigNumber; - - /** - * Returns a new instance of a BigNumber object. - */ - new (value: NumberLike, base?: number): BigNumber; - - /** - * Returns a new independent BigNumber constructor with configuration as described by obj, or with the default configuration if obj is null or undefined. - */ - another(obj?: Partial): BigNumberStatic; - - /** - * Configures the settings for this particular BigNumber constructor. - * - */ - config(obj?: Partial): BigNumberConfig; - - /** - * Configures the settings for this particular BigNumber constructor. - */ - config( - DECIMAL_PLACES?: number, - ROUNDING_MODE?: RoundingMode, - EXPONENTIAL_AT?: number | number[], - RANGE?: number | number[], - ERRORS?: boolean | 0 | 1, - CRYPTO?: boolean | 0 | 1, - MODULO_MODE?: ModuloMode, - POW_PRECISION?: number - ): BigNumberConfig; - - /** - * Configures the settings for this particular BigNumber constructor. - */ - set(obj?: Partial): BigNumberConfig; - - /** - * Configures the settings for this particular BigNumber constructor. - */ - set( - DECIMAL_PLACES?: number, - ROUNDING_MODE?: RoundingMode, - EXPONENTIAL_AT?: number | number[], - RANGE?: number | number[], - ERRORS?: boolean | 0 | 1, - CRYPTO?: boolean | 0 | 1, - MODULO_MODE?: ModuloMode, - POW_PRECISION?: number - ): BigNumberConfig; - - /** - * Returns a BigNumber whose value is the maximum of `args`. - */ - max(...args: NumberLike[]): BigNumber; - - /** - * Returns a BigNumber whose value is the maximum of `args`. - */ - max(args: NumberLike[]): BigNumber; - - /** - * Returns a BigNumber whose value is the minimum of `args`. - */ - min(...args: NumberLike[]): BigNumber; - - /** - * Returns a BigNumber whose value is the minimum of `args`. - */ - min(args: NumberLike[]): BigNumber; - - /** - * Returns a new BigNumber with a pseudo-random value equal to or greater than `0` and less than `1`. - * - * The return value will have `dp` decimal places (or less if trailing zeros are produced). - * If `dp` is omitted then the number of decimal places will default to the current `DECIMAL_PLACES` setting. - * - * Depending on the value of this BigNumber constructor's `CRYPTO` setting and the support for the `crypto` object in the host environment, - * the random digits of the return value are generated by either - * `Math.random` (fastest), - * `crypto.getRandomValues` (Web Cryptography API in recent browsers) - * or `crypto.randomBytes` (Node.js). - * - * If `CRYPTO` is `true`, i.e. one of the `crypto` methods is to be used, - * the value of a returned BigNumber should be cryptographically-secure and statistically indistinguishable from a random value. - */ - random(dp?: number): BigNumber; - - /** - * Rounds away from zero - */ - ROUND_UP: 0; - - /** - * Rounds towards zero - */ - ROUND_DOWN: 1; - - /** - * Rounds towards `Infinity` - */ - ROUND_CEIL: 2; - - /** - * Rounds towards `-Infinity` - */ - ROUND_FLOOR: 3; - - /** - * Rounds towards nearest neighbour. - * If equidistant, rounds away from zero. - */ - ROUND_HALF_UP: 4; - - /** - * Rounds towards nearest neighbour. - * If equidistant, rounds towards zero. - */ - ROUND_HALF_DOWN: 5; - - /** - * Rounds towards nearest neighbour. - * If equidistant, rounds towards even neighbour. - */ - ROUND_HALF_EVEN: 6; - - /** - * Rounds towards nearest neighbour. - * If equidistant, rounds towards `Infinity`. - */ - ROUND_HALF_CEIL: 7; - - /** - * Rounds towards nearest neighbour. - * If equidistant, rounds towards `-Infinity`. - */ - ROUND_HALF_FLOOR: 8; - - /** - * The remainder is always positive. - * - * Euclidian division: `q = sign(n) * floor(a / abs(n))` - */ - EUCLID: 9; - } - - interface BigNumber { - /** - * Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this BigNumber. - */ - absoluteValue(): BigNumber; - - /** - * Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this BigNumber. - */ - abs(): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in the direction of positive Infinity. - */ - ceil(): BigNumber; - - /** - * Returns - * - * `1` if the value of this BigNumber is greater than the value of `n` - * - * `-1` if the value of this BigNumber is less than the value of `n` - * - * `0` if this BigNumber and `n` have the same value - * - * `null` if the value of either this BigNumber or `n` is `NaN` - */ - comparedTo(n: NumberLike, base?: number): 1 | -1 | 0 | null; - - /** - * Returns - * - * `1` if the value of this BigNumber is greater than the value of `n` - * - * `-1` if the value of this BigNumber is less than the value of `n` - * - * `0` if this BigNumber and `n` have the same value - * - * `null` if the value of either this BigNumber or `n` is `NaN` - */ - cmp(n: NumberLike, base?: number): 1 | -1 | 0 | null; - - /** - * Return the number of decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is `±Infinity` or `NaN`. - */ - decimalPlaces(): number; - - /** - * Return the number of decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is `±Infinity` or `NaN`. - */ - dp(): number; - - /** - * Returns a BigNumber whose value is the value of this BigNumber divided by `n`, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration. - */ - dividedBy(n: NumberLike, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber divided by `n`, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration. - */ - div(n: NumberLike, base?: number): BigNumber; - - /** - * Return a BigNumber whose value is the integer part of dividing the value of this BigNumber by `n`. - */ - dividedToIntegerBy(n: NumberLike, base?: number): BigNumber; - - /** - * Return a BigNumber whose value is the integer part of dividing the value of this BigNumber by `n`. - */ - divToInt(n: NumberLike, base?: number): BigNumber; - - /** - * Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`. - * - * As with JavaScript, `NaN` does not equal `NaN`. - */ - equals(n: NumberLike, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`. - * - * As with JavaScript, `NaN` does not equal `NaN`. - */ - eq(n: NumberLike, base?: number): boolean; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in the direction of negative `Infinity`. - */ - floor(): BigNumber; - - /** - * Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise returns `false`. - */ - greaterThan(n: NumberLike, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise returns `false`. - */ - gt(n: NumberLike, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`, otherwise returns `false`. - */ - greaterThanOrEqualTo(n: NumberLike, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`, otherwise returns `false`. - */ - gte(n: NumberLike, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is a finite number, otherwise returns `false`. - * - * The only possible non-finite values of a BigNumber are `NaN`, `Infinity` and `-Infinity`. - */ - isFinite(): boolean; - - /** - * Returns `true` if the value of this BigNumber is a whole number, otherwise returns `false`. - */ - isInteger(): boolean; - - /** - * Returns `true` if the value of this BigNumber is a whole number, otherwise returns `false`. - */ - isInt(): boolean; - - /** - * Returns `true` if the value of this BigNumber is NaN, otherwise returns `false`. - */ - isNaN(): boolean; - - /** - * Returns `true` if the value of this BigNumber is negative, otherwise returns `false`. - */ - isNegative(): boolean; - - /** - * Returns `true` if the value of this BigNumber is negative, otherwise returns `false`. - */ - isNeg(): boolean; - - /** - * Returns `true` if the value of this BigNumber is zero or minus zero, otherwise returns `false`. - */ - isZero(): boolean; - - /** - * Returns `true` if the value of this BigNumber is less than the value of `n`, otherwise returns `false`. - */ - lessThan(n: NumberLike, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is less than the value of `n`, otherwise returns `false`. - */ - lt(n: NumberLike, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns - */ - lessThanOrEqualTo(n: NumberLike, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns - */ - lte(n: NumberLike, base?: number): boolean; - - /** - * Returns a BigNumber whose value is the value of this BigNumber minus `n`. - */ - minus(n: NumberLike, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber minus `n`. - */ - sub(n: NumberLike, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer remainder of dividing this BigNumber by `n`. - * - * The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor. - * If it is `1` (default value), the result will have the same sign as this BigNumber, - * and it will match that of Javascript's `%` operator (within the limits of double precision) and BigDecimal's `remainder` method. - */ - modulo(n: NumberLike, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer remainder of dividing this BigNumber by `n`. - * - * The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor. - * If it is `1` (default value), the result will have the same sign as this BigNumber, - * and it will match that of Javascript's `%` operator (within the limits of double precision) and BigDecimal's `remainder` method. - */ - mod(n: NumberLike, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by `-1`. - */ - negated(): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by `-1`. - */ - neg(): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber plus `n`. - */ - plus(n: NumberLike, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber plus `n`. - */ - add(n: NumberLike, base?: number): BigNumber; - - /** - * Returns the number of significant digits of the value of this BigNumber. - * - * If `z` is `true` or `1` then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not. - */ - precision(z?: boolean | 0 | 1): number; - - /** - * Returns the number of significant digits of the value of this BigNumber. - * - * If `z` is `true` or `1` then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not. - */ - sd(z?: boolean | 0 | 1): number; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode `rm` to a maximum of `dp` decimal places. - * - * If `dp` is omitted, or is `null` or `undefined`, the return value is `n` rounded to a whole number. - * - * If `rm` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used. - */ - round(dp?: number, rm?: RoundingMode): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber shifted `n` places. - * - * The shift is of the decimal point, i.e. of powers of ten, and is to the left if `n` is negative or to the right if `n` is positive. - */ - shift(n: number): BigNumber; - - /** - * Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration. - * - * The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding. - */ - squareRoot(): BigNumber; - - /** - * Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration. - * - * The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding. - */ - sqrt(): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber times `n`. - */ - times(n: NumberLike, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber times `n`. - */ - mul(n: NumberLike, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded to `sd` significant digits using rounding mode `rm`. - * - * If `sd` is omitted or is `null` or `undefined`, the return value will not be rounded. - * - * If `rm` is omitted or is `null` or `undefined`, ROUNDING_MODE will be used. - */ - toDigits(sd?: number, rm?: RoundingMode): BigNumber; - - /** - * Returns a string representing the value of this BigNumber in exponential notation rounded using rounding mode `rm` to `dp` decimal places, - * i.e with one digit before the decimal point and `dp` digits after it. - * - * If the value of this BigNumber in exponential notation has fewer than `dp` fraction digits, the return value will be appended with zeros accordingly. - * - * If `dp` is omitted, or is `null` or `undefined`, the number of digits after the decimal point defaults to the minimum number of digits necessary to represent the value exactly. - * - * If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. - */ - toExponential(dp?: number, rm?: RoundingMode): string; - - /** - * Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to `dp` decimal places using rounding mode `rm`. - * - * If the value of this BigNumber in normal notation has fewer than `dp` fraction digits, the return value will be appended with zeros accordingly. - * - * Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or equal to `10e21`, this method will always return normal notation. - * - * If `dp` is omitted or is `null` or `undefined`, the return value will be unrounded and in normal notation. - * This is also unlike `Number.prototype.toFixed`, which returns the value to zero decimal places. - * It is useful when fixed-point notation is required and the current `EXPONENTIAL_AT` setting causes `toString` to return exponential notation. - * - * If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. - */ - toFixed(dp?: number, rm?: RoundingMode): string; - - /** - * Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to `dp` decimal places using rounding mode `rm`, - * and formatted according to the properties of the `FORMAT` object. - * - * If `dp` is omitted or is `null` or `undefined`, then the return value is not rounded to a fixed number of decimal places. - * - * If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. - */ - toFormat(dp?: number, rm?: RoundingMode): string; - - /** - * Returns a string array representing the value of this BigNumber as a simple fraction with an integer numerator and an integer denominator. - * The denominator will be a positive non-zero value less than or equal to `max`. - * - * If a maximum denominator, `max`, is not specified, or is `null` or `undefined`, the denominator will be the lowest value necessary to represent the number exactly. - */ - toFraction(max?: NumberLike): [string, string]; - - /** - * As `valueOf`. - */ - toJSON(): string; - - /** - * Returns the value of this BigNumber as a JavaScript number primitive. - * - * Type coercion with, for example, the unary plus operator will also work, except that a BigNumber with the value minus zero will be converted to positive zero. - */ - toNumber(): number; - - /** - * Returns a BigNumber whose value is the value of this BigNumber raised to the power `n`, and optionally modulo a modulus `m`. - * - * If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration. - */ - toPower(n: number, m?: NumberLike): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber raised to the power `n`, and optionally modulo a modulus `m`. - * - * If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration. - */ - pow(n: number, m?: NumberLike): BigNumber; - - /** - * Returns a string representing the value of this BigNumber rounded to `sd` significant digits using rounding mode `rm`. - * - * If `sd` is less than the number of digits necessary to represent the integer part of the value in normal (fixed-point) notation, then exponential notation is used. - * - * If `sd` is omitted, or is `null` or `undefined`, then the return value is the same as `n.toString()`. - * - * If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. - */ - toPrecision(sd?: number, rm?: RoundingMode): string; - - /** - * Returns a string representing the value of this BigNumber in the specified base, or base `10` if `base` is omitted or is `null` or `undefined`. - */ - toString(base?: number): string; - - /** - * Returns a BigNumber whose value is the value of this BigNumber truncated to a whole number. - */ - truncated(): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber truncated to a whole number. - */ - trunc(): BigNumber; - - /** - * As `toString`, but does not accept a base argument and includes the minus sign for negative zero. - */ - valueOf(): string; - - /** - * coefficient - * @description Array of base 1e14 numbers - */ - c: number[] | null; - - /** - * exponent - * @description Integer, -1000000000 to 1000000000 inclusive - */ - e: number | null; - - /** - * sign - */ - s: -1 | 1 | null; - - /** - * type identifier - */ - isBigNumber: true; - } -} diff --git a/types/bignumber.js/tsconfig.json b/types/bignumber.js/tsconfig.json deleted file mode 100644 index 6355540e00..0000000000 --- a/types/bignumber.js/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "bignumber.js-tests.ts" - ] -} \ No newline at end of file diff --git a/types/bignumber.js/tslint.json b/types/bignumber.js/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/bignumber.js/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 99c807a857645bc28f9d344e0be2b49fab6d683a Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 10:38:59 -0800 Subject: [PATCH 298/890] uuidjs: Provides its own types (#22377) --- notNeededPackages.json | 6 +++ types/uuidjs/index.d.ts | 82 ------------------------------------ types/uuidjs/tsconfig.json | 24 ----------- types/uuidjs/tslint.json | 79 ---------------------------------- types/uuidjs/uuidjs-tests.ts | 48 --------------------- 5 files changed, 6 insertions(+), 233 deletions(-) delete mode 100644 types/uuidjs/index.d.ts delete mode 100644 types/uuidjs/tsconfig.json delete mode 100644 types/uuidjs/tslint.json delete mode 100644 types/uuidjs/uuidjs-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index 359204f8b1..86920ecb00 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1278,6 +1278,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/upper-case-first", "asOfVersion": "1.1.2" }, + { + "libraryName": "UUID.js", + "typingsPackageName": "uuidjs", + "sourceRepoURL": "https://github.com/LiosK/UUID.js", + "asOfVersion": "3.6.0" + }, { "libraryName": "Validate.js", "typingsPackageName": "validate.js", diff --git a/types/uuidjs/index.d.ts b/types/uuidjs/index.d.ts deleted file mode 100644 index 63f911fa16..0000000000 --- a/types/uuidjs/index.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -// Type definitions for UUID.js v3.3.0 -// Project: https://github.com/LiosK/UUID.js -// Definitions by: Jason Jarrett -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - -interface UUID { - intFields: UUIDArray; - bitFields: UUIDArray; - hexFields: UUIDArray; - version: number; - bitString: string; - hexString: string; - urn: string; - - - /** - * Tests if two {@link UUID} objects are equal. - * @param {UUID} uuid - * @returns {bool} True if two {@link UUID} objects are equal. - */ - equals(uuid: UUID): boolean; - - /** - * Returns UUID string representation. - * @returns {string} {@link UUID#hexString}. - */ - toString(): string; -} - -interface UUIDArray extends Array { - timeLow: string; - timeMid: string; - timeHiAndVersion: string; - clockSeqHiAndReserved: string; - clockSeqLow: string; - node: string; -} - -/** - * The simplest function to get an UUID string. - * @returns {string} A version 4 UUID string. - */ -export declare function generate(): string; - -/** - * Generates a version 4 {@link UUID}. - * @returns {UUID} A version 4 {@link UUID} object. - * @since 3.0 - */ -export declare function genV4(): UUID; - - -/** - * Generates a version 1 {@link UUID}. - * @returns {UUID} A version 1 {@link UUID} object. - * @since 3.0 - */ -export declare function genV1(): UUID; - -/** - * Converts hexadecimal UUID string to an {@link UUID} object. - * @param {string} uuid UUID hexadecimal string representation ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"). - * @returns {UUID} {@link UUID} object or null. - * @since 3.0 - */ -export declare function parse(uuid: string): UUID; - - -/** - * Re-initializes version 1 UUID state. - * @since 3.0 - */ -export declare function resetState(): void; - -/** - * Reinstalls {@link UUID.generate} method to emulate the interface of UUID.js version 2.x. - * @since 3.1 - * @deprecated Version 2.x. compatible interface is not recommended. - */ -export declare function makeBackwardCompatible(): void; diff --git a/types/uuidjs/tsconfig.json b/types/uuidjs/tsconfig.json deleted file mode 100644 index ee3725fc8f..0000000000 --- a/types/uuidjs/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "uuidjs-tests.ts" - ] -} \ No newline at end of file diff --git a/types/uuidjs/tslint.json b/types/uuidjs/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/uuidjs/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/uuidjs/uuidjs-tests.ts b/types/uuidjs/uuidjs-tests.ts deleted file mode 100644 index 51bed1c700..0000000000 --- a/types/uuidjs/uuidjs-tests.ts +++ /dev/null @@ -1,48 +0,0 @@ -import UUID = require("uuidjs"); - -const uuid1: string = UUID.generate() -const uuid2: UUID.UUID = UUID.genV4() -const uuid3: UUID.UUID = UUID.genV1() - -// Copied below from readme at https://github.com/LiosK/UUID.js - -// the simplest way to get an UUID (as a hexadecimal string) -console.log(UUID.generate()); // "0db9a5fa-f532-4736-89d6-8819c7f3ac7b" - -// create a version 4 (random-numbers-based) UUID object -var objV4 = UUID.genV4(); - -// create a version 1 (time-based) UUID object -var objV1 = UUID.genV1(); - -// create an UUID object from a hexadecimal string -var uuid = UUID.parse("a0e0f130-8c21-11df-92d9-95795a3bcd40"); - - -// UUID object as a string -console.log(uuid.toString()); // "a0e0f130-8c21-11df-92d9-95795a3bcd40" -console.log(uuid.hexString); // "a0e0f130-8c21-11df-92d9-95795a3bcd40" -console.log(uuid.bitString); // "101000001110000 ... 1100110101000000" -console.log(uuid.urn); // "urn:uuid:a0e0f130-8c21-11df-92d9-95795a3bcd40" - -// compare UUID objects -console.log(objV4.equals(objV1)); // false - -// show version numbers -console.log(objV4.version); // 4 -console.log(objV1.version); // 1 - -// get UUID field values in 3 different formats by 2 different accessors -console.log(uuid.intFields.timeLow); // 2699096368 -console.log(uuid.bitFields.timeMid); // "1000110000100001" -console.log(uuid.hexFields.timeHiAndVersion); // "11df" -console.log(uuid.intFields.clockSeqHiAndReserved); // 146 -console.log(uuid.bitFields.clockSeqLow); // "11011001" -console.log(uuid.hexFields.node); // "95795a3bcd40" - -console.log(uuid.intFields[0]); // 2699096368 -console.log(uuid.bitFields[1]); // "1000110000100001" -console.log(uuid.hexFields[2]); // "11df" -console.log(uuid.intFields[3]); // 146 -console.log(uuid.bitFields[4]); // "11011001" -console.log(uuid.hexFields[5]); // "95795a3bcd40" From 105784b2d9ff6393b4a38dda28d0388f7b3810d8 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 10:40:06 -0800 Subject: [PATCH 299/890] handsontable: Provides its own types (#22395) --- notNeededPackages.json | 6 + types/handsontable/index.d.ts | 616 ------------------------------ types/handsontable/test/global.ts | 327 ---------------- types/handsontable/test/module.ts | 329 ---------------- types/handsontable/tsconfig.json | 25 -- types/handsontable/tslint.json | 10 - 6 files changed, 6 insertions(+), 1307 deletions(-) delete mode 100644 types/handsontable/index.d.ts delete mode 100644 types/handsontable/test/global.ts delete mode 100644 types/handsontable/test/module.ts delete mode 100644 types/handsontable/tsconfig.json delete mode 100644 types/handsontable/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 86920ecb00..6c5bd58bd8 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -468,6 +468,12 @@ "sourceRepoURL": "https://github.com/ivogabe/gulp-typescript", "asOfVersion": "2.13.0" }, + { + "libraryName": "handsontable", + "typingsPackageName": "handsontable", + "sourceRepoURL": "https://handsontable.com/", + "asOfVersion": "0.35.0" + }, { "libraryName": "http-status-codes", "typingsPackageName": "http-status-codes", diff --git a/types/handsontable/index.d.ts b/types/handsontable/index.d.ts deleted file mode 100644 index 6d86a085f1..0000000000 --- a/types/handsontable/index.d.ts +++ /dev/null @@ -1,616 +0,0 @@ -// Type definitions for Handsontable 0.31 -// Project: https://handsontable.com/ -// Definitions by: Handsoncode sp. z o.o. -// Ryan Riley -// Andrew Stegmaier -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped\ - -declare namespace __Handsontable { - // The Core class is used inside the Handsontable namespace in the actual source code. - // However, there is a resolution issue when a class outside a namespace or module - // extends a class inside a module with the same name. That issue includes a work-around. - // Using the workaround found here: https://github.com/Microsoft/TypeScript/issues/3602 - - class Core { - constructor(element: Element, options: Handsontable.Options); - addHook(key: string, callback: Function|any[]): void; - addHookOnce(key: string, callback: Function|any[]): void; - alter(action: string, index: number, amount?: number, source?: string, keepEmptyRows?: boolean): void; - clear(): void; - colOffset(): number; - colToProp(col: number): string|number; - countCols(): number; - countEmptyCols(ending?: boolean): number; - countEmptyRows(ending?: boolean): number; - countRenderedCols(): number; - countRenderedRows(): number; - countRows(): number; - countSourceRows(): number; - countVisibleCols(): number; - countVisibleRows(): number; - deselectCell(): void; - destroy(): void; - destroyEditor(revertOriginal?: boolean): void; - getActiveEditor(): Object; - getCell(row: number, col: number, topmost?: boolean): Element; - getCellEditor(row: number, col: number): Object; - getCellMeta(row: number, col: number): Object; - getCellRenderer(row: number, col: number): Function; - getCellValidator(row: number, col: number): any; - getColHeader(col?: number): any[]|string; - getColWidth(col: number): number; - getCoords(elem: Element): Object; - getCopyableData(row: number, column: number): string; - getCopyableText(startRow: number, startCol: number, endRow: number, endCol: number): string; - getData(r?: number, c?: number, r2?: number, c2?: number): any[]; - getDataAtCell(row: number, col: number): any; - getDataAtCol(col: number): any[]; - getDataAtProp(prop: string|number): any[]; - getDataAtRow(row: number): any[]; - getDataAtRowProp(row: number, prop: string): any; - getDataType(rowFrom: number, columnFrom: number, rowTo: number, columnTo: number): string; - getInstance(): any; - getPlugin(pluginName: string): any; - getRowHeader(row?: number): any[]|string; - getRowHeight(row: number): number; - getSchema(): Object; - getSelected(): any[]; - getSelectedRange(): Handsontable.Range; - getSettings(): Handsontable.Options; - getSourceData(r?: number, c?: number, r2?: number, c2?: number): any[]; - getSourceDataAtCell(row: number, column: number): any; - getSourceDataAtCol(column: number): any[]; - getSourceDataAtRow(row: number): any[]|Object; - getValue(): any; - hasColHeaders(): boolean; - hasHook(key: string): boolean; - hasRowHeaders(): boolean; - isEmptyCol(col: number): boolean; - isEmptyRow(row: number): boolean; - isListening(): boolean; - listen(): void; - loadData(data: any[]): void; - populateFromArray(row: number, col: number, input: any[], endRow?: number, endCol?: number, source?: string, method?: string, direction?: string, deltas?: any[]): any; - propToCol(prop: string | number): number; - removeCellMeta(row: number, col: number, key: string): void; - removeHook(key: string, callback: Function): void; - render(): void; - rowOffset(): number; - runHooks(key: string, p1?: any, p2?: any, p3?: any, p4?: any, p5?: any, p6?: any): any; - selectCell(row: number, col: number, endRow?: number, endCol?: number, scrollToCell?: boolean, changeListener?: boolean): boolean; - selectCellByProp(row: number, prop: string, endRow?: number, endProp?: string, scrollToCell?: boolean): boolean; - setCellMeta(row: number, col: number, key: string, val: string): void; - setCellMetaObject(row: number, col: number, prop: Object): void; - setDataAtCell(row: number, col: number, value: string, source?: string): void; - setDataAtCell(changes: Array<[number, number, any]>): void; - setDataAtRowProp(row: number|any[], prop: string, value: string, source?: string): void; - spliceCol(col: number, index: number, amount: number, elements?: any): void; - spliceRow(row: number, index: number, amount: number, elements?: any): void; - toPhysicalRow(row: number): number; - toPhysicalColumn(column: number): number; - toVisualRow(row: number): number; - toVisualColumn(column: number): number; - unlisten(): void; - updateSettings(settings: Object, init?: boolean): void; - validateCells(callback: Function): void; - } -} - -declare namespace Handsontable { - interface Options { - allowEmpty?: boolean; - allowInsertColumn?: boolean; - allowInsertRow?: boolean; - allowInvalid?: boolean; - allowRemoveColumn?: boolean; - allowRemoveRow?: boolean; - autoColumnSize?: Object|boolean; - autoComplete?: any[]; - autoRowSize?: Object|boolean; - autoWrapCol?: boolean; - autoWrapRow?: boolean; - bindRowsWithHeaders?: boolean|string; - cell?: any[]; - cells?: Function; - checkedTemplate?: boolean|string; - className?: string|any[]; - colHeaders?: boolean|any[]|Function; - collapsibleColumns?: boolean|any[]; - columnHeaderHeight?: number|any[]; - columns?: any[]; - columnSorting?: boolean|Object; - columnSummary?: Object; - colWidths?: any[]|Function|number|string; - commentedCellClassName?: string; - comments?: boolean|any[]; - contextMenu?: boolean|any[]|Object; - contextMenuCopyPaste?: Object; - copyable?: boolean; - copyColsLimit?: number; - copyPaste?: boolean; - copyRowsLimit?: number; - correctFormat?: boolean; - currentColClassName?: string; - currentRowClassName?: string; - customBorders?: boolean|any[]; - data?: any[]|Function; - dataSchema?: Object; - dateFormat?: string; - debug?: boolean; - defaultDate?: string; - disableVisualSelection?: boolean|string|any[]; - dropdownMenu?: boolean|Object|any[]; - editor?: string|Function|boolean; - enterBeginsEditing?: boolean; - enterMoves?: Object|Function; - fillHandle?: boolean|string|Object; - filter?: boolean; - filteringCaseSensitive?: boolean; - filters?: boolean; - fixedColumnsLeft?: number; - fixedRowsBottom?: number; - fixedRowsTop?: number; - format?: string; - fragmentSelection?: boolean|string; - ganttChart?: Object; - headerTooltips?: boolean|Object; - height?: number|Function; - hiddenColumns?: boolean|Object; - hiddenRows?: boolean|Object; - invalidCellClassName?: string; - label?: Object; - language?: string; - manualColumnFreeze?: boolean; - manualColumnMove?: boolean|any[]; - manualColumnResize?: boolean|any[]; - manualRowMove?: boolean|any[]; - manualRowResize?: boolean|any[]; - maxCols?: number; - maxRows?: number; - mergeCells?: boolean|any[]; - minCols?: number; - minRows?: number; - minSpareCols?: number; - minSpareRows?: number; - multiSelect?: boolean; - nestedHeaders?: any[]; - noWordWrapClassName?: string; - observeChanges?: boolean; - observeDOMVisibility?: boolean; - outsideClickDeselects?: boolean; - pasteMode?: string; - persistentState?: boolean; - placeholder?: any; - placeholderCellClassName?: string; - preventOverflow?: string|boolean; - readOnly?: boolean; - readOnlyCellClassName?: string; - renderAllRows?: boolean; - renderer?: string|Function; - rowHeaders?: boolean|any[]|Function; - rowHeaderWidth?: number|any[]; - rowHeights?: any[]|Function|number|string; - search?: boolean; - selectOptions?: any[]; - skipColumnOnPaste?: boolean; - sortByRelevance?: boolean; - sortFunction?: Function; - sortIndicator?: boolean; - source?: any[]|Function; - startCols?: number; - startRows?: number; - stretchH?: string; - strict?: boolean; - tableClassName?: string|any[]; - tabMoves?: Object; - title?: string; - trimDropdown?: boolean; - trimWhitespace?: boolean; - type?: string; - uncheckedTemplate?: boolean|string; - undo?: boolean; - validator?: Function|RegExp; - viewportColumnRenderingOffset?: number|string; - viewportRowRenderingOffset?: number|string; - visibleRows?: number; - width?: number|Function; - wordWrap?: boolean; - isEmptyCol?(col: number): boolean; - isEmptyRow?(row: number): boolean; - - // hooks - afterAutofillApplyValues?(startArea: any[], entireArea: any[]): void; - afterCellMetaReset?(): void; - afterChange?(changes: Array<[number, number|string, any, any]>, source?: string): void; - afterChangesObserved?(): void; - afterColumnMove?(startColumn: number, endColumn: number): void; - afterColumnResize?(currentColumn: number, newSize: number, isDoubleClick: boolean): void; - afterColumnSort?(column: number, order: boolean): void; - afterContextMenuDefaultOptions?(predefinedItems: any[]): void; - afterContextMenuHide?(context: Object): void; - afterContextMenuShow?(context: Object): void; - afterCopyLimit?(selectedRows: number, selectedColumnds: number, copyRowsLimit: number, copyColumnsLimit: number): void; - afterCreateCol?(index: number, amount: number): void; - afterCreateRow?(index: number, amount: number): void; - afterDeselect?(): void; - afterDestroy?(): void; - afterDocumentKeyDown?(event: Event): void; - afterFilter?(formulasStack: any[]): void; - afterGetCellMeta?(row: number, col: number, cellProperties: Object): void; - afterGetColHeader?(col: number, TH: Element): void; - afterGetColumnHeaderRenderers?(array: any[]): void; - afterGetRowHeader?(row: number, TH: Element): void; - afterGetRowHeaderRenderers?(array: any[]): void; - afterInit?(): void; - afterLoadData?(firstTime: boolean): void; - afterMomentumScroll?(): void; - afterOnCellCornerDblClick?(event: Object): void; - afterOnCellCornerMouseDown?(event: Object): void; - afterOnCellMouseDown?(event: Object, coords: Object, TD: Element): void; - afterOnCellMouseOver?(event: Object, coords: Object, TD: Element): void; - afterRemoveCol?(index: number, amount: number): void; - afterRemoveRow?(index: number, amount: number): void; - afterRender?(isForced: boolean): void; - afterRenderer?(TD: Element, row: number, col: number, prop: string|number, value: string, cellProperties: Object): void; - afterRowMove?(startRow: number, endRow: number): void; - afterRowResize?(currentRow: number, newSize: number, isDoubleClick: boolean): void; - afterScrollHorizontally?(): void; - afterScrollVertically?(): void; - afterSelection?(r: number, c: number, r2: number, c2: number): void; - afterSelectionByProp?(r: number, p: string, r2: number, p2: string): void; - afterSelectionEnd?(r: number, c: number, r2: number, c2: number): void; - afterSelectionEndByProp?(r: number, p: string, r2: number, p2: string): void; - afterSetCellMeta?(row: number, col: number, key: string, value: any): void; - afterUpdateSettings?(): void; - afterValidate?(isValid: boolean, value: any, row: number, prop: string|number, source: string): void|boolean; - beforeAutofill?(start: Object, end: Object, data: any[]): void; - beforeCellAlignment?(stateBefore: any, range: any, type: string, alignmentClass: string): void; - beforeChange?(changes: any[], source: string): void; - beforeChangeRender?(changes: any[], source: string): void; - beforeColumnMove?(startColumn: number, endColumn: number): void; - beforeColumnResize?(currentColumn: number, newSize: number, isDoubleClick: boolean): void; - beforeColumnSort?(column: number, order: boolean): void; - beforeDrawBorders?(corners: any[], borderClassName: string): void; - beforeFilter?(formulasStack: any[]): void; - beforeGetCellMeta?(row: number, col: number, cellProperties: Object): void; - beforeInit?(): void; - beforeInitWalkontable?(walkontableConfig: Object): void; - beforeKeyDown?(event: Event): void; - beforeOnCellMouseDown?(event: Event, coords: Object, TD: Element): void; - beforeRemoveCol?(index: number, amount: number, logicalCols?: any[]): void; - beforeRemoveRow?(index: number, amount: number, logicalRows?: any[]): void; - beforeRender?(isForced: boolean): void; - beforeRenderer?(TD: Element, row: number, col: number, prop: string|number, value: string, cellProperties: Object): void; - beforeRowMove?(startRow: number, endRow: number): void; - beforeRowResize?(currentRow: number, newSize: number, isDoubleClick: boolean): any; - beforeSetRangeEnd?(coords: any[]): void; - beforeStretchingColumnWidth?(stretchedWidth: number, column: number): void; - beforeTouchScroll?(): void; - beforeValidate?(value: any, row: number, prop: string|number, source: string): void; - construct?(): void; - init?(): void; - modifyCol?(col: number): void; - modifyColHeader?(column: number): void; - modifyColWidth?(width: number, col: number): void; - modifyCopyableRange?(copyableRanges: any[]): void; - modifyRow?(row: number): void; - modifyRowHeader?(row: number): void; - modifyRowHeight?(height: number, row: number): void; - persistentStateLoad?(key: string, valuePlaceholder: Object): void; - persistentStateReset?(key: string): void; - persistentStateSave?(key: string, value: any): void; - unmodifyCol?(col: number): void; - } - - class Core extends __Handsontable.Core { - } - - interface Selection { - start: CellPosition; - end: CellPosition; - } - - interface Range { - from: CellPosition; - to: CellPosition; - } - - interface HandsontableRegisterer { - getInstance(id: string): Core; - registerInstance(id: string, instance: Core): void; - removeInstance(id: string): void; - } - - interface ColumnProperties extends CellProperties { - data?: string | number; - title?: string; - editor?: string | EditorConstructor; - selectOptions?: any[]; - width?: number; - } - - interface CellProperties { - renderer?: CellRenderer; - type?: string; - readOnly?: boolean; - language?: string; - format?: string; - validator?: Validator; - allowInvalid?: boolean; - className?: string; - } - - interface CellPosition { - row: number; - col: number; - } - - // so that you can write custom plugins in typescript - interface BasePlugin { - init(): void; - enablePlugin(): void; - disablePlugin(): void; - addHook(name: string, callback: Function): void; - removeHooks(name: string): void; - clearHooks(): void; - callOnPluginsReady(callback: Function): void; - updatePlugin(): void; - destroy(): void; - enabled: boolean; - hot: Core; - } - - interface PluginConstructor { - new (hotInstance: Core): BasePlugin; - } - - interface ContextMenuPluginConstructor extends PluginConstructor { - SEPARATOR: string; - } - - interface Plugins { - AutoColumnSize: PluginConstructor; - AutoRowSizeAutoRowSize: PluginConstructor; - BasePlugin: PluginConstructor; - BindRowsWithHeaders: PluginConstructor; - CollapsibleColumns: PluginConstructor; - ColumnSorting: PluginConstructor; - ColumnSummary: PluginConstructor; - Comments: PluginConstructor; - ContextMenu: ContextMenuPluginConstructor; - ContextMenuCopyPaste: PluginConstructor; - DragToScroll: PluginConstructor; - DropdownMenu: PluginConstructor; - ExportFile: PluginConstructor; - Filters: PluginConstructor; - Formulas: PluginConstructor; - GanttChart: PluginConstructor; - HeaderTooltips: PluginConstructor; - HiddenColumns: PluginConstructor; - HiddenRows: PluginConstructor; - ManualColumnFreeze: PluginConstructor; - ManualColumnMove: PluginConstructor; - ManualColumnResize: PluginConstructor; - ManualRowMove: PluginConstructor; - ManualRowResize: PluginConstructor; - MultipleSelectionHandles: PluginConstructor; - NestedHeaders: PluginConstructor; - NestedRows: PluginConstructor; - ObserveChanges: PluginConstructor; - TouchScroll: PluginConstructor; - TrimRows: PluginConstructor; - registerPlugin(pluginName: string, PluginClass: PluginConstructor): void; - } - - interface Hooks { - /** - * Adds a listener (globally or locally) to a specified hook name. - * - * @param key Hook name. - * @param callback Callback function or an array of functions. - * @param context (optional) The context for the hook callback to be added - a Handsontable instance or leave empty. - */ - add(key: string, callback: ((...params: any[]) => any | void) | Array<(...params: any[]) => any | void>, context?: Handsontable): Object; - - /** - * Returns a new object with empty handlers related to every registered hook name. - */ - createEmptyBucket(): Object; - - /** - * Deregisters a hook name (removes it from the list of known hook names). - * - * @param key Hook name. - */ - deregister(key: string): void; - - /** - * Destroy all listeners connected to the context. If no context is provided, the global listeners will be destroyed. - * - * @param context (optional) A Handsontable instance. - */ - destroy(context?: Handsontable): void; - - /** - * Get hook bucket based on the context of the object or if argument is undefined, get the global hook bucket. - * - * @param context (optional) A Handsontable instance. - */ - getBucket(context?: Handsontable): Object; - - /** - * Returns an array of registered hooks. - */ - getRegistered(): string[]; - - /** - * Checks whether there are any registered listeners for the provided hook name. - * - * @param key Hook name. - * @param context (optional) A Handsontable instance. - */ - has(key: string, context?: Handsontable): boolean; - - /** - * Returns a boolean depending on if a hook by such name has been registered. - * - * @param key Hook name. - */ - isRegistered(key: string): boolean; - - /** - * Adds a listener to a specified hook. After the hook runs this listener will be automatically removed from the bucket. - * - * @param key Hook/Event name. - * @param callback Callback function. - * @param context (optional) A Handsontable instance. - */ - once(key: string, callback: ((...params: any[]) => any | void) | Array<(...params: any[]) => any | void>, context?: Handsontable): void; - - /** - * Registers a hook name (adds it to the list of the known hook names). Used by plugins. - * - * @param key The hook name. - */ - register(key: string): void; - - /** - * Removes a listener from a hook with a given name. - * - * @param key Hook/Event name. - * @param callback Callback function. - * @param context (optional) A Handsontable instance. - */ - remove(key: string, callback: (...params: any[]) => any | void, context?: Handsontable): boolean; - - /** - * Runs all local and global callbacks assigned to the hook identified by the key parameter. - * It returns either a return value from the last called callback or the first parameter (p1) passed to the run function. - * - * @param context Handsontable instance. - * @param key Hook/Event name. - * @param p1 (optional) Parameter to be passed as an argument to the callback function. - * @param p2 (optional) Parameter to be passed as an argument to the callback function. - * @param p3 (optional) Parameter to be passed as an argument to the callback function. - * @param p4 (optional) Parameter to be passed as an argument to the callback function. - * @param p5 (optional) Parameter to be passed as an argument to the callback function. - * @param p6 (optional) Parameter to be passed as an argument to the callback function. - */ - run(context: Handsontable, key: string, p1?: any, p2?: any, p3?: any, p4?: any, p5?: any, p6?: any): any; - } - - interface Dom { - addEvent(element: HTMLElement, eventName: string, callback: Function): void; - addClass(element: HTMLElement, className: string | string[]): void; - removeClass(element: HTMLElement, className: string | string[]): void; - offset(element: HTMLElement): any; - getWindowScrollLeft(): number; - getWindowScrollTop(): number; - outerHeight(element: HTMLElement): number; - hasClass(element: HTMLElement, className: string): boolean | undefined; - empty(element: HTMLElement): void; - } - - interface ArrayMapper { - clearMap(): void; - getIndexByValue(value: any): number; - getValueByIndex(index: number): any; - insertItems(index: number, amount?: number): number[]; - removeItems(index: number | number[], amount?: number): number[]; - unshiftItems(index: number | number[], amount?: number): void; - shiftItems(index: number, amount?: number): void; - } - - interface Utils { - arrayMapper: ArrayMapper; - } - - interface Helper { - arrayFilter(array: any[], predicate: Function): any[]; - arrayEach(array: any[], predicate: Function): void; - arrayMap(array: any[], predicate: Function): any[]; - arrayReduce(array: any[], predicate: Function, initialValue?: any): any; - objectEach(obj: any, predicate: Function): void; - rangeEach(rangeFrom: number, rangeTo: number | Function, iteratee?: Function): void; - mixin(Base: any, ...mixins: any[]): void; - isNumeric(number: any): boolean; - createSpreadsheetData(rows: number, columns: number): any; - } - - type CellRenderer = ( - instance: Core, - td: HTMLTableCellElement, - row: number, - col: number, - prop: string, - value: any, - cellProperties: any) => void; - - interface Editor { - open(): void; - } - - interface EditorConstructor { - new (instance: Core): Editor; - } - - interface Editors { - TextEditor: EditorConstructor; - } - - type Validator = (value: any, callback: (condition: boolean) => void) => void; - - interface Renderers { - TextRenderer: CellRenderer; - NumericRenderer: CellRenderer; - AutocompleteRenderer: CellRenderer; - } - - type AsyncAutocompleteSourceFunction = (query: string, process: (values: any[]) => void) => void; - - interface AutocompleteColumn extends ColumnProperties { - source?: any[] | AsyncAutocompleteSourceFunction; - strict?: boolean; - trimDropdown?: boolean; - } - - interface DateColumn extends ColumnProperties { - dateFormat?: string; - correctFormat?: boolean; - } - - interface NumericColumn extends ColumnProperties { - format?: string; - language?: string; - } - - interface CheckboxColumnLabel { - position?: 'before' | 'after'; - property?: string; - value: string; - } - - interface CheckboxColumn extends ColumnProperties { - checkedTemplate?: any; - uncheckedTemplate?: any; - label?: CheckboxColumnLabel; - } - - type CellMetaFunction = (row: number, column: number, prop: string) => void; - - type DropdownColumn = AutocompleteColumn; -} - -declare class Handsontable extends __Handsontable.Core { - static plugins: Handsontable.Plugins; - static hooks: Handsontable.Hooks; - static Dom: Handsontable.Dom; - static dom: Handsontable.Dom; - static helper: Handsontable.Helper; - static utils: Handsontable.Utils; - static renderers: Handsontable.Renderers; - static editors: Handsontable.Editors; -} - -export = Handsontable; -export as namespace Handsontable; diff --git a/types/handsontable/test/global.ts b/types/handsontable/test/global.ts deleted file mode 100644 index 3760fb1f95..0000000000 --- a/types/handsontable/test/global.ts +++ /dev/null @@ -1,327 +0,0 @@ -function test_HandsontableInit() { - const elem = document.createElement('div'); - const hot = new Handsontable(elem, { - allowEmpty: true, - allowInsertColumn: true, - allowInsertRow: true, - allowInvalid: true, - allowRemoveColumn: true, - allowRemoveRow: true, - autoColumnSize: true, - autoComplete: [], - autoRowSize: true, - autoWrapCol: true, - autoWrapRow: true, - bindRowsWithHeaders: 'foo', - cell: [], - cells: () => { return; }, - checkedTemplate: true, - className: [], - colHeaders: true, - collapsibleColumns: true, - columnHeaderHeight: 123, - columns: [], - columnSorting: {}, - columnSummary: {}, - colWidths: 123, - commentedCellClassName: 'foo', - comments: [], - contextMenu: true, - contextMenuCopyPaste: {}, - copyable: true, - copyColsLimit: 123, - copyPaste: true, - copyRowsLimit: 123, - correctFormat: true, - currentColClassName: 'foo', - currentRowClassName: 'foo', - customBorders: true, - data: [], - dataSchema: {}, - dateFormat: 'foo', - debug: true, - defaultDate: 'foo', - disableVisualSelection: true, - dropdownMenu: [], - editor: true, - enterBeginsEditing: true, - enterMoves: {}, - fillHandle: true, - filter: true, - filteringCaseSensitive: true, - filters: false, - fixedColumnsLeft: 123, - fixedRowsBottom: 123, - fixedRowsTop: 123, - format: 'foo', - fragmentSelection: true, - ganttChart: {}, - headerTooltips: true, - height: 123, - hiddenColumns: true, - hiddenRows: {}, - invalidCellClassName: 'foo', - label: {}, - language: 'foo', - manualColumnFreeze: true, - manualColumnMove: true, - manualColumnResize: true, - manualRowMove: true, - manualRowResize: true, - maxCols: 123, - maxRows: 123, - mergeCells: true, - minCols: 123, - minRows: 123, - minSpareCols: 123, - minSpareRows: 123, - multiSelect: true, - nestedHeaders: [], - noWordWrapClassName: 'foo', - observeChanges: true, - observeDOMVisibility: true, - outsideClickDeselects: true, - pasteMode: 'foo', - persistentState: true, - placeholder: 123, - placeholderCellClassName: 'foo', - preventOverflow: true, - readOnly: true, - readOnlyCellClassName: 'foo', - renderAllRows: true, - renderer: 'foo', - rowHeaders: true, - rowHeaderWidth: 123, - rowHeights: 123, - search: true, - selectOptions: [], - skipColumnOnPaste: true, - sortByRelevance: true, - sortFunction: () => { return; }, - sortIndicator: true, - source: [], - startCols: 123, - startRows: 123, - stretchH: 'foo', - strict: true, - tableClassName: 'foo', - tabMoves: {}, - title: 'foo', - trimDropdown: true, - trimWhitespace: true, - type: 'foo', - uncheckedTemplate: true, - undo: true, - validator: () => {return; }, - viewportColumnRenderingOffset: 123, - viewportRowRenderingOffset: 123, - visibleRows: 123, - width: 1232, - wordWrap: true, - - // Hooks - afterAutofillApplyValues: () => {return; }, - afterCellMetaReset: () => {return; }, - afterChange: (changes) => {return; }, - afterChangesObserved: () => {return; }, - afterColumnMove: () => {return; }, - afterColumnResize: () => {return; }, - afterColumnSort: () => {return; }, - afterContextMenuDefaultOptions: () => {return; }, - afterContextMenuHide: () => {return; }, - afterContextMenuShow: () => {return; }, - afterCopyLimit: () => {return; }, - afterCreateCol: () => {return; }, - afterCreateRow: () => {return; }, - afterDeselect: () => {return; }, - afterDestroy: () => {return; }, - afterDocumentKeyDown: () => {return; }, - afterFilter: () => {return; }, - afterGetCellMeta: () => {return; }, - afterGetColHeader: () => {return; }, - afterGetColumnHeaderRenderers: () => {return; }, - afterGetRowHeader: () => {return; }, - afterGetRowHeaderRenderers: () => {return; }, - afterInit: () => {return; }, - afterLoadData: () => {return; }, - afterMomentumScroll: () => {return; }, - afterOnCellCornerDblClick: () => {return; }, - afterOnCellCornerMouseDown: () => {return; }, - afterOnCellMouseDown: () => {return; }, - afterOnCellMouseOver: () => {return; }, - afterRemoveCol: () => {return; }, - afterRemoveRow: () => {return; }, - afterRender: () => {return; }, - afterRenderer: () => {return; }, - afterRowMove: () => {return; }, - afterRowResize: () => {return; }, - afterScrollHorizontally: () => {return; }, - afterScrollVertically: () => {return; }, - afterSelection: () => {return; }, - afterSelectionByProp: () => {return; }, - afterSelectionEnd: () => {return; }, - afterSelectionEndByProp: () => {return; }, - afterSetCellMeta: () => {return; }, - afterUpdateSettings: () => {return; }, - afterValidate: () => {return; }, - beforeAutofill: () => {return; }, - beforeCellAlignment: () => {return; }, - beforeChange: () => {return; }, - beforeChangeRender: () => {return; }, - beforeColumnMove: () => {return; }, - beforeColumnResize: () => {return; }, - beforeColumnSort: () => {return; }, - beforeDrawBorders: () => {return; }, - beforeFilter: () => {return; }, - beforeGetCellMeta: () => {return; }, - beforeInit: () => {return; }, - beforeInitWalkontable: () => {return; }, - beforeKeyDown: () => {return; }, - beforeOnCellMouseDown: () => {return; }, - beforeRemoveCol: () => {return; }, - beforeRemoveRow: () => {return; }, - beforeRender: () => {return; }, - beforeRenderer: () => {return; }, - beforeRowMove: () => {return; }, - beforeRowResize: () => {return; }, - beforeSetRangeEnd: () => {return; }, - beforeStretchingColumnWidth: () => {return; }, - beforeTouchScroll: () => {return; }, - beforeValidate: () => {return; }, - construct: () => {return; }, - init: () => {return; }, - modifyCol: () => {return; }, - modifyColHeader: () => {return; }, - modifyColWidth: () => {return; }, - modifyCopyableRange: () => {return; }, - modifyRow: () => {return; }, - modifyRowHeader: () => {return; }, - modifyRowHeight: () => {return; }, - persistentStateLoad: () => {return; }, - persistentStateReset: () => {return; }, - persistentStateSave: () => {return; }, - unmodifyCol: () => {return; } - }); -} - -function test_HandsontableMethods() { - const elem = document.createElement('div'); - const hot = new Handsontable(elem, {}); - hot.addHook('foo', []); - hot.addHookOnce('foo', []); - hot.alter('foo', 123, 123, 'foo', true); - hot.clear(); - hot.colOffset(); - hot.colToProp(123); - hot.countCols(); - hot.countEmptyCols(true); - hot.countEmptyRows(true); - hot.countRenderedCols(); - hot.countRenderedRows(); - hot.countRows(); - hot.countSourceRows(); - hot.countVisibleCols(); - hot.countVisibleRows(); - hot.deselectCell(); - hot.destroy(); - hot.destroyEditor(true); - hot.getActiveEditor(); - hot.getCell(123, 123, true); - hot.getCellEditor(123, 123); - hot.getCellMeta(123, 123); - hot.getCellRenderer(123, 123); - hot.getCellValidator(123, 123); - hot.getColHeader(123); - hot.getColWidth(123); - hot.getCoords(elem.querySelector('td')); - hot.getCopyableData(123, 123); - hot.getCopyableText(123, 123, 123, 123); - hot.getData(123, 123, 123, 123); - hot.getDataAtCell(123, 123); - hot.getDataAtCol(123); - hot.getDataAtProp(123); - hot.getDataAtRow(123); - hot.getDataAtRowProp(123, 'foo'); - hot.getDataType(123, 123, 123, 123); - hot.getInstance(); - hot.getPlugin('foo'); - hot.getRowHeader(123); - hot.getRowHeight(123); - hot.getSchema(); - hot.getSelected(); - const range: Handsontable.Range = hot.getSelectedRange(); - hot.getSettings(); - hot.getSourceData(123, 123, 123, 123); - hot.getSourceDataAtCell(123, 123); - hot.getSourceDataAtCol(123); - hot.getSourceDataAtRow(123); - hot.getValue(); - hot.hasColHeaders(); - hot.hasHook('foo'); - hot.hasRowHeaders(); - hot.isEmptyCol(123); - hot.isEmptyRow(123); - hot.isListening(); - hot.listen(); - hot.loadData([]); - hot.populateFromArray(123, 123, [], 123, 123, 'foo', 'foo', 'foo', []); - hot.propToCol('foo'); - hot.propToCol(123); - hot.removeCellMeta(123, 123, 'foo'); - hot.removeHook('foo', () => {return; }); - hot.render(); - hot.rowOffset(); - hot.runHooks('foo', 123, 'foo', true, {}, [], () => {return; }); - hot.selectCell(123, 123, 123, 123, true, true); - hot.selectCellByProp(123, 'foo', 123, 'foo', true); - hot.setCellMeta(123, 123, 'foo', 'foo'); - hot.setCellMetaObject(123, 123, {}); - hot.setDataAtCell(123, 123, 'foo', 'foo'); - hot.setDataAtCell([[123, 123, 'foo'], [123, 123, 'foo']]); - hot.setDataAtRowProp(123, 'foo', 'foo', 'foo'); - hot.spliceCol(123, 123, 123, 'foo'); - hot.spliceRow(123, 123, 123, 'foo'); - hot.toPhysicalRow(123); - hot.toPhysicalColumn(123); - hot.toVisualRow(123); - hot.toVisualColumn(123); - hot.unlisten(); - hot.updateSettings({}, true); - hot.validateCells(() => {return; }); - - Handsontable.renderers.NumericRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {}); - Handsontable.renderers.TextRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {}); - Handsontable.Dom.addEvent(new HTMLElement(), "eventName", () => { return; }); - Handsontable.Dom.empty(new HTMLElement()); - - let bucket: {}; - let registeredHooks: string[]; - let hasHook: boolean; - let isRegistered: boolean; - bucket = Handsontable.hooks.add('beforeInit', () => { return; }); - bucket = Handsontable.hooks.add('beforeInit', () => { return; }, hot); - Handsontable.hooks.createEmptyBucket(); - Handsontable.hooks.deregister('myHook'); - Handsontable.hooks.destroy(); - Handsontable.hooks.destroy(hot); - bucket = Handsontable.hooks.getBucket(); - bucket = Handsontable.hooks.getBucket(hot); - registeredHooks = Handsontable.hooks.getRegistered(); - hasHook = Handsontable.hooks.has("myHook"); - hasHook = Handsontable.hooks.has("myHook", hot); - isRegistered = Handsontable.hooks.isRegistered("myHook"); - Handsontable.hooks.once('beforeInit', () => { return; }); - Handsontable.hooks.once('beforeInit', [() => { return; }, () => { return; }]); - Handsontable.hooks.once('beforeInit', () => { return; }, hot); - Handsontable.hooks.register('myHook'); - Handsontable.hooks.remove('beforeInit', () => { return; }); - Handsontable.hooks.remove('beforeInit', () => { return; }, hot); - Handsontable.hooks.run(hot, 'beforeInit'); - Handsontable.hooks.run(hot, 'beforeInit', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6'); - } - -class MyCustomHotPlugin extends Handsontable.plugins.BasePlugin { - isEnabled(): boolean { - return !!this.hot.getSettings().manualRowMove; - } -} diff --git a/types/handsontable/test/module.ts b/types/handsontable/test/module.ts deleted file mode 100644 index 0bdffed3f5..0000000000 --- a/types/handsontable/test/module.ts +++ /dev/null @@ -1,329 +0,0 @@ -import Handsontable = require("handsontable"); - -function test_HandsontableInit() { - const elem = document.createElement('div'); - const hot = new Handsontable(elem, { - allowEmpty: true, - allowInsertColumn: true, - allowInsertRow: true, - allowInvalid: true, - allowRemoveColumn: true, - allowRemoveRow: true, - autoColumnSize: true, - autoComplete: [], - autoRowSize: true, - autoWrapCol: true, - autoWrapRow: true, - bindRowsWithHeaders: 'foo', - cell: [], - cells: () => { return; }, - checkedTemplate: true, - className: [], - colHeaders: true, - collapsibleColumns: true, - columnHeaderHeight: 123, - columns: [], - columnSorting: {}, - columnSummary: {}, - colWidths: 123, - commentedCellClassName: 'foo', - comments: [], - contextMenu: true, - contextMenuCopyPaste: {}, - copyable: true, - copyColsLimit: 123, - copyPaste: true, - copyRowsLimit: 123, - correctFormat: true, - currentColClassName: 'foo', - currentRowClassName: 'foo', - customBorders: true, - data: [], - dataSchema: {}, - dateFormat: 'foo', - debug: true, - defaultDate: 'foo', - disableVisualSelection: true, - dropdownMenu: [], - editor: true, - enterBeginsEditing: true, - enterMoves: {}, - fillHandle: true, - filter: true, - filteringCaseSensitive: true, - filters: false, - fixedColumnsLeft: 123, - fixedRowsBottom: 123, - fixedRowsTop: 123, - format: 'foo', - fragmentSelection: true, - ganttChart: {}, - headerTooltips: true, - height: 123, - hiddenColumns: true, - hiddenRows: {}, - invalidCellClassName: 'foo', - label: {}, - language: 'foo', - manualColumnFreeze: true, - manualColumnMove: true, - manualColumnResize: true, - manualRowMove: true, - manualRowResize: true, - maxCols: 123, - maxRows: 123, - mergeCells: true, - minCols: 123, - minRows: 123, - minSpareCols: 123, - minSpareRows: 123, - multiSelect: true, - nestedHeaders: [], - noWordWrapClassName: 'foo', - observeChanges: true, - observeDOMVisibility: true, - outsideClickDeselects: true, - pasteMode: 'foo', - persistentState: true, - placeholder: 123, - placeholderCellClassName: 'foo', - preventOverflow: true, - readOnly: true, - readOnlyCellClassName: 'foo', - renderAllRows: true, - renderer: 'foo', - rowHeaders: true, - rowHeaderWidth: 123, - rowHeights: 123, - search: true, - selectOptions: [], - skipColumnOnPaste: true, - sortByRelevance: true, - sortFunction: () => { return; }, - sortIndicator: true, - source: [], - startCols: 123, - startRows: 123, - stretchH: 'foo', - strict: true, - tableClassName: 'foo', - tabMoves: {}, - title: 'foo', - trimDropdown: true, - trimWhitespace: true, - type: 'foo', - uncheckedTemplate: true, - undo: true, - validator: () => {return; }, - viewportColumnRenderingOffset: 123, - viewportRowRenderingOffset: 123, - visibleRows: 123, - width: 1232, - wordWrap: true, - - // Hooks - afterAutofillApplyValues: () => {return; }, - afterCellMetaReset: () => {return; }, - afterChange: (changes) => {return; }, - afterChangesObserved: () => {return; }, - afterColumnMove: () => {return; }, - afterColumnResize: () => {return; }, - afterColumnSort: () => {return; }, - afterContextMenuDefaultOptions: () => {return; }, - afterContextMenuHide: () => {return; }, - afterContextMenuShow: () => {return; }, - afterCopyLimit: () => {return; }, - afterCreateCol: () => {return; }, - afterCreateRow: () => {return; }, - afterDeselect: () => {return; }, - afterDestroy: () => {return; }, - afterDocumentKeyDown: () => {return; }, - afterFilter: () => {return; }, - afterGetCellMeta: () => {return; }, - afterGetColHeader: () => {return; }, - afterGetColumnHeaderRenderers: () => {return; }, - afterGetRowHeader: () => {return; }, - afterGetRowHeaderRenderers: () => {return; }, - afterInit: () => {return; }, - afterLoadData: () => {return; }, - afterMomentumScroll: () => {return; }, - afterOnCellCornerDblClick: () => {return; }, - afterOnCellCornerMouseDown: () => {return; }, - afterOnCellMouseDown: () => {return; }, - afterOnCellMouseOver: () => {return; }, - afterRemoveCol: () => {return; }, - afterRemoveRow: () => {return; }, - afterRender: () => {return; }, - afterRenderer: () => {return; }, - afterRowMove: () => {return; }, - afterRowResize: () => {return; }, - afterScrollHorizontally: () => {return; }, - afterScrollVertically: () => {return; }, - afterSelection: () => {return; }, - afterSelectionByProp: () => {return; }, - afterSelectionEnd: () => {return; }, - afterSelectionEndByProp: () => {return; }, - afterSetCellMeta: () => {return; }, - afterUpdateSettings: () => {return; }, - afterValidate: () => {return; }, - beforeAutofill: () => {return; }, - beforeCellAlignment: () => {return; }, - beforeChange: () => {return; }, - beforeChangeRender: () => {return; }, - beforeColumnMove: () => {return; }, - beforeColumnResize: () => {return; }, - beforeColumnSort: () => {return; }, - beforeDrawBorders: () => {return; }, - beforeFilter: () => {return; }, - beforeGetCellMeta: () => {return; }, - beforeInit: () => {return; }, - beforeInitWalkontable: () => {return; }, - beforeKeyDown: () => {return; }, - beforeOnCellMouseDown: () => {return; }, - beforeRemoveCol: () => {return; }, - beforeRemoveRow: () => {return; }, - beforeRender: () => {return; }, - beforeRenderer: () => {return; }, - beforeRowMove: () => {return; }, - beforeRowResize: () => {return; }, - beforeSetRangeEnd: () => {return; }, - beforeStretchingColumnWidth: () => {return; }, - beforeTouchScroll: () => {return; }, - beforeValidate: () => {return; }, - construct: () => {return; }, - init: () => {return; }, - modifyCol: () => {return; }, - modifyColHeader: () => {return; }, - modifyColWidth: () => {return; }, - modifyCopyableRange: () => {return; }, - modifyRow: () => {return; }, - modifyRowHeader: () => {return; }, - modifyRowHeight: () => {return; }, - persistentStateLoad: () => {return; }, - persistentStateReset: () => {return; }, - persistentStateSave: () => {return; }, - unmodifyCol: () => {return; } - }); -} - -function test_HandsontableMethods() { - const elem = document.createElement('div'); - const hot = new Handsontable(elem, {}); - hot.addHook('foo', []); - hot.addHookOnce('foo', []); - hot.alter('foo', 123, 123, 'foo', true); - hot.clear(); - hot.colOffset(); - hot.colToProp(123); - hot.countCols(); - hot.countEmptyCols(true); - hot.countEmptyRows(true); - hot.countRenderedCols(); - hot.countRenderedRows(); - hot.countRows(); - hot.countSourceRows(); - hot.countVisibleCols(); - hot.countVisibleRows(); - hot.deselectCell(); - hot.destroy(); - hot.destroyEditor(true); - hot.getActiveEditor(); - hot.getCell(123, 123, true); - hot.getCellEditor(123, 123); - hot.getCellMeta(123, 123); - hot.getCellRenderer(123, 123); - hot.getCellValidator(123, 123); - hot.getColHeader(123); - hot.getColWidth(123); - hot.getCoords(elem.querySelector('td')); - hot.getCopyableData(123, 123); - hot.getCopyableText(123, 123, 123, 123); - hot.getData(123, 123, 123, 123); - hot.getDataAtCell(123, 123); - hot.getDataAtCol(123); - hot.getDataAtProp(123); - hot.getDataAtRow(123); - hot.getDataAtRowProp(123, 'foo'); - hot.getDataType(123, 123, 123, 123); - hot.getInstance(); - hot.getPlugin('foo'); - hot.getRowHeader(123); - hot.getRowHeight(123); - hot.getSchema(); - hot.getSelected(); - const range: Handsontable.Range = hot.getSelectedRange(); - hot.getSettings(); - hot.getSourceData(123, 123, 123, 123); - hot.getSourceDataAtCell(123, 123); - hot.getSourceDataAtCol(123); - hot.getSourceDataAtRow(123); - hot.getValue(); - hot.hasColHeaders(); - hot.hasHook('foo'); - hot.hasRowHeaders(); - hot.isEmptyCol(123); - hot.isEmptyRow(123); - hot.isListening(); - hot.listen(); - hot.loadData([]); - hot.populateFromArray(123, 123, [], 123, 123, 'foo', 'foo', 'foo', []); - hot.propToCol('foo'); - hot.propToCol(123); - hot.removeCellMeta(123, 123, 'foo'); - hot.removeHook('foo', () => {return; }); - hot.render(); - hot.rowOffset(); - hot.runHooks('foo', 123, 'foo', true, {}, [], () => {return; }); - hot.selectCell(123, 123, 123, 123, true, true); - hot.selectCellByProp(123, 'foo', 123, 'foo', true); - hot.setCellMeta(123, 123, 'foo', 'foo'); - hot.setCellMetaObject(123, 123, {}); - hot.setDataAtCell(123, 123, 'foo', 'foo'); - hot.setDataAtCell([[123, 123, 'foo'], [123, 123, 'foo']]); - hot.setDataAtRowProp(123, 'foo', 'foo', 'foo'); - hot.spliceCol(123, 123, 123, 'foo'); - hot.spliceRow(123, 123, 123, 'foo'); - hot.toPhysicalRow(123); - hot.toPhysicalColumn(123); - hot.toVisualRow(123); - hot.toVisualColumn(123); - hot.unlisten(); - hot.updateSettings({}, true); - hot.validateCells(() => {return; }); - - Handsontable.renderers.NumericRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {}); - Handsontable.renderers.TextRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {}); - Handsontable.Dom.addEvent(new HTMLElement(), "eventName", () => { return; }); - Handsontable.Dom.empty(new HTMLElement()); - - let bucket: {}; - let registeredHooks: string[]; - let hasHook: boolean; - let isRegistered: boolean; - bucket = Handsontable.hooks.add('beforeInit', () => { return; }); - bucket = Handsontable.hooks.add('beforeInit', () => { return; }, hot); - Handsontable.hooks.createEmptyBucket(); - Handsontable.hooks.deregister('myHook'); - Handsontable.hooks.destroy(); - Handsontable.hooks.destroy(hot); - bucket = Handsontable.hooks.getBucket(); - bucket = Handsontable.hooks.getBucket(hot); - registeredHooks = Handsontable.hooks.getRegistered(); - hasHook = Handsontable.hooks.has("myHook"); - hasHook = Handsontable.hooks.has("myHook", hot); - isRegistered = Handsontable.hooks.isRegistered("myHook"); - Handsontable.hooks.once('beforeInit', () => { return; }); - Handsontable.hooks.once('beforeInit', [() => { return; }, () => { return; }]); - Handsontable.hooks.once('beforeInit', () => { return; }, hot); - Handsontable.hooks.register('myHook'); - Handsontable.hooks.remove('beforeInit', () => { return; }); - Handsontable.hooks.remove('beforeInit', () => { return; }, hot); - Handsontable.hooks.run(hot, 'beforeInit'); - Handsontable.hooks.run(hot, 'beforeInit', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6'); -} - -class MyCustomHotPlugin extends Handsontable.plugins.BasePlugin { - isEnabled(): boolean { - return !!this.hot.getSettings().manualRowMove; - } -} diff --git a/types/handsontable/tsconfig.json b/types/handsontable/tsconfig.json deleted file mode 100644 index afe6365050..0000000000 --- a/types/handsontable/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "test/global.ts", - "test/module.ts" - ] -} \ No newline at end of file diff --git a/types/handsontable/tslint.json b/types/handsontable/tslint.json deleted file mode 100644 index 5f3a731336..0000000000 --- a/types/handsontable/tslint.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // TODOs - "ban-types": false, - "dt-header": false, - "no-any-union": false, - "no-single-declare-module": false - } -} From b5df11f679ac76dacadb710b23647c85345051a3 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 10:40:26 -0800 Subject: [PATCH 300/890] homeworks: Provides its own types (#22424) --- notNeededPackages.json | 6 + types/homeworks/homeworks-tests.ts | 109 ------------- types/homeworks/index.d.ts | 247 ----------------------------- types/homeworks/tsconfig.json | 24 --- types/homeworks/tslint.json | 9 -- 5 files changed, 6 insertions(+), 389 deletions(-) delete mode 100644 types/homeworks/homeworks-tests.ts delete mode 100644 types/homeworks/index.d.ts delete mode 100644 types/homeworks/tsconfig.json delete mode 100644 types/homeworks/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 6c5bd58bd8..f93fa7b04a 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -480,6 +480,12 @@ "sourceRepoURL": "https://github.com/prettymuchbryce/node-http-status", "asOfVersion": "1.2.0" }, + { + "libraryName": "homeworks", + "typingsPackageName": "homeworks", + "sourceRepoURL": "https://github.com/IGAWorksDev/homeworks/", + "asOfVersion": "1.0.19" + }, { "libraryName": "iconv-lite", "typingsPackageName": "iconv-lite", diff --git a/types/homeworks/homeworks-tests.ts b/types/homeworks/homeworks-tests.ts deleted file mode 100644 index 5c41b7fffc..0000000000 --- a/types/homeworks/homeworks-tests.ts +++ /dev/null @@ -1,109 +0,0 @@ -const element: JQuery = $('#element'); -const target: JQuery = $('#target'); - -homeworks.disableHook(); - -element.checkbox({ - /* Empty options */ -}) - .on('change', (event: JQuery.Event) => { - /* HomeWorks native event */ - }); - -element.converter({ - /* Empty options */ -}); - -element.dropdown({ - /* Empty options */ -}); - -const dropdownHandlerTarget: JQuery = element.addHandler(target); - -element.input({ - /* Empty options */ -}) - .on('change', (event: JQuery.Event) => { - /* HomeWorks native event */ - }); - -element.modal({ - /* Any options */ -}) - .each(() => { - /* Chaining */ - }); -element.modal('show'); -element.modal('hide'); -element.modal('open'); -element.modal('close'); - -notification('title', 'content', 'url', 'success'); - -element - .ripple({ - /* Object options */ - }) - .on('start', (event: homeworks.RippleEvent) => { - }); - -element - .start({ - x: 1, - y: 2 - }); - -element.spinner({ - type: 'any', - empty: 'any' -}) - .on('change', (event: JQuery.Event) => { - /* HomeWorks native event */ - }); - -element.tab('method'); -element.tab({ - active: 0 -}) - .on('move', (event: homeworks.TabEvent) => { - /* HomeWorks step event */ - }); - -element.step('method'); -element.step({ - active: 0 -}) - .on('move', (event: homeworks.StepEvent) => { - /* HomeWorks step event */ - }); - -toast('hello homeworks'); -toast({ - message: 'hello homeworks' -}); - -element - .toggle({ - placeholder: 'placeholder' - }) - .on('change', (event: JQuery.Event) => { - /* HomeWorks native event */ - }); - -element - .upload({ - url: 'url', - type: 'type', - data: {}, - dest: 'dest', - isBtn: true, - beforeStart() { - }, - complete(data: any) { - }, - success(data?: any, state?: any, xhr?: any) { - }, - error(xhr?: any, state?: any, error?: any) { - }, - extensions: 'any' - }); diff --git a/types/homeworks/index.d.ts b/types/homeworks/index.d.ts deleted file mode 100644 index 7a25666659..0000000000 --- a/types/homeworks/index.d.ts +++ /dev/null @@ -1,247 +0,0 @@ -// Type definitions for homeworks 1.0 -// Project: https://github.com/IGAWorksDev/homeworks/ -// Definitions by: Kenneth Ceyer -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -type _NativeEvent = Event; - -interface JQuery { - /** - * jQuery homeworks chaining functions - */ - - /** - * @since 1.0.0 - */ - bind(eventType: string, handler: (...parameters: any[]) => void): JQuery; - /** - * @since 1.0.0 - */ - knock(): JQuery; - /** - * @since 1.0.0 - */ - checkbox(options?: homeworks.CheckboxOptions): JQuery; - /** - * @since 1.0.0 - */ - converter(options?: homeworks.ConverterOptions): JQuery; - /** - * @since 1.0.0 - */ - spinner(options?: homeworks.SpinnerOptions): JQuery; - /** - * @since 1.0.0 - */ - dropdown(options?: homeworks.DropdownOptions): JQuery; - /** - * @since 1.0.0 - */ - ripple(options?: any): JQuery; - /** - * @since 1.0.0 - */ - input(options?: homeworks.InputOptions): JQuery; - /** - * @since 1.0.0 - */ - modal(options?: any): JQuery; - /** - * @since 1.0.0 - */ - modal(method?: string, options?: any): JQuery; - /** - * @since 1.0.0 - */ - tab(method?: string): JQuery; - /** - * @since 1.0.0 - */ - tab(options?: homeworks.TabOptions): JQuery; - /** - * @since 1.0.0 - */ - step(method?: string): JQuery; - /** - * @since 1.0.0 - */ - step(options?: homeworks.StepOptions): JQuery; - /** - * @since 1.0.0 - */ - toggle(options: homeworks.ToggleOptions): JQuery; - /** - * @since 1.0.0 - */ - upload(options?: homeworks.UploadOptions): JQuery; - /** - * @since 1.0.0 - * @summary dropdown method - */ - addHandler(target: JQuery): JQuery; - /** - * @since 1.0.0 - * @summary ripple method - */ - start(event?: homeworks.RippleEvent): JQuery; - - /** - * jQuery homeworks events - */ - - /** - * @since 1.0.44 - */ - on(event: homeworks.TabMoveEventType, handler: JQuery.EventHandlerBase): JQuery; - /** - * @since 1.0.44 - */ - on(event: homeworks.StepMoveEventType, handler: JQuery.EventHandlerBase): JQuery; - /** - * @since 1.0.44 - */ - on(event: homeworks.RippleStartEventType, handler: JQuery.EventHandlerBase): JQuery; -} - -/** - * @since 1.0.44 - */ -declare function notification( - title: string, - content: string, - url: string, - status?: string): void; - -/** - * @since 1.0.44 - */ -declare function toast(message: any): void; - -declare namespace homeworks { - /** - * @since 1.0.0 - */ - interface CheckboxOptions { - } - - /** - * @since 1.0.0 - */ - interface ConverterOptions { - } - - /** - * @since 1.0.0 - */ - interface DropdownOptions { - } - - /** - * @since 1.0.0 - */ - interface InputOptions { - } - - /** - * @since 1.0.0 - */ - interface ToggleOptions { - placeholder?: string; - } - - /** - * @since 1.0.0 - */ - interface UploadOptions { - url: string; - type?: string; - data?: any; - dest?: string; - isBtn?: boolean; - beforeStart?: () => void; - complete?: (data?: any) => void; - success?: (data?: any, state?: any, xhr?: any) => void; - error?: (xhr?: any, state?: any, error?: any) => void; - extensions?: any; - } - - /** - * @since 1.0.0 - */ - interface SpinnerOptions { - type?: any; - empty?: any; - } - - /** - * @since 1.0.0 - */ - interface StepOptions { - active?: number; - } - - /** - * @since 1.0.0 - */ - interface TabOptions { - active?: number; - } - - /** - * @since 1.0.44 - */ - interface Event { - element: JQuery; - value: string | string[] | number; - checked?: boolean; - } - - /** - * @since 1.0.44 - */ - interface StepEvent { - header: JQuery[]; - index: number; - length: number; - } - - /** - * @since 1.0.44 - */ - interface TabEvent { - header: JQuery[]; - index: number; - length: number; - } - - /** - * @since 1.0.44 - */ - interface RippleEvent { - x: number; - y: number; - } - - /** - * @since 1.0.0 - */ - type TabMoveEventType = 'move'; - - /** - * @since 1.0.0 - */ - type StepMoveEventType = 'move'; - - /** - * @since 1.0.0 - */ - type RippleStartEventType = 'start'; - - /** - * @since 1.0.44 - */ - function disableHook(): void; -} diff --git a/types/homeworks/tsconfig.json b/types/homeworks/tsconfig.json deleted file mode 100644 index e26de44673..0000000000 --- a/types/homeworks/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "homeworks-tests.ts" - ] -} \ No newline at end of file diff --git a/types/homeworks/tslint.json b/types/homeworks/tslint.json deleted file mode 100644 index 626d0c5922..0000000000 --- a/types/homeworks/tslint.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "no-empty-interface": false, - "strict-export-declare-modifiers": false, - "prefer-method-signature": false, - "unified-signatures": false - } -} From 5760ddb71ad3c85667c1b3834882f66f26a38dfb Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 10:40:45 -0800 Subject: [PATCH 301/890] botvs: Provides its own types (#22380) --- notNeededPackages.json | 6 + types/botvs/botvs-tests.ts | 7 - types/botvs/index.d.ts | 3097 ------------------------------------ types/botvs/tsconfig.json | 23 - types/botvs/tslint.json | 6 - 5 files changed, 6 insertions(+), 3133 deletions(-) delete mode 100644 types/botvs/botvs-tests.ts delete mode 100644 types/botvs/index.d.ts delete mode 100644 types/botvs/tsconfig.json delete mode 100644 types/botvs/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index f93fa7b04a..233c3b3673 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -156,6 +156,12 @@ "sourceRepoURL": "https://github.com/MikeMcl/bignumber.js/", "asOfVersion": "4.0.3" }, + { + "libraryName": "botvs", + "typingsPackageName": "botvs", + "sourceRepoURL": "https://www.botvs.com/", + "asOfVersion": "1.0.0" + }, { "libraryName": "Bowser", "typingsPackageName": "bowser", diff --git a/types/botvs/botvs-tests.ts b/types/botvs/botvs-tests.ts deleted file mode 100644 index 96c424c164..0000000000 --- a/types/botvs/botvs-tests.ts +++ /dev/null @@ -1,7 +0,0 @@ -_N(0, 1); -_C(() => void 0); -Sleep(1e3); -const data: botvs.Record | undefined = void 0; -console.log(data); -TA.Alligator([]); -talib.help('XML'); diff --git a/types/botvs/index.d.ts b/types/botvs/index.d.ts deleted file mode 100644 index 04d8f76c97..0000000000 --- a/types/botvs/index.d.ts +++ /dev/null @@ -1,3097 +0,0 @@ -// Type definitions for botvs 0.1 -// Project: https://www.botvs.com/ -// Definitions by: acrazing -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -import Highstock = require('highcharts/highstock'); - -declare global { - namespace botvs { - /** - * 订单的状态 - */ - type VOrderState = object; - - /** - * 订单的类型 - */ - type VOrderType = object; - - /** - * 仓位的类型 - */ - type VPositionType = object; - - /** - * K线周期 - */ - type VPeriod = object; - - /** - * 日志类型 - */ - type VLogType = object; - - interface ChartOptions extends Highstock.Options { - __isStock?: boolean; - } - - interface RChart { - add(series?: number, data?: number, index?: number): void; - reset(): void; - } - - interface Socket { - write(data: string, timeout?: number): number; - read(size?: number): Buffer | null; - close(): void; - } - - /** - * 标准OHLC结构, 用来画K线和指标分析用的,由GetRecords函数返回此结构数组 - */ - interface Record { - /** - * 一个时间戳, 精确到毫秒,与Javascript的 new Date().getTime() 得到的结果格式一样 - */ - Time: number; - /** - * 开盘价 - */ - Open: number; - /** - * 最高价 - */ - High: number; - /** - * 最低价 - */ - Low: number; - /** - * 收盘价 - */ - Close: number; - /** - * 成交量 - */ - Volume: number; - } - - /** - * 市场深度单 - */ - interface MarketOrder { - /** - * 价格 - */ - Price: number; - /** - * 数量 - */ - Amount: number; - } - - /** - * 市场行情 - */ - interface Ticker { - /** - * 最高价 - */ - High: number; - /** - * 最低价 - */ - Low: number; - /** - * 卖一价 - */ - Sell: number; - /** - * 买一价 - */ - Buy: number; - /** - * 最后成交价 - */ - Last: number; - /** - * 最近成交量 - */ - Volume: number; - } - - /** - * 订单结构, 由GetOrder函数返回 - */ - interface Order { - /** - * 交易单唯一标识 - */ - Id: string; - /** - * 下单价格 - */ - Price: number; - /** - * 下单数量 - */ - Amount: number; - /** - * 成交数量 - */ - DealAmount: number; - /** - * 订单状态, 参考常量里的订单状态 - */ - Status: VOrderState; - /** - * 订单类型, 参考常量里的订单类型 - */ - Type: VOrderType; - } - - /** - * 市场深度,由GetDepth函数返回 - */ - interface Depth { - /** - * 卖单数组, MarketOrder数组, 按价格从低向高排序 - */ - Asks: MarketOrder[]; - /** - * 买单数组, MarketOrder数组, 按价格从高向低排序 - */ - Bids: MarketOrder[]; - } - - /** - * 获取所有交易历史(非自己),由GetTrades函数返回 - */ - interface Trade { - /** - * Id(交易所返回的此Trade的唯一Id) - */ - Id: string; - /** - * 时间(Unix timestamp 毫秒) - */ - Time: number; - /** - * 价格 - */ - Price: number; - /** - * 数量 - */ - Amount: number; - /** - * 订单类型, 参考常量里的订单类型 - */ - Type: VOrderType; - } - - /** - * 手续费结构, 由GetFee函数返回(如国外平台bitfinex买入卖出手续费跟账户交易量相关) - */ - interface Fee { - /** - * 卖出手续费, 为一个浮点数, 如0.2表示0.2%的手续费 - */ - Sell: number; - /** - * 买入手续费, 格式同上 - */ - Buy: number; - } - - /** - * 账户信息, 由GetAccount函数返回 - */ - interface Account { - /** - * 余额(人民币或者美元, 在Poloniex交易所里BTC_ETC这样的品种, Balance就指的是BTC的数量, - * Stocks指的是ETC数量, BTC38的ETC_BTC相当于Poloniex的BTC_ETC, 指的是以BTC计价) - */ - Balance: number; - /** - * 冻结的余额 - */ - FrozenBalance: number; - /** - * BTC/LTC数量, 现货为当前可操作币的余额(去掉冻结的币), - * 期货的话为合约当前可用保证金(传统期货为此属性) - */ - Stocks: number; - /** - * 冻结的BTC/LTC数量(传统期货无此属性) - */ - FrozenStocks: number; - } - - /** - * 期货交易中的持有仓位信息, 由GetPosition()函数返回此结构数组 - */ - interface Position { - /** - * 杆杠大小, 796期货有可能为5, 10, 20三个参数, OKCoin为10或者20, - * BitVC期货和OK期货的全仓模式返回为固定的10, 因为原生API不支持 - */ - MarginLevel: number; - /** - * 持仓量, 796期货表示持币的数量, BitVC指持仓的总金额(100的倍数), - * OKCoin表示合约的份数(整数且大于1) - */ - Amount: number; - /** - * 可平量, 只有股票有此选项, 表示可以平仓的数量(股票为T+1)今日仓不能平 - */ - CanCover: number; - /** - * 仓位冻结量 - */ - FrozenAmount: number; - /** - * 持仓均价 - */ - Price: number; - /** - * 持仓浮动盈亏(数据货币单位:BTC/LTC, 传统期货单位:RMB, 股票不支持此字段, - * 注: OKCoin期货全仓情况下指实现盈余, 并非持仓盈亏, 逐仓下指持仓盈亏) - */ - Profit: number; - /** - * PD_LONG为多头仓位(CTP中用closebuy_today平仓), PD_SHORT为空头仓位(CTP用closesell_today)平仓, - * (CTP期货中)PD_LONG_YD为咋日多头仓位(用closebuy平), PD_SHORT_YD为咋日空头仓位(用closesell平) - */ - Type: VPositionType; - /** - * 商品期货为合约代码, 股票为'交易所代码_股票代码', 具体参数SetContractType的传入类型 - */ - ContractType: string; - } - - interface AsyncJob { - wait(timeout?: number): T | null | undefined; - } - - interface Exchange { - /** - * 返回交易所名称(string) - * - */ - GetName(): string; - - /** - * 返回交易所自定义的标签(string) - * - */ - GetLabel(): string; - - /** - * 返回交易所使用的美元的汇率, OKCoin期货返回官方提供的汇率, 该值不受SetRate影响 - * - */ - GetUSDCNY(): number; - - /** - * 返回交易所使用的流通货币与人民币的汇率, 返回1表示禁用汇率转换 - * - * 汇率接口调用雅虎提供的接口, 5分钟更新一次 - * 所有函数自动经过汇率转换,如果为1指禁用汇率转换 - * - */ - GetRate(): number; - - /** - * 设置交易所的流通货币的汇率, 返回设置前的汇率, 设置为1指禁用汇率转换 - * - * 比如796期货设置SetRate(6.13), 就是设定USD/EUR对CNY的汇率为6.13, 程序所有价格会自动用这个汇率计算 - * SetRate(), 如果不加参数,则恢复系统内置汇率 - * SetRate(1), 就是禁用汇率转换 - * - */ - SetRate(rate?: number): void; - - /** - * 设置价格与品种下单量的小数位精度, 设置后会自动截断 - * - * exchange.SetPrecision(2, 3); // 设置价格小数位精度为2位, 品种下单量小数位精度为3位 - * - */ - SetPrecision(PricePrecision: number, AmountPrecision: number): void; - - /** - * 返回交易所操作的货币名称(string), 传统期货CTP返回的固定为STOCK - * - */ - GetCurrency(): string; - - /** - * 返回交易所操作的基础货币名称(string), BTC_CNY就返回CNY, ETH_BTC就返回BTC - * - */ - GetBaseCurrency(): string; - - /** - * 返回一个Ticker结构 - * - */ - GetTicker(): Ticker; - - /** - * 返回一个Depth结构 - * - */ - GetDepth(): Depth; - - /** - * 返回一个Trade数组, 按时间从低到高的顺序, 只支持数字货币(BTC/LTC) - * - */ - GetTrades(): Trade[]; - - /** - * 返回一个K线历史, K线周期在创建机器人时指定, Record数组结构 - * - * 不加参数, 默认返回添加机器人时时指量的K线周期, 但也可以自定义K线周期 - * 支持: PERIOD_M1 指1分钟, PERIOD_M5 指5分钟, PERIOD_M15 指15分钟, - * PERIOD_M30 指30分钟, PERIOD_H1 指1小时, PERIOD_D1 指一天 - * - */ - GetRecords(Period?: VPeriod): Record[]; - - /** - * 返回一个Account结构, 如exchange.GetAccount(), 将返回主交易所账户信息 - * - */ - GetAccount(): Account; - - /** - * 下买单, Price为买单价格,Amount为数量, 返回一个订单ID - * - * 可以跟多余的参数做为附加消息显示到日志, 如exchange.Buy(1000,0.1, "OK", 123) - * 支持现货(火币/BitVC/OKCoin/OKCoin国际/OKCoin期货/BTCChina/BitYes)市价单, 市价单价格指定为-1 - * exchange.Buy(1000), 指买市价1000元的币, BTCChina例外exchange.Buy(0.3)指市价买0.3个币 - * - * @return - 订单ID - */ - Buy(Price: number, Amount: number, ...args: any[]): string; - - /** - * 跟Buy函数一样的调用方法和场景 {@see Exchange#Buy} - * - */ - Sell(Price: number, Amount: number): string; - - /** - * 获取所有未完成的订单, 返回一个Order数组结构 - * - */ - GetOrders(): Order[]; - - /** - * 根据订单号获取订单详情, 返回一个Order结构 - * - */ - GetOrder(orderId: string): Order; - - /** - * 根据订单号取消一个订单, 返回true或者false - * - */ - CancelOrder(orderId: string): boolean; - - /** - * 不下单, 只记录交易信息, logType可为LOG_TYPE_BUY/LOG_TYPE_SELL/LOG_TYPE_CANCEL - * - */ - Log(logType: VLogType, orderId: string, price: number, amount: number): void; - - /** - * 返回币最小交易数量 - * - */ - GetMinStock(): number; - - /** - * 返回一笔订单要求的最小金额(价格*数量) - * - * Bitstamp要求5美元(程序会根据汇率自动转换为人民币), 其它没有限制 - * - */ - GetMinPrice(): number; - - /** - * 返回一个Fee结构 - * - */ - GetFee(): Fee; - - /** - * 返回最后一次REST API请求返回的原始内容(字符串), 用户可以用来自己解析扩展信息 - * - * 注: 模拟测试的话,会一直返回一个空字符串, 只在真实环境下有效 - * exchange.GetAccount(); - * var obj = JSON.parse(exchange.GetRawJSON()); - * - * 传统商品期货API获取更多信息 - * exchange.GetAccount(); - * Log(exchange.GetRawJSON());//在GetAccount成功后调用, 获取更详细的账户信息, 可以用JSON.parse解析 - * 也支持GetTicker, GetDepth后的exchange.GetRawJSON(), 以及GetPosition与GetOrders,GetOrder这三个调用后的详细反馈数据 - * - */ - GetRawJSON(): string; - - /** - * 多线程异步支持函数, 可以把所有支持的函数的操作变成异步并发的.(只支持数字货币交易平台) - * - * Support: GetTicker, GetDepth, GetTrades, GetRecords, GetAccount, GetOrders, GetOrder, CancelOrder, Buy, - * Sell, GetPosition var a = exchange.Go("GetTicker"); // GetTicker 异步多线程执行 var b = - * exchange.Go("GetDepth"); var c = exchange.Go("Buy", 1000, 0.1); var d = exchange.Go("GetRecords", - * PERIOD_H1); - * - * // 上面四种操作是并发多线程异步执行, 不会耗时, 立即返回的 - * - * var ticker = a.wait(); // 调用wait方法等待返回异步获取ticker结果 - * var depth = b.wait(); // 返回深度, 如果获取失败也是有可能返回null的 - * var orderId = c.wait(1000); // 返回订单号, 限定1秒超时, 超时返回undefined, 此对像可以继续调用wait等待如果上次wait超时 - * // 注意: 判断undefiend要用typeof(xx) === "undefined", 因为null==undefined在JavaScript里是成立的 - * - * var records = d.wait(); // 等待K线结果 - * var ret = d.wait(); // 这里wait了一个已经wait过且结束的异步操作, 会返回null, 并记录出错信息. - * // Python与Javascript的区别, Python的wait返回两个参数, 第一个是异步的api返回的结果, 第二个表示是异步调用是否完成 - * ret, ok = d.wait() // ok是一定返回True的, 除非策略被停止 - * ret, ok = d.wait(100) // ok返回False, 如果等待超时, 或者wait了一个已经结束的实例 - * - */ - Go(Method: keyof Exchange, ...Args: any[]): AsyncJob; - - /** - * 调用交易所其它功能接口 - * - * 支持所有数字货币交易所 - * exchange.IO("api", "cancel_borrow", "symbol=cny&borrow_id=123"); // no need api & sign - * Detail: {@link https://www.botvs.com/bbs-topic/146} - * - * // 只支持Websocket模式(huobi, okcoin.cn, BTCC支持)与商品期货CTP协议 - * - * exchange.IO("websocket"); // 切换行情通信协议到websocket(默认为rest), Ticker, - * Depth会切换为websocket协议来更新, 商品期货CTP无需切换 - * - * - * // 切换GetTicker, GetDepth数据更新模式 - * - * exchange.IO("mode", 0); // 立即返回模式, 如果当前还没有接收到交易所最新的行情数据推送, 就立即返回旧的行情数据, - * 如果有新的数据就返回新的数据 - * - * exchange.IO("mode", 1); // 缓存模式(默认模式), - * 如果当前还没有收到交易所最新的行情数据(同上一次api获取的数据比较), 就等待接收然后再返回, 如果调用该函数之前收到了最新的行情数据, - * 就立即返回最新的数据 - * - * exchange.IO("mode", 2); // 强制更新模式, 进入等待一直到接收到交易所下一次的最新推送数据后返回 - * - * - * - * // 如果想第一时间获取最新的行情可以切换到websocket后不Sleep的立即检测数据, GetTicker, GetDepth用缓存模式进行工作 - * - * exchange.IO("websocket"); - * - * while (true) { - * Log(exchange.GetTicker()); - * } - * - * 传统商品期货扩展的IO功能 - * exchange.IO("status"); // 返回true证明与CTP服务器行情与数据的两台服务器都连接正常 - * exchange.IO("instruments"); // 返回交易所所有的合约列表{合约名: 详情}字典形式, 只支持实盘 - * exchange.IO("products"); // 返回交易所所有的产品列表{产品名: 详情}字典形式, 只支持实盘 - * exchange.IO("subscribed"); // 返回已订阅行情的合约, 格式同上, 只支持实盘 - * exchange.IO("settlement"); // 结算单查询, 不加第二个参数默认返回之前一个交易日的, - * 加参数如"20170317"指返回20170317的结算单, 只支持实盘 - * exchange.IO("wait"); // 有任何品种更新行情信息时才返回, 可带第二个参数(毫秒数)指定超时, - * 超时返回-1, 正常返回事件接收的时间(nano级), 只支持实盘 - * exchange.IO("wait_instrument"); // 有任何品种更新行情信息时才返回, 可带第二个参数(毫秒数) - * 指定超时, 超时返回空字符串, 正常返回触发事件的品种名称, 只支持实盘 - * - */ - IO(Api: 'api' | 'usd' | 'cny' | 'currency' | string, ApiName?: string, Args?: string): T; - - /** - * 获取当前持仓信息 - * - * 返回一个Position数组, (BitVC和OKCoin)可以传入一个参数, 指定要获取的合约类型 - * - */ - GetPosition(): Position[]; - - /** - * 设置杆杠大小 - * - * 设置Buy(多单)或者Sell(空单)的杆杠大小, MarginLevel有5, 10, 20 三个可选参数 - * 796支持5,10,20,50三个选项, BitVC的LTC不支持20倍杠杆, OKCoin支持10倍和20倍 - * 如: exchange.SetMarginLevel(5) - * - */ - SetMarginLevel(MarginLevel: number): void; - - /** - * 设置Buy或者Sell下单类型 - * - * Direction可以取buy, closebuy, sell, closesell四个参数, 传统期货多出closebuy_today,与closesell_today, 指平今仓, - * 默认为closebuy/closesell为平咋仓 对于CTP传统期货, 可以设置第二个参数"1"或者"2"或者"3", 分别指"投机", "套利", "套保", - * 不设置默认为投机 股票只支持buy与closebuy, - * 因为股票只能买跟平仓 exchange.SetMarginLevel(5); exchange.SetDirection("buy"); exchange.Buy(1000, 2); - * exchange.SetMarginLevel(5); exchange.SetDirection("closebuy"); exchange.Sell(1000, 2); - * - * 期货交易中Buy, Sell, CancelOrder和现货交易的区别 - * Buy或Sell之前需要调用SetMarginLevel和SetDirection明确操作类型 - * 数字货币796的CancelOrder之前需要调用SetDirection明确订单类型 - * 如: - * exchange.SetDirection("sell"); - * exchange.Sell(1000, 2); - * 如: - * exchange.SetDirection("buy"); - * exchange.CancelOrder(123); - * - * 数字货币BitVC期货交易中Buy, Sell, GetOrder, SetMarginLevel与796的区别 - * GetOrder里面的Amount为订单总金额, DealAmount为订单完成的金额, 不是币的个数 - * 数字货币796的CancelOrder之前需要调用SetDirection明确订单类型 - * Buy或Sell第二个参数不是币的数量而是订单的总金额(100的倍数) - * SetMarginLevel LTC不支持20倍杠杆 - * 如: - * exchange.SetContractType("week"); exchange.SetDirection("sell"); - * exchange.Sell(1000, 100), 就是以1000元一个币的价格开100元的空头 - * - * 数字货币OKCoin期货交易中Buy, Sell, GetOrder, SetMarginLevel与796的区别 - * GetOrder里面的Amount为合约数(一份合约为10$), DealAmount为订单完成的合约数, 不是币的个数 - * Buy或Sell第二个参数不是币的数量而是合约的份数(整数且大于0) - * SetMarginLevel 只支持10倍和20倍的杠杆 - * 如: 以1000元一个币的价格做空一份合约(10$的LTC或者100$的BTC): - * exchange.SetContractType("this_week"); - * exchange.SetDirection("sell"); - * exchange.Sell(1000, 1); - * - */ - SetDirection(Direction: 'buy' | 'closebuy' | 'sell' | 'closesell' | 'closebuy_today' | 'closesell_today'): void; - - /** - * 设置合约类型 - * - * 传统的CTP期货的ContractType就是指的合约ID, 如SetContractType("au1506") 返回合约的详细信息, 如最少一次买多少, 手续费, - * 交割时间等, - * 主力连续合约为代码为000如MA000, 只支持回测, 不支持实盘 股票合约格式为 股票代码.(SH/SZ), SH指上交所, SZ指深交所, - * 如000001.SZ就是指深交所的平安银行 商品期货与股票取消订阅合约, - * 在合约名前加上"-"前缀重新调用即可, 如SetContractType("-au1506"); 成功返回true 数字货币796支持: "week", "weekcny", - * 默认为子账户A, 要指定子账户是A还是B, - * 在合约后加"@A"或"@B", 如: "day@A" 为日合约A子账户 BitVC有week和quarter和next_week三个可选参数, OKCoin期货有this_week, - * next_week, quarter三个参数 exchange.SetContractType("week"); - * - */ - SetContractType(ContractType: string): void; - } - } - - namespace TA { - /** - * 指数平滑异同平均线 - * - * MACD(数据, 快周期, 慢周期, 信号周期), 默认参数为(12, 26, 9), 返回二维数组, 分别是[DIF, DEA, MACD] - * - */ - function MACD( - Records: botvs.Record[], - LongPeriod?: number, - ShortPeriod?: number, - SignalPeriod?: number, - ): [number[], number[], number[]]; - - /** - * 随机指标 - * - * KDJ(数据, 周期1, 周期2, 周期3), 默认参数为(9, 3, 3), 返回二维数组, 分别是[K, D, J] - * - */ - function KDJ( - Records: botvs.Record[], - FirstPeriod?: number, - SecondPeriod?: number, - ThirdPeriod?: number, - ): [number[], number[], number[]]; - - /** - * 强弱指标 - * - * RSI(数据, 周期), 默认参数为14, 返回一个一维数组 - * - */ - function RSI(Records: botvs.Record[], Period?: number): number[]; - - /** - * 平均真实波幅 - * - * ATR(数据, 周期), 默认参数为14, 返回一个一维数组 - * - */ - function ATR(Records: botvs.Record[], Period?: number): number[]; - - /** - * 能量潮 - * - * OBV(数据), 返回一个一维数组 - * - */ - function OBV(Records: botvs.Record[]): [number[], number[]]; - - /** - * 移动平均线 - * - * MA(数据, 周期), 默认参数为9, 返回一个一维数组 - * - */ - function MA(Records: botvs.Record[], Period?: number): number[]; - - /** - * 指数平均数指标 - * EMA(数据, 周期), 默认参数为9, 返回一个一维数组 - * - */ - function EMA(Records: botvs.Record[], Period?: number): number[]; - - /** - * Alligator Indicator - * - * Alligator(数据, 下颚周期,牙齿周期,上唇周期), 鳄鱼线指标, 默认参数为(13,8,5) 返回一个二维数组[下颚,牙齿,上唇] - * - */ - function Alligator( - Records: botvs.Record[], - JawPeriod?: number, - TeethPeriod?: number, - LibsPeriod?: number, - ): [number[], number[], number[]]; - - /** - * Chaikin Money Flow - * - * CMF(数据, 周期), 默认周期参数为20, 返回一个一维数组 - * - */ - function CMF(Records: botvs.Record[], Period?: number): number[]; - - /** - * 周期最高价 - * - * Highest(数据, 周期, 属性), 返回最近周期内的最大值(不包含当前Bar), - * 如TA.Highest(records, 30, 'High'), 如果周期为0指所有, 如属性不指定则视数据为普通数组 - * - */ - function Highest(Records: botvs.Record[], Period?: number, Property?: keyof botvs.Record): number; - - /** - * 周期最低价 - * - * Lowest(数据, 周期, 属性), 同上, 求最小值 - * - */ - function Lowest(Records: botvs.Record[], Period?: number, Property?: keyof botvs.Record): number; - } - - namespace talib { - /** - * 查询指标调用格式 - * - * Log(talib.help('MACD')); // 在回测环境下调用 - * - */ - function help(Func: string): string; - - /** - * Vector Trigonometric ACos (反余弦函数) - * - * ACOS(Records[Close]) = Array(outReal) - * - */ - function ACOS(Records: botvs.Record[] | number[]): number[]; - - /** - * Chaikin A/D Line (线随机指标) - * - * AD(Records[High,Low,Close,Volume]) = Array(outReal) - * - */ - function AD(Records: botvs.Record[]): number[]; - /** - * Chaikin A/D Line (线随机指标) - * - * AD(Records[High,Low,Close,Volume]) = Array(outReal) - * - */ - function AD(High: number[], Low: number[], Close: number[], Volume: number[]): number[]; - - /** - * Chaikin A/D Oscillator (佳庆指标) - * - * ADOSC(Records[High,Low,Close,Volume],Fast Period = 3,Slow Period = 10) = Array(outReal) - * - */ - function ADOSC(Records: botvs.Record[], FastPeriod: number, SlowPeriod: number): number[]; - /** - * Chaikin A/D Oscillator (佳庆指标) - * - * ADOSC(Records[High,Low,Close,Volume],Fast Period = 3,Slow Period = 10) = Array(outReal) - * - */ - function ADOSC( - High: number[], - Low: number[], - Close: number[], - Volume: number[], - FastPeriod: number, - SlowPeriod: number, - ): number[]; - - /** - * Average Directional Movement Index (平均趋向指数) - * - * ADX(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function ADX(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Average Directional Movement Index (平均趋向指数) - * - * ADX(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function ADX(High: number[], Low: number[], Close: number[], TimePeriod: number): number[]; - - /** - * Average Directional Movement Index Rating (评估指数) - * - * ADXR(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function ADXR(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Average Directional Movement Index Rating (评估指数) - * - * ADXR(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function ADXR(High: number[], Low: number[], Close: number[], TimePeriod: number): number[]; - - /** - * Absolute Price Oscillator (绝对价格振荡指数) - * - * APO(Records[Close],Fast Period = 12,Slow Period = 26,MA Type = 0) = Array(outReal) - * - */ - function APO( - Records: botvs.Record[] | number[], - FastPeriod: number, - SlowPeriod: number, - MAType: number, - ): number[]; - - /** - * Aroon (阿隆指标) - * - * AROON(Records[High,Low],Time Period = 14) = [Array(outAroonDown),Array(outAroonUp)] - * - */ - function AROON(Records: botvs.Record[], TimePeriod: number): [number[], number[]]; - /** - * Aroon (阿隆指标) - * - * AROON(Records[High,Low],Time Period = 14) = [Array(outAroonDown),Array(outAroonUp)] - * - */ - function AROON(High: number[], Low: number[], TimePeriod: number): [number[], number[]]; - - /** - * Aroon Oscillator (阿隆震荡线) - * - * AROONOSC(Records[High,Low],Time Period = 14) = Array(outReal) - * - */ - function AROONOSC(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Aroon Oscillator (阿隆震荡线) - * - * AROONOSC(Records[High,Low],Time Period = 14) = Array(outReal) - * - */ - function AROONOSC(High: number[], Low: number[], TimePeriod: number): number[]; - - /** - * Vector Trigonometric ASin (反正弦函数) - * - * ASIN(Records[Close]) = Array(outReal) - * - */ - function ASIN(Records: botvs.Record[] | number[]): number[]; - - /** - * Vector Trigonometric ATan (反正切函数) - * - * ATAN(Records[Close]) = Array(outReal) - * - */ - function ATAN(Records: botvs.Record[] | number[]): number[]; - - /** - * Average True Range (平均真实波幅) - * - * ATR(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function ATR(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Average True Range (平均真实波幅) - * - * ATR(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function ATR(High: number[], Low: number[], Close: number[], TimePeriod: number): number[]; - - /** - * Average Price (平均价格) - * - * AVGPRICE(Records[Open,High,Low,Close]) = Array(outReal) - * - */ - function AVGPRICE(Records: botvs.Record[]): number[]; - /** - * Average Price (平均价格) - * - * AVGPRICE(Records[Open,High,Low,Close]) = Array(outReal) - * - */ - function AVGPRICE(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Bollinger Bands (布林带) - * - * BBANDS(Records[Close],Time Period = 5,Deviations up = 2,Deviations down = 2,MA Type = 0) = - * [Array(outRealUpperBand),Array(outRealMiddleBand),Array(outRealLowerBand)] - * - */ - function BBANDS( - Records: botvs.Record[] | number[], - TimePeriod: number, - Deviationsup: number, - Deviationsdown: number, - MAType: number, - ): [number[], number[], number[]]; - - /** - * Balance Of Power (均势指标) - * - * BOP(Records[Open,High,Low,Close]) = Array(outReal) - * - */ - function BOP(Records: botvs.Record[]): number[]; - /** - * Balance Of Power (均势指标) - * - * BOP(Records[Open,High,Low,Close]) = Array(outReal) - * - */ - function BOP(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Commodity Channel Index (顺势指标) - * - * CCI(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function CCI(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Commodity Channel Index (顺势指标) - * - * CCI(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function CCI(High: number[], Low: number[], Close: number[], TimePeriod: number): number[]; - - /** - * Two Crows (K线图--两只乌鸦) - * - * CDL2CROWS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL2CROWS(Records: botvs.Record[]): number[]; - /** - * Two Crows (K线图--两只乌鸦) - * - * CDL2CROWS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL2CROWS(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Three Black Crows (K线图--3只黑乌鸦) - * - * CDL3BLACKCROWS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3BLACKCROWS(Records: botvs.Record[]): number[]; - /** - * Three Black Crows (K线图--3只黑乌鸦) - * - * CDL3BLACKCROWS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3BLACKCROWS(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Three Inside Up/Down (K线图:3内上下震荡) - * - * CDL3INSIDE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3INSIDE(Records: botvs.Record[]): number[]; - /** - * Three Inside Up/Down (K线图:3内上下震荡) - * - * CDL3INSIDE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3INSIDE(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Three-Line Strike (K线图:3线震荡) - * - * CDL3LINESTRIKE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3LINESTRIKE(Records: botvs.Record[]): number[]; - /** - * Three-Line Strike (K线图:3线震荡) - * - * CDL3LINESTRIKE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3LINESTRIKE(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Three Outside Up/Down (K线图:3外下震荡) - * - * CDL3OUTSIDE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3OUTSIDE(Records: botvs.Record[]): number[]; - /** - * Three Outside Up/Down (K线图:3外下震荡) - * - * CDL3OUTSIDE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3OUTSIDE(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Three Stars In The South (K线图:南方三星) - * - * CDL3STARSINSOUTH(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3STARSINSOUTH(Records: botvs.Record[]): number[]; - /** - * Three Stars In The South (K线图:南方三星) - * - * CDL3STARSINSOUTH(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3STARSINSOUTH(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Three Advancing White Soldiers (K线图:三白兵) - * - * CDL3WHITESOLDIERS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3WHITESOLDIERS(Records: botvs.Record[]): number[]; - /** - * Three Advancing White Soldiers (K线图:三白兵) - * - * CDL3WHITESOLDIERS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDL3WHITESOLDIERS(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Abandoned Baby (K线图:弃婴) - * - * CDLABANDONEDBABY(Records[Open,High,Low,Close],Penetration = 0.3) = Array(outInteger) - * - */ - function CDLABANDONEDBABY(Records: botvs.Record[], Penetration: number): number[]; - /** - * Abandoned Baby (K线图:弃婴) - * - * CDLABANDONEDBABY(Records[Open,High,Low,Close],Penetration = 0.3) = Array(outInteger) - * - */ - function CDLABANDONEDBABY( - Open: number[], - High: number[], - Low: number[], - Close: number[], - Penetration: number, - ): number[]; - - /** - * Advance Block (K线图:推进) - * - * CDLADVANCEBLOCK(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLADVANCEBLOCK(Records: botvs.Record[]): number[]; - /** - * Advance Block (K线图:推进) - * - * CDLADVANCEBLOCK(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLADVANCEBLOCK(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Belt-hold (K线图:带住) - * - * CDLBELTHOLD(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLBELTHOLD(Records: botvs.Record[]): number[]; - /** - * Belt-hold (K线图:带住) - * - * CDLBELTHOLD(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLBELTHOLD(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Breakaway (K线图:分离) - * - * CDLBREAKAWAY(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLBREAKAWAY(Records: botvs.Record[]): number[]; - /** - * Breakaway (K线图:分离) - * - * CDLBREAKAWAY(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLBREAKAWAY(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Closing Marubozu (K线图:收盘光头光脚) - * - * CDLCLOSINGMARUBOZU(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLCLOSINGMARUBOZU(Records: botvs.Record[]): number[]; - /** - * Closing Marubozu (K线图:收盘光头光脚) - * - * CDLCLOSINGMARUBOZU(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLCLOSINGMARUBOZU(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Concealing Baby Swallow (K线图:藏婴吞没形态) - * - * CDLCONCEALBABYSWALL(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLCONCEALBABYSWALL(Records: botvs.Record[]): number[]; - /** - * Concealing Baby Swallow (K线图:藏婴吞没形态) - * - * CDLCONCEALBABYSWALL(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLCONCEALBABYSWALL(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Counterattack (K线图:反击) - * - * CDLCOUNTERATTACK(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLCOUNTERATTACK(Records: botvs.Record[]): number[]; - /** - * Counterattack (K线图:反击) - * - * CDLCOUNTERATTACK(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLCOUNTERATTACK(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Dark Cloud Cover (K线图:乌云盖) - * - * CDLDARKCLOUDCOVER(Records[Open,High,Low,Close],Penetration = 0.5) = Array(outInteger) - * - */ - function CDLDARKCLOUDCOVER(Records: botvs.Record[], Penetration: number): number[]; - /** - * Dark Cloud Cover (K线图:乌云盖) - * - * CDLDARKCLOUDCOVER(Records[Open,High,Low,Close],Penetration = 0.5) = Array(outInteger) - * - */ - function CDLDARKCLOUDCOVER( - Open: number[], - High: number[], - Low: number[], - Close: number[], - Penetration: number, - ): number[]; - - /** - * Doji (K线图:十字星 ) - * - * CDLDOJI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLDOJI(Records: botvs.Record[]): number[]; - /** - * Doji (K线图:十字星 ) - * - * CDLDOJI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLDOJI(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Doji Star (K线图:十字星) - * - * CDLDOJISTAR(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLDOJISTAR(Records: botvs.Record[]): number[]; - /** - * Doji Star (K线图:十字星) - * - * CDLDOJISTAR(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLDOJISTAR(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Dragonfly Doji (K线图:蜻蜓十字星) - * - * CDLDRAGONFLYDOJI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLDRAGONFLYDOJI(Records: botvs.Record[]): number[]; - /** - * Dragonfly Doji (K线图:蜻蜓十字星) - * - * CDLDRAGONFLYDOJI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLDRAGONFLYDOJI(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Engulfing Pattern (K线图:吞没) - * - * CDLENGULFING(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLENGULFING(Records: botvs.Record[]): number[]; - /** - * Engulfing Pattern (K线图:吞没) - * - * CDLENGULFING(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLENGULFING(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Evening Doji Star (K线图:黄昏十字星) - * - * CDLEVENINGDOJISTAR(Records[Open,High,Low,Close],Penetration = 0.3) = Array(outInteger) - * - */ - function CDLEVENINGDOJISTAR(Records: botvs.Record[], Penetration: number): number[]; - /** - * Evening Doji Star (K线图:黄昏十字星) - * - * CDLEVENINGDOJISTAR(Records[Open,High,Low,Close],Penetration = 0.3) = Array(outInteger) - * - */ - function CDLEVENINGDOJISTAR( - Open: number[], - High: number[], - Low: number[], - Close: number[], - Penetration: number, - ): number[]; - - /** - * Evening Star (K线图:黄昏之星) - * - * CDLEVENINGSTAR(Records[Open,High,Low,Close],Penetration = 0.3) = Array(outInteger) - * - */ - function CDLEVENINGSTAR(Records: botvs.Record[], Penetration: number): number[]; - /** - * Evening Star (K线图:黄昏之星) - * - * CDLEVENINGSTAR(Records[Open,High,Low,Close],Penetration = 0.3) = Array(outInteger) - * - */ - function CDLEVENINGSTAR( - Open: number[], - High: number[], - Low: number[], - Close: number[], - Penetration: number, - ): number[]; - - /** - * Up/Down-gap side-by-side white lines (K线图:上/下间隙并排的白色线条) - * - * CDLGAPSIDESIDEWHITE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLGAPSIDESIDEWHITE(Records: botvs.Record[]): number[]; - /** - * Up/Down-gap side-by-side white lines (K线图:上/下间隙并排的白色线条) - * - * CDLGAPSIDESIDEWHITE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLGAPSIDESIDEWHITE(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Gravestone Doji (K线图:墓碑十字线) - * - * CDLGRAVESTONEDOJI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLGRAVESTONEDOJI(Records: botvs.Record[]): number[]; - /** - * Gravestone Doji (K线图:墓碑十字线) - * - * CDLGRAVESTONEDOJI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLGRAVESTONEDOJI(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Hammer (K线图:锤) - * - * CDLHAMMER(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHAMMER(Records: botvs.Record[]): number[]; - /** - * Hammer (K线图:锤) - * - * CDLHAMMER(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHAMMER(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Hanging Man (K线图:吊人) - * - * CDLHANGINGMAN(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHANGINGMAN(Records: botvs.Record[]): number[]; - /** - * Hanging Man (K线图:吊人) - * - * CDLHANGINGMAN(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHANGINGMAN(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Harami Pattern (K线图:阴阳线) - * - * CDLHARAMI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHARAMI(Records: botvs.Record[]): number[]; - /** - * Harami Pattern (K线图:阴阳线) - * - * CDLHARAMI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHARAMI(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Harami Cross Pattern (K线图:交叉阴阳线) - * - * CDLHARAMICROSS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHARAMICROSS(Records: botvs.Record[]): number[]; - /** - * Harami Cross Pattern (K线图:交叉阴阳线) - * - * CDLHARAMICROSS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHARAMICROSS(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * High-Wave Candle (K线图:长脚十字线 ) - * - * CDLHIGHWAVE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHIGHWAVE(Records: botvs.Record[]): number[]; - /** - * High-Wave Candle (K线图:长脚十字线 ) - * - * CDLHIGHWAVE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHIGHWAVE(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Hikkake Pattern (K线图:陷阱) - * - * CDLHIKKAKE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHIKKAKE(Records: botvs.Record[]): number[]; - /** - * Hikkake Pattern (K线图:陷阱) - * - * CDLHIKKAKE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHIKKAKE(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Modified Hikkake Pattern (K线图:改良的陷阱) - * - * CDLHIKKAKEMOD(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHIKKAKEMOD(Records: botvs.Record[]): number[]; - /** - * Modified Hikkake Pattern (K线图:改良的陷阱) - * - * CDLHIKKAKEMOD(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHIKKAKEMOD(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Homing Pigeon (K线图:信鸽) - * - * CDLHOMINGPIGEON(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHOMINGPIGEON(Records: botvs.Record[]): number[]; - /** - * Homing Pigeon (K线图:信鸽) - * - * CDLHOMINGPIGEON(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLHOMINGPIGEON(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Identical Three Crows (K线图:相同的三只乌鸦) - * - * CDLIDENTICAL3CROWS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLIDENTICAL3CROWS(Records: botvs.Record[]): number[]; - /** - * Identical Three Crows (K线图:相同的三只乌鸦) - * - * CDLIDENTICAL3CROWS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLIDENTICAL3CROWS(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * In-Neck Pattern (K线图:颈纹) - * - * CDLINNECK(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLINNECK(Records: botvs.Record[]): number[]; - /** - * In-Neck Pattern (K线图:颈纹) - * - * CDLINNECK(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLINNECK(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Inverted Hammer (K线图:倒锤) - * - * CDLINVERTEDHAMMER(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLINVERTEDHAMMER(Records: botvs.Record[]): number[]; - /** - * Inverted Hammer (K线图:倒锤) - * - * CDLINVERTEDHAMMER(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLINVERTEDHAMMER(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Kicking (K线图:踢) - * - * CDLKICKING(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLKICKING(Records: botvs.Record[]): number[]; - /** - * Kicking (K线图:踢) - * - * CDLKICKING(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLKICKING(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Kicking - bull/bear determined by the longer marubozu (K线图:踢牛/踢熊) - * - * CDLKICKINGBYLENGTH(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLKICKINGBYLENGTH(Records: botvs.Record[]): number[]; - /** - * Kicking - bull/bear determined by the longer marubozu (K线图:踢牛/踢熊) - * - * CDLKICKINGBYLENGTH(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLKICKINGBYLENGTH(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Ladder Bottom (K线图:梯底) - * - * CDLLADDERBOTTOM(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLLADDERBOTTOM(Records: botvs.Record[]): number[]; - /** - * Ladder Bottom (K线图:梯底) - * - * CDLLADDERBOTTOM(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLLADDERBOTTOM(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Long Legged Doji (K线图:长腿十字线) - * - * CDLLONGLEGGEDDOJI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLLONGLEGGEDDOJI(Records: botvs.Record[]): number[]; - /** - * Long Legged Doji (K线图:长腿十字线) - * - * CDLLONGLEGGEDDOJI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLLONGLEGGEDDOJI(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Long Line Candle (K线图:长线) - * - * CDLLONGLINE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLLONGLINE(Records: botvs.Record[]): number[]; - /** - * Long Line Candle (K线图:长线) - * - * CDLLONGLINE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLLONGLINE(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Marubozu (K线图:光头光脚 ) - * - * CDLMARUBOZU(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLMARUBOZU(Records: botvs.Record[]): number[]; - /** - * Marubozu (K线图:光头光脚 ) - * - * CDLMARUBOZU(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLMARUBOZU(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Matching Low (K线图:匹配低) - * - * CDLMATCHINGLOW(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLMATCHINGLOW(Records: botvs.Record[]): number[]; - /** - * Matching Low (K线图:匹配低) - * - * CDLMATCHINGLOW(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLMATCHINGLOW(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Mat Hold (K线图:垫住) - * - * CDLMATHOLD(Records[Open,High,Low,Close],Penetration = 0.5) = Array(outInteger) - * - */ - function CDLMATHOLD(Records: botvs.Record[], Penetration: number): number[]; - /** - * Mat Hold (K线图:垫住) - * - * CDLMATHOLD(Records[Open,High,Low,Close],Penetration = 0.5) = Array(outInteger) - * - */ - function CDLMATHOLD( - Open: number[], - High: number[], - Low: number[], - Close: number[], - Penetration: number, - ): number[]; - - /** - * Morning Doji Star (K线图:早晨十字星) - * - * CDLMORNINGDOJISTAR(Records[Open,High,Low,Close],Penetration = 0.3) = Array(outInteger) - * - */ - function CDLMORNINGDOJISTAR(Records: botvs.Record[], Penetration: number): number[]; - /** - * Morning Doji Star (K线图:早晨十字星) - * - * CDLMORNINGDOJISTAR(Records[Open,High,Low,Close],Penetration = 0.3) = Array(outInteger) - * - */ - function CDLMORNINGDOJISTAR( - Open: number[], - High: number[], - Low: number[], - Close: number[], - Penetration: number, - ): number[]; - - /** - * Morning Star (K线图:晨星) - * - * CDLMORNINGSTAR(Records[Open,High,Low,Close],Penetration = 0.3) = Array(outInteger) - * - */ - function CDLMORNINGSTAR(Records: botvs.Record[], Penetration: number): number[]; - /** - * Morning Star (K线图:晨星) - * - * CDLMORNINGSTAR(Records[Open,High,Low,Close],Penetration = 0.3) = Array(outInteger) - * - */ - function CDLMORNINGSTAR( - Open: number[], - High: number[], - Low: number[], - Close: number[], - Penetration: number, - ): number[]; - - /** - * On-Neck Pattern (K线图:颈型) - * - * CDLONNECK(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLONNECK(Records: botvs.Record[]): number[]; - /** - * On-Neck Pattern (K线图:颈型) - * - * CDLONNECK(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLONNECK(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Piercing Pattern (K线图:穿孔模式) - * - * CDLPIERCING(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLPIERCING(Records: botvs.Record[]): number[]; - /** - * Piercing Pattern (K线图:穿孔模式) - * - * CDLPIERCING(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLPIERCING(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Rickshaw Man (K线图:车夫) - * - * CDLRICKSHAWMAN(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLRICKSHAWMAN(Records: botvs.Record[]): number[]; - /** - * Rickshaw Man (K线图:车夫) - * - * CDLRICKSHAWMAN(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLRICKSHAWMAN(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Rising/Falling Three Methods (K线图:上升/下降三法) - * - * CDLRISEFALL3METHODS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLRISEFALL3METHODS(Records: botvs.Record[]): number[]; - /** - * Rising/Falling Three Methods (K线图:上升/下降三法) - * - * CDLRISEFALL3METHODS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLRISEFALL3METHODS(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Separating Lines (K线图:分割线) - * - * CDLSEPARATINGLINES(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSEPARATINGLINES(Records: botvs.Record[]): number[]; - /** - * Separating Lines (K线图:分割线) - * - * CDLSEPARATINGLINES(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSEPARATINGLINES(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Shooting Star (K线图:流星) - * - * CDLSHOOTINGSTAR(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSHOOTINGSTAR(Records: botvs.Record[]): number[]; - /** - * Shooting Star (K线图:流星) - * - * CDLSHOOTINGSTAR(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSHOOTINGSTAR(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Short Line Candle (K线图:短线) - * - * CDLSHORTLINE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSHORTLINE(Records: botvs.Record[]): number[]; - /** - * Short Line Candle (K线图:短线) - * - * CDLSHORTLINE(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSHORTLINE(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Spinning Top (K线图:陀螺) - * - * CDLSPINNINGTOP(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSPINNINGTOP(Records: botvs.Record[]): number[]; - /** - * Spinning Top (K线图:陀螺) - * - * CDLSPINNINGTOP(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSPINNINGTOP(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Stalled Pattern (K线图:停滞模式) - * - * CDLSTALLEDPATTERN(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSTALLEDPATTERN(Records: botvs.Record[]): number[]; - /** - * Stalled Pattern (K线图:停滞模式) - * - * CDLSTALLEDPATTERN(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSTALLEDPATTERN(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Stick Sandwich (K线图:棍子三明治) - * - * CDLSTICKSANDWICH(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSTICKSANDWICH(Records: botvs.Record[]): number[]; - /** - * Stick Sandwich (K线图:棍子三明治) - * - * CDLSTICKSANDWICH(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLSTICKSANDWICH(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Takuri (Dragonfly Doji with very long lower shadow) (K线图:托里) - * - * CDLTAKURI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLTAKURI(Records: botvs.Record[]): number[]; - /** - * Takuri (Dragonfly Doji with very long lower shadow) (K线图:托里) - * - * CDLTAKURI(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLTAKURI(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Tasuki Gap (K线图:翼隙) - * - * CDLTASUKIGAP(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLTASUKIGAP(Records: botvs.Record[]): number[]; - /** - * Tasuki Gap (K线图:翼隙) - * - * CDLTASUKIGAP(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLTASUKIGAP(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Thrusting Pattern (K线图:推模式) - * - * CDLTHRUSTING(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLTHRUSTING(Records: botvs.Record[]): number[]; - /** - * Thrusting Pattern (K线图:推模式) - * - * CDLTHRUSTING(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLTHRUSTING(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Tristar Pattern (K线图:三星模式) - * - * CDLTRISTAR(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLTRISTAR(Records: botvs.Record[]): number[]; - /** - * Tristar Pattern (K线图:三星模式) - * - * CDLTRISTAR(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLTRISTAR(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Unique 3 River (K线图:独特的3河) - * - * CDLUNIQUE3RIVER(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLUNIQUE3RIVER(Records: botvs.Record[]): number[]; - /** - * Unique 3 River (K线图:独特的3河) - * - * CDLUNIQUE3RIVER(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLUNIQUE3RIVER(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Upside Gap Two Crows (K线图:双飞乌鸦) - * - * CDLUPSIDEGAP2CROWS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLUPSIDEGAP2CROWS(Records: botvs.Record[]): number[]; - /** - * Upside Gap Two Crows (K线图:双飞乌鸦) - * - * CDLUPSIDEGAP2CROWS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLUPSIDEGAP2CROWS(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Upside/Downside Gap Three Methods (K线图:上行/下行缺口三方法) - * - * CDLXSIDEGAP3METHODS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLXSIDEGAP3METHODS(Records: botvs.Record[]): number[]; - /** - * Upside/Downside Gap Three Methods (K线图:上行/下行缺口三方法) - * - * CDLXSIDEGAP3METHODS(Records[Open,High,Low,Close]) = Array(outInteger) - * - */ - function CDLXSIDEGAP3METHODS(Open: number[], High: number[], Low: number[], Close: number[]): number[]; - - /** - * Vector Ceil (取整函数) - * - * CEIL(Records[Close]) = Array(outReal) - * - */ - function CEIL(Records: botvs.Record[] | number[]): number[]; - - /** - * Chande Momentum Oscillator (钱德动量摆动指标) - * - * CMO(Records[Close],Time Period = 14) = Array(outReal) - * - */ - function CMO(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Vector Trigonometric Cos (余弦函数) - * - * COS(Records[Close]) = Array(outReal) - * - */ - function COS(Records: botvs.Record[] | number[]): number[]; - - /** - * Vector Trigonometric Cosh (双曲余弦值) - * - * COSH(Records[Close]) = Array(outReal) - * - */ - function COSH(Records: botvs.Record[] | number[]): number[]; - - /** - * Double Exponential Moving Average (双指数移动平均线) - * - * DEMA(Records[Close],Time Period = 30) = Array(outReal) - * - */ - function DEMA(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Directional Movement Index (动向指数) - * - * DX(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function DX(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Directional Movement Index (动向指数) - * - * DX(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function DX(High: number[], Low: number[], Close: number[], TimePeriod: number): number[]; - - /** - * Exponential Moving Average (指数移动平均线) - * - * EMA(Records[Close],Time Period = 30) = Array(outReal) - * - */ - function EMA(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Vector Arithmetic Exp (指数函数) - * - * EXP(Records[Close]) = Array(outReal) - * - */ - function EXP(Records: botvs.Record[] | number[]): number[]; - - /** - * Vector Floor (向下取整) - * - * FLOOR(Records[Close]) = Array(outReal) - * - */ - function FLOOR(Records: botvs.Record[] | number[]): number[]; - - /** - * Hilbert Transform - Dominant Cycle Period (希尔伯特变换, 主周期) - * - * HT_DCPERIOD(Records[Close]) = Array(outReal) - * - */ - function HT_DCPERIOD(Records: botvs.Record[] | number[]): number[]; - - /** - * Hilbert Transform - Dominant Cycle Phase (希尔伯特变换,主阶段) - * - * HT_DCPHASE(Records[Close]) = Array(outReal) - * - */ - function HT_DCPHASE(Records: botvs.Record[] | number[]): number[]; - - /** - * Hilbert Transform - Phasor Components (希尔伯特变换,相成分) - * - * HT_PHASOR(Records[Close]) = [Array(outInPhase),Array(outQuadrature)] - * - */ - function HT_PHASOR(Records: botvs.Record[] | number[]): [number[], number[]]; - - /** - * Hilbert Transform - SineWave (希尔伯特变换,正弦波) - * - * HT_SINE(Records[Close]) = [Array(outSine),Array(outLeadSine)] - * - */ - function HT_SINE(Records: botvs.Record[] | number[]): [number[], number[]]; - - /** - * Hilbert Transform - Instantaneous Trendline (希尔伯特变换,瞬时趋势) - * - * HT_TRENDLINE(Records[Close]) = Array(outReal) - * - */ - function HT_TRENDLINE(Records: botvs.Record[] | number[]): number[]; - - /** - * Hilbert Transform - Trend vs Cycle Mode (希尔伯特变换-趋势与周期模式) - * - * HT_TRENDMODE(Records[Close]) = Array(outInteger) - * - */ - function HT_TRENDMODE(Records: botvs.Record[] | number[]): number[]; - - /** - * Kaufman Adaptive Moving Average (适应性移动平均线) - * - * KAMA(Records[Close],Time Period = 30) = Array(outReal) - * - */ - function KAMA(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Linear Regression (线性回归) - * - * LINEARREG(Records[Close],Time Period = 14) = Array(outReal) - * - */ - function LINEARREG(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Linear Regression Angle (线性回归的角度) - * - * LINEARREG_ANGLE(Records[Close],Time Period = 14) = Array(outReal) - * - */ - function LINEARREG_ANGLE(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Linear Regression Intercept (线性回归截距) - * - * LINEARREG_INTERCEPT(Records[Close],Time Period = 14) = Array(outReal) - * - */ - function LINEARREG_INTERCEPT(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Linear Regression Slope (线性回归斜率) - * - * LINEARREG_SLOPE(Records[Close],Time Period = 14) = Array(outReal) - * - */ - function LINEARREG_SLOPE(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Vector Log Natural (自然对数) - * - * LN(Records[Close]) = Array(outReal) - * - */ - function LN(Records: botvs.Record[] | number[]): number[]; - - /** - * Vector Log10 (对数函数) - * - * LOG10(Records[Close]) = Array(outReal) - * - */ - function LOG10(Records: botvs.Record[] | number[]): number[]; - - /** - * Moving average (移动平均线) - * - * MA(Records[Close],Time Period = 30,MA Type = 0) = Array(outReal) - * - */ - function MA(Records: botvs.Record[] | number[], TimePeriod: number, MAType: number): number[]; - - /** - * Moving Average Convergence/Divergence (指数平滑移动平均线) - * - * MACD(Records[Close],Fast Period = 12,Slow Period = 26,Signal Period = 9) = - * [Array(outMACD),Array(outMACDSignal),Array(outMACDHist)] - * - */ - function MACD( - Records: botvs.Record[] | number[], - FastPeriod: number, - SlowPeriod: number, - SignalPeriod: number, - ): [number[], number[], number[]]; - - /** - * MACD with controllable MA type (MA型可控 MACD) - * - * MACDEXT(Records[Close],Fast Period = 12,Fast MA = 0,Slow Period = 26,Slow MA = 0,Signal Period = 9,Signal MA - * = - * 0) = [Array(outMACD),Array(outMACDSignal),Array(outMACDHist)] - * - */ - function MACDEXT( - Records: botvs.Record[] | number[], - FastPeriod: number, - FastMA: number, - SlowPeriod: number, - SlowMA: number, - SignalPeriod: number, - SignalMA: number, - ): [number[], number[], number[]]; - - /** - * Moving Average Convergence/Divergence Fix 12/26 (移动平均收敛/发散修复12/26) - * - * MACDFIX(Records[Close],Signal Period = 9) = [Array(outMACD),Array(outMACDSignal),Array(outMACDHist)] - * - */ - function MACDFIX(Records: botvs.Record[] | number[], SignalPeriod: number): [number[], number[], number[]]; - - /** - * MESA Adaptive Moving Average (MESA 移动平均线) - * - * MAMA(Records[Close],Fast Limit = 0.5,Slow Limit = 0.05) = [Array(outMAMA),Array(outFAMA)] - * - */ - function MAMA(Records: botvs.Record[] | number[], FastLimit: number, SlowLimit: number): [number[], number[]]; - - /** - * Highest value over a specified period (最大值) - * - * MAX(Records[Close],Time Period = 30) = Array(outReal) - * - */ - function MAX(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Index of highest value over a specified period (最大值索引) - * - * MAXINDEX(Records[Close],Time Period = 30) = Array(outInteger) - * - */ - function MAXINDEX(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Median Price (中位数价格) - * - * MEDPRICE(Records[High,Low]) = Array(outReal) - * - */ - function MEDPRICE(Records: botvs.Record[]): number[]; - /** - * Median Price (中位数价格) - * - * MEDPRICE(Records[High,Low]) = Array(outReal) - * - */ - function MEDPRICE(High: number[], Low: number[]): number[]; - - /** - * Money Flow Index (货币流量指数) - * - * MFI(Records[High,Low,Close,Volume],Time Period = 14) = Array(outReal) - * - */ - function MFI(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Money Flow Index (货币流量指数) - * - * MFI(Records[High,Low,Close,Volume],Time Period = 14) = Array(outReal) - * - */ - function MFI(High: number[], Low: number[], Close: number[], Volume: number[], TimePeriod: number): number[]; - - /** - * MidPoint over period (中点) - * - * MIDPOINT(Records[Close],Time Period = 14) = Array(outReal) - * - */ - function MIDPOINT(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Midpoint Price over period (中点价格) - * - * MIDPRICE(Records[High,Low],Time Period = 14) = Array(outReal) - * - */ - function MIDPRICE(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Midpoint Price over period (中点价格) - * - * MIDPRICE(Records[High,Low],Time Period = 14) = Array(outReal) - * - */ - function MIDPRICE(High: number[], Low: number[], TimePeriod: number): number[]; - - /** - * Lowest value over a specified period (最小值) - * - * MIN(Records[Close],Time Period = 30) = Array(outReal) - * - */ - function MIN(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Index of lowest value over a specified period (最小值索引) - * - * MININDEX(Records[Close],Time Period = 30) = Array(outInteger) - * - */ - function MININDEX(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Lowest and highest values over a specified period (最小最大值) - * - * MINMAX(Records[Close],Time Period = 30) = [Array(outMin),Array(outMax)] - * - */ - function MINMAX(Records: botvs.Record[] | number[], TimePeriod: number): [number[], number[]]; - - /** - * Indexes of lowest and highest values over a specified period (最小最大值索引) - * - * MINMAXINDEX(Records[Close],Time Period = 30) = [Array(outMinIdx),Array(outMaxIdx)] - * - */ - function MINMAXINDEX(Records: botvs.Record[] | number[], TimePeriod: number): [number[], number[]]; - - /** - * Minus Directional Indicator (负向指标) - * - * MINUS_DI(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function MINUS_DI(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Minus Directional Indicator (负向指标) - * - * MINUS_DI(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function MINUS_DI(High: number[], Low: number[], Close: number[], TimePeriod: number): number[]; - - /** - * Minus Directional Movement (负向运动) - * - * MINUS_DM(Records[High,Low],Time Period = 14) = Array(outReal) - * - */ - function MINUS_DM(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Minus Directional Movement (负向运动) - * - * MINUS_DM(Records[High,Low],Time Period = 14) = Array(outReal) - * - */ - function MINUS_DM(High: number[], Low: number[], TimePeriod: number): number[]; - - /** - * Momentum (动量) - * - * MOM(Records[Close],Time Period = 10) = Array(outReal) - * - */ - function MOM(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Normalized Average True Range (归一化平均值范围) - * - * NATR(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function NATR(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Normalized Average True Range (归一化平均值范围) - * - * NATR(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function NATR(High: number[], Low: number[], Close: number[], TimePeriod: number): number[]; - - /** - * On Balance Volume (能量潮) - * - * OBV(Records[Close],Records[Volume]) = Array(outReal) - * - */ - function OBV(Records: botvs.Record[]): number[]; - - /** - * On Balance Volume (能量潮) - * - * OBV(Records[Close],Records[Volume]) = Array(outReal) - * - */ - function OBV(Close: number[], Volume: number[]): number[]; - - /** - * Plus Directional Indicator (更向指示器) - * - * PLUS_DI(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function PLUS_DI(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Plus Directional Indicator (更向指示器) - * - * PLUS_DI(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function PLUS_DI(High: number[], Low: number[], Close: number[], TimePeriod: number): number[]; - - /** - * Plus Directional Movement (定向运动) - * - * PLUS_DM(Records[High,Low],Time Period = 14) = Array(outReal) - * - */ - function PLUS_DM(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Plus Directional Movement (定向运动) - * - * PLUS_DM(Records[High,Low],Time Period = 14) = Array(outReal) - * - */ - function PLUS_DM(High: number[], Low: number[], TimePeriod: number): number[]; - - /** - * Percentage Price Oscillator (价格振荡百分比) - * - * PPO(Records[Close],Fast Period = 12,Slow Period = 26,MA Type = 0) = Array(outReal) - * - */ - function PPO( - Records: botvs.Record[] | number[], - FastPeriod: number, - SlowPeriod: number, - MAType: number, - ): number[]; - - /** - * Rate of change : ((price/prevPrice)-1)*100 (变动率指标) - * - * ROC(Records[Close],Time Period = 10) = Array(outReal) - * - */ - function ROC(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Rate of change Percentage: (price-prevPrice)/prevPrice (价格变化率) - * - * ROCP(Records[Close],Time Period = 10) = Array(outReal) - * - */ - function ROCP(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Rate of change ratio: (price/prevPrice) (价格变化率) - * - * ROCR(Records[Close],Time Period = 10) = Array(outReal) - * - */ - function ROCR(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Rate of change ratio 100 scale: (price/prevPrice)*100 (价格变化率) - * - * ROCR100(Records[Close],Time Period = 10) = Array(outReal) - * - */ - function ROCR100(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Relative Strength Index (相对强弱指标) - * - * RSI(Records[Close],Time Period = 14) = Array(outReal) - * - */ - function RSI(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Parabolic SAR (抛物线转向) - * - * SAR(Records[High,Low],Acceleration Factor = 0.02,AF Maximum = 0.2) = Array(outReal) - * - */ - function SAR(Records: botvs.Record[], AccelerationFactor: number, AFMaximum: number): number[]; - /** - * Parabolic SAR (抛物线转向) - * - * SAR(Records[High,Low],Acceleration Factor = 0.02,AF Maximum = 0.2) = Array(outReal) - * - */ - function SAR(High: number[], Low: number[], AccelerationFactor: number, AFMaximum: number): number[]; - - /** - * Parabolic SAR - Extended (增强型抛物线转向) - * - * SAREXT(Records[High,Low],Start Value = 0,Offset on Reverse = 0,AF Init Long = 0.02,AF Long = 0.02,AF Max - * Long = - * 0.2,AF Init Short = 0.02,AF Short = 0.02,AF Max Short = 0.2) = Array(outReal) - * - */ - function SAREXT( - Records: botvs.Record[], - StartValue: number, - OffsetonReverse: number, - AFInitLong: number, - AFLong: number, - AFMaxLong: number, - AFInitShort: number, - AFShort: number, - AFMaxShort: number, - ): number[]; - /** - * Parabolic SAR - Extended (增强型抛物线转向) - * - * SAREXT(Records[High,Low],Start Value = 0,Offset on Reverse = 0,AF Init Long = 0.02,AF Long = 0.02,AF Max - * Long = - * 0.2,AF Init Short = 0.02,AF Short = 0.02,AF Max Short = 0.2) = Array(outReal) - * - */ - function SAREXT( - High: number[], - Low: number[], - StartValue: number, - OffsetonReverse: number, - AFInitLong: number, - AFLong: number, - AFMaxLong: number, - AFInitShort: number, - AFShort: number, - AFMaxShort: number, - ): number[]; - - /** - * Vector Trigonometric Sin (正弦值) - * - * SIN(Records[Close]) = Array(outReal) - * - */ - function SIN(Records: botvs.Record[] | number[]): number[]; - - /** - * Vector Trigonometric Sinh (双曲正弦函数) - * - * SINH(Records[Close]) = Array(outReal) - * - */ - function SINH(Records: botvs.Record[] | number[]): number[]; - - /** - * Simple Moving Average (简单移动平均) - * - * SMA(Records[Close],Time Period = 30) = Array(outReal) - * - */ - function SMA(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Vector Square Root (平方根) - * - * SQRT(Records[Close]) = Array(outReal) - * - */ - function SQRT(Records: botvs.Record[] | number[]): number[]; - - /** - * Standard Deviation (标准偏差) - * - * STDDEV(Records[Close],Time Period = 5,Deviations = 1) = Array(outReal) - * - */ - function STDDEV(Records: botvs.Record[] | number[], TimePeriod: number, Deviations: number): number[]; - - /** - * Stochastic (STOCH指标) - * - * STOCH(Records[High,Low,Close],Fast-K Period = 5,Slow-K Period = 3,Slow-K MA = 0,Slow-D Period = 3,Slow-D MA - * = 0) - * = [Array(outSlowK),Array(outSlowD)] - * - */ - function STOCH( - Records: botvs.Record[], - Fast_KPeriod: number, - Slow_KPeriod: number, - Slow_KMA: number, - Slow_DPeriod: number, - Slow_DMA: number, - ): [number[], number[]]; - /** - * Stochastic (STOCH指标) - * - * STOCH(Records[High,Low,Close],Fast-K Period = 5,Slow-K Period = 3,Slow-K MA = 0,Slow-D Period = 3,Slow-D MA - * = 0) - * = [Array(outSlowK),Array(outSlowD)] - * - */ - function STOCH( - High: number[], - Low: number[], - Close: number[], - Fast_KPeriod: number, - Slow_KPeriod: number, - Slow_KMA: number, - Slow_DPeriod: number, - Slow_DMA: number, - ): [number[], number[]]; - - /** - * Stochastic Fast (快速STOCH指标) - * - * STOCHF(Records[High,Low,Close],Fast-K Period = 5,Fast-D Period = 3,Fast-D MA = 0) = - * [Array(outFastK),Array(outFastD)] - * - */ - function STOCHF( - Records: botvs.Record[], - Fast_KPeriod: number, - Fast_DPeriod: number, - Fast_DMA: number, - ): [number[], number[]]; - /** - * Stochastic Fast (快速STOCH指标) - * - * STOCHF(Records[High,Low,Close],Fast-K Period = 5,Fast-D Period = 3,Fast-D MA = 0) = - * [Array(outFastK),Array(outFastD)] - * - */ - function STOCHF( - High: number[], - Low: number[], - Close: number[], - Fast_KPeriod: number, - Fast_DPeriod: number, - Fast_DMA: number, - ): [number[], number[]]; - - /** - * Stochastic Relative Strength Index (随机强弱指数) - * - * STOCHRSI(Records[Close],Time Period = 14,Fast-K Period = 5,Fast-D Period = 3,Fast-D MA = 0) = - * [Array(outFastK),Array(outFastD)] - * - */ - function STOCHRSI( - Records: botvs.Record[] | number[], - TimePeriod: number, - Fast_KPeriod: number, - Fast_DPeriod: number, - Fast_DMA: number, - ): [number[], number[]]; - - /** - * Summation (求和) - * - * SUM(Records[Close],Time Period = 30) = Array(outReal) - * - */ - function SUM(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Triple Exponential Moving Average (T3) (三指数移动平均) - * - * T3(Records[Close],Time Period = 5,Volume Factor = 0.7) = Array(outReal) - * - */ - function T3(Records: botvs.Record[] | number[], TimePeriod: number, VolumeFactor: number): number[]; - - /** - * Vector Trigonometric Tan (正切) - * - * TAN(Records[Close]) = Array(outReal) - * - */ - function TAN(Records: botvs.Record[] | number[]): number[]; - - /** - * Vector Trigonometric Tanh (双曲正切函数) - * - * TANH(Records[Close]) = Array(outReal) - * - */ - function TANH(Records: botvs.Record[] | number[]): number[]; - - /** - * Triple Exponential Moving Average (三指数移动平均) - * - * TEMA(Records[Close],Time Period = 30) = Array(outReal) - * - */ - function TEMA(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * True Range (真实范围) - * - * TRANGE(Records[High,Low,Close]) = Array(outReal) - * - */ - function TRANGE(Records: botvs.Record[]): number[]; - /** - * True Range (真实范围) - * - * TRANGE(Records[High,Low,Close]) = Array(outReal) - * - */ - function TRANGE(High: number[], Low: number[], Close: number[]): number[]; - - /** - * Triangular Moving Average (三指数移动平均) - * - * TRIMA(Records[Close],Time Period = 30) = Array(outReal) - * - */ - function TRIMA(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA (三重指数平滑平均线) - * - * TRIX(Records[Close],Time Period = 30) = Array(outReal) - * - */ - function TRIX(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Time Series Forecast (时间序列预测) - * - * TSF(Records[Close],Time Period = 14) = Array(outReal) - * - */ - function TSF(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - - /** - * Typical Price (典型价格) - * - * TYPPRICE(Records[High,Low,Close]) = Array(outReal) - * - */ - function TYPPRICE(Records: botvs.Record[]): number[]; - /** - * Typical Price (典型价格) - * - * TYPPRICE(Records[High,Low,Close]) = Array(outReal) - * - */ - function TYPPRICE(High: number[], Low: number[], Close: number[]): number[]; - - /** - * Ultimate Oscillator (极限振子) - * - * ULTOSC(Records[High,Low,Close],First Period = 7,Second Period = 14,Third Period = 28) = Array(outReal) - * - */ - function ULTOSC( - Records: botvs.Record[], - FirstPeriod: number, - SecondPeriod: number, - ThirdPeriod: number, - ): number[]; - /** - * Ultimate Oscillator (极限振子) - * - * ULTOSC(Records[High,Low,Close],First Period = 7,Second Period = 14,Third Period = 28) = Array(outReal) - * - */ - function ULTOSC( - High: number[], - Low: number[], - Close: number[], - FirstPeriod: number, - SecondPeriod: number, - ThirdPeriod: number, - ): number[]; - - /** - * Variance (变量定义) - * - * VAR(Records[Close],Time Period = 5,Deviations = 1) = Array(outReal) - * - */ - function VAR(Records: botvs.Record[] | number[], TimePeriod: number, Deviations: number): number[]; - - /** - * Weighted Close Price (加权收盘价) - * - * WCLPRICE(Records[High,Low,Close]) = Array(outReal) - * - */ - function WCLPRICE(Records: botvs.Record[]): number[]; - /** - * Weighted Close Price (加权收盘价) - * - * WCLPRICE(Records[High,Low,Close]) = Array(outReal) - * - */ - function WCLPRICE(High: number[], Low: number[], Close: number[]): number[]; - - /** - * Williams' %R (威廉指标) - * - * WILLR(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function WILLR(Records: botvs.Record[], TimePeriod: number): number[]; - /** - * Williams' %R (威廉指标) - * - * WILLR(Records[High,Low,Close],Time Period = 14) = Array(outReal) - * - */ - function WILLR(High: number[], Low: number[], Close: number[], TimePeriod: number): number[]; - - /** - * Weighted Moving Average (加权移动平均) - * - * WMA(Records[Close],Time Period = 30) = Array(outReal) - * - */ - function WMA(Records: botvs.Record[] | number[], TimePeriod: number): number[]; - } - - /** - * 订单的状态: 未完成 - */ - const ORDER_STATE_PENDING: botvs.VOrderState; - - /** - * 订单的状态: 已关闭 - */ - const ORDER_STATE_CLOSED: botvs.VOrderState; - - /** - * 订单的状态: 已取消 - */ - const ORDER_STATE_CANCELED: botvs.VOrderState; - - /** - * 订单的类型: 买单 - */ - const ORDER_TYPE_BUY: botvs.VOrderType; - - /** - * 订单的类型: 卖单 - */ - const ORDER_TYPE_SELL: botvs.VOrderType; - - /** - * 多头仓位(CTP中用closebuy_today平仓) - */ - const PD_LONG: botvs.VPositionType; - - /** - * 空头仓位(CTP用closesell_today)平仓 - */ - const PD_SHORT: botvs.VPositionType; - - /** - * (CTP期货中)PD_LONG_YD为咋日多头仓位(用closebuy平 - */ - const PD_LONG_YD: botvs.VPositionType; - - /** - * 咋日空头仓位(用closesell平) - */ - const PD_SHORT_YD: botvs.VPositionType; - - /** - * 1分钟 - */ - const PERIOD_M1: botvs.VPeriod; - - /** - * 5分钟 - */ - const PERIOD_M5: botvs.VPeriod; - - /** - * 15分钟 - */ - const PERIOD_M15: botvs.VPeriod; - - /** - * 30分钟 - */ - const PERIOD_M30: botvs.VPeriod; - - /** - * 1小时 - */ - const PERIOD_H1: botvs.VPeriod; - - /** - * 1天 - */ - const PERIOD_D1: botvs.VPeriod; - - /** - * 买单日志 - */ - const LOG_TYPE_BUY: botvs.VLogType; - - /** - * 卖单日志 - */ - const LOG_TYPE_SELL: botvs.VLogType; - - /** - * 取消日志 - */ - const LOG_TYPE_CANCEL: botvs.VLogType; - - /** - * 默认主交易所对像, 添加交易平台时排列第一的交易所 - */ - const exchange: botvs.Exchange; - - /** - * 交易所数组, 如果添加多个交易所, 可以访问此变量获取交易所对像 - */ - const exchanges: botvs.Exchange[]; - - /** - * 保存一条信息到日志列表 - * - * 如果在字符串后面加上@字符则消息会进入推送队列, 推送到使用绑定的微信账号上(账户安全里绑定)(50条/小时, 1条/5秒 限制) - * 如: Log("微信你好 !@"); 或Log("微信你好, #ff0000@"); - * Log支持打印base64编码后的图片, 以"`"开头, 以"`"结尾, 如Log("`data:image/png;base64,AAAA`") - * Log支持直接打印Python的matplotlib.pyplot对象, 只要对象包含savefig方法就可以直接Log打印, 如: - * import matplotlib.pyplot as plt - * def main(): - * plt.plot([3,6,2,4,7,1]) - * Log(plt) - * - */ - function Log(arg: string): void; - - /** - * 休眠函数 - * - * 参数为毫秒数,如Sleep(1000)为休眠一秒 - * - */ - function Sleep(Millisecond: number): void; - - /** - * 判断是否是模拟回测 - * - * 模拟回测状态返回true,实盘返回false - * - */ - function IsVirtual(): boolean; - - /** - * 记录盈利值,这个为总盈利的值,参数类型为浮点数 - * - */ - function LogProfit(Profit: number): void; - - /** - * 清空所有收益日志, 可以带一个数字参数, 指定保留的条数 - * - */ - function LogProfitReset(reserve?: number): void; - - /** - * 清空所有日志, 可以带一个数字参数, 指定保留的条数 - * - */ - function LogReset(reserve?: number): void; - - /** - * 此信息不保存到日志列表里, 只更新当前机器人的状态信息, 在日志上方显示, 可多次调用, 更新状态 - * - * * LogStatus('这是一个普通的状态提示'); - * LogStatus('这是一个红色字体的状态提示 #ff0000'); - * LogStatus('这是一个多行的状态信息\n我是第二行'); - * LogStatus支持打印base64编码后的图片, 以"`"开头, 以"`"结尾, 如LogStatus("`data:image/png;base64,AAAA`") - * LogStatus支持直接传入Python的matplotlib.pyplot对象, 只要对象包含savefig方法就可以传入LogStatus, 如: - * import matplotlib.pyplot as plt - * def main(): - * plt.plot([3,6,2,4,7,1]) - * LogStatus(plt) - * var table = {type: 'table', title: '持仓信息', cols: ['列1', '列2'], rows: [ ['abc', 'def'], ['ABC', 'support color - * #ff0000']]}; LogStatus('`' + JSON.stringify(table)+'`'); // JSON序列化后两边加上`字符, 视为一个复杂消息格式(当前支持表格) - * LogStatus('第一行消息\n`' + JSON.stringify(table)+'`\n第三行消息'); - * // 表格信息也可以在多行中出现 LogStatus('`' + JSON.stringify([table, - * table])+'`'); // 支持多个表格同时显示, 将以TAB显示到一组里 - * // 也可以构造一个按钮在表格中, 策略用GetCommand接收cmd属性的内容 - * var table = { - * type: 'table', - * title: '持仓操作', - * cols: ['列1', '列2', 'Action'], - * rows: [ - * ['abc', 'def', {'type':'button', 'cmd': 'coverAll', 'name': '平仓'}], - * ] - * }; - * LogStatus('`' + JSON.stringify(table) + '`') - * // 或者构造一单独的按钮 - * LogStatus('`' + JSON.stringify({'type':'button', 'cmd': 'coverAll', 'name': '平仓'}) + '`') - * // 可以自定义按钮风格(bootstrap的按钮属性) - * LogStatus('`' + JSON.stringify({'type':'button', 'class': 'btn btn-xs btn-danger', 'cmd': 'coverAll', 'name': - * '平仓'}) + '`') - * - */ - function LogStatus(Msg: string): void; - - /** - * 打开或者关闭定单和出错信息的日志记录 - * - */ - function EnableLog(IsEnable: boolean): void; - - /** - * 图表绘图函数 - * - * 参数为可以JSON序列化的HighStocks的Highcharts.StockChart参数, 比原生的参数增加一个 - * __isStock属性, 如果指定__isStock: false, 则显示为普通图表 - * 返回对像可以调用add([series索引(如0), 数据])向指定索引的series添加数据, 调用reset() - * 清空图表数据, reset可以带一个数字参数, 指定保留的条数 - * 可以调用add([series索引(如0), 数据, 此数据在series中的索引])来更改数据 - * 可以为负数, -1指最后一个, -2是倒数第二个, 如: - * chart.add([0, 13.5, -1]), 更改series[0].data的倒数第一个点的数据 - * 支持显示多个图表, 配置时只需传入数组参数即可如: var chart = Chart([{...}, {...}, {...}]), - * 比如图表一有两个series, 图表二有一个series, 图表三有一个series, - * 那么add时指定0与1序列ID代表更新图表1的两个序列的数据, add时指定序列ID为2指图表2的第一个 - * series的数据, 指定序列3指的是图表3的第一个series的数据 HighStocks: - * http://api.highcharts.com/highstock - * - */ - function Chart(...options: botvs.ChartOptions[]): botvs.RChart; - - /** - * 发送邮件函数 - * - * Mail(smtpServer, smtpUsername, smtpPassword, mailTo, title, body); ret true or false - * Mail("smtp.163.com", "asdf@163.com", "password", "111@163.com", "title", "body") - * - */ - function Mail( - smtpServer: string, - smtpUsername: string, - smtpPassword: string, - mailTo: string, - title: string, - body: string, - ): boolean; - - /** - * 错误信息过滤 - * - * 被此正则表达式匹配的错误将不上传到日志系统, 可多次调用设置多个 - * SetErrorFilter("502:|503:|tcp|character|unexpected|network|timeout|WSARecv|Connect|GetAddr|no - * such|reset|http|received|EOF|reused"); - * - */ - function SetErrorFilter(RegEx: string): void; - - /** - * 返回机器人进程ID - * - */ - function GetPid(): number; - - /** - * 获取最近一次出错信息,一般无需使用,因为程序会把出错信息自动上传到日志系统 - * - */ - function GetLastError(): string; - - /** - * 可保存的全局字典表 - * - * KV表, 永久保存在本地文件, 每个机器人单独一个数据库, 重启或者托管者退出后一直存在 - * K必须为数字或者字符串, 不区分大小写, V可以为任何可以JSON序列化的内容 - * _G("num", 1); // 设置一个全局变量num, 值为1 - * _G("num", "ok"); // 更改一个全局变量num, 值为字符串ok - * _G("num", null); // 删除全局变量 num - * _G("num"); // 返回全局变量num的值 - * _G(); // 返回当前机器人的ID - * _G(null); // 删除所有全局变量 - * - */ - function _G(K: string, V: T): void; - - /** - * 获取交互命令(utf-8) - * - * 获取策略交互界面发来的命令并清空, 没有命令则返回null, 返回的命令格式为 "按钮名称:参数", 如果没有参数, 则命令就是按钮名称 - * while (true) { - * var cmd = GetCommand(); - * if (cmd) { - * Log(cmd); - * } - * Sleep(1000); - * } - * - */ - function GetCommand(): string | null; - - /** - * 原始的Socket访问, 支持tcp, udp, tls, unix 协议 - * - * @example - * - * ``` - * var client = Dial("tls://www.baidu.com:443"); // Dial支持tcp://, udp://, tls://, unix:// 协议, 可加一个参数指定超时的秒数 - * if (client) { - * client.write("GET / HTTP/1.1\nConnection: Closed\n\n"); // write可再跟一个数字参数指定超时, write返回成功发送的字节数 - * while (true) { - * var buf = client.read();// read可再跟一个数字参数指定超时, 返回null指出错或者超时或者socket已经关闭 - * if (!buf) { - * break; - * } - * Log(buf); - * } - * client.close(); - * } - * ``` - * - */ - function Dial(Address: string, Timeout?: number): botvs.Socket | void; - - /** - * 网络URL访问 - * - * HttpQuery(Url, PostData, Cookies, Headers, IsReturnHeader) - * 获取一个Url的返回内容, 如果第二个参数PostData为字符串就以POST方式提交 - * 第二个参数PostData可以自定义方法比如HttpQuery('http://www.abc.com', {method:'PUT', data:'xx'}) - * 传递Cookie字符串需要第三个参数, 但不需要POST请将第二个参数置为null - * 模拟测试的时候因为无法模拟访问URL, 函数就返回固定字符串 Dummy Data - * 可以用此接口发送短信, 或者与其它API进行交互 - * HttpQuery("http://www.baidu.com/"); // Get - * HttpQuery("http://www.163.com", "xxx"); // Post - * HttpQuery("http://www.baidu.com/", null, "a=10; b=20", "User-Agent: Mobile\nContent-Type: text/html", true); - * // will return {Header: HTTP Header, Body: HTML} - * - */ - function HttpQuery( - Url: string, - PostData: string | null | { method: string, data?: string }, - Cookies: string, - Headers: string, - ): string; - function HttpQuery( - Url: string, - PostData: string | null | { method: string, data?: string }, - Cookies: string, - Headers: string, - IsReturnHeader: true, - ): { Header: string, Body: string }; - - /** - * 支持 md5/sha256/sha512/sha1 的哈希计算, 只支持实盘 - * - * 第二个参数可设置为raw/hex/base64, 分别指输出加密后的 原始内容/hex编码过的/base64编码过的 - * Log(Hash('md5', 'hex', 'hello')); - * Log(Hash('sha512', 'base64', 'hello')); - * - */ - function Hash( - Algo: 'md5' | 'sha256' | 'sha512' | 'sha1', - OutputAlgo: 'hex' | 'base64' | 'raw', - Data: string, - ): string; - - /** - * 支持 md5/sha256/sha512/sha1 的HMAC加密计算, 只支持实盘 - * - * 第二个参数可设置为raw/hex/base64, 分别指输出加密后的 原始内容/hex编码过的/base64编码过的 - * Log(HMAC('md5', 'hex', 'hello', 'pass')); - * Log(HMAC('sha512', 'base64', 'hello', 'pass')); - * - */ - function HMAC( - Algo: 'md5' | 'sha256' | 'sha512' | 'sha1', - OutputAlgo: 'hex' | 'base64' | 'raw', - Data: string, - password: string, - ): string; - - /** - * 返回指定时间戳(ms)字符串, 不传任何参数就返回当前时间, - * 如_D(),或者_D(1478570053241), 默认格式为yyyy-MM-dd hh:mm:ss - * - */ - function _D(timestamp: string, format: string): string; - - /** - * 格式化一个浮点函数 - * - * @param precision Default 4 - */ - function _N(num: number, precision?: number): string; - - /** - * 重试函数, 会一直调用指定函数到成功返回(函数返回null或者false会重试), - * 比如_C(exchange.GetTicker), 默认重试间隔为3秒, 可以调用_CDelay函数来控制重试间隔 - * 比如_CDelay(1000), 指改变_C函数重试间隔为1秒 - * - */ - function _C(func: (...args: any[]) => T, ...args: any[]): T; - - /** - * 比如_CDelay(1000), 指改变_C函数重试间隔为1秒, 默认为3秒 - * - */ - function _CDelay(delay: number): void; -} diff --git a/types/botvs/tsconfig.json b/types/botvs/tsconfig.json deleted file mode 100644 index 6ec444ef28..0000000000 --- a/types/botvs/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "botvs-tests.ts" - ] -} \ No newline at end of file diff --git a/types/botvs/tslint.json b/types/botvs/tslint.json deleted file mode 100644 index 71ee04c4e1..0000000000 --- a/types/botvs/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "no-unnecessary-generics": false - } -} From 43906454e30d8c73f642d14e8ea319e2b4a8b673 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 10:41:10 -0800 Subject: [PATCH 302/890] cordova plugins: Provide their own types (#22305) --- notNeededPackages.json | 108 +++ .../cordova-plugin-battery-status-tests.ts | 29 - .../cordova-plugin-battery-status/index.d.ts | 37 - .../tsconfig.json | 24 - .../cordova-plugin-battery-status/tslint.json | 79 -- .../cordova-plugin-camera-tests.ts | 11 - types/cordova-plugin-camera/index.d.ts | 174 ---- types/cordova-plugin-camera/tsconfig.json | 24 - types/cordova-plugin-camera/tslint.json | 79 -- .../cordova-plugin-contacts-tests.ts | 16 - types/cordova-plugin-contacts/index.d.ts | 337 ------- types/cordova-plugin-contacts/tsconfig.json | 24 - types/cordova-plugin-contacts/tslint.json | 79 -- .../cordova-plugin-device-motion-tests.ts | 10 - types/cordova-plugin-device-motion/index.d.ts | 77 -- .../tsconfig.json | 24 - .../cordova-plugin-device-motion/tslint.json | 79 -- ...cordova-plugin-device-orientation-tests.ts | 11 - .../index.d.ts | 86 -- .../tsconfig.json | 24 - .../tslint.json | 79 -- .../cordova-plugin-device-tests.ts | 1 - types/cordova-plugin-device/index.d.ts | 41 - types/cordova-plugin-device/tsconfig.json | 24 - types/cordova-plugin-device/tslint.json | 79 -- .../cordova-plugin-dialogs-tests.ts | 2 - types/cordova-plugin-dialogs/index.d.ts | 69 -- types/cordova-plugin-dialogs/tsconfig.json | 24 - types/cordova-plugin-dialogs/tslint.json | 79 -- .../cordova-plugin-file-transfer-tests.ts | 37 - types/cordova-plugin-file-transfer/index.d.ts | 136 --- .../tsconfig.json | 24 - .../cordova-plugin-file-transfer/tslint.json | 79 -- .../cordova-plugin-file-tests.ts | 46 - types/cordova-plugin-file/index.d.ts | 378 -------- types/cordova-plugin-file/tsconfig.json | 24 - types/cordova-plugin-file/tslint.json | 79 -- .../cordova-plugin-globalization-tests.ts | 11 - types/cordova-plugin-globalization/index.d.ts | 260 ------ .../tsconfig.json | 24 - .../cordova-plugin-globalization/tslint.json | 79 -- .../cordova-plugin-inappbrowser-tests.ts | 34 - types/cordova-plugin-inappbrowser/index.d.ts | 103 --- .../cordova-plugin-inappbrowser/tsconfig.json | 24 - types/cordova-plugin-inappbrowser/tslint.json | 7 - .../cordova-plugin-media-capture-tests.ts | 11 - types/cordova-plugin-media-capture/index.d.ts | 167 ---- .../tsconfig.json | 24 - .../cordova-plugin-media-capture/tslint.json | 79 -- .../cordova-plugin-media-tests.ts | 9 - types/cordova-plugin-media/index.d.ts | 84 -- types/cordova-plugin-media/tsconfig.json | 24 - types/cordova-plugin-media/tslint.json | 79 -- ...ordova-plugin-network-information-tests.ts | 6 - .../index.d.ts | 62 -- .../tsconfig.json | 24 - .../tslint.json | 79 -- .../cordova-plugin-splashscreen-tests.ts | 2 - types/cordova-plugin-splashscreen/index.d.ts | 17 - .../cordova-plugin-splashscreen/tsconfig.json | 24 - types/cordova-plugin-splashscreen/tslint.json | 79 -- .../cordova-plugin-statusbar-tests.ts | 12 - types/cordova-plugin-statusbar/index.d.ts | 77 -- types/cordova-plugin-statusbar/tsconfig.json | 24 - types/cordova-plugin-statusbar/tslint.json | 79 -- .../cordova-plugin-vibration-tests.ts | 6 - types/cordova-plugin-vibration/index.d.ts | 45 - types/cordova-plugin-vibration/tsconfig.json | 24 - types/cordova-plugin-vibration/tslint.json | 79 -- .../cordova.plugins.diagnostic-tests.ts | 584 ------------ types/cordova.plugins.diagnostic/index.d.ts | 833 ------------------ .../cordova.plugins.diagnostic/tsconfig.json | 24 - types/cordova.plugins.diagnostic/tslint.json | 79 -- types/ng-cordova/package.json | 8 + 74 files changed, 116 insertions(+), 5603 deletions(-) delete mode 100644 types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts delete mode 100644 types/cordova-plugin-battery-status/index.d.ts delete mode 100644 types/cordova-plugin-battery-status/tsconfig.json delete mode 100644 types/cordova-plugin-battery-status/tslint.json delete mode 100644 types/cordova-plugin-camera/cordova-plugin-camera-tests.ts delete mode 100644 types/cordova-plugin-camera/index.d.ts delete mode 100644 types/cordova-plugin-camera/tsconfig.json delete mode 100644 types/cordova-plugin-camera/tslint.json delete mode 100644 types/cordova-plugin-contacts/cordova-plugin-contacts-tests.ts delete mode 100644 types/cordova-plugin-contacts/index.d.ts delete mode 100644 types/cordova-plugin-contacts/tsconfig.json delete mode 100644 types/cordova-plugin-contacts/tslint.json delete mode 100644 types/cordova-plugin-device-motion/cordova-plugin-device-motion-tests.ts delete mode 100644 types/cordova-plugin-device-motion/index.d.ts delete mode 100644 types/cordova-plugin-device-motion/tsconfig.json delete mode 100644 types/cordova-plugin-device-motion/tslint.json delete mode 100644 types/cordova-plugin-device-orientation/cordova-plugin-device-orientation-tests.ts delete mode 100644 types/cordova-plugin-device-orientation/index.d.ts delete mode 100644 types/cordova-plugin-device-orientation/tsconfig.json delete mode 100644 types/cordova-plugin-device-orientation/tslint.json delete mode 100644 types/cordova-plugin-device/cordova-plugin-device-tests.ts delete mode 100644 types/cordova-plugin-device/index.d.ts delete mode 100644 types/cordova-plugin-device/tsconfig.json delete mode 100644 types/cordova-plugin-device/tslint.json delete mode 100644 types/cordova-plugin-dialogs/cordova-plugin-dialogs-tests.ts delete mode 100644 types/cordova-plugin-dialogs/index.d.ts delete mode 100644 types/cordova-plugin-dialogs/tsconfig.json delete mode 100644 types/cordova-plugin-dialogs/tslint.json delete mode 100644 types/cordova-plugin-file-transfer/cordova-plugin-file-transfer-tests.ts delete mode 100644 types/cordova-plugin-file-transfer/index.d.ts delete mode 100644 types/cordova-plugin-file-transfer/tsconfig.json delete mode 100644 types/cordova-plugin-file-transfer/tslint.json delete mode 100644 types/cordova-plugin-file/cordova-plugin-file-tests.ts delete mode 100644 types/cordova-plugin-file/index.d.ts delete mode 100644 types/cordova-plugin-file/tsconfig.json delete mode 100644 types/cordova-plugin-file/tslint.json delete mode 100644 types/cordova-plugin-globalization/cordova-plugin-globalization-tests.ts delete mode 100644 types/cordova-plugin-globalization/index.d.ts delete mode 100644 types/cordova-plugin-globalization/tsconfig.json delete mode 100644 types/cordova-plugin-globalization/tslint.json delete mode 100644 types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts delete mode 100644 types/cordova-plugin-inappbrowser/index.d.ts delete mode 100644 types/cordova-plugin-inappbrowser/tsconfig.json delete mode 100644 types/cordova-plugin-inappbrowser/tslint.json delete mode 100644 types/cordova-plugin-media-capture/cordova-plugin-media-capture-tests.ts delete mode 100644 types/cordova-plugin-media-capture/index.d.ts delete mode 100644 types/cordova-plugin-media-capture/tsconfig.json delete mode 100644 types/cordova-plugin-media-capture/tslint.json delete mode 100644 types/cordova-plugin-media/cordova-plugin-media-tests.ts delete mode 100644 types/cordova-plugin-media/index.d.ts delete mode 100644 types/cordova-plugin-media/tsconfig.json delete mode 100644 types/cordova-plugin-media/tslint.json delete mode 100644 types/cordova-plugin-network-information/cordova-plugin-network-information-tests.ts delete mode 100644 types/cordova-plugin-network-information/index.d.ts delete mode 100644 types/cordova-plugin-network-information/tsconfig.json delete mode 100644 types/cordova-plugin-network-information/tslint.json delete mode 100644 types/cordova-plugin-splashscreen/cordova-plugin-splashscreen-tests.ts delete mode 100644 types/cordova-plugin-splashscreen/index.d.ts delete mode 100644 types/cordova-plugin-splashscreen/tsconfig.json delete mode 100644 types/cordova-plugin-splashscreen/tslint.json delete mode 100644 types/cordova-plugin-statusbar/cordova-plugin-statusbar-tests.ts delete mode 100644 types/cordova-plugin-statusbar/index.d.ts delete mode 100644 types/cordova-plugin-statusbar/tsconfig.json delete mode 100644 types/cordova-plugin-statusbar/tslint.json delete mode 100644 types/cordova-plugin-vibration/cordova-plugin-vibration-tests.ts delete mode 100644 types/cordova-plugin-vibration/index.d.ts delete mode 100644 types/cordova-plugin-vibration/tsconfig.json delete mode 100644 types/cordova-plugin-vibration/tslint.json delete mode 100644 types/cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts delete mode 100644 types/cordova.plugins.diagnostic/index.d.ts delete mode 100644 types/cordova.plugins.diagnostic/tsconfig.json delete mode 100644 types/cordova.plugins.diagnostic/tslint.json create mode 100644 types/ng-cordova/package.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 233c3b3673..258eb4b018 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -234,6 +234,114 @@ "sourceRepoURL": "https://github.com/jayphelps/core-decorators.js", "asOfVersion": "0.20.0" }, + { + "libraryName": "cordova-plugin-battery-status", + "typingsPackageName": "cordova-plugin-battery-status", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-battery-status", + "asOfVersion": "1.2.3" + }, + { + "libraryName": "cordova-plugin-camera", + "typingsPackageName": "cordova-plugin-camera", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-camera", + "asOfVersion": "2.4.0" + }, + { + "libraryName": "cordova-plugin-contacts", + "typingsPackageName": "cordova-plugin-contacts", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-contacts", + "asOfVersion": "2.3.0" + }, + { + "libraryName": "cordova-plugin-device", + "typingsPackageName": "cordova-plugin-device", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-device", + "asOfVersion": "1.1.5" + }, + { + "libraryName": "cordova-plugin-device-motion", + "typingsPackageName": "cordova-plugin-device-motion", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-device-motion", + "asOfVersion": "1.2.4" + }, + { + "libraryName": "Apache Cordova Device Orientation plugin", + "typingsPackageName": "cordova-plugin-device-orientation", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-device-orientation", + "asOfVersion": "1.0.6" + }, + { + "libraryName": "cordova-plugin-dialogs", + "typingsPackageName": "cordova-plugin-dialogs", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-dialogs", + "asOfVersion": "1.3.2" + }, + { + "libraryName": "Apache Cordova File System plugin", + "typingsPackageName": "cordova-plugin-file", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-file", + "asOfVersion": "4.3.2" + }, + { + "libraryName": "cordova-plugin-file-transfer", + "typingsPackageName": "cordova-plugin-file-transfer", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-file-transfer", + "asOfVersion": "1.6.2" + }, + { + "libraryName": "cordova-plugin-globalization", + "typingsPackageName": "cordova-plugin-globalization", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-globalization", + "asOfVersion": "1.0.6" + }, + { + "libraryName": "cordova-plugin-inappbrowser", + "typingsPackageName": "cordova-plugin-inappbrowser", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-inappbrowser", + "asOfVersion": "1.7.0" + }, + { + "libraryName": "cordova-plugin-media", + "typingsPackageName": "cordova-plugin-media", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-media", + "asOfVersion": "3.0.0" + }, + { + "libraryName": "cordova-plugin-media-capture", + "typingsPackageName": "cordova-plugin-media-capture", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-media-capture", + "asOfVersion": "1.4.2" + }, + { + "libraryName": "cordova-plugin-network-information", + "typingsPackageName": "cordova-plugin-network-information", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-network-information", + "asOfVersion": "1.3.2" + }, + { + "libraryName": "cordova-plugin-splashscreen", + "typingsPackageName": "cordova-plugin-splashscreen", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-splashscreen", + "asOfVersion": "4.0.2" + }, + { + "libraryName": "Apache Cordova StatusBar plugin", + "typingsPackageName": "cordova-plugin-statusbar", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-statusbar", + "asOfVersion": "2.2.2" + }, + { + "libraryName": "Apache Cordova Vibration plugin", + "typingsPackageName": "cordova-plugin-vibration", + "sourceRepoURL": "https://github.com/apache/cordova-plugin-vibration", + "asOfVersion": "2.1.4" + }, + { + "libraryName": "cordova.plugins.diagnostic", + "typingsPackageName": "cordova.plugins.diagnostic", + "sourceRepoURL": "https://github.com/dpa99c/cordova-diagnostic-plugin", + "asOfVersion": "3.7.0" + }, { "libraryName": "cypress", "typingsPackageName": "cypress", diff --git a/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts b/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts deleted file mode 100644 index dbad990b8d..0000000000 --- a/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts +++ /dev/null @@ -1,29 +0,0 @@ -function eventCallBack(ev: BatteryStatusEvent) { - console.log('Battery level is ' + ev.level); -} -window.addEventListener('batterystatus', (ev: BatteryStatusEvent) => { console.log('Battery level is ' + ev.level); }); -window.addEventListener('batterystatus', (ev) => { console.log('Battery level is ' + ev.level); }); -window.addEventListener('batterycritical', (ev) => { console.log('Battery is critical: ' + ev.level); }); -window.addEventListener('batterylow', (ev) => { console.log('Battery is low: ' + ev.level); }); - -window.addEventListener('baterystatus', eventCallBack); -window.addEventListener('batterycritical', eventCallBack); -window.addEventListener('batterylow', eventCallBack); - -window.removeEventListener('batterystatus', eventCallBack); -window.removeEventListener('batterycritical', eventCallBack); -window.removeEventListener('batterylow', eventCallBack); - -window.addEventListener('batterycritical', () => { alert('Battery is critical low!'); }); -window.addEventListener('batterylow', () => { alert('Battery is low!'); }); - -function batteryCriticalCallback() { - alert('Battery is critical low!'); -} - -function batteryLowCallback() { - alert('Battery is critical low!'); -} - -window.addEventListener('batterycritical', batteryCriticalCallback); -window.addEventListener('batterylow', batteryLowCallback); \ No newline at end of file diff --git a/types/cordova-plugin-battery-status/index.d.ts b/types/cordova-plugin-battery-status/index.d.ts deleted file mode 100644 index 0cdf729d30..0000000000 --- a/types/cordova-plugin-battery-status/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Type definitions for Apache Cordova BatteryStatus plugin -// Project: https://github.com/apache/cordova-plugin-battery-status -// Definitions by: Microsoft Open Technologies Inc -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// -// Copyright (c) Microsoft Open Technologies Inc -// Licensed under the MIT license. -// TypeScript Version: 2.3 - -interface WindowEventMap { - /** - * batterystatus: event fires when the percentage of battery charge changes by at least 1 percent, or if the device is plugged in or unplugged. - */ - "batterystatus" : BatteryStatusEvent; - /** - * batterycritical: event fires when the percentage of battery charge has reached the critical battery threshold. The value is device-specific. - */ - "batterycritical": BatteryStatusEvent; - /** - * batterylow: event fires when the percentage of battery charge has reached the low battery threshold, device-specific value. - */ - "batterylow": BatteryStatusEvent; -} - -interface Window { - onbatterystatus: (type: BatteryStatusEvent) => void; - onbatterycritical: (type: BatteryStatusEvent) => void; - onbatterylow: (type: BatteryStatusEvent) => void; -} - -/** Object, that passed into battery event listener */ -interface BatteryStatusEvent extends Event { - /* The percentage of battery charge (0-100). */ - level: number; - /* A boolean that indicates whether the device is plugged in. */ - isPlugged: boolean; -} \ No newline at end of file diff --git a/types/cordova-plugin-battery-status/tsconfig.json b/types/cordova-plugin-battery-status/tsconfig.json deleted file mode 100644 index 0149bb419c..0000000000 --- a/types/cordova-plugin-battery-status/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": false, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cordova-plugin-battery-status-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cordova-plugin-battery-status/tslint.json b/types/cordova-plugin-battery-status/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/cordova-plugin-battery-status/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/cordova-plugin-camera/cordova-plugin-camera-tests.ts b/types/cordova-plugin-camera/cordova-plugin-camera-tests.ts deleted file mode 100644 index 2f1b661775..0000000000 --- a/types/cordova-plugin-camera/cordova-plugin-camera-tests.ts +++ /dev/null @@ -1,11 +0,0 @@ -navigator.camera.getPicture( - (data: string) => { alert('Got photo!'); }, - (message: string)=> { alert('Failed!: ' + message); }, - { - allowEdit: true, - cameraDirection: Camera.Direction.BACK, - destinationType: Camera.DestinationType.FILE_URI, - encodingType: Camera.EncodingType.JPEG, - sourceType: Camera.PictureSourceType.PHOTOLIBRARY, - quality: 80 - }); diff --git a/types/cordova-plugin-camera/index.d.ts b/types/cordova-plugin-camera/index.d.ts deleted file mode 100644 index 48c8f8ae5c..0000000000 --- a/types/cordova-plugin-camera/index.d.ts +++ /dev/null @@ -1,174 +0,0 @@ -// Type definitions for Apache Cordova Camera plugin -// Project: https://github.com/apache/cordova-plugin-camera -// Definitions by: Microsoft Open Technologies Inc -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// -// Copyright (c) Microsoft Open Technologies Inc -// Licensed under the MIT license. - -interface Navigator { - /** - * This plugin provides an API for taking pictures and for choosing images from the system's image library. - */ - camera: Camera; -} - -/** - * This plugin provides an API for taking pictures and for choosing images from the system's image library. - */ -interface Camera { - /** - * Removes intermediate photos taken by the camera from temporary storage. - * @param onSuccess Success callback, that called when cleanup succeeds. - * @param onError Error callback, that get an error message. - */ - cleanup( - onSuccess: () => void, - onError: (message: string) => void): void; - /** - * Takes a photo using the camera, or retrieves a photo from the device's image gallery. - * @param cameraSuccess Success callback, that get the image - * as a base64-encoded String, or as the URI for the image file. - * @param cameraError Error callback, that get an error message. - * @param cameraOptions Optional parameters to customize the camera settings. - */ - getPicture( - cameraSuccess: (data: string) => void, - cameraError: (message: string) => void, - cameraOptions?: CameraOptions): void; - // Next will work only on iOS - //getPicture( - // cameraSuccess: (data: string) => void, - // cameraError: (message: string) => void, - // cameraOptions?: CameraOptions): CameraPopoverHandle; -} - -interface CameraOptions { - /** Picture quality in range 0-100. Default is 50 */ - quality?: number; - /** - * Choose the format of the return value. - * Defined in navigator.camera.DestinationType. Default is FILE_URI. - * DATA_URL : 0, Return image as base64-encoded string - * FILE_URI : 1, Return image file URI - * NATIVE_URI : 2 Return image native URI - * (e.g., assets-library:// on iOS or content:// on Android) - */ - destinationType?: number; - /** - * Set the source of the picture. - * Defined in navigator.camera.PictureSourceType. Default is CAMERA. - * PHOTOLIBRARY : 0, - * CAMERA : 1, - * SAVEDPHOTOALBUM : 2 - */ - sourceType?: number; - /** Allow simple editing of image before selection. */ - allowEdit?: boolean; - /** - * Choose the returned image file's encoding. - * Defined in navigator.camera.EncodingType. Default is JPEG - * JPEG : 0 Return JPEG encoded image - * PNG : 1 Return PNG encoded image - */ - encodingType?: number; - /** - * Width in pixels to scale image. Must be used with targetHeight. - * Aspect ratio remains constant. - */ - targetWidth?: number; - /** - * Height in pixels to scale image. Must be used with targetWidth. - * Aspect ratio remains constant. - */ - targetHeight?: number; - /** - * Set the type of media to select from. Only works when PictureSourceType - * is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType - * PICTURE: 0 allow selection of still pictures only. DEFAULT. - * Will return format specified via DestinationType - * VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI - * ALLMEDIA : 2 allow selection from all media types - */ - mediaType?: number; - /** Rotate the image to correct for the orientation of the device during capture. */ - correctOrientation?: boolean; - /** Save the image to the photo album on the device after capture. */ - saveToPhotoAlbum?: boolean; - /** - * Choose the camera to use (front- or back-facing). - * Defined in navigator.camera.Direction. Default is BACK. - * FRONT: 0 - * BACK: 1 - */ - cameraDirection?: number; - /** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */ - popoverOptions?: CameraPopoverOptions; -} - -/** - * A handle to the popover dialog created by navigator.camera.getPicture. Used on iOS only. - */ -interface CameraPopoverHandle { - /** - * Set the position of the popover. - * @param popoverOptions the CameraPopoverOptions that specify the new position. - */ - setPosition(popoverOptions: CameraPopoverOptions): void; -} - -/** - * iOS-only parameters that specify the anchor element location and arrow direction - * of the popover when selecting images from an iPad's library or album. - */ -interface CameraPopoverOptions { - x: number; - y: number; - width: number; - height: number; - /** - * Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection - * Matches iOS UIPopoverArrowDirection constants. - * ARROW_UP : 1, - * ARROW_DOWN : 2, - * ARROW_LEFT : 4, - * ARROW_RIGHT : 8, - * ARROW_ANY : 15 - */ - arrowDir : number; -} - -declare var Camera: { - // Camera constants, defined in Camera plugin - DestinationType: { - DATA_URL: number; - FILE_URI: number; - NATIVE_URI: number - } - Direction: { - BACK: number; - FRONT: number; - } - EncodingType: { - JPEG: number; - PNG: number; - } - MediaType: { - PICTURE: number; - VIDEO: number; - ALLMEDIA: number; - } - PictureSourceType: { - PHOTOLIBRARY: number; - CAMERA: number; - SAVEDPHOTOALBUM: number; - } - // Used only on iOS - PopoverArrowDirection: { - ARROW_UP: number; - ARROW_DOWN: number; - ARROW_LEFT: number; - ARROW_RIGHT: number; - ARROW_ANY: number; - } -}; \ No newline at end of file diff --git a/types/cordova-plugin-camera/tsconfig.json b/types/cordova-plugin-camera/tsconfig.json deleted file mode 100644 index 267426a6fa..0000000000 --- a/types/cordova-plugin-camera/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cordova-plugin-camera-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cordova-plugin-camera/tslint.json b/types/cordova-plugin-camera/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/cordova-plugin-camera/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/cordova-plugin-contacts/cordova-plugin-contacts-tests.ts b/types/cordova-plugin-contacts/cordova-plugin-contacts-tests.ts deleted file mode 100644 index 26243ab43a..0000000000 --- a/types/cordova-plugin-contacts/cordova-plugin-contacts-tests.ts +++ /dev/null @@ -1,16 +0,0 @@ -var contact: Contact = navigator.contacts.create({ - nickname: 'John Smith', - displayName: 'John Smith', - phoneNumbers: [{ pref: true, type: "work", value: "+185642556856" }] -}); - -navigator.contacts.find(["phoneNumbers"], - (contacts: Contact[])=> { alert('Find ' + contacts.length + ' contacts'); }, - (error: ContactError) => { alert('Error: ' + error.message); }, - new ContactFindOptions("+1", true) -); - -navigator.contacts.pickContact( - (contact: Contact)=> { console.log(contact); }, - (err: ContactError)=> { console.log(err.message); } -); diff --git a/types/cordova-plugin-contacts/index.d.ts b/types/cordova-plugin-contacts/index.d.ts deleted file mode 100644 index f0979ba6c2..0000000000 --- a/types/cordova-plugin-contacts/index.d.ts +++ /dev/null @@ -1,337 +0,0 @@ -// Type definitions for Apache Cordova Contacts plugin -// Project: https://github.com/apache/cordova-plugin-contacts -// Definitions by: Microsoft Open Technologies Inc -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// -// Copyright (c) Microsoft Open Technologies, Inc. -// Licensed under the MIT license. - -interface Navigator { - /** Provides access to the device contacts database. */ - contacts: Contacts; -} - -interface Contacts { - /** - * The navigator.contacts.create method is synchronous, and returns a new Contact object. - * This method does not retain the Contact object in the device contacts database, - * for which you need to invoke the Contact.save method. - * @param properties Object with contact fields - */ - create(properties?: ContactProperties): Contact; - /** - * The navigator.contacts.find method executes asynchronously, querying the device contacts database - * and returning an array of Contact objects. The resulting objects are passed to the onSuccess - * callback function specified by the onSuccess parameter. - * @param fields The fields parameter specifies the fields to be used as a search qualifier, - * and only those results are passed to the onSuccess callback function. A zero-length fields parameter - * is invalid and results in ContactError.INVALID_ARGUMENT_ERROR. A contactFields value of "*" returns all contact fields. - * @param onSuccess Success callback function invoked with the array of Contact objects returned from the database - * @param onError Error callback function, invoked when an error occurs. - * @param options Search options to filter navigator.contacts. - */ - find(fields: string[], - onSuccess: (contacts: Contact[]) => void, - onError?: (error: ContactError) => void, - options?: ContactFindOptions): void; - /** - * The navigator.contacts.pickContact method launches the Contact Picker to select a single contact. - * The resulting object is passed to the contactSuccess callback function specified by the contactSuccess parameter. - * @param onSuccess Success callback function invoked with the array of Contact objects returned from the database - * @param onError Error callback function, invoked when an error occurs. - */ - pickContact(onSuccess: (contact: Contact) => void, - onError: (error: ContactError) => void): void - - /** - * This allows us to use an enumeration when setting the desired fields for the ContactFindOptions. - * The values will correspond to the type of string literals in ContactFieldType. - */ - fieldType: { - addresses: "addresses", - birthday: "birthday", - categories: "categories", - country: "country", - department: "department", - displayName: "displayName", - emails: "emails", - familyName: "familyName", - formatted: "formatted", - givenName: "givenName", - honorificPrefix: "honorificPrefix", - honorificSuffix: "honorificSuffix", - id: "id", - ims: "ims", - locality: "locality", - middleName: "middleName", - name: "name", - nickname: "nickname", - note: "note", - organizations: "organizations", - phoneNumbers: "phoneNumbers", - photos: "photos", - postalCode: "postalCode", - region: "region", - streetAddress: "streetAddress", - title: "title", - urls: "urls" - } -} - -interface ContactProperties { - /** A globally unique identifier. */ - id?: string; - /** The name of this Contact, suitable for display to end users. */ - displayName?: string; - /** An object containing all components of a persons name. */ - name?: ContactName; - /** A casual name by which to address the contact. */ - nickname?: string; - /** An array of all the contact's phone numbers. */ - phoneNumbers?: ContactField[]; - /** An array of all the contact's email addresses. */ - emails?: ContactField[]; - /** An array of all the contact's addresses. */ - addresses?: ContactAddress[]; - /** An array of all the contact's IM addresses. */ - ims?: ContactField[]; - /** An array of all the contact's organizations. */ - organizations?: ContactOrganization[]; - /** The birthday of the contact. */ - birthday?: Date; - /** A note about the contact. */ - note?: string; - /** An array of the contact's photos. */ - photos?: ContactField[]; - /** An array of all the user-defined categories associated with the contact. */ - categories?: ContactField[]; - /** An array of web pages associated with the contact. */ - urls?: ContactField[]; -} - -/** - * The Contact object represents a user's contact. Contacts can be created, stored, or removed - * from the device contacts database. Contacts can also be retrieved (individually or in bulk) - * from the database by invoking the navigator.contacts.find method. - */ -interface Contact extends ContactProperties { - /** - * Returns a new Contact object that is a deep copy of the calling object, with the id property set to null - */ - clone(): Contact; - /** - * Removes the contact from the device contacts database, otherwise executes an error callback with a ContactError object. - * @param onSuccess Success callback function invoked on success operation. - * @param onError Error callback function, invoked when an error occurs. - */ - remove( - onSuccess: () => void, - onError: (error: Error) => void): void; - /** - * Saves a new contact to the device contacts database, or updates an existing contact if a contact with the same id already exists. - * @param onSuccess Success callback function invoked on success operation with che Contact object. - * @param onError Error callback function, invoked when an error occurs. - */ - save( - onSuccess: (contact: Contact) => void, - onError: (error: Error) => void): void; -} - -declare var Contact: { - /** Constructor of Contact object */ - new (id?: string, - displayName?: string, - name?: ContactName, - nickname?: string, - phoneNumbers?: ContactField[], - emails?: ContactField[], - addresses?: ContactAddress[], - ims?: ContactField[], - organizations?: ContactOrganization[], - birthday?: Date, - note?: string, - photos?: ContactField[], - categories?: ContactField, - urls?: ContactField[]): Contact -}; - -/** The ContactError object is returned to the user through the contactError callback function when an error occurs. */ -interface ContactError { - /** Error code */ - code: number; - /** Error message */ - message: string; -} - -declare var ContactError: { - new (code: number): ContactError; - UNKNOWN_ERROR: number; - INVALID_ARGUMENT_ERROR: number; - TIMEOUT_ERROR: number; - PENDING_OPERATION_ERROR: number; - IO_ERROR: number; - NOT_SUPPORTED_ERROR: number; - PERMISSION_DENIED_ERROR: number -}; - -/** Contains different kinds of information about a Contact object's name. */ -interface ContactName { - /** The complete name of the contact. */ - formatted?: string; - /** The contact's family name. */ - familyName?: string; - /** The contact's given name. */ - givenName?: string; - /** The contact's middle name. */ - middleName?: string; - /** The contact's prefix (example Mr. or Dr.) */ - honorificPrefix?: string; - /** The contact's suffix (example Esq.). */ - honorificSuffix?: string; -} - -declare var ContactName: { - /** Constructor for ContactName object */ - new (formatted?: string, - familyName?: string, - givenName?: string, - middleName?: string, - honorificPrefix?: string, - honorificSuffix?: string): ContactName -}; - -/** - * The ContactField object is a reusable component that represents contact fields generically. - * Each ContactField object contains a value, type, and pref property. A Contact object stores - * several properties in ContactField[] arrays, such as phone numbers and email addresses. - * - * In most instances, there are no pre-determined values for a ContactField object's type attribute. - * For example, a phone number can specify type values of home, work, mobile, iPhone, - * or any other value that is supported by a particular device platform's contact database. - * However, for the Contact photos field, the type field indicates the format of the returned image: - * url when the value attribute contains a URL to the photo image, or base64 when the value - * contains a base64-encoded image string. - */ -interface ContactField { - /** A string that indicates what type of field this is, home for example. */ - type: string; - /** The value of the field, such as a phone number or email address. */ - value: string; - /** Set to true if this ContactField contains the user's preferred value. */ - pref: boolean; -} - -declare var ContactField: { - /** Constructor for ContactField object */ - new (type?: string, - value?: string, - pref?: boolean): ContactField -}; - -/** - * The ContactAddress object stores the properties of a single address of a contact. - * A Contact object may include more than one address in a ContactAddress[] array. - */ -interface ContactAddress { - /** Set to true if this ContactAddress contains the user's preferred value. */ - pref?: boolean; - /** A string indicating what type of field this is, home for example. */ - type?: string; - /** The full address formatted for display. */ - formatted?: string; - /** The full street address. */ - streetAddress?: string; - /** The city or locality. */ - locality?: string; - /** The state or region. */ - region?: string; - /** The zip code or postal code. */ - postalCode?: string; - /** The country name. */ - country?: string; -} - -declare var ContactAddress: { - /** Constructor of ContactAddress object */ - new (pref?: boolean, - type?: string, - formatted?: string, - streetAddress?: string, - locality?: string, - region?: string, - postalCode?: string, - country?: string): ContactAddress -}; - -/** - * The ContactOrganization object stores a contact's organization properties. A Contact object stores - * one or more ContactOrganization objects in an array. - */ -interface ContactOrganization { - /** Set to true if this ContactOrganization contains the user's preferred value. */ - pref?: boolean; - /** A string that indicates what type of field this is, home for example. */ - type?: string; - /** The name of the organization. */ - name?: string; - /** The department the contract works for. */ - department?: string; - /** The contact's title at the organization. */ - title?: string; -} - -declare var ContactOrganization: { - /** Constructor for ContactOrganization object */ - new (pref?: boolean, - type?: string, - name?: string, - department?: string, - title?: string): ContactOrganization -}; - -/** Search options to filter navigator.contacts. */ -interface ContactFindOptions { - /** The search string used to find navigator.contacts. */ - filter?: string; - /** Determines if the find operation returns multiple navigator.contacts. */ - multiple?: boolean; - /* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */ - desiredFields?: ContactFieldType[]; -} - -/** these are the string values that are valid for the desired fields in ContactFindOptions */ -declare type ContactFieldType = - "addresses" - | "birthday" - | "categories" - | "country" - | "department" - | "displayName" - | "emails" - | "familyName" - | "formatted" - | "givenName" - | "honorificPrefix" - | "honorificSuffix" - | "id" - | "ims" - | "locality" - | "middleName" - | "name" - | "nickname" - | "note" - | "organizations" - | "phoneNumbers" - | "photos" - | "postalCode" - | "region" - | "streetAddress" - | "title" - | "urls"; - -declare var ContactFindOptions: { - /** Constructor for ContactFindOptions object */ - new (filter?: string, - multiple?: boolean, - desiredFields?: ContactFieldType[]): ContactFindOptions -}; diff --git a/types/cordova-plugin-contacts/tsconfig.json b/types/cordova-plugin-contacts/tsconfig.json deleted file mode 100644 index 6217f6ac02..0000000000 --- a/types/cordova-plugin-contacts/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": false, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cordova-plugin-contacts-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cordova-plugin-contacts/tslint.json b/types/cordova-plugin-contacts/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/cordova-plugin-contacts/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/cordova-plugin-device-motion/cordova-plugin-device-motion-tests.ts b/types/cordova-plugin-device-motion/cordova-plugin-device-motion-tests.ts deleted file mode 100644 index 1b335beaf7..0000000000 --- a/types/cordova-plugin-device-motion/cordova-plugin-device-motion-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -navigator.accelerometer.getCurrentAcceleration( - (acc: Acceleration) => { console.log('X: ' + acc.x + 'Y: ' + acc.y + 'Z: ' + acc.z); }, - () => { alert('Error!'); }); - -var acchandle: WatchHandle = navigator.accelerometer.watchAcceleration( - (acc: Acceleration)=> { console.log('X: ' + acc.x + 'Y: ' + acc.y + 'Z: ' + acc.z); }, - () => { alert('Error!'); }, - { frequency: 10 }); - -navigator.accelerometer.clearWatch(acchandle); diff --git a/types/cordova-plugin-device-motion/index.d.ts b/types/cordova-plugin-device-motion/index.d.ts deleted file mode 100644 index ae38803fd2..0000000000 --- a/types/cordova-plugin-device-motion/index.d.ts +++ /dev/null @@ -1,77 +0,0 @@ -// Type definitions for Apache Cordova Device Motion plugin -// Project: https://github.com/apache/cordova-plugin-device-motion -// Definitions by: Microsoft Open Technologies Inc -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// -// Copyright (c) Microsoft Open Technologies Inc -// Licensed under the MIT license. - -interface Navigator { - /** - * This plugin provides access to the device's accelerometer. The accelerometer is a motion sensor - * that detects the change (delta) in movement relative to the current device orientation, - * in three dimensions along the x, y, and z axis. - */ - accelerometer: Accelerometer; -} - -/** - * This plugin provides access to the device's accelerometer. The accelerometer is a motion sensor - * that detects the change (delta) in movement relative to the current device orientation, - * in three dimensions along the x, y, and z axis. - */ -interface Accelerometer { - /** - * Stop watching the Acceleration referenced by the watchID parameter. - * @param watchID The ID returned by navigator.accelerometer.watchAcceleration. - */ - clearWatch(watchID: WatchHandle): void; - /** - * Get the current acceleration along the x, y, and z axes. - * These acceleration values are returned to the accelerometerSuccess callback function. - * @param accelerometerSuccess Success callback that gets the Acceleration object. - * @param accelerometerError Success callback - */ - getCurrentAcceleration( - accelerometerSuccess: (acceleration: Acceleration) => void, - accelerometerError: () => void): void; - /** - * Retrieves the device's current Acceleration at a regular interval, executing the - * accelerometerSuccess callback function each time. Specify the interval in milliseconds - * via the acceleratorOptions object's frequency parameter. - * The returned watch ID references the accelerometer's watch interval, and can be used - * with navigator.accelerometer.clearWatch to stop watching the accelerometer. - * @param accelerometerSuccess Callback, that called at every time interval and passes an Acceleration object. - * @param accelerometerError Error callback. - * @param accelerometerOptions Object with options for watchAcceleration - */ - watchAcceleration( - accelerometerSuccess: (acceleration: Acceleration) => void, - accelerometerError: () => void, - accelerometerOptions?: AccelerometerOptions): WatchHandle; -} - -/** - * Contains Accelerometer data captured at a specific point in time. Acceleration values include - * the effect of gravity (9.81 m/s^2), so that when a device lies flat and facing up, x, y, and z - * values returned should be 0, 0, and 9.81. - */ -interface Acceleration { - /** Amount of acceleration on the x-axis. (in m/s^2) */ - x: number; - /** Amount of acceleration on the y-axis. (in m/s^2) */ - y: number; - /** Amount of acceleration on the z-axis. (in m/s^2) */ - z: number; - /** Creation timestamp in milliseconds. */ - timestamp: number; -} - -/** Object with options for watchAcceleration */ -interface AccelerometerOptions { - /** How often to retrieve the Acceleration in milliseconds. (Default: 10000) */ - frequency?: number; -} - -/** Abstract type for watch IDs used by Accelerometer. Values of these type are actually `number` at runtime.*/ -interface WatchHandle { } \ No newline at end of file diff --git a/types/cordova-plugin-device-motion/tsconfig.json b/types/cordova-plugin-device-motion/tsconfig.json deleted file mode 100644 index ac897b5d8b..0000000000 --- a/types/cordova-plugin-device-motion/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": false, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cordova-plugin-device-motion-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cordova-plugin-device-motion/tslint.json b/types/cordova-plugin-device-motion/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/cordova-plugin-device-motion/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/cordova-plugin-device-orientation/cordova-plugin-device-orientation-tests.ts b/types/cordova-plugin-device-orientation/cordova-plugin-device-orientation-tests.ts deleted file mode 100644 index ab025d5fbf..0000000000 --- a/types/cordova-plugin-device-orientation/cordova-plugin-device-orientation-tests.ts +++ /dev/null @@ -1,11 +0,0 @@ -navigator.compass.getCurrentHeading( - (heading: CompassHeading)=> { console.log('Got heading to ' + heading.magneticHeading); }, - (error: CompassError)=> { alert('Error! ' + error.code); }, - { frequency: 10 }); - -var accelhandle = navigator.compass.watchHeading( - (heading: CompassHeading) => { console.log('Got heading to ' + heading.magneticHeading); }, - (error: CompassError) => { alert('Error! ' + error.code); }, - { frequency: 10 }); - -navigator.compass.clearWatch(accelhandle); diff --git a/types/cordova-plugin-device-orientation/index.d.ts b/types/cordova-plugin-device-orientation/index.d.ts deleted file mode 100644 index dcd9654efa..0000000000 --- a/types/cordova-plugin-device-orientation/index.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -// Type definitions for Apache Cordova Device Orientation plugin -// Project: https://github.com/apache/cordova-plugin-device-orientation -// Definitions by: Microsoft Open Technologies Inc -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// -// Copyright (c) Microsoft Open Technologies Inc -// Licensed under the MIT license. - -interface Navigator { - /** - * This plugin provides access to the device's compass. The compass is a sensor that detects - * the direction or heading that the device is pointed, typically from the top of the device. - * It measures the heading in degrees from 0 to 359.99, where 0 is north. - */ - compass: Compass; -} - -/** - * This plugin provides access to the device's compass. The compass is a sensor that detects - * the direction or heading that the device is pointed, typically from the top of the device. - * It measures the heading in degrees from 0 to 359.99, where 0 is north. - */ -interface Compass { - /** - * Get the current compass heading. The compass heading is returned via a CompassHeading - * object using the onSuccess callback function. - * @param onSuccess Success callback that passes CompassHeading object. - * @param onError Error callback that passes CompassError object. - */ - getCurrentHeading( - onSuccess: (heading: CompassHeading) => void, - onError: (error: CompassError) => void, - options?: CompassOptions): void; - /** - * Gets the device's current heading at a regular interval. Each time the heading is retrieved, - * the headingSuccess callback function is executed. The returned watch ID references the compass - * watch interval. The watch ID can be used with navigator.compass.clearWatch to stop watching - * the navigator.compass. - * @param onSuccess Success callback that passes CompassHeading object. - * @param onError Error callback that passes CompassError object. - * @param options CompassOptions object - */ - watchHeading( - onSuccess: (heading: CompassHeading) => void, - onError: (error: CompassError) => void, - options?: CompassOptions): number; - /** - * Stop watching the compass referenced by the watch ID parameter. - * @param id The ID returned by navigator.compass.watchHeading. - */ - clearWatch(id: number): void; -} - -/** A CompassHeading object is returned to the compassSuccess callback function. */ -interface CompassHeading { - /** The heading in degrees from 0-359.99 at a single moment in time. */ - magneticHeading: number; - /** The heading relative to the geographic North Pole in degrees 0-359.99 at a single moment in time. A negative value indicates that the true heading can't be determined. */ - trueHeading: number; - /** The deviation in degrees between the reported heading and the true heading. */ - headingAccuracy: number; - /** The time at which this heading was determined. */ - timestamp: number; -} - -interface CompassOptions { - filter?: number; - frequency?: number; -} - -/** A CompassError object is returned to the onError callback function when an error occurs. */ -interface CompassError { - /** - * One of the predefined error codes - * CompassError.COMPASS_INTERNAL_ERR - * CompassError.COMPASS_NOT_SUPPORTED - */ - code: number; -} - -declare var CompassError: { - /** Constructor for CompassError object */ - new(code: number): CompassError; - COMPASS_INTERNAL_ERR: number; - COMPASS_NOT_SUPPORTED: number -} \ No newline at end of file diff --git a/types/cordova-plugin-device-orientation/tsconfig.json b/types/cordova-plugin-device-orientation/tsconfig.json deleted file mode 100644 index 9b5d7a2f53..0000000000 --- a/types/cordova-plugin-device-orientation/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cordova-plugin-device-orientation-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cordova-plugin-device-orientation/tslint.json b/types/cordova-plugin-device-orientation/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/cordova-plugin-device-orientation/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/cordova-plugin-device/cordova-plugin-device-tests.ts b/types/cordova-plugin-device/cordova-plugin-device-tests.ts deleted file mode 100644 index cb894785c2..0000000000 --- a/types/cordova-plugin-device/cordova-plugin-device-tests.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(JSON.stringify(device)); \ No newline at end of file diff --git a/types/cordova-plugin-device/index.d.ts b/types/cordova-plugin-device/index.d.ts deleted file mode 100644 index 0451afb4de..0000000000 --- a/types/cordova-plugin-device/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Type definitions for Apache Cordova Device plugin -// Project: https://github.com/apache/cordova-plugin-device -// Definitions by: Microsoft Open Technologies Inc -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// -// Copyright (c) Microsoft Open Technologies Inc -// Licensed under the MIT license - -/** - * This plugin defines a global device object, which describes the device's hardware and software. - * Although the object is in the global scope, it is not available until after the deviceready event. - */ -interface Device { - /** Get the version of Cordova running on the device. */ - cordova: string; - /** Indicates that Cordova initialize successfully. */ - available: boolean; - /** - * The device.model returns the name of the device's model or product. The value is set - * by the device manufacturer and may be different across versions of the same product. - */ - model: string; - /** Get the device's operating system name. */ - platform: string; - /** Get the device's Universally Unique Identifier (UUID). */ - uuid: string; - /** Get the operating system version. */ - version: string; - /** Get the device's manufacturer. */ - manufacturer: string; - /** Whether the device is running on a simulator. */ - isVirtual: boolean; - /** Get the device hardware serial number. */ - serial: string; -} - -interface Window { - device: Device; -} - -declare var device: Device; diff --git a/types/cordova-plugin-device/tsconfig.json b/types/cordova-plugin-device/tsconfig.json deleted file mode 100644 index 43170b45db..0000000000 --- a/types/cordova-plugin-device/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": false, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cordova-plugin-device-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cordova-plugin-device/tslint.json b/types/cordova-plugin-device/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/cordova-plugin-device/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/cordova-plugin-dialogs/cordova-plugin-dialogs-tests.ts b/types/cordova-plugin-dialogs/cordova-plugin-dialogs-tests.ts deleted file mode 100644 index 498d7d1000..0000000000 --- a/types/cordova-plugin-dialogs/cordova-plugin-dialogs-tests.ts +++ /dev/null @@ -1,2 +0,0 @@ -navigator.notification.alert('Alert!', () => { alert('You\'re alerted'); }, 'Alert', 'Ok'); -navigator.notification.confirm('Are you ok?', (choice: number) => { alert('Your choice is ' + choice); }); diff --git a/types/cordova-plugin-dialogs/index.d.ts b/types/cordova-plugin-dialogs/index.d.ts deleted file mode 100644 index 8a4035bf01..0000000000 --- a/types/cordova-plugin-dialogs/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -// Type definitions for Apache Cordova Dialogs plugin -// Project: https://github.com/apache/cordova-plugin-dialogs -// Definitions by: Microsoft Open Technologies Inc -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// -// Copyright (c) Microsoft Open Technologies Inc -// Licensed under the MIT license. - -interface Navigator { - /** This plugin provides access to some native dialog UI elements. */ - notification: Notification -} - -/** This plugin provides access to some native dialog UI elements. */ -interface Notification { - /** - * Shows a custom alert or dialog box. Most Cordova implementations use a native dialog box for this feature, - * but some platforms use the browser's alert function, which is typically less customizable. - * @param message Dialog message. - * @param alertCallback Callback to invoke when alert dialog is dismissed. - * @param title Dialog title, defaults to 'Alert'. - * @param buttonName Button name, defaults to OK. - */ - alert(message: string, - alertCallback: () => void, - title?: string, - buttonName?: string): void; - /** - * The device plays a beep sound. - * @param times The number of times to repeat the beep. - */ - beep(times: number): void; - /** - * Displays a customizable confirmation dialog box. - * @param message Dialog message. - * @param confirmCallback Callback to invoke with index of button pressed (1, 2, or 3) - * or when the dialog is dismissed without a button press (0). - * @param title Dialog title, defaults to Confirm. - * @param buttonLabels Array of strings specifying button labels, defaults to [OK,Cancel]. - */ - confirm(message: string, - confirmCallback: (choice: number) => void, - title?: string, - buttonLabels?: string[]): void; - /** - * Displays a native dialog box that is more customizable than the browser's prompt function. - * @param message Dialog message. - * @param promptCallback Callback to invoke when a button is pressed. - * @param title Dialog title, defaults to "Prompt". - * @param buttonLabels Array of strings specifying button labels, defaults to ["OK","Cancel"]. - * @param defaultText Default textbox input value, default: "". - */ - prompt(message: string, - promptCallback: (result: NotificationPromptResult) => void, - title?: string, - buttonLabels?: string[], - defaultText?: string): void; -} - -/** Object, passed to promptCallback */ -interface NotificationPromptResult { - /** - * The index of the pressed button. Note that the index uses one-based indexing, so the value is 1, 2, 3, etc. - * 0 is the result when the dialog is dismissed without a button press. - */ - buttonIndex: number; - /** The text entered in the prompt dialog box. */ - input1: string; -} \ No newline at end of file diff --git a/types/cordova-plugin-dialogs/tsconfig.json b/types/cordova-plugin-dialogs/tsconfig.json deleted file mode 100644 index 0f12ab4850..0000000000 --- a/types/cordova-plugin-dialogs/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": false, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cordova-plugin-dialogs-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cordova-plugin-dialogs/tslint.json b/types/cordova-plugin-dialogs/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/cordova-plugin-dialogs/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/cordova-plugin-file-transfer/cordova-plugin-file-transfer-tests.ts b/types/cordova-plugin-file-transfer/cordova-plugin-file-transfer-tests.ts deleted file mode 100644 index eec24db2e0..0000000000 --- a/types/cordova-plugin-file-transfer/cordova-plugin-file-transfer-tests.ts +++ /dev/null @@ -1,37 +0,0 @@ -var file = new FileTransfer(); - -file.onprogress = (ev: ProgressEvent) => { - if (ev.lengthComputable) { - console.log(ev.loaded + '/' + ev.total); - } -}; - -file.download('http://some.server.com/download.php', - 'cdvfile://localhost/persistent/path/to/downloads/', - (file: FileEntry)=> { console.log('File Downloaded to ' + file.fullPath); }, - (err: FileTransferError) => { - console.error('Error ' + err.code); - if (err.exception) { - console.error('Failed with exception ' + err.exception); - } - }, - true, - { - headers: { - "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA==" - } - }); - -file.upload('cdvfile://localhost/persistent/path/to/downloads/', - 'http://some.server.com/download.php', - (result: FileUploadResult)=> { console.log('File uploaded. Bytes uploaded: ' + result.bytesSent); }, - (err: FileTransferError) => { - console.error('Error ' + err.code); - if (err.exception) { - console.error('Failed with exception ' + err.exception); - } - }, - { headers: {"X-Email": "user@mail.com", 'X-Token': "asdf3w234"}, httpMethod: "PUT" }, - true); - -file.abort(); diff --git a/types/cordova-plugin-file-transfer/index.d.ts b/types/cordova-plugin-file-transfer/index.d.ts deleted file mode 100644 index ad8d9945f5..0000000000 --- a/types/cordova-plugin-file-transfer/index.d.ts +++ /dev/null @@ -1,136 +0,0 @@ -// Type definitions for Apache Cordova FileTransfer plugin -// Project: https://github.com/apache/cordova-plugin-file-transfer -// Definitions by: Microsoft Open Technologies Inc. -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// -// Copyright (c) Microsoft Open Technologies Inc -// Licensed under the MIT license - -/// - -/** - * The FileTransfer object provides a way to upload files using an HTTP multi-part POST request, - * and to download files as well. - */ -interface FileTransfer { - /** Called with a ProgressEvent whenever a new chunk of data is transferred. */ - onprogress: (event: ProgressEvent) => void; - /** - * Sends a file to a server. - * @param fileURL Filesystem URL representing the file on the device. For backwards compatibility, - * this can also be the full path of the file on the device. - * @param server URL of the server to receive the file, as encoded by encodeURI(). - * @param successCallback A callback that is passed a FileUploadResult object. - * @param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult. - * Invoked with a FileTransferError object. - * @param options Optional parameters. - * @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. - * This is useful since Android rejects self-signed security certificates. - * Not recommended for production use. Supported on Android and iOS. - */ - upload( - fileURL: string, - server: string, - successCallback: (result: FileUploadResult) => void, - errorCallback: (error: FileTransferError) => void, - options?: FileUploadOptions, - trustAllHosts?: boolean): void; - /** - * downloads a file from server. - * @param source URL of the server to download the file, as encoded by encodeURI(). - * @param target Filesystem url representing the file on the device. For backwards compatibility, - * this can also be the full path of the file on the device. - * @param successCallback A callback that is passed a FileEntry object. (Function) - * @param errorCallback A callback that executes if an error occurs when retrieving the fileEntry. - * Invoked with a FileTransferError object. - * @param options Optional parameters. - * @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. - * This is useful since Android rejects self-signed security certificates. - * Not recommended for production use. Supported on Android and iOS. - */ - download( - source: string, - target: string, - successCallback: (fileEntry: FileEntry) => void, - errorCallback: (error: FileTransferError) => void, - trustAllHosts?: boolean, - options?: FileDownloadOptions): void; - /** - * Aborts an in-progress transfer. The onerror callback is passed a FileTransferError object - * which has an error code of FileTransferError.ABORT_ERR. - */ - abort(): void; -} - -declare var FileTransfer: { - new (): FileTransfer; -}; - -/** A FileUploadResult object is passed to the success callback of the FileTransfer object's upload() method. */ -interface FileUploadResult { - /** The number of bytes sent to the server as part of the upload. */ - bytesSent: number; - /** The HTTP response code returned by the server. */ - responseCode: number; - /** The HTTP response returned by the server. */ - response: string; - /** The HTTP response headers by the server. Currently supported on iOS only.*/ - headers: any; -} - -/** Optional parameters for upload method. */ -interface FileUploadOptions { - /** The name of the form element. Defaults to file. */ - fileKey?: string; - /** The file name to use when saving the file on the server. Defaults to image.jpg. */ - fileName?: string; - /** The HTTP method to use - either `PUT` or `POST`. Defaults to `POST`. */ - httpMethod?: string; - /** The mime type of the data to upload. Defaults to image/jpeg. */ - mimeType?: string; - /** A set of optional key/value pairs to pass in the HTTP request. */ - params?: Object; - /** Whether to upload the data in chunked streaming mode. Defaults to true. */ - chunkedMode?: boolean; - /** A map of header name/header values. Use an array to specify more than one value. */ - headers?: Object; -} - -/** Optional parameters for download method. */ -interface FileDownloadOptions { - /** A map of header name/header values. */ - headers?: {}; -} - -/** A FileTransferError object is passed to an error callback when an error occurs. */ -interface FileTransferError { - /** - * One of the predefined error codes listed below. - * FileTransferError.FILE_NOT_FOUND_ERR - * FileTransferError.INVALID_URL_ERR - * FileTransferError.CONNECTION_ERR - * FileTransferError.ABORT_ERR - * FileTransferError.NOT_MODIFIED_ERR - */ - code: number; - /** URL to the source. */ - source: string; - /** URL to the target. */ - target: string; - /** HTTP status code. This attribute is only available when a response code is received from the HTTP connection. */ - http_status: number; - /* Response body. This attribute is only available when a response is received from the HTTP connection. */ - body: string; - /* Exception that is thrown by native code */ - exception: any; -} - -declare var FileTransferError: { - /** Constructor for FileTransferError object */ - new (code?: number, source?: string, target?: string, status?: number, body?: any, exception?: any): FileTransferError; - FILE_NOT_FOUND_ERR: number; - INVALID_URL_ERR: number; - CONNECTION_ERR: number; - ABORT_ERR: number; - NOT_MODIFIED_ERR: number; -} \ No newline at end of file diff --git a/types/cordova-plugin-file-transfer/tsconfig.json b/types/cordova-plugin-file-transfer/tsconfig.json deleted file mode 100644 index eaa8a05e18..0000000000 --- a/types/cordova-plugin-file-transfer/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cordova-plugin-file-transfer-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cordova-plugin-file-transfer/tslint.json b/types/cordova-plugin-file-transfer/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/cordova-plugin-file-transfer/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/cordova-plugin-file/cordova-plugin-file-tests.ts b/types/cordova-plugin-file/cordova-plugin-file-tests.ts deleted file mode 100644 index 37538434e3..0000000000 --- a/types/cordova-plugin-file/cordova-plugin-file-tests.ts +++ /dev/null @@ -1,46 +0,0 @@ -/// - -function fsaccessor(fs: FileSystem) { - console.log('FS root is: ' + fs.root.name); - var fsreader: DirectoryReader = fs.root.createReader(); - fsreader.readEntries( - (entries: Entry[]) => { console.log(fs.root.name + ' has ' + entries.length + ' child elements'); }, - (err: FileError)=> { alert('Error: ' + err.code); }); -} - -window.requestFileSystem( - LocalFileSystem.TEMPORARY, - 1024 * 1024 * 5, - fsaccessor, - (err: FileError) => { alert('Error: ' + err.code); } -); - -window.requestFileSystem( - LocalFileSystem.PERSISTENT, - 1024 * 1024 * 5, - fsaccessor, - (err: FileError) => { alert('Error: ' + err.code); } -); - -window.resolveLocalFileSystemURI(cordova.file.applicationDirectory, - (entry: Entry)=> { - if (entry.isDirectory) { - console.log('successfully resolved ' + entry.fullPath + 'directory'); - console.log(entry.toURL()); - console.log(entry.toInternalURL()); - } else { - var fentry = entry; - fentry.file((f: File) => { console.log(f.slice(f.size - 10, f.size)); }); - fentry.createWriter((writer: FileWriter)=> { - if (writer.readyState == FileWriter.INIT) { - console.log('Init FileWriter'); - writer.write(new Blob(['sdfdsfsdf'])); - writer.onprogress = function(ev: ProgressEvent) { - console.log('Writing ' + ev.target); - }; - } - }); - } - }, - (error: FileError) => { console.log(error.code); } -); \ No newline at end of file diff --git a/types/cordova-plugin-file/index.d.ts b/types/cordova-plugin-file/index.d.ts deleted file mode 100644 index 6aadbf6fad..0000000000 --- a/types/cordova-plugin-file/index.d.ts +++ /dev/null @@ -1,378 +0,0 @@ -// Type definitions for Apache Cordova File System plugin -// Project: https://github.com/apache/cordova-plugin-file -// Definitions by: Microsoft Open Technologies Inc -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// -// Copyright (c) Microsoft Open Technologies, Inc. -// Licensed under the MIT license. - -interface Window { - /** - * Requests a filesystem in which to store application data. - * @param type Whether the filesystem requested should be persistent, as defined above. Use one of TEMPORARY or PERSISTENT. - * @param size This is an indicator of how much storage space, in bytes, the application expects to need. - * @param successCallback The callback that is called when the user agent provides a filesystem. - * @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is denied. - */ - requestFileSystem( - type: LocalFileSystem, - size: number, - successCallback: (fileSystem: FileSystem) => void, - errorCallback?: (fileError: FileError) => void): void; - /** - * Look up file system Entry referred to by local URL. - * @param string url URL referring to a local file or directory - * @param successCallback invoked with Entry object corresponding to URL - * @param errorCallback invoked if error occurs retrieving file system entry - */ - resolveLocalFileSystemURL(url: string, - successCallback: (entry: Entry) => void, - errorCallback?: (error: FileError) => void): void; - /** - * Look up file system Entry referred to by local URI. - * @param string uri URI referring to a local file or directory - * @param successCallback invoked with Entry object corresponding to URI - * @param errorCallback invoked if error occurs retrieving file system entry - */ - resolveLocalFileSystemURI(uri: string, - successCallback: (entry: Entry) => void, - errorCallback?: (error: FileError) => void): void; - TEMPORARY: number; - PERSISTENT: number; -} - -/** This interface represents a file system. */ -interface FileSystem { - /* The name of the file system, unique across the list of exposed file systems. */ - name: string; - /** The root directory of the file system. */ - root: DirectoryEntry; -} - -/** - * An abstract interface representing entries in a file system, - * each of which may be a File or DirectoryEntry. - */ -interface Entry { - /** Entry is a file. */ - isFile: boolean; - /** Entry is a directory. */ - isDirectory: boolean; - /** The name of the entry, excluding the path leading to it. */ - name: string; - /** The full absolute path from the root to the entry. */ - fullPath: string; - /** The file system on which the entry resides. */ - fileSystem: FileSystem; - nativeURL: string; - /** - * Look up metadata about this entry. - * @param successCallback A callback that is called with the time of the last modification. - * @param errorCallback A callback that is called when errors happen. - */ - getMetadata( - successCallback: (metadata: Metadata) => void, - errorCallback?: (error: FileError) => void): void; - /** - * Move an entry to a different location on the file system. It is an error to try to: - * move a directory inside itself or to any child at any depth;move an entry into its parent if a name different from its current one isn't provided; - * move a file to a path occupied by a directory; - * move a directory to a path occupied by a file; - * move any element to a path occupied by a directory which is not empty. - * A move of a file on top of an existing file must attempt to delete and replace that file. - * A move of a directory on top of an existing empty directory must attempt to delete and replace that directory. - * @param parent The directory to which to move the entry. - * @param newName The new name of the entry. Defaults to the Entry's current name if unspecified. - * @param successCallback A callback that is called with the Entry for the new location. - * @param errorCallback A callback that is called when errors happen. - */ - moveTo(parent: DirectoryEntry, - newName?: string, - successCallback?: (entry: Entry) => void, - errorCallback?: (error: FileError) => void): void; - /** - * Copy an entry to a different location on the file system. It is an error to try to: - * copy a directory inside itself or to any child at any depth; - * copy an entry into its parent if a name different from its current one isn't provided; - * copy a file to a path occupied by a directory; - * copy a directory to a path occupied by a file; - * copy any element to a path occupied by a directory which is not empty. - * A copy of a file on top of an existing file must attempt to delete and replace that file. - * A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory. - * Directory copies are always recursive--that is, they copy all contents of the directory. - * @param parent The directory to which to move the entry. - * @param newName The new name of the entry. Defaults to the Entry's current name if unspecified. - * @param successCallback A callback that is called with the Entry for the new object. - * @param errorCallback A callback that is called when errors happen. - */ - copyTo(parent: DirectoryEntry, - newName?: string, - successCallback?: (entry: Entry) => void, - errorCallback?: (error: FileError) => void): void; - /** - * Returns a URL that can be used as the src attribute of a