Merge branch 'master' into master

This commit is contained in:
Dvorak
2018-06-12 07:09:44 +00:00
committed by GitHub
1652 changed files with 118126 additions and 22250 deletions

579
.github/CODEOWNERS vendored

File diff suppressed because it is too large Load Diff

3
.gitignore vendored
View File

@@ -49,3 +49,6 @@ npm-debug.log
# yarn
yarn.lock
# pnpm
shrinkwrap.yaml

View File

@@ -87,6 +87,7 @@ Primero, haz un [fork](https://guides.github.com/activities/forking/) en este re
* `cd types/my-package-to-edit`
* Haz cambios. Recuerda editar las pruebas.
Si realiza cambios importantes, no olvide [actualizar una versión principal](#quiero-actualizar-un-paquete-a-una-nueva-versión-principal).
* También puede que quieras añadirte la sección "Definitions by" en el encabezado del paquete.
- Esto hará que seas notificado (a través de tu nombre de usuario en GitHub) cada vez que alguien haga un pull request o issue sobre el paquete.
- Haz esto añadiendo tu nombre al final de la línea, así como en `// Definitions by: Alice <https://github.com/alice>, Bob <https://github.com/bob>`.

View File

@@ -87,6 +87,7 @@ First, [fork](https://guides.github.com/activities/forking/) this repository, in
* `cd types/my-package-to-edit`
* Make changes. Remember to edit tests.
If you make breaking changes, do not forget to [update a major version](#i-want-to-update-a-package-to-a-new-major-version).
* You may also want to add yourself to "Definitions by" section of the package header.
- This will cause you to be notified (via your GitHub username) whenever someone makes a pull request or issue about the package.
- Do this by adding your name to the end of the line, as in `// Definitions by: Alice <https://github.com/alice>, Bob <https://github.com/bob>`.
@@ -120,7 +121,7 @@ Your package should have this structure:
| tsconfig.json | This allows you to run `tsc` within the package. |
| tslint.json | Enables linting. |
Generate these by running `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --template module`.
Generate these by running `npx dts-gen --dt --name my-package-name --template module` if you have npm ≥ 5.2.0, `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --template module` otherwise.
See all options at [dts-gen](https://github.com/Microsoft/dts-gen).
You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option.

View File

@@ -124,7 +124,7 @@
"libraryName": "axe-core",
"typingsPackageName": "axe-core",
"sourceRepoURL": "https://github.com/dequelabs/axe-core",
"asOfVersion": "2.0.7"
"asOfVersion": "3.0.3"
},
{
"libraryName": "axios",
@@ -660,6 +660,12 @@
"sourceRepoURL": "https://github.com/ashtuchkin/iconv-lite",
"asOfVersion": "0.4.14"
},
{
"libraryName": "ids",
"typingsPackageName": "ids",
"sourceRepoURL": "https://github.com/bpmn-io/ids",
"asOfVersion": "0.2.2"
},
{
"libraryName": "immutability-helper",
"typingsPackageName": "immutability-helper",
@@ -1002,12 +1008,6 @@
"sourceRepoURL": "https://github.com/blakeembrey/param-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "parse5",
"typingsPackageName": "parse5",
"sourceRepoURL": "https://github.com/inikulin/parse5",
"asOfVersion": "3.0.0"
},
{
"libraryName": "pascal-case",
"typingsPackageName": "pascal-case",
@@ -1152,6 +1152,12 @@
"sourceRepoURL": "https://github.com/react-ga/react-ga",
"asOfVersion": "2.3.0"
},
{
"libraryName": "react-monaco-editor",
"typingsPackageName": "react-monaco-editor",
"sourceRepoURL": "https://github.com/superRaytin/react-monaco-editor",
"asOfVersion": "0.16.0"
},
{
"libraryName": "react-native-collapsible",
"typingsPackageName": "react-native-collapsible",

View File

@@ -1,27 +1,27 @@
{
"private": true,
"name": "definitely-typed",
"version": "0.0.1",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped",
"repository": {
"type": "git",
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
},
"engines": {
"node": ">=7.8.0"
},
"scripts": {
"compile-scripts": "tsc -p scripts",
"not-needed": "node scripts/not-needed.js",
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed",
"lint": "dtslint types"
},
"devDependencies": {
"dtslint": "github:Microsoft/dtslint#production",
"types-publisher": "Microsoft/types-publisher#production"
}
"private": true,
"name": "definitely-typed",
"version": "0.0.2",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped",
"repository": {
"type": "git",
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
},
"engines": {
"node": ">=7.8.0"
},
"scripts": {
"compile-scripts": "tsc -p scripts",
"not-needed": "node scripts/not-needed.js",
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed",
"lint": "dtslint types"
},
"devDependencies": {
"dtslint": "github:Microsoft/dtslint#production",
"types-publisher": "Microsoft/types-publisher#production"
}
}

View File

@@ -0,0 +1,22 @@
import AceDiff = require('ace-diff');
new AceDiff(); // $ExpectError
const aceDiffConstructorOpts = {
element: '.acediff',
left: { content: 'left content' },
right: { content: 'right content' },
};
new AceDiff(aceDiffConstructorOpts); // $ExpectType AceDiff
const differ = new AceDiff(aceDiffConstructorOpts);
differ.getEditors(); // $ExpectType { left: any; right: any; }
differ.setOptions(); // $ExpectError
const aceDiffOpts = {
diffGranularity: 'broad' as 'broad', // workaround: cast to avoid https://github.com/Microsoft/TypeScript/issues/11465#issuecomment-252453037
};
differ.setOptions(aceDiffOpts); // $ExpectType void
differ.getNumDiffs(); // $ExpectType number
differ.diff(); // $ExpectType void
differ.destroy(); // $ExpectType void

52
types/ace-diff/index.d.ts vendored Normal file
View File

@@ -0,0 +1,52 @@
// Type definitions for ace-diff 2.1
// Project: https://ace-diff.github.io/ace-diff/
// Definitions by: Mike Dodge <https://github.com/innovation-team>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace AceDiff;
export = AceDiff;
declare class AceDiff {
constructor(opts: AceDiff.AceDiffConstructorOpts);
getEditors(): {
left: any;
right: any;
};
setOptions(options: AceDiff.AceDiffOpts): void;
getNumDiffs(): number;
diff(): void;
destroy(): void;
}
declare namespace AceDiff {
interface AceDiffLROpts {
content?: string | null;
mode?: string;
theme?: string;
editable?: boolean;
copyLinkEnabled?: boolean;
}
interface AceDiffConstructorOpts extends AceDiffOpts {
element: string | HTMLElement;
left: AceDiffLROpts;
right: AceDiffLROpts;
}
interface AceDiffOpts {
mode?: string;
theme?: string;
diffGranularity?: 'specific' | 'broad';
showDiffs?: boolean;
showConnectors?: boolean;
maxDiffs?: number;
left?: AceDiffLROpts;
right?: AceDiffLROpts;
classes?: {
diff: string;
connector: string;
newCodeConnectorLinkContent: string;
deletedCodeConnectorLinkContent: string;
};
}
}

View File

@@ -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",
"ace-diff-tests.ts"
]
}

View File

@@ -1,3 +1,5 @@
/// <reference types="windows-script-host" />
let app = new ActiveXObject('Access.Application');
app.UserControl = true;
@@ -6,7 +8,7 @@ app.DoCmd.OpenForm('MyForm', Access.AcFormView.acNormal, '', 'LastName="Smith"')
// change the contents of a textbox
// tslint:disable-next-line:no-unnecessary-type-assertion
let textbox = app.Forms.Item('MyForm').Controls.Item('MyTextBox') as Access.TextBox;
let textbox = app.Forms('MyForm').Controls('MyTextBox') as Access.TextBox;
textbox.Text = 'Not Smith';
// save the current record on the active form

File diff suppressed because it is too large Load Diff

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,6 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-const-enum": false
"no-const-enum": false,
"max-line-length": false
}
}

View File

@@ -1,5 +1,8 @@
// Note -- running these tests under cscript requires some ES5 polyfills
/// <reference types="windows-script-host" />
/// <reference types="activex-scripting" />
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
const results: T[] = [];
const enumerator = new Enumerator<T>(col);
@@ -12,9 +15,9 @@ const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
};
const toSafeArray = <T>(...items: T[]): SafeArray<T> => {
const dict = new ActiveXObject('Scripting.Dictionary');
const dict: Scripting.Dictionary<number, T> = new ActiveXObject('Scripting.Dictionary');
items.forEach((x, index) => dict.Add(index, x));
return dict.Items() as SafeArray<T>;
return dict.Items();
};
const toConnectionString = (o: { [index: string]: any }) => {

View File

@@ -4,6 +4,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="activex-interop" />
declare namespace ADODB {
const enum ADCPROP_ASYNCTHREADPRIORITY_ENUM {
adPriorityAboveNormal = 4,
@@ -1094,7 +1096,6 @@ declare namespace ADODB {
}
interface ActiveXObject {
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
on(obj: ADODB.Connection, event: 'BeginTransComplete', argNames: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {readonly TransactionLevel: number, readonly pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, readonly pConnection: ADODB.Connection}) => void): void;
on(obj: ADODB.Connection, event: 'CommitTransComplete' | 'ConnectComplete' | 'InfoMessage' | 'RollbackTransComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {readonly pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, readonly pConnection: ADODB.Connection}) => void): void;
on(obj: ADODB.Connection, event: 'Disconnect', argNames: ['adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {adStatus: ADODB.EventStatusEnum, readonly pConnection: ADODB.Connection}) => void): void;

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,3 +1,5 @@
/// <reference types="windows-script-host" />
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
const results: T[] = [];
const enumerator = new Enumerator<T>(col);

View File

@@ -4,6 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="activex-interop" />
/// <reference types="activex-adodb" />
declare namespace ADOX {
@@ -320,10 +321,6 @@ declare namespace ADOX {
}
}
interface ActiveXObject {
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {
'ADOX.Catalog': ADOX.Catalog;
'ADOX.Column': ADOX.Column;

View File

@@ -1,8 +1,9 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es5", "scripthost"],
"lib": [
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,

View File

@@ -1,3 +1,5 @@
/// <reference types="windows-script-host" />
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
const results: T[] = [];
const enumerator = new Enumerator<T>(col);

View File

@@ -4,6 +4,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="activex-interop" />
declare namespace DAO {
const enum _DAOSuppHelp {
KeepLocal = 0,
@@ -883,10 +885,6 @@ declare namespace DAO {
}
}
interface ActiveXObject {
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {
'DAO.DBEngine': DAO.DBEngine;
'DAO.Field': DAO.Field;

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -2,7 +2,9 @@
// 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" />
declare namespace DiskQuotaTypeLibrary {
// tslint:disable-next-line no-const-enum
@@ -136,7 +138,6 @@ interface ActiveXObject {
on(
obj: DiskQuotaTypeLibrary.DiskQuotaControl, event: 'OnUserNameChanged', argNames: ['pUser'], handler: (
this: DiskQuotaTypeLibrary.DiskQuotaControl, parameter: {readonly pUser: DiskQuotaTypeLibrary.DIDiskQuotaUser}) => void): void;
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {
@@ -146,7 +147,3 @@ interface ActiveXObjectNameMap {
interface EnumeratorConstructor {
new(col: DiskQuotaTypeLibrary.DiskQuotaControl): Enumerator<DiskQuotaTypeLibrary.DIDiskQuotaUser>;
}
interface SafeArray<T = any> {
_brand: SafeArray<T>;
}

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,11 +1,12 @@
/// <reference types="windows-script-host" />
/// <reference types="activex-msforms" />
/// <reference types="activex-scripting" />
// some helpers
const toSafeArray = <T>(...items: T[]): SafeArray<T> => {
const dict = new ActiveXObject('Scripting.Dictionary');
const dict: Scripting.Dictionary<number, T> = new ActiveXObject('Scripting.Dictionary');
items.forEach((x, index) => dict.Add(index, x));
return dict.Items() as SafeArray<T>;
return dict.Items();
};
const inCollection = <T = any>(collection: { Item(index: any): T }, index: string | number): T | undefined => {
let item: T | undefined;
@@ -295,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));
})();
})();

View File

@@ -9723,7 +9723,6 @@ interface ActiveXObject {
set(obj: Excel.Workbook, propertyName: 'Colors', parameterTypes: [any], newValue: any): void;
set(obj: Excel.Range, propertyName: 'Value', parameterTypes: [Excel.XlRangeValueDataType], newValue: any): void;
set(obj: Excel.Range, propertyName: 'Value', newValue: any): void; // because Value is defined on the type as a method, not a property
new <K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,6 +1,7 @@
/// <reference types="activex-iwshruntimelibrary" />
/// <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();
@@ -12,9 +13,9 @@ const collectionToArray = <T>(col: { Item(index: any): T } | SafeArray<T>) => {
};
const toSafeArray = <T>(...items: T[]): SafeArray<T> => {
const dict = new ActiveXObject('Scripting.Dictionary');
const dict: Scripting.Dictionary<number, T> = new ActiveXObject('Scripting.Dictionary');
items.forEach((x, index) => dict.Add(index, x));
return dict.Items() as SafeArray<T>;
return dict.Items();
};
const VB = {
@@ -422,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);

View File

@@ -2011,7 +2011,6 @@ interface ActiveXObject {
this: FAXCOMEXLib.FaxServer, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void;
on(obj: FAXCOMEXLib.FaxAccount, event: 'AddRef' | 'Release', handler: (this: FAXCOMEXLib.FaxAccount, parameter: {}) => void): void;
on(obj: FAXCOMEXLib.FaxServer, event: 'AddRef' | 'Release', handler: (this: FAXCOMEXLib.FaxServer, parameter: {}) => void): void;
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1168,7 +1168,6 @@ interface ActiveXObject {
on(obj: InfoPath.Button, event: 'AddRef' | 'Release', handler: (this: InfoPath.Button, parameter: {}) => void): void;
on(obj: InfoPath.DataDOM, event: 'AddRef' | 'Release', handler: (this: InfoPath.DataDOM, parameter: {}) => void): void;
on(obj: InfoPath.XDocument, event: 'AddRef' | 'Release', handler: (this: InfoPath.XDocument, parameter: {}) => void): void;
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -0,0 +1,20 @@
/// <reference types="activex-scripting" />
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);
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];
}

111
types/activex-interop/index.d.ts vendored Normal file
View File

@@ -0,0 +1,111 @@
// Type definitions for Javascript Automation interop 0.0
// 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.6
// tslint:disable-next-line no-empty-interface
interface ActiveXObjectNameMap { }
interface ActiveXObject {
new <K extends keyof ActiveXObjectNameMap>(progid: K): ActiveXObjectNameMap[K];
new(s: string): any;
}
declare var ActiveXObject: ActiveXObject;
/**
* Represents an Automation SAFEARRAY
*/
declare class SafeArray<T = any> {
private constructor();
private SafeArray_typekey: SafeArray<T>;
}
/**
* Allows enumerating over a COM collection, which may not have indexed item access.
*/
interface Enumerator<T = any> {
/**
* Returns true if the current item is the last one in the collection, or the collection is empty,
* or the current item is undefined.
*/
atEnd(): boolean;
/**
* Returns the current item in the collection
*/
item(): T;
/**
* Resets the current item in the collection to the first item. If there are no items in the collection,
* the current item is set to undefined.
*/
moveFirst(): void;
/**
* Moves the current item to the next item in the collection. If the enumerator is at the end of
* the collection or the collection is empty, the current item is set to undefined.
*/
moveNext(): void;
}
interface EnumeratorConstructor {
new <T = any>(collection: { Item(index: any): T }): Enumerator<T>;
// new (collection: any): Enumerator;
}
declare var Enumerator: EnumeratorConstructor;
/**
* Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.
*/
interface VBArray<T = any> {
/**
* Returns the number of dimensions (1-based).
*/
dimensions(): number;
/**
* Takes an index for each dimension in the array, and returns the item at the corresponding location.
*/
getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;
/**
* Returns the smallest available index for a given dimension.
* @param dimension 1-based dimension (defaults to 1)
*/
lbound(dimension?: number): number;
/**
* Returns the largest available index for a given dimension.
* @param dimension 1-based dimension (defaults to 1)
*/
ubound(dimension?: number): number;
/**
* Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,
* each successive dimension is appended to the end of the array.
* Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]
*/
toArray(): T[];
}
interface VBArrayConstructor {
new <T = any>(safeArray: SafeArray<T>): VBArray<T>;
}
declare var VBArray: VBArrayConstructor;
/** Automation date (VT_DATE) */
declare class VarDate {
private constructor();
private VarDate_typekey: VarDate;
}
interface DateConstructor {
new(vd: VarDate): Date;
}
interface Date {
getVarDate: () => VarDate;
}

View File

@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [ "../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"activex-interop-tests.ts"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}

View File

@@ -1,3 +1,16 @@
/// <reference types="windows-script-host" />
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
const results: T[] = [];
const enumerator = new Enumerator<T>(col);
enumerator.moveFirst();
while (!enumerator.atEnd()) {
results.push(enumerator.item());
enumerator.moveNext();
}
return results;
};
const wshn = new ActiveXObject('WScript.Network');
// https://msdn.microsoft.com/en-us/library/s6wt333f(v=vs.84).aspx

View File

@@ -1,14 +1,15 @@
// Type definitions for Windows Script Host Object Model - IWshRuntimeLibrary 1.0
// Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k(v=vs.84).aspx
// Type definitions for Windows Script Host Runtime Object Model 0.0
// 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.6
/// <reference types="activex-interop" />
declare namespace IWshRuntimeLibrary {
type WindowStyle = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
type ShortcutWindowStyle = 1 | 3 | 7;
// tslint:disable-next-line no-const-enum
const enum ButtonType {
OK,
OKCancel,
@@ -19,7 +20,6 @@ declare namespace IWshRuntimeLibrary {
CancelTryagainContinue
}
// tslint:disable-next-line no-const-enum
const enum EventType {
AuditFailure = 5,
AuditSuccess = 4,
@@ -29,7 +29,6 @@ declare namespace IWshRuntimeLibrary {
Warning = 2
}
// tslint:disable-next-line no-const-enum
const enum IconType {
Stop = 16,
QuestionMark = 32,
@@ -37,7 +36,6 @@ declare namespace IWshRuntimeLibrary {
InformationMark = 64,
}
// tslint:disable-next-line no-const-enum
const enum PopupType {
SecondButtonDefault = 256,
ThirdButtonDefault = 512,
@@ -46,7 +44,6 @@ declare namespace IWshRuntimeLibrary {
RTL = 1048576,
}
// tslint:disable-next-line no-const-enum
const enum PopupSelection {
NoButton = -1,
OK = 1,
@@ -60,14 +57,12 @@ declare namespace IWshRuntimeLibrary {
Continue = 11,
}
// tslint:disable-next-line no-const-enum
const enum WshExecStatus {
WshFailed = 2,
WshFinished = 1,
WshRunning = 0,
}
// tslint:disable-next-line no-const-enum
const enum WshWindowStyle {
WshHide = 0,
WshMaximizedFocus = 3,
@@ -77,24 +72,91 @@ declare namespace IWshRuntimeLibrary {
WshNormalNoFocus = 4,
}
class TextStream {
private 'IWshRuntimeLibrary.TextStream_typekey': TextStream;
private constructor();
readonly AtEndOfLine: boolean;
readonly AtEndOfStream: boolean;
Close(): void;
readonly Column: number;
readonly Line: number;
Read(Characters: number): string;
ReadAll(): string;
ReadLine(): string;
Skip(Characters: number): void;
SkipLine(): void;
Write(Text: string): void;
WriteBlankLines(Lines: number): void;
class TextStreamBase {
/**
* The column number of the current character position in an input stream.
*/
Column: number;
/** @param string [Text=''] */
WriteLine(Text?: string): void;
/**
* The current line number in an input stream.
*/
Line: number;
/**
* Closes a text stream.
* It is not necessary to close standard streams; they close automatically when the process ends. If
* you close a standard stream, be aware that any other pointers to that standard stream become invalid.
*/
Close(): void;
}
class TextStreamWriter extends TextStreamBase {
private 'IWshRuntimeLibrary.TextStreamWriter_typekey': TextStreamWriter;
private constructor();
/**
* Sends a string to an output stream.
*/
Write(s: string): void;
/**
* Sends a specified number of blank lines (newline characters) to an output stream.
*/
WriteBlankLines(intLines: number): void;
/**
* Sends a string followed by a newline character to an output stream.
*/
WriteLine(s: string): void;
}
class TextStreamReader extends TextStreamBase {
private 'IWshRuntimeLibrary.TextStreamReader_typekey': TextStreamReader;
private constructor();
/**
* Returns a specified number of characters from an input stream, starting at the current pointer position.
* Does not return until the ENTER key is pressed.
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
*/
Read(characters: number): string;
/**
* Returns all characters from an input stream.
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
*/
ReadAll(): string;
/**
* Returns an entire line from an input stream.
* Although this method extracts the newline character, it does not add it to the returned string.
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
*/
ReadLine(): string;
/**
* Skips a specified number of characters when reading from an input text stream.
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
* @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
*/
Skip(characters: number): void;
/**
* Skips the next line when reading from an input text stream.
* Can only be used on a stream in reading mode, not writing or appending mode.
*/
SkipLine(): void;
/**
* Indicates whether the stream pointer position is at the end of a line.
*/
AtEndOfLine: boolean;
/**
* Indicates whether the stream pointer position is at the end of a stream.
*/
AtEndOfStream: boolean;
}
/** Generic Collection Object */
@@ -109,7 +171,7 @@ declare namespace IWshRuntimeLibrary {
interface WshEnvironment {
Count(): number;
Item(Name: string): string;
readonly length: number;
readonly Length: number;
Remove(Name: string): void;
(Name: string): string;
}
@@ -121,9 +183,9 @@ declare namespace IWshRuntimeLibrary {
readonly ExitCode: number;
readonly ProcessID: number;
readonly Status: WshExecStatus;
readonly StdErr: TextStream;
readonly StdIn: TextStream;
readonly StdOut: TextStream;
readonly StdErr: TextStreamWriter;
readonly StdIn: TextStreamReader;
readonly StdOut: TextStreamWriter;
Terminate(): void;
}
@@ -336,13 +398,40 @@ declare namespace IWshRuntimeLibrary {
TargetPath: string;
}
}
declare namespace WSHControllerLibrary {
class WSHController {
private 'WSHControllerLibrary.WSHController_typekey': WSHController;
private constructor();
CreateScript(Command: string, Server?: any): any;
}
}
interface ActiveXObject {
set(obj: IWshRuntimeLibrary.WshEnvironment, propertyName: 'Item', parameterTypes: [string], newValue: string): void;
new <K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
declare namespace ScriptSigner {
class Signer {
private 'ScriptSigner.Signer_typekey': Signer;
private constructor();
/** @param Store [Store='my'] */
Sign(FileExtension: string, Text: string, Certificate: string, Store?: string): string;
/** @param Store [Store='my'] */
SignFile(FileName: string, Certificate: string, Store?: string): void;
/** @param ShowUI [ShowUI=false] */
Verify(FileExtension: string, Text: string, ShowUI?: boolean): boolean;
/** @param ShowUI [ShowUI=false] */
VerifyFile(FileName: string, ShowUI?: boolean): boolean;
}
}
interface ActiveXObjectNameMap {
'WSHController': WSHControllerLibrary.WSHController;
'Scripting.Signer': ScriptSigner.Signer;
'WScript.Network': IWshRuntimeLibrary.WshNetwork;
'WScript.Shell': IWshRuntimeLibrary.WshShell;
}
interface ActiveXObject {
set(obj: IWshRuntimeLibrary.WshEnvironment, propertyName: 'Item', parameterTypes: [string], newValue: string): void;
}

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,
@@ -21,4 +20,4 @@
"index.d.ts",
"activex-iwshruntimelibrary-tests.ts"
]
}
}

View File

@@ -1,3 +1,6 @@
{
"extends": "dtslint/dt.json"
"extends": "dtslint/dt.json",
"rules": {
"no-const-enum": false
}
}

View File

@@ -1,3 +1,5 @@
/// <reference types="windows-script-host" />
(() => {
// https://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/Automation_Bridge

View File

@@ -2,7 +2,9 @@
// 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" />
declare class type {
private typekey: type;
@@ -12,9 +14,6 @@ declare class sequence<T = any> {
private typekey: sequence<T>;
}
// tslint:disable-next-line no-empty-interface
interface SafeArray<T = any> {}
declare namespace com.sun.star {
namespace accessibility {
/**

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1564,7 +1564,6 @@ interface ActiveXObject {
set(obj: MSForms.ComboBox | MSForms.ListBox, propertyName: 'Column' | 'List', parameterTypes: [number, number] | [number], newValue: any): void;
set(obj: MSForms.ComboBox | MSForms.ListBox, propertyName: 'Column' | 'List', parameterTypes: number[], newValue: SafeArray): void;
set(obj: MSForms.ListBox, propertyName: 'Selected', parameterTypes: [any], newValue: boolean): void;
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,3 +1,5 @@
/// <reference types="windows-script-host" />
let htmlfile = new ActiveXObject('htmlfile');
let htmldoc = htmlfile.createDocumentFromUrl('https://msdn.microsoft.com/en-us/library/aa741317(v=vs.85).aspx', 'null');
let length = htmldoc.all.length;

View File

@@ -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 {
@@ -35570,7 +35570,6 @@ interface ActiveXObject {
on(obj: MSHTML.SVGTSpanElement, event: 'onactivate' | 'onafterupdate' | 'onbeforeactivate' | 'onbeforecopy' | 'onbeforecut' | 'onbeforedeactivate' | 'onbeforeeditfocus' | 'onbeforepaste' | 'onbeforeupdate' | 'onblur' | 'oncellchange' | 'onclick' | 'oncontextmenu' | 'oncontrolselect' | 'oncopy' | 'oncut' | 'ondataavailable' | 'ondatasetchanged' | 'ondatasetcomplete' | 'ondblclick' | 'ondeactivate' | 'ondrag' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondragstart' | 'ondrop' | 'onerrorupdate' | 'onfilterchange' | 'onfocus' | 'onfocusin' | 'onfocusout' | 'onhelp' | 'onkeydown' | 'onkeypress' | 'onkeyup' | 'onlayoutcomplete' | 'onlosecapture' | 'onmousedown' | 'onmouseenter' | 'onmouseleave' | 'onmousemove' | 'onmouseout' | 'onmouseover' | 'onmouseup' | 'onmousewheel' | 'onmove' | 'onmoveend' | 'onmovestart' | 'onpage' | 'onpaste' | 'onpropertychange' | 'onreadystatechange' | 'onresize' | 'onresizeend' | 'onresizestart' | 'onrowenter' | 'onrowexit' | 'onrowsdelete' | 'onrowsinserted' | 'onscroll' | 'onselectstart', handler: (this: MSHTML.SVGTSpanElement, parameter: {}) => void): void;
on(obj: MSHTML.SVGUseElement, event: 'onactivate' | 'onafterupdate' | 'onbeforeactivate' | 'onbeforecopy' | 'onbeforecut' | 'onbeforedeactivate' | 'onbeforeeditfocus' | 'onbeforepaste' | 'onbeforeupdate' | 'onblur' | 'oncellchange' | 'onclick' | 'oncontextmenu' | 'oncontrolselect' | 'oncopy' | 'oncut' | 'ondataavailable' | 'ondatasetchanged' | 'ondatasetcomplete' | 'ondblclick' | 'ondeactivate' | 'ondrag' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondragstart' | 'ondrop' | 'onerrorupdate' | 'onfilterchange' | 'onfocus' | 'onfocusin' | 'onfocusout' | 'onhelp' | 'onkeydown' | 'onkeypress' | 'onkeyup' | 'onlayoutcomplete' | 'onlosecapture' | 'onmousedown' | 'onmouseenter' | 'onmouseleave' | 'onmousemove' | 'onmouseout' | 'onmouseover' | 'onmouseup' | 'onmousewheel' | 'onmove' | 'onmoveend' | 'onmovestart' | 'onpage' | 'onpaste' | 'onpropertychange' | 'onreadystatechange' | 'onresize' | 'onresizeend' | 'onresizestart' | 'onrowenter' | 'onrowexit' | 'onrowsdelete' | 'onrowsinserted' | 'onscroll' | 'onselectstart', handler: (this: MSHTML.SVGUseElement, parameter: {}) => void): void;
on(obj: MSHTML.SVGViewElement, event: 'onactivate' | 'onafterupdate' | 'onbeforeactivate' | 'onbeforecopy' | 'onbeforecut' | 'onbeforedeactivate' | 'onbeforeeditfocus' | 'onbeforepaste' | 'onbeforeupdate' | 'onblur' | 'oncellchange' | 'onclick' | 'oncontextmenu' | 'oncontrolselect' | 'oncopy' | 'oncut' | 'ondataavailable' | 'ondatasetchanged' | 'ondatasetcomplete' | 'ondblclick' | 'ondeactivate' | 'ondrag' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondragstart' | 'ondrop' | 'onerrorupdate' | 'onfilterchange' | 'onfocus' | 'onfocusin' | 'onfocusout' | 'onhelp' | 'onkeydown' | 'onkeypress' | 'onkeyup' | 'onlayoutcomplete' | 'onlosecapture' | 'onmousedown' | 'onmouseenter' | 'onmouseleave' | 'onmousemove' | 'onmouseout' | 'onmouseover' | 'onmouseup' | 'onmousewheel' | 'onmove' | 'onmoveend' | 'onmovestart' | 'onpage' | 'onpaste' | 'onpropertychange' | 'onreadystatechange' | 'onresize' | 'onresizeend' | 'onresizestart' | 'onrowenter' | 'onrowexit' | 'onrowsdelete' | 'onrowsinserted' | 'onscroll' | 'onselectstart', handler: (this: MSHTML.SVGViewElement, parameter: {}) => void): void;
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,3 +1,5 @@
/// <reference types="windows-script-host" />
// https://msdn.microsoft.com/en-us/library/ms764708(v=vs.85).aspx
{
const dom = new ActiveXObject('Msxml2.DOMDocument.6.0');

View File

@@ -2,7 +2,9 @@
// 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" />
declare namespace MSXML2 {
/** Schema Object Model Content Types */
@@ -2775,7 +2777,6 @@ declare namespace MSXML2 {
interface ActiveXObject {
on(obj: MSXML2.DOMDocument60, event: 'ondataavailable' | 'onreadystatechange', handler: (this: MSXML2.DOMDocument60, parameter: {}) => void): void;
on(obj: MSXML2.FreeThreadedDOMDocument60, event: 'ondataavailable' | 'onreadystatechange', handler: (this: MSXML2.FreeThreadedDOMDocument60, parameter: {}) => void): void;
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,3 +1,4 @@
/// <reference types="windows-script-host" />
/// <reference types="activex-word" />
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -4,6 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="activex-interop" />
/// <reference types="activex-stdole" />
/// <reference types="activex-office" />
@@ -5855,7 +5856,6 @@ interface ActiveXObject {
on(obj: Outlook.TaskRequestDeclineItem, event: 'AfterWrite' | 'BeforeRead' | 'Read' | 'Unload', handler: (this: Outlook.TaskRequestDeclineItem, parameter: {}) => void): void;
on(obj: Outlook.TaskRequestItem, event: 'AfterWrite' | 'BeforeRead' | 'Read' | 'Unload', handler: (this: Outlook.TaskRequestItem, parameter: {}) => void): void;
on(obj: Outlook.TaskRequestUpdateItem, event: 'AfterWrite' | 'BeforeRead' | 'Read' | 'Unload', handler: (this: Outlook.TaskRequestUpdateItem, parameter: {}) => void): void;
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,5 +1,5 @@
// tslint:disable-next-line no-unnecessary-generics
const collectionToArray = <T>(col: any): T[] => {
const collectionToArray = <T>(col: {Item(index: any): T}): T[] => {
const results: T[] = [];
const enumerator = new Enumerator<T>(col);
enumerator.moveFirst();
@@ -13,8 +13,8 @@ const collectionToArray = <T>(col: any): T[] => {
const app = new ActiveXObject('PowerPoint.Application');
(() => {
// delete empty textboxes in PowerPoint
collectionToArray<PowerPoint.Slide>(app.ActivePresentation.Slides).forEach(slide => {
collectionToArray<PowerPoint.Shape>(slide.Shapes).filter(shape =>
collectionToArray(app.ActivePresentation.Slides).forEach(slide => {
collectionToArray(slide.Shapes).filter(shape =>
shape.Type === Office.MsoShapeType.msoTextBox
&& shape.TextFrame.TextRange.Text.trim() === ''
).forEach(shape => shape.Delete());

View File

@@ -5374,7 +5374,6 @@ interface ActiveXObject {
this: PowerPoint.Application, parameter: {readonly Sel: PowerPoint.Selection, Cancel: boolean}) => void): void;
on(obj: PowerPoint.Application, event: 'WindowSelectionChange', argNames: ['Sel'], handler: (this: PowerPoint.Application, parameter: {readonly Sel: PowerPoint.Selection}) => void): void;
on(obj: PowerPoint.OLEControl, event: 'GotFocus' | 'LostFocus', handler: (this: PowerPoint.OLEControl, parameter: {}) => void): void;
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,3 +1,5 @@
/// <reference types="windows-script-host" />
// Note -- running these tests under cscript requires some ES5 polyfills
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {

View File

@@ -4,6 +4,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="activex-interop" />
declare namespace Scripting {
// tslint:disable-next-line:no-const-enum
const enum CompareMethod {
@@ -489,8 +491,7 @@ declare namespace Scripting {
}
interface ActiveXObject {
new <K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
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 {
@@ -498,3 +499,7 @@ interface ActiveXObjectNameMap {
'Scripting.Encoder': Scripting.Encoder;
'Scripting.FileSystemObject': Scripting.FileSystemObject;
}
interface EnumeratorConstructor {
new <TKey>(dict: Scripting.Dictionary<TKey>): Enumerator<TKey>;
}

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -4,6 +4,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="activex-interop" />
declare namespace SHDocVw {
// tslint:disable-next-line no-const-enum
const enum BrowserBarConstants {
@@ -1562,7 +1564,6 @@ interface ActiveXObject {
on(obj: SHDocVw.ShellNameSpace, event: 'DoubleClick' | 'Initialized' | 'SelectionChange', handler: (this: SHDocVw.ShellNameSpace, parameter: {}) => void): void;
on(obj: SHDocVw.WebBrowser, event: 'DownloadBegin' | 'DownloadComplete' | 'OnQuit', handler: (this: SHDocVw.WebBrowser, parameter: {}) => void): void;
on(obj: SHDocVw.WebBrowser_V1, event: 'DownloadBegin' | 'DownloadComplete' | 'WindowActivate' | 'WindowMove' | 'WindowResize', handler: (this: SHDocVw.WebBrowser_V1, parameter: {}) => void): void;
new <K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {
@@ -1571,7 +1572,3 @@ interface ActiveXObjectNameMap {
'Shell.UIHelper': SHDocVw.ShellUIHelper;
'ShellNameSpace.ShellNameSpace': SHDocVw.ShellNameSpace;
}
interface EnumeratorConstructor {
new(col: SHDocVw.ShellWindows): Enumerator<SHDocVw.InternetExplorer>;
}

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,4 +1,4 @@
/// <reference types="activex-iwshruntimelibrary" />
/// <reference types="windows-script-host" />
const shell = new ActiveXObject('Shell.Application');

View File

@@ -1001,7 +1001,6 @@ interface ActiveXObject {
on(
obj: Shell32.ShellFolderViewOC, event: 'BeginDrag' | 'DefaultVerbInvoked' | 'EnumDone' | 'SelectionChanged' | 'VerbInvoked',
handler: (this: Shell32.ShellFolderViewOC, parameter: {}) => void): void;
new <K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -4,15 +4,23 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="activex-interop" />
declare namespace stdole {
type IFontDisp = StdFont;
type IPictureDisp = StdPicture;
type OLE_COLOR = number;
type OLE_XPOS_CONTAINER = number;
type OLE_XPOS_PIXELS = number;
type OLE_YPOS_CONTAINER = number;
type OLE_YPOS_PIXELS = number;
const enum LoadPictureConstants {
Color = 4,
Default = 0,
@@ -79,7 +87,6 @@ declare namespace stdole {
interface ActiveXObject {
on(obj: stdole.StdFont, event: 'FontChanged', argNames: ['PropertyName'], handler: (this: stdole.StdFont, parameter: {readonly PropertyName: string}) => void): void;
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,3 +1,4 @@
/// <reference types="windows-script-host" />
/// <reference types="activex-word" />
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,3 +1,5 @@
/// <reference types="windows-script-host" />
// Note -- running these tests under cscript requires some ES5 polyfills
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {

View File

@@ -4,6 +4,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="activex-interop" />
declare namespace WIA {
/** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */
const enum CommandID {
@@ -791,7 +793,6 @@ declare namespace WIA {
}
interface ActiveXObject {
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
on(obj: WIA.DeviceManager, event: 'OnEvent', argNames: ['EventID', 'DeviceID', 'ItemID'], handler: (
this: WIA.DeviceManager, parameter: { readonly EventID: string, readonly DeviceID: string, readonly ItemID: string }) => void): void;
set<TItem>(obj: WIA.Vector<TItem>, propertyName: 'Item', parameterTypes: [number], newValue: TItem): void;

View File

@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@@ -1,5 +1,7 @@
/// <reference types="windows-script-host" />
// tslint:disable-next-line no-unnecessary-generics
const collectionToArray = <T>(col: any): T[] => {
const collectionToArray = <T>(col: {Item(index: any): T}): T[] => {
const results: T[] = [];
const enumerator = new Enumerator<T>(col);
enumerator.moveFirst();
@@ -233,7 +235,7 @@ const activeDoc = app.ActiveDocument;
// looping through a collection -- https://msdn.microsoft.com/en-us/vba/word-vba/articles/looping-through-a-collection
(() => {
collectionToArray<Word.Document>(app.Documents)
collectionToArray(app.Documents)
.forEach(openDocument => WScript.Echo(openDocument.Name));
const strMarks = collectionToArray<Word.Bookmark>(activeDoc.Bookmarks)

View File

@@ -4,6 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="activex-interop" />
/// <reference types="activex-office" />
/// <reference types="activex-vbide" />
/// <reference types="activex-stdole" />
@@ -12496,7 +12497,6 @@ interface ActiveXObject {
set(obj: Word.Document, propertyName: 'ActiveWritingStyle', parameterTypes: [any], newValue: string): void;
set(obj: Word.Document, propertyName: 'Compatibility', parameterTypes: [Word.WdCompatibility], newValue: boolean): void;
set(obj: Word.System, propertyName: 'PrivateProfileString', parameterTypes: [string, string, string], newValue: string): void;
new<K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {

View File

@@ -1,10 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"scripthost"
],
"lib": ["es5"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,

View File

@@ -21,9 +21,9 @@ type MyEntity = AFrame.Entity<{
material: THREE.Material;
sound: { pause(): void };
}>;
const camera = document.querySelector<MyEntity>('a-entity[camera]').components.camera;
const material = document.querySelector<MyEntity>('a-entity[material]').components.material;
document.querySelector<MyEntity>('a-entity[sound]').components.sound.pause();
const camera = (document.querySelector('a-entity[camera]') as MyEntity).components.camera;
const material = (document.querySelector('a-entity[material]') as MyEntity).components.material;
(document.querySelector('a-entity[sound]') as MyEntity).components.sound.pause();
entity.getDOMAttribute('geometry').primitive;
@@ -38,21 +38,82 @@ entity.addEventListener('child-detached', (event) => {
});
// Components
const Component = AFRAME.registerComponent('test', {});
interface TestComponent extends AFrame.Component {
multiply: (f: number) => number;
data: {
myProperty: any[],
string: string,
num: number
};
system: TestSystem;
}
const Component = AFRAME.registerComponent<TestComponent>('test-component', {
schema: {
myProperty: {
default: [],
parse() { return [true]; },
},
string: { type: 'string' },
num: 0
},
init() {
this.data.num = 0;
},
update() {},
tick() {},
remove() {},
pause() {},
play() {},
multiply(this: TestComponent, f: number) {
// Reference to system because both were registered with the same name.
return f * this.data.num * this.system.data.counter;
}
});
// Scene
const scene = document.querySelector('a-scene');
scene.hasLoaded;
// System
const system = scene.systems['systemName'];
interface TestSystem extends AFrame.System {
data: {
counter: number;
};
}
const testSystem: AFrame.SystemDefinition<TestSystem> = {
schema: {
counter: 0
},
init() {
this.data.counter = 1;
}
};
AFRAME.registerSystem('test-component', testSystem);
// Register Custom Geometry
AFRAME.registerGeometry('a-test-geometry', {
interface TestGeometry extends AFrame.Geometry {
schema: AFrame.MultiPropertySchema<{
groupIndex: number;
}>;
}
AFRAME.registerGeometry<TestGeometry>('a-test-geometry', {
schema: {
groupIndex: { default: 0 }
},
init(data) {
this.geometry = new THREE.Geometry();
const temp = data.groupIndex;
temp;
}
});

View File

@@ -2,6 +2,7 @@
// Project: https://aframe.io/
// Definitions by: Paul Shannon <https://github.com/devpaul>
// Roberto Ritger <https://github.com/bertoritger>
// Trygve Wastvedt <https://github.com/twastvedt>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -19,7 +20,7 @@ declare var hasNativeWebVRImplementation: boolean;
interface Document {
createElement(tagName: string): AFrame.Entity;
querySelector(selectors: 'a-scene'): AFrame.Scene;
querySelector<T extends AFrame.Entity<any>>(selectors: string): T;
querySelector(selectors: string): AFrame.Entity<any>;
querySelectorAll(selectors: string): NodeListOf<AFrame.Entity<any> | Element>;
}
@@ -36,15 +37,15 @@ declare namespace AFrame {
components: { [ key: string ]: ComponentDescriptor };
geometries: { [ key: string ]: GeometryDescriptor };
primitives: { [ key: string ]: Entity };
registerComponent(name: string, component: ComponentDefinition): ComponentConstructor;
registerComponent<T extends Component>(name: string, component: ComponentDefinition<T>): ComponentConstructor<T>;
registerElement(name: string, element: ANode): void;
registerGeometry(name: string, geometry: GeometryDefinition): Geometry;
registerGeometry<T extends Geometry>(name: string, geometry: GeometryDefinition<T>): GeometryConstructor<T>;
registerPrimitive(name: string, primitive: PrimitiveDefinition): void;
registerShader(name: string, shader: any): void;
registerSystem(name: string, definition: SystemDefinition): void;
registerShader<T extends Shader>(name: string, shader: T): ShaderConstructor<T>;
registerSystem<T extends System>(name: string, definition: SystemDefinition<T>): SystemConstructor<T>;
schema: SchemaUtils;
shaders: { [ key: string ]: ShaderDescriptor };
systems: { [key: string]: System };
systems: { [key: string]: SystemConstructor };
THREE: typeof THREE;
TWEEN: typeof TWEEN;
utils: Utils;
@@ -89,54 +90,39 @@ declare namespace AFrame {
tick(): void;
}
interface Component {
interface Component<T extends { [key: string]: any } = any, S extends System = System> {
attrName?: string;
data?: any;
data: T;
dependencies?: string[];
el: Entity;
id: string;
multiple?: boolean;
name: string;
schema: Schema;
schema: Schema<T>;
system: S | undefined;
init(data?: any): void;
pause(): void;
play(): void;
remove(): void;
tick?(time: number, timeDelta: number): void;
update(oldData: any): void;
updateSchema?(): void;
init(this: this, data?: T): void;
pause(this: this): void;
play(this: this): void;
remove(this: this): void;
tick?(this: this, time: number, timeDelta: number): void;
update(this: this, oldData: T): void;
updateSchema?(this: this): void;
extendSchema(update: Schema): void;
flushToDOM(): void;
extendSchema(this: this, update: Schema): void;
flushToDOM(this: this): void;
}
interface ComponentConstructor {
new (el: Entity, name: string, id: string): Component;
interface ComponentConstructor<T extends Component> {
new (el: Entity, attrValue: string, id: string): T;
}
interface ComponentDefinition {
dependencies?: string[];
el?: Entity;
id?: string;
multiple?: boolean;
schema?: Schema;
type ComponentDefinition<T extends Component = Component> = Partial<T>;
init?(data?: any): void;
pause?(): void;
play?(): void;
remove?(): void;
tick?(time: number, timeDelta: number): void;
update?(oldData: any): void;
updateSchema?(): void;
[ key: string ]: any;
}
interface ComponentDescriptor {
Component: Component;
dependencies: string[] | null;
multiple: boolean | null;
interface ComponentDescriptor<T extends Component = Component> {
Component: ComponentConstructor<T>;
dependencies: string[] | undefined;
multiple: boolean | undefined;
// internal APIs2
// parse
@@ -144,7 +130,6 @@ declare namespace AFrame {
// schema
// stringify
// type
[ key: string ]: any;
}
interface Coordinate {
@@ -153,8 +138,14 @@ declare namespace AFrame {
z: number;
}
interface DefaultComponents {
position: Component<Coordinate>;
rotation: Component<Coordinate>;
scale: Component<Coordinate>;
}
interface Entity<C = ObjectMap<Component>> extends ANode {
components: C;
components: C & DefaultComponents;
isPlaying: boolean;
object3D: THREE.Object3D;
object3DMap: ObjectMap<THREE.Object3D>;
@@ -165,8 +156,8 @@ declare namespace AFrame {
/**
* @deprecated since 0.4.0
*/
getComputedAttribute<T = Component>(attr: string): T;
getDOMAttribute<T = any>(attr: string): T;
getComputedAttribute(attr: string): Component;
getDOMAttribute(attr: string): any;
getObject3D(type: string): THREE.Object3D;
getOrCreateObject3D(type: string, construct: any): THREE.Object3D;
is(stateName: string): boolean;
@@ -179,7 +170,6 @@ declare namespace AFrame {
// getAttribute specific usages
getAttribute(type: string): any;
getAttribute<T = Component>(attr: string): T;
getAttribute(type: 'position' | 'rotation' | 'scale'): Coordinate;
// setAttribute specific usages
@@ -192,12 +182,18 @@ declare namespace AFrame {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
type DetailEvent<D> = Event & { detail: D };
type DetailEvent<D> = Event & {
detail: D;
target: EventTarget & Entity;
};
interface EntityEventMap {
'child-attached': DetailEvent<{ el: Element | Entity }>;
'child-detached': DetailEvent<{ el: Element | Entity }>;
'componentchanged': DetailEvent<{ name: string }>;
'componentchanged': DetailEvent<{
name: string,
id: string
}>;
'componentremoved': DetailEvent<{
name: string,
id: string,
@@ -215,23 +211,28 @@ declare namespace AFrame {
interface Geometry {
name: string;
geometry: THREE.Geometry;
schema: Schema;
update(data: object): void;
[ key: string ]: any;
schema: Schema<any>;
init(this: this, data: { [P in keyof this['schema']]: any }): void;
// Would like the above to be:
// init?(this: this, data?: { [P in keyof T['schema']]: T['schema'][P]['default'] } ): void;
// I think this is prevented by the following issue: https://github.com/Microsoft/TypeScript/issues/21760.
}
interface GeometryDefinition extends ComponentDefinition {
geometry?: THREE.Geometry;
interface GeometryConstructor<T extends Geometry> {
new (): T;
}
interface GeometryDescriptor {
Geometry: Geometry;
type GeometryDefinition<T extends Geometry = Geometry> = Partial<T>;
interface GeometryDescriptor<T extends Geometry = Geometry> {
Geometry: GeometryConstructor<T>;
schema: Schema;
}
interface MultiPropertySchema {
[ key: string ]: SinglePropertySchema<any>;
}
type MultiPropertySchema<T extends { [key: string ]: any }> = {
[P in keyof T]: SinglePropertySchema<T[P]> | T[P];
};
interface PrimitiveDefinition {
defaultComponents?: any; // TODO cleanup type
@@ -240,8 +241,9 @@ declare namespace AFrame {
transforms?: any; // TODO cleanup type
}
type PropertyTypes = 'array' | 'boolean' | 'color' | 'int' | 'number' | 'selector' |
'selectorAll' | 'src' | 'string' | 'vec2' | 'vec3' | 'vec4';
type PropertyTypes = 'array' | 'asset' | 'audio' | 'boolean' | 'color' |
'int' | 'map' | 'model' | 'number' | 'selector' | 'selectorAll' |
'string' | 'vec2' | 'vec3' | 'vec4';
type SceneEvents = 'enter-vr' | 'exit-vr' | 'loaded' | 'renderstart';
@@ -265,7 +267,7 @@ declare namespace AFrame {
addEventListener(type: SceneEvents, listener: EventListener, useCapture?: boolean): void;
}
type Schema = SinglePropertySchema<any> | MultiPropertySchema;
type Schema<T = { [key: string]: any }> = SinglePropertySchema<T> | MultiPropertySchema<T>;
interface SchemaUtils {
isSingleProperty(schema: Schema): boolean;
@@ -274,11 +276,25 @@ declare namespace AFrame {
interface Shader {
name: string;
schema: Schema;
data: { [key: string]: any };
schema: Schema<this['data']>;
material: THREE.Material;
vertexShader: string;
fragmentShader: string;
init(this: this, data?: this['data']): void;
tick?(this: this, time: number, timeDelta: number): void;
update(this: this, oldData: this['data']): void;
}
interface ShaderDescriptor {
Shader: Shader;
interface ShaderConstructor<T extends Shader> {
new (): T;
}
type ShaderDefinition<T extends Shader = Shader> = Partial<T>;
interface ShaderDescriptor<T extends Shader = Shader> {
Shader: ShaderConstructor<T>;
schema: Schema;
}
@@ -287,27 +303,23 @@ declare namespace AFrame {
'default'?: T;
parse?(value: string): T;
stringify?(value: T): string;
[ key: string ]: any;
}
interface System {
data: any;
schema: Schema;
init(): void;
pause(): void;
play(): void;
tick?(): void;
data: { [key: string]: any };
schema: Schema<this['data']>;
init(this: this): void;
pause(this: this): void;
play(this: this): void;
tick?(this: this, t: number, dt: number): void;
}
interface SystemDefinition {
schema?: Schema;
init?(): void;
pause?(): void;
play?(): void;
tick?(): void;
[ key: string ]: any;
interface SystemConstructor<T extends System = System> {
new (scene: Scene): T;
}
type SystemDefinition<T extends System = System> = Partial<T>;
interface Utils {
coordinates: {
isCoordinate(value: string): boolean;
@@ -326,5 +338,8 @@ declare namespace AFrame {
diff(a: object, b: object): object;
extend(target: object, ... source: object[]): object;
extendDeep(target: object, ... source: object[]): object;
throttle(tickFunction: () => void, minimumInterval: number, optionalContext?: {}): (t: number, dt: number) => void;
throttleTick(tickFunction: (t: number, dt: number) => void, minimumInterval: number, optionalContext?: {}): (t: number, dt: number) => void;
}
}

View File

@@ -1,6 +1,5 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}

View File

@@ -0,0 +1,5 @@
import * as Ajv from "ajv";
import AjvErrors = require("ajv-errors");
const ajv = new Ajv({allErrors: true, jsonPointers: true});
AjvErrors(ajv);

18
types/ajv-errors/index.d.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
// Type definitions for ajv-errors 1.0
// Project: https://github.com/epoberezkin/ajv-errors
// Definitions by: Afshawn Lotfi <https://github.com/afshawnlotfi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Ajv } from "ajv";
/**
*
* @param ajv Ajv Main Class
* https://github.com/epoberezkin/ajv
* @param options Optional options for Ajv Errors
* https://github.com/epoberezkin/ajv-errors#options
*
*/
export = AjvErrors;
declare function AjvErrors(ajv: Ajv, options?: {}): Ajv;

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ajv-errors-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -9,6 +9,7 @@ import {
Response,
IndexSettings,
QueryParameters,
Client
} from 'algoliasearch';
let _algoliaResponse: Response = {
@@ -78,7 +79,7 @@ let _algoliaIndexSettings: IndexSettings = {
ignorePlurals: false,
disableTypoToleranceOnAttributes: '',
separatorsToIndex: '',
queryType: '',
queryType: 'prefixAll',
removeWordsIfNoResults: '',
advancedSyntax: false,
optionalWords: [''],
@@ -86,14 +87,15 @@ let _algoliaIndexSettings: IndexSettings = {
disablePrefixOnAttributes: [''],
disableExactOnAttributes: [''],
exactOnSingleWordQuery: '',
alternativesAsExact: false,
alternativesAsExact: ['ignorePlurals'],
attributeForDistinct: '',
distinct: false,
numericAttributesToIndex: [''],
allowCompressionOfIntegerArray: false,
altCorrections: [{}],
minProximity: 0,
placeholders: '',
placeholders: { '': [''] },
camelCaseAttributes: [''],
};
let _algoliaQueryParameters: QueryParameters = {
@@ -147,7 +149,30 @@ let _algoliaQueryParameters: QueryParameters = {
minProximity: 0,
};
let index: Index = algoliasearch('', '').initIndex('');
let client: Client = algoliasearch('', '');
let index: Index = client.initIndex('');
let search = index.search({ query: '' });
index.search({ query: '' }, (err, res) => {});
// partialUpdateObject
index.partialUpdateObject({}, () => {});
index.partialUpdateObject({}, false, () => {});
index.partialUpdateObject({}).then(() => {});
index.partialUpdateObject({}, false).then(() => {});
// partialUpdateObjects
index.partialUpdateObjects([{}], () => {});
index.partialUpdateObjects([{}], false, () => {});
index.partialUpdateObjects([{}]).then(() => {});
index.partialUpdateObjects([{}], false).then(() => {});
let indexName : string = index.indexName;
// complete copy
client.copyIndex('from', 'to').then(()=>{})
client.copyIndex('from', 'to', ()=> {})
// with scope
client.copyIndex('from', 'to', ['settings']).then(()=>{})
client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {})

View File

@@ -3,6 +3,7 @@
// Definitions by: Baptiste Coquelle <https://github.com/cbaptiste>
// Haroen Viaene <https://github.com/haroenv>
// Aurélien Hervé <https://github.com/aherve>
// Samuel Vaillant <https://github.com/samouss>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -88,7 +89,16 @@ declare namespace algoliasearch {
*/
deleteIndex(name: string): Promise<Task>;
/**
* Copy an index from a specific index to a new one
* Copy an index from a specific index to a new one
* https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex
*/
copyIndex(
from: string,
to: string,
cb: (err: Error, res: Task) => void
): void;
/**
* Copy settings of an index from a specific index to a new one
* https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex
*/
copyIndex(
@@ -98,13 +108,13 @@ declare namespace algoliasearch {
cb: (err: Error, res: Task) => void
): void;
/**
* Copy an index from a specific index to a new one
* Copy settings of an index from a specific index to a new one
* https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex
*/
copyIndex(
from: string,
to: string,
scope: ('settings' | 'synonyms' | 'rules')[]
scope?: ('settings' | 'synonyms' | 'rules')[]
): Promise<Task>;
/**
* Move index to a new one (and will overwrite the original one)
@@ -230,6 +240,7 @@ declare namespace algoliasearch {
* Interface for the index algolia object
*/
interface Index {
indexName: string;
/**
* Gets a specific object
* https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects
@@ -286,14 +297,13 @@ declare namespace algoliasearch {
* https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects
*/
partialUpdateObject(object: {}, cb: (err: Error, res: Task) => void): void;
partialUpdateObject(object: {}, createIfNotExists: boolean, cb: (err: Error, res: Task) => void): void;
/**
* Update parameters of a list of objects
* https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects
*/
partialUpdateObjects(
objects: {}[],
cb: (err: Error, res: Task) => void
): void;
partialUpdateObjects(objects: {}[], cb: (err: Error, res: Task) => void): void;
partialUpdateObjects(objects: {}[], createIfNotExists: boolean, cb: (err: Error, res: Task) => void): void;
/**
* Delete a specific object
* https://github.com/algolia/algoliasearch-client-js#delete-objects---deleteobjects
@@ -330,7 +340,7 @@ declare namespace algoliasearch {
* Wait for an indexing task to be compete
* https://github.com/algolia/algoliasearch-client-js#wait-for-operations---waittask
*/
waitTask(taskID: number, cb: (err: Error, res: any) => void): void;
waitTask(taskID: number, cb: (err: Error, res: TaskStatus) => void): void;
/**
* Get an index settings
* https://github.com/algolia/algoliasearch-client-js#get-settings---getsettings
@@ -531,11 +541,13 @@ declare namespace algoliasearch {
* https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects
*/
partialUpdateObject(object: {}): Promise<Task>;
partialUpdateObject(object: {}, createIfNotExists: boolean): Promise<Task>;
/**
* Update parameters of a list of objects
* https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects
*/
partialUpdateObjects(objects: {}[]): Promise<Task>;
partialUpdateObjects(objects: {}[], createIfNotExists?: boolean): Promise<Task>;
/**
* Delete a specific object
* https://github.com/algolia/algoliasearch-client-js#delete-objects---deleteobjects
@@ -560,7 +572,7 @@ declare namespace algoliasearch {
* Wait for an indexing task to be compete
* https://github.com/algolia/algoliasearch-client-js#wait-for-operations---waittask
*/
waitTask(taskID: number): Promise<any>;
waitTask(taskID: number): Promise<TaskStatus>;
/**
* Get an index settings
* https://github.com/algolia/algoliasearch-client-js#get-settings---getsettings
@@ -1394,52 +1406,6 @@ declare namespace algoliasearch {
userData?: string | object;
}
interface AlgoliaResponse {
/**
* Contains all the hits matching the query
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
hits: any[];
/**
* Current page
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
page: number;
/**
* Number of total hits matching the query
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
nbHits: number;
/**
* Number of pages
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
nbPage: number;
/**
* Number of hits per pages
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
hitsPerPage: number;
/**
* Engine processing time (excluding network transfer)
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
processingTimeMS: number;
/**
* Query used to perform the search
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
query: string;
/**
* GET parameters used to perform the search
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
params: string;
facets: {
[facetName: string]: { [facetValue: string]: number };
};
}
namespace SearchForFacetValues {
interface Parameters extends QueryParameters {
/**
@@ -1480,6 +1446,13 @@ declare namespace algoliasearch {
interface Task {
taskID: number;
createdAt: string;
objectID?: string;
}
interface TaskStatus {
status: 'published' | 'notPublished',
pendingTask: boolean,
}
interface IndexSettings {
@@ -1600,7 +1573,7 @@ declare namespace algoliasearch {
* 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos.
* https://github.com/algolia/algoliasearch-client-js#typotolerance
*/
typoTolerance?: any;
typoTolerance?: boolean | 'min' | 'strict';
/**
* If set to false, disables typo tolerance on numeric tokens (numbers).
* default: true
@@ -1633,7 +1606,7 @@ declare namespace algoliasearch {
* 'prefixNone' No query word is interpreted as a prefix. This option is not recommended.
* https://github.com/algolia/algoliasearch-client-js#querytype
*/
queryType?: any;
queryType?: 'prefixAll' | 'prefixLast' | 'prefixNone';
/**
* This option is used to select a strategy in order to avoid having an empty result page
* default: 'none'
@@ -1699,7 +1672,10 @@ declare namespace algoliasearch {
* 'multiWordsSynonym': multiple-words synonym
* https://github.com/algolia/algoliasearch-client-js#alternativesasexact
*/
alternativesAsExact?: any;
alternativesAsExact?: (
| "ignorePlurals"
| "singleWordSynonym"
| "multiWordsSynonym")[];
/**
* The name of the attribute used for the Distinct feature
* default: null
@@ -1710,7 +1686,7 @@ declare namespace algoliasearch {
* If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set.
* https://github.com/algolia/algoliasearch-client-js#distinct
*/
distinct?: any;
distinct?: boolean | number;
/**
* All numerical attributes are automatically indexed as numerical filters
* default ''
@@ -1737,10 +1713,18 @@ declare namespace algoliasearch {
minProximity?: number;
/**
* This is an advanced use-case to define a token substitutable by a list of words without having the original token searchable
* default: ''
* default: {}
* https://github.com/algolia/algoliasearch-client-js#placeholders
*/
placeholders?: any;
placeholders?: {
[name: string]: string[],
};
/**
* List of attributes on which to do a decomposition of camel case words.
*
https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/
*/
camelCaseAttributes?: string[];
}
interface Response {

View File

@@ -3,13 +3,14 @@
// Definitions by: Baptiste Coquelle <https://github.com/cbaptiste>
// Haroen Viaene <https://github.com/haroenv>
// Aurélien Hervé <https://github.com/aherve>
// Samuel Vaillant <https://github.com/samouss>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare namespace algoliasearch {
/*
Interface for the algolia client object
*/
/**
* Interface for the algolia client object
*/
interface Client {
/**
* Initialization of the index
@@ -67,6 +68,7 @@ declare namespace algoliasearch {
* Interface for the index algolia object
*/
interface Index {
indexName: string;
/**
* Gets a specific object
* https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects
@@ -500,52 +502,6 @@ declare namespace algoliasearch {
userData?: string | object;
}
interface AlgoliaResponse {
/**
* Contains all the hits matching the query
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
hits: any[];
/**
* Current page
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
page: number;
/**
* Number of total hits matching the query
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
nbHits: number;
/**
* Number of pages
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
nbPage: number;
/**
* Number of hits per pages
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
hitsPerPage: number;
/**
* Engine processing time (excluding network transfer)
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
processingTimeMS: number;
/**
* Query used to perform the search
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
query: string;
/**
* GET parameters used to perform the search
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
params: string;
facets: {
[facetName: string]: { [facetValue: string]: number };
};
}
namespace SearchForFacetValues {
interface Parameters extends QueryParameters {
/**

View File

@@ -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();

111
types/allure-js-commons/index.d.ts vendored Normal file
View File

@@ -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;
}
}

View File

@@ -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"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

577
types/amazon-cognito-auth-js/index.d.ts vendored Normal file
View File

@@ -0,0 +1,577 @@
// Type definitions for amazon-cognito-auth-js 1.2
// Project: https://github.com/aws/amazon-cognito-auth-js
// Definitions by: Scott Escue <https://github.com/scottescue>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/*
* Create global variable to provide access to types when used without module
* loading.
*/
export as namespace AmazonCognitoIdentity;
// Stubs the XDomainRequest built-in from older IE browsers, does not follow the project's interface naming convention
export interface XDomainRequest {
readonly responseText: string;
timeout: number;
onprogress: () => void;
ontimeout: () => void;
onerror: () => void;
onload: () => void;
open(method: string, url: string): void;
send(data: string): void;
abort(): void;
}
export interface CognitoSessionData {
/**
* The session's Id token.
*/
IdToken?: CognitoIdToken;
/**
* The session's refresh token.
*/
RefreshToken?: CognitoRefreshToken;
/**
* The session's access token.
*/
AccessToken?: CognitoAccessToken;
/**
* The session's token scopes.
*/
TokenScopes?: CognitoTokenScopes;
/**
* The session's state.
*/
State?: string;
}
export interface CognitoAuthOptions {
/**
* Required: User pool application client id.
*/
ClientId: string;
/**
* Required: The application/user-pools Cognito web hostname,this is set at the Cognito console.
*/
AppWebDomain: string;
/**
* Optional: The token scopes
*/
TokenScopesArray?: ReadonlyArray<string>;
/**
* Required: Required: The redirect Uri, which will be launched after authentication as signed in.
*/
RedirectUriSignIn: string;
/**
* Required: The redirect Uri, which will be launched when signed out.
*/
RedirectUriSignOut: string;
/**
* Optional: Pre-selected identity provider (this allows to automatically trigger social provider authentication flow).
*/
IdentityProvider?: string;
/**
* Optional: UserPoolId for the configured cognito userPool.
*/
UserPoolId?: string;
/**
* Optional: boolean flag indicating if the data collection is enabled to support cognito advanced security features. By default, this flag is set to true.
*/
AdvancedSecurityDataCollectionFlag?: boolean;
}
export interface CognitoAuthUserHandler {
onSuccess: (authSession: CognitoAuthSession) => void;
onFailure: (err: any) => void;
}
export interface CognitoConstants {
DOMAIN_SCHEME: string;
DOMAIN_PATH_SIGNIN: string;
DOMAIN_PATH_TOKEN: string;
DOMAIN_PATH_SIGNOUT: string;
DOMAIN_QUERY_PARAM_REDIRECT_URI: string;
DOMAIN_QUERY_PARAM_SIGNOUT_URI: string;
DOMAIN_QUERY_PARAM_RESPONSE_TYPE: string;
DOMAIN_QUERY_PARAM_IDENTITY_PROVIDER: string;
DOMAIN_QUERY_PARAM_USERCONTEXTDATA: string;
CLIENT_ID: string;
STATE: string;
SCOPE: string;
TOKEN: string;
CODE: string;
POST: string;
PARAMETERERROR: string;
SCOPETYPEERROR: string;
QUESTIONMARK: string;
POUNDSIGN: string;
COLONDOUBLESLASH: string;
SLASH: string;
AMPERSAND: string;
EQUALSIGN: string;
SPACE: string;
CONTENTTYPE: string;
CONTENTTYPEVALUE: string;
AUTHORIZATIONCODE: string;
IDTOKEN: string;
ACCESSTOKEN: string;
REFRESHTOKEN: string;
ERROR: string;
ERROR_DESCRIPTION: string;
STRINGTYPE: string;
STATELENGTH: number;
STATEORIGINSTRING: string;
WITHCREDENTIALS: string;
UNDEFINED: string;
SELF: string;
HOSTNAMEREGEX: RegExp;
QUERYPARAMETERREGEX1: RegExp;
QUERYPARAMETERREGEX2: RegExp;
HEADER: { 'Content-Type': string };
}
export class CognitoIdToken {
/**
* Constructs a new CognitoIdToken object
* @param IdToken The JWT Id token
*/
constructor(IdToken: string);
/**
* @returns the record's token.
*/
getJwtToken(): string;
/**
* Sets new value for id token.
* @param idToken The JWT Id token
*/
setJwtToken(idToken: string): void;
/**
* @returns the token's expiration (exp member).
*/
getExpiration(): number;
/**
* @returns the token's payload.
*/
decodePayload(): object;
}
export class CognitoRefreshToken {
/**
* Constructs a new CognitoRefreshToken object
* @param RefreshToken The JWT refresh token.
*/
constructor(RefreshToken: string);
/**
* @returns the record's token.
*/
getToken(): string;
/**
* Sets new value for refresh token.
* @param refreshToken The JWT refresh token.
*/
setToken(refreshToken: string): void;
}
export class CognitoAccessToken {
/**
* Constructs a new CognitoAccessToken object
* @param AccessToken The JWT access token.
*/
constructor(AccessToken: string);
/**
* @returns the record's token.
*/
getJwtToken(): string;
/**
* Sets new value for access token.
* @param accessToken The JWT access token.
*/
setJwtToken(accessToken: string): void;
/**
* @returns the token's expiration (exp member).
*/
getExpiration(): number;
/**
* @returns the username from payload.
*/
getUsername(): string;
/**
* @returns the token's payload.
*/
decodePayload(): object;
}
export class CognitoTokenScopes {
/**
* Constructs a new CognitoTokenScopes object
* @param TokenScopesArray The token scopes
*/
constructor(TokenScopesArray: ReadonlyArray<string>);
/**
* @returns the token scopes.
*/
getScopes(): string[];
/**
* Sets new value for token scopes.
* @param tokenScopes The token scopes
*/
setTokenScopes(tokenScopes: ReadonlyArray<string>): void;
}
export class CognitoAuthSession {
/**
* Constructs a new CognitoUserSession object
* @param sessionData The session's tokens, scopes, and state.
*/
constructor(sessionData: CognitoSessionData);
/**
* @returns the session's Id token
*/
getIdToken(): CognitoIdToken;
/**
* Set a new Id token
* @param IdToken The session's Id token.
*/
setIdToken(IdToken: CognitoIdToken): void;
/**
* @returns the session's refresh token
*/
getRefreshToken(): CognitoRefreshToken;
/**
* Set a new Refresh token
* @param RefreshToken The session's refresh token.
*/
setRefreshToken(RefreshToken: CognitoRefreshToken): void;
/**
* @returns the session's access token
*/
getAccessToken(): CognitoAccessToken;
/**
* Set a new Access token
* @param AccessToken The session's access token.
*/
setAccessToken(AccessToken: CognitoAccessToken): void;
/**
* @returns the session's token scopes
*/
getTokenScopes(): CognitoTokenScopes;
/**
* Set new token scopes
* @param tokenScopes The session's token scopes.
*/
setTokenScopes(tokenScopes: CognitoTokenScopes): void;
/**
* @returns the session's state
*/
getState(): string;
/**
* Set new state
* @param state The session's state.
*/
setState(State: string): void;
/**
* Checks to see if the session is still valid based on session expiry information found
* in Access and Id Tokens and the current time
* @returns if the session is still valid
*/
isValid(): boolean;
}
export class CognitoAuth {
/**
* Called on success or error.
*/
userhandler: CognitoAuthUserHandler;
/**
* Constructs a new CognitoAuth object
* @param options Creation options
*/
constructor(options: CognitoAuthOptions);
/**
* @returns the constants
*/
getCognitoConstants(): CognitoConstants;
/**
* @returns the client id
*/
getClientId(): string;
/**
* @returns the app web domain
*/
getAppWebDomain(): string;
/**
* method for getting the current user of the application from the local storage
*
* @returns the user retrieved from storage
*/
getCurrentUser(): string;
/**
* method for setting the current user's name
* @param Username the user's name
*/
setUser(Username: string): void;
/**
* sets response type to 'code'
*/
useCodeGrantFlow(): void;
/**
* sets response type to 'token'
*/
useImplicitFlow(): void;
/**
* @returns the current session for this user
*/
getSignInUserSession(): CognitoAuthSession;
/**
* @returns the user's username
*/
getUsername(): string;
/**
* @param Username the user's username
*/
setUsername(Username: string): void;
/**
* @returns the user's state
*/
getState(): string;
/**
* @param State the user's state
*/
setState(State: string): void;
/**
* This is used to get a session, either from the session object or from the local storage, or by using a refresh token
* @param RedirectUriSignIn Required: The redirect Uri, which will be launched after authentication.
* @param TokenScopesArray Required: The token scopes, it is an array of strings specifying all scopes for the tokens.
*/
getSession(): void;
/**
* Parse the http request response and proceed according to different response types.
* @param httpRequestResponse the http request response
*/
parseCognitoWebResponse(httpRequestResponse: string): void;
/**
* Get the query parameter map and proceed according to code response type.
* @param Query parameter map
*/
getCodeQueryParameter(map: ReadonlyMap<string, string>): void;
/**
* Get the query parameter map and proceed according to token response type.
* @param Query parameter map
*/
getTokenQueryParameter(map: ReadonlyMap<string, string>): void;
/**
* Get cached tokens and scopes and return a new session using all the cached data.
* @returns the auth session
*/
getCachedSession(): CognitoAuthSession;
/**
* This is used to get last signed in user from local storage
* @returns the last user name
*/
getLastUser(): string;
/**
* This is used to save the session tokens and scopes to local storage.
*/
cacheTokensScopes(): void;
/**
* Compare two sets if they are identical.
* @param set1 one set
* @param set2 the other set
* @returns boolean value is true if two sets are identical
*/
compareSets(set1: ReadonlySet<any>, set2: ReadonlySet<any>): boolean;
/**
* Get the hostname from url.
* @param url the url string
* @returns hostname string
*/
getHostName(url: string): string;
/**
* Get http query parameters and return them as a map.
* @param url the url string
* @param splitMark query parameters split mark (prefix)
* @returns map
*/
getQueryParameters(url: string, splitMark: string): Map<string, string>;
/**
* helper function to generate a random string
* @param length the length of string
* @param chars a original string
* @returns a random value.
*/
generateRandomString(length: number, chars: string): string;
/**
* This is used to clear the session tokens and scopes from local storage
*/
clearCachedTokensScopes(): void;
/**
* This is used to build a user session from tokens retrieved in the authentication result
* @param refreshToken Successful auth response from server.
*/
refreshSession(refreshToken: string): void;
/**
* Make the http POST request.
* @param header header JSON object
* @param body body JSON object
* @param url string
* @param onSuccess callback
* @param onFailure callback
*/
makePOSTRequest(header: object, body: object, url: string,
onSuccess: (responseText: string) => void,
onFailure: (responseText: string) => void): void;
/**
* Create the XHR object
* @param method which method to call
* @param url the url string
* @returns xhr
*/
createCORSRequest(method: string, url: string): XMLHttpRequest | XDomainRequest;
/**
* The http POST request onFailure callback.
* @param err the error object
*/
onFailure(err: any): void;
/**
* The http POST request onSuccess callback when refreshing tokens.
* @param jsonData tokens
*/
onSuccessRefreshToken(jsonData: string): void;
/**
* The http POST request onSuccess callback when exchanging code for tokens.
* @param jsonData tokens
*/
onSuccessExchangeForToken(jsonData: string): void;
/**
* Launch Cognito Auth UI page.
* @param URL the url to launch
*/
launchUri(URL: string): void;
/**
* @returns scopes string
*/
getSpaceSeperatedScopeString(): string;
/**
* Create the FQDN(fully qualified domain name) for authorization endpoint.
* @returns url
*/
getFQDNSignIn(): string;
/**
* Sign out the user.
*/
signOut(): void;
/**
* Create the FQDN(fully qualified domain name) for signout endpoint.
* @returns url
*/
getFQDNSignOut(): string;
/**
* This method returns the encoded data string used for cognito advanced security feature.
* This would be generated only when developer has included the JS used for collecting the
* data on their client. Please refer to documentation to know more about using AdvancedSecurity
* features
*/
getUserContextData(): string;
/**
* Helper method to let the user know if he has either a valid cached session
* or a valid authenticated session from the app integration callback.
* @returns userSignedIn
*/
isUserSignedIn(): boolean;
}
export class DateHelper {
/**
* @returns The current time in "ddd MMM D HH:mm:ss UTC YYYY" format.
*/
getNowString(): string;
}
export class StorageHelper {
/**
* This is used to get a storage object
* @returns the storage
*/
constructor();
/**
* This is used to return the storage
* @returns the storage
*/
getStorage(): Storage;
}

View File

@@ -0,0 +1,162 @@
import * as lib from 'amazon-cognito-auth-js';
const idToken: lib.CognitoIdToken = new lib.CognitoIdToken('fak3T0ken1==');
idToken.decodePayload(); // $ExpectType object
idToken.setJwtToken('fak3T0ken2=='); // $ExpectType void
idToken.getJwtToken(); // $ExpectType string
idToken.getExpiration(); // $ExpectType number
const refreshToken: lib.CognitoRefreshToken = new lib.CognitoRefreshToken('refreshplease==');
refreshToken.setToken('refreshagainplease=='); // $ExpectType void
refreshToken.getToken(); // $ExpectType string
const accessToken: lib.CognitoAccessToken = new lib.CognitoAccessToken('fak3T0ken3==');
accessToken.decodePayload(); // $ExpectType object
accessToken.setJwtToken('fak3T0ken4=='); // $ExpectType void
accessToken.getJwtToken(); // $ExpectType string
accessToken.getExpiration(); // $ExpectType number
accessToken.getUsername(); // $ExpectType string
const tokenScopes: lib.CognitoTokenScopes = new lib.CognitoTokenScopes(['email', 'custom1']);
tokenScopes.setTokenScopes(['openid']); // $ExpectType void
tokenScopes.getScopes(); // $ExpectType string[]
let sessionData: lib.CognitoSessionData = {};
let authSession: lib.CognitoAuthSession = new lib.CognitoAuthSession(sessionData);
sessionData = {
IdToken: idToken,
RefreshToken: refreshToken,
AccessToken: accessToken,
TokenScopes: tokenScopes,
State: '/myapp/home'
};
authSession = new lib.CognitoAuthSession(sessionData);
authSession.setIdToken(new lib.CognitoIdToken('fak3T0ken5==')); // $ExpectType void
authSession.setRefreshToken(new lib.CognitoRefreshToken('refreshmeyetagain==')); // $ExpectType void
authSession.setAccessToken(new lib.CognitoAccessToken('fak3T0ken6==')); // $ExpectType void
authSession.setTokenScopes(new lib.CognitoTokenScopes(['email'])); // $ExpectType void
authSession.setState('/myapp/login'); // $ExpectType void
authSession.getIdToken(); // $ExpectType CognitoIdToken
authSession.getRefreshToken(); // $ExpectType CognitoRefreshToken
authSession.getAccessToken(); // $ExpectType CognitoAccessToken
authSession.getTokenScopes(); // $ExpectType CognitoTokenScopes
authSession.getState(); // $ExpectType string
let authOptions: lib.CognitoAuthOptions = {
ClientId: '1a2b3c4d5e6f7g',
AppWebDomain: 'myapp.auth.us-east-1.amazoncognito.com',
RedirectUriSignIn: 'https://myapp.com/login',
RedirectUriSignOut: 'https://myapp.com/logout'
};
let auth: lib.CognitoAuth = new lib.CognitoAuth(authOptions);
authOptions = {
ClientId: '1a2b3c4d5e6f7g',
AppWebDomain: 'myapp.auth.us-east-1.amazoncognito.com',
TokenScopesArray: ['email', 'openid'],
RedirectUriSignIn: 'https://myapp.com/login',
RedirectUriSignOut: 'https://myapp.com/logout',
IdentityProvider: 'Facebook',
UserPoolId: 'us-east-1_faKE4ReAl',
AdvancedSecurityDataCollectionFlag: true
};
auth = new lib.CognitoAuth(authOptions);
auth.getClientId(); // $ExpectType string
auth.getAppWebDomain(); // $ExpectType string
auth.getCurrentUser(); // $ExpectType string
auth.setUser('jane.doe'); // $ExpectType void
auth.useCodeGrantFlow(); // $ExpectType void
auth.useImplicitFlow(); // $ExpectType void
auth.getSignInUserSession(); // $ExpectType CognitoAuthSession
auth.getUsername(); // $ExpectType string
auth.setUsername('john.doe'); // $ExpectType void
auth.getState(); // $ExpectType string
auth.setState('/myhost/default.htm'); // $ExpectType void
auth.getSession(); // $ExpectType void
auth.parseCognitoWebResponse('url&stuff=true'); // $ExpectType void
auth.getCodeQueryParameter(new Map()); // $ExpectType void
auth.getTokenQueryParameter(new Map()); // $ExpectType void
auth.getCachedSession(); // $ExpectType CognitoAuthSession
auth.getLastUser(); // $ExpectType string
auth.cacheTokensScopes(); // $ExpectType void
auth.compareSets(new Set(['1']), new Set(['1'])); // $ExpectType boolean
auth.getHostName('https://site.com/page?size=10'); // $ExpectType string
auth.getQueryParameters('http://site.com?1=1&2=2', '?'); // $ExpectType Map<string, string>
auth.generateRandomString(5, '159erf'); // $ExpectType string
auth.clearCachedTokensScopes(); // $ExpectType void
auth.refreshSession('refreshToken=='); // $ExpectType void
// $ExpectType void
auth.makePOSTRequest({ 'Content-Type': 'application/json' }, { pool: '2' },
'https://auth.com/signin',
(data) => console.log(data),
(error) => console.log(error));
auth.createCORSRequest('POST', '/myapp/login'); // $ExpectType XMLHttpRequest | XDomainRequest
auth.onFailure('request failed'); // $ExpectType void
auth.onSuccessRefreshToken('{"name":"John", "age":31}'); // $ExpectType void
auth.onSuccessExchangeForToken('{"name":"Jane", "age":30}'); // $ExpectType void
auth.launchUri('https://auth.com/login'); // $ExpectType void
auth.getSpaceSeperatedScopeString(); // $ExpectType string
auth.getFQDNSignIn(); // $ExpectType string
auth.signOut(); // $ExpectType void
auth.getFQDNSignOut(); // $ExpectType string
auth.getUserContextData(); // $ExpectType string
auth.isUserSignedIn(); // $ExpectType boolean
const userHandler: lib.CognitoAuthUserHandler = {
onSuccess: (authSession: lib.CognitoAuthSession) => console.log(authSession),
onFailure: (error: any) => console.log(error)
};
auth.userhandler = userHandler;
const constants: lib.CognitoConstants = auth.getCognitoConstants();
constants.DOMAIN_SCHEME; // $ExpectType string
constants.DOMAIN_PATH_SIGNIN; // $ExpectType string
constants.DOMAIN_PATH_TOKEN; // $ExpectType string
constants.DOMAIN_PATH_SIGNOUT; // $ExpectType string
constants.DOMAIN_QUERY_PARAM_REDIRECT_URI; // $ExpectType string
constants.DOMAIN_QUERY_PARAM_SIGNOUT_URI; // $ExpectType string
constants.DOMAIN_QUERY_PARAM_RESPONSE_TYPE; // $ExpectType string
constants.DOMAIN_QUERY_PARAM_IDENTITY_PROVIDER; // $ExpectType string
constants.DOMAIN_QUERY_PARAM_USERCONTEXTDATA; // $ExpectType string
constants.CLIENT_ID; // $ExpectType string
constants.STATE; // $ExpectType string
constants.SCOPE; // $ExpectType string
constants.TOKEN; // $ExpectType string
constants.CODE; // $ExpectType string
constants.POST; // $ExpectType string
constants.PARAMETERERROR; // $ExpectType string
constants.SCOPETYPEERROR; // $ExpectType string
constants.QUESTIONMARK; // $ExpectType string
constants.POUNDSIGN; // $ExpectType string
constants.COLONDOUBLESLASH; // $ExpectType string
constants.SLASH; // $ExpectType string
constants.AMPERSAND; // $ExpectType string
constants.EQUALSIGN; // $ExpectType string
constants.SPACE; // $ExpectType string
constants.CONTENTTYPE; // $ExpectType string
constants.CONTENTTYPEVALUE; // $ExpectType string
constants.AUTHORIZATIONCODE; // $ExpectType string
constants.IDTOKEN; // $ExpectType string
constants.ACCESSTOKEN; // $ExpectType string
constants.REFRESHTOKEN; // $ExpectType string
constants.ERROR; // $ExpectType string
constants.ERROR_DESCRIPTION; // $ExpectType string
constants.STRINGTYPE; // $ExpectType string
constants.STATELENGTH; // $ExpectType number
constants.STATEORIGINSTRING; // $ExpectType string
constants.WITHCREDENTIALS; // $ExpectType string
constants.UNDEFINED; // $ExpectType string
constants.SELF; // $ExpectType string
constants.HOSTNAMEREGEX; // $ExpectType RegExp
constants.QUERYPARAMETERREGEX1; // $ExpectType RegExp
constants.QUERYPARAMETERREGEX2; // $ExpectType RegExp
constants.HEADER['Content-Type']; // $ExpectType string
const dateHelper: lib.DateHelper = new lib.DateHelper();
dateHelper.getNowString(); // $ExpectType string
const storageHelper: lib.StorageHelper = new lib.StorageHelper();
storageHelper.getStorage(); // $ExpectType Storage

View File

@@ -0,0 +1,22 @@
AmazonCognitoIdentity.CognitoIdToken; // $ExpectType typeof CognitoIdToken
AmazonCognitoIdentity.CognitoRefreshToken; // $ExpectType typeof CognitoRefreshToken
AmazonCognitoIdentity.CognitoAccessToken; // $ExpectType typeof CognitoAccessToken
AmazonCognitoIdentity.CognitoTokenScopes; // $ExpectType typeof CognitoTokenScopes
AmazonCognitoIdentity.CognitoAuthSession; // $ExpectType typeof CognitoAuthSession
AmazonCognitoIdentity.CognitoAuth; // $ExpectType typeof CognitoAuth
AmazonCognitoIdentity.DateHelper; // $ExpectType typeof DateHelper
AmazonCognitoIdentity.StorageHelper; // $ExpectType typeof StorageHelper
const sessionData: AmazonCognitoIdentity.CognitoSessionData = {};
new AmazonCognitoIdentity.CognitoAuthSession(sessionData);
const authOptions: AmazonCognitoIdentity.CognitoAuthOptions = {
ClientId: '1a2b3c4d5e6f7g',
AppWebDomain: 'myapp.auth.us-east-1.amazoncognito.com',
RedirectUriSignIn: 'https://myapp.com/login',
RedirectUriSignOut: 'https://myapp.com/logout'
};
const auth = new AmazonCognitoIdentity.CognitoAuth(authOptions);
auth.userhandler; // $ExpectType CognitoAuthUserHandler
auth.getCognitoConstants(); // $ExpectType CognitoConstants
auth.createCORSRequest('', ''); // $ExpectType XMLHttpRequest | XDomainRequest

View File

@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"dom",
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"test/amazon-cognito-auth-js-tests.ts",
"test/amazon-cognito-auth-js-umd-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -33,6 +33,8 @@ interface IItemLookupOptions {
searchIndex?: string;
truncateReviewsAt?: number;
variationPage?: string;
domain?: string;
request?: Function;
}
interface IBrowseNodeLookupOptions {

View File

@@ -20,8 +20,11 @@ declare module 'angular' {
interface IAnimateCallbackObject {
eventFn?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
beforeSetClass?: (element: JQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
setClass?: (element: JQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
beforeAddClass?: (element: JQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
addClass?: (element: JQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
beforeRemoveClass?: (element: JQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
removeClass?: (element: JQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
enter?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
leave?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;

View File

@@ -101,7 +101,7 @@ declare module 'angular' {
* Note: This property is not currently supported in any browser.
* Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/vibrate
*/
vibrate?: boolean;
vibrate?: any;
/**
* The onclick property of the Notification interface specifies an event listener to receive click events.

View File

@@ -97,7 +97,7 @@ declare module 'angular' {
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindings?: any): T;
<T>(controllerConstructor: Function, locals?: any, bindings?: any): T;
<T>(controllerConstructor: (...args: any[]) => T, locals?: any, bindings?: any): T;
<T>(controllerName: string, locals?: any, bindings?: any): T;
}

Some files were not shown because too many files have changed in this diff Show More