mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-29 00:00:29 -04:00
SQL Operations Studio Public Preview 1 (0.23) release source code
This commit is contained in:
3052
src/typings/globals/core-js/index.d.ts
vendored
Normal file
3052
src/typings/globals/core-js/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
src/typings/globals/core-js/typings.json
Normal file
8
src/typings/globals/core-js/typings.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"resolution": "main",
|
||||
"tree": {
|
||||
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/3c56e866d6edd234416a92c3d35c15ccd7fe6b72/core-js/index.d.ts",
|
||||
"raw": "registry:dt/core-js#0.9.7+20161130133742",
|
||||
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/3c56e866d6edd234416a92c3d35c15ccd7fe6b72/core-js/index.d.ts"
|
||||
}
|
||||
}
|
||||
1909
src/typings/globals/jqueryui/index.d.ts
vendored
Normal file
1909
src/typings/globals/jqueryui/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
src/typings/globals/jqueryui/typings.json
Normal file
8
src/typings/globals/jqueryui/typings.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"resolution": "main",
|
||||
"tree": {
|
||||
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/ead8376ca80553332af7872f9fe723c6fbb4e412/jqueryui/index.d.ts",
|
||||
"raw": "registry:dt/jqueryui#1.11.0+20161214061125",
|
||||
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/ead8376ca80553332af7872f9fe723c6fbb4e412/jqueryui/index.d.ts"
|
||||
}
|
||||
}
|
||||
1744
src/typings/globals/slickgrid/index.d.ts
vendored
Normal file
1744
src/typings/globals/slickgrid/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
src/typings/globals/slickgrid/typings.json
Normal file
8
src/typings/globals/slickgrid/typings.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"resolution": "main",
|
||||
"tree": {
|
||||
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5607f54defce88bc52a0440288f434cafffdb5ce/slickgrid/index.d.ts",
|
||||
"raw": "registry:dt/slickgrid#2.1.0+20160818215330",
|
||||
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5607f54defce88bc52a0440288f434cafffdb5ce/slickgrid/index.d.ts"
|
||||
}
|
||||
}
|
||||
335
src/typings/globals/systemjs/index.d.ts
vendored
Normal file
335
src/typings/globals/systemjs/index.d.ts
vendored
Normal file
@@ -0,0 +1,335 @@
|
||||
// Generated by typings
|
||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/968736e629cc8052c98c8d5e892e73e0679bec6c/systemjs/index.d.ts
|
||||
declare namespace SystemJSLoader {
|
||||
|
||||
type ModulesList = { [bundleName: string]: Array<string> };
|
||||
|
||||
type PackageList<T> = { [packageName: string]: T };
|
||||
|
||||
/**
|
||||
* The following module formats are supported:
|
||||
*
|
||||
* - esm: ECMAScript Module (previously referred to as es6)
|
||||
* - cjs: CommonJS
|
||||
* - amd: Asynchronous Module Definition
|
||||
* - global: Global shim module format
|
||||
* - register: System.register or System.registerDynamic compatibility module format
|
||||
*
|
||||
*/
|
||||
type ModuleFormat = "esm" | "cjs" | "amd" | "global" | "register";
|
||||
|
||||
/**
|
||||
* Sets the module name of the transpiler to be used for loading ES6 modules.
|
||||
* Represents a module name for System.import that must resolve to either Traceur, Babel or TypeScript.
|
||||
* When set to traceur, babel or typescript, loading will be automatically configured as far as possible.
|
||||
*/
|
||||
type Transpiler = "plugin-traceur" | "plugin-babel" | "plugin-typescript" | "traceur" | "babel" | "typescript" | boolean;
|
||||
|
||||
type ConfigMap = PackageList<string>;
|
||||
|
||||
type ConfigMeta = PackageList<MetaConfig>;
|
||||
|
||||
interface MetaConfig {
|
||||
/**
|
||||
* Sets in what format the module is loaded.
|
||||
*/
|
||||
format?: ModuleFormat;
|
||||
|
||||
/**
|
||||
* For the global format, when automatic detection of exports is not enough, a custom exports meta value can be set.
|
||||
* This tells the loader what global name to use as the module's export value.
|
||||
*/
|
||||
exports?: string;
|
||||
|
||||
/**
|
||||
* Dependencies to load before this module. Goes through regular paths and map normalization.
|
||||
* Only supported for the cjs, amd and global formats.
|
||||
*/
|
||||
deps?: Array<string>;
|
||||
|
||||
/**
|
||||
* A map of global names to module names that should be defined only for the execution of this module.
|
||||
* Enables use of legacy code that expects certain globals to be present.
|
||||
* Referenced modules automatically becomes dependencies. Only supported for the cjs and global formats.
|
||||
*/
|
||||
globals?: string;
|
||||
|
||||
/**
|
||||
* Set a loader for this meta path.
|
||||
*/
|
||||
loader?: string;
|
||||
|
||||
/**
|
||||
* For plugin transpilers to set the source map of their transpilation.
|
||||
*/
|
||||
sourceMap?: any;
|
||||
|
||||
/**
|
||||
* Load the module using <script> tag injection.
|
||||
*/
|
||||
scriptLoad?: boolean;
|
||||
|
||||
/**
|
||||
* The nonce attribute to use when loading the script as a way to enable CSP.
|
||||
* This should correspond to the "nonce-" attribute set in the Content-Security-Policy header.
|
||||
*/
|
||||
nonce?: string;
|
||||
|
||||
/**
|
||||
* The subresource integrity attribute corresponding to the script integrity,
|
||||
* describing the expected hash of the final code to be executed.
|
||||
* For example, System.config({ meta: { 'src/example.js': { integrity: 'sha256-e3b0c44...' }});
|
||||
* would throw an error if the translated source of src/example.js doesn't match the expected hash.
|
||||
*/
|
||||
integrity?: string;
|
||||
|
||||
/**
|
||||
* When scripts are loaded from a different domain (e.g. CDN) the global error handler (window.onerror)
|
||||
* has very limited information about errors to prevent unintended leaking. In order to mitigate this,
|
||||
* the <script> tags need to set crossorigin attribute and the server needs to enable CORS.
|
||||
* The valid values are "anonymous" and "use-credentials".
|
||||
*/
|
||||
crossOrigin?: string;
|
||||
|
||||
/**
|
||||
* When loading a module that is not an ECMAScript Module, we set the module as the default export,
|
||||
* but then also iterate the module object and copy named exports for it a well.
|
||||
* Use this option to disable this iteration and copying of the exports.
|
||||
*/
|
||||
esmExports?: boolean;
|
||||
|
||||
/**
|
||||
* To ignore resources that shouldn't be traced as part of the build.
|
||||
* Use with the SystemJS Builder. (https://github.com/systemjs/builder#ignore-resources)
|
||||
*/
|
||||
build?: boolean;
|
||||
}
|
||||
|
||||
interface PackageConfig {
|
||||
/**
|
||||
* The main entry point of the package (so import 'local/package' is equivalent to import 'local/package/index.js')
|
||||
*/
|
||||
main?: string;
|
||||
|
||||
/**
|
||||
* The module format of the package. See Module Formats.
|
||||
*/
|
||||
format?: ModuleFormat;
|
||||
|
||||
/**
|
||||
* The default extension to add to modules requested within the package. Takes preference over defaultJSExtensions.
|
||||
* Can be set to defaultExtension: false to optionally opt-out of extension-adding when defaultJSExtensions is enabled.
|
||||
*/
|
||||
defaultExtension?: boolean | string;
|
||||
|
||||
/**
|
||||
* Local and relative map configurations scoped to the package. Apply for subpaths as well.
|
||||
*/
|
||||
map?: ConfigMap;
|
||||
|
||||
/**
|
||||
* Module meta provides an API for SystemJS to understand how to load modules correctly.
|
||||
* Package-scoped meta configuration with wildcard support. Modules are subpaths within the package path.
|
||||
* This also provides an opt-out mechanism for defaultExtension, by adding modules here that should skip extension adding.
|
||||
*/
|
||||
meta?: ConfigMeta;
|
||||
}
|
||||
|
||||
interface TraceurOptions {
|
||||
properTailCalls?: boolean;
|
||||
symbols?: boolean;
|
||||
arrayComprehension?: boolean;
|
||||
asyncFunctions?: boolean;
|
||||
asyncGenerators?: any;
|
||||
forOn?: boolean;
|
||||
generatorComprehension?: boolean;
|
||||
}
|
||||
|
||||
interface Config {
|
||||
/**
|
||||
* For custom config names
|
||||
*/
|
||||
[customName: string]: any;
|
||||
|
||||
/**
|
||||
* The baseURL provides a special mechanism for loading modules relative to a standard reference URL.
|
||||
*/
|
||||
baseURL?: string;
|
||||
|
||||
/**
|
||||
* Set the Babel transpiler options when System.transpiler is set to babel.
|
||||
*/
|
||||
//TODO: Import BabelCore.TransformOptions
|
||||
babelOptions?: any;
|
||||
|
||||
/**
|
||||
* undles allow a collection of modules to be downloaded together as a package whenever any module from that collection is requested.
|
||||
* Useful for splitting an application into sub-modules for production. Use with the SystemJS Builder.
|
||||
*/
|
||||
bundles?: ModulesList;
|
||||
|
||||
/**
|
||||
* Backwards-compatibility mode for the loader to automatically add '.js' extensions when not present to module requests.
|
||||
* This allows code written for SystemJS 0.16 or less to work easily in the latest version:
|
||||
*/
|
||||
defaultJSExtensions?: boolean;
|
||||
|
||||
/**
|
||||
* An alternative to bundling providing a solution to the latency issue of progressively loading dependencies.
|
||||
* When a module specified in depCache is loaded, asynchronous loading of its pre-cached dependency list begins in parallel.
|
||||
*/
|
||||
depCache?: ModulesList;
|
||||
|
||||
/**
|
||||
* The map option is similar to paths, but acts very early in the normalization process.
|
||||
* It allows you to map a module alias to a location or package:
|
||||
*/
|
||||
map?: ConfigMap;
|
||||
|
||||
/**
|
||||
* Module meta provides an API for SystemJS to understand how to load modules correctly.
|
||||
* Meta is how we set the module format of a module, or know how to shim dependencies of a global script.
|
||||
*/
|
||||
meta?: ConfigMeta;
|
||||
|
||||
/**
|
||||
* Packages provide a convenience for setting meta and map configuration that is specific to a common path.
|
||||
* In addition packages allow for setting contextual map configuration which only applies within the package itself.
|
||||
* This allows for full dependency encapsulation without always needing to have all dependencies in a global namespace.
|
||||
*/
|
||||
packages?: PackageList<PackageConfig>;
|
||||
|
||||
/**
|
||||
* The ES6 Module Loader paths implementation, applied after normalization and supporting subpaths via wildcards.
|
||||
* It is usually advisable to use map configuration over paths unless you need strict control over normalized module names.
|
||||
*/
|
||||
paths?: PackageList<string>;
|
||||
|
||||
/**
|
||||
* Set the Traceur compilation options.
|
||||
*/
|
||||
traceurOptions?: TraceurOptions;
|
||||
|
||||
/**
|
||||
* Sets the module name of the transpiler to be used for loading ES6 modules.
|
||||
*/
|
||||
transpiler?: Transpiler;
|
||||
|
||||
trace?: boolean;
|
||||
|
||||
/**
|
||||
* Sets the TypeScript transpiler options.
|
||||
*/
|
||||
//TODO: Import Typescript.CompilerOptions
|
||||
typescriptOptions?: any;
|
||||
}
|
||||
|
||||
interface SystemJSSystemFields {
|
||||
env: string;
|
||||
loaderErrorStack: boolean;
|
||||
packageConfigPaths: Array<string>;
|
||||
pluginFirst: boolean;
|
||||
version: string;
|
||||
warnings: boolean;
|
||||
}
|
||||
|
||||
interface System extends Config, SystemJSSystemFields {
|
||||
/**
|
||||
* For backwards-compatibility with AMD environments, set window.define = System.amdDefine.
|
||||
*/
|
||||
amdDefine: Function;
|
||||
|
||||
/**
|
||||
* For backwards-compatibility with AMD environments, set window.require = System.amdRequire.
|
||||
*/
|
||||
amdRequire: Function;
|
||||
|
||||
/**
|
||||
* SystemJS configuration helper function.
|
||||
* Once SystemJS has loaded, configuration can be set on SystemJS by using the configuration function System.config.
|
||||
*/
|
||||
config(config: Config): void;
|
||||
|
||||
/**
|
||||
* This represents the System base class, which can be extended or reinstantiated to create a custom System instance.
|
||||
*/
|
||||
constructor: new () => System;
|
||||
|
||||
/**
|
||||
* Deletes a module from the registry by normalized name.
|
||||
*/
|
||||
delete(moduleName: string): void;
|
||||
|
||||
/**
|
||||
* Returns a module from the registry by normalized name.
|
||||
*/
|
||||
get(moduleName: string): any;
|
||||
get<TModule>(moduleName: string): TModule;
|
||||
|
||||
/**
|
||||
* Returns whether a given module exists in the registry by normalized module name.
|
||||
*/
|
||||
has(moduleName: string): boolean;
|
||||
|
||||
/**
|
||||
* Loads a module by name taking an optional normalized parent name argument.
|
||||
* Promise resolves to the module value.
|
||||
*/
|
||||
import(moduleName: string, normalizedParentName?: string): Promise<any>;
|
||||
import<TModule>(moduleName: string, normalizedParentName?: string): Promise<TModule>;
|
||||
|
||||
/**
|
||||
* Given a plain JavaScript object, return an equivalent Module object.
|
||||
* Useful when writing a custom instantiate hook or using System.set.
|
||||
*/
|
||||
newModule(object: any): any;
|
||||
newModule<TModule>(object: any): TModule;
|
||||
|
||||
/**
|
||||
* Declaration function for defining modules of the System.register polyfill module format.
|
||||
*/
|
||||
register(name: string, deps: Array<string>, declare: Function): void;
|
||||
register(deps: Array<string>, declare: Function): void;
|
||||
|
||||
/**
|
||||
* Companion module format to System.register for non-ES6 modules.
|
||||
* Provides a <script>-injection-compatible module format that any CommonJS or Global module can be converted into for CSP compatibility.
|
||||
*/
|
||||
registerDynamic(name: string, deps: Array<string>, executingRequire: boolean, declare: Function): void;
|
||||
registerDynamic(deps: Array<string>, executingRequire: boolean, declare: Function): void;
|
||||
|
||||
/**
|
||||
* Sets a module into the registry directly and synchronously.
|
||||
* Typically used along with System.newModule to create a valid Module object:
|
||||
*/
|
||||
set(moduleName: string, module: any): void;
|
||||
|
||||
/**
|
||||
* In CommonJS environments, SystemJS will substitute the global require as needed by the module format being
|
||||
* loaded to ensure the correct detection paths in loaded code.
|
||||
* The CommonJS require can be recovered within these modules from System._nodeRequire.
|
||||
*/
|
||||
_nodeRequire: Function;
|
||||
|
||||
/**
|
||||
* Modules list available only with trace=true
|
||||
*/
|
||||
loads: PackageList<any>;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare var SystemJS: SystemJSLoader.System;
|
||||
|
||||
declare var __moduleName: string;
|
||||
|
||||
/**
|
||||
* @deprecated use SystemJS https://github.com/systemjs/systemjs/releases/tag/0.19.10
|
||||
*/
|
||||
declare var System: SystemJSLoader.System;
|
||||
|
||||
declare module "systemjs" {
|
||||
import systemJSLoader = SystemJSLoader;
|
||||
let system: systemJSLoader.System;
|
||||
export = system;
|
||||
}
|
||||
8
src/typings/globals/systemjs/typings.json
Normal file
8
src/typings/globals/systemjs/typings.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"resolution": "main",
|
||||
"tree": {
|
||||
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/968736e629cc8052c98c8d5e892e73e0679bec6c/systemjs/index.d.ts",
|
||||
"raw": "registry:dt/systemjs#0.19.29+20161215140219",
|
||||
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/968736e629cc8052c98c8d5e892e73e0679bec6c/systemjs/index.d.ts"
|
||||
}
|
||||
}
|
||||
635
src/typings/globals/typemoq/index.d.ts
vendored
Normal file
635
src/typings/globals/typemoq/index.d.ts
vendored
Normal file
@@ -0,0 +1,635 @@
|
||||
// Generated by typings
|
||||
// Source: node_modules/typemoq/typemoq.node.d.ts
|
||||
declare module 'typemoq' {
|
||||
namespace TypeMoqIntern {
|
||||
class Consts {
|
||||
static IMATCH_ID_VALUE: string;
|
||||
static IMATCH_ID_NAME: string;
|
||||
static IMATCH_MATCHES_NAME: string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
class CurrentInterceptContext<T> {
|
||||
call: proxy.IProxyCall<T>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
enum GlobalType {
|
||||
Class = 0,
|
||||
Function = 1,
|
||||
Value = 2,
|
||||
}
|
||||
class GlobalMock<T> implements IGlobalMock<T> {
|
||||
mock: Mock<T>;
|
||||
private _name;
|
||||
private _type;
|
||||
container: Object;
|
||||
constructor(mock: Mock<T>, _name: string, _type: GlobalType, container: Object);
|
||||
static ofInstance<U>(instance: U, globalName?: string, container?: Object, behavior?: MockBehavior): GlobalMock<U>;
|
||||
static ofType<U>(ctor: Ctor<U>, globalName?: string, container?: Object, behavior?: MockBehavior): GlobalMock<U>;
|
||||
object: T;
|
||||
name: string;
|
||||
behavior: MockBehavior;
|
||||
callBase: boolean;
|
||||
type: GlobalType;
|
||||
setup<TResult>(expression: IFunc2<T, TResult>): MethodCallReturn<T, TResult>;
|
||||
verify<TResult>(expression: IFunc2<T, TResult>, times: Times): void;
|
||||
verifyAll(): void;
|
||||
reset(): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Api {
|
||||
interface ICallback<T, TResult> {
|
||||
callback(action: IAction): IReturnsThrows<T, TResult>;
|
||||
callback(action: IAction1<T>): IReturnsThrows<T, TResult>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Api {
|
||||
interface IReturns<T, TResult> {
|
||||
returns(valueFunction: IFuncN<any, TResult>): IReturnsResult<T>;
|
||||
callBase(): IReturnsResult<T>;
|
||||
}
|
||||
interface IReturnsResult<T> extends IVerifies {
|
||||
}
|
||||
interface IReturnsThrows<T, TResult> extends IReturns<T, TResult>, IThrows {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Api {
|
||||
interface ISetup<T, TResult> extends ICallback<T, TResult>, IReturnsThrows<T, TResult>, IVerifies {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Api {
|
||||
interface IThrows {
|
||||
throws<T extends error.Exception>(exception: T): IThrowsResult;
|
||||
}
|
||||
interface IThrowsResult extends IVerifies {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Api {
|
||||
interface IUsingResult {
|
||||
with(action: IAction): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Api {
|
||||
interface IVerifies {
|
||||
verifiable(times?: Times): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
type Ctor<T> = {
|
||||
new (): T;
|
||||
prototype: Object;
|
||||
};
|
||||
type CtorWithArgs<T> = {
|
||||
new (...ctorArgs: any[]): T;
|
||||
prototype: Object;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
type IAction = () => void;
|
||||
type IAction1<T> = (x: T) => void;
|
||||
type IActionN<T> = (...x: T[]) => void;
|
||||
type IFunc1<TResult> = () => TResult;
|
||||
type IFunc2<T, TResult> = (x: T) => TResult;
|
||||
type IFuncN<T, TResult> = (...x: T[]) => TResult;
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
class PropertyRetriever {
|
||||
static getOwnEnumerables(obj: any): {
|
||||
name: string;
|
||||
desc: PropertyDescriptor;
|
||||
}[];
|
||||
static getOwnNonenumerables(obj: any): {
|
||||
name: string;
|
||||
desc: PropertyDescriptor;
|
||||
}[];
|
||||
static getOwnEnumerablesAndNonenumerables(obj: any): {
|
||||
name: string;
|
||||
desc: PropertyDescriptor;
|
||||
}[];
|
||||
static getPrototypeEnumerables(obj: any): {
|
||||
name: string;
|
||||
desc: PropertyDescriptor;
|
||||
}[];
|
||||
static getPrototypeNonenumerables(obj: any): {
|
||||
name: string;
|
||||
desc: PropertyDescriptor;
|
||||
}[];
|
||||
static getPrototypeEnumerablesAndNonenumerables(obj: any): {
|
||||
name: string;
|
||||
desc: PropertyDescriptor;
|
||||
}[];
|
||||
static getOwnAndPrototypeEnumerables(obj: any): {
|
||||
name: string;
|
||||
desc: PropertyDescriptor;
|
||||
}[];
|
||||
static getOwnAndPrototypeNonenumerables(obj: any): {
|
||||
name: string;
|
||||
desc: PropertyDescriptor;
|
||||
}[];
|
||||
static getOwnAndPrototypeEnumerablesAndNonenumerables(obj: any): {
|
||||
name: string;
|
||||
desc: PropertyDescriptor;
|
||||
}[];
|
||||
private static _enumerable(obj, prop);
|
||||
private static _notEnumerable(obj, prop);
|
||||
private static _enumerableAndNotEnumerable(obj, prop);
|
||||
private static _getPropertyNames(obj, iterateSelfBool, iteratePrototypeBool, includePropCb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
class Utils {
|
||||
static getUUID(): string;
|
||||
static functionName(fun: Object): string;
|
||||
static conthunktor<U>(ctor: CtorWithArgs<U>, args: any[]): U;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Error {
|
||||
class Exception implements Error {
|
||||
name: string;
|
||||
message: string;
|
||||
constructor(name: string, message?: string);
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Error {
|
||||
enum MockExceptionReason {
|
||||
NoSetup,
|
||||
MoreThanOneSetup,
|
||||
InvalidSetup,
|
||||
InvalidMatcher,
|
||||
InvalidProxyArg,
|
||||
UnknownGlobalType,
|
||||
VerificationFailed,
|
||||
}
|
||||
class MockException extends Exception {
|
||||
reason: MockExceptionReason;
|
||||
ctx: any;
|
||||
constructor(reason: MockExceptionReason, ctx: any, name?: string, message?: string);
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Match {
|
||||
interface IMatch {
|
||||
___id: string;
|
||||
___matches(object: Object): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Match {
|
||||
class MatchAnyObject<T> implements IMatch {
|
||||
private _ctor;
|
||||
___id: string;
|
||||
constructor(_ctor: Ctor<T>);
|
||||
___matches(object: Object): boolean;
|
||||
}
|
||||
class MatchAny implements IMatch {
|
||||
___id: string;
|
||||
___matches(object: Object): boolean;
|
||||
}
|
||||
class MatchAnyString implements IMatch {
|
||||
___id: string;
|
||||
___matches(object: Object): boolean;
|
||||
}
|
||||
class MatchAnyNumber implements IMatch {
|
||||
___id: string;
|
||||
___matches(object: Object): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Match {
|
||||
class MatchPred<T> implements IMatch {
|
||||
private _pred;
|
||||
___id: string;
|
||||
constructor(_pred: IFunc2<T, boolean>);
|
||||
___matches(object: Object): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Match {
|
||||
class MatchValue<T> implements IMatch {
|
||||
private _value;
|
||||
___id: string;
|
||||
constructor(_value: T);
|
||||
___matches(object: any): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Proxy {
|
||||
interface ICallContext {
|
||||
args: IArguments;
|
||||
property: IPropertyInfo;
|
||||
returnValue: any;
|
||||
invokeBase(): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Proxy {
|
||||
interface ICallInterceptor {
|
||||
intercept(context: ICallContext): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Proxy {
|
||||
class MethodInvocation implements ICallContext {
|
||||
private _property;
|
||||
private _args;
|
||||
returnValue: any;
|
||||
constructor(_property: MethodInfo, _args?: IArguments);
|
||||
args: IArguments;
|
||||
property: PropertyInfo;
|
||||
invokeBase(): void;
|
||||
}
|
||||
class ValueGetterInvocation implements ICallContext {
|
||||
private _property;
|
||||
returnValue: any;
|
||||
constructor(_property: PropertyInfo, value: any);
|
||||
args: IArguments;
|
||||
property: PropertyInfo;
|
||||
invokeBase(): void;
|
||||
}
|
||||
class ValueSetterInvocation implements ICallContext {
|
||||
private _property;
|
||||
private _args;
|
||||
returnValue: any;
|
||||
constructor(_property: PropertyInfo, _args: IArguments);
|
||||
args: IArguments;
|
||||
property: PropertyInfo;
|
||||
invokeBase(): void;
|
||||
}
|
||||
class MethodGetterInvocation implements ICallContext {
|
||||
private _property;
|
||||
private _getter;
|
||||
returnValue: any;
|
||||
constructor(_property: PropertyInfo, _getter: () => any);
|
||||
args: IArguments;
|
||||
property: PropertyInfo;
|
||||
invokeBase(): void;
|
||||
}
|
||||
class MethodSetterInvocation implements ICallContext {
|
||||
private _property;
|
||||
private _setter;
|
||||
private _args;
|
||||
returnValue: any;
|
||||
constructor(_property: PropertyInfo, _setter: (v: any) => void, _args: IArguments);
|
||||
args: IArguments;
|
||||
property: PropertyInfo;
|
||||
invokeBase(): void;
|
||||
}
|
||||
class MethodInfo implements IPropertyInfo {
|
||||
obj: any;
|
||||
name: string;
|
||||
constructor(obj: any, name: string);
|
||||
toFunc: Function;
|
||||
}
|
||||
class PropertyInfo implements IPropertyInfo {
|
||||
obj: Object;
|
||||
name: string;
|
||||
constructor(obj: Object, name: string);
|
||||
}
|
||||
interface IPropertyInfo {
|
||||
obj: Object;
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Proxy {
|
||||
interface IProxyCall<T> {
|
||||
id: string;
|
||||
setupExpression: IAction1<T>;
|
||||
setupCall: proxy.ICallContext;
|
||||
isVerifiable: boolean;
|
||||
expectedCallCount: Times;
|
||||
isInvoked: boolean;
|
||||
callCount: number;
|
||||
evaluatedSuccessfully(): void;
|
||||
matches(call: proxy.ICallContext): boolean;
|
||||
execute(call: proxy.ICallContext): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Proxy {
|
||||
interface IProxyFactory {
|
||||
createProxy<T>(interceptor: ICallInterceptor, instance: T): T;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Proxy {
|
||||
class Proxy<T> {
|
||||
constructor(interceptor: ICallInterceptor, instance: T);
|
||||
static of<U>(instance: U, interceptor: ICallInterceptor): any;
|
||||
private static check<U>(instance);
|
||||
private check<U>(instance);
|
||||
private static checkNotNull<U>(instance);
|
||||
private static isPrimitiveObject(obj);
|
||||
private defineMethodProxy(that, interceptor, instance, propName, propDesc?);
|
||||
private static methodProxyValue<U>(interceptor, instance, propName);
|
||||
private defineValuePropertyProxy(that, interceptor, instance, propName, propValue, propDesc?);
|
||||
private defineGetSetPropertyProxy(that, interceptor, instance, propName, get?, set?, propDesc?);
|
||||
private defineProperty(obj, name, desc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern.Proxy {
|
||||
class ProxyFactory implements IProxyFactory {
|
||||
createProxy<T>(interceptor: ICallInterceptor, instance: T): T;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
import api = TypeMoqIntern.Api;
|
||||
import error = TypeMoqIntern.Error;
|
||||
import match = TypeMoqIntern.Match;
|
||||
import proxy = TypeMoqIntern.Proxy;
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
class GlobalScope implements api.IUsingResult {
|
||||
private _args;
|
||||
constructor(_args: IGlobalMock<any>[]);
|
||||
static using(...args: IGlobalMock<any>[]): api.IUsingResult;
|
||||
with(action: IAction): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
interface IGlobalMock<T> extends IMock<T> {
|
||||
mock: Mock<T>;
|
||||
type: GlobalType;
|
||||
container: Object;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
interface IMock<T> {
|
||||
object: T;
|
||||
name: string;
|
||||
behavior: MockBehavior;
|
||||
callBase: boolean;
|
||||
setup<TResult>(expression: IFunc2<T, TResult>): MethodCallReturn<T, TResult>;
|
||||
verify<TResult>(expression: IFunc2<T, TResult>, times: Times): void;
|
||||
verifyAll(): void;
|
||||
reset(): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
enum InterceptionAction {
|
||||
Continue = 0,
|
||||
Stop = 1,
|
||||
}
|
||||
interface IInterceptStrategy<T> {
|
||||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction;
|
||||
}
|
||||
class InterceptorContext<T> {
|
||||
behavior: MockBehavior;
|
||||
mock: IMock<T>;
|
||||
private _actualInvocations;
|
||||
private _orderedCalls;
|
||||
constructor(behavior: MockBehavior, mock: IMock<T>);
|
||||
addInvocation(invocation: proxy.ICallContext): void;
|
||||
actualInvocations(): proxy.ICallContext[];
|
||||
clearInvocations(): void;
|
||||
addOrderedCall(call: proxy.IProxyCall<T>): void;
|
||||
removeOrderedCall(call: proxy.IProxyCall<T>): void;
|
||||
orderedCalls(): proxy.IProxyCall<T>[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
class InterceptorExecute<T> implements Proxy.ICallInterceptor {
|
||||
private _interceptorContext;
|
||||
constructor(behavior: MockBehavior, mock: IMock<T>);
|
||||
interceptorContext: InterceptorContext<T>;
|
||||
intercept(invocation: proxy.ICallContext): void;
|
||||
addCall(call: proxy.IProxyCall<T>): void;
|
||||
verifyCall<T>(call: proxy.IProxyCall<T>, times: Times): void;
|
||||
verify(): void;
|
||||
private interceptionStrategies();
|
||||
private throwVerifyCallException(call, times);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
class InterceptorSetup<T> implements Proxy.ICallInterceptor {
|
||||
private _interceptedCall;
|
||||
interceptedCall: proxy.ICallContext;
|
||||
intercept(invocation: proxy.ICallContext): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
class AddActualInvocation<T> implements IInterceptStrategy<T> {
|
||||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction;
|
||||
}
|
||||
class ExtractProxyCall<T> implements IInterceptStrategy<T> {
|
||||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction;
|
||||
}
|
||||
class ExecuteCall<T> implements IInterceptStrategy<T> {
|
||||
private _ctx;
|
||||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction;
|
||||
}
|
||||
class InvokeBase<T> implements IInterceptStrategy<T> {
|
||||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction;
|
||||
}
|
||||
class HandleMockRecursion<T> implements IInterceptStrategy<T> {
|
||||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
class It {
|
||||
static isValue<T>(x: T): T;
|
||||
static isAnyObject<T>(x: Ctor<T>): T;
|
||||
static isAny(): any;
|
||||
static isAnyString(): string;
|
||||
static isAnyNumber(): number;
|
||||
static is<T>(predicate: IFunc2<T, boolean>): T;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
class MethodCall<T, TResult> implements proxy.IProxyCall<T>, api.IVerifies {
|
||||
mock: Mock<T>;
|
||||
private _setupExpression;
|
||||
protected _id: string;
|
||||
protected _setupCall: proxy.ICallContext;
|
||||
protected _setupCallback: IAction;
|
||||
protected _isVerifiable: boolean;
|
||||
protected _expectedCallCount: Times;
|
||||
protected _isInvoked: boolean;
|
||||
protected _callCount: number;
|
||||
protected _thrownException: error.Exception;
|
||||
protected _evaluatedSuccessfully: boolean;
|
||||
constructor(mock: Mock<T>, _setupExpression: IFunc2<T, TResult>);
|
||||
private generateId();
|
||||
private transformToMatchers(args);
|
||||
id: string;
|
||||
setupExpression: IAction1<T>;
|
||||
setupCall: proxy.ICallContext;
|
||||
isVerifiable: boolean;
|
||||
expectedCallCount: Times;
|
||||
isInvoked: boolean;
|
||||
callCount: number;
|
||||
evaluatedSuccessfully(): void;
|
||||
matches(call: proxy.ICallContext): boolean;
|
||||
execute(call: proxy.ICallContext): void;
|
||||
verifiable(times?: Times): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
class MethodCallReturn<T, TResult> extends MethodCall<T, TResult> implements api.ISetup<T, TResult>, api.IReturnsResult<T> {
|
||||
protected _returnValueFunc: IFuncN<any, TResult>;
|
||||
hasReturnValue: boolean;
|
||||
protected _callBase: boolean;
|
||||
constructor(mock: Mock<T>, setupExpression: IFunc2<T, TResult>);
|
||||
execute(call: proxy.ICallContext): void;
|
||||
callback(action: IActionN<any>): api.IReturnsThrows<T, TResult>;
|
||||
throws(exception: Error): api.IThrowsResult;
|
||||
returns(valueFunc: IFuncN<any, TResult>): api.IReturnsResult<T>;
|
||||
callBase(): api.IReturnsResult<T>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
enum MockBehavior {
|
||||
Loose = 0,
|
||||
Strict = 1,
|
||||
}
|
||||
class Mock<T> implements IMock<T> {
|
||||
instance: T;
|
||||
private _behavior;
|
||||
static proxyFactory: proxy.IProxyFactory;
|
||||
private _id;
|
||||
private _name;
|
||||
private _interceptor;
|
||||
private _proxy;
|
||||
private _callBase;
|
||||
constructor(instance: T, _behavior?: MockBehavior);
|
||||
private init();
|
||||
static ofInstance<U>(instance: U, behavior?: MockBehavior): Mock<U>;
|
||||
static ofType<U>(ctor: CtorWithArgs<U>, behavior?: MockBehavior, ...ctorArgs: any[]): Mock<U>;
|
||||
static ofType2<U>(ctor: CtorWithArgs<U>, ctorArgs: any[], behavior?: MockBehavior): Mock<U>;
|
||||
object: T;
|
||||
name: string;
|
||||
behavior: MockBehavior;
|
||||
callBase: boolean;
|
||||
private generateId();
|
||||
private getNameOf(instance);
|
||||
setup<TResult>(expression: IFunc2<T, TResult>): MethodCallReturn<T, TResult>;
|
||||
verify<TResult>(expression: IFunc2<T, TResult>, times: Times): void;
|
||||
verifyAll(): void;
|
||||
reset(): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace TypeMoqIntern {
|
||||
class Times {
|
||||
private _condition;
|
||||
private _from;
|
||||
private _to;
|
||||
private static NO_MATCHING_CALLS_EXACTLY_N_TIMES;
|
||||
private static NO_MATCHING_CALLS_AT_LEAST_ONCE;
|
||||
private static NO_MATCHING_CALLS_AT_MOST_ONCE;
|
||||
private _lastCallCount;
|
||||
private _failMessage;
|
||||
constructor(_condition: IFunc2<number, boolean>, _from: number, _to: number, failMessage: string);
|
||||
failMessage: string;
|
||||
verify(callCount: number): boolean;
|
||||
static exactly(n: number): Times;
|
||||
static never(): Times;
|
||||
static once(): Times;
|
||||
static atLeastOnce(): Times;
|
||||
static atMostOnce(): Times;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface ITypeMoq {
|
||||
Mock: typeof TypeMoqIntern.Mock;
|
||||
MockBehavior: typeof TypeMoqIntern.MockBehavior;
|
||||
It: typeof TypeMoqIntern.It;
|
||||
Times: typeof TypeMoqIntern.Times;
|
||||
GlobalMock: typeof TypeMoqIntern.GlobalMock;
|
||||
GlobalScope: typeof TypeMoqIntern.GlobalScope;
|
||||
MockException: typeof TypeMoqIntern.Error.MockException;
|
||||
}
|
||||
module TypeMoq {
|
||||
export import Mock = TypeMoqIntern.Mock;
|
||||
export import MockBehavior = TypeMoqIntern.MockBehavior;
|
||||
export import It = TypeMoqIntern.It;
|
||||
export import Times = TypeMoqIntern.Times;
|
||||
export import GlobalMock = TypeMoqIntern.GlobalMock;
|
||||
export import GlobalScope = TypeMoqIntern.GlobalScope;
|
||||
export import MockException = TypeMoqIntern.Error.MockException;
|
||||
}
|
||||
let typemoq: ITypeMoq;
|
||||
|
||||
|
||||
|
||||
|
||||
//# sourceMappingURL=output.d.ts.map
|
||||
export = TypeMoq;
|
||||
}
|
||||
6087
src/typings/globals/underscore/index.d.ts
vendored
Normal file
6087
src/typings/globals/underscore/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
src/typings/globals/underscore/typings.json
Normal file
8
src/typings/globals/underscore/typings.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"resolution": "main",
|
||||
"tree": {
|
||||
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7f8c53f300bb183bd496427f0f955638b1311133/underscore/underscore.d.ts",
|
||||
"raw": "registry:dt/underscore#1.8.3+20161123125004",
|
||||
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7f8c53f300bb183bd496427f0f955638b1311133/underscore/underscore.d.ts"
|
||||
}
|
||||
}
|
||||
343
src/typings/globals/zone.js/index.d.ts
vendored
Normal file
343
src/typings/globals/zone.js/index.d.ts
vendored
Normal file
@@ -0,0 +1,343 @@
|
||||
// Generated by typings
|
||||
// Source: node_modules/zone.js/dist/zone.js.d.ts
|
||||
interface Zone {
|
||||
/**
|
||||
*
|
||||
* @returns {Zone} The parent Zone.
|
||||
*/
|
||||
parent: Zone;
|
||||
/**
|
||||
* @returns {string} The Zone name (useful for debugging)
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Returns a value associated with the `key`.
|
||||
*
|
||||
* If the current zone does not have a key, the request is delegated to the parent zone. Use
|
||||
* [ZoneSpec.properties] to configure the set of properties associated with the current zone.
|
||||
*
|
||||
* @param key The key to retrieve.
|
||||
* @returns {any} The value for the key, or `undefined` if not found.
|
||||
*/
|
||||
get(key: string): any;
|
||||
/**
|
||||
* Returns a Zone which defines a `key`.
|
||||
*
|
||||
* Recursively search the parent Zone until a Zone which has a property `key` is found.
|
||||
*
|
||||
* @param key The key to use for identification of the returned zone.
|
||||
* @returns {Zone} The Zone which defines the `key`, `null` if not found.
|
||||
*/
|
||||
getZoneWith(key: string): Zone;
|
||||
/**
|
||||
* Used to create a child zone.
|
||||
*
|
||||
* @param zoneSpec A set of rules which the child zone should follow.
|
||||
* @returns {Zone} A new child zone.
|
||||
*/
|
||||
fork(zoneSpec: ZoneSpec): Zone;
|
||||
/**
|
||||
* Wraps a callback function in a new function which will properly restore the current zone upon
|
||||
* invocation.
|
||||
*
|
||||
* The wrapped function will properly forward `this` as well as `arguments` to the `callback`.
|
||||
*
|
||||
* Before the function is wrapped the zone can intercept the `callback` by declaring
|
||||
* [ZoneSpec.onIntercept].
|
||||
*
|
||||
* @param callback the function which will be wrapped in the zone.
|
||||
* @param source A unique debug location of the API being wrapped.
|
||||
* @returns {function(): *} A function which will invoke the `callback` through [Zone.runGuarded].
|
||||
*/
|
||||
wrap(callback: Function, source: string): Function;
|
||||
/**
|
||||
* Invokes a function in a given zone.
|
||||
*
|
||||
* The invocation of `callback` can be intercepted be declaring [ZoneSpec.onInvoke].
|
||||
*
|
||||
* @param callback The function to invoke.
|
||||
* @param applyThis
|
||||
* @param applyArgs
|
||||
* @param source A unique debug location of the API being invoked.
|
||||
* @returns {any} Value from the `callback` function.
|
||||
*/
|
||||
run<T>(callback: Function, applyThis?: any, applyArgs?: any[], source?: string): T;
|
||||
/**
|
||||
* Invokes a function in a given zone and catches any exceptions.
|
||||
*
|
||||
* Any exceptions thrown will be forwarded to [Zone.HandleError].
|
||||
*
|
||||
* The invocation of `callback` can be intercepted be declaring [ZoneSpec.onInvoke]. The
|
||||
* handling of exceptions can intercepted by declaring [ZoneSpec.handleError].
|
||||
*
|
||||
* @param callback The function to invoke.
|
||||
* @param applyThis
|
||||
* @param applyArgs
|
||||
* @param source A unique debug location of the API being invoked.
|
||||
* @returns {any} Value from the `callback` function.
|
||||
*/
|
||||
runGuarded<T>(callback: Function, applyThis?: any, applyArgs?: any[], source?: string): T;
|
||||
/**
|
||||
* Execute the Task by restoring the [Zone.currentTask] in the Task's zone.
|
||||
*
|
||||
* @param callback
|
||||
* @param applyThis
|
||||
* @param applyArgs
|
||||
* @returns {*}
|
||||
*/
|
||||
runTask(task: Task, applyThis?: any, applyArgs?: any): any;
|
||||
scheduleMicroTask(source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void): MicroTask;
|
||||
scheduleMacroTask(source: string, callback: Function, data: TaskData, customSchedule: (task: Task) => void, customCancel: (task: Task) => void): MacroTask;
|
||||
scheduleEventTask(source: string, callback: Function, data: TaskData, customSchedule: (task: Task) => void, customCancel: (task: Task) => void): EventTask;
|
||||
/**
|
||||
* Allows the zone to intercept canceling of scheduled Task.
|
||||
*
|
||||
* The interception is configured using [ZoneSpec.onCancelTask]. The default canceler invokes
|
||||
* the [Task.cancelFn].
|
||||
*
|
||||
* @param task
|
||||
* @returns {any}
|
||||
*/
|
||||
cancelTask(task: Task): any;
|
||||
}
|
||||
interface ZoneType {
|
||||
/**
|
||||
* @returns {Zone} Returns the current [Zone]. Returns the current zone. The only way to change
|
||||
* the current zone is by invoking a run() method, which will update the current zone for the
|
||||
* duration of the run method callback.
|
||||
*/
|
||||
current: Zone;
|
||||
/**
|
||||
* @returns {Task} The task associated with the current execution.
|
||||
*/
|
||||
currentTask: Task;
|
||||
/**
|
||||
* Verify that Zone has been correctly patched. Specifically that Promise is zone aware.
|
||||
*/
|
||||
assertZonePatched(): any;
|
||||
}
|
||||
/**
|
||||
* Provides a way to configure the interception of zone events.
|
||||
*
|
||||
* Only the `name` property is required (all other are optional).
|
||||
*/
|
||||
interface ZoneSpec {
|
||||
/**
|
||||
* The name of the zone. Usefull when debugging Zones.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* A set of properties to be associated with Zone. Use [Zone.get] to retrive them.
|
||||
*/
|
||||
properties?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
/**
|
||||
* Allows the interception of zone forking.
|
||||
*
|
||||
* When the zone is being forked, the request is forwarded to this method for interception.
|
||||
*
|
||||
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
|
||||
* @param currentZone The current [Zone] where the current interceptor has beed declared.
|
||||
* @param targetZone The [Zone] which originally received the request.
|
||||
* @param zoneSpec The argument passed into the `fork` method.
|
||||
*/
|
||||
onFork?: (parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone, zoneSpec: ZoneSpec) => Zone;
|
||||
/**
|
||||
* Allows interception of the wrapping of the callback.
|
||||
*
|
||||
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
|
||||
* @param currentZone The current [Zone] where the current interceptor has beed declared.
|
||||
* @param targetZone The [Zone] which originally received the request.
|
||||
* @param delegate The argument passed into the `warp` method.
|
||||
* @param source The argument passed into the `warp` method.
|
||||
*/
|
||||
onIntercept?: (parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone, delegate: Function, source: string) => Function;
|
||||
/**
|
||||
* Allows interception of the callback invocation.
|
||||
*
|
||||
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
|
||||
* @param currentZone The current [Zone] where the current interceptor has beed declared.
|
||||
* @param targetZone The [Zone] which originally received the request.
|
||||
* @param delegate The argument passed into the `run` method.
|
||||
* @param applyThis The argument passed into the `run` method.
|
||||
* @param applyArgs The argument passed into the `run` method.
|
||||
* @param source The argument passed into the `run` method.
|
||||
*/
|
||||
onInvoke?: (parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone, delegate: Function, applyThis: any, applyArgs: any[], source: string) => any;
|
||||
/**
|
||||
* Allows interception of the error handling.
|
||||
*
|
||||
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
|
||||
* @param currentZone The current [Zone] where the current interceptor has beed declared.
|
||||
* @param targetZone The [Zone] which originally received the request.
|
||||
* @param error The argument passed into the `handleError` method.
|
||||
*/
|
||||
onHandleError?: (parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone, error: any) => boolean;
|
||||
/**
|
||||
* Allows interception of task scheduling.
|
||||
*
|
||||
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
|
||||
* @param currentZone The current [Zone] where the current interceptor has beed declared.
|
||||
* @param targetZone The [Zone] which originally received the request.
|
||||
* @param task The argument passed into the `scheduleTask` method.
|
||||
*/
|
||||
onScheduleTask?: (parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone, task: Task) => Task;
|
||||
onInvokeTask?: (parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone, task: Task, applyThis: any, applyArgs: any) => any;
|
||||
/**
|
||||
* Allows interception of task cancelation.
|
||||
*
|
||||
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
|
||||
* @param currentZone The current [Zone] where the current interceptor has beed declared.
|
||||
* @param targetZone The [Zone] which originally received the request.
|
||||
* @param task The argument passed into the `cancelTask` method.
|
||||
*/
|
||||
onCancelTask?: (parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone, task: Task) => any;
|
||||
/**
|
||||
* Notifies of changes to the task queue empty status.
|
||||
*
|
||||
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
|
||||
* @param currentZone The current [Zone] where the current interceptor has beed declared.
|
||||
* @param targetZone The [Zone] which originally received the request.
|
||||
* @param isEmpty
|
||||
*/
|
||||
onHasTask?: (delegate: ZoneDelegate, current: Zone, target: Zone, hasTaskState: HasTaskState) => void;
|
||||
}
|
||||
/**
|
||||
* A delegate when intercepting zone operations.
|
||||
*
|
||||
* A ZoneDelegate is needed because a child zone can't simply invoke a method on a parent zone. For
|
||||
* example a child zone wrap can't just call parent zone wrap. Doing so would create a callback
|
||||
* which is bound to the parent zone. What we are interested is intercepting the callback before it
|
||||
* is bound to any zone. Furthermore, we also need to pass the targetZone (zone which received the
|
||||
* original request) to the delegate.
|
||||
*
|
||||
* The ZoneDelegate methods mirror those of Zone with an addition of extra targetZone argument in
|
||||
* the method signature. (The original Zone which received the request.) Some methods are renamed
|
||||
* to prevent confusion, because they have slightly different semantics and arguments.
|
||||
*
|
||||
* - `wrap` => `intercept`: The `wrap` method delegates to `intercept`. The `wrap` method returns
|
||||
* a callback which will run in a given zone, where as intercept allows wrapping the callback
|
||||
* so that additional code can be run before and after, but does not associated the callback
|
||||
* with the zone.
|
||||
* - `run` => `invoke`: The `run` method delegates to `invoke` to perform the actual execution of
|
||||
* the callback. The `run` method switches to new zone; saves and restores the `Zone.current`;
|
||||
* and optionally performs error handling. The invoke is not responsible for error handling,
|
||||
* or zone management.
|
||||
*
|
||||
* Not every method is usually overwritten in the child zone, for this reason the ZoneDelegate
|
||||
* stores the closest zone which overwrites this behavior along with the closest ZoneSpec.
|
||||
*
|
||||
* NOTE: We have tried to make this API analogous to Event bubbling with target and current
|
||||
* properties.
|
||||
*
|
||||
* Note: The ZoneDelegate treats ZoneSpec as class. This allows the ZoneSpec to use its `this` to
|
||||
* store internal state.
|
||||
*/
|
||||
interface ZoneDelegate {
|
||||
zone: Zone;
|
||||
fork(targetZone: Zone, zoneSpec: ZoneSpec): Zone;
|
||||
intercept(targetZone: Zone, callback: Function, source: string): Function;
|
||||
invoke(targetZone: Zone, callback: Function, applyThis: any, applyArgs: any[], source: string): any;
|
||||
handleError(targetZone: Zone, error: any): boolean;
|
||||
scheduleTask(targetZone: Zone, task: Task): Task;
|
||||
invokeTask(targetZone: Zone, task: Task, applyThis: any, applyArgs: any): any;
|
||||
cancelTask(targetZone: Zone, task: Task): any;
|
||||
hasTask(targetZone: Zone, isEmpty: HasTaskState): void;
|
||||
}
|
||||
declare type HasTaskState = {
|
||||
microTask: boolean;
|
||||
macroTask: boolean;
|
||||
eventTask: boolean;
|
||||
change: TaskType;
|
||||
};
|
||||
/**
|
||||
* Task type: `microTask`, `macroTask`, `eventTask`.
|
||||
*/
|
||||
declare type TaskType = string;
|
||||
/**
|
||||
*/
|
||||
interface TaskData {
|
||||
/**
|
||||
* A periodic [MacroTask] is such which get automatically rescheduled after it is executed.
|
||||
*/
|
||||
isPeriodic?: boolean;
|
||||
/**
|
||||
* Delay in milliseconds when the Task will run.
|
||||
*/
|
||||
delay?: number;
|
||||
/**
|
||||
* identifier returned by the native setTimeout.
|
||||
*/
|
||||
handleId?: number;
|
||||
}
|
||||
/**
|
||||
* Represents work which is executed with a clean stack.
|
||||
*
|
||||
* Tasks are used in Zones to mark work which is performed on clean stack frame. There are three
|
||||
* kinds of task. [MicroTask], [MacroTask], and [EventTask].
|
||||
*
|
||||
* A JS VM can be modeled as a [MicroTask] queue, [MacroTask] queue, and [EventTask] set.
|
||||
*
|
||||
* - [MicroTask] queue represents a set of tasks which are executing right after the current stack
|
||||
* frame becomes clean and before a VM yield. All [MicroTask]s execute in order of insertion
|
||||
* before VM yield and the next [MacroTask] is executed.
|
||||
* - [MacroTask] queue represents a set of tasks which are executed one at a time after each VM
|
||||
* yield. The queue is order by time, and insertions can happen in any location.
|
||||
* - [EventTask] is a set of tasks which can at any time be inserted to the end of the [MacroTask]
|
||||
* queue. This happens when the event fires.
|
||||
*
|
||||
*/
|
||||
interface Task {
|
||||
/**
|
||||
* Task type: `microTask`, `macroTask`, `eventTask`.
|
||||
*/
|
||||
type: TaskType;
|
||||
/**
|
||||
* Debug string representing the API which requested the scheduling of the task.
|
||||
*/
|
||||
source: string;
|
||||
/**
|
||||
* The Function to be used by the VM on entering the [Task]. This function will delegate to
|
||||
* [Zone.runTask] and delegate to `callback`.
|
||||
*/
|
||||
invoke: Function;
|
||||
/**
|
||||
* Function which needs to be executed by the Task after the [Zone.currentTask] has been set to
|
||||
* the current task.
|
||||
*/
|
||||
callback: Function;
|
||||
/**
|
||||
* Task specific options associated with the current task. This is passed to the `scheduleFn`.
|
||||
*/
|
||||
data: TaskData;
|
||||
/**
|
||||
* Represents the default work which needs to be done to schedule the Task by the VM.
|
||||
*
|
||||
* A zone may chose to intercept this function and perform its own scheduling.
|
||||
*/
|
||||
scheduleFn: (task: Task) => void;
|
||||
/**
|
||||
* Represents the default work which needs to be done to un-schedule the Task from the VM. Not all
|
||||
* Tasks are cancelable, and therefore this method is optional.
|
||||
*
|
||||
* A zone may chose to intercept this function and perform its own scheduling.
|
||||
*/
|
||||
cancelFn: (task: Task) => void;
|
||||
/**
|
||||
* @type {Zone} The zone which will be used to invoke the `callback`. The Zone is captured
|
||||
* at the time of Task creation.
|
||||
*/
|
||||
zone: Zone;
|
||||
/**
|
||||
* Number of times the task has been executed, or -1 if canceled.
|
||||
*/
|
||||
runCount: number;
|
||||
}
|
||||
interface MicroTask extends Task {
|
||||
}
|
||||
interface MacroTask extends Task {
|
||||
}
|
||||
interface EventTask extends Task {
|
||||
}
|
||||
declare const Zone: ZoneType;
|
||||
6
src/typings/globals/zone.js/typings.json
Normal file
6
src/typings/globals/zone.js/typings.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"resolution": "main",
|
||||
"tree": {
|
||||
"src": "npm:zone.js\\dist\\zone.js.d.ts"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user