# Conflicts:
#	types/validator/index.d.ts
This commit is contained in:
bglee
2017-08-01 19:50:54 +09:00
8432 changed files with 535046 additions and 450172 deletions
+1 -1
View File
@@ -1,9 +1,9 @@
root = true
[*]
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
[{*.json,*.yml}]
indent_style = space
indent_size = 2
+1 -1
View File
@@ -17,7 +17,7 @@ If adding a new definition:
If changing an existing definition:
- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <<url here>>
- [ ] 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": "dtslint/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.)
+10 -2
View File
@@ -12,7 +12,6 @@
*.map
*.swp
.DS_Store
npm-debug.log
_Resharper.DefinitelyTyped
bin
@@ -25,19 +24,28 @@ Properties
# test folder
_infrastructure/tests/build
# IntelliJ based IDEs
.idea
*.iml
*.js.map
!*.js/
!scripts/new-package.js
!scripts/not-needed.js
!scripts/lint.js
# npm
node_modules
package-lock.json
npm-debug.log
# Sublime
.sublimets
.settings/launch.json
# Visual Studio Code
.settings/launch.json
.vs
.vscode
# yarn
yarn.lock
+22 -13
View File
@@ -1,4 +1,4 @@
# DefinitelyTyped [![Build Status](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped.png?branch=master)](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped)
# DefinitelyTyped [![Build Status](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped.svg?branch=master)](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped)
[![Join the chat at https://gitter.im/borisyankov/DefinitelyTyped](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -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,11 +85,18 @@ 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 <https://github.com/alice>, Bob <https://github.com/bob>`.
* `npm install -g typescript@2.0` and run `tsc`.
- Or if there are more people, it can be multiline
```typescript
// Definitions by: Alice <https://github.com/alice>
// Bob <https://github.com/bob>
// Steve <https://github.com/steve>
// John <https://github.com/john>
```
* If there is a `tslint.json`, run `npm run lint package-name`. Otherwise, run `tsc` in the package directory.
When you make a PR to edit an existing package, `dt-bot` should @-mention previous authors.
If it doesn't, you can do so yourself in the comment associated with the PR.
@@ -153,15 +162,15 @@ 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
}
}
```
@@ -184,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 `<reference types="" />`.
#### 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.
@@ -214,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`.
@@ -256,6 +260,11 @@ transitively `react-router-bootstrap` (which depends on `react-router`) also add
Also, `/// <reference types=".." />` 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.
+276
View File
@@ -12,18 +12,66 @@
"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": "apn",
"typingsPackageName": "apn",
"sourceRepoURL": "https://github.com/node-apn/node-apn",
"asOfVersion": "2.1.2"
},
{
"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": "BigInteger.js",
"typingsPackageName": "big-integer",
"sourceRepoURL": "https://github.com/peterolson/BigInteger.js",
"asOfVersion": "0.0.31"
},
{
"libraryName": "Bugsnag Browser",
"typingsPackageName": "bugsnag-js",
"sourceRepoURL": "https://github.com/bugsnag/bugsnag-js",
"asOfVersion": "3.1.0"
},
{
"libraryName": "camel-case",
"typingsPackageName": "camel-case",
@@ -54,6 +102,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",
@@ -78,6 +132,42 @@
"sourceRepoURL": "https://github.com/bterlson/ecmarkup",
"asOfVersion": "3.4.0"
},
{
"libraryName": "electron",
"typingsPackageName": "electron",
"sourceRepoURL": "https://github.com/electron/electron",
"asOfVersion": "1.6.10"
},
{
"libraryName": "electron-builder",
"typingsPackageName": "electron-builder",
"sourceRepoURL": "https://github.com/loopline-systems/electron-builder",
"asOfVersion": "2.8.0"
},
{
"libraryName": "eventemitter2",
"typingsPackageName": "eventemitter2",
"sourceRepoURL": "https://github.com/asyncly/EventEmitter2",
"asOfVersion": "4.1.0"
},
{
"libraryName": "EventEmitter3",
"typingsPackageName": "eventemitter3",
"sourceRepoURL": "https://github.com/primus/eventemitter3",
"asOfVersion": "2.0.2"
},
{
"libraryName": "express-validator",
"typingsPackageName": "express-validator",
"sourceRepoURL": "https://github.com/ctavan/express-validator",
"asOfVersion": "3.0.0"
},
{
"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",
@@ -102,6 +192,12 @@
"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",
@@ -156,12 +252,36 @@
"sourceRepoURL": "https://github.com/blakeembrey/is-upper-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "jquery.ajaxfile",
"typingsPackageName": "jquery.ajaxfile",
"sourceRepoURL": "https://github.com/fpellet/jquery.ajaxFile",
"asOfVersion": "0.2.29"
},
{
"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",
@@ -180,6 +300,12 @@
"sourceRepoURL": "https://github.com/localForage/localForage",
"asOfVersion": "0.0.34"
},
{
"libraryName": "lodash-decorators",
"typingsPackageName": "lodash-decorators",
"sourceRepoURL": "https://github.com/steelsojka/lodash-decorators",
"asOfVersion": "4.0.0"
},
{
"libraryName": "lower-case",
"typingsPackageName": "lower-case",
@@ -192,12 +318,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",
@@ -222,12 +366,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",
@@ -240,12 +396,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",
@@ -264,18 +438,42 @@
"sourceRepoURL": "https://github.com/angular/protractor",
"asOfVersion": "4.0.0"
},
{
"libraryName": "qiniu",
"typingsPackageName": "qiniu",
"sourceRepoURL": "https://github.com/qiniu/nodejs-sdk",
"asOfVersion": "7.0.1"
},
{
"libraryName": "Raven JS",
"typingsPackageName": "raven-js",
"sourceRepoURL": "https://github.com/getsentry/raven-js",
"asOfVersion": "3.10.0"
},
{
"libraryName": "react-day-picker",
"typingsPackageName": "react-day-picker",
"sourceRepoURL": "https://github.com/gpbl/react-day-picker",
"asOfVersion": "5.3.0"
},
{
"libraryName": "Redux",
"typingsPackageName": "redux",
"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-devtools-extension",
"typingsPackageName": "redux-devtools-extension",
"sourceRepoURL": "https://github.com/zalmoxisus/redux-devtools-extension",
"asOfVersion": "2.13.2"
},
{
"libraryName": "redux-persist",
"typingsPackageName": "redux-persist",
@@ -300,12 +498,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",
@@ -342,18 +564,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",
@@ -366,6 +612,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",
@@ -378,6 +630,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",
@@ -390,17 +648,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"
}
]
}
+5 -2
View File
@@ -17,11 +17,14 @@
"scripts": {
"compile-scripts": "tsc -p scripts",
"not-needed": "node scripts/not-needed.js",
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1",
"lint": "dtslint --dt types"
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed",
"lint": "dtslint types"
},
"devDependencies": {
"dtslint": "Microsoft/dtslint#production",
"types-publisher": "Microsoft/types-publisher#production"
},
"dependencies": {
"jslint": "^0.10.3"
}
}
+1 -1
View File
@@ -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");
}
-4
View File
@@ -5,10 +5,6 @@
import * as fs from 'fs';
import * as path from 'path';
function repeat(s: string, count: number) {
return Array(count + 1).join(s);
}
const home = path.join(__dirname, '..');
for (const dirName of fs.readdirSync(home)) {
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+2 -1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/sathomas/acc-wizard
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
interface AccWizardOptions {
/**
@@ -110,4 +111,4 @@ interface AccWizardOptions {
*/
interface JQuery {
accwizard(options?: AccWizardOptions): void;
}
}
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+3
View File
@@ -3,6 +3,9 @@
// Default usage:
accounting.formatMoney(12345678); // $12,345,678.00
// Stringified usage:
accounting.formatMoney('$4394958309392.9401'); // $4,394,958,309,392.94
// European formatting (custom symbol and separators), could also use options object as second param:
accounting.formatMoney(4999.99, "€", 2, ".", ","); // €4.999,99
+6 -5
View File
@@ -1,6 +1,7 @@
// Type definitions for accounting.js 0.3
// Project: http://josscrowcroft.github.io/accounting.js/
// Type definitions for accounting.js 0.4
// Project: http://openexchangerates.github.io/accounting.js/
// Definitions by: Sergey Gerasimov <https://github.com/gerich-home/>
// Christopher Eck <https://github.com/chrisleck/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace accounting {
@@ -30,9 +31,9 @@ declare namespace accounting {
}
interface Static {
// format any number into currency
formatMoney(number: number, symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string;
formatMoney(number: number, options: CurrencySettings<string> | CurrencySettings<CurrencyFormat>): string;
// format any number or stringified number into currency
formatMoney(number: number | string, symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string;
formatMoney(number: number | string, options: CurrencySettings<string> | CurrencySettings<CurrencyFormat>): string;
formatMoney(numbers: number[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[];
formatMoney(numbers: number[], options: CurrencySettings<string> | CurrencySettings<CurrencyFormat>): string[];
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+20 -2
View File
@@ -474,7 +474,9 @@ declare namespace AceAjax {
removeFold(arg: any): void;
expandFold(arg: any): void;
foldAll(startRow?: number, endRow?: number, depth?: number): void
unfold(arg1: any, arg2: boolean): void;
screenToDocumentColumn(row: number, column: number): void;
@@ -1039,6 +1041,12 @@ declare namespace AceAjax {
addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any): void;
addEventListener(ev: string, callback: Function): void;
off(ev: string, callback: Function): void;
removeListener(ev: string, callback: Function): void;
removeEventListener(ev: string, callback: Function): void;
inMultiSelectMode: boolean;
selectMoreLines(n: number): void;
@@ -2164,8 +2172,16 @@ declare namespace AceAjax {
**/
export interface Selection {
on(ev: string, callback: Function): void;
addEventListener(ev: string, callback: Function): void;
off(ev: string, callback: Function): void;
removeListener(ev: string, callback: Function): void;
removeEventListener(ev: string, callback: Function): void;
moveCursorWordLeft(): void;
moveCursorWordRight(): void;
@@ -2643,7 +2659,9 @@ declare namespace AceAjax {
characterWidth: number;
lineHeight: number;
setScrollMargin(top:number, bottom:number, left: number, right: number): void;
screenToTextCoordinates(left: number, top: number): void;
/**
+1
View File
@@ -15,6 +15,7 @@ const aceVirtualRendererTests = {
var renderer = new AceAjax.VirtualRenderer(el);
renderer.setPadding(0);
renderer.setScrollMargin(0,0,0,0)
renderer.setSession(new AceAjax.EditSession("1234"));
var r = renderer.scroller.getBoundingClientRect();
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/optimalbits/node_acl
// Definitions by: Qubo <https://github.com/tkQubo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="bluebird" />
/// <reference types="node"/>
+1 -1
View File
@@ -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);
}
@@ -0,0 +1,30 @@
let obj0 = new ActiveXObject('ADODB.Command');
let obj1 = new ActiveXObject('ADODB.Connection');
let obj2 = new ActiveXObject('ADODB.Parameter');
let obj3 = new ActiveXObject('ADODB.Record');
let obj4 = new ActiveXObject('ADODB.Recordset');
let obj5 = new ActiveXObject('ADODB.Stream');
// open connection to an Excel file
let pathToExcelFile = 'C:\\path\\to\\excel\\file.xlsx';
let conn = new ActiveXObject('ADODB.Connection');
conn.Provider = 'Microsoft.ACE.OLEDB.12.0';
conn.ConnectionString =
'Data Source="' + pathToExcelFile + '";' +
'Extended Properties="Excel 12.0;HDR=Yes"';
conn.Open();
// create a Command to access the data
let cmd = new ActiveXObject('ADODB.Command');
cmd.CommandText = 'SELECT DISTINCT LastName, CityName FROM [Sheet1$]';
// get a Recordset
let rs = cmd.Execute();
// build a string from the Recordset
let s = rs.GetString(ADODB.StringFormatEnum.adClipString, -1, '\t', '\n', '(NULL)');
rs.Close();
WScript.Echo(s);
@@ -1,11 +1,9 @@
// Type definitions for Microsoft ActiveX Data Objects
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms675532(v=vs.85).aspx
// Type definitions for Microsoft ActiveX Data Objects 6.1
// Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx
// Definitions by: Zev Spitz <https://github.com/zspitz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace ADODB {
//Enums
const enum ADCPROP_ASYNCTHREADPRIORITY_ENUM {
adPriorityAboveNormal = 4,
adPriorityBelowNormal = 2,
@@ -595,240 +593,415 @@ declare namespace ADODB {
adXactSyncPhaseOne = 1048576
}
//Interfaces
interface Command {
ActiveConnection: Connection;
Cancel: () => void;
CommandStream: any /*VT_UNKNOWN*/;
Cancel(): void;
CommandStream: any;
CommandText: string;
CommandTimeout: number;
CommandType: CommandTypeEnum;
CreateParameter: (Name?: string, Type?: DataTypeEnum, Direction?: ParameterDirectionEnum, Size?: number, Value?: any) => Parameter;
/**
* @param string [Name='']
* @param ADODB.DataTypeEnum [Type=0]
* @param ADODB.ParameterDirectionEnum [Direction=1]
* @param number [Size=0]
*/
CreateParameter(Name?: string, Type?: DataTypeEnum, Direction?: ParameterDirectionEnum, Size?: number, Value?: any): Parameter;
Dialect: string;
Execute: (RecordsAffected?: any, Parameters?: any, Options?: number) => Recordset;
/** @param number [Options=-1] */
Execute(RecordsAffected?: any, Parameters?: any, Options?: number): Recordset;
Name: string;
NamedParameters: boolean;
Parameters: Parameters;
readonly Parameters: Parameters;
Prepared: boolean;
Properties: Properties;
State: number;
readonly Properties: Properties;
readonly State: number;
}
interface Connection {
Attributes: number;
BeginTrans: () => number;
Cancel: () => void;
Close: () => void;
BeginTrans(): number;
Cancel(): void;
Close(): void;
CommandTimeout: number;
CommitTrans: () => void;
CommitTrans(): void;
ConnectionString: string;
ConnectionTimeout: number;
CursorLocation: CursorLocationEnum;
DefaultDatabase: string;
Errors: Errors;
Execute: (CommandText: string, RecordsAffected: any, Options?: number) => Recordset;
readonly Errors: Errors;
/** @param number [Options=-1] */
Execute(CommandText: string, RecordsAffected: any, Options?: number): Recordset;
IsolationLevel: IsolationLevelEnum;
Mode: ConnectModeEnum;
Open: (ConnectionString?: string, UserID?: string, Password?: string, Options?: number) => void;
OpenSchema: (Schema: SchemaEnum, Restrictions?: any, SchemaID?: any) => Recordset;
Properties: Properties;
/**
* @param string [ConnectionString='']
* @param string [UserID='']
* @param string [Password='']
* @param number [Options=-1]
*/
Open(ConnectionString?: string, UserID?: string, Password?: string, Options?: number): void;
OpenSchema(Schema: SchemaEnum, Restrictions?: any, SchemaID?: any): Recordset;
readonly Properties: Properties;
Provider: string;
RollbackTrans: () => void;
State: number;
Version: string;
RollbackTrans(): void;
readonly State: number;
readonly Version: string;
}
interface Error {
Description: string;
HelpContext: number;
HelpFile: string;
NativeError: number;
Number: number;
Source: string;
SQLState: string;
readonly Description: string;
readonly HelpContext: number;
readonly HelpFile: string;
readonly NativeError: number;
readonly Number: number;
readonly Source: string;
readonly SQLState: string;
}
interface Errors {
Clear: () => void;
Count: number;
Item: (Index: any) => Error;
Refresh: () => void;
Clear(): void;
readonly Count: number;
Item(Index: any): Error;
Refresh(): void;
}
interface Field {
ActualSize: number;
AppendChunk: (Data: any) => void;
readonly ActualSize: number;
AppendChunk(Data: any): void;
Attributes: number;
DataFormat: any /*VT_UNKNOWN*/;
DataFormat: any;
DefinedSize: number;
GetChunk: (Length: number) => any;
Name: string;
GetChunk(Length: number): any;
readonly Name: string;
NumericScale: number;
OriginalValue: any;
readonly OriginalValue: any;
Precision: number;
Properties: Properties;
Status: number;
readonly Properties: Properties;
readonly Status: number;
Type: DataTypeEnum;
UnderlyingValue: any;
readonly UnderlyingValue: any;
Value: any;
}
interface Fields {
_Append: (Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum) => void;
Append: (Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum, FieldValue?: any) => void;
CancelUpdate: () => void;
Count: number;
Delete: (Index: any) => void;
Item: (Index: any) => Field;
Refresh: () => void;
Resync: (ResyncValues?: ResyncEnum) => void;
Update: () => void;
/**
* @param number [DefinedSize=0]
* @param ADODB.FieldAttributeEnum [Attrib=-1]
*/
_Append(Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum): void;
/**
* @param number [DefinedSize=0]
* @param ADODB.FieldAttributeEnum [Attrib=-1]
*/
Append(Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum, FieldValue?: any): void;
CancelUpdate(): void;
readonly Count: number;
Delete(Index: any): void;
Item(Index: any): Field;
Refresh(): void;
/** @param ADODB.ResyncEnum [ResyncValues=2] */
Resync(ResyncValues?: ResyncEnum): void;
Update(): void;
}
interface Parameter {
AppendChunk: (Val: any) => void;
AppendChunk(Val: any): void;
Attributes: number;
Direction: ParameterDirectionEnum;
Name: string;
NumericScale: number;
Precision: number;
Properties: Properties;
readonly Properties: Properties;
Size: number;
Type: DataTypeEnum;
Value: any;
}
interface Parameters {
Append: (Object: any /*VT_DISPATCH*/) => void;
Count: number;
Delete: (Index: any) => void;
Item: (Index: any) => Parameter;
Refresh: () => void;
Append(Object: any): void;
readonly Count: number;
Delete(Index: any): void;
Item(Index: any): Parameter;
Refresh(): void;
}
interface Properties {
Count: number;
Item: (Index: any) => Property;
Refresh: () => void;
readonly Count: number;
Item(Index: any): Property;
Refresh(): void;
}
interface Property {
Attributes: number;
Name: string;
Type: DataTypeEnum;
readonly Name: string;
readonly Type: DataTypeEnum;
Value: any;
}
interface Record {
ActiveConnection: any;
Cancel: () => void;
Close: () => void;
CopyRecord: (Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: CopyRecordOptionsEnum, Async?: boolean) => string;
DeleteRecord: (Source?: string, Async?: boolean) => void;
Fields: Fields;
GetChildren: () => Recordset;
Cancel(): void;
Close(): void;
/**
* @param string [Source='']
* @param string [Destination='']
* @param string [UserName='']
* @param string [Password='']
* @param ADODB.CopyRecordOptionsEnum [Options=-1]
* @param boolean [Async=false]
*/
CopyRecord(Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: CopyRecordOptionsEnum, Async?: boolean): string;
/**
* @param string [Source='']
* @param boolean [Async=false]
*/
DeleteRecord(Source?: string, Async?: boolean): void;
readonly Fields: Fields;
GetChildren(): Recordset;
Mode: ConnectModeEnum;
MoveRecord: (Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: MoveRecordOptionsEnum, Async?: boolean) => string;
Open: (Source: any, ActiveConnection: any, Mode?: ConnectModeEnum, CreateOptions?: RecordCreateOptionsEnum, Options?: RecordOpenOptionsEnum, UserName?: string, Password?: string) => void;
ParentURL: string;
Properties: Properties;
RecordType: RecordTypeEnum;
/**
* @param string [Source='']
* @param string [Destination='']
* @param string [UserName='']
* @param string [Password='']
* @param ADODB.MoveRecordOptionsEnum [Options=-1]
* @param boolean [Async=false]
*/
MoveRecord(Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: MoveRecordOptionsEnum, Async?: boolean): string;
/**
* @param ADODB.ConnectModeEnum [Mode=0]
* @param ADODB.RecordCreateOptionsEnum [CreateOptions=-1]
* @param ADODB.RecordOpenOptionsEnum [Options=-1]
* @param string [UserName='']
* @param string [Password='']
*/
Open(Source: any, ActiveConnection: any, Mode?: ConnectModeEnum, CreateOptions?: RecordCreateOptionsEnum, Options?: RecordOpenOptionsEnum, UserName?: string, Password?: string): void;
readonly ParentURL: string;
readonly Properties: Properties;
readonly RecordType: RecordTypeEnum;
Source: any;
State: ObjectStateEnum;
readonly State: ObjectStateEnum;
}
interface Recordset {
_xClone: () => Recordset;
_xResync: (AffectRecords?: AffectEnum) => void;
_xSave: (FileName?: string, PersistFormat?: PersistFormatEnum) => void;
_xClone(): Recordset;
/** @param ADODB.AffectEnum [AffectRecords=3] */
_xResync(AffectRecords?: AffectEnum): void;
/**
* @param string [FileName='']
* @param ADODB.PersistFormatEnum [PersistFormat=0]
*/
_xSave(FileName?: string, PersistFormat?: PersistFormatEnum): void;
AbsolutePage: PositionEnum;
AbsolutePosition: PositionEnum;
ActiveCommand: any /*VT_DISPATCH*/;
ActiveConnection: any /*VT_DISPATCH*/;
AddNew: (FieldList?: any, Values?: any) => void;
BOF: boolean;
readonly ActiveCommand: any;
ActiveConnection: any;
AddNew(FieldList?: any, Values?: any): void;
readonly BOF: boolean;
Bookmark: any;
CacheSize: number;
Cancel: () => void;
CancelBatch: (AffectRecords?: AffectEnum) => void;
CancelUpdate: () => void;
Clone: (LockType?: LockTypeEnum) => Recordset;
Close: () => void;
Collect: (Index: any) => any; //Also has setter with parameters
CompareBookmarks: (Bookmark1: any, Bookmark2: any) => CompareEnum;
Cancel(): void;
/** @param ADODB.AffectEnum [AffectRecords=3] */
CancelBatch(AffectRecords?: AffectEnum): void;
CancelUpdate(): void;
/** @param ADODB.LockTypeEnum [LockType=-1] */
Clone(LockType?: LockTypeEnum): Recordset;
Close(): void;
Collect(Index: any): any;
CompareBookmarks(Bookmark1: any, Bookmark2: any): CompareEnum;
CursorLocation: CursorLocationEnum;
CursorType: CursorTypeEnum;
DataMember: string;
DataSource: any /*VT_UNKNOWN*/;
Delete: (AffectRecords?: AffectEnum) => void;
EditMode: EditModeEnum;
EOF: boolean;
Fields: Fields;
DataSource: any;
/** @param ADODB.AffectEnum [AffectRecords=1] */
Delete(AffectRecords?: AffectEnum): void;
readonly EditMode: EditModeEnum;
readonly EOF: boolean;
readonly Fields: Fields;
Filter: any;
Find: (Criteria: string, SkipRecords?: number, SearchDirection?: SearchDirectionEnum, Start?: any) => void;
GetRows: (Rows?: number, Start?: any, Fields?: any) => any;
GetString: (StringFormat?: StringFormatEnum, NumRows?: number, ColumnDelimeter?: string, RowDelimeter?: string, NullExpr?: string) => string;
/**
* @param number [SkipRecords=0]
* @param ADODB.SearchDirectionEnum [SearchDirection=1]
*/
Find(Criteria: string, SkipRecords?: number, SearchDirection?: SearchDirectionEnum, Start?: any): void;
/** @param number [Rows=-1] */
GetRows(Rows?: number, Start?: any, Fields?: any): any;
/**
* @param ADODB.StringFormatEnum [StringFormat=2]
* @param number [NumRows=-1]
* @param string [ColumnDelimeter='']
* @param string [RowDelimeter='']
* @param string [NullExpr='']
*/
GetString(StringFormat?: StringFormatEnum, NumRows?: number, ColumnDelimeter?: string, RowDelimeter?: string, NullExpr?: string): string;
Index: string;
LockType: LockTypeEnum;
MarshalOptions: MarshalOptionsEnum;
MaxRecords: number;
Move: (NumRecords: number, Start?: any) => void;
MoveFirst: () => void;
MoveLast: () => void;
MoveNext: () => void;
MovePrevious: () => void;
NextRecordset: (RecordsAffected?: any) => Recordset;
Open: (Source: any, ActiveConnection: any, CursorType?: CursorTypeEnum, LockType?: LockTypeEnum, Options?: number) => void;
PageCount: number;
Move(NumRecords: number, Start?: any): void;
MoveFirst(): void;
MoveLast(): void;
MoveNext(): void;
MovePrevious(): void;
NextRecordset(RecordsAffected?: any): Recordset;
/**
* @param ADODB.CursorTypeEnum [CursorType=-1]
* @param ADODB.LockTypeEnum [LockType=-1]
* @param number [Options=-1]
*/
Open(Source: any, ActiveConnection: any, CursorType?: CursorTypeEnum, LockType?: LockTypeEnum, Options?: number): void;
readonly PageCount: number;
PageSize: number;
Properties: Properties;
RecordCount: number;
Requery: (Options?: number) => void;
Resync: (AffectRecords?: AffectEnum, ResyncValues?: ResyncEnum) => void;
Save: (Destination: any, PersistFormat?: PersistFormatEnum) => void;
Seek: (KeyValues: any, SeekOption?: SeekEnum) => void;
readonly Properties: Properties;
readonly RecordCount: number;
/** @param number [Options=-1] */
Requery(Options?: number): void;
/**
* @param ADODB.AffectEnum [AffectRecords=3]
* @param ADODB.ResyncEnum [ResyncValues=2]
*/
Resync(AffectRecords?: AffectEnum, ResyncValues?: ResyncEnum): void;
/** @param ADODB.PersistFormatEnum [PersistFormat=0] */
Save(Destination: any, PersistFormat?: PersistFormatEnum): void;
/** @param ADODB.SeekEnum [SeekOption=1] */
Seek(KeyValues: any, SeekOption?: SeekEnum): void;
Sort: string;
Source: any /*VT_DISPATCH*/;
State: number;
Status: number;
Source: any;
readonly State: number;
readonly Status: number;
StayInSync: boolean;
Supports: (CursorOptions: CursorOptionEnum) => boolean;
Update: (Fields?: any, Values?: any) => void;
UpdateBatch: (AffectRecords?: AffectEnum) => void;
Supports(CursorOptions: CursorOptionEnum): boolean;
Update(Fields?: any, Values?: any): void;
/** @param ADODB.AffectEnum [AffectRecords=3] */
UpdateBatch(AffectRecords?: AffectEnum): void;
}
interface Stream {
Cancel: () => void;
Cancel(): void;
Charset: string;
Close: () => void;
CopyTo: (DestStream: Stream, CharNumber?: number) => void;
EOS: boolean;
Flush: () => void;
LineSeparator: LineSeparatorEnum;
LoadFromFile: (FileName: string) => void;
Mode: ConnectModeEnum;
Open: (Source: any, Mode?: ConnectModeEnum, Options?: StreamOpenOptionsEnum, UserName?: string, Password?: string) => void;
Position: number;
Read: (NumBytes?: number) => any;
ReadText: (NumChars?: number) => string;
SaveToFile: (FileName: string, Options?: SaveOptionsEnum) => void;
SetEOS: () => void;
Size: number;
SkipLine: () => void;
State: ObjectStateEnum;
Type: StreamTypeEnum;
Write: (Buffer: any) => void;
WriteText: (Data: string, Options?: StreamWriteEnum) => void;
}
Close(): void;
/** @param number [CharNumber=-1] */
CopyTo(DestStream: Stream, CharNumber?: number): void;
readonly EOS: boolean;
Flush(): void;
LineSeparator: LineSeparatorEnum;
LoadFromFile(FileName: string): void;
Mode: ConnectModeEnum;
/**
* @param ADODB.ConnectModeEnum [Mode=0]
* @param ADODB.StreamOpenOptionsEnum [Options=-1]
* @param string [UserName='']
* @param string [Password='']
*/
Open(Source: any, Mode?: ConnectModeEnum, Options?: StreamOpenOptionsEnum, UserName?: string, Password?: string): void;
Position: number;
/** @param number [NumBytes=-1] */
Read(NumBytes?: number): any;
/** @param number [NumChars=-1] */
ReadText(NumChars?: number): string;
/** @param ADODB.SaveOptionsEnum [Options=1] */
SaveToFile(FileName: string, Options?: SaveOptionsEnum): void;
SetEOS(): void;
readonly Size: number;
SkipLine(): void;
readonly State: ObjectStateEnum;
Type: StreamTypeEnum;
Write(Buffer: any): void;
/** @param ADODB.StreamWriteEnum [Options=0] */
WriteText(Data: string, Options?: StreamWriteEnum): void;
}
}
interface ActiveXObject {
new (progID: 'ADODB.Connection'): ADODB.Connection;
new (progID: 'ADODB.Record'): ADODB.Record;
new (progID: 'ADODB.Stream'): ADODB.Stream;
new (progID: 'ADODB.Command'): ADODB.Command;
new (progID: 'ADODB.Recordset'): ADODB.Recordset;
new (progID: 'ADODB.Parameter'): ADODB.Parameter;
on(obj: ADODB.Connection, event: 'BeginTransComplete', argNames: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (
this: ADODB.Connection, parameter: {
TransactionLevel: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void;
on(obj: ADODB.Connection, event: 'Disconnect', argNames: ['adStatus', 'pConnection'], handler: (
this: ADODB.Connection, parameter: {
adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void;
on(obj: ADODB.Connection, event: 'ExecuteComplete', argNames: ['RecordsAffected', 'pError', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: (
this: ADODB.Connection, parameter: {
RecordsAffected: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void;
on(obj: ADODB.Connection, event: 'InfoMessage' | 'CommitTransComplete' | 'RollbackTransComplete' | 'ConnectComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (
this: ADODB.Connection, parameter: {
pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void;
on(obj: ADODB.Connection, event: 'WillConnect', argNames: ['ConnectionString', 'UserID', 'Password', 'Options', 'adStatus', 'pConnection'], handler: (
this: ADODB.Connection, parameter: {
ConnectionString: string, UserID: string, Password: string, Options: number, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void;
on(obj: ADODB.Connection, event: 'WillExecute', argNames: ['Source', 'CursorType', 'LockType', 'Options', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: (
this: ADODB.Connection, parameter: {
Source: string, CursorType: ADODB.CursorTypeEnum, LockType: ADODB.LockTypeEnum, Options: number, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command,
pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void;
on(obj: ADODB.Recordset, event: 'EndOfRecordset', argNames: ['fMoreData', 'adStatus', 'pRecordset'], handler: (
this: ADODB.Recordset, parameter: {
fMoreData: boolean, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
on(obj: ADODB.Recordset, event: 'FetchComplete', argNames: ['pError', 'adStatus', 'pRecordset'], handler: (
this: ADODB.Recordset, parameter: {
pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
on(obj: ADODB.Recordset, event: 'FetchProgress', argNames: ['Progress', 'MaxProgress', 'adStatus', 'pRecordset'], handler: (
this: ADODB.Recordset, parameter: {
Progress: number, MaxProgress: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
on(obj: ADODB.Recordset, event: 'FieldChangeComplete', argNames: ['cFields', 'Fields', 'pError', 'adStatus', 'pRecordset'], handler: (
this: ADODB.Recordset, parameter: {
cFields: number, Fields: any, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
on(obj: ADODB.Recordset, event: 'RecordChangeComplete', argNames: ['adReason', 'cRecords', 'pError', 'adStatus', 'pRecordset'], handler: (
this: ADODB.Recordset, parameter: {
adReason: ADODB.EventReasonEnum, cRecords: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
on(obj: ADODB.Recordset, event: 'RecordsetChangeComplete' | 'MoveComplete', argNames: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (
this: ADODB.Recordset, parameter: {
adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
on(obj: ADODB.Recordset, event: 'WillChangeField', argNames: ['cFields', 'Fields', 'adStatus', 'pRecordset'], handler: (
this: ADODB.Recordset, parameter: {
cFields: number, Fields: any, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
on(obj: ADODB.Recordset, event: 'WillChangeRecord', argNames: ['adReason', 'cRecords', 'adStatus', 'pRecordset'], handler: (
this: ADODB.Recordset, parameter: {
adReason: ADODB.EventReasonEnum, cRecords: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
on(obj: ADODB.Recordset, event: 'WillChangeRecordset' | 'WillMove', argNames: ['adReason', 'adStatus', 'pRecordset'], handler: (
this: ADODB.Recordset, parameter: {
adReason: ADODB.EventReasonEnum, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
set(obj: ADODB.Recordset, propertyName: 'Collect', parameterTypes: [any], newValue: any): void;
new(progid: 'ADODB.Command'): ADODB.Command;
new(progid: 'ADODB.Connection'): ADODB.Connection;
new(progid: 'ADODB.Parameter'): ADODB.Parameter;
new(progid: 'ADODB.Record'): ADODB.Record;
new(progid: 'ADODB.Recordset'): ADODB.Recordset;
new(progid: 'ADODB.Stream'): ADODB.Stream;
}
interface EnumeratorConstructor {
new(col: ADODB.Errors): ADODB.Error;
new(col: ADODB.Fields): ADODB.Field;
new(col: ADODB.Parameters): ADODB.Parameter;
new(col: ADODB.Properties): ADODB.Property;
}
+1
View File
@@ -0,0 +1 @@
{ "dependencies": { "activex-helpers": "*"}}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es5", "scripthost"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strict": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"activex-adodb-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -1,18 +0,0 @@
//open connection to an Excel file
var pathToExcelFile = 'C:\\path\\to\\excel\\file.xlsx';
var conn = new ActiveXObject('ADODB.Connection');
conn.Provider = 'Microsoft.ACE.OLEDB.12.0';
conn.ConnectionString =
'Data Source="' + pathToExcelFile + '";' +
'Extended Properties="Excel 12.0;HDR=Yes"';
conn.Open();
//create a Command to access the data
var cmd = new ActiveXObject('ADODB.Command');
cmd.CommandText = 'SELECT DISTINCT LastName, CityName FROM [Sheet1$]';
//get a Recordset
var rs = cmd.Execute();
//build a string from the Recordset
var s = rs.GetString(ADODB.StringFormatEnum.adClipString, -1, '\t', '\n', '(NULL)');
rs.Close();
WScript.Echo(s);
-24
View File
@@ -1,24 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom",
"scripthost"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"activex-data-objects-tests.ts"
]
}
-205
View File
@@ -1,205 +0,0 @@
// Type definitions for Microsoft Scripting Runtime
// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx
// Definitions by: Zev Spitz <https://github.com/zspitz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Scripting {
//Enums
const enum CompareMethod {
BinaryCompare = 0,
DatabaseCompare = 2,
TextCompare = 1
}
const enum DriveTypeConst {
CDRom = 4,
Fixed = 2,
RamDisk = 5,
Remote = 3,
Removable = 1,
UnknownType = 0
}
const enum FileAttribute {
Alias = 1024,
Archive = 32,
Compressed = 2048,
Directory = 16,
Hidden = 2,
Normal = 0,
ReadOnly = 1,
System = 4,
Volume = 8
}
const enum IOMode {
ForAppending = 8,
ForReading = 1,
ForWriting = 2
}
const enum SpecialFolderConst {
SystemFolder = 1,
TemporaryFolder = 2,
WindowsFolder = 0
}
const enum StandardStreamTypes {
StdErr = 2,
StdIn = 0,
StdOut = 1
}
const enum Tristate {
TristateFalse = 0,
TristateMixed = -2,
TristateTrue = -1,
TristateUseDefault = -2
}
//Interfaces
interface Dictionary {
Add: (Key: any, Item: any) => void;
CompareMode: CompareMethod;
Count: number;
Exists: (Key: any) => boolean;
HashVal: (Key: any) => any;
Item: (Key: any) => any; //Also has setter with parameters
Items: () => any;
Key: (Key: any) => any;
Keys: () => any;
Remove: (Key: any) => void;
RemoveAll: () => void;
}
interface Drive {
AvailableSpace: any;
DriveLetter: string;
DriveType: DriveTypeConst;
FileSystem: string;
FreeSpace: any;
IsReady: boolean;
Path: string;
RootFolder: Folder;
SerialNumber: number;
ShareName: string;
TotalSize: any;
VolumeName: string;
}
interface Drives {
Count: number;
Item: (Key: any) => Drive;
}
interface Encoder {
EncodeScriptFile: (szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string) => string;
}
interface File {
Attributes: FileAttribute;
Copy: (Destination: string, OverWriteFiles?: boolean) => void;
DateCreated: VarDate;
DateLastAccessed: VarDate;
DateLastModified: VarDate;
Delete: (Force?: boolean) => void;
Drive: Drive;
Move: (Destination: string) => void;
Name: string;
OpenAsTextStream: (IOMode?: IOMode, Format?: Tristate) => TextStream;
ParentFolder: Folder;
Path: string;
ShortName: string;
ShortPath: string;
Size: any;
Type: string;
}
interface Files {
Count: number;
Item: (Key: any) => File;
}
interface FileSystemObject {
BuildPath: (Path: string, Name: string) => string;
CopyFile: (Source: string, Destination: string, OverWriteFiles?: boolean) => void;
CopyFolder: (Source: string, Destination: string, OverWriteFiles?: boolean) => void;
CreateFolder: (Path: string) => Folder;
CreateTextFile: (FileName: string, Overwrite?: boolean, Unicode?: boolean) => TextStream;
DeleteFile: (FileSpec: string, Force?: boolean) => void;
DeleteFolder: (FolderSpec: string, Force?: boolean) => void;
DriveExists: (DriveSpec: string) => boolean;
Drives: Drives;
FileExists: (FileSpec: string) => boolean;
FolderExists: (FolderSpec: string) => boolean;
GetAbsolutePathName: (Path: string) => string;
GetBaseName: (Path: string) => string;
GetDrive: (DriveSpec: string) => Drive;
GetDriveName: (Path: string) => string;
GetExtensionName: (Path: string) => string;
GetFile: (FilePath: string) => File;
GetFileName: (Path: string) => string;
GetFileVersion: (FileName: string) => string;
GetFolder: (FolderPath: string) => Folder;
GetParentFolderName: (Path: string) => string;
GetSpecialFolder: (SpecialFolder: SpecialFolderConst) => Folder;
GetStandardStream: (StandardStreamType: StandardStreamTypes, Unicode?: boolean) => TextStream;
GetTempName: () => string;
MoveFile: (Source: string, Destination: string) => void;
MoveFolder: (Source: string, Destination: string) => void;
OpenTextFile: (FileName: string, IOMode?: IOMode, Create?: boolean, Format?: Tristate) => TextStream;
}
interface Folder {
Attributes: FileAttribute;
Copy: (Destination: string, OverWriteFiles?: boolean) => void;
CreateTextFile: (FileName: string, Overwrite?: boolean, Unicode?: boolean) => TextStream;
DateCreated: VarDate;
DateLastAccessed: VarDate;
DateLastModified: VarDate;
Delete: (Force?: boolean) => void;
Drive: Drive;
Files: Files;
IsRootFolder: boolean;
Move: (Destination: string) => void;
Name: string;
ParentFolder: Folder;
Path: string;
ShortName: string;
ShortPath: string;
Size: any;
SubFolders: Folders;
Type: string;
}
interface Folders {
Add: (Name: string) => Folder;
Count: number;
Item: (Key: any) => Folder;
}
interface TextStream {
AtEndOfLine: boolean;
AtEndOfStream: boolean;
Close: () => void;
Column: number;
Line: number;
Read: (Characters: number) => string;
ReadAll: () => string;
ReadLine: () => string;
Skip: (Characters: number) => void;
SkipLine: () => void;
Write: (Text: string) => void;
WriteBlankLines: (Lines: number) => void;
WriteLine: (Text?: string) => void;
}
}
interface ActiveXObject {
new (progID: 'Scripting.Dictionary'): Scripting.Dictionary;
new (progID: 'Scripting.FileSystemObject'): Scripting.FileSystemObject;
new (progID: 'Scripting.Encoder'): Scripting.Encoder;
}
@@ -1,24 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom",
"scripthost"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"activex-scripting-runtime-tests.ts"
]
}
@@ -1,8 +1,7 @@
//source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx
// source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx
//Generates a string describing the drive type of a given Drive object.
var showDriveType = (drive: Scripting.Drive) => {
// Generates a string describing the drive type of a given Drive object.
let showDriveType = (drive: Scripting.Drive) => {
switch (drive.DriveType) {
case Scripting.DriveTypeConst.Removable:
return 'Removeable';
@@ -19,14 +18,13 @@ var showDriveType = (drive: Scripting.Drive) => {
}
};
//Generates a string describing the attributes of a file or folder.
var showFileAttributes = (file: Scripting.File) => {
var attr = file.Attributes;
// Generates a string describing the attributes of a file or folder.
let showFileAttributes = (file: Scripting.File) => {
let attr = file.Attributes;
if (attr === 0) {
return 'Normal';
}
var attributeStrings: string[] = [];
let attributeStrings: string[] = [];
if (attr & Scripting.FileAttribute.Directory) { attributeStrings.push('Directory'); }
if (attr & Scripting.FileAttribute.ReadOnly) { attributeStrings.push('Read-only'); }
if (attr & Scripting.FileAttribute.Hidden) { attributeStrings.push('Hidden'); }
@@ -38,24 +36,22 @@ var showFileAttributes = (file: Scripting.File) => {
return attributeStrings.join(',');
};
//source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx
var showFreeSpace = (drvPath: string) => {
var fso = new ActiveXObject('Scripting.FileSystemObject');
var d = fso.GetDrive(fso.GetDriveName(drvPath));
var s = 'Drive ' + drvPath + ' - ';
// source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx
let showFreeSpace = (drvPath: string) => {
let fso = new ActiveXObject('Scripting.FileSystemObject');
let d = fso.GetDrive(fso.GetDriveName(drvPath));
let s = 'Drive ' + drvPath + ' - ';
s += d.VolumeName + '<br>';
s += 'Free Space: ' + d.FreeSpace / 1024 + ' Kbytes';
return (s);
};
// source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx
let getALine = (filespec: string) => {
let fso = new ActiveXObject('Scripting.FileSystemObject');
let file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false);
//source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx
var getALine = (filespec: string) => {
var fso = new ActiveXObject('Scripting.FileSystemObject');
var file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false);
var s = '';
let s = '';
while (!file.AtEndOfLine) {
s += file.Read(1);
}
+465
View File
@@ -0,0 +1,465 @@
// Type definitions for Microsoft Scripting Runtime 1.0
// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx
// Definitions by: Zev Spitz <https://github.com/zspitz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Scripting {
const enum CompareMethod {
BinaryCompare = 0,
DatabaseCompare = 2,
TextCompare = 1
}
const enum DriveTypeConst {
CDRom = 4,
Fixed = 2,
RamDisk = 5,
Remote = 3,
Removable = 1,
UnknownType = 0
}
const enum FileAttribute {
Alias = 1024,
Archive = 32,
Compressed = 2048,
Directory = 16,
Hidden = 2,
Normal = 0,
ReadOnly = 1,
System = 4,
Volume = 8
}
const enum IOMode {
ForAppending = 8,
ForReading = 1,
ForWriting = 2
}
const enum SpecialFolderConst {
SystemFolder = 1,
TemporaryFolder = 2,
WindowsFolder = 0
}
const enum StandardStreamTypes {
StdErr = 2,
StdIn = 0,
StdOut = 1
}
const enum Tristate {
TristateFalse = 0,
TristateMixed = -2,
TristateTrue = -1,
TristateUseDefault = -2
}
/** Scripting.Dictionary */
interface Dictionary {
/** Add a new key and item to the dictionary. */
Add(Key: any, Item: any): void;
/** Set or get the string comparison method. */
CompareMode: CompareMethod;
/** Get the number of items in the dictionary. */
readonly Count: number;
/** Determine if a given key is in the dictionary. */
Exists(Key: any): boolean;
HashVal(Key: any): any;
/** Set or get the item for a given key */
Item(Key: any): any;
/** Get an array containing all items in the dictionary. */
Items(): any;
/** Change a key to a different key. */
Key(Key: any): any;
/** Get an array containing all keys in the dictionary. */
Keys(): any;
/** Remove a given key from the dictionary. */
Remove(Key: any): void;
/** Remove all information from the dictionary. */
RemoveAll(): void;
}
/** Drive Object */
interface Drive {
/** Get available space */
readonly AvailableSpace: any;
/** Drive letter */
readonly DriveLetter: string;
/** Drive type */
readonly DriveType: DriveTypeConst;
/** Filesystem type */
readonly FileSystem: string;
/** Get drive free space */
readonly FreeSpace: any;
/** Check if disk is available */
readonly IsReady: boolean;
/** Path */
readonly Path: string;
/** Root folder */
readonly RootFolder: Folder;
/** Serial number */
readonly SerialNumber: number;
/** Share name */
readonly ShareName: string;
/** Get total drive size */
readonly TotalSize: any;
/** Name of volume */
VolumeName: string;
}
/** Collection of drives associated with drive letters */
interface Drives {
/** Number of drives */
readonly Count: number;
/** Get drive */
Item(Key: any): Drive;
}
/** Script Encoder Object */
interface Encoder {
/** Call the Encoder determined by szExt, passing bstrStreamIn and optional arguments */
EncodeScriptFile(szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string): string;
}
/** File object */
interface File {
/** File attributes */
Attributes: FileAttribute;
/**
* Copy this file
* @param boolean [OverWriteFiles=true]
*/
Copy(Destination: string, OverWriteFiles?: boolean): void;
/** Date file was created */
readonly DateCreated: VarDate;
/** Date file was last accessed */
readonly DateLastAccessed: VarDate;
/** Date file was last modified */
readonly DateLastModified: VarDate;
/**
* Delete this file
* @param boolean [Force=false]
*/
Delete(Force?: boolean): void;
/** Get drive that contains file */
readonly Drive: Drive;
/** Move this file */
Move(Destination: string): void;
/** Get name of file */
Name: string;
/**
* Open a file as a TextStream
* @param Scripting.IOMode [IOMode=1]
* @param Scripting.Tristate [Format=0]
*/
OpenAsTextStream(IOMode?: IOMode, Format?: Tristate): TextStream;
/** Get folder that contains file */
readonly ParentFolder: Folder;
/** Path to the file */
readonly Path: string;
/** Short name */
readonly ShortName: string;
/** Short path */
readonly ShortPath: string;
/** File size */
readonly Size: any;
/** Type description */
readonly Type: string;
}
/** Collection of files in a folder */
interface Files {
/** Number of folders */
readonly Count: number;
/** Get file */
Item(Key: any): File;
}
/** FileSystem Object */
interface FileSystemObject {
/** Generate a path from an existing path and a name */
BuildPath(Path: string, Name: string): string;
/**
* Copy a file
* @param boolean [OverWriteFiles=true]
*/
CopyFile(Source: string, Destination: string, OverWriteFiles?: boolean): void;
/**
* Copy a folder
* @param boolean [OverWriteFiles=true]
*/
CopyFolder(Source: string, Destination: string, OverWriteFiles?: boolean): void;
/** Create a folder */
CreateFolder(Path: string): Folder;
/**
* Create a file as a TextStream
* @param boolean [Overwrite=true]
* @param boolean [Unicode=false]
*/
CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream;
/**
* Delete a file
* @param boolean [Force=false]
*/
DeleteFile(FileSpec: string, Force?: boolean): void;
/**
* Delete a folder
* @param boolean [Force=false]
*/
DeleteFolder(FolderSpec: string, Force?: boolean): void;
/** Check if a drive or a share exists */
DriveExists(DriveSpec: string): boolean;
/** Get drives collection */
readonly Drives: Drives;
/** Check if a file exists */
FileExists(FileSpec: string): boolean;
/** Check if a path exists */
FolderExists(FolderSpec: string): boolean;
/** Return the canonical representation of the path */
GetAbsolutePathName(Path: string): string;
/** Return base name from a path */
GetBaseName(Path: string): string;
/** Get drive or UNC share */
GetDrive(DriveSpec: string): Drive;
/** Return drive from a path */
GetDriveName(Path: string): string;
/** Return extension from path */
GetExtensionName(Path: string): string;
/** Get file */
GetFile(FilePath: string): File;
/** Return the file name from a path */
GetFileName(Path: string): string;
/** Retrieve the file version of the specified file into a string */
GetFileVersion(FileName: string): string;
/** Get folder */
GetFolder(FolderPath: string): Folder;
/** Return path to the parent folder */
GetParentFolderName(Path: string): string;
/** Get location of various system folders */
GetSpecialFolder(SpecialFolder: SpecialFolderConst): Folder;
/**
* Retrieve the standard input, output or error stream
* @param boolean [Unicode=false]
*/
GetStandardStream(StandardStreamType: StandardStreamTypes, Unicode?: boolean): TextStream;
/** Generate name that can be used to name a temporary file */
GetTempName(): string;
/** Move a file */
MoveFile(Source: string, Destination: string): void;
/** Move a folder */
MoveFolder(Source: string, Destination: string): void;
/**
* Open a file as a TextStream
* @param Scripting.IOMode [IOMode=1]
* @param boolean [Create=false]
* @param Scripting.Tristate [Format=0]
*/
OpenTextFile(FileName: string, IOMode?: IOMode, Create?: boolean, Format?: Tristate): TextStream;
}
/** Folder object */
interface Folder {
/** Folder attributes */
Attributes: FileAttribute;
/**
* Copy this folder
* @param boolean [OverWriteFiles=true]
*/
Copy(Destination: string, OverWriteFiles?: boolean): void;
/**
* Create a file as a TextStream
* @param boolean [Overwrite=true]
* @param boolean [Unicode=false]
*/
CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream;
/** Date folder was created */
readonly DateCreated: VarDate;
/** Date folder was last accessed */
readonly DateLastAccessed: VarDate;
/** Date folder was last modified */
readonly DateLastModified: VarDate;
/**
* Delete this folder
* @param boolean [Force=false]
*/
Delete(Force?: boolean): void;
/** Get drive that contains folder */
readonly Drive: Drive;
/** Get files collection */
readonly Files: Files;
/** True if folder is root */
readonly IsRootFolder: boolean;
/** Move this folder */
Move(Destination: string): void;
/** Get name of folder */
Name: string;
/** Get parent folder */
readonly ParentFolder: Folder;
/** Path to folder */
readonly Path: string;
/** Short name */
readonly ShortName: string;
/** Short path */
readonly ShortPath: string;
/** Sum of files and subfolders */
readonly Size: any;
/** Get folders collection */
readonly SubFolders: Folders;
/** Type description */
readonly Type: string;
}
/** Collection of subfolders in a folder */
interface Folders {
/** Create a new folder */
Add(Name: string): Folder;
/** Number of folders */
readonly Count: number;
/** Get folder */
Item(Key: any): Folder;
}
/** TextStream object */
interface TextStream {
/** Is the current position at the end of a line? */
readonly AtEndOfLine: boolean;
/** Is the current position at the end of the stream? */
readonly AtEndOfStream: boolean;
/** Close a text stream */
Close(): void;
/** Current column number */
readonly Column: number;
/** Current line number */
readonly Line: number;
/** Read a specific number of characters into a string */
Read(Characters: number): string;
/** Read the entire stream into a string */
ReadAll(): string;
/** Read an entire line into a string */
ReadLine(): string;
/** Skip a specific number of characters */
Skip(Characters: number): void;
/** Skip a line */
SkipLine(): void;
/** Write a string to the stream */
Write(Text: string): void;
/** Write a number of blank lines to the stream */
WriteBlankLines(Lines: number): void;
/**
* Write a string and an end of line to the stream
* @param string [Text='']
*/
WriteLine(Text?: string): void;
}
}
interface ActiveXObject {
set(obj: Scripting.Dictionary, propertyName: 'Item', parameterTypes: [any], newValue: any): void;
new(progid: 'Scripting.Dictionary'): Scripting.Dictionary;
new(progid: 'Scripting.Encoder'): Scripting.Encoder;
new(progid: 'Scripting.FileSystemObject'): Scripting.FileSystemObject;
}
interface EnumeratorConstructor {
new(col: Scripting.Dictionary): any;
new(col: Scripting.Drives): Scripting.Drive;
new(col: Scripting.Files): Scripting.File;
new(col: Scripting.Folders): Scripting.Folder;
}
+1
View File
@@ -0,0 +1 @@
{ "dependencies": { "activex-helpers": "*"}}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es5", "scripthost"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strict": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"activex-scripting-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -1,31 +1,43 @@
//source -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms630826(v=vs.85).aspx
// source -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms630826(v=vs.85).aspx
// Convert a file
let commonDialog = new ActiveXObject('WIA.CommonDialog');
let img = commonDialog.ShowAcquireImage();
//Convert a file
var commonDialog = new ActiveXObject('WIA.CommonDialog');
var img = commonDialog.ShowAcquireImage();
if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) {
var ip = new ActiveXObject('WIA.ImageProcess');
// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these:
let jpegFormatID = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}';
if (img.FormatID !== jpegFormatID) {
let ip = new ActiveXObject('WIA.ImageProcess');
ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID);
ip.Filters.Item(1).Properties.Item('FormatID').Value = jpegFormatID;
img = ip.Apply(img);
}
// with this:
/*if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) {
let ip = new ActiveXObject('WIA.ImageProcess');
ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID);
ip.Filters.Item(1).Properties.Item('FormatID').Value = WIA.FormatID.wiaFormatJPEG;
img = ip.Apply(img);
}
}*/
//Take a picture
var dev = commonDialog.ShowSelectDevice();
// Take a picture
let dev = commonDialog.ShowSelectDevice();
if (dev.Type === WIA.WiaDeviceType.CameraDeviceType) {
var itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);
// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these:
let commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}';
let itm = dev.ExecuteCommand(commandID);
// with this:
// let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);
}
//Display detailed property information
// Display detailed property information
dev = commonDialog.ShowSelectDevice();
var e = new Enumerator<WIA.Property>(dev.Properties); //no foreach over ActiveX collections
let e = new Enumerator<WIA.Property>(dev.Properties); // no foreach over ActiveX collections
e.moveFirst();
while (!e.atEnd()) {
var p = e.item();
var s = p.Name + ' (' + p.PropertyID + ') = ';
let p = e.item();
let s = p.Name + ' (' + p.PropertyID + ') = ';
if (p.IsVector) {
s += '[vector of data]';
} else {
@@ -48,8 +60,8 @@ while (!e.atEnd()) {
} else {
s += ' [valid values include: ';
}
var count = p.SubTypeValues.Count;
for (var i = 1; i <= count; i++) {
let count = p.SubTypeValues.Count;
for (let i = 1; i <= count; i++) {
s += p.SubTypeValues.Item(i);
if (i < count) {
s += ', ';
@@ -63,9 +75,5 @@ while (!e.atEnd()) {
}
}
if (WScript) {
WScript.Echo(s);
} else if (window) {
window.alert(s);
}
}
WScript.Echo(s);
}
+759
View File
@@ -0,0 +1,759 @@
// Type definitions for Windows Image Acquisition 2.0
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx
// Definitions by: Zev Spitz <https://github.com/zspitz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Typescript Version: 2.4
declare namespace WIA {
/** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */
// uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017)
/*const enum CommandID {
wiaCommandChangeDocument = '{04E725B0-ACAE-11D2-A093-00C04F72DC3C}',
wiaCommandDeleteAllItems = '{E208C170-ACAD-11D2-A093-00C04F72DC3C}',
wiaCommandSynchronize = '{9B26B7B2-ACAD-11D2-A093-00C04F72DC3C}',
wiaCommandTakePicture = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}',
wiaCommandUnloadDocument = '{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}'
}*/
/** String versions of globally unique identifiers (GUIDs) that identify DeviceManager events. */
// uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017)
/*const enum EventID {
wiaEventDeviceConnected = '{A28BBADE-64B6-11D2-A231-00C04FA31809}',
wiaEventDeviceDisconnected = '{143E4E83-6497-11D2-A231-00C04FA31809}',
wiaEventItemCreated = '{4C8F4EF5-E14F-11D2-B326-00C04F68CE61}',
wiaEventItemDeleted = '{1D22A559-E14F-11D2-B326-00C04F68CE61}',
wiaEventScanEmailImage = '{C686DCEE-54F2-419E-9A27-2FC7F2E98F9E}',
wiaEventScanFaxImage = '{C00EB793-8C6E-11D2-977A-0000F87A926F}',
wiaEventScanFilmImage = '{9B2B662C-6185-438C-B68B-E39EE25E71CB}',
wiaEventScanImage = '{A6C5A715-8C6E-11D2-977A-0000F87A926F}',
wiaEventScanImage2 = '{FC4767C1-C8B3-48A2-9CFA-2E90CB3D3590}',
wiaEventScanImage3 = '{154E27BE-B617-4653-ACC5-0FD7BD4C65CE}',
wiaEventScanImage4 = '{A65B704A-7F3C-4447-A75D-8A26DFCA1FDF}',
wiaEventScanOCRImage = '{9D095B89-37D6-4877-AFED-62A297DC6DBE}',
wiaEventScanPrintImage = '{B441F425-8C6E-11D2-977A-0000F87A926F}'
}*/
/** String versions of globally unique identifiers (GUIDs) that indicate the file format of an image. */
// uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017)
/*const enum FormatID {
wiaFormatBMP = '{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}',
wiaFormatGIF = '{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}',
wiaFormatJPEG = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}',
wiaFormatPNG = '{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}',
wiaFormatTIFF = '{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}'
}*/
/** Miscellaneous string constants */
// uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017)
/*const enum Miscellaneous {
wiaAnyDeviceID = '*',
wiaIDUnknown = '{00000000-0000-0000-0000-000000000000}'
}*/
/**
* The WiaDeviceType enumeration specifies the type of device attached to a user's computer. Use the Type property on the DeviceInfo object or the Device
* object to obtain these values from the device.
*/
const enum WiaDeviceType {
CameraDeviceType = 2,
ScannerDeviceType = 1,
UnspecifiedDeviceType = 0,
VideoDeviceType = 3
}
/**
* A DeviceEvent's type is composed of bits from the WiaEventFlags enumeration. You can test a DeviceEvent's type by using the AND operation with DeviceEv
* ent.Type and a member from the WiaEventFlags enumeration.
*/
const enum WiaEventFlag {
ActionEvent = 2,
NotificationEvent = 1
}
/** The WiaImageBias enumeration helps specify what type of data the image is intended to represent. */
const enum WiaImageBias {
MaximizeQuality = 131072,
MinimizeSize = 65536
}
/** The WiaImageIntent enumeration helps specify what type of data the image is intended to represent. */
const enum WiaImageIntent {
ColorIntent = 1,
GrayscaleIntent = 2,
TextIntent = 4,
UnspecifiedIntent = 0
}
/**
* The WiaImagePropertyType enumeration specifies the type of the value of an image property. Image properties can be found in the Properties collection o
* f an ImageFile object.
*/
const enum WiaImagePropertyType {
ByteImagePropertyType = 1001,
LongImagePropertyType = 1004,
RationalImagePropertyType = 1006,
StringImagePropertyType = 1002,
UndefinedImagePropertyType = 1000,
UnsignedIntegerImagePropertyType = 1003,
UnsignedLongImagePropertyType = 1005,
UnsignedRationalImagePropertyType = 1007,
VectorOfBytesImagePropertyType = 1101,
VectorOfLongsImagePropertyType = 1103,
VectorOfRationalsImagePropertyType = 1105,
VectorOfUndefinedImagePropertyType = 1100,
VectorOfUnsignedIntegersImagePropertyType = 1102,
VectorOfUnsignedLongsImagePropertyType = 1104,
VectorOfUnsignedRationalsImagePropertyType = 1106
}
/**
* An Item's type is composed of bits from the WiaItemFlags enumeration. You can test an Item's type by using the AND operation with Item.Properties("Item
* Flags") and a member from the WiaItemFlags enumeration.
*/
const enum WiaItemFlag {
AnalyzeItemFlag = 16,
AudioItemFlag = 32,
BurstItemFlag = 2048,
DeletedItemFlag = 128,
DeviceItemFlag = 64,
DisconnectedItemFlag = 256,
FileItemFlag = 2,
FolderItemFlag = 4,
FreeItemFlag = 0,
GeneratedItemFlag = 16384,
HasAttachmentsItemFlag = 32768,
HPanoramaItemFlag = 512,
ImageItemFlag = 1,
RemovedItemFlag = -2147483648,
RootItemFlag = 8,
StorageItemFlag = 4096,
TransferItemFlag = 8192,
VideoItemFlag = 65536,
VPanoramaItemFlag = 1024
}
/**
* The WiaPropertyType enumeration specifies the type of the value of an item property. Item properties can be found in the Properties collection of a Dev
* ice or Item object.
*/
const enum WiaPropertyType {
BooleanPropertyType = 1,
BytePropertyType = 2,
ClassIDPropertyType = 15,
CurrencyPropertyType = 12,
DatePropertyType = 13,
DoublePropertyType = 11,
ErrorCodePropertyType = 7,
FileTimePropertyType = 14,
HandlePropertyType = 18,
IntegerPropertyType = 3,
LargeIntegerPropertyType = 8,
LongPropertyType = 5,
ObjectPropertyType = 17,
SinglePropertyType = 10,
StringPropertyType = 16,
UnsignedIntegerPropertyType = 4,
UnsignedLargeIntegerPropertyType = 9,
UnsignedLongPropertyType = 6,
UnsupportedPropertyType = 0,
VariantPropertyType = 19,
VectorOfBooleansPropertyType = 101,
VectorOfBytesPropertyType = 102,
VectorOfClassIDsPropertyType = 115,
VectorOfCurrenciesPropertyType = 112,
VectorOfDatesPropertyType = 113,
VectorOfDoublesPropertyType = 111,
VectorOfErrorCodesPropertyType = 107,
VectorOfFileTimesPropertyType = 114,
VectorOfIntegersPropertyType = 103,
VectorOfLargeIntegersPropertyType = 108,
VectorOfLongsPropertyType = 105,
VectorOfSinglesPropertyType = 110,
VectorOfStringsPropertyType = 116,
VectorOfUnsignedIntegersPropertyType = 104,
VectorOfUnsignedLargeIntegersPropertyType = 109,
VectorOfUnsignedLongsPropertyType = 106,
VectorOfVariantsPropertyType = 119
}
/**
* The WiaSubType enumeration specifies more detail about the property value. Use the SubType property on the Property object to obtain these values for t
* he property.
*/
const enum WiaSubType {
FlagSubType = 3,
ListSubType = 2,
RangeSubType = 1,
UnspecifiedSubType = 0
}
/**
* The CommonDialog control is an invisible-at-runtime control that contains all the methods that display a User Interface. A CommonDialog control can be
* created using "WIA.CommonDialog" in a call to CreateObject or by dropping a CommonDialog on a form.
*/
interface CommonDialog {
/**
* Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile object
* on success, otherwise Nothing
* @param WIA.WiaDeviceType [DeviceType=0]
* @param WIA.WiaImageIntent [Intent=0]
* @param WIA.WiaImageBias [Bias=131072]
* @param string [FormatID='{00000000-0000-0000-0000-000000000000}']
* @param boolean [AlwaysSelectDevice=false]
* @param boolean [UseCommonUI=true]
* @param boolean [CancelError=false]
*/
ShowAcquireImage(
DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean): ImageFile;
/** Launches the Windows Scanner and Camera Wizard and returns Nothing. Future versions may return a collection of ImageFile objects. */
ShowAcquisitionWizard(Device: Device): any;
/**
* Displays the properties dialog box for the specified Device
* @param boolean [CancelError=false]
*/
ShowDeviceProperties(Device: Device, CancelError?: boolean): void;
/**
* Displays the properties dialog box for the specified Item
* @param boolean [CancelError=false]
*/
ShowItemProperties(Item: Item, CancelError?: boolean): void;
/** Launches the Photo Printing Wizard with the absolute path of a specific file or Vector of absolute paths to files */
ShowPhotoPrintingWizard(Files: any): void;
/**
* Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, otherwise
* Nothing
* @param WIA.WiaDeviceType [DeviceType=0]
* @param boolean [AlwaysSelectDevice=false]
* @param boolean [CancelError=false]
*/
ShowSelectDevice(DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean): Device;
/**
* Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an It
* ems collection on success, otherwise Nothing
* @param WIA.WiaImageIntent [Intent=0]
* @param WIA.WiaImageBias [Bias=131072]
* @param boolean [SingleSelect=true]
* @param boolean [UseCommonUI=true]
* @param boolean [CancelError=false]
*/
ShowSelectItems(Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean): Items;
/**
* Displays a progress dialog box while transferring the specified Item to the local machine. See Item.Transfer for additional information.
* @param string [FormatID='{00000000-0000-0000-0000-000000000000}']
* @param boolean [CancelError=false]
*/
ShowTransfer(Item: Item, FormatID?: string, CancelError?: boolean): any;
}
/** The Device object represents an active connection to an imaging device. */
interface Device {
/** A collection of all commands for this imaging device */
readonly Commands: DeviceCommands;
/** Returns the DeviceID for this Device */
readonly DeviceID: string;
/** A collection of all events for this imaging device */
readonly Events: DeviceEvents;
/**
* Issues the command specified by CommandID to the imaging device. CommandIDs are device dependent. Valid CommandIDs for this Device are contained in the
* Commands collection.
*/
ExecuteCommand(CommandID: string): Item;
/** Returns the Item object specified by ItemID if it exists */
GetItem(ItemID: string): Item;
/** A collection of all items for this imaging device */
readonly Items: Items;
/** A collection of all properties for this imaging device */
readonly Properties: Properties;
/** Returns the Type of Device */
readonly Type: WiaDeviceType;
/** Returns the underlying IWiaItem interface for this Device object */
readonly WiaItem: any;
}
/** The DeviceCommand object describes a CommandID that can be used when calling ExecuteCommand on a Device or Item object. */
interface DeviceCommand {
/** Returns the commandID for this Command */
readonly CommandID: string;
/** Returns the command Description */
readonly Description: string;
/** Returns the command Name */
readonly Name: string;
}
/**
* The DeviceCommands object is a collection of all the supported DeviceCommands for an imaging device. See the Commands property of a Device or Item obje
* ct for more details on determining the collection of supported device commands.
*/
interface DeviceCommands {
/** Returns the number of members in the collection */
readonly Count: number;
/** Returns the specified item in the collection by position */
Item(Index: number): DeviceCommand;
}
/** The DeviceEvent object describes an EventID that can be used when calling RegisterEvent or RegisterPersistentEvent on a DeviceManager object. */
interface DeviceEvent {
/** Returns the event Description */
readonly Description: string;
/** Returns the EventID for this Event */
readonly EventID: string;
/** Returns the event Name */
readonly Name: string;
/** Returns the Type of this Event */
readonly Type: WiaEventFlag;
}
/**
* The DeviceEvents object is a collection of all the supported DeviceEvent for an imaging device. See the Events property of a Device object for more det
* ails on determining the collection of supported device events.
*/
interface DeviceEvents {
/** Returns the number of members in the collection */
readonly Count: number;
/** Returns the specified item in the collection by position */
Item(Index: number): DeviceEvent;
}
/**
* The DeviceInfo object is a container that describes the unchanging (static) properties of an imaging device that is currently connected to the computer
* .
*/
interface DeviceInfo {
/** Establish a connection with this device and return a Device object */
Connect(): Device;
/** Returns the DeviceID for this Device */
readonly DeviceID: string;
/** A collection of all properties for this imaging device that are applicable when the device is not connected */
readonly Properties: Properties;
/** Returns the Type of Device */
readonly Type: WiaDeviceType;
}
/**
* The DeviceInfos object is a collection of all the imaging devices currently connected to the computer. See the DeviceInfos property on the DeviceManage
* r object for detail on accessing the DeviceInfos object.
*/
interface DeviceInfos {
/** Returns the number of members in the collection */
readonly Count: number;
/** Returns the specified item in the collection either by position or Device ID */
Item(Index: any): DeviceInfo;
}
/**
* The DeviceManager control is an invisible-at-runtime control that manages the imaging devices connected to the computer. A DeviceManager control can be
* created using "WIA.DeviceManager" in a call to CreateObject or by dropping a DeviceManager on a form.
*/
interface DeviceManager {
/** A collection of all imaging devices connected to this computer */
readonly DeviceInfos: DeviceInfos;
/**
* Registers the specified EventID for the specified DeviceID. If DeviceID is "*" then OnEvent will be called whenever the event specified occurs for any
* device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified.
* @param string [DeviceID='*']
*/
RegisterEvent(EventID: string, DeviceID?: string): void;
/**
* Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full pat
* h name and the appropriate command-line arguments needed to invoke the application.
* @param string [DeviceID='*']
*/
RegisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void;
/**
* Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called Regis
* terEvent.
* @param string [DeviceID='*']
*/
UnregisterEvent(EventID: string, DeviceID?: string): void;
/**
* Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the Command
* , Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent.
* @param string [DeviceID='*']
*/
UnregisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void;
}
/**
* The Filter object represents a unit of modification on an ImageFile. To use a Filter, add it to the Filters collection, then set the filter's propertie
* s and finally use the Apply method of the ImageProcess object to filter an ImageFile.
*/
interface Filter {
/** Returns a Description of what the filter does */
readonly Description: string;
/** Returns the FilterID for this Filter */
readonly FilterID: string;
/** Returns the Filter Name */
readonly Name: string;
/** A collection of all properties for this filter */
readonly Properties: Properties;
}
/**
* The FilterInfo object is a container that describes a Filter object without requiring a Filter to be Added to the process chain. See the FilterInfos pr
* operty on the ImageProcess object for details on accessing FilterInfo objects.
*/
interface FilterInfo {
/** Returns a technical Description of what the filter does and how to use it in a filter chain */
readonly Description: string;
/** Returns the FilterID for this filter */
readonly FilterID: string;
/** Returns the FilterInfo Name */
readonly Name: string;
}
/**
* The FilterInfos object is a collection of all the available FilterInfo objects. See the FilterInfos property on the ImageProcess object for detail on a
* ccessing the FilterInfos object.
*/
interface FilterInfos {
/** Returns the number of members in the collection */
readonly Count: number;
/** Returns the specified item in the collection either by position or name */
Item(Index: any): FilterInfo;
}
/** The Filters object is a collection of the Filters that will be applied to an ImageFile when you call the Apply method on the ImageProcess object. */
interface Filters {
/**
* Appends/Inserts a new Filter of the specified FilterID into a Filter collection
* @param number [Index=0]
*/
Add(FilterID: string, Index?: number): void;
/** Returns the number of members in the collection */
readonly Count: number;
/** Returns the specified item in the collection by position or FilterID */
Item(Index: number): Filter;
/** Removes the designated filter */
Remove(Index: number): void;
}
/**
* The Formats object is a collection of supported FormatIDs that you can use when calling Transfer on an Item object or ShowTransfer on a CommonDialog ob
* ject for this Item.
*/
interface Formats {
/** Returns the number of members in the collection */
readonly Count: number;
/** Returns the specified item in the collection by position */
Item(Index: number): string;
}
/**
* The ImageFile object is a container for images transferred to your computer when you call Transfer or ShowTransfer. It also supports image files throug
* h LoadFile. An ImageFile object can be created using "WIA.ImageFile" in a call to CreateObject.
*/
interface ImageFile {
/** Returns/Sets the current frame in the image */
ActiveFrame: number;
/** Returns the raw image bits as a Vector of Long values */
readonly ARGBData: Vector;
/** Returns the raw image file as a Vector of Bytes */
readonly FileData: Vector;
/** Returns the file extension for this image file type */
readonly FileExtension: string;
/** Returns the FormatID for this file type */
readonly FormatID: string;
/** Returns the number of frames in the image */
readonly FrameCount: number;
/** Returns the Height of the image in pixels */
readonly Height: number;
/** Returns the Horizontal pixels per inch of the image */
readonly HorizontalResolution: number;
/** Indicates if the pixel format has an alpha component */
readonly IsAlphaPixelFormat: boolean;
/** Indicates whether the image is animated */
readonly IsAnimated: boolean;
/** Indicates if the pixel format is extended (16 bits/channel) */
readonly IsExtendedPixelFormat: boolean;
/** Indicates if the pixel data is an index into a palette or the actual color data */
readonly IsIndexedPixelFormat: boolean;
/** Loads the ImageFile object with the specified File */
LoadFile(Filename: string): void;
/** Returns the depth of the pixels of the image in bits per pixel */
readonly PixelDepth: number;
/** A collection of all properties for this image */
readonly Properties: Properties;
/** Save the ImageFile object to the specified File */
SaveFile(Filename: string): void;
/** Returns the Vertical pixels per inch of the image */
readonly VerticalResolution: number;
/** Returns the Width of the image in pixels */
readonly Width: number;
}
/** The ImageProcess object manages the filter chain. An ImageProcess object can be created using "WIA.ImageProcess" in a call to CreateObject. */
interface ImageProcess {
/** Takes the specified ImageFile and returns the new ImageFile with all the filters applied on success */
Apply(Source: ImageFile): ImageFile;
/** A collection of all available filters */
readonly FilterInfos: FilterInfos;
/** A collection of the filters to be applied in this process */
readonly Filters: Filters;
}
/**
* The Item object is a container for an item on an imaging device object. See the Items property on the Device or Item object for details on accessing It
* em objects.
*/
interface Item {
/** A collection of all commands for this item */
readonly Commands: DeviceCommands;
/** Issues the command specified by CommandID. CommandIDs are device dependent. Valid CommandIDs for this Item are contained in the Commands collection. */
ExecuteCommand(CommandID: string): Item;
/** A collection of all supported format types for this item */
readonly Formats: Formats;
/** Returns the ItemID for this Item */
readonly ItemID: string;
/** A collection of all child items for this item */
readonly Items: Items;
/** A collection of all properties for this item */
readonly Properties: Properties;
/**
* Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging d
* evice. Future versions may return a collection of ImageFile objects.
* @param string [FormatID='{00000000-0000-0000-0000-000000000000}']
*/
Transfer(FormatID?: string): any;
/** Returns the underlying IWiaItem interface for this Item object */
readonly WiaItem: any;
}
/** The Items object contains a collection of Item objects. See the Items property on the Device or Item object for details on accessing the Items object. */
interface Items {
/** Adds a new Item with the specified Name and Flags. The Flags value is created by using the OR operation with members of the WiaItemFlags enumeration. */
Add(Name: string, Flags: number): void;
/** Returns the number of members in the collection */
readonly Count: number;
/** Returns the specified item in the collection by position */
Item(Index: number): Item;
/** Removes the designated Item */
Remove(Index: number): void;
}
/**
* The Properties object is a collection of all the Property objects associated with a given Device, DeviceInfo, Filter, ImageFile or Item object. See the
* Properties property on any of these objects for detail on accessing the Properties object.
*/
interface Properties {
/** Returns the number of members in the collection */
readonly Count: number;
/** Indicates whether the specified Property exists in the collection */
Exists(Index: any): boolean;
/** Returns the specified item in the collection either by position or name. */
Item(Index: any): Property;
}
/**
* The Property object is a container for a property associated with a Device, DeviceInfo, Filter, ImageFile or Item object. See the Properties property o
* n any of these objects for details on accessing Property objects.
*/
interface Property {
/** Indicates whether the Property Value is read only */
readonly IsReadOnly: boolean;
/** Indicates whether the Property Value is a vector */
readonly IsVector: boolean;
/** Returns the Property Name */
readonly Name: string;
/** Returns the PropertyID of this Property */
readonly PropertyID: number;
/** Returns the SubType of the Property, if any */
readonly SubType: WiaSubType;
/** Returns the default Property Value if the SubType is not UnspecifiedSubType */
readonly SubTypeDefault: any;
/** Returns the maximum valid Property Value if the SubType is RangeSubType */
readonly SubTypeMax: number;
/** Returns the minimum valid Property Value if the SubType is RangeSubType */
readonly SubTypeMin: number;
/** Returns the step increment of Property Values if the SubType is RangeSubType */
readonly SubTypeStep: number;
/** Returns a Vector of valid Property Values if the SubType is ListSubType or valid flag Values that can be ored together if the SubType is FlagSubType */
readonly SubTypeValues: Vector;
/** Returns either a WiaPropertyType or a WiaImagePropertyType */
readonly Type: number;
/** Returns/Sets the Property Value */
Value: any;
}
/**
* The Rational object is a container for the rational values found in Exif tags. It is a supported element type of the Vector object and may be created u
* sing "WIA.Rational" in a call to CreateObject.
*/
interface Rational {
/** Returns/Sets the Rational Value Denominator */
Denominator: number;
/** Returns/Sets the Rational Value Numerator */
Numerator: number;
/** Returns the Rational Value as a Double */
readonly Value: number;
}
/**
* The Vector object is a collection of values of the same type. It is used throughout the library in many different ways. The Vector object may be create
* d using "WIA.Vector" in a call to CreateObject.
*/
interface Vector {
/**
* If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the Vecto
* r collection.
* @param number [Index=0]
*/
Add(Value: any, Index?: number): void;
/** Returns/Sets the Vector of Bytes as an array of bytes */
BinaryData: any;
/** Removes all elements. */
Clear(): void;
/** Returns the number of members in the vector */
readonly Count: number;
/** Returns/Sets the Vector of Integers from a Date */
Date: VarDate;
/**
* Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an ImageFil
* e from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details.
* @param number [Width=0]
* @param number [Height=0]
*/
ImageFile(Width?: number, Height?: number): ImageFile;
/** Returns/Sets the specified item in the vector by position */
Item(Index: number): any;
/**
* If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs mu
* st be ARGB data. Returns a Picture object on success. See the ImageFile method for more details.
* @param number [Width=0]
* @param number [Height=0]
*/
Picture(Width?: number, Height?: number): any;
/** Removes the designated element and returns it if successful */
Remove(Index: number): any;
/**
* Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be sto
* red as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string.
* @param boolean [Resizable=true]
* @param boolean [Unicode=true]
*/
SetFromString(Value: string, Resizable?: boolean, Unicode?: boolean): void;
/**
* Returns a Vector of Bytes as a String
* @param boolean [Unicode=true]
*/
String(Unicode?: boolean): string;
}
}
interface ActiveXObject {
on(obj: WIA.DeviceManager, event: 'OnEvent', argNames: ['EventID', 'DeviceID', 'ItemID'], handler: (
this: WIA.DeviceManager, parameter: {
EventID: string, DeviceID: string, ItemID: string}) => void): void;
set(obj: WIA.Vector, propertyName: 'Item', parameterTypes: [number], newValue: any): void;
new(progid: 'WIA.CommonDialog'): WIA.CommonDialog;
new(progid: 'WIA.DeviceManager'): WIA.DeviceManager;
new(progid: 'WIA.ImageFile'): WIA.ImageFile;
new(progid: 'WIA.ImageProcess'): WIA.ImageProcess;
new(progid: 'WIA.Rational'): WIA.Rational;
new(progid: 'WIA.Vector'): WIA.Vector;
}
interface EnumeratorConstructor {
new(col: WIA.DeviceCommands): WIA.DeviceCommand;
new(col: WIA.DeviceEvents): WIA.DeviceEvent;
new(col: WIA.DeviceInfos): WIA.DeviceInfo;
new(col: WIA.FilterInfos): WIA.FilterInfo;
new(col: WIA.Filters): WIA.Filter;
new(col: WIA.Formats): string;
new(col: WIA.Items): WIA.Item;
new(col: WIA.Properties): WIA.Property;
new(col: WIA.Vector): any;
}
+1
View File
@@ -0,0 +1 @@
{ "dependencies": { "activex-helpers": "*"}}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es5", "scripthost"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strict": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"activex-wia-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
-379
View File
@@ -1,379 +0,0 @@
// Type definitions for Microsoft Windows Image Acquisition Library v2.0
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630827(v=vs.85).aspx
// Definitions by: Zev Spitz <https://github.com/zspitz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace WIA {
//Enums
type CommandID =
"'{04E725B0-ACAE-11D2-A093-00C04F72DC3C}'" //wiaCommandChangeDocument
| "'{E208C170-ACAD-11D2-A093-00C04F72DC3C}'" //wiaCommandDeleteAllItems
| "'{9B26B7B2-ACAD-11D2-A093-00C04F72DC3C}'" //wiaCommandSynchronize
| "'{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}'" //wiaCommandTakePicture
| "'{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}'"; //wiaCommandUnloadDocument
const CommandID: {
wiaCommandChangeDocument: CommandID,
wiaCommandDeleteAllItems: CommandID,
wiaCommandSynchronize: CommandID,
wiaCommandTakePicture: CommandID,
wiaCommandUnloadDocument: CommandID
};
type EventID =
"'{A28BBADE-64B6-11D2-A231-00C04FA31809}'" //wiaEventDeviceConnected
| "'{143E4E83-6497-11D2-A231-00C04FA31809}'" //wiaEventDeviceDisconnected
| "'{4C8F4EF5-E14F-11D2-B326-00C04F68CE61}'" //wiaEventItemCreated
| "'{1D22A559-E14F-11D2-B326-00C04F68CE61}'" //wiaEventItemDeleted
| "'{C686DCEE-54F2-419E-9A27-2FC7F2E98F9E}'" //wiaEventScanEmailImage
| "'{C00EB793-8C6E-11D2-977A-0000F87A926F}'" //wiaEventScanFaxImage
| "'{9B2B662C-6185-438C-B68B-E39EE25E71CB}'" //wiaEventScanFilmImage
| "'{A6C5A715-8C6E-11D2-977A-0000F87A926F}'" //wiaEventScanImage
| "'{FC4767C1-C8B3-48A2-9CFA-2E90CB3D3590}'" //wiaEventScanImage2
| "'{154E27BE-B617-4653-ACC5-0FD7BD4C65CE}'" //wiaEventScanImage3
| "'{A65B704A-7F3C-4447-A75D-8A26DFCA1FDF}'" //wiaEventScanImage4
| "'{9D095B89-37D6-4877-AFED-62A297DC6DBE}'" //wiaEventScanOCRImage
| "'{B441F425-8C6E-11D2-977A-0000F87A926F}'"; //wiaEventScanPrintImage
const EventID: {
wiaEventDeviceConnected: EventID,
wiaEventDeviceDisconnected: EventID,
wiaEventItemCreated: EventID,
wiaEventItemDeleted: EventID,
wiaEventScanEmailImage: EventID,
wiaEventScanFaxImage: EventID,
wiaEventScanFilmImage: EventID,
wiaEventScanImage: EventID,
wiaEventScanImage2: EventID,
wiaEventScanImage3: EventID,
wiaEventScanImage4: EventID,
wiaEventScanOCRImage: EventID,
wiaEventScanPrintImage: EventID
};
type FormatID =
"'{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatBMP
| "'{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatGIF
| "'{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatJPEG
| "'{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatPNG
| "'{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}'"; //wiaFormatTIFF
const FormatID: {
wiaFormatBMP: FormatID,
wiaFormatGIF: FormatID,
wiaFormatJPEG: FormatID,
wiaFormatPNG: FormatID,
wiaFormatTIFF: FormatID
};
type Miscellaneous =
"'*'" //wiaAnyDeviceID
| "'{00000000-0000-0000-0000-000000000000}'"; //wiaIDUnknown
const Miscellaneous: {
wiaAnyDeviceID: Miscellaneous,
wiaIDUnknown: Miscellaneous
};
const enum WiaDeviceType {
CameraDeviceType = 2,
ScannerDeviceType = 1,
UnspecifiedDeviceType = 0,
VideoDeviceType = 3
}
const enum WiaEventFlag {
ActionEvent = 2,
NotificationEvent = 1
}
const enum WiaImageBias {
MaximizeQuality = 131072,
MinimizeSize = 65536
}
const enum WiaImageIntent {
ColorIntent = 1,
GrayscaleIntent = 2,
TextIntent = 4,
UnspecifiedIntent = 0
}
const enum WiaImagePropertyType {
ByteImagePropertyType = 1001,
LongImagePropertyType = 1004,
RationalImagePropertyType = 1006,
StringImagePropertyType = 1002,
UndefinedImagePropertyType = 1000,
UnsignedIntegerImagePropertyType = 1003,
UnsignedLongImagePropertyType = 1005,
UnsignedRationalImagePropertyType = 1007,
VectorOfBytesImagePropertyType = 1101,
VectorOfLongsImagePropertyType = 1103,
VectorOfRationalsImagePropertyType = 1105,
VectorOfUndefinedImagePropertyType = 1100,
VectorOfUnsignedIntegersImagePropertyType = 1102,
VectorOfUnsignedLongsImagePropertyType = 1104,
VectorOfUnsignedRationalsImagePropertyType = 1106
}
const enum WiaItemFlag {
AnalyzeItemFlag = 16,
AudioItemFlag = 32,
BurstItemFlag = 2048,
DeletedItemFlag = 128,
DeviceItemFlag = 64,
DisconnectedItemFlag = 256,
FileItemFlag = 2,
FolderItemFlag = 4,
FreeItemFlag = 0,
GeneratedItemFlag = 16384,
HasAttachmentsItemFlag = 32768,
HPanoramaItemFlag = 512,
ImageItemFlag = 1,
RemovedItemFlag = -2147483648,
RootItemFlag = 8,
StorageItemFlag = 4096,
TransferItemFlag = 8192,
VideoItemFlag = 65536,
VPanoramaItemFlag = 1024
}
const enum WiaPropertyType {
BooleanPropertyType = 1,
BytePropertyType = 2,
ClassIDPropertyType = 15,
CurrencyPropertyType = 12,
DatePropertyType = 13,
DoublePropertyType = 11,
ErrorCodePropertyType = 7,
FileTimePropertyType = 14,
HandlePropertyType = 18,
IntegerPropertyType = 3,
LargeIntegerPropertyType = 8,
LongPropertyType = 5,
ObjectPropertyType = 17,
SinglePropertyType = 10,
StringPropertyType = 16,
UnsignedIntegerPropertyType = 4,
UnsignedLargeIntegerPropertyType = 9,
UnsignedLongPropertyType = 6,
UnsupportedPropertyType = 0,
VariantPropertyType = 19,
VectorOfBooleansPropertyType = 101,
VectorOfBytesPropertyType = 102,
VectorOfClassIDsPropertyType = 115,
VectorOfCurrenciesPropertyType = 112,
VectorOfDatesPropertyType = 113,
VectorOfDoublesPropertyType = 111,
VectorOfErrorCodesPropertyType = 107,
VectorOfFileTimesPropertyType = 114,
VectorOfIntegersPropertyType = 103,
VectorOfLargeIntegersPropertyType = 108,
VectorOfLongsPropertyType = 105,
VectorOfSinglesPropertyType = 110,
VectorOfStringsPropertyType = 116,
VectorOfUnsignedIntegersPropertyType = 104,
VectorOfUnsignedLargeIntegersPropertyType = 109,
VectorOfUnsignedLongsPropertyType = 106,
VectorOfVariantsPropertyType = 119
}
const enum WiaSubType {
FlagSubType = 3,
ListSubType = 2,
RangeSubType = 1,
UnspecifiedSubType = 0
}
//Interfaces
interface CommonDialog {
ShowAcquireImage: (DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean) => ImageFile;
ShowAcquisitionWizard: (Device: Device) => any;
ShowDeviceProperties: (Device: Device, CancelError?: boolean) => void;
ShowItemProperties: (Item: Item, CancelError?: boolean) => void;
ShowPhotoPrintingWizard: (Files: any) => void;
ShowSelectDevice: (DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean) => Device;
ShowSelectItems: (Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean) => Items;
ShowTransfer: (Item: Item, FormatID?: string, CancelError?: boolean) => any;
}
interface Device {
Commands: DeviceCommands;
DeviceID: string;
Events: DeviceEvents;
ExecuteCommand: (CommandID: string) => Item;
GetItem: (ItemID: string) => Item;
Items: Items;
Properties: Properties;
Type: WiaDeviceType;
WiaItem: any /*VT_UNKNOWN*/;
}
interface DeviceCommand {
CommandID: string;
Description: string;
Name: string;
}
interface DeviceCommands {
Count: number;
Item: (Index: number) => DeviceCommand;
}
interface DeviceEvent {
Description: string;
EventID: string;
Name: string;
Type: WiaEventFlag;
}
interface DeviceEvents {
Count: number;
Item: (Index: number) => DeviceEvent;
}
interface DeviceInfo {
Connect: () => Device;
DeviceID: string;
Properties: Properties;
Type: WiaDeviceType;
}
interface DeviceInfos {
Count: number;
Item: (Index: any) => DeviceInfo;
}
interface DeviceManager {
DeviceInfos: DeviceInfos;
RegisterEvent: (EventID: string, DeviceID?: string) => void;
RegisterPersistentEvent: (Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string) => void;
UnregisterEvent: (EventID: string, DeviceID?: string) => void;
UnregisterPersistentEvent: (Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string) => void;
}
interface Filter {
Description: string;
FilterID: string;
Name: string;
Properties: Properties;
}
interface FilterInfo {
Description: string;
FilterID: string;
Name: string;
}
interface FilterInfos {
Count: number;
Item: (Index: any) => FilterInfo;
}
interface Filters {
Add: (FilterID: string, Index?: number) => void;
Count: number;
Item: (Index: number) => Filter;
Remove: (Index: number) => void;
}
interface Formats {
Count: number;
Item: (Index: number) => string;
}
interface ImageFile {
ActiveFrame: number;
ARGBData: Vector;
FileData: Vector;
FileExtension: string;
FormatID: string;
FrameCount: number;
Height: number;
HorizontalResolution: number;
IsAlphaPixelFormat: boolean;
IsAnimated: boolean;
IsExtendedPixelFormat: boolean;
IsIndexedPixelFormat: boolean;
LoadFile: (Filename: string) => void;
PixelDepth: number;
Properties: Properties;
SaveFile: (Filename: string) => void;
VerticalResolution: number;
Width: number;
}
interface ImageProcess {
Apply: (Source: ImageFile) => ImageFile;
FilterInfos: FilterInfos;
Filters: Filters;
}
interface Item {
Commands: DeviceCommands;
ExecuteCommand: (CommandID: string) => Item;
Formats: Formats;
ItemID: string;
Items: Items;
Properties: Properties;
Transfer: (FormatID?: string) => any;
WiaItem: any /*VT_UNKNOWN*/;
}
interface Items {
Add: (Name: string, Flags: number) => void;
Count: number;
Item: (Index: number) => Item;
Remove: (Index: number) => void;
}
interface Properties {
Count: number;
Exists: (Index: any) => boolean;
Item: (Index: any) => Property;
}
interface Property {
IsReadOnly: boolean;
IsVector: boolean;
Name: string;
PropertyID: number;
SubType: WiaSubType;
SubTypeDefault: any;
SubTypeMax: number;
SubTypeMin: number;
SubTypeStep: number;
SubTypeValues: Vector;
Type: number;
Value: any;
}
interface Rational {
Denominator: number;
Numerator: number;
Value: number;
}
interface Vector {
Add: (Value: any, Index?: number) => void;
BinaryData: any;
Clear: () => void;
Count: number;
Date: VarDate;
ImageFile: (Width?: number, Height?: number) => ImageFile;
Item: (Index: number) => any; //Also has setter with parameters
Picture: (Width?: number, Height?: number) => any;
Remove: (Index: number) => any;
SetFromString: (Value: string, Resizable?: boolean, Unicode?: boolean) => void;
String: (Unicode?: boolean) => string;
}
}
interface ActiveXObject {
new (progID: 'WIA.Rational'): WIA.Rational;
new (progID: 'WIA.Vector'): WIA.Vector;
new (progID: 'WIA.ImageFile'): WIA.ImageFile;
new (progID: 'WIA.ImageProcess'): WIA.ImageProcess;
new (progID: 'WIA.CommonDialog'): WIA.CommonDialog;
new (progID: 'WIA.DeviceManager'): WIA.DeviceManager;
}
@@ -1,24 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom",
"scripthost"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"activex-windows-image-acquisition-tests.ts"
]
}
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js
// Definitions by: mmaitre314 <https://github.com/mmaitre314>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare var AuthenticationContext: adal.AuthenticationContextStatic;
declare var Logging: adal.Logging;
+50
View File
@@ -0,0 +1,50 @@
// Global
const threeCamera = new AFRAME.THREE.Camera();
AFRAME.TWEEN.Easing;
// Entity
const entity = document.createElement('a-entity');
entity.emit('rotate');
entity.emit('collide', { target: entity });
entity.emit('sink', null, false);
const position = entity.getAttribute('position');
position.x;
position.y;
position.z;
entity.setAttribute('material', 'color', 'red');
entity.components['geometry'].data;
type MyEntity = AFrame.Entity<{
camera: THREE.Camera;
material: THREE.Material;
sound: { pause(): void };
}>;
const camera = document.querySelector<MyEntity>('a-entity[camera]').components.camera;
const material = document.querySelector<MyEntity>('a-entity[material]').components.material;
document.querySelector<MyEntity>('a-entity[sound]').components.sound.pause();
entity.getDOMAttribute('geometry').primitive;
entity.setAttribute('light', {
type: 'spot',
distance: 30,
intensity: 2.0
});
entity.addEventListener('child-detached', (event) => {
event.detail;
});
// Components
const Component = AFRAME.registerComponent('test', {});
// Scene
const scene = document.querySelector('a-scene');
scene.hasLoaded;
// System
const system = scene.systems['systemName'];
+328
View File
@@ -0,0 +1,328 @@
// Type definitions for AFRAME 0.5
// Project: https://aframe.io/
// Definitions by: Paul Shannon <https://github.com/devpaul>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/**
* Extended tests available at https://github.com/devpaul/aframe-typings.git
*/
/// <reference types="three" />
/// <reference types="tween.js" />
// Globals
declare var AFRAME: AFrame.AFrameGlobal;
declare var hasNativeWebVRImplementation: boolean;
interface NodeSelector {
querySelector(selectors: 'a-scene'): AFrame.Scene;
querySelector<T extends AFrame.Entity<any>>(selectors: string): T;
querySelectorAll(selectors: string): NodeListOf<AFrame.Entity<any> | Element>;
}
interface Document {
createElement(tagName: string): AFrame.Entity;
}
// Interfaces
declare namespace AFrame {
interface ObjectMap<T = any> {
[ key: string ]: T;
}
interface AFrameGlobal {
AEntity: Entity;
ANode: ANode;
AScene: Scene;
components: { [ key: string ]: ComponentDescriptor };
geometries: { [ key: string ]: GeometryDescriptor };
primitives: { [ key: string ]: Entity };
registerComponent(name: string, component: ComponentDefinition): ComponentConstructor;
registerElement(name: string, element: ANode): void;
registerGeometry(name: string, geometery: THREE.Geometry): Geometry;
registerPrimitive(name: string, primitive: PrimitiveDefinition): void;
registerShader(name: string, shader: any): void;
registerSystem(name: string, definition: SystemDefinition): void;
schema: SchemaUtils;
shaders: { [ key: string ]: ShaderDescriptor };
systems: { [key: string]: System };
THREE: typeof THREE;
TWEEN: typeof TWEEN;
utils: Utils;
version: string;
}
interface Animation {
attribute: string;
begin: string | number;
delay: number;
direction: 'alternate' | 'alternateReverse' | 'normal' | 'reverse';
dur: number;
easing(): void;
end: string;
fill: 'backwards' | 'both' | 'forwards' | 'none';
from: any; // TODO type
repeat: number | 'indefinite';
to: number;
}
interface ANode extends HTMLElement {
// Only public APIs added. Many methods intentionally left out.
// createdCallback
// attachedCallback
// attributeChangedCallback
closestScene(): Scene;
closest(selector: string): ANode;
// detachedCallback
hasLoaded: boolean;
load(cb?: () => void, childFilter?: (el: Element) => boolean): void;
// updateMixins
registerMixin(id: string): void;
setAttribute(type: string, newValue: any): void;
unregisterMixin(id: string): void;
removeMixinListener(id: string): void;
attachMixinListener(mixin: HTMLElement): void;
emit(name: string, detail?: any, bubbles?: boolean): void;
emitter(name: string, detail?: any, bubbles?: boolean): () => void;
}
interface Behavior {
tick(): void;
}
interface Component {
attrName?: string;
data?: any;
dependencies?: string[];
el: Entity;
id: string;
multiple?: boolean;
name: string;
schema: Schema;
init(): void;
pause(): void;
play(): void;
remove(): void;
tick?(time: number, timeDelta: number): void;
update(oldData: any): void;
updateSchema?(): void;
extendSchema(update: Schema): void;
flushToDOM(): void;
}
interface ComponentConstructor {
new (el: Entity, name: string, id: string): Component;
}
interface ComponentDefinition {
dependencies?: string[];
el?: Entity;
id?: string;
multiple?: boolean;
schema?: Schema;
init?(): void;
pause?(): void;
play?(): void;
remove?(): void;
tick?(time: number, timeDelta: number): void;
update?(oldData: any): void;
updateSchema?(): void;
[ key: string ]: any;
}
interface ComponentDescriptor {
Component: Component;
dependencies: string[] | null;
multiple: boolean | null;
// internal APIs2
// parse
// parseAttrValueForCache
// schema
// stringify
// type
[ key: string ]: any;
}
interface Coordinate {
x: number;
y: number;
z: number;
}
interface Entity<C = ObjectMap<Component>> extends ANode {
components: C;
isPlaying: boolean;
object3D: THREE.Object3D;
object3DMap: ObjectMap<THREE.Object3D>;
sceneEl?: Scene;
addState(name: string): void;
flushToDOM(recursive?: boolean): void;
/**
* @deprecated since 0.4.0
*/
getComputedAttribute<T = Component>(attr: string): T;
getDOMAttribute<T = any>(attr: string): T;
getObject3D(type: string): THREE.Object3D;
getOrCreateObject3D(type: string, construct: any): THREE.Object3D;
is(stateName: string): boolean;
pause(): void;
play(): void;
setObject3D(type: string, obj: THREE.Object3D): void;
removeAttribute(attr: string, property?: string): void;
removeObject3D(type: string): void;
removeState(stateName: string): void;
// getAttribute specific usages
getAttribute(type: string): any;
getAttribute<T = Component>(attr: string): T;
getAttribute(type: 'position' | 'rotation' | 'scale'): Coordinate;
// setAttribute specific usages
setAttribute(attr: string, value: any): void;
setAttribute(attr: string, property: string, componentAttrValue?: any): void;
setAttribute(type: 'position' | 'rotation' | 'scale', value: Coordinate): void;
// addEventListener specific usages
addEventListener<K extends keyof EntityEventMap>(type: K, listener: (event: Event & EntityEventMap[K]) => void, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
type DetailEvent<D> = Event & { detail: D };
interface EntityEventMap {
'child-attached': DetailEvent<{ el: Element | Entity }>;
'child-detached': DetailEvent<{ el: Element | Entity }>;
'componentchanged': DetailEvent<{ name: string }>;
'componentremoved': DetailEvent<{
name: string,
id: string,
newData: any,
oldData: any
}>;
'loaded': EventListener;
'pause': EventListener;
'play': EventListener;
'stateadded': DetailEvent<{ state: string }>;
'stateremoved': DetailEvent<{ state: string }>;
'schemachanged': DetailEvent<{ componentName: string }>;
}
interface Geometry {
name: string;
geometry: THREE.Geometry;
schema: Schema;
update(data: object): void;
[ key: string ]: any;
}
interface GeometryDescriptor {
Geometry: Geometry;
schema: Schema;
}
interface MultiPropertySchema {
[ key: string ]: SinglePropertySchema<any>;
}
interface PrimitiveDefinition {
defaultComponents?: any; // TODO cleanup type
deprecated?: boolean;
mappings?: any; // TODO cleanup type
transforms?: any; // TODO cleanup type
}
type PropertyTypes = 'array' | 'boolean' | 'color' | 'int' | 'number' | 'selector' |
'selectorAll' | 'src' | 'string' | 'vec2' | 'vec3' | 'vec4';
type SceneEvents = 'enter-vr' | 'exit-vr' | 'loaded' | 'renderstart';
interface Scene extends Entity {
behaviors: Behavior[];
camera: THREE.Camera;
canvas: HTMLCanvasElement;
effect: THREE.VREffect;
isMobile: boolean;
object3D: THREE.Scene;
renderer: THREE.WebGLRenderer;
renderStarted: boolean;
systems: ObjectMap<System>;
time: number;
enterVR(): Promise<void> | void;
exitVR(): Promise<void> | void;
reload(): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
addEventListener(type: SceneEvents, listener: EventListener, useCapture?: boolean): void;
}
type Schema = SinglePropertySchema<any> | MultiPropertySchema;
interface SchemaUtils {
isSingleProperty(schema: Schema): boolean;
process(schema: Schema): boolean;
}
interface Shader {
name: string;
schema: Schema;
}
interface ShaderDescriptor {
Shader: Shader;
schema: Schema;
}
interface SinglePropertySchema<T> {
type?: PropertyTypes;
'default'?: T;
parse?(value: string): T;
stringify?(value: T): string;
[ key: string ]: any;
}
interface System {
data: any;
schema: Schema;
init(): void;
pause(): void;
play(): void;
tick?(): void;
}
interface SystemDefinition {
schema?: Schema;
init?(): void;
pause?(): void;
play?(): void;
tick?(): void;
[ key: string ]: any;
}
interface Utils {
coordinates: {
isCoordinate(value: string): boolean;
parse(value: string): Coordinate;
stringify(coord: Coordinate): string;
};
entity: {
getComponentProperty(entity: Entity, componentName: string, delimiter?: string): any;
setComponentProperty(entity: Entity, componentName: string, value: any, delimiter?: string): void;
};
styleParser: {
parse(value: string): object;
stringify(data: object): string;
};
deepEqual(a: any, b: any): boolean;
diff(a: object, b: object): object;
extend(target: object, ... source: object[]): object;
extendDeep(target: object, ... source: object[]): object;
}
}
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"baseUrl": "..",
"lib": [
"es5",
"dom",
"es2015.iterable",
"es2015.promise"
],
"module": "commonjs",
"noImplicitAny": true,
"noImplicitThis": true,
"removeComments": false,
"sourceMap": true,
"strictNullChecks": true,
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": [ "../" ],
"types": [ ]
},
"files": [
"index.d.ts",
"aframe-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/rschmukler/agenda
// Definitions by: Meir Gottlieb <https://github.com/meirgottlieb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
+6 -7
View File
@@ -1,21 +1,20 @@
/// <reference types="node"/>
import * as Alexa from "alexa-sdk";
exports.handler = function(event: Alexa.RequestBody, context: Alexa.Context, callback: Function) {
const handler = (event: Alexa.RequestBody<Alexa.Request>, context: Alexa.Context, callback: () => void) => {
let alexa = Alexa.handler(event, context);
alexa.resources = {};
alexa.registerHandlers(handlers);
alexa.execute();
};
let handlers: Alexa.Handlers = {
'LaunchRequest': function () {
let handlers: Alexa.Handlers<Alexa.Request> = {
'LaunchRequest': function() {
this.emit('SayHello');
},
'HelloWorldIntent': function () {
'HelloWorldIntent': function() {
this.emit('SayHello');
},
'SayHello': function () {
'SayHello': function() {
this.emit(':tell', 'Hello World!');
}
};
+53 -37
View File
@@ -1,43 +1,52 @@
// Type definitions for Alexa SDK for Node.js v1.0.3
// Type definitions for Alexa SDK for Node.js 1.0
// Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs
// Definitions by: Pete Beegle <https://github.com/petebeegle>
// Definitions by: Pete Beegle <https://github.com/petebeegle>
// Huw <https://github.com/hoo29>
// pascalwhoop <https://github.com/pascalwhoop>
// Ben <https://github.com/blforce>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject;
export function handler<T>(event: RequestBody<T>, context: Context, callback?: (err: any, response: any) => void ): AlexaObject<T>;
export function CreateStateHandler(state: string, obj: any): any;
export var StateString: string;
export let StateString: string;
interface AlexaObject {
export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED";
export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED";
export interface AlexaObject<T> extends Handler<T> {
_event: any;
_context: any;
_callback: any;
state: any;
appId: any;
response: any;
resources: any;
dynamoDBTableName: any;
saveBeforeResponse: boolean;
registerHandlers: (...handlers: Handlers[]) => any;
registerHandlers: (...handlers: Array<Handlers<T>>) => any;
execute: () => void;
}
interface Handlers {
[intent: string]: (this: Handler) => void;
export interface Handlers<T> {
[intent: string]: (this: Handler<T>) => void;
}
interface Handler {
export interface Handler<T> {
on: any;
emit(event: string, ...args: any[]): boolean;
emitWithState: any;
state: any;
handler: any;
event: RequestBody;
event: RequestBody<T>;
attributes: any;
context: any;
name: any;
isOverriden: any;
t: (token: string, ...args: any[]) => void;
}
interface Context {
export interface Context {
callbackWaitsForEmptyEventLoop: boolean;
logGroupName: string;
logStreamName: string;
@@ -48,13 +57,13 @@ interface Context {
awsRequestId: string;
}
interface RequestBody {
export interface RequestBody<T> {
version: string;
session: Session;
request: LaunchRequest | IntentRequest | SessionEndedRequest;
request: T;
}
interface Session {
export interface Session {
new: boolean;
sessionId: string;
attributes: any;
@@ -62,56 +71,65 @@ interface Session {
user: SessionUser;
}
interface SessionApplication {
export interface SessionApplication {
applicationId: string;
}
interface SessionUser {
export interface SessionUser {
userId: string;
accessToken: string;
accessToken?: string;
}
interface LaunchRequest extends IRequest { }
export interface LaunchRequest extends Request { }
interface IntentRequest extends IRequest {
intent: Intent;
export interface IntentRequest extends Request {
dialogState?: DialogStates;
intent?: Intent;
}
interface Intent {
name: string;
slots: any;
export interface SessionEndedRequest extends Request {
reason?: string;
}
interface SessionEndedRequest extends IRequest {
reason: string;
}
interface IRequest {
export interface Request {
type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest";
requestId: string;
timeStamp: string;
timestamp: string;
locale?: string;
}
interface ResponseBody {
export interface SlotValue {
confirmationStatus?: ConfirmationStatuses;
name: string;
value?: any;
}
export interface Intent {
confirmationStatus?: ConfirmationStatuses;
name: string;
slots: Record<string, SlotValue>;
}
export interface ResponseBody {
version: string;
sessionAttributes?: any;
response: Response;
}
interface Response {
export interface Response {
outputSpeech?: OutputSpeech;
card?: Card;
reprompt?: Reprompt;
shouldEndSession: boolean;
}
interface OutputSpeech {
export interface OutputSpeech {
type: "PlainText" | "SSML";
text?: string;
ssml?: string;
}
interface Card {
export interface Card {
type: "Simple" | "Standard" | "LinkAccount";
title?: string;
content?: string;
@@ -119,13 +137,11 @@ interface Card {
image?: Image;
}
interface Image {
export interface Image {
smallImageUrl: string;
largeImageUrl: string;
}
interface Reprompt {
export interface Reprompt {
outputSpeech: OutputSpeech;
}
+10
View File
@@ -0,0 +1,10 @@
{ "extends": "dtslint/dt.json",
"rules": {
"object-literal-shorthand": false,
"object-literal-key-quote": false,
"no-empty-interface": false,
"prefer-method-signature": false,
"object-literal-key-quotes": false,
"no-any": false
}
}
@@ -0,0 +1,34 @@
import * as AVS from "alexa-voice-service";
const options = {
debug: true,
clientId: "",
clientSecret: "",
deviceId: "",
refreshToken: "",
};
const avsInstance = new AVS(options);
avsInstance.on(AVS.EventTypes.RECORD_START, () => {
});
avsInstance.on(AVS.EventTypes.RECORD_STOP, () => {
});
avsInstance.player.on(AVS.Player.EventTypes.PLAY, () => {
});
avsInstance.refreshToken().then((tokens) => {
}).catch((error: Error) => {
});
avsInstance.requestMic();
avsInstance.startRecording();
avsInstance.stopRecording().then((dataView: any) => { });
const dataView = new DataView(new ArrayBuffer(1));
avsInstance.sendAudio(dataView).then(({ xhr, response }: any) => { });
+60
View File
@@ -0,0 +1,60 @@
// Type definitions for alexa-voice-service 0.0
// Project: https://github.com/miguelmota/alexa-voice-service.js
// Definitions by: Dolan Miu <https://github.com/dolanmiu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace AVS;
export = AVS;
declare namespace AVS {
enum EventTypes {
RECORD_STOP, RECORD_START, ERROR, TOKEN_INVALID, LOG, LOGIN, LOGOUT, TOKEN_SET, REFRESH_TOKEN_SET
}
interface AVSParams {
debug: boolean;
clientId: string;
clientSecret: string;
deviceId: string;
refreshToken: string;
}
interface TokenResponse {
token: string;
refreshToken: string;
}
class Player {
on(eventType: Player.EventTypes, callback?: () => void): void;
}
namespace Player {
enum EventTypes {
LOG, ERROR, PLAY, REPLAY, PAUSE, STOP, ENQUEUE, DEQUE
}
}
}
declare class AVS {
player: AVS.Player;
constructor(params: AVS.AVSParams);
on(eventType: AVS.EventTypes, callback?: () => void): void;
refreshToken(): Promise<AVS.TokenResponse>;
requestMic(): Promise<any>;
startRecording(): Promise<void>;
stopRecording(): Promise<DataView | undefined>;
sendAudio(dataView: DataView): Promise<{
xhr: any, response: {
httpVersion: string,
statusCode: string,
statusMessage: string,
method: string,
url: string,
headers: string,
body: string,
boundary: string,
multipart: string
}
}>;
}
@@ -17,6 +17,6 @@
},
"files": [
"index.d.ts",
"redux-batched-actions-tests.ts"
"alexa-voice-service-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+162
View File
@@ -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);
}
+62
View File
@@ -0,0 +1,62 @@
// Type definitions for algebra.js 0.2
// Project: http://algebra.js.org
// Definitions by: Federico Caselli <https://github.com/CaselIT>
// 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<Fraction | object>): 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;
+22
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+66 -57
View File
@@ -1,41 +1,52 @@
import algoliasearch = require('algoliasearch');
import { ClientOptions, SynonymOption, AlgoliaUserKeyOptions, SearchSynonymOptions,
import * as algoliasearch from "algoliasearch";
import { ClientOptions, SynonymOption, AlgoliaUserKeyOptions, SearchSynonymOptions, AlgoliaResponse,
AlgoliaSecuredApiOptions, AlgoliaIndexSettings, AlgoliaQueryParameters, AlgoliaIndex } from "algoliasearch";
var _clientOptions: ClientOptions = {
timeout : 12,
let _algoliaResponse: AlgoliaResponse = {
hits: [{}, {}],
page: 0,
nbHits: 12,
nbPages: 6,
hitsPerPage: 2,
processingTimeMS: 32,
query: "",
params: "",
};
let _clientOptions: ClientOptions = {
timeout: 12,
protocol: "",
httpAgent: ""
httpAgent: "",
};
var _synonymOption: SynonymOption = {
let _synonymOption: SynonymOption = {
forwardToSlaves: false,
replaceExistingSynonyms: false
replaceExistingSynonyms: false,
};
var _algoliaUserKeyOptions : AlgoliaUserKeyOptions = {
let _algoliaUserKeyOptions: AlgoliaUserKeyOptions = {
validity: 0,
maxQueriesPerIPPerHour: 0,
indexes: [""],
queryParameters: { attributesToRetrieve: ["algolia"] },
description: ""
description: "",
};
var _searchSynonymOptions : SearchSynonymOptions = {
let _searchSynonymOptions: SearchSynonymOptions = {
query: "",
page: 0,
type: "",
hitsPerPage: 0
hitsPerPage: 0,
};
var _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = {
let _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = {
filters: "",
validUntil: 0,
restrictIndices: "",
userToken: ""
userToken: "",
};
var _algoliaIndexSettings : AlgoliaIndexSettings = {
let _algoliaIndexSettings: AlgoliaIndexSettings = {
attributesToIndex: [""],
attributesforFaceting: [""],
unretrievableAttributes: [""],
@@ -43,12 +54,12 @@ var _algoliaIndexSettings : AlgoliaIndexSettings = {
ranking: [""],
customRanking: [""],
slaves: [""],
maxValuesPerFacet: '',
maxValuesPerFacet: "",
attributesToHighlight: [""],
attributesToSnippet: [""],
highlightPreTag: '',
highlightPostTag: '',
snippetEllipsisText: '',
highlightPreTag: "",
highlightPostTag: "",
snippetEllipsisText: "",
restrictHighlightAndSnippetArrays: false,
hitsPerPage: 0,
minWordSizefor1Typo: 0,
@@ -56,16 +67,16 @@ var _algoliaIndexSettings : AlgoliaIndexSettings = {
typoTolerance: false,
allowTyposOnNumericTokens: false,
ignorePlurals: false,
disableTypoToleranceOnAttributes: '',
separatorsToIndex: '',
queryType: '',
removeWordsIfNoResults: '',
disableTypoToleranceOnAttributes: "",
separatorsToIndex: "",
queryType: "",
removeWordsIfNoResults: "",
advancedSyntax: false,
optionalWords: [""],
removeStopWords: [""],
disablePrefixOnAttributes: [""],
disableExactOnAttributes: [""],
exactOnSingleWordQuery: '',
exactOnSingleWordQuery: "",
alternativesAsExact: false,
attributeForDistinct: "",
distinct: false,
@@ -73,21 +84,21 @@ var _algoliaIndexSettings : AlgoliaIndexSettings = {
allowCompressionOfIntegerArray: false,
altCorrections: [{}],
minProximity: 0,
placeholders: ''
placeholders: "",
};
var _algoliaQueryParameters : AlgoliaQueryParameters = {
query: '',
filters: '',
let _algoliaQueryParameters: AlgoliaQueryParameters = {
query: "",
filters: "",
attributesToRetrieve: [""],
restrictSearchableAttributes: [""],
facets: '',
maxValuesPerFacet: '',
attributesToHighlight: [''],
attributesToSnippet: [''],
highlightPreTag: '',
highlightPostTag: '',
snippetEllipsisText: '',
facets: "",
maxValuesPerFacet: "",
attributesToHighlight: [""],
attributesToSnippet: [""],
highlightPreTag: "",
highlightPostTag: "",
snippetEllipsisText: "",
restrictHighlightAndSnippetArrays: false,
hitsPerPage: 0,
page: 0,
@@ -98,38 +109,36 @@ var _algoliaQueryParameters : AlgoliaQueryParameters = {
typoTolerance: false,
allowTyposOnNumericTokens: false,
ignorePlurals: false,
disableTypoToleranceOnAttributes: '',
aroundLatLng: '',
aroundLatLngViaIP: '',
aroundRadius: '',
disableTypoToleranceOnAttributes: "",
aroundLatLng: "",
aroundLatLngViaIP: "",
aroundRadius: "",
aroundPrecision: 0,
minimumAroundRadius: 0,
insideBoundingBox: '',
queryType: '',
insidePolygon: '',
removeWordsIfNoResults: '',
insideBoundingBox: "",
queryType: "",
insidePolygon: "",
removeWordsIfNoResults: "",
advancedSyntax: false,
optionalWords: [''],
removeStopWords: [''],
disableExactOnAttributes: [''],
exactOnSingleWordQuery: '',
optionalWords: [""],
removeStopWords: [""],
disableExactOnAttributes: [""],
exactOnSingleWordQuery: "",
alternativesAsExact: true,
distinct: 0,
getRankingInfo: false,
numericAttributesToIndex: [''],
numericFilters: [''],
tagFilters: '',
facetFilters: '',
numericAttributesToIndex: [""],
numericFilters: [""],
tagFilters: "",
facetFilters: "",
analytics: false,
analyticsTags: [''],
analyticsTags: [""],
synonyms: true,
replaceSynonymsInHighlight: false,
minProximity: 0
minProximity: 0,
};
var index: AlgoliaIndex = algoliasearch('', '').initIndex('');
var search = index.search({query: ""});
index.search({query: ""}, function(err, res){});
let index: AlgoliaIndex = algoliasearch("", "").initIndex("");
let search = index.search({query: ""});
index.search({query: ""}, (err, res) => {});
+3 -3
View File
@@ -24,7 +24,7 @@ declare namespace algoliasearch {
* Number of pages
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
nbPage: number;
nbPages: number;
/**
* Number of hits per pages
* https://github.com/algolia/algoliasearch-client-js#response-format
@@ -407,7 +407,7 @@ declare namespace algoliasearch {
* @param cb(err, res)
* https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym
*/
saveSynonym(synonym: AlgoliaSynonym, option: SynonymOption, cb: (err: Error, res: any) => void): void;
saveSynonym(synonym: AlgoliaSynonym, options: SynonymOption, cb: (err: Error, res: any) => void): void;
/**
* Save a synonym object
* @param synonyms
@@ -659,7 +659,7 @@ declare namespace algoliasearch {
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym
*/
saveSynonym(synonym: AlgoliaSynonym, option: SynonymOption): Promise<any> ;
saveSynonym(synonym: AlgoliaSynonym, options: SynonymOption): Promise<any> ;
/**
* Save a synonym object
* @param synonyms
+1 -1
View File
@@ -119,7 +119,7 @@ interface ExtendedTestStore extends AltJS.AltStore<AltTestState> {
split():Array<string>;
}
var testStore = <ExtendedTestStore>alt.createStore<AltTestState>(TestStore);
var testStore = <ExtendedTestStore>alt.createStore<AltTestState>(new TestStore());
function testCallback(state:AltTestState) {
console.log(state);
+4 -4
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/goatslacker/alt
// Definitions by: Michael Shearer <https://github.com/Shearerbeard>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.3
///<reference types="react"/>
@@ -109,7 +109,7 @@ declare namespace AltJS {
flush():Object;
recycle( ...stores:Array<AltJS.AltStore<any>>):void;
rollback():void;
dispatch(action?:AltJS.Action<any>, data?:Object, details?:any):void;
dispatch(action?:AltJS.Action<any>|string, data?:Object, details?:any):void;
//Actions methods
addActions(actionsName:string, ActionsClass: ActionsClassConstructor):void;
@@ -141,7 +141,7 @@ declare module "alt/utils/chromeDebug" {
declare module "alt/AltContainer" {
import React = require("react");
import * as React from "react";
interface ContainerProps {
store?:AltJS.AltStore<any>;
@@ -152,7 +152,7 @@ declare module "alt/AltContainer" {
flux?:AltJS.Alt;
transform?:(store:AltJS.AltStore<any>, actions:any) => any;
shouldComponentUpdate?:(props:any) => boolean;
component?:React.Component<any, any>;
component?:React.Component<any>;
}
type AltContainer = React.ReactElement<ContainerProps>;
@@ -1,5 +1,5 @@
/// <reference types="node"/>
declare var console: { log(s: string): void };
declare var process: { env: any };
import amazon = require('amazon-product-api');
+4
View File
@@ -2271,6 +2271,10 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
hideBulletsCount: number;
/** Name of the high field (used by candlesticks and ohlc) in your dataProvider. */
highField: string;
/** Unique id of a graph. It is not required to set one, unless you want to use this graph for as your scrollbar's graph and need to indicate which graph should be used.*/
id?: string;
/** Whether to include this graph when calculating min and max value of the axis.
@default true
*/
+1
View File
@@ -2,6 +2,7 @@
// Project: http://amplifyjs.com/
// Definitions by: Jonas Eriksson <https://github.com/joeriks/>, Laurentiu Stamate <https://github.com/laurentiustamate94>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery" />
+1 -1
View File
@@ -1,5 +1,5 @@
{
"extends": "../tslint.json",
"extends": "dtslint/dt.json",
"rules": {
"ban-types": false
}
+1
View File
@@ -2,6 +2,7 @@
// Project: http://amplifyjs.com/
// Definitions by: Jonas Eriksson <https://github.com/joeriks/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery" />
+1 -1
View File
@@ -1,5 +1,5 @@
{
"extends": "../tslint.json",
"extends": "dtslint/dt.json",
"rules": {
"ban-types": false,
"unified-signatures": false
+69
View File
@@ -0,0 +1,69 @@
import * as amqp from 'amqp';
async function connect() {
const promise = new Promise<amqp.AMQPClient>((resolve, reject) => {
const client = amqp.createConnection({
url: 'amqp://admin:password@localhost:5672'
});
client.once('error', reject);
client.once('ready', resolve);
});
return promise;
}
async function start() {
try {
const client = await connect();
console.log('Connected');
const queue = client.queue('perth-now',
{
autoDelete: false,
durable: true,
}, q => {
console.log('Queue opened');
console.log('Name: %s Channel: %s', q.name, q.channel);
queue.bind('amq.fanout', '#', () => {
queue.subscribe(
{ ack: true },
(msg, _, __, ack) => {
ack.acknowledge(true);
});
});
});
const exchange = client.exchange('amq.fanout', { confirm: true });
exchange.once('open', () => {
exchange.publish(
'content',
{ message: new Date().toLocaleTimeString() },
{ deliveryMode: 2 },
(err, msg) => {
if (!err) {
return;
}
throw new Error(`Failed to publish: ${msg}`);
}
);
exchange.publish('content', { message: 'content message' }, () => {
console.log('Published');
});
});
} catch (ex) {
console.log(ex);
process.exit(1);
}
}
async function wait(ms: number) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
}
start();
+419
View File
@@ -0,0 +1,419 @@
// Type definitions for amqp 0.2
// Project: https://github.com/postwait/node-amqp
// Definitions by: Carl Winkler <https://github.com/seikho>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as net from 'net';
import * as events from 'events';
export type Callback<T> = (value: T) => void;
export interface AMQPClient extends net.Socket {
publish(routingKey: string, body: any, options: {}, callback: (err?: boolean, msg?: string) => void): void;
disconnect(): void;
queue(queueName: string, callback?: Callback<QueueCallback>): AMQPQueue;
queue(queueName: string, options: QueueOptions, callback?: Callback<QueueCallback>): AMQPQueue;
exchange(callback?: Callback<void>): AMQPExchange;
exchange(exchangeName: string, callback?: Callback<void>): AMQPExchange;
exchange(exchangeName: string, options: ExchangeOptions, callback?: Callback<void>): AMQPExchange;
}
export interface AMQPQueue extends events.EventEmitter {
subscribe(callback: SubscribeCallback): void;
subscribe(options: SubscribeOptions, callback: SubscribeCallback): void;
unsubscribe(consumerTag: string): void;
bind(exchangeName: string, routingKey: string, callback?: Callback<AMQPQueue>): void;
bind(routingKey: string, callback?: Callback<AMQPQueue>): void;
unbind(exchangeName: string, routingKey: string): void;
unbind(routingKey: string): void;
bind_headers(exchangeName: string, routingKey: string): void;
bind_headers(routingKey: string): void;
unbind_headers(exchangeName: string, routingKey: string): void;
unbind_headers(routingKey: string): void;
shift(reject: boolean): void;
shift(reject: boolean, requeue: boolean): void;
destroy(options?: DestroyOptions): void;
}
export interface AMQPExchange extends events.EventEmitter {
on(event: 'open' | 'ack' | 'error' | 'exchangeBindOk' | 'exchangeUnbindOk', callback: Callback<void>): this;
publish(routingKey: string, message: Buffer | {}, options: ExchangePublishOptions, callback?: (err?: boolean, msg?: string) => void): void;
/**
* ifUnused default: true
*
* Deletes an exchange.
*
* If the optional boolean second argument is set, the server will only delete the exchange if it has no queue bindings.
*
* If the exchange has queue bindings the server does not delete it but raises a channel exception instead
*/
destroy(ifUnused: boolean): void;
bind(sourceExchange: string, routingKey: string, callback?: Callback<void>): void;
unbind(sourceExchange: string, routingKey: string, callback?: Callback<void>): void;
bind_headers(exchange: string, routing: string, callback?: Callback<void>): void;
}
export function createConnection(options: ConnectionOptions): AMQPClient;
export interface DeliveryInfo {
contentType: string;
consumerTag: string;
deliveryTag: Uint8Array;
exchange: string;
queue: string;
redelivered: boolean;
routingKey: string;
}
export interface Ack extends DeliveryInfo {
acknowledge(all: boolean): void;
reject(requeue: boolean): void;
}
export interface ConnectionOptions {
host?: string;
url?: string;
port?: number;
login?: string;
passowrd?: string;
connectionTimeout?: number;
authMechanism?: string;
vhost?: string;
noDelay?: boolean;
ssl?: {
enabled: boolean;
keyFile?: string;
certFile?: string;
caFile?: string;
rejectUnauthorized?: boolean;
};
/** Default: 'node-amqp' */
product?: string;
/** Default: 'node-{NODE_VERSION}' */
platform?: string;
/** Default: node-amqp/package.json version */
version?: string;
defaultExchangeName?: string;
/** Default: true */
reconnect?: boolean;
/** Default: 'linear' */
reconnectBackoffStrategy?: string;
/** Default: 120000 */
reconnectExponentialLimit?: number;
/** Default: 1000 */
reconnectBackoffTime?: number;
}
export interface QueueOptions {
/**
* Default: false
*
* If set, the server will not create the queue.
*
* The client can use this to check whether a queue exists without modifying the server state
*/
passive?: boolean;
/**
* Default: false
*
* Durable queues remain active when a server restarts.
*
* Non-durable queues (transient queues) are purged if/when a server restarts.
*
* Note that durable queues do not necessarily hold persistent messages,
* although it does not make sense to send persistent messages to a transient queue
*/
durable?: boolean;
/**
* Default: false
*
* Exclusive queues may only be consumed from by the current connection.
*
* Setting the 'exclusive' flag always implies 'autoDelete'
*/
exclusive?: boolean;
/**
* Default: true
*
* If set, the queue is deleted when all consumers have finished using it.
*
* Last consumer can be cancelled either explicitly or because its channel is closed.
*
* If there was no consumer ever on the queue, it won't be deleted
*/
autoDelete?: boolean;
/**
* Default: false
*
* If set, the queue will not be declared, this will allow a queue to be deleted if you don't know its previous options
*/
noDeclare?: boolean;
/**
* a map of additional arguments to pass in when creating a queue
*/
arguments?: { [arg: string]: any };
/**
* Default: false
*
* when true the channel will close on unsubscribe
*/
closeChannelOnUnsubscribe?: boolean;
}
export interface ExchangeOptions {
/**
* Default: 'topic'
*/
type?: 'direct' | 'fanout' | 'topic';
/**
* Default: false
*
* f set, the server will not create the exchange. The client can use this to check whether an exchange exists without modifying the server state
*/
passive?: boolean;
/**
* Default: true
*
* If set when creating a new exchange, the exchange will be marked as durable.
*
* Durable exchanges remain active when a server restarts.
*
* Non-durable exchanges (transient exchanges) are purged if/when a server restarts
*/
durable?: boolean;
/**
* Default: true
*
* If set, the exchange is deleted when there are no longer queues bound to it
*/
autoDelete?: boolean;
/**
* Default: false
*
* If set, the exchange will not be declared,
* this will allow the exchange to be deleted if you dont know its previous options
*/
noDeclare?: boolean;
/**
* Default: false
*
* If set, the exchange will be in confirm mode, and you will get a 'ack'|'error' event emitted on a publish,
* or the callback on the publish will be called
*/
confirm?: boolean;
/**
* a map of additional arguments to pass in when creating an exchange
*/
arguments?: { [arg: string]: any };
}
export interface SubscribeOptions {
/**
* Default: false
*
* If set to true, only one subscriber is allowed at a time
*/
exclusive?: boolean;
/**
* Default: false
*
* Make it so that the AMQP server only delivers single messages at a time.
* When you want the next message, call queue.shift()
*
* When false, you will receive messages as fast as they are emitted
*/
ack?: boolean;
/**
* Default: 1
*
* Will only send you N messages before you 'ack'.
*
* Setting to zero will widen that window to 'unlimited'. If this is set, queue.shift() should not be used
*/
prefetchCount?: number;
/**
* Default: undefined
*
* Will inject the routingKey into the payload received
*/
routingKeyInPayload?: boolean;
/**
* Default: undefined
*
* Will inject the routingKey into the payload received
*/
deliveryKeyInPayload?: boolean;
}
export interface DestroyOptions {
/**
* Default: false
*
* Will only destroy the queue if it has no consumers
*/
ifUnused?: boolean;
/**
* Default: false
*
* Will ony be deleted if the queue has no messages
*/
ifEmpty?: boolean;
}
export type SubscribeCallback = (
message: any,
headers: { [key: string]: any },
deliveryInfo: DeliveryInfo,
ack: Ack
) => void;
export interface QueueCallback {
name: string;
consumerTagListeners: { [tag: string]: any };
consumerTagOptions: { [option: string]: any };
options: QueueOptions;
state: string;
channel: number;
}
export interface ExchangePublishOptions {
/**
* Default: false
*
* This flag tells the server how to react if the message cannot be routed to a queue.
*
* If this flag is set, the server will return an unroutable message with a Return method.
*
* If this flag is false, the server silently drops the message
*/
mandatory?: boolean;
/**
* Default: false
*
* This flag tells the server how to react if the message cannot be routed to a queue consumer immediately.
*
* If this flag is set, the server will return an undeliverable message with a Return method.
*
* If this flag is false, the server will queue the message, but with no guarantee that it will ever be consumed
*/
immediate?: boolean;
/**
* Default: 'application/octet-stream'
*/
contentType?: string;
/**
* Default: null
*/
contentEncoding?: string;
/**
* Default: {}
*
* Arbitrary application-specific message headers
*/
headers?: any;
/**
* 1: Non-persistent
* 2: Persistent
*/
deliveryMode?: 1 | 2;
priority?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
/**
* Application correlation identifier
*/
correlationId?: string;
/**
* Usually used to name a reply queue for a request message
*/
replyTo?: string;
/**
* Default: null
*
* Message expiration specification -- ISO date string?
*/
expiration?: string;
/**
* Default: null
*
* Application message identifier
*/
messageId?: string;
/**
* Default: null
*
* Message timestamp
*
* ISO date string?
*/
timestamp?: string;
/**
* Default: null
*
* Message type name
*/
type?: string;
/**
* Default: null
*
* Creating user id
*/
userId?: string;
/**
* Default: null
*
* Creating application id
*/
appId?: string;
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"amqp-tests.ts"
]
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
"unified-signatures": [
"false"
]
}
}
+18 -8
View File
@@ -16,13 +16,19 @@ amqp.connect('amqp://localhost')
.then(connection => {
return connection.createChannel()
.tap(channel => channel.checkQueue('myQueue'))
.then(channel => channel.consume('myQueue', newMsg => console.log('New Message: ' + newMsg.content.toString())))
.then(channel => {
return channel.consume('myQueue', newMsg => {
if (newMsg != null) {
// test promise api properties
if (newMsg.properties.contentType === 'application/json') {
console.log('New Message: ' + newMsg.content.toString());
}
}
});
})
.finally(() => connection.close());
});
// test promise api properties
let amqpMessage: amqp.Message;
amqpMessage.properties.contentType = 'application/json';
let amqpAssertExchangeOptions: amqp.Options.AssertExchange;
let anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
@@ -49,7 +55,14 @@ amqpcb.connect('amqp://localhost', (err, connection) => {
if (!err) {
channel.assertQueue('myQueue', {}, (err, ok) => {
if (!err) {
channel.consume('myQueue', newMsg => console.log('New Message: ' + newMsg.content.toString()));
channel.consume('myQueue', newMsg => {
if (newMsg != null) {
// test callback api properties
if (newMsg.properties.contentType === 'application/json') {
console.log('New Message: ' + newMsg.content.toString());
}
}
});
}
});
}
@@ -57,8 +70,5 @@ amqpcb.connect('amqp://localhost', (err, connection) => {
}
});
// test callback api properties
let amqpcbMessage: amqpcb.Message;
amqpcbMessage.properties.contentType = 'application/json';
let amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
let anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
+2 -2
View File
@@ -31,10 +31,10 @@ export interface Channel extends events.EventEmitter {
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void;
consume(queue: string, onMessage: (msg: Message | null) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void;
cancel(consumerTag: string, callback?: (err: any, ok: Replies.Empty) => void): void;
get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | boolean) => void): void;
get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | false) => void): void;
ack(message: Message, allUpTo?: boolean): void;
ackAll(): void;
+3 -2
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/squaremo/amqp.node
// Definitions by: Michael Nahkies <https://github.com/mnahkies>, Ab Reitsma <https://github.com/abreits>, Nicolás Fantone <https://github.com/nfantone>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
@@ -39,10 +40,10 @@ export interface Channel extends events.EventEmitter {
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): Promise<Replies.Consume>;
consume(queue: string, onMessage: (msg: Message | null) => any, options?: Options.Consume): Promise<Replies.Consume>;
cancel(consumerTag: string): Promise<Replies.Empty>;
get(queue: string, options?: Options.Get): Promise<Message | boolean>;
get(queue: string, options?: Options.Get): Promise<Message | false>;
ack(message: Message, allUpTo?: boolean): void;
ackAll(): void;
+2 -2
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -20,4 +20,4 @@
"callback_api.d.ts",
"amqplib-tests.ts"
]
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
{
"extends": "../tslint.json",
"extends": "dtslint/dt.json",
"rules": {
"no-empty-interface": false
}
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/AngularAgility/AngularAgility
// Definitions by: Roland Zwaga <https://github.com/rolandzwaga>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular" />
+1 -2
View File
@@ -2,8 +2,7 @@
// Project: http://angularjs.org
// Definitions by: Michel Salib <https://github.com/michelsalib>, Adi Dahiya <https://github.com/adidahiya>, Raphael Schweizer <https://github.com/rasch>, Cody Schaaf <https://github.com/codyschaaf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="jquery" />
// TypeScript Version: 2.1
declare var _: string;
export = _;
@@ -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 = '<pre><code>{{ state | json }}</code></pre>';
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();
});
+169
View File
@@ -0,0 +1,169 @@
// Type definitions for angular-block-ui 0.2
// Project: https://github.com/McNull/angular-block-ui
// Definitions by: Lasse Nørregaard <https://github.com/lassebn>, Stephan Classen <https://github.com/sclassen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
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;
}
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"angular-block-ui-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/mattlewis92/angular-bootstrap-calendar
// Definitions by: Egor Komarov <https://github.com/Odrin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as moment from 'moment';
import * as angular from 'angular';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/ncuillery/angular-breadcrumb
// Definitions by: Marc Talary <https://github.com/marctalary>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular-ui-router" />
@@ -1,8 +1,12 @@
import * as angular from "angular";
import {ClipboardService} from "angular-clipboard";
import { ClipboardService } from "angular-clipboard";
interface TestScope extends ng.IScope {
[index: string]: any;
}
const app = angular.module('testModule', ['angular-clipboard']);
app.controller('TestController', ($scope: ng.IScope, clipboard: ClipboardService) => {
app.controller('TestController', ($scope: TestScope, clipboard: ClipboardService) => {
$scope['testCopy'] = () => {
if (clipboard.supported) {
clipboard.copyText('hiiiiiii');
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/omichelsen/angular-clipboard
// Definitions by: Bradford Wagner <https://github.com/bradfordwagner/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/**
* Definition of the Clipboard Service
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/ivpusic/angular-cookie
// Definitions by: Borislav Zhivkov <https://github.com/borislavjivkov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular" />
+2 -1
View File
@@ -2,6 +2,7 @@
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Anthony Ciccarello <http://github.com/aciccarello>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare var _: string;
export = _;
@@ -87,4 +88,4 @@ declare module 'angular' {
remove(key: string): void;
}
}
}
}
+2 -1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/philippd/angular-deferred-bootstrap
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular" />
@@ -17,4 +18,4 @@ declare module angular {
module?: string,
resolve: any
}
}
}
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/m-e-conroy/angular-dialog-service
// Definitions by: William Comartin <https://github.com/wcomartin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular"/>
/// <reference types="angular-ui-bootstrap"/>
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/lgalfaso/angular-dynamic-locale
// Definitions by: Stephen Lautier <https://github.com/stephenlautier>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular" />
+2 -1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/mjt01/angular-feature-flags
// Definitions by: Borislav Zhivkov <https://github.com/borislavjivkov/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular" />
@@ -39,4 +40,4 @@ declare module "angular" {
set(flagsPromise: angular.IPromise<FlagData> | angular.IHttpPromise<FlagData>): void;
}
}
}
}
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/alferov/angular-file-saver
// Definitions by: Donald Nairn <https://github.com/deenairn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as angular from 'angular';
declare module 'angular' {
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/formly-js/angular-formly
// Definitions by: Scott Hatcher <https://github.com/scatcher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular" />
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/fabiobiondi/angular-fullscreen
// Definitions by: Julien Paroche <https://github.com/julienpa>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/angular-fullscreen
// TypeScript Version: 2.3
/// <reference types="angular" />
+46 -52
View File
@@ -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");
};
});
+1
View File
@@ -2,6 +2,7 @@
// Project: https://angular-gettext.rocketeer.be/
// Definitions by: Ákos Lukács <https://github.com/AkosLukacs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular" />
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/revolunet/angular-google-analytics
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, Thomas Fuchs <https://github.com/Toxantron>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular" />
import * as angular from 'angular';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/ManifestWebDesign/angular-gridster
// Definitions by: Joao Monteiro <https://github.com/jpmnteiro>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as angular from "angular";
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }

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