mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 17:51:46 +00:00
Merge pull request #1 from AlexJerabek/AlexJ-OutlookMigration
Merging with current master branch
This commit is contained in:
+400
-176
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/bb773938(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.5
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-interop" />
|
||||
|
||||
|
||||
@@ -296,11 +296,17 @@ const setColumnVisibility = (visible: boolean) => {
|
||||
|
||||
const combobox = sheet.OLEObjects('ComboBox1').Object as MSForms.ComboBox;
|
||||
combobox.Clear();
|
||||
const enumerator = new Enumerator(dict.Items());
|
||||
|
||||
// iterate over keys using Enumerator
|
||||
const enumerator = new Enumerator(dict);
|
||||
enumerator.moveFirst();
|
||||
while (!enumerator.atEnd()) {
|
||||
combobox.AddItem(enumerator.item());
|
||||
enumerator.moveNext();
|
||||
}
|
||||
|
||||
// alternatively, make a JS array out of the keys, and iterate using forEach
|
||||
// new VBArray(dict.Keys()).toArray().forEach(x => combobox.AddItem(x));
|
||||
})();
|
||||
})();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference types="windows-script-host" />
|
||||
/// <reference types="activex-scripting" />
|
||||
|
||||
const collectionToArray = <T>(col: { Item(index: any): T } | SafeArray<T>) => {
|
||||
const collectionToArray = <T>(col: { Item(index: any): T }): T[] => {
|
||||
const results: T[] = [];
|
||||
const enumerator = new Enumerator<T>(col);
|
||||
enumerator.moveFirst();
|
||||
@@ -423,7 +423,7 @@ the job?
|
||||
document.GroupBroadcastReceipts = true;
|
||||
|
||||
const jobIDs = document.Submit('');
|
||||
collectionToArray(jobIDs).forEach(jobID => WScript.Echo(`The job ID is ${jobID}`));
|
||||
new VBArray(jobIDs).toArray().forEach(jobID => WScript.Echo(`The job ID is ${jobID}`));
|
||||
|
||||
while (recipients.Count > 0) {
|
||||
recipients.Remove(1);
|
||||
|
||||
@@ -1,49 +1,20 @@
|
||||
// copied from the definitions in activex-scripting
|
||||
interface Dictionary<TKey = any, TItem = any> {
|
||||
/** Add a new key and item to the dictionary. */
|
||||
Add(Key: TKey, Item: TItem): void;
|
||||
/// <reference types="activex-scripting" />
|
||||
|
||||
/** Get the number of items in the dictionary. */
|
||||
readonly Count: number;
|
||||
|
||||
/** Determine if a given key is in the dictionary. */
|
||||
Exists(Key: TKey): boolean;
|
||||
HashVal(Key: TKey): any;
|
||||
|
||||
/** Set or get the item for a given key */
|
||||
Item(Key: TKey): TItem;
|
||||
|
||||
/** Get an array containing all items in the dictionary. */
|
||||
Items(): SafeArray<TItem>;
|
||||
|
||||
/** Change a key to a different key. */
|
||||
Key(Key: TKey): TKey;
|
||||
|
||||
/** Get an array containing all keys in the dictionary. */
|
||||
Keys(): SafeArray<TKey>;
|
||||
|
||||
/** Remove a given key from the dictionary. */
|
||||
Remove(Key: TKey): void;
|
||||
|
||||
/** Remove all information from the dictionary. */
|
||||
RemoveAll(): void;
|
||||
|
||||
/** Set or get the item for a given key */
|
||||
(Key: TKey): TItem;
|
||||
}
|
||||
|
||||
interface ActiveXObjectNameMap {
|
||||
'Scripting.Dictionary': Dictionary;
|
||||
}
|
||||
|
||||
const dict: Dictionary<string, number> = new ActiveXObject('Scripting.Dictionary');
|
||||
const dict: Scripting.Dictionary<string, number> = new ActiveXObject('Scripting.Dictionary');
|
||||
dict.Add('one', 1);
|
||||
dict.Add('two', 2);
|
||||
dict.Add('three', 3);
|
||||
|
||||
const keyEnumerator = new Enumerator(dict.Keys());
|
||||
const keyEnumerator = new Enumerator(dict);
|
||||
keyEnumerator.moveFirst();
|
||||
while (!keyEnumerator.atEnd()) {
|
||||
const item = dict(keyEnumerator.item());
|
||||
const power = Math.pow(item, 2);
|
||||
}
|
||||
|
||||
const keysArray = new VBArray(dict.Keys()).toArray();
|
||||
const itemsArray = new VBArray(dict.Items()).toArray();
|
||||
for (let i = 0; i < keysArray.length; i++) {
|
||||
const key = keysArray[i];
|
||||
const item = itemsArray[i];
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/ff521046(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
interface ActiveXObjectNameMap { }
|
||||
@@ -50,8 +50,8 @@ interface Enumerator<T = any> {
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new <T = any>(collection: SafeArray<T> | { Item(index: any): T }): Enumerator<T>;
|
||||
new (collection: any): Enumerator;
|
||||
new <T = any>(collection: { Item(index: any): T }): Enumerator<T>;
|
||||
// new (collection: any): Enumerator;
|
||||
}
|
||||
|
||||
declare var Enumerator: EnumeratorConstructor;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-interop" />
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://api.libreoffice.org/
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-interop" />
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/aa741317(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
declare namespace MSHTML {
|
||||
const enum _BEHAVIOR_EVENT {
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/ms763742.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-interop" />
|
||||
|
||||
|
||||
Vendored
+5
-1
@@ -491,7 +491,7 @@ declare namespace Scripting {
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
set(obj: Scripting.Dictionary, propertyName: 'Item', parameterTypes: [any], newValue: any): void;
|
||||
set<TKey = any, TValue = any>(obj: Scripting.Dictionary<TKey, TValue>, propertyName: 'Item', parameterTypes: [TKey], newValue: TValue): void;
|
||||
}
|
||||
|
||||
interface ActiveXObjectNameMap {
|
||||
@@ -499,3 +499,7 @@ interface ActiveXObjectNameMap {
|
||||
'Scripting.Encoder': Scripting.Encoder;
|
||||
'Scripting.FileSystemObject': Scripting.FileSystemObject;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new <TKey>(dict: Scripting.Dictionary<TKey>): Enumerator<TKey>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import Allure from "allure-js-commons";
|
||||
|
||||
const shouldMakeError = new Allure("test"); // $ExpectError
|
||||
const allure = new Allure();
|
||||
|
||||
allure.startSuite("suite");
|
||||
allure.startCase("case");
|
||||
allure.startCase("case", 123456789);
|
||||
|
||||
allure.endCase("passed");
|
||||
allure.endCase("pending");
|
||||
allure.endCase("skipped");
|
||||
allure.endCase("failed");
|
||||
allure.endCase("broken", 1232131232);
|
||||
allure.endCase("error"); // $ExpectError
|
||||
|
||||
allure.startStep("error");
|
||||
allure.endStep("error"); // $ExpectError
|
||||
|
||||
allure.setDescription("description");
|
||||
allure.addAttachment("image", {}, "image/jpeg");
|
||||
allure.pendingCase("pending");
|
||||
|
||||
allure.endSuite();
|
||||
Vendored
+111
@@ -0,0 +1,111 @@
|
||||
// Type definitions for allure-js-commons 0.0
|
||||
// Project: https://github.com/allure-framework/allure-js-commons
|
||||
// Definitions by: Denis Artyuhovich <https://github.com/zaqqaz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
declare class Allure {
|
||||
constructor();
|
||||
|
||||
setOptions(options: Allure.Options): void;
|
||||
|
||||
getCurrentSuite(): Allure.Suite;
|
||||
|
||||
getCurrentTest(): Allure.Test;
|
||||
|
||||
startSuite(suiteName: string, timestamp?: number): void;
|
||||
|
||||
endSuite(timestamp?: number): void;
|
||||
|
||||
startCase(testName: string, timestamp?: number): void;
|
||||
|
||||
endCase(status: Allure.Status, err?: {}, timestamp?: number): void;
|
||||
|
||||
startStep(stepName: string, timestamp?: number): void;
|
||||
|
||||
endStep(status: Allure.Status, timestamp?: number): void;
|
||||
|
||||
setDescription(description: string, timestamp?: number): void;
|
||||
|
||||
addAttachment(attachmentName: string, buffer: any, type: string): void;
|
||||
|
||||
pendingCase(testName: string, timestamp?: number): void;
|
||||
}
|
||||
|
||||
export = Allure;
|
||||
export as namespace Allure;
|
||||
declare namespace Allure {
|
||||
interface Options {
|
||||
targetDir: string;
|
||||
}
|
||||
|
||||
type Status = "passed" | "pending" | "skipped" | "failed" | "broken";
|
||||
|
||||
enum TYPE {
|
||||
TEXT = "text",
|
||||
HTML = "html",
|
||||
MARKDOWN = "markdown"
|
||||
}
|
||||
|
||||
class Suite {
|
||||
constructor(name: string, timestamp?: number);
|
||||
|
||||
name: string;
|
||||
|
||||
end(timestamp?: number): void;
|
||||
|
||||
hasTests(): boolean;
|
||||
|
||||
addTest(test: Test): boolean;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Test {
|
||||
constructor(name: string, timestamp?: number);
|
||||
|
||||
setDescription(description: string, type: TYPE): void;
|
||||
|
||||
addLabel(name: string, value: string): void;
|
||||
|
||||
addParameter(kind: any, name: string, value: string): void;
|
||||
|
||||
addStep(step: Step): void;
|
||||
|
||||
addAttachment(attachment: Attachment): void;
|
||||
|
||||
end(status: Status, error: Error, timestamp?: number): void;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Description {
|
||||
constructor(value: string, type: TYPE);
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Step {
|
||||
constructor(name: string, timestamp?: number);
|
||||
|
||||
addStep(step: Step): void;
|
||||
|
||||
addAttachment(attachment: Attachment): void;
|
||||
|
||||
end(status: Status, error: Error, timestamp?: number): void;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Attachment {
|
||||
constructor(title: string, source: any, size: number, mime: string);
|
||||
|
||||
addStep(step: Step): void;
|
||||
|
||||
addAttachment(attachment: Attachment): void;
|
||||
|
||||
end(status: Status, error: Error, timestamp?: number): void;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"allure-js-commons-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,3 @@
|
||||
import * as ansi from "ansi-escapes";
|
||||
|
||||
console.log(ansi.cursorUp(2) + ansi.cursorLeft === "\u001B[2A\u001B[1000D");
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
// Type definitions for ansi-escapes 3.0
|
||||
// Project: https://github.com/sindresorhus/ansi-escapes
|
||||
// Definitions by: Rong Shen <https://github.com/jacobbubu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare namespace Ansi {
|
||||
interface ImageOptions {
|
||||
width?: number;
|
||||
height?: number;
|
||||
preserveAspectRatio?: boolean;
|
||||
}
|
||||
|
||||
interface Term {
|
||||
setCwd(cwd: string): string;
|
||||
}
|
||||
|
||||
interface AnsiEscapes {
|
||||
cursorTo(x: number, y?: number): string;
|
||||
cursorMove(x: number, y?: number): string;
|
||||
cursorUp(count: number): string;
|
||||
cursorDown(count: number): string;
|
||||
cursorForward(count: number): string;
|
||||
cursorBackward(count: number): string;
|
||||
|
||||
cursorLeft: string;
|
||||
cursorSavePosition: string;
|
||||
cursorRestorePosition: string;
|
||||
cursorGetPosition: string;
|
||||
cursorNextLine: string;
|
||||
cursorPrevLine: string;
|
||||
cursorHide: string;
|
||||
cursorShow: string;
|
||||
|
||||
eraseLines(count: number): string;
|
||||
|
||||
eraseEndLine: string;
|
||||
eraseStartLine: string;
|
||||
eraseLine: string;
|
||||
eraseDown: string;
|
||||
eraseUp: string;
|
||||
eraseScreen: string;
|
||||
scrollUp: string;
|
||||
scrollDown: string;
|
||||
|
||||
clearScreen: string;
|
||||
beep: string;
|
||||
|
||||
link(text: string, url: string): string;
|
||||
image(buf: Buffer, opts?: ImageOptions): string;
|
||||
iTerm: Term;
|
||||
}
|
||||
}
|
||||
|
||||
declare const ansiEscapes: Ansi.AnsiEscapes;
|
||||
export = ansiEscapes;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"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-escapes-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -20,6 +20,12 @@ simpleExample.addArgument(
|
||||
help: 'bar foo',
|
||||
}
|
||||
);
|
||||
simpleExample.addArgument(
|
||||
'positional',
|
||||
{
|
||||
help: 'bar foo',
|
||||
}
|
||||
);
|
||||
|
||||
simpleExample.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
Vendored
+2
-1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/nodeca/argparse
|
||||
// Definitions by: Andrew Schurman <https://github.com/arcticwaters>
|
||||
// Tomasz Łaziuk <https://github.com/tlaziuk>
|
||||
// Sebastian Silbermann <https://github.com/eps1lon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -34,7 +35,7 @@ export class SubParser {
|
||||
}
|
||||
|
||||
export class ArgumentGroup {
|
||||
addArgument(args: string[], options?: ArgumentOptions): void;
|
||||
addArgument(args: string[] | string, options?: ArgumentOptions): void;
|
||||
addArgumentGroup(options?: ArgumentGroupOptions): ArgumentGroup;
|
||||
addMutuallyExclusiveGroup(options?: { required: boolean }): ArgumentGroup;
|
||||
setDefaults(options?: {}): void;
|
||||
|
||||
@@ -504,6 +504,7 @@ function callback(cb: AWSLambda.Callback) {
|
||||
cb();
|
||||
cb(null);
|
||||
cb(error);
|
||||
cb(str); // https://docs.aws.amazon.com/apigateway/latest/developerguide/handle-errors-in-lambda-integration.html
|
||||
cb(null, anyObj);
|
||||
cb(null, bool);
|
||||
cb(null, str);
|
||||
|
||||
Vendored
+4
-1
@@ -18,6 +18,7 @@
|
||||
// David Hayden <https://github.com/Haydabase>
|
||||
// Chris Redekop <https://github.com/repl-chris>
|
||||
// Aneil Mallavarapu <https://github.com/aneilbaboo>
|
||||
// Jeremy Nagel <https://github.com/jeznag>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -661,9 +662,11 @@ export type Handler<TEvent = any, TResult = any> = (
|
||||
* http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
|
||||
*
|
||||
* @param error – an optional parameter that you can use to provide results of the failed Lambda function execution.
|
||||
* It can be a string for Lambda Proxy Integrations
|
||||
* https://docs.aws.amazon.com/apigateway/latest/developerguide/handle-errors-in-lambda-integration.html
|
||||
* @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible.
|
||||
*/
|
||||
export type Callback<TResult = any> = (error?: Error | null, result?: TResult) => void;
|
||||
export type Callback<TResult = any> = (error?: Error | null | string, result?: TResult) => void;
|
||||
|
||||
// Begin defining Handler and Callback types for each API trigger type.
|
||||
// Ordered by https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import * as babel from "babel-core";
|
||||
|
||||
// Example from https://github.com/babel/babel/tree/master/packages/babel-core
|
||||
// Slightly modified example from https://github.com/babel/babel/tree/master/packages/babel-core
|
||||
const code = `class Example {}`;
|
||||
const result = babel.transform(code, { /* options */ });
|
||||
result.code; // Generated code
|
||||
result.map; // Sourcemap
|
||||
result.ast; // AST
|
||||
result.ignored;
|
||||
result.metadata;
|
||||
|
||||
// Examples from http://babeljs.io/docs/usage/api/
|
||||
// Slightly modified examples from http://babeljs.io/docs/usage/api/
|
||||
const options: babel.TransformOptions = {
|
||||
plugins: [
|
||||
"es2015-arrow-functions",
|
||||
@@ -24,6 +26,8 @@ babel.transformFile("filename.js", options, (err, result) => {
|
||||
result.code;
|
||||
result.map;
|
||||
result.ast;
|
||||
result.ignored;
|
||||
result.metadata;
|
||||
});
|
||||
|
||||
babel.transformFileSync("filename.js", options).code;
|
||||
|
||||
Vendored
+21
@@ -169,9 +169,30 @@ export interface TransformOptions {
|
||||
wrapPluginVisitorMethod?(pluginAlias: string, visitorType: 'enter' | 'exit', callback: (path: NodePath, state: any) => void): (path: NodePath, state: any) => void ;
|
||||
}
|
||||
|
||||
export interface BabelFileModulesMetadata {
|
||||
imports: object[];
|
||||
exports: {
|
||||
exported: object[],
|
||||
specifiers: object[]
|
||||
};
|
||||
}
|
||||
|
||||
export interface BabelFileMetadata {
|
||||
usedHelpers: string[];
|
||||
marked: Array<{
|
||||
type: string;
|
||||
message: string;
|
||||
loc: object;
|
||||
}>;
|
||||
modules: BabelFileModulesMetadata;
|
||||
}
|
||||
|
||||
export interface BabelFileResult {
|
||||
ast?: Node;
|
||||
code?: string;
|
||||
ignored?: boolean;
|
||||
map?: object;
|
||||
metadata?: BabelFileMetadata;
|
||||
}
|
||||
|
||||
export as namespace babel;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import blockies = require('blockies');
|
||||
|
||||
const seed = 'seed';
|
||||
blockies({ seed });
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Type definitions for blockies 0.0
|
||||
// Project: https://github.com/goldylucks/blockies-npm
|
||||
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface BlockiesIcon {
|
||||
toDataURL(): string;
|
||||
}
|
||||
interface BlockiesConfig {
|
||||
seed: string;
|
||||
}
|
||||
declare function blockies(config: BlockiesConfig): BlockiesIcon;
|
||||
|
||||
export = blockies;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "blockies-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,6 @@
|
||||
import BN = require('bn.js');
|
||||
|
||||
let bn = new BN(42);
|
||||
bn = bn.add(bn);
|
||||
bn.isZero();
|
||||
bn.byteLength;
|
||||
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
// Type definitions for bn.js 4.11
|
||||
// Project: https://github.com/indutny/bn.js
|
||||
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
type Endianness = 'le' | 'be';
|
||||
|
||||
declare class BN {
|
||||
constructor(num: number | string | number[] | Buffer, base?: number, endian?: Endianness);
|
||||
clone(): BN;
|
||||
toString(base?: number, length?: number): string;
|
||||
toNumber(): number;
|
||||
toJSON(): string;
|
||||
toArray(endian?: Endianness, length?: number): number[];
|
||||
toBuffer(endian?: Endianness, length?: number): Buffer;
|
||||
bitLength(): number;
|
||||
zeroBits(): number;
|
||||
byteLength(): number;
|
||||
isNeg(): boolean;
|
||||
isEven(): boolean;
|
||||
isOdd(): boolean;
|
||||
isZero(): boolean;
|
||||
cmp(b: any): number;
|
||||
lt(b: any): boolean;
|
||||
lte(b: any): boolean;
|
||||
gt(b: any): boolean;
|
||||
gte(b: any): boolean;
|
||||
eq(b: any): boolean;
|
||||
isBN(b: any): boolean;
|
||||
|
||||
neg(): BN;
|
||||
abs(): BN;
|
||||
add(b: BN): BN;
|
||||
sub(b: BN): BN;
|
||||
mul(b: BN): BN;
|
||||
sqr(): BN;
|
||||
pow(b: BN): BN;
|
||||
div(b: BN): BN;
|
||||
mod(b: BN): BN;
|
||||
divRound(b: BN): BN;
|
||||
|
||||
or(b: BN): BN;
|
||||
and(b: BN): BN;
|
||||
xor(b: BN): BN;
|
||||
setn(b: number): BN;
|
||||
shln(b: number): BN;
|
||||
shrn(b: number): BN;
|
||||
testn(b: number): boolean;
|
||||
maskn(b: number): BN;
|
||||
bincn(b: number): BN;
|
||||
notn(w: number): BN;
|
||||
|
||||
gcd(b: BN): BN;
|
||||
egcd(b: BN): { a: BN; b: BN; gcd: BN };
|
||||
invm(b: BN): BN;
|
||||
}
|
||||
|
||||
export = BN;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "bn.js-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+5
@@ -95,6 +95,11 @@ declare namespace Bull {
|
||||
*/
|
||||
data: any;
|
||||
|
||||
/**
|
||||
* How many attempts where made to run this job
|
||||
*/
|
||||
attemptsMade: number;
|
||||
|
||||
/**
|
||||
* Report progress on a job
|
||||
*/
|
||||
|
||||
Vendored
+20
-18
@@ -11,6 +11,7 @@
|
||||
// Sergey Rubanov <https://github.com/chicoxyzzy>
|
||||
// Simon Archer <https://github.com/archy-bold>
|
||||
// Ken Elkabany <https://github.com/braincore>
|
||||
// Slavik Nychkalo <https://github.com/gebeto>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -37,6 +38,7 @@ declare class Chart {
|
||||
canvas: HTMLCanvasElement|null;
|
||||
chartArea: Chart.ChartArea;
|
||||
static pluginService: PluginServiceStatic;
|
||||
static plugins: PluginServiceStatic;
|
||||
|
||||
static defaults: {
|
||||
global: Chart.ChartOptions & Chart.ChartFontOptions;
|
||||
@@ -56,40 +58,40 @@ declare class PluginServiceStatic {
|
||||
}
|
||||
|
||||
interface PluginServiceRegistrationOptions {
|
||||
beforeInit?(chartInstance: Chart): void;
|
||||
afterInit?(chartInstance: Chart): void;
|
||||
beforeInit?(chartInstance: Chart, options?: any): void;
|
||||
afterInit?(chartInstance: Chart, options?: any): void;
|
||||
|
||||
resize?(chartInstance: Chart, newChartSize: Size): void;
|
||||
resize?(chartInstance: Chart, newChartSize: Size, options?: any): void;
|
||||
|
||||
beforeUpdate?(chartInstance: Chart): void;
|
||||
afterScaleUpdate?(chartInstance: Chart): void;
|
||||
beforeDatasetsUpdate?(chartInstance: Chart): void;
|
||||
afterDatasetsUpdate?(chartInstance: Chart): void;
|
||||
afterUpdate?(chartInstance: Chart): void;
|
||||
beforeUpdate?(chartInstance: Chart, options?: any): void;
|
||||
afterScaleUpdate?(chartInstance: Chart, options?: any): void;
|
||||
beforeDatasetsUpdate?(chartInstance: Chart, options?: any): void;
|
||||
afterDatasetsUpdate?(chartInstance: Chart, options?: any): void;
|
||||
afterUpdate?(chartInstance: Chart, options?: any): void;
|
||||
|
||||
// This is called at the start of a render. It is only called once, even if the animation will run for a number of frames. Use beforeDraw or afterDraw
|
||||
// to do something on each animation frame
|
||||
beforeRender?(chartInstance: Chart): void;
|
||||
beforeRender?(chartInstance: Chart, options?: any): void;
|
||||
|
||||
// Easing is for animation
|
||||
beforeDraw?(chartInstance: Chart, easing: string): void;
|
||||
afterDraw?(chartInstance: Chart, easing: string): void;
|
||||
beforeDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
afterDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
// Before the datasets are drawn but after scales are drawn
|
||||
beforeDatasetsDraw?(chartInstance: Chart, easing: string): void;
|
||||
afterDatasetsDraw?(chartInstance: Chart, easing: string): void;
|
||||
beforeDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
afterDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
|
||||
// Called before drawing the `tooltip`. If any plugin returns `false`,
|
||||
// the tooltip drawing is cancelled until another `render` is triggered.
|
||||
beforeTooltipDraw?(chartInstance: Chart): void;
|
||||
beforeTooltipDraw?(chartInstance: Chart, tooltipData?: any, options?: any): void;
|
||||
// Called after drawing the `tooltip`. Note that this hook will not,
|
||||
// be called if the tooltip drawing has been previously cancelled.
|
||||
afterTooltipDraw?(chartInstance: Chart): void;
|
||||
afterTooltipDraw?(chartInstance: Chart, tooltipData?: any, options?: any): void;
|
||||
|
||||
destroy?(chartInstance: Chart): void;
|
||||
|
||||
// Called when an event occurs on the chart
|
||||
beforeEvent?(chartInstance: Chart, event: Event): void;
|
||||
afterEvent?(chartInstance: Chart, event: Event): void;
|
||||
beforeEvent?(chartInstance: Chart, event: Event, options?: any): void;
|
||||
afterEvent?(chartInstance: Chart, event: Event, options?: any): void;
|
||||
}
|
||||
|
||||
interface Size {
|
||||
@@ -98,7 +100,7 @@ interface Size {
|
||||
}
|
||||
|
||||
declare namespace Chart {
|
||||
type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie';
|
||||
type ChartType = 'line' | 'bar' | 'horizontalBar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie';
|
||||
|
||||
type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -519,7 +519,7 @@ declare namespace Chartist {
|
||||
|
||||
|
||||
interface ChartistSvgStatic {
|
||||
new (name: HTMLElement | string, attributes: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg;
|
||||
new (name?: HTMLElement | string, attributes?: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg;
|
||||
|
||||
Easing: ChartistEasingStatic;
|
||||
|
||||
|
||||
Vendored
+2
@@ -293,6 +293,8 @@ declare namespace chroma {
|
||||
|
||||
mode(mode: keyof ColorSpaces): this;
|
||||
|
||||
gamma(g: number): this;
|
||||
|
||||
cache(use: boolean): boolean;
|
||||
|
||||
correctLightness(enable?: boolean): this;
|
||||
|
||||
Vendored
+193
-198
@@ -10,99 +10,102 @@
|
||||
declare namespace chrome.cast {
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.AutoJoinPolicy
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.AutoJoinPolicy
|
||||
*/
|
||||
export interface AutoJoinPolicy {
|
||||
TAB_AND_ORIGIN_SCOPED: string;
|
||||
ORIGIN_SCOPED: string;
|
||||
PAGE_SCOPED: string;
|
||||
export enum AutoJoinPolicy {
|
||||
CUSTOM_CONTROLLER_SCOPED = "custom_controller_scoped",
|
||||
TAB_AND_ORIGIN_SCOPED = "tab_and_origin_scoped",
|
||||
ORIGIN_SCOPED = "origin_scoped",
|
||||
PAGE_SCOPED = "page_scoped"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.DefaultActionPolicy
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.DefaultActionPolicy
|
||||
*/
|
||||
export interface DefaultActionPolicy {
|
||||
CREATE_SESSION: string;
|
||||
CAST_THIS_TAB: string;
|
||||
export enum DefaultActionPolicy {
|
||||
CREATE_SESSION = "create_session",
|
||||
CAST_THIS_TAB = "cast_this_tab"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Capability
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.Capability
|
||||
*/
|
||||
export interface Capability {
|
||||
VIDEO_OUT: string;
|
||||
AUDIO_OUT: string;
|
||||
VIDEO_IN: string;
|
||||
AUDIO_IN: string;
|
||||
export enum Capability {
|
||||
VIDEO_OUT = "video_out",
|
||||
AUDIO_OUT = "audio_out",
|
||||
VIDEO_IN = "video_in",
|
||||
AUDIO_IN = "audio_in",
|
||||
MULTIZONE_GROUP = "multizone_group"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ErrorCode
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ErrorCode
|
||||
*/
|
||||
export interface ErrorCode {
|
||||
CANCEL: string;
|
||||
TIMEOUT: string;
|
||||
API_NOT_INITIALIZED: string;
|
||||
INVALID_PARAMETER: string;
|
||||
EXTENSION_NOT_COMPATIBLE: string;
|
||||
EXTENSION_MISSING: string;
|
||||
RECEIVER_UNAVAILABLE: string;
|
||||
SESSION_ERROR: string;
|
||||
CHANNEL_ERROR: string;
|
||||
LOAD_MEDIA_FAILED: string;
|
||||
export enum ErrorCode {
|
||||
CANCEL = "cancel",
|
||||
TIMEOUT = "timeout",
|
||||
API_NOT_INITIALIZED = "api_not_initialized",
|
||||
INVALID_PARAMETER = "invalid_parameter",
|
||||
EXTENSION_NOT_COMPATIBLE = "extension_not_compatible",
|
||||
EXTENSION_MISSING = "extension_missing",
|
||||
RECEIVER_UNAVAILABLE = "receiver_unavailable",
|
||||
SESSION_ERROR = "session_error",
|
||||
CHANNEL_ERROR = "channel_error",
|
||||
LOAD_MEDIA_FAILED = "load_media_failed"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverAvailability
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ReceiverAvailability
|
||||
*/
|
||||
export interface ReceiverAvailability {
|
||||
AVAILABLE: string;
|
||||
UNAVAILABLE: string;
|
||||
export enum ReceiverAvailability {
|
||||
AVAILABLE = "available",
|
||||
UNAVAILABLE = "unavailable"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SenderPlatform
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.SenderPlatform
|
||||
*/
|
||||
export interface SenderPlatform {
|
||||
CHROME: string;
|
||||
IOS: string;
|
||||
ANDROID: string;
|
||||
export enum SenderPlatform {
|
||||
CHROME = "chrome",
|
||||
IOS = "ios",
|
||||
ANDROID = "android"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ReceiverType
|
||||
*/
|
||||
export interface ReceiverType {
|
||||
CAST: string;
|
||||
HANGOUT: string;
|
||||
CUSTOM: string;
|
||||
export enum ReceiverType {
|
||||
CAST = "cast",
|
||||
DIAL = "dial",
|
||||
HANGOUT = "hangout",
|
||||
CUSTOM = "custom"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverAction
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ReceiverAction
|
||||
*/
|
||||
export interface ReceiverAction {
|
||||
CAST: string;
|
||||
STOP: string;
|
||||
export enum ReceiverAction {
|
||||
CAST = "cast",
|
||||
STOP = "stop"
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SessionStatus
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.SessionStatus
|
||||
*/
|
||||
export interface SessionStatus {
|
||||
CONNECTED: string;
|
||||
DISCONNECTED: string;
|
||||
STOPPED: string;
|
||||
export enum SessionStatus {
|
||||
CONNECTED = "connected",
|
||||
DISCONNECTED = "disconnected",
|
||||
STOPPED = "stopped"
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,7 +211,7 @@ declare namespace chrome.cast {
|
||||
receiverListener: (receiverAvailability: chrome.cast.ReceiverAvailability) => void,
|
||||
autoJoinPolicy?: chrome.cast.AutoJoinPolicy,
|
||||
defaultActionPolicy?: chrome.cast.DefaultActionPolicy
|
||||
):ApiConfig;
|
||||
): ApiConfig;
|
||||
|
||||
sessionRequest: chrome.cast.SessionRequest;
|
||||
sessionListener: (session: chrome.cast.Session) => void;
|
||||
@@ -229,7 +232,7 @@ declare namespace chrome.cast {
|
||||
code: chrome.cast.ErrorCode,
|
||||
description?: string,
|
||||
details?: Object
|
||||
):Error;
|
||||
): Error;
|
||||
|
||||
code: chrome.cast.ErrorCode;
|
||||
description?: string;
|
||||
@@ -237,15 +240,13 @@ declare namespace chrome.cast {
|
||||
|
||||
}
|
||||
|
||||
export interface Image {
|
||||
export class Image {
|
||||
/**
|
||||
* @param {string} url
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Image
|
||||
*/
|
||||
new(
|
||||
url: string
|
||||
):Image;
|
||||
constructor(url: string);
|
||||
|
||||
url: string;
|
||||
height?: number;
|
||||
@@ -260,7 +261,7 @@ declare namespace chrome.cast {
|
||||
*/
|
||||
new(
|
||||
platform: chrome.cast.SenderPlatform
|
||||
):SenderApplication;
|
||||
): SenderApplication;
|
||||
|
||||
platform: chrome.cast.SenderPlatform;
|
||||
url?: string;
|
||||
@@ -279,7 +280,7 @@ declare namespace chrome.cast {
|
||||
appId: string,
|
||||
capabilities?: Array<chrome.cast.Capability>,
|
||||
timeout?: number
|
||||
):SessionRequest;
|
||||
): SessionRequest;
|
||||
|
||||
appId: string;
|
||||
capabilities: Array<chrome.cast.Capability>;
|
||||
@@ -303,7 +304,7 @@ declare namespace chrome.cast {
|
||||
displayName: string,
|
||||
appImages: Array<chrome.cast.Image>,
|
||||
receiver: chrome.cast.Receiver
|
||||
):Session;
|
||||
): Session;
|
||||
|
||||
sessionId: string;
|
||||
appId: string;
|
||||
@@ -311,7 +312,7 @@ declare namespace chrome.cast {
|
||||
appImages: Array<chrome.cast.Image>;
|
||||
receiver: chrome.cast.Receiver;
|
||||
senderApps: Array<chrome.cast.SenderApplication>;
|
||||
namespaces: Array<{name: string}>;
|
||||
namespaces: Array<{ name: string }>;
|
||||
media: Array<chrome.cast.media.Media>;
|
||||
status: chrome.cast.SessionStatus
|
||||
|
||||
@@ -324,7 +325,7 @@ declare namespace chrome.cast {
|
||||
newLevel: number,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {boolean} muted
|
||||
@@ -335,7 +336,7 @@ declare namespace chrome.cast {
|
||||
muted: boolean,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function()} successCallback
|
||||
@@ -344,7 +345,7 @@ declare namespace chrome.cast {
|
||||
leave(
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function()} successCallback
|
||||
@@ -353,7 +354,7 @@ declare namespace chrome.cast {
|
||||
stop(
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {string} namespace
|
||||
@@ -366,21 +367,21 @@ declare namespace chrome.cast {
|
||||
message: string,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
addUpdateListener(
|
||||
listener: (isAlive:boolean) => void
|
||||
):void
|
||||
listener: (isAlive: boolean) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
removeUpdateListener(
|
||||
listener: (isAlive:boolean) => void
|
||||
):void
|
||||
listener: (isAlive: boolean) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {string} namespace
|
||||
@@ -389,7 +390,7 @@ declare namespace chrome.cast {
|
||||
addMessageListener(
|
||||
namespace: string,
|
||||
listener: (namespace: string, message: string) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {string} namespace
|
||||
@@ -397,22 +398,22 @@ declare namespace chrome.cast {
|
||||
*/
|
||||
removeMessageListener(
|
||||
namespace: string,
|
||||
listener: (namespace:string, message:string) => void
|
||||
):void
|
||||
listener: (namespace: string, message: string) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function(!chrome.cast.media.Media)} listener
|
||||
*/
|
||||
addMediaListener(
|
||||
listener: (media: chrome.cast.media.Media) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function(!chrome.cast.media.Media)} listener
|
||||
*/
|
||||
removeMediaListener(
|
||||
listener: (media: chrome.cast.media.Media) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.media.LoadRequest} loadRequest
|
||||
@@ -423,7 +424,7 @@ declare namespace chrome.cast {
|
||||
loadRequest: chrome.cast.media.LoadRequest,
|
||||
successCallback: (media: chrome.cast.media.Media) => void,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.media.QueueLoadRequest} queueLoadRequest
|
||||
@@ -434,7 +435,7 @@ declare namespace chrome.cast {
|
||||
queueLoadRequest: chrome.cast.media.QueueLoadRequest,
|
||||
successCallback: (media: chrome.cast.media.Media) => void,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
}
|
||||
|
||||
export interface Receiver {
|
||||
@@ -451,7 +452,7 @@ declare namespace chrome.cast {
|
||||
friendlyName: string,
|
||||
capabilities?: Array<chrome.cast.Capability>,
|
||||
volume?: chrome.cast.Volume
|
||||
):Receiver;
|
||||
): Receiver;
|
||||
|
||||
label: string;
|
||||
friendlyName: string;
|
||||
@@ -471,7 +472,7 @@ declare namespace chrome.cast {
|
||||
new(
|
||||
statusText: string,
|
||||
appImages: Array<chrome.cast.Image>
|
||||
):ReceiverDisplayStatus;
|
||||
): ReceiverDisplayStatus;
|
||||
|
||||
statusText: string;
|
||||
appImages: Array<chrome.cast.Image>;
|
||||
@@ -487,7 +488,7 @@ declare namespace chrome.cast {
|
||||
new(
|
||||
level?: number,
|
||||
muted?: boolean
|
||||
):Volume;
|
||||
): Volume;
|
||||
|
||||
level?: number;
|
||||
muted?: boolean;
|
||||
@@ -500,77 +501,77 @@ declare namespace chrome.cast.media {
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaCommand
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.MediaCommand
|
||||
*/
|
||||
export interface MediaCommand {
|
||||
PAUSE: string;
|
||||
SEEK: string;
|
||||
STREAM_VOLUME: string;
|
||||
STREAM_MUTE: string;
|
||||
export enum MediaCommand {
|
||||
PAUSE = "pause",
|
||||
SEEK = "seek",
|
||||
STREAM_VOLUME = "stream_volume",
|
||||
STREAM_MUTE = "stream_mute"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MetadataType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.MetadataType
|
||||
*/
|
||||
export interface MetadataType {
|
||||
GENERIC: number;
|
||||
TV_SHOW: number;
|
||||
MOVIE: number;
|
||||
MUSIC_TRACK: number;
|
||||
PHOTO: number;
|
||||
export enum MetadataType {
|
||||
GENERIC,
|
||||
TV_SHOW,
|
||||
MOVIE,
|
||||
MUSIC_TRACK,
|
||||
PHOTO
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayerState
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.PlayerState
|
||||
*/
|
||||
export interface PlayerState {
|
||||
IDLE: string;
|
||||
PLAYING: string;
|
||||
PAUSED: string;
|
||||
BUFFERING: string;
|
||||
export enum PlayerState {
|
||||
IDLE = "IDLE",
|
||||
PLAYING = "PLAYING",
|
||||
PAUSED = "PAUSED",
|
||||
BUFFERING = "BUFFERING"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.ResumeState
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.ResumeState
|
||||
*/
|
||||
export interface ResumeState {
|
||||
PLAYBACK_START: string;
|
||||
PLAYBACK_PAUSE: string;
|
||||
export enum ResumeState {
|
||||
PLAYBACK_START = "PLAYBACK_START",
|
||||
PLAYBACK_PAUSE = "PLAYBACK_PAUSE"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StreamType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.StreamType
|
||||
*/
|
||||
export interface StreamType {
|
||||
BUFFERED: string;
|
||||
LIVE: string;
|
||||
OTHER: string;
|
||||
export enum StreamType {
|
||||
BUFFERED = "BUFFERED",
|
||||
LIVE = "LIVE",
|
||||
OTHER = "OTHER"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.IdleReason
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.IdleReason
|
||||
*/
|
||||
export interface IdleReason {
|
||||
CANCELLED: string;
|
||||
INTERRUPTED: string;
|
||||
FINISHED: string;
|
||||
ERROR: string;
|
||||
export enum IdleReason {
|
||||
CANCELLED = "CANCELLED",
|
||||
INTERRUPTED = "INTERRUPTED",
|
||||
FINISHED = "FINISHED",
|
||||
ERROR = "ERROR"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.RepeatMode
|
||||
*/
|
||||
export interface RepeatMode {
|
||||
OFF:string;
|
||||
ALL:string;
|
||||
SINGLE:string;
|
||||
ALL_AND_SHUFFLE:string;
|
||||
export enum RepeatMode {
|
||||
OFF = "REPEAT_OFF",
|
||||
ALL = "REPEAT_ALL",
|
||||
SINGLE = "REPEAT_SINGLE",
|
||||
ALL_AND_SHUFFLE = "REPEAT_ALL_AND_SHUFFLE"
|
||||
}
|
||||
|
||||
export interface QueueItem {
|
||||
@@ -581,7 +582,7 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
mediaInfo: chrome.cast.media.MediaInfo
|
||||
):QueueItem;
|
||||
): QueueItem;
|
||||
|
||||
activeTrackIds: Array<Number>;
|
||||
autoplay: boolean;
|
||||
@@ -600,7 +601,7 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
items: Array<chrome.cast.media.QueueItem>
|
||||
):QueueLoadRequest;
|
||||
): QueueLoadRequest;
|
||||
|
||||
customData: Object;
|
||||
items: Array<chrome.cast.media.QueueItem>;
|
||||
@@ -616,10 +617,10 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
itemsToInsert: Array<chrome.cast.media.QueueItem>
|
||||
):QueueInsertItemsRequest;
|
||||
): QueueInsertItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
insertBefore:number;
|
||||
insertBefore: number;
|
||||
items: Array<chrome.cast.media.QueueItem>;
|
||||
}
|
||||
|
||||
@@ -631,7 +632,7 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
itemIdsToRemove: Array<number>
|
||||
):QueueRemoveItemsRequest;
|
||||
): QueueRemoveItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
itemIds: Array<number>;
|
||||
@@ -645,7 +646,7 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
itemIdsToReorder: Array<number>
|
||||
):QueueReorderItemsRequest;
|
||||
): QueueReorderItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
insertBefore: number;
|
||||
@@ -660,7 +661,7 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
itemsToUpdate: Array<chrome.cast.media.QueueItem>
|
||||
):QueueUpdateItemsRequest;
|
||||
): QueueUpdateItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
item: Array<chrome.cast.media.QueueItem>;
|
||||
@@ -668,71 +669,71 @@ declare namespace chrome.cast.media {
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TrackType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TrackType
|
||||
*/
|
||||
export interface TrackType {
|
||||
TEXT: string;
|
||||
AUDIO: string;
|
||||
VIDEO: string;
|
||||
export enum TrackType {
|
||||
TEXT = "TEXT",
|
||||
AUDIO = "AUDIO",
|
||||
VIDEO = "VIDEO"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackType
|
||||
*/
|
||||
export interface TextTrackType {
|
||||
SUBTITLES: string;
|
||||
CAPTIONS: string;
|
||||
DESCRIPTIONS: string;
|
||||
CHAPTERS: string;
|
||||
METADATA: string;
|
||||
export enum TextTrackType {
|
||||
SUBTITLES = "SUBTITLES",
|
||||
CAPTIONS = "CAPTIONS",
|
||||
DESCRIPTIONS = "DESCRIPTIONS",
|
||||
CHAPTERS = "CHAPTERS",
|
||||
METADATA = "METADATA"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackEdgeType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackEdgeType
|
||||
*/
|
||||
export interface TextTrackEdgeType {
|
||||
NONE: string;
|
||||
OUTLINE: string;
|
||||
DROP_SHADOW: string;
|
||||
RAISED: string;
|
||||
DEPRESSED: string;
|
||||
export enum TextTrackEdgeType {
|
||||
NONE = "NONE",
|
||||
OUTLINE = "OUTLINE",
|
||||
DROP_SHADOW = "DROP_SHADOW",
|
||||
RAISED = "RAISED",
|
||||
DEPRESSED = "DEPRESSED"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackWindowType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackWindowType
|
||||
*/
|
||||
export interface TextTrackWindowType {
|
||||
NONE: string;
|
||||
NORMAL: string;
|
||||
ROUNDED_CORNERS: string;
|
||||
export enum TextTrackWindowType {
|
||||
NONE = "NONE",
|
||||
NORMAL = "NORMAL",
|
||||
ROUNDED_CORNERS = "ROUNDED_CORNERS"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackFontGenericFamily
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackFontGenericFamily
|
||||
*/
|
||||
export interface TextTrackFontGenericFamily {
|
||||
SANS_SERIF: string;
|
||||
MONOSPACED_SANS_SERIF: string;
|
||||
SERIF: string;
|
||||
MONOSPACED_SERIF: string;
|
||||
CASUAL: string;
|
||||
CURSIVE: string;
|
||||
SMALL_CAPITALS: string;
|
||||
export enum TextTrackFontGenericFamily {
|
||||
SANS_SERIF = "SANS_SERIF",
|
||||
MONOSPACED_SANS_SERIF = "MONOSPACED_SANS_SERIF",
|
||||
SERIF = "SERIF",
|
||||
MONOSPACED_SERIF = "MONOSPACED_SERIF",
|
||||
CASUAL = "CASUAL",
|
||||
CURSIVE = "CURSIVE",
|
||||
SMALL_CAPITALS = "SMALL_CAPITALS"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackFontStyle
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackFontStyle
|
||||
*/
|
||||
export interface TextTrackFontStyle {
|
||||
NORMAL: string;
|
||||
BOLD: string;
|
||||
BOLD_ITALIC: string;
|
||||
ITALIC: string;
|
||||
export enum TextTrackFontStyle {
|
||||
NORMAL = "NORMAL",
|
||||
BOLD = "BOLD",
|
||||
BOLD_ITALIC = "BOLD_ITALIC",
|
||||
ITALIC = "ITALIC"
|
||||
}
|
||||
|
||||
export interface GetStatusRequest {
|
||||
@@ -740,7 +741,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GetStatusRequest
|
||||
*/
|
||||
new():GetStatusRequest;
|
||||
new(): GetStatusRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -750,7 +751,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PauseRequest
|
||||
*/
|
||||
new():PauseRequest;
|
||||
new(): PauseRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -760,7 +761,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayRequest
|
||||
*/
|
||||
new():PlayRequest;
|
||||
new(): PlayRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -770,7 +771,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.SeekRequest
|
||||
*/
|
||||
new():SeekRequest;
|
||||
new(): SeekRequest;
|
||||
|
||||
currentTime: number;
|
||||
resumeState: chrome.cast.media.ResumeState;
|
||||
@@ -782,7 +783,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StopRequest
|
||||
*/
|
||||
new():StopRequest;
|
||||
new(): StopRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -795,21 +796,21 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
volume: chrome.cast.Volume
|
||||
):VolumeRequest;
|
||||
): VolumeRequest;
|
||||
|
||||
volume: chrome.cast.Volume;
|
||||
customData: Object;
|
||||
}
|
||||
|
||||
export interface LoadRequest {
|
||||
export class LoadRequest {
|
||||
/**
|
||||
* @param {!chrome.cast.media.MediaInfo} mediaInfo
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.LoadRequest
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
mediaInfo: chrome.cast.media.MediaInfo
|
||||
):LoadRequest;
|
||||
);
|
||||
|
||||
activeTrackIds: Array<number>;
|
||||
autoplay: boolean;
|
||||
@@ -828,19 +829,13 @@ declare namespace chrome.cast.media {
|
||||
new(
|
||||
activeTrackIds?: Array<number>,
|
||||
textTrackStyle?: chrome.cast.media.TextTrackStyle
|
||||
):EditTracksInfoRequest;
|
||||
): EditTracksInfoRequest;
|
||||
|
||||
activeTrackIds: Array<number>;
|
||||
textTrackStyle: chrome.cast.media.TextTrackStyle;
|
||||
}
|
||||
|
||||
export interface GenericMediaMetadata {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GenericMediaMetadata
|
||||
*/
|
||||
new():GenericMediaMetadata;
|
||||
|
||||
export class GenericMediaMetadata {
|
||||
images: Array<chrome.cast.Image>;
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
releaseDate: string;
|
||||
@@ -857,7 +852,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MovieMediaMetadata
|
||||
*/
|
||||
new():MovieMediaMetadata;
|
||||
new(): MovieMediaMetadata;
|
||||
|
||||
images: Array<chrome.cast.Image>;
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
@@ -898,7 +893,7 @@ declare namespace chrome.cast.media {
|
||||
releaseYear: number;
|
||||
}
|
||||
|
||||
export interface MusicTrackMediaMetadata {
|
||||
export interface MusicTrackMediaMetadata {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MusicTrackMediaMetadata
|
||||
@@ -947,17 +942,17 @@ declare namespace chrome.cast.media {
|
||||
type: chrome.cast.media.MetadataType;
|
||||
}
|
||||
|
||||
export interface MediaInfo {
|
||||
export class MediaInfo {
|
||||
/**
|
||||
* @param {string} contentId
|
||||
* @param {string} contentType
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaInfo
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
contentId: string,
|
||||
contentType: string
|
||||
): MediaInfo;
|
||||
);
|
||||
|
||||
contentId: string;
|
||||
streamType: chrome.cast.media.StreamType;
|
||||
@@ -1089,14 +1084,14 @@ declare namespace chrome.cast.media {
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
addUpdateListener(
|
||||
listener: (isAlive:boolean) => void
|
||||
listener: (isAlive: boolean) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
removeUpdateListener(
|
||||
listener: (isAlive:boolean) => void
|
||||
listener: (isAlive: boolean) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
@@ -1110,7 +1105,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueAppendItem (
|
||||
queueAppendItem(
|
||||
item: chrome.cast.media.QueueItem,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1121,7 +1116,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueInsertItems (
|
||||
queueInsertItems(
|
||||
queueInsertItemsRequest: chrome.cast.media.QueueInsertItemsRequest,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1132,7 +1127,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueJumpToItem (
|
||||
queueJumpToItem(
|
||||
itemId: number,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1144,7 +1139,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueMoveItemToNewIndex (
|
||||
queueMoveItemToNewIndex(
|
||||
itemId: number,
|
||||
newIndex: number,
|
||||
successCallback: Function,
|
||||
@@ -1155,7 +1150,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueNext (
|
||||
queueNext(
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
@@ -1164,7 +1159,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queuePrev (
|
||||
queuePrev(
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
@@ -1174,7 +1169,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueRemoveItem (
|
||||
queueRemoveItem(
|
||||
itemId: number,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1185,7 +1180,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueReorderItems (
|
||||
queueReorderItems(
|
||||
queueReorderItemsRequest: chrome.cast.media.QueueReorderItemsRequest,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1196,7 +1191,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueSetRepeatMode (
|
||||
queueSetRepeatMode(
|
||||
repeatMode: chrome.cast.media.RepeatMode,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1207,7 +1202,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueUpdateItems (
|
||||
queueUpdateItems(
|
||||
queueUpdateItemsRequest: chrome.cast.media.QueueUpdateItemsRequest,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
|
||||
+725
-111
@@ -6,9 +6,9 @@ function test_CKEDITOR() {
|
||||
CKEDITOR.skinName = 'moono';
|
||||
CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
|
||||
var editor = new CKEDITOR.editor();
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_NONE)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT)
|
||||
if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_ELEMENT)
|
||||
if (editor.getSelection(false).getType() == CKEDITOR.SELECTION_NONE)
|
||||
if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_TEXT)
|
||||
alert(CKEDITOR.basePath);
|
||||
if (CKEDITOR.currentInstance)
|
||||
alert(CKEDITOR.currentInstance.name);
|
||||
@@ -35,6 +35,13 @@ function test_CKEDITOR() {
|
||||
CKEDITOR.replaceAll();
|
||||
CKEDITOR.replaceAll('myClassName');
|
||||
CKEDITOR.replaceAll((textarea, config) => false);
|
||||
|
||||
var editor: CKEDITOR.editor = CKEDITOR.appendTo('append here', CKEDITOR.config, 'data');
|
||||
var editor: CKEDITOR.editor = CKEDITOR.appendTo(document.createElement('div'));
|
||||
CKEDITOR.error('code');
|
||||
CKEDITOR.error('500', { moreData: true });
|
||||
CKEDITOR.warn('danger');
|
||||
CKEDITOR.warn('303', 12345);
|
||||
}
|
||||
|
||||
function test_CKEDITOR_events() {
|
||||
@@ -83,6 +90,8 @@ function test_dom_comment() {
|
||||
var nativeNode = document.createComment('Example');
|
||||
var comment = new CKEDITOR.dom.comment(nativeNode);
|
||||
var comment2 = new CKEDITOR.dom.comment('Example');
|
||||
var comment3 = new CKEDITOR.dom.comment('Example', new CKEDITOR.dom.document(document));
|
||||
var html: string = comment.getOuterHtml();
|
||||
}
|
||||
|
||||
function test_dom_document() {
|
||||
@@ -103,10 +112,16 @@ function test_dom_document() {
|
||||
'<body>Document contents created by code</body>' +
|
||||
'</html>'
|
||||
);
|
||||
var styles: CSSStyleSheet = document.appendStyleText('some styles');
|
||||
var element: CKEDITOR.dom.element = document.createElement('div');
|
||||
var element2: CKEDITOR.dom.element = document.createElement('div', { styles: { height: '1234' } });
|
||||
var element3: CKEDITOR.dom.element = document.createElement('div', { attributes: { id: '1234' } });
|
||||
var element4: CKEDITOR.dom.element = document.createElement('div', { attributes: { tabIndex: '1234' }, styles: { width: '1234' } });
|
||||
}
|
||||
|
||||
function test_dom_documentFragment() {
|
||||
var type = CKEDITOR.NODE_DOCUMENT_FRAGMENT;
|
||||
alert(new CKEDITOR.dom.documentFragment(document.body).type === type);
|
||||
}
|
||||
|
||||
function test_dom_domObject() {
|
||||
@@ -124,6 +139,8 @@ function test_dom_domObject() {
|
||||
var elementB = new CKEDITOR.dom.element(nativeElement).getPrivate().value;
|
||||
var element3 = new CKEDITOR.dom.element('span');
|
||||
element.setCustomData('hasCustomData', true);
|
||||
|
||||
var domObject = new CKEDITOR.dom.domObject(document.createElement('div'));
|
||||
}
|
||||
|
||||
function test_dom_element() {
|
||||
@@ -156,6 +173,7 @@ function test_dom_element() {
|
||||
element.appendTo(CKEDITOR.document.getBody());
|
||||
alert(element.getEditor().name);
|
||||
var first = element.getFirst();
|
||||
var first2 = element.getFirst((node: CKEDITOR.dom.node) => node.equals(document.body));
|
||||
alert(element.getHtml());
|
||||
alert(element.getId());
|
||||
alert(element.getName());
|
||||
@@ -199,6 +217,26 @@ function test_dom_element() {
|
||||
alert(element == CKEDITOR.dom.element.get(element));
|
||||
var htmlElement = document.getElementById('myElement');
|
||||
alert(CKEDITOR.dom.element.get(htmlElement).getName());
|
||||
|
||||
var dtd: CKEDITOR.dtdDefinition = element.getDtd();
|
||||
var last: CKEDITOR.dom.node = element.getLast();
|
||||
var last2: CKEDITOR.dom.node = element.getLast((node: CKEDITOR.dom.node) => node.equals(document.body));
|
||||
if (element.isBlockBoundary({ 'div': 1, 'span': 1 })) {
|
||||
element.setState(1, 'hex', false);
|
||||
}
|
||||
|
||||
CKEDITOR.dom.element.clearMarkers({}, element, true);
|
||||
var element1: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div');
|
||||
var element2: CKEDITOR.dom.element = CKEDITOR.dom.element.get(document.createElement('div'));
|
||||
var element3: CKEDITOR.dom.element = CKEDITOR.dom.element.get(element2);
|
||||
var markedElement: CKEDITOR.dom.element = CKEDITOR.dom.element.setMarker({}, element, 'key', 0);
|
||||
}
|
||||
|
||||
function test_dom_elementPath() {
|
||||
var path: CKEDITOR.dom.elementPath = new CKEDITOR.dom.elementPath(CKEDITOR.dom.element.get('div'));
|
||||
var path2: CKEDITOR.dom.elementPath = new CKEDITOR.dom.elementPath(CKEDITOR.dom.element.get('div'), CKEDITOR.dom.element.get(document.body));
|
||||
|
||||
var dir: 'ltr' | 'rtl' = path.direction();
|
||||
}
|
||||
|
||||
function test_dom_event() {
|
||||
@@ -226,8 +264,10 @@ function test_dom_event() {
|
||||
function test_dom_iterator() {
|
||||
var range = new CKEDITOR.dom.range(new CKEDITOR.dom.element('div'));
|
||||
var iterator = range.createIterator();
|
||||
iterator.getNextParagraph();
|
||||
iterator.getNextParagraph();
|
||||
var paragrah1: CKEDITOR.dom.element = iterator.getNextParagraph();
|
||||
var paragrah2: CKEDITOR.dom.element = iterator.getNextParagraph('div');
|
||||
alert(iterator.forceBrBreak === false);
|
||||
var itRange: CKEDITOR.dom.range = iterator.range;
|
||||
}
|
||||
|
||||
function test_dom_node() {
|
||||
@@ -255,6 +295,7 @@ function test_dom_node() {
|
||||
function test_dom_nodeList() {
|
||||
var nodeList = CKEDITOR.document.getBody().getChildren();
|
||||
alert(nodeList.count());
|
||||
var nodes: CKEDITOR.dom.node[] = nodeList.toArray();
|
||||
}
|
||||
|
||||
function test_dom_range() {
|
||||
@@ -268,19 +309,96 @@ function test_dom_range() {
|
||||
alert(range.collapsed);
|
||||
range.selectNodeContents(range.document.getBody());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.endContainer.getName());
|
||||
alert(range.endContainer.getPrivate());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.endOffset);
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.startContainer.getName());
|
||||
alert(range.startContainer.getDocument());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.startOffset);
|
||||
}
|
||||
|
||||
function test_dom_selection() {
|
||||
var element: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div');
|
||||
var selection: CKEDITOR.dom.selection = new CKEDITOR.dom.selection(new CKEDITOR.dom.document(document));
|
||||
selection = new CKEDITOR.dom.selection(element);
|
||||
selection = new CKEDITOR.dom.selection(selection);
|
||||
|
||||
var marks: CKEDITOR.dom.bookmark[] = selection.createBookmarks('serialized');
|
||||
var marks2: CKEDITOR.dom.bookmark2[] = selection.createBookmarks2({ normalized: true });
|
||||
selection.fake(element);
|
||||
selection.fake(element, true);
|
||||
element = selection.getCommonAncestor();
|
||||
var domSel: Selection = selection.getNative();
|
||||
var ranges: CKEDITOR.dom.range[] = selection.getRanges();
|
||||
ranges = selection.getRanges(true);
|
||||
element = selection.getSelectedElement();
|
||||
var text: string = selection.getSelectedText();
|
||||
element = selection.getStartElement();
|
||||
|
||||
var type: number = selection.getType();
|
||||
|
||||
var isSomething: boolean = selection.isCollapsed();
|
||||
isSomething = selection.isHidden();
|
||||
isSomething = selection.isInTable();
|
||||
isSomething = selection.isInTable(false);
|
||||
|
||||
selection.lock();
|
||||
selection.removeAllRanges();
|
||||
selection.reset();
|
||||
selection.removeAllRanges();
|
||||
selection.reset();
|
||||
selection.scrollIntoView();
|
||||
selection = selection.selectBookmarks(marks);
|
||||
selection = selection.selectBookmarks(marks2);
|
||||
selection.selectElement(element);
|
||||
selection.selectRanges(ranges);
|
||||
selection.unlock(false);
|
||||
}
|
||||
|
||||
function test_dom_walker() {
|
||||
var element: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div');
|
||||
var range: CKEDITOR.dom.range = new CKEDITOR.dom.range(element);
|
||||
|
||||
var walker: CKEDITOR.dom.walker = new CKEDITOR.dom.walker(range);
|
||||
|
||||
var isSomething: boolean = walker.checkBackward();
|
||||
isSomething = walker.checkForward();
|
||||
walker.end();
|
||||
|
||||
var node: CKEDITOR.dom.node = walker.lastBackward();
|
||||
node = walker.lastForward();
|
||||
node = walker.next();
|
||||
node = walker.previous();
|
||||
walker.reset();
|
||||
|
||||
isSomething = CKEDITOR.dom.walker.blockBoundary({ 'div': 1 })(node);
|
||||
isSomething = CKEDITOR.dom.walker.bogus()(node);
|
||||
isSomething = CKEDITOR.dom.walker.bogus(isSomething)(node);
|
||||
isSomething = CKEDITOR.dom.walker.bookmark()(node);
|
||||
isSomething = CKEDITOR.dom.walker.bookmark(true)(node);
|
||||
isSomething = CKEDITOR.dom.walker.bookmark(true, false)(node);
|
||||
isSomething = CKEDITOR.dom.walker.editable()(node);
|
||||
isSomething = CKEDITOR.dom.walker.editable(isSomething)(node);
|
||||
isSomething = CKEDITOR.dom.walker.empty()(node);
|
||||
isSomething = CKEDITOR.dom.walker.empty(true)(node);
|
||||
isSomething = CKEDITOR.dom.walker.ignored()(node);
|
||||
isSomething = CKEDITOR.dom.walker.ignored(true)(node);
|
||||
isSomething = CKEDITOR.dom.walker.listItemBoundary()(node);
|
||||
isSomething = CKEDITOR.dom.walker.nodeType(0)(node);
|
||||
isSomething = CKEDITOR.dom.walker.nodeType(1, true)(node);
|
||||
isSomething = CKEDITOR.dom.walker.temp()(node);
|
||||
isSomething = CKEDITOR.dom.walker.temp(isSomething)(node);
|
||||
isSomething = CKEDITOR.dom.walker.whitespaces()(node);
|
||||
isSomething = CKEDITOR.dom.walker.whitespaces(isSomething)(node);
|
||||
}
|
||||
|
||||
function test_dom_text() {
|
||||
var nativeNode = document.createTextNode('Example');
|
||||
var text = new CKEDITOR.dom.text(nativeNode);
|
||||
var text2 = new CKEDITOR.dom.text('Example');
|
||||
text.substring(1, 2);
|
||||
text.substring(1);
|
||||
}
|
||||
|
||||
function test_dom_window() {
|
||||
@@ -292,6 +410,545 @@ function test_dom_window() {
|
||||
var size = win.getViewPaneSize();
|
||||
alert(size.width);
|
||||
alert(size.height);
|
||||
|
||||
var frame: CKEDITOR.dom.element = win.getFrame();
|
||||
win.focus();
|
||||
}
|
||||
|
||||
function test_ajax() {
|
||||
var req: string = CKEDITOR.ajax.load('https://ckeditor.com/ckeditor-4/');
|
||||
req = CKEDITOR.ajax.load('https://ckeditor.com/ckeditor-4/', (data: any) => console.log(data));
|
||||
|
||||
var xml: CKEDITOR.xml = CKEDITOR.ajax.loadXml('https://ckeditor.com/ckeditor-4/');
|
||||
xml = CKEDITOR.ajax.loadXml('https://ckeditor.com/ckeditor-4/', (data: any) => console.log(data));
|
||||
|
||||
CKEDITOR.ajax.post('https://ckeditor.com/ckeditor-4/', {});
|
||||
CKEDITOR.ajax.post('https://ckeditor.com/ckeditor-4/', {}, 'html');
|
||||
CKEDITOR.ajax.post('https://ckeditor.com/ckeditor-4/', {}, 'text', (data: any) => console.log(data));
|
||||
}
|
||||
|
||||
function test_dataProcessor() {
|
||||
var processor: CKEDITOR.dataProcessor;
|
||||
processor.toDataFormat('html', 'fix');
|
||||
processor.toHtml('data');
|
||||
processor.toHtml('data', 'fix');
|
||||
}
|
||||
|
||||
function test_dialog() {
|
||||
var dialog: CKEDITOR.dialog = new CKEDITOR.dialog(CKEDITOR.instances[0], 'dialog');
|
||||
|
||||
var element: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div');
|
||||
dialog.addFocusable(element);
|
||||
dialog.addFocusable(element, 13);
|
||||
dialog.addPage({ some: true, object: false });
|
||||
var ret = dialog.click('1234');
|
||||
dialog.commitContent();
|
||||
dialog.disableButton('some button');
|
||||
dialog.enableButton('4321');
|
||||
dialog = dialog.foreach(() => console.log('hey'));
|
||||
|
||||
var button: CKEDITOR.ui.dialog.button = dialog.getButton('button1');
|
||||
var uiEl: CKEDITOR.ui.dialog.uiElement = dialog.getContentElement('page1', 'element1');
|
||||
element = dialog.getElement();
|
||||
var str: string = dialog.getName();
|
||||
var numb: number = dialog.getPageCount();
|
||||
var editor: CKEDITOR.editor = dialog.getParentEditor();
|
||||
var obj: { [key: string]: any } = dialog.getPosition();
|
||||
element = dialog.getSelectedElement();
|
||||
obj = dialog.getSize();
|
||||
obj = dialog.getValueOf('page1', 'ele1');
|
||||
dialog.hide();
|
||||
dialog.hidePage('1234');
|
||||
dialog.layout();
|
||||
dialog.move(1, 2, true);
|
||||
dialog = dialog.reset();
|
||||
dialog.resize(numb, numb);
|
||||
dialog.selectPage('1');
|
||||
dialog.setState(4);
|
||||
dialog.setValueOf('page1', 'ele1', false);
|
||||
dialog.setupContent();
|
||||
dialog.show();
|
||||
dialog.showPage('1234');
|
||||
dialog.updateStyle();
|
||||
|
||||
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
|
||||
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
|
||||
return {
|
||||
title: 'Abbreviation Properties',
|
||||
minWidth: 400,
|
||||
minHeight: 200,
|
||||
onLoad: () => {},
|
||||
onOk: () => {},
|
||||
onCancel: () => {},
|
||||
onShow: () => {},
|
||||
onHide: () => {},
|
||||
contents: [
|
||||
{
|
||||
id: 'tab-basic',
|
||||
label: 'Basic Settings',
|
||||
elements: <any[]>[]
|
||||
},
|
||||
{
|
||||
id: 'tab-adv',
|
||||
label: 'Advanced Settings',
|
||||
elements: []
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
CKEDITOR.dialog.addIframe('frame', 'frame', 1234, 4321);
|
||||
CKEDITOR.dialog.addIframe('frame', 'frame', 1234, 4321, () => console.log('loaded'));
|
||||
CKEDITOR.dialog.addIframe('frame', 'frame', 1234, 4321, () => console.log('loaded'), obj);
|
||||
|
||||
CKEDITOR.dialog.addUIElement('node', () => console.log('build'));
|
||||
CKEDITOR.dialog.cancelButton();
|
||||
CKEDITOR.dialog.exists('dialog1');
|
||||
CKEDITOR.dialog.exists(1234);
|
||||
dialog = CKEDITOR.dialog.getCurrent();
|
||||
|
||||
var isEnabled: boolean = CKEDITOR.dialog.isTabEnabled(editor, 'dialog', 'table');
|
||||
|
||||
CKEDITOR.dialog.okButton();
|
||||
}
|
||||
|
||||
function test_editable() {
|
||||
var element: CKEDITOR.dom.element;
|
||||
var editor: CKEDITOR.editor;
|
||||
|
||||
var editable: CKEDITOR.editable = new CKEDITOR.editable(editor, element);
|
||||
editable = new CKEDITOR.editable(editor, document.createElement('div'));
|
||||
|
||||
editable.attachClass('class');
|
||||
editable.attachListener(editable, 'event', (evt: CKEDITOR.eventInfo) => console.log('listen')).removeListener();
|
||||
editable.attachListener(new CKEDITOR.event(), 'event', (evt: CKEDITOR.eventInfo) => console.log('listen')).removeListener();
|
||||
editable.attachListener(new CKEDITOR.event(), 'event', (evt: CKEDITOR.eventInfo) => console.log('listen'), { scope: 'object' }).removeListener();
|
||||
editable.attachListener(editable, 'event', (evt: CKEDITOR.eventInfo) => console.log('listen'), { scope: 'object' }, 'data').removeListener();
|
||||
editable.attachListener(editable, 'event', (evt: CKEDITOR.eventInfo) => console.log('listen'), { scope: 'object' }, 'data', 1).removeListener();
|
||||
|
||||
editable.changeAttr('attr', 'val');
|
||||
editable.detach();
|
||||
|
||||
var range: CKEDITOR.dom.range;
|
||||
editable.insertElement(element);
|
||||
editable.insertElement(element, range);
|
||||
editable.insertHtml('data');
|
||||
editable.insertHtml('data', 'mode');
|
||||
editable.insertHtml('data', 'mode', range);
|
||||
editable.insertText(new CKEDITOR.dom.text('text'));
|
||||
|
||||
var inline: boolean = editable.isInline();
|
||||
editable.setReadOnly(inline);
|
||||
}
|
||||
|
||||
function test_fileTools() {
|
||||
var editor: CKEDITOR.editor;
|
||||
var def: CKEDITOR.fileTools.uploadWidgetDefinition;
|
||||
var loader: CKEDITOR.fileTools.fileLoader;
|
||||
var blob: Blob;
|
||||
var element: CKEDITOR.dom.element;
|
||||
|
||||
CKEDITOR.fileTools.addUploadWidget(editor, 'editor', def);
|
||||
CKEDITOR.fileTools.bindNotification(editor, loader);
|
||||
var url: string = CKEDITOR.fileTools.getUploadUrl({ some: 'object' });
|
||||
url = CKEDITOR.fileTools.getUploadUrl({ some: 'object' }, 'type');
|
||||
|
||||
var supported = CKEDITOR.fileTools.isTypeSupported(blob, /regex/);
|
||||
CKEDITOR.fileTools.markElement(element, 'name', 45);
|
||||
}
|
||||
|
||||
function test_fileTools_fileLoader() {
|
||||
var editor: CKEDITOR.editor;
|
||||
var def: CKEDITOR.fileTools.uploadWidgetDefinition;
|
||||
var blob: Blob;
|
||||
var element: CKEDITOR.dom.element;
|
||||
|
||||
var loader: CKEDITOR.fileTools.fileLoader = new CKEDITOR.fileTools.fileLoader(editor, 'data');
|
||||
loader = new CKEDITOR.fileTools.fileLoader(editor, blob);
|
||||
loader = new CKEDITOR.fileTools.fileLoader(editor, blob, 'name');
|
||||
|
||||
loader.abort();
|
||||
var finished: boolean = loader.isFinished();
|
||||
loader.load();
|
||||
loader.loadAndUpload('url');
|
||||
loader.loadAndUpload('url', { someHeader: '1234' });
|
||||
|
||||
loader.update();
|
||||
loader.upload('url');
|
||||
loader.upload('url', { someHeader: '1234' });
|
||||
}
|
||||
|
||||
function test_fileTools_uploadRepository() {
|
||||
var editor: CKEDITOR.editor;
|
||||
var blob: Blob;
|
||||
var repo: CKEDITOR.fileTools.uploadRepository = new CKEDITOR.fileTools.uploadRepository(editor);
|
||||
|
||||
var loader: CKEDITOR.fileTools.fileLoader = repo.create('data', 'name');
|
||||
loader = repo.create(blob, 'name', 'type');
|
||||
|
||||
var fin: boolean = loader.isFinished();
|
||||
}
|
||||
|
||||
function test_filter() {
|
||||
var editor: CKEDITOR.editor;
|
||||
var style: CKEDITOR.style;
|
||||
|
||||
var filter: CKEDITOR.filter = new CKEDITOR.filter(editor);
|
||||
filter = new CKEDITOR.filter('rule');
|
||||
filter = new CKEDITOR.filter(style);
|
||||
filter = new CKEDITOR.filter([ style, 'rule', [ style, 'rule' ] ]);
|
||||
filter = CKEDITOR.filter.instances['1234'];
|
||||
|
||||
filter.addContentForms([ { form: true } ]);
|
||||
filter.addElementCallback((el: CKEDITOR.htmlParser.element) => 4);
|
||||
filter.addFeature({ allowedContent: style });
|
||||
filter.addTransformations([ [ 'transform1', { right: (element: CKEDITOR.htmlParser.element, tools: string | CKEDITOR.filter.transformationTools) => true } ] ]);
|
||||
|
||||
var allowed: boolean = filter.allow(style);
|
||||
allowed = filter.allow([style], 'name');
|
||||
allowed = filter.allow('rule', 'name', false);
|
||||
|
||||
var apply: boolean = filter.applyTo(CKEDITOR.htmlParser.fragment.fromHtml('string'), true, false, 1);
|
||||
apply = filter.applyTo(new CKEDITOR.htmlParser.element('name', null), true, false, 1);
|
||||
|
||||
var checked: boolean = filter.check(style);
|
||||
checked = filter.check('rule', true);
|
||||
checked = filter.check(style, false, true);
|
||||
|
||||
checked = filter.checkFeature({ allowedContent: style });
|
||||
|
||||
filter = filter.clone();
|
||||
filter.destroy();
|
||||
filter.disable();
|
||||
|
||||
filter.disallow(filter.disallowedContent);
|
||||
var mode: number = filter.getAllowedEnterMode(1);
|
||||
mode = filter.getAllowedEnterMode(1, false);
|
||||
}
|
||||
|
||||
function test_focusManager() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea);
|
||||
var element = CKEDITOR.document.getById('myElement');
|
||||
|
||||
instance.focusManager.focus();
|
||||
instance.focusManager.focus(element);
|
||||
instance.focusManager.lock();
|
||||
instance.focusManager.unlock();
|
||||
instance.focusManager.blur();
|
||||
instance.focusManager.blur(true);
|
||||
instance.focusManager.add(element, true);
|
||||
instance.focusManager.remove(element);
|
||||
|
||||
var focusManager = new CKEDITOR.focusManager(CKEDITOR.instances[0]);
|
||||
var object: CKEDITOR.dom.domObject = focusManager.currentActive;
|
||||
var bool: boolean = focusManager.hasFocus;
|
||||
}
|
||||
|
||||
|
||||
function test_htmlParser_basicWriter() {
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.closeTag('p');
|
||||
writer.comment('hello');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
writer.openTag('p', {});
|
||||
writer.openTagClose('p', false);
|
||||
writer.reset();
|
||||
writer.text('Hello');
|
||||
writer.write('data');
|
||||
}
|
||||
|
||||
function test_htmlParser_cdata() {
|
||||
var cdata: CKEDITOR.htmlParser.cdata = new CKEDITOR.htmlParser.cdata('hey');
|
||||
cdata.writeHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
}
|
||||
|
||||
function test_htmlParser_comment() {
|
||||
var filter: CKEDITOR.htmlParser.filter;
|
||||
var comment: CKEDITOR.htmlParser.comment = new CKEDITOR.htmlParser.comment('hey');
|
||||
var filtered: boolean = comment.filter(filter);
|
||||
comment.writeHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
comment.writeHtml(new CKEDITOR.htmlParser.basicWriter(), filter);
|
||||
}
|
||||
|
||||
function test_htmlParser_cssStyle() {
|
||||
var element: CKEDITOR.htmlParser.element;
|
||||
|
||||
var style: CKEDITOR.htmlParser.cssStyle = new CKEDITOR.htmlParser.cssStyle(element);
|
||||
style = new CKEDITOR.htmlParser.cssStyle('styles');
|
||||
|
||||
style.populate(element);
|
||||
style.populate(new CKEDITOR.dom.element('div'));
|
||||
style.populate({ 'width': 1 });
|
||||
}
|
||||
|
||||
function test_htmlParser_element() {
|
||||
var element: CKEDITOR.htmlParser.element = new CKEDITOR.htmlParser.element('el', { 'id': '1'});
|
||||
|
||||
var node: CKEDITOR.htmlParser.node;
|
||||
element.add(node);
|
||||
element.add(node, 5);
|
||||
element.addClass('class');
|
||||
element = element.clone();
|
||||
|
||||
var filter: CKEDITOR.htmlParser.filter;
|
||||
var filtered: boolean = element.filter(filter);
|
||||
element.filterChildren(filter);
|
||||
|
||||
var nodes: CKEDITOR.htmlParser.node[] = element.find('*');
|
||||
nodes = element.find((el: CKEDITOR.htmlParser.node) => false, true);
|
||||
|
||||
element.forEach((el: CKEDITOR.htmlParser.node) => console.log('node'));
|
||||
element.forEach((el: CKEDITOR.htmlParser.node) => console.log('node'), 1);
|
||||
element.forEach((el: CKEDITOR.htmlParser.node) => false, 2, true);
|
||||
|
||||
var node: CKEDITOR.htmlParser.node = element.getFirst('*');
|
||||
node = element.getFirst({ 'id': '1' });
|
||||
node = element.getFirst((el: CKEDITOR.htmlParser.node) => true);
|
||||
|
||||
var html: string = element.getHtml();
|
||||
html = element.getOuterHtml();
|
||||
|
||||
var hasClass: boolean = element.hasClass('class');
|
||||
element.removeClass('class');
|
||||
element.replaceWithChildren();
|
||||
element.setHtml('html');
|
||||
var el2: CKEDITOR.htmlParser.element = element.split(1);
|
||||
|
||||
element.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
element.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter(), filter);
|
||||
|
||||
element.writeHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
element.writeHtml(new CKEDITOR.htmlParser.basicWriter(), filter);
|
||||
}
|
||||
|
||||
function test_htmlParser_filter() {
|
||||
var filter: CKEDITOR.htmlParser.filter = new CKEDITOR.htmlParser.filter({ elementNames: [ 'div' ] });
|
||||
filter = new CKEDITOR.htmlParser.filter();
|
||||
|
||||
filter.addRules({ text: 'text' });
|
||||
filter.addRules({ attributes: { 'id': '1234' }}, 1);
|
||||
filter.addRules({ comment: 'hey', text: 'text' }, { priority: 1 });
|
||||
filter.addRules({ root: document.body }, { applyToAll: false });
|
||||
|
||||
var node: CKEDITOR.htmlParser.node;
|
||||
filter.applyTo(node);
|
||||
}
|
||||
|
||||
|
||||
function test_htmlParser_filterRulesGroup() {
|
||||
var rules: CKEDITOR.htmlParser.filterRulesGroup = new CKEDITOR.htmlParser.filterRulesGroup();
|
||||
|
||||
rules.add([ 'some', 'rule' ], 1, { applyToAll: false, excludeNestedEditable: true });
|
||||
|
||||
rules.addMany([ (value: CKEDITOR.htmlParser.node | CKEDITOR.htmlParser.fragment | string) => false, [ 'some', 'rule' ] ], 1, { applyToAll: false });
|
||||
|
||||
var nodeFragOrString: CKEDITOR.htmlParser.node | CKEDITOR.htmlParser.fragment | string;
|
||||
nodeFragOrString = rules.exec(nodeFragOrString);
|
||||
|
||||
var str: string;
|
||||
str = rules.execOnName(str);
|
||||
|
||||
var idx: number = rules.findIndex(1);
|
||||
}
|
||||
|
||||
function test_htmlParser_fragment() {
|
||||
var frag: CKEDITOR.htmlParser.fragment = new CKEDITOR.htmlParser.fragment();
|
||||
|
||||
var node: CKEDITOR.htmlParser.node;
|
||||
frag.add(node);
|
||||
frag.add(node, 1);
|
||||
|
||||
var filter: CKEDITOR.htmlParser.filter;
|
||||
frag.filter(filter);
|
||||
frag.filterChildren(filter);
|
||||
frag.filterChildren(filter, true);
|
||||
frag.forEach((node: CKEDITOR.htmlParser.node) => console.log('node'));
|
||||
frag.forEach((node: CKEDITOR.htmlParser.node) => false, 1);
|
||||
frag.forEach((node: CKEDITOR.htmlParser.node) => false, 2, true);
|
||||
|
||||
frag.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
frag.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter(), filter);
|
||||
|
||||
frag.writeHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
frag.writeHtml(new CKEDITOR.htmlParser.basicWriter(), filter);
|
||||
|
||||
frag = CKEDITOR.htmlParser.fragment.fromBBCode('code');
|
||||
|
||||
var fragOrEl: CKEDITOR.htmlParser.fragment | CKEDITOR.htmlParser.element = CKEDITOR.htmlParser.fragment.fromHtml('html');
|
||||
fragOrEl = CKEDITOR.htmlParser.fragment.fromHtml('html', 'parent');
|
||||
fragOrEl = CKEDITOR.htmlParser.fragment.fromHtml('html', 'parent', 'fix');
|
||||
fragOrEl = CKEDITOR.htmlParser.fragment.fromHtml('html', new CKEDITOR.htmlParser.element('name', null), true);
|
||||
}
|
||||
|
||||
function test_htmlParser_node() {
|
||||
var node: CKEDITOR.htmlParser.node = new CKEDITOR.htmlParser.node();
|
||||
|
||||
var el: CKEDITOR.htmlParser.element = node.getAscendant('condition');
|
||||
el = node.getAscendant({ 'id': '1234' });
|
||||
el = node.getAscendant((node: CKEDITOR.htmlParser.element) => false);
|
||||
|
||||
var idx: number = node.getIndex();
|
||||
node.insertAfter(node);
|
||||
node.insertBefore(node);
|
||||
node.remove();
|
||||
node.replaceWith(node);
|
||||
el = node.wrapWith(el);
|
||||
|
||||
}
|
||||
|
||||
function test_htmlParser_text() {
|
||||
var text: CKEDITOR.htmlParser.text = new CKEDITOR.htmlParser.text('text');
|
||||
var filtered: boolean = text.filter(new CKEDITOR.htmlParser.filter());
|
||||
text.writeHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
text.writeHtml(new CKEDITOR.htmlParser.basicWriter(), new CKEDITOR.htmlParser.filter());
|
||||
}
|
||||
|
||||
function test_htmlWriter() {
|
||||
var writer = new CKEDITOR.htmlWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
|
||||
writer.indentationChars = '\t';
|
||||
writer.lineBreakChars = '\r\n';
|
||||
writer.selfClosingEnd = '>';
|
||||
writer.indentation();
|
||||
writer.lineBreak();
|
||||
writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true});
|
||||
}
|
||||
|
||||
function test_htmlParser() {
|
||||
var html = '<div><span>text</span></div>';
|
||||
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
|
||||
fragment.forEach(function(node) {
|
||||
if (node instanceof CKEDITOR.htmlParser.element) {
|
||||
node.forEach(function(node) {
|
||||
console.log(node);
|
||||
});
|
||||
}
|
||||
}, CKEDITOR.NODE_ELEMENT, true);
|
||||
}
|
||||
|
||||
function test_keystrokeHandler() {
|
||||
var handler: CKEDITOR.keystrokeHandler = new CKEDITOR.keystrokeHandler(CKEDITOR.instances[0]);
|
||||
handler.attach(new CKEDITOR.dom.domObject(document.body));
|
||||
}
|
||||
|
||||
function test_lang() {
|
||||
var lang: string = CKEDITOR.lang.detect('en');
|
||||
lang = CKEDITOR.lang.detect('zh', 'sw');
|
||||
|
||||
CKEDITOR.lang.load('tk', 'pr', (code: string, entries: any) => console.log('loaded'));
|
||||
}
|
||||
|
||||
function test_loader() {
|
||||
CKEDITOR.loader.load('script');
|
||||
CKEDITOR.loader.load('script', true);
|
||||
|
||||
CKEDITOR.loader.loadPending();
|
||||
}
|
||||
|
||||
function test_menu() {
|
||||
var menu: CKEDITOR.menu = new CKEDITOR.menu();
|
||||
|
||||
menu.add({ anything: true });
|
||||
menu.addListener((startElement: CKEDITOR.dom.element, selection: CKEDITOR.dom.selection, path: CKEDITOR.dom.elementPath) => 'return');
|
||||
var { item, element } = menu.findItemByCommandName('command');
|
||||
menu.hide();
|
||||
menu.hide(false);
|
||||
menu.removeAll();
|
||||
menu.show(new CKEDITOR.dom.element('div'));
|
||||
menu.show(new CKEDITOR.dom.element('div'), 1);
|
||||
menu.show(new CKEDITOR.dom.element('div'), 1, 2);
|
||||
menu.show(new CKEDITOR.dom.element('div'), 1, 2, 3);
|
||||
}
|
||||
|
||||
function test_plugins() {
|
||||
CKEDITOR.plugins.add( 'abbr', {
|
||||
init: function( editor: CKEDITOR.editor ) {
|
||||
// empty logic
|
||||
}
|
||||
});
|
||||
|
||||
console.log(CKEDITOR.plugins.registered['abbr']);
|
||||
}
|
||||
|
||||
function test_resourceManager() {
|
||||
var manager: CKEDITOR.resourceManager = new CKEDITOR.resourceManager('path', 'name');
|
||||
|
||||
manager.add('name');
|
||||
manager.add('name', { hidpi: true });
|
||||
manager.addExternal('names', 'path');
|
||||
manager.addExternal('names', 'path', 'name');
|
||||
|
||||
var def: CKEDITOR.pluginDefinition = manager.get('name');
|
||||
var path: string = manager.getFilePath('path');
|
||||
path = manager.getPath('path');
|
||||
|
||||
manager.load('name', (loaded: string[]) => console.log('hey'));
|
||||
manager.load([ 'name' ], (loaded: string[]) => console.log('hey'), manager);
|
||||
}
|
||||
|
||||
function test_scriptLoader() {
|
||||
CKEDITOR.scriptLoader.load('url', (succeededUrls: boolean | string[], failedUrls: string[]) => console.log('loaded'));
|
||||
CKEDITOR.scriptLoader.load([ 'url' ], (succeededUrls: boolean | string[], failedUrls: string[]) => console.log('loaded'), null);
|
||||
CKEDITOR.scriptLoader.load([ 'url' ], (succeededUrls: boolean | string[], failedUrls: string[]) => console.log('loaded'), null, true);
|
||||
CKEDITOR.scriptLoader.queue('url', (succeeded: boolean) => console.log('loaded'));
|
||||
}
|
||||
|
||||
function test_skin() {
|
||||
CKEDITOR.skin.addIcon('name', 'path');
|
||||
CKEDITOR.skin.addIcon('name', 'path', 1);
|
||||
CKEDITOR.skin.addIcon('name', 'path', 1, 'small');
|
||||
|
||||
CKEDITOR.skin.chameleon('editor', 'part');
|
||||
|
||||
var style: any = CKEDITOR.skin.getIconStyle('name');
|
||||
style = CKEDITOR.skin.getIconStyle('name', true);
|
||||
style = CKEDITOR.skin.getIconStyle('name', true, 1);
|
||||
style = CKEDITOR.skin.getIconStyle('name', true, 1, 'large');
|
||||
|
||||
var path: any = CKEDITOR.skin.getPath('part');
|
||||
|
||||
CKEDITOR.skin.loadPart('part', () => console.log('load'));
|
||||
|
||||
var path2: string = CKEDITOR.skin.path();
|
||||
}
|
||||
|
||||
function test_style() {
|
||||
var style: CKEDITOR.style = new CKEDITOR.style({ element: 'div' }, { 'key': 'value '});
|
||||
style.apply(CKEDITOR.instances[0]);
|
||||
|
||||
var el: CKEDITOR.dom.element;
|
||||
style.applyToObject(el, CKEDITOR.instances[0]);
|
||||
|
||||
var range: CKEDITOR.dom.range;
|
||||
style.applyToRange(range, CKEDITOR.instances[0]);
|
||||
|
||||
var str: string = style.buildPreview();
|
||||
str = style.buildPreview('label');
|
||||
|
||||
var path: CKEDITOR.dom.elementPath;
|
||||
var bool: boolean = style.checkActive(path, CKEDITOR.instances[0]);
|
||||
|
||||
var filter: CKEDITOR.filter;
|
||||
bool = style.checkApplicable(path, CKEDITOR.instances[0], filter);
|
||||
|
||||
bool = style.checkElementMatch(el, true, CKEDITOR.instances[0]);
|
||||
bool = style.checkElementRemovable(el, false, CKEDITOR.instances[0]);
|
||||
|
||||
var def: CKEDITOR.style.definition = style.getDefintion();
|
||||
style.remove(CKEDITOR.instances[0]);
|
||||
style.removeFromRange(range, CKEDITOR.instances[0]);
|
||||
|
||||
var rules: CKEDITOR.filter.allowedContentRules;
|
||||
rules = style.toAllowedContentRules();
|
||||
rules = style.toAllowedContentRules(CKEDITOR.instances[0]);
|
||||
}
|
||||
|
||||
function test_adding_command_and_buttons() {
|
||||
@@ -320,47 +977,6 @@ function test_adding_command_and_buttons() {
|
||||
});
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_path() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_definition() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
|
||||
return {
|
||||
title: 'Abbreviation Properties',
|
||||
minWidth: 400,
|
||||
minHeight: 200,
|
||||
onLoad: () => {},
|
||||
onOk: () => {},
|
||||
onCancel: () => {},
|
||||
onShow: () => {},
|
||||
onHide: () => {},
|
||||
contents: [
|
||||
{
|
||||
id: 'tab-basic',
|
||||
label: 'Basic Settings',
|
||||
elements: <any[]>[]
|
||||
},
|
||||
{
|
||||
id: 'tab-adv',
|
||||
label: 'Advanced Settings',
|
||||
elements: []
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function test_plugins() {
|
||||
CKEDITOR.plugins.add( 'abbr', {
|
||||
init: function( editor: CKEDITOR.editor ) {
|
||||
// empty logic
|
||||
}
|
||||
});
|
||||
|
||||
console.log(CKEDITOR.plugins.registered['abbr']);
|
||||
}
|
||||
|
||||
function test_adding_widget() {
|
||||
function wrapper(editor: CKEDITOR.editor) {
|
||||
editor.widgets.add("widgetty", {
|
||||
@@ -374,52 +990,6 @@ function test_adding_widget() {
|
||||
}
|
||||
}
|
||||
|
||||
function test_focusManager() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea);
|
||||
var element = CKEDITOR.document.getById('myElement');
|
||||
|
||||
instance.focusManager.focus();
|
||||
instance.focusManager.focus(element);
|
||||
instance.focusManager.lock();
|
||||
instance.focusManager.unlock();
|
||||
instance.focusManager.blur();
|
||||
instance.focusManager.blur(true);
|
||||
instance.focusManager.add(element, true);
|
||||
instance.focusManager.remove(element);
|
||||
|
||||
var focusManager = new CKEDITOR.focusManager(instance);
|
||||
var object: CKEDITOR.dom.domObject = focusManager.currentActive;
|
||||
var bool: boolean = focusManager.hasFocus;
|
||||
}
|
||||
|
||||
function test_basicWriter() {
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
}
|
||||
|
||||
function test_htmlWriter() {
|
||||
var writer = new CKEDITOR.htmlWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
|
||||
writer.indentationChars = '\t';
|
||||
writer.lineBreakChars = '\r\n';
|
||||
writer.selfClosingEnd = '>';
|
||||
writer.indentation();
|
||||
writer.lineBreak();
|
||||
writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true});
|
||||
}
|
||||
|
||||
function test_sharedSpace() {
|
||||
CKEDITOR.inline('content', {
|
||||
removePlugins: 'maximize,resize',
|
||||
@@ -558,7 +1128,7 @@ function test_selection() {
|
||||
var editor = new CKEDITOR.editor();
|
||||
var testNode = CKEDITOR.document.getById('myElement');
|
||||
|
||||
var selection = editor.getSelection();
|
||||
var selection = editor.getSelection(true);
|
||||
var ranges = selection.getRanges();
|
||||
for (var i = 0, c = ranges.length; i < c; i++) {
|
||||
var range = ranges[i];
|
||||
@@ -570,31 +1140,75 @@ function test_selection() {
|
||||
}
|
||||
|
||||
function test_tools() {
|
||||
var obj = { key: 'value' };
|
||||
var obj: { [key: string]: any } = { key: 'value' };
|
||||
|
||||
CKEDITOR.tools.addFunction(console.log);
|
||||
CKEDITOR.tools.addFunction(console.log, obj);
|
||||
var bool = CKEDITOR.tools.arrayCompare([ 1 ], [ 2, 3 ]);
|
||||
CKEDITOR.tools.clone(obj);
|
||||
CKEDITOR.tools.copy(obj);
|
||||
CKEDITOR.tools.prototypedCopy(obj);
|
||||
|
||||
obj = CKEDITOR.tools.createClass(obj);
|
||||
var str = CKEDITOR.tools.cssStyleToDomStyle('style');
|
||||
var prefixes: { [cssClass: string]: string | number } = CKEDITOR.tools.cssVendorPrefix('prop', 'val');
|
||||
prefixes = CKEDITOR.tools.cssVendorPrefix('prop', 'val', true);
|
||||
var fn: (param: any) => boolean
|
||||
fn = CKEDITOR.tools.defer<(param: any) => boolean>(fn);
|
||||
CKEDITOR.tools.enableHtml5Elements(document);
|
||||
CKEDITOR.tools.enableHtml5Elements(document.createDocumentFragment(), true);
|
||||
str = CKEDITOR.tools.escapeCss('css');
|
||||
var { input, reset } = CKEDITOR.tools.eventsBuffer(1, console.log, obj);
|
||||
obj = CKEDITOR.tools.extend(obj, obj, true, obj);
|
||||
bool = CKEDITOR.tools.fixDomain();
|
||||
str = CKEDITOR.tools.genKey(str);
|
||||
str = CKEDITOR.tools.getCookie(str);
|
||||
str = CKEDITOR.tools.getCsrfToken();
|
||||
var numb: number = CKEDITOR.tools.getIndex<string>(['string', 'array'], (element: string) => false);
|
||||
bool = CKEDITOR.tools.getMouseButton(new CKEDITOR.dom.event(document.createEvent(null)));
|
||||
str = CKEDITOR.tools.getNextId();
|
||||
numb = CKEDITOR.tools.getNextNumber();
|
||||
str = CKEDITOR.tools.getUniqueId();
|
||||
str = CKEDITOR.tools.htmlDecode(str);
|
||||
str = CKEDITOR.tools.htmlDecodeAttr(str);
|
||||
str = CKEDITOR.tools.htmlEncode(str);
|
||||
str = CKEDITOR.tools.htmlEncodeAttr(str);
|
||||
numb = CKEDITOR.tools.indexOf<string>(['string', 'array'], 'string');
|
||||
numb = CKEDITOR.tools.indexOf<boolean>([true, false], (val: boolean) => false);
|
||||
console.log(CKEDITOR.tools.isArray([1])); // true
|
||||
console.log(CKEDITOR.tools.isArray(obj)); // false
|
||||
console.log(CKEDITOR.tools.isArray(null)); // false
|
||||
console.log(CKEDITOR.tools.isArray(undefined)); // false
|
||||
|
||||
bool = CKEDITOR.tools.isEmpty(obj);
|
||||
var ret1: { display: string[], aria: string[] } = CKEDITOR.tools.keystrokeToArray(obj, 1);
|
||||
var ret2: { display: string, aria: string } = CKEDITOR.tools.keystrokeToString(obj, 1);
|
||||
str = CKEDITOR.tools.ltrim(str);
|
||||
str = CKEDITOR.tools.normalizeCssText(str, bool);
|
||||
str = CKEDITOR.tools.normalizeHex(str);
|
||||
bool = CKEDITOR.tools.objectCompare(obj, obj);
|
||||
bool = CKEDITOR.tools.objectCompare(obj, obj, true);
|
||||
var strArr: string[] = CKEDITOR.tools.objectKeys(obj);
|
||||
CKEDITOR.tools.override(parseInt, function(_parseInt) {
|
||||
return function(value: any, radix?: number) {
|
||||
return _parseInt(value, radix);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function test_htmlParser() {
|
||||
var html = '<div><span>text</span></div>';
|
||||
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
|
||||
fragment.forEach(function(node) {
|
||||
if (node instanceof CKEDITOR.htmlParser.element) {
|
||||
node.forEach(function(node) {
|
||||
console.log(node);
|
||||
});
|
||||
}
|
||||
}, CKEDITOR.NODE_ELEMENT, true);
|
||||
obj = CKEDITOR.tools.parseCssText(str);
|
||||
obj = CKEDITOR.tools.parseCssText(str, bool);
|
||||
obj = CKEDITOR.tools.parseCssText(str, bool, bool);
|
||||
obj = CKEDITOR.tools.prototypedCopy(obj);
|
||||
CKEDITOR.tools.removeFunction(1);
|
||||
str = CKEDITOR.tools.repeat(str, 40);
|
||||
str = CKEDITOR.tools.rtrim(str);
|
||||
str = CKEDITOR.tools.search<string>(strArr, 'string');
|
||||
str = CKEDITOR.tools.search<string>(strArr, (el: string) => true);
|
||||
CKEDITOR.tools.setCookie('name', 'value');
|
||||
numb = CKEDITOR.tools.setTimeout(console.log);
|
||||
numb = CKEDITOR.tools.setTimeout(console.log, 1000);
|
||||
numb = CKEDITOR.tools.setTimeout(console.log, 1000, obj);
|
||||
numb = CKEDITOR.tools.setTimeout(console.log, 1000, obj, 'timeout');
|
||||
numb = CKEDITOR.tools.setTimeout(console.log, 1000, obj, 'timeout', window);
|
||||
str = CKEDITOR.tools.transformPlainTextToHtml(str, 1);
|
||||
str = CKEDITOR.tools.trim(str);
|
||||
CKEDITOR.tools.tryThese([ console.log, console.warn ]);
|
||||
str = CKEDITOR.tools.writeCssText(obj);
|
||||
str = CKEDITOR.tools.writeCssText(obj, true);
|
||||
}
|
||||
|
||||
Vendored
+2090
-1269
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,600 @@
|
||||
|
||||
|
||||
function test_CKEDITOR() {
|
||||
CKEDITOR.basePath = 'test';
|
||||
CKEDITOR.replaceClass = 'rich_editor';
|
||||
CKEDITOR.skinName = 'moono';
|
||||
CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
|
||||
var editor = new CKEDITOR.editor();
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_NONE)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT)
|
||||
alert(CKEDITOR.basePath);
|
||||
if (CKEDITOR.currentInstance)
|
||||
alert(CKEDITOR.currentInstance.name);
|
||||
alert(CKEDITOR.document.getBody().getName());
|
||||
alert(CKEDITOR.instances[0].name);
|
||||
CKEDITOR.loadFullCoreTimeout = 5;
|
||||
alert(CKEDITOR.revision);
|
||||
alert(CKEDITOR.rnd);
|
||||
if (CKEDITOR.status == 'loaded') {
|
||||
CKEDITOR.loadFullCore();
|
||||
}
|
||||
alert(CKEDITOR.timestamp);
|
||||
CKEDITOR.addCss('.cke_editable h1,.cke_editable h2,.cke_editable h3 { border-bottom: 1px dotted red }');
|
||||
CKEDITOR.appendTo('editorSpace');
|
||||
alert(CKEDITOR.getUrl('skins/default/editor.css'));
|
||||
alert(CKEDITOR.getUrl('/skins/default/editor.css'));
|
||||
alert(CKEDITOR.getUrl('http://www.somesite.com/skins/default/editor.css'));
|
||||
CKEDITOR.inline('content');
|
||||
if (CKEDITOR.loadFullCore)
|
||||
CKEDITOR.loadFullCore();
|
||||
CKEDITOR.replace('myfield');
|
||||
var textarea = document.createElement('textarea');
|
||||
CKEDITOR.replace(textarea);
|
||||
CKEDITOR.replaceAll();
|
||||
CKEDITOR.replaceAll('myClassName');
|
||||
CKEDITOR.replaceAll((textarea, config) => false);
|
||||
}
|
||||
|
||||
function test_CKEDITOR_events() {
|
||||
CKEDITOR.on('instanceCreated', function(event) {
|
||||
// $ExpectType editor
|
||||
event.editor;
|
||||
});
|
||||
}
|
||||
|
||||
function test_config() {
|
||||
var config1: CKEDITOR.config = {
|
||||
toolbar: 'basic',
|
||||
};
|
||||
var config2: CKEDITOR.config = {
|
||||
toolbar: [
|
||||
[ 'mode', 'document', 'doctools' ],
|
||||
[ 'clipboard', 'undo' ],
|
||||
'/',
|
||||
[ 'find', 'selection', 'spellchecker' ],
|
||||
[ 'basicstyles', 'cleanup' ],
|
||||
'/',
|
||||
[ 'list', 'indent', 'blocks', 'align', 'bidi' ],
|
||||
],
|
||||
};
|
||||
var config3: CKEDITOR.config = {
|
||||
toolbarGroups: [
|
||||
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
|
||||
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
|
||||
{ name: 'links', groups: [ 'links' ] },
|
||||
{ name: 'insert', groups: [ 'insert' ] },
|
||||
{ name: 'tools', groups: [ 'tools' ] },
|
||||
{ name: 'document', groups: [ 'mode' ] },
|
||||
{ name: 'about', groups: [ 'about' ] },
|
||||
'/',
|
||||
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
|
||||
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'paragraph' ] },
|
||||
'/',
|
||||
{ name: 'styles', groups: [ 'styles' ] },
|
||||
{ name: 'colors', groups: [ 'colors' ] },
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
function test_dom_comment() {
|
||||
var type = CKEDITOR.NODE_COMMENT;
|
||||
var nativeNode = document.createComment('Example');
|
||||
var comment = new CKEDITOR.dom.comment(nativeNode);
|
||||
var comment2 = new CKEDITOR.dom.comment('Example');
|
||||
}
|
||||
|
||||
function test_dom_document() {
|
||||
var document = new CKEDITOR.dom.document(window.document);
|
||||
var type = CKEDITOR.NODE_DOCUMENT;
|
||||
CKEDITOR.document.appendStyleSheet('/mystyles.css');
|
||||
var element = CKEDITOR.document.getBody();
|
||||
alert(element.getName());
|
||||
var element2 = CKEDITOR.document.getById('myElement');
|
||||
alert(element.getId());
|
||||
var element3 = CKEDITOR.document.getHead();
|
||||
alert(element.getName());
|
||||
var selection = CKEDITOR.instances[0].document.getSelection();
|
||||
alert(selection.getType());
|
||||
document.write(
|
||||
'<html>' +
|
||||
'<head><title>Sample Doc</title></head>' +
|
||||
'<body>Document contents created by code</body>' +
|
||||
'</html>'
|
||||
);
|
||||
}
|
||||
|
||||
function test_dom_documentFragment() {
|
||||
var type = CKEDITOR.NODE_DOCUMENT_FRAGMENT;
|
||||
}
|
||||
|
||||
function test_dom_domObject() {
|
||||
var element = new CKEDITOR.dom.element('span');
|
||||
alert(element.$.nodeType);
|
||||
var nativeElement = element.$;
|
||||
var doc = new CKEDITOR.dom.document(document);
|
||||
alert(doc.equals(CKEDITOR.document));
|
||||
alert(doc == CKEDITOR.document);
|
||||
var element2 = new CKEDITOR.dom.element('span');
|
||||
alert(element.getCustomData('hasCustomData'));
|
||||
alert(element.getCustomData('nonExistingKey'));
|
||||
var elementA = new CKEDITOR.dom.element(nativeElement);
|
||||
elementA.getPrivate().value = 1;
|
||||
var elementB = new CKEDITOR.dom.element(nativeElement).getPrivate().value;
|
||||
var element3 = new CKEDITOR.dom.element('span');
|
||||
element.setCustomData('hasCustomData', true);
|
||||
}
|
||||
|
||||
function test_dom_element() {
|
||||
var element = new CKEDITOR.dom.element('span');
|
||||
alert(element.$.nodeType);
|
||||
element.addClass('classA');
|
||||
element.addClass('classB');
|
||||
element.addClass('classA');
|
||||
var p = new CKEDITOR.dom.element('p');
|
||||
var strong = new CKEDITOR.dom.element('strong');
|
||||
p.append(strong);
|
||||
var em = p.append('em');
|
||||
var p = new CKEDITOR.dom.element('p');
|
||||
p.appendText('This is');
|
||||
p.appendText(' some text');
|
||||
element.breakParent(strong);
|
||||
element.data('extra-info', 'test');
|
||||
alert(element.data('extra-info'));
|
||||
element.data('extra-info', false);
|
||||
var element5 = CKEDITOR.document.getById('myTextarea');
|
||||
element.focus();
|
||||
element.focusNext();
|
||||
element.focusPrevious();
|
||||
element.forEach(node=> {
|
||||
console.log(node);
|
||||
});
|
||||
var element2 = CKEDITOR.dom.element.createFromHtml('<input type="text" />');
|
||||
alert(element.getAttribute('type'));
|
||||
alert(element.getComputedStyle('display'));
|
||||
element.appendTo(CKEDITOR.document.getBody());
|
||||
alert(element.getEditor().name);
|
||||
var first = element.getFirst();
|
||||
alert(element.getHtml());
|
||||
alert(element.getId());
|
||||
alert(element.getName());
|
||||
alert('<b>' + element.getNameAtt() + '</b>');
|
||||
alert(element.getOuterHtml());
|
||||
alert(element.getTabIndex());
|
||||
alert(element.getText());
|
||||
alert(element.hasAttributes());
|
||||
alert(element.hasAttributes());
|
||||
element.hide();
|
||||
alert(element.is('span'));
|
||||
alert(element.is('p', 'span'));
|
||||
alert(element.is('p'));
|
||||
alert(element.is('p', 'div'));
|
||||
alert(element.is({ p: 1, span: 1 }));
|
||||
element.removeAttribute('class');
|
||||
element.addClass('classA');
|
||||
element.addClass('classB');
|
||||
element.removeClass('classA');
|
||||
element.removeClass('classB');
|
||||
element.removeStyle('display');
|
||||
element.setAttribute('class', 'myClass');
|
||||
element.setAttribute('title', 'This is an example');
|
||||
element.setAttributes({
|
||||
'class': 'myClass',
|
||||
title: 'This is an example'
|
||||
});
|
||||
p.setHtml('<b>Inner</b> HTML');
|
||||
element.setOpacity(0.75);
|
||||
element.setStyle('background-color', '#ff0000');
|
||||
element.setStyle('margin-top', '10px');
|
||||
element.setStyle('float', 'right');
|
||||
element.setStyles({
|
||||
position: 'absolute',
|
||||
float: 'right'
|
||||
});
|
||||
element.setText('A > B & C < D');
|
||||
element.show();
|
||||
element.unselectable();
|
||||
alert(element.getName());
|
||||
alert(element == CKEDITOR.dom.element.get(element));
|
||||
var htmlElement = document.getElementById('myElement');
|
||||
alert(CKEDITOR.dom.element.get(htmlElement).getName());
|
||||
}
|
||||
|
||||
function test_dom_event() {
|
||||
var event = new CKEDITOR.dom.event(new Event(""));
|
||||
alert(event.getKey());
|
||||
alert(event.getKeystroke() == 65);
|
||||
alert(event.getKeystroke() == CKEDITOR.CTRL + 65);
|
||||
alert(event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
|
||||
var element = new CKEDITOR.dom.element('div');
|
||||
element.on('mousemouse', ev=> {
|
||||
var pageOffset = ev.data.getPageOffset();
|
||||
alert(pageOffset.x);
|
||||
alert(pageOffset.y);
|
||||
});
|
||||
element.on('click', ev=> {
|
||||
var domEvent = ev.data;
|
||||
domEvent.getTarget().addClass('clicked');
|
||||
});
|
||||
element.on('click', ev=> {
|
||||
var domEvent = ev.data as CKEDITOR.dom.event;
|
||||
domEvent.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
function test_dom_iterator() {
|
||||
var range = new CKEDITOR.dom.range(new CKEDITOR.dom.element('div'));
|
||||
var iterator = range.createIterator();
|
||||
iterator.getNextParagraph();
|
||||
iterator.getNextParagraph();
|
||||
}
|
||||
|
||||
function test_dom_node() {
|
||||
var p = new CKEDITOR.dom.element('p');
|
||||
var strong = new CKEDITOR.dom.element('strong');
|
||||
strong.appendTo(p);
|
||||
var node = new CKEDITOR.dom.node(new Node());
|
||||
node = node.getAscendant('b');
|
||||
node = node.getAscendant('b', true);
|
||||
var element = CKEDITOR.document.getById('example');
|
||||
alert(element.getDocument().equals(CKEDITOR.document));
|
||||
element.getIndex();
|
||||
element.getIndex(true);
|
||||
var last = element.getFirst().getNext();
|
||||
var parent = node.getParent();
|
||||
alert(parent.getName());
|
||||
var parents = node.getParents();
|
||||
var em = new CKEDITOR.dom.element('em');
|
||||
strong.insertAfter(em);
|
||||
strong.insertBefore(em);
|
||||
strong.insertBeforeMe(em);
|
||||
element.isReadOnly();
|
||||
}
|
||||
|
||||
function test_dom_nodeList() {
|
||||
var nodeList = CKEDITOR.document.getBody().getChildren();
|
||||
alert(nodeList.count());
|
||||
}
|
||||
|
||||
function test_dom_range() {
|
||||
var editor = new CKEDITOR.editor();
|
||||
var range = new CKEDITOR.dom.range(editor.document);
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
range.deleteContents();
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.collapsed);
|
||||
range.collapse();
|
||||
alert(range.collapsed);
|
||||
range.selectNodeContents(range.document.getBody());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.endContainer.getName());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.endOffset);
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.startContainer.getName());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.startOffset);
|
||||
}
|
||||
|
||||
function test_dom_text() {
|
||||
var nativeNode = document.createTextNode('Example');
|
||||
var text = new CKEDITOR.dom.text(nativeNode);
|
||||
var text2 = new CKEDITOR.dom.text('Example');
|
||||
}
|
||||
|
||||
function test_dom_window() {
|
||||
var document = new CKEDITOR.dom.window(window);
|
||||
var win = new CKEDITOR.dom.window(window);
|
||||
var pos = win.getScrollPosition();
|
||||
alert(pos.x);
|
||||
alert(pos.y);
|
||||
var size = win.getViewPaneSize();
|
||||
alert(size.width);
|
||||
alert(size.height);
|
||||
}
|
||||
|
||||
function test_adding_command_and_buttons() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea);
|
||||
|
||||
instance.addCommand( 'aCommand', {
|
||||
exec: function( editor: CKEDITOR.editor ) {
|
||||
// empty logic
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
instance.ui.addButton( 'firstButton', {
|
||||
icon: 'http://www.example.com/assets/images/icons.png',
|
||||
iconOffset: -32,
|
||||
label: 'Label 1',
|
||||
command: 'aCommand',
|
||||
toolbar: 'tools'
|
||||
});
|
||||
|
||||
instance.ui.addButton( 'secondButton', {
|
||||
label: 'Label 2',
|
||||
command: 'aCommand',
|
||||
toolbar: 'tools'
|
||||
});
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_path() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_definition() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
|
||||
return {
|
||||
title: 'Abbreviation Properties',
|
||||
minWidth: 400,
|
||||
minHeight: 200,
|
||||
onLoad: () => {},
|
||||
onOk: () => {},
|
||||
onCancel: () => {},
|
||||
onShow: () => {},
|
||||
onHide: () => {},
|
||||
contents: [
|
||||
{
|
||||
id: 'tab-basic',
|
||||
label: 'Basic Settings',
|
||||
elements: <any[]>[]
|
||||
},
|
||||
{
|
||||
id: 'tab-adv',
|
||||
label: 'Advanced Settings',
|
||||
elements: []
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function test_plugins() {
|
||||
CKEDITOR.plugins.add( 'abbr', {
|
||||
init: function( editor: CKEDITOR.editor ) {
|
||||
// empty logic
|
||||
}
|
||||
});
|
||||
|
||||
console.log(CKEDITOR.plugins.registered['abbr']);
|
||||
}
|
||||
|
||||
function test_adding_widget() {
|
||||
function wrapper(editor: CKEDITOR.editor) {
|
||||
editor.widgets.add("widgetty", {
|
||||
button: "Activate widgetty",
|
||||
template: "<imaginary-element>",
|
||||
dialog: "widgetty",
|
||||
init: function() {
|
||||
// no logic
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function test_focusManager() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea);
|
||||
var element = CKEDITOR.document.getById('myElement');
|
||||
|
||||
instance.focusManager.focus();
|
||||
instance.focusManager.focus(element);
|
||||
instance.focusManager.lock();
|
||||
instance.focusManager.unlock();
|
||||
instance.focusManager.blur();
|
||||
instance.focusManager.blur(true);
|
||||
instance.focusManager.add(element, true);
|
||||
instance.focusManager.remove(element);
|
||||
|
||||
var focusManager = new CKEDITOR.focusManager(instance);
|
||||
var object: CKEDITOR.dom.domObject = focusManager.currentActive;
|
||||
var bool: boolean = focusManager.hasFocus;
|
||||
}
|
||||
|
||||
function test_basicWriter() {
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
}
|
||||
|
||||
function test_htmlWriter() {
|
||||
var writer = new CKEDITOR.htmlWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
|
||||
writer.indentationChars = '\t';
|
||||
writer.lineBreakChars = '\r\n';
|
||||
writer.selfClosingEnd = '>';
|
||||
writer.indentation();
|
||||
writer.lineBreak();
|
||||
writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true});
|
||||
}
|
||||
|
||||
function test_sharedSpace() {
|
||||
CKEDITOR.inline('content', {
|
||||
removePlugins: 'maximize,resize',
|
||||
sharedSpaces: {
|
||||
top: 'someElementId',
|
||||
bottom: document.getElementById('anotherId')
|
||||
}
|
||||
});
|
||||
|
||||
CKEDITOR.inline('content', {
|
||||
sharedSpaces: { }
|
||||
});
|
||||
}
|
||||
|
||||
function test_specifying_editor_path() {
|
||||
window.CKEDITOR_BASEPATH = '/ckeditor/';
|
||||
}
|
||||
|
||||
function test_editor_instance_event() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea, {
|
||||
on: {
|
||||
activeEnterModeChange: function() {},
|
||||
activeFilterChange: function() {},
|
||||
afterCommandExec: function() {},
|
||||
afterInsertHtml: function() {},
|
||||
afterPaste: function() {},
|
||||
afterPasteFromWord: function() {},
|
||||
afterSetData: function() {},
|
||||
afterUndoImage: function() {},
|
||||
ariaEditorHelpLabel: function() {},
|
||||
ariaWidget: function() {},
|
||||
autogrow: function() {},
|
||||
beforeCommandExec: function() {},
|
||||
beforeDestroy: function() {},
|
||||
beforeModeUnload: function() {},
|
||||
beforeSetMode: function() {},
|
||||
beforeUndoImage: function() {},
|
||||
blur: function() {},
|
||||
change: function() {},
|
||||
configLoaded: function() {},
|
||||
contentDirChanged: function() {},
|
||||
contentDom: function() {},
|
||||
contentDomInvalidated: function() {},
|
||||
contentDomUnload: function() {},
|
||||
customConfigLoaded: function() {},
|
||||
dataFiltered: function() {},
|
||||
dataReady: function() {},
|
||||
destroy: function() {},
|
||||
dialogHide: function() {},
|
||||
dialogShow: function() {},
|
||||
dirChanged: function() {},
|
||||
doubleclick: function() {},
|
||||
dragend: function() {},
|
||||
dragstart: function() {},
|
||||
drop: function() {},
|
||||
elementsPathUpdate: function() {},
|
||||
fileUploadRequest: function() {},
|
||||
fileUploadResponse: function() {},
|
||||
floatingSpaceLayout: function() {},
|
||||
focus: function() {},
|
||||
getData: function() {},
|
||||
getSnapshot: function() {},
|
||||
insertElement: function() {},
|
||||
insertHtml: function() {},
|
||||
insertText: function() {},
|
||||
instanceReady: function() {},
|
||||
key: function() {},
|
||||
langLoaded: function() {},
|
||||
loadSnapshot: function() {},
|
||||
loaded: function() {},
|
||||
lockSnapshot: function() {},
|
||||
maximize: function() {},
|
||||
menuShow: function() {},
|
||||
mode: function() {},
|
||||
notificationHide: function() {},
|
||||
notificationShow: function() {},
|
||||
notificationUpdate: function() {},
|
||||
paste: function() {},
|
||||
pasteFromWord: function() {},
|
||||
pluginsLoaded: function() {},
|
||||
readOnly: function() {},
|
||||
removeFormatCleanup: function() {},
|
||||
required: function() {},
|
||||
resize: function() {},
|
||||
save: function() {},
|
||||
saveSnapshot: function() {},
|
||||
selectionChange: function() {},
|
||||
setData: function() {},
|
||||
stylesSet: function() {},
|
||||
template: function() {},
|
||||
toDataFormat: function() {},
|
||||
toHtml: function() {},
|
||||
unlockSnapshot: function() {},
|
||||
updateSnapshot: function() {},
|
||||
widgetDefinition: function() {}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function test_dtd() {
|
||||
var brConsideredEmptyTag = CKEDITOR.dtd.$empty['br'];
|
||||
var spanCanContainText = CKEDITOR.dtd['span']['#'];
|
||||
var divCanContainSpan = CKEDITOR.dtd['div']['span'];
|
||||
}
|
||||
|
||||
function test_getSelectedHtml() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var editor = CKEDITOR.replace(textarea);
|
||||
|
||||
// $ExpectType documentFragment
|
||||
var sel1 = editor.getSelectedHtml();
|
||||
console.log(sel1);
|
||||
|
||||
// $ExpectType documentFragment
|
||||
var sel2 = editor.getSelectedHtml(false);
|
||||
console.log(sel2);
|
||||
|
||||
// $ExpectType string
|
||||
var sel3 = editor.getSelectedHtml(true);
|
||||
console.log(sel3);
|
||||
|
||||
// $ExpectType string | documentFragment
|
||||
var sel4 = editor.getSelectedHtml(Math.random() > 0.5);
|
||||
console.log(sel4);
|
||||
}
|
||||
|
||||
function test_element() {
|
||||
var el = CKEDITOR.document.getById('myElement');
|
||||
el.addClass('class');
|
||||
console.log(el.hasClass('class'));
|
||||
el.removeClass('class');
|
||||
}
|
||||
|
||||
function test_selection() {
|
||||
var editor = new CKEDITOR.editor();
|
||||
var testNode = CKEDITOR.document.getById('myElement');
|
||||
|
||||
var selection = editor.getSelection();
|
||||
var ranges = selection.getRanges();
|
||||
for (var i = 0, c = ranges.length; i < c; i++) {
|
||||
var range = ranges[i];
|
||||
range.setStartBefore(testNode);
|
||||
range.setStartAfter(testNode);
|
||||
range.setEndBefore(testNode);
|
||||
range.setEndAfter(testNode);
|
||||
}
|
||||
}
|
||||
|
||||
function test_tools() {
|
||||
var obj = { key: 'value' };
|
||||
CKEDITOR.tools.clone(obj);
|
||||
CKEDITOR.tools.copy(obj);
|
||||
CKEDITOR.tools.prototypedCopy(obj);
|
||||
|
||||
console.log(CKEDITOR.tools.isArray([1])); // true
|
||||
console.log(CKEDITOR.tools.isArray(obj)); // false
|
||||
console.log(CKEDITOR.tools.isArray(null)); // false
|
||||
console.log(CKEDITOR.tools.isArray(undefined)); // false
|
||||
|
||||
CKEDITOR.tools.override(parseInt, function(_parseInt) {
|
||||
return function(value: any, radix?: number) {
|
||||
return _parseInt(value, radix);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function test_htmlParser() {
|
||||
var html = '<div><span>text</span></div>';
|
||||
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
|
||||
fragment.forEach(function(node) {
|
||||
if (node instanceof CKEDITOR.htmlParser.element) {
|
||||
node.forEach(function(node) {
|
||||
console.log(node);
|
||||
});
|
||||
}
|
||||
}, CKEDITOR.NODE_ELEMENT, true);
|
||||
}
|
||||
Vendored
+1949
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": false,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"ckeditor": [
|
||||
"ckeditor/v2"
|
||||
],
|
||||
"ckeditor/*": [
|
||||
"ckeditor/v2/*"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ckeditor-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -38,3 +38,6 @@ const className = cx('foo', ['bar'], { baz: true }); // => "abc def xyz"
|
||||
|
||||
// falsey values are just ignored
|
||||
cx(null, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1'
|
||||
|
||||
// true is just ignored
|
||||
cx(true || "foo");
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | false;
|
||||
type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | boolean;
|
||||
|
||||
interface ClassDictionary {
|
||||
[id: string]: boolean | undefined | null;
|
||||
|
||||
Vendored
+11
@@ -18,8 +18,14 @@ declare namespace CodeMirror {
|
||||
|
||||
function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.EditorFromTextArea;
|
||||
|
||||
/** It contains a string that indicates the version of the library. This is a triple of integers "major.minor.patch",
|
||||
where patch is zero for releases, and something else (usually one) for dev snapshots. */
|
||||
var version: string;
|
||||
|
||||
/** An object containing default values for all options.
|
||||
You can assign to its properties to modify defaults (though this won't affect editors that have already been created). */
|
||||
var defaults: any;
|
||||
|
||||
/** If you want to define extra methods in terms of the CodeMirror API, it is possible to use defineExtension.
|
||||
This will cause the given value(usually a method) to be added to all CodeMirror instances created from then on. */
|
||||
function defineExtension(name: string, value: any): void;
|
||||
@@ -315,6 +321,11 @@ declare namespace CodeMirror {
|
||||
/** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */
|
||||
getTokenAt(pos: CodeMirror.Position, precise?: boolean): Token;
|
||||
|
||||
/** This is a (much) cheaper version of getTokenAt useful for when you just need the type of the token at a given position,
|
||||
and no other information. Will return null for unstyled tokens, and a string, potentially containing multiple
|
||||
space-separated style names, otherwise. */
|
||||
getTokenTypeAt(pos: CodeMirror.Position): string;
|
||||
|
||||
/** This is similar to getTokenAt, but collects all tokens for a given line into an array. */
|
||||
getLineTokens(line: number, precise?: boolean): Token[];
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import compareVersions = require('compare-versions');
|
||||
|
||||
compareVersions('1.0.0', '2.0.0');
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Type definitions for compare-versions 3.0
|
||||
// Project: https://github.com/omichelsen/compare-versions
|
||||
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function compareVersions(firstVersion: string, secondVersion: string): number;
|
||||
export = compareVersions;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "compare-versions-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+17
-17
@@ -1,4 +1,4 @@
|
||||
// Type definitions for core-js 0.9
|
||||
// Type definitions for core-js 2.5
|
||||
// Project: https://github.com/zloirock/core-js/
|
||||
// Definitions by: Ron Buckton <https://github.com/rbuckton>, Michel Felipe <https://github.com/mfdeveloper>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -755,8 +755,8 @@ declare namespace core {
|
||||
raw(template: TemplateStringsArray, ...substitutions: any[]): string;
|
||||
startsWith(text: string, searchString: string, position?: number): boolean;
|
||||
at(text: string, index: number): string;
|
||||
lpad(text: string, length: number, fillStr?: string): string;
|
||||
rpad(text: string, length: number, fillStr?: string): string;
|
||||
padStart(text: string, length: number, fillStr?: string): string;
|
||||
padEnd(text: string, length: number, fillStr?: string): string;
|
||||
escapeHTML(text: string): string;
|
||||
unescapeHTML(text: string): string;
|
||||
};
|
||||
@@ -1454,9 +1454,13 @@ declare module "core-js/fn/string/includes" {
|
||||
const includes: typeof core.String.includes;
|
||||
export = includes;
|
||||
}
|
||||
declare module "core-js/fn/string/lpad" {
|
||||
const lpad: typeof core.String.lpad;
|
||||
export = lpad;
|
||||
declare module "core-js/fn/string/pad-end" {
|
||||
const padEnd: typeof core.String.padEnd;
|
||||
export = padEnd;
|
||||
}
|
||||
declare module "core-js/fn/string/pad-start" {
|
||||
const padStart: typeof core.String.padStart;
|
||||
export = padStart;
|
||||
}
|
||||
declare module "core-js/fn/string/raw" {
|
||||
const raw: typeof core.String.raw;
|
||||
@@ -1466,10 +1470,6 @@ declare module "core-js/fn/string/repeat" {
|
||||
const repeat: typeof core.String.repeat;
|
||||
export = repeat;
|
||||
}
|
||||
declare module "core-js/fn/string/rpad" {
|
||||
const rpad: typeof core.String.rpad;
|
||||
export = rpad;
|
||||
}
|
||||
declare module "core-js/fn/string/starts-with" {
|
||||
const startsWith: typeof core.String.startsWith;
|
||||
export = startsWith;
|
||||
@@ -2273,9 +2273,13 @@ declare module "core-js/library/fn/string/includes" {
|
||||
const includes: typeof core.String.includes;
|
||||
export = includes;
|
||||
}
|
||||
declare module "core-js/library/fn/string/lpad" {
|
||||
const lpad: typeof core.String.lpad;
|
||||
export = lpad;
|
||||
declare module "core-js/library/fn/string/pad-end" {
|
||||
const padEnd: typeof core.String.padEnd;
|
||||
export = padEnd;
|
||||
}
|
||||
declare module "core-js/library/fn/string/pad-start" {
|
||||
const padStart: typeof core.String.padStart;
|
||||
export = padStart;
|
||||
}
|
||||
declare module "core-js/library/fn/string/raw" {
|
||||
const raw: typeof core.String.raw;
|
||||
@@ -2285,10 +2289,6 @@ declare module "core-js/library/fn/string/repeat" {
|
||||
const repeat: typeof core.String.repeat;
|
||||
export = repeat;
|
||||
}
|
||||
declare module "core-js/library/fn/string/rpad" {
|
||||
const rpad: typeof core.String.rpad;
|
||||
export = rpad;
|
||||
}
|
||||
declare module "core-js/library/fn/string/starts-with" {
|
||||
const startsWith: typeof core.String.startsWith;
|
||||
export = startsWith;
|
||||
|
||||
Vendored
+43
-22
@@ -8,15 +8,27 @@ export as namespace CryptoJS;
|
||||
|
||||
declare var CryptoJS: CryptoJS.Hashes;
|
||||
declare namespace CryptoJS {
|
||||
interface Cipher {
|
||||
|
||||
interface Base {}
|
||||
|
||||
interface BufferedBlockAlgorithm extends Base {}
|
||||
|
||||
interface Hasher extends BufferedBlockAlgorithm {}
|
||||
|
||||
interface Cipher extends BufferedBlockAlgorithm {
|
||||
createEncryptor(secretPassphrase: string, option?: CipherOption): Encryptor;
|
||||
createDecryptor(secretPassphrase: string, option?: CipherOption): Decryptor;
|
||||
}
|
||||
|
||||
interface BlockCipher extends Cipher {}
|
||||
|
||||
interface StreamCipher extends Cipher {}
|
||||
|
||||
interface CipherHelper {
|
||||
encrypt(message: string, secretPassphrase: string | WordArray, option?: CipherOption): WordArray;
|
||||
decrypt(encryptedMessage: string | WordArray, secretPassphrase: string | WordArray, option?: CipherOption): DecryptedMessage;
|
||||
}
|
||||
interface CipherAlgorythm {
|
||||
createEncryptor(secretPassphrase: string, option?: CipherOption): Encriptor;
|
||||
createDecryptor(secretPassphrase: string, option?: CipherOption): Decryptor;
|
||||
}
|
||||
interface Encriptor {
|
||||
interface Encryptor {
|
||||
process(messagePart: string): string;
|
||||
finalize(): string;
|
||||
}
|
||||
@@ -87,23 +99,32 @@ declare namespace CryptoJS {
|
||||
HmacRIPEMD160(message: string | LibWordArray, ...options: any[]): WordArray;
|
||||
PBKDF2(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
|
||||
PBKDF2(message: string | LibWordArray, ...options: any[]): WordArray;
|
||||
AES: Cipher;
|
||||
DES: Cipher;
|
||||
TripleDES: Cipher;
|
||||
RC4: Cipher;
|
||||
RC4Drop: Cipher;
|
||||
Rabbit: Cipher;
|
||||
RabbitLegacy: Cipher;
|
||||
EvpKDF: Cipher;
|
||||
AES: CipherHelper;
|
||||
DES: CipherHelper;
|
||||
TripleDES: CipherHelper;
|
||||
RC4: CipherHelper;
|
||||
RC4Drop: CipherHelper;
|
||||
Rabbit: CipherHelper;
|
||||
RabbitLegacy: CipherHelper;
|
||||
EvpKDF: CipherHelper;
|
||||
algo: {
|
||||
AES: CipherAlgorythm;
|
||||
DES: CipherAlgorythm;
|
||||
TrippleDES: CipherAlgorythm;
|
||||
RC4: CipherAlgorythm;
|
||||
RC4Drop: CipherAlgorythm;
|
||||
Rabbit: CipherAlgorythm;
|
||||
RabbitLegacy: CipherAlgorythm;
|
||||
EvpKDF: CipherAlgorythm;
|
||||
AES: BlockCipher;
|
||||
DES: BlockCipher;
|
||||
TripleDES: BlockCipher;
|
||||
RC4: StreamCipher;
|
||||
RC4Drop: StreamCipher;
|
||||
Rabbit: StreamCipher;
|
||||
RabbitLegacy: StreamCipher;
|
||||
EvpKDF: Base;
|
||||
HMAC: Base;
|
||||
PBKDF2: Base;
|
||||
SHA1: Hasher;
|
||||
SHA3: Hasher;
|
||||
SHA256: Hasher;
|
||||
SHA384: Hasher;
|
||||
SHA512: Hasher;
|
||||
MD5: Hasher;
|
||||
RIPEMD160: Hasher;
|
||||
};
|
||||
format: {
|
||||
OpenSSL: any;
|
||||
|
||||
@@ -48,6 +48,7 @@ cHSV = cHSV.darker();
|
||||
cHSV = cHSV.darker(0.2);
|
||||
displayable = cHSV.displayable();
|
||||
cString = cHSV.toString();
|
||||
cString = cHSV.hex();
|
||||
console.log('Channels = (h : %d, s: %d, v: %d)', cHSV.h, cHSV.s, cHSV.v);
|
||||
console.log('Opacity = %d', cHSV.opacity);
|
||||
|
||||
|
||||
Vendored
-6
@@ -68,12 +68,6 @@ export interface HSVColor extends Color {
|
||||
* Returns the RGB equivalent of this color.
|
||||
*/
|
||||
rgb(): RGBColor;
|
||||
|
||||
/**
|
||||
* Returns a hexadecimal string representing this color.
|
||||
* If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255.
|
||||
*/
|
||||
hex(): string;
|
||||
}
|
||||
|
||||
export const hsv: HSVColorFactory;
|
||||
|
||||
@@ -229,3 +229,16 @@ iString = d3Interpolate.interpolateCubehelixLong.gamma(2.2)('purple', 'orange');
|
||||
iNum = d3Interpolate.interpolateBasis([1, 50, 30, 10]);
|
||||
|
||||
iNum = d3Interpolate.interpolateBasisClosed([1, 50, 30, 10]);
|
||||
|
||||
iString = d3Interpolate.piecewise(d3Interpolate.interpolateRgb.gamma(2.2), ['red', 'green', 'blue']);
|
||||
iString = d3Interpolate.piecewise(d3Interpolate.interpolateCubehelix, ['red', 'green', 'blue']);
|
||||
iZoom = d3Interpolate.piecewise(d3Interpolate.interpolateZoom, [[50, 50, 300], [100, 100, 500]]);
|
||||
iNum = d3Interpolate.piecewise(d3Interpolate.interpolateNumber, [1, 2, 3]);
|
||||
iNum = d3Interpolate.piecewise(d3Interpolate.interpolateRound, [1.1, 2.2, 3.3]);
|
||||
iString = d3Interpolate.piecewise(d3Interpolate.interpolateString, ['a', 'b', 'c']);
|
||||
iDate = d3Interpolate.piecewise(d3Interpolate.interpolateDate, [new Date(2018, 5, 1), new Date(2018, 5, 2), new Date(2018, 5, 3)]);
|
||||
iArrayNum = d3Interpolate.piecewise<number[]>(d3Interpolate.interpolateArray, [1, 2, 4, 8]);
|
||||
iArrayStr = d3Interpolate.piecewise<string[]>(d3Interpolate.interpolateArray, ['a', 'b', 'c', 'd']);
|
||||
iArrayMixed = d3Interpolate.piecewise<[Date, string]>(d3Interpolate.interpolateArray, [new Date(2016, 6, 1), 'b: 1']);
|
||||
iString = d3Interpolate.piecewise(d3Interpolate.interpolateTransformCss, ['rotate(0deg)', 'rotate(60deg)']);
|
||||
iString = d3Interpolate.piecewise(d3Interpolate.interpolateTransformSvg, ['rotate(0)', 'rotate(60)']);
|
||||
|
||||
Vendored
+9
-3
@@ -1,9 +1,9 @@
|
||||
// Type definitions for D3JS d3-interpolate module 1.1
|
||||
// Type definitions for D3JS d3-interpolate module 1.2
|
||||
// Project: https://github.com/d3/d3-interpolate/
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.1.1
|
||||
// Last module patch version validated against: 1.2.0
|
||||
|
||||
import { ColorCommonInstance } from 'd3-color';
|
||||
|
||||
@@ -55,7 +55,9 @@ export function interpolateString(a: string | { toString(): string }, b: string
|
||||
|
||||
export function interpolateDate(a: Date, b: Date): ((t: number) => Date);
|
||||
|
||||
export function interpolateArray<A extends any[]>(a: any[], b: A): ((t: number) => A);
|
||||
export type ArrayInterpolator<A extends any[]> = ((t: number) => A);
|
||||
|
||||
export function interpolateArray<A extends any[]>(a: any[], b: A): ArrayInterpolator<A>;
|
||||
|
||||
export function interpolateObject<U extends any>(a: any, b: U): ((t: number) => U); // TODO: extends 'any' should become 'object' with TS 2.2+ definitions
|
||||
export function interpolateObject(a: { [key: string]: any }, b: { [key: string]: any }): ((t: number) => { [key: string]: any });
|
||||
@@ -89,3 +91,7 @@ export const interpolateCubehelixLong: ColorGammaInterpolationFactory;
|
||||
|
||||
export function interpolateBasis(splineNodes: number[]): ((t: number) => number);
|
||||
export function interpolateBasisClosed(splineNodes: number[]): ((t: number) => number);
|
||||
|
||||
export function piecewise(interpolate: (a: ZoomView, b: ZoomView) => ZoomInterpolator, values: ZoomView[]): ZoomInterpolator;
|
||||
export function piecewise<A extends any[]>(interpolate: (a: any[], b: A) => ArrayInterpolator<A>, values: A): ArrayInterpolator<A>;
|
||||
export function piecewise<TData, Interpolator>(interpolate: (a: TData, b: TData) => Interpolator, values: TData[]): (t: number) => any;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false,
|
||||
"callable-types": false
|
||||
"callable-types": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.0.2
|
||||
// Last module patch version validated against: 1.0.7
|
||||
|
||||
/**
|
||||
* Returns the current time as defined by performance.now if available, and Date.now if not.
|
||||
@@ -44,7 +44,7 @@ export interface Timer {
|
||||
export function timer(callback: (elapsed: number) => void, delay?: number, time?: number): Timer;
|
||||
|
||||
/**
|
||||
* Immediately invoke any eligible timer callbacks
|
||||
* Immediately invoke any eligible timer callbacks.
|
||||
*/
|
||||
export function timerFlush(): void;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import * as ddTrace from 'dd-trace';
|
||||
import SpanContext = require('dd-trace/src/opentracing/span_context');
|
||||
|
||||
const tracer = ddTrace.init({
|
||||
service: 'MyLovelyService',
|
||||
hostname: 'localhost',
|
||||
port: 8126,
|
||||
});
|
||||
|
||||
tracer
|
||||
.trace('web.request', {
|
||||
service: 'my_service',
|
||||
childOf: new SpanContext({ traceId: 1337, spanId: 42 }),
|
||||
tags: {
|
||||
env: 'dev'
|
||||
}
|
||||
})
|
||||
.then(span => {
|
||||
span.setTag('my_tag', 'my_value');
|
||||
span.finish();
|
||||
});
|
||||
Vendored
+139
@@ -0,0 +1,139 @@
|
||||
// Type definitions for dd-trace-js 0.2
|
||||
// Project: https://github.com/DataDog/dd-trace-js
|
||||
// Definitions by: Colin Bradley <https://github.com/ColinBradley>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import Tracer = require('./src/opentracing/tracer');
|
||||
import Span = require('./src/opentracing/span');
|
||||
import SpanContext = require('./src/opentracing/span_context');
|
||||
|
||||
declare var trace: TraceProxy;
|
||||
export = trace;
|
||||
|
||||
declare class TraceProxy extends Tracer {
|
||||
/**
|
||||
* Initializes the tracer. This should be called before importing other libraries.
|
||||
*/
|
||||
init(options?: TracerOptions): this;
|
||||
|
||||
/**
|
||||
* Enable and optionally configure a plugin.
|
||||
* @param plugin The name of a built-in plugin.
|
||||
* @param config Configuration options.
|
||||
*/
|
||||
use(plugin: string, config: PluginOptions): this;
|
||||
|
||||
/**
|
||||
* Initiate a trace and creates a new span.
|
||||
* @param operationName The operation name to be used for this span.
|
||||
* @param options Configuration options. These will take precedence over environment variables.
|
||||
*/
|
||||
trace(operationName: string, options: TraceOptions): Promise<Span>;
|
||||
|
||||
/**
|
||||
* Initiate a trace and creates a new span.
|
||||
* @param operationName The operation name to be used for this span.
|
||||
* @param options Configuration options. These will take precedence over environment variables.
|
||||
*/
|
||||
trace(operationName: string, options: TraceOptions, callback: (span: Span) => void): void;
|
||||
|
||||
/**
|
||||
* Get the span from the current context.
|
||||
* @returns The current span or null if outside a trace context.
|
||||
*/
|
||||
currentSpan(): Span | null;
|
||||
}
|
||||
|
||||
interface TracerOptions {
|
||||
/**
|
||||
* Enable debug logging in the tracer.
|
||||
* @default false
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* The service name to be used for this program.
|
||||
*/
|
||||
service?: string;
|
||||
|
||||
/**
|
||||
* The address of the trace agent that the tracer will submit to.
|
||||
* @default 'localhost'
|
||||
*/
|
||||
hostname?: string;
|
||||
|
||||
/**
|
||||
* The port of the trace agent that the tracer will submit to.
|
||||
* @default 8126
|
||||
*/
|
||||
port?: number | string;
|
||||
|
||||
/**
|
||||
* Percentage of spans to sample as a float between 0 and 1.
|
||||
* @default 1
|
||||
*/
|
||||
sampleRate?: number;
|
||||
|
||||
/**
|
||||
* Interval in milliseconds at which the tracer will submit traces to the agent.
|
||||
* @default 2000
|
||||
*/
|
||||
flushInterval?: number;
|
||||
|
||||
/**
|
||||
* Experimental features can be enabled all at once by using true or individually using key / value pairs.
|
||||
* @default {}
|
||||
*/
|
||||
experimental?: ExperimentalOptions | boolean;
|
||||
|
||||
/**
|
||||
* Whether to load all built-in plugins.
|
||||
* @default true
|
||||
*/
|
||||
plugins?: boolean;
|
||||
}
|
||||
|
||||
interface ExperimentalOptions {
|
||||
/**
|
||||
* Whether to use Node's experimental async hooks.
|
||||
* @default false
|
||||
*/
|
||||
asyncHooks?: boolean;
|
||||
}
|
||||
|
||||
interface PluginOptions {
|
||||
/**
|
||||
* The service name to be used for this plugin.
|
||||
*/
|
||||
service: string;
|
||||
}
|
||||
|
||||
interface TraceOptions {
|
||||
/**
|
||||
* The service name to be used for this span.
|
||||
* The service name from the tracer will be used if this is not provided.
|
||||
*/
|
||||
service?: string;
|
||||
|
||||
/**
|
||||
* The resource name to be used for this span.
|
||||
* The operation name will be used if this is not provided.
|
||||
*/
|
||||
resource?: string;
|
||||
|
||||
/**
|
||||
* The span type to be used for this span.
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* The parent span or span context for the new span. Generally this is not needed as it will be
|
||||
* fetched from the current context.
|
||||
*/
|
||||
childOf?: Span | SpanContext;
|
||||
|
||||
/**
|
||||
* Global tags that should be assigned to every span.
|
||||
*/
|
||||
tags?: { [key: string]: any; } | string;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import Span = require('./span');
|
||||
import SpanContext = require('./span_context');
|
||||
|
||||
declare class Reference {
|
||||
/**
|
||||
* @return The Reference type (e.g., REFERENCE_CHILD_OF or
|
||||
* REFERENCE_FOLLOWS_FROM).
|
||||
*/
|
||||
type(): string;
|
||||
|
||||
/**
|
||||
* @return The SpanContext being referred to (e.g., the
|
||||
* parent in a REFERENCE_CHILD_OF Reference).
|
||||
*/
|
||||
referencedContext(): SpanContext;
|
||||
|
||||
/**
|
||||
* Initialize a new Reference instance.
|
||||
*
|
||||
* @param type - the Reference type constant (e.g.,
|
||||
* REFERENCE_CHILD_OF or REFERENCE_FOLLOWS_FROM).
|
||||
* @param referencedContext - the SpanContext being referred
|
||||
* to. As a convenience, a Span instance may be passed in instead
|
||||
* (in which case its .context() is used here).
|
||||
*/
|
||||
constructor(type: string, referencedContext: SpanContext | Span);
|
||||
}
|
||||
|
||||
export = Reference;
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
import Tracer = require('./tracer');
|
||||
import SpanContext = require('./span_context');
|
||||
|
||||
declare class Span {
|
||||
/**
|
||||
* Returns the SpanContext object associated with this Span.
|
||||
*/
|
||||
context(): SpanContext;
|
||||
|
||||
/**
|
||||
* Returns the Tracer object used to create this Span.
|
||||
*/
|
||||
tracer(): Tracer;
|
||||
|
||||
/**
|
||||
* Sets the string name for the logical operation this span represents.
|
||||
*/
|
||||
setOperationName(name: string): this;
|
||||
|
||||
/**
|
||||
* Sets a key:value pair on this Span that also propagates to future
|
||||
* children of the associated Span.
|
||||
*
|
||||
* setBaggageItem() enables powerful functionality given a full-stack
|
||||
* opentracing integration (e.g., arbitrary application data from a web
|
||||
* client can make it, transparently, all the way into the depths of a
|
||||
* storage system), and with it some powerful costs: use this feature with
|
||||
* care.
|
||||
*
|
||||
* IMPORTANT NOTE #1: setBaggageItem() will only propagate baggage items to
|
||||
* *future* causal descendants of the associated Span.
|
||||
*
|
||||
* IMPORTANT NOTE #2: Use this thoughtfully and with care. Every key and
|
||||
* value is copied into every local *and remote* child of the associated
|
||||
* Span, and that can add up to a lot of network and cpu overhead.
|
||||
*/
|
||||
setBaggageItem(key: string, value: string): this;
|
||||
|
||||
/**
|
||||
* Returns the value for a baggage item given its key.
|
||||
*
|
||||
* @param key
|
||||
* The key for the given trace attribute.
|
||||
* @return String value for the given key, or undefined if the key does not
|
||||
* correspond to a set trace attribute.
|
||||
*/
|
||||
getBaggageItem(key: string): string | undefined;
|
||||
|
||||
/**
|
||||
* Adds a single tag to the span. See `addTags()` for details.
|
||||
*/
|
||||
setTag(key: string, value: any): this;
|
||||
|
||||
/**
|
||||
* Adds the given key value pairs to the set of span tags.
|
||||
*
|
||||
* Multiple calls to addTags() results in the tags being the superset of
|
||||
* all calls.
|
||||
*
|
||||
* The behavior of setting the same key multiple times on the same span
|
||||
* is undefined.
|
||||
*
|
||||
* The supported type of the values is implementation-dependent.
|
||||
* Implementations are expected to safely handle all types of values but
|
||||
* may choose to ignore unrecognized / unhandle-able values (e.g. objects
|
||||
* with cyclic references, function objects).
|
||||
*/
|
||||
addTags(keyValueMap: {
|
||||
[key: string]: any;
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Add a log record to this Span, optionally at a user-provided timestamp.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* span.log({
|
||||
* size: rpc.size(), // numeric value
|
||||
* URI: rpc.URI(), // string value
|
||||
* payload: rpc.payload(), // Object value
|
||||
* "keys can be arbitrary strings": rpc.foo(),
|
||||
* });
|
||||
*
|
||||
* span.log({
|
||||
* "error.description": someError.description(),
|
||||
* }, someError.timestampMillis());
|
||||
*
|
||||
* @param keyValuePairs
|
||||
* An object mapping string keys to arbitrary value types. All
|
||||
* Tracer implementations should support bool, string, and numeric
|
||||
* value types, and some may also support Object values.
|
||||
* @param timestamp
|
||||
* An optional parameter specifying the timestamp in milliseconds
|
||||
* since the Unix epoch. Fractional values are allowed so that
|
||||
* timestamps with sub-millisecond accuracy can be represented. If
|
||||
* not specified, the implementation is expected to use its notion
|
||||
* of the current time of the call.
|
||||
*/
|
||||
|
||||
log(keyValuePairs: {
|
||||
[key: string]: any;
|
||||
}, timestamp?: number): this;
|
||||
|
||||
/**
|
||||
* Sets the end timestamp and finalizes Span state.
|
||||
*
|
||||
* With the exception of calls to Span.context() (which are always allowed),
|
||||
* finish() must be the last call made to any span instance, and to do
|
||||
* otherwise leads to undefined behavior.
|
||||
*
|
||||
* @param finishTime
|
||||
* Optional finish time in milliseconds as a Unix timestamp. Decimal
|
||||
* values are supported for timestamps with sub-millisecond accuracy.
|
||||
* If not specified, the current time (as defined by the
|
||||
* implementation) will be used.
|
||||
*/
|
||||
finish(finishTime?: number): void;
|
||||
}
|
||||
|
||||
export = Span;
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* SpanContext represents Span state that must propagate to descendant Spans
|
||||
* and across process boundaries.
|
||||
*
|
||||
* SpanContext is logically divided into two pieces: the user-level "Baggage"
|
||||
* (see setBaggageItem and getBaggageItem) that propagates across Span
|
||||
* boundaries and any Tracer-implementation-specific fields that are needed to
|
||||
* identify or otherwise contextualize the associated Span instance (e.g., a
|
||||
* <trace_id, span_id, sampled> tuple).
|
||||
*/
|
||||
declare class SpanContext {
|
||||
/**
|
||||
* Use to create references to parent spans.
|
||||
*/
|
||||
constructor(props: SpanContextLike);
|
||||
|
||||
public traceId: number;
|
||||
|
||||
public spanId: number;
|
||||
|
||||
public parentId?: number | null;
|
||||
|
||||
public sampled?: boolean;
|
||||
|
||||
public baggageItems?: { [key: string]: string };
|
||||
|
||||
public trace?: {
|
||||
started: number[],
|
||||
finished: number[]
|
||||
}
|
||||
}
|
||||
|
||||
interface SpanContextLike {
|
||||
traceId: number;
|
||||
spanId: number;
|
||||
}
|
||||
|
||||
export = SpanContext;
|
||||
@@ -0,0 +1,37 @@
|
||||
import Span = require('./span');
|
||||
import Reference = require('./reference');
|
||||
import SpanContext = require('./span_context');
|
||||
|
||||
interface SpanOptions {
|
||||
/**
|
||||
* a parent SpanContext (or Span, for convenience) that the newly-started
|
||||
* span will be the child of (per REFERENCE_CHILD_OF). If specified,
|
||||
* `references` must be unspecified.
|
||||
*/
|
||||
childOf?: Span | SpanContext;
|
||||
|
||||
/**
|
||||
* an array of Reference instances, each pointing to a causal parent
|
||||
* SpanContext. If specified, `fields.childOf` must be unspecified.
|
||||
*/
|
||||
references?: Reference[];
|
||||
|
||||
/**
|
||||
* set of key-value pairs which will be set as tags on the newly created
|
||||
* Span. Ownership of the object is passed to the created span for
|
||||
* efficiency reasons (the caller should not modify this object after
|
||||
* calling startSpan).
|
||||
*/
|
||||
tags?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
/**
|
||||
* a manually specified start time for the created Span object. The time
|
||||
* should be specified in milliseconds as Unix timestamp. Decimal value are
|
||||
* supported to represent time values with sub-millisecond accuracy.
|
||||
*/
|
||||
startTime?: number;
|
||||
}
|
||||
|
||||
export = SpanOptions;
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
import SpanOptions = require('./span_options');
|
||||
import Span = require('./span');
|
||||
import SpanContext = require('./span_context');
|
||||
|
||||
/**
|
||||
* Tracer is the entry-point between the instrumentation API and the tracing
|
||||
* implementation.
|
||||
*/
|
||||
declare class Tracer {
|
||||
/**
|
||||
* Starts and returns a new Span representing a logical unit of work.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* // Start a new (parentless) root Span:
|
||||
* var parent = Tracer.startSpan('DoWork');
|
||||
*
|
||||
* // Start a new (child) Span:
|
||||
* var child = Tracer.startSpan('load-from-db', {
|
||||
* childOf: parent.context(),
|
||||
* });
|
||||
*
|
||||
* // Start a new async (FollowsFrom) Span:
|
||||
* var child = Tracer.startSpan('async-cache-write', {
|
||||
* references: [
|
||||
* opentracing.followsFrom(parent.context())
|
||||
* ],
|
||||
* });
|
||||
*
|
||||
* @param name - the name of the operation (REQUIRED).
|
||||
* @param options - options for the newly created span.
|
||||
* @return A new Span object.
|
||||
*/
|
||||
startSpan(name: string, options?: SpanOptions): Span;
|
||||
|
||||
/**
|
||||
* Injects the given SpanContext instance for cross-process propagation
|
||||
* within `carrier`. The expected type of `carrier` depends on the value of
|
||||
* `format.
|
||||
*
|
||||
* OpenTracing defines a common set of `format` values (see
|
||||
* FORMAT_TEXT_MAP, FORMAT_HTTP_HEADERS, and FORMAT_BINARY), and each has
|
||||
* an expected carrier type.
|
||||
*
|
||||
* Consider this pseudocode example:
|
||||
*
|
||||
* var clientSpan = ...;
|
||||
* ...
|
||||
* // Inject clientSpan into a text carrier.
|
||||
* var headersCarrier = {};
|
||||
* Tracer.inject(clientSpan.context(), Tracer.FORMAT_HTTP_HEADERS, headersCarrier);
|
||||
* // Incorporate the textCarrier into the outbound HTTP request header
|
||||
* // map.
|
||||
* Object.assign(outboundHTTPReq.headers, headersCarrier);
|
||||
* // ... send the httpReq
|
||||
*
|
||||
* @param spanContext - the SpanContext to inject into the
|
||||
* carrier object. As a convenience, a Span instance may be passed
|
||||
* in instead (in which case its .context() is used for the
|
||||
* inject()).
|
||||
* @param format - the format of the carrier.
|
||||
* @param carrier - see the documentation for the chosen `format`
|
||||
* for a description of the carrier object.
|
||||
*/
|
||||
inject(spanContext: SpanContext | Span, format: string, carrier: any): void;
|
||||
|
||||
/**
|
||||
* Returns a SpanContext instance extracted from `carrier` in the given
|
||||
* `format`.
|
||||
*
|
||||
* OpenTracing defines a common set of `format` values (see
|
||||
* FORMAT_TEXT_MAP, FORMAT_HTTP_HEADERS, and FORMAT_BINARY), and each has
|
||||
* an expected carrier type.
|
||||
*
|
||||
* Consider this pseudocode example:
|
||||
*
|
||||
* // Use the inbound HTTP request's headers as a text map carrier.
|
||||
* var headersCarrier = inboundHTTPReq.headers;
|
||||
* var wireCtx = Tracer.extract(Tracer.FORMAT_HTTP_HEADERS, headersCarrier);
|
||||
* var serverSpan = Tracer.startSpan('...', { childOf : wireCtx });
|
||||
*
|
||||
* @param format - the format of the carrier.
|
||||
* @param carrier - the type of the carrier object is determined by
|
||||
* the format.
|
||||
* @return The extracted SpanContext, or null if no such SpanContext could
|
||||
* be found in `carrier`
|
||||
*/
|
||||
extract(format: string, carrier: any): SpanContext | null;
|
||||
}
|
||||
|
||||
export = Tracer;
|
||||
@@ -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",
|
||||
"dd-trace-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,5 @@
|
||||
import onKeypress = require("@derhuerst/cli-on-key");
|
||||
import { Key, OffKeyPress } from "@derhuerst/cli-on-key";
|
||||
|
||||
const onKey = (key: Key): void => undefined;
|
||||
const offKeypress: OffKeyPress = onKeypress(process.stdin, onKey);
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for @derhuerst/cli-on-key 0.1
|
||||
// Project: https://github.com/derhuerst/cli-on-key
|
||||
// Definitions by: Rong Shen <https://github.com/jacobbubu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import stream = require("stream");
|
||||
|
||||
declare namespace listen {
|
||||
interface Key {
|
||||
name?: string;
|
||||
ctrl: boolean;
|
||||
meta: boolean;
|
||||
shift: boolean;
|
||||
sequence: string;
|
||||
code?: string; // ansi code leaving out leading \x1b's
|
||||
raw: string;
|
||||
}
|
||||
|
||||
type Callback = (key: Key) => void;
|
||||
type OffKeyPress = (key: Key) => void;
|
||||
}
|
||||
|
||||
declare function listen(
|
||||
stream: stream.Readable,
|
||||
callback: listen.Callback
|
||||
): listen.OffKeyPress;
|
||||
|
||||
export = listen;
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@derhuerst/cli-on-key": [
|
||||
"derhuerst__cli-on-key"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": ["index.d.ts", "derhuerst__cli-on-key-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@
|
||||
/// <reference types="google.visualization" />
|
||||
|
||||
declare namespace dygraphs {
|
||||
type DataArray = number[][];
|
||||
type DataArray = (number|Date)[][];
|
||||
|
||||
type Data = string | DataArray | google.visualization.DataTable;
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -1075,14 +1075,14 @@ declare module 'ember' {
|
||||
* after all initializers and therefore after all code is loaded and the app is
|
||||
* ready.
|
||||
*/
|
||||
initializer(initializer: Initializer<Engine>): void;
|
||||
static initializer(initializer: Initializer<Engine>): void;
|
||||
/**
|
||||
* Instance initializers run after all initializers have run. Because
|
||||
* instance initializers run after the app is fully set up. We have access
|
||||
* to the store, container, and other items. However, these initializers run
|
||||
* after code has loaded and are not allowed to defer readiness.
|
||||
*/
|
||||
instanceInitializer(instanceInitializer: Initializer<EngineInstance>): void;
|
||||
static instanceInitializer(instanceInitializer: Initializer<EngineInstance>): void;
|
||||
/**
|
||||
* Set this to provide an alternate class to `Ember.DefaultResolver`
|
||||
*/
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
import Ember from 'ember';
|
||||
import { assertType } from "./lib/assert";
|
||||
|
||||
let App = Ember.Application.create({
|
||||
customEvents: {
|
||||
paste: 'paste'
|
||||
}
|
||||
let BaseApp = Ember.Application.extend({
|
||||
modulePrefix: 'my-app'
|
||||
});
|
||||
|
||||
App.initializer({
|
||||
BaseApp.initializer({
|
||||
name: 'my-initializer',
|
||||
initialize(app) {
|
||||
app.register('foo:bar', Ember.Object.extend({ foo: 'bar' }));
|
||||
}
|
||||
});
|
||||
|
||||
App.instanceInitializer({
|
||||
BaseApp.instanceInitializer({
|
||||
name: 'my-instance-initializer',
|
||||
initialize(app) {
|
||||
app.lookup('foo:bar').get('foo');
|
||||
}
|
||||
});
|
||||
|
||||
let App2 = Ember.Application.create({
|
||||
let App1 = BaseApp.create({
|
||||
rootElement: '#app-one',
|
||||
customEvents: {
|
||||
paste: 'paste'
|
||||
}
|
||||
});
|
||||
|
||||
let App2 = BaseApp.create({
|
||||
rootElement: '#app-two',
|
||||
customEvents: {
|
||||
mouseenter: null,
|
||||
mouseleave: null
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import { methodID, soliditySHA256, soliditySHA3 } from 'ethereumjs-abi';
|
||||
|
||||
methodID('foo', ['uint256', 'string']);
|
||||
soliditySHA3(['uint256', 'string'], [0, 'Alice']);
|
||||
soliditySHA256(['uint256', 'string'], [0, 'Alice']);
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// Type definitions for ethereumjs-abi 0.6
|
||||
// Project: https://github.com/ethereumjs/ethereumjs-abi
|
||||
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export function soliditySHA3(argTypes: string[], args: any[]): Buffer;
|
||||
export function soliditySHA256(argTypes: string[], args: any[]): Buffer;
|
||||
export function methodID(name: string, types: string[]): Buffer;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "ethereumjs-abi-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,4 @@
|
||||
import EthereumjsTx = require('ethereumjs-tx');
|
||||
|
||||
const txParams = {};
|
||||
const tx = new EthereumjsTx(txParams);
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for ethereumjs-tx 1.0
|
||||
// Project: https://github.com/ethereumjs/ethereumjs-tx
|
||||
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
declare class EthereumTx {
|
||||
raw: Buffer[];
|
||||
r: Buffer;
|
||||
s: Buffer;
|
||||
v: Buffer;
|
||||
nonce: Buffer;
|
||||
serialize(): Buffer;
|
||||
sign(buffer: Buffer): void;
|
||||
getSenderAddress(): Buffer;
|
||||
constructor(txParams: any);
|
||||
}
|
||||
export = EthereumTx;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "ethereumjs-tx-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+1
-1
@@ -761,7 +761,7 @@ export interface RecordingOptions {
|
||||
}
|
||||
|
||||
export class CameraObject {
|
||||
takePictureAsync(options: PictureOptions): Promise<PictureResponse>;
|
||||
takePictureAsync(options?: PictureOptions): Promise<PictureResponse>;
|
||||
recordAsync(options: RecordingOptions): Promise<{ uri: string; }>;
|
||||
stopRecording(): void;
|
||||
getSupportedRatiosAsync(): Promise<string[]>; // Android only
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import express from 'express';
|
||||
import * as paginate from 'express-paginate';
|
||||
|
||||
declare function findAndCountAll(params: object): Promise<{count: number, rows: object[]}>;
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(paginate.middleware(10, 50));
|
||||
|
||||
app.get('/users', async (req, res, next) => {
|
||||
// req.skip should be available
|
||||
return findAndCountAll({limit: req.query.limit, offset: req.skip})
|
||||
.then(results => {
|
||||
const itemCount = results.count;
|
||||
const pageCount = Math.ceil(results.count / req.query.limit);
|
||||
res.render('users/all_users', {
|
||||
users: results.rows,
|
||||
pageCount,
|
||||
itemCount,
|
||||
currentPageHref: paginate.href(req)(false, req.params),
|
||||
// Instead of exposing this to the html template, we'll test this here and pass a static number
|
||||
hasNextPages: paginate.hasNextPages(req)(pageCount),
|
||||
pages: paginate.getArrayPages(req)(3, pageCount, req.query.page)
|
||||
});
|
||||
}).catch(next);
|
||||
});
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for express-paginate 1.0
|
||||
// Project: https://github.com/niftylettuce/express-paginate
|
||||
// Definitions by: Amir Tugendhaft <https://github.com/AmirTugi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
import express = require("express");
|
||||
|
||||
declare global {
|
||||
namespace Express {
|
||||
interface Request {
|
||||
skip?: number;
|
||||
offset?: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface PageElement {
|
||||
number: number;
|
||||
url: typeof href;
|
||||
}
|
||||
|
||||
export function middleware(limit?: number, maxLimit?: number): (req: express.Request, res: express.Response, next: express.NextFunction) => void;
|
||||
export function hasNextPages(req: express.Request): (pageCount: number) => boolean;
|
||||
export function href(req: express.Request): (prev: object | boolean, params: object) => string;
|
||||
export function getArrayPages(req: express.Request): (limit: number, pageCount: number, currentPage: number) => PageElement[];
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"esModuleInterop": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"express-paginate-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -3,8 +3,54 @@ import xmlparser = require('express-xml-bodyparser');
|
||||
|
||||
const app: express.Express = express();
|
||||
|
||||
// xml-parser with no options
|
||||
app.use(xmlparser());
|
||||
|
||||
app.post("/auth", xmlparser({explicitArray: false}), (req, res, next) => {
|
||||
res.send("Success!");
|
||||
});
|
||||
// xml-parser with implicit default options
|
||||
app.use(xmlparser({}));
|
||||
|
||||
// xml-parser with explicit default options
|
||||
app.use(xmlparser({
|
||||
async: false,
|
||||
explicitArray: true,
|
||||
normalize: true,
|
||||
normalizeTags: true,
|
||||
trim: true
|
||||
}));
|
||||
|
||||
// xml-parser with all options
|
||||
app.use(xmlparser({
|
||||
async: true,
|
||||
attrkey: 'attrkey',
|
||||
attrNameProcessors: [(name => String.fromCharCode((42 + name.length) & 127))],
|
||||
attrValueProcessors: [(name => String.fromCharCode((24 + name.length) & 127))],
|
||||
charkey: 'charKey',
|
||||
charsAsChildren: true,
|
||||
childkey: 'childkey',
|
||||
emptyTag: 'emptyTag',
|
||||
explicitArray: true,
|
||||
explicitCharkey: true,
|
||||
explicitChildren: true,
|
||||
explicitRoot: true,
|
||||
ignoreAttrs: false,
|
||||
includeWhiteChars: false,
|
||||
mergeAttrs: true,
|
||||
normalize: true,
|
||||
normalizeTags: true,
|
||||
strict: true,
|
||||
tagNameProcessors: [(name) => name.toLocaleLowerCase()],
|
||||
trim: true,
|
||||
validator: () => false,
|
||||
valueProcessors: [],
|
||||
xmlns: true,
|
||||
}));
|
||||
|
||||
// xml-parser as route middleware with custom options
|
||||
const routeMiddleware: express.Handler = xmlparser({ explicitArray: false, strict: false });
|
||||
const routeHandler: express.RequestHandler = (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
res.send('Success!');
|
||||
};
|
||||
app.post('/auth', [routeMiddleware], routeHandler);
|
||||
|
||||
// overriding mime-type regexp
|
||||
xmlparser.regexp = /text\/(stranger|things)/;
|
||||
|
||||
+7
-11
@@ -1,23 +1,19 @@
|
||||
// Type definitions for express-xml-bodyparser 0.3
|
||||
// Project: https://github.com/macedigital/express-xml-bodyparser
|
||||
// Definitions by: Notice Maker <https://github.com/noticeMaker>
|
||||
// Definitions by: Notice Maker <https://github.com/noticeMaker>
|
||||
// Matthias Adler <https://github.com/macedigital>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Request, Response, NextFunction } from 'express';
|
||||
import { Handler } from 'express';
|
||||
|
||||
declare function xmlparser(options?: xmlparser.XmlparserOptions): (req: Request, res: Response, next: NextFunction) => void;
|
||||
import { Options as XmlParserOptions } from 'xml2js';
|
||||
|
||||
declare function xmlparser(options?: XmlParserOptions): Handler;
|
||||
|
||||
declare namespace xmlparser {
|
||||
// @deprecated Will be removed in future versions
|
||||
let regexp: RegExp;
|
||||
|
||||
interface XmlparserOptions {
|
||||
async?: boolean;
|
||||
explicitArray?: boolean;
|
||||
normalize?: boolean;
|
||||
normalizeTags?: boolean;
|
||||
trim?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = xmlparser;
|
||||
|
||||
Vendored
+5
@@ -2254,6 +2254,11 @@ interface IObjectOptions {
|
||||
* Not used by fabric, just for convenience
|
||||
*/
|
||||
data?: any;
|
||||
|
||||
/**
|
||||
* Describes the object's corner position in canvas object absolute properties.
|
||||
*/
|
||||
aCoords?: {bl: Point, br: Point, tl: Point, tr: Point};
|
||||
}
|
||||
export interface Object extends IObservable<Object>, IObjectOptions, IObjectAnimation<Object> { }
|
||||
export class Object {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const locale: string = FBInstant.getLocale()!;
|
||||
const platform: string = FBInstant.getPlatform();
|
||||
const platform: string = FBInstant.getPlatform()!;
|
||||
const sdkVersion: string = FBInstant.getSDKVersion();
|
||||
FBInstant.initializeAsync().then(() => {});
|
||||
FBInstant.setLoadingProgress(10);
|
||||
@@ -70,6 +70,12 @@ FBInstant.getLeaderboardAsync("name").then((leaderboard: FBInstant.Leaderboard)
|
||||
const score: number = leaderboardEntry.getScore();
|
||||
const timestamp: number = leaderboardEntry.getTimestamp();
|
||||
});
|
||||
const contextID: string = leaderboard.getContextID()!;
|
||||
leaderboard.getEntriesAsync(10, 10).then(entries => {});
|
||||
leaderboard.getEntryCountAsync().then((entryCount: number) => {});
|
||||
const name: string = leaderboard.getName();
|
||||
leaderboard.getPlayerEntryAsync().then(playerEntry => {});
|
||||
leaderboard.setScoreAsync(10).then(leaderboardEntry => {});
|
||||
});
|
||||
|
||||
FBInstant.player.canSubscribeBotAsync().then((canSubscribeBot: boolean) => {});
|
||||
|
||||
+5
-5
@@ -33,7 +33,7 @@ declare namespace FBInstant {
|
||||
/**
|
||||
* The platform on which the game is currently running. The value will always be null until FBInstant.initializeAsync() resolves.
|
||||
*/
|
||||
function getPlatform(): Platform;
|
||||
function getPlatform(): Platform | null;
|
||||
|
||||
/**
|
||||
* The string representation of this SDK version.
|
||||
@@ -174,11 +174,11 @@ declare namespace FBInstant {
|
||||
*
|
||||
* @param eventName Name of the event. Must be 2 to 40 characters, and can only contain '_', '-', ' ', and alphanumeric characters.
|
||||
* @param valueToSum An optional numeric value that FB Analytics can calculate a sum with.
|
||||
* @param parameter An optional object that can contain up to 25 key-value pairs to be logged with the event. Keys must be 2 to 40 characters,
|
||||
* @param parameters An optional object that can contain up to 25 key-value pairs to be logged with the event. Keys must be 2 to 40 characters,
|
||||
* and can only contain '_', '-', ' ', and alphanumeric characters. Values must be less than 100 characters in length.
|
||||
* @returns The error if the event failed to log; otherwise returns null.
|
||||
*/
|
||||
function logEvent(eventName: string, valueToSum?: number, parameter?: { [key: string]: string; }): APIError | null;
|
||||
function logEvent(eventName: string, valueToSum?: number, parameters?: { [key: string]: string; }): APIError | null;
|
||||
|
||||
/**
|
||||
* Set a callback to be fired when a pause event is triggered.
|
||||
@@ -458,7 +458,7 @@ declare namespace FBInstant {
|
||||
* @throws PENDING_REQUEST
|
||||
* @throws CLIENT_UNSUPPORTED_OPERATION
|
||||
*/
|
||||
chooseAsync(options: ContextOptions): Promise<void>;
|
||||
chooseAsync(options?: ContextOptions): Promise<void>;
|
||||
|
||||
/**
|
||||
* Attempts to create or switch into a context between a specified player and the current player. The returned promise will reject if the player listed is not a Connected Player of the current
|
||||
@@ -521,7 +521,7 @@ declare namespace FBInstant {
|
||||
* @throws INVALID_OPERATION
|
||||
* @throws RATE_LIMITED
|
||||
*/
|
||||
setScoreAsync(score: number, extraData: string): Promise<LeaderboardEntry>;
|
||||
setScoreAsync(score: number, extraData?: string): Promise<LeaderboardEntry>;
|
||||
|
||||
/**
|
||||
* Retrieves the leaderboard's entry for the current player, or null if the player has not set one yet.
|
||||
|
||||
@@ -92,3 +92,9 @@ fetchMock.get("http://test.com", {
|
||||
body: 'abc',
|
||||
redirectUrl: "http://example.org"
|
||||
});
|
||||
|
||||
const sandbox = fetchMock.sandbox();
|
||||
sandbox.get("http://test.com", {
|
||||
body: 'abc',
|
||||
redirectUrl: "http://example.org"
|
||||
});
|
||||
|
||||
Vendored
+16
@@ -203,6 +203,14 @@ declare namespace fetchMock {
|
||||
*/
|
||||
mock(options: MockOptions): this;
|
||||
|
||||
/**
|
||||
* Returns a drop-in mock for fetch which can be passed to other mocking
|
||||
* libraries. It implements the full fetch-mock api and maintains its
|
||||
* own state independent of other instances, so tests can be run in
|
||||
* parallel.
|
||||
*/
|
||||
sandbox(): FetchMockSandbox;
|
||||
|
||||
/**
|
||||
* Replaces fetch() with a stub which records its calls, grouped by
|
||||
* route, and optionally returns a mocked Response object or passes the
|
||||
@@ -450,6 +458,14 @@ declare namespace fetchMock {
|
||||
*/
|
||||
configure(opts: {}): void;
|
||||
}
|
||||
|
||||
interface FetchMockSandbox extends FetchMockStatic {
|
||||
/**
|
||||
* Also callable as fetch(). Use `typeof fetch` in your code to define
|
||||
* a field that accepts both `fetch()` and a fetch-mock sandbox.
|
||||
*/
|
||||
(input?: string | Request , init?: RequestInit): Promise<Response>;
|
||||
}
|
||||
}
|
||||
|
||||
declare var fetchMock: fetchMock.FetchMockStatic;
|
||||
|
||||
@@ -0,0 +1,681 @@
|
||||
class Component {
|
||||
openFhirServiceUrl = 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/open';
|
||||
closedFhirServiceUrl = 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/data';
|
||||
|
||||
clientSettings: FHIR.SMART.OAuth2ClientSettings = {
|
||||
client_id: '50a7f6ca-075a-47de-ab83-152814c3edb2',
|
||||
scope: 'launch/patient user/*.* openid profile',
|
||||
state: 'RandomStateOverride'
|
||||
};
|
||||
|
||||
oauth2Configuration: FHIR.SMART.OAuth2Configuration = {
|
||||
client: this.clientSettings,
|
||||
server: this.closedFhirServiceUrl
|
||||
};
|
||||
|
||||
authContext: FHIR.SMART.AuthContext = {
|
||||
type: 'none'
|
||||
};
|
||||
|
||||
context: FHIR.SMART.Context = {
|
||||
serviceUrl: this.openFhirServiceUrl,
|
||||
auth: this.authContext,
|
||||
userId: 'tTFt1mD0vgox9npTe2ZA',
|
||||
// Patient name: Abernathy,Francine
|
||||
patientId: 'a509406a-5098-478c-b183-037d68a953d9'
|
||||
};
|
||||
|
||||
observationEntry: FHIR.SMART.Entry = {
|
||||
resource: {
|
||||
'resourceType': 'Observation',
|
||||
'id': 'c179f87f-e7d2-49b0-8838-c7cbf9b0da27',
|
||||
'meta': {
|
||||
'versionId': '1',
|
||||
'lastUpdated': '2018-01-12T19:22:57.000+00:00',
|
||||
'profile': [
|
||||
'http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation'
|
||||
],
|
||||
'tag': [
|
||||
{
|
||||
'system': 'https://smarthealthit.org/tags',
|
||||
'code': 'synthea-7-2017'
|
||||
}
|
||||
]
|
||||
},
|
||||
'status': 'final',
|
||||
'category': [
|
||||
{
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://hl7.org/fhir/observation-category'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
'code': {
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://loinc.org',
|
||||
'code': '69453-9',
|
||||
'display': 'Cause of Death [US Standard Certificate of Death]'
|
||||
}
|
||||
],
|
||||
'text': 'Cause of Death [US Standard Certificate of Death]'
|
||||
},
|
||||
'subject': {
|
||||
'reference': 'Patient/a509406a-5098-478c-b183-037d68a953d9'
|
||||
},
|
||||
'context': {
|
||||
'reference': 'Encounter/fbebfcf2-86d8-4c56-9539-314be0ce5bed'
|
||||
},
|
||||
'effectiveDateTime': '1989-07-26T17:51:45-04:00',
|
||||
'issued': '1989-07-26T17:51:45-04:00',
|
||||
'valueCodeableConcept': {
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://snomed.info/sct',
|
||||
'code': '185086009',
|
||||
'display': 'Chronic obstructive bronchitis (disorder)'
|
||||
}
|
||||
],
|
||||
'text': 'Chronic obstructive bronchitis (disorder)'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
weightObservationEntry: FHIR.SMART.Entry = {
|
||||
'resource': {
|
||||
'id': 'RandomId',
|
||||
'resourceType': 'Observation',
|
||||
'text': {
|
||||
'status': 'generated',
|
||||
'div': '<div>Human readable form</div>'
|
||||
},
|
||||
'status': 'final',
|
||||
'category': [
|
||||
{
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://hl7.org/fhir/observation-category',
|
||||
'code': 'vital-signs',
|
||||
'display': 'Vital Signs'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
'code': {
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://loinc.org',
|
||||
'code': '29463-7',
|
||||
'display': 'Body Weight'
|
||||
},
|
||||
{
|
||||
'system': 'http://loinc.org',
|
||||
'code': '3141-9',
|
||||
'display': 'Body weight Measured'
|
||||
},
|
||||
{
|
||||
'system': 'http://snomed.info/sct',
|
||||
'code': '27113001',
|
||||
'display': 'Body weight'
|
||||
},
|
||||
{
|
||||
'system': 'http://acme.org/devices/clinical-codes',
|
||||
'code': 'body-weight',
|
||||
'display': 'Body Weight'
|
||||
}
|
||||
]
|
||||
},
|
||||
'subject': {
|
||||
'reference': 'Patient/example'
|
||||
},
|
||||
'context': {
|
||||
'reference': 'Encounter/example'
|
||||
},
|
||||
'effectiveDateTime': '2016-03-28',
|
||||
'valueQuantity': {
|
||||
'value': 185,
|
||||
'unit': 'lbs',
|
||||
'system': 'http://unitsofmeasure.org',
|
||||
'code': '[lb_us]'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
bundle: FHIR.SMART.Bundle = {
|
||||
bundle: {
|
||||
'resourceType': 'Bundle',
|
||||
'id': '936286e3-cf22-44c8-be9f-b8d1b950a9a3',
|
||||
'meta': {
|
||||
'lastUpdated': '2018-05-22T22:08:19.000+00:00'
|
||||
},
|
||||
'type': 'searchset',
|
||||
'total': 1,
|
||||
'link': [
|
||||
{
|
||||
'relation': 'self',
|
||||
// tslint:disable-next-line:max-line-length
|
||||
'url': 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/open?_getpages=8bbd1c3c-a90f-49c6-8394-ca7524b46774&_getpagesoffset=10&_count=10&_pretty=true&_bundletype=searchset'
|
||||
},
|
||||
{
|
||||
'relation': 'next',
|
||||
// tslint:disable-next-line:max-line-length
|
||||
'url': 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/open?_getpages=8bbd1c3c-a90f-49c6-8394-ca7524b46774&_getpagesoffset=20&_count=10&_format=json&_pretty=true&_bundletype=searchset'
|
||||
},
|
||||
{
|
||||
'relation': 'prev',
|
||||
// tslint:disable-next-line:max-line-length
|
||||
'url': 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/open?_getpages=8bbd1c3c-a90f-49c6-8394-ca7524b46774&_getpagesoffset=0&_count=10&_format=json&_pretty=true&_bundletype=searchset'
|
||||
}
|
||||
],
|
||||
'entry': [
|
||||
{
|
||||
'fullUrl': 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/open/Observation/152759',
|
||||
'resource': {
|
||||
'resourceType': 'Observation',
|
||||
'id': '152759',
|
||||
'meta': {
|
||||
'versionId': '1',
|
||||
'lastUpdated': '2018-05-22T20:42:56.000+00:00',
|
||||
'profile': [
|
||||
'http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation'
|
||||
],
|
||||
'tag': [
|
||||
{
|
||||
'system': 'https://smarthealthit.org/tags',
|
||||
'code': 'synthea-7-2017'
|
||||
}
|
||||
]
|
||||
},
|
||||
'status': 'final',
|
||||
'category': [
|
||||
{
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://hl7.org/fhir/observation-category'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
'code': {
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://loinc.org',
|
||||
'code': '69453-9',
|
||||
'display': 'Cause of Death [US Standard Certificate of Death]'
|
||||
}
|
||||
],
|
||||
'text': 'Cause of Death [US Standard Certificate of Death]'
|
||||
},
|
||||
'subject': {
|
||||
'reference': 'Patient/a509406a-5098-478c-b183-037d68a953d9'
|
||||
},
|
||||
'context': {
|
||||
'reference': 'Encounter/fbebfcf2-86d8-4c56-9539-314be0ce5bed'
|
||||
},
|
||||
'effectiveDateTime': '1989-07-26T17:51:45-04:00',
|
||||
'issued': '1989-07-26T17:51:45-04:00',
|
||||
'valueCodeableConcept': {
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://snomed.info/sct',
|
||||
'code': '185086009',
|
||||
'display': 'Chronic obstructive bronchitis (disorder)'
|
||||
}
|
||||
],
|
||||
'text': 'Chronic obstructive bronchitis (disorder)'
|
||||
}
|
||||
},
|
||||
'search': {
|
||||
'mode': 'match'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
heightObservation: FHIR.SMART.Resource = {
|
||||
'resourceType': 'Observation',
|
||||
'id': 'body-height',
|
||||
'meta': {
|
||||
'profile': [
|
||||
'http://hl7.org/fhir/StructureDefinition/vitalsigns'
|
||||
]
|
||||
},
|
||||
'text': {
|
||||
'status': 'generated',
|
||||
'div': '<div>Test</div>'
|
||||
},
|
||||
'status': 'final',
|
||||
'category': [
|
||||
{
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://hl7.org/fhir/observation-category',
|
||||
'code': 'vital-signs',
|
||||
'display': 'Vital Signs'
|
||||
}
|
||||
],
|
||||
'text': 'Vital Signs'
|
||||
}
|
||||
],
|
||||
'code': {
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://loinc.org',
|
||||
'code': '8302-2',
|
||||
'display': 'Body height'
|
||||
}
|
||||
],
|
||||
'text': 'Body height'
|
||||
},
|
||||
'subject': {
|
||||
'reference': 'Patient/example'
|
||||
},
|
||||
'effectiveDateTime': '1999-07-02',
|
||||
'valueQuantity': {
|
||||
'value': 66.899999999999991,
|
||||
'unit': 'in',
|
||||
'system': 'http://unitsofmeasure.org',
|
||||
'code': '[in_i]'
|
||||
}
|
||||
};
|
||||
|
||||
transactionBundle: FHIR.SMART.Bundle = {
|
||||
bundle: {
|
||||
'resourceType': 'Bundle',
|
||||
'id': '936286e3-cf22-44c8-be9f-b8d1b950a9a3',
|
||||
'meta': {
|
||||
'lastUpdated': '2018-05-22T22:08:19.000+00:00'
|
||||
},
|
||||
'type': 'transaction',
|
||||
'total': 1,
|
||||
'link': [
|
||||
{
|
||||
'relation': 'self',
|
||||
// tslint:disable-next-line:max-line-length
|
||||
'url': 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/open?_getpages=8bbd1c3c-a90f-49c6-8394-ca7524b46774&_getpagesoffset=10&_count=10&_pretty=true&_bundletype=searchset'
|
||||
},
|
||||
{
|
||||
'relation': 'next',
|
||||
// tslint:disable-next-line:max-line-length
|
||||
'url': 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/open?_getpages=8bbd1c3c-a90f-49c6-8394-ca7524b46774&_getpagesoffset=20&_count=10&_format=json&_pretty=true&_bundletype=searchset'
|
||||
},
|
||||
{
|
||||
'relation': 'prev',
|
||||
// tslint:disable-next-line:max-line-length
|
||||
'url': 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/open?_getpages=8bbd1c3c-a90f-49c6-8394-ca7524b46774&_getpagesoffset=0&_count=10&_format=json&_pretty=true&_bundletype=searchset'
|
||||
}
|
||||
],
|
||||
'entry': [
|
||||
{
|
||||
'fullUrl': 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/open/Observation/152759',
|
||||
'resource': {
|
||||
'resourceType': 'Observation',
|
||||
'id': '152759',
|
||||
'meta': {
|
||||
'versionId': '1',
|
||||
'lastUpdated': '2018-05-22T20:42:56.000+00:00',
|
||||
'profile': [
|
||||
'http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation'
|
||||
],
|
||||
'tag': [
|
||||
{
|
||||
'system': 'https://smarthealthit.org/tags',
|
||||
'code': 'synthea-7-2017'
|
||||
}
|
||||
]
|
||||
},
|
||||
'status': 'final',
|
||||
'category': [
|
||||
{
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://hl7.org/fhir/observation-category'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
'code': {
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://loinc.org',
|
||||
'code': '69453-9',
|
||||
'display': 'Cause of Death [US Standard Certificate of Death]'
|
||||
}
|
||||
],
|
||||
'text': 'Cause of Death [US Standard Certificate of Death]'
|
||||
},
|
||||
'subject': {
|
||||
'reference': 'Patient/a509406a-5098-478c-b183-037d68a953d9'
|
||||
},
|
||||
'context': {
|
||||
'reference': 'Encounter/fbebfcf2-86d8-4c56-9539-314be0ce5bed'
|
||||
},
|
||||
'effectiveDateTime': '1989-07-26T17:51:45-04:00',
|
||||
'issued': '1989-07-26T17:51:45-04:00',
|
||||
'valueCodeableConcept': {
|
||||
'coding': [
|
||||
{
|
||||
'system': 'http://snomed.info/sct',
|
||||
'code': '185086009',
|
||||
'display': 'Chronic obstructive bronchitis (disorder)'
|
||||
}
|
||||
],
|
||||
'text': 'Chronic obstructive bronchitis (disorder)'
|
||||
}
|
||||
},
|
||||
'request': {
|
||||
'method': 'POST'
|
||||
},
|
||||
'search': {
|
||||
'mode': 'match'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
searchParameter: FHIR.SMART.SearchParams = {
|
||||
type: 'Observation',
|
||||
query: {
|
||||
code: '69453-9'
|
||||
}
|
||||
};
|
||||
|
||||
patientSpecificSearchParams: FHIR.SMART.SearchParams = {
|
||||
patient: 'a509406a-5098-478c-b183-037d68a953d9',
|
||||
type: 'Observation',
|
||||
query: {
|
||||
code: '69453-9'
|
||||
}
|
||||
};
|
||||
|
||||
resolveParameter: string[] = ['Observation.subject'];
|
||||
|
||||
historyParameter: FHIR.SMART.HistoryParams = {
|
||||
id: '152768',
|
||||
type: 'Observation',
|
||||
count: 10,
|
||||
params: { _extraParam: 'extraParamValue' }
|
||||
};
|
||||
|
||||
resourceType: FHIR.SMART.ResourceType = {
|
||||
type: 'Observation'
|
||||
};
|
||||
|
||||
readParameter: FHIR.SMART.ReadParams = {
|
||||
type: 'Observation',
|
||||
id: '152768'
|
||||
};
|
||||
|
||||
vreadParameter: FHIR.SMART.VersionReadParams = {
|
||||
type: 'Observation',
|
||||
id: '152768',
|
||||
versionId: '1'
|
||||
};
|
||||
|
||||
resolveParameter2: FHIR.SMART.ResolveParams = {
|
||||
reference: this.observationEntry.resource.subject,
|
||||
resource: this.observationEntry.resource,
|
||||
bundle: this.bundle.bundle
|
||||
};
|
||||
|
||||
resourceParameter: FHIR.SMART.ResourceParameter = {
|
||||
resource: 'Patient',
|
||||
id: 'a509406a-5098-478c-b183-037d68a953d9'
|
||||
};
|
||||
|
||||
oauth2ReadyCallback = (smartClient: FHIR.SMART.SMARTClient) => {
|
||||
// Client interacting after a successful OAuth2 authorization workflow
|
||||
const api: FHIR.SMART.Api = smartClient.api;
|
||||
|
||||
// FHIR API methods exposed by fhir.js
|
||||
api.conformance(this.context).then(this.apiSuccess, this.apiError);
|
||||
api.create(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
api.delete(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
api.document(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
api.drain(this.searchParameter, this.drainProcess, this.drainDone, this.apiError);
|
||||
api.fetchAll(this.searchParameter).then(this.fetchAllSuccess, this.apiError);
|
||||
api.fetchAllWithReferences(this.searchParameter, this.resolveParameter)
|
||||
.then(this.fetchAllWithReferencesSuccess, this.apiError);
|
||||
api.history(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
api.nextPage(this.bundle).then(this.apiSuccess, this.apiError);
|
||||
api.prevPage(this.bundle).then(this.apiSuccess, this.apiError);
|
||||
api.profile(this.resourceType).then(this.apiSuccess, this.apiError);
|
||||
api.read(this.readParameter).then(this.apiSuccess, this.apiError);
|
||||
api.resolve(this.resolveParameter2).then(this.apiSuccess, this.apiError);
|
||||
api.resourceHistory(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
api.search(this.searchParameter).then(this.apiSuccess, this.apiError);
|
||||
api.search(this.patientSpecificSearchParams).then(this.apiSuccess, this.apiError);
|
||||
api.transaction(this.transactionBundle).then(this.apiSuccess, this.apiError);
|
||||
api.typeHistory(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
api.update(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
api.validate(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
api.vread(this.vreadParameter).then(this.apiSuccess, this.apiError);
|
||||
|
||||
const objectPopulatedWithHeader = smartClient.authenticated({});
|
||||
smartClient.fetchBinary(this.observationEntry.resource.subject.reference).then(this.fetchBinarySuccess, this.apiError);
|
||||
smartClient.get(this.resourceParameter).then(this.apiSuccess, this.apiError);
|
||||
smartClient.getBinary(this.observationEntry.resource.subject.reference).then(this.fetchBinarySuccess, this.apiError);
|
||||
|
||||
// Patient scoped FHIR API calls
|
||||
if (smartClient.patient) {
|
||||
const patient: FHIR.SMART.Patient = smartClient.patient;
|
||||
const patientId: string = patient.id;
|
||||
const patientApi: FHIR.SMART.Api = patient.api;
|
||||
|
||||
patientApi.conformance(this.context).then(this.apiSuccess, this.apiError);
|
||||
patientApi.create(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
patientApi.delete(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
patientApi.document(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
patientApi.drain(this.searchParameter, this.drainProcess, this.drainDone, this.apiError);
|
||||
patientApi.fetchAll(this.searchParameter).then(this.fetchAllSuccess, this.apiError);
|
||||
patientApi.fetchAllWithReferences(this.searchParameter, this.resolveParameter)
|
||||
.then(this.fetchAllWithReferencesSuccess, this.apiError);
|
||||
patientApi.history(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
patientApi.nextPage(this.bundle).then(this.apiSuccess, this.apiError);
|
||||
patientApi.prevPage(this.bundle).then(this.apiSuccess, this.apiError);
|
||||
patientApi.profile(this.resourceType).then(this.apiSuccess, this.apiError);
|
||||
patientApi.read(this.readParameter).then(this.apiSuccess, this.apiError);
|
||||
patientApi.resolve(this.resolveParameter2).then(this.apiSuccess, this.apiError);
|
||||
patientApi.resourceHistory(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
patientApi.search(this.searchParameter).then(this.apiSuccess, this.apiError);
|
||||
patientApi.search(this.patientSpecificSearchParams).then(this.apiSuccess, this.apiError);
|
||||
patientApi.transaction(this.transactionBundle).then(this.apiSuccess, this.apiError);
|
||||
patientApi.typeHistory(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
patientApi.update(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
patientApi.validate(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
patientApi.vread(this.vreadParameter).then(this.apiSuccess, this.apiError);
|
||||
|
||||
patient.read().then(this.apiSuccess, this.apiError);
|
||||
}
|
||||
|
||||
// SMART client context helpers
|
||||
const context: FHIR.SMART.Context = smartClient.server;
|
||||
if (smartClient.server.auth) {
|
||||
const auth: FHIR.SMART.AuthContext = smartClient.server.auth;
|
||||
}
|
||||
if (smartClient.server.patientId) {
|
||||
const patientIdInContext: string = smartClient.server.patientId;
|
||||
}
|
||||
const fhirServiceUrl = smartClient.server.serviceUrl;
|
||||
if (smartClient.server.userId) {
|
||||
const userIdInContext: string = smartClient.server.userId;
|
||||
}
|
||||
const state: FHIR.SMART.OAuth2Configuration = smartClient.state;
|
||||
const tokenResponse = smartClient.tokenResponse;
|
||||
|
||||
// User in context
|
||||
const userId = smartClient.userId;
|
||||
const userInContext = smartClient.user;
|
||||
smartClient.user.read().then(this.apiSuccess, this.apiError);
|
||||
|
||||
// SMART client helper methods
|
||||
// Observation helpers
|
||||
const observationByCodesFn = smartClient.byCodes(this.observationEntry.resource, 'code');
|
||||
const observations = observationByCodesFn('29463-7');
|
||||
const observationsByCodes: FHIR.SMART.ObservationsByCode = smartClient.byCode(this.observationEntry.resource, 'code');
|
||||
// Unit helpers
|
||||
const numericValue = smartClient.units.any(this.heightObservation.valueQuantity);
|
||||
const convertedHeightValueInCm = smartClient.units.cm(this.heightObservation.valueQuantity);
|
||||
const convertedWeightValueInKg = smartClient.units.kg(this.weightObservationEntry.resource.valueQuantity);
|
||||
}
|
||||
|
||||
oauth2ReadyErrback = (error: any) => {
|
||||
FHIR.oauth2.authorize(this.oauth2Configuration, (authError) => {
|
||||
console.log(authError);
|
||||
});
|
||||
}
|
||||
|
||||
oauth2ResolveAuthTypeCallback = (type: string) => {
|
||||
console.log(type);
|
||||
}
|
||||
|
||||
oauth2ResolveAuthTypeErrback = (error: any) => {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
apiSuccess = (response: FHIR.SMART.Response) => {
|
||||
console.log('Response from the FHIR server:');
|
||||
console.log(response);
|
||||
}
|
||||
|
||||
apiError = (response: FHIR.SMART.Response) => {
|
||||
console.log('Error response from the FHIR server:');
|
||||
console.log(response);
|
||||
}
|
||||
|
||||
drainProcess = (entries: FHIR.SMART.Entry[]) => {
|
||||
console.log('Drain Process:');
|
||||
console.log(entries);
|
||||
}
|
||||
|
||||
drainDone = () => {
|
||||
console.log('Drain Done');
|
||||
}
|
||||
|
||||
fetchAllSuccess = (entries: FHIR.SMART.Entry[]) => {
|
||||
console.log('Fetch all success:');
|
||||
console.log(entries);
|
||||
}
|
||||
|
||||
fetchAllWithReferencesSuccess = (entries: FHIR.SMART.Entry[], resolvedReferences: FHIR.SMART.ResolveFn) => {
|
||||
console.log('Fetch all with references success:');
|
||||
console.log(entries);
|
||||
console.log('Resolved References');
|
||||
console.log(resolvedReferences(this.observationEntry.resource, this.observationEntry.resource.subject));
|
||||
}
|
||||
|
||||
genericCallback = (data: any) => {
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
fetchBinarySuccess = (blob: any) => {
|
||||
// const reader = new FileReader();
|
||||
// reader.addEventListener('loadend', function () {
|
||||
// console.log('Blob content');
|
||||
// console.log(reader.result);
|
||||
// });
|
||||
// reader.readAsArrayBuffer(blob);
|
||||
}
|
||||
|
||||
openSmartFhir(): void {
|
||||
// Open SMART on FHIR server interaction
|
||||
const openSmartClient: FHIR.SMART.Client = FHIR.client(this.context);
|
||||
const api: FHIR.SMART.Api = openSmartClient.api;
|
||||
|
||||
api.conformance(this.context).then(this.apiSuccess, this.apiError);
|
||||
api.create(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
api.delete(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
api.document(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
api.drain(this.searchParameter, this.drainProcess, this.drainDone, this.apiError);
|
||||
api.fetchAll(this.searchParameter).then(this.fetchAllSuccess, this.apiError);
|
||||
api.fetchAllWithReferences(this.searchParameter, this.resolveParameter)
|
||||
.then(this.fetchAllWithReferencesSuccess, this.apiError);
|
||||
api.history(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
api.nextPage(this.bundle).then(this.apiSuccess, this.apiError);
|
||||
api.prevPage(this.bundle).then(this.apiSuccess, this.apiError);
|
||||
api.profile(this.resourceType).then(this.apiSuccess, this.apiError);
|
||||
api.read(this.readParameter).then(this.apiSuccess, this.apiError);
|
||||
api.resolve(this.resolveParameter2).then(this.apiSuccess, this.apiError);
|
||||
api.resourceHistory(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
api.search(this.searchParameter).then(this.apiSuccess, this.apiError);
|
||||
api.search(this.patientSpecificSearchParams).then(this.apiSuccess, this.apiError);
|
||||
api.transaction(this.transactionBundle).then(this.apiSuccess, this.apiError);
|
||||
api.typeHistory(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
api.update(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
api.validate(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
api.vread(this.vreadParameter).then(this.apiSuccess, this.apiError);
|
||||
|
||||
openSmartClient.fetchBinary(this.observationEntry.resource.subject.reference).then(this.fetchBinarySuccess, this.apiError);
|
||||
openSmartClient.get(this.resourceParameter).then(this.apiSuccess, this.apiError);
|
||||
openSmartClient.getBinary(this.observationEntry.resource.subject.reference).then(this.fetchBinarySuccess, this.apiError);
|
||||
|
||||
if (openSmartClient.patient) {
|
||||
const patient: FHIR.SMART.Patient = openSmartClient.patient;
|
||||
const patientApi: FHIR.SMART.Api = patient.api;
|
||||
const patientId: string = patient.id;
|
||||
patientApi.conformance(this.context).then(this.apiSuccess, this.apiError);
|
||||
patientApi.create(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
patientApi.delete(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
patientApi.document(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
patientApi.drain(this.searchParameter, this.drainProcess, this.drainDone, this.apiError);
|
||||
patientApi.fetchAll(this.searchParameter).then(this.fetchAllSuccess, this.apiError);
|
||||
patientApi.fetchAllWithReferences(this.searchParameter, this.resolveParameter)
|
||||
.then(this.fetchAllWithReferencesSuccess, this.apiError);
|
||||
patientApi.history(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
patientApi.nextPage(this.bundle).then(this.apiSuccess, this.apiError);
|
||||
patientApi.prevPage(this.bundle).then(this.apiSuccess, this.apiError);
|
||||
patientApi.profile(this.resourceType).then(this.apiSuccess, this.apiError);
|
||||
patientApi.read(this.readParameter).then(this.apiSuccess, this.apiError);
|
||||
patientApi.resolve(this.resolveParameter2).then(this.apiSuccess, this.apiError);
|
||||
patientApi.resourceHistory(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
patientApi.search(this.searchParameter).then(this.apiSuccess, this.apiError);
|
||||
patientApi.search(this.patientSpecificSearchParams).then(this.apiSuccess, this.apiError);
|
||||
patientApi.transaction(this.transactionBundle).then(this.apiSuccess, this.apiError);
|
||||
patientApi.typeHistory(this.historyParameter).then(this.apiSuccess, this.apiError);
|
||||
patientApi.update(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
patientApi.validate(this.observationEntry).then(this.apiSuccess, this.apiError);
|
||||
patientApi.vread(this.vreadParameter).then(this.apiSuccess, this.apiError);
|
||||
patient.read().then(this.apiSuccess, this.apiError);
|
||||
}
|
||||
|
||||
const context: FHIR.SMART.Context = openSmartClient.server;
|
||||
if (openSmartClient.server.auth) {
|
||||
const auth: FHIR.SMART.AuthContext = openSmartClient.server.auth;
|
||||
}
|
||||
if (openSmartClient.server.patientId) {
|
||||
const patientIdInContext: string = openSmartClient.server.patientId;
|
||||
}
|
||||
const fhirServiceUrl = openSmartClient.server.serviceUrl;
|
||||
if (openSmartClient.server.userId) {
|
||||
const userIdInContext: string = openSmartClient.server.userId;
|
||||
}
|
||||
|
||||
const userId = openSmartClient.userId;
|
||||
const userInContext = openSmartClient.user;
|
||||
openSmartClient.user.read().then(this.apiSuccess, this.apiError);
|
||||
|
||||
const observationByCodesFn = openSmartClient.byCodes(this.observationEntry.resource, 'code');
|
||||
const observations = observationByCodesFn('29463-7');
|
||||
const observationsByCodes: FHIR.SMART.ObservationsByCode = openSmartClient.byCode(this.observationEntry.resource, 'code');
|
||||
|
||||
const numericValue = openSmartClient.units.any(this.heightObservation.valueQuantity);
|
||||
const convertedHeightValueInCm = openSmartClient.units.cm(this.heightObservation.valueQuantity);
|
||||
const convertedWeightValueInKg = openSmartClient.units.kg(this.weightObservationEntry.resource.valueQuantity);
|
||||
}
|
||||
|
||||
closedSmartOnFhir() {
|
||||
// Closed FHIR server which requires user authorization
|
||||
FHIR.oauth2.ready(this.oauth2ReadyCallback, this.oauth2ReadyErrback);
|
||||
FHIR.oauth2.resolveAuthType(this.closedFhirServiceUrl, this.oauth2ResolveAuthTypeCallback, this.oauth2ResolveAuthTypeErrback);
|
||||
}
|
||||
}
|
||||
|
||||
let component = new Component();
|
||||
// Perform the API interactions on the Open SMART on FHIR sandbox server
|
||||
component.openSmartFhir();
|
||||
// Perform the API interactions on the Closed SMART on FHIR sandbox server(Requires user authorization)
|
||||
component.closedSmartOnFhir();
|
||||
Vendored
+740
@@ -0,0 +1,740 @@
|
||||
// Type definitions for fhir-js-client 1.0
|
||||
// Project: https://github.com/smart-on-fhir/client-js
|
||||
// Definitions by: Ramachandran Gokulachandran <https://github.com/rmchndrng>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/**
|
||||
* Namespace containing all global FHIR related definitions
|
||||
*/
|
||||
declare namespace FHIR {
|
||||
/**
|
||||
* Namespace containing all the SMART on FHIR related definitions
|
||||
*/
|
||||
namespace SMART {
|
||||
/**
|
||||
* FHIR API instance which can be used to make API calls to the FHIR server.
|
||||
* This exposes all the methods implemented by jqFhir.js adapter of fhir.js client library
|
||||
* https://github.com/FHIR/fhir.js
|
||||
*/
|
||||
interface Api {
|
||||
/**
|
||||
* GET BASEURL/metadata
|
||||
*
|
||||
* @param input : An override to the base config object or just an empty object {}
|
||||
*/
|
||||
conformance(input: any): Promise<Response>;
|
||||
|
||||
/**
|
||||
* POST BASEURL/{resourceType} BODY: {entry without id}
|
||||
* @param entry : A valid FHIR entry containing the resource.
|
||||
*/
|
||||
create(entry: Entry): Promise<Response>;
|
||||
|
||||
/**
|
||||
* DELETE BASEURL/{resourceType} BODY {entry with id}
|
||||
* @param entry : A valid FHIR entry object containing the resource object
|
||||
* or an object containing the id property(id of the resource to be deleted)
|
||||
*/
|
||||
delete(entry: Entry): Promise<Response>;
|
||||
|
||||
/**
|
||||
* POST BASEURL/Document
|
||||
* @param document
|
||||
*/
|
||||
document(document: Entry): Promise<Response>;
|
||||
|
||||
/**
|
||||
* GET BASEURL/{resourceType}?searchParams
|
||||
* Fetch all the resources based on the search parameter (keeps on calling next method to gett all the pages)
|
||||
* and process the result set of each page
|
||||
* @param params Search Parameter, same as parameter of the Search method
|
||||
* @param process Function called by passing the result set of each page fetched.
|
||||
* @param done Function called once all the resources are fetched
|
||||
* @param fail Function called when an error occurs in the process
|
||||
*/
|
||||
drain(params: SearchParams, process: (entries: Entry[]) => any, done: () => any, fail: (error: any) => any): void;
|
||||
|
||||
/**
|
||||
* GET BASEURL/{resourceType}?searchParams
|
||||
* Fetch all the resources of a particular resource type and that meets the search filter.
|
||||
* @param params Search Parameter, same as parameter of the Search method
|
||||
* Returns a promise
|
||||
* Resolve: (entries:any[]) => { console.log(entries); }
|
||||
* Reject: (error:any) => { console.log(error); }
|
||||
*/
|
||||
fetchAll(params: SearchParams): Promise<Entry[]>;
|
||||
|
||||
/**
|
||||
* GET BASEURL/{resourceType}?searchParams
|
||||
* GET BASEURL/{referencedType} referencedType based on the resolveParams
|
||||
* @param params Search Parameter, same as parameter of the Search method
|
||||
* @param resolveParams Resolve Parameter, an array of string containing the each parameter in the format TargetResourceType.TargetElement
|
||||
* eg. ['Observation.subject',Observation.context']
|
||||
* Returns a promise.
|
||||
* Resolve: (entries:Entry[],resolvedReferences:[index: string]: Resource) => { console.log(entries); console.log(resolvedReferences);}
|
||||
* Reject: (error:any) => { console.log(error); }
|
||||
*/
|
||||
fetchAllWithReferences(params: SearchParams, resolveParams: string[]): any;
|
||||
|
||||
/**
|
||||
* GET BASEURL/_history?historyParams
|
||||
* Calls the _history API with the parameters specified
|
||||
* @param params
|
||||
*/
|
||||
history(params: HistoryParams): Promise<Response>;
|
||||
|
||||
/**
|
||||
* GET BASEURL/_getpages=XXXX : Next link in the bundle
|
||||
* Fetches the next page based on the input bundle resource's next link.
|
||||
* @param bundle Input bundle resource containing the next link.
|
||||
*/
|
||||
nextPage(bundle: Bundle): Promise<Response>;
|
||||
|
||||
/**
|
||||
* GET BASEURL/_getpages=XXXX : Prev link in the bundle
|
||||
* Fetches the previous page based on the input bundle resource's previous link.
|
||||
* @param bundle Input bundle resource containing the previous link
|
||||
*/
|
||||
prevPage(bundle: Bundle): Promise<Response>;
|
||||
|
||||
/**
|
||||
* GET BASEURL/Profile/{resourceType}
|
||||
* @param resourceType
|
||||
*/
|
||||
profile(resourceType: ResourceType): Promise<Response>;
|
||||
|
||||
/**
|
||||
* GET BASEURL/{resourceType}/{id}
|
||||
* @param params An object with id and resourceType property
|
||||
*/
|
||||
read(params: ReadParams): Promise<Response>;
|
||||
|
||||
/**
|
||||
* Pass the node containing the property reference, which needs to be resolved. eg. myObservation.resource.subject
|
||||
* The resource node should be present if the reference is contained within the resource.
|
||||
* If a bundle resource is passed, will try to resolve within that bundle first before querying the server
|
||||
* @param params The reference node to be resolved along with the resource and the bundle to be searched if the reference is a contained one.
|
||||
*/
|
||||
resolve(params: ResolveParams): Promise<Response>;
|
||||
|
||||
/**
|
||||
* GET BASEURL/{resourceType}/{id}/_history?otherHistoryParams
|
||||
* @param params Should provide, resourceType and id either through id and type properties or the resource property
|
||||
*/
|
||||
resourceHistory(params: HistoryParams): Promise<Response>;
|
||||
|
||||
/**
|
||||
* GET BASEURL/{resourceType}?searchParams
|
||||
* @param searchParams Filters to be applied to the API call
|
||||
*/
|
||||
search(params: SearchParams): Promise<Response>;
|
||||
|
||||
/**
|
||||
* POST BASEURL Body: Bundle with entries containing a node 'request': { 'method': 'POST' }. The value of 'method' can be DELETE,POST,PUT or GET.
|
||||
* @param bundle
|
||||
*/
|
||||
transaction(bundle: Bundle): Promise<Response>;
|
||||
|
||||
/**
|
||||
* GET BASEURL/{resourceType}/_history?historyParams
|
||||
* @param params
|
||||
*/
|
||||
typeHistory(params: HistoryParams): Promise<Response>;
|
||||
|
||||
/**
|
||||
* PUT BASEURL/{resourceType}/{id}
|
||||
* @param entry : Entry containing the Resource to be updated
|
||||
*/
|
||||
update(entry: Entry): Promise<Response>;
|
||||
|
||||
/**
|
||||
* POST BASEURL/{resourceType}/_validate BODY: Resource to be validated
|
||||
* PS: Cannot find the _validate endpoint on the SMART on FHIR open server. But $validate exists.
|
||||
* @param entry
|
||||
*/
|
||||
validate(entry: Entry): Promise<Response>;
|
||||
|
||||
/**
|
||||
* GET BASEURL/{resourceType}/{id}/_history/{versionId}
|
||||
* Fetches the specific historic version of the resource.
|
||||
* @param params ResourceType, ResourceId and the VersionId
|
||||
*/
|
||||
vread(params: VersionReadParams): Promise<Response>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference within a resource
|
||||
*/
|
||||
interface Reference {
|
||||
reference: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Funtion type returned by the fetchAllWithReferences method
|
||||
*/
|
||||
type ResolveFn = (resource: Resource, reference: Reference) => Resource;
|
||||
|
||||
/**
|
||||
* Represents the parameter to be passed to the resolve api method
|
||||
*/
|
||||
interface ResolveParams {
|
||||
/**
|
||||
* Represents a reference within a resource. It can be a contained one(within the resource or a bundle) or a remote resource(eg {ResourceType}/{id})
|
||||
*/
|
||||
reference: Reference;
|
||||
/**
|
||||
* The resource in which the reference will be resolved if the reference is a contained one.
|
||||
*/
|
||||
resource?: Resource;
|
||||
/**
|
||||
* The Bundle resource in which the reference will be resolved if the reference is a contained one within the bundle.
|
||||
*/
|
||||
bundle?: Resource;
|
||||
}
|
||||
|
||||
interface CommonQueryFilters {
|
||||
/**
|
||||
* Number of return records requested. The server is not bound to return the number requested, but cannot return more
|
||||
*/
|
||||
count?: number;
|
||||
|
||||
/**
|
||||
* Only include resource versions that were created at or after the given instant in time
|
||||
*
|
||||
* Type: instant An instant in time - known at least to the second and always includes a time zone.
|
||||
* Note: This is intended for precisely observed times (typically system logs etc.), and not human-reported times - for them,
|
||||
* use date and dateTime. instant is a more constrained dateTime xs:dateTime A JSON string - an xs:dateTime
|
||||
* Note: This type is for system times, not human times (see date and dateTime below).
|
||||
*/
|
||||
since?: string;
|
||||
|
||||
/**
|
||||
* Addition filters to be applied on the history query. The object will be converted into query string parameters.
|
||||
*/
|
||||
params?: {
|
||||
/**
|
||||
* To specify alternative response formats by their MIME-types.
|
||||
* This parameter allows a client to override the accept header value when it is unable to set it correctly due to internal limitations
|
||||
* (e.g. XSLT usage). For the _format parameter, the values xml, text/xml, application/xml, and application/fhir+xml SHALL be interpreted
|
||||
* to mean the XML format, the codes json, application/json and application/fhir+json SHALL be interpreted
|
||||
* to mean the JSON format, and the codes ttl and text/turtle SHALL be interpreted to mean the Turtle RDF format.
|
||||
* In addition, the values html and text/html are allowed.
|
||||
*/
|
||||
_format?: string;
|
||||
/**
|
||||
* Type: dateTime Only include resource versions that were current at some point during the time period specified
|
||||
* in the date time value (may be more than one)
|
||||
*/
|
||||
_at?: string;
|
||||
/**
|
||||
* Making this interface extendable so that we can add more custom filter parameters
|
||||
*/
|
||||
[propName: string]: any;
|
||||
};
|
||||
}
|
||||
|
||||
interface HistoryParams extends CommonQueryFilters {
|
||||
/**
|
||||
* Resource ID, if the history to be fetched is resource specific.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* Type of the resource, if the history to be fetched is resource specific.
|
||||
*/
|
||||
type?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* FHIR Search parameter : The parameter used to by the FHIR api methods to perform search on a particular resource.
|
||||
*/
|
||||
interface SearchParams extends CommonQueryFilters {
|
||||
/**
|
||||
* The name of the resource type on which the query is performed
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* The Search filter query object
|
||||
* This object syntaxs adopts mongodb-like query syntax ([see](http://docs.mongodb.org/manual/tutorial/query-documents/)
|
||||
* eg:
|
||||
* {name: 'maud'}
|
||||
* //=> name=maud
|
||||
*
|
||||
* {name: {$exact: 'maud'}}
|
||||
* //=> name:exact=maud
|
||||
*
|
||||
* {name: {$or: ['maud','dave']}}
|
||||
* //=> name=maud,dave
|
||||
*
|
||||
* {name: {$and: ['maud',{$exact: 'dave'}]}}
|
||||
* //=> name=maud&name:exact=Dave
|
||||
*
|
||||
* {birthDate: {$gt: '1970', $lte: '1980'}}
|
||||
* //=> birthDate=gt1970&birthDate=lte1980
|
||||
*
|
||||
* {subject: {$type: 'Patient', name: 'maud', birthDate: {$gt: '1970'}}}
|
||||
* //=> subject:Patient.name=maud&subject:Patient.birthDate=gt1970
|
||||
*
|
||||
* {'subject.name': {$exact: 'maud'}}
|
||||
* //=> subject.name:exact=maud
|
||||
*/
|
||||
query?: any;
|
||||
|
||||
/**
|
||||
* The patient id. If provided, will make the search query patient specific by adding the patien query parameter
|
||||
*/
|
||||
patient?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to specify the type of Resource which needs to be considered for the API call
|
||||
*/
|
||||
interface ResourceType {
|
||||
type: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a FHIR entry
|
||||
*/
|
||||
interface Entry {
|
||||
/**
|
||||
* Version Stamp of resource
|
||||
*/
|
||||
versionId?: string;
|
||||
/**
|
||||
* FHIR Resource type name
|
||||
*/
|
||||
type?: string;
|
||||
/**
|
||||
* FHIR Resource
|
||||
*/
|
||||
resource: Resource;
|
||||
/**
|
||||
* Making this interface extendable since this is not a complete type definition of FHIR Entry
|
||||
*/
|
||||
[propName: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a FHIR resource
|
||||
*/
|
||||
interface Resource {
|
||||
/**
|
||||
* The type of resource. All FHIR resources must have a resource type.
|
||||
*/
|
||||
resourceType: string;
|
||||
/**
|
||||
* Making this interface extendable since this is not a complete type definition of FHIR Resource
|
||||
*/
|
||||
[propName: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a FHIR bundle
|
||||
*/
|
||||
interface Bundle {
|
||||
/**
|
||||
* The actual FHIR bundle, which is a FHIR resource itself with resourceType: 'Bundle'
|
||||
*/
|
||||
bundle: Resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameter to be passed to the read API method
|
||||
*/
|
||||
interface ReadParams {
|
||||
/**
|
||||
* Type of the FHIR resource
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* ID of the FHIR resource
|
||||
*/
|
||||
id: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameter to be passed to the vread API method
|
||||
*/
|
||||
interface VersionReadParams extends ReadParams {
|
||||
/**
|
||||
* Version ID of the resource to be fetched
|
||||
*/
|
||||
versionId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Structure of the response from the FHIR server
|
||||
*/
|
||||
interface Response {
|
||||
/**
|
||||
* Data returned from the FHIR server
|
||||
*/
|
||||
data?: any;
|
||||
/**
|
||||
* HTTP Status code string
|
||||
*/
|
||||
status?: any;
|
||||
/**
|
||||
* HTTP Response headers
|
||||
*/
|
||||
headers?: any;
|
||||
/**
|
||||
* Contains state information. Url, type, server configuration used, Id etc
|
||||
*/
|
||||
config?: any;
|
||||
/**
|
||||
* Error object returned by the client library.
|
||||
*/
|
||||
error?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Patient in context
|
||||
*/
|
||||
interface Patient {
|
||||
/**
|
||||
* Patient ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Patient scoped fhir.js FHIR API interface. This will ensure that the 'patient' query parameter is passed
|
||||
* along with all the API calls which needs a patient context.
|
||||
*/
|
||||
api: Api;
|
||||
/**
|
||||
* Get the Patient resource in context
|
||||
* GET BASEURL/Patient/{id}
|
||||
*/
|
||||
read(): Promise<Response>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authorization Context which needs to be passed to create a SMART client directly
|
||||
*/
|
||||
interface AuthContext {
|
||||
/**
|
||||
* Type of Authorization 'none' | 'basic' | 'bearer'
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* Username if the type of authorization in 'basic'
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* Password if the type of authorization in 'basic'
|
||||
*/
|
||||
password?: string;
|
||||
/**
|
||||
* Access token to be set if the type of authorization is 'bearer'
|
||||
*/
|
||||
token?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Context passed to create a SMART client directly without completing the SMART on FHIR OAuth2 authorization workflow
|
||||
*/
|
||||
interface Context {
|
||||
/**
|
||||
* FHIR service base url
|
||||
*/
|
||||
serviceUrl: string;
|
||||
/**
|
||||
* Authorization context
|
||||
*/
|
||||
auth?: AuthContext;
|
||||
/**
|
||||
* Patient in context
|
||||
*/
|
||||
patientId?: string;
|
||||
/**
|
||||
* User in context
|
||||
*/
|
||||
userId?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a Resource type with ID
|
||||
* Used by the get method
|
||||
*/
|
||||
interface ResourceParameter {
|
||||
/**
|
||||
* Name of the resource type
|
||||
*/
|
||||
resource: string;
|
||||
/**
|
||||
* Resource ID
|
||||
*/
|
||||
id?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* User in context
|
||||
*/
|
||||
interface User {
|
||||
/**
|
||||
* Fetch the current user information from server. The library expects the userId to be of the format "ResourceType/Id"
|
||||
*/
|
||||
read(): Promise<Response>;
|
||||
}
|
||||
|
||||
interface SMARTClient extends Client {
|
||||
/**
|
||||
* Method to add the authorization headers based on the type of authorization Basic or Authorization
|
||||
* @param input
|
||||
* Returns: The object populated with Authorization header
|
||||
*/
|
||||
authenticated(input: any): any;
|
||||
/**
|
||||
* OAuth2 configuration used in context
|
||||
*/
|
||||
state: OAuth2Configuration;
|
||||
|
||||
/**
|
||||
* OAuth2 Access Token response
|
||||
*/
|
||||
tokenResponse?: any;
|
||||
}
|
||||
|
||||
interface Client {
|
||||
/**
|
||||
* fhir.js FHIR API interface
|
||||
*/
|
||||
api: Api;
|
||||
|
||||
/**
|
||||
* Fetch a resource as Binary/Blob
|
||||
* @param path Absolute or relative path to the resource to be fetched
|
||||
*/
|
||||
fetchBinary(path: string): Promise<Blob>;
|
||||
|
||||
/**
|
||||
* Get the resources based on the resource type and id
|
||||
* @param params Resource type and id
|
||||
*/
|
||||
get(params: ResourceParameter): Promise<Response>;
|
||||
|
||||
/**
|
||||
* Fetch a resource as Binary/Blob (Same as fetchBinary)
|
||||
* @param path Absolute url of the resource to be fetched
|
||||
*/
|
||||
getBinary(path: string): Promise<Blob>;
|
||||
|
||||
/**
|
||||
* Current server, user and patient in context
|
||||
*/
|
||||
server: Context;
|
||||
|
||||
/**
|
||||
* Patient in context and interface to perform FHIR API calls within its context
|
||||
*/
|
||||
patient?: Patient;
|
||||
|
||||
/**
|
||||
* Id of the user in context
|
||||
*/
|
||||
userId?: string;
|
||||
|
||||
/**
|
||||
* User in context and exposes a method 'read' to get information.
|
||||
*/
|
||||
user: User;
|
||||
|
||||
/**
|
||||
* Split a set of observations based on codable concept properties. eg. code
|
||||
* @param observations Observation resources
|
||||
* @param property The name of the property which is a codable concept
|
||||
* Returns a function to which you can pass code values and get a filtered array of observations.
|
||||
*/
|
||||
byCodes(observations: Resource | Resource[], ...property: string[]): (...codes: string[]) => Resource[];
|
||||
|
||||
/**
|
||||
* Split a set of observations based on codable concept properties. eg. code
|
||||
* @param observations Observation resources
|
||||
* @param property The name of the property which is a codable concept
|
||||
* Returns an object with code values as index and array of observations as values
|
||||
*/
|
||||
byCode(observations: Resource | Resource[], property: string): ObservationsByCode;
|
||||
/**
|
||||
* Helper method to convert units
|
||||
*/
|
||||
units: {
|
||||
/**
|
||||
* Converts the valueQuantity passed into cm based on the code
|
||||
*/
|
||||
cm(valueQuantity: any): number;
|
||||
/**
|
||||
* Converts the valueQuantity passed into kg based on the code
|
||||
*/
|
||||
kg(valueQuantity: any): number;
|
||||
/**
|
||||
* Returns the valueQuantity value as number. (As it is)
|
||||
*/
|
||||
any(valueQuantity: any): number;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Indexable type used to represent Observation FHIR resources indexed based on codes.
|
||||
*/
|
||||
interface ObservationsByCode {
|
||||
[index: string]: Resource[];
|
||||
}
|
||||
|
||||
/**
|
||||
* SMART client settings for browser behaviour
|
||||
*/
|
||||
interface Settings {
|
||||
/**
|
||||
* Replaces the browser's current URL using window.history.replaceState API.
|
||||
* Default to true
|
||||
*/
|
||||
replaceBrowserHistory: boolean;
|
||||
/**
|
||||
* When set to true, this variable will fully utilize HTML5 sessionStorage API.
|
||||
* Default to true
|
||||
* This variable can be overriden to false by setting FHIR.oauth2.settings.fullSessionStorageSupport = false.
|
||||
* When set to false, the sessionStorage will be keyed by a state variable. This is to allow the embedded IE browser
|
||||
* instances instantiated on a single thread to continue to function without having sessionStorage data shared
|
||||
* across the embedded IE instances.
|
||||
*/
|
||||
fullSessionStorageSupport: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Client or application specific settings provided on the FHIR server during the client/application registration.
|
||||
*/
|
||||
interface OAuth2ClientSettings {
|
||||
/**
|
||||
* Unique ID representing the client or application
|
||||
*/
|
||||
client_id: string;
|
||||
/**
|
||||
* URI to which the code is sent via query string during the OAuth2 authorization workflow. Defaults to the applications base url.
|
||||
*/
|
||||
redirect_uri?: string;
|
||||
/**
|
||||
* Scopes based on the access required by the application
|
||||
*/
|
||||
scope?: string;
|
||||
/**
|
||||
* If the application registered is a confidential application, the client_secret needs to be provided during the Token workflow. (Not recommended for public applications)
|
||||
*/
|
||||
secret?: string;
|
||||
/**
|
||||
* Override the state parameter set by the SMART JS Client library. The library generates a random string as state.
|
||||
*/
|
||||
state?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The OAuth2 endpoints (Registration URI, Authorize URI, Token URI)
|
||||
*/
|
||||
interface OAuth2Endpoints {
|
||||
/**
|
||||
* OAuth2 Registration URI
|
||||
*/
|
||||
registration_uri?: string;
|
||||
/**
|
||||
* OAuth2 Authorize URI
|
||||
*/
|
||||
authorize_uri?: string;
|
||||
/**
|
||||
* OAuth2 Token URI
|
||||
*/
|
||||
token_uri?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* OAuth2 Provider information. If provided during the Authorize call, the library skips the conformance statement introspection
|
||||
*/
|
||||
interface OAuth2Provider {
|
||||
/**
|
||||
* FHIR Service URL
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* Unique name for the provider
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Description about the provider
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* The OAuth2 endpoints (Registration URI, Authorize URI, Token URI)
|
||||
*/
|
||||
oauth2?: OAuth2Endpoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* OAuth2 Configuration of the SMART on FHIR Server
|
||||
*/
|
||||
interface OAuth2Configuration {
|
||||
/**
|
||||
* Set the response type based on the Authorization Grant eg. code(Authorization Code Grant), token(Implicit Grant)
|
||||
*/
|
||||
response_type?: string;
|
||||
/**
|
||||
* Client or application specific settings provided on the FHIR server during the client/application registration.
|
||||
*/
|
||||
client?: OAuth2ClientSettings;
|
||||
/**
|
||||
* FHIR Service URL
|
||||
*/
|
||||
server?: string;
|
||||
/**
|
||||
* Fake Access Token Response. Should contain the patient property to set the patient context.
|
||||
*/
|
||||
fake_token_response?: any;
|
||||
/**
|
||||
* OAuth2 Provider information. If provided during the Authorize call, the library skips the conformance statement introspection
|
||||
*/
|
||||
provider?: OAuth2Provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* SMART on FHIR OAuth2 authorization helper methods and settings
|
||||
*/
|
||||
interface OAuth2 {
|
||||
/**
|
||||
* Settings to drive the JS client browser behaviour
|
||||
*/
|
||||
settings: Settings;
|
||||
|
||||
/**
|
||||
* Handles the OAuth2 redirect
|
||||
* If the URL contains the code parameter, it will complete the token call and pass the SMART client to the callback method
|
||||
* @param callback Called once the SMART client is ready to be used.
|
||||
* @param errback Called when either the OAuth2 workflow has not been started on an error occured during the OAuth2 workflow.
|
||||
*/
|
||||
ready(callback?: (smart: SMARTClient) => void, errback?: (...args: any[]) => void): void;
|
||||
|
||||
/**
|
||||
* Initiate the OAuth2 authorization workflow
|
||||
* @param params OAuth2 Configuration
|
||||
* @param errback Method which is triggered when an error occurs during the OAuth2 authorization workflow
|
||||
*/
|
||||
authorize(params: OAuth2Configuration, errback?: (...args: any[]) => void): void;
|
||||
|
||||
/**
|
||||
* Resolves the Authorization type of the FHIR server. Can be used to identify if a server supports SMART on FHIR.
|
||||
* @param fhirServiceUrl FHIR Server Base URL
|
||||
* @param callback Callled once the authorization type is retrieved from the conformance statement.
|
||||
* @param errBack Called when an error occured while trying to fetch the conformance statement.
|
||||
*/
|
||||
resolveAuthType(fhirServiceUrl: string, callback?: (type: string) => void, errBack?: (type: string) => void): void;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the SMART client directly without using the Oauth2 workflow
|
||||
* @param context Context required to construct the client.
|
||||
*/
|
||||
function client(context: SMART.Context): SMART.Client;
|
||||
|
||||
/**
|
||||
* Property which exposes the OAUth2 specific workflow helpers
|
||||
*/
|
||||
const oauth2: SMART.OAuth2;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"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",
|
||||
"fhir-js-client-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"object-literal-key-quotes": false
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user