diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1fc8897d23..4338219f31 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,25 +1,23 @@ Please fill in this template. -- [ ] Make your PR against the `master` branch. - [ ] Use a meaningful title for the pull request. Include the name of the package modified. - [ ] Test the change in your own code. (Compile and run.) - [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). -- [ ] Run `tsc` without errors. -- [ ] Run `npm run lint package-name` if a `tslint.json` is present. +- [ ] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). Select one of these and delete the others: If adding a new definition: - [ ] The package does not provide its own types, and you can not add them. - [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package. -- [ ] Create it with `npm run new-package package-name`, not by basing it on an existing project. +- [ ] Create it with `dts-gen --dt`, not by basing it on an existing project. - [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, and `strictNullChecks` set to `true`. If changing an existing definition: - [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <> - [ ] Increase the version number in the header if appropriate. -- [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "../tslint.json" }`. +- [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dslint/dt.json" }`. If removing a declaration: - [ ] If a package was never on DefinitelyTyped, you don't need to do anything. (If you wrote a package and provided types, you don't need to register it with us.) diff --git a/README.md b/README.md index 9dbb809b57..9f3c4fe78f 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,9 @@ Add to your `tsconfig.json`: Create `types/foo/index.d.ts` containing declarations for the module "foo". You should now be able import from `"foo"` in your code and it will route to the new type definition. Then build *and* run the code to make sure your type definition actually corresponds to what happens at runtime. -Once you've tested your definitions with real code, make a PR contributing the definition by copying `types/foo` to `DefinitelyTyped/foo` and adding a `tsconfig.json` and `foo-tests.ts`. +Once you've tested your definitions with real code, make a [PR](#make-a-pull-request) +then follow the instructions to [edit an existing package](#edit-an-existing-package) or +[create a new package](#create-a-new-package). ### Make a pull request @@ -83,10 +85,17 @@ First, [fork](https://guides.github.com/activities/forking/) this repository, in #### Edit an existing package -* `cd my-package-to-edit` +* `cd types/my-package-to-edit` * Make changes. Remember to edit tests. * You may also want to add yourself to "Definitions by" section of the package header. - Do this by adding your name to the end of the line, as in `// Definitions by: Alice , Bob `. + - Or if there are more people, it can be multiline + ```typescript + // Definitions by: Alice + // Bob + // Steve + // John + ``` * `npm install -g typescript@2.0` and run `tsc`. When you make a PR to edit an existing package, `dt-bot` should @-mention previous authors. @@ -110,9 +119,8 @@ 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 run new-package -- --name my-package-name --template module`. -(Other templates are `module-class`, `module-function`, `module-plugin`, `global`, `global-plugin`, and `global-modifying-module`. -This just wraps [dts-gen](https://github.com/Microsoft/dts-gen), so it supports all options from that.) +Generate these by running `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --template module`. +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. @@ -154,22 +162,24 @@ If a package was never on DefinitelyTyped, it does not need to be added to `notN #### Lint -To lint a package, just add a `tslint.json` to that package containing `{ "extends": "../tslint.json" }`. All new packages must be linted. +To lint a package, just add a `tslint.json` to that package containing `{ "extends": "dtslint/dt.json" }`. All new packages must be linted. If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example: ```js { - "extends": "../tslint.json", + "extends": "dtslint/dt.json", "rules": { // This package uses the Function type, and it will take effort to fix. - "forbidden-types": false + "ban-types": false } } ``` -(To indicate that a lint rule truly does not apply, use `// tslint:disable:rule-name` or better, `//tslint:disable-next-line:rule-name`.) +(To indicate that a lint rule truly does not apply, use `// tslint:disable rule-name` or better, `//tslint:disable-next-line rule-name`.) + +Test by running `npm run lint package-name` where `package-name` is the name of your package. +This script uses [dtslint](https://github.com/Microsoft/dtslint). -Test the linter by running `npm run lint -- package-name`. Do not use a globally installed tslint. ## FAQ @@ -183,11 +193,6 @@ This usually happens within an hour of changes being merged. If the module you're referencing is an external module (uses `export`), use an import. If the module you're referencing is an ambient module (uses `declare module`, or just declares globals), use ``. -#### What do I do about older versions of typings? - -Currently we don't support this, though it is [planned](https://github.com/Microsoft/types-publisher/issues/3). -If you're adding a new major version of a library, you can copy `index.d.ts` to `foo-v2.3.d.ts` and edit `index.d.ts` to be the new version. - #### I notice some packages having a `package.json` here. Usually you won't need this. When publishing a package we will normally automatically create a `package.json` for it. @@ -213,7 +218,7 @@ If default imports work in your environment, consider turning on the [`--allowSy Do not change the type definition if it is accurate. For an NPM package, `export =` is accurate if `node -p 'require("foo")'` is the export, and `export default` is accurate if `node -p 'require("foo").default'` is the export. -#### I want to use features from TypeScript 2.1. +#### I want to use features from TypeScript 2.1 or above. Then you will have to add a comment to the last line of your definition header (after `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`): `// TypeScript Version: 2.1`. @@ -255,6 +260,11 @@ transitively `react-router-bootstrap` (which depends on `react-router`) also add Also, `/// ` will not work with path mapping, so dependencies must use `import`. +#### What about scoped packages? + +Types for a scoped package `@foo/bar` should go in `types/foo__bar`. Note the double underscore. + + #### The file history in GitHub looks incomplete. GitHub doesn't [support](http://stackoverflow.com/questions/5646174/how-to-make-github-follow-directory-history-after-renames) file history for renamed files. Use [`git log --follow`](https://www.git-scm.com/docs/git-log) instead. diff --git a/notNeededPackages.json b/notNeededPackages.json index 90a63f066e..ca42f4d9f5 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -12,18 +12,54 @@ "sourceRepoURL": "https://github.com/ant-design/ant-design", "asOfVersion": "1.0.0" }, + { + "libraryName": "anydb-sql", + "typingsPackageName": "anydb-sql", + "sourceRepoURL": "https://github.com/doxout/anydb-sql", + "asOfVersion": "0.6.46" + }, { "libraryName": "Argon2", "typingsPackageName": "argon2", "sourceRepoURL": "https://github.com/ranisalt/node-argon2", "asOfVersion": "0.15.0" }, + { + "libraryName": "aws-sdk", + "typingsPackageName": "aws-sdk", + "sourceRepoURL": "https://github.com/aws/aws-sdk-js", + "asOfVersion": "2.7.0" + }, + { + "libraryName": "axe-core", + "typingsPackageName": "axe-core", + "sourceRepoURL": "https://github.com/dequelabs/axe-core", + "asOfVersion": "2.0.7" + }, { "libraryName": "axios", "typingsPackageName": "axios", "sourceRepoURL": "https://github.com/mzabriskie/axios", "asOfVersion": "0.14.0" }, + { + "libraryName": "azure-mobile-apps", + "typingsPackageName": "azure-mobile-apps", + "sourceRepoURL": "https://github.com/Azure/azure-mobile-apps-node/", + "asOfVersion": "3.0.0" + }, + { + "libraryName": "BabylonJS", + "typingsPackageName": "babylonjs", + "sourceRepoURL": "http://www.babylonjs.com/", + "asOfVersion": "2.4.1" + }, + { + "libraryName": "Bugsnag Browser", + "typingsPackageName": "bugsnag-js", + "sourceRepoURL": "https://github.com/bugsnag/bugsnag-js", + "asOfVersion": "3.1.0" + }, { "libraryName": "camel-case", "typingsPackageName": "camel-case", @@ -36,6 +72,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/change-case", "asOfVersion": "2.3.1" }, + { + "libraryName": "cheap-ruler", + "typingsPackageName": "cheap-ruler", + "sourceRepoURL": "https://github.com/mapbox/cheap-ruler", + "asOfVersion": "2.5.0" + }, { "libraryName": "constant-case", "typingsPackageName": "constant-case", @@ -48,6 +90,12 @@ "sourceRepoURL": "https://github.com/date-fns/date-fns", "asOfVersion": "2.6.0" }, + { + "libraryName": "DevExtreme", + "typingsPackageName": "devextreme", + "sourceRepoURL": "http://js.devexpress.com/", + "asOfVersion": "16.2.1" + }, { "libraryName": "Dexie.js", "typingsPackageName": "dexie", @@ -72,6 +120,30 @@ "sourceRepoURL": "https://github.com/bterlson/ecmarkup", "asOfVersion": "3.4.0" }, + { + "libraryName": "electron-builder", + "typingsPackageName": "electron-builder", + "sourceRepoURL": "https://github.com/loopline-systems/electron-builder", + "asOfVersion": "2.8.0" + }, + { + "libraryName": "EventEmitter3", + "typingsPackageName": "eventemitter3", + "sourceRepoURL": "https://github.com/primus/eventemitter3", + "asOfVersion": "2.0.2" + }, + { + "libraryName": "JSON-Patch", + "typingsPackageName": "fast-json-patch", + "sourceRepoURL": "https://github.com/Starcounter-Jack/JSON-Patch", + "asOfVersion": "1.1.5" + }, + { + "libraryName": "FastSimplexNoise", + "typingsPackageName": "fast-simplex-noise", + "sourceRepoURL": "https://www.npmjs.com/package/fast-simplex-noise", + "asOfVersion": "3.0.0" + }, { "libraryName": "FineUploader", "typingsPackageName": "fine-uploader", @@ -84,6 +156,18 @@ "sourceRepoURL": "https://github.com/ascoders/gaea-model", "asOfVersion": "0.0.0" }, + { + "libraryName": "github", + "typingsPackageName": "github", + "sourceRepoURL": "https://github.com/mikedeboer/node-github", + "asOfVersion": "7.1.0" + }, + { + "libraryName": "gulp-typescript", + "typingsPackageName": "gulp-typescript", + "sourceRepoURL": "https://github.com/ivogabe/gulp-typescript", + "asOfVersion": "2.13.0" + }, { "libraryName": "Facebook's Immutable", "typingsPackageName": "immutable", @@ -138,12 +222,30 @@ "sourceRepoURL": "https://github.com/blakeembrey/is-upper-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "JSNLog", + "typingsPackageName": "jsnlog", + "sourceRepoURL": "https://github.com/mperdeck/jsnlog.js", + "asOfVersion": "2.17.2" + }, { "libraryName": "jsonschema", "typingsPackageName": "jsonschema", "sourceRepoURL": "https://github.com/tdegrunt/jsonschema", "asOfVersion": "1.1.1" }, + { + "libraryName": "knockout-paging", + "typingsPackageName": "knockout-paging", + "sourceRepoURL": "https://github.com/ErikSchierboom/knockout-paging", + "asOfVersion": "0.3.1" + }, + { + "libraryName": "knockout-pre-rendered", + "typingsPackageName": "knockout-pre-rendered", + "sourceRepoURL": "https://github.com/ErikSchierboom/knockout-pre-rendered", + "asOfVersion": "0.7.1" + }, { "libraryName": "Linq.JS", "typingsPackageName": "linq", @@ -157,10 +259,10 @@ "asOfVersion": "1.0.0" }, { - "libraryName": "localforage", - "typingsPackageName": "localforage", - "sourceRepoURL": "https://github.com/localForage/localForage", - "asOfVersion": "0.0.34" + "libraryName": "localforage", + "typingsPackageName": "localforage", + "sourceRepoURL": "https://github.com/localForage/localForage", + "asOfVersion": "0.0.34" }, { "libraryName": "lower-case", @@ -174,12 +276,30 @@ "sourceRepoURL": "https://github.com/blakeembrey/lower-case-first", "asOfVersion": "1.0.1" }, + { + "libraryName": "maquette", + "typingsPackageName": "maquette", + "sourceRepoURL": "http://maquettejs.org/", + "asOfVersion": "2.1.6" + }, + { + "libraryName": "mendixmodelsdk", + "typingsPackageName": "mendixmodelsdk", + "sourceRepoURL": "http://www.mendix.com", + "asOfVersion": "0.8.1" + }, { "libraryName": "mobservable", "typingsPackageName": "mobservable", "sourceRepoURL": "github.com/mweststrate/mobservable", "asOfVersion": "1.2.5" }, + { + "libraryName": "mobservable-react", + "typingsPackageName": "mobservable-react", + "sourceRepoURL": "https://github.com/mweststrate/mobservable-react", + "asOfVersion": "1.0.0" + }, { "libraryName": "Moment", "typingsPackageName": "moment", @@ -204,12 +324,24 @@ "sourceRepoURL": "https://github.com/foretagsplatsen/numbro/", "asOfVersion": "1.9.3" }, + { + "libraryName": "Onsen UI", + "typingsPackageName": "onsenui", + "sourceRepoURL": "http://onsen.io", + "asOfVersion": "2.0.0" + }, { "libraryName": "param-case", "typingsPackageName": "param-case", "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", @@ -222,12 +354,30 @@ "sourceRepoURL": "https://github.com/blakeembrey/path-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "path-to-regexp", + "typingsPackageName": "path-to-regexp", + "sourceRepoURL": "https://github.com/pillarjs/path-to-regexp", + "asOfVersion": "1.7.0" + }, + { + "libraryName": "pg-promise", + "typingsPackageName": "pg-promise", + "sourceRepoURL": "https://github.com/vitaly-t/pg-promise", + "asOfVersion": "5.4.3" + }, { "libraryName": "pixi-spine", "typingsPackageName": "pixi-spine", "sourceRepoURL": "https://github.com/pixijs/pixi-spine", "asOfVersion": "1.4.2" }, + { + "libraryName": "pkcs11js", + "typingsPackageName": "pkcs11js", + "sourceRepoURL": "https://github.com/PeculiarVentures/pkcs11js", + "asOfVersion": "1.0.4" + }, { "libraryName": "poly2tri.js", "typingsPackageName": "poly2tri", @@ -258,6 +408,12 @@ "sourceRepoURL": "https://github.com/reactjs/redux", "asOfVersion": "3.6.0" }, + { + "libraryName": "redux-batched-actions", + "typingsPackageName": "redux-batched-actions", + "sourceRepoURL": "https://github.com/tshelburne/redux-batched-actions", + "asOfVersion": "0.1.5" + }, { "libraryName": "redux-persist", "typingsPackageName": "redux-persist", @@ -282,12 +438,36 @@ "sourceRepoURL": "https://github.com/gaearon/redux-thunk", "asOfVersion": "2.1.0" }, + { + "libraryName": "reselect", + "typingsPackageName": "reselect", + "sourceRepoURL": "https://github.com/rackt/reselect", + "asOfVersion": "2.2.0" + }, + { + "libraryName": "rest-io", + "typingsPackageName": "rest-io", + "sourceRepoURL": "https://github.com/EnoF/rest-io", + "asOfVersion": "4.1.0" + }, + { + "libraryName": "route-recognizer", + "typingsPackageName": "route-recognizer", + "sourceRepoURL": "https://github.com/tildeio/route-recognizer", + "asOfVersion": "0.3.0" + }, { "libraryName": "node-scanf", "typingsPackageName": "scanf", "sourceRepoURL": "https://github.com/Lellansin/node-scanf", "asOfVersion": "0.7.3" }, + { + "libraryName": "sendgrid", + "typingsPackageName": "sendgrid", + "sourceRepoURL": "https://github.com/sendgrid/sendgrid-nodejs", + "asOfVersion": "4.3.0" + }, { "libraryName": "sentence-case", "typingsPackageName": "sentence-case", @@ -324,18 +504,42 @@ "sourceRepoURL": "https://github.com/andrewplummer/Sugar", "asOfVersion": "2.0.2" }, + { + "libraryName": "svg.js", + "typingsPackageName": "svg.js", + "sourceRepoURL": "http://www.svgjs.com/", + "asOfVersion": "2.3.1" + }, { "libraryName": "swap-case", "typingsPackageName": "swap-case", "sourceRepoURL": "https://github.com/blakeembrey/swap-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "Tabris.js", + "typingsPackageName": "tabris", + "sourceRepoURL": "http://tabrisjs.com", + "asOfVersion": "1.8.0" + }, + { + "libraryName": "tcomb", + "typingsPackageName": "tcomb", + "sourceRepoURL": "http://gcanti.github.io/tcomb/guide/index.html", + "asOfVersion": "2.6.0" + }, { "libraryName": "title-case", "typingsPackageName": "title-case", "sourceRepoURL": "https://github.com/blakeembrey/title-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "TsMonad", + "typingsPackageName": "tsmonad", + "sourceRepoURL": "https://github.com/cbowdon/TsMonad", + "asOfVersion": "0.5.0" + }, { "libraryName": "TypeScript", "typingsPackageName": "typescript", @@ -348,6 +552,12 @@ "sourceRepoURL": "https://github.com/Microsoft/TypeScript", "asOfVersion": "2.0.0" }, + { + "libraryName": "uk.co.workingedge.phonegap.plugin.istablet", + "typingsPackageName": "uk.co.workingedge.phonegap.plugin.istablet", + "sourceRepoURL": "https://github.com/dpa99c/phonegap-istablet", + "asOfVersion": "1.1.3" + }, { "libraryName": "upper-case", "typingsPackageName": "upper-case", @@ -360,6 +570,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/upper-case-first", "asOfVersion": "1.1.2" }, + { + "libraryName": "vso-node-api", + "typingsPackageName": "vso-node-api", + "sourceRepoURL": "https://github.com/Microsoft/vso-node-api", + "asOfVersion": "4.0.0" + }, { "libraryName": "vuejs", "typingsPackageName": "vue", @@ -372,17 +588,35 @@ "sourceRepoURL": "https://github.com/vuejs/vue-router", "asOfVersion": "2.0.0" }, + { + "libraryName": "webcola", + "typingsPackageName": "webcola", + "sourceRepoURL": "https://github.com/tgdwyer/WebCola", + "asOfVersion": "3.2.0" + }, { "libraryName": "x2js", "typingsPackageName": "x2js", "sourceRepoURL": "https://code.google.com/p/x2js/", "asOfVersion": "3.1.0" }, + { + "libraryName": "xml-js", + "typingsPackageName": "xml-js", + "sourceRepoURL": "https://github.com/nashwaan/xml-js", + "asOfVersion": "1.0.0" + }, { "libraryName": "@xmpp/jid", "typingsPackageName": "xmpp-jid", "sourceRepoURL": "github.com/node-xmpp/node-xmpp/", "asOfVersion": "1.2.0" + }, + { + "libraryName": "Zone.js", + "typingsPackageName": "zone.js", + "sourceRepoURL": "https://github.com/angular/zone.js", + "asOfVersion": "0.5.12" } ] } diff --git a/package.json b/package.json index 1dad46394d..1be6d06c89 100644 --- a/package.json +++ b/package.json @@ -12,17 +12,16 @@ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" }, "engines": { - "node": ">= 6.9.1" + "node": ">=7.8.0" }, "scripts": { "compile-scripts": "tsc -p scripts", - "new-package": "dts-gen --dt", "not-needed": "node scripts/not-needed.js", - "lint": "node scripts/lint.js", - "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1" + "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1", + "lint": "dtslint types" }, "devDependencies": { - "types-publisher": "Microsoft/types-publisher#production", - "dts-gen": "latest" + "dtslint": "Microsoft/dtslint#production", + "types-publisher": "Microsoft/types-publisher#production" } } diff --git a/scripts/fix-tslint.ts b/scripts/fix-tslint.ts index a54f4c7386..419ebcd0de 100644 --- a/scripts/fix-tslint.ts +++ b/scripts/fix-tslint.ts @@ -31,7 +31,7 @@ function fixTslint(dir: string): void { if (!fs.existsSync(target)) return; let json = JSON.parse(fs.readFileSync(target, 'utf-8')); json = fix(json); - const text = Object.keys(json).length === 1 ? '{ "extends": "../tslint.json" }' : JSON.stringify(json, undefined, 4); + const text = Object.keys(json).length === 1 ? '{ "extends": "dtslint/dt.json" }' : JSON.stringify(json, undefined, 4); fs.writeFileSync(target, text + "\n", "utf-8"); } diff --git a/scripts/lint.js b/scripts/lint.js deleted file mode 100644 index 84ef71259d..0000000000 --- a/scripts/lint.js +++ /dev/null @@ -1,25 +0,0 @@ -// Usage: npm run lint -- my-package-name -const pkg = process.argv[2]; -const execSync = require("child_process").execSync; -const existsSync = require("fs").existsSync; -const path = require("path"); - -const pkgPath = path.join("types", pkg); - -// Path of tslint when `types-publisher` is symlinked -const symlinkedTslintPath = "../../node_modules/types-publisher/node_modules/tslint" -let tslintPath = existsSync(path.join(pkgPath, symlinkedTslintPath)) ? symlinkedTslintPath : "../node_modules/tslint"; -// An older version (e.g. abs/v0) is in a nested directory, so needs to look one more level up for tslint. -if (pkg.includes("/") && pkg[pkg.length - 1] !== "/") { - tslintPath = path.join("..", tslintPath); -} - -const cmd = `node ${tslintPath}/lib/tslint-cli --format stylish "**/*.ts"`; -console.log(cmd); - -try { - // Child process writes directly to our own stdout - execSync(cmd, { cwd: pkgPath, stdio: "inherit" }); -} catch (_) { - // Process should have printed out error info -} diff --git a/scripts/not-needed.js b/scripts/not-needed.js index e17b3ac6ce..9a2360c72b 100644 --- a/scripts/not-needed.js +++ b/scripts/not-needed.js @@ -17,7 +17,7 @@ rmdirRecursive(path.join("types", typingsPackageName)); const notNeededPackages = JSON.parse(fs.readFileSync("notNeededPackages.json", "utf-8")); notNeededPackages.packages.push({ libraryName, typingsPackageName, sourceRepoURL, asOfVersion }); notNeededPackages.packages.sort((x, y) => x.typingsPackageName < y.typingsPackageName ? -1 : 1); -fs.writeFileSync("notNeededPackages.json", JSON.stringify(notNeededPackages, undefined, 4), "utf-8"); +fs.writeFileSync("notNeededPackages.json", JSON.stringify(notNeededPackages, undefined, 4) + "\n", "utf-8"); function rmdirRecursive(dir) { for (let entry of fs.readdirSync(dir)) { diff --git a/types/ably/ably-tests.ts b/types/ably/ably-tests.ts index 026ef48adc..bc50d03ce6 100644 --- a/types/ably/ably-tests.ts +++ b/types/ably/ably-tests.ts @@ -1,6 +1,6 @@ import * as Ably from 'ably'; -declare var console: { log(message: any): void }; +declare const console: { log(message: any): void }; const ApiKey = 'appId.keyId:secret'; const client = new Ably.Realtime(ApiKey); @@ -19,10 +19,9 @@ client.connection.on('failed', () => { // failed connection }); - // Subscribing to a channel -var channel = client.channels.get('test'); +const channel = client.channels.get('test'); channel.subscribe(message => { message.name; // 'greeting' message.data; // 'Hello World!' @@ -68,7 +67,6 @@ channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direct console.log(messagesPage.items.length); }); - // Presence on a channel // Getting presence: @@ -118,7 +116,7 @@ channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direct // Generate a random 256-bit key for demonstration purposes (in // practice you need to create one and distribute it to clients yourselves) Ably.Realtime.Crypto.generateRandomKey((err, key) => { - var channel = client.channels.get('channelName', { cipher: { key } }); + const channel = client.channels.get('channelName', { cipher: { key } }); channel.subscribe(message => { message.name; // 'name is not encrypted' @@ -136,7 +134,7 @@ channel.setOptions({cipher: {key: ''}}, () => { // Using the REST API -var restChannel = restClient.channels.get('test'); +const restChannel = restClient.channels.get('test'); // Publishing to a channel @@ -195,7 +193,6 @@ restChannel.presence.history((err, messagesPage) => { // PaginatedResult // Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history restChannel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards' }, (err, messagesPage) => {}); - // Generate Token and Token Request // See https://www.ably.io/documentation/general/authentication for an explanation of Ably's authentication mechanism. @@ -206,7 +203,7 @@ client.auth.requestToken((err, tokenDetails) => { // see https://www.ably.io/documentation/rest/authentication/#token-details for its properties // Now we have the token, we can send it to someone who can instantiate a client with it: - var clientUsingToken = new Ably.Realtime(tokenDetails.token); + const clientUsingToken = new Ably.Realtime(tokenDetails.token); }); // requestToken can take two optional params @@ -242,15 +239,15 @@ client.stats({ limit: 50 }, (err, statsPage) => { // statsPage as Paginat client.time({}, (err, time) => {}); // time is in ms since epoch // Getting decoded Message objects from JSON -var messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]); +const messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]); console.log(messages[0].id); -var message = Ably.Rest.Message.fromEncoded({ id: 'foo' }); +const message = Ably.Rest.Message.fromEncoded({ id: 'foo' }); console.log(message.id); // Getting decoded PresenceMessage objects from JSON -var presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]); +const presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]); console.log(presenceMessages[0].action); -var presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' }); +const presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' }); console.log(presenceMessage.action); diff --git a/types/ably/index.d.ts b/types/ably/index.d.ts index b8d1eb9bfe..7bfc2338b6 100644 --- a/types/ably/index.d.ts +++ b/types/ably/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Ably // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace ablyLib { +export namespace ablyLib { namespace ChannelState { type INITIALIZED = 'initialized'; type ATTACHING = 'attaching'; @@ -130,15 +130,15 @@ declare namespace ablyLib { * A function which is called when a new token is required. * The role of the callback is to either generate a signed TokenRequest which may then be submitted automatically * by the library to the Ably REST API requestToken; or to provide a valid token in as a TokenDetails object. - **/ - authCallback?: (data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void) => void; + */ + authCallback?(data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void): void; authHeaders?: { [index: string]: string }; authMethod?: HTTPMethods; authParams?: { [index: string]: string }; /** * A URL that the library may use to obtain a token string (in plain text format), or a signed TokenRequest or TokenDetails (in JSON format). - **/ + */ authUrl?: string; key?: string; queryTime?: boolean; @@ -259,13 +259,13 @@ declare namespace ablyLib { /** * A number controlling the verbosity of the output. Valid values are: 0 (no logs), 1 (errors only), * 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output). - **/ + */ level?: number; /** * A function to handle each line of log output. If handler is not specified, console.log is used. - **/ - handler?: (...args: any[]) => void; + */ + handler?(...args: any[]): void; } interface ChannelEvent { @@ -398,7 +398,7 @@ declare namespace ablyLib { } interface Crypto { - generateRandomKey: (callback: (error: ErrorInfo, key: string) => void) => void; + generateRandomKey(callback: (error: ErrorInfo, key: string) => void): void; } class Connection extends EventEmitter { diff --git a/types/ably/tslint.json b/types/ably/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/ably/tslint.json +++ b/types/ably/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/abs/tslint.json b/types/abs/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/abs/tslint.json +++ b/types/abs/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/accepts/tslint.json b/types/accepts/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/accepts/tslint.json +++ b/types/accepts/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/accounting/accounting-tests.ts b/types/accounting/accounting-tests.ts index 0c11683c65..a397c559eb 100644 --- a/types/accounting/accounting-tests.ts +++ b/types/accounting/accounting-tests.ts @@ -27,8 +27,6 @@ accounting.formatMoney(5318008, { // Will recursively format an array of values: accounting.formatMoney([123, 456, [78, 9]], "$", 0); // ["$123", "$456", ["$78", "$9"]] - - // formatColumn // Format list of numbers for display: @@ -40,8 +38,6 @@ accounting.formatColumn([123, 12345], "$ ", 0); // ["$ 123", "$ 12,345"] // List of numbers can be a multi-dimensional array (formatColumn is applied recursively): accounting.formatColumn([[1, 100], [900, 9]]); // [["$ 1.00", "$100.00"], ["$900.00", "$ 9.00"]] - - // formatNumber // Example usage: @@ -58,16 +54,11 @@ accounting.formatNumber(5318008, { // Will recursively format an array of values: accounting.formatNumber([123456, [7890, 123]]); // ["123,456", ["7,890", "123"]] - - // toFixed (0.615).toFixed(2); // "0.61" accounting.toFixed(0.615, 2); // "0.62" - - - // unformat // Example usage: diff --git a/types/accounting/tslint.json b/types/accounting/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/accounting/tslint.json +++ b/types/accounting/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/acorn/index.d.ts b/types/acorn/index.d.ts index 441deb29c3..ce7da6d368 100644 --- a/types/acorn/index.d.ts +++ b/types/acorn/index.d.ts @@ -63,7 +63,7 @@ declare namespace acorn { class SourceLocation implements ESTree.SourceLocation { start: Position; end: Position; - source?: string; + source?: string | null; constructor(p: Parser, start: Position, end: Position); } diff --git a/types/adal/index.d.ts b/types/adal/index.d.ts index 18ca3d8079..552ca468aa 100644 --- a/types/adal/index.d.ts +++ b/types/adal/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ADAL.JS 1.0.13 +// Type definitions for ADAL.JS 1.0.14 // Project: https://github.com/AzureAD/azure-activedirectory-library-for-js // Definitions by: mmaitre314 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -29,6 +29,7 @@ declare namespace adal { loginResource?: string; resource?: string; extraQueryParameter?: string; + navigateToLoginRequestUrl?: boolean; } interface User { diff --git a/types/algebra.js/algebra.js-tests.ts b/types/algebra.js/algebra.js-tests.ts new file mode 100644 index 0000000000..0dc7f260e7 --- /dev/null +++ b/types/algebra.js/algebra.js-tests.ts @@ -0,0 +1,162 @@ +import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js'; + +{ + let expr = new Expression("x"); + expr = expr.subtract(3); + expr = expr.add("x"); + expr.toString(); + let eq = new Equation(expr, 4); + eq.toString(); + let x = eq.solveFor("x"); + x.toString(); +} +{ + let frac = new Fraction(1, 2); + frac.toString(); + frac = frac.add(new Fraction(3, 4)); + frac.toString(); + frac = frac.subtract(2); + frac.toString(); + frac = frac.multiply(new Fraction(4, 3)); + frac.toString(); + frac = frac.divide(5); + frac.toString(); + + let x = new Expression("x"); + x = x.add(3); + x.toString(); + x = x.subtract(new Fraction(1, 3)); + x.toString(); + x = x.add("y"); + x.toString(); + let otherExp = new Expression("x").add(6); + x = x.add(otherExp); + x.toString(); + + let expr1 = new Expression("a").add("b").add("c"); + let expr2 = new Expression("c").subtract("b"); + let expr3 = expr1.subtract(expr2); + expr1.toString() + " - (" + expr2.toString() + ") = " + expr3.toString(); + + expr1 = new Expression("x"); + expr1 = expr1.add(2); + expr1 = expr1.multiply(4); + expr2 = new Expression("x"); + expr2 = expr2.multiply("y"); + expr2 = expr2.multiply(new Fraction(1, 3)); + expr2 = expr2.add(4); + expr3 = expr1.multiply(expr2); + "(" + expr1.toString() + ")(" + expr2.toString() + ") = " + expr3.toString(); + + x = new Expression("x").divide(2).divide(new Fraction(1, 5)); + x.toString(); + let exp = new Expression("x"); + exp = exp.add("y"); + exp = exp.add(3); + exp.toString(); + let sum = exp.summation("x", 3, 6); + sum.toString(); + exp = new Expression("x").add(2); + let exp3 = exp.pow(3); + "(" + exp.toString() + ")^3 = " + exp3.toString(); + + let expr = new Expression("x"); + expr = expr.multiply(2); + expr = expr.multiply("x"); + expr = expr.add("y"); + expr = expr.add(new Fraction(1, 3)); + expr.toString(); + let answer1 = expr.eval({ x: 2 }); + let answer2 = expr.eval({ x: 2, y: new Fraction(3, 4) }); + answer1.toString(); + answer2.toString(); + expr = new Expression("x").add(2); + expr.toString(); + let sub = new Expression("y").add(4); + let answer = expr.eval({ x: sub }); + answer.toString(); + exp = new Expression("x").add(2); + exp.toString(); + exp = exp.multiply(5, false); + exp.toString(); + exp = exp.simplify(); + exp.toString(); + exp = exp.add(5, false); + exp.toString(); + exp = exp.divide(5, false); + exp.toString(); + exp = exp.simplify(); + exp.toString(); + exp = exp.pow(2, false); + exp.toString(); + exp = exp.simplify(); + exp.toString(); + let z = new Expression("z"); + let eq1 = new Equation(z.subtract(4).divide(9), z.add(6)); + eq1.toString(); + let eq2 = new Equation(z.add(4).multiply(9), 6); + eq2.toString(); + let eq3 = new Equation(z.divide(2).multiply(7), new Fraction(1, 4)); + eq3.toString(); +} +{ + let x1 = parse("1/5 * x + 2/15"); + let x2 = parse("1/7 * x + 4"); + let eq = new Equation(x1 as Expression, x2 as Expression); + eq.toString(); + let answer = eq.solveFor("x"); + "x = " + answer.toString(); + let expr1 = parse("1/4 * x + 5/4"); + let expr2 = parse("3 * y - 12/5"); + eq = new Equation(expr1 as Expression, expr2 as Expression); + eq.toString(); + let xAnswer = eq.solveFor("x"); + let yAnswer = eq.solveFor("y"); + "x = " + xAnswer.toString(); + "y = " + yAnswer.toString(); + let n1 = parse("x + 5") as Expression; + let n2 = parse("x - 3/4") as Expression; + let quad = new Equation(n1.multiply(n2), 0); + quad.toString(); + let answers = quad.solveFor("x"); + "x = " + answers.toString(); + n1 = parse("x + 2") as Expression; + n2 = parse("x + 3") as Expression; + let n3 = parse("x + 4") as Expression; + let cubic = new Equation(n1.multiply(n2).multiply(n3), 0); + cubic.toString(); + answers = cubic.solveFor("x"); + "x = " + answers.toString(); + let expr = new Expression("x"); + expr = expr.multiply("x"); + expr = expr.add("x"); + expr = expr.add("y"); + eq = new Equation(expr, 3); + eq.toString(); + xAnswer = eq.solveFor("x"); + yAnswer = eq.solveFor("y"); + "x = " + xAnswer; + "y = " + yAnswer.toString(); + let exp = parse("2 * x^2 + 4 * x + 4"); + exp.toString(); + exp = parse("x * y + 4"); + exp.toString(); +} +{ + let eq = parse("x^2 + 4 * x + 4 = 0") as Equation; + eq.toString(); + let ans = eq.solveFor("x"); + "x = " + ans.toString(); + let a = new Expression("x").pow(2); + let b = new Expression("x").multiply(new Fraction(5, 4)); + let c = new Fraction(-21, 4); + let expr = a.add(b).add(c); + let quad = new Equation(expr, 0); + toTex(quad); + let answers = quad.solveFor("x"); + toTex(answers); + let lambda = new Expression("lambda").add(3).divide(4); + let Phi = new Expression("Phi").subtract(new Fraction(1, 5)).add(lambda); + toTex(lambda); + toTex(Phi); +} diff --git a/types/algebra.js/index.d.ts b/types/algebra.js/index.d.ts new file mode 100644 index 0000000000..3a6c7cb29e --- /dev/null +++ b/types/algebra.js/index.d.ts @@ -0,0 +1,62 @@ +// Type definitions for algebra.js 0.2 +// Project: http://algebra.js.org +// Definitions by: Federico Caselli +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare class Term { + coefficients: algebra.js.Fraction[]; + variables: Variable[]; + coefficient(): algebra.js.Fraction; + toString(): string; +} + +declare class Variable { + variable: string; + toString(): string; +} + +type Union = string | number | algebra.js.Fraction | Term; + +declare namespace algebra.js { + function parse(input: string): Equation | Expression; + function toTex(input: Fraction | Expression | Equation | object | Array): string; + + class Equation { + lhs: Expression; + rhs: Expression; + constructor(lhs: Expression, rhs: Expression | Fraction | number) + solveFor(variable: string): Fraction | Fraction[] | number[]; + toString(): string; + } + + class Expression { + constants: Fraction[]; + terms: Term[]; + constructor(variable: Union | undefined) + add(other: Union | Expression, simplify?: boolean): Expression; + divide(other: Fraction | number, simplify?: boolean): Expression; + eval(p: object, simplify?: boolean): Expression; + multiply(other: Union | Expression, simplify?: boolean): Expression; + pow(p: number, simplify?: boolean): Expression; + constant(): Fraction; + simplify(): Expression; + subtract(other: Union | Expression, simplify?: boolean): Expression; + summation(variable: string, lower: number, upper: number, simplify?: boolean): Expression; + toString(): string; + } + + class Fraction { + denom: number; + numer: number; + constructor(num: number, denom: number) + abs(): Fraction; + add(other: Fraction | number, simplify?: boolean): Fraction; + divide(other: Fraction | number, simplify?: boolean): Fraction; + multiply(other: Fraction | number, simplify?: boolean): Fraction; + subtract(other: Fraction | number, simplify?: boolean): Fraction; + toString(): string; + valueOf(): number; + } +} +export = algebra.js; diff --git a/types/algebra.js/tsconfig.json b/types/algebra.js/tsconfig.json new file mode 100644 index 0000000000..9fb8a64bcc --- /dev/null +++ b/types/algebra.js/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "algebra.js-tests.ts" + ] +} diff --git a/types/algebra.js/tslint.json b/types/algebra.js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/algebra.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/alt/index.d.ts b/types/alt/index.d.ts index 00e171484b..f0ea3ba008 100644 --- a/types/alt/index.d.ts +++ b/types/alt/index.d.ts @@ -109,7 +109,7 @@ declare namespace AltJS { flush():Object; recycle( ...stores:Array>):void; rollback():void; - dispatch(action?:AltJS.Action, data?:Object, details?:any):void; + dispatch(action?:AltJS.Action|string, data?:Object, details?:any):void; //Actions methods addActions(actionsName:string, ActionsClass: ActionsClassConstructor):void; diff --git a/types/amplify-deferred/tslint.json b/types/amplify-deferred/tslint.json index f05741c59b..a62d0d4e68 100644 --- a/types/amplify-deferred/tslint.json +++ b/types/amplify-deferred/tslint.json @@ -1,6 +1,6 @@ { - "extends": "../tslint.json", + "extends": "dtslint/dt.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/amplify/amplify-tests.ts b/types/amplify/amplify-tests.ts index 8cce567960..62b00052dd 100644 --- a/types/amplify/amplify-tests.ts +++ b/types/amplify/amplify-tests.ts @@ -16,7 +16,6 @@ amplify.subscribe("dataexample", data => { alert(data.foo); // bar }); - amplify.publish("dataexample", { foo: "bar" }); amplify.subscribe("dataexample2", (param1, param2) => { @@ -47,7 +46,6 @@ amplify.subscribe("priorityexample", data => { } }, 1); - // Store data with amplify storage picking the default storage technology: amplify.publish("priorityexample", { foo: "bar" }); @@ -56,9 +54,9 @@ amplify.publish("priorityexample", { foo: "oops" }); amplify.store("storeExample1", { foo: "bar" }); amplify.store("storeExample2", "baz"); // retrieve the data later via the key -var myStoredValue = amplify.store("storeExample1"), - myStoredValue2 = amplify.store("storeExample2"), - myStoredValues = amplify.store(); +const myStoredValue = amplify.store("storeExample1"); +let myStoredValue2 = amplify.store("storeExample2"); +const myStoredValues = amplify.store(); myStoredValue.foo; // bar myStoredValue2; // baz myStoredValues.storeExample1.foo; // bar @@ -68,15 +66,13 @@ myStoredValues.storeExample2; // baz amplify.store.sessionStorage("explicitExample", { foo2: "baz" }); // retrieve the data later via the key -var myStoredValue2 = amplify.store.sessionStorage("explicitExample"); +myStoredValue2 = amplify.store.sessionStorage("explicitExample"); myStoredValue2.foo2; // baz - // REQUEST // Set up and use a request utilizing Ajax - amplify.request.define("ajaxExample1", "ajax", { url: "/myApiUrl", dataType: "json", @@ -159,15 +155,11 @@ amplify.request("twitter-search", { term: "amplifyjs" } ); // Similarly, we can create a request that searches for mentions, by accepting a username: - amplify.request.define("twitter-mentions", "ajax", { - url: "http://search.twitter.com/search.json", - dataType: "jsonp", - dataMap: data => { - return { - q: "@" + data.user - }; - } - }); +amplify.request.define("twitter-mentions", "ajax", { + url: "http://search.twitter.com/search.json", + dataType: "jsonp", + dataMap: data => ({ q: "@" + data.user }), +}); amplify.request("twitter-mentions", { user: "amplifyjs" }); @@ -175,7 +167,7 @@ amplify.request("twitter-mentions", { user: "amplifyjs" }); // Example: -var appEnvelopeDecoder: amplify.Decoder = (data, status, xhr, success, error) => { +const appEnvelopeDecoder: amplify.Decoder = (data, status, xhr, success, error) => { if (data.status === "success") { success(data.data); } else if (data.status === "fail" || data.status === "error") { @@ -197,7 +189,6 @@ amplify.request.decoders.appEnvelope = appEnvelopeDecoder; // but you can also just add it via an index amplify.request.decoders['appEnvelopeStr'] = appEnvelopeDecoder; - amplify.request.define("decoderExample", "ajax", { url: "/myAjaxUrl", type: "POST", @@ -246,11 +237,11 @@ amplify.request({ // amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition. - amplify.request.define("statusExample1", "ajax", { - // ... - }); +amplify.request.define("statusExample1", "ajax", { + // ... +}); - amplify.request({ +amplify.request({ resourceId: "statusExample1", success: (data, status) => { }, diff --git a/types/amplify/index.d.ts b/types/amplify/index.d.ts index 5cb03e5b1d..f88c754264 100644 --- a/types/amplify/index.d.ts +++ b/types/amplify/index.d.ts @@ -9,8 +9,8 @@ declare namespace amplify { interface RequestSettings { resourceId: string; data?: any; - success?: (...args: any[]) => void; - error?: (...args: any[]) => void; + success?(...args: any[]): void; + error?(...args: any[]): void; } type Decoder = diff --git a/types/amplify/tslint.json b/types/amplify/tslint.json index fe03bea79d..1b62a88e52 100644 --- a/types/amplify/tslint.json +++ b/types/amplify/tslint.json @@ -1,7 +1,7 @@ { - "extends": "../tslint.json", + "extends": "dtslint/dt.json", "rules": { - "forbidden-types": false, + "ban-types": false, "unified-signatures": false } } diff --git a/types/amqplib/amqplib-tests.ts b/types/amqplib/amqplib-tests.ts index 24dade85dc..8bfcf3c9b4 100644 --- a/types/amqplib/amqplib-tests.ts +++ b/types/amqplib/amqplib-tests.ts @@ -1,7 +1,7 @@ // promise api tests import amqp = require('amqplib'); -var msg = 'Hello World'; +const msg = 'Hello World'; // test promise api amqp.connect('amqp://localhost') @@ -21,11 +21,10 @@ amqp.connect('amqp://localhost') }); // test promise api properties -var amqpMessage: amqp.Message; +let amqpMessage: amqp.Message; amqpMessage.properties.contentType = 'application/json'; -var amqpAssertExchangeOptions: amqp.Options.AssertExchange; -var anqpAssertExchangeReplies: amqp.Replies.AssertExchange; - +let amqpAssertExchangeOptions: amqp.Options.AssertExchange; +let anqpAssertExchangeReplies: amqp.Replies.AssertExchange; // callback api tests import amqpcb = require('amqplib/callback_api'); @@ -59,7 +58,7 @@ amqpcb.connect('amqp://localhost', (err, connection) => { }); // test callback api properties -var amqpcbMessage: amqpcb.Message; +let amqpcbMessage: amqpcb.Message; amqpcbMessage.properties.contentType = 'application/json'; -var amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange; -var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange; +let amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange; +let anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange; diff --git a/types/amqplib/tslint.json b/types/amqplib/tslint.json index 105f5736e6..4f44991c3c 100644 --- a/types/amqplib/tslint.json +++ b/types/amqplib/tslint.json @@ -1,5 +1,5 @@ { - "extends": "../tslint.json", + "extends": "dtslint/dt.json", "rules": { "no-empty-interface": false } diff --git a/types/angular-block-ui/angular-block-ui-tests.ts b/types/angular-block-ui/angular-block-ui-tests.ts new file mode 100644 index 0000000000..4b3903f9cc --- /dev/null +++ b/types/angular-block-ui/angular-block-ui-tests.ts @@ -0,0 +1,41 @@ +let app: angular.IModule = angular.module('at', ['blockUI']); + +app.config((blockUIConfig: angular.blockUI.BlockUIConfig) => { + blockUIConfig.message = 'Please stop clicking!'; + blockUIConfig.delay = 100; + blockUIConfig.template = '
{{ state | json }}
'; + blockUIConfig.templateUrl = 'my-templates/block-ui-overlay.html'; + blockUIConfig.autoBlock = false; + blockUIConfig.resetOnException = false; + blockUIConfig.autoInjectBodyBlock = false; + blockUIConfig.cssClass = 'block-ui my-custom-class'; + blockUIConfig.blockBrowserNavigation = true; + + blockUIConfig.requestFilter = (config) => { + if (config.url.match(/^\/api\/quote($|\/).*/)) { + return false; + } + return true; + }; + + blockUIConfig.requestFilter = (config) => { + if (config.url.match(/^\/api\/quote($|\/).*/)) { + return 'Hello World'; + } + return 'Loading...'; + }; +}); + +app.controller('Ctrl', ($scope: ng.IScope, blockUI: angular.blockUI.BlockUIService) => { + blockUI.start(); + blockUI.start('Hello'); + blockUI.start({}); + blockUI.start({message: 'World'}); + blockUI.start({delay: 100}); + + blockUI.stop(); + blockUI.reset(); + blockUI.message("Hello Types"); + blockUI.done(); + let b: boolean = blockUI.isBlocking(); +}); diff --git a/types/angular-block-ui/index.d.ts b/types/angular-block-ui/index.d.ts new file mode 100644 index 0000000000..bf311b04a1 --- /dev/null +++ b/types/angular-block-ui/index.d.ts @@ -0,0 +1,168 @@ +// Type definitions for angular-block-ui 0.2 +// Project: https://github.com/McNull/angular-block-ui +// Definitions by: Lasse Nørregaard , Stephan Classen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as angular from "angular"; + +declare module 'angular' { + namespace blockUI { + interface BlockUIConfig { + /** + * Changes the default message to be used when no message + * has been provided to the start method of the service. + * + * Default value is 'Loading ...'. + */ + message?: string; + + /** + * Specifies the amount in milliseconds before the block + * is visible to the user. By delaying a visible block your + * application will appear more responsive. + * + * The default value is 250. + */ + delay?: number; + + /** + * Specifies a custom template to use as the overlay. + */ + template?: string; + + /** + * Specifies a url to retrieve the template from. + * The current release only works with pre-cached templates, + * which means that this url should be known in the + * $templateCache service of Angular. + * + * If you're using the grunt with html2js or angular-templates, + * which I highly recommend, you're already set. + */ + templateUrl?: string; + + /** + * By default the BlockUI module will start a block whenever + * the Angular $http service has an pending request. + * + * If you don't want this behaviour and want to do all the + * blocking manually you can change this value to false. + */ + autoBlock?: boolean; + + /** + * By default the BlockUI module will reset the block count and + * hide the overlay whenever an exception has occurred. + * + * You can set this value to false if you don't want this behaviour. + */ + resetOnException?: boolean; + + /** + * Allows you to specify a filter function to exclude certain ajax + * requests from blocking the user interface. + * The blockUI service will ignore requests when the function returns `false`. + * + * If the filter function returns a string it will be passed as the message + * argument to the start method of the service. + * + * @param {angular.IRequestConfig} config - the Angular request config object. + * + */ + requestFilter?(config: angular.IRequestConfig): (string | boolean); + + /** + * When the module is started it will inject the main block element + * by adding the block-ui directive to the body element. + */ + autoInjectBodyBlock?: boolean; + + /** + * A string containing the default css classes, separated by spaces, + * that should be applied to each block-ui element. + * + * The default value is `block-ui block-ui-anim-fade` + */ + cssClass?: string; + + /** + * Whenever a user interface block is active, because the single page + * application is still waiting for a response from the backend server, + * the user can still navigate away using the back and forward buttons + * of the browser. + * + * Callbacks registered to handle the responses from the server will + * be executed even if a different view/controller is currently active. + * By setting the blockBrowserNavigation property to true the + * angular-block-ui module will prevent navigation while a fullscreen + * block is active. + * + * Programatic location changes via the $location service are still + * allowed however. + * The navigation block is disabled by default. + */ + blockBrowserNavigation?: boolean; + } + + interface BlockUIService { + /** + * The start method will start the user interface block. + * Because multiple user interface elements can request + * a user interface block at the same time, the service + * keeps track of the number of start calls. + * + * Each call to start() will increase the count and every + * call to stop() will decrease the value. + * Whenever the count reaches 0 the block will end. + * + * Note: By default the block is immediately active after + * calling this method, but to prevent trashing the user + * interface each time a button is pressed, the block is + * visible after a short delay. + * + * This behaviour can be modified in the configuration. + * + * @param {string|IBlockUIConfig} messageOrOptions - + * Either supply the message (string) to be show in the + * overlay or specify an IBlockUIConfig object that will be + * merged/extended into the block ui instance state. + * If no argument is specified the default text message + * from the configuration is used. + */ + start(messageOrOptions?: (string | BlockUIConfig)): void; + + /** + * This will decrease the block count. + * + * The block will end if the count is 0. + */ + stop(): void; + + /** + * The reset will force an unblock by setting the block count to 0. + */ + reset(): void; + + /** + * Queues a callback function to be called when the block has finished. + * + * This can be useful whenever you wish to redirect the user + * to a different location while there are still pending AJAX requests. + */ + done(): void; + + /** + * Allows the message shown in the overlay to be updated + * while to block is active. + * + * @param {string} message - The message to show in the overlay. + */ + message(message: string): void; + + /** + * Returns whether currently a block is shown for the instance or not. + */ + isBlocking(): boolean; + } + } +} diff --git a/types/uk.co.workingedge.phonegap.plugin.istablet/tsconfig.json b/types/angular-block-ui/tsconfig.json similarity index 87% rename from types/uk.co.workingedge.phonegap.plugin.istablet/tsconfig.json rename to types/angular-block-ui/tsconfig.json index 1d2c6677e0..b1b705a6e5 100644 --- a/types/uk.co.workingedge.phonegap.plugin.istablet/tsconfig.json +++ b/types/angular-block-ui/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "uk.co.workingedge.phonegap.plugin.istablet-tests.ts" + "angular-block-ui-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/angular-block-ui/tslint.json b/types/angular-block-ui/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/angular-block-ui/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/angular-gettext/angular-gettext-tests.ts b/types/angular-gettext/angular-gettext-tests.ts index d7c330c3eb..766b16a963 100644 --- a/types/angular-gettext/angular-gettext-tests.ts +++ b/types/angular-gettext/angular-gettext-tests.ts @@ -1,61 +1,55 @@ +// Configuring angular-gettext +// https://angular-gettext.rocketeer.be/dev-guide/configure/ +//Setting the language +angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) { + gettextCatalog.setCurrentLanguage('nl'); +}); + +//Highlighting untranslated strings +angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) { + gettextCatalog.debug = true; +}); -namespace angular_gettext_tests { +// Marking strings in JavaScript code as translatable. +// https://angular-gettext.rocketeer.be/dev-guide/annotate-js/ +angular.module("myApp").controller("helloController", function (gettext: angular.gettext.gettextFunction) { + var myString = gettext("Hello"); +}); +//Translating directly in JavaScript. +angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { + var translated: string = gettextCatalog.getString("Hello"); +}); - // Configuring angular-gettext - // https://angular-gettext.rocketeer.be/dev-guide/configure/ - //Setting the language - angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) { - gettextCatalog.setCurrentLanguage('nl'); - }); +angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { + var myString2: string = gettextCatalog.getPlural(3, "Bird", "Birds"); +}); - //Highlighting untranslated strings - angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) { - gettextCatalog.debug = true; +angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { + var translated: string = gettextCatalog.getString("Hello {{name}}", { name: "Ruben" }); +}); + +// Setting strings manually +// https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/ + +angular.module("myApp").run(function (gettextCatalog: angular.gettext.gettextCatalog) { + // Load the strings automatically during initialization. + gettextCatalog.setStrings("nl", { + "Hello": "Hallo", + "One boat": ["Een boot", "{{$count}} boats"] }); +}); - // Marking strings in JavaScript code as translatable. - // https://angular-gettext.rocketeer.be/dev-guide/annotate-js/ - angular.module("myApp").controller("helloController", function (gettext: angular.gettext.gettextFunction) { - var myString = gettext("Hello"); - }); - - //Translating directly in JavaScript. - angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { - var translated: string = gettextCatalog.getString("Hello"); - }); - - angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { - var myString2: string = gettextCatalog.getPlural(3, "Bird", "Birds"); - }); - - angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { - var translated: string = gettextCatalog.getString("Hello {{name}}", { name: "Ruben" }); - }); - - // Setting strings manually - // https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/ - - angular.module("myApp").run(function (gettextCatalog: angular.gettext.gettextCatalog) { - // Load the strings automatically during initialization. - gettextCatalog.setStrings("nl", { - "Hello": "Hallo", - "One boat": ["Een boot", "{{$count}} boats"] - }); - }); - - - interface helloControllerScope extends ng.IScope { - switchLanguage: (lang: string) => void; - } - // Lazy-loading languages - // https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ - angular.module("myApp").controller("helloController", function ($scope: helloControllerScope, gettextCatalog: angular.gettext.gettextCatalog) { - $scope.switchLanguage = function (lang: string) { - gettextCatalog.setCurrentLanguage(lang); - gettextCatalog.loadRemote("/languages/" + lang + ".json"); - }; - }); +interface helloControllerScope extends ng.IScope { + switchLanguage: (lang: string) => void; } +// Lazy-loading languages +// https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ +angular.module("myApp").controller("helloController", function ($scope: helloControllerScope, gettextCatalog: angular.gettext.gettextCatalog) { + $scope.switchLanguage = function (lang: string) { + gettextCatalog.setCurrentLanguage(lang); + gettextCatalog.loadRemote("/languages/" + lang + ".json"); + }; +}); diff --git a/types/angular-gridster/angular-gridster-tests.ts b/types/angular-gridster/angular-gridster-tests.ts index 7af4908d2d..f8c5a93c81 100644 --- a/types/angular-gridster/angular-gridster-tests.ts +++ b/types/angular-gridster/angular-gridster-tests.ts @@ -3,11 +3,10 @@ import * as angular from "angular"; import gridster from "angular-gridster"; -var myApp = angular.module("testModule", ["gridster"]); +const myApp = angular.module("testModule", ["gridster"]); // configure gridster's global options myApp.run(["gridsterConfig", (gridsterConfig: angular.gridster.GridsterConfig) => { - gridsterConfig.mobileBreakPoint = 697; gridsterConfig.colWidth = "100"; gridsterConfig.rowHeight = "100"; @@ -24,4 +23,4 @@ myApp.run(["gridsterConfig", (gridsterConfig: angular.gridster.GridsterConfig) = gridsterConfig.resizable = { enabled: true, handles: ["n", "s", "e", "w", "ne", "se", "sw", "nw"]}; } -]); \ No newline at end of file +]); diff --git a/types/angular-gridster/tslint.json b/types/angular-gridster/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/angular-gridster/tslint.json +++ b/types/angular-gridster/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/angular-hotkeys/README.md b/types/angular-hotkeys/README.md new file mode 100644 index 0000000000..a31ed8a936 --- /dev/null +++ b/types/angular-hotkeys/README.md @@ -0,0 +1,55 @@ +## What is it? + +This is a typescript interface to be used with [angular-hotkeys](https://github.com/chieffancypants/angular-hotkeys/). + +## What are declaration files? + +See the [TypeScript handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html). + + +## How do I get them? + +### npm + +This is the preferred method. This is only available for TypeScript 2.0+ users. For these typings: + +```sh +npm install --save-dev @types/angular-hotkeys +``` + +The types should then be automatically included by the compiler. +See more in the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html). + + +### Other methods + +These can be used by TypeScript 1.0. + +* [Typings](https://github.com/typings/typings) +* ~~[NuGet](http://nuget.org/Tpackages?q=DefinitelyTyped)~~ (use preferred alternatives, nuget DT type publishing has been turned off) +* Manually download from the `master` branch of this repository + +You may need to add manual [references](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html). + +## How to use + +After installing a package you can import the definition file and begin using it as so: + +```ts + +import * as hotkeys from '../../node_modules/@types/angular-hotkeys' + +class FooController { + static $inject = [ + 'hotkeys' + ]; + + constructor( + private hotkeys: ng.hotkeys.HotkeysProvider + ) { } +} + +``` + +for a detailed explanation of the behavior of angular-hotkeys please refer to [its documentation](https://github.com/chieffancypants/angular-hotkeys/) + diff --git a/types/angular-hotkeys/index.d.ts b/types/angular-hotkeys/index.d.ts index f37171c416..4515afca67 100644 --- a/types/angular-hotkeys/index.d.ts +++ b/types/angular-hotkeys/index.d.ts @@ -2,6 +2,8 @@ // Project: https://github.com/chieffancypants/angular-hotkeys // Definitions by: Jason Zhao , Stefan Steinhart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +//readme written by David Valentine + /// diff --git a/types/angular-local-storage/index.d.ts b/types/angular-local-storage/index.d.ts index a3bd35d048..f403126d7a 100644 --- a/types/angular-local-storage/index.d.ts +++ b/types/angular-local-storage/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for angular-local-storage v0.1.5 +// Type definitions for angular-local-storage v0.1.6 // Project: https://github.com/grevory/angular-local-storage // Definitions by: Ken Fukuyama // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -60,19 +60,19 @@ declare module 'angular' { */ set(key: string, val: string): boolean; /** - * Directly adds a value to cookies with an expiration. - * Note: Typically used as a fallback if local storage is not supported. - * Returns: Boolean - * @param key - * @param val - * @param daysToExpiry - */ + * Directly adds a value to cookies with an expiration. + * Note: Typically used as a fallback if local storage is not supported. + * Returns: Boolean + * @param key + * @param val + * @param daysToExpiry + */ set(key: string, val: string, daysToExpiry: number): boolean; /** - * Directly get a value from a cookie. - * Returns: value from local storage - * @param key - */ + * Directly get a value from a cookie. + * Returns: value from local storage + * @param key + */ get(key: string): string; /** * Remove directly value from a cookie. @@ -84,8 +84,9 @@ declare module 'angular' { * Remove all data for this app from cookie. */ clearAll(): any; - } + + type StorageType = 'localStorage' | 'sessionStorage'; interface ILocalStorageService { /** @@ -104,19 +105,19 @@ declare module 'angular' { * @param key * @param value */ - set(key: string, value: T): boolean; + set(key: string, value: T, storageType?: StorageType): boolean; /** * Directly get a value from local storage. * If local storage is not supported, use cookies instead. * Returns: value from local storage * @param key */ - get(key: string): T; + get(key: string, storageType?: StorageType): T; /** * Return array of keys for local storage, ignore keys that not owned. * Returns: value from local storage */ - keys(): string[]; + keys(storageType?: StorageType): string[]; /** * Remove an item from local storage by key. * If local storage is not supported, use cookies instead. @@ -131,7 +132,7 @@ declare module 'angular' { * Returns: Boolean * @param regularExpression */ - clearAll(regularExpression?: RegExp): boolean; + clearAll(regularExpression?: RegExp, storageType?: StorageType): boolean; /** * Bind $scope key to localStorageService. * Usage: localStorageService.bind(scope, property, value[optional], key[optional]) @@ -141,7 +142,7 @@ declare module 'angular' { * @param value optional * @param key The corresponding key used in local storage */ - bind(scope: angular.IScope, property: string, value?: any, key?: string): Function; + bind(scope: angular.IScope, property: string, value?: any, key?: string, storageType?: StorageType): Function; /** * Return the derive key * Returns String @@ -152,7 +153,7 @@ declare module 'angular' { * Return localStorageService.length, ignore keys that not owned. * Returns Number */ - length(): number; + length(storageType?: StorageType): number; /** * Deal with browser's cookies directly. */ diff --git a/types/angular-material/angular-material-tests.ts b/types/angular-material/angular-material-tests.ts index f9195ec999..d1af7c8159 100644 --- a/types/angular-material/angular-material-tests.ts +++ b/types/angular-material/angular-material-tests.ts @@ -1,15 +1,12 @@ - - -var myApp = angular.module('testModule', ['ngMaterial']); +const myApp = angular.module('testModule', ['ngMaterial']); myApp.config(( $mdThemingProvider: ng.material.IThemingProvider, $mdIconProvider: ng.material.IIconProvider, $mdProgressCircularProvider: ng.material.IProgressCircularProvider) => { - $mdThemingProvider.alwaysWatchTheme(true); - var neonRedMap: ng.material.IPalette = $mdThemingProvider.extendPalette('red', { - '500': 'ff0000' + const neonRedMap: ng.material.IPalette = $mdThemingProvider.extendPalette('red', { + 500: 'ff0000' }); // Register the new color palette map with the name neonRed $mdThemingProvider.definePalette('neonRed', neonRedMap); @@ -21,12 +18,13 @@ myApp.config(( .warnPalette('red') .dark(true); - var browserColors: ng.material.IBrowserColors = { - theme: 'default', - palette: 'neonRed', - hue: '500' + const browserColors: ng.material.IBrowserColors = { + theme: 'default', + palette: 'neonRed', + hue: '500' }; - $mdThemingProvider.enableBrowserColor(browserColors); + const removeColors = $mdThemingProvider.enableBrowserColor(browserColors); + removeColors(); // Disable theming generation at runtime $mdThemingProvider.disableTheming(); @@ -41,44 +39,67 @@ myApp.config(( $mdProgressCircularProvider.configure({ progressSize: 100, strokeWidth: 20, - duration: 800 + duration: 800, + easeFn(t, b, c, d) { + t /= d; + return c * t * t + b; + }, + easeFnIndeterminate(t, b, c, d) { + return c * Math.pow(2, 10 * (t / d - 1)) + b; + } }); }); -myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.IBottomSheetService) => { +myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.IBottomSheetService, $q: ng.IQService) => { $scope['openBottomSheet'] = () => { $mdBottomSheet.show({ template: 'Hello!', clickOutsideToClose: true, disableBackdrop: true, disableParentScroll: false, - parent: () => {} }); + + const options: ng.material.IBottomSheetOptions = {}; + + options.resolve = { + nativePromise: () => Promise.resolve(), + angularPromise: () => $q.resolve(), + annotatedNativePromise: ['fakeService', (fake) => Promise.resolve()], + annotatedAngularPromise: ['fakeService', (fake) => $q.resolve()] + }; + + options.controller = 'TestController'; + options.controller = (function TestController(param: any) { }); + options.controller = (class { }); + options.controller = ['fakeService', function TestController(fake: any) { }]; + options.controller = ['fakeService', class { }]; + + options.parent = (scope, element) => new Element(); + options.parent = (scope, element) => angular.element(new Element()); + options.parent = '#container'; + options.parent = new Element(); + options.parent = angular.element(new Element()); }; $scope['hideBottomSheet'] = $mdBottomSheet.hide.bind($mdBottomSheet, 'hide'); $scope['cancelBottomSheet'] = $mdBottomSheet.cancel.bind($mdBottomSheet, 'cancel'); }); myApp.controller('ColorController', ($scope: ng.IScope, $mdColor: ng.material.IColorService) => { - var colorExpression : ng.material.IColorExpression; - var element : Element; - - colorExpression = { color: '#FFFFFF' } - - element = new Element(); + const colorExpression: ng.material.IColorExpression = { color: '#FFFFFF' }; + const element: Element = new Element(); $scope['applyThemeColors'] = () => { $mdColor.applyThemeColors(element, colorExpression); }; $scope['getThemeColor'] = () => { - $mdColor.getThemeColor('default-neonRed') + $mdColor.getThemeColor('default-neonRed'); }; $scope['hasTheme'] = () => { $mdColor.hasTheme(); }; }); -myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.IDialogService) => { +myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.IDialogService, $q: ng.IQService) => { $scope['openDialog'] = () => { $mdDialog.show({ template: 'Hello!' @@ -120,16 +141,56 @@ myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material. }; $scope['hideDialog'] = $mdDialog.hide.bind($mdDialog, 'hide'); $scope['cancelDialog'] = $mdDialog.cancel.bind($mdDialog, 'cancel'); + + const alertPreset: ng.material.IAlertDialog = $mdDialog.alert() + .resolve({ + nativePromise: () => Promise.resolve(), + angularPromise: () => $q.resolve(), + annotatedNativePromise: ['fakeService', (fake) => Promise.resolve()], + annotatedAngularPromise: ['fakeService', (fake) => $q.resolve()] + }) + .controller('TestController') + .controller(function TestController(param) { }) + .controller(class { }) + .controller(['fakeService', function TestController(fake) { }]) + .controller(['fakeService', class { }]) + ; + + const dialogOptions: ng.material.IDialogOptions = {}; + + dialogOptions.resolve = { + nativePromise: () => Promise.resolve(), + angularPromise: () => $q.resolve(), + annotatedNativePromise: ['fakeService', (fake) => Promise.resolve()], + annotatedAngularPromise: ['fakeService', (fake) => $q.resolve()] + }; + + dialogOptions.controller = 'TestController'; + dialogOptions.controller = (function TestController(param) { }); + dialogOptions.controller = (class { }); + dialogOptions.controller = ['fakeService', function TestController(fake) { }]; + dialogOptions.controller = ['fakeService', class { }]; + + $mdDialog.show({ + onShowing(scope, element) { }, + onComplete(scope, element) { }, + onRemoving(element, removePromise) { }, + }); + + $mdDialog.show({ + onShowing: (scope, element) => { }, + onComplete: (scope, element) => { }, + onRemoving: (element, removePromise) => { }, + }); }); class IconDirective implements ng.IDirective { - private $mdIcon: ng.material.IIcon; constructor($mdIcon: ng.material.IIcon) { this.$mdIcon = $mdIcon; } - public link($scope: ng.IScope, $elm: ng.IAugmentedJQuery) { + link($scope: ng.IScope, $elm: ng.IAugmentedJQuery) { this.$mdIcon('android').then((iconEl: Element) => $elm.append(iconEl)); this.$mdIcon('work:chair').then((iconEl: Element) => $elm.append(iconEl)); // Load and cache the external SVG using a URL @@ -150,7 +211,7 @@ myApp.controller('MediaController', ($scope: ng.IScope, $mdMedia: ng.material.IM }); myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.material.ISidenavService) => { - var componentId = 'left'; + const componentId = 'left'; $scope['toggle'] = () => $mdSidenav(componentId).toggle(); $scope['open'] = () => $mdSidenav(componentId).open(); $scope['close'] = () => $mdSidenav(componentId).close(); @@ -165,41 +226,81 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia instance.isLockedOpen(); }); - $scope['onClose'] = $mdSidenav(componentId).onClose(() => {}); + $scope['onClose'] = $mdSidenav(componentId).onClose(() => { }); }); -myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => { +myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService, $q: ng.IQService) => { $scope['openToast'] = () => { $mdToast.show($mdToast.simple().textContent('Hello!')); $mdToast.updateTextContent('New Content'); - } + }; $scope['customToast'] = () => { - var options = { + const options: ng.material.IToastOptions = { hideDelay: 3000, position: 'top right', - controller : 'ToastCtrl', - templateUrl : 'toast-template.html', - toastClass: 'my-class' + controller: 'ToastCtrl', + templateUrl: 'toast-template.html', + toastClass: 'my-class', + resolve: { + nativePromise: () => Promise.resolve(), + angularPromise: () => $q.resolve(), + annotatedNativePromise: ['fakeService', (fake) => Promise.resolve()], + annotatedAngularPromise: ['fakeService', (fake) => $q.resolve()] + } }; + options.controller = 'TestController'; + options.controller = (function TestController(param) { }); + options.controller = (class { }); + options.controller = ['fakeService', function TestController(fake) { }]; + options.controller = ['fakeService', class { }]; + $mdToast.show(options); - } + }; }); -myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IPanelService) => { +myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IPanelService, $q: ng.IQService) => { $scope['createPanel'] = () => { - var config = { + const config: ng.material.IPanelConfig = { id: 'myPanel', template: '

Hello!

', hasBackdrop: true, disableParentScroll: true, - zIndex: 150 + zIndex: 150, + resolve: { + nativePromise: () => Promise.resolve(), + angularPromise: () => $q.resolve(), + annotatedNativePromise: ['fakeService', (fake) => Promise.resolve()], + annotatedAngularPromise: ['fakeService', (fake) => $q.resolve()] + } }; - + + config.controller = 'TestController'; + config.controller = (function TestController(param) { }); + config.controller = (class { }); + config.controller = ['fakeService', function TestController(fake) { }]; + config.controller = ['fakeService', class { }]; + + config.onDomAdded = (paneRef) => Promise.resolve(); + config.onDomAdded = () => $q.reject(); + config.onDomAdded = () => { }; + + config.onOpenComplete = (paneRef) => Promise.resolve(); + config.onOpenComplete = () => $q.reject(); + config.onOpenComplete = () => { }; + + config.onRemoving = (paneRef) => Promise.resolve(); + config.onRemoving = () => $q.reject(); + config.onRemoving = () => { }; + + config.onDomRemoved = (paneRef) => Promise.resolve(); + config.onDomRemoved = () => $q.reject(); + config.onDomRemoved = () => { }; + $mdPanel.create(config); - var panelRef = $mdPanel.create(config); + let panelRef = $mdPanel.create(config); panelRef.open() .then((ref: ng.material.IPanelRef) => { ref.addClass('foo'); @@ -232,6 +333,6 @@ myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IP $scope['newPanelAnimation'] = () => { $mdPanel.newPanelAnimation().openFrom('.some-target'); - $mdPanel.newPanelAnimation().openFrom({top: 0, left: 0}); + $mdPanel.newPanelAnimation().openFrom({ top: 0, left: 0 }); }; }); diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index a8196269a4..10648c0012 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular Material (angular.material module) 1.1 +// Type definitions for angular-material 1.1 // Project: https://github.com/angular/material // Definitions by: Blake Bigelow , Peter Hajdu , Davide Donadello , Geert Jansen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -9,21 +9,25 @@ declare var _: string; export = _; declare module 'angular' { - export namespace material { + namespace material { + interface ResolveObject { + [name: string]: Injectable<(...args: any[]) => PromiseLike>; + } + interface IBottomSheetOptions { templateUrl?: string; template?: string; scope?: angular.IScope; // default: new child scope preserveScope?: boolean; // default: false - controller?: string | Function; + controller?: string | Injectable; locals?: { [index: string]: any }; clickOutsideToClose?: boolean; bindToController?: boolean; // default: false disableBackdrop?: boolean; escapeToClose?: boolean; - resolve?: { [index: string]: () => angular.IPromise }; + resolve?: ResolveObject; controllerAs?: string; - parent?: Function | string | Object; // default: root node + parent?: ((scope: angular.IScope, element: JQuery) => Element | JQuery) | string | Element | JQuery; // default: root node disableParentScroll?: boolean; // default: true } @@ -49,16 +53,16 @@ declare module 'angular' { clickOutsideToClose(clickOutsideToClose?: boolean): T; // default: false escapeToClose(escapeToClose?: boolean): T; // default: true focusOnOpen(focusOnOpen?: boolean): T; // default: true - controller(controller?: string | Function): T; + controller(controller?: string | Injectable): T; locals(locals?: { [index: string]: any }): T; bindToController(bindToController?: boolean): T; // default: false - resolve(resolve?: { [index: string]: () => angular.IPromise }): T; + resolve(resolve?: ResolveObject): T; controllerAs(controllerAs?: string): T; parent(parent?: string | Element | JQuery): T; // default: root node - onComplete(onComplete?: Function): T; ariaLabel(ariaLabel: string): T; } + // tslint:disable-next-line no-empty-interface interface IAlertDialog extends IPresetDialog { } @@ -97,15 +101,15 @@ declare module 'angular' { clickOutsideToClose?: boolean; // default: false escapeToClose?: boolean; // default: true focusOnOpen?: boolean; // default: true - controller?: string | Function; + controller?: string | Injectable; locals?: { [index: string]: any }; bindToController?: boolean; // default: false - resolve?: { [index: string]: () => angular.IPromise } + resolve?: ResolveObject; controllerAs?: string; parent?: string | Element | JQuery; // default: root node - onShowing?: Function; - onComplete?: Function; - onRemoving?: Function; + onShowing?(scope: angular.IScope, element: JQuery): void; + onComplete?(scope: angular.IScope, element: JQuery): void; + onRemoving?(element: JQuery, removePromise: angular.IPromise): void; skipHide?: boolean; multiple?: boolean; fullscreen?: boolean; // default: false @@ -120,9 +124,7 @@ declare module 'angular' { cancel(response?: any): void; } - interface IIcon { - (id: string): angular.IPromise; // id is a unique ID or URL - } + type IIcon = (id: string) => angular.IPromise; // id is a unique ID or URL interface IIconProvider { icon(id: string, url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24 @@ -132,9 +134,7 @@ declare module 'angular' { defaultFontSet(name: string): IIconProvider; } - interface IMedia { - (media: string): boolean; - } + type IMedia = (media: string) => boolean; interface ISidenavObject { toggle(): angular.IPromise; @@ -142,7 +142,7 @@ declare module 'angular' { close(): angular.IPromise; isOpen(): boolean; isLockedOpen(): boolean; - onClose(onClose: Function): void; + onClose(onClose: () => void): void; } interface ISidenavService { @@ -163,6 +163,7 @@ declare module 'angular' { toastClass(toastClass: string): T; } + // tslint:disable-next-line no-empty-interface interface ISimpleToastPreset extends IToastPreset { } @@ -175,10 +176,10 @@ declare module 'angular' { hideDelay?: number | false; // default (ms): 3000 position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left' toastClass?: string; - controller?: string | Function; + controller?: string | Injectable; locals?: { [index: string]: any }; bindToController?: boolean; // default: false - resolve?: { [index: string]: () => angular.IPromise } + resolve?: ResolveObject; controllerAs?: string; parent?: string | Element | JQuery; // default: root node } @@ -263,19 +264,19 @@ declare module 'angular' { interface IThemeConfig { disableTheming: boolean; - generateOnDemand: boolean; + generateOnDemand: boolean; nonce: string; defaultTheme: string; alwaysWatchTheme: boolean; - registeredStyles: Array; + registeredStyles: string[]; } interface IThemingProvider { alwaysWatchTheme(alwaysWatch: boolean): void; definePalette(name: string, palette: IPalette): IThemingProvider; - enableBrowserColor(browserColors: IBrowserColors): Function; + enableBrowserColor(browserColors: IBrowserColors): () => void; extendPalette(name: string, palette: IPalette): IPalette; - registerStyles(styles: String): void; + registerStyles(styles: string): void; setDefaultTheme(theme: string): void; setNonce(nonce: string): void; theme(name: string, inheritFrom?: string): ITheme; @@ -328,11 +329,11 @@ declare module 'angular' { id?: string; template?: string; templateUrl?: string; - controller?: string | Function; + controller?: string | Injectable; controllerAs?: string; bindToController?: boolean; // default: true locals?: { [index: string]: any }; - resolve?: { [index: string]: () => angular.IPromise } + resolve?: ResolveObject; attachTo?: string | JQuery | Element; propagateContainerEvents?: boolean; panelClass?: string; @@ -346,10 +347,10 @@ declare module 'angular' { animation?: IPanelAnimation; hasBackdrop?: boolean; // default: false disableParentScroll?: boolean; // default: false - onDomAdded?: Function; - onOpenComplete?: Function; - onRemoving?: Function; - onDomRemoved?: Function; + onDomAdded?(...args: any[]): PromiseLike | void; + onOpenComplete?(...args: any[]): PromiseLike | void; + onRemoving?(...args: any[]): PromiseLike | void; + onDomRemoved?(...args: any[]): PromiseLike | void; origin?: string | JQuery | Element; onCloseSuccess?: ((panel: IPanelRef, closeReason: string) => any); } @@ -442,11 +443,11 @@ declare module 'angular' { progressSize?: number; strokeWidth?: number; duration?: number; - easeFn?: Function; + easeFn?(t: number, b: number, c: number, d: number): number; durationIndeterminate?: number; startIndeterminate?: number; endIndeterminate?: number; - easeFnIndeterminate?: Function; + easeFnIndeterminate?(t: number, b: number, c: number, d: number): number; } interface IProgressCircularProvider { diff --git a/types/angular-material/tslint.json b/types/angular-material/tslint.json new file mode 100644 index 0000000000..8e8a076d2c --- /dev/null +++ b/types/angular-material/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "interface-name": false, + "max-line-length": false + } +} \ No newline at end of file diff --git a/types/angular-oauth2/angular-oauth2-tests.ts b/types/angular-oauth2/angular-oauth2-tests.ts index 042fe537aa..89dd51b4aa 100644 --- a/types/angular-oauth2/angular-oauth2-tests.ts +++ b/types/angular-oauth2/angular-oauth2-tests.ts @@ -7,4 +7,4 @@ angular.module('angular-oauth2-test', ['angular-oauth2']) clientId: 'CLIENT_ID', clientSecret: 'CLIENT_SECRET' // optional }); - }]); \ No newline at end of file + }]); diff --git a/types/angular-oauth2/tslint.json b/types/angular-oauth2/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/angular-oauth2/tslint.json +++ b/types/angular-oauth2/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/angular-promise-tracker/angular-promise-tracker-tests.ts b/types/angular-promise-tracker/angular-promise-tracker-tests.ts index 82f9e66c06..0365709cf5 100644 --- a/types/angular-promise-tracker/angular-promise-tracker-tests.ts +++ b/types/angular-promise-tracker/angular-promise-tracker-tests.ts @@ -1,7 +1,7 @@ angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker', ($q: angular.IQService, promiseTracker: angular.promisetracker.PromiseTrackerService) => { const trackerWithoutOptions = promiseTracker(); - + const options = { activationDelay: 10, minDuration: 500 @@ -17,4 +17,6 @@ angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker', const promiseToAdd = $q.defer().promise; const addedPromise: angular.IDeferred = trackerWithOptions.addPromise(promiseToAdd); + + const trackerWithSomeOptions = promiseTracker({activationDelay: 500}); }]); diff --git a/types/angular-promise-tracker/index.d.ts b/types/angular-promise-tracker/index.d.ts index c00f36e77c..b8957eab3d 100644 --- a/types/angular-promise-tracker/index.d.ts +++ b/types/angular-promise-tracker/index.d.ts @@ -10,8 +10,8 @@ import * as angular from 'angular'; declare module 'angular' { export namespace promisetracker { interface PromiseTrackerOptions { - activationDelay: number; - minDuration: number; + activationDelay?: number; + minDuration?: number; } interface PromiseTracker { diff --git a/types/angular-signalr-hub/angular-signalr-hub-tests.ts b/types/angular-signalr-hub/angular-signalr-hub-tests.ts index 771e49cdff..14d202e171 100644 --- a/types/angular-signalr-hub/angular-signalr-hub-tests.ts +++ b/types/angular-signalr-hub/angular-signalr-hub-tests.ts @@ -1,74 +1,72 @@ -angular - .module('app', ['SignalR']) - .factory('Employees', ngSignalrTest.EmployeesFactory); +class EmployeesFactory { + static $inject = ['$rootScope', 'Hub', '$timeout']; + private hub: ngSignalr.Hub; + public all: Array; -namespace ngSignalrTest { - export class EmployeesFactory { - static $inject = ['$rootScope', 'Hub', '$timeout']; - private hub: ngSignalr.Hub; - public all: Array; - - constructor($rootScope: ng.IRootScopeService, Hub: ngSignalr.HubFactory, $timeout: ng.ITimeoutService) { - // declaring the hub connection - this.hub = new Hub('employee', { - // client-side methods - listeners: { - 'lockEmployee': (id: number) => { - var employee = this.find(id); - employee.Locked = true; - $rootScope.$apply(); - }, - 'unlockEmployee': (id: number) => { - var employee = this.find(id); - employee.Locked = false; - $rootScope.$apply(); - } + constructor($rootScope: ng.IRootScopeService, Hub: ngSignalr.HubFactory, $timeout: ng.ITimeoutService) { + // declaring the hub connection + this.hub = new Hub('employee', { + // client-side methods + listeners: { + 'lockEmployee': (id: number) => { + var employee = this.find(id); + employee.Locked = true; + $rootScope.$apply(); }, - - // server-side methods - methods: ['lock', 'unlock'], - - // query params sent on initial connection - queryParams:{ - 'token': 'exampletoken' - }, - - // handle connection error - errorHandler: (message: string) => { - console.error(message); - }, - - stateChanged: (state: SignalR.StateChanged) => { - // your code here + 'unlockEmployee': (id: number) => { + var employee = this.find(id); + employee.Locked = false; + $rootScope.$apply(); } - }); - } + }, - private find(id: number) { - for (var i = 0; i < this.all.length; i++) { - if (this.all[i].Id === id) return this.all[i]; + // server-side methods + methods: ['lock', 'unlock'], + + // query params sent on initial connection + queryParams:{ + 'token': 'exampletoken' + }, + + // handle connection error + errorHandler: (message: string) => { + console.error(message); + }, + + stateChanged: (state: SignalR.StateChanged) => { + // your code here } - - return null; - } - - public edit = (employee: Employee) => { - employee.Edit = true; - this.hub.invoke('lock', employee.Id); - }; - - public done = (employee: Employee) => { - employee.Edit = false; - this.hub.invoke('unlock', employee.Id); - } + }); } - interface Employee { - Id: number; - Name: string; - Email: string; - Salary: number; - Edit: boolean; - Locked: boolean; + private find(id: number) { + for (var i = 0; i < this.all.length; i++) { + if (this.all[i].Id === id) return this.all[i]; + } + + return null; + } + + public edit = (employee: Employee) => { + employee.Edit = true; + this.hub.invoke('lock', employee.Id); + }; + + public done = (employee: Employee) => { + employee.Edit = false; + this.hub.invoke('unlock', employee.Id); } } + +interface Employee { + Id: number; + Name: string; + Email: string; + Salary: number; + Edit: boolean; + Locked: boolean; +} + +angular + .module('app', ['SignalR']) + .factory('Employees', EmployeesFactory); diff --git a/types/angular-spinner/angular-spinner-tests.ts b/types/angular-spinner/angular-spinner-tests.ts index c8d9e42479..82a47a40a4 100644 --- a/types/angular-spinner/angular-spinner-tests.ts +++ b/types/angular-spinner/angular-spinner-tests.ts @@ -2,11 +2,9 @@ var myApp = angular.module('testModule'); -namespace AngularSpinnerTest { - var app = angular.module("angularSpinnerTest", ["angular-spinner"]); +var app = angular.module("angularSpinnerTest", ["angular-spinner"]); - app.config(['usSpinnerService', function(usSpinnerService: ISpinnerService) { - usSpinnerService.spin('key1'); - usSpinnerService.stop('key2'); - }]); -} +app.config(['usSpinnerService', function(usSpinnerService: ISpinnerService) { + usSpinnerService.spin('key1'); + usSpinnerService.stop('key2'); +}]); diff --git a/types/angular-toastr/index.d.ts b/types/angular-toastr/index.d.ts index 7a10587e9b..83c42045d1 100644 --- a/types/angular-toastr/index.d.ts +++ b/types/angular-toastr/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular Toastr v1.6.0 // Project: https://github.com/Foxandxss/angular-toastr -// Definitions by: Niko Kovačič +// Definitions by: Niko Kovačič , Troy McKinnon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -15,9 +15,9 @@ declare module 'angular' { closeHtml?: string; extendedTimeOut?: number; messageClass?: string; - onHidden?: Function; - onShown?: Function; - onTap?: Function; + onHidden?: (wasClicked: boolean, toast: angular.toastr.IToast) => void; + onShown?: (toast: angular.toastr.IToast) => void; + onTap?: (toast: angular.toastr.IToast) => void; progressBar?: boolean; tapToDismiss?: boolean; templates?: { diff --git a/types/angular-translate/angular-translate-tests.ts b/types/angular-translate/angular-translate-tests.ts index cc1d65afe9..da97e69927 100644 --- a/types/angular-translate/angular-translate-tests.ts +++ b/types/angular-translate/angular-translate-tests.ts @@ -1,6 +1,7 @@ +import * as angular from 'angular'; +import * as angularTranslate from 'angular-translate'; - -var app = angular.module('at', ['pascalprecht.translate']); +var app = angular.module('at', [angularTranslate]); app.factory('customLoader', ($q:angular.IQService) => { return (options:any) => { diff --git a/types/angular-translate/index.d.ts b/types/angular-translate/index.d.ts index 3b911ba313..3caf9dc054 100644 --- a/types/angular-translate/index.d.ts +++ b/types/angular-translate/index.d.ts @@ -1,10 +1,13 @@ -// Type definitions for Angular Translate (pascalprecht.translate module) 2.4 +// Type definitions for Angular Translate (pascalprecht.translate module) 2.15 // Project: https://github.com/PascalPrecht/angular-translate // Definitions by: Michel Salib // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +declare var _: string; +export = _; + import * as angular from 'angular'; declare module 'angular' { @@ -45,8 +48,8 @@ declare module 'angular' { } interface ITranslateService { - (translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise; - (translationId: string[], interpolateParams?: any, interpolationId?: string): angular.IPromise<{ [key: string]: string }>; + (translationId: string, interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string): angular.IPromise; + (translationId: string[], interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string): angular.IPromise<{ [key: string]: string }>; cloakClassName(): string; cloakClassName(name: string): ITranslateProvider; fallbackLanguage(langKey?: string): string; @@ -117,7 +120,7 @@ declare module 'angular' { interface IFilterService { (name: 'translate'): { - (translationId: string, interpolateParams?: any, interpolation?: string): string; + (translationId: string, interpolateParams?: any, interpolation?: string, forceLanguage?: string): string; }; } } diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index b4e394aa37..d01dbd25b8 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -62,7 +62,6 @@ angular.module('http-auth-interceptor', []) * On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'. */ .config(['$httpProvider', 'authServiceProvider', ($httpProvider: ng.IHttpProvider, authServiceProvider: any) => { - $httpProvider.defaults.headers.common = {Authorization: 'Bearer token'}; $httpProvider.defaults.headers.get['Authorization'] = 'Bearer token'; $httpProvider.defaults.headers.post['Authorization'] = (config: ng.IRequestConfig) => 'Bearer token'; @@ -108,7 +107,7 @@ namespace HttpAndRegularPromiseTests { $http.get('http://somewhere/some/resource') .then((response: ng.IHttpPromiseCallbackArg) => { // typing lost, so something like - // var i: number = response.data + // const i: number = response.data // would type check $scope.person = response.data; }); @@ -116,7 +115,7 @@ namespace HttpAndRegularPromiseTests { $http.get('http://somewhere/some/resource') .then((response: ng.IHttpPromiseCallbackArg) => { // typing lost, so something like - // var i: number = response.data + // const i: number = response.data // would NOT type check $scope.person = response.data; }); @@ -153,7 +152,13 @@ namespace HttpAndRegularPromiseTests { // Test for AngularJS Syntax namespace My.Namespace { - export var x: any; // need to export something for module to kick in + export const x: any = null; // need to export something for module to kick in +} + +class TestProvider implements ng.IServiceProvider { + constructor(private $scope: ng.IScope) {} + + $get() {} } // IModule Registering Test @@ -229,14 +234,6 @@ mod.value(My.Namespace); mod.decorator('name', ($scope: ng.IScope) => {}); mod.decorator('name', ['$scope', ($scope: ng.IScope) => {}]); -class TestProvider implements ng.IServiceProvider { - constructor(private $scope: ng.IScope) { - } - - $get() { - } -} - // QProvider tests angular.module('qprovider-test', []) .config(['$qProvider', ($qProvider: ng.IQProvider) => { @@ -276,8 +273,8 @@ foo.then((x) => { // Object is inferred here x.a = 123; // Try a promise - var y: ng.IPromise; - var condition: boolean; + const y: ng.IPromise = null; + const condition: boolean = null; return condition ? y : x.a; // IPromise | T, both are good for the 1st arg of .then() }).then((x) => { // x is infered to be a number, which is the resolved value of a promise @@ -299,15 +296,15 @@ namespace TestQ { g: string; h: number; } - var tResult: TResult; - var promiseTResult: angular.IPromise; - var tValue: TValue; - var promiseTValue: angular.IPromise; - var tOther: TOther; - var promiseTOther: angular.IPromise; + const tResult: TResult = null; + const promiseTResult: angular.IPromise = null; + const tValue: TValue = null; + const promiseTValue: angular.IPromise = null; + const tOther: TOther = null; + const promiseTOther: angular.IPromise = null; - var $q: angular.IQService; - var promiseAny: angular.IPromise; + const $q: angular.IQService = null; + const promiseAny: angular.IPromise = null; const assertPromiseType = (arg: angular.IPromise) => arg; @@ -346,7 +343,7 @@ namespace TestQ { let result: angular.IDeferred; result = $q.defer(); result.resolve(tResult); - var anyValue: any; + const anyValue: any = null; result.reject(anyValue); result.promise.then(result => { return $q.resolve(result); @@ -411,7 +408,7 @@ namespace TestQ { let httpFoo: ng.IHttpPromise; httpFoo.then((x) => { // When returning a promise the generic type must be inferred. - var innerPromise: ng.IPromise; + const innerPromise: ng.IPromise = null; return innerPromise; }).then((x) => { // must still be number. @@ -427,16 +424,16 @@ httpFoo.then((response: ng.IHttpPromiseCallbackArg) => { // Deferred signature tests namespace TestDeferred { - var any: any; + const any: any = null; interface TResult { a: number; b: string; c: boolean; } - var tResult: TResult; + const tResult: TResult = null; - var deferred: angular.IDeferred; + const deferred: angular.IDeferred = null; // deferred.resolve { @@ -467,17 +464,40 @@ namespace TestDeferred { } namespace TestInjector { - var $injector: angular.auto.IInjectorService; + const $injector: angular.auto.IInjectorService = null; $injector.strictDi = true; $injector.annotate(() => {}); $injector.annotate(() => {}, true); + + // $injector.instantiate + { + class Foobar { + constructor($q) {} + } + let result: Foobar = $injector.instantiate(Foobar); + } + + // $injector.invoke + { + function foobar(v: boolean): number { + return 7; + } + let result = $injector.invoke(foobar); + if (!(typeof result === 'number')) { + // This fails to compile if 'result' is not exactly a number. + let expectNever: never = result; + } + + let anyFunction: Function = foobar; + let anyResult: string = $injector.invoke(anyFunction); + } } // Promise signature tests namespace TestPromise { - var any: any; + const any: any = null; interface TResult { kind: 'result'; @@ -497,16 +517,16 @@ namespace TestPromise { return x.kind === 'result'; } - var tresult: TResult; - var tresultPromise: ng.IPromise; - var tresultHttpPromise: ng.IHttpPromise; + const tresult: TResult = null; + const tresultPromise: ng.IPromise = null; + const tresultHttpPromise: ng.IHttpPromise = null; - var tother: TOther; - var totherPromise: ng.IPromise; - var totherHttpPromise: ng.IHttpPromise; + const tother: TOther = null; + const totherPromise: ng.IPromise = null; + const totherHttpPromise: ng.IHttpPromise = null; - var promise: angular.IPromise; - var $q: angular.IQService; + const promise: angular.IPromise = null; + const $q: angular.IQService = null; const assertPromiseType = (arg: angular.IPromise) => arg; const reject = $q.reject(); @@ -608,9 +628,9 @@ namespace TestTimeout { b: string; c: boolean; } - var fnTResult: (...args: any[]) => TResult; - var promiseAny: angular.IPromise; - var $timeout: angular.ITimeoutService; + const fnTResult: (...args: any[]) => TResult = null; + const promiseAny: angular.IPromise = null; + const $timeout: angular.ITimeoutService = null; // $timeout { @@ -670,9 +690,7 @@ class SampleDirective implements ng.IDirective { return new SampleDirective(); } - link(scope: ng.IScope) { - - } + link(scope: ng.IScope) {} } class SampleDirective2 implements ng.IDirective { @@ -688,9 +706,7 @@ class SampleDirective2 implements ng.IDirective { return new SampleDirective2(); } - link(scope: ng.IScope) { - - } + link(scope: ng.IScope) {} } angular.module('SameplDirective', []).directive('sampleDirective', SampleDirective.instance).directive('sameplDirective2', SampleDirective2.instance); @@ -825,11 +841,10 @@ angular.module('docsTimeDirective', []) $scope.format = 'M/d/yy h:mm:ss a'; }]) .directive('myCurrentTime', ['$interval', 'dateFilter', ($interval: any, dateFilter: any) => { - return { link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) { - let format: any, - timeoutId: any; + let format: any; + let timeoutId: any; function updateTime() { element.text(dateFilter(new Date(), format)); @@ -904,7 +919,10 @@ angular.module('docsIsoFnBindExample', []) angular.module('dragModule', []) .directive('myDraggable', ['$document', ($document: any) => { return (scope: any, element: any, attr: any) => { - let startX = 0, startY = 0, x = 0, y = 0; + let startX = 0; + let startY = 0; + let x = 0; + let y = 0; element.css({ position: 'relative', @@ -1030,11 +1048,10 @@ interface ICopyExampleUser { } interface ICopyExampleScope { - user: ICopyExampleUser; master: ICopyExampleUser; - update: (copyExampleUser: ICopyExampleUser) => any; - reset: () => any; + update(copyExampleUser: ICopyExampleUser): any; + reset(): any; } angular.module('copyExample', []) @@ -1055,8 +1072,7 @@ angular.module('copyExample', []) }]); namespace locationTests { - - var $location: ng.ILocationService; + const $location: ng.ILocationService = null; /* * From https://docs.angularjs.org/api/ng/service/$location @@ -1114,9 +1130,9 @@ namespace locationTests { // NgModelController function NgModelControllerTyping() { - var ngModel: angular.INgModelController; - var $http: angular.IHttpService; - var $q: angular.IQService; + const ngModel: angular.INgModelController = null; + const $http: angular.IHttpService = null; + const $q: angular.IQService = null; // See https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#$validators ngModel.$validators['validCharacters'] = (modelValue, viewValue) => { @@ -1141,8 +1157,7 @@ function NgModelControllerTyping() { let $filter: angular.IFilterService; function testFilter() { - - var items: string[]; + const items: string[] = null; $filter('filter')(items, 'test'); $filter('filter')(items, {name: 'test'}); $filter('filter')(items, (val, index, array) => { @@ -1224,7 +1239,7 @@ function testCustomFilter() { } function parseTyping() { - var $parse: angular.IParseService; + const $parse: angular.IParseService = null; const compiledExp = $parse('a.b.c'); if (compiledExp.constant) { return compiledExp({}); @@ -1234,7 +1249,7 @@ function parseTyping() { } function parseWithParams() { - var $parse: angular.IParseService; + const $parse: angular.IParseService = null; const compiledExp1 = $parse('a.b.c', () => null); const compiledExp2 = $parse('a.b.c', null, false); } @@ -1255,7 +1270,7 @@ function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjector } function testIHttpParamSerializerJQLikeProvider() { - var serializer: angular.IHttpParamSerializer; + const serializer: angular.IHttpParamSerializer = null; serializer({ a: 'b' }); @@ -1271,6 +1286,6 @@ function anyOf3(v1: T1, v2: T2, v3: T3) { } function toPromise(val: T): ng.IPromise { - var p: ng.IPromise; + const p: ng.IPromise = null; return p; } diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index 485ad9ebb3..c895c4f7ee 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.6 // Project: http://angularjs.org -// Definitions by: Diego Vilar , Georgii Dolzhykov +// Definitions by: Diego Vilar , Georgii Dolzhykov , Caleb St-Denis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -413,7 +413,7 @@ declare namespace angular { // https://docs.angularjs.org/api/ng/directive/ngModelOptions interface INgModelOptions { updateOn?: string; - debounce?: any; + debounce?: number | { [key: string]: number; }; allowInvalid?: boolean; getterSetter?: boolean; timezone?: string; @@ -602,7 +602,7 @@ declare namespace angular { /////////////////////////////////////////////////////////////////////////// interface ITimeoutService { (delay?: number, invokeApply?: boolean): IPromise; - (fn: (...args: any[]) => T, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise; + (fn: (...args: any[]) => T | IPromise, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise; cancel(promise?: IPromise): boolean; } @@ -782,7 +782,7 @@ declare namespace angular { // Check angular's i18n files for exemples NUMBER_FORMATS: ILocaleNumberFormatDescriptor; DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor; - pluralCat: (num: any) => string; + pluralCat(num: any): string; } interface ILocaleNumberFormatDescriptor { @@ -875,7 +875,8 @@ declare namespace angular { * @param identifierStart The function that will decide whether the given character is a valid identifier start character. * @param identifierContinue The function that will decide whether the given character is a valid identifier continue character. **/ - setIdentifierFns(identifierStart?: (character: string, codePoint: number) => boolean, + setIdentifierFns( + identifierStart?: (character: string, codePoint: number) => boolean, identifierContinue?: (character: string, codePoint: number) => boolean): void; } @@ -1591,10 +1592,10 @@ declare namespace angular { } interface IHttpInterceptor { - request?: (config: IRequestConfig) => IRequestConfig|IPromise; - requestError?: (rejection: any) => any; - response?: (response: IHttpPromiseCallbackArg) => IPromise>|IHttpPromiseCallbackArg; - responseError?: (rejection: any) => any; + request?(config: IRequestConfig): IRequestConfig|IPromise; + requestError?(rejection: any): any; + response?(response: IHttpPromiseCallbackArg): IPromise>|IHttpPromiseCallbackArg; + responseError?(rejection: any): any; } interface IHttpInterceptorFactory { @@ -1846,6 +1847,77 @@ declare namespace angular { $postLink?(): void; } + /** + * Interface for the $onInit lifecycle hook + * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks + */ + interface IOnInit { + /** + * Called on each controller after all the controllers on an element have been constructed and had their bindings + * initialized (and before the pre & post linking functions for the directives on this element). This is a good + * place to put initialization code for your controller. + */ + $onInit(): void; + } + + /** + * Interface for the $doCheck lifecycle hook + * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks + */ + interface IDoCheck { + /** + * Called on each turn of the digest cycle. Provides an opportunity to detect and act on changes. + * Any actions that you wish to take in response to the changes that you detect must be invoked from this hook; + * implementing this has no effect on when `$onChanges` is called. For example, this hook could be useful if you wish + * to perform a deep equality check, or to check a `Dat`e object, changes to which would not be detected by Angular's + * change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; if detecting changes, + * you must store the previous value(s) for comparison to the current values. + */ + $doCheck(): void; + } + + /** + * Interface for the $onChanges lifecycle hook + * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks + */ + interface IOnChanges { + /** + * Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound + * properties that have changed, and the values are an {@link IChangesObject} object of the form + * { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as + * cloning the bound value to prevent accidental mutation of the outer value. + */ + $onChanges(onChangesObj: IOnChangesObject): void; + } + + /** + * Interface for the $onDestroy lifecycle hook + * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks + */ + interface IOnDestroy { + /** + * Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources, + * watches and event handlers. + */ + $onDestroy(): void; + } + + /** + * Interface for the $postLink lifecycle hook + * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks + */ + interface IPostLink { + /** + * Called after this controller's element and its children have been linked. Similar to the post-link function this + * hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain + * templateUrl directives will not have been compiled and linked since they are waiting for their template to load + * asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered + * analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather + * different in Angular 1 there is no direct mapping and care should be taken when upgrading. + */ + $postLink(): void; + } + interface IOnChangesObject { [property: string]: IChangesObject; } @@ -1977,8 +2049,9 @@ declare namespace angular { get(name: '$window'): IWindowService; get(name: '$xhrFactory'): IXhrFactory; has(name: string): boolean; - instantiate(typeConstructor: Function, locals?: any): T; + instantiate(typeConstructor: {new(...args: any[]): T}, locals?: any): T; invoke(inlineAnnotatedFunction: any[]): any; + invoke(func: (...args: any[]) => T, context?: any, locals?: any): T; invoke(func: Function, context?: any, locals?: any): any; strictDi: boolean; } @@ -2025,7 +2098,6 @@ declare namespace angular { service(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; value(name: string, value: any): IServiceProvider; } - } /** diff --git a/types/angular/tslint.json b/types/angular/tslint.json index 7ba374959e..50c4474b7c 100644 --- a/types/angular/tslint.json +++ b/types/angular/tslint.json @@ -1,33 +1,20 @@ { - "extends": "../tslint.json", + "extends": "dtslint/dt.json", "rules": { "class-name": true, - "curly": true, - "max-line-length": false, - "no-consecutive-blank-lines": true, - "no-shadowed-variable": true, - "quotemark": [ - true, - "single" - ], - "align": true, + "indent": [true, "spaces"], + "quotemark": [true, "single"], + "variable-name": [true, "check-format"], + + // Below are all TODOs "callable-types": false, - "forbidden-types": false, - "indent": [ - true, - "spaces" - ], + "ban-types": false, "interface-name": false, - "linebreak-style": [ - true, - "LF" - ], + "jsdoc-format": false, + "max-line-length": false, "no-empty-interface": false, + "no-namespace": false, "unified-signatures": false, - "variable-name": [ - true, - "check-format" - ], "void-return": false } -} +} \ No newline at end of file diff --git a/types/animation-frame/animation-frame-tests.ts b/types/animation-frame/animation-frame-tests.ts index 2e0486f6ab..470f7e18ee 100644 --- a/types/animation-frame/animation-frame-tests.ts +++ b/types/animation-frame/animation-frame-tests.ts @@ -1,8 +1,6 @@ -namespace AnimationFrameTests { - var animation = new AnimationFrame(); - function frame() { - animation.request(frame); - } - +var animation = new AnimationFrame(); +function frame() { animation.request(frame); } + +animation.request(frame); diff --git a/types/anydb-sql-migrations/index.d.ts b/types/anydb-sql-migrations/index.d.ts index a72271ebb5..5db740c70f 100644 --- a/types/anydb-sql-migrations/index.d.ts +++ b/types/anydb-sql-migrations/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Gorgi Kosev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - import Promise = require('bluebird'); import { Column, Table, Transaction, AnydbSql } from 'anydb-sql'; export interface Migration { diff --git a/types/anydb-sql-migrations/package.json b/types/anydb-sql-migrations/package.json new file mode 100644 index 0000000000..5557c21ec8 --- /dev/null +++ b/types/anydb-sql-migrations/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "anydb-sql": "^0.6.53" + } +} diff --git a/types/anydb-sql/anydb-sql-tests.ts b/types/anydb-sql/anydb-sql-tests.ts deleted file mode 100644 index 745431d857..0000000000 --- a/types/anydb-sql/anydb-sql-tests.ts +++ /dev/null @@ -1,70 +0,0 @@ - -import anydbsql = require('anydb-sql'); -import { Table, Column } from 'anydb-sql' - -function do_not_run() { - - var db = anydbsql({ - url: 'postgres://user:pass@host:port/database', - connections: { min: 2, max: 20 } - }); - - // Table Post - - interface Post { - content: string; - userId: string; - date: string; - } - - interface PostTable extends Table { - content: Column; - userId: Column; - date: Column; - } - - var post = db.define({ - name: 'posts', - columns: { - content: {}, - userId: {}, - date: {} - } - }); - - // Table User - - interface User { - id: string; - email: string; - password: string; - name: string; - } - - interface UserTable extends Table { - id: Column; - email: Column; - password: Column; - name: Column; - } - - var user = db.define({ - name: 'users', - columns: { - id: { primaryKey: true }, - email: {}, - password: {}, - name: {}, - date: {} - }, - has: { - posts: { from: 'posts', many: true }, - group: { from: 'groups'} - } - }); - - user.select(user.name, post.content) - .from(user.join(post).on(user.id.equals(post.userId))) - .where(post.date.gt('123')) - .all() -} \ No newline at end of file diff --git a/types/anydb-sql/index.d.ts b/types/anydb-sql/index.d.ts deleted file mode 100644 index 367ade6ff9..0000000000 --- a/types/anydb-sql/index.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -// Type definitions for anydb-sql -// Project: https://github.com/doxout/anydb-sql -// Definitions by: Gorgi Kosev -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -interface AnyDBPool extends anydbSQL.DatabaseConnection { - query: (text: string, values: any[], callback: (err: Error, result: any) => void) => void - begin: () => anydbSQL.Transaction - close: (err: Error) => void -} - -interface Dictionary { [key: string]: T; } - -declare namespace anydbSQL { - export interface OrderByValueNode { } - export interface ColumnDefinition { - primaryKey?: boolean; - dataType?: string; - references?: { table: string; column: string } - notNull?: boolean - } - - export interface TableDefinition { - name: string - columns: Dictionary - has?: Dictionary<{ from: string; many?: boolean }> - } - - - export interface QueryLike { - query: string; - values: any[] - text: string - } - export interface DatabaseConnection { - queryAsync(query: string, ...params: any[]): Promise<{ rowCount: number; rows: T[] }> - queryAsync(query: QueryLike): Promise<{ rowCount: number; rows: T[] }> - } - - export interface Transaction extends DatabaseConnection { - rollback(): void - commitAsync(): Promise - } - - export interface SubQuery { - select(node: Column): SubQuery - where(...nodes: any[]): SubQuery - from(table: TableNode): SubQuery - group(...nodes: any[]): SubQuery - order(criteria: OrderByValueNode): SubQuery - notExists(subQuery: SubQuery): SubQuery - } - - interface Executable { - get(): Promise - getWithin(tx: DatabaseConnection): Promise - exec(): Promise - all(): Promise - execWithin(tx: DatabaseConnection): Promise - allWithin(tx: DatabaseConnection): Promise - toQuery(): QueryLike; - } - - interface Queryable { - where(...nodes: any[]): Query - delete(): ModifyingQuery - select(...nodes: any[]): Query - selectDeep(table: Table): Query - selectDeep(...nodesOrTables: any[]): Query - } - - export interface Query extends Executable, Queryable { - from(table: TableNode): Query - update(o: Dictionary): ModifyingQuery - update(o: {}): ModifyingQuery - group(...nodes: any[]): Query - order(...criteria: OrderByValueNode[]): Query - limit(l: number): Query - offset(o: number): Query - } - - export interface ModifyingQuery extends Executable { - returning(...nodes: any[]): Query - where(...nodes: any[]): ModifyingQuery - } - - export interface TableNode { - join(table: TableNode): JoinTableNode - leftJoin(table: TableNode): JoinTableNode - } - - export interface JoinTableNode extends TableNode { - on(filter: BinaryNode): TableNode - on(filter: string): TableNode - } - - interface CreateQuery extends Executable { - ifNotExists(): Executable - } - interface DropQuery extends Executable { - ifExists(): Executable - } - export interface Table extends TableNode, Queryable { - create(): CreateQuery - drop(): DropQuery - as(name: string): Table - update(o: any): ModifyingQuery - insert(row: T): ModifyingQuery - insert(rows: T[]): ModifyingQuery - select(): Query - select(...nodes: any[]): Query - from(table: TableNode): Query - star(): Column - subQuery(): SubQuery - eventEmitter: { - emit: (type: string, ...args: any[]) => void - on: (eventName: string, handler: Function) => void - } - columns: Column[] - sql: SQL; - alter(): AlterQuery - } - export interface AlterQuery extends Executable { - addColumn(column: Column): AlterQuery; - addColumn(name: string, options: string): AlterQuery; - dropColumn(column: Column): AlterQuery; - renameColumn(column: Column, newColumn: Column): AlterQuery; - renameColumn(column: Column, newName: string): AlterQuery; - renameColumn(name: string, newName: string): AlterQuery; - rename(newName: string): AlterQuery - } - - export interface SQL { - functions: { - LOWER(c: Column): Column - } - } - - export interface BinaryNode { - and(node: BinaryNode): BinaryNode - or(node: BinaryNode): BinaryNode - } - - export interface Column { - in(arr: T[]): BinaryNode - in(subQuery: SubQuery): BinaryNode - notIn(arr: T[]): BinaryNode - equals(node: any): BinaryNode - notEquals(node: any): BinaryNode - gte(node: any): BinaryNode - lte(node: any): BinaryNode - gt(node: any): BinaryNode - lt(node: any): BinaryNode - like(str: string): BinaryNode - multiply: { - (node: Column): Column - (n: number): Column - } - isNull(): BinaryNode - isNotNull(): BinaryNode - sum(): Column - count(): Column - count(name: string): Column - distinct(): Column - as(name: string): Column - ascending: OrderByValueNode - descending: OrderByValueNode - asc: OrderByValueNode - desc: OrderByValueNode - } - - export interface AnydbSql extends DatabaseConnection { - define(map: TableDefinition): Table; - transaction(fn: (tx: Transaction) => Promise): Promise - allOf(...tables: Table[]): any - models: Dictionary> - functions: { - LOWER: (name: Column) => Column - RTRIM: (name: Column) => Column - } - makeFunction(name: string): Function - begin(): Transaction - open(): void; - close(): void; - getPool(): AnyDBPool; - dialect(): string; - } -} - -declare function anydbSQL(config: Object): anydbSQL.AnydbSql; - -export = anydbSQL; diff --git a/types/anydb-sql/tsconfig.json b/types/anydb-sql/tsconfig.json deleted file mode 100644 index 92f2bff729..0000000000 --- a/types/anydb-sql/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "anydb-sql-tests.ts" - ] -} \ No newline at end of file diff --git a/types/apex.js/tslint.json b/types/apex.js/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/apex.js/tslint.json +++ b/types/apex.js/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/applepayjs/applepayjs-tests.ts b/types/applepayjs/applepayjs-tests.ts index 26c61396ae..5adf61e45c 100644 --- a/types/applepayjs/applepayjs-tests.ts +++ b/types/applepayjs/applepayjs-tests.ts @@ -21,7 +21,6 @@ describe("ApplePaySession", () => { } }); it("can create a new instance", () => { - const version = 1; const paymentRequest = { countryCode: "US", @@ -42,7 +41,6 @@ describe("ApplePaySession", () => { const session = new ApplePaySession(version, paymentRequest); }); it("can call static methods", () => { - const merchantIdentifier = "MyMerchantId"; let canMakePayments: boolean = ApplePaySession.canMakePayments(); @@ -59,7 +57,6 @@ describe("ApplePaySession", () => { }); }); it("can call instance methods", () => { - const version = 1; const paymentRequest = { countryCode: "US", @@ -171,7 +168,6 @@ describe("ApplePaySession", () => { }); describe("ApplePayPaymentRequest", () => { it("can create a new instance", () => { - let paymentRequest: ApplePayJS.ApplePayPaymentRequest = { applicationData: "ApplicationData", countryCode: "GB", diff --git a/types/applepayjs/index.d.ts b/types/applepayjs/index.d.ts index 52af393ebd..34d3c41a99 100644 --- a/types/applepayjs/index.d.ts +++ b/types/applepayjs/index.d.ts @@ -7,7 +7,6 @@ * A session object for managing the payment process on the web. */ declare class ApplePaySession extends EventTarget { - /** * Creates a new instance of the ApplePaySession class. * @param version - The version of the ApplePay JS API you are using. @@ -164,12 +163,10 @@ declare class ApplePaySession extends EventTarget { } declare namespace ApplePayJS { - /** * Defines a line item in a payment request - for example, total, tax, discount, or grand total. */ interface ApplePayLineItem { - /** * A short, localized description of the line item. */ @@ -190,7 +187,6 @@ declare namespace ApplePayJS { * Represents the result of authorizing a payment request and contains encrypted payment information. */ interface ApplePayPayment { - /** * The encrypted token for an authorized payment. */ @@ -211,7 +207,6 @@ declare namespace ApplePayJS { * The Apple​Pay​Payment​Authorized​Event class defines the attributes contained by the ApplePaySession.onpaymentauthorized callback function. */ abstract class ApplePayPaymentAuthorizedEvent extends Event { - /** * The payment token used to authorize a payment. */ @@ -222,7 +217,6 @@ declare namespace ApplePayJS { * Encapsulates contact information needed for billing and shipping. */ interface ApplePayPaymentContact { - /** * An email address for the contact. */ @@ -278,7 +272,6 @@ declare namespace ApplePayJS { * Contains information about an Apple Pay payment card. */ interface ApplePayPaymentMethod { - /** * A string, suitable for display, that describes the card. */ @@ -305,7 +298,6 @@ declare namespace ApplePayJS { * The Apple​Pay​Payment​Method​Selected​Event class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function. */ abstract class ApplePayPaymentMethodSelectedEvent extends Event { - /** * The card used to complete a payment. */ @@ -316,7 +308,6 @@ declare namespace ApplePayJS { * Represents a provisioned payment card for Apple Pay payments. */ interface ApplePayPaymentPass { - /** * The unique identifier for the primary account number for the payment card. */ @@ -347,7 +338,6 @@ declare namespace ApplePayJS { * Encapsulates a request for payment, including information about payment processing capabilities, the payment amount, and shipping information. */ interface ApplePayPaymentRequest { - /** * The merchant's two-letter ISO 3166 country code. */ @@ -402,7 +392,7 @@ declare namespace ApplePayJS { /** * A set of shipping method objects that describe the available shipping methods. */ - shippingMethods?: ApplePayShippingMethod[] | string[]; + shippingMethods?: ApplePayShippingMethod[]; /** * How the items are to be shipped. @@ -419,7 +409,6 @@ declare namespace ApplePayJS { * Contains the user's payment credentials. */ interface ApplePayPaymentToken { - /** * An object containing the encrypted payment data. */ @@ -440,7 +429,6 @@ declare namespace ApplePayJS { * The Apple​Pay​Shipping​Contact​Selected​Event class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function. */ abstract class ApplePayShippingContactSelectedEvent extends Event { - /** * The shipping address selected by the user. */ @@ -451,7 +439,6 @@ declare namespace ApplePayJS { * Defines a shipping method for delivering physical goods. */ interface ApplePayShippingMethod { - /** * A short description of the shipping method. */ @@ -477,7 +464,6 @@ declare namespace ApplePayJS { * The Apple​Pay​Shipping​Method​Selected​Event class defines the attribute contained by the ApplePaySession.onshippingmethodselected callback function. */ abstract class ApplePayShippingMethodSelectedEvent extends Event { - /** * The shipping method selected by the user. */ @@ -488,7 +474,6 @@ declare namespace ApplePayJS { * The Apple​Pay​Validate​Merchant​Event class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function. */ abstract class ApplePayValidateMerchantEvent extends Event { - /** * The URL used to validate the merchant server. */ @@ -496,7 +481,6 @@ declare namespace ApplePayJS { } abstract class Event { - readonly bubbles: boolean; cancelBubble: boolean; diff --git a/types/applepayjs/tslint.json b/types/applepayjs/tslint.json index 0344a1a3fa..3db14f85ea 100644 --- a/types/applepayjs/tslint.json +++ b/types/applepayjs/tslint.json @@ -1,3 +1 @@ -{ - "extends": "../tslint.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/applicationinsights-js/applicationinsights-js-tests.ts b/types/applicationinsights-js/applicationinsights-js-tests.ts index 66bc1f268d..1a4d585795 100644 --- a/types/applicationinsights-js/applicationinsights-js-tests.ts +++ b/types/applicationinsights-js/applicationinsights-js-tests.ts @@ -1,6 +1,6 @@ // More samples on: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md -var config: Microsoft.ApplicationInsights.IConfig = { +const config: Microsoft.ApplicationInsights.IConfig = { instrumentationKey: "", endpointUrl: "endpointUrl", emitLineDelimitedJson: false, @@ -30,7 +30,7 @@ var config: Microsoft.ApplicationInsights.IConfig = { isStorageUseDisabled: true }; -var appInsights: Microsoft.ApplicationInsights.IAppInsights = { +appInsights = { config, context: null, queue: null, @@ -91,9 +91,8 @@ appInsights.setAuthenticatedUserContext("userId", "accountId"); // set config dynamically appInsights.config.instrumentationKey = ""; - // TelementryContext -var context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context; +const context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context; context.application.ver = "v0.0.0"; context.application.build = "1.1.1"; @@ -113,54 +112,54 @@ context.operation.id = "1"; context.operation.syntheticSource = "testAgent"; // track -var data = new Microsoft.Telemetry.Base(); -var envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name"); +const data = new Microsoft.Telemetry.Base(); +const envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name"); context.track(envelope); -context.addTelemetryInitializer((envelope) => false); +context.addTelemetryInitializer(telemetryEnvelope => false); // track event -var eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null); -var eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj); -var eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType); +const eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null); +const eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj); +const eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType); context.track(eventEnvelope); // track exception -var exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical); -var exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data( +const exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical); +const exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data( Microsoft.ApplicationInsights.Telemetry.Exception.dataType, exceptionObj); -var exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType); +const exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType); context.track(exceptionEnvelope); // track metric -var metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null); -var metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj); -var metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType); +const metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null); +const metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj); +const metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType); context.track(metricEnvelope); // track page view -var pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null); -var pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj); -var pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType); +const pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null); +const pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj); +const pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType); context.track(pageViewEnvelope); // track page view performance -var pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null); -var pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data( +const pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null); +const pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data( Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerfObj); -var pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType); +const pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType); context.track(pageViewPerfEnvelope); // track remote dependency -var remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET"); -var remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data( +const remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET"); +const remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data( Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType, remoteDepObj); -var remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType); +const remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType); context.track(pageViewPerfEnvelope); // track trace -var traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null); -var traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj); -var traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType); -context.track(traceEnvelope); \ No newline at end of file +const traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null); +const traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj); +const traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType); +context.track(traceEnvelope); diff --git a/types/applicationinsights-js/index.d.ts b/types/applicationinsights-js/index.d.ts index ede1584bb5..cce53f5823 100644 --- a/types/applicationinsights-js/index.d.ts +++ b/types/applicationinsights-js/index.d.ts @@ -195,8 +195,8 @@ declare module Microsoft.ApplicationInsights.Context { interface IInternal { /** - * The SDK version used to create this telemetry item. - */ + * The SDK version used to create this telemetry item. + */ sdkVersion: string; /** * The SDK agent version. @@ -206,15 +206,15 @@ declare module Microsoft.ApplicationInsights.Context { interface ISample { /** - * Sample rate - */ + * Sample rate + */ sampleRate: number; } interface ISession { /** - * The session ID. - */ + * The session ID. + */ id: string; /** * The true if this is the first session @@ -258,8 +258,8 @@ declare module Microsoft.ApplicationInsights.Context { interface IUser { /** - * The telemetry configuration. - */ + * The telemetry configuration. + */ config: any; /** * The user ID. @@ -345,12 +345,12 @@ declare module Microsoft.ApplicationInsights.Telemetry { measurements: Microsoft.ApplicationInsights.FieldType; }; /** - * Constructs a new isntance of the ExceptionTelemetry object - */ + * Constructs a new isntance of the ExceptionTelemetry object + */ constructor(exception: Error, handledAt?: string, properties?: any, measurements?: any, severityLevel?: AI.SeverityLevel); /** - * Creates a simple exception with 1 stack frame. Useful for manual constracting of exception. - */ + * Creates a simple exception with 1 stack frame. Useful for manual constracting of exception. + */ static CreateSimpleException(message: string, typeName: string, assembly: string, fileName: string, details: string, line: number, handledAt?: string): Telemetry.Exception; } @@ -414,8 +414,8 @@ declare module Microsoft.ApplicationInsights.Telemetry { getIsValid(): boolean; private durationMs; /** - * Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method. - */ + * Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method. + */ getDurationMs(): number; /** * Constructs a new instance of the PageEventTelemetry object @@ -423,8 +423,8 @@ declare module Microsoft.ApplicationInsights.Telemetry { constructor(name: string, url: string, unused: number, properties?: any, measurements?: any); static getPerformanceTiming(): PerformanceTiming; /** - * Returns true is window performance timing API is supported, false otherwise. - */ + * Returns true is window performance timing API is supported, false otherwise. + */ static isPerformanceTimingSupported(): PerformanceTiming; /** * As page loads different parts of performance timing numbers get set. When all of them are set we can report it. @@ -615,16 +615,16 @@ declare module Microsoft.ApplicationInsights { interface ITelemetryContext { /** - * The object describing a component tracked by this object. - */ + * The object describing a component tracked by this object. + */ application: Context.IApplication; /** * The object describing a device tracked by this object. */ device: Context.IDevice; /** - * The object describing internal settings. - */ + * The object describing internal settings. + */ internal: Context.IInternal; /** * The object describing a location tracked by this object. @@ -635,8 +635,8 @@ declare module Microsoft.ApplicationInsights { */ operation: Context.IOperation; /** - * The object describing sampling settings. - */ + * The object describing sampling settings. + */ sample: Context.ISample; /** * The object describing a user tracked by this object. @@ -647,13 +647,13 @@ declare module Microsoft.ApplicationInsights { */ session: Context.ISession; /** - * Adds telemetry initializer to the collection. Telemetry initializers will be called one by one - * before telemetry item is pushed for sending and in the order they were added. - */ + * Adds telemetry initializer to the collection. Telemetry initializers will be called one by one + * before telemetry item is pushed for sending and in the order they were added. + */ addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean): any; /** - * Tracks telemetry object. - */ + * Tracks telemetry object. + */ track(envelope: Microsoft.ApplicationInsights.IEnvelope): any; } @@ -662,23 +662,23 @@ declare module Microsoft.ApplicationInsights { context: ITelemetryContext; queue: Array<() => void>; /** - * Starts timing how long the user views a page or other item. Call this when the page opens. - * This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes. - * @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title. - */ + * Starts timing how long the user views a page or other item. Call this when the page opens. + * This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes. + * @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title. + */ startTrackPage(name?: string): any; /** - * Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes. - * @param name The string you used as the name in startTrackPage. Defaults to the document title. - * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location. - * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty. - * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty. - */ - stopTrackPage(name?: string, url?: string, properties?: { - [name: string]: string; - }, measurements?: { - [name: string]: number; - }): any; + * Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes. + * @param name The string you used as the name in startTrackPage. Defaults to the document title. + * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location. + * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty. + * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty. + */ + stopTrackPage( + name?: string, + url?: string, + properties?: { [name: string]: string }, + measurements?: { [name: string]: number }): any; /** * Logs that a page or other item was viewed. * @param name The string you used as the name in startTrackPage. Defaults to the document title. @@ -687,11 +687,11 @@ declare module Microsoft.ApplicationInsights { * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty. * @param duration number - the number of milliseconds it took to load the page. Defaults to undefined. If set to default value, page load time is calculated internally. */ - trackPageView(name?: string, url?: string, properties?: { - [name: string]: string; - }, measurements?: { - [name: string]: number; - }, duration?: number): any; + trackPageView( + name?: string, + url?: string, + properties?: { [name: string]: string }, + measurements?: { [name: string]: number }, duration?: number): any; /** * Start timing an extended event. Call {@link stopTrackEvent} to log the event when it ends. * @param name A string that identifies this event uniquely within the document. @@ -703,22 +703,20 @@ declare module Microsoft.ApplicationInsights { * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty. */ - stopTrackEvent(name: string, properties?: { - [name: string]: string; - }, measurements?: { - [name: string]: number; - }): any; + stopTrackEvent( + name: string, + properties?: { [name: string]: string }, + measurements?: { [name: string]: number }): any; /** - * Log a user action or other occurrence. - * @param name A string to identify this event in the portal. - * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. - * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty. - */ - trackEvent(name: string, properties?: { - [name: string]: string; - }, measurements?: { - [name: string]: number; - }): any; + * Log a user action or other occurrence. + * @param name A string to identify this event in the portal. + * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. + * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty. + */ + trackEvent( + name: string, + properties?: { [name: string]: string }, + measurements?: { [name: string]: number }): any; /** * Log a dependency call * @param id unique id, this is used by the backend o correlate server requests. Use Util.newId() to generate a unique Id. @@ -737,11 +735,12 @@ declare module Microsoft.ApplicationInsights { * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty. * @param severityLevel AI.SeverityLevel - severity level */ - trackException(exception: Error, handledAt?: string, properties?: { - [name: string]: string; - }, measurements?: { - [name: string]: number; - }, severityLevel?: AI.SeverityLevel): any; + trackException( + exception: Error, + handledAt?: string, + properties?: { [name: string]: string }, + measurements?: { [name: string]: number }, + severityLevel?: AI.SeverityLevel): any; /** * Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators. * To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the @@ -752,28 +751,30 @@ declare module Microsoft.ApplicationInsights { * @param min The smallest measurement in the sample. Defaults to the average. * @param max The largest measurement in the sample. Defaults to the average. */ - trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: { - [name: string]: string; - }): any; + trackMetric( + name: string, + average: number, + sampleCount?: number, + min?: number, + max?: number, + properties?: { [name: string]: string }): any; /** - * Log a diagnostic message. - * @param message A message string - * @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty. - */ - trackTrace(message: string, properties?: { - [name: string]: string; - }): any; + * Log a diagnostic message. + * @param message A message string + * @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty. + */ + trackTrace(message: string, properties?: { [name: string]: string }): any; /** * Immediately send all queued telemetry. */ flush(): any; /** - * Sets the autheticated user id and the account id in this session. - * User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars. - * - * @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service. - * @param accountId {string} - An optional string to represent the account associated with the authenticated user. - */ + * Sets the autheticated user id and the account id in this session. + * User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars. + * + * @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service. + * @param accountId {string} - An optional string to represent the account associated with the authenticated user. + */ setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string): any; /** * Clears the authenticated user id and the account id from the user context. @@ -796,4 +797,4 @@ declare module 'applicationinsights-js' { const AppInsights: Microsoft.ApplicationInsights.IAppInsights; } -declare var appInsights: Microsoft.ApplicationInsights.IAppInsights; \ No newline at end of file +declare var appInsights: Microsoft.ApplicationInsights.IAppInsights; diff --git a/types/applicationinsights-js/tslint.json b/types/applicationinsights-js/tslint.json index 119a5839d0..0cc2f62b56 100644 --- a/types/applicationinsights-js/tslint.json +++ b/types/applicationinsights-js/tslint.json @@ -1,8 +1,8 @@ { - "extends": "../tslint.json", + "extends": "dtslint/dt.json", "rules": { "interface-name": [ false ], "no-internal-module": false, "no-single-declare-module": false } -} \ No newline at end of file +} diff --git a/types/arcgis-js-api/arcgis-js-api-tests.ts b/types/arcgis-js-api/arcgis-js-api-tests.ts index 0624c88672..d5dfb99406 100644 --- a/types/arcgis-js-api/arcgis-js-api-tests.ts +++ b/types/arcgis-js-api/arcgis-js-api-tests.ts @@ -2,8 +2,6 @@ import Map = require("esri/Map"); import MapView = require("esri/views/MapView"); import Point = require("esri/geometry/Point"); -export = MapController; - class MapController { map: Map; @@ -19,7 +17,7 @@ class MapController { this.map = new Map({ basemap: "topo" }); - + let view = new MapView({ center: point, container: this.mapDiv, diff --git a/types/arcgis-js-api/index.d.ts b/types/arcgis-js-api/index.d.ts index 293c5190e9..d46dea1b81 100644 --- a/types/arcgis-js-api/index.d.ts +++ b/types/arcgis-js-api/index.d.ts @@ -667,6 +667,8 @@ declare namespace __esri { export type EasingFunction = (t: number, duration: number) => number; + export type EventHandler = (event: any) => void; + export interface PromisedWatchHandle extends IPromise { remove(): void; } @@ -1337,7 +1339,7 @@ declare namespace __esri { maxZoom?: number; snapToZoom?: boolean; rotationEnabled?: boolean; - effectiveLODs?: number; + effectiveLODs?: LOD[]; effectiveMinZoom?: number; effectiveMaxZoom?: number; effectiveMinScale?: number; @@ -1868,21 +1870,6 @@ declare namespace __esri { worldScale?: boolean; } - interface Evented { - emit(type: string, event: any): IHandle; - on(name: string, callback: Function): IHandle; - } - - interface EventedConstructor { - new(): Evented; - - - hasEventListener(type: string): boolean; - on(type: string, listener: Function): any; - } - - export const Evented: EventedConstructor; - interface Basemap extends Accessor, Loadable, JSONSupport { baseLayers: Collection; id: string; @@ -1907,11 +1894,11 @@ declare namespace __esri { export const Basemap: BasemapConstructor; interface BasemapProperties extends LoadableProperties { - baseLayers?: Collection; + baseLayers?: Collection | any[]; id?: string; loaded?: boolean; portalItem?: PortalItemProperties; - referenceLayers?: Collection; + referenceLayers?: Collection | any[]; thumbnailUrl?: string; title?: string; } @@ -2013,7 +2000,7 @@ declare namespace __esri { export const Ground: GroundConstructor; interface GroundProperties { - layers?: Collection; + layers?: Collection | any[]; } interface Map extends Accessor, LayersMixin { @@ -2029,7 +2016,7 @@ declare namespace __esri { export const Map: MapConstructor; interface MapProperties extends LayersMixinProperties { - allLayers?: Collection; + allLayers?: Collection | any[]; basemap?: BasemapProperties; ground?: GroundProperties; } @@ -2053,7 +2040,7 @@ declare namespace __esri { export const PopupTemplate: PopupTemplateConstructor; interface PopupTemplateProperties { - actions?: Collection; + actions?: Collection | any[]; content?: string | any[] | Function; fieldInfos?: PopupTemplateFieldInfos[]; overwriteActions?: boolean; @@ -2718,6 +2705,7 @@ declare namespace __esri { definitionExpression: string; elevationInfo: FeatureLayerElevationInfo; fields: Field[]; + gdbVersion: string; geometryType: string; hasAttachments: boolean; hasM: boolean; @@ -2762,6 +2750,7 @@ declare namespace __esri { definitionExpression?: string; elevationInfo?: FeatureLayerElevationInfo; fields?: FieldProperties[]; + gdbVersion?: string; geometryType?: string; hasAttachments?: boolean; hasM?: boolean; @@ -2777,7 +2766,7 @@ declare namespace __esri { renderer?: RendererProperties; returnM?: boolean; returnZ?: boolean; - source?: Collection; + source?: Collection | any[]; spatialReference?: SpatialReferenceProperties; token?: string; url?: string; @@ -2823,7 +2812,7 @@ declare namespace __esri { interface GraphicsLayerProperties extends LayerProperties, ScaleRangeLayerProperties { elevationInfo?: GraphicsLayerElevationInfo; - graphics?: Collection; + graphics?: Collection | any[]; } interface GroupLayer extends Layer, LayersMixin, JSONSupport, PortalLayer { @@ -3419,7 +3408,7 @@ declare namespace __esri { popupTemplate?: PopupTemplateProperties; renderer?: RendererProperties; source?: any | any; - sublayers?: Collection; + sublayers?: Collection | any[]; title?: string; url?: string; visible?: boolean; @@ -4506,7 +4495,7 @@ declare namespace __esri { interface Symbol3DProperties extends SymbolProperties { styleOrigin?: Symbol3DStyleOrigin; - symbolLayers?: Collection; + symbolLayers?: Collection | any[]; } interface Symbol3DLayer extends Accessor, JSONSupport { @@ -6170,7 +6159,7 @@ declare namespace __esri { goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | any, options?: MapViewGoToOptions): IPromise; hasEventListener(type: string): boolean; hitTest(screenPoint: MapViewHitTestScreenPoint): IPromise; - on(type: string | string[], modifiersOrHandler: string[] | Function, handler?: Function): any; + on(type: string | string[], modifiersOrHandler: string[] | EventHandler, handler?: EventHandler): IHandle; toMap(screenPoint: ScreenPoint, mapPoint?: Point): Point; toScreen(point: Point, screenPoint?: ScreenPoint): ScreenPoint; } @@ -6208,7 +6197,7 @@ declare namespace __esri { goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | Camera | any, options?: SceneViewGoToOptions): IPromise; hasEventListener(type: string): boolean; hitTest(screenPoint: SceneViewHitTestScreenPoint): IPromise; - on(type: string | string[], modifiersOrHandler: string[] | Function, handler?: Function): any; + on(type: string | string[], modifiersOrHandler: string[] | EventHandler, handler?: EventHandler): IHandle; toMap(screenPoint: ScreenPoint, mapPoint?: Point): Point; toScreen(point: Point, screenPoint?: ScreenPoint): ScreenPoint; } @@ -6257,11 +6246,11 @@ declare namespace __esri { export const View: ViewConstructor; interface ViewProperties extends BreakpointsOwnerProperties, DOMContainerProperties { - allLayerViews?: Collection; + allLayerViews?: Collection | any[]; animation?: ViewAnimationProperties; - graphics?: Collection; + graphics?: Collection | any[]; interacting?: boolean; - layerViews?: Collection; + layerViews?: Collection | any[]; map?: MapProperties; padding?: ViewPadding; ready?: boolean; @@ -6502,7 +6491,7 @@ declare namespace __esri { export const Presentation: PresentationConstructor; interface PresentationProperties { - slides?: Collection; + slides?: Collection | any[]; } interface Slide extends Accessor { @@ -6736,7 +6725,7 @@ declare namespace __esri { interface LayerListProperties extends WidgetProperties { createActionsFunction?: Function; - operationalItems?: Collection; + operationalItems?: Collection | any[]; view?: MapView | SceneView; viewModel?: LayerListViewModelProperties; } @@ -6813,7 +6802,6 @@ declare namespace __esri { features: Graphic[]; location: Point; promises: IPromise[]; - rendered: boolean; selectedFeature: Graphic; selectedFeatureIndex: number; title: string; @@ -6836,7 +6824,7 @@ declare namespace __esri { export const Popup: PopupConstructor; interface PopupProperties extends WidgetteProperties { - actions?: Collection; + actions?: Collection | any[]; content?: string | any; currentDockPosition?: string; dockEnabled?: boolean; @@ -6845,7 +6833,6 @@ declare namespace __esri { features?: GraphicProperties[]; location?: PointProperties; promises?: IPromise[]; - rendered?: boolean; selectedFeature?: GraphicProperties; selectedFeatureIndex?: number; title?: string; @@ -7142,7 +7129,7 @@ declare namespace __esri { interface BasemapGalleryViewModelProperties { activeBasemap?: BasemapProperties; - items?: Collection; + items?: Collection | any[]; source?: LocalBasemapsSource | PortalBasemapsSource; state?: string; view?: MapView | SceneView; @@ -7245,7 +7232,7 @@ declare namespace __esri { interface LayerListViewModelProperties { createActionsFunction?: Function; - operationalItems?: Collection; + operationalItems?: Collection | any[]; state?: string; view?: MapView | SceneView; } @@ -7356,7 +7343,7 @@ declare namespace __esri { export const PopupViewModel: PopupViewModelConstructor; interface PopupViewModelProperties { - actions?: Collection; + actions?: Collection | any[]; content?: string | any; featureCount?: number; features?: GraphicProperties[]; @@ -7491,6 +7478,17 @@ declare namespace __esri { view?: MapView | SceneView; } + interface Evented { + hasEventListener(type: string): boolean; + on(type: string, listener: EventHandler): IHandle; + } + + interface EventedConstructor { + new(): Evented; + } + + export const Evented: EventedConstructor; + interface JSONSupport { toJSON(): any; } @@ -7627,14 +7625,14 @@ declare namespace __esri { export const ArcGISDynamicMapService: ArcGISDynamicMapServiceConstructor; interface ArcGISDynamicMapServiceProperties { - allSublayers?: Collection; + allSublayers?: Collection | any[]; dpi?: number; gdbVersion?: string; imageFormat?: string; imageMaxHeight?: number; imageMaxWidth?: number; imageTransparency?: boolean; - sublayers?: Collection; + sublayers?: Collection | any[]; } interface ArcGISImageService { @@ -7809,7 +7807,7 @@ declare namespace __esri { export const LayersMixin: LayersMixinConstructor; interface LayersMixinProperties { - layers?: Collection; + layers?: Collection | any[]; } interface BreakpointsOwner { @@ -7833,7 +7831,7 @@ declare namespace __esri { } interface DOMContainer { - container: string; + container: HTMLDivElement | string; height: number; popup: Popup; resizing: boolean; @@ -7850,7 +7848,7 @@ declare namespace __esri { export const DOMContainer: DOMContainerConstructor; interface DOMContainerProperties { - container?: string; + container?: HTMLDivElement | string; height?: number; popup?: Popup; resizing?: boolean; @@ -8381,6 +8379,8 @@ declare module "esri" { export import EasingFunction = __esri.EasingFunction; + export import EventHandler = __esri.EventHandler; + export import PromisedWatchHandle = __esri.PromisedWatchHandle; export import GroundQueryElevationOptions = __esri.GroundQueryElevationOptions; @@ -8748,11 +8748,6 @@ declare module "esri" { export import sizeGetSchemesParams = __esri.sizeGetSchemesParams; } -declare module "esri/core/Evented" { - import Evented = __esri.Evented; - export = Evented; -} - declare module "esri/Basemap" { import Basemap = __esri.Basemap; export = Basemap; @@ -9833,6 +9828,11 @@ declare module "esri/widgets/Zoom/ZoomViewModel" { export = ZoomViewModel; } +declare module "esri/core/Evented" { + import Evented = __esri.Evented; + export = Evented; +} + declare module "esri/core/JSONSupport" { import JSONSupport = __esri.JSONSupport; export = JSONSupport; diff --git a/types/arcgis-js-api/v3/arcgis-js-api-tests.ts b/types/arcgis-js-api/v3/arcgis-js-api-tests.ts index ee6c5105fd..23fb7af03b 100644 --- a/types/arcgis-js-api/v3/arcgis-js-api-tests.ts +++ b/types/arcgis-js-api/v3/arcgis-js-api-tests.ts @@ -2,8 +2,6 @@ import esri = require("esri"); import Map = require("esri/map"); import Point = require("esri/geometry/Point"); -export = MapController; - class MapController { map: Map; diff --git a/types/arcgis-rest-api/arcgis-rest-api-tests.ts b/types/arcgis-rest-api/arcgis-rest-api-tests.ts index 0f4cf3d926..3955b02f35 100644 --- a/types/arcgis-rest-api/arcgis-rest-api-tests.ts +++ b/types/arcgis-rest-api/arcgis-rest-api-tests.ts @@ -8,4 +8,4 @@ point = { spatialReference: { wkid: 4326 } -}; \ No newline at end of file +}; diff --git a/types/arcgis-rest-api/index.d.ts b/types/arcgis-rest-api/index.d.ts index 65a02a4367..ade4b7a857 100644 --- a/types/arcgis-rest-api/index.d.ts +++ b/types/arcgis-rest-api/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for arcgis-to-geojson-utils 10.4 +// Type definitions for ArcGIS REST API 10.4 // Project: http://resources.arcgis.com/en/help/arcgis-rest-api/ // Definitions by: Jeff Jacobson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -65,7 +65,6 @@ export interface BezierCurve { export type JsonCurve = CircularArc | Arc | OldCircularArc | BezierCurve; - export interface SpatialReferenceWkid { wkid?: number; latestWkid?: number; @@ -131,7 +130,6 @@ export interface Envelope extends Geometry { export type esriGeometryType = "esriGeometryPoint" | "esriGeometryMultipoint" | "esriGeometryPolyline" | "esriGeometryPolygon" | "esriGeometryEnvelope"; - export type Color = [number, number, number, number]; export type SimpleMarkerSymbolStyle = "esriSMSCircle" | "esriSMSCross" | "esriSMSDiamond" | "esriSMSSquare" | "esriSMSX" | "esriSMSTriangle"; export type SimpleLineSymbolStyle = "esriSLSDash" | "esriSLSDashDot" | "esriSLSDashDotDot" | "esriSLSDot" | "esriSLSNull" | "esriSLSSolid"; @@ -181,7 +179,6 @@ export interface PictureSourced { "angle"?: number; "xoffset"?: number; "yoffset"?: number; - } export interface PictureMarkerSymbol extends MarkerSymbol, PictureSourced { @@ -217,4 +214,4 @@ export interface TextSymbol extends MarkerSymbol { "kerning"?: boolean; "font"?: Font; "text"?: string; // only applicable when specified as a client-side graphic. -} \ No newline at end of file +} diff --git a/types/arcgis-rest-api/tslint.json b/types/arcgis-rest-api/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/arcgis-rest-api/tslint.json +++ b/types/arcgis-rest-api/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/arcgis-to-geojson-utils/arcgis-to-geojson-utils-tests.ts b/types/arcgis-to-geojson-utils/arcgis-to-geojson-utils-tests.ts index 2e9337793a..5cb9d9472e 100644 --- a/types/arcgis-to-geojson-utils/arcgis-to-geojson-utils-tests.ts +++ b/types/arcgis-to-geojson-utils/arcgis-to-geojson-utils-tests.ts @@ -14,7 +14,7 @@ const geojsonPoint: GeoJSON.Point = { }; // parse ArcGIS JSON, convert it to GeoJSON -var geojson = utils.arcgisToGeoJSON(arcgisPoint); +const geojson = utils.arcgisToGeoJSON(arcgisPoint); // take GeoJSON and convert it to ArcGIS JSON -var arcgis = utils.geojsonToArcGIS(geojsonPoint); \ No newline at end of file +const arcgis = utils.geojsonToArcGIS(geojsonPoint); diff --git a/types/arcgis-to-geojson-utils/index.d.ts b/types/arcgis-to-geojson-utils/index.d.ts index 94a86022a3..65c78a4230 100644 --- a/types/arcgis-to-geojson-utils/index.d.ts +++ b/types/arcgis-to-geojson-utils/index.d.ts @@ -15,4 +15,4 @@ export function arcgisToGeoJSON(arcgis: T): GeoJSON.G /** * Converts a GeoJSON geometry into a ArcGIS geometry. */ -export function geojsonToArcGIS(geojson: GeoJSON.GeometryObject): ArcGis.Geometry; \ No newline at end of file +export function geojsonToArcGIS(geojson: GeoJSON.GeometryObject): ArcGis.Geometry; diff --git a/types/arcgis-to-geojson-utils/tslint.json b/types/arcgis-to-geojson-utils/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/arcgis-to-geojson-utils/tslint.json +++ b/types/arcgis-to-geojson-utils/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/archiver/archiver-tests.ts b/types/archiver/archiver-tests.ts index f186fb9bcb..d4ea423a4f 100644 --- a/types/archiver/archiver-tests.ts +++ b/types/archiver/archiver-tests.ts @@ -1,19 +1,41 @@ -import Archiver = require('archiver'); -import FS = require('fs'); +import * as Archiver from 'archiver'; +import * as fs from 'fs'; -var archiver = Archiver.create('zip'); +const archiver = Archiver.create('zip'); -var writeStream = FS.createWriteStream('./archiver.d.ts'); -var readStream = FS.createReadStream('./archiver.d.ts'); +const writeStream = fs.createWriteStream('./archiver.d.ts'); +const readStream = fs.createReadStream('./archiver.d.ts'); + +archiver.abort(); archiver.pipe(writeStream); -archiver.append(readStream, {name: 'archiver.d.ts'}); -archiver.finalize(); +archiver.append(readStream, { name: 'archiver.d.ts' }); + +archiver.append(readStream, {name: 'archiver.d.ts'}) +.append(readStream, {name: 'archiver.d.ts'}); + +archiver.bulk({ mappaing: {} }); archiver.directory('./path', './someOtherPath'); -archiver.directory('./path', { name: "testName"} ); - +archiver.directory('./path', { name: "testName" }); archiver.directory('./', "", {}); -archiver.directory('./', {name: 'test'}, {}); +archiver.directory('./', { name: 'test' }, {}); -archiver.bulk({ mappaing: {} }); \ No newline at end of file +archiver.append(readStream, { + name: "sub/folder.xml" +}); + +archiver.glob("**", { + cwd: 'path/to/files', +}); +archiver.glob('./path', {}, {}); + +archiver.file('./path', { name: 'test' }); + +archiver.setFormat('zip'); +archiver.setModule(() => {}); + +archiver.pointer(); +archiver.use(() => {}); + +archiver.finalize(); diff --git a/types/archiver/index.d.ts b/types/archiver/index.d.ts index 665624143e..2e4b1063ff 100644 --- a/types/archiver/index.d.ts +++ b/types/archiver/index.d.ts @@ -1,47 +1,66 @@ -// Type definitions for archiver v0.15.0 +// Type definitions for archiver 1.3 // Project: https://github.com/archiverjs/node-archiver -// Definitions by: Esri +// Definitions by: Esri , Dolan Miu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* =================== USAGE =================== import Archiver = require('archiver); var archiver = Archiver.create('zip'); - archiver.pipe(FS.createWriteStream('xxx')); - archiver.append(FS.createReadStream('xxx')); + archiver.pipe(fs.createWriteStream('xxx')); + archiver.append(fs.createReadStream('xxx')); archiver.finalize(); =============================================== */ /// -import * as FS from 'fs'; -import * as STREAM from 'stream'; +import * as fs from 'fs'; +import * as stream from 'stream'; +import * as express from 'express'; +import * as glob from 'glob'; - -declare function archiver(format: string, options?: archiver.Options): archiver.Archiver; +declare function archiver(format: archiver.Format, options?: archiver.ArchiverOptions): archiver.Archiver; declare namespace archiver { + type Format = 'zip' | 'tar'; - export function create(format: string, options?: Options): Archiver; + function create(format: string, options?: ArchiverOptions): Archiver; + function registerFormat(format: string, module: Function): void; - - export interface nameInterface { + interface EntryData { name?: string; + prefix?: string; + stats?: string; } - export interface Archiver extends STREAM.Transform { - append(source: STREAM.Readable | Buffer | string, name: nameInterface): void; + interface Archiver extends stream.Transform { + abort(): this; + append(source: stream.Readable | Buffer | string, name?: EntryData): this; - directory(dirpath: string, destpath: nameInterface | string): void; - directory(dirpath: string, destpath: nameInterface | string, data: any | Function): void; + bulk(mappings: any): this; - bulk(mappings: any): void; - finalize(): void; + directory(dirpath: string, options: EntryData | string, data?: EntryData): this; + + file(filename: string, data: EntryData): this; + glob(pattern: string, options?: glob.IOptions, data?: EntryData): this; + finalize(): this; + + pipe(stream: fs.WriteStream | express.Response): void; + + setFormat(format: string): this; + setModule(module: Function): this; + + pointer(): number; + use(plugin: Function): this; } - export interface Options { - + interface ArchiverOptions { + store?: boolean; + gzip?: boolean; + gzipOptions?: { + level: number, + }; } } diff --git a/types/archiver/tslint.json b/types/archiver/tslint.json new file mode 100644 index 0000000000..a62d0d4e68 --- /dev/null +++ b/types/archiver/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false + } +} diff --git a/types/array-find-index/tslint.json b/types/array-find-index/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/array-find-index/tslint.json +++ b/types/array-find-index/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/array-uniq/array-uniq-tests.ts b/types/array-uniq/array-uniq-tests.ts index 8674d2508c..b6c90c620a 100644 --- a/types/array-uniq/array-uniq-tests.ts +++ b/types/array-uniq/array-uniq-tests.ts @@ -2,4 +2,4 @@ import arrayUniq = require("array-uniq"); arrayUniq([1, 1, 2, 3, 3]); -arrayUniq(["foo", "foo", "bar", "foo"]); \ No newline at end of file +arrayUniq(["foo", "foo", "bar", "foo"]); diff --git a/types/array-uniq/index.d.ts b/types/array-uniq/index.d.ts index 25d97c0a94..d05ad76072 100644 --- a/types/array-uniq/index.d.ts +++ b/types/array-uniq/index.d.ts @@ -5,4 +5,4 @@ declare function arrayUniq(arr: T[]): T[]; -export = arrayUniq; \ No newline at end of file +export = arrayUniq; diff --git a/types/array-uniq/tslint.json b/types/array-uniq/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/array-uniq/tslint.json +++ b/types/array-uniq/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/artyom.js/artyom.js-tests.ts b/types/artyom.js/artyom.js-tests.ts index 67e5908883..d301c9a6f4 100644 --- a/types/artyom.js/artyom.js-tests.ts +++ b/types/artyom.js/artyom.js-tests.ts @@ -29,4 +29,4 @@ artyom.getVoices(); artyom.getLanguage(); // Get the artyom.js version -artyom.getVersion(); \ No newline at end of file +artyom.getVersion(); diff --git a/types/artyom.js/index.d.ts b/types/artyom.js/index.d.ts index ae120015ca..b4f85781c6 100644 --- a/types/artyom.js/index.d.ts +++ b/types/artyom.js/index.d.ts @@ -22,16 +22,16 @@ interface SpeechRecognition extends EventTarget { start(): void; stop(): void; abort(): void; - onaudiostart: (ev: Event) => any; - onsoundstart: (ev: Event) => any; - onspeechstart: (ev: Event) => any; - onspeechend: (ev: Event) => any; - onsoundend: (ev: Event) => any; - onresult: (ev: SpeechRecognitionEvent) => any; - onnomatch: (ev: SpeechRecognitionEvent) => any; - onerror: (ev: SpeechRecognitionError) => any; - onstart: (ev: Event) => any; - onend: (ev: Event) => any; + onaudiostart(ev: Event): any; + onsoundstart(ev: Event): any; + onspeechstart(ev: Event): any; + onspeechend(ev: Event): any; + onsoundend(ev: Event): any; + onresult(ev: SpeechRecognitionEvent): any; + onnomatch(ev: SpeechRecognitionEvent): any; + onerror(ev: SpeechRecognitionError): any; + onstart(ev: Event): any; + onend(ev: Event): any; } interface SpeechRecognitionStatic { @@ -106,7 +106,7 @@ interface SpeechSynthesis extends EventTarget { speaking: boolean; paused: boolean; - onvoiceschanged: (ev: Event) => any; + onvoiceschanged(ev: Event): any; speak(utterance: SpeechSynthesisUtterance): void; cancel(): void; pause(): void; @@ -128,13 +128,13 @@ interface SpeechSynthesisUtterance extends EventTarget { rate: number; pitch: number; - onstart: (ev: SpeechSynthesisEvent) => any; - onend: (ev: SpeechSynthesisEvent) => any; - onerror: (ev: SpeechSynthesisErrorEvent) => any; - onpause: (ev: SpeechSynthesisEvent) => any; - onresume: (ev: SpeechSynthesisEvent) => any; - onmark: (ev: SpeechSynthesisEvent) => any; - onboundary: (ev: SpeechSynthesisEvent) => any; + onstart(ev: SpeechSynthesisEvent): any; + onend(ev: SpeechSynthesisEvent): any; + onerror(ev: SpeechSynthesisErrorEvent): any; + onpause(ev: SpeechSynthesisEvent): any; + onresume(ev: SpeechSynthesisEvent): any; + onmark(ev: SpeechSynthesisEvent): any; + onboundary(ev: SpeechSynthesisEvent): any; } interface SpeechSynthesisUtteranceStatic { @@ -211,7 +211,7 @@ declare namespace Artyom { /** Triggers of the command */ indexes: string[]; /** Logic to execute when the command is triggered */ - action: (i: number, wildcard?: string, full?: string) => void; + action(i: number, wildcard?: string, full?: string): void; /** Description of the command */ description?: string; /** Flag to specify is a command is either normal or smart */ @@ -502,7 +502,7 @@ declare namespace Artyom { /** * Method to bla, bla, bla... */ - static getInstance(): ArtyomJS + static getInstance(): ArtyomJS; } } diff --git a/types/artyom.js/tslint.json b/types/artyom.js/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/artyom.js/tslint.json +++ b/types/artyom.js/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/assert-equal-jsx/assert-equal-jsx-tests.tsx b/types/assert-equal-jsx/assert-equal-jsx-tests.tsx new file mode 100644 index 0000000000..16e6467637 --- /dev/null +++ b/types/assert-equal-jsx/assert-equal-jsx-tests.tsx @@ -0,0 +1,16 @@ +import * as React from 'react'; +import assertEqualJSX = require('assert-equal-jsx'); + +function sanitizeId(str: string): string { + return str.replace(/my-component-id-(\d+)/ig, 'my-component-id-0'); +} + +assertEqualJSX( +
, + // should equal: +
, + // with sanitization: + { + sanitize: sanitizeId + } +); diff --git a/types/assert-equal-jsx/index.d.ts b/types/assert-equal-jsx/index.d.ts new file mode 100644 index 0000000000..5deb9ede36 --- /dev/null +++ b/types/assert-equal-jsx/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for assert-equal-jsx 1.0 +// Project: https://github.com/thejameskyle/assert-equal-jsx +// Definitions by: Josh Toft +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import * as React from 'react'; + +declare namespace assertEqualJSX { + interface AsssertOptions { + sanitize?(str: string): string; + } +} + +declare function assertEqualJSX(actual: JSX.Element, expected: JSX.Element, opts?: assertEqualJSX.AsssertOptions): void; + +export = assertEqualJSX; diff --git a/types/assert-equal-jsx/tsconfig.json b/types/assert-equal-jsx/tsconfig.json new file mode 100644 index 0000000000..25c499a18f --- /dev/null +++ b/types/assert-equal-jsx/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "assert-equal-jsx-tests.tsx" + ] +} diff --git a/types/assert-equal-jsx/tslint.json b/types/assert-equal-jsx/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/assert-equal-jsx/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/assert-plus/index.d.ts b/types/assert-plus/index.d.ts index 5de187cb85..d79172bc49 100644 --- a/types/assert-plus/index.d.ts +++ b/types/assert-plus/index.d.ts @@ -122,7 +122,6 @@ export function AssertionError(options: any, message ?: string): void; */ export function fail(actual: any, expected: any, message: any, operator: any): void; - /** * Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`. * @@ -353,5 +352,4 @@ export function doesNotThrow(block: any, error ?: any, message ?: string): void; */ export function ifError(value: any): void; - export as namespace AssertPlus; diff --git a/types/assert-plus/tslint.json b/types/assert-plus/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/assert-plus/tslint.json +++ b/types/assert-plus/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/aurelia-knockout/tslint.json b/types/aurelia-knockout/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/aurelia-knockout/tslint.json +++ b/types/aurelia-knockout/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/auto-sni/auto-sni-tests.ts b/types/auto-sni/auto-sni-tests.ts new file mode 100644 index 0000000000..a271a1a1ad --- /dev/null +++ b/types/auto-sni/auto-sni-tests.ts @@ -0,0 +1,6 @@ +import * as autosni from "auto-sni"; +let a = autosni({ + agreeTos: true, + email: '', + domains: [''] +}); diff --git a/types/auto-sni/index.d.ts b/types/auto-sni/index.d.ts new file mode 100644 index 0000000000..bc252831ca --- /dev/null +++ b/types/auto-sni/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for auto-sni 2.1 +// Project: https://www.npmjs.com/package/auto-sni +// Definitions by: Jan Wolf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import {Server} from "https"; + +declare namespace createServer { + interface Options { + email: string; + agreeTos: boolean; + domains: Array; + ports?: { + http?: number, + https?: number + }; + debug?: boolean; + } +} + +declare function createServer(opts: createServer.Options, app?: any): Server; + +export = createServer; diff --git a/types/auto-sni/tsconfig.json b/types/auto-sni/tsconfig.json new file mode 100644 index 0000000000..715f315867 --- /dev/null +++ b/types/auto-sni/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "auto-sni-tests.ts" + ] +} diff --git a/types/auto-sni/tslint.json b/types/auto-sni/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/auto-sni/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/autobahn/index.d.ts b/types/autobahn/index.d.ts index 8a37bdf21b..6741bcccd1 100644 --- a/types/autobahn/index.d.ts +++ b/types/autobahn/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for AutobahnJS v0.9.7 // Project: http://autobahn.ws/js/ -// Definitions by: Elad Zelingher , Andy Hawkins +// Definitions by: Elad Zelingher , Andy Hawkins , Wladimir Totino // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -167,8 +167,14 @@ declare namespace autobahn { interface IPublishOptions { acknowledge?: boolean; exclude?: number[]; + exclude_authid?: string[]; + exclude_authrole?: string[]; eligible?: number[]; - disclose_me?: Boolean; + eligible_authid?: string[]; + eligible_authrole?: string[]; + retain?: boolean; + disclose_me?: boolean; + exclude_me?: boolean; } interface ISubscribeOptions { diff --git a/types/autoprefixer/tslint.json b/types/autoprefixer/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/autoprefixer/tslint.json +++ b/types/autoprefixer/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/awesomplete/awesomplete-tests.ts b/types/awesomplete/awesomplete-tests.ts index 5a33aeb135..6cea0e1bca 100644 --- a/types/awesomplete/awesomplete-tests.ts +++ b/types/awesomplete/awesomplete-tests.ts @@ -1,6 +1,6 @@ import * as Awesomplete from 'awesomplete'; -var input = document.getElementById("myinput"); +const input = document.getElementById("myinput"); new Awesomplete(input, {list: "#mylist"}); new Awesomplete(input, {list: document.querySelector("#mylist")}); @@ -9,7 +9,7 @@ new Awesomplete(input, { list: ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"] }); -var awesomplete = new Awesomplete(input); +const awesomplete = new Awesomplete(input); awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"]; new Awesomplete(input, { @@ -46,15 +46,15 @@ new Awesomplete('input[data-multiple]', { }, replace: (text: string) => { - var before = this.input.value.match(/^.+,\s*|/)[0]; + const before = this.input.value.match(/^.+,\s*|/)[0]; this.input.value = before + text + ", "; } }); -var ajax = new XMLHttpRequest(); +const ajax = new XMLHttpRequest(); ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true); ajax.onload = () => { - var list = JSON.parse(ajax.responseText).map((i: any) => i.name); + const list = JSON.parse(ajax.responseText).map((i: any) => i.name); new Awesomplete(document.querySelector("#ajax-example input"), { list }); }; ajax.send(); diff --git a/types/awesomplete/index.d.ts b/types/awesomplete/index.d.ts index 41abc36be6..4612d66210 100644 --- a/types/awesomplete/index.d.ts +++ b/types/awesomplete/index.d.ts @@ -6,14 +6,14 @@ declare class Awesomplete { constructor(input: Element | HTMLElement | string, o?: Awesomplete.Options); static all: any[]; - static $$: (expr: string | NodeSelector, con?: any) => NodeList; + static $$(expr: string | NodeSelector, con?: any): NodeList; static ITEM: (text: string, input: string) => HTMLElement; static $: { (expr: string|Element, con?: NodeSelector): string | Element; - regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any; - create: (tag: string, o: any) => HTMLElement; - fire: (target: EventTarget, type: string, properties: any) => any; - siblingIndex: (el: Element) => number; + regExpEscape(s: { replace(arg0: RegExp, arg1: string): void }): any; + create(tag: string, o: any): HTMLElement; + fire(target: EventTarget, type: string, properties: any): any; + siblingIndex(el: Element): number; }; static FILTER_STARTSWITH: (text: string, input: string) => boolean; static FILTER_CONTAINS: (text: string, input: string) => boolean; @@ -45,11 +45,11 @@ declare namespace Awesomplete { minChars?: number; maxItems?: number; autoFirst?: boolean; - data?: (item: Suggestion, input: string) => string; - filter?: (text: string, input: string) => boolean; - sort?: (left: number | any[], right: number | any[]) => number; - item?: (text: string, input: string) => HTMLElement; - replace?: (text: string) => void; + data?(item: Suggestion, input: string): string; + filter?(text: string, input: string): boolean; + sort?(left: number | any[], right: number | any[]): number; + item?(text: string, input: string): HTMLElement; + replace?(text: string): void; } } diff --git a/types/awesomplete/tslint.json b/types/awesomplete/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/awesomplete/tslint.json +++ b/types/awesomplete/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/aws-lambda-mock-context/tslint.json b/types/aws-lambda-mock-context/tslint.json index 192203ab54..f93cf8562a 100644 --- a/types/aws-lambda-mock-context/tslint.json +++ b/types/aws-lambda-mock-context/tslint.json @@ -1,3 +1,3 @@ { - "extends": "../tslint.json" -} \ No newline at end of file + "extends": "dtslint/dt.json" +} diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 3aede36d4c..e793442177 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -5,12 +5,17 @@ var num: number = 5; var error: Error = new Error(); var b: boolean = true; var apiGwEvt: AWSLambda.APIGatewayEvent; +var customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent; var clientCtx: AWSLambda.ClientContext; var clientContextEnv: AWSLambda.ClientContextEnv; var clientContextClient: AWSLambda.ClientContextClient; var context: AWSLambda.Context; var identity: AWSLambda.CognitoIdentity; var proxyResult: AWSLambda.ProxyResult; +var authResponse: AWSLambda.AuthResponse; +var policyDocument: AWSLambda.PolicyDocument; +var statement: AWSLambda.Statement; +var authResponseContext: AWSLambda.AuthResponseContext; var snsEvt: AWSLambda.SNSEvent; var snsEvtRecs: AWSLambda.SNSEventRecord[]; var snsEvtRec: AWSLambda.SNSEventRecord; @@ -87,6 +92,11 @@ str = apiGwEvt.requestContext.resourceId; str = apiGwEvt.requestContext.resourcePath; str = apiGwEvt.resource; +/* API Gateway CustomAuthorizer Event */ +str = customAuthorizerEvt.type; +str = customAuthorizerEvt.authorizationToken; +str = customAuthorizerEvt.methodArn; + /* SNS Event */ snsEvtRecs = snsEvt.Records; @@ -119,6 +129,41 @@ proxyResult.headers["example"] = b; proxyResult.headers["example"] = num; str = proxyResult.body; +/* API Gateway CustomAuthorizer AuthResponse */ +authResponseContext = { + stringKey: str, + numberKey: num, + booleanKey: b +}; + +statement = { + Action: str, + Effect: str, + Resource: str +}; + +statement = { + Action: [str, str], + Effect: str, + Resource: [str, str] +}; + +policyDocument = { + Version: str, + Statement: [statement] +}; + +authResponse = { + principalId: str, + policyDocument: policyDocument, + context: authResponseContext +}; + +authResponse = { + principalId: str, + policyDocument: policyDocument +}; + /* Context */ b = context.callbackWaitsForEmptyEventLoop; str = context.functionName; @@ -170,6 +215,14 @@ function proxyCallback(cb: AWSLambda.ProxyCallback) { cb(null, proxyResult); } +/* CustomAuthorizerCallback */ +function customAuthorizerCallback(cb: AWSLambda.CustomAuthorizerCallback) { + cb(); + cb(null); + cb(error); + cb(null, authResponse); +} + /* Compatibility functions */ context.done(); context.done(error); @@ -183,3 +236,4 @@ context.fail(str); /* Handler */ let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { }; let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { }; +let CustomAuthorizerHandler: AWSLambda.CustomAuthorizerHandler = (event: AWSLambda.CustomAuthorizerEvent, context: AWSLambda.Context, cb: AWSLambda.CustomAuthorizerCallback) => { }; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index c5e49d54c6..a5fa271699 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -39,6 +39,13 @@ interface APIGatewayEvent { resource: string; } +// API Gateway CustomAuthorizer "event" +interface CustomAuthorizerEvent { + type: string; + authorizationToken: string; + methodArn: string; +} + // SNS "event" interface SNSMessageAttribute { Type: string; @@ -180,6 +187,43 @@ interface ProxyResult { body: string; } +/** + * API Gateway CustomAuthorizer AuthResponse. + * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output + */ +interface AuthResponse { + principalId: string; + policyDocument: PolicyDocument; + context?: AuthResponseContext; +} + +/** + * API Gateway CustomAuthorizer AuthResponse.PolicyDocument. + * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output + */ +interface PolicyDocument { + Version: string; + Statement: [Statement]; +} + +/** + * API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement. + * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output + */ +interface Statement { + Action: string | [string]; + Effect: string; + Resource: string | [string]; +} + +/** + * API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement. + * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output + */ +interface AuthResponseContext { + [name: string]: string | number | boolean; +} + /** * AWS Lambda handler function. * http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html @@ -190,6 +234,7 @@ interface ProxyResult { */ export type Handler = (event: any, context: Context, callback?: Callback) => void; export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => void; +export type CustomAuthorizerHandler = (event: CustomAuthorizerEvent, context: Context, callback?: CustomAuthorizerCallback) => void; /** * Optional callback parameter. @@ -200,5 +245,6 @@ export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: */ export type Callback = (error?: Error, result?: any) => void; export type ProxyCallback = (error?: Error, result?: ProxyResult) => void; +export type CustomAuthorizerCallback = (error?: Error, result?: AuthResponse) => void; export as namespace AWSLambda; diff --git a/types/aws-sdk/aws-sdk-tests.ts b/types/aws-sdk/aws-sdk-tests.ts deleted file mode 100644 index 5188a3e725..0000000000 --- a/types/aws-sdk/aws-sdk-tests.ts +++ /dev/null @@ -1,422 +0,0 @@ - -import AWS = require('aws-sdk'); - -var str: string; - -var creds: AWS.Credentials; - -creds = new AWS.Credentials(str, str); -creds = new AWS.Credentials(str, str, str); -str = creds.accessKeyId; - - -/* - * ECS - */ -var ecs:AWS.ECS - -ecs = new AWS.ECS(); -ecs = new AWS.ECS({apiVersion: '2012-11-05'}); - -ecs.describeClusters({ - clusters: ['STRING_VALUE', 'STRING_VALUE'] - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -ecs.describeTasks({ - cluster: 'STRING_VALUE', - tasks: ['STRING_VALUE', 'STRING_VALUE'] - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - - -/* - * SQS - */ -var sqs:AWS.SQS - -//Default constructor -sqs = new AWS.SQS(); - -//Locking the API Version -sqs = new AWS.SQS({apiVersion: '2012-11-05'}); - -// Locking the API Version Globally -AWS.config.apiVersions = { - sqs: '2012-11-05', - // other service API versions -}; - -sqs.addPermission({ - AWSAccountIds: [ /* required */ - 'STRING_VALUE', - /* more items */ - ], - Actions: [ /* required */ - 'STRING_VALUE', - /* more items */ - ], - Label: 'STRING_VALUE', /* required */ - QueueUrl: 'STRING_VALUE' /* required */ - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.changeMessageVisibility({ - QueueUrl: 'STRING_VALUE', /* required */ - ReceiptHandle: 'STRING_VALUE', /* required */ - VisibilityTimeout: 0 /* required */ - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.changeMessageVisibilityBatch({ - Entries: [ /* required */ - { - Id: 'STRING_VALUE', /* required */ - ReceiptHandle: 'STRING_VALUE', /* required */ - VisibilityTimeout: 0 - }, - /* more items */ - ], - QueueUrl: 'STRING_VALUE' /* required */ - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.createQueue({ - QueueName: 'STRING_VALUE', /* required */ - Attributes: { - someKey: 'STRING_VALUE', - /* anotherKey: ... */ - } - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.deleteMessage({ - QueueUrl: 'STRING_VALUE', /* required */ - ReceiptHandle: 'STRING_VALUE' /* required */ - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.deleteMessageBatch({ - Entries: [ /* required */ - { - Id: 'STRING_VALUE', /* required */ - ReceiptHandle: 'STRING_VALUE' /* required */ - }, - /* more items */ - ], - QueueUrl: 'STRING_VALUE' /* required */ - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.deleteQueue({ - QueueUrl: 'STRING_VALUE' /* required */ - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.getQueueAttributes({ - QueueUrl: 'STRING_VALUE', /* required */ - AttributeNames: [ - 'Policy | VisibilityTimeout | MaximumMessageSize | MessageRetentionPeriod | ApproximateNumberOfMessages | ApproximateNumberOfMessagesNotVisible | CreatedTimestamp | LastModifiedTimestamp | QueueArn | ApproximateNumberOfMessagesDelayed | DelaySeconds | ReceiveMessageWaitTimeSeconds | RedrivePolicy', - /* more items */ - ] - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.getQueueUrl({ - QueueName: 'STRING_VALUE', /* required */ - QueueOwnerAWSAccountId: 'STRING_VALUE' - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.listDeadLetterSourceQueues({ - QueueUrl: 'STRING_VALUE' /* required */ - }, function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.listQueues({ - QueueNamePrefix: 'STRING_VALUE' - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.purgeQueue({ - QueueUrl: 'STRING_VALUE' /* required */ - }, function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.receiveMessage({ - QueueUrl: 'STRING_VALUE', /* required */ - AttributeNames: [ - 'Policy | VisibilityTimeout | MaximumMessageSize | MessageRetentionPeriod | ApproximateNumberOfMessages | ApproximateNumberOfMessagesNotVisible | CreatedTimestamp | LastModifiedTimestamp | QueueArn | ApproximateNumberOfMessagesDelayed | DelaySeconds | ReceiveMessageWaitTimeSeconds | RedrivePolicy', - /* more items */ - ], - MaxNumberOfMessages: 0, - MessageAttributeNames: [ - 'STRING_VALUE', - /* more items */ - ], - VisibilityTimeout: 0, - WaitTimeSeconds: 0 - }, function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.removePermission({ - Label: 'STRING_VALUE', /* required */ - QueueUrl: 'STRING_VALUE' /* required */ - }, function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.sendMessage({ - MessageBody: 'STRING_VALUE', /* required */ - QueueUrl: 'STRING_VALUE', /* required */ - DelaySeconds: 0, - MessageAttributes: { - someKey: { - DataType: 'STRING_VALUE', /* required */ - BinaryListValues: [ - new Buffer('...') || 'STRING_VALUE', - /* more items */ - ], - BinaryValue: new Buffer('...') || 'STRING_VALUE', - StringListValues: [ - 'STRING_VALUE', - /* more items */ - ], - StringValue: 'STRING_VALUE' - }, - /* anotherKey: ... */ - } - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.sendMessageBatch({ - Entries: [ /* required */ - { - Id: 'STRING_VALUE', /* required */ - MessageBody: 'STRING_VALUE', /* required */ - DelaySeconds: 0, - MessageAttributes: { - someKey: { - DataType: 'STRING_VALUE', /* required */ - BinaryListValues: [ - new Buffer('...') , - /* more items */ - ], - BinaryValue: new Buffer('...'), - StringListValues: [ - 'STRING_VALUE', - /* more items */ - ], - StringValue: 'STRING_VALUE' - }, - /* anotherKey: ... */ - } - }, - /* more items */ - ], - QueueUrl: 'STRING_VALUE' /* required */ - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - -sqs.setQueueAttributes({ - Attributes: { /* required */ - someKey: 'STRING_VALUE', - /* anotherKey: ... */ - }, - QueueUrl: 'STRING_VALUE' /* required */ - }, function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); - - var dynamoDBDocClient:AWS.DynamoDB.DocumentClient; -dynamoDBDocClient = new AWS.DynamoDB.DocumentClient(); -dynamoDBDocClient = new AWS.DynamoDB.DocumentClient({}); -dynamoDBDocClient.createSet([1, 2, 3], { validate: true }); -dynamoDBDocClient.get( - { - TableName: 'TABLE_NAME', - Key: { userId: 'abc123', email: 'abc123@abc123.com' } - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - } -); -dynamoDBDocClient.put( - { - TableName: 'TABLE_NAME', - Item: { - userId: 'abc123', - email: 'abc123@abc123.com', - firstName: 'Matt', - lastName: 'Forrester the ' + new Date().getTime() - } - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - } -); -dynamoDBDocClient.delete( - { - TableName: 'TABLE_NAME', - Key: { - userId: 'abc123', - email: 'abc123@abc123.com' - } - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - } -); -dynamoDBDocClient.update( - { - TableName: 'TABLE_NAME', - Key: { - userId: 'abc123', - email: 'abc123@abc123.com' - }, - AttributeUpdates: { - thingsWithWheels: { - Action: 'PUT', - Value: dynamoDBDocClient.createSet( - [ - 'SkateBoard', - 'Skates', - 'Mountain Bike', - 'Evolve Electric Skateboard' - ], - { validate: true } - ) - }, - age: { - Action: 'PUT', - Value: 35 - } - } - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - } -); -dynamoDBDocClient.scan( - { - TableName: 'TABLE_NAME', - KeyConditions: { - age: { - ComparisonOperator: 'EQ', - AttributeValueList: [35] - } - } - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - } -); -dynamoDBDocClient.query( - { - TableName: 'TABLE_NAME', - KeyConditions: { - userId: { - ComparisonOperator: 'EQ', - AttributeValueList: ['abc123'] - } - } - }, - function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - } -); - -var kinesis = new AWS.Kinesis(); - -var putRecordParam = { - Data: new Buffer('...') || 'STRING_VALUE', /* required */ - PartitionKey: 'STRING_VALUE', /* required */ - StreamName: 'STRING_VALUE', /* required */ - ExplicitHashKey: 'STRING_VALUE', - SequenceNumberForOrdering: 'STRING_VALUE' -}; -kinesis.putRecord(putRecordParam, function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response -}); - -var putRecordParams = { - Records: [ /* required */ - { - Data: new Buffer('...') || 'STRING_VALUE', /* required */ - PartitionKey: 'STRING_VALUE', /* required */ - ExplicitHashKey: 'STRING_VALUE' - }, - /* more items */ - ], - StreamName: 'STRING_VALUE' /* required */ -}; -kinesis.putRecords(putRecordParams, function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response -}); - -var increaseStreamRetentionPeriodParams = { - RetentionPeriodHours: 0, /* required */ - StreamName: 'STRING_VALUE' /* required */ -}; -kinesis.increaseStreamRetentionPeriod(increaseStreamRetentionPeriodParams, function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response -}); \ No newline at end of file diff --git a/types/aws-sdk/index.d.ts b/types/aws-sdk/index.d.ts deleted file mode 100644 index fbee8f926c..0000000000 --- a/types/aws-sdk/index.d.ts +++ /dev/null @@ -1,2606 +0,0 @@ -// Type definitions for aws-sdk -// Project: https://github.com/aws/aws-sdk-js -// Definitions by: midknight41 , Casper Skydt -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// Imported from: https://github.com/soywiz/typescript-node-definitions/aws-sdk.d.ts - -/// - -export declare var config: ClientConfig; - -export declare function Config(json: any): void; - -export declare class Credentials { - constructor(accessKeyId: string, secretAccessKey: string, sessionToken?: string); - accessKeyId: string; -} - -export class EnvironmentCredentials extends Credentials { - constructor(profile: string); -} - -export module CognitoIdentity { - export interface CognitoIdentityCredentialsParams { - IdentityPoolId?: string; - AccountId?: string; - Logins?: { [k: string]: any }; - - RoleArn?: string; - RoleSessionName?: string; - WebIdentityToken?: string; - ProviderId?: string; - Policy?: string; - DurationSeconds?: number; - - IdentityId?: string; - } -} - -export class CognitoIdentityCredentials extends Credentials { - constructor(params: CognitoIdentity.CognitoIdentityCredentialsParams); -} - -export interface Logger { - write?: (chunk: any, encoding?: string, callback?: () => void) => void; - log?: (...messages: any[]) => void; -} - -export interface HttpOptions { - proxy?: string; - agent?: any; - timeout?: number; - xhrAsync?: boolean; - xhrWithCredentials?: boolean; -} - -export declare class Endpoint { - constructor(endpoint: string); - - host: string; - hostname: string; - href: string; - port: number; - protocol: string; -} - -interface AwsError extends Error { - stack: string; -} - -export interface RetryDelayOption { - base?: number; - customBackoff?: (retryCount: number) => number; -} - -export interface Ebs { - SnapshotId?: string; - VolumeSize?: number; - VolumeType?: string; - DeleteOnTermination?: boolean; - Iops?: number; - Encrypted?: boolean; -} - -export interface BlockDeviceMapping { - VirtualName?: string; - DeviceName: string; - Ebs?: Ebs; - NoDevice?: boolean; -} - -export interface InstanceMonitoring { - SpotPrice?: string; - Enabled?: boolean; -} - -export interface Filter { - Name?: string; - Values?: boolean; -} - -export interface StepAdjustment { - scalingAdjustment: number; - metricIntervalLowerBound?: number; - metricIntervalUpperBound?: number; -} - -export interface Tags { - resourceId?: string; - resourceType?: string; - key: string; - value?: string; - propagateAtLaunch?: boolean; -} - -export interface Services { - autoscaling?: any; - cloudformation?: any; - cloudfront?: any; - cloudsearch?: any; - cloudsearchdomain?: any; - cloudtrail?: any; - cloudwatch?: any; - cloudwatchlogs?: any; - cognitoidentity?: any; - cognitosync?: any; - datapipeline?: any; - directconnect?: any; - dynamodb?: any; - ec2?: any; - ecs?: any; - elasticache?: any; - elasticbeanstalk?: any; - elastictranscoder?: any; - elb?: any; - emr?: any; - glacier?: any; - httpOptions?: HttpOptions; - iam?: any; - importexport?: any; - kinesis?: any; - opsworks?: any; - rds?: any; - redshift?: any; - route53?: any; - route53domains?: any; - s3?: any; - ses?: any; - simpledb?: any; - sns?: any; - sqs?: any; - storagegateway?: any; - sts?: any; - support?: any; - swf?: any; -} - -export interface ClientConfigPartial extends Services { - credentials?: Credentials; - region?: string; - computeChecksums?: boolean; - convertResponseTypes?: boolean; - logger?: Logger; - maxRedirects?: number; - maxRetries?: number; - paramValidation?: boolean; - s3ForcePathStyle?: boolean; - apiVersion?: any; - apiVersions?: Services; - signatureVersion?: string; - sslEnabled?: boolean; - systemClockOffset?: number; -} - -export interface ClientConfig extends ClientConfigPartial { - update?: (options: ClientConfigPartial, allUnknownKeys?: boolean) => void; - getCredentials?: (callback: (err?: any) => void) => void; - loadFromPath?: (path: string) => void; - credentials: Credentials; - region: string; -} - -export declare class CloudFormation { - constructor(options?: CloudFormation.Options); - endpoint: Endpoint; - - cancelUpdateStack(params: CloudFormation.CancelUpdateStackParams, callback: (err: AwsError, data: any) => void): void; - continueUpdateRollback(params: CloudFormation.ContinueUpdateRollbackParams, callback: (err: AwsError, data: any) => void): void; - createChangeSet(params: CloudFormation.CreateChangeSetParams, callback: (err: AwsError, data: any) => void): void; - createStack(params: CloudFormation.CreateStackParams, callback: (err: AwsError, data: any) => void): void; - deleteChangeSet(params: CloudFormation.DeleteChangeSetParams, callback: (err: AwsError, data: any) => void): void; - deleteStack(params: CloudFormation.DeleteStackParams, callback: (err: AwsError, data: any) => void): void; - describeAccountLimits(params: CloudFormation.DescribeAccountLimitsParams, callback: (err: AwsError, data: any) => void): void; - describeChangeSet(params: CloudFormation.DescribeChangeSetParams, callback: (err: AwsError, data: any) => void): void; - describeStackEvents(params: CloudFormation.DescribeStackEventsParams, callback: (err: AwsError, data: any) => void): void; - describeStackResource(params: CloudFormation.DescribeStackResourceParams, callback: (err: AwsError, data: any) => void): void; - describeStackResources(params: CloudFormation.DescribeStackResourcesParams, callback: (err: AwsError, data: any) => void): void; - describeStacks(params: CloudFormation.DescribeStacksParams, callback: (err: AwsError, data: any) => void): void; - estimateTemplateCost(params: CloudFormation.EstimateTemplateCostParams, callback: (err: AwsError, data: any) => void): void; - executeChangeSet(params: CloudFormation.ExecuteChangeSetParams, callback: (err: AwsError, data: any) => void): void; - getStackPolicy(params: CloudFormation.GetStackPolicyParams, callback: (err: AwsError, data: any) => void): void; - getTemplate(params: CloudFormation.GetTemplateParams, callback: (err: AwsError, data: any) => void): void; - getTemplateSummary(params: CloudFormation.GetTemplateSummaryParams, callback: (err: AwsError, data: any) => void): void; - listChangeSets(params: CloudFormation.ListChangeSetsParams, callback: (err: AwsError, data: any) => void): void; - listStackResources(params: CloudFormation.ListStackResourcesParams, callback: (err: AwsError, data: any) => void): void; - listStacks(params: CloudFormation.ListStacksParams, callback: (err: AwsError, data: any) => void): void; - setStackPolicy(params: CloudFormation.SetStackPolicyParams, callback: (err: AwsError, data: any) => void): void; - signalResource(params: CloudFormation.SignalResourceParams, callback: (err: AwsError, data: any) => void): void; - updateStack(params: CloudFormation.UpdateStackParams, callback: (err: AwsError, data: any) => void): void; - validateTemplate(params: CloudFormation.ValidateTemplateParams, callback: (err: AwsError, data: any) => void): void; - waitFor(state: string, params: CloudFormation.WaitForParams, callback: (err: AwsError, data: any) => void): void; -} - -export declare class Lambda { - constructor(options?: any); - endpoint: Endpoint; - - addPermission(params: Lambda.AddPermissionParams, callback: (err: AwsError, data: any) => void): void; - createAlias(params: Lambda.CreateAliasParams, callback: (err: AwsError, data: any) => void): void; - createEventSourceMapping(params: Lambda.CreateEventSourceMappingParams, callback: (err: AwsError, data: any) => void): void; - createFunction(params: Lambda.CreateFunctionParams, callback: (err: AwsError, data: any) => void): void; - deleteAlias(params: Lambda.DeleteAliasParams, callback: (err: AwsError, data: any) => void): void; - deleteEventSourceMapping(params: Lambda.DeleteEventSourceMappingParams, callback: (err: AwsError, data: any) => void): void; - deleteFunction(params: Lambda.DeleteFunctionParams, callback: (err: AwsError, data: any) => void): void; - getAlias(params: Lambda.GetAliasParams, callback: (err: AwsError, data: any) => void): void; - getEventSourceMapping(params: Lambda.GetEventSourceMappingParams, callback: (err: AwsError, data: any) => void): void; - getFunction(params: Lambda.GetFunctionParams, callback: (err: AwsError, data: any) => void): void; - getFunctionConfiguration(params: Lambda.GetFunctionConfigurationParams, callback: (err: AwsError, data: any) => void): void; - getPolicy(params: Lambda.GetPolicyParams, callback: (err: AwsError, data: any) => void): void; - invoke(params: Lambda.InvokeParams, callback: (err: AwsError, data: any) => void): void; - listAliases(params: Lambda.ListAliasesParams, callback: (err: AwsError, data: any) => void): void; - listEventSourceMappings(params: Lambda.ListEventSourceMappingsParams, callback: (err: AwsError, data: any) => void): void; - listFunctions(params: Lambda.ListFunctionsParams, callback: (err: AwsError, data: any) => void): void; - listVersionsByFunction(params: Lambda.ListVersionsByFunctionParams, callback: (err: AwsError, data: any) => void): void; - publishVersion(params: Lambda.PublishVersionParams, callback: (err: AwsError, data: any) => void): void; - removePermission(params: Lambda.RemovePermissionParams, callback: (err: AwsError, data: any) => void): void; - updateAlias(params: Lambda.UpdateAliasParams, callback: (err: AwsError, data: any) => void): void; - updateEventSourceMapping(params: Lambda.UpdateEventSourceMappingParams, callback: (err: AwsError, data: any) => void): void; - updateFunctionCode(params: Lambda.UpdateFunctionCodeParams, callback: (err: AwsError, data: any) => void): void; - updateFunctionConfiguration(params: Lambda.UpdateFunctionConfigurationParams, callback: (err: AwsError, data: any) => void): void; -} - -export class AutoScaling { - constructor(options?: any); - endpoint: Endpoint; - - attachInstances(params: AutoScaling.AttachInstancesParams, callback: (err: AwsError, data: any) => void): void; - attachLoadBalancers(params: AutoScaling.AttachLoadBalancersParams, callback: (err: AwsError, data: any) => void): void; - attachLoadBalancerTargetGroups(param: AutoScaling.AttachLoadBalancerTargetGroupsParams, callback: (err: AwsError, data: any) => void): void; - completeLifecycleAction(param: AutoScaling.CompleteLifecycleActionParams, callback: (err: AwsError, data: any) => void): void; - createAutoScalingGroup(param: AutoScaling.CreateAutoScalingGroupParams, callback: (err: AwsError, data: any) => void): void; - createLaunchConfiguration(param: AutoScaling.CreateLaunchConfigurationParams, callback: (err: AwsError, data: any) => void): void; - createOrUpdateTags(param: AutoScaling.CreateOrUpdateTagsParams, callback: (err: AwsError, data: any) => void): void; - deleteAutoScalingGroup(param: AutoScaling.DeleteAutoScalingGroupParams, callback: (err: AwsError, data: any) => void): void; - deleteLaunchConfiguration(param: AutoScaling.DeleteLaunchConfigurationParams, callback: (err: AwsError, data: any) => void): void; - deleteLifecycleHook(param: AutoScaling.DeleteLifecycleHookParams, callback: (err: AwsError, data: any) => void): void; - deleteNotificationConfiguration(param: AutoScaling.DeleteNotificationConfigurationParams, callback: (err: AwsError, data: any) => void): void; - deletePolicy(param: AutoScaling.DeletePolicyParams, callback: (err: AwsError, data: any) => void): void; - deleteScheduledAction(param: AutoScaling.DeleteScheduledActionParams, callback: (err: AwsError, data: any) => void): void; - deleteTags(param: AutoScaling.DeleteTagsParams, callback: (err: AwsError, data: any) => void): void; - describeAccountLimits(callback: (err: AwsError, data: any) => void): void; - describeAdjustmentTypes(callback: (err: AwsError, data: any) => void): void; - describeAutoScalingGroups(param: AutoScaling.DescribeAutoScalingGroupsParams, callback: (err: AwsError, data: any) => void): void; - describeAutoScalingInstances(param: AutoScaling.DescribeAutoScalingInstancesParams, callback: (err: AwsError, data: any) => void): void; - describeAutoScalingNotificationTypes(callback: (err: AwsError, data: any) => void): void; - describeLaunchConfigurations(param: AutoScaling.DescribeLaunchConfigurationsParams, callback: (err: AwsError, data: any) => void): void; - describeLifecycleHooks(param: AutoScaling.DescribeLifecycleHooksParams, callback: (err: AwsError, data: any) => void): void; - describeLifecycleHookTypes(callback: (err: AwsError, data: any) => void): void; - describeLoadBalancers(param: AutoScaling.DescribeLoadBalancersParams, callback: (err: AwsError, data: any) => void): void; - describeLoadBalancerTargetGroups(param: AutoScaling.DescribeLoadBalancerTargetGroupsParams, callback: (err: AwsError, data: any) => void): void; - describeMetricCollectionTypes(callback: (err: AwsError, data: any) => void): void; - describeNotificationConfigurations(param: AutoScaling.DescribeNotificationConfigurationsParams, callback: (err: AwsError, data: any) => void): void; - describePolicies(param: AutoScaling.DescribePoliciesParams, callback: (err: AwsError, data: any) => void): void; - describeScalingActivities(param: AutoScaling.DescribeScalingActivitiesParams, callback: (err: AwsError, data: any) => void): void; - describeScalingProcessTypes(callback: (err: AwsError, data: any) => void): void; - describeScheduledActions(param: AutoScaling.DescribeScheduledActionsParams, callback: (err: AwsError, data: any) => void): void; - describeTags(param: AutoScaling.DescribeTagsParams, callback: (err: AwsError, data: any) => void): void; - describeTerminationPolicyTypes(callback: (err: AwsError, data: any) => void): void; - detachInstances(param: AutoScaling.DetachInstancesParams, callback: (err: AwsError, data: any) => void): void; - detachLoadBalancers(param: AutoScaling.DetachLoadBalancersParams, callback: (err: AwsError, data: any) => void): void; - detachLoadBalancerTargetGroups(param: AutoScaling.DetachLoadBalancerTargetGroupsParams, callback: (err: AwsError, data: any) => void): void; - disableMetricsCollection(param: AutoScaling.DisableMetricsCollectionParams, callback: (err: AwsError, data: any) => void): void; - enableMetricsCollection(param: AutoScaling.EnableMetricsCollectionParams, callback: (err: AwsError, data: any) => void): void; - enterStandby(param: AutoScaling.EnterStandbyParams, callback: (err: AwsError, data: any) => void): void; - executePolicy(param: AutoScaling.ExecutePolicyParams, callback: (err: AwsError, data: any) => void): void; - exitStandby(param: AutoScaling.ExitStandbyParams, callback: (err: AwsError, data: any) => void): void; - putLifecycleHook(param: AutoScaling.PutLifecycleHookParams, callback: (err: AwsError, data: any) => void): void; - putNotificationConfiguration(param: AutoScaling.PutNotificationConfigurationParams, callback: (err: AwsError, data: any) => void): void; - putScalingPolicy(param: AutoScaling.PutScalingPolicyParams, callback: (err: AwsError, data: any) => void): void; - putScheduledUpdateGroupAction(param: AutoScaling.PutScheduledUpdateGroupActionParams, callback: (err: AwsError, data: any) => void): void; - recordLifecycleActionHeartbeat(params: AutoScaling.RecordLifecycleActionHeartbeatParams, callback: (err: AwsError, data: any) => void): void; - resumeProcesses(params: AutoScaling.ResumeProcessesParams, callback: (err: AwsError, data: any) => void): void; - setDesiredCapacity(params: AutoScaling.SetDesiredCapacityParams, callback: (err: AwsError, data: any) => void): void; - setInstanceHealth(params: AutoScaling.SetInstanceHealthParams, callback: (err: AwsError, data: any) => void): void; - setInstanceProtection(params: AutoScaling.SetInstanceProtectionParams, callback: (err: AwsError, data: any) => void): void; - suspendProcesses(params: AutoScaling.SuspendProcessesParams, callback: (err: AwsError, data: any) => void): void; - terminateInstanceInAutoScalingGroup(params: AutoScaling.TerminateInstanceInAutoScalingGroupParams, callback: (err: AwsError, data: any) => void): void; - updateAutoScalingGroup(params: AutoScaling.UpdateAutoScalingGroupParams, callback: (err: AwsError, data: any) => void): void; - } - -export class SQS { - constructor(options?: any); - endpoint: Endpoint; - - addPermission(params: SQS.AddPermissionParams, callback: (err: AwsError, data: any) => void): void; - changeMessageVisibility(params: SQS.ChangeMessageVisibilityParams, callback: (err: AwsError, data: any) => void): void; - changeMessageVisibilityBatch(params: SQS.ChangeMessageVisibilityBatchParams, callback: (err: AwsError, data: SQS.ChangeMessageVisibilityBatchResponse) => void): void; - createQueue(params: SQS.CreateQueueParams, callback: (err: AwsError, data: SQS.CreateQueueResult) => void): void; - deleteMessage(params: SQS.DeleteMessageParams, callback: (err: AwsError, data: any) => void): void; - deleteMessageBatch(params: SQS.DeleteMessageBatchParams, callback: (err: AwsError, data: SQS.DeleteMessageBatchResult) => void): void; - deleteQueue(params: { QueueUrl: string; }, callback: (err: AwsError, data: any) => void): void; - getQueueAttributes(params: SQS.GetQueueAttributesParams, callback: (err: AwsError, data: SQS.GetQueueAttributesResult) => void): void; - getQueueUrl(params: SQS.GetQueueUrlParams, callback: (err: AwsError, data: { QueueUrl: string; }) => void): void; - listDeadLetterSourceQueues(params: { QueueUrl: string }, callback: (err: AwsError, data: { queueUrls: string[] }) => void): void; - listQueues(params: { QueueNamePrefix?: string }, callback: (err: AwsError, data: { QueueUrls: string[] }) => void): void; - purgeQueue(params: { QueueUrl: string }, callback: (err: AwsError, data: any) => void): void; - receiveMessage(params: SQS.ReceiveMessageParams, callback: (err: AwsError, data: SQS.ReceiveMessageResult) => void): void; - removePermission(params: { QueueUrl: string, Label: string }, callback: (err: AwsError, data: any) => void): void; - sendMessage(params: SQS.SendMessageParams, callback: (err: AwsError, data: SQS.SendMessageResult) => void): void; - sendMessageBatch(params: SQS.SendMessageBatchParams, callback: (err: AwsError, data: SQS.SendMessageBatchResult) => void): void; - setQueueAttributes(params: SQS.SetQueueAttributesParams, callback: (err: AwsError, data: any) => void): void; -} - -export declare class SES { - constructor(options?: any); - endpoint: Endpoint; - - sendEmail(params: any, callback: (err: any, data: SES.SendEmailResult) => void): void; -} - -export declare class SNS { - constructor(options?: any); - endpoint: Endpoint; - - publish(request: Sns.PublishRequest, callback: (err: any, data: any) => void): void; -} - -export class Kinesis { - constructor(options?: any); - endpoint: Endpoint; - - putRecord(params: KINESIS.PutRecordParams, callback: (error: Error, data: KINESIS.PutRecordResult) => void): void; - putRecords(params: KINESIS.PutRecordsParams, callback: (error: Error, data: KINESIS.PutRecordsResult) => void): void; - increaseStreamRetentionPeriod(params: KINESIS.IncreaseStreamRetentionPeriodParams, callback: (error: Error, data: any) => void): void; - } - - export module KINESIS { - export interface Record { - Data: Buffer | string | Blob; - PartitionKey: string; - ExplicitHashKey?: string; - } - - export interface RecordResult { - SequenceNumber: string; - ShardId: string; - ErrorCode: string; - ErrorMessage: string; - } - - export interface PutRecordParams extends Record { - StreamName: string; - SequenceNumberForOrdering?: string; - } - - export interface PutRecordResult { - ShardId: string; - SequenceNumber: string; - } - - export interface PutRecordsParams { - StreamName: string; - Records: Record[]; - } - - export interface PutRecordsResult { - FailedRecordCount: number; - Records: RecordResult[] - } - - export interface IncreaseStreamRetentionPeriodParams { - RetentionPeriodHours: number; - StreamName: string; - } - } - - -export declare class SWF { - constructor(options?: any); - endpoint: Endpoint; - - countClosedWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - countOpenWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - countPendingActivityTasks(params: any, callback: (err: any, data: any) => void): void; - countPendingDecisionTasks(params: any, callback: (err: any, data: any) => void): void; - deprecateActivityType(params: any, callback: (err: any, data: any) => void): void; - deprecateDomain(params: any, callback: (err: any, data: any) => void): void; - deprecateWorkflowType(params: any, callback: (err: any, data: any) => void): void; - describeActivityType(params: any, callback: (err: any, data: any) => void): void; - describeDomain(params: any, callback: (err: any, data: any) => void): void; - describeWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - describeWorkflowType(params: any, callback: (err: any, data: any) => void): void; - getWorkflowExecutionHistory(params: any, callback: (err: any, data: any) => void): void; - listActivityTypes(params: any, callback: (err: any, data: any) => void): void; - listClosedWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - listDomains(params: any, callback: (err: any, data: any) => void): void; - listOpenWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - listWorkflowTypes(params: any, callback: (err: any, data: any) => void): void; - pollForActivityTask(params: any, callback: (err: any, data: Swf.ActivityTask) => void): void; - pollForDecisionTask(params: any, callback: (err: any, data: Swf.DecisionTask) => void): void; - recordActivityTaskHeartbeat(params: any, callback: (err: any, data: any) => void): void; - registerActivityType(params: any, callback: (err: any, data: any) => void): void; - registerDomain(params: any, callback: (err: any, data: any) => void): void; - registerWorkflowType(params: any, callback: (err: any, data: any) => void): void; - requestCancelWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - respondActivityTaskCanceled(params: Swf.RespondActivityTaskCanceledRequest, callback: (err: any, data: any) => void): void; - respondActivityTaskCompleted(params: Swf.RespondActivityTaskCompletedRequest, callback: (err: any, data: any) => void): void; - respondActivityTaskFailed(params: Swf.RespondActivityTaskFailedRequest, callback: (err: any, data: any) => void): void; - respondDecisionTaskCompleted(params: Swf.RespondDecisionTaskCompletedRequest, callback: (err: any, data: any) => void): void; - signalWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - startWorkflowExecution(params: any, callback: (err: any, data: Swf.StartWorkflowExecutionResult) => void): void; - terminateWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - -} - -export declare class S3 { - constructor(options?: any); - endpoint: Endpoint; - - getObject(params: s3.GetObjectRequest, callback?: (err: Error, data: any) => void): any; - putObject(params: s3.PutObjectRequest, callback?: (err: Error, data: any) => void): any; - copyObject(params: s3.CopyObjectRequest, callback?: (err: Error, data: any) => void): any; - deleteObject(params: s3.DeleteObjectRequest, callback: (err: Error, data: any) => void): void; - headObject(params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void; - getSignedUrl(operation: string, params: any): string; - getSignedUrl(operation: string, params: any, callback: (err: Error, url: string) => void): void; - upload(params?: s3.PutObjectRequest, options?: s3.UploadOptions, callback?: (err: Error, data: any) => void): void; - listObjects(params: s3.ListObjectRequest, callback: (err: Error, data: s3.ListObjectResponse) => void): void; - listObjectsV2(params: s3.ListObjectV2Request, callback: (err: Error, data: s3.ListObjectV2Response) => void): void; - waitFor(state: string, params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void; - - createMultipartUpload(params: any, callback: (err: Error, data: any) => void): void; - uploadPart(params: any, callback: (err: Error, data: any) => void): void; - listParts(params: any, callback: (err: Error, data: any) => void): void; - completeMultipartUpload(params: any, callback: (err: Error, data: any) => void): void; - } - - -export class STS { - constructor(options?: any); - endpoint: Endpoint; - /** - * Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) that you can use to access AWS resources that you might not normally have access to. - */ - assumeRole(params: sts.AssumeRoleParams, callback: (err: any, data: any) => void): void; - /** - * Returns a set of temporary security credentials for users who have been authenticated via a SAML authentication response. - */ - assumeRoleWithSAML(params: sts.AssumeRoleWithSAMLParams, callback: (err: any, data: any) => void): void; - - /** - * Returns a set of temporary security credentials for users who have been authenticated in a mobile or web application with a web identity provider, such as Amazon Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible identity provider. - */ - assumeRoleWithWebIdentity(params: sts.AssumeRoleWithWebIdentityParams, callback: (err: any, data: any) => void): void; - - /** - * Creates a credentials object from STS response data containing credentials information. - */ - credentialsFrom(params: sts.CredentialsFromParams, callback: (err: any, data: any) => void): void; - - /** - * Decodes additional information about the authorization status of a request from an encoded message returned in response to an AWS request. - */ - decodeAuthorizationMessage(params: sts.DecodeAuthorizationMessageParams, callback: (err: any, data: any) => void): void; - - /** - * Returns details about the IAM identity whose credentials are used to call the API. - */ - getCallerIdentity(params: {}, callback: (err: any, data: any) => void): void; - - /** - * Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) for a federated user. - */ - getFederationToken(params: sts.GetFederationTokenParams, callback: (err: any, data: any) => void): void; - - /** - * Returns a set of temporary credentials for an AWS account or IAM user. - */ - getSessionToken(params: sts.GetSessionTokenParams, callback: (err: any, data: any) => void): void; - -} - -export declare class ECS { - constructor(options?: any); - endpoint: Endpoint; - /** - * Runs and maintains a desired number of tasks from a specified task definition. If the number of tasks running in a service drops below desiredCount, Amazon ECS spawns another instantiation of the task in the specified cluster. To update an existing service, see UpdateService. - */ - createService(params: ecs.CreateServicesParams, callback: (err: any, data: any) => void): void; - /** - * Describes one or more of your clusters. - */ - describeClusters(params: ecs.DescribeClustersParams, callback: (err: any, data: any) => void): void; - /** - * Describes the specified services running in your cluster. - */ - describeServices(params: ecs.DescribeServicesParams, callback: (err: any, data: any) => void): void; - /** - * Describes a specified task or tasks. - */ - describeTasks(params: ecs.DescribeTasksParams, callback: (err: any, data: any) => void): void; - /** - * Describes a task definition. You can specify a family and revision to find information about a specific task definition, or you can simply specify the family to find the latest ACTIVE revision in that family. - */ - describeTaskDefinition(params: ecs.DescribeTaskDefinitionParams, callback: (err: any, data: any) => void): void; - /** - * Registers a new task definition from the supplied family and containerDefinitions. Optionally, you can add data volumes to your containers with the volumes parameter. For more information about task definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service Developer Guide. - */ - registerTaskDefinition(params: ecs.RegisterTaskDefinitionParams, callback: (err: any, data: any) => void): void; - /** - * Modifies the desired count, deployment configuration, or task definition used in a service. - */ - updateService(params: ecs.UpdateServiceParams, callback: (err: any, data: any) => void): void; -} - -export declare class DynamoDB { - constructor(options?: any); - endpoint: Endpoint; - createTable(params: any, next: (err: any, data: any) => void): void; - deleteTable(params: any, next: (err: any, data: any) => void): void; -} - -// ========================================================== - -export declare module DynamoDB { - - interface _DDBDC_Generic { - TableName: string; - ExpressionAttributeNames?: { [someKey: string]: string }; - ReturnConsumedCapacity?: "INDEXES" | "TOTAL" | "NONE"; - } - - type _DDBDC_ComparisonOperator = "EQ" | "NE" | "IN" | "LE" | "LT" | "GE" | "GT" | "BETWEEN" | "NOT_NULL" | "NULL" | "CONTAINS" | "NOT_CONTAINS" | "BEGINS_WITH" - type _DDBDC_Keys = { [someKey: string]: any }; - type _DDBDC_KeyComparison = { - [someKey: string]: { - AttributeValueList: any[]; - ComparisonOperator: _DDBDC_ComparisonOperator; - } - }; - - interface _DDBDC_Reader extends _DDBDC_Generic { - ConsistentRead?: boolean; - ProjectionExpression?: string; - AttributesToGet?: string[]; - } - - interface _DDBDC_Writer extends _DDBDC_Generic { - ExpressionAttributeValues?: _DDBDC_Keys; - ReturnItemCollectionMetrics?: "SIZE" | "NONE"; - ReturnValues?: "NONE" | "ALL_OLD" | "UPDATED_OLD" | "ALL_NEW" | "UPDATED_NEW"; - ConditionExpression?: string; - ConditionalOperator?: "AND" | "OR"; - Expected?: { - [someKey: string]: { - AttributeValueList?: any[]; - ComparisonOperator?: _DDBDC_ComparisonOperator; - Exists: boolean; - Value?: any; - } - } - } - - interface UpdateParam extends _DDBDC_Writer { - Key: _DDBDC_Keys; - UpdateExpression?: string; - AttributeUpdates?: { - [someKey: string]: { - Action: "PUT" | "ADD" | "DELETE"; - Value: any - } - } - } - - interface QueryParam extends _DDBDC_Reader { - ConditionalOperator?: "AND" | "OR"; - ExclusiveStartKey?: _DDBDC_Keys; - ExpressionAttributeValues?: _DDBDC_Keys; - FilterExpression?: string; - IndexName?: string; - KeyConditionExpression?: string; - KeyConditions?: _DDBDC_KeyComparison; - Limit?: number; - QueryFilter?: _DDBDC_KeyComparison; - ScanIndexForward?: boolean; - Select?: "ALL_ATTRIBUTES" | "ALL_PROJECTED_ATTRIBUTES" | "SPECIFIC_ATTRIBUTES" | "COUNT"; - } - - interface ScanParam extends QueryParam { - Segment?: number; - ScanFilter?: _DDBDC_KeyComparison; - TotalSegments?: number; - } - - interface GetParam extends _DDBDC_Reader { - Key: _DDBDC_Keys; - } - - interface PutParam extends _DDBDC_Writer { - Item: _DDBDC_Keys; - } - - interface DeleteParam extends _DDBDC_Writer { - Key: _DDBDC_Keys; - } - - export class DocumentClient { - constructor(options?: any); - get(params: GetParam, next: (err: any, data: any) => void): void; - put(params: PutParam, next: (err: any, data: any) => void): void; - delete(params: DeleteParam, next: (err: any, data: any) => void): void; - query(params: QueryParam, next: (err: any, data: any) => void): void; - scan(params: ScanParam, next: (err: any, data: any) => void): void; - update(params: UpdateParam, next: (err: any, data: any) => void): void; - createSet(list: any[], options?: { validate?: boolean }): { values: any[], type: string }; - batchGet(params: any, next: (err: any, data: any) => void): void; - batchWrite(params: any, next: (err: any, data: any) => void): void; - } - -} - -// =========================================================== - -export module CloudFormation { - export interface CancelUpdateStackParams { - StackName: string; - } - - export interface ContinueUpdateRollbackParams { - StackName: string; - } - - export interface CreateChangeSetParams { - StackName: string; - TemplateBody?: string; // specify either TemplateBody or TemplateURL - TemplateURL?: string; // specify either TemplateBody or TemplateURL - UsePreviousTemplate?: boolean; - Parameters?: CloudFormation.Parameter[]; - Capabilities?: string[]; // CAPABILITY_IAM | CAPABILITY_NAMED_IAM - ResourceTypes?: string[]; - NotificationARNs?: string[]; - Tags?: CloudFormation.Tag[]; - ChangeSetName: string; - ClientToken?: string; - Description?: string; - } - - export interface CreateStackParams { - StackName: string; - TemplateBody?: string; // specify either TemplateBody or TemplateURL - TemplateURL?: string; // specify either TemplateBody or TemplateURL - Parameters?: CloudFormation.Parameter[]; - DisableRollback?: boolean; // cannot specify both DisableRollback and OnFailure - TimeoutInMinutes?: number; - NotificationARNs?: string[]; - Capabilities?: string[]; - ResourceTypes?: string[]; - OnFailure?: string[]; // cannot specify both DisableRollback and OnFailure - // DO_NOTHING | ROLLBACK | DELETE - StackPolicyBody?: string; // cannot specify both StackPolicyBody and StackPolicyURL - StackPolicyURL?: string; // cannot specify both StackPolicyBody and StackPolicyURL - Tags?: CloudFormation.Tag[]; - } - - export interface DeleteChangeSetParams { - ChangeSetName: string; - StackName?: string; - } - - export interface DeleteStackParams { - StackName: string; - RetainResources?: string[]; - } - - export interface DescribeAccountLimitsParams { - NextToken?: string; - } - - export interface DescribeChangeSetParams { - ChangeSetName: string; - StackName?: string; - NextToken?: string; - } - - export interface DescribeStackEventsParams { - StackName?: string; - NextToken?: string; - } - - export interface DescribeStackResourceParams { - StackName: string; - LogicalResourceId: string; - } - - export interface DescribeStackResourcesParams { - StackName?: string; // must specify either StackName or PhysicalResourceId - LogicalResourceId?: string; - PhysicalResourceId?: string; // must specify either StackName or PhysicalResourceId - } - - export interface DescribeStacksParams { - StackName?: string; - NextToken?: string; - } - - export interface EstimateTemplateCostParams { - TemplateBody?: string; // must specify either TemplateBody or TemplateURL - // if both are passed, only TemplateBody is used - TemplateURL?: string; // must specify either TemplateBody or TemplateURL - Parameters?: CloudFormation.Parameter[]; - } - - export interface ExecuteChangeSetParams { - ChangeSetName: string; - StackName?: string; - } - - export interface GetStackPolicyParams { - StackName: string; - } - - export interface GetTemplateParams { - StackName: string; - } - - export interface GetTemplateSummaryParams { - // must specify one of the three - TemplateBody?: string; - TemplateURL?: string; - StackName?: string; - } - - export interface ListChangeSetsParams { - StackName: string; - NextToken?: string; - } - - export interface ListStackResourcesParams { - StackName: string; - NextToken?: string; - } - - export interface ListStacksParams { - NextToken?: string; - StackStatusFilter?: string[]; - } - - export interface SetStackPolicyParams { - StackName: string; - StackPolicyBody?: string; // cannot set both StackPolicyBody and StackPolicyURL - StackPolicyURL?: string; // cannot set both StackPolicyBody and StackPolicyURL - } - - export interface SignalResourceParams { - StackName: string; - LogicalResourceId: string; - UniqueId: string; - Status: string; // SUCCESS | FAILURE - } - - export interface UpdateStackParams { - StackName: string; - TemplateBody?: string; // specify either TemplateBody or TemplateURL, not both - TemplateURL?: string; // specify either TemplateBody or TemplateURL, not both - UsePreviousTemplate?: boolean; - StackPolicyDuringUpdateBody?: string; // cannot set both StackPolicyDuringUpdateBody and StackPolicyDuringUpdateURL - StackPolicyDuringUpdateURL?: string; // cannot set both StackPolicyDuringUpdateBody and StackPolicyDuringUpdateURL - Parameters?: CloudFormation.Parameter[]; - Capabilities?: string[]; // CAPABILITY_IAM | CAPABILITY_NAMED_IAM - ResourceTypes?: string[]; - StackPolicyBody?: string; // cannot set both StackPolicyBody and StackPolicyURL - StackPolicyURL?: string; // cannot set both StackPolicyBody and StackPolicyURL - NotificationARNs?: string[]; - Tags?: CloudFormation.Tag[]; - } - - export interface ValidateTemplateParams { - TemplateBody?: string; // must pass either TemplateBody or TemplateURL - // if both are specified, only TemplateBody is used - TemplateURL?: string; // must pass either TemplateBody or TemplateURL - } - - export interface WaitForParams { - StackName: string; - NextToken?: string; - } - - export interface Options { - params?: any; - endpoint?: string; - accessKeyId?: string; - secretAccessKey?: string; - sessionToken?: any; - credentials?: any; - credentialProvider?: any; - region?: string; - maxRetries?: number; - maxRedirects?: number; - sslEnabled?: boolean; - paramValidation?: any; - computeChecksums?: boolean; - convertResponseTypes?: boolean; - correctClockSkew?: boolean; - s3ForcePathStyle?: boolean; - s3BucketEndpoint?: boolean; - s3DisableBodySigning?: boolean; - retryDelayOptions?: any; - httpOptions?: any; - apiVersion?: any; - apiVersions?: any; - logger?: any; - systemClockOffset?: number; - signatureVersion?: string; - signatureCache?: boolean; - } - - export interface Parameter { - ParameterKey: string; - ParameterValue: string; - UsePreviousValue?: boolean; // if you specify true, do not specify ParameterValue - } - - export interface Tag { - Key: string; - Value: string; - } -} - -// =========================================================== - -export declare module Lambda { - export interface AddPermissionParams { - Action: string; - FunctionName: string; - Principal: string; - StatementId: string; - Qualifier?: string; - SourceAccount?: string; - SourceArn?: string; - } - - export interface CreateAliasParams { - FunctionName: string; - FunctionVersion: string; - Name: string; - Description?: string; - } - export interface CreateEventSourceMappingParams { - EventSourceArn: string; - FunctionName: string; - StartingPosition: string; /* TRIM_HORIZON | LATEST */ - BatchSize?: number; - Enabled?: boolean - } - - export interface CreateFunctionParams { - Code: { - S3Bucket?: string; - S3Key?: string; - S3ObjectVersion?: string; - ZipFile?: any; // new Buffer('...') || string; - }, - FunctionName: string; - Handler: string; - Role: string; - Runtime: string; /* 'nodejs | java8 | python2.7', */ - Description?: string; - MemorySize?: number; - Publish?: boolean; - Timeout?: number; - VpcConfig?: { - SecurityGroupIds?: string[]; - SubnetIds?: string[]; - } - } - - export interface DeleteAliasParams { - FunctionName: string; - Name: string; - } - - export interface DeleteEventSourceMappingParams { - UUID: string; - } - - export interface DeleteFunctionParams { - FunctionName: string; - Qualifier?: string; - } - export interface GetAliasParams { - FunctionName: string; - Name: string; - } - - export interface GetEventSourceMappingParams { - UUID: string; - } - - export interface GetFunctionParams { - FunctionName: string; - Qualifier?: string; - } - - export interface GetFunctionConfigurationParams { - FunctionName: string; - Qualifier?: string; - } - - export interface GetPolicyParams { - FunctionName: string; - Qualifier?: string; - } - - export interface InvokeParams { - FunctionName: string; - ClientContext?: string; - InvocationType?: string;/* 'Event | RequestResponse | DryRun' */ - LogType?: string; /* 'None | Tail' */ - Payload?: any; /* new Buffer('...') || string */ - Qualifier?: string; - } - - export interface ListAliasesParams { - FunctionName: string; - FunctionVersion?: string; - Marker?: string; - MaxItems?: number - } - - export interface ListEventSourceMappingsParams { - EventSourceArn?: string; - FunctionName?: string; - Marker?: string; - MaxItems?: number - } - - export interface ListFunctionsParams { - Marker?: string; - MaxItems?: number - } - - export interface ListVersionsByFunctionParams { - FunctionName: string; - Marker?: string; - MaxItems?: number - } - - export interface PublishVersionParams { - FunctionName: string; - CodeSha256?: string; - Description?: string; - } - - export interface RemovePermissionParams { - FunctionName: string; - StatementId: string; - Qualifier?: string; - } - - export interface UpdateAliasParams { - FunctionName: string; - Name: string; - Description?: string; - FunctionVersion?: string; - } - - export interface UpdateEventSourceMappingParams { - UUID: string; - BatchSize?: number; - Enabled?: boolean; - FunctionName?: string; - } - - export interface UpdateFunctionCodeParams { - FunctionName: string; - Publish?: boolean; - S3Bucket?: string; - S3Key?: string; - S3ObjectVersion?: string; - ZipFile?: any; /* new Buffer('...') || string; */ - - } - - export interface UpdateFunctionConfigurationParams { - FunctionName: string; - Description?: string; - Handler?: string; - MemorySize?: number; - Role?: string; - Timeout?: number; - VpcConfig?: { - SecurityGroupIds?: string[]; - SubnetIds?: string[]; - } - } -} - -export module AutoScaling { - export interface AutoScalingOptions { - params?: any; - endpoint?: string; - accessKeyId?: string; - secretAccessKey?: string; - sessionToken?: Credentials; - credentials?: Credentials; - credentialProvider?: any; - region?: string; - maxRetries?: number; - maxRedirects?: number; - sslEnabled?: boolean; - paramValidation?: boolean; - computeChecksums?: boolean; - convertResponseTypes?: boolean; - correctClockSkew?: boolean; - s3ForcePathStyle?: boolean; - s3BucketEndpoint?: boolean; - s3DisableBodySigning?: boolean; - retryDelayOptions?: RetryDelayOption; - httpOptions?: HttpOptions; - apiVersion?: string; - apiVersions?: { [serviceName: string]: string }; - logger?: Logger; - systemClockOffset?: number; - signatureVersion?: string; - signatureCache?: boolean; - } - - export interface AttachInstancesParams { - AutoScalingGroupName: string; - InstanceIds: string[]; - } - - export interface AttachLoadBalancersParams { - AutoScalingGroupName: string; - LoadBalancerNames: string[]; - } - - export interface AttachLoadBalancerTargetGroupsParams { - AutoScalingGroupName: string; - TargetGroupARNs: string[]; - } - - export interface CompleteLifecycleActionParams { - AutoScalingGroupName: string; - LifecycleActionResult: string; - LifecycleHookName: string; - lifecycleActionToken?: string; - InstanceId?: string; - } - - export interface CreateAutoScalingGroupParams { - AutoScalingGroupName: string; - MinSize: number; - MaxSize: number; - LaunchConfigurationName?: string; - InstanceId?: string; - DesiredCapacity?: number; - DefaultCooldown?: number; - AvailabilityZones?: string[]; - LoadBalancerNames?: string[]; - TargetGroupARNs?: string[]; - HealthCheckType?: string; - HealthCheckGracePeriod?: number; - PlacementGroup?: string; - VPCZoneIdentifier?: string; - TerminationPolicies?: string; - NewInstancesProtectedFromScaleIn?: boolean; - Tags?: Tags; - } - - export interface CreateLaunchConfigurationParams { - LaunchConfigurationName: string; - AssociatePublicIpAddress?: boolean; - ImageId?: string; - KeyName?: string; - SecurityGroups?: string[]; - ClassicLinkVPCId?: string; - ClassicLinkVPCSecurityGroups?: string[]; - UserData?: string; - InstanceId?: string; - InstanceType?: string; - KernelId?: string; - RamdiskId?: string; - BlockDeviceMappings?: BlockDeviceMapping[]; - InstanceMonitoring?: InstanceMonitoring; - SpotPrice?: string; - IamInstanceProfile?: string; - EbsOptimized?: boolean; - PlacementTenancy?: string; - } - - export interface CreateOrUpdateTagsParams { - Tags: Tags[]; - } - - export interface DeleteAutoScalingGroupParams { - AutoScalingGroupName: string; - ForceDelete?: boolean; - } - - export interface DeleteLaunchConfigurationParams { - LaunchConfigurationName: string; - } - - export interface DeleteLifecycleHookParams { - AutoScalingGroupName: string; - LifecycleHookName: string; - } - - export interface DeleteNotificationConfigurationParams { - AutoScalingGroupName: string; - TopicARN: string; - } - - export interface DeletePolicyParams { - PolicyName: string; - AutoScalingGroupName?: string; - } - - export interface DeleteScheduledActionParams { - AutoScalingGroupName: string; - ScheduledActionName: string; - } - - export interface DeleteTagsParams { - Tags: Tags[]; - } - - export interface DescribeAutoScalingGroupsParams { - AutoScalingGroupName?: string; - NextToken?: string; - MaxRecords?: number; - } - - export interface DescribeAutoScalingInstancesParams { - InstanceIds?: string[]; - NextToken?: string; - MaxRecords?: number; - } - - export interface DescribeLaunchConfigurationsParams { - LaunchConfigurationNames?: string[]; - NextToken?: string; - MaxRecords?: number; - } - - export interface DescribeLifecycleHooksParams { - AutoScalingGroupName: string; - LifecycleHookNames?: string[]; - } - - export interface DescribeLoadBalancersParams { - AutoScalingGroupName: string; - NextToken?: string; - MaxRecords?: number; - } - - export interface DescribeLoadBalancerTargetGroupsParams { - AutoScalingGroupName: string; - NextToken?: string; - MaxRecords?: number; - } - - export interface DescribeNotificationConfigurationsParams { - AutoScalingGroupName?: string; - NextToken?: string; - MaxRecords?: number; - } - - export interface DescribePoliciesParams { - AutoScalingGroupName?: string; - PolicyNames?: string[]; - PolicyTypes?: string[]; - NextToken?: string; - MaxRecords?: number; - } - - export interface DescribeScalingActivitiesParams { - AutoScalingGroupName?: string; - ActivityIds?: string[]; - NextToken?: string; - MaxRecords?: number; - } - - export interface DescribeScheduledActionsParams { - AutoScalingGroupName?: string; - ScheduledActionNames?: string[]; - StartTime?: Date; - EndTime?: Date; - NextToken?: string; - MaxRecords?: number; - } - - export interface DescribeTagsParams { - Filters?: Filter[]; - NextToken?: string; - MaxRecords?: number; - } - - export interface DetachInstancesParams { - AutoScalingGroupName: string; - ShouldDecrementDesiredCapacity: boolean; - InstanceIds?: string[]; - } - - export interface DetachLoadBalancersParams { - AutoScalingGroupName: string; - LoadBalancerNames: string; - } - - export interface DetachLoadBalancerTargetGroupsParams { - AutoScalingGroupName: string; - TargetGroupARNs: string[]; - } - - export interface DisableMetricsCollectionParams { - AutoScalingGroupName: string; - Metrics?: string[]; - } - - export interface EnableMetricsCollectionParams { - AutoScalingGroupName: string; - Granularity: string; - Metrics?: string[]; - } - - export interface EnterStandbyParams { - AutoScalingGroupName: string; - ShouldDecrementDesiredCapacity: boolean; - InstanceIds?: string[]; - } - - export interface ExecutePolicyParams { - PolicyName: string; - AutoScalingGroupName?: string; - HonorCooldown?: boolean; - MetricValue?: number; - BreachThreshold?: number; - } - - export interface ExitStandbyParams { - AutoScalingGroupName: string; - InstanceIds?: string[]; - } - - export interface PutLifecycleHookParams { - AutoScalingGroupName: string; - LifecycleHookName: string; - LifecycleTransition?: string; - RoleARN?: string; - NotificationTargetARN?: string; - NotificationMetadata?: string; - HeartbeatTimeout?: number; - DefaultResult?: string; - } - - export interface PutNotificationConfigurationParams { - AutoScalingGroupName: string; - NotificationTypes: string[]; - TopicARN: string; - } - - export interface PutScalingPolicyParams { - AutoScalingGroupName: string; - AdjustmentType: string; - PolicyName: string; - PolicyType?: string; - MinAdjustmentStep?: number; - MinAdjustmentMagnitude?: number; - ScalingAdjustment?: number; - Cooldown?: number; - MetricAggregationType?: string; - StepAdjustments?: StepAdjustment[]; - EstimatedInstanceWarmup: number; - } - - export interface PutScheduledUpdateGroupActionParams { - AutoScalingGroupName: string; - ScheduledActionName: string; - Time?: Date; - StartTime?: Date; - EndTime?: Date; - Recurrence?: string; - MinSize?: number; - MaxSize?: number; - DesiredCapacity?: number; - } - - export interface RecordLifecycleActionHeartbeatParams { - AutoScalingGroupName: string; - LifecycleHookName: string; - LifecycleActionToken?: string; - InstanceId?: string; - } - - export interface ResumeProcessesParams { - AutoScalingGroupName: string; - ScalingProcesses?: string[]; - } - - export interface SetDesiredCapacityParams { - AutoScalingGroupName: string; - DesiredCapacity: number; - HonorCooldown?: boolean; - } - - export interface SetInstanceHealthParams { - HealthStatus: string; - InstanceId: string; - ShouldRespectGracePeriod?: boolean; - } - - export interface SetInstanceProtectionParams { - AutoScalingGroupName: string; - InstanceIds: string[]; - ProtectedFromScaleIn: boolean; - } - - export interface SuspendProcessesParams { - AutoScalingGroupName: string; - ScalingProcesses?: string[]; - } - - export interface TerminateInstanceInAutoScalingGroupParams { - InstanceId: string; - ShouldDecrementDesiredCapacity: boolean; - } - - export interface UpdateAutoScalingGroupParams { - AutoScalingGroupName: string; - LaunchConfigurationName: string; - MinSize: number; - MaxSize: number; - DesiredCapacity: number; - DefaultCooldown: number; - AvailabilityZones: string[]; - HealthCheckType: string; - HealthCheckGracePeriod: number; - PlacementGroup: string; - VPCZoneIdentifier: string; - TerminationPolicies: string[]; - NewInstancesProtectedFromScaleIn?: boolean; - } -} - -export module SQS { - export interface SqsOptions { - params?: any; - endpoint?: string; - accessKeyId?: string; - secretAccessKey?: string; - sessionToken?: Credentials; - credentials?: Credentials; - credentialProvider?: any; - region?: string; - maxRetries?: number; - maxRedirects?: number; - sslEnabled?: boolean; - paramValidation?: boolean; - computeChecksums?: boolean; - convertResponseTypes?: boolean; - correctClockSkew?: boolean; - s3ForcePathStyle?: boolean; - s3BucketEndpoint?: boolean; - httpOptions?: HttpOptions; - apiVersion?: string; - apiVersions?: { [serviceName: string]: string }; - logger?: Logger; - systemClockOffset?: number; - signatureVersion?: string; - signatureCache?: boolean; - } - - export interface AddPermissionParams { - QueueUrl: string; - Label: string; - AWSAccountIds: string[]; - Actions: string[]; - } - - export interface ChangeMessageVisibilityParams { - QueueUrl: string, - ReceiptHandle: string, - VisibilityTimeout: number - } - - export interface ChangeMessageVisibilityBatchParams { - QueueUrl: string, - Entries: { Id: string; ReceiptHandle: string; VisibilityTimeout?: number; }[] - } - - export interface ChangeMessageVisibilityBatchResponse { - Successful: { Id: string }[]; - Failed: BatchResultErrorEntry[]; - } - - export interface SendMessageParams { - QueueUrl?: string; - MessageBody: string; - DelaySeconds?: number; - MessageAttributes?: { [name: string]: MessageAttribute; } - } - - export interface ReceiveMessageParams { - QueueUrl: string; - MaxNumberOfMessages?: number; - VisibilityTimeout?: number; - AttributeNames?: string[]; - MessageAttributeNames?: string[]; - WaitTimeSeconds?: number; - } - - export interface DeleteMessageBatchParams { - QueueUrl: string; - Entries: DeleteMessageBatchRequestEntry[]; - } - - export interface DeleteMessageBatchRequestEntry { - Id: string; - ReceiptHandle: string; - } - - export interface DeleteMessageParams { - QueueUrl: string; - ReceiptHandle: string; - } - - export interface SendMessageBatchParams { - QueueUrl: string; - Entries: SendMessageBatchRequestEntry[]; - } - - export interface SendMessageBatchRequestEntry { - Id: string; - MessageBody: string; - DelaySeconds?: number; - MessageAttributes?: { [name: string]: MessageAttribute; } - } - - export interface CreateQueueParams { - QueueName: string; - Attributes: QueueAttributes; - } - - export interface QueueAttributes { - [name: string]: any; - DelaySeconds?: number; - MaximumMessageSize?: number; - MessageRetentionPeriod?: number; - Policy?: any; - ReceiveMessageWaitTimeSeconds?: number; - VisibilityTimeout?: number; - RedrivePolicy?: any; - } - - export interface GetQueueAttributesParams { - QueueUrl: string; - AttributeNames: string[]; - } - - export interface GetQueueAttributesResult { - Attributes: { [name: string]: string }; - } - - export interface GetQueueUrlParams { - QueueName: string; - QueueOwnerAWSAccountId?: string; - } - - export interface SendMessageResult { - MessageId: string; - MD5OfMessageBody: string; - MD5OfMessageAttributes: string; - } - - export interface ReceiveMessageResult { - Messages: Message[]; - } - - export interface Message { - MessageId: string; - ReceiptHandle: string; - MD5OfBody: string; - Body: string; - Attributes: { [name: string]: any }; - MD5OfMessageAttributes: string; - MessageAttributes: { [name: string]: MessageAttribute; } - } - - export interface MessageAttribute { - StringValue?: string; - BinaryValue?: any; //(Buffer, Typed Array, Blob, String) - StringListValues?: string[]; - BinaryListValues?: any[]; - DataType: string; - } - - export interface DeleteMessageBatchResult { - Successful: DeleteMessageBatchResultEntry[]; - Failed: BatchResultErrorEntry[]; - } - - export interface DeleteMessageBatchResultEntry { - Id: string; - } - - export interface BatchResultErrorEntry { - Id: string; - Code: string; - Message?: string; - SenderFault: boolean; - } - - export interface SendMessageBatchResult { - Successful: SendMessageBatchResultEntry[]; - Failed: BatchResultErrorEntry[]; - } - - export interface SendMessageBatchResultEntry { - Id: string; - MessageId: string; - MD5OfMessageBody: string; - MD5OfMessageAttributes: string; - } - - export interface CreateQueueResult { - QueueUrl: string; - } - - export interface SetQueueAttributesParams { - QueueUrl: string; - Attributes: QueueAttributes; - } - -} - -export declare module SES { - - export interface Client { - config: ClientConfig; - - sendEmail(params: any, callback: (err: any, data: SendEmailResult) => void): void; - } - - export interface SendEmailRequest { - Source: string; - Destination: Destination; - Message: Message; - ReplyToAddresses: string[]; - ReturnPath: string; - } - - export class Destination { - ToAddresses: string[]; - CcAddresses: string[]; - BccAddresses: string[]; - } - - export class Message { - Subject: Content; - Body: Body; - } - - export class Content { - Data: string; - Charset: string; - } - - export class Body { - Text: Content; - Html: Content; - } - - export class SendEmailResult { - MessageId: string; - } - -} - -export declare module Swf { - - export interface Client { - //constructor(options?: any); - config: ClientConfig; - - countClosedWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - countOpenWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - countPendingActivityTasks(params: any, callback: (err: any, data: any) => void): void; - countPendingDecisionTasks(params: any, callback: (err: any, data: any) => void): void; - deprecateActivityType(params: any, callback: (err: any, data: any) => void): void; - deprecateDomain(params: any, callback: (err: any, data: any) => void): void; - deprecateWorkflowType(params: any, callback: (err: any, data: any) => void): void; - describeActivityType(params: any, callback: (err: any, data: any) => void): void; - describeDomain(params: any, callback: (err: any, data: any) => void): void; - describeWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - describeWorkflowType(params: any, callback: (err: any, data: any) => void): void; - getWorkflowExecutionHistory(params: any, callback: (err: any, data: any) => void): void; - listActivityTypes(params: any, callback: (err: any, data: any) => void): void; - listClosedWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - listDomains(params: any, callback: (err: any, data: any) => void): void; - listOpenWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - listWorkflowTypes(params: any, callback: (err: any, data: any) => void): void; - pollForActivityTask(params: any, callback: (err: any, data: ActivityTask) => void): void; - pollForDecisionTask(params: any, callback: (err: any, data: DecisionTask) => void): void; - recordActivityTaskHeartbeat(params: any, callback: (err: any, data: any) => void): void; - registerActivityType(params: any, callback: (err: any, data: any) => void): void; - registerDomain(params: any, callback: (err: any, data: any) => void): void; - registerWorkflowType(params: any, callback: (err: any, data: any) => void): void; - requestCancelWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - respondActivityTaskCanceled(params: RespondActivityTaskCanceledRequest, callback: (err: any, data: any) => void): void; - respondActivityTaskCompleted(params: RespondActivityTaskCompletedRequest, callback: (err: any, data: any) => void): void; - respondActivityTaskFailed(params: RespondActivityTaskFailedRequest, callback: (err: any, data: any) => void): void; - respondDecisionTaskCompleted(params: RespondDecisionTaskCompletedRequest, callback: (err: any, data: any) => void): void; - signalWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - startWorkflowExecution(params: any, callback: (err: any, data: StartWorkflowExecutionResult) => void): void; - terminateWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - } - - export interface PollForActivityTaskRequest { - domain?: string; - taskList?: TaskList; - identity?: string; - } - - export interface TaskList { - name?: string; - } - - export interface PollForDecisionTaskRequest { - domain?: string; - taskList?: TaskList; - identity?: string; - nextPageToken?: string; - maximumPageSize?: number; - reverseOrder?: Boolean; - } - - export interface StartWorkflowExecutionRequest { - domain?: string; - workflowId?: string; - workflowType?: WorkflowType; - taskList?: TaskList; - input?: string; - executionStartToCloseTimeout?: string; - tagList?: string[]; - taskStartToCloseTimeout?: string; - childPolicy?: string; - } - - export interface WorkflowType { - name?: string; - version?: string; - } - - export interface RespondDecisionTaskCompletedRequest { - taskToken?: string; - decisions?: Decision[]; - executionContext?: string; - } - - export interface Decision { - decisionType?: string; - scheduleActivityTaskDecisionAttributes?: ScheduleActivityTaskDecisionAttributes; - requestCancelActivityTaskDecisionAttributes?: RequestCancelActivityTaskDecisionAttributes; - completeWorkflowExecutionDecisionAttributes?: CompleteWorkflowExecutionDecisionAttributes; - failWorkflowExecutionDecisionAttributes?: FailWorkflowExecutionDecisionAttributes; - cancelWorkflowExecutionDecisionAttributes?: CancelWorkflowExecutionDecisionAttributes; - continueAsNewWorkflowExecutionDecisionAttributes?: ContinueAsNewWorkflowExecutionDecisionAttributes; - recordMarkerDecisionAttributes?: RecordMarkerDecisionAttributes; - startTimerDecisionAttributes?: StartTimerDecisionAttributes; - cancelTimerDecisionAttributes?: CancelTimerDecisionAttributes; - signalExternalWorkflowExecutionDecisionAttributes?: SignalExternalWorkflowExecutionDecisionAttributes; - requestCancelExternalWorkflowExecutionDecisionAttributes?: RequestCancelExternalWorkflowExecutionDecisionAttributes; - startChildWorkflowExecutionDecisionAttributes?: StartChildWorkflowExecutionDecisionAttributes; - } - - export interface ScheduleActivityTaskDecisionAttributes { - activityType?: ActivityType; - activityId?: string; - control?: string; - input?: string; - scheduleToCloseTimeout?: string; - taskList?: TaskList; - scheduleToStartTimeout?: string; - startToCloseTimeout?: string; - heartbeatTimeout?: string; - } - - export interface ActivityType { - name?: string; - version?: string; - } - - export interface RequestCancelActivityTaskDecisionAttributes { - activityId?: string; - } - - export interface CompleteWorkflowExecutionDecisionAttributes { - result?: string; - } - - export interface FailWorkflowExecutionDecisionAttributes { - reason?: string; - details?: string; - } - - export interface CancelWorkflowExecutionDecisionAttributes { - details?: string; - } - - export interface ContinueAsNewWorkflowExecutionDecisionAttributes { - input?: string; - executionStartToCloseTimeout?: string; - taskList?: TaskList; - taskStartToCloseTimeout?: string; - childPolicy?: string; - tagList?: string[]; - workflowTypeVersion?: string; - } - - export interface RecordMarkerDecisionAttributes { - markerName?: string; - details?: string; - } - - export interface StartTimerDecisionAttributes { - timerId?: string; - control?: string; - startToFireTimeout?: string; - } - - export interface CancelTimerDecisionAttributes { - timerId?: string; - } - - export interface SignalExternalWorkflowExecutionDecisionAttributes { - workflowId?: string; - runId?: string; - signalName?: string; - input?: string; - control?: string; - } - - export interface RequestCancelExternalWorkflowExecutionDecisionAttributes { - workflowId?: string; - runId?: string; - control?: string; - } - - export interface StartChildWorkflowExecutionDecisionAttributes { - workflowType?: WorkflowType; - workflowId?: string; - control?: string; - input?: string; - executionStartToCloseTimeout?: string; - taskList?: TaskList; - taskStartToCloseTimeout?: string; - childPolicy?: string; - tagList?: string[]; - } - - export interface RespondActivityTaskCompletedRequest { - taskToken?: string; - result?: string; - } - - export interface RespondActivityTaskFailedRequest { - taskToken?: string; - reason?: string; - details?: string; - } - - export interface RespondActivityTaskCanceledRequest { - taskToken?: string; - details?: string; - } - - export interface DecisionTask { - taskToken?: string; - startedEventId?: number; - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - events?: HistoryEvent[]; - nextPageToken?: string; - previousStartedEventId?: number; - } - - export interface WorkflowExecution { - workflowId?: string; - runId?: string; - } - - export interface HistoryEvent { - eventTimestamp?: any; - eventType?: string; - eventId?: number; - workflowExecutionStartedEventAttributes?: WorkflowExecutionStartedEventAttributes; - workflowExecutionCompletedEventAttributes?: WorkflowExecutionCompletedEventAttributes; - completeWorkflowExecutionFailedEventAttributes?: CompleteWorkflowExecutionFailedEventAttributes; - workflowExecutionFailedEventAttributes?: WorkflowExecutionFailedEventAttributes; - failWorkflowExecutionFailedEventAttributes?: FailWorkflowExecutionFailedEventAttributes; - workflowExecutionTimedOutEventAttributes?: WorkflowExecutionTimedOutEventAttributes; - workflowExecutionCanceledEventAttributes?: WorkflowExecutionCanceledEventAttributes; - cancelWorkflowExecutionFailedEventAttributes?: CancelWorkflowExecutionFailedEventAttributes; - workflowExecutionContinuedAsNewEventAttributes?: WorkflowExecutionContinuedAsNewEventAttributes; - continueAsNewWorkflowExecutionFailedEventAttributes?: ContinueAsNewWorkflowExecutionFailedEventAttributes; - workflowExecutionTerminatedEventAttributes?: WorkflowExecutionTerminatedEventAttributes; - workflowExecutionCancelRequestedEventAttributes?: WorkflowExecutionCancelRequestedEventAttributes; - decisionTaskScheduledEventAttributes?: DecisionTaskScheduledEventAttributes; - decisionTaskStartedEventAttributes?: DecisionTaskStartedEventAttributes; - decisionTaskCompletedEventAttributes?: DecisionTaskCompletedEventAttributes; - decisionTaskTimedOutEventAttributes?: DecisionTaskTimedOutEventAttributes; - activityTaskScheduledEventAttributes?: ActivityTaskScheduledEventAttributes; - activityTaskStartedEventAttributes?: ActivityTaskStartedEventAttributes; - activityTaskCompletedEventAttributes?: ActivityTaskCompletedEventAttributes; - activityTaskFailedEventAttributes?: ActivityTaskFailedEventAttributes; - activityTaskTimedOutEventAttributes?: ActivityTaskTimedOutEventAttributes; - activityTaskCanceledEventAttributes?: ActivityTaskCanceledEventAttributes; - activityTaskCancelRequestedEventAttributes?: ActivityTaskCancelRequestedEventAttributes; - workflowExecutionSignaledEventAttributes?: WorkflowExecutionSignaledEventAttributes; - markerRecordedEventAttributes?: MarkerRecordedEventAttributes; - timerStartedEventAttributes?: TimerStartedEventAttributes; - timerFiredEventAttributes?: TimerFiredEventAttributes; - timerCanceledEventAttributes?: TimerCanceledEventAttributes; - startChildWorkflowExecutionInitiatedEventAttributes?: StartChildWorkflowExecutionInitiatedEventAttributes; - childWorkflowExecutionStartedEventAttributes?: ChildWorkflowExecutionStartedEventAttributes; - childWorkflowExecutionCompletedEventAttributes?: ChildWorkflowExecutionCompletedEventAttributes; - childWorkflowExecutionFailedEventAttributes?: ChildWorkflowExecutionFailedEventAttributes; - childWorkflowExecutionTimedOutEventAttributes?: ChildWorkflowExecutionTimedOutEventAttributes; - childWorkflowExecutionCanceledEventAttributes?: ChildWorkflowExecutionCanceledEventAttributes; - childWorkflowExecutionTerminatedEventAttributes?: ChildWorkflowExecutionTerminatedEventAttributes; - signalExternalWorkflowExecutionInitiatedEventAttributes?: SignalExternalWorkflowExecutionInitiatedEventAttributes; - externalWorkflowExecutionSignaledEventAttributes?: ExternalWorkflowExecutionSignaledEventAttributes; - signalExternalWorkflowExecutionFailedEventAttributes?: SignalExternalWorkflowExecutionFailedEventAttributes; - externalWorkflowExecutionCancelRequestedEventAttributes?: ExternalWorkflowExecutionCancelRequestedEventAttributes; - requestCancelExternalWorkflowExecutionInitiatedEventAttributes?: RequestCancelExternalWorkflowExecutionInitiatedEventAttributes; - requestCancelExternalWorkflowExecutionFailedEventAttributes?: RequestCancelExternalWorkflowExecutionFailedEventAttributes; - scheduleActivityTaskFailedEventAttributes?: ScheduleActivityTaskFailedEventAttributes; - requestCancelActivityTaskFailedEventAttributes?: RequestCancelActivityTaskFailedEventAttributes; - startTimerFailedEventAttributes?: StartTimerFailedEventAttributes; - cancelTimerFailedEventAttributes?: CancelTimerFailedEventAttributes; - startChildWorkflowExecutionFailedEventAttributes?: StartChildWorkflowExecutionFailedEventAttributes; - } - - export interface WorkflowExecutionStartedEventAttributes { - input?: string; - executionStartToCloseTimeout?: string; - taskStartToCloseTimeout?: string; - childPolicy?: string; - taskList?: TaskList; - workflowType?: WorkflowType; - tagList?: string[]; - continuedExecutionRunId?: string; - parentWorkflowExecution?: WorkflowExecution; - parentInitiatedEventId?: number; - } - - export interface WorkflowExecutionCompletedEventAttributes { - result?: string; - decisionTaskCompletedEventId?: number; - } - - export interface CompleteWorkflowExecutionFailedEventAttributes { - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface WorkflowExecutionFailedEventAttributes { - reason?: string; - details?: string; - decisionTaskCompletedEventId?: number; - } - - export interface FailWorkflowExecutionFailedEventAttributes { - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface WorkflowExecutionTimedOutEventAttributes { - timeoutType?: string; - childPolicy?: string; - } - - export interface WorkflowExecutionCanceledEventAttributes { - details?: string; - decisionTaskCompletedEventId?: number; - } - - export interface CancelWorkflowExecutionFailedEventAttributes { - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface WorkflowExecutionContinuedAsNewEventAttributes { - input?: string; - decisionTaskCompletedEventId?: number; - newExecutionRunId?: string; - executionStartToCloseTimeout?: string; - taskList?: TaskList; - taskStartToCloseTimeout?: string; - childPolicy?: string; - tagList?: string[]; - workflowType?: WorkflowType; - } - - export interface ContinueAsNewWorkflowExecutionFailedEventAttributes { - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface WorkflowExecutionTerminatedEventAttributes { - reason?: string; - details?: string; - childPolicy?: string; - cause?: string; - } - - export interface WorkflowExecutionCancelRequestedEventAttributes { - externalWorkflowExecution?: WorkflowExecution; - externalInitiatedEventId?: number; - cause?: string; - } - - export interface DecisionTaskScheduledEventAttributes { - taskList?: TaskList; - startToCloseTimeout?: string; - } - - export interface DecisionTaskStartedEventAttributes { - identity?: string; - scheduledEventId?: number; - } - - export interface DecisionTaskCompletedEventAttributes { - executionContext?: string; - scheduledEventId?: number; - startedEventId?: number; - } - - export interface DecisionTaskTimedOutEventAttributes { - timeoutType?: string; - scheduledEventId?: number; - startedEventId?: number; - } - - export interface ActivityTaskScheduledEventAttributes { - activityType?: ActivityType; - activityId?: string; - input?: string; - control?: string; - scheduleToStartTimeout?: string; - scheduleToCloseTimeout?: string; - startToCloseTimeout?: string; - taskList?: TaskList; - decisionTaskCompletedEventId?: number; - heartbeatTimeout?: string; - } - - export interface ActivityTaskStartedEventAttributes { - identity?: string; - scheduledEventId?: number; - } - - export interface ActivityTaskCompletedEventAttributes { - result?: string; - scheduledEventId?: number; - startedEventId?: number; - } - - export interface ActivityTaskFailedEventAttributes { - reason?: string; - details?: string; - scheduledEventId?: number; - startedEventId?: number; - } - - export interface ActivityTaskTimedOutEventAttributes { - timeoutType?: string; - scheduledEventId?: number; - startedEventId?: number; - details?: string; - } - - export interface ActivityTaskCanceledEventAttributes { - details?: string; - scheduledEventId?: number; - startedEventId?: number; - latestCancelRequestedEventId?: number; - } - - export interface ActivityTaskCancelRequestedEventAttributes { - decisionTaskCompletedEventId?: number; - activityId?: string; - } - - export interface WorkflowExecutionSignaledEventAttributes { - signalName?: string; - input?: string; - externalWorkflowExecution?: WorkflowExecution; - externalInitiatedEventId?: number; - } - - export interface MarkerRecordedEventAttributes { - markerName?: string; - details?: string; - decisionTaskCompletedEventId?: number; - } - - export interface TimerStartedEventAttributes { - timerId?: string; - control?: string; - startToFireTimeout?: string; - decisionTaskCompletedEventId?: number; - } - - export interface TimerFiredEventAttributes { - timerId?: string; - startedEventId?: number; - } - - export interface TimerCanceledEventAttributes { - timerId?: string; - startedEventId?: number; - decisionTaskCompletedEventId?: number; - } - - export interface StartChildWorkflowExecutionInitiatedEventAttributes { - workflowId?: string; - workflowType?: WorkflowType; - control?: string; - input?: string; - executionStartToCloseTimeout?: string; - taskList?: TaskList; - decisionTaskCompletedEventId?: number; - childPolicy?: string; - taskStartToCloseTimeout?: string; - tagList?: string[]; - } - - export interface ChildWorkflowExecutionStartedEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - initiatedEventId?: number; - } - - export interface ChildWorkflowExecutionCompletedEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - result?: string; - initiatedEventId?: number; - startedEventId?: number; - } - - export interface ChildWorkflowExecutionFailedEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - reason?: string; - details?: string; - initiatedEventId?: number; - startedEventId?: number; - } - - export interface ChildWorkflowExecutionTimedOutEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - timeoutType?: string; - initiatedEventId?: number; - startedEventId?: number; - } - - export interface ChildWorkflowExecutionCanceledEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - details?: string; - initiatedEventId?: number; - startedEventId?: number; - } - - export interface ChildWorkflowExecutionTerminatedEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - initiatedEventId?: number; - startedEventId?: number; - } - - export interface SignalExternalWorkflowExecutionInitiatedEventAttributes { - workflowId?: string; - runId?: string; - signalName?: string; - input?: string; - decisionTaskCompletedEventId?: number; - control?: string; - } - - export interface ExternalWorkflowExecutionSignaledEventAttributes { - workflowExecution?: WorkflowExecution; - initiatedEventId?: number; - } - - export interface SignalExternalWorkflowExecutionFailedEventAttributes { - workflowId?: string; - runId?: string; - cause?: string; - initiatedEventId?: number; - decisionTaskCompletedEventId?: number; - control?: string; - } - - export interface ExternalWorkflowExecutionCancelRequestedEventAttributes { - workflowExecution?: WorkflowExecution; - initiatedEventId?: number; - } - - export interface RequestCancelExternalWorkflowExecutionInitiatedEventAttributes { - workflowId?: string; - runId?: string; - decisionTaskCompletedEventId?: number; - control?: string; - } - - export interface RequestCancelExternalWorkflowExecutionFailedEventAttributes { - workflowId?: string; - runId?: string; - cause?: string; - initiatedEventId?: number; - decisionTaskCompletedEventId?: number; - control?: string; - } - - export interface ScheduleActivityTaskFailedEventAttributes { - activityType?: ActivityType; - activityId?: string; - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface RequestCancelActivityTaskFailedEventAttributes { - activityId?: string; - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface StartTimerFailedEventAttributes { - timerId?: string; - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface CancelTimerFailedEventAttributes { - timerId?: string; - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface StartChildWorkflowExecutionFailedEventAttributes { - workflowType?: WorkflowType; - cause?: string; - workflowId?: string; - initiatedEventId?: number; - decisionTaskCompletedEventId?: number; - control?: string; - } - - export interface ActivityTask { - taskToken?: string; - activityId?: string; - startedEventId?: number; - workflowExecution?: WorkflowExecution; - activityType?: ActivityType; - input?: string; - } - - export interface PollForActivityTaskResult { - activityTask?: ActivityTask; - } - - export interface PollForDecisionTaskResult { - decisionTask?: DecisionTask; - } - - export interface StartWorkflowExecutionResult { - run?: Run; - } - - export interface Run { - runId?: string; - } - -} - -export declare module Sns { - - export interface Client { - config: ClientConfig; - - publish(params: PublishRequest, callback: (err: any, data: PublishResult) => void): void; - createTopic(params: CreateTopicRequest, callback: (err: any, data: CreateTopicResult) => void): void; - deleteTopic(params: DeleteTopicRequest, callback: (err: any, data: any) => void): void; - } - - export interface PublishRequest { - TopicArn?: string; - TargetArn?: string; - MessageAttributes?: { [name: string]: MessageAttribute; }; - Message?: string; - MessageStructure?: string; - Subject?: string; - } - - export interface MessageAttribute { - DataType: string; - StringValue?: string; - BinaryValue: any; // (Buffer, Typed Array, Blob, String) - } - - export interface PublishResult { - MessageId?: string; - } - - export interface CreateTopicRequest { - Name?: string; - } - - export interface CreateTopicResult { - TopicArn?: string; - } - - export interface DeleteTopicRequest { - TopicArn?: string; - } - -} - -export declare module s3 { - interface Owner { - DisplayName: string; - ID: string; - } - - interface ObjectKeyPrefix { - Prefix: string; - } - - export interface ListObjectContent { - Key: string; - LastModified: Date; - ETag: string; - Size: number; - StorageClass: "STANDARD" | "REDUCED_REDUNDANCY" | "GLACIER"; - Owner?: Owner - } - - // This private interface contains the common parts between v1 and v2 of the API Request and is exposed via V1 and V2 subclasses - interface ListObjectRequestBase { - Bucket: string; - Delimiter?: string; - EncodingType?: 'url'; - MaxKeys?: number; - Prefix?: string; - } - - // This private interface contains the common parts between v1 and v2 of the API Response and is exposed via V1 and V2 subclasses - interface ListObjectResponseBase { - IsTruncated: boolean; - Contents: ListObjectContent[]; - Name: string; - Prefix?: string; - Delimiter?: string; - MaxKeys: number; - CommonPrefixes?: ObjectKeyPrefix[]; - EncodingType?: "url"; - } - - export interface PutObjectRequest { - ACL?: string; - Body?: any; - Bucket: string; - CacheControl?: string; - ContentDisposition?: string; - ContentEncoding?: string; - ContentLanguage?: string; - ContentLength?: string; - ContentMD5?: string; - ContentType?: string; - Expires?: any; - GrantFullControl?: string; - GrantRead?: string; - GrantReadACP?: string; - GrantWriteACP?: string; - Key: string; - Metadata?: { [key: string]: string; }; - ServerSideEncryption?: string; - StorageClass?: string; - WebsiteRedirectLocation?: string; - } - - export interface CopyObjectRequest { - Bucket: string; - CopySource: string; - Key: string; - ACL?: string; - CacheControl?: string; - ContentDisposition?: string; - ContentEncoding?: string; - ContentLanguage?: string; - ContentType?: string; - CopySourceIfMatch?: string; - CopySourceIfModifiedSince?: any; - CopySourceIfNoneMatch?: string; - CopySourceIfUnmodifiedSince?: any; - CopySourceSSECustomerAlgorithm?: string; - CopySourceSSECustomerKey?: any; - CopySourceSSECustomerKeyMD5?: string; - Expires?: any; - GrantFullControl?: string; - GrantRead?: string; - GrantReadACP?: string; - GrantWriteACP?: string; - Metadata?: { [key: string]: string; }; - MetadataDirective?: string; - RequestPayer?: string; - SSECustomerAlgorithm?: string; - SSECustomerKey?: any; - SSECustomerKeyMD5?: string; - SSEKMSKeyId?: string; - ServerSideEncryption?: string; - StorageClass?: string; - WebsiteRedirectLocation?: string; - } - - export interface GetObjectRequest { - Bucket: string; - IfMatch?: string; - IfModifiedSince?: any; - IfNoneMatch?: string; - IfUnmodifiedSince?: any; - Key: string; - Range?: string; - ResponseCacheControl?: string; - ResponseContentDisposition?: string; - ResponseContentEncoding?: string; - ResponseContentLanguage?: string; - ResponseContentType?: string; - ResponseExpires?: any; - VersionId?: string; - } - - export interface DeleteObjectRequest { - Bucket: string; - Key: string; - MFA?: string; - RequestPayer?: string; - VersionId?: string; - } - - export interface HeadObjectRequest { - Bucket: string; - Key: string; - IfMatch?: string; - IfModifiedSince?: Date; - IfNoneMatch?: string; - IfUnmodifiedSince?: Date; - Range?: string; - RequestPayer?: string; - SSECustomerAlgorithm?: string; - SSECustomerKey?: Buffer | string; - SSECustomerKeyMD5?: string; - VersionId?: string; - } - - export interface UploadOptions { - partSize?: number; - queueSize?: number; - } - - export interface ListObjectRequest extends ListObjectRequestBase { - Marker?: string; - } - - export interface ListObjectV2Request extends ListObjectRequestBase { - ContinuationToken?: string; - FetchOwner?: boolean; - StartAfter?: string; - } - - export interface ListObjectResponse extends ListObjectResponseBase { - Marker?: string; - NextMarker?: string; - } - - export interface ListObjectV2Response extends ListObjectResponseBase { - KeyCount: number; - ContinuationToken?: string; - NextContinuationToken?: string; - StartAfter?: string; - } -} - -export declare module ecs { - export interface CreateServicesParams { - desiredCount: number; - serviceName: string; - taskDefinition: string; - clientToken?: string; - cluster?: string; - deploymentConfiguration?: { - maximumPercent?: number; - minimumHealthyPercent?: number; - }; - loadBalancers?: { - containerName?: string; - containerPort?: number; - loadBalancerName?: string; - }[]; - role?: string; - } - - export interface DescribeServicesParams { - /** - * A list of services to describe. - */ - services: string[]; - /** - * The name of the cluster that hosts the service to describe. If you do not specify a cluster, the default cluster is assumed. - */ - cluster?: string; - } - - export interface DescribeClustersParams { - /** - * A space-separated list of cluster names or full cluster Amazon Resource Name (ARN) entries. If you do not specify a cluster, the default cluster is assumed. - */ - clusters?: string[]; - } - - export interface DescribeTasksParams { - /** - * A space-separated list of task IDs or full Amazon Resource Name (ARN) entries. - */ - tasks: string[]; - /** - * The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task to describe. If you do not specify a cluster, the default cluster is assumed. - */ - cluster?: string; - } - - export interface DescribeTaskDefinitionParams { - /** - * The `family` for the latest `ACTIVE` revision, `family` and `revision` (`family:revision`) for a specific revision in the family, or full Amazon Resource Name (ARN) of the task definition to describe. - */ - taskDefinition: string; - } - - export interface RegisterTaskDefinitionParams { - containerDefinitions: { - command?: string[], - cpu?: number, - disableNetworking?: boolean, - dnsSearchDomains?: string[], - dnsServers?: string[], - dockerLabels?: any, - dockerSecurityOptions?: string[], - entryPoint?: string[], - environment?: any[], - essential?: boolean, - extraHosts?: { - hostName: string, - ipAddress: string - }[]; - hostname?: string, - image?: string, - links?: string[], - logConfiguration?: { - logDriver: string, - options: any - }[], - memory?: number, - mountPoints?: { - containerPath: string, - readOnly: boolean, - sourceVolume: string - }[]; - name?: string, - portMappings?: { - containerPort?: number, - hostPort?: number, - protocol: string - }[]; - privileged?: boolean, - readonlyRootFilesystem?: boolean, - ulimits?: { - hardLimit: number, - name: string, - softLimit: number - }[]; - user?: string, - volumesFrom?: { - readOnly?: boolean, - sourceContainer?: string - }[], - workingDirectory?: string - }[]; - family: string; - volumes?: { - host: { - sourcePath: string - }, - name: string - }[]; - } - - export interface UpdateServiceParams { - service: string; - cluster?: string; - deploymentConfiguration?: { - maximumPercent: number; - minimumHealthyPercent: number; - }; - desiredCount?: number; - taskDefinition: string; - } -} - -export module sts { - export interface AssumeRoleParams { - RoleArn: string; - RoleSessionName: string; - DurationSeconds?: number; - ExternalId?: string; - Policy?: string; - SerialNumber?: string; - TokenCode?: string; - } - - export interface AssumeRoleCallbackData { - Credentials: TemporaryCredentials; - AssumedRoleUser: AssumedRoleUser; - PackedPolicySize: number; - } - - export interface TemporaryCredentials { - AccessKeyId: string; - SecretAccessKey: string; - SessionToken: string; - Expiration: Date; - } - - export interface AssumedRoleUser { - AssumedRoleId: string; - Arn: string; - } - - export interface AssumeRoleWithSAMLParams { - PrincipalArn: string; - RoleArn: string; - SAMLAssertion: string; - DurationSeconds?: number; - Policy?: string; - } - - export interface AssumeRoleWithWebIdentityParams { - RoleArn: string; - RoleSessionName: string; - WebIdentityToken: string; - DurationSeconds?: number; - Policy?: string; - ProviderId?: string; - } - - export interface CredentialsFromParams { - /** - * Data retrieved from a call to AWS.STS.getFederatedToken, getSessionToken(), assumeRole(), or assumeRoleWithWebIdentity(). - */ - Data: any; - /** - * An optional credentials object to fill instead of creating a new object. Useful when modifying an existing credentials object from a refresh call. - */ - Credentials?: Credentials - } - - export interface DecodeAuthorizationMessageParams { - EncodedMessage: string; - } - - export interface GetFederationTokenParams { - Name: string; - DurationSeconds?: number, - Policy?: string - } - - export interface GetSessionTokenParams { - DurationSeconds: number, - SerialNumber: string; - TokenCode: string; - } -} diff --git a/types/aws-serverless-express/tslint.json b/types/aws-serverless-express/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/aws-serverless-express/tslint.json +++ b/types/aws-serverless-express/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/axe-core/axe-core-tests.ts b/types/axe-core/axe-core-tests.ts deleted file mode 100644 index 2ed759bba5..0000000000 --- a/types/axe-core/axe-core-tests.ts +++ /dev/null @@ -1,90 +0,0 @@ - -var context:any = document -var $fixture:any = {} - -// axe.a11yCheck config -axe.a11yCheck(context, {}, (results) => { - // axe's results object - console.log(results.passes.length) - console.log(results.violations.length) -}); -// axe.a11yCheck include/exclude -axe.a11yCheck({include: [['#id1'], ['#id2']]}, {}, (results) => { - console.log(results) -}) -axe.a11yCheck({exclude: [$fixture[0]]}, {}, (results) => { - console.log(results) -}) -var tagConfigRunOnly: axe.RunOnly = { - type: 'tag', - values: ['wcag2a'] -} -var tagConfig = { - runOnly: tagConfigRunOnly -} -axe.a11yCheck(context, tagConfig, (results) => { - console.log(results) -}) -var includeExcludeTagsRunOnly: axe.RunOnly = { - type: 'tags', - value: { - include: ['wcag2a', 'wcag2aa'], - exclude: ['experimental'] - } -} -var includeExcludeTagsConfig = { - runOnly: includeExcludeTagsRunOnly -} -axe.a11yCheck(context, includeExcludeTagsConfig, (results) => { - console.log(results) -}) -var someRulesConfig = { - rules: { - "color-contrast": {enabled: 'false'}, - "heading-order": {enabled: 'true'} - } -} -axe.a11yCheck(context, someRulesConfig, (results) => { - console.log(results) -}) - -// axe.configure -var spec: axe.Spec = { - branding: { - brand: 'foo', - application: 'bar' - }, - reporter: 'v1', - checks: [{ - id: 'custom-check', - evaluate: function() { - return true - } - }], - rules: [{ - id: 'custom-rule', - any: ['custom-check'] - }] -} -axe.configure(spec) - -axe.reset() - -axe.getRules(['wcag2aa']) -typeof axe.getRules() === 'object' - -// Plugins -var pluginSrc: axe.AxePlugin = { - id: 'doStuff', - run: (data:any, callback:Function) => { - callback() - }, - commands: [{ - id: 'run-doStuff', - callback: (data:any, callback:Function) => { - axe.plugins['doStuff'].run(data, callback) - } - }] -} -axe.registerPlugin(pluginSrc) -axe.cleanup() diff --git a/types/axe-core/index.d.ts b/types/axe-core/index.d.ts deleted file mode 100644 index 98818e75cc..0000000000 --- a/types/axe-core/index.d.ts +++ /dev/null @@ -1,159 +0,0 @@ -// Type definitions for axe-core 2.0.5 -// Project: https://github.com/dequelabs/axe-core -// Definitions by: Marcy Sutton -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace axe { - - export type ImpactValue = "minor" | "moderate" | "serious" | "critical"; - - export type TagValue = "wcag2a" | "wcag2aa" | "section508" | "best-practice"; - - export type ReporterVersion = "v1" | "v2"; - - export type RunOnlyType = "rule" | "rules" | "tag" | "tags"; - - export interface ElementContext { - node?: Object, - selector?: string, - include?: any[], - exclude?: any[] - } - export interface RunOnly { - type: RunOnlyType, - value?: { - include?: string[], - exclude?: string[] - } - values?: TagValue[] - } - export interface AxeResults { - url: string, - timestamp: string, - passes: Pass[], - violations: Violation[] - } - export interface Pass { - description: string, - help: string, - helpUrl: string, - id: string, - impact: ImpactValue, - tags: TagValue[], - nodes: NodeResult[] - } - export interface Violation { - description: string, - help: string, - helpUrl: string, - id: string, - impact: ImpactValue, - tags: TagValue[], - nodes: NodeResult[] - } - export interface NodeResult { - html: string, - impact: ImpactValue, - target: string[], - any: CheckResult[], - all: CheckResult[], - none: CheckResult[] - } - export interface CheckResult { - id: string, - impact: string, - message: string, - data: any, - relatedNodes?: RelatedNode[] - } - export interface RelatedNode { - target: string[], - html: string - } - export interface Spec { - branding?: { - brand: string, - application: string - }, - reporter?: ReporterVersion, - checks?: Check[], - rules?: Rule[] - } - export interface Check { - id: string, - evaluate: Function, - after?: Function, - options?: any, - matches?: string, - enabled?: boolean - } - export interface Rule { - id: string, - selector?: string, - excludeHidden?: boolean, - enabled?: boolean, - pageLevel?: boolean, - any?: string[], - all?: string[], - none?: string[], - tags?: string[], - matches?: string - } - export interface AxePlugin { - id: string, - run(...args:any[]): any, - commands: { - id: string, - callback(...args:any[]): void - }[], - cleanup?(callback:Function): void - } - - export let plugins: any - - /** - * Starts analysis on the current document and its subframes - * - * @param {Object} context The `Context` specification object @see Context - * @param {Array} options Options passed into rules or checks, temporarily modifyint them. - * @param {Function} callback The function to invoke when analysis is complete. - * @returns {Object} results The aXe results object - */ - export function a11yCheck(context: ElementContext, options: {runOnly?: RunOnly, rules?: Object}, callback: (results:AxeResults) => void): AxeResults - - /** - * Method for configuring the data format used by aXe. Helpful for adding new - * rules, which must be registered with the library to execute. - * @param {Spec} Spec Object with valid `branding`, `reporter`, `checks` and `rules` data - */ - export function configure(spec: Spec): void - - /** - * Searches and returns rules that contain a tag in the list of tags. - * @param {Array} tags Optional array of tags - * @return {Array} Array of rules - */ - export function getRules(tags?: string[]): Object[] - - /** - * Restores the default axe configuration - */ - export function reset(): void - - /** - * Function to register a plugin configuration in document and its subframes - * @param {Object} plugin A plugin configuration object - */ - export function registerPlugin(plugin: AxePlugin): void - - /** - * Function to clean up plugin configuration in document and its subframes - */ - export function cleanup(): void - -} - -// axe is also available as a module -declare module "axe-core" { - export = axe; -} diff --git a/types/azure-mobile-apps/azure-mobile-apps-tests.ts b/types/azure-mobile-apps/azure-mobile-apps-tests.ts deleted file mode 100644 index d653e0ae95..0000000000 --- a/types/azure-mobile-apps/azure-mobile-apps-tests.ts +++ /dev/null @@ -1,125 +0,0 @@ - - -import express = require('express'); -import mobileApps = require('azure-mobile-apps'); -import logger = require('azure-mobile-apps/src/logger'); -import queries = require('azure-mobile-apps/src/query'); - -var app = express(), - mobileApp = mobileApps(); - -// various configuration permutations -mobileApps({ - debug: true, - data: { - provider: 'mssql', - server: '', - user: '', - database: '', - password: '' - }, - webhook: { url: 'http://localhost/' } -}); - -mobileApps({ - data: { - provider: 'memory' - } -}) - -// it would be nice to integrate with winston -mobileApps({ logging: { level: 'silly', transports: [{}] } }) - -// various custom middleware syntaxes -mobileApp.use(function (req: any, res: any, next: any) { next(); }); -mobileApp.use([function () {}, function () {}]); -mobileApp.use(function () {}, function () {}); -mobileApp.use(function () {}).use(function () {}); - -// basic syntax for tables and api -mobileApp.tables.add('todoitem'); -mobileApp.tables.add('todoitem', { authorize: true }); -mobileApp.tables.add('todoitem', mobileApps.table()); -mobileApp.tables.import('tables'); -mobileApp.api.add('api', { authorize: true, get: function () {}, delete: function () {} }); -mobileApp.api.import('api'); - -// ensure the mobile app instance can be correctly mounted as an express router -app.use(mobileApp); - -// Express.Table, instantiated from the mobile app -var table = mobileApp.table() -table.use(function (req: Express.Request, res: Express.Response, next: any) { - next(new Error()); -}); -table.use([function () {}, function () {}]); -table.read(function (context: Azure.MobileApps.Context) { - context.query.where({ p1: 'test' }); - return context.execute() - .then(function (result: any) { - return result; - }) - .catch(function (error: any) { }) - .then(function () {}); -}); -table.insert(function (context: Azure.MobileApps.Context) { - context.query.id = 'anotherId'; - context.query.single = true; - context.item.userId = context.user.id; - context.push.send('tag', {}, function (error, result) {}); - context.push.gcm.send('tag', {}, function (error, result) {}); - context.push.apns.send('tag', { payload: { } }, function (error, result) {}); - context.push.wns.sendToastText01('tag', '', { headers: { } }, function (error, result) {}); - context.next(new Error()); - context.next('An error occurred'); -}); -table.read.use(function () {}); -table.read.use([function () {}, function () {}]); -table.read.use(function () {}, function () {}); -table.use(function () {}).use(function () {}).read(function () {}).use(function () {}); - -table.access = undefined; -table.access = 'authenticated'; -table.read.access = 'anonymous'; -table.update.access = 'disabled'; -table.delete.access = 'authenticated'; -table.insert.access = 'authenticated'; - -table.filters = [function (query, context) { }]; -table.transforms = [function (item, context) { }]; -table.hooks = [function (results, context) { }]; - -table.perUser = true; -table.recordsExpire = { milliseconds: 1, seconds: 1, minutes: 1, hours: 1, days: 1, weeks: 1, months: 1, years: 1 }; -table.webhook = { url: 'http://localhost/' } -table.webhook = true; - -// Express.Table, instantiated from the static require('azure-mobile-apps').table() -// This is going to be interesting if we ever support more than one provider -var table2 = mobileApps.table(); -table2.read(function (context: Azure.MobileApps.Context) {}); - -// ApiDefinition, from the static require('azure-mobile-apps').api() -var api2 = mobileApps.api({ - get: function (req, res, next) { } -}); -api2.post = function (req, res, next) {}; - -// Logger -logger.silly('test', 'message'); -logger.error('Something happened', new Error()); -mobileApps.logger.debug('a debug message') - -// Query -queries.create('table').where({ x: 10 }).select('col1,col2').includeDeleted().includeTotalCount(); -mobileApps.query.create('table'); - -// Custom SQL query -mobileApp.api.add('query', { authorize: true, get: (req, res, next) => { - req.azureMobile.data.execute({ - sql: "SELECT * FROM TODOITEM WHERE COMPLETE = :complete", - parameters: [ - { name: 'complete', value: 1 } - ] - }).then(x => {}); -}, delete: function () {} }); diff --git a/types/azure-mobile-apps/index.d.ts b/types/azure-mobile-apps/index.d.ts deleted file mode 100644 index 53dd5edae3..0000000000 --- a/types/azure-mobile-apps/index.d.ts +++ /dev/null @@ -1,326 +0,0 @@ -// Type definitions for azure-mobile-apps v2.1.7 -// Project: https://github.com/Azure/azure-mobile-apps-node/ -// Definitions by: Microsoft Azure -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -/// - -declare module "azure-mobile-apps" { - interface AzureMobileApps { - (configuration?: Azure.MobileApps.Configuration): Azure.MobileApps.Platforms.Express.MobileApp; - table(): Azure.MobileApps.Platforms.Express.Table; - api(definition?: Azure.MobileApps.ApiDefinition): Azure.MobileApps.ApiDefinition; - logger: Azure.MobileApps.Logger; - query: Azure.MobileApps.Query; - } - - var out: AzureMobileApps; - export = out; -} -declare module "azure-mobile-apps/src/logger" { - var logger: Azure.MobileApps.Logger; - export = logger; -} - -declare module "azure-mobile-apps/src/query" { - var query: Azure.MobileApps.Query; - export = query; -} - -declare namespace Azure.MobileApps { - // the additional Platforms namespace is required to avoid collisions with the main Express namespace - export module Platforms { - export module Express { - interface MobileApp extends Middleware { - configuration: Configuration; - tables: Tables; - table(): Table; - api: Api; - use(...middleware: Middleware[]): MobileApp; - use(middleware: Middleware[]): MobileApp; - } - - interface Api { - add(name: string, definition: ApiDefinition): void; - import(fileOrFolder: string): void; - } - - interface Table extends TableDefinition { - use(...middleware: Middleware[]): Table; - use(middleware: Middleware[]): Table; - read: TableOperation; - update: TableOperation; - insert: TableOperation; - delete: TableOperation; - undelete: TableOperation; - } - - interface TableOperation { - (operationHandler: (context: Context) => void): Table; - use(...middleware: Middleware[]): Table; - use(middleware: Middleware[]): Table; - access?: AccessType; - } - - interface Tables { - configuration: Configuration; - add(name: string, definition?: Table | TableDefinition): void; - import(fileOrFolder: string): void; - initialize(): Thenable; - } - } - } - - export module Data { - interface Table { - read(query: QueryJs): Thenable; - update(item: any, query: QueryJs): Thenable; - insert(item: any): Thenable; - delete(query: QueryJs, version: string): Thenable; - undelete(query: QueryJs, version: string): Thenable; - truncate(): Thenable; - initialize(): Thenable; - schema(): Thenable; - } - - interface Column { - name: string; - type: string; - } - } - - // auth - interface User { - id: string; - claims: any[]; - token: string; - getIdentity(provider: string): Thenable; - } - - interface Auth { - validate(token: string): Thenable; - decode(token: string): User; - sign(payload: any): string; - } - - // configuration - interface Configuration { - platform?: string; - basePath?: string; - configFile?: string; - promiseConstructor?: (resolve: (result: any) => void, reject: (error: any) => void) => Thenable; - apiRootPath?: string; - tableRootPath?: string; - notificationRootPath?: string; - swaggerPath?: string; - authStubRoute?: string; - debug?: boolean; - version?: string; - apiVersion?: string; - homePage?: boolean; - swagger?: boolean; - maxTop?: number; - pageSize?: number; - logging?: Configuration.Logging; - data?: Configuration.Data; - auth?: Configuration.Auth; - cors?: Configuration.Cors; - notifications?: Configuration.Notifications; - webhook?: Webhook; - } - - export module Configuration { - // it would be nice to have the config for various providers in separate interfaces, - // but this is the simplest solution to support variations of the current setup - interface Data { - provider: string; - user?: string; - password?: string; - server?: string; - port?: number; - database?: string; - connectionTimeout?: string; - options?: { encrypt: boolean }; - schema?: string; - dynamicSchema?: boolean; - filename?: string; - } - - interface Auth { - secret: string; - validateTokens?: boolean; - } - - interface Logging { - level?: string; - transports?: LoggingTransport[]; - } - - interface LoggingTransport { } - - interface Cors { - exposeHeaders: string; - maxAge?: number; - hostnames: string[]; - } - - interface Notifications { - hubName: string; - connectionString?: string; - endpoint?: string; - sharedAccessKeyName?: string; - sharedAccessKeyValue?: string; - } - } - - // query - interface Query { - create(tableName: string): QueryJs; - fromRequest(req: Express.Request): QueryJs; - toOData(query: QueryJs): OData; - } - - interface QueryJs { - includeTotalCount(): QueryJs; - includeDeleted(): QueryJs; - orderBy(properties: string): QueryJs; - orderByDescending(properties: string): QueryJs; - select(properties: string): QueryJs; - skip(count: number): QueryJs; - take(count: number): QueryJs; - where(filter: any): QueryJs; - // these are properties added by the SDK - id?: string | number; - single?: boolean; - } - - interface OData { - table: string; - filters?: string; - ordering?: string; - orderClauses?: string; - skip?: number; - take?: number; - selections?: string; - includeTotalCount?: boolean; - } - - // general - var nh: Azure.ServiceBus.NotificationHubService; - - interface Context { - query: QueryJs; - id: string | number; - item: any; - req: Express.Request; - res: Express.Response; - data: ContextData; - tables: (tableName: string) => Data.Table; - user: User; - push: typeof nh; - logger: Logger; - execute(): Thenable; - next(error: string|Error): any; - } - - interface ContextData { - (table: TableDefinition): Data.Table; - execute(q: SqlQueryDefinition): Thenable; - } - - interface SqlQueryDefinition { - sql: string; - parameters?: SqlParameterDefinition[]; - } - - interface SqlParameterDefinition { - name: string; - value: any; - } - - interface TableDefinition { - access?: AccessType; - authorize?: boolean; - autoIncrement?: boolean; - columns?: any; - databaseTableName?: string; - dynamicSchema?: boolean; - maxTop?: number; - name?: string; - pageSize?: number; - schema?: string; - softDelete?: boolean; - userIdColumn?: string; - - filters?: [(query: QueryJs, context: Context) => void | QueryJs]; - transforms?: [(item: any, context: Context) => void | any]; - hooks?: [(results: any, context: Context) => void]; - - perUser?: boolean; - recordsExpire?: Duration; - webhook?: Webhook | boolean; - } - - type AccessType = 'anonymous' | 'authenticated' | 'disabled'; - - interface Duration { - milliseconds?: number; - seconds?: number; - minutes?: number; - hours?: number; - days?: number; - weeks?: number; - months?: number; - years?: number; - } - - interface Webhook { - url: string; - } - - interface ApiDefinition { - authorize?: boolean; - get?: Middleware | Middleware[]; - post?: Middleware | Middleware[]; - patch?: Middleware | Middleware[]; - put?: Middleware | Middleware[]; - delete?: Middleware | Middleware[]; - } - - interface Thenable { - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; - catch(onRejected?: (error: any) => U | Thenable): Thenable; - catch(onRejected?: (error: any) => void): Thenable; - } - - interface Logger { - log(level: string, ...message: any[]): void; - silly(...message: any[]): void; - debug(...message: any[]): void; - verbose(...message: any[]): void; - info(...message: any[]): void; - warn(...message: any[]): void; - error(...message: any[]): void; - } - - interface Middleware { - (req: Express.Request, res: Express.Response, next: NextMiddleware): void; - } - - interface NextMiddleware { - (error?: any): void; - } -} - -// additions to the Express modules -declare namespace Express { - interface Request { - azureMobile: Azure.MobileApps.Context - } - - interface Response { - results?: any; - } -} diff --git a/types/azure-mobile-apps/tsconfig.json b/types/azure-mobile-apps/tsconfig.json deleted file mode 100644 index ae1ae9db7b..0000000000 --- a/types/azure-mobile-apps/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "azure-mobile-apps-tests.ts" - ] -} \ No newline at end of file diff --git a/types/azure/index.d.ts b/types/azure/index.d.ts index 59d1b9d114..8e7a321713 100644 --- a/types/azure/index.d.ts +++ b/types/azure/index.d.ts @@ -1627,7 +1627,7 @@ export interface Entity { RowKey: string; Timestamp?: Date; etag?: string; - [property: string]: string | number | boolean | Date; + [property: string]: string | number | boolean | Date | undefined; } //#endregion //#region BlobService Interfaces diff --git a/types/azure/tsconfig.json b/types/azure/tsconfig.json index 5f058966d7..15e71337b2 100644 --- a/types/azure/tsconfig.json +++ b/types/azure/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/b_/tslint.json b/types/b_/tslint.json index 2221e40e4a..3db14f85ea 100644 --- a/types/b_/tslint.json +++ b/types/b_/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } \ No newline at end of file +{ "extends": "dtslint/dt.json" } diff --git a/types/babel-code-frame/index.d.ts b/types/babel-code-frame/index.d.ts index ebfde63c4c..19d18b6df8 100644 --- a/types/babel-code-frame/index.d.ts +++ b/types/babel-code-frame/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface BabelCodeFrameOptions { - /** Syntax highlight the code as JavaScript for terminals. default: false*/ + /** Syntax highlight the code as JavaScript for terminals. default: false */ highlightCode?: boolean; /** The number of lines to show above the error. default: 2 */ linesBelow?: number; diff --git a/types/babel-code-frame/tslint.json b/types/babel-code-frame/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/babel-code-frame/tslint.json +++ b/types/babel-code-frame/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/babylon/index.d.ts b/types/babylon/index.d.ts index 4400a8f1a0..eb35a5d799 100644 --- a/types/babylon/index.d.ts +++ b/types/babylon/index.d.ts @@ -5,10 +5,11 @@ /// -import * as t from 'babel-types'; -type Node = t.Node; +import { File, Expression } from 'babel-types'; -export function parse(code: string, opts?: BabylonOptions): Node; +export function parse(code: string, opts?: BabylonOptions): File; + +export function parseExpression(input: string, options?: BabylonOptions): Expression; export interface BabylonOptions { /** diff --git a/types/babylonjs/babylonjs-tests.ts b/types/babylonjs/babylonjs-tests.ts deleted file mode 100644 index 8b13789179..0000000000 --- a/types/babylonjs/babylonjs-tests.ts +++ /dev/null @@ -1 +0,0 @@ - diff --git a/types/babylonjs/index.d.ts b/types/babylonjs/index.d.ts deleted file mode 100644 index ad6d1a242f..0000000000 --- a/types/babylonjs/index.d.ts +++ /dev/null @@ -1,7260 +0,0 @@ -// Type definitions for BabylonJS v2.3 -// Project: http://www.babylonjs.com/ -// Definitions by: David Catuhe -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace BABYLON { - class _DepthCullingState { - private _isDepthTestDirty; - private _isDepthMaskDirty; - private _isDepthFuncDirty; - private _isCullFaceDirty; - private _isCullDirty; - private _isZOffsetDirty; - private _depthTest; - private _depthMask; - private _depthFunc; - private _cull; - private _cullFace; - private _zOffset; - isDirty: boolean; - zOffset: number; - cullFace: number; - cull: boolean; - depthFunc: number; - depthMask: boolean; - depthTest: boolean; - reset(): void; - apply(gl: WebGLRenderingContext): void; - } - class _AlphaState { - private _isAlphaBlendDirty; - private _isBlendFunctionParametersDirty; - private _alphaBlend; - private _blendFunctionParameters; - isDirty: boolean; - alphaBlend: boolean; - setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void; - reset(): void; - apply(gl: WebGLRenderingContext): void; - } - class EngineCapabilities { - maxTexturesImageUnits: number; - maxTextureSize: number; - maxCubemapTextureSize: number; - maxRenderTextureSize: number; - standardDerivatives: boolean; - s3tc: any; - textureFloat: boolean; - textureAnisotropicFilterExtension: any; - maxAnisotropy: number; - instancedArrays: any; - uintIndices: boolean; - highPrecisionShaderSupported: boolean; - fragmentDepthSupported: boolean; - drawBuffersExtension: any; - } - /** - * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio. - */ - class Engine { - private static _ALPHA_DISABLE; - private static _ALPHA_ADD; - private static _ALPHA_COMBINE; - private static _ALPHA_SUBTRACT; - private static _ALPHA_MULTIPLY; - private static _ALPHA_MAXIMIZED; - private static _ALPHA_ONEONE; - private static _DELAYLOADSTATE_NONE; - private static _DELAYLOADSTATE_LOADED; - private static _DELAYLOADSTATE_LOADING; - private static _DELAYLOADSTATE_NOTLOADED; - private static _TEXTUREFORMAT_ALPHA; - private static _TEXTUREFORMAT_LUMINANCE; - private static _TEXTUREFORMAT_LUMINANCE_ALPHA; - private static _TEXTUREFORMAT_RGB; - private static _TEXTUREFORMAT_RGBA; - private static _TEXTURETYPE_UNSIGNED_INT; - private static _TEXTURETYPE_FLOAT; - static ALPHA_DISABLE: number; - static ALPHA_ONEONE: number; - static ALPHA_ADD: number; - static ALPHA_COMBINE: number; - static ALPHA_SUBTRACT: number; - static ALPHA_MULTIPLY: number; - static ALPHA_MAXIMIZED: number; - static DELAYLOADSTATE_NONE: number; - static DELAYLOADSTATE_LOADED: number; - static DELAYLOADSTATE_LOADING: number; - static DELAYLOADSTATE_NOTLOADED: number; - static TEXTUREFORMAT_ALPHA: number; - static TEXTUREFORMAT_LUMINANCE: number; - static TEXTUREFORMAT_LUMINANCE_ALPHA: number; - static TEXTUREFORMAT_RGB: number; - static TEXTUREFORMAT_RGBA: number; - static TEXTURETYPE_UNSIGNED_INT: number; - static TEXTURETYPE_FLOAT: number; - static Version: string; - static Epsilon: number; - static CollisionsEpsilon: number; - static CodeRepository: string; - static ShadersRepository: string; - isFullscreen: boolean; - isPointerLock: boolean; - cullBackFaces: boolean; - renderEvenInBackground: boolean; - enableOfflineSupport: boolean; - scenes: Scene[]; - _gl: WebGLRenderingContext; - private _renderingCanvas; - private _windowIsBackground; - private _webGLVersion; - static audioEngine: AudioEngine; - private _onBlur; - private _onFocus; - private _onFullscreenChange; - private _onPointerLockChange; - private _hardwareScalingLevel; - private _caps; - private _pointerLockRequested; - private _alphaTest; - private _loadingScreen; - private _drawCalls; - private _glVersion; - private _glRenderer; - private _glVendor; - private _videoTextureSupported; - private _renderingQueueLaunched; - private _activeRenderLoops; - private fpsRange; - private previousFramesDuration; - private fps; - private deltaTime; - private _depthCullingState; - private _alphaState; - private _alphaMode; - private _loadedTexturesCache; - private _maxTextureChannels; - private _activeTexturesCache; - private _currentEffect; - private _compiledEffects; - private _vertexAttribArrays; - private _cachedViewport; - private _cachedVertexBuffers; - private _cachedIndexBuffer; - private _cachedEffectForVertexBuffers; - private _currentRenderTarget; - private _uintIndicesCurrentlySet; - private _workingCanvas; - private _workingContext; - private _bindedRenderFunction; - /** - * @constructor - * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering - * @param {boolean} [antialias] - enable antialias - * @param options - further options to be sent to the getContext function - */ - constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: { - antialias?: boolean; - preserveDrawingBuffer?: boolean; - }, adaptToDeviceRatio?: boolean); - webGLVersion: string; - private _prepareWorkingCanvas(); - resetTextureCache(): void; - getGlInfo(): { - vendor: string; - renderer: string; - version: string; - }; - getAspectRatio(camera: Camera, useScreen?: boolean): number; - getRenderWidth(useScreen?: boolean): number; - getRenderHeight(useScreen?: boolean): number; - getRenderingCanvas(): HTMLCanvasElement; - getRenderingCanvasClientRect(): ClientRect; - setHardwareScalingLevel(level: number): void; - getHardwareScalingLevel(): number; - getLoadedTexturesCache(): WebGLTexture[]; - getCaps(): EngineCapabilities; - drawCalls: number; - resetDrawCalls(): void; - setDepthFunctionToGreater(): void; - setDepthFunctionToGreaterOrEqual(): void; - setDepthFunctionToLess(): void; - setDepthFunctionToLessOrEqual(): void; - /** - * stop executing a render loop function and remove it from the execution array - * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed. - */ - stopRenderLoop(renderFunction?: () => void): void; - _renderLoop(): void; - /** - * Register and execute a render loop. The engine can have more than one render function. - * @param {Function} renderFunction - the function to continuesly execute starting the next render loop. - * @example - * engine.runRenderLoop(function () { - * scene.render() - * }) - */ - runRenderLoop(renderFunction: () => void): void; - /** - * Toggle full screen mode. - * @param {boolean} requestPointerLock - should a pointer lock be requested from the user - */ - switchFullscreen(requestPointerLock: boolean): void; - clear(color: any, backBuffer: boolean, depthStencil: boolean): void; - /** - * Set the WebGL's viewport - * @param {BABYLON.Viewport} viewport - the viewport element to be used. - * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used. - * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used. - */ - setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void; - setDirectViewport(x: number, y: number, width: number, height: number): void; - beginFrame(): void; - endFrame(): void; - /** - * resize the view according to the canvas' size. - * @example - * window.addEventListener("resize", function () { - * engine.resize(); - * }); - */ - resize(): void; - /** - * force a specific size of the canvas - * @param {number} width - the new canvas' width - * @param {number} height - the new canvas' height - */ - setSize(width: number, height: number): void; - bindFramebuffer(texture: WebGLTexture, faceIndex?: number): void; - unBindFramebuffer(texture: WebGLTexture, disableGenerateMipMaps?: boolean): void; - generateMipMapsForCubemap(texture: WebGLTexture): void; - flushFramebuffer(): void; - restoreDefaultFramebuffer(): void; - private _resetVertexBufferBinding(); - createVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer; - createDynamicVertexBuffer(capacity: number): WebGLBuffer; - updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: number[] | Float32Array, offset?: number): void; - private _resetIndexBufferBinding(); - createIndexBuffer(indices: number[] | Int32Array): WebGLBuffer; - bindBuffers(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void; - bindMultiBuffers(vertexBuffers: VertexBuffer[], indexBuffer: WebGLBuffer, effect: Effect): void; - _releaseBuffer(buffer: WebGLBuffer): boolean; - createInstancesBuffer(capacity: number): WebGLBuffer; - deleteInstancesBuffer(buffer: WebGLBuffer): void; - updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[]): void; - unBindInstancesBuffer(instancesBuffer: WebGLBuffer, offsetLocations: number[]): void; - applyStates(): void; - draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void; - drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void; - drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): void; - _releaseEffect(effect: Effect): void; - createEffect(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; - createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; - createShaderProgram(vertexCode: string, fragmentCode: string, defines: string): WebGLProgram; - getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[]; - getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[]; - enableEffect(effect: Effect): void; - setArray(uniform: WebGLUniformLocation, array: number[]): void; - setArray2(uniform: WebGLUniformLocation, array: number[]): void; - setArray3(uniform: WebGLUniformLocation, array: number[]): void; - setArray4(uniform: WebGLUniformLocation, array: number[]): void; - setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void; - setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void; - setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void; - setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void; - setFloat(uniform: WebGLUniformLocation, value: number): void; - setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void; - setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void; - setBool(uniform: WebGLUniformLocation, bool: number): void; - setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - setColor3(uniform: WebGLUniformLocation, color3: Color3): void; - setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void; - setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void; - setDepthBuffer(enable: boolean): void; - getDepthWrite(): boolean; - setDepthWrite(enable: boolean): void; - setColorWrite(enable: boolean): void; - setAlphaMode(mode: number): void; - getAlphaMode(): number; - setAlphaTesting(enable: boolean): void; - getAlphaTesting(): boolean; - wipeCaches(): void; - setSamplingMode(texture: WebGLTexture, samplingMode: number): void; - createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture; - updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void; - createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture; - createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number, forceExponantOfTwo?: boolean): WebGLTexture; - updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void; - updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean): void; - updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void; - createRenderTargetTexture(size: any, options: any): WebGLTexture; - createRenderTargetCubeTexture(size: number, options?: any): WebGLTexture; - createCubeTexture(rootUrl: string, scene: Scene, files: string[], noMipmap?: boolean): WebGLTexture; - _releaseTexture(texture: WebGLTexture): void; - bindSamplers(effect: Effect): void; - _bindTexture(channel: number, texture: WebGLTexture): void; - setTextureFromPostProcess(channel: number, postProcess: PostProcess): void; - unbindAllTextures(): void; - setTexture(channel: number, texture: BaseTexture): void; - _setAnisotropicLevel(key: number, texture: BaseTexture): void; - readPixels(x: number, y: number, width: number, height: number): Uint8Array; - releaseInternalTexture(texture: WebGLTexture): void; - dispose(): void; - displayLoadingUI(): void; - hideLoadingUI(): void; - loadingScreen: ILoadingScreen; - loadingUIText: string; - loadingUIBackgroundColor: string; - getFps(): number; - getDeltaTime(): number; - private _measureFps(); - static isSupported(): boolean; - } -} - -interface Window { - mozIndexedDB(func: any): any; - webkitIndexedDB(func: any): any; - IDBTransaction(func: any): any; - webkitIDBTransaction(func: any): any; - msIDBTransaction(func: any): any; - IDBKeyRange(func: any): any; - webkitIDBKeyRange(func: any): any; - msIDBKeyRange(func: any): any; - webkitURL: HTMLURL; - webkitRequestAnimationFrame(func: any): any; - mozRequestAnimationFrame(func: any): any; - oRequestAnimationFrame(func: any): any; - WebGLRenderingContext: WebGLRenderingContext; - MSGesture: MSGesture; - CANNON: any; - SIMD: any; - AudioContext: AudioContext; - webkitAudioContext: AudioContext; - PointerEvent: any; -} -interface HTMLURL { - createObjectURL(param1: any, param2?: any): any; -} -interface Document { - exitFullscreen(): void; - webkitCancelFullScreen(): void; - mozCancelFullScreen(): void; - msCancelFullScreen(): void; - mozFullScreen: boolean; - msIsFullScreen: boolean; - fullscreen: boolean; - mozPointerLockElement: HTMLElement; - msPointerLockElement: HTMLElement; - webkitPointerLockElement: HTMLElement; -} -interface HTMLCanvasElement { - requestPointerLock(): void; - msRequestPointerLock(): void; - mozRequestPointerLock(): void; - webkitRequestPointerLock(): void; -} -interface CanvasRenderingContext2D { - imageSmoothingEnabled: boolean; - // mozImageSmoothingEnabled: boolean; - // oImageSmoothingEnabled: boolean; - // webkitImageSmoothingEnabled: boolean; -} -interface WebGLTexture { - isReady: boolean; - isCube: boolean; - url: string; - noMipmap: boolean; - samplingMode: number; - references: number; - generateMipMaps: boolean; - _size: number; - _baseWidth: number; - _baseHeight: number; - _width: number; - _height: number; - _workingCanvas: HTMLCanvasElement; - _workingContext: CanvasRenderingContext2D; - _framebuffer: WebGLFramebuffer; - _depthBuffer: WebGLRenderbuffer; - _cachedCoordinatesMode: number; - _cachedWrapU: number; - _cachedWrapV: number; - _isDisabled: boolean; -} -interface WebGLBuffer { - references: number; - capacity: number; - is32Bits: boolean; -} -interface MouseEvent { - mozMovementX: number; - mozMovementY: number; - webkitMovementX: number; - webkitMovementY: number; - msMovementX: number; - msMovementY: number; -} -interface MSStyleCSSProperties { - webkitTransform: string; - webkitTransition: string; -} -interface Navigator { - getVRDevices: () => any; - mozGetVRDevices: (any: any) => any; - isCocoonJS: boolean; -} -interface Screen { - orientation: string; - mozOrientation: string; -} -interface HTMLMediaElement { - // crossOrigin: string; -} - -declare namespace BABYLON { - /** - * Node is the basic class for all scene objects (Mesh, Light Camera). - */ - class Node { - parent: Node; - name: string; - id: string; - uniqueId: number; - state: string; - animations: Animation[]; - private _ranges; - onReady: (node: Node) => void; - private _childrenFlag; - private _isEnabled; - private _isReady; - _currentRenderId: number; - private _parentRenderId; - _waitingParentId: string; - private _scene; - _cache: any; - /** - * @constructor - * @param {string} name - the name and id to be given to this node - * @param {BABYLON.Scene} the scene this node will be added to - */ - constructor(name: string, scene: Scene); - getScene(): Scene; - getEngine(): Engine; - getWorldMatrix(): Matrix; - _initCache(): void; - updateCache(force?: boolean): void; - _updateCache(ignoreParentClass?: boolean): void; - _isSynchronized(): boolean; - _markSyncedWithParent(): void; - isSynchronizedWithParent(): boolean; - isSynchronized(updateCache?: boolean): boolean; - hasNewParent(update?: boolean): boolean; - /** - * Is this node ready to be used/rendered - * @return {boolean} is it ready - */ - isReady(): boolean; - /** - * Is this node enabled. - * If the node has a parent and is enabled, the parent will be inspected as well. - * @return {boolean} whether this node (and its parent) is enabled. - * @see setEnabled - */ - isEnabled(): boolean; - /** - * Set the enabled state of this node. - * @param {boolean} value - the new enabled state - * @see isEnabled - */ - setEnabled(value: boolean): void; - /** - * Is this node a descendant of the given node. - * The function will iterate up the hierarchy until the ancestor was found or no more parents defined. - * @param {BABYLON.Node} ancestor - The parent node to inspect - * @see parent - */ - isDescendantOf(ancestor: Node): boolean; - _getDescendants(list: Node[], results: Node[]): void; - /** - * Will return all nodes that have this node as parent. - * @return {BABYLON.Node[]} all children nodes of all types. - */ - getDescendants(): Node[]; - _setReady(state: boolean): void; - getAnimationByName(name: string): Animation; - createAnimationRange(name: string, from: number, to: number): void; - deleteAnimationRange(name: string, deleteFrames?: boolean): void; - getAnimationRange(name: string): AnimationRange; - beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void; - serializeAnimationRanges(): any; - static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void; - } -} - -declare namespace BABYLON { - interface IDisposable { - dispose(): void; - } - /** - * Represents a scene to be rendered by the engine. - * @see http://doc.babylonjs.com/page.php?p=21911 - */ - class Scene { - private static _FOGMODE_NONE; - private static _FOGMODE_EXP; - private static _FOGMODE_EXP2; - private static _FOGMODE_LINEAR; - static MinDeltaTime: number; - static MaxDeltaTime: number; - static FOGMODE_NONE: number; - static FOGMODE_EXP: number; - static FOGMODE_EXP2: number; - static FOGMODE_LINEAR: number; - autoClear: boolean; - clearColor: any; - ambientColor: Color3; - /** - * A function to be executed before rendering this scene - * @type {Function} - */ - beforeRender: () => void; - /** - * A function to be executed after rendering this scene - * @type {Function} - */ - afterRender: () => void; - /** - * A function to be executed when this scene is disposed. - * @type {Function} - */ - onDispose: () => void; - beforeCameraRender: (camera: Camera) => void; - afterCameraRender: (camera: Camera) => void; - forceWireframe: boolean; - forcePointsCloud: boolean; - forceShowBoundingBoxes: boolean; - clipPlane: Plane; - animationsEnabled: boolean; - constantlyUpdateMeshUnderPointer: boolean; - private _onPointerMove; - private _onPointerDown; - private _onPointerUp; - onPointerMove: (evt: PointerEvent, pickInfo: PickingInfo) => void; - onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void; - onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void; - onPointerPick: (evt: PointerEvent, pickInfo: PickingInfo) => void; - cameraToUseForPointers: Camera; - private _pointerX; - private _pointerY; - private _meshUnderPointer; - private _startingPointerPosition; - private _startingPointerTime; - _mirroredCameraPosition: Vector3; - private _onKeyDown; - private _onKeyUp; - /** - * is fog enabled on this scene. - * @type {boolean} - */ - fogEnabled: boolean; - fogMode: number; - fogColor: Color3; - fogDensity: number; - fogStart: number; - fogEnd: number; - /** - * is shadow enabled on this scene. - * @type {boolean} - */ - shadowsEnabled: boolean; - /** - * is light enabled on this scene. - * @type {boolean} - */ - lightsEnabled: boolean; - /** - * All of the lights added to this scene. - * @see BABYLON.Light - * @type {BABYLON.Light[]} - */ - lights: Light[]; - onNewLightAdded: (newLight?: Light, positionInArray?: number, scene?: Scene) => void; - onLightRemoved: (removedLight?: Light) => void; - /** - * All of the cameras added to this scene. - * @see BABYLON.Camera - * @type {BABYLON.Camera[]} - */ - cameras: Camera[]; - onNewCameraAdded: (newCamera?: Camera, positionInArray?: number, scene?: Scene) => void; - onCameraRemoved: (removedCamera?: Camera) => void; - activeCameras: Camera[]; - activeCamera: Camera; - /** - * All of the (abstract) meshes added to this scene. - * @see BABYLON.AbstractMesh - * @type {BABYLON.AbstractMesh[]} - */ - meshes: AbstractMesh[]; - onNewMeshAdded: (newMesh?: AbstractMesh, positionInArray?: number, scene?: Scene) => void; - onMeshRemoved: (removedMesh?: AbstractMesh) => void; - private _geometries; - onGeometryAdded: (newGeometry?: Geometry) => void; - onGeometryRemoved: (removedGeometry?: Geometry) => void; - materials: Material[]; - multiMaterials: MultiMaterial[]; - defaultMaterial: StandardMaterial; - texturesEnabled: boolean; - textures: BaseTexture[]; - particlesEnabled: boolean; - particleSystems: ParticleSystem[]; - spritesEnabled: boolean; - spriteManagers: SpriteManager[]; - layers: Layer[]; - skeletonsEnabled: boolean; - skeletons: Skeleton[]; - lensFlaresEnabled: boolean; - lensFlareSystems: LensFlareSystem[]; - collisionsEnabled: boolean; - private _workerCollisions; - collisionCoordinator: ICollisionCoordinator; - gravity: Vector3; - postProcessesEnabled: boolean; - postProcessManager: PostProcessManager; - postProcessRenderPipelineManager: PostProcessRenderPipelineManager; - renderTargetsEnabled: boolean; - dumpNextRenderTargets: boolean; - customRenderTargets: RenderTargetTexture[]; - useDelayedTextureLoading: boolean; - importedMeshesFiles: String[]; - probesEnabled: boolean; - reflectionProbes: ReflectionProbe[]; - database: any; - /** - * This scene's action manager - * @type {BABYLON.ActionManager} - */ - actionManager: ActionManager; - _actionManagers: ActionManager[]; - private _meshesForIntersections; - proceduralTexturesEnabled: boolean; - _proceduralTextures: ProceduralTexture[]; - mainSoundTrack: SoundTrack; - soundTracks: SoundTrack[]; - private _audioEnabled; - private _headphone; - simplificationQueue: SimplificationQueue; - private _engine; - private _totalVertices; - _activeIndices: number; - _activeParticles: number; - private _lastFrameDuration; - private _evaluateActiveMeshesDuration; - private _renderTargetsDuration; - _particlesDuration: number; - private _renderDuration; - _spritesDuration: number; - private _animationRatio; - private _animationStartDate; - _cachedMaterial: Material; - private _renderId; - private _executeWhenReadyTimeoutId; - _toBeDisposed: SmartArray; - private _onReadyCallbacks; - private _pendingData; - private _onBeforeRenderCallbacks; - private _onAfterRenderCallbacks; - private _activeMeshes; - private _processedMaterials; - private _renderTargets; - _activeParticleSystems: SmartArray; - private _activeSkeletons; - private _softwareSkinnedMeshes; - _activeBones: number; - private _renderingManager; - private _physicsEngine; - _activeAnimatables: Animatable[]; - private _transformMatrix; - private _pickWithRayInverseMatrix; - private _edgesRenderers; - private _boundingBoxRenderer; - private _outlineRenderer; - private _viewMatrix; - private _projectionMatrix; - private _frustumPlanes; - private _selectionOctree; - private _pointerOverMesh; - private _debugLayer; - private _depthRenderer; - private _uniqueIdCounter; - private _pickedMeshName; - /** - * @constructor - * @param {BABYLON.Engine} engine - the engine to be used to render this scene. - */ - constructor(engine: Engine); - debugLayer: DebugLayer; - workerCollisions: boolean; - SelectionOctree: Octree; - /** - * The mesh that is currently under the pointer. - * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none. - */ - meshUnderPointer: AbstractMesh; - /** - * Current on-screen X position of the pointer - * @return {number} X position of the pointer - */ - pointerX: number; - /** - * Current on-screen Y position of the pointer - * @return {number} Y position of the pointer - */ - pointerY: number; - getCachedMaterial(): Material; - getBoundingBoxRenderer(): BoundingBoxRenderer; - getOutlineRenderer(): OutlineRenderer; - getEngine(): Engine; - getTotalVertices(): number; - getActiveIndices(): number; - getActiveParticles(): number; - getActiveBones(): number; - getLastFrameDuration(): number; - getEvaluateActiveMeshesDuration(): number; - getActiveMeshes(): SmartArray; - getRenderTargetsDuration(): number; - getRenderDuration(): number; - getParticlesDuration(): number; - getSpritesDuration(): number; - getAnimationRatio(): number; - getRenderId(): number; - incrementRenderId(): void; - private _updatePointerPosition(evt); - attachControl(): void; - detachControl(): void; - isReady(): boolean; - resetCachedMaterial(): void; - registerBeforeRender(func: () => void): void; - unregisterBeforeRender(func: () => void): void; - registerAfterRender(func: () => void): void; - unregisterAfterRender(func: () => void): void; - _addPendingData(data: any): void; - _removePendingData(data: any): void; - getWaitingItemsCount(): number; - /** - * Registers a function to be executed when the scene is ready. - * @param {Function} func - the function to be executed. - */ - executeWhenReady(func: () => void): void; - _checkIsReady(): void; - /** - * Will start the animation sequence of a given target - * @param target - the target - * @param {number} from - from which frame should animation start - * @param {number} to - till which frame should animation run. - * @param {boolean} [loop] - should the animation loop - * @param {number} [speedRatio] - the speed in which to run the animation - * @param {Function} [onAnimationEnd] function to be executed when the animation ended. - * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params. - * @return {BABYLON.Animatable} the animatable object created for this animation - * @see BABYLON.Animatable - * @see http://doc.babylonjs.com/page.php?p=22081 - */ - beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable; - beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable; - getAnimatableByTarget(target: any): Animatable; - Animatables: Animatable[]; - /** - * Will stop the animation of the given target - * @param target - the target - * @see beginAnimation - */ - stopAnimation(target: any): void; - private _animate(); - getViewMatrix(): Matrix; - getProjectionMatrix(): Matrix; - getTransformMatrix(): Matrix; - setTransformMatrix(view: Matrix, projection: Matrix): void; - addMesh(newMesh: AbstractMesh): void; - removeMesh(toRemove: AbstractMesh): number; - removeSkeleton(toRemove: Skeleton): number; - removeLight(toRemove: Light): number; - removeCamera(toRemove: Camera): number; - addLight(newLight: Light): void; - addCamera(newCamera: Camera): void; - /** - * Switch active camera - * @param {Camera} newCamera - new active camera - * @param {boolean} attachControl - call attachControl for the new active camera (default: true) - */ - swithActiveCamera(newCamera: Camera, attachControl?: boolean): void; - /** - * sets the active camera of the scene using its ID - * @param {string} id - the camera's ID - * @return {BABYLON.Camera|null} the new active camera or null if none found. - * @see activeCamera - */ - setActiveCameraByID(id: string): Camera; - /** - * sets the active camera of the scene using its name - * @param {string} name - the camera's name - * @return {BABYLON.Camera|null} the new active camera or null if none found. - * @see activeCamera - */ - setActiveCameraByName(name: string): Camera; - /** - * get a material using its id - * @param {string} the material's ID - * @return {BABYLON.Material|null} the material or null if none found. - */ - getMaterialByID(id: string): Material; - /** - * get a material using its name - * @param {string} the material's name - * @return {BABYLON.Material|null} the material or null if none found. - */ - getMaterialByName(name: string): Material; - getLensFlareSystemByName(name: string): LensFlareSystem; - getCameraByID(id: string): Camera; - getCameraByUniqueID(uniqueId: number): Camera; - /** - * get a camera using its name - * @param {string} the camera's name - * @return {BABYLON.Camera|null} the camera or null if none found. - */ - getCameraByName(name: string): Camera; - /** - * get a bone using its id - * @param {string} the bone's id - * @return {BABYLON.Bone|null} the bone or null if not found - */ - getBoneByID(id: string): Bone; - /** - * get a bone using its id - * @param {string} the bone's name - * @return {BABYLON.Bone|null} the bone or null if not found - */ - getBoneByName(name: string): Bone; - /** - * get a light node using its name - * @param {string} the light's name - * @return {BABYLON.Light|null} the light or null if none found. - */ - getLightByName(name: string): Light; - /** - * get a light node using its ID - * @param {string} the light's id - * @return {BABYLON.Light|null} the light or null if none found. - */ - getLightByID(id: string): Light; - /** - * get a light node using its scene-generated unique ID - * @param {number} the light's unique id - * @return {BABYLON.Light|null} the light or null if none found. - */ - getLightByUniqueID(uniqueId: number): Light; - /** - * get a particle system by id - * @param id {number} the particle system id - * @return {BABYLON.ParticleSystem|null} the corresponding system or null if none found. - */ - getParticleSystemByID(id: string): ParticleSystem; - /** - * get a geometry using its ID - * @param {string} the geometry's id - * @return {BABYLON.Geometry|null} the geometry or null if none found. - */ - getGeometryByID(id: string): Geometry; - /** - * add a new geometry to this scene. - * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene. - * @param {boolean} [force] - force addition, even if a geometry with this ID already exists - * @return {boolean} was the geometry added or not - */ - pushGeometry(geometry: Geometry, force?: boolean): boolean; - /** - * Removes an existing geometry - * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene. - * @return {boolean} was the geometry removed or not - */ - removeGeometry(geometry: Geometry): boolean; - getGeometries(): Geometry[]; - /** - * Get the first added mesh found of a given ID - * @param {string} id - the id to search for - * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. - */ - getMeshByID(id: string): AbstractMesh; - /** - * Get a mesh with its auto-generated unique id - * @param {number} uniqueId - the unique id to search for - * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. - */ - getMeshByUniqueID(uniqueId: number): AbstractMesh; - /** - * Get a the last added mesh found of a given ID - * @param {string} id - the id to search for - * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. - */ - getLastMeshByID(id: string): AbstractMesh; - /** - * Get a the last added node (Mesh, Camera, Light) found of a given ID - * @param {string} id - the id to search for - * @return {BABYLON.Node|null} the node found or null if not found at all. - */ - getLastEntryByID(id: string): Node; - getNodeByID(id: string): Node; - getNodeByName(name: string): Node; - getMeshByName(name: string): AbstractMesh; - getSoundByName(name: string): Sound; - getLastSkeletonByID(id: string): Skeleton; - getSkeletonById(id: string): Skeleton; - getSkeletonByName(name: string): Skeleton; - isActiveMesh(mesh: Mesh): boolean; - private _evaluateSubMesh(subMesh, mesh); - private _evaluateActiveMeshes(); - private _activeMesh(mesh); - updateTransformMatrix(force?: boolean): void; - private _renderForCamera(camera); - private _processSubCameras(camera); - private _checkIntersections(); - render(): void; - private _updateAudioParameters(); - audioEnabled: boolean; - private _disableAudio(); - private _enableAudio(); - headphone: boolean; - private _switchAudioModeForHeadphones(); - private _switchAudioModeForNormalSpeakers(); - enableDepthRenderer(): DepthRenderer; - disableDepthRenderer(): void; - freezeMaterials(): void; - unfreezeMaterials(): void; - dispose(): void; - disposeSounds(): void; - getWorldExtends(): { - min: Vector3; - max: Vector3; - }; - createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree; - createPickingRay(x: number, y: number, world: Matrix, camera: Camera, cameraViewSpace?: boolean): Ray; - createPickingRayInCameraSpace(x: number, y: number, camera: Camera): Ray; - private _internalPick(rayFunction, predicate, fastCheck?); - private _internalPickSprites(ray, predicate?, fastCheck?, camera?); - pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo; - pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo; - pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo; - setPointerOverMesh(mesh: AbstractMesh): void; - getPointerOverMesh(): AbstractMesh; - getPhysicsEngine(): PhysicsEngine; - /** - * Enables physics to the current scene - * @param {BABYLON.Vector3} [gravity] - the scene's gravity for the physics engine - * @param {BABYLON.IPhysicsEnginePlugin} [plugin] - The physics engine to be used. defaults to OimoJS. - * @return {boolean} was the physics engine initialized - */ - enablePhysics(gravity?: Vector3, plugin?: IPhysicsEnginePlugin): boolean; - disablePhysicsEngine(): void; - isPhysicsEnabled(): boolean; - /** - * Sets the gravity of the physics engine (and NOT of the scene) - * @param {BABYLON.Vector3} [gravity] - the new gravity to be used - */ - setGravity(gravity: Vector3): void; - createCompoundImpostor(parts: any, options: PhysicsBodyCreationOptions): any; - deleteCompoundImpostor(compound: any): void; - createDefaultCameraOrLight(): void; - private _getByTags(list, tagsQuery, forEach?); - getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[]; - getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[]; - getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[]; - getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[]; - } -} - -declare namespace BABYLON { - class Action { - triggerOptions: any; - trigger: number; - _actionManager: ActionManager; - private _nextActiveAction; - private _child; - private _condition; - private _triggerParameter; - constructor(triggerOptions: any, condition?: Condition); - _prepare(): void; - getTriggerParameter(): any; - _executeCurrent(evt: ActionEvent): void; - execute(evt: ActionEvent): void; - skipToNextActiveAction(): void; - then(action: Action): Action; - _getProperty(propertyPath: string): string; - _getEffectiveTarget(target: any, propertyPath: string): any; - } -} - -declare namespace BABYLON { - /** - * ActionEvent is the event beint sent when an action is triggered. - */ - class ActionEvent { - source: any; - pointerX: number; - pointerY: number; - meshUnderPointer: AbstractMesh; - sourceEvent: any; - additionalData: any; - /** - * @constructor - * @param source The mesh or sprite that triggered the action. - * @param pointerX The X mouse cursor position at the time of the event - * @param pointerY The Y mouse cursor position at the time of the event - * @param meshUnderPointer The mesh that is currently pointed at (can be null) - * @param sourceEvent the original (browser) event that triggered the ActionEvent - */ - constructor(source: any, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any); - /** - * Helper function to auto-create an ActionEvent from a source mesh. - * @param source The source mesh that triggered the event - * @param evt {Event} The original (browser) event - */ - static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent; - /** - * Helper function to auto-create an ActionEvent from a source mesh. - * @param source The source sprite that triggered the event - * @param scene Scene associated with the sprite - * @param evt {Event} The original (browser) event - */ - static CreateNewFromSprite(source: Sprite, scene: Scene, evt?: Event, additionalData?: any): ActionEvent; - /** - * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew - * @param scene the scene where the event occurred - * @param evt {Event} The original (browser) event - */ - static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent; - } - /** - * Action Manager manages all events to be triggered on a given mesh or the global scene. - * A single scene can have many Action Managers to handle predefined actions on specific meshes. - */ - class ActionManager { - private static _NothingTrigger; - private static _OnPickTrigger; - private static _OnLeftPickTrigger; - private static _OnRightPickTrigger; - private static _OnCenterPickTrigger; - private static _OnPickDownTrigger; - private static _OnPickUpTrigger; - private static _OnLongPressTrigger; - private static _OnPointerOverTrigger; - private static _OnPointerOutTrigger; - private static _OnEveryFrameTrigger; - private static _OnIntersectionEnterTrigger; - private static _OnIntersectionExitTrigger; - private static _OnKeyDownTrigger; - private static _OnKeyUpTrigger; - static NothingTrigger: number; - static OnPickTrigger: number; - static OnLeftPickTrigger: number; - static OnRightPickTrigger: number; - static OnCenterPickTrigger: number; - static OnPickDownTrigger: number; - static OnPickUpTrigger: number; - static OnLongPressTrigger: number; - static OnPointerOverTrigger: number; - static OnPointerOutTrigger: number; - static OnEveryFrameTrigger: number; - static OnIntersectionEnterTrigger: number; - static OnIntersectionExitTrigger: number; - static OnKeyDownTrigger: number; - static OnKeyUpTrigger: number; - static DragMovementThreshold: number; - static LongPressDelay: number; - actions: Action[]; - private _scene; - constructor(scene: Scene); - dispose(): void; - getScene(): Scene; - /** - * Does this action manager handles actions of any of the given triggers - * @param {number[]} triggers - the triggers to be tested - * @return {boolean} whether one (or more) of the triggers is handeled - */ - hasSpecificTriggers(triggers: number[]): boolean; - /** - * Does this action manager handles actions of a given trigger - * @param {number} trigger - the trigger to be tested - * @return {boolean} whether the trigger is handeled - */ - hasSpecificTrigger(trigger: number): boolean; - /** - * Does this action manager has pointer triggers - * @return {boolean} whether or not it has pointer triggers - */ - hasPointerTriggers: boolean; - /** - * Does this action manager has pick triggers - * @return {boolean} whether or not it has pick triggers - */ - hasPickTriggers: boolean; - /** - * Registers an action to this action manager - * @param {BABYLON.Action} action - the action to be registered - * @return {BABYLON.Action} the action amended (prepared) after registration - */ - registerAction(action: Action): Action; - /** - * Process a specific trigger - * @param {number} trigger - the trigger to process - * @param evt {BABYLON.ActionEvent} the event details to be processed - */ - processTrigger(trigger: number, evt: ActionEvent): void; - _getEffectiveTarget(target: any, propertyPath: string): any; - _getProperty(propertyPath: string): string; - static Parse(parsedActions: any, object: AbstractMesh, scene: Scene): void; - } -} - -declare namespace BABYLON { - class Condition { - _actionManager: ActionManager; - _evaluationId: number; - _currentResult: boolean; - constructor(actionManager: ActionManager); - isValid(): boolean; - _getProperty(propertyPath: string): string; - _getEffectiveTarget(target: any, propertyPath: string): any; - } - class ValueCondition extends Condition { - propertyPath: string; - value: any; - operator: number; - private static _IsEqual; - private static _IsDifferent; - private static _IsGreater; - private static _IsLesser; - static IsEqual: number; - static IsDifferent: number; - static IsGreater: number; - static IsLesser: number; - _actionManager: ActionManager; - private _target; - private _property; - constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number); - isValid(): boolean; - } - class PredicateCondition extends Condition { - predicate: () => boolean; - _actionManager: ActionManager; - constructor(actionManager: ActionManager, predicate: () => boolean); - isValid(): boolean; - } - class StateCondition extends Condition { - value: string; - _actionManager: ActionManager; - private _target; - constructor(actionManager: ActionManager, target: any, value: string); - isValid(): boolean; - } -} - -declare namespace BABYLON { - class SwitchBooleanAction extends Action { - propertyPath: string; - private _target; - private _property; - constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition); - _prepare(): void; - execute(): void; - } - class SetStateAction extends Action { - value: string; - private _target; - constructor(triggerOptions: any, target: any, value: string, condition?: Condition); - execute(): void; - } - class SetValueAction extends Action { - propertyPath: string; - value: any; - private _target; - private _property; - constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); - _prepare(): void; - execute(): void; - } - class IncrementValueAction extends Action { - propertyPath: string; - value: any; - private _target; - private _property; - constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); - _prepare(): void; - execute(): void; - } - class PlayAnimationAction extends Action { - from: number; - to: number; - loop: boolean; - private _target; - constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition); - _prepare(): void; - execute(): void; - } - class StopAnimationAction extends Action { - private _target; - constructor(triggerOptions: any, target: any, condition?: Condition); - _prepare(): void; - execute(): void; - } - class DoNothingAction extends Action { - constructor(triggerOptions?: any, condition?: Condition); - execute(): void; - } - class CombineAction extends Action { - children: Action[]; - constructor(triggerOptions: any, children: Action[], condition?: Condition); - _prepare(): void; - execute(evt: ActionEvent): void; - } - class ExecuteCodeAction extends Action { - func: (evt: ActionEvent) => void; - constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition); - execute(evt: ActionEvent): void; - } - class SetParentAction extends Action { - private _parent; - private _target; - constructor(triggerOptions: any, target: any, parent: any, condition?: Condition); - _prepare(): void; - execute(): void; - } - class PlaySoundAction extends Action { - private _sound; - constructor(triggerOptions: any, sound: Sound, condition?: Condition); - _prepare(): void; - execute(): void; - } - class StopSoundAction extends Action { - private _sound; - constructor(triggerOptions: any, sound: Sound, condition?: Condition); - _prepare(): void; - execute(): void; - } -} - -declare namespace BABYLON { - class InterpolateValueAction extends Action { - propertyPath: string; - value: any; - duration: number; - stopOtherAnimations: boolean; - onInterpolationDone: () => void; - private _target; - private _property; - constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean, onInterpolationDone?: () => void); - _prepare(): void; - execute(): void; - } -} - -declare namespace BABYLON { - class Animatable { - target: any; - fromFrame: number; - toFrame: number; - loopAnimation: boolean; - speedRatio: number; - onAnimationEnd: any; - private _localDelayOffset; - private _pausedDelay; - private _animations; - private _paused; - private _scene; - animationStarted: boolean; - constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any); - getAnimations(): Animation[]; - appendAnimations(target: any, animations: Animation[]): void; - getAnimationByTargetProperty(property: string): Animation; - reset(): void; - goToFrame(frame: number): void; - pause(): void; - restart(): void; - stop(): void; - _animate(delay: number): boolean; - } -} - -declare namespace BABYLON { - class AnimationRange { - name: string; - from: number; - to: number; - constructor(name: string, from: number, to: number); - } - /** - * Composed of a frame, and an action function - */ - class AnimationEvent { - frame: number; - action: () => void; - onlyOnce: boolean; - isDone: boolean; - constructor(frame: number, action: () => void, onlyOnce?: boolean); - } - class Animation { - name: string; - targetProperty: string; - framePerSecond: number; - dataType: number; - loopMode: number; - private _keys; - private _offsetsCache; - private _highLimitsCache; - private _stopped; - _target: any; - private _easingFunction; - private _events; - targetPropertyPath: string[]; - currentFrame: number; - allowMatricesInterpolation: boolean; - private _ranges; - static _PrepareAnimation(name: string, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction): Animation; - static CreateAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable; - static CreateMergeAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable; - constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number); - /** - * Add an event to this animation. - */ - addEvent(event: AnimationEvent): void; - /** - * Remove all events found at the given frame - * @param frame - */ - removeEvents(frame: number): void; - createRange(name: string, from: number, to: number): void; - deleteRange(name: string, deleteFrames?: boolean): void; - getRange(name: string): AnimationRange; - reset(): void; - isStopped(): boolean; - getKeys(): any[]; - getHighestFrame(): number; - getEasingFunction(): IEasingFunction; - setEasingFunction(easingFunction: EasingFunction): void; - floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number; - quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion; - vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3; - vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2; - color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3; - matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix; - clone(): Animation; - setKeys(values: Array): void; - private _getKeyValue(value); - private _interpolate(currentFrame, repeatCount, loopMode, offsetValue?, highLimitValue?); - setValue(currentValue: any): void; - goToFrame(frame: number): void; - animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number): boolean; - serialize(): any; - private static _ANIMATIONTYPE_FLOAT; - private static _ANIMATIONTYPE_VECTOR3; - private static _ANIMATIONTYPE_QUATERNION; - private static _ANIMATIONTYPE_MATRIX; - private static _ANIMATIONTYPE_COLOR3; - private static _ANIMATIONTYPE_VECTOR2; - private static _ANIMATIONLOOPMODE_RELATIVE; - private static _ANIMATIONLOOPMODE_CYCLE; - private static _ANIMATIONLOOPMODE_CONSTANT; - static ANIMATIONTYPE_FLOAT: number; - static ANIMATIONTYPE_VECTOR3: number; - static ANIMATIONTYPE_VECTOR2: number; - static ANIMATIONTYPE_QUATERNION: number; - static ANIMATIONTYPE_MATRIX: number; - static ANIMATIONTYPE_COLOR3: number; - static ANIMATIONLOOPMODE_RELATIVE: number; - static ANIMATIONLOOPMODE_CYCLE: number; - static ANIMATIONLOOPMODE_CONSTANT: number; - static Parse(parsedAnimation: any): Animation; - static AppendSerializedAnimations(source: IAnimatable, destination: any): any; - } -} - -declare namespace BABYLON { - interface IEasingFunction { - ease(gradient: number): number; - } - class EasingFunction implements IEasingFunction { - private static _EASINGMODE_EASEIN; - private static _EASINGMODE_EASEOUT; - private static _EASINGMODE_EASEINOUT; - static EASINGMODE_EASEIN: number; - static EASINGMODE_EASEOUT: number; - static EASINGMODE_EASEINOUT: number; - private _easingMode; - setEasingMode(easingMode: number): void; - getEasingMode(): number; - easeInCore(gradient: number): number; - ease(gradient: number): number; - } - class CircleEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class BackEase extends EasingFunction implements IEasingFunction { - amplitude: number; - constructor(amplitude?: number); - easeInCore(gradient: number): number; - } - class BounceEase extends EasingFunction implements IEasingFunction { - bounces: number; - bounciness: number; - constructor(bounces?: number, bounciness?: number); - easeInCore(gradient: number): number; - } - class CubicEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class ElasticEase extends EasingFunction implements IEasingFunction { - oscillations: number; - springiness: number; - constructor(oscillations?: number, springiness?: number); - easeInCore(gradient: number): number; - } - class ExponentialEase extends EasingFunction implements IEasingFunction { - exponent: number; - constructor(exponent?: number); - easeInCore(gradient: number): number; - } - class PowerEase extends EasingFunction implements IEasingFunction { - power: number; - constructor(power?: number); - easeInCore(gradient: number): number; - } - class QuadraticEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class QuarticEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class QuinticEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class SineEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class BezierCurveEase extends EasingFunction implements IEasingFunction { - x1: number; - y1: number; - x2: number; - y2: number; - constructor(x1?: number, y1?: number, x2?: number, y2?: number); - easeInCore(gradient: number): number; - } -} - -declare namespace BABYLON { - class Analyser { - SMOOTHING: number; - FFT_SIZE: number; - BARGRAPHAMPLITUDE: number; - DEBUGCANVASPOS: { - x: number; - y: number; - }; - DEBUGCANVASSIZE: { - width: number; - height: number; - }; - private _byteFreqs; - private _byteTime; - private _floatFreqs; - private _webAudioAnalyser; - private _debugCanvas; - private _debugCanvasContext; - private _scene; - private _registerFunc; - private _audioEngine; - constructor(scene: Scene); - getFrequencyBinCount(): number; - getByteFrequencyData(): Uint8Array; - getByteTimeDomainData(): Uint8Array; - getFloatFrequencyData(): Uint8Array; - drawDebugCanvas(): void; - stopDebugCanvas(): void; - connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void; - dispose(): void; - } -} - -declare namespace BABYLON { - class AudioEngine { - private _audioContext; - private _audioContextInitialized; - canUseWebAudio: boolean; - masterGain: GainNode; - private _connectedAnalyser; - WarnedWebAudioUnsupported: boolean; - unlocked: boolean; - onAudioUnlocked: () => any; - audioContext: AudioContext; - constructor(); - private _unlockiOSaudio(); - private _initializeAudioContext(); - dispose(): void; - getGlobalVolume(): number; - setGlobalVolume(newVolume: number): void; - connectToAnalyser(analyser: Analyser): void; - } -} - -declare namespace BABYLON { - class Sound { - name: string; - autoplay: boolean; - loop: boolean; - useCustomAttenuation: boolean; - soundTrackId: number; - spatialSound: boolean; - refDistance: number; - rolloffFactor: number; - maxDistance: number; - distanceModel: string; - private _panningModel; - onended: () => any; - private _playbackRate; - private _streaming; - private _startTime; - private _startOffset; - private _position; - private _localDirection; - private _volume; - private _isLoaded; - private _isReadyToPlay; - isPlaying: boolean; - isPaused: boolean; - private _isDirectional; - private _readyToPlayCallback; - private _audioBuffer; - private _soundSource; - private _streamingSource; - private _soundPanner; - private _soundGain; - private _inputAudioNode; - private _ouputAudioNode; - private _coneInnerAngle; - private _coneOuterAngle; - private _coneOuterGain; - private _scene; - private _connectedMesh; - private _customAttenuationFunction; - private _registerFunc; - private _isOutputConnected; - private _htmlAudioElement; - /** - * Create a sound and attach it to a scene - * @param name Name of your sound - * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer - * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played - * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming - */ - constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any); - dispose(): void; - private _soundLoaded(audioData); - setAudioBuffer(audioBuffer: AudioBuffer): void; - updateOptions(options: any): void; - private _createSpatialParameters(); - private _updateSpatialParameters(); - switchPanningModelToHRTF(): void; - switchPanningModelToEqualPower(): void; - private _switchPanningModel(); - connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void; - /** - * Transform this sound into a directional source - * @param coneInnerAngle Size of the inner cone in degree - * @param coneOuterAngle Size of the outer cone in degree - * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0) - */ - setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void; - setPosition(newPosition: Vector3): void; - setLocalDirectionToMesh(newLocalDirection: Vector3): void; - private _updateDirection(); - updateDistanceFromListener(): void; - setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void; - /** - * Play the sound - * @param time (optional) Start the sound after X seconds. Start immediately (0) by default. - */ - play(time?: number): void; - private _onended(); - /** - * Stop the sound - * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default. - */ - stop(time?: number): void; - pause(): void; - setVolume(newVolume: number, time?: number): void; - setPlaybackRate(newPlaybackRate: number): void; - getVolume(): number; - attachToMesh(meshToConnectTo: AbstractMesh): void; - private _onRegisterAfterWorldMatrixUpdate(connectedMesh); - clone(): Sound; - getAudioBuffer(): AudioBuffer; - static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound; - } -} - -declare namespace BABYLON { - class SoundTrack { - private _outputAudioNode; - private _inputAudioNode; - private _trackConvolver; - private _scene; - id: number; - soundCollection: Array; - private _isMainTrack; - private _connectedAnalyser; - private _options; - private _isInitialized; - constructor(scene: Scene, options?: any); - private _initializeSoundTrackAudioGraph(); - dispose(): void; - AddSound(sound: Sound): void; - RemoveSound(sound: Sound): void; - setVolume(newVolume: number): void; - switchPanningModelToHRTF(): void; - switchPanningModelToEqualPower(): void; - connectToAnalyser(analyser: Analyser): void; - } -} - -declare namespace BABYLON { - class Bone extends Node { - name: string; - children: Bone[]; - animations: Animation[]; - length: number; - private _skeleton; - _matrix: Matrix; - private _restPose; - private _baseMatrix; - private _worldTransform; - private _absoluteTransform; - private _invertedAbsoluteTransform; - private _parent; - constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix, restPose?: Matrix); - getParent(): Bone; - getLocalMatrix(): Matrix; - getBaseMatrix(): Matrix; - getRestPose(): Matrix; - returnToRest(): void; - getWorldMatrix(): Matrix; - getInvertedAbsoluteTransform(): Matrix; - getAbsoluteTransform(): Matrix; - updateMatrix(matrix: Matrix): void; - _updateDifferenceMatrix(rootMatrix?: Matrix): void; - markAsDirty(): void; - copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired?: boolean): boolean; - } -} - -declare namespace BABYLON { - class Skeleton { - name: string; - id: string; - bones: Bone[]; - needInitialSkinMatrix: boolean; - private _scene; - private _isDirty; - private _transformMatrices; - private _meshesWithPoseMatrix; - private _animatables; - private _identity; - private _ranges; - constructor(name: string, id: string, scene: Scene); - getTransformMatrices(mesh: AbstractMesh): Float32Array; - getScene(): Scene; - createAnimationRange(name: string, from: number, to: number): void; - deleteAnimationRange(name: string, deleteFrames?: boolean): void; - getAnimationRange(name: string): AnimationRange; - /** - * note: This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences - */ - copyAnimationRange(source: Skeleton, name: string, rescaleAsRequired?: boolean): boolean; - returnToRest(): void; - private _getHighestAnimationFrame(); - beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void; - _markAsDirty(): void; - _registerMeshWithPoseMatrix(mesh: AbstractMesh): void; - _unregisterMeshWithPoseMatrix(mesh: AbstractMesh): void; - _computeTransformMatrices(targetMatrix: Float32Array, initialSkinMatrix: Matrix): void; - prepare(): void; - getAnimatables(): IAnimatable[]; - clone(name: string, id: string): Skeleton; - dispose(): void; - serialize(): any; - static Parse(parsedSkeleton: any, scene: Scene): Skeleton; - } -} - -declare namespace BABYLON { - class ArcRotateCamera extends TargetCamera { - alpha: number; - beta: number; - radius: number; - target: any; - inertialAlphaOffset: number; - inertialBetaOffset: number; - inertialRadiusOffset: number; - lowerAlphaLimit: any; - upperAlphaLimit: any; - lowerBetaLimit: number; - upperBetaLimit: number; - lowerRadiusLimit: any; - upperRadiusLimit: any; - angularSensibilityX: number; - angularSensibilityY: number; - wheelPrecision: number; - pinchPrecision: number; - panningSensibility: number; - inertialPanningX: number; - inertialPanningY: number; - keysUp: number[]; - keysDown: number[]; - keysLeft: number[]; - keysRight: number[]; - zoomOnFactor: number; - targetScreenOffset: Vector2; - pinchInwards: boolean; - allowUpsideDown: boolean; - private _keys; - _viewMatrix: Matrix; - private _attachedElement; - private _onContextMenu; - private _onPointerDown; - private _onPointerUp; - private _onPointerMove; - private _wheel; - private _onMouseMove; - private _onKeyDown; - private _onKeyUp; - private _onLostFocus; - _reset: () => void; - private _onGestureStart; - private _onGesture; - private _MSGestureHandler; - panningAxis: Vector3; - private _localDirection; - private _transformedDirection; - private _isRightClick; - private _isCtrlPushed; - onCollide: (collidedMesh: AbstractMesh) => void; - checkCollisions: boolean; - collisionRadius: Vector3; - private _collider; - private _previousPosition; - private _collisionVelocity; - private _newPosition; - private _previousAlpha; - private _previousBeta; - private _previousRadius; - private _collisionTriggered; - angularSensibility: number; - constructor(name: string, alpha: number, beta: number, radius: number, target: any, scene: Scene); - _getTargetPosition(): Vector3; - _initCache(): void; - _updateCache(ignoreParentClass?: boolean): void; - _isSynchronizedViewMatrix(): boolean; - attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean): void; - detachControl(element: HTMLElement): void; - _checkInputs(): void; - private _checkLimits(); - setPosition(position: Vector3): void; - setTarget(target: Vector3): void; - _getViewMatrix(): Matrix; - private _onCollisionPositionChange; - zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void; - focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void; - /** - * @override - * Override Camera.createRigCamera - */ - createRigCamera(name: string, cameraIndex: number): Camera; - /** - * @override - * Override Camera._updateRigCameras - */ - _updateRigCameras(): void; - serialize(): any; - } -} - -declare namespace BABYLON { - class VRCameraMetrics { - hResolution: number; - vResolution: number; - hScreenSize: number; - vScreenSize: number; - vScreenCenter: number; - eyeToScreenDistance: number; - lensSeparationDistance: number; - interpupillaryDistance: number; - distortionK: number[]; - chromaAbCorrection: number[]; - postProcessScaleFactor: number; - lensCenterOffset: number; - compensateDistortion: boolean; - aspectRatio: number; - aspectRatioFov: number; - leftHMatrix: Matrix; - rightHMatrix: Matrix; - leftPreViewMatrix: Matrix; - rightPreViewMatrix: Matrix; - static GetDefault(): VRCameraMetrics; - } - class Camera extends Node { - position: Vector3; - private static _PERSPECTIVE_CAMERA; - private static _ORTHOGRAPHIC_CAMERA; - private static _FOVMODE_VERTICAL_FIXED; - private static _FOVMODE_HORIZONTAL_FIXED; - private static _RIG_MODE_NONE; - private static _RIG_MODE_STEREOSCOPIC_ANAGLYPH; - private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL; - private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED; - private static _RIG_MODE_STEREOSCOPIC_OVERUNDER; - private static _RIG_MODE_VR; - static PERSPECTIVE_CAMERA: number; - static ORTHOGRAPHIC_CAMERA: number; - static FOVMODE_VERTICAL_FIXED: number; - static FOVMODE_HORIZONTAL_FIXED: number; - static RIG_MODE_NONE: number; - static RIG_MODE_STEREOSCOPIC_ANAGLYPH: number; - static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number; - static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number; - static RIG_MODE_STEREOSCOPIC_OVERUNDER: number; - static RIG_MODE_VR: number; - upVector: Vector3; - orthoLeft: any; - orthoRight: any; - orthoBottom: any; - orthoTop: any; - fov: number; - minZ: number; - maxZ: number; - inertia: number; - mode: number; - isIntermediate: boolean; - viewport: Viewport; - layerMask: number; - fovMode: number; - cameraRigMode: number; - _cameraRigParams: any; - _rigCameras: Camera[]; - private _computedViewMatrix; - _projectionMatrix: Matrix; - private _worldMatrix; - _postProcesses: PostProcess[]; - _postProcessesTakenIndices: any[]; - _activeMeshes: SmartArray; - private _globalPosition; - constructor(name: string, position: Vector3, scene: Scene); - globalPosition: Vector3; - getActiveMeshes(): SmartArray; - isActiveMesh(mesh: Mesh): boolean; - _initCache(): void; - _updateCache(ignoreParentClass?: boolean): void; - _updateFromScene(): void; - _isSynchronized(): boolean; - _isSynchronizedViewMatrix(): boolean; - _isSynchronizedProjectionMatrix(): boolean; - attachControl(element: HTMLElement): void; - detachControl(element: HTMLElement): void; - _update(): void; - _checkInputs(): void; - attachPostProcess(postProcess: PostProcess, insertAt?: number): number; - detachPostProcess(postProcess: PostProcess, atIndices?: any): number[]; - getWorldMatrix(): Matrix; - _getViewMatrix(): Matrix; - getViewMatrix(force?: boolean): Matrix; - _computeViewMatrix(force?: boolean): Matrix; - getProjectionMatrix(force?: boolean): Matrix; - dispose(): void; - setCameraRigMode(mode: number, rigParams: any): void; - private _getVRProjectionMatrix(); - setCameraRigParameter(name: string, value: any): void; - /** - * May needs to be overridden by children so sub has required properties to be copied - */ - createRigCamera(name: string, cameraIndex: number): Camera; - /** - * May needs to be overridden by children - */ - _updateRigCameras(): void; - serialize(): any; - static Parse(parsedCamera: any, scene: Scene): Camera; - } -} - -declare namespace BABYLON { - class DeviceOrientationCamera extends FreeCamera { - private _offsetX; - private _offsetY; - private _orientationGamma; - private _orientationBeta; - private _initialOrientationGamma; - private _initialOrientationBeta; - private _attachedCanvas; - private _orientationChanged; - angularSensibility: number; - moveSensibility: number; - constructor(name: string, position: Vector3, scene: Scene); - attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void; - detachControl(canvas: HTMLCanvasElement): void; - _checkInputs(): void; - } -} - -declare namespace BABYLON { - class FollowCamera extends TargetCamera { - radius: number; - rotationOffset: number; - heightOffset: number; - cameraAcceleration: number; - maxCameraSpeed: number; - target: AbstractMesh; - constructor(name: string, position: Vector3, scene: Scene); - private getRadians(degrees); - private follow(cameraTarget); - _checkInputs(): void; - serialize(): any; - } - class ArcFollowCamera extends TargetCamera { - alpha: number; - beta: number; - radius: number; - target: AbstractMesh; - private _cartesianCoordinates; - constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene); - private follow(); - _checkInputs(): void; - serialize(): any; - } -} - -declare namespace BABYLON { - class FreeCamera extends TargetCamera { - ellipsoid: Vector3; - keysUp: number[]; - keysDown: number[]; - keysLeft: number[]; - keysRight: number[]; - checkCollisions: boolean; - applyGravity: boolean; - angularSensibility: number; - onCollide: (collidedMesh: AbstractMesh) => void; - private _keys; - private _collider; - private _needMoveForGravity; - private _oldPosition; - private _diffPosition; - private _newPosition; - private _attachedElement; - private _localDirection; - private _transformedDirection; - private _onMouseDown; - private _onMouseUp; - private _onMouseOut; - private _onMouseMove; - private _onKeyDown; - private _onKeyUp; - _waitingLockedTargetId: string; - constructor(name: string, position: Vector3, scene: Scene); - _onLostFocus(e: FocusEvent): void; - attachControl(element: HTMLElement, noPreventDefault?: boolean): void; - detachControl(element: HTMLElement): void; - _collideWithWorld(velocity: Vector3): void; - private _onCollisionPositionChange; - _checkInputs(): void; - _decideIfNeedsToMove(): boolean; - _updatePosition(): void; - serialize(): any; - } -} - -declare namespace BABYLON { - class GamepadCamera extends UniversalCamera { - constructor(name: string, position: Vector3, scene: Scene); - } -} - -declare namespace BABYLON { - class AnaglyphFreeCamera extends FreeCamera { - interaxialDistance: number; - constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene); - } - class AnaglyphArcRotateCamera extends ArcRotateCamera { - constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene); - } - class AnaglyphGamepadCamera extends GamepadCamera { - constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene); - } - class StereoscopicFreeCamera extends FreeCamera { - constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene); - } - class StereoscopicArcRotateCamera extends ArcRotateCamera { - constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isSideBySide: boolean, scene: Scene); - } - class StereoscopicGamepadCamera extends GamepadCamera { - constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene); - } -} - -declare namespace BABYLON { - class TargetCamera extends Camera { - cameraDirection: Vector3; - cameraRotation: Vector2; - rotation: Vector3; - speed: number; - noRotationConstraint: boolean; - lockedTarget: any; - _currentTarget: Vector3; - _viewMatrix: Matrix; - _camMatrix: Matrix; - _cameraTransformMatrix: Matrix; - _cameraRotationMatrix: Matrix; - private _rigCamTransformMatrix; - _referencePoint: Vector3; - _transformedReferencePoint: Vector3; - _lookAtTemp: Matrix; - _tempMatrix: Matrix; - _reset: () => void; - _waitingLockedTargetId: string; - constructor(name: string, position: Vector3, scene: Scene); - getFrontPosition(distance: number): Vector3; - _getLockedTargetPosition(): Vector3; - _initCache(): void; - _updateCache(ignoreParentClass?: boolean): void; - _isSynchronizedViewMatrix(): boolean; - _computeLocalCameraSpeed(): number; - setTarget(target: Vector3): void; - getTarget(): Vector3; - _decideIfNeedsToMove(): boolean; - _updatePosition(): void; - _checkInputs(): void; - _getViewMatrix(): Matrix; - _getVRViewMatrix(): Matrix; - /** - * @override - * Override Camera.createRigCamera - */ - createRigCamera(name: string, cameraIndex: number): Camera; - /** - * @override - * Override Camera._updateRigCameras - */ - _updateRigCameras(): void; - private _getRigCamPosition(halfSpace, result); - serialize(): any; - } -} - -declare namespace BABYLON { - class TouchCamera extends FreeCamera { - private _offsetX; - private _offsetY; - private _pointerCount; - private _pointerPressed; - private _attachedCanvas; - private _onPointerDown; - private _onPointerUp; - private _onPointerMove; - touchAngularSensibility: number; - touchMoveSensibility: number; - constructor(name: string, position: Vector3, scene: Scene); - _onLostFocus(e: FocusEvent): void; - attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void; - detachControl(canvas: HTMLCanvasElement): void; - _checkInputs(): void; - } -} - -declare namespace BABYLON { - class UniversalCamera extends TouchCamera { - gamepad: Gamepad; - private _gamepads; - gamepadAngularSensibility: number; - gamepadMoveSensibility: number; - constructor(name: string, position: Vector3, scene: Scene); - private _onNewGameConnected(gamepad); - attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void; - detachControl(canvas: HTMLCanvasElement): void; - _checkInputs(): void; - dispose(): void; - } -} - -declare namespace BABYLON { - class VirtualJoysticksCamera extends FreeCamera { - private _leftjoystick; - private _rightjoystick; - constructor(name: string, position: Vector3, scene: Scene); - getLeftJoystick(): VirtualJoystick; - getRightJoystick(): VirtualJoystick; - _checkInputs(): void; - dispose(): void; - } -} - -declare namespace BABYLON { - class Collider { - radius: Vector3; - retry: number; - velocity: Vector3; - basePoint: Vector3; - epsilon: number; - collisionFound: boolean; - velocityWorldLength: number; - basePointWorld: Vector3; - velocityWorld: Vector3; - normalizedVelocity: Vector3; - initialVelocity: Vector3; - initialPosition: Vector3; - nearestDistance: number; - intersectionPoint: Vector3; - collidedMesh: AbstractMesh; - private _collisionPoint; - private _planeIntersectionPoint; - private _tempVector; - private _tempVector2; - private _tempVector3; - private _tempVector4; - private _edge; - private _baseToVertex; - private _destinationPoint; - private _slidePlaneNormal; - private _displacementVector; - _initialize(source: Vector3, dir: Vector3, e: number): void; - _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean; - _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean; - _testTriangle(faceIndex: number, trianglePlaneArray: Array, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void; - _collide(trianglePlaneArray: Array, pts: Vector3[], indices: number[] | Int32Array, indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void; - _getResponse(pos: Vector3, vel: Vector3): void; - } -} - -declare namespace BABYLON { - var CollisionWorker: string; - interface ICollisionCoordinator { - getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; - init(scene: Scene): void; - destroy(): void; - onMeshAdded(mesh: AbstractMesh): any; - onMeshUpdated(mesh: AbstractMesh): any; - onMeshRemoved(mesh: AbstractMesh): any; - onGeometryAdded(geometry: Geometry): any; - onGeometryUpdated(geometry: Geometry): any; - onGeometryDeleted(geometry: Geometry): any; - } - interface SerializedMesh { - id: string; - name: string; - uniqueId: number; - geometryId: string; - sphereCenter: Array; - sphereRadius: number; - boxMinimum: Array; - boxMaximum: Array; - worldMatrixFromCache: any; - subMeshes: Array; - checkCollisions: boolean; - } - interface SerializedSubMesh { - position: number; - verticesStart: number; - verticesCount: number; - indexStart: number; - indexCount: number; - hasMaterial: boolean; - sphereCenter: Array; - sphereRadius: number; - boxMinimum: Array; - boxMaximum: Array; - } - interface SerializedGeometry { - id: string; - positions: Float32Array; - indices: Int32Array; - normals: Float32Array; - } - interface BabylonMessage { - taskType: WorkerTaskType; - payload: InitPayload | CollidePayload | UpdatePayload; - } - interface SerializedColliderToWorker { - position: Array; - velocity: Array; - radius: Array; - } - enum WorkerTaskType { - INIT = 0, - UPDATE = 1, - COLLIDE = 2, - } - interface WorkerReply { - error: WorkerReplyType; - taskType: WorkerTaskType; - payload?: any; - } - interface CollisionReplyPayload { - newPosition: Array; - collisionId: number; - collidedMeshUniqueId: number; - } - interface InitPayload { - } - interface CollidePayload { - collisionId: number; - collider: SerializedColliderToWorker; - maximumRetry: number; - excludedMeshUniqueId?: number; - } - interface UpdatePayload { - updatedMeshes: { - [n: number]: SerializedMesh; - }; - updatedGeometries: { - [s: string]: SerializedGeometry; - }; - removedMeshes: Array; - removedGeometries: Array; - } - enum WorkerReplyType { - SUCCESS = 0, - UNKNOWN_ERROR = 1, - } - class CollisionCoordinatorWorker implements ICollisionCoordinator { - private _scene; - private _scaledPosition; - private _scaledVelocity; - private _collisionsCallbackArray; - private _init; - private _runningUpdated; - private _runningCollisionTask; - private _worker; - private _addUpdateMeshesList; - private _addUpdateGeometriesList; - private _toRemoveMeshesArray; - private _toRemoveGeometryArray; - constructor(); - static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh; - static SerializeGeometry: (geometry: Geometry) => SerializedGeometry; - getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; - init(scene: Scene): void; - destroy(): void; - onMeshAdded(mesh: AbstractMesh): void; - onMeshUpdated: (mesh: AbstractMesh) => void; - onMeshRemoved(mesh: AbstractMesh): void; - onGeometryAdded(geometry: Geometry): void; - onGeometryUpdated: (geometry: Geometry) => void; - onGeometryDeleted(geometry: Geometry): void; - private _afterRender; - private _onMessageFromWorker; - } - class CollisionCoordinatorLegacy implements ICollisionCoordinator { - private _scene; - private _scaledPosition; - private _scaledVelocity; - private _finalPosition; - getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; - init(scene: Scene): void; - destroy(): void; - onMeshAdded(mesh: AbstractMesh): void; - onMeshUpdated(mesh: AbstractMesh): void; - onMeshRemoved(mesh: AbstractMesh): void; - onGeometryAdded(geometry: Geometry): void; - onGeometryUpdated(geometry: Geometry): void; - onGeometryDeleted(geometry: Geometry): void; - private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?); - } -} - -declare namespace BABYLON { - var WorkerIncluded: boolean; - class CollisionCache { - private _meshes; - private _geometries; - getMeshes(): { - [n: number]: SerializedMesh; - }; - getGeometries(): { - [s: number]: SerializedGeometry; - }; - getMesh(id: any): SerializedMesh; - addMesh(mesh: SerializedMesh): void; - removeMesh(uniqueId: number): void; - getGeometry(id: string): SerializedGeometry; - addGeometry(geometry: SerializedGeometry): void; - removeGeometry(id: string): void; - } - class CollideWorker { - collider: Collider; - private _collisionCache; - private finalPosition; - private collisionsScalingMatrix; - private collisionTranformationMatrix; - constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3); - collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void; - private checkCollision(mesh); - private processCollisionsForSubMeshes(transformMatrix, mesh); - private collideForSubMesh(subMesh, transformMatrix, meshGeometry); - private checkSubmeshCollision(subMesh); - } - interface ICollisionDetector { - onInit(payload: InitPayload): void; - onUpdate(payload: UpdatePayload): void; - onCollision(payload: CollidePayload): void; - } - class CollisionDetectorTransferable implements ICollisionDetector { - private _collisionCache; - onInit(payload: InitPayload): void; - onUpdate(payload: UpdatePayload): void; - onCollision(payload: CollidePayload): void; - } -} - -declare namespace BABYLON { - class IntersectionInfo { - bu: number; - bv: number; - distance: number; - faceId: number; - subMeshId: number; - constructor(bu: number, bv: number, distance: number); - } - class PickingInfo { - hit: boolean; - distance: number; - pickedPoint: Vector3; - pickedMesh: AbstractMesh; - bu: number; - bv: number; - faceId: number; - subMeshId: number; - pickedSprite: Sprite; - getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3; - getTextureCoordinates(): Vector2; - } -} - -declare namespace BABYLON { - class DebugLayer { - private _scene; - private _camera; - private _transformationMatrix; - private _enabled; - private _labelsEnabled; - private _displayStatistics; - private _displayTree; - private _displayLogs; - private _globalDiv; - private _statsDiv; - private _statsSubsetDiv; - private _optionsDiv; - private _optionsSubsetDiv; - private _logDiv; - private _logSubsetDiv; - private _treeDiv; - private _treeSubsetDiv; - private _drawingCanvas; - private _drawingContext; - private _rootElement; - _syncPositions: () => void; - private _syncData; - private _syncUI; - private _onCanvasClick; - private _clickPosition; - private _ratio; - private _identityMatrix; - private _showUI; - private _needToRefreshMeshesTree; - shouldDisplayLabel: (node: Node) => boolean; - shouldDisplayAxis: (mesh: Mesh) => boolean; - axisRatio: number; - accentColor: string; - customStatsFunction: () => string; - constructor(scene: Scene); - private _refreshMeshesTreeContent(); - private _renderSingleAxis(zero, unit, unitText, label, color); - private _renderAxis(projectedPosition, mesh, globalViewport); - private _renderLabel(text, projectedPosition, labelOffset, onClick, getFillStyle); - private _isClickInsideRect(x, y, width, height); - isVisible(): boolean; - hide(): void; - show(showUI?: boolean, camera?: Camera, rootElement?: HTMLElement): void; - private _clearLabels(); - private _generateheader(root, text); - private _generateTexBox(root, title, color); - private _generateAdvancedCheckBox(root, leftTitle, rightTitle, initialState, task, tag?); - private _generateCheckBox(root, title, initialState, task, tag?); - private _generateButton(root, title, task, tag?); - private _generateRadio(root, title, name, initialState, task, tag?); - private _generateDOMelements(); - private _displayStats(); - } -} - -declare namespace BABYLON { - class BoundingBox { - minimum: Vector3; - maximum: Vector3; - vectors: Vector3[]; - center: Vector3; - extendSize: Vector3; - directions: Vector3[]; - vectorsWorld: Vector3[]; - minimumWorld: Vector3; - maximumWorld: Vector3; - private _worldMatrix; - constructor(minimum: Vector3, maximum: Vector3); - getWorldMatrix(): Matrix; - _update(world: Matrix): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - isCompletelyInFrustum(frustumPlanes: Plane[]): boolean; - intersectsPoint(point: Vector3): boolean; - intersectsSphere(sphere: BoundingSphere): boolean; - intersectsMinMax(min: Vector3, max: Vector3): boolean; - static Intersects(box0: BoundingBox, box1: BoundingBox): boolean; - static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean; - static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean; - static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean; - } -} - -declare namespace BABYLON { - class BoundingInfo { - minimum: Vector3; - maximum: Vector3; - boundingBox: BoundingBox; - boundingSphere: BoundingSphere; - private _isLocked; - constructor(minimum: Vector3, maximum: Vector3); - isLocked: boolean; - update(world: Matrix): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - isCompletelyInFrustum(frustumPlanes: Plane[]): boolean; - _checkCollision(collider: Collider): boolean; - intersectsPoint(point: Vector3): boolean; - intersects(boundingInfo: BoundingInfo, precise: boolean): boolean; - } -} - -declare namespace BABYLON { - class BoundingSphere { - minimum: Vector3; - maximum: Vector3; - center: Vector3; - radius: number; - centerWorld: Vector3; - radiusWorld: number; - private _tempRadiusVector; - constructor(minimum: Vector3, maximum: Vector3); - _update(world: Matrix): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - intersectsPoint(point: Vector3): boolean; - static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean; - } -} - -declare namespace BABYLON { - class Layer { - name: string; - texture: Texture; - isBackground: boolean; - color: Color4; - scale: Vector2; - offset: Vector2; - onDispose: () => void; - alphaBlendingMode: number; - private _scene; - private _vertexDeclaration; - private _vertexStrideSize; - private _vertexBuffer; - private _indexBuffer; - private _effect; - constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4); - render(): void; - dispose(): void; - } -} - -declare namespace BABYLON { - class LensFlare { - size: number; - position: number; - color: Color3; - texture: Texture; - private _system; - constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem); - dispose: () => void; - } -} - -declare namespace BABYLON { - class LensFlareSystem { - name: string; - lensFlares: LensFlare[]; - borderLimit: number; - meshesSelectionPredicate: (mesh: Mesh) => boolean; - layerMask: number; - private _scene; - private _emitter; - private _vertexDeclaration; - private _vertexStrideSize; - private _vertexBuffer; - private _indexBuffer; - private _effect; - private _positionX; - private _positionY; - private _isEnabled; - constructor(name: string, emitter: any, scene: Scene); - isEnabled: boolean; - getScene(): Scene; - getEmitter(): any; - setEmitter(newEmitter: any): void; - getEmitterPosition(): Vector3; - computeEffectivePosition(globalViewport: Viewport): boolean; - _isVisible(): boolean; - render(): boolean; - dispose(): void; - static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem; - serialize(): any; - } -} - -declare namespace BABYLON { - class DirectionalLight extends Light implements IShadowLight { - direction: Vector3; - position: Vector3; - private _transformedDirection; - transformedPosition: Vector3; - private _worldMatrix; - shadowOrthoScale: number; - autoUpdateExtends: boolean; - private _orthoLeft; - private _orthoRight; - private _orthoTop; - private _orthoBottom; - constructor(name: string, direction: Vector3, scene: Scene); - getAbsolutePosition(): Vector3; - setDirectionToTarget(target: Vector3): Vector3; - setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; - supportsVSM(): boolean; - needRefreshPerFrame(): boolean; - needCube(): boolean; - getShadowDirection(faceIndex?: number): Vector3; - computeTransformedPosition(): boolean; - transferToEffect(effect: Effect, directionUniformName: string): void; - _getWorldMatrix(): Matrix; - serialize(): any; - } -} - -declare namespace BABYLON { - class HemisphericLight extends Light { - direction: Vector3; - groundColor: Color3; - private _worldMatrix; - constructor(name: string, direction: Vector3, scene: Scene); - setDirectionToTarget(target: Vector3): Vector3; - getShadowGenerator(): ShadowGenerator; - transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void; - _getWorldMatrix(): Matrix; - serialize(): any; - } -} - -declare namespace BABYLON { - interface IShadowLight { - id: string; - position: Vector3; - transformedPosition: Vector3; - name: string; - computeTransformedPosition(): boolean; - getScene(): Scene; - setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; - supportsVSM(): boolean; - needRefreshPerFrame(): boolean; - needCube(): boolean; - getShadowDirection(faceIndex?: number): Vector3; - _shadowGenerator: ShadowGenerator; - } - class Light extends Node { - diffuse: Color3; - specular: Color3; - intensity: number; - range: number; - includeOnlyWithLayerMask: number; - includedOnlyMeshes: AbstractMesh[]; - excludedMeshes: AbstractMesh[]; - excludeWithLayerMask: number; - _shadowGenerator: ShadowGenerator; - private _parentedWorldMatrix; - _excludedMeshesIds: string[]; - _includedOnlyMeshesIds: string[]; - constructor(name: string, scene: Scene); - getShadowGenerator(): ShadowGenerator; - getAbsolutePosition(): Vector3; - transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void; - _getWorldMatrix(): Matrix; - canAffectMesh(mesh: AbstractMesh): boolean; - getWorldMatrix(): Matrix; - dispose(): void; - serialize(): any; - static Parse(parsedLight: any, scene: Scene): Light; - } -} - -declare namespace BABYLON { - class PointLight extends Light implements IShadowLight { - position: Vector3; - private _worldMatrix; - transformedPosition: Vector3; - constructor(name: string, position: Vector3, scene: Scene); - getAbsolutePosition(): Vector3; - computeTransformedPosition(): boolean; - transferToEffect(effect: Effect, positionUniformName: string): void; - needCube(): boolean; - supportsVSM(): boolean; - needRefreshPerFrame(): boolean; - getShadowDirection(faceIndex?: number): Vector3; - setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; - _getWorldMatrix(): Matrix; - serialize(): any; - } -} - -declare namespace BABYLON { - class SpotLight extends Light implements IShadowLight { - position: Vector3; - direction: Vector3; - angle: number; - exponent: number; - transformedPosition: Vector3; - private _transformedDirection; - private _worldMatrix; - constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene); - getAbsolutePosition(): Vector3; - setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; - needCube(): boolean; - supportsVSM(): boolean; - needRefreshPerFrame(): boolean; - getShadowDirection(faceIndex?: number): Vector3; - setDirectionToTarget(target: Vector3): Vector3; - computeTransformedPosition(): boolean; - transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void; - _getWorldMatrix(): Matrix; - serialize(): any; - } -} - -declare namespace BABYLON { - interface ISceneLoaderPlugin { - extensions: string; - importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean; - load: (scene: Scene, data: string, rootUrl: string) => boolean; - } - class SceneLoader { - private static _ForceFullSceneLoadingForIncremental; - private static _ShowLoadingScreen; - static ForceFullSceneLoadingForIncremental: boolean; - static ShowLoadingScreen: boolean; - private static _registeredPlugins; - private static _getPluginForFilename(sceneFilename); - static RegisterPlugin(plugin: ISceneLoaderPlugin): void; - static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, e: any) => void): void; - /** - * Load a scene - * @param rootUrl a string that defines the root url for scene and resources - * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene - * @param engine is the instance of BABYLON.Engine to use to create the scene - */ - static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void; - /** - * Append a scene - * @param rootUrl a string that defines the root url for scene and resources - * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene - * @param scene is the instance of BABYLON.Scene to append to - */ - static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void; - } -} - -declare namespace BABYLON { - class SIMDVector3 { - static TransformCoordinatesToRefSIMD(vector: Vector3, transformation: Matrix, result: Vector3): void; - static TransformCoordinatesFromFloatsToRefSIMD(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; - } - class SIMDMatrix { - multiplyToArraySIMD(other: Matrix, result: Matrix, offset?: number): void; - invertToRefSIMD(other: Matrix): Matrix; - static LookAtLHToRefSIMD(eyeRef: Vector3, targetRef: Vector3, upRef: Vector3, result: Matrix): void; - } - class SIMDHelper { - private static _isEnabled; - static IsEnabled: boolean; - static DisableSIMD(): void; - static EnableSIMD(): void; - } -} - -declare namespace BABYLON { - class Color3 { - r: number; - g: number; - b: number; - constructor(r?: number, g?: number, b?: number); - toString(): string; - toArray(array: number[], index?: number): Color3; - toColor4(alpha?: number): Color4; - asArray(): number[]; - toLuminance(): number; - multiply(otherColor: Color3): Color3; - multiplyToRef(otherColor: Color3, result: Color3): Color3; - equals(otherColor: Color3): boolean; - equalsFloats(r: number, g: number, b: number): boolean; - scale(scale: number): Color3; - scaleToRef(scale: number, result: Color3): Color3; - add(otherColor: Color3): Color3; - addToRef(otherColor: Color3, result: Color3): Color3; - subtract(otherColor: Color3): Color3; - subtractToRef(otherColor: Color3, result: Color3): Color3; - clone(): Color3; - copyFrom(source: Color3): Color3; - copyFromFloats(r: number, g: number, b: number): Color3; - toHexString(): string; - toLinearSpace(): Color3; - toLinearSpaceToRef(convertedColor: Color3): Color3; - toGammaSpace(): Color3; - toGammaSpaceToRef(convertedColor: Color3): Color3; - static FromHexString(hex: string): Color3; - static FromArray(array: number[], offset?: number): Color3; - static FromInts(r: number, g: number, b: number): Color3; - static Lerp(start: Color3, end: Color3, amount: number): Color3; - static Red(): Color3; - static Green(): Color3; - static Blue(): Color3; - static Black(): Color3; - static White(): Color3; - static Purple(): Color3; - static Magenta(): Color3; - static Yellow(): Color3; - static Gray(): Color3; - } - class Color4 { - r: number; - g: number; - b: number; - a: number; - constructor(r: number, g: number, b: number, a: number); - addInPlace(right: any): Color4; - asArray(): number[]; - toArray(array: number[], index?: number): Color4; - add(right: Color4): Color4; - subtract(right: Color4): Color4; - subtractToRef(right: Color4, result: Color4): Color4; - scale(scale: number): Color4; - scaleToRef(scale: number, result: Color4): Color4; - toString(): string; - clone(): Color4; - copyFrom(source: Color4): Color4; - toHexString(): string; - static FromHexString(hex: string): Color4; - static Lerp(left: Color4, right: Color4, amount: number): Color4; - static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void; - static FromArray(array: number[], offset?: number): Color4; - static FromInts(r: number, g: number, b: number, a: number): Color4; - static CheckColors4(colors: number[], count: number): number[]; - } - class Vector2 { - x: number; - y: number; - constructor(x: number, y: number); - toString(): string; - toArray(array: number[], index?: number): Vector2; - asArray(): number[]; - copyFrom(source: Vector2): Vector2; - copyFromFloats(x: number, y: number): Vector2; - add(otherVector: Vector2): Vector2; - addVector3(otherVector: Vector3): Vector2; - subtract(otherVector: Vector2): Vector2; - subtractInPlace(otherVector: Vector2): Vector2; - multiplyInPlace(otherVector: Vector2): Vector2; - multiply(otherVector: Vector2): Vector2; - multiplyToRef(otherVector: Vector2, result: Vector2): Vector2; - multiplyByFloats(x: number, y: number): Vector2; - divide(otherVector: Vector2): Vector2; - divideToRef(otherVector: Vector2, result: Vector2): Vector2; - negate(): Vector2; - scaleInPlace(scale: number): Vector2; - scale(scale: number): Vector2; - equals(otherVector: Vector2): boolean; - equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean; - length(): number; - lengthSquared(): number; - normalize(): Vector2; - clone(): Vector2; - static Zero(): Vector2; - static FromArray(array: number[] | Float32Array, offset?: number): Vector2; - static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector2): void; - static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2; - static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2; - static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2; - static Lerp(start: Vector2, end: Vector2, amount: number): Vector2; - static Dot(left: Vector2, right: Vector2): number; - static Normalize(vector: Vector2): Vector2; - static Minimize(left: Vector2, right: Vector2): Vector2; - static Maximize(left: Vector2, right: Vector2): Vector2; - static Transform(vector: Vector2, transformation: Matrix): Vector2; - static Distance(value1: Vector2, value2: Vector2): number; - static DistanceSquared(value1: Vector2, value2: Vector2): number; - } - class Vector3 { - x: number; - y: number; - z: number; - constructor(x: number, y: number, z: number); - toString(): string; - asArray(): number[]; - toArray(array: number[] | Float32Array, index?: number): Vector3; - toQuaternion(): Quaternion; - addInPlace(otherVector: Vector3): Vector3; - add(otherVector: Vector3): Vector3; - addToRef(otherVector: Vector3, result: Vector3): Vector3; - subtractInPlace(otherVector: Vector3): Vector3; - subtract(otherVector: Vector3): Vector3; - subtractToRef(otherVector: Vector3, result: Vector3): Vector3; - subtractFromFloats(x: number, y: number, z: number): Vector3; - subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3; - negate(): Vector3; - scaleInPlace(scale: number): Vector3; - scale(scale: number): Vector3; - scaleToRef(scale: number, result: Vector3): void; - equals(otherVector: Vector3): boolean; - equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean; - equalsToFloats(x: number, y: number, z: number): boolean; - multiplyInPlace(otherVector: Vector3): Vector3; - multiply(otherVector: Vector3): Vector3; - multiplyToRef(otherVector: Vector3, result: Vector3): Vector3; - multiplyByFloats(x: number, y: number, z: number): Vector3; - divide(otherVector: Vector3): Vector3; - divideToRef(otherVector: Vector3, result: Vector3): Vector3; - MinimizeInPlace(other: Vector3): Vector3; - MaximizeInPlace(other: Vector3): Vector3; - length(): number; - lengthSquared(): number; - normalize(): Vector3; - clone(): Vector3; - copyFrom(source: Vector3): Vector3; - copyFromFloats(x: number, y: number, z: number): Vector3; - static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number; - static FromArray(array: number[] | Float32Array, offset?: number): Vector3; - static FromFloatArray(array: Float32Array, offset?: number): Vector3; - static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector3): void; - static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void; - static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void; - static Zero(): Vector3; - static Up(): Vector3; - static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3; - static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void; - static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; - static TransformNormal(vector: Vector3, transformation: Matrix): Vector3; - static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void; - static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; - static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3; - static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3; - static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3; - static Lerp(start: Vector3, end: Vector3, amount: number): Vector3; - static Dot(left: Vector3, right: Vector3): number; - static Cross(left: Vector3, right: Vector3): Vector3; - static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void; - static Normalize(vector: Vector3): Vector3; - static NormalizeToRef(vector: Vector3, result: Vector3): void; - static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3; - static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3; - static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3; - static Minimize(left: Vector3, right: Vector3): Vector3; - static Maximize(left: Vector3, right: Vector3): Vector3; - static Distance(value1: Vector3, value2: Vector3): number; - static DistanceSquared(value1: Vector3, value2: Vector3): number; - static Center(value1: Vector3, value2: Vector3): Vector3; - /** - * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system), - * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply - * to something in order to rotate it from its local system to the given target system. - */ - static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3; - /** - * The same than RotationFromAxis but updates the passed ref Vector3 parameter. - */ - static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void; - } - class Vector4 { - x: number; - y: number; - z: number; - w: number; - constructor(x: number, y: number, z: number, w: number); - toString(): string; - asArray(): number[]; - toArray(array: number[], index?: number): Vector4; - addInPlace(otherVector: Vector4): Vector4; - add(otherVector: Vector4): Vector4; - addToRef(otherVector: Vector4, result: Vector4): Vector4; - subtractInPlace(otherVector: Vector4): Vector4; - subtract(otherVector: Vector4): Vector4; - subtractToRef(otherVector: Vector4, result: Vector4): Vector4; - subtractFromFloats(x: number, y: number, z: number, w: number): Vector4; - subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4; - negate(): Vector4; - scaleInPlace(scale: number): Vector4; - scale(scale: number): Vector4; - scaleToRef(scale: number, result: Vector4): void; - equals(otherVector: Vector4): boolean; - equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean; - equalsToFloats(x: number, y: number, z: number, w: number): boolean; - multiplyInPlace(otherVector: Vector4): Vector4; - multiply(otherVector: Vector4): Vector4; - multiplyToRef(otherVector: Vector4, result: Vector4): Vector4; - multiplyByFloats(x: number, y: number, z: number, w: number): Vector4; - divide(otherVector: Vector4): Vector4; - divideToRef(otherVector: Vector4, result: Vector4): Vector4; - MinimizeInPlace(other: Vector4): Vector4; - MaximizeInPlace(other: Vector4): Vector4; - length(): number; - lengthSquared(): number; - normalize(): Vector4; - clone(): Vector4; - copyFrom(source: Vector4): Vector4; - copyFromFloats(x: number, y: number, z: number, w: number): Vector4; - static FromArray(array: number[], offset?: number): Vector4; - static FromArrayToRef(array: number[], offset: number, result: Vector4): void; - static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void; - static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void; - static Zero(): Vector4; - static Normalize(vector: Vector4): Vector4; - static NormalizeToRef(vector: Vector4, result: Vector4): void; - static Minimize(left: Vector4, right: Vector4): Vector4; - static Maximize(left: Vector4, right: Vector4): Vector4; - static Distance(value1: Vector4, value2: Vector4): number; - static DistanceSquared(value1: Vector4, value2: Vector4): number; - static Center(value1: Vector4, value2: Vector4): Vector4; - } - class Quaternion { - x: number; - y: number; - z: number; - w: number; - constructor(x?: number, y?: number, z?: number, w?: number); - toString(): string; - asArray(): number[]; - equals(otherQuaternion: Quaternion): boolean; - clone(): Quaternion; - copyFrom(other: Quaternion): Quaternion; - copyFromFloats(x: number, y: number, z: number, w: number): Quaternion; - add(other: Quaternion): Quaternion; - subtract(other: Quaternion): Quaternion; - scale(value: number): Quaternion; - multiply(q1: Quaternion): Quaternion; - multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion; - multiplyInPlace(q1: Quaternion): Quaternion; - length(): number; - normalize(): Quaternion; - toEulerAngles(order?: string): Vector3; - toEulerAnglesToRef(result: Vector3, order?: string): Quaternion; - toRotationMatrix(result: Matrix): Quaternion; - fromRotationMatrix(matrix: Matrix): Quaternion; - static FromRotationMatrix(matrix: Matrix): Quaternion; - static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void; - static Inverse(q: Quaternion): Quaternion; - static Identity(): Quaternion; - static RotationAxis(axis: Vector3, angle: number): Quaternion; - static FromArray(array: number[], offset?: number): Quaternion; - static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion; - static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void; - static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion; - static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void; - static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion; - } - class Matrix { - private static _tempQuaternion; - private static _xAxis; - private static _yAxis; - private static _zAxis; - m: Float32Array; - isIdentity(): boolean; - determinant(): number; - toArray(): Float32Array; - asArray(): Float32Array; - invert(): Matrix; - reset(): Matrix; - add(other: Matrix): Matrix; - addToRef(other: Matrix, result: Matrix): Matrix; - addToSelf(other: Matrix): Matrix; - invertToRef(other: Matrix): Matrix; - setTranslation(vector3: Vector3): Matrix; - multiply(other: Matrix): Matrix; - copyFrom(other: Matrix): Matrix; - copyToArray(array: Float32Array, offset?: number): Matrix; - multiplyToRef(other: Matrix, result: Matrix): Matrix; - multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix; - equals(value: Matrix): boolean; - clone(): Matrix; - decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean; - static FromArray(array: number[], offset?: number): Matrix; - static FromArrayToRef(array: number[], offset: number, result: Matrix): void; - static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void; - static FromValuesToRef(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number, result: Matrix): void; - static FromValues(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number): Matrix; - static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix; - static Identity(): Matrix; - static IdentityToRef(result: Matrix): void; - static Zero(): Matrix; - static RotationX(angle: number): Matrix; - static Invert(source: Matrix): Matrix; - static RotationXToRef(angle: number, result: Matrix): void; - static RotationY(angle: number): Matrix; - static RotationYToRef(angle: number, result: Matrix): void; - static RotationZ(angle: number): Matrix; - static RotationZToRef(angle: number, result: Matrix): void; - static RotationAxis(axis: Vector3, angle: number): Matrix; - static RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void; - static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix; - static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void; - static Scaling(x: number, y: number, z: number): Matrix; - static ScalingToRef(x: number, y: number, z: number, result: Matrix): void; - static Translation(x: number, y: number, z: number): Matrix; - static TranslationToRef(x: number, y: number, z: number, result: Matrix): void; - static Lerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix; - static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix; - static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void; - static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix; - static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void; - static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix; - static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void; - static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix; - static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix; - static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, fovMode?: number): void; - static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix; - static GetAsMatrix2x2(matrix: Matrix): Float32Array; - static GetAsMatrix3x3(matrix: Matrix): Float32Array; - static Transpose(matrix: Matrix): Matrix; - static Reflection(plane: Plane): Matrix; - static ReflectionToRef(plane: Plane, result: Matrix): void; - } - class Plane { - normal: Vector3; - d: number; - constructor(a: number, b: number, c: number, d: number); - asArray(): number[]; - clone(): Plane; - normalize(): Plane; - transform(transformation: Matrix): Plane; - dotCoordinate(point: any): number; - copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane; - isFrontFacingTo(direction: Vector3, epsilon: number): boolean; - signedDistanceTo(point: Vector3): number; - static FromArray(array: number[]): Plane; - static FromPoints(point1: any, point2: any, point3: any): Plane; - static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane; - static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number; - } - class Viewport { - x: number; - y: number; - width: number; - height: number; - constructor(x: number, y: number, width: number, height: number); - toGlobal(engine: Engine): Viewport; - toScreenGlobal(engine: Engine): Viewport; - } - class Frustum { - static GetPlanes(transform: Matrix): Plane[]; - static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void; - } - class Ray { - origin: Vector3; - direction: Vector3; - length: number; - private _edge1; - private _edge2; - private _pvec; - private _tvec; - private _qvec; - constructor(origin: Vector3, direction: Vector3, length?: number); - intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean; - intersectsBox(box: BoundingBox): boolean; - intersectsSphere(sphere: any): boolean; - intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo; - static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray; - /** - * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be - * transformed to the given world matrix. - * @param origin The origin point - * @param end The end point - * @param world a matrix to transform the ray to. Default is the identity matrix. - */ - static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray; - static Transform(ray: Ray, matrix: Matrix): Ray; - } - enum Space { - LOCAL = 0, - WORLD = 1, - } - class Axis { - static X: Vector3; - static Y: Vector3; - static Z: Vector3; - } - class BezierCurve { - static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number; - } - enum Orientation { - CW = 0, - CCW = 1, - } - class Angle { - private _radians; - constructor(radians: number); - degrees: () => number; - radians: () => number; - static BetweenTwoPoints(a: Vector2, b: Vector2): Angle; - static FromRadians(radians: number): Angle; - static FromDegrees(degrees: number): Angle; - } - class Arc2 { - startPoint: Vector2; - midPoint: Vector2; - endPoint: Vector2; - centerPoint: Vector2; - radius: number; - angle: Angle; - startAngle: Angle; - orientation: Orientation; - constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2); - } - class PathCursor { - private path; - private _onchange; - value: number; - animations: Animation[]; - constructor(path: Path2); - getPoint(): Vector3; - moveAhead(step?: number): PathCursor; - moveBack(step?: number): PathCursor; - move(step: number): PathCursor; - private ensureLimits(); - private markAsDirty(propertyName); - private raiseOnChange(); - onchange(f: (cursor: PathCursor) => void): PathCursor; - } - class Path2 { - private _points; - private _length; - closed: boolean; - constructor(x: number, y: number); - addLineTo(x: number, y: number): Path2; - addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2; - close(): Path2; - length(): number; - getPoints(): Vector2[]; - getPointAtLengthPosition(normalizedLengthPosition: number): Vector2; - static StartingAt(x: number, y: number): Path2; - } - class Path3D { - path: Vector3[]; - private _curve; - private _distances; - private _tangents; - private _normals; - private _binormals; - private _raw; - /** - * new Path3D(path, normal, raw) - * path : an array of Vector3, the curve axis of the Path3D - * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal. - * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed. - */ - constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean); - getCurve(): Vector3[]; - getTangents(): Vector3[]; - getNormals(): Vector3[]; - getBinormals(): Vector3[]; - getDistances(): number[]; - update(path: Vector3[], firstNormal?: Vector3): Path3D; - private _compute(firstNormal); - private _getFirstNonNullVector(index); - private _getLastNonNullVector(index); - private _normalVector(v0, vt, va); - } - class Curve3 { - private _points; - private _length; - static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3; - static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3; - static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3; - constructor(points: Vector3[]); - getPoints(): Vector3[]; - length(): number; - continue(curve: Curve3): Curve3; - private _computeLength(path); - } - class PositionNormalVertex { - position: Vector3; - normal: Vector3; - constructor(position?: Vector3, normal?: Vector3); - clone(): PositionNormalVertex; - } - class PositionNormalTextureVertex { - position: Vector3; - normal: Vector3; - uv: Vector2; - constructor(position?: Vector3, normal?: Vector3, uv?: Vector2); - clone(): PositionNormalTextureVertex; - } - class Tmp { - static Vector2: Vector2[]; - static Vector3: Vector3[]; - static Vector4: Vector4[]; - static Quaternion: Quaternion[]; - static Matrix: Matrix[]; - } -} - -declare namespace BABYLON { - class EffectFallbacks { - private _defines; - private _currentRank; - private _maxRank; - private _mesh; - private _meshRank; - addFallback(rank: number, define: string): void; - addCPUSkinningFallback(rank: number, mesh: BABYLON.AbstractMesh): void; - isMoreFallbacks: boolean; - reduce(currentDefines: string): string; - } - class Effect { - name: any; - defines: string; - onCompiled: (effect: Effect) => void; - onError: (effect: Effect, errors: string) => void; - onBind: (effect: Effect) => void; - private _engine; - private _uniformsNames; - private _samplers; - private _isReady; - private _compilationError; - private _attributesNames; - private _attributes; - private _uniforms; - _key: string; - private _program; - private _valueCache; - constructor(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], engine: any, defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void); - isReady(): boolean; - getProgram(): WebGLProgram; - getAttributesNames(): string[]; - getAttributeLocation(index: number): number; - getAttributeLocationByName(name: string): number; - getAttributesCount(): number; - getUniformIndex(uniformName: string): number; - getUniform(uniformName: string): WebGLUniformLocation; - getSamplers(): string[]; - getCompilationError(): string; - _loadVertexShader(vertex: any, callback: (data: any) => void): void; - _loadFragmentShader(fragment: any, callback: (data: any) => void): void; - private _dumpShadersName(); - private _prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks?); - isSupported: boolean; - _bindTexture(channel: string, texture: WebGLTexture): void; - setTexture(channel: string, texture: BaseTexture): void; - setTextureFromPostProcess(channel: string, postProcess: PostProcess): void; - _cacheMatrix(uniformName: any, matrix: any): void; - _cacheFloat2(uniformName: string, x: number, y: number): void; - _cacheFloat3(uniformName: string, x: number, y: number, z: number): void; - _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): void; - setArray(uniformName: string, array: number[]): Effect; - setArray2(uniformName: string, array: number[]): Effect; - setArray3(uniformName: string, array: number[]): Effect; - setArray4(uniformName: string, array: number[]): Effect; - setMatrices(uniformName: string, matrices: Float32Array): Effect; - setMatrix(uniformName: string, matrix: Matrix): Effect; - setMatrix3x3(uniformName: string, matrix: Float32Array): Effect; - setMatrix2x2(uniformname: string, matrix: Float32Array): Effect; - setFloat(uniformName: string, value: number): Effect; - setBool(uniformName: string, bool: boolean): Effect; - setVector2(uniformName: string, vector2: Vector2): Effect; - setFloat2(uniformName: string, x: number, y: number): Effect; - setVector3(uniformName: string, vector3: Vector3): Effect; - setFloat3(uniformName: string, x: number, y: number, z: number): Effect; - setVector4(uniformName: string, vector4: Vector4): Effect; - setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect; - setColor3(uniformName: string, color3: Color3): Effect; - setColor4(uniformName: string, color3: Color3, alpha: number): Effect; - static ShadersStore: {}; - } -} - -declare namespace BABYLON { - class MaterialDefines { - _keys: string[]; - isEqual(other: MaterialDefines): boolean; - cloneTo(other: MaterialDefines): void; - reset(): void; - toString(): string; - } - class Material { - name: string; - private static _TriangleFillMode; - private static _WireFrameFillMode; - private static _PointFillMode; - static TriangleFillMode: number; - static WireFrameFillMode: number; - static PointFillMode: number; - private static _ClockWiseSideOrientation; - private static _CounterClockWiseSideOrientation; - static ClockWiseSideOrientation: number; - static CounterClockWiseSideOrientation: number; - id: string; - checkReadyOnEveryCall: boolean; - checkReadyOnlyOnce: boolean; - state: string; - alpha: number; - backFaceCulling: boolean; - sideOrientation: number; - onCompiled: (effect: Effect) => void; - onError: (effect: Effect, errors: string) => void; - onDispose: () => void; - onBind: (material: Material, mesh: Mesh) => void; - getRenderTargetTextures: () => SmartArray; - alphaMode: number; - disableDepthWrite: boolean; - fogEnabled: boolean; - _effect: Effect; - _wasPreviouslyReady: boolean; - private _scene; - private _fillMode; - private _cachedDepthWriteState; - pointSize: number; - zOffset: number; - wireframe: boolean; - pointsCloud: boolean; - fillMode: number; - constructor(name: string, scene: Scene, doNotAdd?: boolean); - isFrozen: boolean; - freeze(): void; - unfreeze(): void; - isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; - getEffect(): Effect; - getScene(): Scene; - needAlphaBlending(): boolean; - needAlphaTesting(): boolean; - getAlphaTestTexture(): BaseTexture; - trackCreation(onCompiled: (effect: Effect) => void, onError: (effect: Effect, errors: string) => void): void; - markDirty(): void; - _preBind(): void; - bind(world: Matrix, mesh?: Mesh): void; - bindOnlyWorldMatrix(world: Matrix): void; - unbind(): void; - clone(name: string): Material; - getBindedMeshes(): AbstractMesh[]; - dispose(forceDisposeEffect?: boolean): void; - copyTo(other: Material): void; - serialize(): any; - static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial; - static Parse(parsedMaterial: any, scene: Scene, rootUrl: string): any; - } -} - -declare namespace BABYLON { - class MultiMaterial extends Material { - subMaterials: Material[]; - constructor(name: string, scene: Scene); - getSubMaterial(index: any): Material; - isReady(mesh?: AbstractMesh): boolean; - clone(name: string, cloneChildren?: boolean): MultiMaterial; - serialize(): any; - } -} - -declare namespace BABYLON { - class ShaderMaterial extends Material { - private _shaderPath; - private _options; - private _textures; - private _floats; - private _floatsArrays; - private _colors3; - private _colors4; - private _vectors2; - private _vectors3; - private _vectors4; - private _matrices; - private _matrices3x3; - private _matrices2x2; - private _cachedWorldViewMatrix; - private _renderId; - constructor(name: string, scene: Scene, shaderPath: any, options: any); - needAlphaBlending(): boolean; - needAlphaTesting(): boolean; - private _checkUniform(uniformName); - setTexture(name: string, texture: Texture): ShaderMaterial; - setFloat(name: string, value: number): ShaderMaterial; - setFloats(name: string, value: number[]): ShaderMaterial; - setColor3(name: string, value: Color3): ShaderMaterial; - setColor4(name: string, value: Color4): ShaderMaterial; - setVector2(name: string, value: Vector2): ShaderMaterial; - setVector3(name: string, value: Vector3): ShaderMaterial; - setVector4(name: string, value: Vector4): ShaderMaterial; - setMatrix(name: string, value: Matrix): ShaderMaterial; - setMatrix3x3(name: string, value: Float32Array): ShaderMaterial; - setMatrix2x2(name: string, value: Float32Array): ShaderMaterial; - isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; - bindOnlyWorldMatrix(world: Matrix): void; - bind(world: Matrix, mesh?: Mesh): void; - clone(name: string): ShaderMaterial; - dispose(forceDisposeEffect?: boolean): void; - serialize(): any; - static Parse(source: any, scene: Scene, rootUrl: string): ShaderMaterial; - } -} - -declare namespace BABYLON { - class FresnelParameters { - isEnabled: boolean; - leftColor: Color3; - rightColor: Color3; - bias: number; - power: number; - clone(): FresnelParameters; - serialize(): any; - static Parse(parsedFresnelParameters: any): FresnelParameters; - } - class StandardMaterial extends Material { - diffuseTexture: BaseTexture; - ambientTexture: BaseTexture; - opacityTexture: BaseTexture; - reflectionTexture: BaseTexture; - emissiveTexture: BaseTexture; - specularTexture: BaseTexture; - bumpTexture: BaseTexture; - lightmapTexture: BaseTexture; - ambientColor: Color3; - diffuseColor: Color3; - specularColor: Color3; - specularPower: number; - emissiveColor: Color3; - useAlphaFromDiffuseTexture: boolean; - useEmissiveAsIllumination: boolean; - linkEmissiveWithDiffuse: boolean; - useReflectionFresnelFromSpecular: boolean; - useSpecularOverAlpha: boolean; - disableLighting: boolean; - roughness: number; - useLightmapAsShadowmap: boolean; - diffuseFresnelParameters: FresnelParameters; - opacityFresnelParameters: FresnelParameters; - reflectionFresnelParameters: FresnelParameters; - emissiveFresnelParameters: FresnelParameters; - useGlossinessFromSpecularMapAlpha: boolean; - private _renderTargets; - private _worldViewProjectionMatrix; - private _globalAmbientColor; - private _renderId; - private _defines; - private _cachedDefines; - private _useLogarithmicDepth; - constructor(name: string, scene: Scene); - useLogarithmicDepth: boolean; - needAlphaBlending(): boolean; - needAlphaTesting(): boolean; - private _shouldUseAlphaFromDiffuseTexture(); - getAlphaTestTexture(): BaseTexture; - private _checkCache(scene, mesh?, useInstances?); - static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: MaterialDefines): boolean; - private static _scaledDiffuse; - private static _scaledSpecular; - static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines): void; - isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; - unbind(): void; - bindOnlyWorldMatrix(world: Matrix): void; - bind(world: Matrix, mesh?: Mesh): void; - getAnimatables(): IAnimatable[]; - dispose(forceDisposeEffect?: boolean): void; - clone(name: string): StandardMaterial; - serialize(): any; - static DiffuseTextureEnabled: boolean; - static AmbientTextureEnabled: boolean; - static OpacityTextureEnabled: boolean; - static ReflectionTextureEnabled: boolean; - static EmissiveTextureEnabled: boolean; - static SpecularTextureEnabled: boolean; - static BumpTextureEnabled: boolean; - static FresnelEnabled: boolean; - static LightmapEnabled: boolean; - static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial; - } -} - -declare namespace BABYLON { - class AbstractMesh extends Node implements IDisposable { - private static _BILLBOARDMODE_NONE; - private static _BILLBOARDMODE_X; - private static _BILLBOARDMODE_Y; - private static _BILLBOARDMODE_Z; - private static _BILLBOARDMODE_ALL; - static BILLBOARDMODE_NONE: number; - static BILLBOARDMODE_X: number; - static BILLBOARDMODE_Y: number; - static BILLBOARDMODE_Z: number; - static BILLBOARDMODE_ALL: number; - definedFacingForward: boolean; - position: Vector3; - rotation: Vector3; - rotationQuaternion: Quaternion; - scaling: Vector3; - billboardMode: number; - visibility: number; - alphaIndex: number; - infiniteDistance: boolean; - isVisible: boolean; - isPickable: boolean; - showBoundingBox: boolean; - showSubMeshesBoundingBox: boolean; - onDispose: any; - isBlocker: boolean; - renderingGroupId: number; - material: Material; - receiveShadows: boolean; - actionManager: ActionManager; - renderOutline: boolean; - outlineColor: Color3; - outlineWidth: number; - renderOverlay: boolean; - overlayColor: Color3; - overlayAlpha: number; - hasVertexAlpha: boolean; - useVertexColors: boolean; - applyFog: boolean; - computeBonesUsingShaders: boolean; - scalingDeterminant: number; - numBoneInfluencers: number; - useOctreeForRenderingSelection: boolean; - useOctreeForPicking: boolean; - useOctreeForCollisions: boolean; - layerMask: number; - alwaysSelectAsActiveMesh: boolean; - _physicImpostor: number; - _physicsMass: number; - _physicsFriction: number; - _physicRestitution: number; - onPhysicsCollide: (collidedMesh: AbstractMesh, contact: any) => void; - private _checkCollisions; - ellipsoid: Vector3; - ellipsoidOffset: Vector3; - private _collider; - private _oldPositionForCollisions; - private _diffPositionForCollisions; - private _newPositionForCollisions; - onCollide: (collidedMesh: AbstractMesh) => void; - onCollisionPositionChange: (newPosition: Vector3) => void; - private _meshToBoneReferal; - edgesWidth: number; - edgesColor: Color4; - _edgesRenderer: EdgesRenderer; - private _localWorld; - _worldMatrix: Matrix; - private _rotateYByPI; - private _absolutePosition; - private _collisionsTransformMatrix; - private _collisionsScalingMatrix; - _positions: Vector3[]; - private _isDirty; - _masterMesh: AbstractMesh; - _materialDefines: MaterialDefines; - _boundingInfo: BoundingInfo; - private _pivotMatrix; - _isDisposed: boolean; - _renderId: number; - subMeshes: SubMesh[]; - _submeshesOctree: Octree; - _intersectionsInProgress: AbstractMesh[]; - private _onAfterWorldMatrixUpdate; - private _isWorldMatrixFrozen; - _unIndexed: boolean; - _poseMatrix: Matrix; - _waitingActions: any; - _waitingFreezeWorldMatrix: boolean; - private _skeleton; - _bonesTransformMatrices: Float32Array; - skeleton: Skeleton; - constructor(name: string, scene: Scene); - updatePoseMatrix(matrix: Matrix): void; - getPoseMatrix(): Matrix; - disableEdgesRendering(): void; - enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): void; - isBlocked: boolean; - getLOD(camera: Camera): AbstractMesh; - getTotalVertices(): number; - getIndices(): number[] | Int32Array; - getVerticesData(kind: string): number[] | Float32Array; - isVerticesDataPresent(kind: string): boolean; - getBoundingInfo(): BoundingInfo; - useBones: boolean; - _preActivate(): void; - _activate(renderId: number): void; - getWorldMatrix(): Matrix; - worldMatrixFromCache: Matrix; - absolutePosition: Vector3; - freezeWorldMatrix(): void; - unfreezeWorldMatrix(): void; - isWorldMatrixFrozen: boolean; - rotate(axis: Vector3, amount: number, space?: Space): void; - translate(axis: Vector3, distance: number, space?: Space): void; - getAbsolutePosition(): Vector3; - setAbsolutePosition(absolutePosition: Vector3): void; - /** - * Perform relative position change from the point of view of behind the front of the mesh. - * This is performed taking into account the meshes current rotation, so you do not have to care. - * Supports definition of mesh facing forward or backward. - * @param {number} amountRight - * @param {number} amountUp - * @param {number} amountForward - */ - movePOV(amountRight: number, amountUp: number, amountForward: number): void; - /** - * Calculate relative position change from the point of view of behind the front of the mesh. - * This is performed taking into account the meshes current rotation, so you do not have to care. - * Supports definition of mesh facing forward or backward. - * @param {number} amountRight - * @param {number} amountUp - * @param {number} amountForward - */ - calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3; - /** - * Perform relative rotation change from the point of view of behind the front of the mesh. - * Supports definition of mesh facing forward or backward. - * @param {number} flipBack - * @param {number} twirlClockwise - * @param {number} tiltRight - */ - rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): void; - /** - * Calculate relative rotation change from the point of view of behind the front of the mesh. - * Supports definition of mesh facing forward or backward. - * @param {number} flipBack - * @param {number} twirlClockwise - * @param {number} tiltRight - */ - calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3; - setPivotMatrix(matrix: Matrix): void; - getPivotMatrix(): Matrix; - _isSynchronized(): boolean; - _initCache(): void; - markAsDirty(property: string): void; - _updateBoundingInfo(): void; - _updateSubMeshesBoundingInfo(matrix: Matrix): void; - computeWorldMatrix(force?: boolean): Matrix; - /** - * If you'd like to be callbacked after the mesh position, rotation or scaling has been updated - * @param func: callback function to add - */ - registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void; - unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void; - setPositionWithLocalVector(vector3: Vector3): void; - getPositionExpressedInLocalSpace(): Vector3; - locallyTranslate(vector3: Vector3): void; - lookAt(targetPoint: Vector3, yawCor: number, pitchCor: number, rollCor: number): void; - attachToBone(bone: Bone, affectedMesh: AbstractMesh): void; - detachFromBone(): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - isCompletelyInFrustum(camera?: Camera): boolean; - intersectsMesh(mesh: AbstractMesh, precise?: boolean): boolean; - intersectsPoint(point: Vector3): boolean; - setPhysicsState(impostor?: any, options?: PhysicsBodyCreationOptions): any; - getPhysicsImpostor(): number; - getPhysicsMass(): number; - getPhysicsFriction(): number; - getPhysicsRestitution(): number; - getPositionInCameraSpace(camera?: Camera): Vector3; - getDistanceToCamera(camera?: Camera): number; - applyImpulse(force: Vector3, contactPoint: Vector3): void; - setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void; - updatePhysicsBodyPosition(): void; - checkCollisions: boolean; - moveWithCollisions(velocity: Vector3): void; - private _onCollisionPositionChange; - /** - * This function will create an octree to help select the right submeshes for rendering, picking and collisions - * Please note that you must have a decent number of submeshes to get performance improvements when using octree - */ - createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree; - _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): void; - _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): void; - _checkCollision(collider: Collider): void; - _generatePointsArray(): boolean; - intersects(ray: Ray, fastCheck?: boolean): PickingInfo; - clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh; - releaseSubMeshes(): void; - dispose(doNotRecurse?: boolean): void; - } -} - -declare namespace BABYLON { - class CSG { - private polygons; - matrix: Matrix; - position: Vector3; - rotation: Vector3; - rotationQuaternion: Quaternion; - scaling: Vector3; - static FromMesh(mesh: Mesh): CSG; - private static FromPolygons(polygons); - clone(): CSG; - private toPolygons(); - union(csg: CSG): CSG; - unionInPlace(csg: CSG): void; - subtract(csg: CSG): CSG; - subtractInPlace(csg: CSG): void; - intersect(csg: CSG): CSG; - intersectInPlace(csg: CSG): void; - inverse(): CSG; - inverseInPlace(): void; - copyTransformAttributes(csg: CSG): CSG; - buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh; - toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh; - } -} - -declare namespace BABYLON { - class Geometry implements IGetSetVerticesData { - id: string; - delayLoadState: number; - delayLoadingFile: string; - onGeometryUpdated: (geometry: Geometry, kind?: string) => void; - private _scene; - private _engine; - private _meshes; - private _totalVertices; - private _indices; - private _vertexBuffers; - private _isDisposed; - private _extend; - _delayInfo: any; - private _indexBuffer; - _boundingInfo: BoundingInfo; - _delayLoadingFunction: (any: any, geometry: Geometry) => void; - _softwareSkinningRenderId: number; - constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh); - extend: { - minimum: Vector3; - maximum: Vector3; - }; - getScene(): Scene; - getEngine(): Engine; - isReady(): boolean; - setAllVerticesData(vertexData: VertexData, updatable?: boolean): void; - setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void; - updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void; - updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean): void; - getTotalVertices(): number; - getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array; - getVertexBuffer(kind: string): VertexBuffer; - getVertexBuffers(): VertexBuffer[]; - isVerticesDataPresent(kind: string): boolean; - getVerticesDataKinds(): string[]; - setIndices(indices: number[] | Int32Array, totalVertices?: number): void; - getTotalIndices(): number; - getIndices(copyWhenShared?: boolean): number[] | Int32Array; - getIndexBuffer(): any; - releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void; - applyToMesh(mesh: Mesh): void; - private _applyToMesh(mesh); - private notifyUpdate(kind?); - load(scene: Scene, onLoaded?: () => void): void; - isDisposed(): boolean; - dispose(): void; - copy(id: string): Geometry; - serialize(): any; - serializeVerticeData(): any; - static ExtractFromMesh(mesh: Mesh, id: string): Geometry; - static RandomId(): string; - static ImportGeometry(parsedGeometry: any, mesh: Mesh): void; - static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Geometry; - } - namespace Geometry.Primitives { - class _Primitive extends Geometry { - private _beingRegenerated; - private _canBeRegenerated; - constructor(id: string, scene: Scene, vertexData?: VertexData, canBeRegenerated?: boolean, mesh?: Mesh); - canBeRegenerated(): boolean; - regenerate(): void; - asNewGeometry(id: string): Geometry; - setAllVerticesData(vertexData: VertexData, updatable?: boolean): void; - setVerticesData(kind: string, data: number[] | Int32Array | Float32Array, updatable?: boolean): void; - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - serialize(): any; - } - class Ribbon extends _Primitive { - pathArray: Vector3[][]; - closeArray: boolean; - closePath: boolean; - offset: number; - side: number; - constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class Box extends _Primitive { - size: number; - side: number; - constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - serialize(): any; - static Parse(parsedBox: any, scene: Scene): Box; - } - class Sphere extends _Primitive { - segments: number; - diameter: number; - side: number; - constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - serialize(): any; - static Parse(parsedSphere: any, scene: Scene): Geometry.Primitives.Sphere; - } - class Disc extends _Primitive { - radius: number; - tessellation: number; - side: number; - constructor(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class Cylinder extends _Primitive { - height: number; - diameterTop: number; - diameterBottom: number; - tessellation: number; - subdivisions: number; - side: number; - constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - serialize(): any; - static Parse(parsedCylinder: any, scene: Scene): Geometry.Primitives.Cylinder; - } - class Torus extends _Primitive { - diameter: number; - thickness: number; - tessellation: number; - side: number; - constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - serialize(): any; - static Parse(parsedTorus: any, scene: Scene): Geometry.Primitives.Torus; - } - class Ground extends _Primitive { - width: number; - height: number; - subdivisions: number; - constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - serialize(): any; - static Parse(parsedGround: any, scene: Scene): Geometry.Primitives.Ground; - } - class TiledGround extends _Primitive { - xmin: number; - zmin: number; - xmax: number; - zmax: number; - subdivisions: { - w: number; - h: number; - }; - precision: { - w: number; - h: number; - }; - constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { - w: number; - h: number; - }, precision: { - w: number; - h: number; - }, canBeRegenerated?: boolean, mesh?: Mesh); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class Plane extends _Primitive { - size: number; - side: number; - constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - serialize(): any; - static Parse(parsedPlane: any, scene: Scene): Geometry.Primitives.Plane; - } - class TorusKnot extends _Primitive { - radius: number; - tube: number; - radialSegments: number; - tubularSegments: number; - p: number; - q: number; - side: number; - constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - serialize(): any; - static Parse(parsedTorusKnot: any, scene: Scene): Geometry.Primitives.TorusKnot; - } - } -} - -declare namespace BABYLON { - class GroundMesh extends Mesh { - generateOctree: boolean; - private _worldInverse; - private _heightQuads; - _subdivisions: number; - _width: number; - _height: number; - _minX: number; - _maxX: number; - _minZ: number; - _maxZ: number; - constructor(name: string, scene: Scene); - subdivisions: number; - optimize(chunksCount: number, octreeBlocksSize?: number): void; - /** - * Returns a height (y) value in the Worl system : - * the ground altitude at the coordinates (x, z) expressed in the World system. - * Returns the ground y position if (x, z) are outside the ground surface. - * Not pertinent if the ground is rotated. - */ - getHeightAtCoordinates(x: number, z: number): number; - /** - * Returns a normalized vector (Vector3) orthogonal to the ground - * at the ground coordinates (x, z) expressed in the World system. - * Returns Vector3(0, 1, 0) if (x, z) are outside the ground surface. - * Not pertinent if the ground is rotated. - */ - getNormalAtCoordinates(x: number, z: number): Vector3; - /** - * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground - * at the ground coordinates (x, z) expressed in the World system. - * Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface. - * Not pertinent if the ground is rotated. - */ - getNormalAtCoordinatesToRef(x: number, z: number, ref: Vector3): void; - private _getFacetAt(x, z); - private _computeHeightQuads(); - } -} - -declare namespace BABYLON { - /** - * Creates an instance based on a source mesh. - */ - class InstancedMesh extends AbstractMesh { - private _sourceMesh; - private _currentLOD; - constructor(name: string, source: Mesh); - receiveShadows: boolean; - material: Material; - visibility: number; - skeleton: Skeleton; - renderingGroupId: number; - getTotalVertices(): number; - sourceMesh: Mesh; - getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array; - isVerticesDataPresent(kind: string): boolean; - getIndices(): number[] | Int32Array; - _positions: Vector3[]; - refreshBoundingInfo(): void; - _preActivate(): void; - _activate(renderId: number): void; - getLOD(camera: Camera): AbstractMesh; - _syncSubMeshes(): void; - _generatePointsArray(): boolean; - clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh; - dispose(doNotRecurse?: boolean): void; - } -} - -declare namespace BABYLON { - class LinesMesh extends Mesh { - color: Color3; - alpha: number; - private _colorShader; - constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean); - material: Material; - isPickable: boolean; - checkCollisions: boolean; - _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void; - _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void; - intersects(ray: Ray, fastCheck?: boolean): any; - dispose(doNotRecurse?: boolean): void; - clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh; - } -} - -declare namespace BABYLON { - class _InstancesBatch { - mustReturn: boolean; - visibleInstances: InstancedMesh[][]; - renderSelf: boolean[]; - } - class Mesh extends AbstractMesh implements IGetSetVerticesData { - static _FRONTSIDE: number; - static _BACKSIDE: number; - static _DOUBLESIDE: number; - static _DEFAULTSIDE: number; - static _NO_CAP: number; - static _CAP_START: number; - static _CAP_END: number; - static _CAP_ALL: number; - static FRONTSIDE: number; - static BACKSIDE: number; - static DOUBLESIDE: number; - static DEFAULTSIDE: number; - static NO_CAP: number; - static CAP_START: number; - static CAP_END: number; - static CAP_ALL: number; - delayLoadState: number; - instances: InstancedMesh[]; - delayLoadingFile: string; - _binaryInfo: any; - private _LODLevels; - onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void; - onBeforeDraw: () => void; - _geometry: Geometry; - private _onBeforeRenderCallbacks; - private _onAfterRenderCallbacks; - _delayInfo: any; - _delayLoadingFunction: (any: any, mesh: Mesh) => void; - _visibleInstances: any; - private _renderIdForInstances; - private _batchCache; - private _worldMatricesInstancesBuffer; - private _worldMatricesInstancesArray; - private _instancesBufferSize; - _shouldGenerateFlatShading: boolean; - private _preActivateId; - private _sideOrientation; - private _areNormalsFrozen; - private _sourcePositions; - private _sourceNormals; - /** - * @constructor - * @param {string} name - The value used by scene.getMeshByName() to do a lookup. - * @param {Scene} scene - The scene to add this mesh to. - * @param {Node} parent - The parent of this mesh, if it has one - * @param {Mesh} source - An optional Mesh from which geometry is shared, cloned. - * @param {boolean} doNotCloneChildren - When cloning, skip cloning child meshes of source, default False. - * When false, achieved by calling a clone(), also passing False. - * This will make creation of children, recursive. - */ - constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean); - hasLODLevels: boolean; - private _sortLODLevels(); - /** - * Add a mesh as LOD level triggered at the given distance. - * @param {number} distance - the distance from the center of the object to show this level - * @param {Mesh} mesh - the mesh to be added as LOD level - * @return {Mesh} this mesh (for chaining) - */ - addLODLevel(distance: number, mesh: Mesh): Mesh; - getLODLevelAtDistance(distance: number): Mesh; - /** - * Remove a mesh from the LOD array - * @param {Mesh} mesh - the mesh to be removed. - * @return {Mesh} this mesh (for chaining) - */ - removeLODLevel(mesh: Mesh): Mesh; - getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh; - geometry: Geometry; - getTotalVertices(): number; - getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array; - getVertexBuffer(kind: any): VertexBuffer; - isVerticesDataPresent(kind: string): boolean; - getVerticesDataKinds(): string[]; - getTotalIndices(): number; - getIndices(copyWhenShared?: boolean): number[] | Int32Array; - isBlocked: boolean; - isReady(): boolean; - isDisposed(): boolean; - sideOrientation: number; - areNormalsFrozen: boolean; - /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */ - freezeNormals(): void; - /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */ - unfreezeNormals(): void; - _preActivate(): void; - _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): void; - refreshBoundingInfo(): void; - _createGlobalSubMesh(): SubMesh; - subdivide(count: number): void; - setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void; - updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void; - updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void; - updateMeshPositions(positionFunction: any, computeNormals?: boolean): void; - makeGeometryUnique(): void; - setIndices(indices: number[] | Int32Array, totalVertices?: number): void; - _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void; - _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void; - registerBeforeRender(func: (mesh: AbstractMesh) => void): void; - unregisterBeforeRender(func: (mesh: AbstractMesh) => void): void; - registerAfterRender(func: (mesh: AbstractMesh) => void): void; - unregisterAfterRender(func: (mesh: AbstractMesh) => void): void; - _getInstancesRenderList(subMeshId: number): _InstancesBatch; - _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: Engine): void; - _processRendering(subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix) => void): void; - render(subMesh: SubMesh, enableAlphaMode: boolean): void; - getEmittedParticleSystems(): ParticleSystem[]; - getHierarchyEmittedParticleSystems(): ParticleSystem[]; - getChildren(): Node[]; - _checkDelayState(): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - setMaterialByID(id: string): void; - getAnimatables(): IAnimatable[]; - bakeTransformIntoVertices(transform: Matrix): void; - bakeCurrentTransformIntoVertices(): void; - _resetPointsArrayCache(): void; - _generatePointsArray(): boolean; - clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): Mesh; - dispose(doNotRecurse?: boolean): void; - applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void): void; - applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void; - convertToFlatShadedMesh(): void; - convertToUnIndexedMesh(): void; - flipFaces(flipNormals?: boolean): void; - createInstance(name: string): InstancedMesh; - synchronizeInstances(): void; - /** - * Simplify the mesh according to the given array of settings. - * Function will return immediately and will simplify async. - * @param settings a collection of simplification settings. - * @param parallelProcessing should all levels calculate parallel or one after the other. - * @param type the type of simplification to run. - * @param successCallback optional success callback to be called after the simplification finished processing all settings. - */ - simplify(settings: Array, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): void; - /** - * Optimization of the mesh's indices, in case a mesh has duplicated vertices. - * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes. - * This should be used together with the simplification to avoid disappearing triangles. - * @param successCallback an optional success callback to be called after the optimization finished. - */ - optimizeIndices(successCallback?: (mesh?: Mesh) => void): void; - static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh; - static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh; - static CreateDisc(name: string, radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any, sideOrientation?: number): Mesh; - static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh; - static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh; - static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh; - static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: any, rotationFunction: any, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh; - static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh; - static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { - w: number; - h: number; - }, precision: { - w: number; - h: number; - }, scene: Scene, updatable?: boolean): Mesh; - static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void): GroundMesh; - static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: { - (i: number, distance: number): number; - }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh; - static CreatePolyhedron(name: string, options: { - type?: number; - size?: number; - sizeX?: number; - sizeY?: number; - sizeZ?: number; - custom?: any; - faceUV?: Vector4[]; - faceColors?: Color4[]; - updatable?: boolean; - sideOrientation?: number; - }, scene: Scene): Mesh; - static CreateIcoSphere(name: string, options: { - radius?: number; - flat?: boolean; - subdivisions?: number; - sideOrientation?: number; - updatable?: boolean; - }, scene: Scene): Mesh; - static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh; - /** - * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh. - */ - setPositionsForCPUSkinning(): Float32Array; - /** - * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh. - */ - setNormalsForCPUSkinning(): Float32Array; - /** - * Update the vertex buffers by applying transformation from the bones - * @param {skeleton} skeleton to apply - */ - applySkeleton(skeleton: Skeleton): Mesh; - static MinMax(meshes: AbstractMesh[]): { - min: Vector3; - max: Vector3; - }; - static Center(meshesOrMinMaxVector: any): Vector3; - /** - * Merge the array of meshes into a single mesh for performance reasons. - * @param {Array} meshes - The vertices source. They should all be of the same material. Entries can empty - * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes - * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true. - * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class. - */ - static MergeMeshes(meshes: Array, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh): Mesh; - } -} - -declare namespace BABYLON { - interface IGetSetVerticesData { - isVerticesDataPresent(kind: string): boolean; - getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Int32Array | Float32Array; - getIndices(copyWhenShared?: boolean): number[] | Int32Array; - setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void; - updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void; - setIndices(indices: number[] | Int32Array): void; - } - class VertexData { - positions: number[] | Float32Array; - normals: number[] | Float32Array; - uvs: number[] | Float32Array; - uvs2: number[] | Float32Array; - uvs3: number[] | Float32Array; - uvs4: number[] | Float32Array; - uvs5: number[] | Float32Array; - uvs6: number[] | Float32Array; - colors: number[] | Float32Array; - matricesIndices: number[] | Float32Array; - matricesWeights: number[] | Float32Array; - matricesIndicesExtra: number[] | Float32Array; - matricesWeightsExtra: number[] | Float32Array; - indices: number[] | Int32Array; - set(data: number[] | Float32Array, kind: string): void; - applyToMesh(mesh: Mesh, updatable?: boolean): void; - applyToGeometry(geometry: Geometry, updatable?: boolean): void; - updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void; - updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void; - private _applyTo(meshOrGeometry, updatable?); - private _update(meshOrGeometry, updateExtends?, makeItUnique?); - transform(matrix: Matrix): void; - merge(other: VertexData): void; - private _mergeElement(source, other); - serialize(): any; - static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean): VertexData; - static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean): VertexData; - private static _ExtractFrom(meshOrGeometry, copyWhenShared?); - static CreateRibbon(options: { - pathArray: Vector3[][]; - closeArray?: boolean; - closePath?: boolean; - offset?: number; - sideOrientation?: number; - }): VertexData; - static CreateBox(options: { - size?: number; - width?: number; - height?: number; - depth?: number; - faceUV?: Vector4[]; - faceColors?: Color4[]; - sideOrientation?: number; - }): VertexData; - static CreateSphere(options: { - segments?: number; - diameter?: number; - diameterX?: number; - diameterY?: number; - diameterZ?: number; - arc?: number; - slice?: number; - sideOrientation?: number; - }): VertexData; - static CreateCylinder(options: { - height?: number; - diameterTop?: number; - diameterBottom?: number; - diameter?: number; - tessellation?: number; - subdivisions?: number; - arc?: number; - faceColors?: Color4[]; - faceUV?: Vector4[]; - hasRings?: boolean; - enclose?: boolean; - sideOrientation?: number; - }): VertexData; - static CreateTorus(options: { - diameter?: number; - thickness?: number; - tessellation?: number; - sideOrientation?: number; - }): VertexData; - static CreateLines(options: { - points: Vector3[]; - }): VertexData; - static CreateDashedLines(options: { - points: Vector3[]; - dashSize?: number; - gapSize?: number; - dashNb?: number; - }): VertexData; - static CreateGround(options: { - width?: number; - height?: number; - subdivisions?: number; - }): VertexData; - static CreateTiledGround(options: { - xmin: number; - zmin: number; - xmax: number; - zmax: number; - subdivisions?: { - w: number; - h: number; - }; - precision?: { - w: number; - h: number; - }; - }): VertexData; - static CreateGroundFromHeightMap(options: { - width: number; - height: number; - subdivisions: number; - minHeight: number; - maxHeight: number; - buffer: Uint8Array; - bufferWidth: number; - bufferHeight: number; - }): VertexData; - static CreatePlane(options: { - size?: number; - width?: number; - height?: number; - sideOrientation?: number; - }): VertexData; - static CreateDisc(options: { - radius?: number; - tessellation?: number; - arc?: number; - sideOrientation?: number; - }): VertexData; - static CreateIcoSphere(options: { - radius?: number; - radiusX?: number; - radiusY?: number; - radiusZ?: number; - flat?: boolean; - subdivisions?: number; - sideOrientation?: number; - }): VertexData; - static CreatePolyhedron(options: { - type?: number; - size?: number; - sizeX?: number; - sizeY?: number; - sizeZ?: number; - custom?: any; - faceUV?: Vector4[]; - faceColors?: Color4[]; - flat?: boolean; - sideOrientation?: number; - }): VertexData; - static CreateTorusKnot(options: { - radius?: number; - tube?: number; - radialSegments?: number; - tubularSegments?: number; - p?: number; - q?: number; - sideOrientation?: number; - }): VertexData; - /** - * @param {any} - positions (number[] or Float32Array) - * @param {any} - indices (number[] or Uint16Array) - * @param {any} - normals (number[] or Float32Array) - */ - static ComputeNormals(positions: any, indices: any, normals: any): void; - private static _ComputeSides(sideOrientation, positions, indices, normals, uvs); - static ImportVertexData(parsedVertexData: any, geometry: Geometry): void; - } -} - -declare namespace BABYLON { - class MeshBuilder { - static CreateBox(name: string, options: { - width?: number; - height?: number; - depth?: number; - faceUV?: Vector4[]; - faceColors?: Color4[]; - sideOrientation?: number; - updatable?: boolean; - }, scene: Scene): Mesh; - static CreateSphere(name: string, options: { - segments?: number; - diameter?: number; - diameterX?: number; - diameterY?: number; - diameterZ?: number; - arc?: number; - slice?: number; - sideOrientation?: number; - updatable?: boolean; - }, scene: any): Mesh; - static CreateDisc(name: string, options: { - radius?: number; - tessellation?: number; - arc?: number; - updatable?: boolean; - sideOrientation?: number; - }, scene: Scene): Mesh; - static CreateIcoSphere(name: string, options: { - radius?: number; - radiusX?: number; - radiusY?: number; - radiusZ?: number; - flat?: boolean; - subdivisions?: number; - sideOrientation?: number; - updatable?: boolean; - }, scene: Scene): Mesh; - static CreateRibbon(name: string, options: { - pathArray: Vector3[][]; - closeArray?: boolean; - closePath?: boolean; - offset?: number; - updatable?: boolean; - sideOrientation?: number; - instance?: Mesh; - }, scene?: Scene): Mesh; - static CreateCylinder(name: string, options: { - height?: number; - diameterTop?: number; - diameterBottom?: number; - diameter?: number; - tessellation?: number; - subdivisions?: number; - arc?: number; - faceColors?: Color4[]; - faceUV?: Vector4[]; - updatable?: boolean; - hasRings?: boolean; - enclose?: boolean; - sideOrientation?: number; - }, scene: any): Mesh; - static CreateTorus(name: string, options: { - diameter?: number; - thickness?: number; - tessellation?: number; - updatable?: boolean; - sideOrientation?: number; - }, scene: any): Mesh; - static CreateTorusKnot(name: string, options: { - radius?: number; - tube?: number; - radialSegments?: number; - tubularSegments?: number; - p?: number; - q?: number; - updatable?: boolean; - sideOrientation?: number; - }, scene: any): Mesh; - static CreateLines(name: string, options: { - points: Vector3[]; - updatable?: boolean; - instance?: LinesMesh; - }, scene: Scene): LinesMesh; - static CreateDashedLines(name: string, options: { - points: Vector3[]; - dashSize?: number; - gapSize?: number; - dashNb?: number; - updatable?: boolean; - instance?: LinesMesh; - }, scene: Scene): LinesMesh; - static ExtrudeShape(name: string, options: { - shape: Vector3[]; - path: Vector3[]; - scale?: number; - rotation?: number; - cap?: number; - updatable?: boolean; - sideOrientation?: number; - instance?: Mesh; - }, scene: Scene): Mesh; - static ExtrudeShapeCustom(name: string, options: { - shape: Vector3[]; - path: Vector3[]; - scaleFunction?:any; - rotationFunction?:any; - ribbonCloseArray?: boolean; - ribbonClosePath?: boolean; - cap?: number; - updatable?: boolean; - sideOrientation?: number; - instance?: Mesh; - }, scene: Scene): Mesh; - static CreateLathe(name: string, options: { - shape: Vector3[]; - radius?: number; - tessellation?: number; - arc?: number; - closed?: boolean; - updatable?: boolean; - sideOrientation?: number; - cap?: number; - }, scene: Scene): Mesh; - static CreatePlane(name: string, options: { - size?: number; - width?: number; - height?: number; - sideOrientation?: number; - updatable?: boolean; - sourcePlane?: Plane; - }, scene: Scene): Mesh; - static CreateGround(name: string, options: { - width?: number; - height?: number; - subdivisions?: number; - updatable?: boolean; - }, scene: any): Mesh; - static CreateTiledGround(name: string, options: { - xmin: number; - zmin: number; - xmax: number; - zmax: number; - subdivisions?: { - w: number; - h: number; - }; - precision?: { - w: number; - h: number; - }; - updatable?: boolean; - }, scene: Scene): Mesh; - static CreateGroundFromHeightMap(name: string, url: string, options: { - width?: number; - height?: number; - subdivisions?: number; - minHeight?: number; - maxHeight?: number; - updatable?: boolean; - onReady?: (mesh: GroundMesh) => void; - }, scene: Scene): GroundMesh; - static CreateTube(name: string, options: { - path: Vector3[]; - radius?: number; - tessellation?: number; - radiusFunction?: { - (i: number, distance: number): number; - }; - cap?: number; - arc?: number; - updatable?: boolean; - sideOrientation?: number; - instance?: Mesh; - }, scene: Scene): Mesh; - static CreatePolyhedron(name: string, options: { - type?: number; - size?: number; - sizeX?: number; - sizeY?: number; - sizeZ?: number; - custom?: any; - faceUV?: Vector4[]; - faceColors?: Color4[]; - flat?: boolean; - updatable?: boolean; - sideOrientation?: number; - }, scene: Scene): Mesh; - static CreateDecal(name: string, sourceMesh: AbstractMesh, options: { - position?: Vector3; - normal?: Vector3; - size?: Vector3; - angle?: number; - }): Mesh; - private static _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance); - } -} - -declare namespace BABYLON.Internals { - class MeshLODLevel { - distance: number; - mesh: Mesh; - constructor(distance: number, mesh: Mesh); - } -} - -declare namespace BABYLON { - /** - * A simplifier interface for future simplification implementations. - */ - interface ISimplifier { - /** - * Simplification of a given mesh according to the given settings. - * Since this requires computation, it is assumed that the function runs async. - * @param settings The settings of the simplification, including quality and distance - * @param successCallback A callback that will be called after the mesh was simplified. - * @param errorCallback in case of an error, this callback will be called. optional. - */ - simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void; - } - /** - * Expected simplification settings. - * Quality should be between 0 and 1 (1 being 100%, 0 being 0%); - */ - interface ISimplificationSettings { - quality: number; - distance: number; - optimizeMesh?: boolean; - } - class SimplificationSettings implements ISimplificationSettings { - quality: number; - distance: number; - optimizeMesh: boolean; - constructor(quality: number, distance: number, optimizeMesh?: boolean); - } - interface ISimplificationTask { - settings: Array; - simplificationType: SimplificationType; - mesh: Mesh; - successCallback?: () => void; - parallelProcessing: boolean; - } - class SimplificationQueue { - private _simplificationArray; - running: any; - constructor(); - addTask(task: ISimplificationTask): void; - executeNext(): void; - runSimplification(task: ISimplificationTask): void; - private getSimplifier(task); - } - /** - * The implemented types of simplification. - * At the moment only Quadratic Error Decimation is implemented. - */ - enum SimplificationType { - QUADRATIC = 0, - } - class DecimationTriangle { - vertices: Array; - normal: Vector3; - error: Array; - deleted: boolean; - isDirty: boolean; - borderFactor: number; - deletePending: boolean; - originalOffset: number; - constructor(vertices: Array); - } - class DecimationVertex { - position: Vector3; - id: any; - q: QuadraticMatrix; - isBorder: boolean; - triangleStart: number; - triangleCount: number; - originalOffsets: Array; - constructor(position: Vector3, id: any); - updatePosition(newPosition: Vector3): void; - } - class QuadraticMatrix { - data: Array; - constructor(data?: Array); - det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number; - addInPlace(matrix: QuadraticMatrix): void; - addArrayInPlace(data: Array): void; - add(matrix: QuadraticMatrix): QuadraticMatrix; - static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix; - static DataFromNumbers(a: number, b: number, c: number, d: number): number[]; - } - class Reference { - vertexId: number; - triangleId: number; - constructor(vertexId: number, triangleId: number); - } - /** - * An implementation of the Quadratic Error simplification algorithm. - * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf - * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS - * @author RaananW - */ - class QuadraticErrorSimplification implements ISimplifier { - private _mesh; - private triangles; - private vertices; - private references; - private initialized; - private _reconstructedMesh; - syncIterations: number; - aggressiveness: number; - decimationIterations: number; - boundingBoxEpsilon: number; - constructor(_mesh: Mesh); - simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void; - private isTriangleOnBoundingBox(triangle); - private runDecimation(settings, submeshIndex, successCallback); - private initWithMesh(submeshIndex, callback, optimizeMesh?); - private init(callback); - private reconstructMesh(submeshIndex); - private initDecimatedMesh(); - private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr); - private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles); - private identifyBorder(); - private updateMesh(identifyBorders?); - private vertexError(q, point); - private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?); - } -} - -declare namespace BABYLON { - class Polygon { - static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[]; - static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[]; - static Parse(input: string): Vector2[]; - static StartingAt(x: number, y: number): Path2; - } - class PolygonMeshBuilder { - private _swctx; - private _points; - private _outlinepoints; - private _holes; - private _name; - private _scene; - constructor(name: string, contours: Path2, scene: Scene); - constructor(name: string, contours: Vector2[], scene: Scene); - addHole(hole: Vector2[]): PolygonMeshBuilder; - build(updatable?: boolean, depth?: number): Mesh; - private addSide(positions, normals, uvs, indices, bounds, points, depth, flip); - } -} - -declare namespace BABYLON { - class SubMesh { - materialIndex: number; - verticesStart: number; - verticesCount: number; - indexStart: any; - indexCount: number; - linesIndexCount: number; - private _mesh; - private _renderingMesh; - private _boundingInfo; - private _linesIndexBuffer; - _lastColliderWorldVertices: Vector3[]; - _trianglePlanes: Plane[]; - _lastColliderTransformMatrix: Matrix; - _renderId: number; - _alphaIndex: number; - _distanceToCamera: number; - _id: number; - constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean); - IsGlobal: boolean; - getBoundingInfo(): BoundingInfo; - getMesh(): AbstractMesh; - getRenderingMesh(): Mesh; - getMaterial(): Material; - refreshBoundingInfo(): void; - _checkCollision(collider: Collider): boolean; - updateBoundingInfo(world: Matrix): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - render(enableAlphaMode: boolean): void; - getLinesIndexBuffer(indices: number[] | Int32Array, engine: any): WebGLBuffer; - canIntersects(ray: Ray): boolean; - intersects(ray: Ray, positions: Vector3[], indices: number[] | Int32Array, fastCheck?: boolean): IntersectionInfo; - clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh; - dispose(): void; - static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh; - } -} - -declare namespace BABYLON { - class VertexBuffer { - private _mesh; - private _engine; - private _buffer; - private _data; - private _updatable; - private _kind; - private _strideSize; - constructor(engine: any, data: number[] | Float32Array, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number); - isUpdatable(): boolean; - getData(): number[] | Float32Array; - getBuffer(): WebGLBuffer; - getStrideSize(): number; - create(data?: number[] | Float32Array): void; - update(data: number[] | Float32Array): void; - updateDirectly(data: Float32Array, offset: number): void; - dispose(): void; - private static _PositionKind; - private static _NormalKind; - private static _UVKind; - private static _UV2Kind; - private static _UV3Kind; - private static _UV4Kind; - private static _UV5Kind; - private static _UV6Kind; - private static _ColorKind; - private static _MatricesIndicesKind; - private static _MatricesWeightsKind; - private static _MatricesIndicesExtraKind; - private static _MatricesWeightsExtraKind; - static PositionKind: string; - static NormalKind: string; - static UVKind: string; - static UV2Kind: string; - static UV3Kind: string; - static UV4Kind: string; - static UV5Kind: string; - static UV6Kind: string; - static ColorKind: string; - static MatricesIndicesKind: string; - static MatricesWeightsKind: string; - static MatricesIndicesExtraKind: string; - static MatricesWeightsExtraKind: string; - } -} - -declare namespace BABYLON { - class Particle { - position: Vector3; - direction: Vector3; - color: Color4; - colorStep: Color4; - lifeTime: number; - age: number; - size: number; - angle: number; - angularSpeed: number; - copyTo(other: Particle): void; - } -} - -declare namespace BABYLON { - class ParticleSystem implements IDisposable { - name: string; - static BLENDMODE_ONEONE: number; - static BLENDMODE_STANDARD: number; - id: string; - renderingGroupId: number; - emitter: any; - emitRate: number; - manualEmitCount: number; - updateSpeed: number; - targetStopDuration: number; - disposeOnStop: boolean; - minEmitPower: number; - maxEmitPower: number; - minLifeTime: number; - maxLifeTime: number; - minSize: number; - maxSize: number; - minAngularSpeed: number; - maxAngularSpeed: number; - particleTexture: Texture; - layerMask: number; - onDispose: () => void; - updateFunction: (particles: Particle[]) => void; - blendMode: number; - forceDepthWrite: boolean; - gravity: Vector3; - direction1: Vector3; - direction2: Vector3; - minEmitBox: Vector3; - maxEmitBox: Vector3; - color1: Color4; - color2: Color4; - colorDead: Color4; - textureMask: Color4; - startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle) => void; - startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle) => void; - private particles; - private _capacity; - private _scene; - private _vertexDeclaration; - private _vertexStrideSize; - private _stockParticles; - private _newPartsExcess; - private _vertexBuffer; - private _indexBuffer; - private _vertices; - private _effect; - private _customEffect; - private _cachedDefines; - private _scaledColorStep; - private _colorDiff; - private _scaledDirection; - private _scaledGravity; - private _currentRenderId; - private _alive; - private _started; - private _stopped; - private _actualFrame; - private _scaledUpdateSpeed; - constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect); - recycleParticle(particle: Particle): void; - getCapacity(): number; - isAlive(): boolean; - isStarted(): boolean; - start(): void; - stop(): void; - _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void; - private _update(newParticles); - private _getEffect(); - animate(): void; - render(): number; - dispose(): void; - clone(name: string, newEmitter: any): ParticleSystem; - serialize(): any; - static Parse(parsedParticleSystem: any, scene: Scene, rootUrl: string): ParticleSystem; - } -} - -declare namespace BABYLON { - class SolidParticle { - idx: number; - color: Color4; - position: Vector3; - rotation: Vector3; - quaternion: Vector4; - scale: Vector3; - uvs: Vector4; - velocity: Vector3; - alive: boolean; - _pos: number; - _model: ModelShape; - shapeId: number; - idxInShape: number; - constructor(particleIndex: number, positionIndex: number, model: ModelShape, shapeId: number, idxInShape: number); - } - class ModelShape { - shapeID: number; - _shape: Vector3[]; - _shapeUV: number[]; - _positionFunction: (particle: SolidParticle, i: number, s: number) => void; - _vertexFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void; - constructor(id: number, shape: Vector3[], shapeUV: number[], posFunction: (particle: SolidParticle, i: number, s: number) => void, vtxFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void); - } -} - -declare namespace BABYLON { - /** - * Full documentation here : http://doc.babylonjs.com/tutorials/Solid_Particle_System - */ - class SolidParticleSystem implements IDisposable { - particles: SolidParticle[]; - nbParticles: number; - billboard: boolean; - counter: number; - name: string; - mesh: Mesh; - vars: any; - pickedParticles: { - idx: number; - faceId: number; - }[]; - private _scene; - private _positions; - private _indices; - private _normals; - private _colors; - private _uvs; - private _positions32; - private _normals32; - private _fixedNormal32; - private _colors32; - private _uvs32; - private _index; - private _updatable; - private _pickable; - private _isVisibilityBoxLocked; - private _alwaysVisible; - private _shapeCounter; - private _copy; - private _shape; - private _shapeUV; - private _color; - private _computeParticleColor; - private _computeParticleTexture; - private _computeParticleRotation; - private _computeParticleVertex; - private _cam_axisZ; - private _cam_axisY; - private _cam_axisX; - private _axisX; - private _axisY; - private _axisZ; - private _camera; - private _particle; - private _fakeCamPos; - private _rotMatrix; - private _invertMatrix; - private _rotated; - private _quaternion; - private _vertex; - private _normal; - private _yaw; - private _pitch; - private _roll; - private _halfroll; - private _halfpitch; - private _halfyaw; - private _sinRoll; - private _cosRoll; - private _sinPitch; - private _cosPitch; - private _sinYaw; - private _cosYaw; - private _w; - /** - * Creates a SPS (Solid Particle System) object. - * @param name the SPS name, this will be the underlying mesh name - * @param updatable (default true) if the SPS must be updatable or immutable - * @param isPickable (default false) if the solid particles must be pickable - */ - constructor(name: string, scene: Scene, options?: { - updatable?: boolean; - isPickable?: boolean; - }); - /** - * Builds the SPS underlying mesh. Returns a standard Mesh. - * If no model shape was added to the SPS, the return mesh is only a single triangular plane. - */ - buildMesh(): Mesh; - private _resetCopy(); - private _meshBuilder(p, shape, positions, meshInd, indices, meshUV, uvs, meshCol, colors, idx, idxInShape, options); - private _posToShape(positions); - private _uvsToShapeUV(uvs); - private _addParticle(idx, idxpos, model, shapeId, idxInShape); - /** - * Adds some particles to the SPS from the model shape. - * Please read the doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#create-an-immutable-sps - * @param mesh any Mesh object that will be used as a model for the solid particles. - * @param nb the number of particles to be created from this model - * @param positionFunction an optional javascript function to called for each particle on SPS creation - * @param vertexFunction an optional javascript function to called for each vertex of each particle on SPS creation - */ - addShape(mesh: Mesh, nb: number, options?: { - positionFunction?: any; - vertexFunction?: any; - }): number; - private _rebuildParticle(particle); - /** - * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed. - */ - rebuildMesh(): void; - /** - * Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc. - * This method calls updateParticle() for each particles of the SPS. - * For an animated SPS, it is usually called within the render loop. - * @param start (default 0) the particle index in the particle array where to start to compute the particle property values - * @param end (default nbParticle - 1) the particle index in the particle array where to stop to compute the particle property values - * @param update (default true) if the mesh must be finally updated on this call after all the particle computations. - */ - setParticles(start?: number, end?: number, update?: boolean): void; - private _quaternionRotationYPR(); - private _quaternionToRotationMatrix(); - /** - * Disposes the SPS - */ - dispose(): void; - /** - * Visibilty helper : Recomputes the visible size according to the mesh bounding box - * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#sps-visibility - */ - refreshVisibleSize(): void; - /** Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box. - * @param size the size (float) of the visibility box - * note : this doesn't lock the SPS mesh bounding box. - * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#sps-visibility - */ - setVisibilityBox(size: number): void; - /** - * True if the SPS is set as always visible - */ - /** - * Sets the SPS as always visible or not - * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#sps-visibility - */ - isAlwaysVisible: boolean; - /** - * True if the SPS visibility box is locked. The underlying mesh bounding box is then not updatable any more. - */ - /** - * Sets the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates. - * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#sps-visibility - */ - isVisibilityBoxLocked: boolean; - /** - * Tells to setParticle() to compute the particle rotations or not. - * Default value : true. The SPS is faster when it's set to false. - * Note : the particle rotations aren't stored values, so setting computeParticleRotation to false will prevents the particle to rotate. - */ - computeParticleRotation: boolean; - /** - * Tells to setParticle() to compute the particle colors or not. - * Default value : true. The SPS is faster when it's set to false. - * Note : the particle colors are stored values, so setting computeParticleColor to false will keep yet the last colors set. - */ - computeParticleColor: boolean; - /** - * Tells to setParticle() to compute the particle textures or not. - * Default value : true. The SPS is faster when it's set to false. - * Note : the particle textures are stored values, so setting computeParticleTexture to false will keep yet the last colors set. - */ - computeParticleTexture: boolean; - /** - * Tells to setParticle() to call the vertex function for each vertex of each particle, or not. - * Default value : false. The SPS is faster when it's set to false. - * Note : the particle custom vertex positions aren't stored values. - */ - computeParticleVertex: boolean; - /** - * This function does nothing. It may be overwritten to set all the particles first values. - * The SPS doesn't call this function, you may have to call it by your own. - * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#particle-management - */ - initParticles(): void; - /** - * This function does nothing. It may be overwritten to recycle a particle. - * The SPS doesn't call this function, you may have to call it by your own. - * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#particle-management - */ - recycleParticle(particle: SolidParticle): SolidParticle; - /** - * Updates a particle : this function should be overwritten by the user. - * It is called on each particle by setParticles(). This is the place to code each particle behavior. - * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#particle-management - * ex : just set a particle position or velocity and recycle conditions - */ - updateParticle(particle: SolidParticle): SolidParticle; - /** - * Updates a vertex of a particle : it can be overwritten by the user. - * This will be called on each vertex particle by setParticles() if computeParticleVertex is set to true only. - * @param particle the current particle - * @param vertex the current index of the current particle - * @param pt the index of the current vertex in the particle shape - * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#update-each-particle-shape - * ex : just set a vertex particle position - */ - updateParticleVertex(particle: SolidParticle, vertex: Vector3, pt: number): Vector3; - /** - * This will be called before any other treatment by setParticles() and will be passed three parameters. - * This does nothing and may be overwritten by the user. - * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle() - * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle() - * @param update the boolean update value actually passed to setParticles() - */ - beforeUpdateParticles(start?: number, stop?: number, update?: boolean): void; - /** - * This will be called by setParticles() after all the other treatments and just before the actual mesh update. - * This will be passed three parameters. - * This does nothing and may be overwritten by the user. - * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle() - * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle() - * @param update the boolean update value actually passed to setParticles() - */ - afterUpdateParticles(start?: number, stop?: number, update?: boolean): void; - } -} - -declare namespace BABYLON { - interface IPhysicsEnginePlugin { - name: string; - initialize(iterations?: number): any; - setGravity(gravity: Vector3): void; - getGravity(): Vector3; - runOneStep(delta: number): void; - registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; - registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; - unregisterMesh(mesh: AbstractMesh): any; - applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; - createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; - dispose(): void; - isSupported(): boolean; - updateBodyPosition(mesh: AbstractMesh): void; - getWorldObject(): any; - getPhysicsBodyOfMesh(mesh: AbstractMesh): any; - } - interface PhysicsBodyCreationOptions { - mass: number; - friction: number; - restitution: number; - } - interface PhysicsCompoundBodyPart { - mesh: Mesh; - impostor: number; - } - class PhysicsEngine { - gravity: Vector3; - private _currentPlugin; - constructor(plugin?: IPhysicsEnginePlugin); - _initialize(gravity?: Vector3): void; - _runOneStep(delta: number): void; - _setGravity(gravity: Vector3): void; - _getGravity(): Vector3; - _registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; - _registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; - _unregisterMesh(mesh: AbstractMesh): void; - _applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; - _createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; - _updateBodyPosition(mesh: AbstractMesh): void; - dispose(): void; - isSupported(): boolean; - getPhysicsBodyOfMesh(mesh: AbstractMesh): any; - getPhysicsPluginName(): string; - static NoImpostor: number; - static SphereImpostor: number; - static BoxImpostor: number; - static PlaneImpostor: number; - static MeshImpostor: number; - static CapsuleImpostor: number; - static ConeImpostor: number; - static CylinderImpostor: number; - static ConvexHullImpostor: number; - static HeightmapImpostor: number; - static Epsilon: number; - } -} - -declare namespace BABYLON { - class AnaglyphPostProcess extends PostProcess { - constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare namespace BABYLON { - class BlackAndWhitePostProcess extends PostProcess { - constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare namespace BABYLON { - class BlurPostProcess extends PostProcess { - direction: Vector2; - blurWidth: number; - constructor(name: string, direction: Vector2, blurWidth: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare namespace BABYLON { - class ColorCorrectionPostProcess extends PostProcess { - private _colorTableTexture; - constructor(name: string, colorTableUrl: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare namespace BABYLON { - class ConvolutionPostProcess extends PostProcess { - kernel: number[]; - constructor(name: string, kernel: number[], ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - static EdgeDetect0Kernel: number[]; - static EdgeDetect1Kernel: number[]; - static EdgeDetect2Kernel: number[]; - static SharpenKernel: number[]; - static EmbossKernel: number[]; - static GaussianKernel: number[]; - } -} - -declare namespace BABYLON { - class DisplayPassPostProcess extends PostProcess { - constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare namespace BABYLON { - class FilterPostProcess extends PostProcess { - kernelMatrix: Matrix; - constructor(name: string, kernelMatrix: Matrix, ratio: number, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare namespace BABYLON { - class FxaaPostProcess extends PostProcess { - texelWidth: number; - texelHeight: number; - constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare namespace BABYLON { - class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable { - /** - * Public members - */ - /** - * Gaussian blur coefficient - * @type {number} - */ - gaussCoeff: number; - /** - * Gaussian blur mean - * @type {number} - */ - gaussMean: number; - /** - * Gaussian blur standard deviation - * @type {number} - */ - gaussStandDev: number; - /** - * Gaussian blur multiplier. Multiplies the blur effect - * @type {number} - */ - gaussMultiplier: number; - /** - * Exposure, controls the overall intensity of the pipeline - * @type {number} - */ - exposure: number; - /** - * Minimum luminance that the post-process can output. Luminance is >= 0 - * @type {number} - */ - minimumLuminance: number; - /** - * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance - * @type {number} - */ - maximumLuminance: number; - /** - * Increase rate for luminance: eye adaptation speed to dark - * @type {number} - */ - luminanceIncreaserate: number; - /** - * Decrease rate for luminance: eye adaptation speed to bright - * @type {number} - */ - luminanceDecreaseRate: number; - /** - * Minimum luminance needed to compute HDR - * @type {number} - */ - brightThreshold: number; - /** - * Private members - */ - private _guassianBlurHPostProcess; - private _guassianBlurVPostProcess; - private _brightPassPostProcess; - private _textureAdderPostProcess; - private _downSampleX4PostProcess; - private _originalPostProcess; - private _hdrPostProcess; - private _hdrCurrentLuminance; - private _hdrOutputLuminance; - static LUM_STEPS: number; - private _downSamplePostProcesses; - private _scene; - private _needUpdate; - /** - * @constructor - * @param {string} name - The rendering pipeline name - * @param {BABYLON.Scene} scene - The scene linked to this pipeline - * @param {any} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) - * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null. - * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to - */ - constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]); - /** - * Tells the pipeline to update its post-processes - */ - update(): void; - /** - * Returns the current calculated luminance - */ - getCurrentLuminance(): number; - /** - * Returns the currently drawn luminance - */ - getOutputLuminance(): number; - /** - * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras - */ - dispose(): void; - /** - * Creates the HDR post-process and computes the luminance adaptation - */ - private _createHDRPostProcess(scene, ratio); - /** - * Texture Adder post-process - */ - private _createTextureAdderPostProcess(scene, ratio); - /** - * Down sample X4 post-process - */ - private _createDownSampleX4PostProcess(scene, ratio); - /** - * Bright pass post-process - */ - private _createBrightPassPostProcess(scene, ratio); - /** - * Luminance generator. Creates the luminance post-process and down sample post-processes - */ - private _createLuminanceGeneratorPostProcess(scene); - /** - * Gaussian blur post-processes. Horizontal and Vertical - */ - private _createGaussianBlurPostProcess(scene, ratio); - } -} - -declare namespace BABYLON { - class LensRenderingPipeline extends PostProcessRenderPipeline { - /** - * The chromatic aberration PostProcess id in the pipeline - * @type {string} - */ - LensChromaticAberrationEffect: string; - /** - * The highlights enhancing PostProcess id in the pipeline - * @type {string} - */ - HighlightsEnhancingEffect: string; - /** - * The depth-of-field PostProcess id in the pipeline - * @type {string} - */ - LensDepthOfFieldEffect: string; - private _scene; - private _depthTexture; - private _grainTexture; - private _chromaticAberrationPostProcess; - private _highlightsPostProcess; - private _depthOfFieldPostProcess; - private _edgeBlur; - private _grainAmount; - private _chromaticAberration; - private _distortion; - private _highlightsGain; - private _highlightsThreshold; - private _dofDistance; - private _dofAperture; - private _dofDarken; - private _dofPentagon; - private _blurNoise; - /** - * @constructor - * - * Effect parameters are as follow: - * { - * chromatic_aberration: number; // from 0 to x (1 for realism) - * edge_blur: number; // from 0 to x (1 for realism) - * distortion: number; // from 0 to x (1 for realism) - * grain_amount: number; // from 0 to 1 - * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise - * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default) - * dof_aperture: number; // depth-of-field: focus blur bias (default: 1) - * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default) - * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect - * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default) - * dof_threshold: number; // depth-of-field: highlights threshold (default: 1) - * blur_noise: boolean; // add a little bit of noise to the blur (default: true) - * } - * Note: if an effect parameter is unset, effect is disabled - * - * @param {string} name - The rendering pipeline name - * @param {object} parameters - An object containing all parameters (see above) - * @param {BABYLON.Scene} scene - The scene linked to this pipeline - * @param {number} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) - * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to - */ - constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]); - setEdgeBlur(amount: number): void; - disableEdgeBlur(): void; - setGrainAmount(amount: number): void; - disableGrain(): void; - setChromaticAberration(amount: number): void; - disableChromaticAberration(): void; - setEdgeDistortion(amount: number): void; - disableEdgeDistortion(): void; - setFocusDistance(amount: number): void; - disableDepthOfField(): void; - setAperture(amount: number): void; - setDarkenOutOfFocus(amount: number): void; - enablePentagonBokeh(): void; - disablePentagonBokeh(): void; - enableNoiseBlur(): void; - disableNoiseBlur(): void; - setHighlightsGain(amount: number): void; - setHighlightsThreshold(amount: number): void; - disableHighlights(): void; - /** - * Removes the internal pipeline assets and detaches the pipeline from the scene cameras - */ - dispose(disableDepthRender?: boolean): void; - private _createChromaticAberrationPostProcess(ratio); - private _createHighlightsPostProcess(ratio); - private _createDepthOfFieldPostProcess(ratio); - private _createGrainTexture(); - } -} - -declare namespace BABYLON { - class PassPostProcess extends PostProcess { - constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare namespace BABYLON { - class PostProcess { - name: string; - onApply: (effect: Effect) => void; - onBeforeRender: (effect: Effect) => void; - onAfterRender: (effect: Effect) => void; - onSizeChanged: () => void; - onActivate: (camera: Camera) => void; - width: number; - height: number; - renderTargetSamplingMode: number; - clearColor: Color4; - private _camera; - private _scene; - private _engine; - private _renderRatio; - private _reusable; - private _textureType; - _textures: SmartArray; - _currentRenderTextureInd: number; - private _effect; - private _samplers; - private _fragmentUrl; - private _parameters; - constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], ratio: number | any, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number); - updateEffect(defines?: string): void; - isReusable(): boolean; - activate(camera: Camera, sourceTexture?: WebGLTexture): void; - isSupported: boolean; - apply(): Effect; - dispose(camera?: Camera): void; - } -} - -declare namespace BABYLON { - class PostProcessManager { - private _scene; - private _indexBuffer; - private _vertexDeclaration; - private _vertexStrideSize; - private _vertexBuffer; - constructor(scene: Scene); - private _prepareBuffers(); - _prepareFrame(sourceTexture?: WebGLTexture): boolean; - directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void; - _finalizeFrame(doNotPresent?: boolean, targetTexture?: WebGLTexture, faceIndex?: number, postProcesses?: PostProcess[]): void; - dispose(): void; - } -} - -declare namespace BABYLON { - class RefractionPostProcess extends PostProcess { - color: Color3; - depth: number; - colorLevel: number; - private _refRexture; - constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - dispose(camera: Camera): void; - } -} - -declare namespace BABYLON { - class SSAORenderingPipeline extends PostProcessRenderPipeline { - /** - * The PassPostProcess id in the pipeline that contains the original scene color - * @type {string} - */ - SSAOOriginalSceneColorEffect: string; - /** - * The SSAO PostProcess id in the pipeline - * @type {string} - */ - SSAORenderEffect: string; - /** - * The horizontal blur PostProcess id in the pipeline - * @type {string} - */ - SSAOBlurHRenderEffect: string; - /** - * The vertical blur PostProcess id in the pipeline - * @type {string} - */ - SSAOBlurVRenderEffect: string; - /** - * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect) - * @type {string} - */ - SSAOCombineRenderEffect: string; - /** - * The output strength of the SSAO post-process. Default value is 1.0. - * @type {number} - */ - totalStrength: number; - /** - * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0006 - * @type {number} - */ - radius: number; - /** - * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel - * Must not be equal to fallOff and superior to fallOff. - * Default value is 0.975 - * @type {number} - */ - area: number; - /** - * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel - * Must not be equal to area and inferior to area. - * Default value is 0.0 - * @type {number} - */ - fallOff: number; - /** - * The base color of the SSAO post-process - * The final result is "base + ssao" between [0, 1] - * @type {number} - */ - base: number; - private _scene; - private _depthTexture; - private _randomTexture; - private _originalColorPostProcess; - private _ssaoPostProcess; - private _blurHPostProcess; - private _blurVPostProcess; - private _ssaoCombinePostProcess; - private _firstUpdate; - /** - * @constructor - * @param {string} name - The rendering pipeline name - * @param {BABYLON.Scene} scene - The scene linked to this pipeline - * @param {any} ratio - The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, combineRatio: 1.0 } - * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to - */ - constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]); - /** - * Returns the horizontal blur PostProcess - * @return {BABYLON.BlurPostProcess} The horizontal blur post-process - */ - getBlurHPostProcess(): BlurPostProcess; - /** - * Returns the vertical blur PostProcess - * @return {BABYLON.BlurPostProcess} The vertical blur post-process - */ - getBlurVPostProcess(): BlurPostProcess; - /** - * Removes the internal pipeline assets and detatches the pipeline from the scene cameras - */ - dispose(disableDepthRender?: boolean): void; - private _createSSAOPostProcess(ratio); - private _createSSAOCombinePostProcess(ratio); - private _createRandomTexture(); - } -} - -declare namespace BABYLON { - class StereoscopicInterlacePostProcess extends PostProcess { - private _stepSize; - constructor(name: string, camB: Camera, postProcessA: PostProcess, isStereoscopicHoriz: boolean, samplingMode?: number); - } -} - -declare namespace BABYLON { - enum TonemappingOperator { - Hable = 0, - Reinhard = 1, - HejiDawson = 2, - Photographic = 3, - } - class TonemapPostProcess extends PostProcess { - private _operator; - private _exposureAdjustment; - constructor(name: string, operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number); - } -} - -declare namespace BABYLON { - class VolumetricLightScatteringPostProcess extends PostProcess { - private _volumetricLightScatteringPass; - private _volumetricLightScatteringRTT; - private _viewPort; - private _screenCoordinates; - private _cachedDefines; - private _customMeshPosition; - /** - * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false) - * @type {boolean} - */ - useCustomMeshPosition: boolean; - /** - * If the post-process should inverse the light scattering direction - * @type {boolean} - */ - invert: boolean; - /** - * The internal mesh used by the post-process - * @type {boolean} - */ - mesh: Mesh; - /** - * Set to true to use the diffuseColor instead of the diffuseTexture - * @type {boolean} - */ - useDiffuseColor: boolean; - /** - * Array containing the excluded meshes not rendered in the internal pass - */ - excludedMeshes: AbstractMesh[]; - /** - * Controls the overall intensity of the post-process - * @type {number} - */ - exposure: number; - /** - * Dissipates each sample's contribution in range [0, 1] - * @type {number} - */ - decay: number; - /** - * Controls the overall intensity of each sample - * @type {number} - */ - weight: number; - /** - * Controls the density of each sample - * @type {number} - */ - density: number; - /** - * @constructor - * @param {string} name - The post-process name - * @param {any} ratio - The size of the post-process and/or internal pass (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) - * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to - * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering - * @param {number} samples - The post-process quality, default 100 - * @param {number} samplingMode - The post-process filtering mode - * @param {BABYLON.Engine} engine - The babylon engine - * @param {boolean} reusable - If the post-process is reusable - * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided - */ - constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene); - isReady(subMesh: SubMesh, useInstances: boolean): boolean; - /** - * Sets the new light position for light scattering effect - * @param {BABYLON.Vector3} The new custom light position - */ - setCustomMeshPosition(position: Vector3): void; - /** - * Returns the light position for light scattering effect - * @return {BABYLON.Vector3} The custom light position - */ - getCustomMeshPosition(): Vector3; - /** - * Disposes the internal assets and detaches the post-process from the camera - */ - dispose(camera: Camera): void; - /** - * Returns the render target texture used by the post-process - * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process - */ - getPass(): RenderTargetTexture; - private _meshExcluded(mesh); - private _createPass(scene, ratio); - private _updateMeshScreenCoordinates(scene); - /** - * Creates a default mesh for the Volumeric Light Scattering post-process - * @param {string} The mesh name - * @param {BABYLON.Scene} The scene where to create the mesh - * @return {BABYLON.Mesh} the default mesh - */ - static CreateDefaultMesh(name: string, scene: Scene): Mesh; - } -} - -declare namespace BABYLON { - class VRDistortionCorrectionPostProcess extends PostProcess { - aspectRatio: number; - private _isRightEye; - private _distortionFactors; - private _postProcessScaleFactor; - private _lensCenterOffset; - private _scaleIn; - private _scaleFactor; - private _lensCenter; - constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics); - } -} - -declare namespace BABYLON { - class ReflectionProbe { - name: string; - private _scene; - private _renderTargetTexture; - private _projectionMatrix; - private _viewMatrix; - private _target; - private _add; - private _attachedMesh; - position: Vector3; - constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean); - refreshRate: number; - getScene(): Scene; - cubeTexture: RenderTargetTexture; - renderList: AbstractMesh[]; - attachToMesh(mesh: AbstractMesh): void; - dispose(): void; - } -} - -declare namespace BABYLON { - class BoundingBoxRenderer { - frontColor: Color3; - backColor: Color3; - showBackLines: boolean; - renderList: SmartArray; - private _scene; - private _colorShader; - private _vb; - private _ib; - constructor(scene: Scene); - private _prepareRessources(); - reset(): void; - render(): void; - dispose(): void; - } -} - -declare namespace BABYLON { - class DepthRenderer { - private _scene; - private _depthMap; - private _effect; - private _viewMatrix; - private _projectionMatrix; - private _transformMatrix; - private _worldViewProjection; - private _cachedDefines; - constructor(scene: Scene, type?: number); - isReady(subMesh: SubMesh, useInstances: boolean): boolean; - getDepthMap(): RenderTargetTexture; - dispose(): void; - } -} - -declare namespace BABYLON { - class EdgesRenderer { - edgesWidthScalerForOrthographic: number; - edgesWidthScalerForPerspective: number; - private _source; - private _linesPositions; - private _linesNormals; - private _linesIndices; - private _epsilon; - private _indicesCount; - private _lineShader; - private _vb0; - private _vb1; - private _ib; - private _buffers; - private _checkVerticesInsteadOfIndices; - constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean); - private _prepareRessources(); - dispose(): void; - private _processEdgeForAdjacencies(pa, pb, p0, p1, p2); - private _processEdgeForAdjacenciesWithVertices(pa, pb, p0, p1, p2); - private _checkEdge(faceIndex, edge, faceNormals, p0, p1); - _generateEdgesLines(): void; - render(): void; - } -} - -declare namespace BABYLON { - class OutlineRenderer { - private _scene; - private _effect; - private _cachedDefines; - constructor(scene: Scene); - render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void; - isReady(subMesh: SubMesh, useInstances: boolean): boolean; - } -} - -declare namespace BABYLON { - class RenderingGroup { - index: number; - private _scene; - private _opaqueSubMeshes; - private _transparentSubMeshes; - private _alphaTestSubMeshes; - private _activeVertices; - onBeforeTransparentRendering: () => void; - constructor(index: number, scene: Scene); - render(customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray) => void): boolean; - prepare(): void; - dispatch(subMesh: SubMesh): void; - } -} - -declare namespace BABYLON { - class RenderingManager { - static MAX_RENDERINGGROUPS: number; - private _scene; - private _renderingGroups; - private _depthBufferAlreadyCleaned; - private _currentIndex; - private _currentActiveMeshes; - private _currentRenderParticles; - private _currentRenderSprites; - constructor(scene: Scene); - private _renderParticles(index, activeMeshes); - private _renderSprites(index); - private _clearDepthBuffer(); - private _renderSpritesAndParticles(); - render(customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void; - reset(): void; - dispatch(subMesh: SubMesh): void; - } -} - -declare namespace BABYLON { - class Sprite { - name: string; - position: Vector3; - color: Color4; - width: number; - height: number; - angle: number; - cellIndex: number; - invertU: number; - invertV: number; - disposeWhenFinishedAnimating: boolean; - animations: Animation[]; - isPickable: boolean; - actionManager: ActionManager; - private _animationStarted; - private _loopAnimation; - private _fromIndex; - private _toIndex; - private _delay; - private _direction; - private _frameCount; - private _manager; - private _time; - size: number; - constructor(name: string, manager: SpriteManager); - playAnimation(from: number, to: number, loop: boolean, delay: number): void; - stopAnimation(): void; - _animate(deltaTime: number): void; - dispose(): void; - } -} - -declare namespace BABYLON { - class SpriteManager { - name: string; - cellSize: number; - sprites: Sprite[]; - renderingGroupId: number; - layerMask: number; - onDispose: () => void; - fogEnabled: boolean; - isPickable: boolean; - private _capacity; - private _spriteTexture; - private _epsilon; - private _scene; - private _vertexDeclaration; - private _vertexStrideSize; - private _vertexBuffer; - private _indexBuffer; - private _vertices; - private _effectBase; - private _effectFog; - constructor(name: string, imgUrl: string, capacity: number, cellSize: number, scene: Scene, epsilon?: number, samplingMode?: number); - private _appendSpriteVertex(index, sprite, offsetX, offsetY, rowSize); - intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): PickingInfo; - render(): void; - dispose(): void; - } -} - -declare namespace BABYLON.Internals { - class AndOrNotEvaluator { - static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean; - private static _HandleParenthesisContent(parenthesisContent, evaluateCallback); - private static _SimplifyNegation(booleanString); - } -} - -declare namespace BABYLON { - interface IAssetTask { - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - run(scene: Scene, onSuccess: () => void, onError: () => void): any; - } - class MeshAssetTask implements IAssetTask { - name: string; - meshesNames: any; - rootUrl: string; - sceneFilename: string; - loadedMeshes: Array; - loadedParticleSystems: Array; - loadedSkeletons: Array; - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string); - run(scene: Scene, onSuccess: () => void, onError: () => void): void; - } - class TextFileAssetTask implements IAssetTask { - name: string; - url: string; - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - text: string; - constructor(name: string, url: string); - run(scene: Scene, onSuccess: () => void, onError: () => void): void; - } - class BinaryFileAssetTask implements IAssetTask { - name: string; - url: string; - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - data: ArrayBuffer; - constructor(name: string, url: string); - run(scene: Scene, onSuccess: () => void, onError: () => void): void; - } - class ImageAssetTask implements IAssetTask { - name: string; - url: string; - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - image: HTMLImageElement; - constructor(name: string, url: string); - run(scene: Scene, onSuccess: () => void, onError: () => void): void; - } - class TextureAssetTask implements IAssetTask { - name: string; - url: string; - noMipmap: boolean; - invertY: boolean; - samplingMode: number; - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - texture: Texture; - constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number); - run(scene: Scene, onSuccess: () => void, onError: () => void): void; - } - class AssetsManager { - private _tasks; - private _scene; - private _waitingTasksCount; - onFinish: (tasks: IAssetTask[]) => void; - onTaskSuccess: (task: IAssetTask) => void; - onTaskError: (task: IAssetTask) => void; - useDefaultLoadingScreen: boolean; - constructor(scene: Scene); - addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask; - addTextFileTask(taskName: string, url: string): IAssetTask; - addBinaryFileTask(taskName: string, url: string): IAssetTask; - addImageTask(taskName: string, url: string): IAssetTask; - addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): IAssetTask; - private _decreaseWaitingTasksCount(); - private _runTask(task); - reset(): AssetsManager; - load(): AssetsManager; - } -} - -declare namespace BABYLON { - class Database { - private callbackManifestChecked; - private currentSceneUrl; - private db; - private enableSceneOffline; - private enableTexturesOffline; - private manifestVersionFound; - private mustUpdateRessources; - private hasReachedQuota; - private isSupported; - private idbFactory; - static IsUASupportingBlobStorage: boolean; - static IDBStorageEnabled: boolean; - constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any); - static parseURL: (url: string) => string; - static ReturnFullUrlLocation: (url: string) => string; - checkManifestFile(): void; - openAsync(successCallback: any, errorCallback: any): void; - loadImageFromDB(url: string, image: HTMLImageElement): void; - private _loadImageFromDBAsync(url, image, notInDBCallback); - private _saveImageIntoDBAsync(url, image); - private _checkVersionFromDB(url, versionLoaded); - private _loadVersionFromDBAsync(url, callback, updateInDBCallback); - private _saveVersionIntoDBAsync(url, callback); - private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?); - private _loadFileFromDBAsync(url, callback, notInDBCallback, useArrayBuffer?); - private _saveFileIntoDBAsync(url, callback, progressCallback, useArrayBuffer?); - } -} - -declare namespace BABYLON { - class FilesInput { - private _engine; - private _currentScene; - private _canvas; - private _sceneLoadedCallback; - private _progressCallback; - private _additionnalRenderLoopLogicCallback; - private _textureLoadingCallback; - private _startingProcessingFilesCallback; - private _elementToMonitor; - static FilesTextures: any[]; - static FilesToLoad: any[]; - private _sceneFileToLoad; - private _filesToLoad; - constructor(p_engine: Engine, p_scene: Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback: any, p_progressCallback: any, p_additionnalRenderLoopLogicCallback: any, p_textureLoadingCallback: any, p_startingProcessingFilesCallback: any); - monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void; - private renderFunction(); - private drag(e); - private drop(eventDrop); - loadFiles(event: any): void; - reload(): void; - } -} - -declare namespace BABYLON { - class Gamepads { - private babylonGamepads; - private oneGamepadConnected; - private isMonitoring; - private gamepadEventSupported; - private gamepadSupportAvailable; - private _callbackGamepadConnected; - private static gamepadDOMInfo; - constructor(ongamedpadconnected: (gamepad: Gamepad) => void); - dispose(): void; - private _onGamepadConnected(evt); - private _addNewGamepad(gamepad); - private _onGamepadDisconnected(evt); - private _startMonitoringGamepads(); - private _stopMonitoringGamepads(); - private _checkGamepadsStatus(); - private _updateGamepadObjects(); - } - class StickValues { - x: any; - y: any; - constructor(x: any, y: any); - } - class Gamepad { - id: string; - index: number; - browserGamepad: any; - private _leftStick; - private _rightStick; - private _onleftstickchanged; - private _onrightstickchanged; - constructor(id: string, index: number, browserGamepad: any); - onleftstickchanged(callback: (values: StickValues) => void): void; - onrightstickchanged(callback: (values: StickValues) => void): void; - leftStick: StickValues; - rightStick: StickValues; - update(): void; - } - class GenericPad extends Gamepad { - id: string; - index: number; - gamepad: any; - private _buttons; - private _onbuttondown; - private _onbuttonup; - onbuttondown(callback: (buttonPressed: number) => void): void; - onbuttonup(callback: (buttonReleased: number) => void): void; - constructor(id: string, index: number, gamepad: any); - private _setButtonValue(newValue, currentValue, buttonIndex); - update(): void; - } - enum Xbox360Button { - A = 0, - B = 1, - X = 2, - Y = 3, - Start = 4, - Back = 5, - LB = 6, - RB = 7, - LeftStick = 8, - RightStick = 9, - } - enum Xbox360Dpad { - Up = 0, - Down = 1, - Left = 2, - Right = 3, - } - class Xbox360Pad extends Gamepad { - private _leftTrigger; - private _rightTrigger; - private _onlefttriggerchanged; - private _onrighttriggerchanged; - private _onbuttondown; - private _onbuttonup; - private _ondpaddown; - private _ondpadup; - private _buttonA; - private _buttonB; - private _buttonX; - private _buttonY; - private _buttonBack; - private _buttonStart; - private _buttonLB; - private _buttonRB; - private _buttonLeftStick; - private _buttonRightStick; - private _dPadUp; - private _dPadDown; - private _dPadLeft; - private _dPadRight; - onlefttriggerchanged(callback: (value: number) => void): void; - onrighttriggerchanged(callback: (value: number) => void): void; - leftTrigger: number; - rightTrigger: number; - onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void; - onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void; - ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void; - ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void; - private _setButtonValue(newValue, currentValue, buttonType); - private _setDPadValue(newValue, currentValue, buttonType); - buttonA: number; - buttonB: number; - buttonX: number; - buttonY: number; - buttonStart: number; - buttonBack: number; - buttonLB: number; - buttonRB: number; - buttonLeftStick: number; - buttonRightStick: number; - dPadUp: number; - dPadDown: number; - dPadLeft: number; - dPadRight: number; - update(): void; - } -} -interface Navigator { - getGamepads(func?: any): any; - webkitGetGamepads(func?: any): any; - msGetGamepads(func?: any): any; - webkitGamepads(func?: any): any; -} - -declare namespace BABYLON { - interface ILoadingScreen { - displayLoadingUI: () => void; - hideLoadingUI: () => void; - loadingUIBackgroundColor: string; - loadingUIText: string; - } - class DefaultLoadingScreen implements ILoadingScreen { - private _renderingCanvas; - private _loadingText; - private _loadingDivBackgroundColor; - private _loadingDiv; - private _loadingTextDiv; - constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string); - displayLoadingUI(): void; - hideLoadingUI(): void; - loadingUIText: string; - loadingUIBackgroundColor: string; - private _resizeLoadingUI; - } -} - -declare namespace BABYLON { - class SceneOptimization { - priority: number; - apply: (scene: Scene) => boolean; - constructor(priority?: number); - } - class TextureOptimization extends SceneOptimization { - priority: number; - maximumSize: number; - constructor(priority?: number, maximumSize?: number); - apply: (scene: Scene) => boolean; - } - class HardwareScalingOptimization extends SceneOptimization { - priority: number; - maximumScale: number; - private _currentScale; - constructor(priority?: number, maximumScale?: number); - apply: (scene: Scene) => boolean; - } - class ShadowsOptimization extends SceneOptimization { - apply: (scene: Scene) => boolean; - } - class PostProcessesOptimization extends SceneOptimization { - apply: (scene: Scene) => boolean; - } - class LensFlaresOptimization extends SceneOptimization { - apply: (scene: Scene) => boolean; - } - class ParticlesOptimization extends SceneOptimization { - apply: (scene: Scene) => boolean; - } - class RenderTargetsOptimization extends SceneOptimization { - apply: (scene: Scene) => boolean; - } - class MergeMeshesOptimization extends SceneOptimization { - static _UpdateSelectionTree: boolean; - static UpdateSelectionTree: boolean; - private _canBeMerged; - apply: (scene: Scene, updateSelectionTree?: boolean) => boolean; - } - class SceneOptimizerOptions { - targetFrameRate: number; - trackerDuration: number; - optimizations: SceneOptimization[]; - constructor(targetFrameRate?: number, trackerDuration?: number); - static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; - static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; - static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; - } - class SceneOptimizer { - static _CheckCurrentState(scene: Scene, options: SceneOptimizerOptions, currentPriorityLevel: number, onSuccess?: () => void, onFailure?: () => void): void; - static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void; - } -} - -declare namespace BABYLON { - class SceneSerializer { - static Serialize(scene: Scene): any; - static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any; - } -} - -declare namespace BABYLON { - class SmartArray { - data: Array; - length: number; - private _id; - private _duplicateId; - constructor(capacity: number); - push(value: any): void; - pushNoDuplicate(value: any): void; - sort(compareFn: any): void; - reset(): void; - concat(array: any): void; - concatWithNoDuplicate(array: any): void; - indexOf(value: any): number; - private static _GlobalId; - } -} - -declare namespace BABYLON { - class SmartCollection { - count: number; - items: any; - private _keys; - private _initialCapacity; - constructor(capacity?: number); - add(key: any, item: any): number; - remove(key: any): number; - removeItemOfIndex(index: number): number; - indexOf(key: any): number; - item(key: any): any; - getAllKeys(): any[]; - getKeyByIndex(index: number): any; - getItemByIndex(index: number): any; - empty(): void; - forEach(block: (item: any) => void): void; - } -} - -declare namespace BABYLON { - class Tags { - static EnableFor(obj: any): void; - static DisableFor(obj: any): void; - static HasTags(obj: any): boolean; - static GetTags(obj: any, asString?: boolean): any; - static AddTagsTo(obj: any, tagsString: string): void; - static _AddTagTo(obj: any, tag: string): void; - static RemoveTagsFrom(obj: any, tagsString: string): void; - static _RemoveTagFrom(obj: any, tag: string): void; - static MatchesQuery(obj: any, tagsQuery: string): boolean; - } -} - -declare namespace BABYLON.Internals { - interface DDSInfo { - width: number; - height: number; - mipmapCount: number; - isFourCC: boolean; - isRGB: boolean; - isLuminance: boolean; - isCube: boolean; - } - class DDSTools { - static GetDDSInfo(arrayBuffer: any): DDSInfo; - private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); - private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); - private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); - static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void; - } -} - -declare namespace BABYLON.Internals { - class TGATools { - private static _TYPE_NO_DATA; - private static _TYPE_INDEXED; - private static _TYPE_RGB; - private static _TYPE_GREY; - private static _TYPE_RLE_INDEXED; - private static _TYPE_RLE_RGB; - private static _TYPE_RLE_GREY; - private static _ORIGIN_MASK; - private static _ORIGIN_SHIFT; - private static _ORIGIN_BL; - private static _ORIGIN_BR; - private static _ORIGIN_UL; - private static _ORIGIN_UR; - static GetTGAHeader(data: Uint8Array): any; - static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void; - static _getImageData8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - static _getImageData16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - static _getImageData24bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - static _getImageData32bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - static _getImageDataGrey8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - static _getImageDataGrey16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - } -} - -declare namespace BABYLON { - interface IAnimatable { - animations: Array; - } - interface ISize { - width: number; - height: number; - } - class Tools { - static BaseUrl: string; - static CorsBehavior: any; - static UseFallbackTexture: boolean; - static Instantiate(className: string): any; - static GetConstructorName(obj: any): any; - static ToHex(i: number): string; - static SetImmediate(action: () => void): void; - static IsExponentOfTwo(value: number): boolean; - static GetExponentOfTwo(value: number, max: number): number; - static GetFilename(path: string): string; - static GetDOMTextContent(element: HTMLElement): string; - static ToDegrees(angle: number): number; - static ToRadians(angle: number): number; - static EncodeArrayBufferTobase64(buffer: ArrayBuffer): string; - static ExtractMinAndMaxIndexed(positions: number[] | Float32Array, indices: number[] | Int32Array, indexStart: number, indexCount: number): { - minimum: Vector3; - maximum: Vector3; - }; - static ExtractMinAndMax(positions: number[] | Float32Array, start: number, count: number): { - minimum: Vector3; - maximum: Vector3; - }; - static MakeArray(obj: any, allowsNullUndefined?: boolean): Array; - static GetPointerPrefix(): string; - static QueueNewFrame(func: any): void; - static RequestFullscreen(element: any): void; - static ExitFullscreen(): void; - static CleanUrl(url: string): string; - static LoadImage(url: any, onload: any, onerror: any, database: any): HTMLImageElement; - static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void; - static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void; - static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void; - static FileAsURL(content: string): string; - static Clamp(value: number, min?: number, max?: number): number; - static Sign(value: number): number; - static Format(value: number, decimals?: number): string; - static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void; - static WithinEpsilon(a: number, b: number, epsilon?: number): boolean; - static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void; - static IsEmpty(obj: any): boolean; - static RegisterTopRootEvents(events: { - name: string; - handler: EventListener; - }[]): void; - static UnregisterTopRootEvents(events: { - name: string; - handler: EventListener; - }[]): void; - static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void): void; - static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void): void; - static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean; - private static _NoneLogLevel; - private static _MessageLogLevel; - private static _WarningLogLevel; - private static _ErrorLogLevel; - private static _LogCache; - static errorsCount: number; - static OnNewCacheEntry: (entry: string) => void; - static NoneLogLevel: number; - static MessageLogLevel: number; - static WarningLogLevel: number; - static ErrorLogLevel: number; - static AllLogLevel: number; - private static _AddLogEntry(entry); - private static _FormatMessage(message); - static Log: (message: string) => void; - private static _LogDisabled(message); - private static _LogEnabled(message); - static Warn: (message: string) => void; - private static _WarnDisabled(message); - private static _WarnEnabled(message); - static Error: (message: string) => void; - private static _ErrorDisabled(message); - private static _ErrorEnabled(message); - static LogCache: string; - static ClearLogCache(): void; - static LogLevels: number; - private static _PerformanceNoneLogLevel; - private static _PerformanceUserMarkLogLevel; - private static _PerformanceConsoleLogLevel; - private static _performance; - static PerformanceNoneLogLevel: number; - static PerformanceUserMarkLogLevel: number; - static PerformanceConsoleLogLevel: number; - static PerformanceLogLevel: number; - static _StartPerformanceCounterDisabled(counterName: string, condition?: boolean): void; - static _EndPerformanceCounterDisabled(counterName: string, condition?: boolean): void; - static _StartUserMark(counterName: string, condition?: boolean): void; - static _EndUserMark(counterName: string, condition?: boolean): void; - static _StartPerformanceConsole(counterName: string, condition?: boolean): void; - static _EndPerformanceConsole(counterName: string, condition?: boolean): void; - static StartPerformanceCounter: (counterName: string, condition?: boolean) => void; - static EndPerformanceCounter: (counterName: string, condition?: boolean) => void; - static Now: number; - } - /** - * An implementation of a loop for asynchronous functions. - */ - class AsyncLoop { - iterations: number; - private _fn; - private _successCallback; - index: number; - private _done; - /** - * Constroctor. - * @param iterations the number of iterations. - * @param _fn the function to run each iteration - * @param _successCallback the callback that will be called upon succesful execution - * @param offset starting offset. - */ - constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number); - /** - * Execute the next iteration. Must be called after the last iteration was finished. - */ - executeNext(): void; - /** - * Break the loop and run the success callback. - */ - breakLoop(): void; - /** - * Helper function - */ - static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop; - /** - * A for-loop that will run a given number of iterations synchronous and the rest async. - * @param iterations total number of iterations - * @param syncedIterations number of synchronous iterations in each async iteration. - * @param fn the function to call each iteration. - * @param callback a success call back that will be called when iterating stops. - * @param breakFunction a break condition (optional) - * @param timeout timeout settings for the setTimeout function. default - 0. - * @constructor - */ - static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void; - } -} - -declare namespace BABYLON { - enum JoystickAxis { - X = 0, - Y = 1, - Z = 2, - } - class VirtualJoystick { - reverseLeftRight: boolean; - reverseUpDown: boolean; - deltaPosition: Vector3; - pressed: boolean; - private static _globalJoystickIndex; - private static vjCanvas; - private static vjCanvasContext; - private static vjCanvasWidth; - private static vjCanvasHeight; - private static halfWidth; - private static halfHeight; - private _action; - private _axisTargetedByLeftAndRight; - private _axisTargetedByUpAndDown; - private _joystickSensibility; - private _inversedSensibility; - private _rotationSpeed; - private _inverseRotationSpeed; - private _rotateOnAxisRelativeToMesh; - private _joystickPointerID; - private _joystickColor; - private _joystickPointerPos; - private _joystickPreviousPointerPos; - private _joystickPointerStartPos; - private _deltaJoystickVector; - private _leftJoystick; - private _joystickIndex; - private _touches; - private _onPointerDownHandlerRef; - private _onPointerMoveHandlerRef; - private _onPointerUpHandlerRef; - private _onPointerOutHandlerRef; - private _onResize; - constructor(leftJoystick?: boolean); - setJoystickSensibility(newJoystickSensibility: number): void; - private _onPointerDown(e); - private _onPointerMove(e); - private _onPointerUp(e); - /** - * Change the color of the virtual joystick - * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000") - */ - setJoystickColor(newColor: string): void; - setActionOnTouch(action: () => any): void; - setAxisForLeftRight(axis: JoystickAxis): void; - setAxisForUpDown(axis: JoystickAxis): void; - private _clearCanvas(); - private _drawVirtualJoystick(); - releaseCanvas(): void; - } -} - -declare namespace BABYLON { - class VRDeviceOrientationFreeCamera extends FreeCamera { - _alpha: number; - _beta: number; - _gamma: number; - private _offsetOrientation; - private _deviceOrientationHandler; - constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean); - _onOrientationEvent(evt: DeviceOrientationEvent): void; - attachControl(element: HTMLElement, noPreventDefault?: boolean): void; - detachControl(element: HTMLElement): void; - } -} - -declare var HMDVRDevice: any; -declare var PositionSensorVRDevice: any; -declare namespace BABYLON { - class WebVRFreeCamera extends FreeCamera { - _hmdDevice: any; - _sensorDevice: any; - _cacheState: any; - _cacheQuaternion: Quaternion; - _cacheRotation: Vector3; - _vrEnabled: boolean; - constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean); - private _getWebVRDevices(devices); - _checkInputs(): void; - attachControl(element: HTMLElement, noPreventDefault?: boolean): void; - detachControl(element: HTMLElement): void; - } -} - -declare namespace BABYLON { - interface IOctreeContainer { - blocks: Array>; - } - class Octree { - maxDepth: number; - blocks: Array>; - dynamicContent: T[]; - private _maxBlockCapacity; - private _selectionContent; - private _creationFunc; - constructor(creationFunc: (entry: T, block: OctreeBlock) => void, maxBlockCapacity?: number, maxDepth?: number); - update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void; - addMesh(entry: T): void; - select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray; - intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray; - intersectsRay(ray: Ray): SmartArray; - static _CreateBlocks(worldMin: Vector3, worldMax: Vector3, entries: T[], maxBlockCapacity: number, currentDepth: number, maxDepth: number, target: IOctreeContainer, creationFunc: (entry: T, block: OctreeBlock) => void): void; - static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock) => void; - static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock) => void; - } -} - -declare namespace BABYLON { - class OctreeBlock { - entries: T[]; - blocks: Array>; - private _depth; - private _maxDepth; - private _capacity; - private _minPoint; - private _maxPoint; - private _boundingVectors; - private _creationFunc; - constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock) => void); - capacity: number; - minPoint: Vector3; - maxPoint: Vector3; - addEntry(entry: T): void; - addEntries(entries: T[]): void; - select(frustumPlanes: Plane[], selection: SmartArray, allowDuplicate?: boolean): void; - intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray, allowDuplicate?: boolean): void; - intersectsRay(ray: Ray, selection: SmartArray): void; - createInnerBlocks(): void; - } -} - -declare namespace BABYLON { - class ShadowGenerator { - private static _FILTER_NONE; - private static _FILTER_VARIANCESHADOWMAP; - private static _FILTER_POISSONSAMPLING; - private static _FILTER_BLURVARIANCESHADOWMAP; - static FILTER_NONE: number; - static FILTER_VARIANCESHADOWMAP: number; - static FILTER_POISSONSAMPLING: number; - static FILTER_BLURVARIANCESHADOWMAP: number; - private _filter; - blurScale: number; - private _blurBoxOffset; - private _bias; - private _lightDirection; - forceBackFacesOnly: boolean; - bias: number; - blurBoxOffset: number; - filter: number; - useVarianceShadowMap: boolean; - usePoissonSampling: boolean; - useBlurVarianceShadowMap: boolean; - private _light; - private _scene; - private _shadowMap; - private _shadowMap2; - private _darkness; - private _transparencyShadow; - private _effect; - private _viewMatrix; - private _projectionMatrix; - private _transformMatrix; - private _worldViewProjection; - private _cachedPosition; - private _cachedDirection; - private _cachedDefines; - private _currentRenderID; - private _downSamplePostprocess; - private _boxBlurPostprocess; - private _mapSize; - private _currentFaceIndex; - private _currentFaceIndexCache; - constructor(mapSize: number, light: IShadowLight); - isReady(subMesh: SubMesh, useInstances: boolean): boolean; - getShadowMap(): RenderTargetTexture; - getShadowMapForRendering(): RenderTargetTexture; - getLight(): IShadowLight; - getTransformMatrix(): Matrix; - getDarkness(): number; - setDarkness(darkness: number): void; - setTransparencyShadow(hasShadow: boolean): void; - private _packHalf(depth); - dispose(): void; - serialize(): any; - static Parse(parsedShadowGenerator: any, scene: Scene): ShadowGenerator; - } -} - -declare namespace BABYLON.Internals { -} - -declare namespace BABYLON { - class BaseTexture { - name: string; - delayLoadState: number; - hasAlpha: boolean; - getAlphaFromRGB: boolean; - level: number; - isCube: boolean; - isRenderTarget: boolean; - animations: Animation[]; - onDispose: () => void; - coordinatesIndex: number; - coordinatesMode: number; - wrapU: number; - wrapV: number; - anisotropicFilteringLevel: number; - _cachedAnisotropicFilteringLevel: number; - private _scene; - _texture: WebGLTexture; - constructor(scene: Scene); - getScene(): Scene; - getTextureMatrix(): Matrix; - getReflectionTextureMatrix(): Matrix; - getInternalTexture(): WebGLTexture; - isReady(): boolean; - getSize(): ISize; - getBaseSize(): ISize; - scale(ratio: number): void; - canRescale: boolean; - _removeFromCache(url: string, noMipmap: boolean): void; - _getFromCache(url: string, noMipmap: boolean, sampling?: number): WebGLTexture; - delayLoad(): void; - clone(): BaseTexture; - releaseInternalTexture(): void; - dispose(): void; - serialize(): any; - } -} - -declare namespace BABYLON { - class CubeTexture extends BaseTexture { - url: string; - coordinatesMode: number; - private _noMipmap; - private _files; - private _extensions; - private _textureMatrix; - static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture; - constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean, files?: string[]); - clone(): CubeTexture; - delayLoad(): void; - getReflectionTextureMatrix(): Matrix; - static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture; - serialize(): any; - } -} - -declare namespace BABYLON { - class DynamicTexture extends Texture { - private _generateMipMaps; - private _canvas; - private _context; - constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number); - canRescale: boolean; - scale(ratio: number): void; - getContext(): CanvasRenderingContext2D; - clear(): void; - update(invertY?: boolean): void; - drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void; - clone(): DynamicTexture; - } -} - -declare namespace BABYLON { - class MirrorTexture extends RenderTargetTexture { - mirrorPlane: Plane; - private _transformMatrix; - private _mirrorMatrix; - private _savedViewMatrix; - constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean); - clone(): MirrorTexture; - serialize(): any; - } -} - -declare namespace BABYLON { - class RawTexture extends Texture { - format: number; - constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number); - update(data: ArrayBufferView): void; - static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; - static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; - static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; - static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; - static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; - } -} - -declare namespace BABYLON { - class RenderTargetTexture extends Texture { - isCube: boolean; - static _REFRESHRATE_RENDER_ONCE: number; - static _REFRESHRATE_RENDER_ONEVERYFRAME: number; - static _REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number; - static REFRESHRATE_RENDER_ONCE: number; - static REFRESHRATE_RENDER_ONEVERYFRAME: number; - static REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number; - renderList: AbstractMesh[]; - renderParticles: boolean; - renderSprites: boolean; - coordinatesMode: number; - onBeforeRender: (faceIndex: number) => void; - onAfterRender: (faceIndex: number) => void; - onAfterUnbind: () => void; - onClear: (engine: Engine) => void; - activeCamera: Camera; - customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray, beforeTransparents?: () => void) => void; - private _size; - _generateMipMaps: boolean; - private _renderingManager; - _waitingRenderList: string[]; - private _doNotChangeAspectRatio; - private _currentRefreshId; - private _refreshRate; - private _textureMatrix; - constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number, isCube?: boolean); - resetRefreshCounter(): void; - refreshRate: number; - _shouldRender(): boolean; - isReady(): boolean; - getRenderSize(): number; - canRescale: boolean; - scale(ratio: number): void; - getReflectionTextureMatrix(): Matrix; - resize(size: any, generateMipMaps?: boolean): void; - render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void; - renderToTarget(faceIndex: number, currentRenderList: AbstractMesh[], useCameraPostProcess: boolean, dumpForDebug: boolean): void; - clone(): RenderTargetTexture; - serialize(): any; - } -} - -declare namespace BABYLON { - class Texture extends BaseTexture { - static NEAREST_SAMPLINGMODE: number; - static BILINEAR_SAMPLINGMODE: number; - static TRILINEAR_SAMPLINGMODE: number; - static EXPLICIT_MODE: number; - static SPHERICAL_MODE: number; - static PLANAR_MODE: number; - static CUBIC_MODE: number; - static PROJECTION_MODE: number; - static SKYBOX_MODE: number; - static INVCUBIC_MODE: number; - static EQUIRECTANGULAR_MODE: number; - static FIXED_EQUIRECTANGULAR_MODE: number; - static CLAMP_ADDRESSMODE: number; - static WRAP_ADDRESSMODE: number; - static MIRROR_ADDRESSMODE: number; - url: string; - uOffset: number; - vOffset: number; - uScale: number; - vScale: number; - uAng: number; - vAng: number; - wAng: number; - private _noMipmap; - _invertY: boolean; - private _rowGenerationMatrix; - private _cachedTextureMatrix; - private _projectionModeMatrix; - private _t0; - private _t1; - private _t2; - private _cachedUOffset; - private _cachedVOffset; - private _cachedUScale; - private _cachedVScale; - private _cachedUAng; - private _cachedVAng; - private _cachedWAng; - private _cachedCoordinatesMode; - _samplingMode: number; - private _buffer; - private _deleteBuffer; - constructor(url: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean); - delayLoad(): void; - updateSamplingMode(samplingMode: number): void; - private _prepareRowForTextureGeneration(x, y, z, t); - getTextureMatrix(): Matrix; - getReflectionTextureMatrix(): Matrix; - clone(): Texture; - serialize(): any; - static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture; - static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BaseTexture; - } -} - -declare namespace BABYLON { - class VideoTexture extends Texture { - video: HTMLVideoElement; - private _autoLaunch; - private _lastUpdate; - constructor(name: string, urls: string[], scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number); - update(): boolean; - } -} - -declare namespace BABYLON { - class CannonJSPlugin implements IPhysicsEnginePlugin { - private _useDeltaForWorldStep; - private _world; - private _registeredMeshes; - private _physicsMaterials; - private _gravity; - private _fixedTimeStep; - name: string; - constructor(_useDeltaForWorldStep?: boolean); - initialize(iterations?: number): void; - private _checkWithEpsilon(value); - runOneStep(delta: number): void; - setGravity(gravity: Vector3): void; - getGravity(): Vector3; - registerMesh(mesh: AbstractMesh, impostor: number, options?: PhysicsBodyCreationOptions): any; - private _createShape(mesh, impostor); - private _createConvexPolyhedron(rawVerts, rawFaces, mesh); - private _createHeightmap(mesh, pointDepth?); - private _addMaterial(friction, restitution); - private _createRigidBodyFromShape(shape, mesh, options); - registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; - private _unbindBody(body); - unregisterMesh(mesh: AbstractMesh): void; - applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; - updateBodyPosition: (mesh: AbstractMesh) => void; - createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3): boolean; - dispose(): void; - isSupported(): boolean; - getWorldObject(): any; - getPhysicsBodyOfMesh(mesh: AbstractMesh): any; - } -} - -declare namespace BABYLON { - class OimoJSPlugin implements IPhysicsEnginePlugin { - private _world; - private _registeredMeshes; - name: string; - private _gravity; - private _checkWithEpsilon(value); - initialize(iterations?: number): void; - setGravity(gravity: Vector3): void; - getGravity(): Vector3; - registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; - registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; - private _createBodyAsCompound(part, options, initialMesh); - unregisterMesh(mesh: AbstractMesh): void; - private _unbindBody(body); - /** - * Update the body position according to the mesh position - * @param mesh - */ - updateBodyPosition: (mesh: AbstractMesh) => void; - applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; - createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; - dispose(): void; - isSupported(): boolean; - getWorldObject(): any; - getPhysicsBodyOfMesh(mesh: AbstractMesh): any; - private _getLastShape(body); - runOneStep(time: number): void; - } -} - -declare namespace BABYLON { - class PostProcessRenderEffect { - private _engine; - private _postProcesses; - private _getPostProcess; - private _singleInstance; - private _cameras; - private _indicesForCamera; - private _renderPasses; - private _renderEffectAsPasses; - _name: string; - applyParameters: (postProcess: PostProcess) => void; - constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean); - isSupported: boolean; - _update(): void; - addPass(renderPass: PostProcessRenderPass): void; - removePass(renderPass: PostProcessRenderPass): void; - addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void; - getPass(passName: string): void; - emptyPasses(): void; - _attachCameras(cameras: Camera): any; - _attachCameras(cameras: Camera[]): any; - _detachCameras(cameras: Camera): any; - _detachCameras(cameras: Camera[]): any; - _enable(cameras: Camera): any; - _enable(cameras: Camera[]): any; - _disable(cameras: Camera): any; - _disable(cameras: Camera[]): any; - getPostProcess(camera?: Camera): PostProcess; - private _linkParameters(); - private _linkTextures(effect); - } -} - -declare namespace BABYLON { - class PostProcessRenderPass { - private _enabled; - private _renderList; - private _renderTexture; - private _scene; - private _refCount; - _name: string; - constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void); - _incRefCount(): number; - _decRefCount(): number; - _update(): void; - setRenderList(renderList: Mesh[]): void; - getRenderTexture(): RenderTargetTexture; - } -} - -declare namespace BABYLON { - class PostProcessRenderPipeline { - private _engine; - private _renderEffects; - private _renderEffectsForIsolatedPass; - private _cameras; - _name: string; - private static PASS_EFFECT_NAME; - private static PASS_SAMPLER_NAME; - constructor(engine: Engine, name: string); - isSupported: boolean; - addEffect(renderEffect: PostProcessRenderEffect): void; - _enableEffect(renderEffectName: string, cameras: Camera): any; - _enableEffect(renderEffectName: string, cameras: Camera[]): any; - _disableEffect(renderEffectName: string, cameras: Camera): any; - _disableEffect(renderEffectName: string, cameras: Camera[]): any; - _attachCameras(cameras: Camera, unique: boolean): any; - _attachCameras(cameras: Camera[], unique: boolean): any; - _detachCameras(cameras: Camera): any; - _detachCameras(cameras: Camera[]): any; - _enableDisplayOnlyPass(passName: any, cameras: Camera): any; - _enableDisplayOnlyPass(passName: any, cameras: Camera[]): any; - _disableDisplayOnlyPass(cameras: Camera): any; - _disableDisplayOnlyPass(cameras: Camera[]): any; - _update(): void; - dispose(): void; - } -} - -declare namespace BABYLON { - class PostProcessRenderPipelineManager { - private _renderPipelines; - constructor(); - addPipeline(renderPipeline: PostProcessRenderPipeline): void; - attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any; - attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any; - detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any; - detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any; - enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any; - enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any; - disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any; - disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any; - enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any; - enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any; - disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any; - disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any; - update(): void; - } -} - -declare namespace BABYLON { - class CustomProceduralTexture extends ProceduralTexture { - private _animate; - private _time; - private _config; - private _texturePath; - constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); - private loadJson(jsonUrl); - isReady(): boolean; - render(useCameraPostProcess?: boolean): void; - updateTextures(): void; - updateShaderUniforms(): void; - animate: boolean; - } -} - -declare namespace BABYLON { - class ProceduralTexture extends Texture { - isCube: boolean; - private _size; - _generateMipMaps: boolean; - isEnabled: boolean; - private _doNotChangeAspectRatio; - private _currentRefreshId; - private _refreshRate; - onGenerated: () => void; - private _vertexBuffer; - private _indexBuffer; - private _effect; - private _vertexDeclaration; - private _vertexStrideSize; - private _uniforms; - private _samplers; - private _fragment; - _textures: Texture[]; - private _floats; - private _floatsArrays; - private _colors3; - private _colors4; - private _vectors2; - private _vectors3; - private _matrices; - private _fallbackTexture; - private _fallbackTextureUsed; - constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean, isCube?: boolean); - reset(): void; - isReady(): boolean; - resetRefreshCounter(): void; - setFragment(fragment: any): void; - refreshRate: number; - _shouldRender(): boolean; - getRenderSize(): number; - resize(size: any, generateMipMaps: any): void; - private _checkUniform(uniformName); - setTexture(name: string, texture: Texture): ProceduralTexture; - setFloat(name: string, value: number): ProceduralTexture; - setFloats(name: string, value: number[]): ProceduralTexture; - setColor3(name: string, value: Color3): ProceduralTexture; - setColor4(name: string, value: Color4): ProceduralTexture; - setVector2(name: string, value: Vector2): ProceduralTexture; - setVector3(name: string, value: Vector3): ProceduralTexture; - setMatrix(name: string, value: Matrix): ProceduralTexture; - render(useCameraPostProcess?: boolean): void; - clone(): ProceduralTexture; - dispose(): void; - } -} diff --git a/types/backbone-associations/backbone-associations-tests.ts b/types/backbone-associations/backbone-associations-tests.ts index eebd48895d..411e1e5ec4 100644 --- a/types/backbone-associations/backbone-associations-tests.ts +++ b/types/backbone-associations/backbone-associations-tests.ts @@ -3,77 +3,72 @@ import * as Backbone from 'backbone'; -namespace BackboneAssociationsTests { - namespace OneToOne { - class EmployeeWithManager extends Backbone.AssociatedModel { - constructor(options?) { - super(options); - this.relations = [ - { - type: Backbone.One, //nature of the relationship - key: 'manager', // attribute of Employee - relatedModel: 'Employee' //AssociatedModel for attribute key - } - ]; +// one-to-one tests +class EmployeeWithManager extends Backbone.AssociatedModel { + constructor(options?) { + super(options); + this.relations = [ + { + type: Backbone.One, //nature of the relationship + key: 'manager', // attribute of Employee + relatedModel: 'Employee' //AssociatedModel for attribute key } - - defaults() { - return { - age: 0, - fname: "", - lname: "", - manager: null - }; - } - } + ]; } - namespace OneToMany { - class Location extends Backbone.AssociatedModel { - defaults() { - return { - add1: "", - add2: null, - zip: "", - state: "" - }; - } - } - - class Locations extends Backbone.Collection { - comparator = (c: Backbone.Model) => { - return c.get("Number"); - } - } - - class Project extends Backbone.AssociatedModel { - constructor(options?) { - super(options); - this.relations = [ - { - type: Backbone.Many, //nature of the relation - key: 'locations', //attribute of Project - collectionType: Locations, //Collection to be used. - relatedModel: Location //Optional - } - ]; - } - - defaults() { - return { - name: "", - number: 0, - locations: [] - } - } - } - - function reverseAssociationTest() { - var local = new Location({ state: "Hertfordshire" }); - var project = new Project({ name: "The Old Pond Project" }); - local.set("oddRelationTo", project); - var parents = project.parents; - } + defaults() { + return { + age: 0, + fname: "", + lname: "", + manager: null + }; } +} +// one-to-many tests +class Location extends Backbone.AssociatedModel { + defaults() { + return { + add1: "", + add2: null, + zip: "", + state: "" + }; + } +} + +class Locations extends Backbone.Collection { + comparator = (c: Backbone.Model) => { + return c.get("Number"); + } +} + +class Project extends Backbone.AssociatedModel { + constructor(options?) { + super(options); + this.relations = [ + { + type: Backbone.Many, //nature of the relation + key: 'locations', //attribute of Project + collectionType: Locations, //Collection to be used. + relatedModel: Location //Optional + } + ]; + } + + defaults() { + return { + name: "", + number: 0, + locations: [] + } + } +} + +function reverseAssociationTest() { + var local = new Location({ state: "Hertfordshire" }); + var project = new Project({ name: "The Old Pond Project" }); + local.set("oddRelationTo", project); + var parents = project.parents; } diff --git a/types/backbone.marionette/backbone.marionette-tests.ts b/types/backbone.marionette/backbone.marionette-tests.ts index 2c1f5b68bd..46f504e18e 100644 --- a/types/backbone.marionette/backbone.marionette-tests.ts +++ b/types/backbone.marionette/backbone.marionette-tests.ts @@ -1,322 +1,321 @@ import * as Marionette from 'backbone.marionette'; import * as Backbone from 'backbone'; -namespace MarionetteTests { - class DestroyWarn extends Marionette.Behavior { - // you can set default options - // just like you can in your Backbone Models - // they will be overriden if you pass in an option with the same key - defaults = { - "message": "you are destroying!" - }; - - // behaviors have events that are bound to the views DOM - events = { - "click @ui.destroy": "warnBeforeDestroy" - }; - - warnBeforeDestroy() { - alert(this.options.message); - // every Behavior has a hook into the - // view that it is attached to - this.view.destroy(); - } - } - - - Marionette.Behaviors.getBehaviorClass = (options, key) => { - if (key === "DestroyWarn") - return DestroyWarn; - - return undefined; +class DestroyWarn extends Marionette.Behavior { + // you can set default options + // just like you can in your Backbone Models + // they will be overriden if you pass in an option with the same key + defaults = { + "message": "you are destroying!" }; - class MyRouter extends Marionette.AppRouter { - // "someMethod" must exist at controller.someMethod - appRoutes = { - "some/route": "someMethod" - }; - - /* standard routes can be mixed with appRoutes/Controllers above */ - routes = { - "some/otherRoute": "someOtherMethod" - }; - - someOtherMethod() { - // do something here. - } - - } - - class MyApplication extends Marionette.Application { - initialize(options?: any) { - console.log("initializing application"); - this.layoutView = new AppLayoutView(); - } - - layoutView: AppLayoutView; - mainRegion: Marionette.Region; - - onStart() { - this.mainRegion = new Marionette.Region({ el: '#main' }); - this.layoutView.addRegion('main', this.mainRegion); - this.layoutView.render(); - this.layoutView.showChildView('main', new MyView(new MyModel)); - let view: Backbone.View = this.layoutView.getChildView('main'); - let regions: {[key: string]: Marionette.Region} = this.layoutView.getRegions(); - let prefix: string = this.layoutView.childViewEventPrefix; - let region: Marionette.Region = this.layoutView.removeRegion('main'); - let layout: Marionette.View = this.layoutView.destroy(); - } - } - - class AppLayoutView extends Marionette.View { - constructor() { - super({ el: 'body' }); - } - - template() { - return "
"; - } - - initialize(options?: any) { - console.log("initializing layoutview"); - } - } - - class MyModel extends Backbone.Model { - - constructor(options?: any) { - super(options); - } - - getName(): string { - return this.get('name'); - } - - setName(value: string) { - this.set(value); - } - } - - class MyBaseView extends Marionette.View { - - constructor() { - super(); - this.getOption('foo'); - this.triggers = { - 'click .foo': 'bar' - }; - } - - } - - class MyView extends Marionette.View { - behaviors: any; - - constructor(model: MyModel) { - super({ model: model }); - - this.ui = { - destroy: '.destroy' - }; - - this.behaviors = { - DestroyWarn: { - message: 'hello' - } - }; - } - - template() { - return '

' + this.model.getName() + '

'; - } + // behaviors have events that are bound to the views DOM + events = { + "click @ui.destroy": "warnBeforeDestroy" }; + warnBeforeDestroy() { + alert(this.options.message); + // every Behavior has a hook into the + // view that it is attached to + this.view.destroy(); + } +} - class MainRegion extends Marionette.Region { - constructor() { - super(); - this.el = '#main'; - } + +Marionette.Behaviors.getBehaviorClass = (options, key) => { + if (key === "DestroyWarn") + return DestroyWarn; + + return undefined; +}; + +class MyRouter extends Marionette.AppRouter { + // "someMethod" must exist at controller.someMethod + appRoutes = { + "some/route": "someMethod" + }; + + /* standard routes can be mixed with appRoutes/Controllers above */ + routes = { + "some/otherRoute": "someOtherMethod" + }; + + someOtherMethod() { + // do something here. } +} - class MyObject extends Marionette.Object { - name: string; - options: any; - - constructor() { - super(); - this.name = 'Adam'; - - this.options = { - name: 'Foo' - }; - - this.on("before:destroy", () => { - console.log("before:destroy"); - }); - } - - onBeforeDestroy(arg: any) { - console.log("in onBeforeDestroy with arg " + arg); - } +class MyApplication extends Marionette.Application { + initialize(options?: any) { + console.log("initializing application"); + this.layoutView = new AppLayoutView(); } - class MyRegion extends Marionette.Region { - constructor() { - super(); - this.el = '#main-nav'; - } + layoutView: AppLayoutView; + mainRegion: Marionette.Region; + + onStart() { + this.mainRegion = new Marionette.Region({ el: '#main' }); + this.layoutView.addRegion('main', this.mainRegion); + this.layoutView.render(); + this.layoutView.showChildView('main', new MyView(new MyModel)); + let view: Backbone.View = this.layoutView.getChildView('main'); + let regions: {[key: string]: Marionette.Region} = this.layoutView.getRegions(); + let prefix: string = this.layoutView.childViewEventPrefix; + let region: Marionette.Region = this.layoutView.removeRegion('main'); + let layout: Marionette.View = this.layoutView.destroy(); + } +} + +class AppLayoutView extends Marionette.View { + constructor() { + super({ el: 'body' }); } - class MyJQueryRegion extends Marionette.Region { - constructor() { - super(); - this.el = $('#main-nav'); - } + template() { + return "
"; } - class MyHtmlElRegion extends Marionette.Region { - constructor() { - super(); - this.el = document.querySelector("body"); - } + initialize(options?: any) { + console.log("initializing layoutview"); + } +} + +class MyModel extends Backbone.Model { + + constructor(options?: any) { + super(options); } - class MyCollectionView extends Marionette.CollectionView { - constructor() { - super(); - this.childView = MyView; - this.childViewEvents = { - render: function () { - console.log("a childView has been rendered"); - } - }; - - this.childViewOptions = function (model: any, index: any): any { - // do some calculations based on the model - return { - foo: "bar", - childIndex: index - } - }; - - this.childViewOptions = { - foo: "bar" - }; - - this.childViewEventPrefix = "some:prefix"; - - this.on('some:prefix:render', function () { - - }); - - } + getName(): string { + return this.get('name'); } - export var app: MyApplication; + setName(value: string) { + this.set(value); + } +} - function ApplicationTests() { - app = new MyApplication(); +class MyBaseView extends Marionette.View { - app.start(); - - var view = new MyView(new MyModel()); - app.mainRegion.show(view); + constructor() { + super(); + this.getOption('foo'); + this.triggers = { + 'click .foo': 'bar' + }; } - function ObjectTests() { - var obj = new MyObject(); - console.log(obj.getOption('name')); - obj.destroy("goodbye"); - } +} - function RegionManagerTests() { - var rm = new Marionette.RegionManager(); - rm.addRegions({ - contentRegion: { - el: '#content', - regionClass: MainRegion - }, +class MyView extends Marionette.View { + behaviors: any; - navigationRegion: { - el: '#navigation', - regionClass: MainRegion, + constructor(model: MyModel) { + super({ model: model }); - // Options passed to instance of `MyOtherRegion` for - // the `navigationRegion` on `App` - navigationOption: 42, - anotherNavigationOption: 'foo' - }, + this.ui = { + destroy: '.destroy' + }; - footerRegion: { - regionClass: MainRegion, - someOption: 42, - someValue: 'value' + this.behaviors = { + DestroyWarn: { + message: 'hello' } + }; + } + + template() { + return '

' + this.model.getName() + '

'; + } +}; + + +class MainRegion extends Marionette.Region { + constructor() { + super(); + this.el = '#main'; + } +} + + +class MyObject extends Marionette.Object { + name: string; + options: any; + + constructor() { + super(); + this.name = 'Adam'; + + this.options = { + name: 'Foo' + }; + + this.on("before:destroy", () => { + console.log("before:destroy"); }); } - function RegionTests() { - var myView: Marionette.View = new MyView(new MyModel()); - - // render and display the view - app.mainRegion.show(myView); - - // empties the current view - app.mainRegion.empty(); - - myView = new MyView(new MyModel()); - app.mainRegion.show(myView, { preventDestroy: true, forceShow: true, triggerAttach: true, triggerBeforeAttach: false }); - - var hasView: boolean = app.mainRegion.hasView(); - - app.mainRegion.reset(); - - Marionette.Region.prototype.attachHtml = function (view: any): void { - this.$el.empty().append(view.el); - } - - myView = new Marionette.View({ - el: $("#existing-view-stuff") - }); - - app.mainRegion.attachView(myView); - - app.mainRegion.on("empty", function (view: any, region: any, options: any) { - // manipulate the `view` or do something extra - // with the `region` - // you also have access to the `options` that were passed to the Region.show call - }); - + onBeforeDestroy(arg: any) { + console.log("in onBeforeDestroy with arg " + arg); } +} - function CollectionViewTests() { - var cv = new MyCollectionView(); - cv.collection.add(new MyModel()); - app.mainRegion.attachView(cv); - cv.addEmptyView(new MyModel, MyView); - cv.proxyChildEvents(new MyView(new MyModel)); - let children: Backbone.ChildViewContainer> = cv.destroyChildren(); - let view: Marionette.CollectionView> = cv.destroy(); +class MyRegion extends Marionette.Region { + constructor() { + super(); + this.el = '#main-nav'; } +} - class MyController extends Marionette.Controller { - +class MyJQueryRegion extends Marionette.Region { + constructor() { + super(); + this.el = $('#main-nav'); } +} - function AppRouterTests() { - var myController = new MyController(); - var router = new MyRouter(); +class MyHtmlElRegion extends Marionette.Region { + constructor() { + super(); + this.el = document.querySelector("body"); + } +} - router.appRoute("/foo", "fooThat"); +class MyCollectionView extends Marionette.CollectionView { + constructor() { + super(); + this.childView = MyView; + this.childViewEvents = { + render: function () { + console.log("a childView has been rendered"); + } + }; + + this.childViewOptions = function (model: any, index: any): any { + // do some calculations based on the model + return { + foo: "bar", + childIndex: index + } + }; + + this.childViewOptions = { + foo: "bar" + }; + + this.childViewEventPrefix = "some:prefix"; + + this.on('some:prefix:render', function () { - router.processAppRoutes(myController, { - "foo": "doFoo", - "bar/:id": "doBar" }); } } + +var app: MyApplication; + +function ApplicationTests() { + app = new MyApplication(); + + app.start(); + + var view = new MyView(new MyModel()); + app.mainRegion.show(view); +} + +function ObjectTests() { + var obj = new MyObject(); + console.log(obj.getOption('name')); + obj.destroy("goodbye"); +} + +function RegionManagerTests() { + var rm = new Marionette.RegionManager(); + rm.addRegions({ + contentRegion: { + el: '#content', + regionClass: MainRegion + }, + + navigationRegion: { + el: '#navigation', + regionClass: MainRegion, + + // Options passed to instance of `MyOtherRegion` for + // the `navigationRegion` on `App` + navigationOption: 42, + anotherNavigationOption: 'foo' + }, + + footerRegion: { + regionClass: MainRegion, + someOption: 42, + someValue: 'value' + } + }); +} + +function RegionTests() { + var myView: Marionette.View = new MyView(new MyModel()); + + // render and display the view + app.mainRegion.show(myView); + + // empties the current view + app.mainRegion.empty(); + + myView = new MyView(new MyModel()); + app.mainRegion.show(myView, { preventDestroy: true, forceShow: true, triggerAttach: true, triggerBeforeAttach: false }); + + var hasView: boolean = app.mainRegion.hasView(); + + app.mainRegion.reset(); + + Marionette.Region.prototype.attachHtml = function (view: any): void { + this.$el.empty().append(view.el); + } + + myView = new Marionette.View({ + el: $("#existing-view-stuff") + }); + + app.mainRegion.attachView(myView); + + app.mainRegion.on("empty", function (view: any, region: any, options: any) { + // manipulate the `view` or do something extra + // with the `region` + // you also have access to the `options` that were passed to the Region.show call + }); + +} + +function CollectionViewTests() { + var cv = new MyCollectionView(); + cv.collection.add(new MyModel()); + app.mainRegion.attachView(cv); + cv.addEmptyView(new MyModel, MyView); + cv.proxyChildEvents(new MyView(new MyModel)); + let children: Backbone.ChildViewContainer> = cv.destroyChildren(); + let view: Marionette.CollectionView> = cv.destroy(); +} + +class MyController extends Marionette.Controller { + +} + +function AppRouterTests() { + var myController = new MyController(); + var router = new MyRouter(); + + router.appRoute("/foo", "fooThat"); + + router.processAppRoutes(myController, { + "foo": "doFoo", + "bar/:id": "doBar" + }); + +} + diff --git a/types/backbone.paginator/backbone.paginator-tests.ts b/types/backbone.paginator/backbone.paginator-tests.ts index 28b09d4fc5..f4f5765988 100644 --- a/types/backbone.paginator/backbone.paginator-tests.ts +++ b/types/backbone.paginator/backbone.paginator-tests.ts @@ -1,306 +1,258 @@ /// - import * as Backbone from 'backbone'; -namespace BackbonePaginatorTests { +class TestModel extends Backbone.Model{}; - class TestModel extends Backbone.Model{}; - - var makeFetchOptions = >() => { - return { - reset: true, - url: 'example.com', - beforeSend: (jqxhr: JQueryXHR) => {}, - success: (model: TestModel, response: any, options: any) => {}, - error: (collection: TCol, jqxhr: JQueryXHR, options: any) => {}, - parse: '', - }; +var makeFetchOptions = >() => { + return { + reset: true, + url: 'example.com', + beforeSend: (jqxhr: JQueryXHR) => {}, + success: (model: TestModel, response: any, options: any) => {}, + error: (collection: TCol, jqxhr: JQueryXHR, options: any) => {}, + parse: '', }; +}; - - namespace InitializingWithNoOption { - - class TestCollection extends Backbone.PageableCollection { - constructor(){ - super(); - } +namespace InitializingWithNoOption { + class TestCollection extends Backbone.PageableCollection { + constructor(){ + super(); } - - var testCollection = new TestCollection(); - } + var testCollection = new TestCollection(); +} - - - namespace InitializingWithOptions { - - class TestCollection extends Backbone.PageableCollection { - - constructor(models?: TestModel[], - options?: Backbone.PageableInitialOptions){ - super(); - } - +namespace InitializingWithOptions { + class TestCollection extends Backbone.PageableCollection { + constructor(models?: TestModel[], options?: Backbone.PageableInitialOptions){ + super(); } - - var testCollection1 = new TestCollection(); - - var testCollection2 = new TestCollection([ - new TestModel(), - new TestModel() - ]); - - var testCollection3 = new TestCollection([], {}); - - var testCollection4 = new TestCollection([],{ - comparator: ()=>1, - full: true, - state: {}, - queryParam: {}, - }); - - var testCollection5 = new TestCollection([],{ - state: { - firstPage: 0, - lastPage: 0, - currentPage: 0, - pageSize: 1, - totalPages: 1, - totalRecords: 1, - sortKey: 'id', - order: 1, - }, - queryParam: { - currentPage: 'current_page', - pageSize: 'page_size', - totalPages: 'total_pages', - totalRecords: 'total_records', - sortKey: 'sort_key', - order: 'order', - directions: '', - }, - }); - - var testCollection6 = new TestCollection([ - {}, - {}, - ]); - } - - - namespace Fetching { - - class TestCollection extends Backbone.PageableCollection { - constructor(models?: TestModel[], - options?: Backbone.PageableInitialOptions){ - super(); - } + var testCollection1 = new TestCollection(); + + var testCollection2 = new TestCollection([ + new TestModel(), + new TestModel() + ]); + + var testCollection3 = new TestCollection([], {}); + + var testCollection4 = new TestCollection([],{ + comparator: ()=>1, + full: true, + state: {}, + queryParam: {}, + }); + + var testCollection5 = new TestCollection([],{ + state: { + firstPage: 0, + lastPage: 0, + currentPage: 0, + pageSize: 1, + totalPages: 1, + totalRecords: 1, + sortKey: 'id', + order: 1, + }, + queryParam: { + currentPage: 'current_page', + pageSize: 'page_size', + totalPages: 'total_pages', + totalRecords: 'total_records', + sortKey: 'sort_key', + order: 'order', + directions: '', + }, + }); + + var testCollection6 = new TestCollection([ + {}, + {}, + ]); +} + +namespace Fetching { + class TestCollection extends Backbone.PageableCollection { + constructor(models?: TestModel[], options?: Backbone.PageableInitialOptions){ + super(); } + } + var testCollection = new TestCollection(); - var testCollection = new TestCollection(); + var result:JQueryXHR = testCollection.fetch(); - var result:JQueryXHR = testCollection.fetch(); + testCollection.fetch({}); - testCollection.fetch({}); + testCollection.fetch(makeFetchOptions()); +} - testCollection.fetch(makeFetchOptions()); - +namespace Paging { + class TestCollection extends Backbone.PageableCollection { + constructor(models?: TestModel[], options?: Backbone.PageableInitialOptions){ + super(); + } } + var options = makeFetchOptions(); + var testCollection = new TestCollection(); - namespace Paging { - class TestCollection extends Backbone.PageableCollection { - constructor(models?: TestModel[], - options?: Backbone.PageableInitialOptions){ - super(); - } - } + var result:JQueryXHR|TestCollection = testCollection.getFirstPage(); - var options = makeFetchOptions(); + testCollection.getFirstPage(options); - var testCollection = new TestCollection(); + // 'silent's type is boolean. (structural subtyping) + testCollection.getFirstPage({silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getFirstPage({url: true}); - var result:JQueryXHR|TestCollection = testCollection.getFirstPage(); + result = testCollection.getLastPage(); - testCollection.getFirstPage(options); + testCollection.getLastPage(options); - // 'silent's type is boolean. (structural subtyping) - testCollection.getFirstPage({silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getFirstPage({url: true}); + // 'silent's type is boolean. (structural subtyping) + testCollection.getLastPage({silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getLastPage({url: true}); - result = testCollection.getLastPage(); + result = testCollection.getNextPage(); - testCollection.getLastPage(options); + testCollection.getNextPage(options); - // 'silent's type is boolean. (structural subtyping) - testCollection.getLastPage({silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getLastPage({url: true}); + // 'silent's type is boolean. (structural subtyping) + testCollection.getNextPage({silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getNextPage({url: true}); - result = testCollection.getNextPage(); + result = testCollection.getPage(1); - testCollection.getNextPage(options); + testCollection.getPage("1", options); - // 'silent's type is boolean. (structural subtyping) - testCollection.getNextPage({silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getNextPage({url: true}); + // 'silent's type is boolean. (structural subtyping) + testCollection.getPage(1, {silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getPage(1, {url: true}); - result = testCollection.getPage(1); + result = testCollection.getPageByOffset(1); - testCollection.getPage("1", options); + testCollection.getPageByOffset(1, options); - // 'silent's type is boolean. (structural subtyping) - testCollection.getPage(1, {silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getPage(1, {url: true}); + // 'silent's type is boolean. (structural subtyping) + testCollection.getPageByOffset(1, {silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getPageByOffset(1, {url: true}); - result = testCollection.getPageByOffset(1); + result = testCollection.getPreviousPage(); - testCollection.getPageByOffset(1, options); + testCollection.getPreviousPage(options); - // 'silent's type is boolean. (structural subtyping) - testCollection.getPageByOffset(1, {silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getPageByOffset(1, {url: true}); + // 'silent's type is boolean. (structural subtyping) + testCollection.getPreviousPage({silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getPreviousPage({url: true}); - result = testCollection.getPreviousPage(); + var hasPage:boolean = testCollection.hasNextPage(); - testCollection.getPreviousPage(options); + hasPage = testCollection.hasPreviousPage(); +} - // 'silent's type is boolean. (structural subtyping) - testCollection.getPreviousPage({silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getPreviousPage({url: true}); - var hasPage:boolean = testCollection.hasNextPage(); - hasPage = testCollection.hasPreviousPage(); - +namespace Parse { + class TestCollection extends Backbone.PageableCollection { + constructor(models?: TestModel[], + options?: Backbone.PageableInitialOptions){ + super(); + } } - - - - namespace Parse { - - class TestCollection extends Backbone.PageableCollection { - constructor(models?: TestModel[], - options?: Backbone.PageableInitialOptions){ - super(); - } + var testCollection = new TestCollection(); + + var result:any[] = testCollection.parse({}, {}); + + + var resultLinks:any = testCollection.parseLinks({}, {}); + + resultLinks = testCollection.parseLinks({}, { xhr: $.ajax({}) } ); + + + result = testCollection.parseRecords({}, {}); + + var resultState: Backbone.PageableState = testCollection.parseState( + {}, + { + currentPage: 'current_page', + pageSize: 'page_size', + totalPages: 'total_pages', + totalRecords: 'total_records', + sortKey: 'sort_key', + order: 'order', + directions: '', + }, + { + firstPage: 0, + lastPage: 0, + currentPage: 0, + pageSize: 1, + totalPages: 1, + totalRecords: 1, + sortKey: 'id', + order: 1, + }, + {}); +} + +namespace Setting { + class TestCollection extends Backbone.PageableCollection { + constructor(models?: TestModel[], options?: Backbone.PageableInitialOptions){ + super(); } - - var testCollection = new TestCollection(); - - var result:any[] = testCollection.parse({}, {}); - - - var resultLinks:any = testCollection.parseLinks({}, {}); - - resultLinks = testCollection.parseLinks({}, { xhr: $.ajax({}) } ); - - - result = testCollection.parseRecords({}, {}); - - - var resultState: Backbone.PageableState = testCollection.parseState( - {}, - { - currentPage: 'current_page', - pageSize: 'page_size', - totalPages: 'total_pages', - totalRecords: 'total_records', - sortKey: 'sort_key', - order: 'order', - directions: '', - }, - { - firstPage: 0, - lastPage: 0, - currentPage: 0, - pageSize: 1, - totalPages: 1, - totalRecords: 1, - sortKey: 'id', - order: 1, - }, - {}); - } - + var testCollection = new TestCollection(); - namespace Setting { + var options = makeFetchOptions(); - class TestCollection extends Backbone.PageableCollection { - constructor(models?: TestModel[], - options?: Backbone.PageableInitialOptions){ - super(); - } - } + var result1:JQueryXHR|TestCollection + = testCollection.setPageSize(1, options); - var testCollection = new TestCollection(); - var options = makeFetchOptions(); + var result2:TestCollection + = testCollection.setSorting('id', 1, options); + result1 = testCollection.switchMode( + 'server', + {fetch: true, resetState: true} + ); +} - var result1:JQueryXHR|TestCollection - = testCollection.setPageSize(1, options); - - - var result2:TestCollection - = testCollection.setSorting('id', 1, options); - - - result1 = testCollection.switchMode( - 'server', - {fetch: true, resetState: true} - ); - - } - - - - namespace Syncing { - - class TestCollection extends Backbone.PageableCollection { - constructor(models?: TestModel[], - options?: Backbone.PageableInitialOptions){ - super(); - } +namespace Syncing { + class TestCollection extends Backbone.PageableCollection { + constructor(models?: TestModel[], options?: Backbone.PageableInitialOptions){ + super(); } - - var testCollection = new TestCollection(); - - - var result:JQueryXHR = testCollection.sync('server', new TestModel(), {}); - - result = testCollection.sync('server', testCollection, {}); - } + var testCollection = new TestCollection(); + var result:JQueryXHR = testCollection.sync('server', new TestModel(), {}); - namespace Confllict { - - var result:typeof Backbone.PageableCollection - = Backbone.PageableCollection.noConflict(); - - } + result = testCollection.sync('server', testCollection, {}); +} +namespace Confllict { + var result: typeof Backbone.PageableCollection = Backbone.PageableCollection.noConflict(); } diff --git a/types/backlog-js/index.d.ts b/types/backlog-js/index.d.ts index d06f764baa..e0742c39dd 100644 --- a/types/backlog-js/index.d.ts +++ b/types/backlog-js/index.d.ts @@ -2,9 +2,9 @@ // Project: https://github.com/nulab/backlog-js // Definitions by: Yuichi Watanabe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// -/// declare class Request { private configure; diff --git a/types/baconjs/baconjs-tests.ts b/types/baconjs/baconjs-tests.ts index e948668dc7..75560d4e42 100644 --- a/types/baconjs/baconjs-tests.ts +++ b/types/baconjs/baconjs-tests.ts @@ -190,6 +190,11 @@ function CommonMethodsInEventStreamsAndProperties() { console.log(sum); // returns [-1, 2, 8] in an order }); } + + { + var src = Bacon.fromArray([1, 2, 3]); + src.doLog('element value'); + } } function EventStream() { diff --git a/types/baconjs/index.d.ts b/types/baconjs/index.d.ts index 8659ea9115..0550d6ec48 100644 --- a/types/baconjs/index.d.ts +++ b/types/baconjs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Bacon.js 0.7.0 // Project: https://baconjs.github.io/ -// Definitions by: Alexander Matsievsky +// Definitions by: Alexander Matsievsky , Joonas Javanainen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -69,7 +69,7 @@ declare namespace Bacon { /** * @function * @description Creates an [EventStream]{@link Bacon.EventStream} from a `promise` Promise object such as JQuery Ajax. This stream will contain a single value or an error, followed immediately by stream end. You can use the optional `abort` flag (i.e. ´Bacon.fromPromise(p, true)´ to have the `abort` method of the given promise be called when all subscribers have been removed from the created stream. - * @param {Promise|JQueryXHR} promise + * @param {PromiseLike|JQueryXHR} promise * @param {boolean} [abort] * @returns {EventStream} * @example @@ -78,7 +78,7 @@ declare namespace Bacon { * Bacon.fromPromise($.ajax("https://baconjs.github.io/"), true); * Bacon.fromPromise(Promise.resolve(1), false); */ - function fromPromise(promise:Promise|JQueryXHR, abort?:boolean):EventStream; + function fromPromise(promise:PromiseLike|JQueryXHR, abort?:boolean):EventStream; /** * @callback Bacon.fromPromise~eventTransformer @@ -88,7 +88,7 @@ declare namespace Bacon { /** * @function Bacon.fromPromise * @description Creates an [EventStream]{@link Bacon.EventStream} from a `promise` Promise object such as JQuery Ajax. This stream will contain a single value or an error, followed immediately by stream end. You can use the `abort` flag (i.e. ´Bacon.fromPromise(p, true)´ to have the `abort` method of the given promise be called when all subscribers have been removed from the created stream, and also pass a function `eventTransformer` that transforms the promise value into Events. The default is to transform the value into `[new Bacon.Next(value), new Bacon.End()]`. - * @param {Promise|JQueryXHR} promise + * @param {PromiseLike|JQueryXHR} promise * @param {boolean} abort * @param {Bacon.fromPromise~eventTransformer} eventTransformer * @returns {EventStream} @@ -100,7 +100,7 @@ declare namespace Bacon { * return [new Bacon.Next(n), new Bacon.Next(() => n), new Bacon.End()]; * }); */ - function fromPromise(promise:Promise|JQueryXHR, abort:boolean, eventTransformer:(value:A) => (Initial|Next|End|Error)[]):EventStream; + function fromPromise(promise:PromiseLike|JQueryXHR, abort:boolean, eventTransformer:(value:A) => (Initial|Next|End|Error)[]):EventStream; /** * @function @@ -1026,9 +1026,10 @@ declare namespace Bacon { /** * @method EventStream#doLog * @description Logs each value of the [EventStream]{@link Bacon.EventStream} to the console. [doLog]{@link Bacon.EventStream#doLog} behaves like [log]{@link Bacon.EventStream#log} but does not subscribe to the EventStream. You can think of `doLog` as a logger function that – unlike `log` – is safe to use in production. `doLog` is safe, because it does not cause the same surprising side-effects as `log` does. + * @param {string} [label] * @returns {EventStream} */ - doLog():EventStream; + doLog(label?:string):EventStream; /** * @method @@ -1613,9 +1614,10 @@ declare namespace Bacon { /** * @method Property#doLog * @description Logs each value of the [Property]{@link Bacon.Property} to the console. [doLog]{@link Bacon.Property#doLog} behaves like [log]{@link Bacon.Property#log} but does not subscribe to the Property. You can think of `doLog` as a logger function that – unlike `log` – is safe to use in production. `doLog` is safe, because it does not cause the same surprising side-effects as `log` does. + * @param {string} [label] * @returns {Property} */ - doLog():Property; + doLog(label?:string):Property; /** * @method diff --git a/types/bagpipes/bagpipes-tests.ts b/types/bagpipes/bagpipes-tests.ts new file mode 100755 index 0000000000..af7dfa0a31 --- /dev/null +++ b/types/bagpipes/bagpipes-tests.ts @@ -0,0 +1,100 @@ +import * as Bagpipes from 'bagpipes'; + +// test `create` +Bagpipes.create({}); +Bagpipes.create({ CustomPipe: [] }); +Bagpipes.create({ CustomPipe: [] }, undefined); +Bagpipes.create({ CustomPipe: [] }, {}); + +// test `PipeDefs` Pipe Definitions Object +const perDefsMixed: Bagpipes.PipeDefMap = { + HelloWorld: [ + { emit: 'Hello, World!' }, + 'StringTypeDef' + ], + xxx: 'ddd' +}; +const pipesDefsEmpty: Bagpipes.PipeDefMap = {}; + +const pipesDefs: Bagpipes.PipeDefMap = { + _router: { + name: 'swagger_router', + mockMode: false, + mockControllersDirs: [ 'api/mocks' ], + controllersDirs: [ 'api/controllers' ] + }, + _swagger_validate: { + name: 'swagger_validator', + validateReponse: true + }, + swagger_controllers: [ + 'cors', + 'swagger_params_parser', + 'swagger_security', + '_swagger_validate', + 'express_compatibility', + '_router' + ] +}; + +// test `Config` object +const pipesConfigA: Bagpipes.Config = { + connectMiddlewareDirs: ['some_dir', 'ssssss'] +}; + +const pipesConfigempty: Bagpipes.Config = { }; + +const pipesConfigFull: Bagpipes.Config = { + connectMiddlewareDirs: ['test'], + userFittingsDirs: ['test'], + userViewsDirs: ['test'] +}; + +const pipesConfigFullEmpty: Bagpipes.Config = { + connectMiddlewareDirs: [], + userFittingsDirs: [], + userViewsDirs: [] +}; + +let pipesA = Bagpipes.create(perDefsMixed, { + connectMiddlewareDirs: ['some_dir', 'ssssss'], + swaggerNodeRunner: {} +}); +let pipeA = pipesA.getPipe('HelloWorld'); + +// log the output to standard out +pipeA.fit((context, cb) => { + cb(null, context); +}); + +pipesA.play(pipeA, {}); + +// test cb with err +const pipesEnty = Bagpipes.create({ + HelloWorld: [] +}, {}); + +// test fit a registered pipe and return error +const pipeErrTest = pipesEnty.pipes['any'].fit((context, cb) => { + cb(new Error("test err")); +}); +pipesEnty.play(pipeErrTest, {}); + +const fittingsC = ["xxxx", "aaa"].map((name) => { + let fittingDef = {} as Bagpipes.PipeDefMap; + fittingDef[name] = 'nothing'; + return fittingDef; +}); +const bagpipesC = Bagpipes.create({ fittings: fittingsC }); + +// test create with array of object literals +const pipeWithObj = [{ emit: 'something' }]; +const bagpipesD = Bagpipes.create({ objPipe: pipeWithObj }); +bagpipesD.play(bagpipesD.getPipe('objPipe'), {}); + +// Test full create +const userFittingsDirs = ['./fixtures/fittings']; +const pipeWithString = ['emit']; +let contextPlain = {}; +const bagpipesWithPipeAndFittings = Bagpipes.create({ myCustomPipe: pipeWithString }, { userFittingsDirs }); +bagpipesWithPipeAndFittings.play(bagpipesWithPipeAndFittings.getPipe('myCustomPipe'), contextPlain); diff --git a/types/bagpipes/index.d.ts b/types/bagpipes/index.d.ts new file mode 100755 index 0000000000..82a1fa32f4 --- /dev/null +++ b/types/bagpipes/index.d.ts @@ -0,0 +1,177 @@ +// Type definitions for bagpipes 0.1 +// Project: https://github.com/apigee-127/bagpipes +// Definitions by: Michael Mrowetz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface FittingContext { + /** The input defined in the fitting definition + * (string, number, object, array) + */ + input: any; + /** Output to be delivered to the next fitting or client */ + output: any; + [prop: string]: any; +} + +/** + * Fitting types has pre-defined fittings `system` and `user` + * but can be any any string for custom types like `swagger` or `node-machine` + */ +type FittingType = "system" | "user" | string; + +interface FittingDef { + /** + * If type is omitted (as it must be for in-line usage), Bagpipes will + * first check the user fittings then the system fittings for the name and + * use the first fitting found. + * + * Thus be aware that if you define a fitting with the same name as a + * system one, your fitting will override it. + */ + type?: FittingType; + /** The name of the fitting of the type specified */ + name?: string; + /** Static values passed to the fitting during construction */ + config?: any; + /** Dynamic values passed to the fitting during execution */ + input?: any; + /** The name of the context key to which the output value is assigned */ + output?: any; + // allow other config settings + [prop: string]: any; +} + +/** + * Fitting Execution Function + * + * Will be called called when the `Pipe` it is contained it gets 'played' + */ +type Fitting = ( + context: FittingContext, + next: {(err: Error | null | undefined, res?: any): void}) => void; + +/** + * Fitting creation Function + * + * Executed during parsing + * @see {@link https://github.com/apigee-127/bagpipes#fittings|Docs} + * + * @param {Object} fittingDef Fitting Definition + */ +type FittingFactory = (fittingDef: FittingDef, bagpipes: any) => Fitting; + +/** + * Hashmap of `fittingType`s (the name of a fitting) and the + * `FittingFactory` functions used to create them + */ +interface FittingTypesMap { + [fittingType: string]: FittingFactory; +} + +/** The Pipe Definition */ +type PipeDef = any[] | string | FittingDef; + +/** Hashmap of Pipe Definitons */ +export interface PipeDefMap { + [name: string]: PipeDef; +} + +/** + * Bagpipes Instance (a collection of pipes) + * @see {@link https://github.com/apigee-127/bagpipes#pipes|Docs} + */ +export class Bagpipes { + /** + * Hashmap of `fittingType`s (the name of a fitting) and the + * `FittingFactory` functions used to create them + */ + fittingTypes: FittingTypesMap; + /** The pipes */ + pipes: { + [name: string]: Pipe; + }; + /** The `Bagpipes`' configuration */ + config: Config; + /** + * Creates a `Fitting` + * @throws {Error} Throws error if an invalid (not defined) fitting typ is used + * (can't find argument `fittingType` in `Bagpipes.fittingTypes`) + */ + createFitting(fittingDef: FittingDef): Fitting; + /** returns `pipeworks` Pipe instance */ + createPipe(pipeDef: PipeDef): Pipe; + createPipeFromFitting(fitting: Fitting, fittingDef: FittingDef): Pipe; + /** + * Finds and returns a `Pipe` by name and lazily creates if it is not defined + * @throws {Error} Throws error if `pipeDef` pipe is not yet defined and `pipeDef` is + * not supplied + */ + getPipe(pipeName: string, pipeDef?: PipeDef): Pipe; + /** Handler for errors that occure when a `Fitting` gets 'played' */ + handleError(context: FittingContext, err: Error): void; + /** Loads `FittingFactory`s from file-system and adds them to `Bagpipes.fittingTypes` */ + loadFittingTypes(): FittingTypesMap; + /** + * Builds a new (wrappend) `Fitting` + * @throws {Error} Throws error if an invalid (not defined) fitting typ is used + * (can't find argument `fittingType` in `Bagpipes.fittingTypes`) + */ + newFitting(fittingType: string, fittingDef: FittingDef): Fitting; + /** Run the pipeline */ + play(pipe: Pipe, context: any): void; + /** + * Wraps `Fitting` with debugging, `preflight`, `postflight` + * and error handling functionality and returns as new Fitting + */ + wrapFitting(fitting: Fitting, fittingDef: FittingDef): Fitting | null; +} + +/** Configuration object for `Bagpipes` */ +export interface Config { + connectMiddlewareDirs?: string[]; + userFittingsDirs?: string[]; + userViewsDirs?: string[]; + // allow to store custom values e.g. for swagger-node-runner + // see https://github.com/theganyo/swagger-node-runner/blob/v0.7.1/index.js#L304 + [name: string]: any; +} + +/** + * Creates `Bagpipes` + */ +export function create(pipesDefs: PipeDefMap, conf?: Config): Bagpipes; + +// Types for imports from `pipeworks` module + +type Affinity = "hoist" | "sink"; + +/** PipeDef used in `pipeworks` module */ +interface PipeworksOptions { + /** + * Adds to the pre and post queues, respectively. + * Ensures a pipe gets fitted before or after the main execution pipeline. + */ + affinity: Affinity; +} + +/** + * Instance of a `Pipeworks` pipeline (in `pipeworks` module) - + * called 'pipe' in `Bagpipes` + * + * _(simplified version)_ + */ +export class Pipe { + /** add a new `Fitting` (piece) to the pipe (aka. pipeline) */ + fit(pipe: Fitting): Pipe; + /** add a new `Fitting` (piece) to the pipe (aka. pipeline) */ + fit(options: PipeworksOptions, pipe: Fitting): Pipe; + /** Redirect the flow to another pipe (aka. pipeline). */ + siphon(pipe: Fitting): Pipe; + /** Redirect the flow to another pipe (aka. pipeline). */ + siphon(options: PipeworksOptions, pipe: Fitting): Pipe; + /** + * Send something down the pipe (aka. pipeline)! Any number of arguments + * can be sent, but often there's just a single `context` object. + */ + flow(...args: any[]): Pipe; +} diff --git a/types/bagpipes/tsconfig.json b/types/bagpipes/tsconfig.json new file mode 100755 index 0000000000..6097fdb56d --- /dev/null +++ b/types/bagpipes/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bagpipes-tests.ts" + ] +} diff --git a/types/bagpipes/tslint.json b/types/bagpipes/tslint.json new file mode 100755 index 0000000000..3db14f85ea --- /dev/null +++ b/types/bagpipes/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/bardjs/bardjs-tests.ts b/types/bardjs/bardjs-tests.ts index 91172b7255..52f5ab1d3f 100644 --- a/types/bardjs/bardjs-tests.ts +++ b/types/bardjs/bardjs-tests.ts @@ -1,281 +1,279 @@ import * as angular from 'angular'; import 'angular-mocks'; -namespace bardTests { - var expect = chai.expect, - assert = chai.assert; +var expect = chai.expect, + assert = chai.assert; - class MyService { - constructor(private $q: angular.IQService) {} +class MyService { + constructor(private $q: angular.IQService) {} - remoteCall(): angular.IPromise { - return new this.$q((resolve, reject) => { - resolve(['Hello', 'World']); - }); - } - } - - function myService($q: angular.IQService) { - return new MyService($q); - } - namespace myService { - export var $inject = ['$q']; - } - - class MyController { - myProperty: string; - } - - angular - .module('myModule') - .service('myService', myService) - .controller('MyController', MyController); - - /* - * bard.$httpBackend - */ - function test_$httpBackend() { - var myService: MyService; - var $rootScope: angular.IRootScopeService; - - beforeEach(angular.mock.module(bard.$httpBackend, 'myModule')); - - beforeEach(inject(function(_myService_: MyService, _$rootScope_: angular.IRootScopeService) { - myService = _myService_; - $rootScope = _$rootScope_; - })); - - it('should return valid data', function(done) { - myService.remoteCall() - .then(function(data) { - expect(data).to.exist; - }) - .then(done, done); - - $rootScope.$apply; // Because not using bard.$q, must flush the $http and $q queues + remoteCall(): angular.IPromise { + return new this.$q((resolve, reject) => { + resolve(['Hello', 'World']); }); } +} - /* - * bard.$q - */ - function test_$q() { - var myService: MyService; +function myService($q: angular.IQService) { + return new MyService($q); +} +namespace myService { + export var $inject = ['$q']; +} - beforeEach(angular.mock.module(bard.$q, bard.$httpBackend, 'myModule')); +class MyController { + myProperty: string; +} - beforeEach(inject(function(_myService_: MyService) { - myService = _myService_; - })); +angular + .module('myModule') + .service('myService', myService) + .controller('MyController', MyController); - it('should return valid data', (done) => { - myService.remoteCall() - .then((data) => { - expect(data).to.exist; - }) - .then(done, done); +/* + * bard.$httpBackend + */ +function test_$httpBackend() { + var myService: MyService; + var $rootScope: angular.IRootScopeService; - // No need to flush + beforeEach(angular.mock.module(bard.$httpBackend, 'myModule')); + + beforeEach(inject(function(_myService_: MyService, _$rootScope_: angular.IRootScopeService) { + myService = _myService_; + $rootScope = _$rootScope_; + })); + + it('should return valid data', function(done) { + myService.remoteCall() + .then(function(data) { + expect(data).to.exist; + }) + .then(done, done); + + $rootScope.$apply; // Because not using bard.$q, must flush the $http and $q queues + }); +} + +/* + * bard.$q + */ +function test_$q() { + var myService: MyService; + + beforeEach(angular.mock.module(bard.$q, bard.$httpBackend, 'myModule')); + + beforeEach(inject(function(_myService_: MyService) { + myService = _myService_; + })); + + it('should return valid data', (done) => { + myService.remoteCall() + .then((data) => { + expect(data).to.exist; + }) + .then(done, done); + + // No need to flush + }); +} + +/* + * bard.addGlobals + */ +function test_addGlobals() { + describe('someting', function() { + var ctx = this; + + it('should work', function() { + var bar = 'bar'; + bard.addGlobals(this, 'foo'); // where `this` is the spec context + bard.addGlobals(this, 'foo', bar); + bard.addGlobals.bind(this)('foo', 'bar'); + bard.addGlobals(ctx, ['foo', 'bar']) // where ctx is the spec context }); - } - - /* - * bard.addGlobals - */ - function test_addGlobals() { - describe('someting', function() { - var ctx = this; - - it('should work', function() { - var bar = 'bar'; - bard.addGlobals(this, 'foo'); // where `this` is the spec context - bard.addGlobals(this, 'foo', bar); - bard.addGlobals.bind(this)('foo', 'bar'); - bard.addGlobals(ctx, ['foo', 'bar']) // where ctx is the spec context - }); - }) - } - - /* - * bard.appModule - */ - function test_appModule() { - beforeEach(bard.appModule('myModule')); - //// - beforeEach(bard.appModule('myModule', function() {}, {})); - } - - /* - * bard.assertFail - */ - function test_assertFail() { - bard.assertFail('FAIL!'); - } - - /* - * bard.asyncModule - */ - function test_asyncModule() { - beforeEach(bard.asyncModule('myModule')); - //// - beforeEach(bard.asyncModule('myModule', function() {}, {})); - } - - /* - * bard.debugging - */ - function test_debugging() { - console.log( - bard.debugging(true), // should return true - bard.debugging(false), // should return false - bard.debugging(42), // should return true - bard.debugging(''), // should return false - bard.debugging() // should return false - ); - } - - /* - * bard.fakeLogger - */ - function test_fakeLogger() { - beforeEach(angular.mock.module('myModule', bard.fakeLogger)); - //// - beforeEach(bard.appModule('myModule', bard.fakeLogger)); - //// - beforeEach(bard.asyncModule('myModule', bard.fakeLogger)); - } - - /* - * bard.fakeRouteHelperProvider - */ - function test_fakeRouteHelperProvider() { - beforeEach(angular.mock.module('myModule', bard.fakeRouteHelperProvider)); - //// - beforeEach(bard.appModule('myModule', bard.fakeRouteHelperProvider)); - //// - beforeEach(bard.asyncModule('myModule', bard.fakeRouteHelperProvider)); - } - - /* - * bard.fakeRouteProvider - */ - function test_fakeRouteProvider() { - beforeEach(angular.mock.module('myModule', bard.fakeRouteProvider)); - //// - beforeEach(bard.appModule('myModule', bard.fakeRouteProvider)); - //// - beforeEach(bard.asyncModule('myModule', bard.fakeRouteProvider)); - } - - /* - * bard.fakeStateProvider - */ - function test_fakeStateProvider() { - beforeEach(angular.mock.module('myModule', bard.fakeStateProvider)); - //// - beforeEach(bard.appModule('myModule', bard.fakeStateProvider)); - //// - beforeEach(bard.asyncModule('myModule', bard.fakeStateProvider)); - } - - /* - * bard.fakeToastr - */ - function test_fakeToastr() { - beforeEach(angular.mock.module('myModule', bard.fakeToastr)); - //// - beforeEach(bard.appModule('myModule', bard.fakeToastr)); - //// - beforeEach(bard.asyncModule('myModule', bard.fakeToastr)); - } - - /* - * bard.inject - */ - function test_inject() { - beforeEach(() => bard.inject(this, '$controller', '$log', '$q', '$rootScope', 'myService')); - } - - /* - * bard.log - */ - function test_log() { - bard.log('We got the goods'); - } - - /* - * bard.mochaRunnerListener - */ - function test_mochaRunnerListener() { - var runner = mocha.run(); - bard.mochaRunnerListener(runner); - } - - /* - * bard.mockService - */ - function test_mockService() { - var controller: MyController, - myArray = ['This', 'is', 'some', 'mocked', 'data']; - var $controller: angular.IControllerService, - $q: angular.IQService, - $rootScope: angular.IRootScopeService, - myService: MyService; - - beforeEach(function() { - bard.appModule('myModule'); - bard.inject(this, '$controller', '$q', '$rootScope', 'myService'); - - bard.mockService(myService, { - remoteCall: $q.when(myArray), - _default: $q.when([]) - }); - - controller = $controller('MyController'); - $rootScope.$apply(); + }) +} + +/* + * bard.appModule + */ +function test_appModule() { + beforeEach(bard.appModule('myModule')); + //// + beforeEach(bard.appModule('myModule', function() {}, {})); +} + +/* + * bard.assertFail + */ +function test_assertFail() { + bard.assertFail('FAIL!'); +} + +/* + * bard.asyncModule + */ +function test_asyncModule() { + beforeEach(bard.asyncModule('myModule')); + //// + beforeEach(bard.asyncModule('myModule', function() {}, {})); +} + +/* + * bard.debugging + */ +function test_debugging() { + console.log( + bard.debugging(true), // should return true + bard.debugging(false), // should return false + bard.debugging(42), // should return true + bard.debugging(''), // should return false + bard.debugging() // should return false + ); +} + +/* + * bard.fakeLogger + */ +function test_fakeLogger() { + beforeEach(angular.mock.module('myModule', bard.fakeLogger)); + //// + beforeEach(bard.appModule('myModule', bard.fakeLogger)); + //// + beforeEach(bard.asyncModule('myModule', bard.fakeLogger)); +} + +/* + * bard.fakeRouteHelperProvider + */ +function test_fakeRouteHelperProvider() { + beforeEach(angular.mock.module('myModule', bard.fakeRouteHelperProvider)); + //// + beforeEach(bard.appModule('myModule', bard.fakeRouteHelperProvider)); + //// + beforeEach(bard.asyncModule('myModule', bard.fakeRouteHelperProvider)); +} + +/* + * bard.fakeRouteProvider + */ +function test_fakeRouteProvider() { + beforeEach(angular.mock.module('myModule', bard.fakeRouteProvider)); + //// + beforeEach(bard.appModule('myModule', bard.fakeRouteProvider)); + //// + beforeEach(bard.asyncModule('myModule', bard.fakeRouteProvider)); +} + +/* + * bard.fakeStateProvider + */ +function test_fakeStateProvider() { + beforeEach(angular.mock.module('myModule', bard.fakeStateProvider)); + //// + beforeEach(bard.appModule('myModule', bard.fakeStateProvider)); + //// + beforeEach(bard.asyncModule('myModule', bard.fakeStateProvider)); +} + +/* + * bard.fakeToastr + */ +function test_fakeToastr() { + beforeEach(angular.mock.module('myModule', bard.fakeToastr)); + //// + beforeEach(bard.appModule('myModule', bard.fakeToastr)); + //// + beforeEach(bard.asyncModule('myModule', bard.fakeToastr)); +} + +/* + * bard.inject + */ +function test_inject() { + beforeEach(() => bard.inject(this, '$controller', '$log', '$q', '$rootScope', 'myService')); +} + +/* + * bard.log + */ +function test_log() { + bard.log('We got the goods'); +} + +/* + * bard.mochaRunnerListener + */ +function test_mochaRunnerListener() { + var runner = mocha.run(); + bard.mochaRunnerListener(runner); +} + +/* + * bard.mockService + */ +function test_mockService() { + var controller: MyController, + myArray = ['This', 'is', 'some', 'mocked', 'data']; + var $controller: angular.IControllerService, + $q: angular.IQService, + $rootScope: angular.IRootScopeService, + myService: MyService; + + beforeEach(function() { + bard.appModule('myModule'); + bard.inject(this, '$controller', '$q', '$rootScope', 'myService'); + + bard.mockService(myService, { + remoteCall: $q.when(myArray), + _default: $q.when([]) }); - } - - /* - * bard.replaceAccentChars - */ - function test_replaceAccentChars() { - console.log(bard.replaceAccentChars('àáâãäåèéêëìíîïòóôõöùúûüýÿ') === 'aaaaaaeeeeeeeeooooouuuuyy'); - } - - /* - * bard.verifyNoOutstandingHttpRequests - */ - function test_verifyNoOutstandingHttpRequests() { - var controller: MyController, - myArray = ['This', 'is', 'some', 'mocked', 'data']; - var $controller: angular.IControllerService, - $q: angular.IQService, - $rootScope: angular.IRootScopeService, - myService: MyService; - - beforeEach(function() { - bard.appModule('myModule'); - bard.inject(this, '$controller', '$q', '$rootScope', 'myService'); - - bard.mockService(myService, { - remoteCall: $q.when(myArray), - _default: $q.when([]) - }); - - controller = $controller('MyController'); - $rootScope.$apply(); + + controller = $controller('MyController'); + $rootScope.$apply(); + }); +} + +/* + * bard.replaceAccentChars + */ +function test_replaceAccentChars() { + console.log(bard.replaceAccentChars('àáâãäåèéêëìíîïòóôõöùúûüýÿ') === 'aaaaaaeeeeeeeeooooouuuuyy'); +} + +/* + * bard.verifyNoOutstandingHttpRequests + */ +function test_verifyNoOutstandingHttpRequests() { + var controller: MyController, + myArray = ['This', 'is', 'some', 'mocked', 'data']; + var $controller: angular.IControllerService, + $q: angular.IQService, + $rootScope: angular.IRootScopeService, + myService: MyService; + + beforeEach(function() { + bard.appModule('myModule'); + bard.inject(this, '$controller', '$q', '$rootScope', 'myService'); + + bard.mockService(myService, { + remoteCall: $q.when(myArray), + _default: $q.when([]) }); + + controller = $controller('MyController'); + $rootScope.$apply(); + }); + + bard.verifyNoOutstandingHttpRequests(); +} - bard.verifyNoOutstandingHttpRequests(); - } - - /* - * bard.wrapWithDone - */ - function test_wrapWithDone() { - function callback() { console.log('Doing something...'); } - function done() { console.log('...Done'); } - bard.wrapWithDone(callback, done); - } +/* + * bard.wrapWithDone + */ +function test_wrapWithDone() { + function callback() { console.log('Doing something...'); } + function done() { console.log('...Done'); } + bard.wrapWithDone(callback, done); } diff --git a/types/base-64/index.d.ts b/types/base-64/index.d.ts index ddd10db17b..26cb9c4a41 100644 --- a/types/base-64/index.d.ts +++ b/types/base-64/index.d.ts @@ -22,4 +22,4 @@ export function encode(input: string): string; * with atob() as described in the HTML Standard. * see: https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-atob */ -export function decode(input: string): string; \ No newline at end of file +export function decode(input: string): string; diff --git a/types/base-64/tslint.json b/types/base-64/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/base-64/tslint.json +++ b/types/base-64/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/base64-js/base64-js-tests.ts b/types/base64-js/base64-js-tests.ts index 13c3f705b5..402ce43e88 100644 --- a/types/base64-js/base64-js-tests.ts +++ b/types/base64-js/base64-js-tests.ts @@ -1,5 +1,5 @@ import * as base64js from "base64-js"; -const length: number = base64js.byteLength(""); -const bytes: Uint8Array = base64js.toByteArray(""); -const decoded: string = base64js.fromByteArray(new Uint8Array(0)); +base64js.byteLength(""); // $ExpectType number +base64js.toByteArray(""); // $ExpectType Uint8Array +base64js.fromByteArray(new Uint8Array(0)); // $ExpectTpe string diff --git a/types/base64-js/tslint.json b/types/base64-js/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/base64-js/tslint.json +++ b/types/base64-js/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/bigi/bigi-tests.ts b/types/bigi/bigi-tests.ts index 70569bb919..ef9d7421d3 100644 --- a/types/bigi/bigi-tests.ts +++ b/types/bigi/bigi-tests.ts @@ -1,9 +1,9 @@ import BigInteger = require('bigi'); -var b1 = BigInteger.fromHex("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012"); -var b2 = BigInteger.fromHex("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811"); +const b1 = BigInteger.fromHex("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012"); +const b2 = BigInteger.fromHex("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811"); -var b3 = b1.multiply(b2); +const b3 = b1.multiply(b2); console.log(b3.toHex()); -// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132 \ No newline at end of file +// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132 diff --git a/types/bigi/tslint.json b/types/bigi/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/bigi/tslint.json +++ b/types/bigi/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/bignumber.js/bignumber.js-tests.ts b/types/bignumber.js/bignumber.js-tests.ts index 9dc96dd7ea..8ea0775dba 100644 --- a/types/bignumber.js/bignumber.js-tests.ts +++ b/types/bignumber.js/bignumber.js-tests.ts @@ -1,5 +1,5 @@ -var x: BigNumber.BigNumber = new BigNumber(9); -var y = new BigNumber(x); +let x: BigNumber.BigNumber = new BigNumber(9); +let y = new BigNumber(x); BigNumber(435.345); @@ -27,7 +27,7 @@ new BigNumber(1.23456789); new BigNumber(1.23456789, 10); BigNumber.config({ DECIMAL_PLACES: 5 }); -var BN = BigNumber.another({ DECIMAL_PLACES: 9 }); +let BN = BigNumber.another({ DECIMAL_PLACES: 9 }); x = new BigNumber(1); y = new BN(1); @@ -112,14 +112,14 @@ BigNumber.config({ BigNumber.config(40, 7, [-10, 20], 500, 1, 1, 3, 80); -var obj = BigNumber.config(); +const obj = BigNumber.config(); obj.ERRORS; obj.RANGE; x = new BigNumber('3257869345.0378653'); BigNumber.max(4e9, x, '123456789.9'); -var arr = [12, '13', new BigNumber(14)]; +let arr = [12, '13', new BigNumber(14)]; BigNumber.max(arr); x = new BigNumber('3257869345.0378653'); @@ -137,7 +137,7 @@ BigNumber.config({ ROUNDING_MODE: 2 }); x = new BigNumber(-0.8); y = x.absoluteValue(); -var z = y.abs(); +let z = y.abs(); x = new BigNumber(1.3); x.ceil(); @@ -300,7 +300,7 @@ y.toFixed(2); y.toFixed(2, 1); y.toFixed(5); -var format = { +const format = { decimalSeparator: '.', groupSeparator: ',', groupSize: 3, @@ -332,7 +332,7 @@ x.toFormat(6); x = new BigNumber(1.75); x.toFraction(); -var pi = new BigNumber('3.14159265358'); +const pi = new BigNumber('3.14159265358'); pi.toFraction(); pi.toFraction(100000); pi.toFraction(10000); @@ -344,7 +344,7 @@ x = new BigNumber('177.7e+457'); y = new BigNumber(235.4325); z = new BigNumber('0.0098074'); -var str = JSON.stringify([x, y, z]); +const str = JSON.stringify([x, y, z]); JSON.parse(str, (key, val) => key === '' ? val : new BigNumber(val)); diff --git a/types/bignumber.js/index.d.ts b/types/bignumber.js/index.d.ts index 10423b1ed3..d627ad136c 100644 --- a/types/bignumber.js/index.d.ts +++ b/types/bignumber.js/index.d.ts @@ -673,4 +673,4 @@ declare namespace BigNumber { */ isBigNumber: true; } -} \ No newline at end of file +} diff --git a/types/bignumber.js/tslint.json b/types/bignumber.js/tslint.json index 2221e40e4a..3db14f85ea 100644 --- a/types/bignumber.js/tslint.json +++ b/types/bignumber.js/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } \ No newline at end of file +{ "extends": "dtslint/dt.json" } diff --git a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts index bdaee3ee83..7267fe5d26 100644 --- a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts +++ b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts @@ -3,9 +3,9 @@ import bigi = require('bigi'); import bitcoin = require('bitcoinjs-lib'); -declare var it: any; -declare var describe: any; -declare var assert: any; +declare const it: any; +declare const describe: any; +declare const assert: any; describe('bitcoinjs-lib (basic)', () => { it('can generate a random bitcoin address', () => { @@ -13,18 +13,18 @@ describe('bitcoinjs-lib (basic)', () => { function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); } // generate random keyPair - var keyPair = bitcoin.ECPair.makeRandom({ rng }); - var address = keyPair.getAddress(); + const keyPair = bitcoin.ECPair.makeRandom({ rng }); + const address = keyPair.getAddress(); assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64'); }); it('can generate an address from a SHA256 hash', () => { - var hash = bitcoin.crypto.sha256('correct horse battery staple'); - var d = bigi.fromBuffer(hash); + const hash = bitcoin.crypto.sha256('correct horse battery staple'); + const d = bigi.fromBuffer(hash); - var keyPair = new bitcoin.ECPair(d); - var address = keyPair.getAddress(); + const keyPair = new bitcoin.ECPair(d); + const address = keyPair.getAddress(); assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8'); }); @@ -33,26 +33,26 @@ describe('bitcoinjs-lib (basic)', () => { // for testing only function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); } - var litecoin = bitcoin.networks.litecoin; + const litecoin = bitcoin.networks.litecoin; - var keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng }); - var wif = keyPair.toWIF(); - var address = keyPair.getAddress(); + const keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng }); + const wif = keyPair.toWIF(); + const address = keyPair.getAddress(); assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn'); assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS'); }); it('can import an address via WIF', () => { - var keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct'); - var address = keyPair.getAddress(); + const keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct'); + const address = keyPair.getAddress(); assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31'); }); it('can create a Transaction', () => { - var keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy'); - var tx = new bitcoin.TransactionBuilder(); + const keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy'); + const tx = new bitcoin.TransactionBuilder(); tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0); tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000); diff --git a/types/bitcoinjs-lib/tslint.json b/types/bitcoinjs-lib/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/bitcoinjs-lib/tslint.json +++ b/types/bitcoinjs-lib/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/bittorrent-protocol/bittorrent-protocol-tests.ts b/types/bittorrent-protocol/bittorrent-protocol-tests.ts index f5f6b4649f..c32b2af368 100644 --- a/types/bittorrent-protocol/bittorrent-protocol-tests.ts +++ b/types/bittorrent-protocol/bittorrent-protocol-tests.ts @@ -7,7 +7,7 @@ class TestExtension implements Protocol.Extension { } net.createServer(socket => { - var wire = new Protocol(); + const wire = new Protocol(); wire.use(TestExtension); diff --git a/types/bittorrent-protocol/index.d.ts b/types/bittorrent-protocol/index.d.ts index 6d838a90f5..b5ef1a4a44 100644 --- a/types/bittorrent-protocol/index.d.ts +++ b/types/bittorrent-protocol/index.d.ts @@ -10,30 +10,30 @@ import * as stream from 'stream'; declare const BittorrentProtocol: BittorrentProtocol.BittorrentProtocol; declare namespace BittorrentProtocol { - export interface BittorrentProtocol { + interface BittorrentProtocol { new (): Wire; (): Wire; } - export interface ExtensionConstructor { + interface ExtensionConstructor { new (wire: Wire): Extension; } - export interface Extension { - onHandshake?: (infoHash: string, peerId: string, extensions: { [name: string]: boolean }) => void; - onExtendedHandshake?: (handshake: { [key: string]: any }) => void; - onMessage?: (buf: Buffer) => void; + interface Extension { + onHandshake?(infoHash: string, peerId: string, extensions: { [name: string]: boolean }): void; + onExtendedHandshake?(handshake: { [key: string]: any }): void; + onMessage?(buf: Buffer): void; name: string; } - export interface Request { + interface Request { piece: number; offset: number; length: number; - callback: () => void; + callback(): void; } - export interface Wire extends stream.Duplex { + interface Wire extends stream.Duplex { readonly peerId: string; // remote peer id (hex string) readonly peerIdBuffer: Buffer; // remote peer id (Buffer) readonly type: 'webrtc' | 'tcpIncoming' | 'tcpOutgoing' | 'webSeed'; // connection type diff --git a/types/bittorrent-protocol/tslint.json b/types/bittorrent-protocol/tslint.json index 3c4a3237e8..dfea11be1a 100644 --- a/types/bittorrent-protocol/tslint.json +++ b/types/bittorrent-protocol/tslint.json @@ -1,5 +1,5 @@ { - "extends": "../tslint.json", + "extends": "dtslint/dt.json", "rules": { "no-misused-new": false } diff --git a/types/blacklist/blacklist-tests.ts b/types/blacklist/blacklist-tests.ts index 0f465dd62a..5c5803c45c 100644 --- a/types/blacklist/blacklist-tests.ts +++ b/types/blacklist/blacklist-tests.ts @@ -1,4 +1,4 @@ -var someInput = { a: 1, b: 2, c: 3 }; +const someInput = { a: 1, b: 2, c: 3 }; import blacklist = require('blacklist'); @@ -10,4 +10,4 @@ blacklist(someInput, { b: false, // b will be in the result c: 1 > 2 // false, therefore c will be in the result }); -// => { b: 2, c: 3 } \ No newline at end of file +// => { b: 2, c: 3 } diff --git a/types/blacklist/tslint.json b/types/blacklist/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/blacklist/tslint.json +++ b/types/blacklist/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/bleno/bleno-tests.ts b/types/bleno/bleno-tests.ts new file mode 100644 index 0000000000..7dcb47ff35 --- /dev/null +++ b/types/bleno/bleno-tests.ts @@ -0,0 +1,56 @@ +import * as Bleno from 'bleno'; + +export class EchoCharacteristic extends Bleno.Characteristic { + _value: any; + _updateValueCallback: any; + + constructor() { + super({ + uuid: 'ec0e', + properties: ['read', 'write', 'notify'], + value: null + }); + this._value = new ArrayBuffer(0); + this._updateValueCallback = null; + } + + onReadRequest(offset: number, callback: any) { + callback(Bleno.Characteristic.RESULT_SUCCESS, this._value); + } + + onWriteRequest(data: any, offset: number, withoutResponse: boolean, callback: any) { + this._value = data; + + if (this._updateValueCallback) { + this._updateValueCallback(this._value); + } + + callback(Bleno.Characteristic.RESULT_SUCCESS); + } + + onSubscribe(maxValueSize: number, updateValueCallback: any) { + this._updateValueCallback = updateValueCallback; + } + + onUnsubscribefunction() { + this._updateValueCallback = null; + } +} + +Bleno.on('stateChange', (state: string) => { + if (state === 'poweredOn') { + Bleno.startAdvertising('echo', ['ec00'], () => {}); + } else { + Bleno.stopAdvertising(() => {}); + } +}); + +let characteristic = new EchoCharacteristic(); +Bleno.on('advertisingStart', (error: string) => { + if (!error) { + Bleno.setServices( + [new Bleno.PrimaryService({uuid: 'ec00', characteristics: [ characteristic ] })], + () => {} + ); + } +}); diff --git a/types/bleno/index.d.ts b/types/bleno/index.d.ts new file mode 100644 index 0000000000..a59e394a84 --- /dev/null +++ b/types/bleno/index.d.ts @@ -0,0 +1,128 @@ +// Type definitions for bleno 0.4 +// Project: https://github.com/sandeepmistry/bleno +// Definitions by: Manuel Francisco Naranjo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export class Characteristic { + uuid: any; + properties: any; + secure: any; + value: any; + descriptors: any; + + constructor(options: any); + + onIndicate(): void; + + onNotify(): void; + + onReadRequest(offset: any, callback: any): void; + + onSubscribe(maxValueSize: any, updateValueCallback: any): void; + + onUnsubscribe(): void; + + onWriteRequest(data: any, offset: any, withoutResponse: any, callback: any): void; + + toString(): any; + + static RESULT_ATTR_NOT_LONG: number; + + static RESULT_INVALID_ATTRIBUTE_LENGTH: number; + + static RESULT_INVALID_OFFSET: number; + + static RESULT_SUCCESS: number; + + static RESULT_UNLIKELY_ERROR: number; +} + +export class Descriptor { + uuid: any; + value: any; + + constructor(options: any); + + toString(): any; +} + +export class PrimaryService { + uuid: any; + characteristics: any; + + constructor(options: any); + + toString(): any; +} + +export const address: string; + +export const domain: any; + +export const mtu: number; + +export const platform: string; + +export const rssi: number; + +export const state: string; + +export function addListener(type: any, listener: any): any; + +export function disconnect(): void; + +export function emit(type: any, ...args: any[]): any; + +export function eventNames(): any; + +export function getMaxListeners(): any; + +export function listenerCount(type: any): any; + +export function listeners(type: any): any; + +export function on(type: any, listener: any): any; + +export function onAccept(clientAddress: any): void; + +export function onAddressChange(address: any): void; + +export function onAdvertisingStart(error: any): void; + +export function onAdvertisingStop(): void; + +export function onDisconnect(clientAddress: any): void; + +export function onMtuChange(mtu: any): void; + +export function onPlatform(platform: any): void; + +export function onRssiUpdate(rssi: any): void; + +export function onServicesSet(error: any): void; + +export function onStateChange(state: any): void; + +export function once(type: any, listener: any): any; + +export function prependListener(type: any, listener: any): any; + +export function prependOnceListener(type: any, listener: any): any; + +export function removeAllListeners(type: any, ...args: any[]): any; + +export function removeListener(type: any, listener: any): any; + +export function setMaxListeners(n: any): any; + +export function setServices(services: any, callback: any): void; + +export function startAdvertising(name: any, serviceUuids: any, callback: any): void; + +export function startAdvertisingIBeacon(uuid: any, major: any, minor: any, measuredPower: any, callback: any): void; + +export function startAdvertisingWithEIRData(advertisementData: any, scanData: any, callback: any): void; + +export function stopAdvertising(callback: any): void; + +export function updateRssi(callback: any): void; diff --git a/types/bleno/tsconfig.json b/types/bleno/tsconfig.json new file mode 100644 index 0000000000..44fa6c893f --- /dev/null +++ b/types/bleno/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bleno-tests.ts" + ] +} diff --git a/types/inert/tslint.json b/types/bleno/tslint.json similarity index 100% rename from types/inert/tslint.json rename to types/bleno/tslint.json diff --git a/types/blessed/index.d.ts b/types/blessed/index.d.ts index 24b6fddaf3..b08f77b3b1 100644 --- a/types/blessed/index.d.ts +++ b/types/blessed/index.d.ts @@ -44,7 +44,7 @@ declare namespace Blessed { track?: {bg?: string; fg?: string;}; scrollbar?: {bg?: string; fg?: string;}; } - + export type TBorder = { /** * Type of border (line or bg). bg by default. @@ -57,15 +57,15 @@ declare namespace Blessed { /** * Border foreground and background, must be numbers (-1 for default). */ - bg?: number; + bg?: number; fg?: number; /** * Border attributes. */ - bold?: string; + bold?: string; underline?: string; } - + export type TCursor = { /** * Have blessed draw a custom cursor and hide the terminal cursor (experimental). @@ -85,26 +85,26 @@ declare namespace Blessed { color: string; } - export type TAlign = "left" | "center" | "right"; + export type TAlign = "left" | "center" | "right"; - export type ListbarCommand = { - key: string; + export type ListbarCommand = { + key: string; callback: () => void; - }; + }; export type TImage = { /** * Pixel width. */ - width: number; + width: number; /** * Pixel height. */ height: number; /** * Image bitmap. - * */ - bmp: any; + * */ + bmp: any; /** * Image cellmap (bitmap scaled down to cell size). */ @@ -132,13 +132,13 @@ declare namespace Blessed { } export module Events { - + export interface IMouseEventArg { x: number; y: number; action: Types.TMouseAction; } - + export interface IKeyEventArg { full: string; name: string; @@ -148,7 +148,7 @@ declare namespace Blessed { sequence: string; } } - + export interface NodeChildProcessExecOptions { cwd?: string; stdio?: any; @@ -163,14 +163,14 @@ declare namespace Blessed { export interface IDestroyable { destroy(): void; } - + export interface IOptions { } - + export interface IHasOptions { options: T; } - + export interface TputsOptions extends IOptions { terminal?: string; extended?: boolean; @@ -201,7 +201,7 @@ declare namespace Blessed { termcapFile: string; error: Error; terminal: string; - + setup(): void; term(is: any): boolean; readTerminfo(term: string): string; @@ -233,11 +233,11 @@ declare namespace Blessed { strings: Object; }; } - + export interface IDestroyable { destroy(): void; } - + export interface INodeOptions extends IOptions { name?: string; screen?: Screen; @@ -245,7 +245,7 @@ declare namespace Blessed { children?: Node[]; focusable?: boolean; } - + export abstract class Node extends EventEmitter implements IHasOptions, IDestroyable { constructor(options: INodeOptions); @@ -257,7 +257,7 @@ declare namespace Blessed { * Original options object. */ options: INodeOptions; - + /** * An object for any miscellanous user data. */ @@ -290,7 +290,7 @@ declare namespace Blessed { * Array of node's children. */ children: Node[]; - + // ** methods ** // /** @@ -398,7 +398,7 @@ declare namespace Blessed { */ on(event: "detach", callback: (arg: Node) => void): this; } - + export class NodeWithEvents extends Node { // ** methods ** // @@ -417,7 +417,7 @@ declare namespace Blessed { removeKey(name: string, listener: Function): void; // ** events ** // - + on(event: string, listener: Function): this; /** * Received on screen resize. @@ -451,12 +451,12 @@ declare namespace Blessed { */ //on(event: "key", callback: (arg: BlessedScreen) => void): this; /** - * Received when the terminal window focuses/blurs. Requires a terminal supporting the + * Received when the terminal window focuses/blurs. Requires a terminal supporting the * focus protocol and focus needs to be passed to program.enableMouse(). */ on(event: "focus", callback: (arg: Screen) => void): this; /** - * Received when the terminal window focuses/blurs. Requires a terminal supporting the + * Received when the terminal window focuses/blurs. Requires a terminal supporting the * focus protocol and focus needs to be passed to program.enableMouse(). */ on(event: "blur", callback: (arg: Screen) => void): this; @@ -492,31 +492,31 @@ declare namespace Blessed { * Received when element becomes hidden. */ on(event: "hide", callback: () => void): this; - + on(event: "set content", callback: () => void): this; on(event: "parsed content", callback: () => void): this; } - + export interface IScreenOptions extends INodeOptions { /** * The blessed Program to be associated with. Will be automatically instantiated if none is provided. */ program?: BlessedProgram; /** - * Attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with - * uniform cells to their sides). This is known to cause flickering with elements that are not full-width, + * Attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with + * uniform cells to their sides). This is known to cause flickering with elements that are not full-width, * however, it is more optimal for terminal rendering. */ smartCSR?: boolean; /** - * Do CSR on any element within 20 cols of the screen edge on either side. Faster than smartCSR, + * Do CSR on any element within 20 cols of the screen edge on either side. Faster than smartCSR, * but may cause flickering depending on what is on each side of the element. */ fastCSR?: boolean; /** - * Attempt to perform back_color_erase optimizations for terminals that support it. It will also work - * with terminals that don't support it, but only on lines with the default background color. As it - * stands with the current implementation, it's uncertain how much terminal performance this adds at + * Attempt to perform back_color_erase optimizations for terminals that support it. It will also work + * with terminals that don't support it, but only on lines with the default background color. As it + * stands with the current implementation, it's uncertain how much terminal performance this adds at * the cost of overhead within node. */ useBCE?: boolean; @@ -529,13 +529,13 @@ declare namespace Blessed { */ tabSize?: number; /** - * Automatically position child elements with border and padding in mind (NOTE: this is a recommended + * Automatically position child elements with border and padding in mind (NOTE: this is a recommended * option. It may become default in the future). */ autoPadding?: boolean; - + cursor?: Types.TCursor; - + /** * Create a log file. See log method. */ @@ -545,31 +545,31 @@ declare namespace Blessed { */ dump?: string; /** - * Debug mode. Enables usage of the debug method. Also creates a debug console which will display when + * Debug mode. Enables usage of the debug method. Also creates a debug console which will display when * pressing F12. It will display all log and debug messages. */ debug?: (...msg: string[]) => void; /** - * Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful + * Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful * for creating a key that will always exit no matter whether the keys are locked. */ ignoreLocked?: boolean; /** - * Automatically "dock" borders with other elements instead of overlapping, depending on position + * Automatically "dock" borders with other elements instead of overlapping, depending on position * (experimental). For example: These border-overlapped elements: */ dockBorders?: boolean; /** - * Normally, dockable borders will not dock if the colors or attributes are different. This option + * Normally, dockable borders will not dock if the colors or attributes are different. This option * will allow them to dock regardless. It may produce some odd looking multi-colored borders though. */ ignoreDockContrast?: boolean; /** - * Allow for rendering of East Asian double-width characters, utf-16 surrogate pairs, and unicode - * combining characters. This allows you to display text above the basic multilingual plane. This - * is behind an option because it may affect performance slightly negatively. Without this option - * enabled, all double-width, surrogate pair, and combining characters will be replaced by '??', - * '?', '' respectively. (NOTE: iTerm2 cannot display combining characters properly. Blessed simply + * Allow for rendering of East Asian double-width characters, utf-16 surrogate pairs, and unicode + * combining characters. This allows you to display text above the basic multilingual plane. This + * is behind an option because it may affect performance slightly negatively. Without this option + * enabled, all double-width, surrogate pair, and combining characters will be replaced by '??', + * '?', '' respectively. (NOTE: iTerm2 cannot display combining characters properly. Blessed simply * removes them from an element's content if iTerm2 is detected). */ fullUnicode?: boolean; @@ -582,17 +582,17 @@ declare namespace Blessed { */ warnings?: boolean; /** - * Force blessed to use unicode even if it is not detected via terminfo, env variables, or windows code page. + * Force blessed to use unicode even if it is not detected via terminfo, env variables, or windows code page. * If value is true unicode is forced. If value is false non-unicode is forced (default: null). */ forceUnicode?: boolean; /** - * Input and output streams. process.stdin/process.stdout by default, however, it could be a + * Input and output streams. process.stdin/process.stdout by default, however, it could be a * net.Socket if you want to make a program that runs over telnet or something of that nature. * */ input?: stream.Writable; /** - * Input and output streams. process.stdin/process.stdout by default, however, it could be a + * Input and output streams. process.stdin/process.stdout by default, however, it could be a * net.Socket if you want to make a program that runs over telnet or something of that nature. * */ output?: stream.Readable; @@ -673,13 +673,13 @@ declare namespace Blessed { */ title?: string; } - + export class Screen extends NodeWithEvents implements IHasOptions { constructor(opts: IScreenOptions); // ** properties ** // cleanSides: any; - + /** * Original options object. */ @@ -690,20 +690,20 @@ declare namespace Blessed { */ program: BlessedProgram; /** - * Attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with - * uniform cells to their sides). This is known to cause flickering with elements that are not full-width, + * Attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with + * uniform cells to their sides). This is known to cause flickering with elements that are not full-width, * however, it is more optimal for terminal rendering. */ smartCSR: boolean; /** - * Do CSR on any element within 20 cols of the screen edge on either side. Faster than smartCSR, + * Do CSR on any element within 20 cols of the screen edge on either side. Faster than smartCSR, * but may cause flickering depending on what is on each side of the element. */ fastCSR: boolean; /** - * Attempt to perform back_color_erase optimizations for terminals that support it. It will also work - * with terminals that don't support it, but only on lines with the default background color. As it - * stands with the current implementation, it's uncertain how much terminal performance this adds at + * Attempt to perform back_color_erase optimizations for terminals that support it. It will also work + * with terminals that don't support it, but only on lines with the default background color. As it + * stands with the current implementation, it's uncertain how much terminal performance this adds at * the cost of overhead within node. */ useBCE: boolean; @@ -716,38 +716,38 @@ declare namespace Blessed { */ tabSize: number; /** - * Automatically position child elements with border and padding in mind (NOTE: this is a recommended + * Automatically position child elements with border and padding in mind (NOTE: this is a recommended * option. It may become default in the future). */ autoPadding: boolean; - + cursor: Types.TCursor; - + /** * Dump all output and input to desired file. Can be used together with log option if set as a boolean. */ dump: string; /** - * Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful + * Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful * for creating a key that will always exit no matter whether the keys are locked. */ ignoreLocked: boolean; /** - * Automatically "dock" borders with other elements instead of overlapping, depending on position + * Automatically "dock" borders with other elements instead of overlapping, depending on position * (experimental). For example: These border-overlapped elements: */ dockBorders: boolean; /** - * Normally, dockable borders will not dock if the colors or attributes are different. This option + * Normally, dockable borders will not dock if the colors or attributes are different. This option * will allow them to dock regardless. It may produce some odd looking multi-colored borders though. */ ignoreDockContrast: boolean; /** - * Allow for rendering of East Asian double-width characters, utf-16 surrogate pairs, and unicode - * combining characters. This allows you to display text above the basic multilingual plane. This - * is behind an option because it may affect performance slightly negatively. Without this option - * enabled, all double-width, surrogate pair, and combining characters will be replaced by '??', - * '?', '' respectively. (NOTE: iTerm2 cannot display combining characters properly. Blessed simply + * Allow for rendering of East Asian double-width characters, utf-16 surrogate pairs, and unicode + * combining characters. This allows you to display text above the basic multilingual plane. This + * is behind an option because it may affect performance slightly negatively. Without this option + * enabled, all double-width, surrogate pair, and combining characters will be replaced by '??', + * '?', '' respectively. (NOTE: iTerm2 cannot display combining characters properly. Blessed simply * removes them from an element's content if iTerm2 is detected). */ fullUnicode: boolean; @@ -760,17 +760,17 @@ declare namespace Blessed { */ warnings: boolean; /** - * Force blessed to use unicode even if it is not detected via terminfo, env variables, or windows code page. + * Force blessed to use unicode even if it is not detected via terminfo, env variables, or windows code page. * If value is true unicode is forced. If value is false non-unicode is forced (default: null). */ forceUnicode: boolean; /** - * Input and output streams. process.stdin/process.stdout by default, however, it could be a + * Input and output streams. process.stdin/process.stdout by default, however, it could be a * net.Socket if you want to make a program that runs over telnet or something of that nature. * */ input: stream.Writable; /** - * Input and output streams. process.stdin/process.stdout by default, however, it could be a + * Input and output streams. process.stdin/process.stdout by default, however, it could be a * net.Socket if you want to make a program that runs over telnet or something of that nature. * */ output: stream.Readable; @@ -850,9 +850,9 @@ declare namespace Blessed { * Set or get window title. */ title: string; - + // ** methods ** // - + /** * Write string to the log file if one was created. */ @@ -860,7 +860,7 @@ declare namespace Blessed { /** * Same as the log method, but only gets called if the debug option was set. */ - debug(...msg: string[]): void; + debug(...msg: string[]): void; /** * Allocate a new pending screen buffer and a new output screen buffer. */ @@ -959,13 +959,13 @@ declare namespace Blessed { */ deleteTop(top: number, bottom: number): void; /** - * Enable mouse events for the screen and optionally an element (automatically called when a form of + * Enable mouse events for the screen and optionally an element (automatically called when a form of * on('mouse') is bound). */ enableMouse(el: BlessedElement): void; enableMouse(): void; /** - * Enable keypress events for the screen and optionally an element (automatically called when a form of + * Enable keypress events for the screen and optionally an element (automatically called when a form of * on('keypress') is bound). */ enableKeys(el: BlessedElement): void; @@ -980,7 +980,7 @@ declare namespace Blessed { */ copyToClipboard(text: string): void; /** - * Attempt to change cursor shape. Will not work in all terminals (see artificial cursors for a solution + * Attempt to change cursor shape. Will not work in all terminals (see artificial cursors for a solution * to this). Returns true if successful. */ cursorShape(shape: boolean, blink: boolean): any; @@ -993,14 +993,14 @@ declare namespace Blessed { */ cursorReset(): void; /** - * Take an SGR screenshot of the screen within the region. Returns a string containing only + * Take an SGR screenshot of the screen within the region. Returns a string containing only * characters and SGR codes. Can be displayed by simply echoing it in a terminal. */ screenshot(xi: number, xl: number, yi: number, yl: number): string; screenshot(): void; /** - * Destroy the screen object and remove it from the global list. Also remove all global events relevant - * to the screen object. If all screen objects are destroyed, the node process is essentially reset + * Destroy the screen object and remove it from the global list. Also remove all global events relevant + * to the screen object. If all screen objects are destroyed, the node process is essentially reset * to its initial state. */ destroy(): void; @@ -1043,23 +1043,23 @@ declare namespace Blessed { /** * Border foreground and background, must be numbers (-1 for default). */ - bg?: number; + bg?: number; fg?: number; /** * Border attributes. */ - bold?: string; + bold?: string; underline?: string; } export interface ElementOptions extends INodeOptions { tags?: boolean; - - fg?: string; - bg?: string; - bold?: string; + + fg?: string; + bg?: string; + bold?: string; underline?: string; - + style?: any; /** * Border object, see below. @@ -1107,24 +1107,24 @@ declare namespace Blessed { */ shrink?: boolean; /** - * Amount of padding on the inside of the element. Can be a number or an object containing + * Amount of padding on the inside of the element. Can be a number or an object containing * the properties: left, right, top, and bottom. */ padding?: number | Padding; - + top?: Types.TTopLeft; left?: Types.TTopLeft; right?: Types.TPosition; bottom?: Types.TPosition; - + /** - * Width/height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). + * Width/height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). * Percentages can also have offsets (50%+1, 50%-1). */ width?: number | string; /** - * Offsets of the element relative to its parent. Can be a number, percentage (0-100%), or - * keyword (center). right and bottom do not accept keywords. Percentages can also have + * Offsets of the element relative to its parent. Can be a number, percentage (0-100%), or + * keyword (center). right and bottom do not accept keywords. Percentages can also have * offsets (50%+1, 50%-1). */ height?: number | string; @@ -1171,7 +1171,7 @@ declare namespace Blessed { // TODO: scrollable - Note: If the scrollable option is enabled, Element inherits all methods from ScrollableBox. export abstract class BlessedElement extends NodeWithEvents implements IHasOptions { constructor(opts: ElementOptions); - + // ** properties ** // /** @@ -1196,28 +1196,28 @@ declare namespace Blessed { /** * Border foreground and background, must be numbers (-1 for default). */ - bg: number; + bg: number; fg: number; /** * Border attributes. */ - bold: string; + bold: string; underline: string; /** * Calculated width. */ - width: number | string; + width: number | string; /** * Calculated height. */ height: number | string; /** - * Calculated relative top offset.*/ - top: Types.TTopLeft; + * Calculated relative top offset.*/ + top: Types.TTopLeft; /** * Calculated relative left offset. - */ - left: Types.TTopLeft; + */ + left: Types.TTopLeft; /** * Calculated relative right offset. */ @@ -1228,12 +1228,12 @@ declare namespace Blessed { bottom: Types.TPosition; /** * Calculated absolute top offset. - */ - atop: Types.TTopLeft; + */ + atop: Types.TTopLeft; /** * Calculated absolute left offset. - */ - aleft: Types.TTopLeft; + */ + aleft: Types.TTopLeft; /** * Calculated absolute right offset. */ @@ -1241,13 +1241,13 @@ declare namespace Blessed { /** * Calculated absolute bottom offset. */ - abottom: Types.TPosition; + abottom: Types.TPosition; /** * Whether the element is draggable. Set to true to allow dragging. */ - draggable: boolean; - + draggable: boolean; + itop: Types.TTopLeft; ileft: Types.TTopLeft; iheight: Types.TPosition; @@ -1255,115 +1255,115 @@ declare namespace Blessed { /** * Calculated relative top offset. - */ + */ rtop: Types.TTopLeft; /** * Calculated relative left offset. - */ + */ rleft: Types.TTopLeft; /** * Calculated relative right offset. - */ + */ rright: Types.TPosition; /** * Calculated relative bottom offset. - */ + */ rbottom: Types.TPosition; - + lpos: PositionCoords; - + // ** methods ** // - + /** * Write content and children to the screen buffer. */ render(): Coords; /** - * Hide element.*/ - hide(): void; + * Hide element.*/ + hide(): void; /** * Show element. */ - show(): void; + show(): void; /** * Toggle hidden/shown. */ toggle(): void; /** * Focus element. - */ - focus(): void; + */ + focus(): void; /** - * Same asel.on('screen', ...) except this will automatically keep track of which listeners + * Same asel.on('screen', ...) except this will automatically keep track of which listeners * are bound to the screen object. For use with removeScreenEvent(), free(), and destroy(). */ - onScreenEvent(type: string, handler: Function): void; + onScreenEvent(type: string, handler: Function): void; /** - * Same asel.removeListener('screen', ...) except this will automatically keep track of which + * Same asel.removeListener('screen', ...) except this will automatically keep track of which * listeners are bound to the screen object. For use with onScreenEvent(), free(), and destroy(). */ removeScreenEvent(type: string, handler: Function): void; /** - * Free up the element. Automatically unbind all events that may have been bound to the screen - * object. This prevents memory leaks. For use with onScreenEvent(), removeScreenEvent(), + * Free up the element. Automatically unbind all events that may have been bound to the screen + * object. This prevents memory leaks. For use with onScreenEvent(), removeScreenEvent(), * and destroy(). - */ - free(): void; + */ + free(): void; /** - * Same as the detach() method, except this will automatically call free() and unbind any screen + * Same as the detach() method, except this will automatically call free() and unbind any screen * events to prevent memory leaks. for use with onScreenEvent(), removeScreenEvent(), and free(). */ - destroy(): void; + destroy(): void; /** * Set the z-index of the element (changes rendering order). */ setIndex(z: number): void; /** - * Put the element in front of its siblings.*/ - setFront(): void; + * Put the element in front of its siblings.*/ + setFront(): void; /** * Put the element in back of its siblings. */ - setBack(): void; + setBack(): void; /** * text/options - Set the label text for the top-left corner. Example options: {text:'foo',side:'left'} */ setLabel(arg: string | LabelOptions): void; /** * Remove the label completely. - */ - removeLabel(): any; + */ + removeLabel(): any; /** - * text/options - Set a hover text box to follow the cursor. Similar to the "title" DOM attribute + * text/options - Set a hover text box to follow the cursor. Similar to the "title" DOM attribute * in the browser. Example options: {text:'foo'} */ setHover(arg: string | LabelOptions): void; /** * Remove the hover label completely. - */ - removeHover(): void; + */ + removeHover(): void; /** * Enable mouse events for the element (automatically called when a form of on('mouse') is bound). */ enableMouse(): void; /** * Enable keypress events for the element (automatically called when a form of on('keypress') is bound). - */ - enableKeys(): void; + */ + enableKeys(): void; /** * Enable key and mouse events. Calls bot enableMouse and enableKeys. */ enableInput(): void; /** * Enable dragging of the element. - */ - enableDrag(): void; + */ + enableDrag(): void; /** * Disable dragging of the element. */ - disableDrag(): void; + disableDrag(): void; /** - * Take an SGR screenshot of the screen within the region. Returns a string containing only + * Take an SGR screenshot of the screen within the region. Returns a string containing only * characters and SGR codes. Can be displayed by simply echoing it in a terminal. */ screenshot(xi: number, xl: number, yi: number, yl: number): string; @@ -1372,132 +1372,132 @@ declare namespace Blessed { /* Content Methods - Methods for dealing with text content, line by line. Useful for writing a text editor, + Methods for dealing with text content, line by line. Useful for writing a text editor, irc client, etc. - Note: All of these methods deal with pre-aligned, pre-wrapped text. If you use deleteTop() - on a box with a wrapped line at the top, it may remove 3-4 "real" lines (rows) depending + Note: All of these methods deal with pre-aligned, pre-wrapped text. If you use deleteTop() + on a box with a wrapped line at the top, it may remove 3-4 "real" lines (rows) depending on how long the original line was. - The lines parameter can be a string or an array of strings. The line parameter must + The lines parameter can be a string or an array of strings. The line parameter must be a string. */ /** - * Set the content. Note: When text is input, it will be stripped of all non-SGR - * escape codes, tabs will be replaced with 8 spaces, and tags will be replaced + * Set the content. Note: When text is input, it will be stripped of all non-SGR + * escape codes, tabs will be replaced with 8 spaces, and tags will be replaced * with SGR codes (if enabled). */ setContent(text: string): void; /** * Return content, slightly different from el.content. Assume the above formatting. - */ - getContent(): string; + */ + getContent(): string; /** * Similar to setContent, but ignore tags and remove escape codes. */ setText(text: string): void; /** * Similar to getContent, but return content with tags and escape codes removed. - */ - getText(): string; + */ + getText(): string; /** * Insert a line into the box's content. */ insertLine(i: number, lines: string | string[]): void; /** * Delete a line from the box's content. - */ - deleteLine(i: number): void; + */ + deleteLine(i: number): void; /** * Get a line from the box's content. */ - getLine(i: number): string; + getLine(i: number): string; /** * Get a line from the box's content from the visible top. */ - getBaseLine(i: number): string; + getBaseLine(i: number): string; /** * Set a line in the box's content. */ - setLine(i: number, line: string | string[]): void; + setLine(i: number, line: string | string[]): void; /** * Set a line in the box's content from the visible top. */ setBaseLine(i: number, line: string | string[]): void; /** * Clear a line from the box's content. - */ - clearLine(i: number): void; + */ + clearLine(i: number): void; /** * Clear a line from the box's content from the visible top. */ - clearBaseLine(i: number): void; + clearBaseLine(i: number): void; /** * Insert a line at the top of the box. */ - insertTop(lines: string | string[]): void; + insertTop(lines: string | string[]): void; /** * Insert a line at the bottom of the box. */ insertBottom(lines: string | string[]): void; /** * Delete a line at the top of the box. - */ - deleteTop(): void; + */ + deleteTop(): void; /** * Delete a line at the bottom of the box. */ - deleteBottom(): void; + deleteBottom(): void; /** * Unshift a line onto the top of the content. */ unshiftLine(lines: string | string[]): void; /** * Shift a line off the top of the content. - */ - shiftLine(i: number): void; + */ + shiftLine(i: number): void; /** * Push a line onto the bottom of the content. */ pushLine(lines: string | string[]): void; /** * Pop a line off the bottom of the content. - */ + */ popLine(i: number): string; /** * An array containing the content lines. - */ - getLines(): string[]; + */ + getLines(): string[]; /** * An array containing the lines as they are displayed on the screen. */ - getScreenLines(): string[]; + getScreenLines(): string[]; /** - * Get a string's displayed width, taking into account double-width, surrogate pairs, + * Get a string's displayed width, taking into account double-width, surrogate pairs, * combining characters, tags, and SGR escape codes. */ - strWidth(text: string): string; + strWidth(text: string): string; // ** events ** // } - + export interface ScrollableBoxOptions extends ElementOptions { /** * A limit to the childBase. Default is Infinity. */ - baseLimit?: number; + baseLimit?: number; /** - * A option which causes the ignoring of childOffset. This in turn causes the + * A option which causes the ignoring of childOffset. This in turn causes the * childBase to change every time the element is scrolled. */ - alwaysScroll?: boolean; + alwaysScroll?: boolean; /** * Object enabling a scrollbar. * Style of the scrollbar track if present (takes regular style options). */ scrollbar?: { style?: any; track?: any; ch?: string; } - } + } export interface ScrollableTextOptions extends ScrollableBoxOptions { /** @@ -1507,18 +1507,18 @@ declare namespace Blessed { mouse?: boolean | (() => void); /** * Use pre-defined keys (i or enter for insert, e for editor, C-e for editor while inserting). - */ - keys?: string | string[] | boolean; + */ + keys?: string | string[] | boolean; /** * Use vi keys with the keys option. */ vi?: boolean; } - + export interface BoxOptions extends ScrollableTextOptions { bindings?: any; } - + /** * DEPRECATED - Use Box with the scrollable option instead. A box with scrollable content. */ @@ -1526,60 +1526,60 @@ declare namespace Blessed { /** * The offset of the top of the scroll content. */ - childBase: number; + childBase: number; /** * The offset of the chosen item/line. */ childOffset: number; - + /** * Scroll the content by a relative offset. */ - scroll(offset: number, always?: boolean): void; + scroll(offset: number, always?: boolean): void; /** * Scroll the content to an absolute index. */ - scrollTo(index: number): void; + scrollTo(index: number): void; /** * Same as scrollTo. */ - setScroll(index: number): void; + setScroll(index: number): void; /** * Set the current scroll index in percentage (0-100). */ setScrollPerc(perc: number): void; /** * Get the current scroll index in lines. - */ - getScroll(): void; + */ + getScroll(): number; /** * Get the actual height of the scrolling area. */ - getScrollHeight(): void; + getScrollHeight(): number; /** * Get the current scroll index in percentage. - */ - getScrollPerc(): void; + */ + getScrollPerc(): number; /** * Reset the scroll index to its initial state. - */ - resetScroll(): void; - + */ + resetScroll(): void; + on(event: string, listener: Function): this; /** * Received when the element is scrolled. */ on(event: "scroll", callback: () => void): this; } - + /** * DEPRECATED - Use Box with the scrollable and alwaysScroll options instead. - * A scrollable text box which can display and scroll text, as well as handle + * A scrollable text box which can display and scroll text, as well as handle * pre-existing newlines and escape codes. */ export class ScrollableTextElement extends ScrollableBoxElement { } - + /** * A box element which draws a simple box containing content or other elements. */ @@ -1594,7 +1594,7 @@ declare namespace Blessed { export interface TextOptions extends ElementOptions { /** - * Fill the entire line with chosen bg until parent bg ends, even if there + * Fill the entire line with chosen bg until parent bg ends, even if there * is not enough text to fill the entire width. */ fill?: boolean; @@ -1609,13 +1609,13 @@ declare namespace Blessed { */ export class TextElement extends BlessedElement implements IHasOptions { constructor(opts: TextOptions); - + /** * Original options object. */ options: TextOptions; } - + /** * A simple line which can be line or bg styled. */ @@ -1632,51 +1632,51 @@ declare namespace Blessed { fg?: string; ch?: string; } - + /** * A simple line which can be line or bg styled. */ export class LineElement extends BoxElement implements IHasOptions { constructor(opts: LineOptions); - + /** * Original options object. */ options: LineOptions; } - + export interface BigTextOptions extends BoxOptions { /** * bdf->json font file to use (see ttystudio for instructions on compiling BDFs to JSON). */ - font?: string; + font?: string; /** * bdf->json bold font file to use (see ttystudio for instructions on compiling BDFs to JSON). */ fontBold?: string; /** * foreground character. (default: ' ') - */ + */ fch?: string; } - + /** * A box which can render content drawn as 8x14 cell characters using the terminus font. */ export class BigTextElement extends BoxElement implements IHasOptions { constructor(opts: BigTextOptions); - + /** * Original options object. */ options: BigTextOptions; } - + export interface ListElementStyle { selected?: any; item?: any; } - + export interface ListOptions extends BoxOptions { /** * Style for a selected item. Style for an unselected item. @@ -1687,9 +1687,9 @@ declare namespace Blessed { */ items?: string[]; /** - * A function that is called when vi mode is enabled and the key / is pressed. This function accepts a - * callback function which should be called with the search string. The search string is then used to - * jump to an item that is found in items. + * A function that is called when vi mode is enabled and the key / is pressed. This function accepts a + * callback function which should be called with the search string. The search string is then used to + * jump to an item that is found in items. */ search?: () => void; /** @@ -1701,10 +1701,10 @@ declare namespace Blessed { */ invertSelected?: boolean; } - + export class ListElement extends BoxElement implements IHasOptions> { constructor(opts: ListOptions); - + /** * Original options object. */ @@ -1712,11 +1712,11 @@ declare namespace Blessed { /** * Add an item based on a string. - */ + */ add(text: string): void; /** * Add an item based on a string. - */ + */ addItem(text: string): void; /** * Removes an item from the list. Child can be an element, index, or string. @@ -1724,75 +1724,75 @@ declare namespace Blessed { removeItem(child: BlessedElement): BlessedElement; /** * Push an item onto the list. - * */ + * */ pushItem(child: BlessedElement): number; /** * Pop an item off the list. - * */ - popItem(): BlessedElement; + * */ + popItem(): BlessedElement; /** * Unshift an item onto the list. */ unshiftItem(child: BlessedElement): number; /** * Shift an item off the list. - * */ - shiftItem(): BlessedElement; + * */ + shiftItem(): BlessedElement; /** * Inserts an item to the list. Child can be an element, index, or string. */ - insertItem(i: number, child: BlessedElement): void; + insertItem(i: number, child: BlessedElement): void; /** * Returns the item element. Child can be an element, index, or string. */ - getItem(child: BlessedElement): BlessedElement; + getItem(child: BlessedElement): BlessedElement; /** * Set item to content. */ setItem(child: BlessedElement, content: BlessedElement | string): void; /** * Remove and insert items to the list. - * */ + * */ spliceItem(i: number, n: number, ...items: BlessedElement[]): void; /** * Clears all items from the list. - * */ - clearItems(): void; + * */ + clearItems(): void; /** * Sets the list items to multiple strings. */ - setItems(items: BlessedElement[]): void; + setItems(items: BlessedElement[]): void; /** * Returns the item index from the list. Child can be an element, index, or string. */ getItemIndex(child: BlessedElement): number; /** * Select an index of an item. - * */ + * */ select(index: number): void; /** * Select item based on current offset. - * */ + * */ move(offset: number): void; /** * Select item above selected. - * */ - up(amount: number): void; + * */ + up(amount: number): void; /** * Select item below selected. */ - down(amount: number): void; + down(amount: number): void; /** * Show/focus list and pick an item. The callback is executed with the result. */ - pick(callback: () => void): void; + pick(callback: () => void): void; /** * Find an item based on its text content. */ - fuzzyFind(arg: string | RegExp | (() => void)): void; - + fuzzyFind(arg: string | RegExp | (() => void)): void; + // ** events ** // - + on(event: string, listener: Function): this; /** * Received when an item is selected. @@ -1806,7 +1806,7 @@ declare namespace Blessed { * Either a select or a cancel event was received. */ on(event: "action", callback: () => void): this; - + on(event: "create item", callback: () => void): this; on(event: "add item", callback: () => void): this; on(event: "remove item", callback: () => void): this; @@ -1814,17 +1814,17 @@ declare namespace Blessed { on(event: "set items", callback: () => void): this; on(event: "select item", callback: (item: BlessedElement, index: number) => void): this; } - + export interface FileManagerOptions extends ListOptions { /** * Current working directory. */ cwd?: string; } - + export class FileManagerElement extends ListElement implements IHasOptions { constructor(opts: FileManagerOptions); - + /** * Original options object. */ @@ -1833,7 +1833,7 @@ declare namespace Blessed { * Current working directory. */ cwd: string; - + /** * Refresh the file list (perform a readdir on cwd and update the list items). */ @@ -1851,9 +1851,9 @@ declare namespace Blessed { reset(cwd:string, callback: () => void): void; reset(callback: () => void): void; reset(): void; - + // ** events ** // - + on(event: string, listener: Function): this; /** * Received when an item is selected. @@ -1863,11 +1863,11 @@ declare namespace Blessed { * Received when an item is selected. */ on(event: "file", callback: (file: string) => void): this; - + on(event: "error", callback: (err: any, file: string) => void): this; on(event: "refresh", callback: () => void): this; } - + export interface StyleListTable extends ListElementStyle { /** * Header style. @@ -1878,7 +1878,7 @@ declare namespace Blessed { */ cell?: any; } - + export interface ListTableOptions extends ListOptions { /** * Array of array of strings representing rows. @@ -1886,7 +1886,7 @@ declare namespace Blessed { rows?: string[]; data?: string[][]; /** - * Spaces to attempt to pad on the sides of each cell. 2 by default: one space on each side + * Spaces to attempt to pad on the sides of each cell. 2 by default: one space on each side * (only useful if the width is shrunken). */ pad?: number; @@ -1894,22 +1894,22 @@ declare namespace Blessed { * Do not draw inner cells. */ noCellBorders?: boolean; - + style?: StyleListTable; } - + export class ListTableElement extends ListElement implements IHasOptions { constructor(opts: ListTableOptions); - + /** * Original options object. */ options: ListTableOptions; - + /** * Set rows in table. Array of arrays of strings. * @example: - * + * * table.setData([ [ 'Animals', 'Foods' ], [ 'Elephant', 'Apple' ], @@ -1920,7 +1920,7 @@ declare namespace Blessed { /** * Set rows in table. Array of arrays of strings. * @example: - * + * * table.setData([ [ 'Animals', 'Foods' ], [ 'Elephant', 'Apple' ], @@ -1929,11 +1929,11 @@ declare namespace Blessed { */ setData(rows: string[][]): void; } - + export interface ListbarOptions extends BoxOptions { style?: ListElementStyle; /** - * Set buttons using an object with keys as titles of buttons, containing of objects + * Set buttons using an object with keys as titles of buttons, containing of objects * containing keys of keys and callback. */ commands: Types.ListbarCommand[]; @@ -1943,15 +1943,15 @@ declare namespace Blessed { */ autoCommandKeys: boolean; } - + export class ListbarElement extends BoxElement implements IHasOptions { constructor(opts: ListbarOptions); - + /** * Original options object. */ options: ListbarOptions; - + /** * Set commands (see commands option above). */ @@ -1990,18 +1990,18 @@ declare namespace Blessed { moveRight(offset: number): void; /** * Select button and execute its callback. - */ + */ selectTab(index: number): void; - + // ** events ** // - + on(event: string, listener: Function): this; on(event: "set items", callback: () => void): this; on(event: "remove item", callback: () => void): this; on(event: "select tab", callback: () => void): this; } - + export interface FormOptions extends BoxOptions { /** * Allow default keys (tab, vi keys, enter). @@ -2015,7 +2015,7 @@ declare namespace Blessed { export class FormElement extends BoxElement implements IHasOptions { constructor(opts: FormOptions); - + /** * Original options object. */ @@ -2024,7 +2024,7 @@ declare namespace Blessed { * Last submitted data. */ submission: TFormData; - + /** * Focus next form element. */ @@ -2045,9 +2045,9 @@ declare namespace Blessed { * Clear the form. */ reset(): void; - + // ** events ** // - + on(event: string, listener: Function): this; /** * Form is submitted. Receives a data object. @@ -2062,7 +2062,7 @@ declare namespace Blessed { */ on(event: "reset", callback: () => void): this; } - + export interface InputOptions extends BoxOptions { } export abstract class InputElement extends BoxElement { @@ -2078,20 +2078,20 @@ declare namespace Blessed { */ inputOnFocus?: boolean; } - + export class TextareaElement extends InputElement implements IHasOptions { constructor(opts: TextareaOptions); - + /** * Original options object. */ options: TextareaOptions; - + /** * The input text. read-only. */ value: string; - + /** * Submit the textarea (emits submit). */ @@ -2101,32 +2101,32 @@ declare namespace Blessed { */ cancel(): void; /** - * Grab key events and start reading text from the keyboard. Takes a callback which receives + * Grab key events and start reading text from the keyboard. Takes a callback which receives * the final value. */ readInput(callback?: (err: any, value?: string) => void): void; /** - * Grab key events and start reading text from the keyboard. Takes a callback which receives + * Grab key events and start reading text from the keyboard. Takes a callback which receives * the final value. */ input(callback: (err: any, value?: string) => void): void; /** - * Grab key events and start reading text from the keyboard. Takes a callback which receives + * Grab key events and start reading text from the keyboard. Takes a callback which receives * the final value. */ setInput(callback: (err: any, value?: string) => void): void; /** - * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which + * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which * receives the final value. */ readEditor(callback: (err: any, value?: string) => void): void; /** - * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which + * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which * receives the final value. */ editor(callback: (err: any, value?: string) => void): void; /** - * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which + * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which * receives the final value. */ setEditor(callback: (err: any, value?: string) => void): void; @@ -2142,9 +2142,9 @@ declare namespace Blessed { * Set value. */ setValue(text: string): void; - + // ** events ** // - + on(event: string, listener: Function): this; on(event: "error", callback: (err: any) => void): this; @@ -2162,7 +2162,7 @@ declare namespace Blessed { */ on(event: "action", callback: (value: any) => void): this; } - + export interface TextboxOptions extends TextareaOptions { /** * Completely hide text. @@ -2173,10 +2173,10 @@ declare namespace Blessed { */ censor?: boolean; } - + export class TextboxElement extends TextareaElement implements IHasOptions { constructor(opts: TextboxOptions); - + /** * Original options object. */ @@ -2189,14 +2189,14 @@ declare namespace Blessed { /** * Replace text with asterisks (*). */ - censor: boolean; + censor: boolean; } - + export interface ButtonOptions extends BoxOptions { } export class ButtonElement extends InputElement implements IHasOptions { constructor(opts: ButtonOptions); - + /** * Original options object. */ @@ -2206,25 +2206,25 @@ declare namespace Blessed { * Press button. Emits press. */ press(): void; - + on(event: string, listener: Function): this; on(event: "press", callback: () => void): this; } - + export interface CheckboxOptions extends BoxOptions { - /** - * whether the element is checked or not. + /** + * whether the element is checked or not. * */ checked?: boolean; - /** - * enable mouse support. + /** + * enable mouse support. * */ mouse?: boolean; } - - /** - * A checkbox which can be used in a form element. + + /** + * A checkbox which can be used in a form element. * */ export class CheckboxElement extends InputElement implements IHasOptions { constructor(options?: CheckboxOptions); @@ -2234,39 +2234,39 @@ declare namespace Blessed { */ options: CheckboxOptions; - /** - * the text next to the checkbox (do not use setcontent, use `check.text = ''`). + /** + * the text next to the checkbox (do not use setcontent, use `check.text = ''`). * */ text: string; - /** - * whether the element is checked or not. + /** + * whether the element is checked or not. * */ checked: boolean; - /** - * same as `checked`. + /** + * same as `checked`. * */ value: boolean; - /** - * check the element. + /** + * check the element. * */ check(): void; - /** - * uncheck the element. + /** + * uncheck the element. * */ uncheck(): void; - /** - * toggle checked state. + /** + * toggle checked state. * */ toggle(): void; - } + } export interface RadioSetOptions extends BoxOptions { } /** - * An element wrapping RadioButtons. RadioButtons within this element will be mutually exclusive + * An element wrapping RadioButtons. RadioButtons within this element will be mutually exclusive * with each other. - * */ + * */ export abstract class RadioSetElement extends BoxElement { constructor(opts: RadioSetOptions); } @@ -2279,7 +2279,7 @@ declare namespace Blessed { export abstract class RadioButtonElement extends CheckboxElement { constructor(opts: RadioButtonOptions); } - + export interface PromptOptions extends BoxOptions { } /** @@ -2297,7 +2297,7 @@ declare namespace Blessed { setInput(text: string, value: string, callback: (err: any, value: string) => void): void; readInput(text: string, value: string, callback: (err: any, value: string) => void): void; } - + export interface QuestionOptions extends BoxOptions { } /** @@ -2307,13 +2307,13 @@ declare namespace Blessed { constructor(opts: QuestionOptions); options: QuestionOptions; - + /** * Ask a question. callback will yield the result. */ ask(question: string, callback: (err: any, value: string) => void): void; } - + export interface MessageOptions extends BoxOptions { } /** @@ -2331,14 +2331,14 @@ declare namespace Blessed { log(text: string, callback: (err: any) => void): void; display(text: string, time: number, callback: (err: any) => void): void; display(text: string, callback: (err: any) => void): void; - + /** * Display an error in the same way. */ error(text: string, time: number, callback: () => void): void; error(text: string, callback: () => void): void; } - + export interface LoadingOptions extends BoxOptions { } /** @@ -2360,32 +2360,32 @@ declare namespace Blessed { } export interface ProgressBarOptions extends BoxOptions { - /** - * can be `horizontal` or `vertical`. + /** + * can be `horizontal` or `vertical`. * */ orientation: string; - /** - * the character to fill the bar with (default is space). + /** + * the character to fill the bar with (default is space). * */ pch: string; - /** - * the amount filled (0 - 100). + /** + * the amount filled (0 - 100). * */ filled: number; - /** - * same as `filled`. + /** + * same as `filled`. * */ value: number; - /** - * enable key support. + /** + * enable key support. * */ keys: boolean; - /** - * enable mouse support. + /** + * enable mouse support. * */ mouse: boolean; } - + /** * A progress bar allowing various styles. This can also be used as a form input. */ @@ -2394,19 +2394,19 @@ declare namespace Blessed { options: ProgressBarOptions; - /** - * progress the bar by a fill amount. + /** + * progress the bar by a fill amount. * */ progress(amount:number): void; - /** - * set progress to specific amount. + /** + * set progress to specific amount. * */ setProgress(amount:number): void; - /** - * reset the bar. + /** + * reset the bar. * */ reset(): void; - + on(event: string, listener: Function): this; /** * Bar was reset. @@ -2419,104 +2419,104 @@ declare namespace Blessed { } export interface LogOptions extends ScrollableTextOptions { - /** - * amount of scrollback allowed. default: Infinity. + /** + * amount of scrollback allowed. default: Infinity. * */ scrollback?: number; - /** - * scroll to bottom on input even if the user has scrolled up. default: false. + /** + * scroll to bottom on input even if the user has scrolled up. default: false. * */ scrollOnInput?: boolean; } - - /** - * A log permanently scrolled to the bottom. + + /** + * A log permanently scrolled to the bottom. * */ export class Log extends ScrollableTextElement implements IHasOptions { constructor(options?: LogOptions); options: LogOptions; - /** - * amount of scrollback allowed. default: Infinity. + /** + * amount of scrollback allowed. default: Infinity. * */ scrollback: number; - /** - * scroll to bottom on input even if the user has scrolled up. default: false. + /** + * scroll to bottom on input even if the user has scrolled up. default: false. * */ scrollOnInput: boolean; - /** - * add a log line. + /** + * add a log line. * */ log(text:string): void; - /** - * add a log line. + /** + * add a log line. * */ add(text:string): void; } export interface TableOptions extends BoxOptions { - /** - * array of array of strings representing rows (same as `data`). + /** + * array of array of strings representing rows (same as `data`). * */ rows?: string[][]; - /** - * array of array of strings representing rows (same as `rows`). + /** + * array of array of strings representing rows (same as `rows`). * */ data?: string[][]; - /** - * spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). + /** + * spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). * */ pad?: number; - /** - * do not draw inner cells. + /** + * do not draw inner cells. * */ noCellBorders?: boolean; - /** - * fill cell borders with the adjacent background color. + /** + * fill cell borders with the adjacent background color. * */ fillCellBorders?: boolean; } - /** - * A stylized table of text elements. - * */ + /** + * A stylized table of text elements. + * */ export class TableElement extends BoxElement implements IHasOptions { constructor(opts: TableOptions); options: TableOptions; - /** - * set rows in table. array of arrays of strings. + /** + * set rows in table. array of arrays of strings. * */ setData(rows: string[][]): void; - /** - * set rows in table. array of arrays of strings. + /** + * set rows in table. array of arrays of strings. * */ setRows(rows: string[][]): void; } export interface TerminalOptions extends BoxOptions { - /** - * handler for input data. + /** + * handler for input data. * */ handler?: (userInput:Buffer) => void; - /** - * name of shell. $SHELL by default. + /** + * name of shell. $SHELL by default. * */ shell?:string; - /** - * args for shell. + /** + * args for shell. * */ args?:any; - /** - * can be line, underline, and block. + /** + * can be line, underline, and block. * */ cursor?: 'line'|'underline'|'block'; - + terminal?: string; - + /** * Object for process env. */ @@ -2528,39 +2528,39 @@ declare namespace Blessed { options: TerminalOptions; - /** + /** * reference to the headless term.js terminal. * */ term: any; - /** - * reference to the pty.js pseudo terminal. + /** + * reference to the pty.js pseudo terminal. * */ pty: any; - /** - * write data to the terminal. + /** + * write data to the terminal. * */ write(data:string): void; - /** - * nearly identical to `element.screenshot`, however, the specified region includes the terminal's _entire_ scrollback, rather than just what is visible on the screen. + /** + * nearly identical to `element.screenshot`, however, the specified region includes the terminal's _entire_ scrollback, rather than just what is visible on the screen. * */ screenshot(xi?:number, xl?:number, yi?:number, yl?:number): string; } export interface ImageOptions extends BoxOptions { - /** - * path to image. + /** + * path to image. * */ file: string; - /** - * path to w3mimgdisplay. if a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary. + /** + * path to w3mimgdisplay. if a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary. * */ type: "ansi" | "overlay" | "w3m"; } - - /** - * Display an image in the terminal (jpeg, png, gif) using w3mimgdisplay. Requires w3m to be installed. X11 required: works in xterm, urxvt, and possibly other terminals. + + /** + * Display an image in the terminal (jpeg, png, gif) using w3mimgdisplay. Requires w3m to be installed. X11 required: works in xterm, urxvt, and possibly other terminals. * */ export class ImageElement extends BoxElement implements IHasOptions { constructor(options?: ImageOptions); @@ -2569,44 +2569,44 @@ declare namespace Blessed { } export interface ANSIImageOptions extends BoxOptions { - /** - * URL or path to PNG/GIF file. Can also be a buffer. + /** + * URL or path to PNG/GIF file. Can also be a buffer. * */ file: string; - /** - * Scale cellmap down (0-1.0) from its original pixel width/height (Default: 1.0). + /** + * Scale cellmap down (0-1.0) from its original pixel width/height (Default: 1.0). * */ scale: number; /** * This differs from other element's width or height in that only one of them is needed: blessed will maintain the aspect ratio of the image as it scales down to the proper number of cells. NOTE: PNG/GIF's are always automatically shrunken to size (based on scale) if a width or height is not given. - * */ + * */ width: number | string; height: number | string; - + /** * Add various "density" ASCII characters over the rendering to give the image more detail, similar to libcaca/libcucul (the library mplayer uses to display videos in the terminal). */ ascii: string; - + /** * Whether to animate if the image is an APNG/animating GIF. If false, only display the first frame or IDAT (Default: true). */ animate: boolean; - + /** * Set the speed of animation. Slower: 0.0-1.0. Faster: 1-1000. It cannot go faster than 1 frame per millisecond, so 1000 is the fastest. (Default: 1.0) */ - speed: number; - + speed: number; + /** * mem or cpu. If optimizing for memory, animation frames will be rendered to bitmaps as the animation plays, using less memory. Optimizing for cpu will precompile all bitmaps beforehand, which may be faster, but might also OOM the process on large images. (Default: mem). */ optimization: "mem" | "cpu"; } - - /** - * Convert any .png file (or .gif, see below) to an ANSI image and display it as an element. + + /** + * Convert any .png file (or .gif, see below) to an ANSI image and display it as an element. * */ export class ANSIImageElement extends BoxElement implements IHasOptions { constructor(options?:ANSIImageOptions); @@ -2618,18 +2618,18 @@ declare namespace Blessed { */ img: Types.TImage; - /** - * set the image in the box to a new path. + /** + * set the image in the box to a new path. * */ setImage(img: string, callback: () => void): void; - /** - * clear the current image. + /** + * clear the current image. * */ clearImage(callback: () => void): void; /** * Play animation if it has been paused or stopped. */ - play(): void; + play(): void; /** * Pause animation. */ @@ -2644,7 +2644,7 @@ declare namespace Blessed { /** * Path to image. */ - file: string; + file: string; /** * Render the file as ANSI art instead of using w3m to overlay Internally uses the ANSIImage element. See the ANSIImage element for more information/options. (Default: true). */ @@ -2652,39 +2652,39 @@ declare namespace Blessed { /** * Path to w3mimgdisplay. If a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary. */ - w3m: string; + w3m: string; /** * Whether to search /usr, /bin, and /lib for w3mimgdisplay (Default: true). */ search: string; } - /** - * Convert any .png file (or .gif, see below) to an ANSI image and display it as an element. + /** + * Convert any .png file (or .gif, see below) to an ANSI image and display it as an element. * */ export class OverlayImageElement extends BoxElement implements IHasOptions { constructor(options?: OverlayImageOptions); - + options: OverlayImageOptions; - /** - * set the image in the box to a new path. + /** + * set the image in the box to a new path. * */ setImage(img: string, callback: () => void): void; - /** - * clear the current image. + /** + * clear the current image. * */ clearImage(callback: () => void): void; - /** - * get the size of an image file in pixels. + /** + * get the size of an image file in pixels. * */ imageSize(img:string, callback: () => void): void; - /** - * get the size of the terminal in pixels. + /** + * get the size of the terminal in pixels. * */ termSize(callback: () => void): void; - /** - * get the pixel to cell ratio for the terminal. + /** + * get the pixel to cell ratio for the terminal. * */ getPixelRatio(callback: () => void): void; } @@ -2697,30 +2697,30 @@ declare namespace Blessed { /** * Start time in seconds. */ - start: number; + start: number; } - + export class VideoElement extends BoxElement implements IHasOptions { constructor(options?: VideoOptions); options: VideoOptions; - + /** * The terminal element running mplayer or mpv. */ tty: any; } - + export interface LayoutOptions extends ElementOptions { /** - * A callback which is called right before the children are iterated over to be rendered. Should return an + * A callback which is called right before the children are iterated over to be rendered. Should return an * iterator callback which is called on each child element: iterator(el, i). */ renderer?: () => void; /** - * Using the default renderer, it provides two layouts: inline, and grid. inline is the default and will render - * akin to inline-block. grid will create an automatic grid based on element dimensions. The grid cells' + * Using the default renderer, it provides two layouts: inline, and grid. inline is the default and will render + * akin to inline-block. grid will create an automatic grid based on element dimensions. The grid cells' * width and height are always determined by the largest children in the layout. */ layout: "inline" | "inline-block" | "grid"; @@ -2732,25 +2732,25 @@ declare namespace Blessed { options: LayoutOptions; /** - * A callback which is called right before the children are iterated over to be rendered. Should return an + * A callback which is called right before the children are iterated over to be rendered. Should return an * iterator callback which is called on each child element: iterator(el, i). */ renderer(coords: PositionCoords): void; /** - * Check to see if a previous child element has been rendered and is visible on screen. This is only useful + * Check to see if a previous child element has been rendered and is visible on screen. This is only useful * for checking child elements that have already been attempted to be rendered! see the example below. */ isRendered(el: BlessedElement): boolean; /** - * Get the last rendered and visible child element based on an index. This is useful for basing the position + * Get the last rendered and visible child element based on an index. This is useful for basing the position * of the current child element on the position of the last child element. */ getLast(i: number): Element; /** - * Get the last rendered and visible child element coords based on an index. This is useful for basing the position + * Get the last rendered and visible child element coords based on an index. This is useful for basing the position * of the current child element on the position of the last child element. See the example below. */ - getLastCoords(i: number): PositionCoords; + getLastCoords(i: number): PositionCoords; } export class Program { @@ -2816,21 +2816,21 @@ declare namespace Blessed { export function radiobutton(options?: Widgets.RadioButtonOptions): Widgets.RadioButtonElement; export function table(options?: Widgets.TableOptions): Widgets.TableElement; - + export function prompt(options?: Widgets.PromptOptions): Widgets.PromptElement; export function question(options?: Widgets.QuestionOptions): Widgets.QuestionElement; export function message(options?: Widgets.MessageOptions): Widgets.MessageElement; export function loading(options?: Widgets.LoadingOptions): Widgets.LoadingElement; - + export function progressbar(options?: Widgets.ProgressBarOptions): Widgets.ProgressBarElement; export function terminal(options?: Widgets.TerminalOptions): Widgets.TerminalElement; export function layout(options?: Widgets.LayoutOptions): Widgets.LayoutElement; - + export function escape(item: any): any; export const colors: { match: (hexColor: string) => string } } -export = Blessed; \ No newline at end of file +export = Blessed; diff --git a/types/blissfuljs/index.d.ts b/types/blissfuljs/index.d.ts index 76061c1391..9174ee4e94 100644 --- a/types/blissfuljs/index.d.ts +++ b/types/blissfuljs/index.d.ts @@ -251,6 +251,16 @@ declare namespace BlissNS { (expr: Node, context?: Element): [Node]; } + interface AriaRequestEvent extends Event { + readonly attributeName: string; + attributeValue: string | null; + } + + interface CommandEvent extends Event { + readonly commandName: string; + readonly detail: string | null; + } + // Native methods added into "_" property, but methods that return "void" now return thi stype in order to be chainables // Methods are All HTMLElement a ELement methods interface BlissNativeExtentions { diff --git a/types/bloomfilter/tslint.json b/types/bloomfilter/tslint.json index ec365f164b..d88586e5bd 100644 --- a/types/bloomfilter/tslint.json +++ b/types/bloomfilter/tslint.json @@ -1,3 +1,3 @@ { - "extends": "../tslint.json" + "extends": "dtslint/dt.json" } diff --git a/types/bluebird-global/bluebird-global-tests.ts b/types/bluebird-global/bluebird-global-tests.ts index 43d5fee050..0464b188cd 100644 --- a/types/bluebird-global/bluebird-global-tests.ts +++ b/types/bluebird-global/bluebird-global-tests.ts @@ -7,7 +7,6 @@ function testSomeStaticMethods() { function testFunctionReturningPromise() { function functionReturningPromise(): Promise { return new Promise((resolve, reject, onCancel) => { - if (onCancel) { onCancel(() => { console.log("onCancel cleanup"); @@ -40,5 +39,4 @@ function testPromiseRejection() { .then((value) => { return value.toUpperCase(); }); - } diff --git a/types/bluebird-global/index.d.ts b/types/bluebird-global/index.d.ts index a705222e9d..835bc59c31 100644 --- a/types/bluebird-global/index.d.ts +++ b/types/bluebird-global/index.d.ts @@ -11,15 +11,24 @@ * * 2. How to use it? * - * Add `bluebird-global` to the `types` array in your `tsconfig.json` like this: + * It should just work, but there are a couple of points to be wary about: * - * { - * "compilerOptions": { - * "types": [ - * "bluebird-global" - * ], - * } - * } + * a) If you already use `compilerOptions.types` in your `tsconfig.json`, then add `bluebird-global` + * to the list: + * + * { + * "compilerOptions": { + * "types": [ + * (other types ...) + * + * "bluebird-global" + * ], + * } + * } + * + * b) Be aware, that you still need to get the global Promise symbol to be replaced with bluebird.js + * in the runtime. Do this by either importing bluebird.js via a `