Skip to content

Commit

Permalink
feat: build typescript .d.ts files
Browse files Browse the repository at this point in the history
api.js changes:
- make most options to api.DICOMwebClient optional.
- add progressCallback arg to retrieveSeries
  • Loading branch information
PaulHax committed Nov 15, 2022
1 parent c686828 commit 6afd163
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 13 deletions.
22 changes: 21 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"description": "Implementation of DICOMweb client code",
"main": "build/dicomweb-client.js",
"module": "build/dicomweb-client.es.js",
"types": "build/dicomweb-client.d.ts",
"scripts": {
"test": "./test_ci.sh",
"test:watch": "./test.sh",
"start": "rollup -c",
"build": "rollup -c",
"build": "rollup -c && npx tsc",
"watch": "rollup -c -w",
"version": "node -p -e \"'export default \\'' + require('./package.json').version + '\\';'\" > src/version.js",
"lint": "eslint -c .eslintrc.js --fix src && prettier --write src/**/*.js"
Expand Down Expand Up @@ -44,7 +45,7 @@
"prettier": "^1.16.4",
"puppeteer": "^1.18.1",
"rollup": "^0.63.2",
"rollup-plugin-babel": "^4.0.3"
},
"dependencies": {}
"rollup-plugin-babel": "^4.0.3",
"typescript": "^4.8.4"
}
}
17 changes: 9 additions & 8 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class DICOMwebClient {
* @constructor
* @param {Object} options
* @param {String} options.url - URL of the DICOMweb RESTful Service endpoint
* @param {String} options.qidoURLPrefix - URL path prefix for QIDO-RS
* @param {String} options.wadoURLPrefix - URL path prefix for WADO-RS
* @param {String} options.stowURLPrefix - URL path prefix for STOW-RS
* @param {String} options.username - Username
* @param {String} options.password - Password
* @param {Object} options.headers - HTTP headers
* @param {Array.<RequestHook>} options.requestHooks - Request hooks.
* @param {Object} options.verbose - print to console request warnings and errors, default true
* @param {String=} options.qidoURLPrefix - URL path prefix for QIDO-RS
* @param {String=} options.wadoURLPrefix - URL path prefix for WADO-RS
* @param {String=} options.stowURLPrefix - URL path prefix for STOW-RS
* @param {String=} options.username - Username
* @param {String=} options.password - Password
* @param {Object=} options.headers - HTTP headers
* @param {Array.<RequestHook>=} options.requestHooks - Request hooks.
* @param {Object=} options.verbose - print to console request warnings and errors, default true
*/
constructor(options) {
this.baseURL = options.url;
Expand Down Expand Up @@ -1626,6 +1626,7 @@ class DICOMwebClient {
* @param {Object} options
* @param {String} options.studyInstanceUID - Study Instance UID
* @param {String} options.seriesInstanceUID - Series Instance UID
* @param {Function} options.progressCallback
* @returns {ArrayBuffer[]} DICOM Instances
*/
retrieveSeries(options) {
Expand Down
10 changes: 10 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"include": ["src/**/*"],
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "build",
"declarationMap": true
}
}

0 comments on commit 6afd163

Please sign in to comment.