diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3fa1deaed3..bff753c62a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -10,7 +10,7 @@ /types/abstract-leveldown/ @MeirionHughes @danwbyrne /types/acc-wizard/ @cyrilschumacher /types/accept/ @feinoujc -/types/accept-language-parser/ @kampfgnom +/types/accept-language-parser/ @kampfgnom @chatoo2412 /types/accepts/ @bomret @brikou /types/accounting/ @gerich-home @chrisleck /types/ace/ @Diullei @@ -19,7 +19,9 @@ /types/acorn/ @RReverser @e-cloud /types/actioncable/ @zhu1230 @szechyjs /types/actions-on-google/ @joelhegg +/types/active-win/ @BendingBender /types/activedirectory2/ @pasthelod +/types/activestorage/ @cbothner /types/activex-access/ @zspitz /types/activex-adodb/ @zspitz /types/activex-adox/ @zspitz @@ -46,13 +48,16 @@ /types/activex-word/ @zspitz /types/adal-angular/ @unindented @aciccarello /types/add-zero/ @Roaders +/types/adlib/ @Esri @MikeTschudi /types/adm-zip/ @jvilk @abner /types/adone/ @s0m3on3 @maxveres +/types/aes-js/ @federicobond /types/aframe/ @devpaul @bertoritger @twastvedt /types/agenda/ @meirgottlieb @princjef /types/agent-base/ @Shinigami92 /types/aggregate-error/ @BendingBender /types/agora-rtc-sdk/ @menthays +/types/airbnb-prop-types/ @milesj /types/ajv-errors/ @afshawnlotfi /types/ale-url-parser/ @msn0 /types/alertify/ @jjeffery @@ -62,9 +67,12 @@ /types/algoliasearch/ @cbaptiste @haroenv @aherve @samouss @keichinger /types/ali-app/ @taoqf /types/ali-oss/ @ptrdu +/types/all-keys/ @BendingBender +/types/all-property-names/ @BendingBender /types/allure-js-commons/ @zaqqaz /types/almost-equal/ @cmaddalozzo /types/alt/ @Shearerbeard +/types/amap-js-sdk/ @agasbzj /types/amazon-cognito-auth-js/ @scottescue /types/amazon-product-api/ @MattiLehtinen @alien35 /types/amcharts/ @ldrick @@ -155,10 +163,11 @@ /types/animejs/ @A-Babin /types/annyang/ @hisham @theluk /types/ansi/ @Gustavo6046 -/types/ansi-colors/ @rogierschouten +/types/ansi-colors/v1/ @rogierschouten +/types/ansi-colors/ @rogierschouten @BendingBender /types/ansi-escape-sequences/ @aomarks /types/ansi-escapes/ @jacobbubu -/types/ansi-regex/ @mvachhar +/types/ansi-regex/ @mvachhar @ffflorian /types/ansi-styles/ @brynbellomy @plylrnsdy /types/ansicolors/ @balupton /types/antlr4/ @mcchatman8009 @@ -198,9 +207,11 @@ /types/argparse/ @arcticwaters @tlaziuk @eps1lon /types/args/ @Slessi /types/argv/ @hookclaw +/types/arr-diff/ @BendingBender /types/arr-union/ @mrmlnc /types/array-find-index/ @samverschueren /types/array-foreach/ @skysteve +/types/array-move/ @BendingBender /types/array-sort/ @DanielMSchmidt /types/array-uniq/ @DanielRosenwasser /types/array-unique/ @CSLTech @@ -220,7 +231,8 @@ /types/assertsharp/ @brunolm /types/assets-webpack-plugin/ @kryops /types/astring/ @nkappler -/types/async/ @borisyankov @kern0 @Penryn @fenying @pascalmartin +/types/async/ @borisyankov @kern0 @Penryn @fenying @pascalmartin @Dmitri1337 +/types/async-busboy/ @hirochachacha /types/async-cache/ @BendingBender /types/async-lock/ @elisee @afharo @rhymmor /types/async-polling/ @Goldsmith42 @@ -243,7 +255,7 @@ /types/atpl/ @soywiz /types/audiosprite/ @Perlmint /types/auth-header/ @ForbesLindesay -/types/auth0/ @westy92 +/types/auth0/ @westy92 @ianhowe76 @dauledk /types/auth0-angular/ @homesar /types/auth0-js/v7/ @advancedrei /types/auth0-js/ @adrianchia @mdurrant @peterblazejewicz @@ -252,7 +264,7 @@ /types/auto-bind/ @sseppola /types/auto-launch/ @rhysd @unindented /types/auto-sni/ @janwo -/types/autobahn/ @darkl @valepu +/types/autobahn/ @darkl @a904guy @valepu @glenroy37 /types/autolinker/ @leonyu /types/autoprefixer/ @odnamrataizem @murt /types/autosize/ @kingdango @keika299 @NeekSandhu @@ -260,7 +272,7 @@ /types/await-timeout/ @szhu /types/awesomplete/ @webbiesdk @bmdixon @tbekolay @chrislopresto /types/aws-iot-device-sdk/ @niik @mlamp -/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart @palmithor @daniloraisi @simonbuchan @Haydabase @repl-chris @aneilbaboo @jeznag @louislarry @dpapukchiev @ohookins @trevor-leach @jagregory +/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart @palmithor @daniloraisi @simonbuchan @Haydabase @repl-chris @aneilbaboo @jeznag @louislarry @dpapukchiev @ohookins @trevor-leach @jagregory @dalen /types/aws-serverless-express/ @threesquared @jcaffey @mattmeye @albertovasquez /types/aws4/ @ajcrites /types/axe-webdriverjs/ @JoshuaKGoldberg @@ -303,15 +315,19 @@ /types/backo2/ @Retsam /types/backoff/ @BendingBender /types/baconjs/ @alexander-matsievsky @gekkio +/types/badgen/ @m5d215 /types/bagpipes/ @micmro /types/baidu-app/ @taoqf +/types/bandagedbd__bdapi/ @Acidic9 /types/barbellweights/ @evelijn /types/barcode/ @pvomhoff /types/bardjs/ @TepigMC /types/base-64/ @dolanmiu -/types/base-x/ @chrootsu +/types/base-x/v1/ @chrootsu +/types/base-x/ @chrootsu @BendingBender /types/base16/ @alechill /types/base64-arraybuffer/ @jbencook +/types/base64-async/ @BendingBender /types/base64-js/ @pe8ter /types/base64-url/ @urish /types/base64topdf/ @lucasriondel @@ -320,12 +336,14 @@ /types/basic-auth/ @moonpyk @vesse /types/basicauth-middleware/ @nchaulet /types/batch-stream/ @drudge +/types/battery-level/ @BendingBender /types/bazinga-translator/ @alexndlm /types/bcrypt/ @codeanimal @IOAyman @dstapleton92 /types/bcryptjs/ @RafaelKr @branoholy /types/bdfjs/ @jeremejevs /types/beats/ @urish /types/bech32/ @micksatana +/types/beeper/ @BendingBender /types/behavior3/ @carrrywu /types/bell/ @SimonSchick /types/bem-cn/ @selkinvitaly @@ -333,7 +351,7 @@ /types/better-curry/ @pocesar /types/better-queue/ @maozedong /types/better-scroll/ @stoneChen @cnjack -/types/better-sqlite3/ @Morfent @matrumz @sant123 +/types/better-sqlite3/ @Morfent @matrumz @sant123 @loghorn /types/bezier-easing/ @ptlis /types/bezier-js/ @danmarshall @Epskampie /types/bgiframe/ @sumegizoltan @@ -344,7 +362,9 @@ /types/bignum/ @Patman64 /types/bigscreen/ @dduugg /types/bin-pack/ @orentrutner +/types/bin-version/ @BendingBender /types/binary-parser/ @riggs @dolanmiu @yuhr +/types/binaryextensions/ @BendingBender /types/bind-ponyfill/ @skysteve /types/bindings/ @unindented /types/bintrees/ @CjS77 @@ -378,9 +398,10 @@ /types/bluebird-global/ @d-ph /types/bluebird-retry/ @pvomhoff /types/blueimp-md5/ @rmartone @mkohlmyr -/types/bn.js/ @LogvinovLeon @HenryNguyen5 +/types/bn.js/ @LogvinovLeon @HenryNguyen5 @Gilthoniel /types/body-parser/ @santialbo @vilic @dreampulse @blendsdk @tlaziuk @jwalton /types/body-parser-xml/ @tbounsiar +/types/body-scroll-lock/ @kimcoder /types/bonjour/ @quentin-ol @octo-sniffle /types/bookshelf/ @arcticwaters @vesse /types/boom/v3/ @rogatty @@ -411,6 +432,7 @@ /types/bootstrap3-dialog/ @nakupanda @cnboland /types/bounce.js/ @cherrry /types/box2d/ @jbaldwin +/types/boxen/ @BendingBender /types/bpmn-moddle/ @haydos89 /types/brace-expansion/ @BendingBender /types/braces/ @vemoo @@ -430,11 +452,14 @@ /types/browser-sync/ @joeskeen @aznnomness /types/browserify/ @AndrewGaspar @jvilk @leonard-thieu @LinusU /types/browserslist/ @davecardwell -/types/bs58/ @chrootsu +/types/browserslist-useragent/ @nju33 +/types/bs58/v3/ @chrootsu +/types/bs58/ @chrootsu @BendingBender /types/bson/ @horiuchi @CaselIT /types/btoa/ @johngeorgewright /types/bucks/ @zaneli /types/buffer-compare/ @chrootsu +/types/buffer-crc32/ @BendingBender /types/buffer-equal/ @Bartvds /types/buffer-from/ @burnnat /types/buffer-reader/ @nrlquaker @@ -463,6 +488,7 @@ /types/c3/ @mcliment @gerinjacob @denyo @dmitryshindin @timn /types/cache-manager/ @GausSim /types/cached-path-relative/ @TeamworkGuy2 +/types/cadesplugin/ @Delagen @kmvi /types/cal-heatmap/ @RetroChrisB /types/caller/ @ignocide /types/callsite/ @newclear @@ -497,6 +523,7 @@ /types/cfn-response/ @ivoisbelongtous /types/chai/v2/ @Bartvds @AGBrown /types/chai/ @jedmao @Bartvds @AGBrown @olivr70 @mwistrand @joshuakgoldberg @shaunluttin @Naktibalda @micksatana @ErikSchierboom +/types/chai-almost/ @kclnn /types/chai-arrays/ @clementprevot /types/chai-as-promised/ @jt000 @Kuniwak @leonard-thieu @lazerwalker @mattbishop /types/chai-datetime/ @cliffburger @mattbishop @@ -516,6 +543,7 @@ /types/chai-uuid/ @harm-less /types/chai-webdriverio/ @sherlock1982 /types/chai-xml/ @jedigo +/types/chalk-animation/ @BendingBender /types/chance/ @cbowdon @brikou @cafesanu /types/change-emitter/ @iskandersierra /types/chardet/ @Gebatzens @@ -539,7 +567,7 @@ /types/chownr/ @BendingBender /types/chroma-js/v0/ @invliD /types/chroma-js/ @invliD @mpacholec -/types/chrome/ @matthewkimber @otiai10 @couven92 @rreverser @sreimer15 +/types/chrome/ @matthewkimber @otiai10 @couven92 @rreverser @sreimer15 @MatCarlson /types/chrome-apps/ @niikoo @AdamLay @pine613 @mzsm @RReverser @pyle @matthewkimber @otiai10 @couven92 @rreverser @sreimer15 /types/chromecast-caf-receiver/ @craigrbruce /types/chromecast-caf-sender/ @samuelmaddock @@ -548,12 +576,16 @@ /types/circular-json/ @jpevarnek /types/ckeditor/v2/ @wittwert /types/ckeditor/ @wittwert @stuartlong @viktorpegy +/types/ckeditor__ckeditor5-core/ @denisname +/types/ckeditor__ckeditor5-engine/ @denisname /types/ckeditor__ckeditor5-utils/ @denisname /types/clamp-js/ @Hikariii /types/clamp-js-main/ @sinziananicolae /types/classnames/ @adidahiya @JKillian @seansfkelley @mradamczyk @marvinhagemeister /types/cldrjs/ @RamanBut-Husaim @gcastre -/types/clean-css/ @tkrotoff +/types/clean-css/v3/ @tkrotoff +/types/clean-css/ @tkrotoff @GolaWaya +/types/clean-regexp/ @BendingBender /types/clean-stack/ @BendingBender /types/clean-webpack-plugin/ @j-f1 /types/clear-require/ @dan-j @@ -563,10 +595,13 @@ /types/cleave.js/ @clentfort @jasongi-at-sportsbet @sashashakun /types/cli/ @kayahr /types/cli-box/ @athasach +/types/cli-boxes/ @BendingBender /types/cli-color/ @ChaosinaCan +/types/cli-cursor/ @BendingBender /types/cli-interact/ @ffflorian /types/cli-progress/ @mhegazy /types/cli-spinner/ @janslow +/types/cli-spinners/ @BendingBender /types/cli-table/ @arylo /types/cli-table2/ @mgroenhoff /types/cli-truncate/ @danwbyrne @@ -584,6 +619,7 @@ /types/closure-compiler/ @mprobst /types/cloud-env/ @Morfent /types/cloudflare-apps/ @MartynasZilinskas +/types/clovelced-plugin-audiomanagement/ @marckassay /types/cls-hooked/ @aleung /types/clusterize.js/ @Pr1st0n /types/cmd-shim/ @cspotcode @@ -594,6 +630,7 @@ /types/codependency/ @morphatic /types/coffeeify/ @tkQubo /types/coinbase/ @rogierschouten +/types/coinlist/ @BendingBender /types/coinstring/ @mhegazy /types/collections/ @scarabedore /types/color/v0/ @LKay @@ -605,6 +642,7 @@ /types/color-namer/ @in19farkt /types/color-string/ @BendingBender @danmarshall /types/colorbrewer/ @mtraynham +/types/colornames/ @manuth /types/colresizable/ @gilleswaeber /types/com.darktalker.cordova.screenshot/ @akarienta /types/com.wikitude.phonegap.wikitudeplugin/ @zbarbuto @@ -633,12 +671,13 @@ /types/compose-function/ @denis-sokolov /types/compressible/ @BendingBender /types/compression/ @santialbo @rburgt -/types/compression-webpack-plugin/ @dublicator +/types/compression-webpack-plugin/ @dublicator @rhys-vdw /types/compute-quantile/ @mrmlnc /types/compute-stdev/ @mrmlnc /types/concat-stream/ @jmarianer /types/concaveman/ @DenisCarriere /types/conf/v0/ @SamVerschueren +/types/conf/v1/ @SamVerschueren @BendingBender /types/conf/ @SamVerschueren @BendingBender /types/confidence/ @jppellerin /types/config/ @RWander @forrestbice @jndonald3 @albertovasquez @@ -666,6 +705,7 @@ /types/console-ui/ @dfreeman /types/consolidate/ @soywiz @theosherry @nicolashenry /types/consul/ @chrootsu +/types/contains-path/ @BendingBender /types/content-disposition/ @bomret /types/content-type/ @horiuchi @BendingBender /types/contentful-resolve-response/ @antonkarsten @@ -682,14 +722,16 @@ /types/cookie_js/ @slawiko /types/cookiejar/ @paroxp /types/cookies/ @WangZishi @jkeylu @BendingBender +/types/copy/ @ffflorian /types/copy-paste/ @SrTobi /types/copy-text-to-clipboard/ @BendingBender /types/copy-webpack-plugin/ @flying-sheep +/types/copyfiles/ @ffflorian /types/cordova-ionic/ @hendrikmaus /types/cordova-plugin-app-version/ @Ritzlgrmft /types/cordova-plugin-background-mode/ @Lordnoname /types/cordova-plugin-badge/ @timbru31 -/types/cordova-plugin-ble-central/ @gjunge +/types/cordova-plugin-ble-central/ @gjunge @peitschie /types/cordova-plugin-bluetoothclassic-serial/ @tuvokki /types/cordova-plugin-canvascamera/ @lordazzi /types/cordova-plugin-device-name/ @larrybahr @@ -719,6 +761,7 @@ /types/countdown/ @gjuchault /types/counterpart/ @santiagodoldan /types/countries-and-timezones/ @zero51 +/types/country-data/ @biltongza /types/country-list/v1/ @iRoachie /types/country-list/ @iRoachie @Kimahriman /types/country-select-js/ @humrochagf @@ -733,6 +776,7 @@ /types/create-error/ @tkrotoff /types/create-hash/ @BendingBender /types/create-hmac/ @BendingBender +/types/create-html-element/ @BendingBender /types/create-react-class/ @jgoz /types/create-subscription/ @Asana @vsiao /types/createjs/ @evilangelist @gyohk @@ -749,6 +793,7 @@ /types/crpc/ @0xdeafcafe /types/crumb/ @lenovouser @SimonSchick /types/cryptiles/ @awendland +/types/crypto-hash/ @BendingBender /types/crypto-js/ @misak113 /types/crypto-random-string/ @MrManny /types/cryptojs/ @giabao @@ -777,11 +822,15 @@ /types/currency-formatter/ @mhegazy @davidmpaz /types/custom-error-generator/ @thmiceli /types/custom-functions-runtime/ @OfficeDev @Zlatkovsky @mscharlock +/types/cwd/ @BendingBender /types/cwise/ @taoqf /types/cwise-compiler/ @taoqf /types/cwise-parser/ @taoqf /types/cybozulabs-md5/ @pine613 +/types/cycled/ @BendingBender +/types/cypress-axe/ @wKovacs64 /types/cytoscape/ @phreed @wy193777 @ypconstante @janniclas @cerberuser +/types/d/ @BendingBender /types/d3/v3/ @gustavderdrache @borisyankov @MatthiasJobst /types/d3/v4/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3/ @tomwanzek @gustavderdrache @borisyankov @denisname @@ -799,7 +848,7 @@ /types/d3-drag/ @tomwanzek @gustavderdrache @borisyankov /types/d3-dsv/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-ease/ @tomwanzek @gustavderdrache @borisyankov -/types/d3-fetch/ @ledragon +/types/d3-fetch/ @ledragon @denisname /types/d3-force/ @tomwanzek @gustavderdrache @borisyankov /types/d3-format/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-geo/ @ledragon @tomwanzek @gustavderdrache @borisyankov @@ -816,18 +865,18 @@ /types/d3-request/ @Ledragon @gustavderdrache @borisyankov @tomwanzek @denisname /types/d3-sankey/ @tomwanzek @gustavderdrache /types/d3-scale/v1/ @tomwanzek @gustavderdrache @borisyankov -/types/d3-scale/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-scale/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-scale-chromatic/ @Ledragon @gustavderdrache @borisyankov @henriquefm /types/d3-selection/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-selection-multi/ @gustavderdrache @borisyankov -/types/d3-shape/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-shape/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-time/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-time-format/ @tomwanzek @gustavderdrache @borisyankov /types/d3-timer/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-tip/ @brspnnggrt /types/d3-transition/ @tomwanzek @gustavderdrache @borisyankov /types/d3-voronoi/ @tomwanzek @gustavderdrache @borisyankov @denisname -/types/d3-zoom/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-zoom/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3.slider/ @lk-chen /types/d3kit/ @morphatic /types/d3pie/ @mc-petry @@ -851,7 +900,8 @@ /types/datatables.net-select/ @szechyjs /types/date-arithmetic/ @HeeL /types/date.format.js/ @balrob -/types/dateformat/ @aicest +/types/dateformat/v1/ @aicest +/types/dateformat/ @aicest @BendingBender /types/datejs/ @rupertavery /types/daterangepicker/ @SirMartin @smasala @nertzy /types/dav/ @ToastHawaii @@ -864,10 +914,13 @@ /types/deasync/ @Sicilica /types/debessmann/ @vkorehov /types/debounce/ @denis-sokolov @joshuakgoldberg @wcarson +/types/debounce-fn/ @BendingBender /types/debounce-promise/ @whtsky /types/debug/ @swook @galtalmor @zamb3zi @brasten /types/decamelize/ @samverschueren /types/decay/ @enaeseth +/types/decode-entities/ @waspothegreat +/types/decode-uri-component/ @BendingBender /types/decompress/ @plantain-00 @jbethke /types/decompress-response/ @DanielRosenwasser /types/decorum/ @dflor003 @@ -879,6 +932,7 @@ /types/deep-freeze/ @Bartvds @aluanhaddad /types/deep-freeze-es6/ @mattbishop /types/deep-freeze-strict/ @mhegazy +/types/default-gateway/ @BendingBender /types/defaults/ @IbtihelCHNAB /types/defer-promise/ @niklasf /types/define-lazy-prop/ @BendingBender @@ -931,15 +985,18 @@ /types/diffie-hellman/ @BendingBender /types/digibyte/ @lautarodragan @werewolfe /types/dinero.js/ @BendingBender +/types/dir-glob/ @BendingBender /types/dir-resolve/ @andy-ms +/types/dirname-regex/ @BendingBender /types/discontinuous-range/ @OiCMudkips /types/discord-rpc/ @jasonhaxstuff /types/discourse-sso/ @championswimmer /types/dispatchr/ @Ragg- /types/disposable-email-domains/ @geoffreak +/types/distributions/ @marcolanaro /types/dnssd/ @angelmerino @Maxr1998 /types/doccookies/ @jonegerton -/types/dockerode/ @seikho @nlaplante @isac322 @lazarusx @meisenzahl @thegecko @CameronDiver +/types/dockerode/ @seikho @nlaplante @isac322 @lazarusx @meisenzahl @thegecko @CameronDiver @p4sca1 /types/docopt/ @giggio /types/doctrine/ @rictic /types/document-promises/ @NotWoods @@ -947,8 +1004,10 @@ /types/documentdb/ @NoelAbrahams @brettferdosi @ctstone @yifanwu /types/documentdb-server/ @lith-light-g /types/documentdb-session/ @DanielRosenwasser +/types/doge-seed/ @BendingBender /types/dojo/ @vansimke /types/dom-clipboard-api/ @43081j +/types/dom-helpers/ @mctep /types/dom-inputevent/ @diagramatics /types/dom-loaded/ @ltetzlaff /types/dom-mediacapture-record/ @eliasmeire @@ -967,17 +1026,18 @@ /types/dotdotdot/ @milanjaros /types/dotenv/v2/ @jussikinnula @borekb @enaeseth /types/dotenv/ @jussikinnula @borekb @enaeseth @maxbeatty +/types/dotenv-flow/ @vincentlanglet /types/dotenv-safe/ @krenor -/types/dotenv-webpack/ @karol-majewski +/types/dotenv-webpack/ @karol-majewski @davecardwell /types/dotfile-regex/ @mrmlnc /types/dottie/ @domarmstrong /types/double-ended-queue/ @dsagal /types/doublearray/ @mzsm /types/doubleclick-gpt/ @johngeorgewright @steven-joyce /types/download/ @nicojs -/types/downloadjs/ @cwmoo740 +/types/downloadjs/ @cwmoo740 @josuedevmark /types/dplayer/ @Guanyunhan -/types/draft-js/ @dmitryrogozhny @eelco @ghotiphud @schwers @michael-yx-wu @willisplummer @smvilar @sulf @pablopunk +/types/draft-js/ @dmitryrogozhny @eelco @ghotiphud @schwers @michael-yx-wu @willisplummer @smvilar @sulf @pablopunk @claudiopro /types/drag-timetable/ @chinkan /types/draggabilly/ @jaydubu /types/dragster/ @zskovacs @@ -996,11 +1056,11 @@ /types/dustjs-linkedin/ @mdezem /types/dvtng-jss/ @Ptival /types/dw-bxslider-4/ @namerci -/types/dwt/v12/ @yushulx /types/dwt/ @yushulx @jbh @lincoln2018 @Tom-Dynamsoft /types/dygraphs/ @danvk /types/dymo-label-framework/ @thijskuipers /types/dynatable/ @francoismassart +/types/dynatrace/ @alvaro450 /types/dynogels/ @SpartanLabs @ramondeklein @stephentuso /types/each/ @misak113 /types/earcut/ @NaridaL @@ -1018,6 +1078,7 @@ /types/ecurve/ @mhegazy /types/ed25519/ @erikma /types/ed2curve/ @ffflorian +/types/ee-first/ @BendingBender /types/egg-mock/ @sheperdwind /types/egg.js/ @ToastHawaii /types/egjs__axes/ @naver @@ -1036,7 +1097,7 @@ /types/electron-load-devtool/ @prince0203 /types/electron-notifications/ @djpereira /types/electron-notify/ @djpereira -/types/electron-packager/ @SomaticIT @cortopy @jkleinsc @shiftkey +/types/electron-packager/ @SomaticIT @cortopy @jkleinsc @shiftkey @malept /types/electron-settings/v2/ @leonard-thieu /types/electron-settings/ @icopp @nrlquaker /types/electron-spellchecker/ @unindented @@ -1050,7 +1111,7 @@ /types/element-resize-detector/ @saranshkataria @franklixuefei /types/element-resize-event/ @rogierschouten @plgregoire /types/elementtree/ @dwieeb -/types/elliptic/ @danwbyrne +/types/elliptic/ @danwbyrne @Gilthoniel /types/elm/ @thSoft /types/email-templates/ @cyrilschumacher @gurisko @blankstar85 /types/ember/v1/ @jedmao @@ -1064,7 +1125,7 @@ /types/ember-modal-dialog/v2/ @tansongyang @mike-north /types/ember-modal-dialog/ @tansongyang @mike-north /types/ember-qunit/v2/ @dwickern @mike-north -/types/ember-qunit/ @dwickern @mike-north +/types/ember-qunit/ @dwickern @mike-north @scalvert @dfreeman /types/ember-resolver/v4/ @dfreeman @mike-north /types/ember-resolver/ @dfreeman @mike-north /types/ember-test-helpers/v0/ @dwickern @mike-north @@ -1092,7 +1153,9 @@ /types/emojione/ @dbrgn /types/empower/ @vvakame /types/empty-dir/ @BendingBender +/types/empty-trash/ @BendingBender /types/emscripten/ @zakki @periklis +/types/encodeurl/ @BendingBender /types/encoding-down/ @MeirionHughes @danwbyrne /types/end-of-stream/ @strax /types/engine.io/ @KentarouTakeda @@ -1100,8 +1163,12 @@ /types/enhanced-resolve/ @e-cloud @onigoetz @johnnyreilly /types/enigma.js/ @konne /types/enquire.js/ @screendriver +/types/ensure-error/ @BendingBender +/types/ensure-posix-path/ @BendingBender /types/ent/ @rogierschouten /types/entities/ @aliceklipper +/types/env-ci/ @BendingBender +/types/env-editor/ @BendingBender /types/env-paths/ @danwbyrne /types/env-to-object/ @MugeSo /types/envify/ @tkQubo @@ -1124,6 +1191,7 @@ /types/es6-promisify/ @harryshipton @bschlenk /types/es6-shim/ @rbuckton /types/es6-weak-map/ @pine +/types/escape-goat/ @BendingBender /types/escape-html/ @elisee /types/escape-latex/ @olsio /types/escape-regexp/ @jewbre @@ -1145,10 +1213,10 @@ /types/eth-lightwallet/ @LogvinovLeon /types/ethereum-protocol/ @LogvinovLeon /types/ethereumjs-abi/ @LogvinovLeon -/types/ethereumjs-tx/ @LogvinovLeon +/types/ethereumjs-tx/ @LogvinovLeon @dmihal /types/ethereumjs-util/ @cortopy /types/ethjs-signer/ @doppio -/types/eureka-js-client/ @Schnillz +/types/eureka-js-client/ @Schnillz @karl-run @tombarton /types/evaporate/ @kookster @chrisrhoden @ailrun /types/event-emitter/ @LKay /types/event-emitter-es6/ @ahstro @@ -1157,14 +1225,16 @@ /types/event-loop-lag/ @rogierschouten /types/event-stream/ @flcdrg /types/event-to-promise/ @flying-sheep -/types/events/ @yasupeke -/types/eventsource/ @scottleedavis @afroozeh +/types/events/ @yasupeke @weareoutman +/types/eventsource/ @scottleedavis @afroozeh @snakedrak /types/evernote/ @corps /types/ex-react-native-i18n/ @maplerichie /types/excel-style-dataformatter/ @SanderDeWaal1992 /types/exceljs/ @rogierschouten @alitaheri /types/execa/ @douglasduteil @BendingBender @borekb @mickdekkers +/types/execall/ @BendingBender /types/exenv/ @christianchown +/types/exif/ @ffflorian /types/exit/ @Bartvds /types/exit-hook/ @BendingBender /types/exorcist/ @TeamworkGuy2 @@ -1181,7 +1251,7 @@ /types/expo/v26/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @tinaroh /types/expo/v27/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo /types/expo/v30/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo -/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel +/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian /types/expo-localization/ @burtek /types/expo__status-bar-height/ @dawnmist /types/expo__vector-icons/ @incleaf @@ -1205,6 +1275,7 @@ /types/express-formidable/ @tdolsen @evanshortiss /types/express-graphql/ @isman-usoh @nitintutlani @hubel @zya @mlamp @firede /types/express-handlebars/ @stpettersens @yhaskell +/types/express-http-proxy/ @ulrichb @Danscho /types/express-jsonschema/ @atd-schubert /types/express-jwt/ @wokim @kacepe @Sl1MBoy @milan-mimra /types/express-less/ @xieyubo @@ -1219,7 +1290,8 @@ /types/express-paginate/ @AmirTugi /types/express-partials/ @jt000 /types/express-promise-router/ @wanganjun -/types/express-rate-limit/ @cyrilschumacher @makepost +/types/express-rate-limit/v2/ @cyrilschumacher @makepost +/types/express-rate-limit/ @cyrilschumacher @makepost @jdforsythe /types/express-redis-cache/ @ajliv /types/express-route-fs/ @kripod /types/express-routemap/ @icopp @@ -1228,6 +1300,7 @@ /types/express-serve-static-core/ @borisyankov @19majkel94 @kacepe @micksatana @samijaber /types/express-session/ @horiuchi @jacobbogers @builtinnya @ry7n /types/express-sitemap-xml/ @ffflorian +/types/express-slow-down/ @jdforsythe /types/express-socket.io-session/ @AylaJK /types/express-to-koa/ @xiaohanzhang /types/express-unless/ @wokim @@ -1264,17 +1337,20 @@ /types/fancy-log/ @pine /types/fancybox/ @borisyankov /types/farbtastic/ @EnableSoftware +/types/fast-json-stable-stringify/ @BendingBender /types/fast-levenshtein/ @mizunashi-mana /types/fast-list/ @BendingBender /types/fast-stats/ @rogierschouten +/types/fast64/ @rarmatei /types/fastclick/ @shinnn /types/fastify-accepts/ @leomelzer /types/fastify-cors/ @jannikkeye +/types/fastify-favicon/ @tuelsch /types/fastify-jwt/ @jannikkeye /types/fastify-multipart/ @jannikkeye /types/fastify-static/ @leomelzer /types/favico.js/ @drowse314-dev-ymat -/types/favicons/ @mohsen1 +/types/favicons/ @mohsen1 @metsawyr /types/fb/ @JoshStrobl /types/fb-watchman/ @whtsky /types/fbemitter/ @kmxz @@ -1299,7 +1375,8 @@ /types/feedme/ @codeanimal /types/feedparser/ @cortopy /types/fetch-jsonp/ @tkrotoff -/types/fetch-mock/ @asvetliakov @tamird @merrywhether @chrissinclair @matttennison @quentinbouygues @mtsmfm +/types/fetch-mock/v6/ @asvetliakov @tamird @merrywhether @chrissinclair @matttennison @quentinbouygues @mtsmfm +/types/fetch-mock/ @asvetliakov @tamird @merrywhether @chrissinclair @matttennison @quentinbouygues @mtsmfm @captain-igloo @ChenNima /types/fetch.io/ @newraina /types/ffi/ @loyd @waitingsong /types/ffi-napi/ @keerthi16 @KiranNiranjan @@ -1315,12 +1392,16 @@ /types/file-type/ @tcaesvk @BendingBender /types/file-url/ @coderslagoon /types/filenamify/ @rokt33r -/types/filesize/ @GiedriusGrabauskas @renchap +/types/filenamify-url/ @cprecioso +/types/filesize/ @GiedriusGrabauskas @renchap @Ky6uk /types/fill-pdf/ @westy92 +/types/filter-console/ @BendingBender /types/filter-invalid-dom-props/ @icopp /types/finalhandler/ @chrootsu /types/finch/ @DavidSichau /types/find/ @andypyrope +/types/find-cache-dir/ @BendingBender +/types/find-java-home/ @sjx233 /types/find-package-json/ @BendingBender /types/find-parent-dir/ @ikatyang /types/find-process/ @buaban @@ -1328,10 +1409,12 @@ /types/find-root/ @Alorel /types/find-up/ @BendingBender /types/find-versions/ @LogvinovLeon @carnesen -/types/findup-sync/ @Bartvds @ngbrown +/types/findup-sync/v0/ @Bartvds @ngbrown +/types/findup-sync/ @Bartvds @ngbrown @BendingBender /types/fined/ @BendingBender /types/fingerprintjs/ @zaneli -/types/fingerprintjs2/ @curtstate +/types/fingerprintjs2/v1/ @curtstate +/types/fingerprintjs2/ @curtstate @BendingBender /types/firebase-client/ @fpsscarecrow /types/firebase-token-generator/ @dotdotcommadot /types/firebird/ @karak @@ -1339,8 +1422,10 @@ /types/firefox-webext-browser/ @jsmnbom /types/firmata/ @troywweber7 /types/first-mate/ @GlenCFL +/types/first-run/ @BendingBender /types/fixed-data-table/ @pepaar @stephenjelfs /types/fixed-data-table-2/ @ilivit +/types/fkill/ @BendingBender /types/flagged-respawn/ @BendingBender /types/flat/ @chrootsu /types/fleximap/ @DanielRose @@ -1353,8 +1438,12 @@ /types/flot/ @burlandm @Anticom @admiralsmaster /types/flowdoc/ @animify /types/flowjs/ @ryan10132 +/types/fluent/ @huy-nguyen /types/fluent-ffmpeg/ @tcaesvk @DingWeizhe @mabidina +/types/fluent-langneg/ @huy-nguyen +/types/fluent-react/ @huy-nguyen /types/flush-write-stream/ @djcsdy +/types/flushable/ @pash90 /types/flux/ @stkb @GiedriusGrabauskas /types/fluxible/ @xbim /types/fluxible-addons-react/ @xbim @@ -1368,6 +1457,7 @@ /types/forever-agent/ @yavanosta /types/forever-monitor/ @shuntksh @wrboyce /types/forge-di/ @adamcarr +/types/forge-viewer/ @Autodesk-Forge /types/form-data/ @soywiz @leonyu @BendingBender /types/form-serialize/ @tyler-johnson /types/form-serializer/ @flqw @@ -1558,7 +1648,7 @@ /types/gapi.client.youtubereporting/ @Bolisov /types/gapi.drive/ @baxtersa /types/gapi.pagespeedonline/ @sgtfrankieboy -/types/gapi.people/ @tkrotoff +/types/gapi.people/ @tkrotoff @joshuaobrien /types/gapi.plus/ @tkrotoff /types/gapi.translate/ @sgtfrankieboy /types/gapi.urlshortener/ @sgtfrankieboy @@ -1566,6 +1656,7 @@ /types/gapi.youtubeanalytics/ @sgtfrankieboy /types/gaussian/ @scttcper /types/gc-stats/ @vfernandestoptal +/types/gdal/ @andreidigori /types/geetest/ @plantain-00 /types/gen-readlines/ @CodeAnimal /types/generate-changelog/ @ffflorian @@ -1574,37 +1665,54 @@ /types/generic-pool/ @jerray @wrboyce /types/gently/ @bonnici /types/geodesy/ @DenisCarriere @HandyG52 @excelulous -/types/geojson/ @cobster @atd-schubert @JeffJacobson @icholy +/types/geojson/ @cobster @atd-schubert @JeffJacobson @icholy @danvk /types/geojson2osm/ @DenisCarriere /types/geokdbush/ @DenisCarriere +/types/geolite2/ @ffflorian /types/geometry-dom/ @nakakura /types/geopattern/ @Gaelan /types/gestalt/ @serranoarevalo /types/get-caller-file/ @ajafff +/types/get-certain/ @BendingBender +/types/get-emails/ @BendingBender +/types/get-emoji/ @BendingBender /types/get-folder-size/ @mszczepanczyk +/types/get-func-name/ @BendingBender /types/get-node-dimensions/ @vincekovacs +/types/get-port/ @plantain-00 @BendingBender +/types/get-range/ @BendingBender /types/get-stdin/ @DanielRosenwasser /types/get-stream/ @douglasduteil @BendingBender +/types/get-urls/ @BendingBender /types/get-value/ @DanielRosenwasser /types/getenv/ @impankratov /types/getopts/ @azasypkin /types/getos/ @BendingBender /types/gettext.js/ @jucrouzet +/types/gfc/ @BendingBender /types/gh-pages/ @DanielRosenwasser /types/ghauth/ @Leko /types/gifffer/ @gatimus /types/gijgo/ @atatanasov /types/giraffe/ @darthapo /types/git/ @vvakame +/types/git-add-remote/ @BendingBender /types/git-branch/ @rynclark /types/git-config/ @stpettersens +/types/git-config-path/ @BendingBender /types/git-remote-origin-url/ @janslow +/types/git-repo-name/ @BendingBender /types/git-rev-sync/ @khoi-fish /types/git-root-dir/ @ffflorian /types/git-url-parse/ @ajafff +/types/git-user-email/ @BendingBender +/types/git-user-name/ @BendingBender +/types/git-username/ @BendingBender /types/gitconfiglocal/ @ffflorian /types/github-url-to-object/ @ajafff +/types/github-username/ @BendingBender /types/github-username-regex/ @BehindTheMath +/types/gl/ @sjx233 /types/gl-matrix/ @mattijskneppers @tatchx @nbabanov @auzmartist @surtr-isaz /types/gl-react/ @jussikinnula /types/gl-react-dom/ @jussikinnula @@ -1622,6 +1730,10 @@ /types/glob-parent/ @mrmlnc /types/glob-stream/ @Bartvds @mrmlnc /types/glob-to-regexp/ @whatasoda +/types/global-dirs/ @BendingBender +/types/global-modules/ @BendingBender +/types/global-paths/ @BendingBender +/types/global-prefix/ @BendingBender /types/global-tunnel-ng/ @BendingBender /types/globalize/ @gcastre @afromogli @bryanforbes /types/globalize-compiler/ @iclanton @@ -1635,6 +1747,7 @@ /types/google-apps-script/ @motemen @grant /types/google-apps-script-oauth2/ @dhayab /types/google-cloud__datastore/ @beaulac @ogawa0071 @ThomasdenH +/types/google-cloud__kms/ @ben-tbotlabs /types/google-cloud__pubsub/ @pheromonez @LunaPg @msiviero /types/google-earth/ @icholy /types/google-images/ @dolanmiu @@ -1649,6 +1762,7 @@ /types/google.fonts/ @danmarshall /types/google.geolocation/ @vbortone /types/google.picker/ @grapswiz +/types/google.script.client-side/ @clomie /types/google.visualization/ @danludwig @gmoore-sjcorg @danmana @mlcheng @IvanBisultanov @glebm @shrujalshah28 /types/google__maps/ @indrimuska /types/googlemaps/ @cgwrench @nertzy @xaolas @mrmcnerd @martincostello @svenkreiss @bolatovumar @gauthierm @@ -1663,10 +1777,11 @@ /types/gramps__rest-helpers/ @claude /types/graphite-udp/ @EricByers /types/graphlib-dot/ @DomParfitt -/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio @divyenduz @bradzacher @clayne11 @JCMais +/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio @divyenduz @bradzacher @clayne11 @JCMais @langpavel /types/graphql-date/ @enaeseth /types/graphql-deduplicator/ @lfades /types/graphql-depth-limit/ @eritikass +/types/graphql-errors/ @MatiasOlivera /types/graphql-fields/ @feinoujc /types/graphql-iso-date/ @jwaldrip /types/graphql-list-fields/ @filipows @@ -1689,6 +1804,7 @@ /types/grunt/ @jeffmay @basarat /types/gsap/ @codebelt @ProbablePrime @philipbulley @leomeloxp /types/gtin/ @RafaelKr +/types/guardian__prosemirror-invisibles/ @dddotsev /types/guid/ @maroy1986 /types/gulp/ @GiedriusGrabauskas /types/gulp-angular-templatecache/ @amanmahajan7 @@ -1770,7 +1886,7 @@ /types/gzip-js/ @rhysd /types/gzip-size/v3/ @plantain-00 /types/gzip-size/ @plantain-00 @jimivdw @andrewiggins -/types/h2o2/ @jasonswearingen @AJamesPhillips +/types/h2o2/ @jasonswearingen @AJamesPhillips @garthk /types/halfred/ @dherges /types/halogen/ @steller /types/hammerjs/ @milkisevil @codler @@ -1780,17 +1896,22 @@ /types/hapi/v12/ @jasonswearingen /types/hapi/v15/ @jasonswearingen /types/hapi/v16/ @jasonswearingen @AJamesPhillips -/types/hapi/ @rafaelsouzaf @jhsimms @SimonSchick +/types/hapi/v17/ @rafaelsouzaf @jhsimms @SimonSchick @saboya +/types/hapi/ @rafaelsouzaf @jhsimms @SimonSchick @saboya /types/hapi-auth-basic/ @AJamesPhillips @saboya +/types/hapi-auth-bearer-token/ @saboya /types/hapi-auth-cookie/ @lenovouser @SimonSchick @Mutmatt /types/hapi-auth-jwt2/v7/ @warrenseymour /types/hapi-auth-jwt2/ @warrenseymour @SimonSchick /types/hapi-decorators/ @kenhowardpdx +/types/hapi-pino/ @saboya /types/har-format/ @micmro /types/hard-rejection/ @BendingBender /types/hard-source-webpack-plugin/ @woitechen /types/harmony-proxy/ @remojansen /types/has-ansi/ @BendingBender +/types/has-emoji/ @BendingBender +/types/has-yarn/ @BendgingBender /types/hash-file/ @HiromiShikata /types/hash-stream/ @BendingBender /types/hash-sum/ @DanielRosenwasser @@ -1798,6 +1919,7 @@ /types/hasher/ @flyfishMT /types/hashids/ @pocesar /types/hashmap/ @outring +/types/hashtag-regex/ @diogofcunha /types/hat/ @tup1tsa /types/haversine/ @screendriver /types/hbs/ @davidm77 @@ -1814,12 +1936,12 @@ /types/heredatalens/ @denyo /types/heremaps/ @Josh-ES @denyo @fx88 /types/heroku-logger/ @kylevogt +/types/hex-rgb/ @BendingBender /types/hex-rgba/ @r3nya /types/hexo-bunyan/ @segayuu /types/hexo-fs/ @segayuu /types/hexo-log/ @segayuu /types/hexo-util/ @segayuu -/types/hibp/ @lenovouser /types/highcharts/ @damianog @baltie @AlbertOzimek @hanssens /types/highcharts-ng/ @scatcher /types/highland/ @Bartvds @hgwood @iwllyu @alvis @notbobthebuilder @@ -1831,7 +1953,7 @@ /types/history.js/ @borisyankov @gjunge /types/historykana/ @h-shiratsuki /types/hjson/ @crunchie84 -/types/hls.js/ @jgainfort +/types/hls.js/ @jgainfort @brookback @adripanico /types/hoek/ @prashaantt /types/hoist-non-react-statics/ @JounQin /types/holderjs/ @renjfk @@ -1846,6 +1968,7 @@ /types/html-minifier/ @tkrotoff @rikuayanokozy /types/html-pdf/ @westy92 /types/html-tag-names/ @sandersn +/types/html-tags/ @BendingBender /types/html-to-text/ @erykwarren /types/html-void-elements/ @rhysd /types/html-webpack-plugin/ @deevus @bumbleblym @tlaziuk @@ -1854,7 +1977,7 @@ /types/htmlbars-inline-precompile/ @chriskrycho /types/htmlparser2/ @staticfunction @LinusU /types/htmltojsx/ @basarat -/types/http-assert/ @jkeylu +/types/http-assert/ @jkeylu @stripedpajamas /types/http-aws-es/ @marcogrcr /types/http-codes/ @mhegazy /types/http-context/ @mtraynham @@ -1874,6 +1997,7 @@ /types/humane/ @jmvrbanac /types/humanize-plus/ @DenisCarriere /types/humanize-string/ @ragnarok56 +/types/humanize-url/ @BendingBender /types/humanparser/ @MichalPodeszwa /types/humps/ @nikeee /types/hyco-ws/ @mrcabellom @@ -1901,6 +2025,7 @@ /types/ibm_db/ @agov /types/icepick/ @ngbrown @tobico /types/icheck/ @qcz +/types/icon-gen/ @ffflorian /types/iconv/ @delphinus35 /types/idyll/ @iocat /types/idyll-ast/ @iocat @@ -1926,13 +2051,14 @@ /types/imap/ @psnider /types/imap-simple/ @pushplay @iaarnio /types/imgur-rest-api/ @lukewestby +/types/immediate/ @BendingBender /types/imperium/ @gaetansenn /types/impress/ @borisyankov /types/in-app-purchase/ @l-jonas @IchordeDionysos /types/in-range/ @DanielRosenwasser /types/inboxsdk/ @rdoursenaud @amiram /types/incremental-dom/ @basarat @lanthaler @vvakame -/types/indent-string/ @mhegazy +/types/indent-string/ @mhegazy @BendingBender /types/inert/v4/ @nycdotnet @AJamesPhillips /types/inert/ @nycdotnet @AJamesPhillips @lenovouser /types/inflected/ @dsci @@ -1941,10 +2067,12 @@ /types/ini/ @marcinporebski @carnesen /types/iniparser/ @chrootsu /types/init-package-json/ @kfarnung +/types/ink/ @cprecioso /types/inline-css/ @philipisapain /types/inline-style-prefixer/ @ahz @dpetrezselyova @franklixuefei /types/inquirer/ @tkQubo @ppathan @jouderianjr @bang88 @bitjson @synarque @jrockwood @kwkelly @Ailrun /types/inquirer-npm-name/ @manuth +/types/insert-css/ @hvoecking /types/insert-module-globals/ @leonard-thieu /types/insight/ @vvakame /types/instabug-reactnative/ @pengcao1 @@ -1952,6 +2080,7 @@ /types/intercom-client/ @jineshshah36 @peping /types/intercom-web/ @fongandrew @salbahra @onatm /types/intercomjs/ @spencerwi +/types/internal-ip/v2/ @BendingBender /types/internal-ip/ @BendingBender /types/interpret/ @BendingBender /types/intl/ @RagibHasin @@ -1968,31 +2097,45 @@ /types/iobroker/ @AlCalzone /types/ion-rangeslider/v1/ @dduugg @Karel-van-de-Plassche /types/ion-rangeslider/ @Karel-van-de-Plassche -/types/ioredis/v3/ @plantain-00 @chrisleck @aliarham11 @br8h @shaharmor @palindrom615 @reconbot -/types/ioredis/ @plantain-00 @chrisleck @aliarham11 @br8h @shaharmor @palindrom615 @reconbot @funthing @iamolegga @tingwai-to +/types/iopipe__iopipe/ @javonharper +/types/ioredis/v3/ @plantain-00 @chrisleck @aliarham11 @br8h @shaharmor @palindrom615 @reconbot @pettyalex +/types/ioredis/ @plantain-00 @chrisleck @aliarham11 @br8h @shaharmor @palindrom615 @reconbot @funthing @iamolegga @tingwai-to @pettyalex /types/iota.lib.js/ @fogsh -/types/ip/ @codeanimal +/types/ip/ @codeanimal @BendingBender /types/ip-address/ @icopp @danwbyrne -/types/ip-regex/ @unindented +/types/ip-regex/v2/ @unindented +/types/ip-regex/ @renarsvilnis /types/ipcheck/ @bengry +/types/ipify/ @BendingBender /types/irc/ @phillips1012 /types/iri/ @BendingBender /types/iron/ @simonschick @rafaelsouzaf /types/is/ @cabralRodrigo @gricey432 +/types/is-absolute/ @BendingBender /types/is-absolute-url/ @mhegazy /types/is-alphanumerical/ @vutran /types/is-archive/ @mhegazy /types/is-array/ @pine +/types/is-array-sorted/ @BendingBender /types/is-binary-path/ @DanielRosenwasser +/types/is-buffer/ @rokt33r /types/is-callable/ @nieltg +/types/is-charging/ @BendingBender /types/is-ci/ @atd-schubert /types/is-color/ @VitorLuizC /types/is-compressed/ @mhegazy /types/is-docker/ @YashdalfTheGray +/types/is-dotdir/ @BendingBender +/types/is-dotfile/ @BendingBender +/types/is-elevated/ @BendingBender /types/is-empty/ @termosa /types/is-finite/ @mhegazy +/types/is-fullwidth-code-point/ @BendingBender +/types/is-function/ @evangeloszotos +/types/is-git-url/ @BendingBender /types/is-glob/ @mrmlnc /types/is-hotkey/ @petester42 @kalley +/types/is-installed-globally/ @BendingBender /types/is-ip/ @coderslagoon /types/is-mobile/ @LogvinovLeon /types/is-my-json-valid/ @kruncher @@ -2000,10 +2143,16 @@ /types/is-number/ @harryshipton /types/is-obj/ @forivall /types/is-object/ @wbhob +/types/is-online/ @BendingBender /types/is-path-cwd/ @DanielRosenwasser /types/is-path-in-cwd/ @mhegazy +/types/is-plain-obj/ @BendingBender +/types/is-png/ @jameswilddev +/types/is-progressive/ @BendingBender /types/is-promise/ @DanielRosenwasser +/types/is-reachable/ @BendingBender /types/is-regexp/ @forivall +/types/is-relative/ @BendingBender /types/is-relative-url/ @mhegazy /types/is-root/ @mhegazy /types/is-root-path/ @mhegazy @@ -2013,18 +2162,26 @@ /types/is-svg/ @BendingBender /types/is-text-path/ @mhegazy /types/is-touch-device/ @screendriver +/types/is-trademarked/ @BendingBender +/types/is-typedarray/ @BendingBender +/types/is-unc-path/ @BendingBender /types/is-url/ @RyotaMurohoshi /types/is-url-superb/ @kryops /types/is-uuid/ @tedre191 +/types/is-valid-glob/ @BendingBender +/types/is-valid-path/ @Goldsmith42 /types/is-windows/ @mizunashi-mana /types/isaac/ @mo /types/isbn-utils/ @elhaard /types/iscroll/ @csrakowski @devlato +/types/isexe/ @BendingBender /types/ismobilejs/ @Ty3uK /types/iso-3166-2/ @sicilica /types/iso8601-localizer/ @avielfedida /types/isomorphic-fetch/ @toddlucas /types/isotope-layout/ @avidenic @malinushj +/types/issue-parser/ @Leko +/types/issue-regex/ @BendingBender /types/istanbul/ @tkrotoff /types/istanbul-lib-coverage/ @jason0x43 /types/istanbul-lib-hook/ @jason0x43 @@ -2033,6 +2190,7 @@ /types/istanbul-lib-source-maps/ @jason0x43 /types/istanbul-middleware/ @hookclaw /types/istanbul-reports/ @jason0x43 +/types/istextorbinary/ @BendingBender /types/ityped/ @DanielRosenwasser /types/ix.js/ @Igorbek /types/jackrabbit/ @elvisvoer @@ -2040,8 +2198,8 @@ /types/jalaali-js/ @alitaheri /types/japanese-holidays/ @syamatoo /types/jasmine/v1/ @borisyankov -/types/jasmine/v2/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software @Engineer2B @cyungmann -/types/jasmine/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software @Engineer2B @cyungmann @Roaders +/types/jasmine/v2/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software @Engineer2B @cyungmann @devoto13 @fdim +/types/jasmine/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software @Engineer2B @cyungmann @Roaders @devoto13 @fdim @pe8ter /types/jasmine-ajax/ @lgrignon /types/jasmine-data-provider/ @tlaziuk /types/jasmine-data_driven_tests/ @AnthonyMacKinnon @@ -2091,7 +2249,7 @@ /types/jjv/ @Nemo157 /types/jjve/ @Nemo157 /types/jmespath/ @pushplay -/types/johnny-five/ @nakakura @ujvzolee @workshop2 @xtrimsystems +/types/johnny-five/ @nakakura @ujvzolee @workshop2 @xtrimsystems @marcinobiedz /types/joi/v6/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW /types/joi/v10/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @aconanlai /types/joi/v13/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun @rafaelkallis @aconanlai @zaphoyd @thewillg @SimonSchick @@ -2099,6 +2257,7 @@ /types/joigoose/ @boothwhack /types/josa/ @vichyssoise /types/jotform-css.js/ @pandawood +/types/jpeg-autorotate/ @Slessi /types/jpeg-js/ @DanielRosenwasser /types/jpegtran-bin/ @hikoma /types/jpm/ @github-account-because-they-want-it @@ -2231,6 +2390,7 @@ /types/js-data-angular/ @reppners /types/js-fixtures/ @kazimanzurrashid /types/js-git/ @Bartvds +/types/js-levenshtein/ @Kallu609 @naftis /types/js-md5/ @mwmccarthy /types/js-money/ @kanatkubash /types/js-nacl/ @ethanfrey @@ -2240,6 +2400,7 @@ /types/js-sha512/ @nicojs /types/js-string-escape/ @viralpickaxe /types/js-to-java/ @skyitachi +/types/js-types/ @BendingBender /types/js-url/ @pine /types/js-yaml/ @Bartvds @sclausen /types/js.spec/ @mattbishop @@ -2252,7 +2413,7 @@ /types/jsend/ @CaselIT /types/jsesc/ @Bartvds /types/jsfl/ @soywiz -/types/jsforce/ @dolanmiu @netes @amphro @tnoonan-salesforce @whiteabelincoln @borys-kupar +/types/jsforce/ @dolanmiu @netes @amphro @tnoonan-salesforce @whiteabelincoln @borys-kupar @catalandres /types/jsftp/ @xyleen /types/jsgraph/ @rosinbum /types/jshamcrest/ @dharkness @@ -2277,11 +2438,14 @@ /types/json3/ @NN--- /types/json5/ @Esemesek /types/json_ml/ @pluma +/types/jsonabc/ @ffflorian +/types/jsonapi-serializer/ @chiangf /types/jsonata/ @nick121212 /types/jsoneditor/ @alejo90 @errietta /types/jsoneditor-for-react/ @joshuakgoldberg /types/jsoneditoronline/ @vbortone -/types/jsonfile/ @dbowring +/types/jsonfile/v4/ @dbowring +/types/jsonfile/ @dbowring @BendingBender /types/jsonic/ @jacobbubu /types/jsonminify/ @no23reason /types/jsonnet/ @hookclaw @@ -2306,7 +2470,7 @@ /types/jsreport-xlsx/ @taoqf /types/jsrp/ @harryshipton /types/jss/ @appsforartists @kof @pelotom @eps1lon -/types/jssha/ @randombk @SrTobi +/types/jssha/ @randombk @SrTobi @cakoose /types/jstimezonedetect/ @olamothe /types/jstorage/ @dflor003 /types/jstree/ @adaskothebeast @@ -2320,11 +2484,12 @@ /types/jui/ @easylogic /types/jui-core/ @easylogic /types/jui-grid/ @easylogic +/types/junk/ @BendingBender /types/just-debounce-it/ @azizhk /types/just-extend/ @pe8ter /types/just-pick/ @pe8ter /types/jweixin/ @taoqf @gomydodo -/types/jwplayer/ @martinduparc @kutomer @philippguertler @danielmcgraw @bpdsw +/types/jwplayer/ @martinduparc @kutomer @philippguertler @danielmcgraw @bpdsw @bebebebebe @djcsdy /types/jws/ @JustinBeckwith /types/jwt-client/ @timoteoponce /types/jwt-decode/v1/ @QuatroDevOfficial @@ -2343,7 +2508,7 @@ /types/karma-jasmine/ @michelsalib /types/karma-viewport/ @karak /types/karma-webpack/ @mtraynham -/types/katex/ @mrand01 +/types/katex/ @mrand01 @knguyen0125 /types/kcors/ @Xstoudi @izayoiko /types/kdbush/ @DenisCarriere @chrfrasco /types/kdbxweb/ @Roang-zero1 @@ -2359,7 +2524,12 @@ /types/keypress.js/ @rcchen /types/keysym/ @harryshipton /types/keytar/ @miniak @shiftkey @juturu -/types/keyv/ @Arylo +/types/keyv/ @Arylo @BendingBender +/types/keyv__mongo/ @BendingBender +/types/keyv__mysql/ @BendingBender +/types/keyv__postgres/ @BendingBender +/types/keyv__redis/ @BendingBender +/types/keyv__sqlite/ @BendingBender /types/kik-browser/ @joelday /types/klaw/v1/ @mceachen /types/klaw/ @mceachen @@ -2384,6 +2554,7 @@ /types/knockout.validation/ @danludwig /types/knockout.viewmodel/ @oising /types/knockstrap/ @adaskothebeast +/types/known/ @BendingBender /types/knuddels-userapps-api/ @Knuddels /types/ko.plus/ @conficient /types/koa/ @DavidCai1993 @jkeylu @brikou @@ -2457,6 +2628,8 @@ /types/lambda-tester/ @ivank @HajoAhoMantila /types/lasso/ @darkwebdev /types/later/ @jasond-s +/types/latest-semver/ @BendingBender +/types/latest-version/ @BendingBender /types/latinize/ @GiedriusGrabauskas /types/latlon-geohash/ @rimig /types/launchpad/ @rictic @@ -2495,6 +2668,7 @@ /types/leaflet.pm/ @tkleinke /types/leaflet.polylinemeasure/ @RiON69 /types/leakage/ @atd-schubert +/types/leap-year/ @BendingBender /types/leapmotionts/ @logotype /types/ledgerhq__hw-transport/ @danwbyrne /types/ledgerhq__hw-transport-node-hid/ @danwbyrne @@ -2523,17 +2697,24 @@ /types/lil-uuid/ @Pr1st0n /types/lime-js/ @arthur-xavier /types/line-by-line/ @etomsen +/types/line-column-path/ @BendingBender /types/line-reader/ @stpettersens /types/linear-gradient/ @Jack-Works /types/lingui__core/ @huan086 /types/lingui__macro/ @huan086 /types/lingui__react/ @huan086 +/types/linkify-issues/ @BendingBender /types/linkify-it/ @praxxis -/types/linkifyjs/ @szhu +/types/linkify-urls/ @BendingBender +/types/linkifyjs/ @szhu @ovidiubute +/types/list-git-remotes/ @BendingBender /types/list-stream/ @IanStorm /types/listr/ @durad /types/lls/ @borislavjivkov +/types/load-google-maps-api/ @oBusk /types/load-json-file/ @SamVerschueren +/types/loadable__component/ @martynaskadisa +/types/loadable__server/ @martynaskadisa /types/loader-runner/ @e-cloud /types/loader-utils/ @Perlmint @TotooriaHyperion /types/loadjs/ @screendriver @@ -2544,6 +2725,7 @@ /types/localized-countries/ @coderslagoon /types/localizejs-library/ @salbahra /types/locate-path/ @me +/types/lock-system/ @BendingBender /types/lockfile/v0/ @Bartvds /types/lockfile/ @Bartvds @BendingBender /types/lockr/ @droritos @@ -2851,6 +3033,7 @@ /types/looks-same/ @xcatliu /types/loopback/ @kattsushi @enko @sequoia @drmikecrowe @karimsa /types/loopback-boot/ @kattsushi +/types/loopbench/ @BendingBender /types/lorem-ipsum/ @durad /types/lory.js/ @kubosho @milkisevil /types/loud-rejection/ @BendingBender @@ -2863,12 +3046,13 @@ /types/ltx/ @PJakcson @BendingBender /types/luaparse/ @stpettersens /types/lunr/v0/ @sebastian-lenz -/types/lunr/ @seantanly +/types/lunr/ @seantanly @hokiegeek /types/lusca/ @crutchcorn -/types/luxon/ @colbydehart @FourwingsY @jsiebern @mastermatt +/types/luxon/ @colbydehart @FourwingsY @jsiebern @mastermatt @pietrovismara /types/lwip/ @AyaMorisawa /types/lz-string/ @M0ns1gn0r /types/lzma-native/ @leshow +/types/macrotask/ @BendingBender /types/magic-number/ @stpettersens /types/magicsuggest/ @leonardochaia /types/magnet-uri/ @tlaziuk @@ -2888,6 +3072,7 @@ /types/mali-compose/ @danwbyrne /types/mali-onerror/ @danwbyrne /types/mandrill-api/ @pocesar +/types/mangopay2-nodejs-sdk/ @ifiokjr /types/map-obj/ @BendingBender /types/mapbox/ @anahkiasen @Fluccioni /types/mapbox-gl/ @dobrud @patrickr @@ -2899,7 +3084,7 @@ /types/mapnik/ @ipv4sec /types/mapsjs/ @davismj /types/mariasql/ @bennett000 -/types/mark.js/ @renjfk @RomanGotsiy +/types/mark.js/ @renjfk @RomanGotsiy @LucianBuzzo /types/markdown-it/ @rapropos /types/markdown-it-anchor/ @seryl /types/markdown-it-container/ @hronex @@ -2907,6 +3092,7 @@ /types/markdown-pdf/ @MonsieurMan /types/markdownlint/ @ark120202 /types/marked/ @worr @BendingBender @CrossR @mwickett +/types/marked-terminal/ @bkendall /types/marker-animate-unobtrusive/ @viskin /types/markerclustererplus/ @enanox @mxl /types/markitup/ @drillbits @@ -2917,8 +3103,9 @@ /types/massive/v4/ @swissspidy @clarenceh @AmazingTurtle /types/massive/ @swissspidy @clarenceh @AmazingTurtle @mike-engel /types/match-media-mock/ @asvetliakov -/types/match-sorter/ @claasahl -/types/material-components-web/ @BrentDouglas @ckosti +/types/match-sorter/ @claasahl @chrisru +/types/matcher/ @BendingBender +/types/material-components-web/ @BrentDouglas @ckosti @agroupp /types/material-design-lite/ @bradzacher /types/material-ui/ @ngbrown @theigor @alitaheri @herrmanno @DaIgeb @allienna @schlesingermatthias @InsidersByte @artyomsv @dan-j @minodisk @samwalshnz @reggino /types/material-ui-datatables/ @coding2012 @@ -2928,13 +3115,15 @@ /types/material__checkbox/ @BrentDouglas @ckosti /types/material__chips/ @BrentDouglas @ckosti /types/material__dialog/ @BrentDouglas @ckosti -/types/material__drawer/ @BrentDouglas @ckosti +/types/material__dom/ @agroupp +/types/material__drawer/ @BrentDouglas @ckosti @agroupp /types/material__floating-label/ @BrentDouglas @ckosti /types/material__form-field/ @BrentDouglas @ckosti /types/material__grid-list/ @BrentDouglas @ckosti /types/material__icon-toggle/ @BrentDouglas @ckosti /types/material__line-ripple/ @BrentDouglas @ckosti /types/material__linear-progress/ @BrentDouglas @ckosti +/types/material__list/ @agroupp /types/material__menu/ @BrentDouglas @ckosti /types/material__notched-outline/ @BrentDouglas @ckosti /types/material__radio/ @BrentDouglas @ckosti @@ -2970,14 +3159,18 @@ /types/memcached/ @KentarouTakeda /types/memdown/ @MeirionHughes @danwbyrne /types/memjs/ @leizongmin +/types/memoize-one/v3/ @karol-majewski @franklixuefei /types/memoize-one/ @karol-majewski @franklixuefei /types/memoizee/ @juanpicado /types/memory-cache/ @jedigo @thieman /types/memory-fs/ @e-cloud +/types/memory-pager/ @BendingBender +/types/memorystream/ @bangbang93 /types/memwatch-next/ @cyrilschumacher /types/meow/ @KnisterPeter @praxxis @bitjson /types/merge-descriptors/ @danny8002 /types/merge-env/ @BendingBender +/types/merge-images/ @BendingBender /types/merge-stream/ @k-kagurazaka @tomxtobin @daniel-zazula @djcsdy /types/merge2/ @tkrotoff @smac89 /types/merkle/ @kerol2r20 @@ -2986,7 +3179,7 @@ /types/meshblu/ @fnipo /types/mess/ @Nemo157 /types/messenger/ @derekcicerone -/types/meteor/ @barbatus @fullflavedave @orefalo @dagatsoin @birkskyum @ardatan @stefanholzapfel @andrei-markeev @lmachens +/types/meteor/ @barbatus @fullflavedave @orefalo @dagatsoin @birkskyum @ardatan @stefanholzapfel @andrei-markeev @lmachens @gunn /types/meteor-accounts-phone/ @DAB0mB /types/meteor-astronomy/ @Deadly0 /types/meteor-collection-hooks/ @twastvedt @@ -3002,9 +3195,11 @@ /types/mfiles/ @avonwyss /types/micro/ @kaoDev /types/micro-cors/ @CallumDenby +/types/micro-events/ @AlexanderSychev /types/micromatch/v2/ @glen-84 /types/micromatch/ @glen-84 @vemoo /types/microrouter/ @mathieudutour +/types/microservice-utilities/ @runebaas /types/microsoft-ajax/ @pjmagee /types/microsoft-live-connect/ @jvilk /types/microsoft-sdk-soap/ @markusmauch @@ -3016,6 +3211,7 @@ /types/mime-db/ @AJamesPhillips /types/mime-types/ @Perlmint /types/mimos/ @AJamesPhillips +/types/min-indent/ @BendingBender /types/mina/ @lhk @mattanja @kant2002 /types/mini-css-extract-plugin/ @JounQin /types/minimal-bit-array/ @jeremejevs @@ -3029,6 +3225,7 @@ /types/mithril-global/ @spacejack @isiahmeadows /types/mitm/ @alejo90 /types/mixpanel/ @hjellek @Manduro +/types/mixpanel-browser/ @karlos1337 /types/mixto/ @vvakame /types/mjml/ @aahoughton @marpstar /types/mjml-react/ @henrinormak @@ -3036,6 +3233,7 @@ /types/mkdirp-promise/ @pluma /types/mkpath/ @optical /types/ml-levenberg-marquardt/ @m93a +/types/mnemonic-words/ @BendingBender /types/mobx-apollo/ @pselden /types/mobx-devtools-mst/ @pluma /types/mocha/ @kazimanzurrashid @otiai10 @jt000 @enlight @cspotcode @1999 @@ -3053,6 +3251,7 @@ /types/mockingoose/ @hirochachacha /types/modernizr/ @borisyankov @theodorejb @leonyu @lucax88x @nhardy /types/modesl/ @neeschit +/types/modular-scale/ @mikefowler /types/module-alias/ @KevinRamharak /types/module-deps/ @TeamworkGuy2 /types/moji/ @yasupeke @@ -3061,24 +3260,25 @@ /types/moment-duration-format/ @SwintDC @TwoStone @leonard-thieu @bendykowski /types/moment-holiday/ @rwdalpe /types/moment-jalaali/ @alitaheri -/types/moment-range/ @Burgov @wilgert @franjuan @MartynasZilinskas +/types/moment-range/ @Burgov @wilgert @franjuan @MartynasZilinskas @chemass /types/moment-round/ @jacobbaskin /types/moment-shortformat/ @whatasoda /types/moment-strftime2/ @dex4er -/types/moment-timezone/ @michelsalib @alanblins +/types/moment-timezone/ @michelsalib @alanblins @asermax /types/money-math/ @taoqf /types/mongo-sanitize/ @CedricCazin /types/mongodb/v2/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi /types/mongodb/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi @EnricoPicci @AJCStriker @julien-c @daprahamian @denys-bushulyak @BastienAr @sindbach @geraldinelemeur @jishi @various89 @angela-1 @lirbank @hector7 @floric @erikc5000 /types/mongodb-memory-server/ @dmitryrogozhny /types/mongodb-uri/ @mernxl -/types/mongoose/v4/ @simonxca @horiuchi @sindrenm @lukasz-zak -/types/mongoose/ @horiuchi @sindrenm @lukasz-zak @Alorel @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 @Fazendaaa @NormanPerrin @danmana @stablio +/types/mongoose/v4/ @simonxca @horiuchi @lukasz-zak +/types/mongoose/ @horiuchi @lukasz-zak @Alorel @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 @Fazendaaa @NormanPerrin @danmana @stablio @emmanuelgautier /types/mongoose-auto-increment/ @AyaMorisawa /types/mongoose-deep-populate/ @AyaMorisawa /types/mongoose-geojson-schema/ @bondz /types/mongoose-mock/ @jt000 /types/mongoose-paginate/ @linusbrolin @simonxca +/types/mongoose-paginate-v2/ @linusbrolin @simonxca @woutgg /types/mongoose-promise/ @simonxca /types/mongoose-seeder/ @Crevil /types/mongoose-sequence/ @linusbrolin @@ -3086,6 +3286,7 @@ /types/mongoose-unique-validator/ @stevehipwell /types/mongorito/ @pinguet62 /types/mongration/ @soulthreads +/types/month-days/ @BendingBender /types/moo/ @deltaidea @MofX /types/moonjs/ @DanielRosenwasser /types/morgan/ @staticfunction @pscanf @@ -3093,8 +3294,9 @@ /types/morris.js/ @mareek @sindilevich /types/mosca/ @GabrielGouv @jerray /types/motor-hat/ @muntyan -/types/mousetrap/ @qcz +/types/mousetrap/ @qcz @alanhchoi /types/move-concurrently/ @mgroenhoff +/types/move-file/ @BendingBender /types/moveto/ @shermendev /types/moviedb/ @basarat @0x6368656174 /types/moxios/ @itoasuka @@ -3115,8 +3317,9 @@ /types/multer-gridfs-storage/v2/ @devconcept /types/multer-gridfs-storage/ @devconcept /types/multer-s3/ @tcaesvk @galtalmor @terski +/types/multi-progress/ @DHBrett /types/multi-typeof/ @mhegazy -/types/multimatch/ @stephenlautier +/types/multimatch/ @stephenlautier @BendingBender /types/multiparty/ @kenfdev /types/multiplexjs/ @KamyarNazeri /types/multisort/ @CzBuCHi @@ -3150,17 +3353,21 @@ /types/navermaps/ @ckboyjiy /types/navigation/ @grahammendick /types/navigation-react/ @grahammendick +/types/navigator-permissions/ @vargavince91 @minddocdev /types/navigo/ @aersamkull @dancespiele @deini /types/nblas/ @erikgerrits -/types/nconf/ @jedigo @jmthibault +/types/nconf/ @jedigo @jmthibault @ew73 /types/ncp/ @bartvds /types/ndarray/ @pawsong @taoqf /types/nearley/ @deltaidea @BendingBender +/types/neat-csv/ @calamitizer /types/nedb/ @reppners @anthonynichols @afharo /types/nedb-logger/ @thisboyiscrazy /types/needle/v0/ @bigsan /types/needle/v1/ @bigsan @nikeee -/types/needle/ @bigsan @nikeee @sindilevich +/types/needle/ @bigsan @nikeee @sindilevich @bryanspears +/types/negative-array/ @BendingBender +/types/negative-zero/ @BendingBender /types/negotiator/ @BendingBender /types/neo4j/ @cyrilschumacher /types/nes/ @NoHomey @saboya @@ -3170,15 +3377,18 @@ /types/netlify-identity-widget/ @nkprince007 /types/netmask/ @mhfrantz /types/network-interfaces/ @anderswestberg +/types/new-github-issue-url/ @BendingBender +/types/new-github-release-url/ @BendingBender /types/new-relic-browser/ @renehamburger @piotrkubisa /types/newline-remove/ @OpenByteDev /types/newman/ @LogvinovLeon @Graham42 -/types/newrelic/ @mastermatt @brookspatton +/types/newrelic/ @mastermatt @brookspatton @MichaelRBond /types/nexpect/ @vvakame /types/next/ @dru89 @brikou @jthegedus @resir014 @scottdj92 @joaovieira @ajliv /types/next-redux-saga/ @leocavalcante /types/next-redux-wrapper/ @stevegeek @Jungwoo-An /types/next-server/ @dru89 @brikou @jthegedus @resir014 @scottdj92 @joaovieira @ajliv +/types/next-tick/ @BendingBender /types/ng-command/ @stephenlautier /types/ng-cordova/ @ksachdeva /types/ng-dialog/ @stephenlautier @@ -3206,6 +3416,7 @@ /types/nise/ @a-tarasyuk /types/nivo-slider/ @AndersonFriaca /types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko +/types/noble-mac/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko /types/nock/ @bonnici @horiuchi @afharo @mastermatt @damour @paambaati /types/nodal/ @charrondev /types/node/v0/ @Microsoft @DefinitelyTyped @@ -3225,13 +3436,14 @@ /types/node-dijkstra/ @nokutu /types/node-dir/ @panuhorsmalahti /types/node-dogstatsd/ @chrisbobo -/types/node-emoji/ @jonestristand @styu +/types/node-emoji/ @jonestristand @styu @rimiti /types/node-fetch/ @torstenwerner @nikcorg /types/node-fibers/ @caryhaynie -/types/node-forge/ @westy92 @flynetworks @a-k-g @rafal2228 @beenotung @joeflateau @Apologiz @timhwang21 +/types/node-forge/ @westy92 @flynetworks @a-k-g @rafal2228 @beenotung @joeflateau @Apologiz @timhwang21 @supaiku0 /types/node-gcm/ @horiuchi /types/node-geocoder/ @rosek86 /types/node-getopt/ @kcauchy +/types/node-gettext/ @sameercaresu /types/node-hid/ @mhegazy @ert78gb @thegecko /types/node-horseman/ @apratheek /types/node-hue-api/ @fjmorel @@ -3243,14 +3455,14 @@ /types/node-memwatch/ @Kroisse /types/node-mysql-wrapper/ @kataras /types/node-notifier/ @tkQubo -/types/node-polyglot/ @timjk +/types/node-polyglot/ @timjk @liamross /types/node-powershell/ @rodrigoff /types/node-pushnotifications/ @menushka /types/node-ral/ @ssddi456 /types/node-red/ @andersea @tbowmo /types/node-redis-pubsub/ @renekeijzer /types/node-resque/ @gordey4doronin -/types/node-rsa/ @alitaheri @xm +/types/node-rsa/ @alitaheri @xm @ffflorian /types/node-schedule/ @cyrilschumacher @flowpl /types/node-slack/ @tkQubo /types/node-snap7/ @heilingbrunner @@ -3263,6 +3475,7 @@ /types/node-validator/ @kengorab /types/node-vault/ @YuJianrong /types/node-wit/ @julienduf +/types/node-xlsx/ @cWatermelon /types/node-xmpp-client/ @PJakcson /types/node-xmpp-core/ @PJakcson /types/node-zookeeper-client/ @plantain-00 @jessezhang91 @@ -3286,6 +3499,7 @@ /types/nookies/ @andreasbergqvist /types/nopt/ @jbondc /types/normalize-package-data/ @jdxcode +/types/normalize-path/ @BendingBender /types/normalize-url/ @odin3 @BendingBender @mathieumg /types/notie/ @mateusdemboski /types/notify/ @hellochar @@ -3297,13 +3511,19 @@ /types/nouislider/ @bleuarg @lagaffe /types/novnc-core/ @smithkl42 @BendingBender /types/npm/ @SomaticIT +/types/npm-email/ @BendingBender +/types/npm-keyword/ @BendingBender +/types/npm-name/ @BendingBender /types/npm-package-arg/ @mgroenhoff @OiYouYeahYou /types/npm-packlist/ @ajafff +/types/npm-paths/ @BendingBender +/types/npm-run-path/ @BendingBender +/types/npm-user/ @BendingBender +/types/npm-user-packages/ @BendingBender /types/npmlog/ @DanielMSchmidt @littlepiggy03 /types/ns-api/ @Archcry /types/nslog/ @unindented /types/nsqjs/ @cezaryrk -/types/nuka-carousel/ @Romic @altaudio @matt-sungwook /types/number-is-nan/ @mhegazy /types/number-to-words/ @frederickfogerty /types/numeral/ @vbortone @BehindTheMath @klujanrosas @@ -3332,7 +3552,7 @@ /types/object-keys-mapping/ @newraina /types/object-map/ @wolfgang42 /types/object-merge/ @OpenByteDev -/types/object-path/ @pocesar +/types/object-path/ @pocesar @BendingBender /types/object-refs/ @3fd /types/object.getownpropertydescriptors/ @VitorLuizC /types/oblo-util/ @Oblosys @@ -3343,7 +3563,7 @@ /types/oembed-parser/ @BendingBender /types/ofe/ @Morfent /types/office-js/ @OfficeDev @LanceEA @Zlatkovsky @kbrandl @Rick-Kirkham @AlexJerabek @ElizabethSamuel-MSFT -/types/office-js-preview @OfficeDev @Zlatkovsky @kbrandl @Rick-Kirkham @AlexJerabek @ElizabethSamuel-MSFT +/types/office-js-preview/ @OfficeDev @Zlatkovsky @kbrandl @Rick-Kirkham @AlexJerabek @ElizabethSamuel-MSFT /types/office-runtime/ @Zlatkovsky @mscharlock /types/offline-js/ @cgwrench /types/oibackoff/ @geoffreak @@ -3352,16 +3572,20 @@ /types/okta__okta-vue/ @innovation-team /types/ol/ @yairtawil /types/omggif/ @ffflorian +/types/on-change/ @BendingBender /types/on-finished/ @czechboy0 @BendingBender /types/on-headers/ @jjeffery @BendingBender /types/on-wake-up/ @ajafff /types/once/ @denis-sokolov @BendingBender +/types/one-time/ @BendingBender /types/onesignal-cordova-plugin/ @broder /types/onetime/ @BendingBender /types/oniguruma/ @smhxx /types/onoff/ @marcel-ernst @Kallu609 /types/ontime/ @Hirse /types/open/ @Bartvds +/types/open-editor/ @BendingBender +/types/openapi-factory/ @runebaas /types/opener/ @tikurahul /types/openfin/v17/ @chrisbarker /types/openfin/v29/ @chrisbarker @rdepena @@ -3371,22 +3595,24 @@ /types/openlayers/v2/ @bolhovsky /types/openlayers/v3/ @osechet @matthiasdailey-ccri /types/openlayers/ @osechet @wb14123 @ailrun @mylen @iamthechad @danmana @yairtawil @pierremarc @hauke96 @gberaudo -/types/openpgp/ @errietta @damonpam @po5i +/types/openpgp/ @errietta @damonpam @po5i @ecamellini /types/openstack-wrapper/ @sanjaymadane /types/opentok/ @westy92 @CatGuardian /types/opentype.js/ @danmarshall @edzis /types/opn/ @shinnn @SomaticIT @tlent -/types/opossum/ @quinnlangille @merufm @lance +/types/opossum/ @quinnlangille @merufm @lance @mastermatt /types/optics-agent/ @crevil /types/optimist/ @soywiz @chbrown /types/optimize-css-assets-webpack-plugin/ @odnamrataizem /types/ora/v0/ @basarat @screendriver +/types/ora/v1/ @basarat @screendriver @BendingBender @azasypkin /types/ora/ @basarat @screendriver @BendingBender @azasypkin /types/oracle__oraclejet/ @nolakara @jingxwu /types/oracledb/ @Bigous /types/orchestrator/ @tkQubo @TeamworkGuy2 /types/orderedmap/ @bradleyayers /types/orientjs/ @saeedtabrizi +/types/original/ @wcarson /types/os-homedir/ @mhegazy /types/os-locale/v1/ @AyaMorisawa @BendingBender /types/os-locale/ @AyaMorisawa @BendingBender @@ -3396,6 +3622,7 @@ /types/osmtogeojson/ @tkqubo /types/osrm/ @DenisCarriere /types/otplib/ @renjfk +/types/overlayscrollbars/ @KingSora /types/overwatch-api/ @JoshuaHall /types/owasp-password-strength-test/ @stephtr /types/owl.carousel/ @igorissen @KennethanCeyer @@ -3410,6 +3637,8 @@ /types/p-each-series/ @BendingBender /types/p-event/ @BendingBender /types/p-every/ @BendingBender +/types/p-forever/ @BendingBender +/types/p-is-promise/ @BendingBender /types/p-lazy/ @BendingBender /types/p-limit/ @BendingBender @LinusU /types/p-loading/ @renjfk @@ -3418,7 +3647,9 @@ /types/p-map/ @BendingBender /types/p-map-series/ @BendingBender /types/p-memoize/ @forabi +/types/p-min-delay/ @BendingBender /types/p-one/ @BendingBender +/types/p-pipe/ @BendingBender /types/p-progress/ @icopp /types/p-props/ @BendingBender /types/p-queue/v2/ @BendingBender @evanshortiss @@ -3431,19 +3662,23 @@ /types/p-some/ @BendingBender /types/p-tap/ @BendingBender /types/p-throttle/ @BendingBender +/types/p-time/ @BendingBender /types/p-timeout/ @BendingBender +/types/p-times/ @BendingBender /types/p-try/ @BendingBender @LinusU /types/p-wait-for/v1/ @BendingBender /types/p-wait-for/ @BendingBender +/types/p-waterfall/ @BendingBender /types/p-whilst/ @BendingBender /types/p2/ @clark-stevenson /types/p5/ @p5-types -/types/package-json/ @jinwoo +/types/package-json/ @jinwoo @BendingBender /types/packery/ @piraveen @hanssens /types/pad/ @mhegazy /types/page/ @43081j /types/paho-mqtt/ @amikhalev /types/pako/ @cappellin @calebegg +/types/palx/ @mikefowler /types/pangu/ @plantain-00 /types/papaparse/ @torpedro @rainshen49 @jfloff @johnnyreilly @albertorestifo @BehindTheMath @3af @jliuhtonen /types/paper/ @clark-stevenson @Xakaloz @sebaswebdev @rfried @@ -3452,18 +3687,25 @@ /types/parcel-bundler/ @pinage404 /types/parcel-env/ @fathyb /types/parent-package-json/ @sgmccli +/types/parents/ @TeamworkGuy2 /types/parity-pmd/ @leovujanic @jewbre /types/parity-pmr/ @leovujanic /types/parity-poe/ @leovujanic +/types/park-miller/ @BendingBender /types/parse/v1/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas /types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas @agoldis -/types/parse-git-config/ @leonard-thieu @deltaidea +/types/parse-columns/ @BendingBender +/types/parse-filepath/ @BendingBender +/types/parse-git-config/v2/ @leonard-thieu @deltaidea +/types/parse-git-config/ @leonard-thieu @deltaidea @BendingBender /types/parse-github-url/ @ajafff /types/parse-glob/ @glen-84 /types/parse-json/ @mrmlnc /types/parse-link-header/ @zelein /types/parse-mockdb/ @dpoetzsch /types/parse-ms/ @Roaders +/types/parse-numeric-range/ @eoin-obrien +/types/parse-passwd/ @BendingBender /types/parse-torrent/ @niieani @tlaziuk /types/parse-torrent-file/ @tlaziuk /types/parse-unit/ @Jack-Works @@ -3478,7 +3720,7 @@ /types/parsecurrency/ @cristianrgreco /types/parseurl/ @bomret /types/parsimmon/ @Bartvds @mizunashi-mana @bcherny @bvanreeven @leonard-thieu @MrJohz -/types/passport/ @horiuchi @enaeseth @theigor @tlaziuk @danielpa9708 +/types/passport/ @horiuchi @enaeseth @theigor @tlaziuk @danielpa9708 @kstiehl /types/passport-anonymous/ @0x6368656174 /types/passport-auth0/ @johnbendi @iamvishnusankar @duncanhall /types/passport-azure-ad/ @ShekharNain @@ -3488,18 +3730,19 @@ /types/passport-discord/ @kzay /types/passport-facebook/ @staticfunction @lucasmacosta /types/passport-facebook-token/ @rmartone @mrand01 -/types/passport-github/ @yasupeke -/types/passport-github2/ @yasupeke @mthmulders @codepunkt +/types/passport-github/ @yasupeke @reggaepanda +/types/passport-github2/ @yasupeke @mthmulders @codepunkt @ivan94 /types/passport-google-oauth/ @staticfunction /types/passport-google-oauth2/ @bluehatbrit -/types/passport-http/ @krizalys @tlaziuk @cjbarth +/types/passport-http/ @krizalys @tlaziuk @cjbarth @jamesadarich /types/passport-http-bearer/ @isman-usoh /types/passport-jwt/ @jindev /types/passport-kakao/ @Park9eon @zerocho +/types/passport-linkedin-oauth2/ @andrewvetovitz /types/passport-local/ @SomaticIT /types/passport-local-mongoose/ @linusbrolin /types/passport-naver/ @Park9eon @zerocho -/types/passport-oauth2/ @pasieronen @WangZishi @EduardoAC +/types/passport-oauth2/ @pasieronen @WangZishi @EduardoAC @ivan94 /types/passport-oauth2-client-password/ @akaNightmare /types/passport-remember-me-extended/ @AylaJK /types/passport-saml/ @cjbarth @dassennato @ksamborski @@ -3515,6 +3758,9 @@ /types/path-exists/ @shiwano @BendingBender /types/path-is-absolute/ @mhegazy /types/path-is-inside/ @aomarks +/types/path-key/ @BendingBender +/types/path-regex/ @BendingBender +/types/path-type/ @BendingBender /types/pathfinding/ @BNedry /types/pathjs/ @lokeshpeta /types/pathwatcher/ @GlenCFL @@ -3538,6 +3784,7 @@ /types/permit/ @jannikkeye /types/persona/ @Nycto /types/pet-finder-api/ @me +/types/petit-dom/ @JamesMessinger /types/pg/v6/ @pspeter3 /types/pg/ @pspeter3 /types/pg-ears/ @bradleyayers @@ -3565,6 +3812,7 @@ /types/pick-weight/ @rsxdalv /types/pickadate/ @theodorejb @leonard-thieu /types/picturefill/ @alaz +/types/pid-from-port/ @BendingBender /types/pidusage/ @cyrilschumacher @mx601595686 /types/pify/ @samverschueren @mad-mike @c7hm4r /types/pigpio/ @manerfan @erikma @@ -3584,6 +3832,7 @@ /types/pkg-conf/ @jorgegonzalez /types/pkg-dir/ @NK-WEB-Git /types/pkg-up/ @forivall +/types/pkg-versions/ @BendingBender /types/pkijs/ @microshine /types/platform/ @JakeH /types/playcanvas/ @Neoflash1979 @@ -3606,6 +3855,7 @@ /types/point-in-polygon/ @dyst5422 @kogai /types/pollyjs__adapter/ @feinoujc /types/pollyjs__adapter-fetch/ @feinoujc +/types/pollyjs__adapter-node-http/ @jlmessenger /types/pollyjs__core/ @feinoujc /types/pollyjs__persister/ @feinoujc /types/pollyjs__persister-fs/ @feinoujc @@ -3617,6 +3867,7 @@ /types/polymer-ts/ @lgrignon /types/popcorn/ @grapswiz /types/portscanner/ @douglasduteil +/types/positive-zero/ @BendingBender /types/postal/ @lokeshpeta @myitcv /types/postcss-calc/ @huan086 /types/postcss-icss-values/ @huan086 @@ -3656,7 +3907,10 @@ /types/pretty-bytes/v4/ @plantain-00 /types/pretty-bytes/ @plantain-00 @danielasy /types/pretty-format/ @ikatyang -/types/pretty-ms/ @BendingBender @ocboogie +/types/pretty-hrtime/ @BendingBender +/types/pretty-ms/v3/ @BendingBender @ocboogie +/types/pretty-ms/ @BendingBender @ocboogie @silh +/types/preval.macro/ @huan086 /types/printf/ @AluisioASG /types/priorityqueuejs/ @geoffreak /types/prismic-dom/ @nickw444 @sbilstein @@ -3666,7 +3920,7 @@ /types/progress/ @sebastian-lenz /types/progressbar/ @atd-schubert /types/progressjs/ @zaneli -/types/proj4/ @DenisCarriere +/types/proj4/ @DenisCarriere @BendingBender /types/proj4leaflet/ @BendingBender /types/project-oxford/ @scsouthw /types/prometheus-gc-stats/ @danwbyrne @@ -3690,7 +3944,7 @@ /types/prompt-sync/ @MugeSo /types/prompt-sync-history/ @MugeSo /types/promptly/ @danrspencer -/types/prompts/ @Berkays @danielpa9708 +/types/prompts/ @Berkays @danielpa9708 @kamontat /types/prop-types/ @DovydasNavickas @ferdaber /types/proper-lockfile/ @qlonik /types/properties-reader/ @Goldsmith42 @@ -3719,11 +3973,14 @@ /types/proxy-lists/ @BehindTheMath /types/proxy-verifier/ @BehindTheMath /types/proxyquire/ @jt000 +/types/ps-list/ @BendingBender /types/ps-tree/ @alessiopcc +/types/pseudo-audio-param/ @kirbysayshi +/types/psl/ @BendingBender /types/ptomasroos__react-native-multi-slider/ @Slessi /types/pty.js/ @enlight /types/public-ip/ @BendingBender -/types/pubnub/ @bitbankinc @rollymaduk @vitosamson @FlorianDr +/types/pubnub/ @bitbankinc @rollymaduk @vitosamson @FlorianDr @danduh /types/pubsub-js/ @borisyankov /types/pug/ @TonyPythoneer @19majkel94 /types/pulltorefreshjs/ @DanielRosenwasser @humpedli @@ -3744,7 +4001,7 @@ /types/q-io/ @Bartvds /types/q-retry/ @vilic /types/qhistory/ @Kovensky -/types/qiniu-js/ @taoqf +/types/qiniu-js/ @taoqf @qiqizjl /types/qlik/ @RubenSlabbert @AginicX /types/qlik-engineapi/ @konne @richardison /types/qlik-visualizationextensions/ @konne @@ -3753,8 +4010,9 @@ /types/qrcode.react/ @mleko /types/qs/ @RWander @leonyu @tehbelinda @zyml @artursvonda @CarlosBonetti /types/qtip2/ @Seltzer @leonard-thieu -/types/query-string/ @SamVerschueren @tkrotoff @huhuanming @MadaraUchiha @shssoichiro +/types/query-string/ @SamVerschueren @tkrotoff @huhuanming @MadaraUchiha @shssoichiro @jarrku /types/querystringify/ @ilich +/types/quick-lru/v1/ @BendingBender /types/quick-lru/ @BendingBender /types/quill/ @sumitkm @guillaume-ro-fr @43081j @AnielloFalcone @mhamri /types/quixote/ @greybax @@ -3769,7 +4027,8 @@ /types/radium/ @alexgorbatchev @nupplaphil @asvetliakov /types/radius/ @codeanimal /types/radix64/ @huan086 -/types/ramda/ @donnut @tycho01 @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick @leighman @CaptJakk @deftomat @deptno @blimusiek @biern @rayhaneh @rgm @drewwyatt +/types/raf/ @BenLorantfy +/types/ramda/ @donnut @tycho01 @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick @leighman @CaptJakk @deftomat @deptno @blimusiek @biern @rayhaneh @rgm @drewwyatt @jottenlips @minitesh /types/random-boolean/ @BendingBender /types/random-float/ @BendingBender /types/random-int/ @BendingBender @@ -3780,6 +4039,7 @@ /types/random-obj-prop/ @BendingBender /types/random-seed/ @endel /types/random-string/ @stpettersens +/types/randoma/ @BendingBender /types/randombytes/ @BendingBender /types/randomcolor/ @feitzi @BradyLiles /types/range-parser/ @tlaziuk @@ -3803,10 +4063,11 @@ /types/raygun/ @UberMouse /types/raygun4js/ @xt0rted @BenjaminHarding @UberMouse /types/rbac-a/ @tlaziuk -/types/rc/ @DanielRosenwasser +/types/rc/ @DanielRosenwasser @BendingBender /types/rc-progress/ @jussikinnula /types/rc-select/ @DenisTirilis /types/rc-slider/ @mantasmarcinkus @mattoni @paustint @j-fro @Deanna2 +/types/rc-switch/ @karol-majewski /types/rc-time-picker/ @Hoff97 /types/rc-tooltip/ @rhysd @ahstro @vsaarinen /types/rc-tree/ @johnnyreilly @Methuselah96 @@ -3817,7 +4078,7 @@ /types/re-base/ @jordandrako /types/reach__router/ @kingdaro /types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz -/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei @Kovensky +/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei @Kovensky @pshrmn /types/react-adal/ @dkorolev1 /types/react-albus/ @sseppola @conradreuter @kuirak /types/react-alert/v2/ @ssyrell @@ -3826,12 +4087,12 @@ /types/react-amplitude/ @rayzor65 /types/react-animate-on-scroll/ @ralbuque /types/react-app/ @prakarshpandey -/types/react-aria-menubutton/ @forabi @crohlfs +/types/react-aria-menubutton/ @forabi @crohlfs @karmats /types/react-aria-modal/ @forabi /types/react-autocomplete/ @lstanden /types/react-autosuggest/ @nicolas-schmitt @pjo256 @robessog @tbayne @cdeutsch @rosskevin /types/react-avatar-editor/ @diogocorrea @gabsprates -/types/react-beautiful-dnd/ @varHarrie @bradleyayers @paustint @marknelissen +/types/react-beautiful-dnd/ @varHarrie @bradleyayers @paustint @marknelissen @enricoboccadifuoco @lonyele /types/react-better-password/ @mhuynh1 /types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly @janb87 /types/react-blessed/ @me @@ -3841,7 +4102,7 @@ /types/react-bootstrap-daterangepicker/ @ianks /types/react-bootstrap-table/v2/ @flaub @alelode @UJosue10 /types/react-bootstrap-table/ @flaub @alelode @UJosue10 @dawnmist @Ogglas -/types/react-bootstrap-typeahead/ @Guymestef @radziksh @PaitoAnderson +/types/react-bootstrap-typeahead/ @Guymestef @radziksh @PaitoAnderson @arichter83 /types/react-breadcrumbs/ @guoyunhe /types/react-breadcrumbs-dynamic/ @mitsuruog /types/react-broadcast/ @kandros @@ -3857,8 +4118,8 @@ /types/react-coinhive/ @sktbcbbs /types/react-collapse/ @Kimahriman /types/react-collapsible/ @knegusen -/types/react-color/ @LKay @markspolakovs @mntdn -/types/react-confirm/ @santiagodoldan +/types/react-color/ @LKay @markspolakovs @mntdn @nkgrnkgr +/types/react-confirm/ @santiagodoldan @marknelissen /types/react-content-loader/ @alaatm @samwalshnz /types/react-copy-to-clipboard/ @mabels @BernabeFelix /types/react-copy-write/ @samhh @davej @@ -3887,7 +4148,8 @@ /types/react-dom/v15/ @MartynasZilinskas /types/react-dom/ @MartynasZilinskas @theruther4d /types/react-dom-factories/ @jgoz -/types/react-draft-wysiwyg/ @imechZhangLY +/types/react-dotdotdot/ @jczyzewski +/types/react-draft-wysiwyg/ @imechZhangLY @brunoMaurice /types/react-dragtastic/ @nscarcella /types/react-dropzone/v2/ @matdube @LynxEyes @goblindegook @benbayard /types/react-dropzone/v3/ @matdube @LynxEyes @goblindegook @benbayard @LKay @@ -3901,6 +4163,7 @@ /types/react-faux-dom/ @alitaheri @cleverguy25 @deviousm @hanai /types/react-file-input/ @dmitryrogozhny /types/react-file-reader-input/ @dmitryrogozhny @alitaheri +/types/react-filepond/ @zposten /types/react-flag-icon-css/ @jonfreedman /types/react-flags-select/ @senukartur /types/react-flatpickr/ @begincalendar @snaveevans @@ -3910,21 +4173,24 @@ /types/react-form/v1/ @cameron-mcateer /types/react-form/ @cameron-mcateer @TiuSh /types/react-foundation/ @danielearwicker +/types/react-frontload/ @rockon404 /types/react-gateway/ @jsonunger /types/react-geosuggest/ @brmenchl /types/react-global-configuration/ @ryokik /types/react-google-login-component/ @koss-lebedev /types/react-google-maps-loader/ @vasilysn /types/react-google-places-suggest/ @vasilysn -/types/react-google-recaptcha/ @KoalaHuman +/types/react-google-recaptcha/ @KoalaHuman @tomsturge /types/react-gravatar/ @invliD /types/react-grid-layout/ @abirkholz @alitaheri @ZheyangSong @andrewhathaway /types/react-hamburger-menu/ @grzesie2k /types/react-hammerjs/v0/ @jsonunger /types/react-hammerjs/ @jsonunger @cecchi +/types/react-headroom/ @zerocho /types/react-helmet/v4/ @evanbb @isman-usoh /types/react-helmet/ @evanbb @isman-usoh @lith-light-g @sammkj @yuit /types/react-helmet-async/ @forabi +/types/react-highcharts/ @j1r1k /types/react-highlight/ @joshuakgoldberg /types/react-highlight-words/ @mhegazy @diogodca @kellyrmilligan /types/react-highlighter/ @oizie @@ -3933,7 +4199,7 @@ /types/react-hyperscript/ @tock203 /types/react-icon-base/ @apare @LKay /types/react-icons/ @apare @johnnyreilly @LKay -/types/react-image-crop/ @danielasy +/types/react-image-crop/ @danielasy @chaaya /types/react-image-fallback/ @8enSmith /types/react-image-gallery/ @adamwpc /types/react-imageloader/ @stephenjelfs @@ -3943,6 +4209,7 @@ /types/react-infinite-calendar/ @christianchown /types/react-infinite-scroll-component/ @sroy3 @burtek @davidkevork @JoshuaScript /types/react-infinite-scroller/ @Lapanti @psrebniak @WrathZA @daggerjames +/types/react-inlinesvg/ @MyCryptoHQ @nickmccurdy /types/react-input-autosize/ @jsonunger @franklixuefei /types/react-input-calendar/ @stepancar /types/react-input-mask/v1/ @apare @@ -3954,7 +4221,7 @@ /types/react-intl/v1/ @bgrieder /types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos @lukyth @obedm503 /types/react-intl-redux/ @LKay -/types/react-is/ @AviVahl @christianchown +/types/react-is/ @AviVahl @christianchown @eps1lon /types/react-is-deprecated/ @seansfkelley /types/react-joyride/ @kdy1 @kamranayub /types/react-js-pagination/ @netoisc @@ -3968,6 +4235,7 @@ /types/react-leaflet/ @danzel @davschne @yuit /types/react-leaflet-markercluster/ @Kimahriman /types/react-lifecycle-component/ @pixelshaded +/types/react-lifecycles-compat/ @bySabi /types/react-list/ @buptyyf @tomshen /types/react-loadable/ @Kovensky @odensc @ianks @tlaziuk @iMobs /types/react-loader/ @artfuldev @@ -3978,22 +4246,22 @@ /types/react-mce/ @morphologue /types/react-mdl/ @bradzacher /types/react-measure/ @asvetliakov @marcfallows -/types/react-mentions/ @activescott +/types/react-mentions/ @activescott @efedorenko /types/react-mixin/ @tkqubo /types/react-modal/ @radziksh @drewnoakes @homburg @ttamminen @hallowatcher @peterblazejewicz @jpowell /types/react-motion/ @stepancar @asvetliakov @dimitarnestorov /types/react-motion-slider/ @asvetliakov /types/react-motion-ui-pack/ @jsonunger -/types/react-native/ @alloy @huhuanming @iRoachie @skn0tt @timwangdev @kamal @nelyousfi @alexdunne @swissmanu @bm-software @tkrotoff @a-tarasyuk @mvdam @esemesek @mrnickel +/types/react-native/ @alloy @huhuanming @iRoachie @skn0tt @timwangdev @kamal @nelyousfi @alexdunne @swissmanu @bm-software @tkrotoff @a-tarasyuk @mvdam @esemesek @mrnickel @souvik-ghosh /types/react-native-android-taskdescription/ @christianchown -/types/react-native-auth0/ @ascariandrea +/types/react-native-auth0/ @ascariandrea @marknelissen /types/react-native-autocomplete-input/ @ifiokjr /types/react-native-background-timer/ @chillkroeteTTS /types/react-native-bluetooth-serial/ @RodrigoAWeber /types/react-native-calendars/ @Tyler-Zhang @DavidNorena @FabianMeul /types/react-native-communications/ @huhuanming @PaitoAnderson /types/react-native-custom-tabs/ @philnova -/types/react-native-datepicker/ @jacobbaskin +/types/react-native-datepicker/ @jacobbaskin @nossbigg /types/react-native-dialog/ @MrLuje @stackbuilders @ibarrae /types/react-native-dialogflow/ @jasonmerino /types/react-native-doc-viewer/ @iRoachie @@ -4017,20 +4285,24 @@ /types/react-native-keychain/ @DavidFarinha /types/react-native-loading-spinner-overlay/ @fhelwanger /types/react-native-material-design-searchbar/ @iRoachie +/types/react-native-material-dropdown/ @jaydeep987 /types/react-native-material-kit/ @iRoachie @timwangdev /types/react-native-material-textfield/ @mindhivefi @iRoachie /types/react-native-material-ui/ @iRoachie /types/react-native-mauron85-background-geolocation/ @djereg /types/react-native-mixpanel/ @r3nya +/types/react-native-modal-dropdown/ @echoulen /types/react-native-modalbox/ @iRoachie /types/react-native-multi-slider/ @Slessi /types/react-native-navbar/ @ryokik /types/react-native-orientation/ @MoLow /types/react-native-permissions/ @vincentlanglet /types/react-native-photo-view/ @christianchown +/types/react-native-platform-touchable/ @tngranados /types/react-native-popup-dialog/ @PaitoAnderson @connectdotz @bm-software /types/react-native-push-notification/ @PaitoAnderson @tomSawkins /types/react-native-qrcode/ @plantain-00 +/types/react-native-read-more-text/ @solkaz /types/react-native-referrer/ @christianchown /types/react-native-restart/ @christianchown /types/react-native-safari-view/ @mrand01 @@ -4058,8 +4330,10 @@ /types/react-native-vector-icons/ @iRoachie @timwangdev /types/react-native-version-number/ @VincentLanglet /types/react-native-video/ @huhuanming +/types/react-native-zeroconf/ @mattapet /types/react-navigation/v1/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi -/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway +/types/react-navigation/v2/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway +/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway @denissb @skovhus /types/react-navigation-material-bottom-tabs/ @iRoachie /types/react-no-ssr/ @rafalfilipek /types/react-notification-system/ @GiedriusGrabauskas @DeividasBakanas @LKay @sztobar @@ -4070,13 +4344,16 @@ /types/react-onclickoutside/ @LKay @surgeboris /types/react-onsenui/ @salim7 @jemmyw @lirbank /types/react-outside-click-handler/ @zubivan -/types/react-overlays/ @aaronbeall @vitosamson +/types/react-overlays/ @aaronbeall @vitosamson @aarondancer /types/react-owl-carousel/ @tbounsiar @igorissen @KennethanCeyer /types/react-paginate/v4/ @deevus @wouterhardeman @pegel03 @archy-bold /types/react-paginate/v5/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke -/types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @sugarshin -/types/react-places-autocomplete/ @guilhermehubner @r3nya +/types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @sugarshin @SPWizard01 +/types/react-panelgroup/ @qgolsteyn +/types/react-places-autocomplete/v6/ @guilhermehubner @r3nya @ApeNox @azizhk +/types/react-places-autocomplete/ @guilhermehubner @r3nya @ApeNox @azizhk /types/react-plotly.js/ @jonfreedman +/types/react-plyr/ @baorv /types/react-pointable/ @istefo @mdibyo /types/react-popover/ @jacoporicare /types/react-portal/v3/ @shuntksh @@ -4085,10 +4362,12 @@ /types/react-props-decorators/ @tkqubo /types/react-qr-reader/ @davidkevork /types/react-radio-group/ @jsonunger +/types/react-rangeslider/ @RichieRock /types/react-recaptcha/ @mhegazy @zzanol /types/react-reconciler/ @Methuselah96 /types/react-redux/v5/ @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva -/types/react-redux/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris +/types/react-redux/v6/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris +/types/react-redux/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris @soerenbf /types/react-redux-epic/ @forabi /types/react-redux-i18n/ @clementdevos /types/react-redux-toastr/ @Smiche @artyomsv @kulmajaba @@ -4113,6 +4392,7 @@ /types/react-router-redux/v3/ @isman-usoh @noah79 @rosendi /types/react-router-redux/v4/ @isman-usoh @noah79 @rosendi @LKay @DovydasNavickas /types/react-router-redux/ @huy-nguyen @8398a7 @mykolas +/types/react-rte/ @jclyons52 /types/react-s-alert/ @mitsuruog /types/react-scroll/ @sudoplz @GiedriusGrabauskas /types/react-scrollbar/ @stephenjelfs @@ -4122,6 +4402,7 @@ /types/react-show-more/ @naortor /types/react-side-effect/ @remojansen @0xcaff /types/react-sidebar/ @jeroenvervaeke +/types/react-simple-maps/ @thepocp /types/react-sketchapp/ @ricokahler @DomiR @saschazar21 /types/react-slick/ @andrewBalekha @GiedriusGrabauskas @r3nya /types/react-slider/ @jsonunger @@ -4129,6 +4410,7 @@ /types/react-sortable-hoc/ @NoHomey @charlesrey /types/react-sortable-pane/ @rhysd /types/react-sortable-tree/ @wouterhardeman @jzoric @kevinsperrine @acemac @dolezel +/types/react-sortable-tree-theme-file-explorer/ @dolezel /types/react-sound/ @koss-lebedev /types/react-sparklines/ @henrinormak /types/react-spinkit/v1/ @tkqubo @mleko @pelotom @@ -4139,7 +4421,7 @@ /types/react-sticky-box/ @koss-lebedev /types/react-sticky-el/ @jbraithwaite /types/react-stickynode/ @tstirrat -/types/react-stripe-elements/ @dan-j @santiagodoldan @sonnysangha @9y5 @thchia @yhnavein +/types/react-stripe-elements/ @dan-j @santiagodoldan @sonnysangha @9y5 @thchia @yhnavein @virzak /types/react-svg-inline/ @kiyopikko /types/react-svg-pan-zoom/ @huy-nguyen /types/react-swf/ @stepancar @@ -4166,7 +4448,7 @@ /types/react-toastr/ @shssoichiro @DanRegazzi /types/react-toggle/v2/ @LKay @jsonunger /types/react-toggle/ @LKay -/types/react-tooltip/ @DeividasBakanas +/types/react-tooltip/ @DeividasBakanas @Vijayasingam /types/react-touch/ @grzesie2k /types/react-tracking/ @alloy /types/react-transition-group/v1/ @LKay @@ -4177,26 +4459,28 @@ /types/react-user-tour/ @ccancellieri /types/react-vertical-timeline-component/ @stephane-monnot /types/react-virtual-keyboard/ @bsurai -/types/react-virtualized/ @kaoDev @guntherjh @wasd171 @szabolcsx @kraenhansen @Stevearzh @mgoszcz2 @brandonhall @sbusch +/types/react-virtualized/ @kaoDev @guntherjh @wasd171 @szabolcsx @Stevearzh @mgoszcz2 @brandonhall @sbusch /types/react-virtualized-select/ @seansfkelley /types/react-visibility-sensor/ @JRasmusBm @gcangussu /types/react-webcam/ @squat /types/react-weui/ @tairan -/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz @georg94 +/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz @georg94 @tzarger /types/react-widgets-moment/ @dawnmist /types/react-window/ @martynaskadisa /types/react-window-size/ @jakejrichards -/types/react-youtube/ @kgtkr +/types/react-wow/ @mikepthomas +/types/react-youtube/ @kgtkr @salguerooo /types/react-youtube-embed/ @charles-salmon /types/reactable/ @spielc /types/reactcss/ @chrisgervang @LKay /types/reactstrap/v4/ @alihammad @mfal @danilobjr @fabiopaiva -/types/reactstrap/ @alihammad @mfal @danilobjr @FaithForHumans @timc13 @patrickrgaffney @prabodht +/types/reactstrap/ @alihammad @mfal @danilobjr @FaithForHumans @timc13 @patrickrgaffney @prabodht @georg94 /types/read/ @timjk /types/read-chunk/ @crispybee /types/read-package-tree/ @mgroenhoff /types/read-pkg/ @jdxcode /types/read-pkg-up/ @dudeofawesome @jdxcode +/types/readable-stream/ @TeamworkGuy2 /types/readdir-enhanced/ @mrmlnc /types/readdir-stream/ @Bartvds /types/readline-sync/ @jonestristand @@ -4216,7 +4500,8 @@ /types/recorder-js/ @higuri /types/recursive-readdir/v1/ @elisee /types/recursive-readdir/ @elisee @MicahZoltu -/types/redis/ @soywiz @CodeAnimal @MugeSo @UppaJung @Rokt33r @43081j @barnski @1pete +/types/redent/ @BendingBender +/types/redis/ @soywiz @CodeAnimal @MugeSo @UppaJung @Rokt33r @43081j @barnski @1pete @blablapolicja @ferrantejake /types/redis-errors/ @43081j /types/redis-mock/ @BendingBender /types/redis-rate-limiter/ @westy92 @nodify-at @@ -4242,8 +4527,8 @@ /types/redux-first-router-restore-scroll/ @icopp /types/redux-first-routing/ @tlaziuk /types/redux-form/v4/ @aikoven -/types/redux-form/v6/ @carsonf @aikoven @LKay @bancek -/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun +/types/redux-form/v6/ @carsonf @aikoven @LKay @bancek @mshaaban088 +/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 /types/redux-immutable/v3/ @oizie @sebald @gavingregory /types/redux-immutable/ @oizie @sebald @gavingregory @lukyth /types/redux-immutable-state-invariant/ @remojansen @highflying @mihai-dinculescu @@ -4285,15 +4570,18 @@ /types/reflux/v0/ @mauricedb /types/reflux/ @mauricedb @LiangZugeng /types/registry-auth-token/ @mauricedb @LiangZugeng +/types/regression/ @MattiasMartens /types/relateurl/ @tkrotoff /types/relaxed-json/ @18steps /types/relay-runtime/ @voxmatt @alloy /types/rellax/ @shermendev -/types/remarkable/ @makepost +/types/remarkable/ @makepost @chigix +/types/remote-origin-url/ @BendingBender /types/remote-redux-devtools/ @ColinEberhardt @unindented @mamodom @colindekker /types/remove-markdown/ @RagibHasin /types/rename/ @Aankhen /types/replace-ext/ @DeividasBakanas +/types/replace-string/ @BendingBender /types/replacestream/ @dex4er /types/req-cwd/ @Alorel /types/request/ @soywiz @bonnici @Bartvds @joeskeen @ccurrens @lookfirst @mastermatt @josecolella @murbanowicz @@ -4301,6 +4589,7 @@ /types/request-ip/ @mrhen /types/request-promise/ @cglantschnig @joeskeen @AyaMorisawa @mastermatt /types/request-promise-native/ @gustavohenke @mastermatt +/types/request-stats/ @BendingBender /types/requestidlecallback/ @hax /types/requestretry/ @EricByers @trainerbill /types/require-dir/ @weekens @@ -4309,11 +4598,16 @@ /types/require-relative/ @MattiasBuelens /types/requirejs/ @jbaldwin /types/requirejs-domready/ @lefb766 +/types/requires-port/ @BendingBender /types/resemblejs/ @pimterry /types/reservoir/ @danvk /types/resize-img/ @higuri /types/resolve/ @marionebl @ajafff -/types/resolve-from/ @unional +/types/resolve-cwd/ @BendingBender +/types/resolve-from/v2/ @unional +/types/resolve-from/ @unional @BendingBender +/types/resolve-global/ @BendingBender +/types/resolve-pkg/ @mabels @BendingBender /types/resourcejs/ @shaunluttin /types/response-time/ @urossmolnik @TonyPythoneer @danmana /types/rest/ @Nemo157 @@ -4328,9 +4622,10 @@ /types/restify-plugins/ @KostyaTretyak /types/restler/ @cyrilschumacher /types/restling/ @loghorn +/types/restore-cursor/ @BendingBender /types/resumablejs/ @DanielMcAssey /types/rethinkdb/ @alexgorbatchev @AdrianFarmadin @kondi @hoishin -/types/retry/ @krenor +/types/retry/ @krenor @BendingBender /types/retry-as-promised/ @Raigen /types/rev-hash/ @ikatyang /types/revalidate/ @alex3165 @@ -4338,8 +4633,9 @@ /types/reveal/ @robertop87 @Nava2 /types/rewire/ @borislavjivkov @CaselIT /types/rfc2047/ @mugifly +/types/rgb-hex/ @BendingBender /types/rgrove__parse-xml/ @petejohanson -/types/rheostat/ @SashaBayan @kourge +/types/rheostat/ @SashaBayan @kourge @StefanWerW /types/rickshaw/ @niemyjski /types/rimraf/ @soywiz @e-cloud @bash /types/riot/ @Stubb0rn @@ -4353,12 +4649,16 @@ /types/rivets/ @TrevorDev @matjanos /types/rmc-drawer/ @Hoff97 /types/rmfr/ @pluma +/types/rn-fetch-blob/ @pengcao1 /types/roads/ @dancespiele /types/roads-server/ @dancespiele /types/rocksdb/ @MeirionHughes @danwbyrne /types/roll/ @icopp /types/rolling-rate-limiter/ @l-jonas +/types/rollup-plugin-commonjs/ @eoin-obrien /types/rollup-plugin-json/ @asmockler @hotell +/types/rollup-plugin-node-resolve/ @eoin-obrien +/types/rollup-plugin-sourcemaps/ @eoin-obrien /types/roman-numerals/ @pluma /types/ronomon__crypto-async/ @BendingBender /types/rosie/ @abner @subvertallchris @abukurov @adam187 @@ -4417,9 +4717,15 @@ /types/sanitize-filename/ @Nemo157 /types/sanitize-html/ @rogierschouten @afshin @BehindTheMath @biermeester @WillGibson @sirMerr /types/sap__xsenv/ @mad-mike +/types/sarif/ @rscrivens /types/sasl-anonymous/ @BendingBender +/types/sasl-digest-md5/ @BendingBender +/types/sasl-external/ @BendingBender +/types/sasl-plain/ @BendingBender +/types/sasl-scram-sha-1/ @BendingBender /types/saslmechanisms/ @BendingBender -/types/sass/ @lenovouser +/types/saslprep/ @BendingBender +/types/sass/ @lenovouser @jleider /types/sass-graph/ @marvinhagemeister /types/sass-webpack-plugin/ @AepKill /types/sat/ @omni360 @@ -4429,7 +4735,10 @@ /types/sc-broker/ @DanielRose /types/sc-broker-cluster/ @DanielRose /types/sc-channel/ @DanielRose +/types/sc-framework-health-check/ @DanielRose +/types/sc-hot-reboot/ @DanielRose /types/scalike/ @ryoppy +/types/scc-broker-client/ @DanielRose /types/schedule/ @Methuselah96 /types/scheduler/ @Methuselah96 /types/schema-registry/ @bonzzy @@ -4447,9 +4756,10 @@ /types/scrypt-async/ @xStrom @stesix /types/scrypt-js/ @danwbyrne /types/scryptsy/ @micksatana +/types/sdbm/ @BendingBender /types/sdp-transform/ @loc /types/seamless/ @danmana -/types/seamless-immutable/ @alex3165 @xsburg @geirsagberg @RMHonor +/types/seamless-immutable/ @alex3165 @xsburg @geirsagberg @RMHonor @pheromonez /types/season/ @dex4er /types/secp256k1/ @anler /types/seed-random/ @l-jonas @@ -4462,7 +4772,7 @@ /types/selectize/ @adidahiya @naBausch /types/selenium-standalone/ @SanderDeWaal1992 /types/selenium-webdriver/v2/ @BillArmstrong @Kuniwak @cnishina -/types/selenium-webdriver/ @BillArmstrong @Kuniwak @cnishina @SupernaviX @bendxn +/types/selenium-webdriver/ @BillArmstrong @Kuniwak @cnishina @SupernaviX @bendxn @oddui /types/semantic-ui/ @leonard-thieu /types/semantic-ui-accordion/ @leonard-thieu /types/semantic-ui-api/ @leonard-thieu @@ -4488,12 +4798,14 @@ /types/semver/ @Bartvds @BendingBender @LucianBuzzo /types/semver-compare/ @vincekovacs /types/semver-diff/ @chrismbarr +/types/semver-regex/ @BendingBender /types/semver-sort/ @LogvinovLeon +/types/semver-truncate/ @BendingBender /types/sencha_touch/ @brian428 /types/send/ @MikeJerred /types/seneca/ @psnider @kevynb /types/sequelize/v3/ @samuelneff @codeanimal @drinchev @morpheusxaut @torhal -/types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut @TitaneBoy @zjy01 @nidzov @Raigen @todd @nrschultz @thomas-b @Antoine38660 +/types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut @TitaneBoy @zjy01 @nidzov @Raigen @todd @nrschultz @thomas-b @Antoine38660 @smff /types/sequelize-cursor-pagination/ @pilagod /types/sequelize-fixtures/ @cschwarz /types/sequencify/ @npenin @@ -4515,30 +4827,36 @@ /types/set-value/ @DanielRosenwasser /types/setasap/ @djcsdy /types/settings/ @shreyjain1994 +/types/sha/ @oBusk /types/sha.js/ @BendingBender /types/sha1/ @arcdev1 /types/sha256/ @nhardy /types/shallow-equals/ @rsolomon -/types/shallowequal/ @seansfkelley +/types/shallowequal/v0/ @seansfkelley +/types/shallowequal/ @seansfkelley @BendingBender /types/shapefile/ @DenisCarriere @Thw0rted /types/sharedb/ @soney /types/sharedworker/ @nakakura /types/sharepoint/ @gandjustas @andrei-markeev @baywet @teroarvola @dennispg -/types/sharp/ @lith-light-g @wooseopkim @BTOdell +/types/sharp/ @lith-light-g @wooseopkim @BTOdell @JamieWoodbury +/types/shasum/ @TeamworkGuy2 +/types/shebang-command/ @BendingBender +/types/shebang-regex/ @BendingBender /types/sheetify/ @toddself /types/shell-escape/ @nenadalm -/types/shell-quote/ @jason0x43 -/types/shelljs/ @nikeee @voy @gkalpak @pheromonez +/types/shell-quote/ @jason0x43 @CameronDiver +/types/shelljs/ @nikeee @voy @gkalpak @pheromonez @aldafu /types/shelljs-exec-proxy/ @qlonik /types/shimmer/ @kjin /types/shipit/ @cyrilschumacher /types/shipit-utils/ @cyrilschumacher /types/shopify-buy/ @openminder @straiforos @totemika +/types/shorten-repo-url/ @BendingBender /types/shortid/ @stpettersens @despairblue /types/shot/v3/ @AJamesPhillips @SimonSchick /types/shot/ @AJamesPhillips @SimonSchick /types/should-sinon/ @Arylo -/types/showdown/ @cbowdon @tan9 @arielsaldana +/types/showdown/ @hamedbaatour @cbowdon @tan9 @arielsaldana /types/shpjs/ @littlebtc /types/shrink-ray/ @forabi /types/shuffle-seed/ @LeartS @@ -4546,11 +4864,13 @@ /types/siesta/ @bquarmby /types/sigmajs/ @qinfchen /types/sigmund/ @BendingBender +/types/signal-exit/ @BendingBender /types/signale/ @resir014 @kingdaro @rjoydip /types/signalr/ @borisyankov @keesey @GiedriusGrabauskas /types/signalr-no-jquery/ @gjoshevski /types/signals/ @diullei /types/signature_pad/ @AbubakerB @jrmihalick @leejaedus +/types/simpl-schema/ @arichter83 @Qkramer @deskoh /types/simple-assign/ @NoHomey /types/simple-cw-node/ @vvakame /types/simple-lru/ @NN--- @@ -4566,10 +4886,16 @@ /types/simplemde/ @Scalesoft /types/simplesmtp/ @rogierschouten /types/simplestorage.js/ @axelcostaspena @mxl +/types/sindresorhus__class-names/ @BendingBender /types/sindresorhus__df/ @whatknight +/types/sindresorhus__djb2a/ @BendingBender +/types/sindresorhus__fnv1a/ @BendingBender +/types/sindresorhus__slugify/ @cprecioso +/types/sindresorhus__string-hash/ @BendingBender +/types/sindresorhus__to-milliseconds/ @BendingBender /types/single-line-log/ @ffflorian -/types/single-spa-react/ @Garrett-Smith-iq -/types/sinon/ @mrbigdog2u @rationull @lumaxis @nicojs @43081j @joshuakgoldberg @gjednaszewski @johnjesse +/types/single-spa-react/ @Garrett-Smith-iq @chrisdopuch +/types/sinon/ @mrbigdog2u @rationull @lumaxis @nicojs @43081j @joshuakgoldberg @gjednaszewski @johnjesse @alecf @SimonSchick /types/sinon-as-promised/ @igrayson /types/sinon-chai/v2/ @kazimanzurrashid @jedmao /types/sinon-chai/ @kazimanzurrashid @jedmao @elpdpt @@ -4578,20 +4904,22 @@ /types/sinon-mongoose/ @stevehipwell /types/sinon-stub-promise/ @vintem @tstackhouse /types/sinon-test/ @mummybot -/types/sip.js/ @decyrus /types/sipml/ @chookies /types/sitemap2/ @shundy /types/six-runtime/ @493636333 /types/sizzle/ @leonard-thieu /types/sjcl/ @Evgenus /types/skatejs/ @Hotell +/types/sketchapp/ @manekinekko /types/ski/ @AyaMorisawa +/types/skin-tone/ @BendingBender /types/skyway/ @nakakura @izmhr /types/slack-mock/ @kkalavantavanich /types/slack-node/ @geoffreak /types/slack-winston/ @BlueHatbRit /types/slackdown/ @nju33 /types/slackify-html/ @hypexr +/types/slash/ @BendingBender /types/slate/ @andykent @majelbstoat @JanLoebel @YangusKhan @kalley @Kornil @isubasti @sgreav /types/slate-base64-serializer/ @YangusKhan /types/slate-html-serializer/ @YangusKhan @@ -4606,6 +4934,7 @@ /types/slocket/ @BendingBender /types/slug/ @mhegazy /types/smart-fox-server/ @ChanceM +/types/smart-truncate/ @oyalhi /types/smooth-scroll/ @andreiho /types/smoothscroll-polyfill/ @kryops /types/smtp-server/v1/ @markisme @Taisiias @@ -4613,10 +4942,10 @@ /types/smtpapi/ @a-morales /types/snakecase-keys/ @BendingBender /types/snappy/ @reconbot -/types/snapsvg/ @lhk @mattanja @kant2002 +/types/snapsvg/ @lhk @mattanja @kant2002 @terrymun /types/snazzy-info-window/ @milosd92 /types/snekfetch/ @ANekoIsFineToo @ShayBox @Dev-Yukine -/types/snoowrap/ @vitosamson @TheAppleFreak +/types/snoowrap/ @vitosamson @TheAppleFreak @willwull /types/snowball-stemmers/ @ryanvolum /types/snowboy/ @dolanmiu /types/socket.io/v1/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi @BrainMaestro @@ -4652,13 +4981,14 @@ /types/sparkpost/v1/ @geoffreak /types/sparkpost/ @geoffreak @bondz @vvu /types/sparqljs/ @AlexeyMz +/types/sparse-bitfield/ @BendingBender /types/spatialite/ @atd-schubert /types/spdx-correct/ @jinwoo /types/spdx-satisfies/ @jinwoo /types/spdy/ @tony19 /types/speakeasy/ @legendecas @mrOlorin @xeoneux /types/speakingurl/ @Goldsmith42 -/types/spectacle/ @zmaybury @kale-stew +/types/spected/ @benneq /types/spectrum/ @M-Zuber @Ailrun /types/split/ @marcinporebski /types/split.js/ @icholy @@ -4676,6 +5006,7 @@ /types/sqlite3/ @nmalaguti @dpyro @BehindTheMath /types/sqlstring/ @marvinhagemeister /types/squirejs/ @bradleyayers +/types/srcset/ @BendingBender /types/srp/ @Patman64 /types/ssh-key-decrypt/ @BendingBender /types/ssh2/ @tkQubo @rbuckton @wrboyce @lucasmotta @@ -4704,7 +5035,8 @@ /types/steam-totp/ @phenomax /types/steamid/ @Slessi /types/steed/ @Paul-Isache -/types/stellar-sdk/ @carl-foster @tristonj @pselden @maxbause @charlie-wasp +/types/stellar-base/ @carl-foster @tristonj @pselden @maxbause @charlie-wasp @Akuukis +/types/stellar-sdk/ @carl-foster @tristonj @pselden @maxbause @charlie-wasp @Akuukis /types/stemmer/ @will-ockmore /types/sticky-cluster/ @paustint /types/stompit/ @DanielRose @@ -4716,18 +5048,20 @@ /types/storybook-readme/ @lonyele /types/storybook__addon-a11y/ @hyunseob /types/storybook__addon-actions/ @joscha @jicjjang -/types/storybook__addon-backgrounds/ @hyunseob +/types/storybook__addon-backgrounds/ @hyunseob @adhrinae /types/storybook__addon-centered/ @kiyopikko /types/storybook__addon-info/ @mkornblum @fyrkant /types/storybook__addon-jest/ @halfmatthalfcat -/types/storybook__addon-knobs/ @joscha @martynaskadisa @amacleay +/types/storybook__addon-knobs/ @joscha @martynaskadisa @amacleay @MLoughry /types/storybook__addon-links/ @joscha @jessepinho -/types/storybook__addon-notes/ @joscha @amacleay +/types/storybook__addon-notes/ @joscha @amacleay @MLoughry /types/storybook__addon-options/ @joscha @simonhn @amacleay @gaetanmaisse @adam187 /types/storybook__addon-storyshots/ @bradleyayers +/types/storybook__addon-viewport/ @Vinnl /types/storybook__react/ @joscha @wapgear @dandean /types/storybook__react-native/ @joscha @wapgear @alechill @iRoachie @ceyhuno /types/storybook__vue/ @pntgupta +/types/strange/ @wanganjun /types/stream-array/ @Tyler-Murphy /types/stream-buffers/ @Jason3S /types/stream-chain/ @uhop @@ -4751,19 +5085,24 @@ /types/string-argv/ @vladimir-tikhonov /types/string-format/ @lal12 /types/string-hash/ @ethanrubio +/types/string-length/ @BendingBender /types/string-replace-webpack-plugin/ @pd4d10 -/types/string-similarity/ @ragtime +/types/string-similarity/v1/ @ragtime +/types/string-similarity/ @ragtime @BendingBender /types/string-template/ @TonyPythoneer /types/string-width/ @jacobbubu /types/string_score/ @marcinporebski +/types/stringify-attributes/ @BendingBender /types/stringify-object/ @khoomeister /types/strip-ansi/ @mhegazy /types/strip-bom/ @mhegazy +/types/strip-color/ @BendingBender +/types/strip-indent/ @BendingBender /types/strip-json-comments/ @dmoonfire -/types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU @brannon @kkamperschroer @starhoshi @bruun @galtalmor @htunnicliff @squirly @tzarger @ifiokjr +/types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU @brannon @kkamperschroer @starhoshi @bruun @galtalmor @htunnicliff @squirly @tzarger @ifiokjr @SimonSchick @yultyyev @cpsoinos /types/stripe-checkout/ @cgwrench /types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak -/types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak +/types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak @slangeder /types/stripejs/ @RobinvanTienhoven @mattferderer /types/strong-cluster-control/ @shuntksh /types/strong-error-handler/ @blankstar85 @@ -4775,7 +5114,7 @@ /types/styled-components/ @Igorbek @Igmat @lavoaster @Kovensky /types/styled-jsx/ @R1ZZU /types/styled-react-modal/ @Lavoaster -/types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster @jschuler +/types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster @jschuler @adam187 /types/styled-theming/ @ArjanJ /types/stylelint/v7/ @alan-agius4 /types/stylelint/ @alan-agius4 @filipsalpe @@ -4783,6 +5122,7 @@ /types/stylenames/ @bengry /types/stylus/ @SomaticIT /types/subscribe-ui-event/ @wangcheng678 +/types/subsume/v1/ @BendingBender /types/subsume/ @BendingBender /types/subtitle/ @jenglamlow /types/succinct/ @EnableSoftware @@ -4837,12 +5177,14 @@ /types/swig-email-templates/ @mrhen @micksatana /types/swipe/ @kant2002 /types/swiper/v3/ @sgaliano @lucax88x -/types/swiper/ @sgaliano @lucax88x @ematseruk @odahcam @jmca +/types/swiper/ @sgaliano @lucax88x @ematseruk @odahcam @jmca @daem0ndev /types/swipeview/ @borisyankov /types/switchery/ @bgrieder @claylaut /types/swiz/ @jedigo /types/sylvester/ @StephaneAlie +/types/symlink-or-copy/ @BendingBender /types/synaptic/ @ToastHawaii @austincummings +/types/syntax-error/ @TeamworkGuy2 /types/systeminformation/ @PixelcrabAT /types/systemjs/ @ludohenin @NathanWalker @GiedriusGrabauskas @aluanhaddad /types/tabbable/ @mokkan @@ -4855,11 +5197,12 @@ /types/tail/ @spacejack /types/tapable/v0/ @e-cloud /types/tapable/ @e-cloud @johnnyreilly -/types/tape/ @Bartvds @sodatea @DennisSchwartz @mikehenrty +/types/tape/ @Bartvds @sodatea @DennisSchwartz @mikehenrty @rostrowski /types/tar/ @SomaticIT @connor4312 /types/tar-fs/ @Umoxfo /types/tar-stream/ @glicht /types/task-graph-runner/ @mgroenhoff +/types/task-worklet/ @karol-majewski /types/tcp-ping/ @stegano /types/tcp-port-used/ @gautejohan /types/teddy/ @lannonbr @@ -4867,12 +5210,17 @@ /types/tedious-connection-pool/ @sandorfr /types/telebot/ @mariotsi /types/temp/ @DanielRosenwasser +/types/temp-dir/ @BendingBender /types/temp-write/ @BendingBender /types/tempfile/ @SamVerschueren @BendingBender /types/tempy/ @douglasduteil @maistho +/types/term-size/ @BendingBender +/types/terminal-image/ @BendingBender +/types/terminal-link/ @BendingBender /types/terminal-menu/ @aravindarun /types/tern/ @nkappler /types/terser/ @JordiAnderl +/types/terser-webpack-plugin/ @Danscho /types/test-console/ @roberto @guidoux @gbmoretti /types/test-listen/ @stephenmathieson /types/testingbot-api/ @timbru31 @@ -4884,6 +5232,7 @@ /types/text-encoding-utf-8/ @trxcllnt /types/text-table/ @saadq /types/textarea-caret/ @shiftkey +/types/textextensions/ @BendingBender /types/textract/ @lal12 /types/textversionjs/ @aaronosher /types/texzilla/ @m93a @@ -4891,7 +5240,7 @@ /types/theming/ @eps1lon /types/theo/ @petekp /types/thepiratebay/ @jsorrell -/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv @apurvaojas @NotWoods @sethk @elk941 @Methuselah96 @Dukuo @JulianSSS @devilsparta @KonstantinLukaschenko +/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv @apurvaojas @NotWoods @sethk @elk941 @Methuselah96 @Dukuo @JulianSSS @devilsparta @KonstantinLukaschenko @danyim /types/three-tds-loader/ @KonstantinLukaschenko @sschoensee /types/thrift/ @kamek-pf @kevin-greene-ck @jessezhang91 /types/throng/ @cyrilschumacher @tatethurston @@ -4931,6 +5280,7 @@ /types/to-absolute-glob/ @ajafff /types/to-camel-case/ @j-f1 /types/to-markdown/ @SuperPaintman +/types/to-semver/ @BendingBender /types/to-snake-case/ @LogvinovLeon /types/to-title-case-gouch/ @stpettersens /types/toastr/ @borisyankov @@ -4938,6 +5288,7 @@ /types/tokgen/ @l-jonas /types/toobusy-js/ @atd-schubert @BendingBender /types/tooltipster/ @stephenlautier @pjmagee @VorobeY1326 @leonard-thieu @janhi @joeskeen +/types/topo/ @BendingBender /types/topojson/ @ricardo-mello @chenzhutian @denisname /types/topojson-client/ @denisname @ricardo-mello /types/topojson-simplify/ @denisname @ricardo-mello @@ -4954,18 +5305,23 @@ /types/transducers-js/ @colinkahn @dphilipson @NaridaL /types/transducers.js/ @dphilipson /types/transliteration/ @tony19 -/types/trash/ @matthew-matvei @hoishin +/types/trash/ @matthew-matvei @hoishin @BendingBender /types/traverse/ @newclear /types/traverson/ @marcinporebski /types/travis-fold/ @andy-ms /types/trayballoon/ @korve +/types/treeify/ @mike-north /types/tress/ @sindilevich +/types/trezor-connect/ @federicobond /types/trianglify/ @unindented +/types/trie-prefix-tree/ @jlismore /types/trim/ @skysteve /types/triple-beam/ @danwbyrne /types/triplesec/ @threesquared /types/trunk8/ @niemyjski +/types/trusted-types/ @vrana /types/tryer/ @bengry +/types/ts-nameof/ @dsherret /types/tspromise/ @soywiz /types/ttf2woff2/ @ThomasdenH /types/tunnel/ @BendingBender @@ -4974,16 +5330,18 @@ /types/tween.js/ @Amos47 @sunetos @jzarnikov @alexburner /types/tweenjs/ @evilangelist @jcyuan /types/tweezer.js/ @praxxis -/types/twig/ @soywiz @enko +/types/twig/ @soywiz @enko @mtizziani /types/twilio/ @nickiannone @ashleybrener /types/twilio-common/ @gatimus /types/twilio-video/ @minddocdev @darioblanco /types/twit/ @Volox @sapphiredev @abraham @siwalikm @plhery /types/twitch-ext/ @beheh -/types/twitter/ @chitoku-k +/types/twitter/ @BendingBender +/types/twitter-for-web/ @chitoku-k /types/twitter-stream-channels/ @adrianbardan /types/twitter-text/ @rhysd /types/twix/ @j3ko +/types/two.js/ @cprecioso /types/type-check/ @hansrwindhoff /types/type-detect/v0/ @Bartvds /types/type-detect/ @Bartvds @@ -4993,14 +5351,17 @@ /types/typedarray-pool/ @pawsong /types/typeof/ @OpenByteDev /types/typescript-deferred/ @DirtyHairy -/types/typography/ @boyeborg +/types/typography/ @boyeborg @krzysztofzuraw @dominicfallows +/types/typpy/ @BendingBender /types/tz-format/ @samverschueren /types/ua-parser-js/ @superduper @legendecas @MeLlamoPablo +/types/ua-string/ @BendingBender /types/uglify-es/ @alan-agius4 /types/uglify-js/v2/ @tkrotoff /types/uglify-js/ @alan-agius4 @tkrotoff @johnnyreilly /types/uglifycss/ @blendsdk /types/uglifyjs-webpack-plugin/ @vajkayrene +/types/ui-box/ @nettofarah /types/ui-grid/ @btesser @joeskeen @pbojanczyk /types/ui-router-extras/ @mputters @marcel-k @LaserUnicorns /types/ui-select/ @nkovacic @@ -5011,6 +5372,7 @@ /types/umbraco/ @DeCareSystemsIreland /types/umd/ @TeamworkGuy2 /types/umzug/ @drinchev @mlamp @trodi @emmanuelgautier +/types/unc-path-regex/ @BendingBender /types/underscore/ @borisyankov @jbaldwin @ccurrens @clottman @confususs /types/underscore-ko/ @MagicMau /types/underscore.string/ @rygine @@ -5022,12 +5384,12 @@ /types/unique-hash-stream/ @BendingBender /types/unique-random/ @Kuniwak /types/unique-random-array/ @BendingBender +/types/unique-string/ @BendingBender /types/unist/ @bizen241 @lujun2 @hrajchert @wooorm @rokt33r /types/unist-util-is/ @rokt33r /types/unity-webapi/ @jmvrbanac /types/universal-analytics/ @Bartvds @DarkerTV /types/universal-cookie/ @tomi -/types/universal-router/ @jtmthf @tlaziuk @Lodin /types/unorm/ @chbrown /types/untildify/ @BendingBender /types/unused-filename/ @BendingBender @@ -5042,15 +5404,18 @@ /types/uri-templates/ @Bartvds @barnski /types/urijs/ @RodneyJT @xt0rted @petejohanson /types/uritemplate/ @teyc @rubensworks +/types/urix/ @BendingBender /types/url-assembler/ @wolfgang42 -/types/url-join/ @rogierschouten @devrelm +/types/url-join/v0/ @rogierschouten @devrelm +/types/url-join/ @rogierschouten @devrelm @BendingBender /types/url-metadata/ @mrkmg /types/url-params/ @danielsogl -/types/url-parse/ @ChernenkoPaul @harisiva @DimitryDushkin +/types/url-parse/ @ChernenkoPaul @harisiva @DimitryDushkin @davidgoli /types/url-regex/ @unindented @sosukesuzuki /types/url-safe-base64/ @johngeorgewright /types/url-search-params/ @nick121212 @nrathi /types/url-template/ @marcinporebski +/types/urlencode/ @kimcoder /types/urllib/ @sorayama /types/urlparser/ @OpenByteDev /types/urlrouter/ @soywiz @@ -5079,15 +5444,16 @@ /types/valiant/ @whatasoda /types/valid-url/ @stevehipwell /types/validator/ @tgfjt @chrootsu @IOAyman @louy @kacepe @deptno @builtinnya @qqilihq -/types/validatorjs/ @LKay @danmana +/types/validatorjs/ @LKay @danmana @MatiasOlivera /types/vanilla-modal/ @samnau /types/vanilla-tilt/ @BrunnerLivio /types/varint/ @dbrockman /types/vary/ @BendingBender -/types/vast-client/ @jgainfort +/types/vast-client/ @jgainfort @kobawan /types/vec3/ @xstoudi /types/vectorious/ @erikgerrits /types/velocity-animate/ @smrq +/types/venn/ @marcwjj /types/verror/ @svi3c @max4t /types/vertx3-eventbus-client/ @oddeirik /types/vex-js/ @gdcohan @@ -5096,7 +5462,7 @@ /types/vfile/ @bizen241 @rokt33r /types/vfile-location/ @ikatyang @rokt33r /types/vfile-message/ @rokt33r -/types/victory/ @asvetliakov @snerks @Havret @alredyExist +/types/victory/ @asvetliakov @snerks @Havret @alredyExist @jlismore /types/video.js/ @vbortone @scleriot @SWBennett06 @IgelCampus @giofreitas @gjanblaszczyk @sroucheray @AkxeOne @meikidd /types/viewability-helper/ @lironzluf /types/viewerjs/ @lrh3321 @@ -5130,18 +5496,21 @@ /types/vue-scrollto/ @vincekovacs /types/vue-select/ @silh /types/vue2-datepicker/ @ChristianStornowski -/types/vuelidate/ @janesser +/types/vuelidate/ @janesser @jubairsaidi /types/vuex-i18n/ @jaeggerr @noamkfir @barahliush /types/w2ui/ @Ptival +/types/w3c-css-typed-object-model-level-1/ @yavanosta /types/w3c-generic-sensor/ @kenchris /types/w3c-image-capture/ @cosium /types/w3c-permissions/ @jberube /types/w3c-screen-orientation/ @kenchris /types/w3c-web-usb/ @larsgk +/types/wait-for-localhost/ @BendingBender /types/waitme/ @totpero /types/wake_on_lan/ @SrTobi /types/walk/ @poppa /types/wallabyjs/ @andrewconnell +/types/wallop/ @leemcd56 /types/wallpaper/ @BendingBender /types/wampy/ @KSDaemon /types/warning/ @cvle @@ -5155,12 +5524,12 @@ /types/wcag-contrast/ @plantain-00 /types/wcwidth/ @rokt33r /types/weak/ @int0h -/types/weapp-api/ @vargeek +/types/weapp-api/ @vargeek @pbestz /types/web-animations-js/ @kritollm /types/web-bluetooth/ @urish /types/web-push/ @paullessing /types/web-resource-inliner/ @BendingBender -/types/web3/ @simon-jentzsch @nitzantomer @zurbo @yxliang01 @phra @naddison36 @icaroharry @linusnorton @jpeletier @anneau @matrushka @andrevmatos @levino @zlumer @archangel-irk @sogasg @donamk @dkent600 @nerddan +/types/web3/ @simon-jentzsch @nitzantomer @zurbo @yxliang01 @phra @naddison36 @icaroharry @linusnorton @jpeletier @anneau @matrushka @andrevmatos @levino @zlumer @archangel-irk @sogasg @donamk @dkent600 @nerddan @alexkvak /types/web3-eth-abi/ @LogvinovLeon /types/web3-provider-engine/ @LogvinovLeon /types/webappsec-credential-management/ @iainmcgin @@ -5169,14 +5538,14 @@ /types/webcl/ @NCARalph /types/webcomponents.js/ @adidahiya /types/webcrypto/ @iislucas -/types/webdriverio/ @nmalaguti @timbru31 @fsmedberg-tc @tanvirislam06 @daveparslow @phil-lgr +/types/webdriverio/ @nmalaguti @timbru31 @fsmedberg-tc @tanvirislam06 @daveparslow @phil-lgr @mroggy85 /types/webfontloader/ @doskallemaskin /types/webgl-ext/ @zenmumbler /types/webgl2/ @nkemnitz @karhu /types/webidl2/ @saschanaz /types/webmidi/ @lostfictions /types/webpack/v3/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @alan-agius4 @elliottsj @jason0x43 @christophehurpeau @rwaskiewicz @kuehlein -/types/webpack/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @alan-agius4 @elliottsj @jason0x43 @dennispg @christophehurpeau @ZSkycat @johnnyreilly @rwaskiewicz @kuehlein +/types/webpack/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @alan-agius4 @elliottsj @jason0x43 @dennispg @christophehurpeau @ZSkycat @johnnyreilly @rwaskiewicz @kuehlein @grgur /types/webpack-assets-manifest/ @FranklinWhale /types/webpack-bundle-analyzer/ @kryops /types/webpack-chain/ @eirikurn @psachs21 @@ -5226,8 +5595,10 @@ /types/whatwg-url/ @aomarks /types/wheel/ @BTOdell /types/when/ @derekcicerone @Nemo157 +/types/when-dom-ready/ @BendingBender /types/which/ @vvakame @cspotcode /types/which-pm/ @jorgegonzalez +/types/whitelist-object/ @BendingBender /types/wicg-mediasession/ @jucrouzet /types/wif/ @danwbyrne /types/wiiu/ @mzsm @@ -5255,6 +5626,8 @@ /types/wordcloud/ @joeskeen /types/words-to-numbers/ @James-Frowen /types/workbox-sw/ @wessberg +/types/workbox-webpack-plugin/ @kgroat +/types/worker-threads-pool/ @BendingBender /types/workerpool/ @Alorel /types/wpapi/ @guoyunhe /types/wrap-ansi/v2/ @kayahr @@ -5283,6 +5656,7 @@ /types/xmldoc/ @Xstoudi @ajsheehan @notlaforge /types/xmldom/ @tkqubo /types/xmlpoke/ @garthk +/types/xmlserializer/ @eoin-obrien /types/xmltojson/ @traviscrowe /types/xmpp__jid/ @PJakcson @BendingBender /types/xmpp__xml/ @BendingBender @@ -5295,13 +5669,13 @@ /types/xxhashjs/ @mDibyo /types/yallist/ @BendingBender /types/yaml/ @ikatyang @ColinBradley -/types/yandex-maps/ @Delagen +/types/yandex-maps/ @Delagen @gastwork13 /types/yandex-money-sdk/ @chrootsu /types/yar/ @SimonSchick /types/yargs/v8/ @poelstra @mizunashi-mana @pushplay @jeffkenney /types/yargs/v10/ @poelstra @mizunashi-mana @pushplay @jeffkenney @JimiC /types/yargs/v11/ @poelstra @mizunashi-mana @pushplay @jeffkenney @JimiC -/types/yargs/ @poelstra @mizunashi-mana @pushplay @jeffkenney @JimiC @tkazec +/types/yargs/ @poelstra @mizunashi-mana @pushplay @jeffkenney @JimiC @steffenvv /types/yargs-interactive/ @szeck87 /types/yargs-parser/ @milesj /types/yauzl/ @ffflorian @@ -5309,10 +5683,12 @@ /types/yayson/ @Codesleuth /types/yazl/ @taoqf @seangenabe /types/ydn-db/ @yathit @gabrielmaldi +/types/year-days/ @BendingBender /types/yeoman-assert/ @Toilal /types/yeoman-generator/ @armorik83 @janslow @ikatyang @tasadar2 /types/yeoman-test/ @ikatyang /types/yesql/ @Sumolari +/types/yn/ @BendingBender /types/yoctodelay/ @seangenabe /types/yog-bigpipe/ @ssddi456 /types/yog-log/ @ssddi456 @@ -5320,9 +5696,9 @@ /types/yoga-layout/ @tnobody /types/yosay/ @armorik83 /types/youtube/ @DazWilkin @JoshuaKGoldberg @eliotfallon213 @terrymun @paulhobbel -/types/youtube-dl/ @bsurai +/types/youtube-dl/ @bsurai @moshfeu /types/yui/ @giabao -/types/yup/ @dhardtke @vtserman @MoretonBayRC @sseppola @YashdalfTheGray @vincentjames501 +/types/yup/ @dhardtke @vtserman @MoretonBayRC @sseppola @YashdalfTheGray @vincentjames501 @robertbullen @sat0yu /types/z-schema/ @pgonzal /types/zapier-platform-core/ @bradleyayers /types/zeit__next-typescript/ @icopp diff --git a/README.md b/README.md index 4343577bd0..bbf2a6f16e 100644 --- a/README.md +++ b/README.md @@ -255,12 +255,30 @@ Here are the [currently requested definitions](https://github.com/DefinitelyType If types are part of a web standard, they should be contributed to [TSJS-lib-generator](https://github.com/Microsoft/TSJS-lib-generator) so that they can become part of the default `lib.dom.d.ts`. +#### Should I add an empty namespace to a package that doesn't export a module to use ES6 style imports? + +Some packages, like [chai-http](https://github.com/chaijs/chai-http), export a function. + +Importing this module with an ES6 style import in the form `import * as foo from "foo";` leads to the error: + +> error TS2497: Module 'foo' resolves to a non-module entity and cannot be imported using this construct + +This error can be suppressed by merging the function declaration with an empty namespace of the same name, but this practice is discouraged. +This is a commonly cited [Stack Overflow answer](https://stackoverflow.com/questions/39415661/what-does-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this) regarding this matter. + +It is more appropriate to import the module using the `import foo = require("foo");` syntax. +Nevertheless, if you want to use a default import like `import foo from "foo";` you have two options: +- you can use the [`--allowSyntheticDefaultImports` compiler option](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-8.html#support-for-default-import-interop-with-systemjs) if your module runtime supports an interop scheme for non-ECMAScript modules, i.e. if default imports work in your environment (e.g. Webpack, SystemJS, esm). +- you can use the [`--esModuleInterop` compiler option](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#support-for-import-d-from-cjs-form-commonjs-modules-with---esmoduleinterop) if you want TypeScript to take care of non-ECMAScript interop (since Typescript 2.7). + #### A package uses `export =`, but I prefer to use default imports. Can I change `export =` to `export default`? -If you are using TypeScript 2.7 or later, use `--esModuleInterop` in your project. -Otherwise, if default imports work in your environment (e.g. Webpack, SystemJS, esm), consider turning on the [`--allowSyntheticDefaultImports`](http://www.typescriptlang.org/docs/handbook/compiler-options.html) compiler option. +Like in the previous question, refer to using either the [`--allowSyntheticDefaultImports`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-8.html#support-for-default-import-interop-with-systemjs) +or [`--esModuleInterop`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#support-for-import-d-from-cjs-form-commonjs-modules-with---esmoduleinterop) +compiler options. + 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. +For an NPM package, `export =` is accurate if `node -p 'require("foo")'` works to import a module, and `export default` is accurate if `node -p 'require("foo").default'` works to import a module. #### I want to use features from TypeScript 2.1 or above. @@ -268,8 +286,9 @@ Then you will have to add a comment to the last line of your definition header ( #### I want to use features from TypeScript 3.1 or above. -You will need to use the `typesVersions` feature of TypeScript 3.1 and above. You can find a detailed explanation -of this feature in the [official TypeScript documentation](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#version-selection-with-typesversions). +You can use the same `// TypeScript Version: 3.1` comment as above. +However, if your project needs to maintain types that are compatible with 3.1 and above *at the same time as* types that are compatible with 3.0 or below, you will need to use the `typesVersions` feature, which is available in TypeScript 3.1 and above. +You can find a detailed explanation of this feature in the [official TypeScript documentation](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#version-selection-with-typesversions). Here's a short explanation to get you started: @@ -368,19 +387,6 @@ When `dts-gen` is used to scaffold a scoped package, the `paths` property has to 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. -#### Should I add an empty namespace to a package that doesn't export a module to use ES6 style imports? - -Some packages, like [chai-http](https://github.com/chaijs/chai-http), export a function. - -Importing this module with an ES6 style import in the form `import * as foo from "foo";` leads to the error: - -> error TS2497: Module 'foo' resolves to a non-module entity and cannot be imported using this construct - -This error can be suppressed by merging the function declaration with an empty namespace of the same name, but this practice is discouraged. -This is a commonly cited [Stack Overflow answer](https://stackoverflow.com/questions/39415661/what-does-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this) regarding this matter. - -It is more appropriate to import the module using the `import foo = require("foo");` syntax, or to use a default import like `import foo from "foo";` if using the `--allowSyntheticDefaultImports` flag if your module runtime supports an interop scheme for non-ECMAScript modules as such. - ## License This project is licensed under the MIT license. diff --git a/notNeededPackages.json b/notNeededPackages.json index 7882451204..2a645f9c93 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1728,6 +1728,12 @@ "sourceRepoURL": "https://github.com/tgdwyer/WebCola", "asOfVersion": "3.2.0" }, + { + "libraryName": "WebdriverIO", + "typingsPackageName": "webdriverio", + "sourceRepoURL": "git@github.com:webdriverio/webdriverio.git", + "asOfVersion": "5.0.0" + }, { "libraryName": "webgme", "typingsPackageName": "webgme", diff --git a/types/amplitude-js/amplitude-js-tests.ts b/types/amplitude-js/amplitude-js-tests.ts index c5ffbe9898..0b6bb49751 100644 --- a/types/amplitude-js/amplitude-js-tests.ts +++ b/types/amplitude-js/amplitude-js-tests.ts @@ -1,5 +1,7 @@ // Tests for Amplitude SDK TypeScript definitions +import amplitude = require('amplitude-js'); + module Amplitude.Tests { function all() { diff --git a/types/amplitude-js/index.d.ts b/types/amplitude-js/index.d.ts index 1cdb843589..10465f6647 100644 --- a/types/amplitude-js/index.d.ts +++ b/types/amplitude-js/index.d.ts @@ -4,143 +4,142 @@ // Dan Manastireanu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module amplitude { +export as namespace amplitude; - type Callback = (responseCode: number, responseBody: string, details?: { reason: string; }) => void; - type LogReturn = number | void; +type Callback = (responseCode: number, responseBody: string, details?: { reason: string; }) => void; +type LogReturn = number | void; - interface Config { - apiEndpoint?: string; - batchEvents?: boolean; - cookieExpiration?: number; - cookieName?: string; - userId?: string; - deviceId?: string; - deviceIdFromUrlParam?: boolean; - domain?: string; - eventUploadPeriodMillis?: number; - eventUploadThreshold?: number; - forceHttps?: boolean; - includeGclid?: boolean; - includeReferrer?: boolean; - includeUtm?: boolean; - language?: string; - logLevel?: 'DISABLE' | 'ERROR' | 'WARN' | 'INFO'; - optOut?: boolean; - platform?: string; - saveEvents?: boolean; - savedMaxCount?: number; - saveParamsReferrerOncePerSession?: boolean; - sessionTimeout?: number; - trackingOptions?: { - city?: boolean; - country?: boolean; - device_model?: boolean; - dma?: boolean; - ip_address?: boolean; - language?: boolean; - os_name?: boolean; - os_version?: boolean; - platform?: boolean; - region?: boolean; - version_name?: boolean; - }, - unsentKey?: string; - unsentIdentifyKey?: string; - uploadBatchSize?: number; - } - - export class Identify { - set(key: string, value: any): Identify; - setOnce(key: string, value: any): Identify; - add(key: string, value: number | string): Identify; - append(key: string, value: any): Identify; - prepend(key: string, value: any): Identify; - - unset(key: string): Identify; - } - - export class Revenue { - - setProductId(productId: string): Revenue; - setQuantity(quantity: number): Revenue; - setPrice(price: number): Revenue; - setRevenueType(revenueType: string): Revenue; - setEventProperties(eventProperties: any): Revenue; - } - - export class AmplitudeClient { - - constructor(instanceName?: string); - - options: Config; - - init(apiKey: string, userId?: string, config?: Config, callback?: (client: AmplitudeClient) => void): void; - - setVersionName(versionName: string): void; - - isNewSession(): boolean; - setSessionId(sessionId: number): void; - getSessionId(): number; - - setDomain(domain: string): void; - setUserId(userId: string): void; - - setDeviceId(id: string): void; - regenerateDeviceId(): void; - - identify(identify_obj: Identify, opt_callback?: Callback): void; - - setUserProperties(properties: any): void; - setGlobalUserProperties(properties: any): void; - clearUserProperties(): void; - - setOptOut(enable: boolean): void; - - setGroup(groupType: string, groupName: string | string[]): void; - - logEvent(event: string, data?: any, callback?: Callback): LogReturn; - logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn; - logRevenueV2(revenue_obj: Revenue): LogReturn; - logRevenue(pric: number, quantity: number, product: string): LogReturn; - logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn; - } - - // Proxy methods that get executed on the default AmplitudeClient instance (not all client methods are proxied) - - export function init(apiKey: string, userId?: string, options?: Config, callback?: (client: AmplitudeClient) => void): void; - - export function setVersionName(version: string): void; - - export function isNewSession(): boolean; - export function getSessionId(): number; - - export function setDomain(domain: string): void; - - export function setUserId(userId: string): void; - - export function setDeviceId(id: string): void; - export function regenerateDeviceId(): void; - - export function identify(identify: Identify, callback?: Callback): void; - - export function setUserProperties(properties: any): void; - export function setGlobalUserProperties(properties: any): void; - export function clearUserProperties(): void; - - export function setOptOut(optOut: boolean): void; - - export function setGroup(groupType: string, groupName: string | string[]): void; - - export function logEvent(event: string, data?: any, callback?: Callback): LogReturn; - export function logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn; - export function logRevenueV2(revenue_obj: Revenue): LogReturn; - export function logRevenue(pric: number, quantity: number, product: string): LogReturn; - export function logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn; - - - - export function getInstance(instanceName?: string): AmplitudeClient; - export const __VERSION__: string; - export var options: Config; +interface Config { + apiEndpoint?: string; + batchEvents?: boolean; + cookieExpiration?: number; + cookieName?: string; + userId?: string; + deviceId?: string; + deviceIdFromUrlParam?: boolean; + domain?: string; + eventUploadPeriodMillis?: number; + eventUploadThreshold?: number; + forceHttps?: boolean; + includeGclid?: boolean; + includeReferrer?: boolean; + includeUtm?: boolean; + language?: string; + logLevel?: 'DISABLE' | 'ERROR' | 'WARN' | 'INFO'; + optOut?: boolean; + platform?: string; + saveEvents?: boolean; + savedMaxCount?: number; + saveParamsReferrerOncePerSession?: boolean; + sessionTimeout?: number; + trackingOptions?: { + city?: boolean; + country?: boolean; + device_model?: boolean; + dma?: boolean; + ip_address?: boolean; + language?: boolean; + os_name?: boolean; + os_version?: boolean; + platform?: boolean; + region?: boolean; + version_name?: boolean; + }, + unsentKey?: string; + unsentIdentifyKey?: string; + uploadBatchSize?: number; } + +export class Identify { + set(key: string, value: any): Identify; + setOnce(key: string, value: any): Identify; + add(key: string, value: number | string): Identify; + append(key: string, value: any): Identify; + prepend(key: string, value: any): Identify; + + unset(key: string): Identify; +} + +export class Revenue { + + setProductId(productId: string): Revenue; + setQuantity(quantity: number): Revenue; + setPrice(price: number): Revenue; + setRevenueType(revenueType: string): Revenue; + setEventProperties(eventProperties: any): Revenue; +} + +export class AmplitudeClient { + + constructor(instanceName?: string); + + options: Config; + + init(apiKey: string, userId?: string, config?: Config, callback?: (client: AmplitudeClient) => void): void; + + setVersionName(versionName: string): void; + + isNewSession(): boolean; + setSessionId(sessionId: number): void; + getSessionId(): number; + + setDomain(domain: string): void; + setUserId(userId: string): void; + + setDeviceId(id: string): void; + regenerateDeviceId(): void; + + identify(identify_obj: Identify, opt_callback?: Callback): void; + + setUserProperties(properties: any): void; + setGlobalUserProperties(properties: any): void; + clearUserProperties(): void; + + setOptOut(enable: boolean): void; + + setGroup(groupType: string, groupName: string | string[]): void; + + logEvent(event: string, data?: any, callback?: Callback): LogReturn; + logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn; + logRevenueV2(revenue_obj: Revenue): LogReturn; + logRevenue(pric: number, quantity: number, product: string): LogReturn; + logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn; +} + +// Proxy methods that get executed on the default AmplitudeClient instance (not all client methods are proxied) + +export function init(apiKey: string, userId?: string, options?: Config, callback?: (client: AmplitudeClient) => void): void; + +export function setVersionName(version: string): void; + +export function isNewSession(): boolean; +export function getSessionId(): number; + +export function setDomain(domain: string): void; + +export function setUserId(userId: string): void; + +export function setDeviceId(id: string): void; +export function regenerateDeviceId(): void; + +export function identify(identify: Identify, callback?: Callback): void; + +export function setUserProperties(properties: any): void; +export function setGlobalUserProperties(properties: any): void; +export function clearUserProperties(): void; + +export function setOptOut(optOut: boolean): void; + +export function setGroup(groupType: string, groupName: string | string[]): void; + +export function logEvent(event: string, data?: any, callback?: Callback): LogReturn; +export function logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn; +export function logRevenueV2(revenue_obj: Revenue): LogReturn; +export function logRevenue(pric: number, quantity: number, product: string): LogReturn; +export function logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn; + + + +export function getInstance(instanceName?: string): AmplitudeClient; +export const __VERSION__: string; +export var options: Config; diff --git a/types/asn1/asn1-tests.ts b/types/asn1/asn1-tests.ts new file mode 100644 index 0000000000..f37541b03e --- /dev/null +++ b/types/asn1/asn1-tests.ts @@ -0,0 +1,88 @@ +import { Ber, BerReader, BerWriter } from 'asn1'; + +let buf: Buffer = Buffer.alloc(0); +let bool = false; +let str = ''; +let num = 0; +let numOrNull: number | null = 0; +const roStrArray: ReadonlyArray = [str]; + +const reader = new BerReader(buf); +numOrNull = reader.peek(); +bool = reader.readBoolean(); +numOrNull = reader.readByte(bool); +num = reader.readEnumeration(); +num = reader.readInt(); +num = reader.readLength(); +num = reader.readLength(num); +str = reader.readOID(); +str = reader.readOID(num); +numOrNull = reader.readSequence(); +numOrNull = reader.readSequence(num); +str = reader.readString(); +str = reader.readString(num); +buf = reader.readString(num, bool); +num = reader._readTag(); +num = reader._readTag(num); + +let writer = new BerWriter(); +writer = new BerWriter({ + size: num, + growthFactor: num, +}); + +buf = writer.buffer; +buf = writer._buf; +num = writer._size; +num = writer._offset; + +writer.endSequence(); +writer.startSequence(); +writer.startSequence(num); +writer.writeBoolean(bool); +writer.writeBoolean(bool, num); +writer.writeBuffer(buf, num); +writer.writeByte(num); +writer.writeEnumeration(num); +writer.writeEnumeration(num, num); +writer.writeInt(num); +writer.writeInt(num, num); +writer.writeLength(num); +writer.writeNull(); +writer.writeOID(str, num); +writer.writeString(str); +writer.writeString(str, num); +writer.writeStringArray(roStrArray); +writer._ensure(num); + +num = Ber.BMPString; +num = Ber.BitString; +num = Ber.Boolean; +num = Ber.CharacterString; +num = Ber.Constructor; +num = Ber.Context; +num = Ber.EOC; +num = Ber.Enumeration; +num = Ber.External; +num = Ber.GeneralString; +num = Ber.GeneralizedTime; +num = Ber.GraphicString; +num = Ber.IA5String; +num = Ber.Integer; +num = Ber.Null; +num = Ber.NumericString; +num = Ber.OID; +num = Ber.ObjectDescriptor; +num = Ber.OctetString; +num = Ber.PDV; +num = Ber.PrintableString; +num = Ber.Real; +num = Ber.RelativeOID; +num = Ber.Sequence; +num = Ber.Set; +num = Ber.T61String; +num = Ber.UTCTime; +num = Ber.UniversalString; +num = Ber.Utf8String; +num = Ber.VideotexString; +num = Ber.VisibleString; diff --git a/types/asn1/index.d.ts b/types/asn1/index.d.ts new file mode 100644 index 0000000000..3f7de44af8 --- /dev/null +++ b/types/asn1/index.d.ts @@ -0,0 +1,126 @@ +// Type definitions for asn1 0.2 +// Project: https://github.com/joyent/node-asn1 +// Definitions by: Jim Geurts +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 +/// + +export class BerReader { + readonly buffer: Buffer; + readonly offset: number; + readonly length: number; + readonly remain: number; + readonly _buf: Buffer; + _size: number; + _offset: number; + + constructor(data: Buffer); + + peek(): number | null; + readBoolean(): boolean; + readByte(peek: boolean): number | null; + readEnumeration(): number; + readInt(): number; + readLength(offset?: number): number; + readOID(tag?: number): string; + readSequence(tag?: number): number | null; + readString(tag?: number): string; + readString(tag: number, retbuf: boolean): Buffer; + _readTag(tag?: number): number; +} + +export class BerWriter { + readonly buffer: Buffer; + readonly _buf: Buffer; + readonly _size: number; + _offset: number; + + constructor(options?: { + size: number; + growthFactor: number; + }); + + endSequence(): void; + startSequence(tag?: number): void; + writeBoolean(b: boolean, tag?: number): void; + writeBuffer(buf: Buffer, tag: number): void; + writeByte(b: number): void; + writeEnumeration(i: number, tag?: number): void; + writeInt(i: number, tag?: number): void; + writeLength(len: number): void; + writeNull(): void; + writeOID(s: string, tag: number): void; + writeString(s: string, tag?: number): void; + writeStringArray(strings: ReadonlyArray): void; + _ensure(length: number): void; +} + +export namespace Ber { + const BMPString: number; + const BitString: number; + const Boolean: number; + const CharacterString: number; + const Constructor: number; + const Context: number; + const EOC: number; + const Enumeration: number; + const External: number; + const GeneralString: number; + const GeneralizedTime: number; + const GraphicString: number; + const IA5String: number; + const Integer: number; + const Null: number; + const NumericString: number; + const OID: number; + const ObjectDescriptor: number; + const OctetString: number; + const PDV: number; + const PrintableString: number; + const Real: number; + const RelativeOID: number; + const Sequence: number; + const Set: number; + const T61String: number; + const UTCTime: number; + const UniversalString: number; + const Utf8String: number; + const VideotexString: number; + const VisibleString: number; +} +/* +declare enum BerType { + EOC = 0, + Boolean = 1, + Integer = 2, + BitString = 3, + OctetString = 4, + Null = 5, + OID = 6, + ObjectDescriptor = 7, + External = 8, + Real = 9, // float + Enumeration = 10, + PDV = 11, + Utf8String = 12, + RelativeOID = 13, + Sequence = 16, + Set = 17, + NumericString = 18, + PrintableString = 19, + T61String = 20, + VideotexString = 21, + IA5String = 22, + UTCTime = 23, + GeneralizedTime = 24, + GraphicString = 25, + VisibleString = 26, + GeneralString = 28, + UniversalString = 29, + CharacterString = 30, + BMPString = 31, + Constructor = 32, + Context = 128, +} + +*/ diff --git a/types/asn1/tsconfig.json b/types/asn1/tsconfig.json new file mode 100644 index 0000000000..fd1bdc45d9 --- /dev/null +++ b/types/asn1/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "noUnusedParameters": true, + + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "asn1-tests.ts" + ] +} \ No newline at end of file diff --git a/types/asn1/tslint.json b/types/asn1/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/asn1/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index a38c928333..4fcbb5df33 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -812,6 +812,8 @@ export interface AuthorizeOptions { login_hint?: string; prompt?: string; mode?: "login" | "signUp"; + accessType?: string; + approvalPrompt?: string; } export interface CheckSessionOptions extends AuthorizeOptions { diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 92f0a6999b..ba6ebdc5ac 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -1056,3 +1056,113 @@ const firehoseEventHandler: AWSLambda.FirehoseTransformationHandler = ( ] }); }; + +declare let lexEvent: AWSLambda.LexEvent; +lexEvent = { + currentIntent: { + name: 'intent-name', + slots: { + slot1: null, + slot2: 'value2', + }, + slotDetails: { + slot1: { + resolutions: [ + { value: 'value1' }, + ], + originalValue: 'originalValue', + } + }, + confirmationStatus: 'None', + }, + bot: { + name: 'bot name', + alias: 'bot alias', + version: 'bot version', + }, + userId: 'User ID specified in the POST request to Amazon Lex.', + inputTranscript: 'Text used to process the request', + invocationSource: 'FulfillmentCodeHook', + outputDialogMode: 'Text', + messageVersion: '1.0', + sessionAttributes: { + key1: 'value1', + key2: 'value2', + }, + requestAttributes: { + key1: 'value1', + key2: 'value2', + } +}; + +declare let lexResult: AWSLambda.LexResult; +declare let lexDialogAction: AWSLambda.LexDialogAction; +declare let lexDialogActionBase: AWSLambda.LexDialogActionBase; +declare let lexDialogActionClose: AWSLambda.LexDialogActionClose; +declare let lexDialogActionConfirmIntent: AWSLambda.LexDialogActionConfirmIntent; +declare let lexDialogActionDelegate: AWSLambda.LexDialogActionDelegate; +declare let lexDialogActionElicitIntent: AWSLambda.LexDialogActionElicitIntent; +declare let lexDialogActionElicitSlot: AWSLambda.LexDialogActionElicitSlot; +declare let lexGenericAttachment: AWSLambda.LexGenericAttachment; + +lexResult = { + sessionAttributes: { + attrib1: 'Value One', + }, + dialogAction: { + type: 'Close', + fulfillmentState: 'Failed', + }, +}; + +str = lexGenericAttachment.title; +str = lexGenericAttachment.subTitle; +str = lexGenericAttachment.imageUrl; +str = lexGenericAttachment.attachmentLinkUrl; +str = lexGenericAttachment.buttons[0].text; +str = lexGenericAttachment.buttons[0].value; + +lexDialogAction.type === 'Close'; +lexDialogAction.type === 'ConfirmIntent'; +lexDialogAction.type === 'Delegate'; +lexDialogAction.type === 'ElicitIntent'; +lexDialogAction.type === 'ElicitSlot'; + +lexDialogActionBase.message!.contentType === 'CustomPayload'; +lexDialogActionBase.message!.contentType === 'PlainText'; +lexDialogActionBase.message!.contentType === 'SSML'; +str = lexDialogActionBase.message!.content; +num = lexDialogActionBase.responseCard!.version; +lexDialogActionBase.responseCard!.contentType === 'application/vnd.amazonaws.card.generic'; +// $ExpectType LexGenericAttachment +lexDialogActionBase.responseCard!.genericAttachments[0]; + +lexDialogActionClose.type === 'Close'; +lexDialogActionClose.fulfillmentState === 'Failed'; +lexDialogActionClose.fulfillmentState === 'Fulfilled'; + +lexDialogActionConfirmIntent.type === 'ConfirmIntent'; +str = lexDialogActionConfirmIntent.intentName; +strOrNull = lexDialogActionConfirmIntent.slots['example']; + +lexDialogActionDelegate.type === 'Delegate'; +strOrNull = lexDialogActionDelegate.slots['example']; + +lexDialogActionElicitIntent.type === 'ElicitIntent'; +lexDialogActionElicitSlot.type === 'ElicitSlot'; +strOrNull = lexDialogActionElicitSlot.slots['example']; +str = lexDialogActionElicitSlot.slotToElicit; +str = lexDialogActionElicitSlot.intentName; + +const lexEventHandler: AWSLambda.LexHandler = async ( + event: AWSLambda.LexEvent, + context: AWSLambda.Context, +) => { + // $ExpectType LexEvent + event; + + // $ExpectType Context + context; + str = context.functionName; + return lexResult; +}; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 4cafe3d2da..52314529bc 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -876,6 +876,100 @@ export interface SQSMessageAttributes { [name: string]: SQSMessageAttribute; } +// Lex +// https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html#supported-event-source-lex +export interface LexEvent { + currentIntent: { + name: string; + slots: { [name: string]: string | null }; + slotDetails: LexSlotDetails; + confirmationStatus: 'None' | 'Confirmed' | 'Denied'; + }; + bot: { + name: string; + alias: string; + version: string; + }; + userId: string; + inputTranscript: string; + invocationSource: 'DialogCodeHook' | 'FulfillmentCodeHook'; + outputDialogMode: 'Text' | 'Voice'; + messageVersion: '1.0'; + sessionAttributes: { [key: string]: string }; + requestAttributes: { [key: string]: string } | null; +} + +export interface LexSlotResolution { + value: string; +} + +export interface LexSlotDetails { + [name: string]: { + // The following line only works in TypeScript Version: 3.0, The array should have at least 1 and no more than 5 items + // resolutions: [LexSlotResolution, LexSlotResolution?, LexSlotResolution?, LexSlotResolution?, LexSlotResolution?]; + resolutions: LexSlotResolution[] + originalValue: string; + }; +} + +export interface LexGenericAttachment { + title: string; + subTitle: string; + imageUrl: string; + attachmentLinkUrl: string; + buttons: Array<{ + text: string; + value: string; + }>; +} + +export interface LexDialogActionBase { + type: 'Close' | 'ElicitIntent' | 'ElicitSlot' | 'ConfirmIntent'; + message?: { + contentType: 'PlainText' | 'SSML' | 'CustomPayload'; + content: string; + }; + responseCard?: { + version: number; + contentType: 'application/vnd.amazonaws.card.generic'; + genericAttachments: LexGenericAttachment[]; + }; +} + +export interface LexDialogActionClose extends LexDialogActionBase { + type: 'Close'; + fulfillmentState: 'Fulfilled' | 'Failed'; +} + +export interface LexDialogActionElicitIntent extends LexDialogActionBase { + type: 'ElicitIntent'; +} + +export interface LexDialogActionElicitSlot extends LexDialogActionBase { + type: 'ElicitSlot'; + intentName: string; + slots: { [name: string]: string | null }; + slotToElicit: string; +} + +export interface LexDialogActionConfirmIntent extends LexDialogActionBase { + type: 'ConfirmIntent'; + intentName: string; + slots: { [name: string]: string | null }; +} + +export interface LexDialogActionDelegate { + type: 'Delegate'; + slots: { [name: string]: string | null }; +} + +export type LexDialogAction = LexDialogActionClose | LexDialogActionElicitIntent | LexDialogActionElicitSlot | LexDialogActionConfirmIntent | LexDialogActionDelegate; + +export interface LexResult { + sessionAttributes?: { [key: string]: string }; + dialogAction: LexDialogAction; +} + /** * AWS Lambda handler function. * http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html @@ -938,6 +1032,9 @@ export type ScheduledHandler = Handler; // TODO: Alexa +export type LexHandler = Handler; +export type LexCallback = Callback; + export type APIGatewayProxyHandler = Handler; export type APIGatewayProxyCallback = Callback; export type ProxyHandler = APIGatewayProxyHandler; // Old name diff --git a/types/axios-case-converter/axios-case-converter-tests.ts b/types/axios-case-converter/axios-case-converter-tests.ts new file mode 100644 index 0000000000..77fa927976 --- /dev/null +++ b/types/axios-case-converter/axios-case-converter-tests.ts @@ -0,0 +1,6 @@ +import axios from "axios"; +import applyConverters from "axios-case-converter"; + +applyConverters(); // $ExpectError + +applyConverters(axios.create()); // $ExpectType AxiosInstance diff --git a/types/axios-case-converter/index.d.ts b/types/axios-case-converter/index.d.ts new file mode 100644 index 0000000000..2071ee4dbc --- /dev/null +++ b/types/axios-case-converter/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for axios-case-converter 0.3 +// Project: https://github.com/mpyw/axios-case-converter +// Definitions by: Derek Kniffin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import { AxiosInstance } from "axios"; + +export default function applyConverters(axios: AxiosInstance): AxiosInstance; diff --git a/types/axios-case-converter/package.json b/types/axios-case-converter/package.json new file mode 100644 index 0000000000..ab98e74e0b --- /dev/null +++ b/types/axios-case-converter/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "axios": "^0.16.1" + } +} diff --git a/types/axios-case-converter/tsconfig.json b/types/axios-case-converter/tsconfig.json new file mode 100644 index 0000000000..fb3102b6eb --- /dev/null +++ b/types/axios-case-converter/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "axios-case-converter-tests.ts" + ] +} diff --git a/types/axios-case-converter/tslint.json b/types/axios-case-converter/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/axios-case-converter/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/babel__traverse/babel__traverse-tests.ts b/types/babel__traverse/babel__traverse-tests.ts index 70f8c5f0b6..98a0338021 100644 --- a/types/babel__traverse/babel__traverse-tests.ts +++ b/types/babel__traverse/babel__traverse-tests.ts @@ -150,3 +150,8 @@ const VisitorStateTest: Visitor = { } } }; + +const VisitorAliasTest: Visitor = { + Function() {}, + Expression() {}, +}; diff --git a/types/babel__traverse/index.d.ts b/types/babel__traverse/index.d.ts index 89e242129b..fe817d5daf 100644 --- a/types/babel__traverse/index.d.ts +++ b/types/babel__traverse/index.d.ts @@ -145,6 +145,8 @@ export class Binding { export type Visitor = VisitNodeObject & { [Type in Node["type"]]?: VisitNode>; +} & { + [K in keyof t.Aliases]?: VisitNode }; export type VisitNode = VisitNodeFunction | VisitNodeObject; diff --git a/types/babel__traverse/package.json b/types/babel__traverse/package.json index 2442a952db..47a2d3dc48 100644 --- a/types/babel__traverse/package.json +++ b/types/babel__traverse/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.3.0" } } diff --git a/types/better-sqlite3/better-sqlite3-tests.ts b/types/better-sqlite3/better-sqlite3-tests.ts index dddd69bea8..f5a6c0e070 100644 --- a/types/better-sqlite3/better-sqlite3-tests.ts +++ b/types/better-sqlite3/better-sqlite3-tests.ts @@ -69,3 +69,12 @@ trans.default('name'); trans.deferred('name'); trans.immediate('name'); trans.exclusive('name'); + +const transTyped = db.transaction((param: number) => stmt.all(param)); +transTyped(1); +trans.default(1); +trans.deferred(1); +trans.immediate(1); +trans.exclusive(1); +// $ExpectError +transTyped('name'); diff --git a/types/better-sqlite3/index.d.ts b/types/better-sqlite3/index.d.ts index 2c027ff6e6..32a71d96af 100644 --- a/types/better-sqlite3/index.d.ts +++ b/types/better-sqlite3/index.d.ts @@ -4,10 +4,17 @@ // Mathew Rumsey // Santiago Aguilar // Alessandro Vergani +// Andrew Kaiser // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 import Integer = require("integer"); +type VariableArgFunction = (...params: any[]) => any; +type ArgumentTypes = F extends (...args: infer A) => any + ? A + : never; + declare namespace BetterSqlite3 { interface Statement { database: Database; @@ -34,12 +41,12 @@ declare namespace BetterSqlite3 { type: string | null; } - interface Transaction { - (...params: any[]): any; - default(...params: any[]): any; - deferred(...params: any[]): any; - immediate(...params: any[]): any; - exclusive(...params: any[]): any; + interface Transaction { + (...params: ArgumentTypes): any; + default(...params: ArgumentTypes): any; + deferred(...params: ArgumentTypes): any; + immediate(...params: ArgumentTypes): any; + exclusive(...params: ArgumentTypes): any; } interface Database { @@ -50,7 +57,7 @@ declare namespace BetterSqlite3 { inTransaction: boolean; prepare(source: string): Statement; - transaction(fn: (...params: any[]) => any): Transaction; + transaction(fn: F): Transaction; exec(source: string): this; pragma(source: string, options?: Database.PragmaOptions): any; checkpoint(databaseName?: string): this; @@ -113,7 +120,7 @@ declare namespace Database { type SqliteError = typeof SqliteError; type Statement = BetterSqlite3.Statement; type ColumnDefinition = BetterSqlite3.ColumnDefinition; - type Transaction = BetterSqlite3.Transaction; + type Transaction = BetterSqlite3.Transaction; type Database = BetterSqlite3.Database; } diff --git a/types/btoa/btoa-tests.ts b/types/btoa/btoa-tests.ts index d09cdad23a..7ce230fcf7 100644 --- a/types/btoa/btoa-tests.ts +++ b/types/btoa/btoa-tests.ts @@ -1,3 +1,3 @@ -import btoa from 'btoa'; +import btoa = require('btoa'); btoa('foo'); diff --git a/types/btoa/index.d.ts b/types/btoa/index.d.ts index cc311ed836..bdb02b5b59 100644 --- a/types/btoa/index.d.ts +++ b/types/btoa/index.d.ts @@ -1,7 +1,10 @@ // Type definitions for btoa 1.2 // Project: https://git.coolaj86.com/coolaj86/btoa.js // Definitions by: John Wright +// Alex Brick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -export default function(str: string): string; +declare function btoa(str: string): string; + +export = btoa; diff --git a/types/buble/buble-tests.ts b/types/buble/buble-tests.ts new file mode 100644 index 0000000000..cebb373415 --- /dev/null +++ b/types/buble/buble-tests.ts @@ -0,0 +1,77 @@ +import * as buble from 'buble'; + +const input = 'const answer = () => 42;'; + +// Simple transform +(() => { + const output = buble.transform(input); + + console.log(output.code); + console.log(output.map.toString()); + console.log(output.map.toUrl()); +})(); + +// Transform for Chrome & Firefox +(() => { + const output = buble.transform(input, { + target: { + chrome: 71, + firefox: 64, + }, + }); +})(); + +// Transform with sourcemaps support +(() => { + const output = buble.transform(input, { + source: 'input.js', + file: 'output.js', + includeContent: true, + }); +})(); + +// Transform for Preact +(() => { + const output = buble.transform(input, { + jsx: 'h' + }); +})(); + +// Transform with Object assign/spread support +(() => { + let output = buble.transform(input, { + objectAssign: true, + }); + output = buble.transform(input, { + objectAssign: 'MyCustomObjectAssign', + }); +})(); + +// Transform with every transforms +(() => { + const output = buble.transform(input, { + transforms: { + arrow: true, + classes: false, + collections: true, + computedProperty: false, + conciseMethodProperty: true, + constLoop: false, + dangerousForOf: true, + dangerousTaggedTemplateString: false, + defaultParameter: true, + destructuring: false, + forOf: true, + generator: false, + letConst: true, + modules: false, + numericLiteral: true, + parameterDestructuring: false, + reservedProperties: true, + spreadRest: false, + stickyRegExp: true, + templateString: false, + unicodeRegExp: true, + } + }); +})(); diff --git a/types/buble/index.d.ts b/types/buble/index.d.ts new file mode 100644 index 0000000000..db3cb0a7b7 --- /dev/null +++ b/types/buble/index.d.ts @@ -0,0 +1,65 @@ +// Type definitions for buble 0.19 +// Project: https://github.com/Rich-Harris/buble#README +// Definitions by: Hugo Alliaume +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import { SourceMap } from "magic-string"; + +export interface TransformOptions { + // source: https://github.com/Rich-Harris/buble/blob/master/src/support.js + target?: { + chrome?: 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71; + firefox?: 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64; + safari?: 8 | 9 | 10 | 10.1 | 11 | 11.1 | 12; + ie?: 8 | 9 | 10 | 11; + edge?: 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19; + node?: 0.10 | 0.12 | 4 | 5 | 6 | 8 | 8.3 | 8.7 | 8.10; + }; + + // used for sourcemaps + source?: string; // input + file?: string; // output + includeContent?: boolean; + + // custom JSX pragma (https://buble.surge.sh/guide/#jsx) + jsx?: string; // default: 'React.createElement' + + // custom `Object.assign` (https://buble.surge.sh/guide/#object-spread-and-rest) + objectAssign?: string | boolean; + + // transforms + transforms?: { + arrow?: boolean; + classes?: boolean; + collections?: boolean; + computedProperty?: boolean; + conciseMethodProperty?: boolean; + constLoop?: boolean; + dangerousForOf?: boolean; + dangerousTaggedTemplateString?: boolean; + defaultParameter?: boolean; + destructuring?: boolean; + forOf?: boolean; + generator?: boolean; + letConst?: boolean; + modules?: boolean; + numericLiteral?: boolean; + parameterDestructuring?: boolean; + reservedProperties?: boolean; + spreadRest?: boolean; + stickyRegExp?: boolean; + templateString?: boolean; + unicodeRegExp?: boolean; + }; + + // others + namedFunctionExpressions?: boolean; +} + +export interface TransformOutput { + code: string; + map: SourceMap; +} + +export function transform(content: string, options?: TransformOptions): TransformOutput; diff --git a/types/react-bootstrap-typeahead/package.json b/types/buble/package.json similarity index 61% rename from types/react-bootstrap-typeahead/package.json rename to types/buble/package.json index e6696d08e7..d2f8119c0a 100644 --- a/types/react-bootstrap-typeahead/package.json +++ b/types/buble/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "csstype": "^2.2.0" + "magic-string": "^0.25.0" } } diff --git a/types/buble/tsconfig.json b/types/buble/tsconfig.json new file mode 100644 index 0000000000..0196ebd845 --- /dev/null +++ b/types/buble/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "buble-tests.ts" + ] +} diff --git a/types/buble/tslint.json b/types/buble/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/buble/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index b2fb68d4d7..bbafa0301c 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -585,6 +585,11 @@ declare namespace Bull { */ getJobCounts(): Promise; + /** + * Returns a promise that resolves with the job counts for the given queue of the given types. + */ + getJobCountByTypes(types: string[] | string): Promise; + /** * Returns a promise that resolves with the quantity of completed jobs. */ diff --git a/types/bytebuffer/index.d.ts b/types/bytebuffer/index.d.ts index bafed6edf8..eaa1a509d5 100644 --- a/types/bytebuffer/index.d.ts +++ b/types/bytebuffer/index.d.ts @@ -127,7 +127,7 @@ declare class ByteBuffer * Calculates the number of UTF8 characters of a string.JavaScript itself uses UTF- 16, so that a string's length property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF. */ static calculateUTF8Chars( str: string ): number; - + /** * Calculates the number of UTF8 bytes of a string. This is an alias of ByteBuffer#calculateUTF8Bytes. */ @@ -574,6 +574,11 @@ declare class ByteBuffer */ writeInt8( value: number, offset?: number ): ByteBuffer; + /** + * Write a 64bit signed integer. This is an alias of ByteBuffer#writeInt64. + */ + writeLong( value: number | Long, offset?: number ): ByteBuffer; + /** * Writes a 16bit signed integer. This is an alias of ByteBuffer#writeInt16. */ diff --git a/types/cacheable-request/cacheable-request-tests.ts b/types/cacheable-request/cacheable-request-tests.ts new file mode 100644 index 0000000000..95458c14b7 --- /dev/null +++ b/types/cacheable-request/cacheable-request-tests.ts @@ -0,0 +1,28 @@ +import * as http from 'http'; +import * as https from 'https'; +import CacheableRequest = require('cacheable-request'); +import QuickLRU = require('quick-lru'); + +// You can do +let cacheableRequest = new CacheableRequest(http.request); +const cacheReq = cacheableRequest('http://example.com', res => { + res; // $ExpectType ServerResponse | ResponseLike +}); +cacheReq.on('request', req => req.end()); + +cacheableRequest = new CacheableRequest(https.request); + +cacheableRequest = new CacheableRequest(http.request, 'redis://user:pass@localhost:6379'); +cacheableRequest = new CacheableRequest(http.request, new Map()); +cacheableRequest = new CacheableRequest(http.request, new QuickLRU({ maxSize: 1000 })); + +cacheableRequest('example.com', res => { + res; // $ExpectType ServerResponse | ResponseLike +}) + .on('error', err => { + err; // $ExpectType RequestErrorCls | CacheErrorCls + }) + .on('request', req => { + req.on('error', () => {}); + req.end(); + }); diff --git a/types/cacheable-request/index.d.ts b/types/cacheable-request/index.d.ts new file mode 100644 index 0000000000..98d858d3f6 --- /dev/null +++ b/types/cacheable-request/index.d.ts @@ -0,0 +1,134 @@ +// Type definitions for cacheable-request 6.0 +// Project: https://github.com/lukechilds/cacheable-request#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +import { request, RequestOptions, ClientRequest, ServerResponse } from 'http'; +import { URL } from 'url'; +import { EventEmitter } from 'events'; +import { Store } from 'keyv'; +import { Options as CacheSemanticsOptions } from 'http-cache-semantics'; +import ResponseLike = require('responselike'); + +export = CacheableRequest; + +declare const CacheableRequest: CacheableRequest; + +type RequestFn = typeof request; + +interface CacheableRequest { + new (requestFn: RequestFn, storageAdapter?: string | Store): ( + opts: string | URL | (RequestOptions & CacheSemanticsOptions), + cb?: (response: ServerResponse | ResponseLike) => void + ) => CacheableRequest.Emitter; + + RequestError: typeof RequestErrorCls; + CacheError: typeof CacheErrorCls; +} + +declare namespace CacheableRequest { + interface Options { + /** + * If the cache should be used. Setting this to `false` will completely bypass the cache for the current request. + * @default true + */ + cache?: boolean; + + /** + * If set to `true` once a cached resource has expired it is deleted and will have to be re-requested. + * + * If set to `false`, after a cached resource's TTL expires it is kept in the cache and will be revalidated + * on the next request with `If-None-Match`/`If-Modified-Since` headers. + * @default false + */ + strictTtl?: boolean; + + /** + * Limits TTL. The `number` represents milliseconds. + * @default undefined + */ + maxTtl?: number; + + /** + * When set to `true`, if the DB connection fails we will automatically fallback to a network request. + * DB errors will still be emitted to notify you of the problem even though the request callback may succeed. + * @default false + */ + automaticFailover?: boolean; + + /** + * Forces refreshing the cache. If the response could be retrieved from the cache, it will perform a + * new request and override the cache instead. + * @default false + */ + forceRefresh?: boolean; + } + + interface Emitter extends EventEmitter { + addListener(event: 'request', listener: (request: ClientRequest) => void): this; + addListener( + event: 'response', + listener: (response: ServerResponse | ResponseLike) => void + ): this; + addListener(event: 'error', listener: (error: RequestError | CacheError) => void): this; + on(event: 'request', listener: (request: ClientRequest) => void): this; + on(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this; + on(event: 'error', listener: (error: RequestError | CacheError) => void): this; + once(event: 'request', listener: (request: ClientRequest) => void): this; + once(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this; + once(event: 'error', listener: (error: RequestError | CacheError) => void): this; + prependListener(event: 'request', listener: (request: ClientRequest) => void): this; + prependListener( + event: 'response', + listener: (response: ServerResponse | ResponseLike) => void + ): this; + prependListener(event: 'error', listener: (error: RequestError | CacheError) => void): this; + prependOnceListener(event: 'request', listener: (request: ClientRequest) => void): this; + prependOnceListener( + event: 'response', + listener: (response: ServerResponse | ResponseLike) => void + ): this; + prependOnceListener( + event: 'error', + listener: (error: RequestError | CacheError) => void + ): this; + removeListener(event: 'request', listener: (request: ClientRequest) => void): this; + removeListener( + event: 'response', + listener: (response: ServerResponse | ResponseLike) => void + ): this; + removeListener(event: 'error', listener: (error: RequestError | CacheError) => void): this; + off(event: 'request', listener: (request: ClientRequest) => void): this; + off(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this; + off(event: 'error', listener: (error: RequestError | CacheError) => void): this; + removeAllListeners(event?: 'request' | 'response' | 'error'): this; + listeners(event: 'request'): Array<(request: ClientRequest) => void>; + listeners(event: 'response'): Array<(response: ServerResponse | ResponseLike) => void>; + listeners(event: 'error'): Array<(error: RequestError | CacheError) => void>; + rawListeners(event: 'request'): Array<(request: ClientRequest) => void>; + rawListeners(event: 'response'): Array<(response: ServerResponse | ResponseLike) => void>; + rawListeners(event: 'error'): Array<(error: RequestError | CacheError) => void>; + emit(event: 'request', request: ClientRequest): boolean; + emit(event: 'response', response: ServerResponse | ResponseLike): boolean; + emit(event: 'error', error: RequestError | CacheError): boolean; + eventNames(): Array<'request' | 'response' | 'error'>; + listenerCount(type: 'request' | 'response' | 'error'): number; + } + + type RequestError = RequestErrorCls; + type CacheError = CacheErrorCls; +} + +declare class RequestErrorCls extends Error { + readonly name: 'RequestError'; + + constructor(error: Error); +} +declare class CacheErrorCls extends Error { + readonly name: 'CacheError'; + + constructor(error: Error); +} diff --git a/types/cacheable-request/tsconfig.json b/types/cacheable-request/tsconfig.json new file mode 100644 index 0000000000..635a5b1689 --- /dev/null +++ b/types/cacheable-request/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cacheable-request-tests.ts" + ] +} diff --git a/types/cacheable-request/tslint.json b/types/cacheable-request/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cacheable-request/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/catbox/index.d.ts b/types/catbox/index.d.ts index 32fbdf6f3f..bd41889e07 100644 --- a/types/catbox/index.d.ts +++ b/types/catbox/index.d.ts @@ -231,7 +231,7 @@ export interface DecoratedPolicyOptions extends PolicyOptions { /** * @default false */ - getDecoratedValue?: boolean; + getDecoratedValue: boolean | undefined; } export interface GenerateFuncFlags { diff --git a/types/chai-webdriverio/package.json b/types/chai-webdriverio/package.json new file mode 100644 index 0000000000..cd495fe983 --- /dev/null +++ b/types/chai-webdriverio/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "@types/webdriverio": "^4.0.0" + } +} diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index ca28a1a9f6..8e795ed77c 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -537,6 +537,7 @@ declare namespace Chart { interface LinearTickOptions extends TickOptions { maxTicksLimit?: number; stepSize?: number; + precision?: number; suggestedMin?: number; suggestedMax?: number; } diff --git a/types/chartist/chartist-tests.ts b/types/chartist/chartist-tests.ts index cb7f884264..863fdb33be 100644 --- a/types/chartist/chartist-tests.ts +++ b/types/chartist/chartist-tests.ts @@ -485,3 +485,53 @@ new Chartist.Candle('.ct-chart', { } } }); + + +// Create a simple bar chart and line chart with two dimensional arrays +new Chartist.Bar('.ct-chart', { + labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + series: [ + [ + {value: 1}, + {value: 2}, + {value: 3}, + {value: 4}, + {value: 5}, + {value: 6}, + {value: 7} + ], + [ + {value: 7}, + {value: 6}, + {value: 5}, + {value: 4}, + {value: 3}, + {value: 2}, + {value: 1} + ] + ] +}, {}) + +new Chartist.Line('.ct-chart', { + labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + series: [ + [ + {value: 1}, + {value: 2}, + {value: 3}, + {value: 4}, + {value: 5}, + {value: 6}, + {value: 7} + ], + [ + {value: 7}, + {value: 6}, + {value: 5}, + {value: 4}, + {value: 3}, + {value: 2}, + {value: 1} + ] + ] +}, {}) diff --git a/types/chartist/index.d.ts b/types/chartist/index.d.ts index 9b096839cc..8d700703c9 100644 --- a/types/chartist/index.d.ts +++ b/types/chartist/index.d.ts @@ -93,7 +93,7 @@ declare namespace Chartist { // TODO: come in and tidy this up and make it fit better interface IChartistData { labels?: Array | Array | Array; - series: Array | Array> | Array | Array>; + series: Array | Array> | Array> | Array | Array>; } interface IChartistSeriesData { diff --git a/types/ckeditor/ckeditor-tests.ts b/types/ckeditor/ckeditor-tests.ts index 7e224ab683..1321d5b83d 100644 --- a/types/ckeditor/ckeditor-tests.ts +++ b/types/ckeditor/ckeditor-tests.ts @@ -289,6 +289,17 @@ function test_dom_node() { strong.insertBefore(em); strong.insertBeforeMe(em); element.isReadOnly(); + var prev = node.getPreviousSourceNode(); + prev = node.getPreviousSourceNode(true); + prev = node.getPreviousSourceNode(true, CKEDITOR.NODE_TEXT); + prev = node.getPreviousSourceNode(true, CKEDITOR.NODE_COMMENT, node); + prev = node.getPreviousSourceNode(true, CKEDITOR.NODE_COMMENT, (current: CKEDITOR.dom.node) => false); + var next = node.getNextSourceNode(); + next = node.getNextSourceNode(true); + next = node.getNextSourceNode(true, CKEDITOR.NODE_ELEMENT); + next = node.getNextSourceNode(true, CKEDITOR.NODE_DOCUMENT, node); + next = node.getNextSourceNode(true, CKEDITOR.NODE_DOCUMENT_FRAGMENT, (current: CKEDITOR.dom.node) => true); + console.log(node.type); } function test_dom_nodeList() { diff --git a/types/ckeditor/index.d.ts b/types/ckeditor/index.d.ts index 88646f67d1..910d62f2d7 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -333,6 +333,7 @@ declare namespace CKEDITOR { } class node extends domObject { + type: number; constructor(domNode: Node); appendTo(element: element): element; clone(includeChildren: boolean, cloneId: boolean): node; @@ -347,12 +348,12 @@ declare namespace CKEDITOR { getDocument(): document; getIndex(normalized?: boolean): number; getNext(evaluator?: (node: node) => boolean): node; - getNextSourceNode(startFromSibling: boolean, nodeType: number, guard: node | ((node: node) => boolean)): void; + getNextSourceNode(startFromSibling?: boolean, nodeType?: number, guard?: node | ((node: node) => boolean)): node; getParent(allowFragmentParent?: boolean): element; getParents(closerFirst?: boolean): node[]; getPosition(otherNode: node): void; getPrevious(evaluator?: (node: node) => boolean): node; - getPreviousSourceNode(startFromSibling: boolean, nodeType: number, guard: node | ((node: node) => boolean)): void; + getPreviousSourceNode(startFromSibling?: boolean, nodeType?: number, guard?: node | ((node: node) => boolean)): node; hasAscendant(name: string, includeSelf: boolean): boolean; remove(preserveChildren?: boolean): node; replace(nodeToReplace: node): void; diff --git a/types/clean-css/clean-css-tests.ts b/types/clean-css/clean-css-tests.ts index 9c856d40a1..98049b3ef6 100644 --- a/types/clean-css/clean-css-tests.ts +++ b/types/clean-css/clean-css-tests.ts @@ -81,3 +81,18 @@ new CleanCSS({ returnPromise: true, sourceMap: true }).minify(source, inputSourc console.log(error); } ); + +// test object return when passing options as object +let CleanCssOptions: CleanCSS.Options = { returnPromise: true }; +new CleanCSS(CleanCssOptions).minify(source) + .then((minified: CleanCSS.Output): void => { + console.log(minified.styles); + }).catch((error: any): void => { + console.log(error); + } +); + +CleanCssOptions = { returnPromise: false }; +new CleanCSS(CleanCssOptions).minify(source, (error: any, minified: CleanCSS.Output): void => { + console.log(minified.styles); +}); diff --git a/types/clean-css/index.d.ts b/types/clean-css/index.d.ts index 244c585e53..9f2dfe9358 100644 --- a/types/clean-css/index.d.ts +++ b/types/clean-css/index.d.ts @@ -8,83 +8,78 @@ import { RequestOptions as HttpsRequestOptions } from "https"; import { RequestOptions as HttpRequestOptions } from "http"; -declare namespace CleanCSS { +/** + * Shared options passed when initializing a new instance of CleanCSS that returns either a promise or output + */ +interface OptionsBase { /** - * Options passed when initializing a new instance of CleanCSS + * Controls compatibility mode used; defaults to ie10+ using `'*'`. + * Compatibility hash exposes the following properties: `colors`, `properties`, `selectors`, and `units` */ - interface Options { - /** - * Controls compatibility mode used; defaults to ie10+ using `'*'`. - * Compatibility hash exposes the following properties: `colors`, `properties`, `selectors`, and `units` - */ - compatibility?: "*" | "ie9" | "ie8" | "ie7" | CompatibilityOptions; + compatibility?: "*" | "ie9" | "ie8" | "ie7" | CleanCSS.CompatibilityOptions; - /** - * Controls a function for handling remote requests; Defaults to the build in `loadRemoteResource` function - */ - fetch?: (uri: string, inlineRequest: HttpRequestOptions | HttpsRequestOptions, inlineTimeout: number, done: (message: string | number, body: string) => void) => void; + /** + * Controls a function for handling remote requests; Defaults to the build in `loadRemoteResource` function + */ + fetch?: (uri: string, inlineRequest: HttpRequestOptions | HttpsRequestOptions, inlineTimeout: number, done: (message: string | number, body: string) => void) => void; - /** - * Controls output CSS formatting; defaults to `false`. - * Format hash exposes the following properties: `breaks`, `breakWith`, `indentBy`, `indentWith`, `spaces`, and `wrapAt`. - */ - format?: "beautify" | "keep-breaks" | FormatOptions | false; + /** + * Controls output CSS formatting; defaults to `false`. + * Format hash exposes the following properties: `breaks`, `breakWith`, `indentBy`, `indentWith`, `spaces`, and `wrapAt`. + */ + format?: "beautify" | "keep-breaks" | CleanCSS.FormatOptions | false; - /** - * inline option whitelists which @import rules will be processed. Defaults to `'local'` - * Accepts the following values: - * 'local': enables local inlining; - * 'remote': enables remote inlining; - * 'none': disables all inlining; - * 'all': enables all inlining, same as ['local', 'remote']; - * '[uri]': enables remote inlining from the specified uri; - * '![url]': disables remote inlining from the specified uri; - */ - inline?: ReadonlyArray | false; + /** + * inline option whitelists which @import rules will be processed. Defaults to `'local'` + * Accepts the following values: + * 'local': enables local inlining; + * 'remote': enables remote inlining; + * 'none': disables all inlining; + * 'all': enables all inlining, same as ['local', 'remote']; + * '[uri]': enables remote inlining from the specified uri; + * '![url]': disables remote inlining from the specified uri; + */ + inline?: ReadonlyArray | false; - /** - * Controls extra options for inlining remote @import rules - */ - inlineRequest?: HttpRequestOptions | HttpsRequestOptions; + /** + * Controls extra options for inlining remote @import rules + */ + inlineRequest?: HttpRequestOptions | HttpsRequestOptions; - /** - * Controls number of milliseconds after which inlining a remote @import fails; defaults to `5000`; - */ - inlineTimeout?: number; + /** + * Controls number of milliseconds after which inlining a remote @import fails; defaults to `5000`; + */ + inlineTimeout?: number; - /** - * Controls optimization level used; defaults to `1`. - * Level hash exposes `1`, and `2`. - */ - level?: 0 | 1 | 2 | OptimizationsOptions; + /** + * Controls optimization level used; defaults to `1`. + * Level hash exposes `1`, and `2`. + */ + level?: 0 | 1 | 2 | CleanCSS.OptimizationsOptions; - /** - * Controls URL rebasing; defaults to `true`; - */ - rebase?: boolean; + /** + * Controls URL rebasing; defaults to `true`; + */ + rebase?: boolean; - /** - * controls a directory to which all URLs are rebased, most likely the directory under which the output file - * will live; defaults to the current directory; - */ - rebaseTo?: string; + /** + * controls a directory to which all URLs are rebased, most likely the directory under which the output file + * will live; defaults to the current directory; + */ + rebaseTo?: string; - /** - * If you prefer clean-css to return a Promise object then you need to explicitely ask for it; defaults to `false` - */ - returnPromise?: boolean; + /** + * Controls whether an output source map is built; defaults to `false` + */ + sourceMap?: boolean; - /** - * Controls whether an output source map is built; defaults to `false` - */ - sourceMap?: boolean; - - /** - * Controls embedding sources inside a source map's `sourcesContent` field; defaults to `false` - */ - sourceMapInlineSources?: boolean; - } + /** + * Controls embedding sources inside a source map's `sourcesContent` field; defaults to `false` + */ + sourceMapInlineSources?: boolean; +} +declare namespace CleanCSS { /** * Output returned when calling minify functions */ @@ -650,12 +645,40 @@ declare namespace CleanCSS { minify(sources: Sources, sourceMap?: string): Promise; } + /** + * Options when returning a promise + */ + type OptionsPromise = OptionsBase & { + /** + * If you prefer clean-css to return a Promise object then you need to explicitly ask for it; defaults to `false` + */ + returnPromise: true + }; + + /** + * Options when returning an output + */ + type OptionsOutput = OptionsBase & { + /** + * If you prefer clean-css to return a Promise object then you need to explicitly ask for it; defaults to `false` + */ + returnPromise?: false + }; + + /** + * Discriminant union of both sets of options types. If you initialize without setting `returnPromise: true` + * and want to return a promise, you will need to cast to the correct options type so that TypeScript + * knows what the expected return type will be: + * `(options = options as CleanCSS.OptionsPromise).returnPromise = true` + */ + type Options = OptionsPromise | OptionsOutput; + /** * Constructor interface for CleanCSS */ interface Constructor { - new(options: Options & { returnPromise: true }): MinifierPromise; - new(options?: Options): MinifierOutput; + new(options: OptionsPromise): MinifierPromise; + new(options?: OptionsOutput): MinifierOutput; } } diff --git a/types/cleave.js/cleave.js-tests.tsx b/types/cleave.js/cleave.js-tests.tsx index a826d2607a..461e4f4d05 100644 --- a/types/cleave.js/cleave.js-tests.tsx +++ b/types/cleave.js/cleave.js-tests.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import Cleave = require("cleave.js"); import CleaveReact = require("cleave.js/react"); -import { Props } from "cleave.js/react/props"; +import { Props, ChangeEvent } from "cleave.js/react/props"; const ExampleSelector1 = () => { const cleave = new Cleave("#my-input", { phone: true }); @@ -41,3 +41,17 @@ const ExampleReact2 = (props: Props) => { /> ); }; + +const ExampleReact3 = (props: Props) => { + const handleChange = (e: ChangeEvent) => { + return e.target.rawValue; + }; + return ( + + ); +}; diff --git a/types/cleave.js/index.d.ts b/types/cleave.js/index.d.ts index 77d2e818ca..11067195ea 100644 --- a/types/cleave.js/index.d.ts +++ b/types/cleave.js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cleave.js 1.3 +// Type definitions for cleave.js 1.4 // Project: https://github.com/nosir/cleave.js // Definitions by: C Lentfort , // J Giancono , diff --git a/types/cleave.js/react/props.d.ts b/types/cleave.js/react/props.d.ts index 6ce47db62c..d881e1b319 100644 --- a/types/cleave.js/react/props.d.ts +++ b/types/cleave.js/react/props.d.ts @@ -3,8 +3,15 @@ import { CleaveOptions } from "../options"; export type InitHandler = (owner: React.ReactInstance) => void; +export interface ChangeEvent extends React.ChangeEvent { + target: { rawValue: string } & EventTarget & T; +} + +export type ChangeEventHandler = React.EventHandler>; + export interface Props extends React.InputHTMLAttributes { onInit?: InitHandler; options: CleaveOptions; htmlRef?: (i: any) => void; + onChange?: ChangeEventHandler; } diff --git a/types/clusterize.js/index.d.ts b/types/clusterize.js/index.d.ts index 7c549761d6..47da5a2140 100644 --- a/types/clusterize.js/index.d.ts +++ b/types/clusterize.js/index.d.ts @@ -32,9 +32,9 @@ declare namespace Clusterize { } interface Callbacks { - clusterWillChange?(cb: () => void): void; - clusterChanged?(cb: () => void): void; - scrollingProgress?(cb: (progress: number) => void): void; + clusterWillChange?: () => void; + clusterChanged?: () => void; + scrollingProgress?: (progress: number) => void; } } diff --git a/types/coinbase/coinbase-tests.ts b/types/coinbase/coinbase-tests.ts index fb804ac566..65ec9693bd 100644 --- a/types/coinbase/coinbase-tests.ts +++ b/types/coinbase/coinbase-tests.ts @@ -25,7 +25,7 @@ client.getAccount("abcdef", (error: Error, account: coinbase.Account): void => { account.getBuy("abcdef", (error: Error, buy: coinbase.Buy): void => undefined); - account.getBuys((error: Error, buy: coinbase.Buy[]): void => undefined); + account.getBuys(null, (error: Error, buy: coinbase.Buy[]): void => undefined); account.getDeposit("abcdef", (error: Error, deposit: coinbase.Deposit): void => undefined); @@ -33,7 +33,7 @@ client.getAccount("abcdef", (error: Error, account: coinbase.Account): void => { account.getSell("abcdef", (error: Error, deposit: coinbase.Sell): void => undefined); - account.getSells((error: Error, deposit: coinbase.Sell[]): void => undefined); + account.getSells(null, (error: Error, deposit: coinbase.Sell[]): void => undefined); account.getTransaction("abcdef", (error: Error, deposit: coinbase.Transaction): void => undefined); diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts index 6057f58142..82fc32a7d3 100644 --- a/types/coinbase/index.d.ts +++ b/types/coinbase/index.d.ts @@ -536,6 +536,21 @@ export class Account implements Resource { */ balance: MoneyHash; + /** + * Allow deposits + */ + allow_deposits: boolean; + + /** + * Allow withdrawls + */ + allow_withdrawals: boolean; + + /** + * Account worth in fiat. + */ + native_balance: MoneyHash; + /** * Promote an account as primary account. * Scope: wallet:accounts:update @@ -630,7 +645,7 @@ export class Account implements Resource { * Lists buys for an account. * Scope: wallet:buys:read */ - getBuys(cb: (error: Error, result: Buy[]) => void): void; + getBuys(opts: null, cb: (error: Error, result: Buy[]) => void): void; /** * Show an individual buy. @@ -663,7 +678,7 @@ export class Account implements Resource { * Lists sells for an account. * Scope: wallet:sells:read */ - getSells(cb: (error: Error, result: Sell[]) => void): void; + getSells(opts: null, cb: (error: Error, result: Sell[]) => void): void; /** * Show an individual sell. @@ -883,7 +898,7 @@ export class Buy implements Resource { /** * Fee associated to this buy */ - fee: MoneyHash; + fees: Fee[]; /** * Has this buy been committed? @@ -900,6 +915,26 @@ export class Buy implements Resource { */ payout_at?: string; + /** + * Unit price of the base currency. + */ + unit_price: UnitPrice; + + /** + * Hold period for transfer. + */ + hold_business_days: number; + + /** + * Is it the first buy for this symbol? + */ + is_first_buy: boolean; + + /** + * Is there another action required to make the transfer pass? + */ + requires_completion_step: boolean; + /** * Completes a buy that is created in commit: false state. * If the exchange rate has changed since the buy was created, this call will fail with the error โ€œThe exchange rate updated while you @@ -910,6 +945,32 @@ export class Buy implements Resource { commit(cb: (error: Error, transaction: Buy) => void): void; } +export interface Fee { + /** + * Amount associated to this fee + */ + amount: MoneyHash; + /** + * Fee beneficiary ("bank", "coinbase", ...) + */ + type: string; +} + +export interface UnitPrice { + /** + * Amount as floating-point in a string + */ + amount: string; + /** + * Currency e.g. "BTC" (see Client#getCurrencies() for available strings) + */ + currency: string; + /** + * Type of price + */ + scale: number; +} + export type SellStatus = "created" | "completed" | "canceled"; /** diff --git a/types/color-diff/color-diff-tests.ts b/types/color-diff/color-diff-tests.ts new file mode 100644 index 0000000000..684858c203 --- /dev/null +++ b/types/color-diff/color-diff-tests.ts @@ -0,0 +1,17 @@ +import diff from "color-diff"; + +const color = { R: 255, G: 1, B: 30 }; +// red, green, blue +const palette = [ + { R: 255, G: 0, B: 0 }, + { R: 0, G: 255, B: 0 }, + { R: 0, G: 0, B: 255 } +]; + +diff.closest(color, palette); // {R: 255, G: 0, B: 0 }, red + +const color1 = { R: 255, G: 255, B: 255 }; +// black, white +const palette1 = [{ R: 0, G: 0, B: 0 }, { R: 255, G: 255, B: 255 }]; + +diff.furthest(color1, palette1); // {R: 0, G: 0, B: 0 }, black diff --git a/types/color-diff/index.d.ts b/types/color-diff/index.d.ts new file mode 100644 index 0000000000..f331b7203c --- /dev/null +++ b/types/color-diff/index.d.ts @@ -0,0 +1,67 @@ +// Type definitions for color-diff 1.1 +// Project: https://github.com/markusn/color-diff#readme +// Definitions by: katsanva +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +export interface RGBColor { + R: number; + G: number; + B: number; + A?: number; +} + +export interface LabColor { + L: number; + a: number; + b: number; +} + +export function diff(c1: LabColor, c2: LabColor): number; + +export function rgb_to_lab(c: RGBColor): LabColor; +export function rgba_to_lab(c: RGBColor, bc?: RGBColor): LabColor; + +export function closest( + color: RGBColor, + palette: ReadonlyArray, + backgroundColor?: RGBColor +): RGBColor; + +export function furthest( + color: RGBColor, + palette: ReadonlyArray, + backgroundColor?: RGBColor +): RGBColor; + +export function map_palette( + a: ReadonlyArray, + b: ReadonlyArray, + type?: "closest" | "furthest", + backgroundColor?: RGBColor +): { [key: string]: RGBColor }; + +export function palette_map_key(c: RGBColor): string; + +export function closest_lab( + color: LabColor, + palette: ReadonlyArray +): LabColor; + +export function furthest_lab( + color: LabColor, + palette: ReadonlyArray +): LabColor; + +export function map_palette_lab( + p1: ReadonlyArray, + p2: ReadonlyArray +): { [key: string]: LabColor }; + +export function lab_palette_map_key(c: LabColor): string; + +export function match_palette_lab( + target_color: LabColor, + palette: ReadonlyArray, + find_furthest: boolean +): LabColor; diff --git a/types/color-diff/tsconfig.json b/types/color-diff/tsconfig.json new file mode 100644 index 0000000000..b8a60d5c99 --- /dev/null +++ b/types/color-diff/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true, + "strictFunctionTypes": true + }, + "files": ["index.d.ts", "color-diff-tests.ts"] +} diff --git a/types/color-diff/tslint.json b/types/color-diff/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/color-diff/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/commonmark/index.d.ts b/types/commonmark/index.d.ts index 96bb2774c5..2f2899b44a 100644 --- a/types/commonmark/index.d.ts +++ b/types/commonmark/index.d.ts @@ -4,15 +4,18 @@ // Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export type NodeType = + 'text' |'softbreak' | 'linebreak' | 'emph' | 'strong' | 'html_inline' | 'link' | 'image' | 'code' | 'document' | 'paragraph' | + 'block_quote' | 'item' | 'list' | 'heading' | 'code_block' | 'html_block' | 'thematic_break' | 'custom_inline' | 'custom_block'; + export class Node { - constructor(nodeType: string, sourcepos?: Position); + constructor(nodeType: NodeType, sourcepos?: Position); /** * (read-only): a String, one of text, softbreak, linebreak, emph, strong, html_inline, link, image, code, document, paragraph, * block_quote, item, list, heading, code_block, html_block, thematic_break. */ - readonly type: 'text' | 'softbreak' | 'linebreak' | 'emph' | 'strong' | 'html_inline' | 'link' | 'image' | 'code' | 'document' | 'paragraph' | - 'block_quote' | 'item' | 'list' | 'heading' | 'code_block' | 'html_block' | 'thematic_break' | 'custom_inline' | 'custom_block'; + readonly type: NodeType; /** * (read-only): a Node or null. */ diff --git a/types/content-range/content-range-tests.ts b/types/content-range/content-range-tests.ts new file mode 100644 index 0000000000..c482d6f072 --- /dev/null +++ b/types/content-range/content-range-tests.ts @@ -0,0 +1,23 @@ +import { format, parse } from 'content-range'; + +format({ + first: 10, + last: 100, + length: 100, + limit: 20, + unit: 'items', +}); + +format({ + length: null, + unit: 'bytes', +}); + +const parts = parse('items 10-29/100'); + +if (parts) { + parts.first; + parts.last; + parts.length; + parts.unit; +} diff --git a/types/content-range/index.d.ts b/types/content-range/index.d.ts new file mode 100644 index 0000000000..b8ee780541 --- /dev/null +++ b/types/content-range/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for content-range 1.1 +// Project: https://github.com/neoziro/content-range +// Definitions by: Alex Brick +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface ContentRangeFormatOptions { + first?: number; + last?: number; + length: number | null; + limit?: number; + unit: string; +} + +export interface ContentRangeParts { + first: number | null; + last: number | null; + length: number | null; + unit: string; +} + +export function format(options: ContentRangeFormatOptions): string; +export function parse(str: string): ContentRangeParts | null; diff --git a/types/content-range/tsconfig.json b/types/content-range/tsconfig.json new file mode 100644 index 0000000000..a2649416e0 --- /dev/null +++ b/types/content-range/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "content-range-tests.ts" + ] +} diff --git a/types/content-range/tslint.json b/types/content-range/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/content-range/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/copy/index.d.ts b/types/copy/index.d.ts index 175a07e216..567d6594d3 100644 --- a/types/copy/index.d.ts +++ b/types/copy/index.d.ts @@ -7,10 +7,41 @@ import File = require('vinyl'); declare namespace copy { - function each(files: string[], dir: string, options: Options, callback: Callback): void; - function each(files: string[], dir: string, callback: Callback): void; - function one(pattern: string | object, dir: string, options: Options, callback: Callback): void; - function one(pattern: string | object, dir: string, callback: Callback): void; + /** + * Copy an array of files to the given destination `directory`, with + * `options` and callback function that exposes `err` and the array of + * vinyl files that are created by the copy operation. + * + * ```js + * copy.each(['foo.txt', 'bar.txt', 'baz.txt'], 'dist', function(err, files) { + * // exposes the vinyl `files` created when the files are copied + * }); + * ``` + * @param `files` Filepaths or vinyl files. + * @param `dir` Destination directory + * @param `options` or callback function + * @param `cb` Callback function if no options are specified + */ + function each(files: string[] | File[], dir: string, options: Options, cb: Callback): void; + function each(files: string[] | File[], dir: string, cb: Callback): void; + + /** + * Copy a single `file` to the given `dest` directory, using + * the specified options and callback function. + * + * ```js + * copy.one('foo.txt', 'dist', function(err, file) { + * if (err) throw err; + * // exposes the vinyl `file` that is created when the file is copied + * }); + * ``` + * @param `file` Filepath or vinyl file + * @param `dir` Destination directory + * @param `options` or callback function + * @param `cb` Callback function if no options are specified + */ + function one(pattern: string | File, dir: string, options: Options, cb: Callback): void; + function one(pattern: string | File, dir: string, cb: Callback): void; type Callback = (error: Error | null, files?: File[]) => void; @@ -20,12 +51,28 @@ declare namespace copy { } } +/** + * Copy a filepath, vinyl file, array of files, or glob of files to the + * given destination `directory`, with `options` and callback function that + * exposes `err` and the array of vinyl files that are created by the copy + * operation. + * + * ```js + * copy('*.js', 'dist', function(err, file) { + * // exposes the vinyl `file` created when the file is copied + * }); + * ``` + * @param `patterns` Filepath(s), vinyl file(s) or glob of files. + * @param `dir` Destination directory + * @param `options` or callback function + * @param `cb` Callback function if no options are specified + */ declare function copy( - patterns: string | object | string[], + patterns: string | File | string[] | File[], dir: string, options: copy.Options, callback: copy.Callback, ): void; -declare function copy(patterns: string | object | string[], dir: string, callback: copy.Callback): void; +declare function copy(patterns: string | File | string[] | File[], dir: string, callback: copy.Callback): void; export = copy; diff --git a/types/cron/index.d.ts b/types/cron/index.d.ts index b27bfdf90c..596a9536ca 100644 --- a/types/cron/index.d.ts +++ b/types/cron/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cron 1.3 +// Type definitions for cron 1.6 // Project: https://www.npmjs.com/package/cron // Definitions by: Hiroki Horiuchi // Lundarl Gholoi @@ -9,8 +9,9 @@ export declare class CronTime { * Create a new ```CronTime```. * @param source The time to fire off your job. This can be in the form of cron syntax or a JS ```Date``` object. * @param zone Timezone name. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/). + * @param utcOffset UTC offset. Don't use both ```zone``` and ```utcOffset``` together or weird things may happen. */ - constructor(source: string | Date, zone?: string); + constructor(source: string | Date, zone?: string, utcOffset?: string | number); /** * Tells you when ```CronTime``` will be run. @@ -29,19 +30,19 @@ export declare interface CronJobParameters { */ cronTime: string | Date; /** - * The function to fire at the specified time. + * The function to fire at the specified time. If an ```onComplete``` callback was provided, ```onTick``` will receive it as an argument. ```onTick``` may call ```onComplete``` when it has finished its work. */ onTick: () => void; /** - * A function that will fire when the job is complete, when it is stopped. + * A function that will fire when the job is stopped with ```job.stop()```, and may also be called by ```onTick``` at the end of each run. */ onComplete?: () => void; /** - * Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call ```job.start()``` in order to start the job (assuming ```job``` is the variable you set the cronjob to). This does not immediately fire your onTick function, it just gives you more control over the behavior of your jobs. + * Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call ```job.start()``` in order to start the job (assuming ```job``` is the variable you set the cronjob to). This does not immediately fire your ```onTick``` function, it just gives you more control over the behavior of your jobs. */ start?: boolean; /** - * Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/). + * Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/). Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen. */ timeZone?: string; /** @@ -52,6 +53,14 @@ export declare interface CronJobParameters { * This will immediately fire your ```onTick``` function as soon as the requisit initialization has happened. This option is set to ```false``` by default for backwards compatibility. */ runOnInit?: boolean; + /** + * This allows you to specify the offset of your timezone rather than using the ```timeZone``` param. Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen. + */ + utcOffset?: string | number; + /** + * If you have code that keeps the event loop running and want to stop the node process when that finishes regardless of the state of your cronjob, you can do so making use of this parameter. This is off by default and cron will run as if it needs to control the event loop. For more information take a look at [timers#timers_timeout_unref](https://nodejs.org/api/timers.html#timers_timeout_unref) from the NodeJS docs. + */ + unrefTimeout?: boolean; } export declare class CronJob { @@ -73,8 +82,10 @@ export declare class CronJob { * @param timeZone Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/). * @param context The context within which to execute the onTick method. This defaults to the cronjob itself allowing you to call ```this.stop()```. However, if you change this you'll have access to the functions and values within your context object. * @param runOnInit This will immediately fire your ```onTick``` function as soon as the requisit initialization has happened. This option is set to ```false``` by default for backwards compatibility. + * @param utcOffset This allows you to specify the offset of your timezone rather than using the ```timeZone``` param. Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen. + * @param unrefTimeout If you have code that keeps the event loop running and want to stop the node process when that finishes regardless of the state of your cronjob, you can do so making use of this parameter. This is off by default and cron will run as if it needs to control the event loop. For more information take a look at [timers#timers_timeout_unref](https://nodejs.org/api/timers.html#timers_timeout_unref) from the NodeJS docs. */ - constructor(cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean); + constructor(cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean, utcOffset?: string | number, unrefTimeout?: boolean); /** * Create a new ```CronJob```. * @param options Job parameters. @@ -111,7 +122,7 @@ export declare class CronJob { } export declare var job: - ((cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean) => CronJob) + ((cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean, utcOffset?: string | number, unrefTimeout?: boolean) => CronJob) | ((options: CronJobParameters) => CronJob); export declare var time: (source: string | Date, zone?: string) => CronTime; export declare var sendAt: (cronTime: CronTime) => Date; diff --git a/types/custom-functions-runtime/custom-functions-runtime-tests.ts b/types/custom-functions-runtime/custom-functions-runtime-tests.ts index 8f54ee4f5c..3b773e95b1 100644 --- a/types/custom-functions-runtime/custom-functions-runtime-tests.ts +++ b/types/custom-functions-runtime/custom-functions-runtime-tests.ts @@ -10,17 +10,20 @@ CustomFunctions.associate({ RANDOM: (n: number) => n * Math.random() }); +function callerAddress(invocation: CustomFunctions.Invocation) { + return invocation.address; +} + async function getStockValues(ticker: string): Promise { const response = await fetch(`myService.com/prices/${ticker}`); return (await response.json())["price"]; } -async function getStockValuesCancellable( - ticker: string, - handler: CustomFunctions.CancelableHandler -): Promise { +async function getStockValuesCancellable(ticker: string, + invocation: CustomFunctions.CancelableInvocation): Promise { + const address = invocation.address; let shouldStop = false; - handler.onCanceled = () => (shouldStop = true); + invocation.onCanceled = () => (shouldStop = true); await pause(1000); if (shouldStop) { @@ -31,10 +34,9 @@ async function getStockValuesCancellable( return (await response.json())["price"]; } -function stockPriceStream( - ticker: string, - handler: CustomFunctions.StreamingHandler -) { +function stockPriceStream(ticker: string, + invocation: CustomFunctions.StreamingInvocation) { + const address = invocation.address; const updateFrequency = 10 /* milliseconds*/; let isPending = false; @@ -49,14 +51,14 @@ function stockPriceStream( try { const response = await fetch(url); const data = await response.json(); - handler.setResult(data.price); + invocation.setResult(data.price); } catch (error) { - handler.setResult(error); + invocation.setResult(error); } isPending = false; }, updateFrequency); - handler.onCanceled = () => { + invocation.onCanceled = () => { clearInterval(timer); }; } diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index 174308c131..c907fe327e 100644 --- a/types/custom-functions-runtime/index.d.ts +++ b/types/custom-functions-runtime/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for Custom Functions 1.4 // Project: https://github.com/OfficeDev/office-js -// Definitions by: OfficeDev , Michael Zlatkovsky , Michelle Scharlock +// Definitions by: OfficeDev , +// Adam Krantz , +// Michael Zlatkovsky , +// Michelle Scharlock // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -10,8 +13,8 @@ Copyright (c) Microsoft Corporation */ /** - * CustomFunctions namespace, used by Excel Custom Functions * @beta + * CustomFunctions namespace, used by Excel Custom Functions */ declare namespace CustomFunctions { /** @@ -26,30 +29,67 @@ declare namespace CustomFunctions { function associate(mappings: { [key: string]: Function }): void; /** - * A handler passed automatically as the last parameter - * to a streaming function. With this parameter, a - * function can use handler.setResult to set a cell value - * or hook into the handler.onCanceled event to - * to handle what happens when the function stops streaming. * @beta + * Provides information about the invocation of a custom function. */ - interface StreamingHandler extends CancelableHandler { + interface Invocation { /** - * Sets the returned result for a streaming custom function. * @beta + * The cell address where the function is being called, if requested, otherwise undefined. + * + * To request the address for the function, in the metadata JSON file, the function options should specify: + * `{ "requiresAddress": true }` + * + * If the metadata JSON file is being generated from JSDoc comments, include the tag `@requiresAddress`. */ - setResult: (value: T | Error) => void; + address?: string; } /** * @beta - * CancelableHandler interface + * Provides information about the invocation of a cancelable custom function. + * A cancelable custom function can provide a handler for the onCanceled event. + * + * To indicate that a function is cancelable, in the metadata JSON file, the function options should specify: + * `{ "cancelable": true }` + * + * If the metadata JSON file is being generated from JSDoc comments, include the tag `@cancelable`. */ - interface CancelableHandler { + interface CancelableInvocation extends Invocation { /** - * Handles what should occur when a custom function is canceled. * @beta + * Event handler called when the custom function is canceled. */ onCanceled: () => void; } + + /** + * @beta + * @deprecated Use `CancelableInvocation` instead. + */ + interface CancelableHandler extends CancelableInvocation { + } + + /** + * @beta + * Provides information about the invocation of a streaming custom function. + * A streaming custom function can provide results which can change over time. + * + * Call `setResult()` one or more times to provide the result instead of returning + * a result from the function. + */ + interface StreamingInvocation extends CancelableInvocation { + /** + * @beta + * Set the result for the custom function. May be called more than once. + */ + setResult: (value: ResultType | Error) => void; + } + + /** + * @beta + * @deprecated Use `StreamingInvocation` instead. + */ + interface StreamingHandler extends StreamingInvocation { + } } diff --git a/types/custom-functions-runtime/tslint.json b/types/custom-functions-runtime/tslint.json index ad17c76132..bb858f4682 100644 --- a/types/custom-functions-runtime/tslint.json +++ b/types/custom-functions-runtime/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { "ban-types": false, - "file-name-casing": false + "file-name-casing": false, + "no-empty-interface": false } } diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index 391e2786be..11b9e0de35 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -181,7 +181,7 @@ export function ascending(a: Primitive | undefined, b: Primitive | undefined): n // NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. /** - * Compares two primitive values for sorting (in ascending order). + * Compares two primitive values for sorting (in descending order). */ export function descending(a: Primitive | undefined, b: Primitive | undefined): number; diff --git a/types/defaults-deep/defaults-deep-tests.ts b/types/defaults-deep/defaults-deep-tests.ts new file mode 100644 index 0000000000..daabc46d7d --- /dev/null +++ b/types/defaults-deep/defaults-deep-tests.ts @@ -0,0 +1,7 @@ +import defaults = require('defaults-deep'); + +defaults(); +defaults({a: 'foo'}); +defaults({a: 'foo'}, {a: 'bar'}); +defaults({a: 'foo'}, {a: 'bar'}, {a: 'foobar'}); +defaults({a: {b: 'foo'}}, {a: {b: 'bar'}}); diff --git a/types/defaults-deep/index.d.ts b/types/defaults-deep/index.d.ts new file mode 100644 index 0000000000..749257eb88 --- /dev/null +++ b/types/defaults-deep/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for defaults-deep 0.2 +// Project: https://github.com/jonschlinkert/defaults-deep +// Definitions by: Hugo Alliaume +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface Obj { + [k: string]: any; +} + +declare function defaultsDeep(...objs: Obj[]): Obj; + +export = defaultsDeep; diff --git a/types/defaults-deep/tsconfig.json b/types/defaults-deep/tsconfig.json new file mode 100644 index 0000000000..9b7c12bf2b --- /dev/null +++ b/types/defaults-deep/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "defaults-deep-tests.ts" + ] +} diff --git a/types/defaults-deep/tslint.json b/types/defaults-deep/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/defaults-deep/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/dhtmlxgantt/index.d.ts b/types/dhtmlxgantt/index.d.ts index f2e322b0e3..5502cdcaf2 100644 --- a/types/dhtmlxgantt/index.d.ts +++ b/types/dhtmlxgantt/index.d.ts @@ -1455,13 +1455,13 @@ interface GanttStatic { * exports a Gantt chart into the PDF format * @param _export_ an object with export settings (see the details) */ - exportToPDF(_export_: any): void; + exportToPDF(_export_?: any): void; /** * exports a Gantt chart into the PNG format * @param _export_ an object with export settings (see the details) */ - exportToPNG(_export_: any): void; + exportToPNG(_export_?: any): void; /** * returns all dependency loops in the chart @@ -2242,4 +2242,4 @@ declare module "gantt" { declare module "Gantt" { export = Gantt; -} \ No newline at end of file +} diff --git a/types/diff/diff-tests.ts b/types/diff/diff-tests.ts index 2f640da490..845b307132 100644 --- a/types/diff/diff-tests.ts +++ b/types/diff/diff-tests.ts @@ -1,47 +1,55 @@ -import jsdiff = require('diff'); +import * as diff from 'diff'; + const one = 'beep boop'; const other = 'beep boob blah'; -let diff = jsdiff.diffChars(one, other); -printDiff(diff); +let changes = diff.diffChars(one, other); +examineChanges(changes); -const diffArraysResult = jsdiff.diffArrays(['a', 'b', 'c'], ['a', 'c', 'd']); +// $ExpectType void +diff.diffChars(one, other, { + callback: (err, value) => { + err; // $ExpectType undefined + value; // $ExpectType Change[] | undefined + }, +}); +// $ExpectType void +diff.diffChars(one, other, (err, value) => { + err; // $ExpectType undefined + value; // $ExpectType Change[] | undefined +}); + +const diffArraysResult = diff.diffArrays(['a', 'b', 'c'], ['a', 'c', 'd']); diffArraysResult.forEach(result => { - if (result.added) { - console.log(`added ${result.value.length} line(s):`, ...result.value); - } else if (result.removed) { - console.log(`removed ${result.value.length} line(s):`, ...result.value); - } else { - console.log(`no changes`); - } + result.added; // $ExpectType boolean | undefined + result.removed; // $ExpectType boolean | undefined + result.value; // $ExpectType string[] + result.count; // $ExpectType number | undefined }); interface DiffObj { value: number; } -const a: DiffObj = {value: 0}; -const b: DiffObj = {value: 1}; -const c: DiffObj = {value: 2}; -const d: DiffObj = {value: 3}; -const arrayOptions: jsdiff.IArrayOptions = { - comparator: (left: DiffObj, right: DiffObj) => { - return left.value === right.value; - } +const a: DiffObj = { value: 0 }; +const b: DiffObj = { value: 1 }; +const c: DiffObj = { value: 2 }; +const d: DiffObj = { value: 3 }; +const arrayOptions: diff.ArrayOptions = { + comparator: (left, right) => { + return left.value === right.value; + }, }; -const diffResult = jsdiff.diffArrays([a, b, c], [a, b, d], arrayOptions); -diffResult.forEach(result => { - if (result.added) { - console.log(`added ${result.value.length} line(s):`, ...result.value); - } else if (result.removed) { - console.log(`removed ${result.value.length} line(s):`, ...result.value); - } else { - console.log(`no changes`); - } +const arrayChanges = diff.diffArrays([a, b, c], [a, b, d], arrayOptions); +arrayChanges.forEach(result => { + result.added; // $ExpectType boolean | undefined + result.removed; // $ExpectType boolean | undefined + result.value; // $ExpectType DiffObj[] + result.count; // $ExpectType number | undefined }); // -------------------------- -class LineDiffWithoutWhitespace extends jsdiff.Diff { +class LineDiffWithoutWhitespace extends diff.Diff { tokenize(value: string): any { return value.split(/^/m); } @@ -52,71 +60,62 @@ class LineDiffWithoutWhitespace extends jsdiff.Diff { } const obj = new LineDiffWithoutWhitespace(); -diff = obj.diff(one, other); -printDiff(diff); +changes = obj.diff(one, other); +examineChanges(changes); -function printDiff(diff: jsdiff.IDiffResult[]) { - function addLineHeader(decorator: string, str: string | string[]) { - return (typeof str === 'string' ? str.split("\n") : str).map((line, index, array) => { - if (index === array.length - 1 && line === "") { - return line; - } else { - return decorator + line; - } - }).join("\n"); - } - - diff.forEach((part) => { - if (part.added) { - console.log(addLineHeader("+", part.value)); - } else if (part.removed) { - console.log(addLineHeader("-", part.value)); - } else { - console.log(addLineHeader(" ", part.value)); - } +function examineChanges(diff: diff.Change[]) { + diff.forEach(part => { + part.added; // $ExpectType boolean | undefined + part.removed; // $ExpectType boolean | undefined + part.value; // $ExpectType string + part.count; // $ExpectType number | undefined }); } -function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) { - const verifyPatch = jsdiff.parsePatch( - jsdiff.createTwoFilesPatch("oldFile.ts", "newFile.ts", oldStr, newStr, - "old", "new", { context: 1 })); +function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: diff.ParsedDiff) { + const verifyPatch = diff.parsePatch( + diff.createTwoFilesPatch('oldFile.ts', 'newFile.ts', oldStr, newStr, 'old', 'new', { + context: 1, + }) + ); - if (JSON.stringify(verifyPatch[0], Object.keys(verifyPatch[0]).sort()) !== JSON.stringify(uniDiff, Object.keys(uniDiff).sort())) { - console.error("Patch did not match uniDiff"); + if ( + JSON.stringify(verifyPatch[0], Object.keys(verifyPatch[0]).sort()) !== + JSON.stringify(uniDiff, Object.keys(uniDiff).sort()) + ) { + throw new Error('Patch did not match uniDiff'); } } -function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) { - const verifyApply = [ - jsdiff.applyPatch(oldStr, uniDiff), - jsdiff.applyPatch(oldStr, [uniDiff]) - ]; - jsdiff.applyPatches([uniDiff], { - loadFile: (index: number, callback: (err: Error, data: string) => void) => { +function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: diff.ParsedDiff) { + const verifyApply = [diff.applyPatch(oldStr, uniDiff), diff.applyPatch(oldStr, [uniDiff])]; + diff.applyPatches([uniDiff], { + loadFile: (index, callback) => { + index; // $ExpectType ParsedDiff callback(undefined, one); }, - patched: (index: number, content: string) => { + patched: (index, content) => { + index; // $ExpectType ParsedDiff verifyApply.push(content); }, complete: (err?: Error) => { if (err) { - console.error(err); + throw err; } verifyApply.forEach(result => { if (result !== newStr) { - console.error("Result did not match newStr"); + throw new Error('Result did not match newStr'); } }); - } + }, }); } -const uniDiffPatch = jsdiff.structuredPatch("oldFile.ts", "newFile.ts", one, other, - "old", "new", { context: 1 }); +const uniDiffPatch = diff.structuredPatch('oldFile.ts', 'newFile.ts', one, other, 'old', 'new', { + context: 1, +}); verifyPatchMethods(one, other, uniDiffPatch); -const uniDiffStr = jsdiff.createPatch("file.ts", one, other, "old", "new", - { context: 1 }); -const uniDiffApply = jsdiff.parsePatch(uniDiffStr)[0]; +const uniDiffStr = diff.createPatch('file.ts', one, other, 'old', 'new', { context: 1 }); +const uniDiffApply = diff.parsePatch(uniDiffStr)[0]; verifyApplyMethods(one, other, uniDiffApply); diff --git a/types/diff/index.d.ts b/types/diff/index.d.ts index 760aee4e61..fa0e4e2e3d 100644 --- a/types/diff/index.d.ts +++ b/types/diff/index.d.ts @@ -1,121 +1,402 @@ -// Type definitions for diff 3.5 +// Type definitions for diff 4.0 // Project: https://github.com/kpdecker/jsdiff // Definitions by: vvakame // szdc // moc-yuto +// BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -export = JsDiff; -export as namespace JsDiff; +export as namespace Diff; -declare namespace JsDiff { - interface IOptions { - ignoreCase: boolean; - } +export type Callback = (err: undefined, value?: Change[]) => void; - interface ILinesOptions extends IOptions { - ignoreWhitespace?: boolean; - newlineIsToken?: boolean; - } - - interface IArrayOptions { - comparator?: (left: any, right: any) => boolean; - } - - interface IDiffResult { - value: string; - count?: number; - added?: boolean; - removed?: boolean; - } - - interface IDiffArraysResult { - value: T[]; - count?: number; - added?: boolean; - removed?: boolean; - } - - interface IBestPath { - newPos: number; - componenets: IDiffResult[]; - } - - interface IHunk { - oldStart: number; - oldLines: number; - newStart: number; - newLines: number; - lines: string[]; - } - - interface IUniDiff { - oldFileName: string; - newFileName: string; - oldHeader: string; - newHeader: string; - index: string; - hunks: IHunk[]; - } - - class Diff { - diff(oldString: string, newString: string, options?: IOptions): IDiffResult[]; - - pushComponent(components: IDiffResult[], added: boolean, removed: boolean): void; - - extractCommon(basePath: IBestPath, newString: string, oldString: string, diagonalPath: number): number; - - equals(left: string, right: string): boolean; - - removeEmpty(array: any[]): any[]; - - castInput(value: any): any; - - join(chars: string[]): string; - - tokenize(value: string): any; // return types are string or string[] - } - - function diffChars(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; - - function diffWords(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; - - function diffWordsWithSpace(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; - - function diffJson(oldObj: object, newObj: object, options?: IOptions): IDiffResult[]; - - function diffLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[]; - - function diffCss(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; - - function diffTrimmedLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[]; - - function diffSentences(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; - - function diffArrays(oldArr: T[], newArr: T[], options?: IArrayOptions): Array>; - - function createPatch(fileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string; - - function createTwoFilesPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string; - - function structuredPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): IUniDiff; - - function applyPatch(oldStr: string, uniDiff: string | IUniDiff | IUniDiff[]): string; - - function applyPatches(uniDiff: IUniDiff[], options: { - loadFile(index: number, callback: (err: Error, data: string) => void): void, - patched(index: number, content: string): void, - complete(err?: Error): void - }): void; - - function parsePatch(diffStr: string, options?: {strict: boolean}): IUniDiff[]; - - function convertChangesToXML(changes: IDiffResult[]): string; - - function convertChangesToDMP(changes: IDiffResult[]): Array<{0: number; 1: string; }>; - - function merge(mine: string, theirs: string, base: string): IUniDiff; - - function canonicalize(obj: any, stack: any[], replacementStack: any[]): any; +export interface CallbackOptions { + /** + * Callback to call with the result instead of returning the result directly. + */ + callback: Callback; } + +export interface BaseOptions { + /** + * `true` to ignore casing difference. + * @default false + */ + ignoreCase?: boolean; +} + +export interface WordsOptions extends BaseOptions { + /** + * `true` to ignore leading and trailing whitespace. This is the same as `diffWords()`. + */ + ignoreWhitespace?: boolean; +} + +export interface LinesOptions extends BaseOptions { + /** + * `true` to ignore leading and trailing whitespace. This is the same as `diffTrimmedLines()`. + */ + ignoreWhitespace?: boolean; + + /** + * `true` to treat newline characters as separate tokens. This allows for changes to the newline structure + * to occur independently of the line content and to be treated as such. In general this is the more + * human friendly form of `diffLines()` and `diffLines()` is better suited for patches and other computer + * friendly output. + */ + newlineIsToken?: boolean; +} + +export interface JsonOptions extends LinesOptions { + /** + * Replacer used to stringify the properties of the passed objects. + */ + stringifyReplacer?: (key: string, value: any) => any; + + /** + * The value to use when `undefined` values in the passed objects are encountered during stringification. + * Will only be used if `stringifyReplacer` option wasn't specified. + * @default undefined + */ + undefinedReplacement?: any; +} + +export interface ArrayOptions extends BaseOptions { + /** + * Comparator for custom equality checks. + */ + comparator?: (left: TLeft, right: TRight) => boolean; +} + +export interface PatchOptions extends LinesOptions { + /** + * Describes how many lines of context should be included. + * @default 4 + */ + context?: number; +} + +export interface ApplyPatchOptions { + /** + * Number of lines that are allowed to differ before rejecting a patch. + * @default 0 + */ + fuzzFactor?: number; + + /** + * Callback used to compare to given lines to determine if they should be considered equal when patching. + * Should return `false` if the lines should be rejected. + * + * @default strict equality + */ + compareLine?: ( + lineNumber: number, + line: string, + operation: '-' | ' ', + patchContent: string + ) => boolean; +} + +export interface ApplyPatchesOptions { + loadFile(index: ParsedDiff, callback: (err: any, data: string) => void): void; + patched(index: ParsedDiff, content: string, callback: (err: any) => void): void; + complete(err: any): void; +} + +export interface Change { + count?: number; + /** + * Text content. + */ + value: string; + /** + * `true` if the value was inserted into the new string. + */ + added?: boolean; + /** + * `true` if the value was removed from the old string. + */ + removed?: boolean; +} + +export interface ArrayChange { + value: T[]; + count?: number; + added?: boolean; + removed?: boolean; +} + +export interface ParsedDiff { + index?: string; + oldFileName?: string; + newFileName?: string; + oldHeader?: string; + newHeader?: string; + hunks: Hunk[]; +} + +export interface Hunk { + oldStart: number; + oldLines: number; + newStart: number; + newLines: number; + lines: string[]; +} + +export interface BestPath { + newPos: number; + componenets: Change[]; +} + +export class Diff { + diff( + oldString: string, + newString: string, + options?: Callback | (ArrayOptions & Partial) + ): Change[]; + + pushComponent(components: Change[], added: boolean, removed: boolean): void; + + extractCommon( + basePath: BestPath, + newString: string, + oldString: string, + diagonalPath: number + ): number; + + equals(left: any, right: any): boolean; + + removeEmpty(array: any[]): any[]; + + castInput(value: any): any; + + join(chars: string[]): string; + + tokenize(value: string): any; // return types are string or string[] +} + +/** + * Diffs two blocks of text, comparing character by character. + * + * @returns A list of change objects. + */ +export function diffChars(oldStr: string, newStr: string, options?: BaseOptions): Change[]; +export function diffChars( + oldStr: string, + newStr: string, + options: Callback | (BaseOptions & CallbackOptions) +): void; + +/** + * Diffs two blocks of text, comparing word by word, ignoring whitespace. + * + * @returns A list of change objects. + */ +export function diffWords(oldStr: string, newStr: string, options?: WordsOptions): Change[]; +export function diffWords( + oldStr: string, + newStr: string, + options: Callback | (WordsOptions & CallbackOptions) +): void; + +/** + * Diffs two blocks of text, comparing word by word, treating whitespace as significant. + * + * @returns A list of change objects. + */ +export function diffWordsWithSpace( + oldStr: string, + newStr: string, + options?: WordsOptions +): Change[]; +export function diffWordsWithSpace( + oldStr: string, + newStr: string, + options: Callback | (WordsOptions & CallbackOptions) +): void; + +/** + * Diffs two blocks of text, comparing line by line. + * + * @returns A list of change objects. + */ +export function diffLines(oldStr: string, newStr: string, options?: LinesOptions): Change[]; +export function diffLines( + oldStr: string, + newStr: string, + options: Callback | (LinesOptions & CallbackOptions) +): void; + +/** + * Diffs two blocks of text, comparing line by line, ignoring leading and trailing whitespace. + * + * @returns A list of change objects. + */ +export function diffTrimmedLines(oldStr: string, newStr: string, options?: LinesOptions): Change[]; +export function diffTrimmedLines( + oldStr: string, + newStr: string, + options: Callback | (LinesOptions & CallbackOptions) +): void; + +/** + * Diffs two blocks of text, comparing sentence by sentence. + * + * @returns A list of change objects. + */ +export function diffSentences(oldStr: string, newStr: string, options?: BaseOptions): Change[]; +export function diffSentences( + oldStr: string, + newStr: string, + options: Callback | (BaseOptions & CallbackOptions) +): void; + +/** + * Diffs two blocks of text, comparing CSS tokens. + * + * @returns A list of change objects. + */ +export function diffCss(oldStr: string, newStr: string, options?: BaseOptions): Change[]; +export function diffCss( + oldStr: string, + newStr: string, + options: Callback | (BaseOptions & CallbackOptions) +): void; + +/** + * Diffs two JSON objects, comparing the fields defined on each. The order of fields, etc does not matter + * in this comparison. + * + * @returns A list of change objects. + */ +export function diffJson( + oldObj: string | object, + newObj: string | object, + options?: JsonOptions +): Change[]; +export function diffJson( + oldObj: string | object, + newObj: string | object, + options: Callback | (JsonOptions & CallbackOptions) +): void; + +/** + * Diffs two arrays, comparing each item for strict equality (`===`). + * + * @returns A list of change objects. + */ +export function diffArrays( + oldArr: TOld[], + newArr: TNew[], + options?: ArrayOptions +): Array>; + +/** + * Creates a unified diff patch. + * + * @param oldFileName String to be output in the filename section of the patch for the removals. + * @param newFileName String to be output in the filename section of the patch for the additions. + * @param oldStr Original string value. + * @param newStr New string value. + * @param oldHeader Additional information to include in the old file header. + * @param newHeader Additional information to include in the new file header. + */ +export function createTwoFilesPatch( + oldFileName: string, + newFileName: string, + oldStr: string, + newStr: string, + oldHeader?: string, + newHeader?: string, + options?: PatchOptions +): string; + +/** + * Creates a unified diff patch. + * Just like `createTwoFilesPatch()`, but with `oldFileName` being equal to `newFileName`. + * + * @param fileName String to be output in the filename section. + * @param oldStr Original string value. + * @param newStr New string value. + * @param oldHeader Additional information to include in the old file header. + * @param newHeader Additional information to include in the new file header. + */ +export function createPatch( + fileName: string, + oldStr: string, + newStr: string, + oldHeader?: string, + newHeader?: string, + options?: PatchOptions +): string; + +/** + * This method is similar to `createTwoFilesPatch()`, but returns a data structure suitable for further processing. + * Parameters are the same as `createTwoFilesPatch()`. + * + * @param oldFileName String to be output in the `oldFileName` hunk property. + * @param newFileName String to be output in the `newFileName` hunk property. + * @param oldStr Original string value. + * @param newStr New string value. + * @param oldHeader Additional information to include in the `oldHeader` hunk property. + * @param newHeader Additional information to include in the `newHeader` hunk property. + * @returns An object with an array of hunk objects. + */ +export function structuredPatch( + oldFileName: string, + newFileName: string, + oldStr: string, + newStr: string, + oldHeader?: string, + newHeader?: string, + options?: PatchOptions +): ParsedDiff; + +/** + * Applies a unified diff patch. + * + * @param patch May be a string diff or the output from the `parsePatch()` or `structuredPatch()` methods. + * @returns A string containing new version of provided data. + */ +export function applyPatch( + source: string, + patch: string | ParsedDiff | [ParsedDiff], + options?: ApplyPatchOptions +): string; + +/** + * Applies one or more patches. + * This method will iterate over the contents of the patch and apply to data provided through callbacks. + * + * The general flow for each patch index is: + * + * 1. `options.loadFile(index, callback)` is called. The caller should then load the contents of the file + * and then pass that to the `callback(err, data)` callback. Passing an `err` will terminate further patch execution. + * 2. `options.patched(index, content, callback)` is called once the patch has been applied. `content` will be + * the return value from `applyPatch()`. When it's ready, the caller should call `callback(err)` callback. + * Passing an `err` will terminate further patch execution. + * 3. Once all patches have been applied or an error occurs, the `options.complete(err)` callback is made. + */ +export function applyPatches(patch: string | ParsedDiff[], options: ApplyPatchesOptions): void; + +/** + * Parses a patch into structured data. + * + * @returns A JSON object representation of the a patch, suitable for use with the `applyPatch()` method. + */ +export function parsePatch(diffStr: string, options?: { strict?: boolean }): ParsedDiff[]; + +/** + * Converts a list of changes to a serialized XML format. + */ +export function convertChangesToXML(changes: Change[]): string; + +/** + * Converts a list of changes to [DMP](http://code.google.com/p/google-diff-match-patch/wiki/API) format. + */ +export function convertChangesToDMP(changes: Change[]): Array<[1 | 0 | -1, string]>; + +export function merge(mine: string, theirs: string, base: string): ParsedDiff; + +export function canonicalize(obj: any, stack: any[], replacementStack: any[]): any; diff --git a/types/diff/tsconfig.json b/types/diff/tsconfig.json index 9a1fdba840..b32089d091 100644 --- a/types/diff/tsconfig.json +++ b/types/diff/tsconfig.json @@ -2,12 +2,11 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -21,4 +20,4 @@ "index.d.ts", "diff-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/diff/tslint.json b/types/diff/tslint.json index 1b7b2672e6..3db14f85ea 100644 --- a/types/diff/tslint.json +++ b/types/diff/tslint.json @@ -1,7 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "interface-name": false, - "export-just-namespace": false - } -} +{ "extends": "dtslint/dt.json" } diff --git a/types/diff/v3/diff-tests.ts b/types/diff/v3/diff-tests.ts new file mode 100644 index 0000000000..2f640da490 --- /dev/null +++ b/types/diff/v3/diff-tests.ts @@ -0,0 +1,122 @@ +import jsdiff = require('diff'); +const one = 'beep boop'; +const other = 'beep boob blah'; + +let diff = jsdiff.diffChars(one, other); +printDiff(diff); + +const diffArraysResult = jsdiff.diffArrays(['a', 'b', 'c'], ['a', 'c', 'd']); +diffArraysResult.forEach(result => { + if (result.added) { + console.log(`added ${result.value.length} line(s):`, ...result.value); + } else if (result.removed) { + console.log(`removed ${result.value.length} line(s):`, ...result.value); + } else { + console.log(`no changes`); + } +}); + +interface DiffObj { + value: number; +} +const a: DiffObj = {value: 0}; +const b: DiffObj = {value: 1}; +const c: DiffObj = {value: 2}; +const d: DiffObj = {value: 3}; +const arrayOptions: jsdiff.IArrayOptions = { + comparator: (left: DiffObj, right: DiffObj) => { + return left.value === right.value; + } +}; +const diffResult = jsdiff.diffArrays([a, b, c], [a, b, d], arrayOptions); +diffResult.forEach(result => { + if (result.added) { + console.log(`added ${result.value.length} line(s):`, ...result.value); + } else if (result.removed) { + console.log(`removed ${result.value.length} line(s):`, ...result.value); + } else { + console.log(`no changes`); + } +}); + +// -------------------------- + +class LineDiffWithoutWhitespace extends jsdiff.Diff { + tokenize(value: string): any { + return value.split(/^/m); + } + + equals(left: string, right: string): boolean { + return left.trim() === right.trim(); + } +} + +const obj = new LineDiffWithoutWhitespace(); +diff = obj.diff(one, other); +printDiff(diff); + +function printDiff(diff: jsdiff.IDiffResult[]) { + function addLineHeader(decorator: string, str: string | string[]) { + return (typeof str === 'string' ? str.split("\n") : str).map((line, index, array) => { + if (index === array.length - 1 && line === "") { + return line; + } else { + return decorator + line; + } + }).join("\n"); + } + + diff.forEach((part) => { + if (part.added) { + console.log(addLineHeader("+", part.value)); + } else if (part.removed) { + console.log(addLineHeader("-", part.value)); + } else { + console.log(addLineHeader(" ", part.value)); + } + }); +} + +function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) { + const verifyPatch = jsdiff.parsePatch( + jsdiff.createTwoFilesPatch("oldFile.ts", "newFile.ts", oldStr, newStr, + "old", "new", { context: 1 })); + + if (JSON.stringify(verifyPatch[0], Object.keys(verifyPatch[0]).sort()) !== JSON.stringify(uniDiff, Object.keys(uniDiff).sort())) { + console.error("Patch did not match uniDiff"); + } +} +function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) { + const verifyApply = [ + jsdiff.applyPatch(oldStr, uniDiff), + jsdiff.applyPatch(oldStr, [uniDiff]) + ]; + jsdiff.applyPatches([uniDiff], { + loadFile: (index: number, callback: (err: Error, data: string) => void) => { + callback(undefined, one); + }, + patched: (index: number, content: string) => { + verifyApply.push(content); + }, + complete: (err?: Error) => { + if (err) { + console.error(err); + } + + verifyApply.forEach(result => { + if (result !== newStr) { + console.error("Result did not match newStr"); + } + }); + } + }); +} + +const uniDiffPatch = jsdiff.structuredPatch("oldFile.ts", "newFile.ts", one, other, + "old", "new", { context: 1 }); +verifyPatchMethods(one, other, uniDiffPatch); + +const uniDiffStr = jsdiff.createPatch("file.ts", one, other, "old", "new", + { context: 1 }); +const uniDiffApply = jsdiff.parsePatch(uniDiffStr)[0]; +verifyApplyMethods(one, other, uniDiffApply); diff --git a/types/diff/v3/index.d.ts b/types/diff/v3/index.d.ts new file mode 100644 index 0000000000..760aee4e61 --- /dev/null +++ b/types/diff/v3/index.d.ts @@ -0,0 +1,121 @@ +// Type definitions for diff 3.5 +// Project: https://github.com/kpdecker/jsdiff +// Definitions by: vvakame +// szdc +// moc-yuto +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export = JsDiff; +export as namespace JsDiff; + +declare namespace JsDiff { + interface IOptions { + ignoreCase: boolean; + } + + interface ILinesOptions extends IOptions { + ignoreWhitespace?: boolean; + newlineIsToken?: boolean; + } + + interface IArrayOptions { + comparator?: (left: any, right: any) => boolean; + } + + interface IDiffResult { + value: string; + count?: number; + added?: boolean; + removed?: boolean; + } + + interface IDiffArraysResult { + value: T[]; + count?: number; + added?: boolean; + removed?: boolean; + } + + interface IBestPath { + newPos: number; + componenets: IDiffResult[]; + } + + interface IHunk { + oldStart: number; + oldLines: number; + newStart: number; + newLines: number; + lines: string[]; + } + + interface IUniDiff { + oldFileName: string; + newFileName: string; + oldHeader: string; + newHeader: string; + index: string; + hunks: IHunk[]; + } + + class Diff { + diff(oldString: string, newString: string, options?: IOptions): IDiffResult[]; + + pushComponent(components: IDiffResult[], added: boolean, removed: boolean): void; + + extractCommon(basePath: IBestPath, newString: string, oldString: string, diagonalPath: number): number; + + equals(left: string, right: string): boolean; + + removeEmpty(array: any[]): any[]; + + castInput(value: any): any; + + join(chars: string[]): string; + + tokenize(value: string): any; // return types are string or string[] + } + + function diffChars(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; + + function diffWords(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; + + function diffWordsWithSpace(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; + + function diffJson(oldObj: object, newObj: object, options?: IOptions): IDiffResult[]; + + function diffLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[]; + + function diffCss(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; + + function diffTrimmedLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[]; + + function diffSentences(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; + + function diffArrays(oldArr: T[], newArr: T[], options?: IArrayOptions): Array>; + + function createPatch(fileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string; + + function createTwoFilesPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string; + + function structuredPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): IUniDiff; + + function applyPatch(oldStr: string, uniDiff: string | IUniDiff | IUniDiff[]): string; + + function applyPatches(uniDiff: IUniDiff[], options: { + loadFile(index: number, callback: (err: Error, data: string) => void): void, + patched(index: number, content: string): void, + complete(err?: Error): void + }): void; + + function parsePatch(diffStr: string, options?: {strict: boolean}): IUniDiff[]; + + function convertChangesToXML(changes: IDiffResult[]): string; + + function convertChangesToDMP(changes: IDiffResult[]): Array<{0: number; 1: string; }>; + + function merge(mine: string, theirs: string, base: string): IUniDiff; + + function canonicalize(obj: any, stack: any[], replacementStack: any[]): any; +} diff --git a/types/diff/v3/tsconfig.json b/types/diff/v3/tsconfig.json new file mode 100644 index 0000000000..92e1861ec8 --- /dev/null +++ b/types/diff/v3/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "diff": [ + "diff/v3" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "diff-tests.ts" + ] +} diff --git a/types/diff/v3/tslint.json b/types/diff/v3/tslint.json new file mode 100644 index 0000000000..1b7b2672e6 --- /dev/null +++ b/types/diff/v3/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "interface-name": false, + "export-just-namespace": false + } +} diff --git a/types/dlv/dlv-tests.ts b/types/dlv/dlv-tests.ts new file mode 100644 index 0000000000..abe4b259c3 --- /dev/null +++ b/types/dlv/dlv-tests.ts @@ -0,0 +1,44 @@ +import dlv from 'dlv'; + +const obj = { + undef: undefined, + zero: 0, + one: 1, + n: null, + f: false, + a: { + two: 2, + b: { + three: 3, + c: { + four: 4 + } + } + } +}; + +// Test without defaults +dlv(obj, ''); +dlv(obj, 'one'); +dlv(obj, 'one.two'); +dlv(obj, 'a'); +dlv(obj, 'a.two'); +dlv(obj, 'a.b'); +dlv(obj, 'a.b.three'); +dlv(obj, 'a.b.c'); +dlv(obj, 'a.b.c.four'); +dlv(obj, 'n'); +dlv(obj, 'n.badkey'); +dlv(obj, 'f'); +dlv(obj, 'f.badkey'); + +// Test defaults +dlv(obj, '', 'foo'); +dlv(obj, 'undef', 'foo'); +dlv(obj, 'n', null); +dlv(obj, 'n.badkey', 'foo'); +dlv(obj, 'zero', 0); +dlv(obj, 'a.badkey', 'foo'); +dlv(obj, 'a.badkey.anotherbadkey', 'foo'); +dlv(obj, 'f', false); +dlv(obj, 'f.badkey', 'foo'); diff --git a/types/dlv/index.d.ts b/types/dlv/index.d.ts new file mode 100644 index 0000000000..5813ec0595 --- /dev/null +++ b/types/dlv/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for dlv 1.1 +// Project: https://github.com/developit/dlv#readme +// Definitions by: Ryan Sonshine +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/** + * Safely get a dot-notated path within a nested object, with ability to + * return a default if the full key path does not exist or the value is + * undefined + */ +export default function dlv(object: object, key: string | string[], defaultValue?: any): any; diff --git a/types/webdriverio/tsconfig.json b/types/dlv/tsconfig.json similarity index 75% rename from types/webdriverio/tsconfig.json rename to types/dlv/tsconfig.json index 654e7fc599..222ce070e7 100644 --- a/types/webdriverio/tsconfig.json +++ b/types/dlv/tsconfig.json @@ -2,13 +2,11 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": false, "baseUrl": "../", "typeRoots": [ "../" @@ -16,10 +14,10 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, - "target": "es2015" + "strictFunctionTypes": true }, "files": [ "index.d.ts", - "webdriverio-tests.ts" + "dlv-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/dlv/tslint.json b/types/dlv/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dlv/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index bdbda1ed95..0581057dea 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -174,6 +174,10 @@ declare namespace Dockerode { update(options: {}, callback: Callback): void; update(options: {}): Promise; + + logs(options: ContainerLogsOptions, callback: Callback): void; + logs(callback: Callback): void; + logs(options?: ContainerLogsOptions): Promise; } class Task { diff --git a/types/dot-object/dot-object-tests.ts b/types/dot-object/dot-object-tests.ts index a553c6c68d..c87c6f5a80 100644 --- a/types/dot-object/dot-object-tests.ts +++ b/types/dot-object/dot-object-tests.ts @@ -47,12 +47,21 @@ var newObj = { nested: { value: 'Hi there!' } + }, + breath: { + value: 'Hello' } }; var val = dot.pick('some.nested.value', newObj); console.log(val); +// Set a new value +val = dot.str('breath.value', 'World', newObj); + +// Replacing with a new object +val = dot.set('breath', { value: 'Goodbye' }, newObj); + // Pick & Remove the value val = dot.pick('some.nested.value', newObj, true); diff --git a/types/dot-object/index.d.ts b/types/dot-object/index.d.ts index 8bb7d0657c..ef119a3424 100644 --- a/types/dot-object/index.d.ts +++ b/types/dot-object/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for Dot-Object v1.5 +// Type definitions for Dot-Object 1.7 // Project: https://github.com/rhalff/dot-object // Definitions by: Niko Kovaฤiฤ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 declare namespace DotObject { @@ -120,12 +121,25 @@ declare namespace DotObject { */ remove(path: string, obj: any): any; /** + * + * Replace/create with a string + * * @param {String} path dotted path * @param {String} v value to be set * @param {Object} obj object to be modified * @param {Function|Array} mods optional modifier */ - str(path: string, v: any, obj: Object, mods?: ModifierFunctionWrapper | Array): void; + str(path: string, v: any, obj: object, mods?: ModifierFunctionWrapper | Array): void; + /** + * + * Replace/merge an object to an existing object property + * + * @param {String} path dotted path + * @param {Object} v object to be set + * @param {Object} obj object to be modified + * @param {Boolean} merge optional merge + */ + set(path: string, v: any, obj: object, merge?: boolean): void; /** * * Transfer a property from one object to another object. diff --git a/types/dot-object/tslint.json b/types/dot-object/tslint.json index a41bf5d19a..a0357daa61 100644 --- a/types/dot-object/tslint.json +++ b/types/dot-object/tslint.json @@ -7,7 +7,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/dotenv-flow/dotenv-flow-tests.ts b/types/dotenv-flow/dotenv-flow-tests.ts new file mode 100644 index 0000000000..c1d12834db --- /dev/null +++ b/types/dotenv-flow/dotenv-flow-tests.ts @@ -0,0 +1,18 @@ +import dotenv = require("dotenv-flow"); + +const env = dotenv.config(); +const dbUrl: string | null = env.error || !env.parsed ? null : env.parsed["BASIC"]; + +dotenv.load({ + cwd: "someDir", + encoding: "utf8", + purge_dotenv: true +}); + +const parsed = dotenv.parse("NODE_ENV=production\nDB_HOST=a.b.c"); +const dbHost: string = parsed["DB_HOST"]; + +const parsedFromBuffer = dotenv.parse(new Buffer("JUSTICE=league\n"), { + debug: true +}); +const justice: string = parsedFromBuffer["JUSTICE"]; diff --git a/types/dotenv-flow/index.d.ts b/types/dotenv-flow/index.d.ts new file mode 100644 index 0000000000..33a494c4a8 --- /dev/null +++ b/types/dotenv-flow/index.d.ts @@ -0,0 +1,62 @@ +// Type definitions for dotenv-flow 0.2 +// Project: https://github.com/motdotla/dotenv +// Definitions by: Vincent Langlet +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export interface DotenvParseOptions { + /** + * You may turn on logging to help debug why certain keys or values are not being set as you expect. + */ + debug?: boolean; +} + +export interface DotenvParseOutput { + [name: string]: string; +} + +/** + * Parses a string or buffer in the .env file format into an object. + * + * @param src - contents to be parsed + * @param options - additional options + * @returns an object with keys and values based on `src` + */ +export function parse( + src: string | Buffer, + options?: DotenvParseOptions +): DotenvParseOutput; + +export interface DotenvConfigOptions { + /** + * You may specify a custom path if your file containing environment variables is located elsewhere. + */ + cwd?: string; + + /** + * You may specify the encoding of your file containing environment variables. + */ + encoding?: string; + + /** + * In some cases the original "dotenv" library can be used by one of the dependent npm modules. Use to fix this. + */ + purge_dotenv?: boolean; +} + +export interface DotenvConfigOutput { + error?: Error; + parsed?: DotenvParseOutput; +} + +/** + * Loads `.env` file contents into {@link https://nodejs.org/api/process.html#process_process_env | `process.env`}. + * Example: 'KEY=value' becomes { parsed: { KEY: 'value' } } + * + * @param options - controls behavior + * @returns an object with a `parsed` key if successful or `error` key if an error occurred + * + */ +export function config(options?: DotenvConfigOptions): DotenvConfigOutput; +export const load: typeof config; diff --git a/types/dotenv-flow/tsconfig.json b/types/dotenv-flow/tsconfig.json new file mode 100644 index 0000000000..376a2532ce --- /dev/null +++ b/types/dotenv-flow/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dotenv-flow-tests.ts" + ] +} diff --git a/types/dotenv-flow/tslint.json b/types/dotenv-flow/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dotenv-flow/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/drivelist/drivelist-tests.ts b/types/drivelist/drivelist-tests.ts new file mode 100644 index 0000000000..9e1f04bf35 --- /dev/null +++ b/types/drivelist/drivelist-tests.ts @@ -0,0 +1,59 @@ +import * as drivelist from "drivelist"; + +drivelist.list((error, drives) => { + if (!error) { + drives.forEach(drive => { + const { + enumerator, + busType, + busVersion, + device, + devicePath, + raw, + description, + error, + size, + blockSize, + logicalBlockSize, + mountpoints, + isReadOnly, + isSystem, + isVirtual, + isRemovable, + isCard, + isSCSI, + isUSB, + isUAS + } = drive; + + enumerator; // $ExpectType string + busType; // $ExpectType BusType + busVersion; // $ExpectType string | null + device; // $ExpectType string + devicePath; // $ExpectType string | null + raw; // $ExpectType string + description; // $ExpectType string + error; // $ExpectType any + size; // $ExpectType number | null + blockSize; // $ExpectType number | null + logicalBlockSize; // $ExpectType number | null + + mountpoints; // $ExpectType MountPoint[] + mountpoints.forEach(mountpoint => { + const { path, label } = mountpoint; + + path; // $ExpectType string + label; // $ExpectType string | undefined + }); + + isReadOnly; // $ExpectType boolean + isSystem; // $ExpectType boolean + isVirtual; // $ExpectType boolean | null + isRemovable; // $ExpectType boolean | null + isCard; // $ExpectType boolean | null + isSCSI; // $ExpectType boolean | null + isUSB; // $ExpectType boolean | null + isUAS; // $ExpectType boolean | null + }); + } +}); diff --git a/types/drivelist/index.d.ts b/types/drivelist/index.d.ts new file mode 100644 index 0000000000..d2acd039df --- /dev/null +++ b/types/drivelist/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for drivelist 6.4 +// Project: https://github.com/resin-io-modules/drivelist +// Definitions by: Xiao Deng +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export type BusType = "SATA" | "SCSI" | "ATA" | "IDE" | "PCI" | "UNKNOWN"; + +export interface MountPoint { + path: string; + label?: string; +} + +export interface Drive { + enumerator: string; + busType: BusType; + busVersion: string | null; + device: string; + devicePath: string | null; + raw: string; + description: string; + error: any; // can be null + size: number | null; + blockSize: number | null; + logicalBlockSize: number | null; + mountpoints: MountPoint[]; + isReadOnly: boolean; + isSystem: boolean; + isVirtual: boolean | null; + isRemovable: boolean | null; + isCard: boolean | null; + isSCSI: boolean | null; + isUSB: boolean | null; + isUAS: boolean | null; +} + +export function list(callback: (error: any, drives: Drive[]) => void): void; diff --git a/types/drivelist/tsconfig.json b/types/drivelist/tsconfig.json new file mode 100644 index 0000000000..0dd1a9ecdd --- /dev/null +++ b/types/drivelist/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "drivelist-tests.ts" + ] +} diff --git a/types/drivelist/tslint.json b/types/drivelist/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/drivelist/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/dwt/Dynamsoft.d.ts b/types/dwt/Dynamsoft.d.ts new file mode 100644 index 0000000000..65569f61b3 --- /dev/null +++ b/types/dwt/Dynamsoft.d.ts @@ -0,0 +1,113 @@ +declare namespace Dynamsoft { + let Lib: DynamsoftLib; + let WebTwainEnv: dwtEnv; + namespace WebTwain { + namespace Addon { + let OCRPro: OCRProAddon; + } + } + namespace DWT { + let defaultEnv: dwtEnv; + } +} + +declare const dwt: WebTwain; + +interface dwtEnv { + ActiveXInstallWithCAB: boolean; + ActiveXVersion: string; + AutoLoad: boolean; + CloseDialog(): void; + ContainerMap: {}; + Containers: Container[]; + CreateDWTObject(newObjID: string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void; + CreateDWTObject(newObjID: string, ip: number | string, port: number | string, portSSL: number | string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void; + Debug: boolean; + DeleteDWTObject(objID: string): void; + DynamicContainers: string[]; + DynamicDWTMap: {}; + GetWebTwain(cid: string): WebTwain; + IfUpdateService: boolean; + IfUseActiveXForIE10Plus: boolean; + JSVersion: string; + Load(): void; + + /*ignored + OnWebTwainInitMessage OnWebTwainNeedUpgrade OnWebTwainNeedUpgradeWebJavascript OnWebTwainNotFound OnWebTwainOldPluginNotAllowed + */ + + OnWebTwainPostExecute(): void; + OnWebTwainPreExecute(): void; + + /*ignored + OnWebTwainReady + */ + + PluginVersion: string; + ProductKey: string; + RegisterEvent(event: string, fn: (...args: any[]) => void): void; + RemoveAllAuthorizations(): void; + ResourcesPath: string; + ServerVersionInfo: string; + ShowDialog(_dialogWidth: number, _dialogHeight: number, _strDialogMessageWithHtmlFormat: string, _bChangeImage: boolean, bHideCloseButton: boolean): void; + Trial: boolean; + Unload(): void; + UseDefaultInstallUI: boolean; + initQueue: any[]; + inited: boolean; +} + +interface DynamsoftLib { + /*ignored + Addon_Events Addon_Sendback_Events AttachAndShowImage BIO DOM DynamicLoadAddonFuns DynamicWebTwain EnumMouseButton + Errors Events IntToColorStr LS OnGetImageByURL OnGetImageFromServer Path ProgressBar UI Uri + addEventListener ajax all appendMessage appendRichMessage aryControlLoadImage attachAddon attachProperty + base64 bio cancelFrome clearMessage closeAll closeProgress colorStrToInt config css currentStyle + debug*/ + + detect: { + /*ignored + OnCreatWS OnDetectNext OnWebTwainPostExecute OnWebTwainPreExecute StartWSByIPTimeoutId StartWSTimeoutId + aryReconnectSTwains arySTwains arySTwainsByIP bFirst bNeedUpgradeEvent bNoControlEvent bOK bPromptJSOrServerOutdated + cUrlIndex dcpCallbackType dcpStatus detectType getVersionArray global_dlg hideMask isDWTVersionLatest onNoControl + onNotAllowedForChrome ports scriptLoaded showMask starting tryTimes*/ + ssl: boolean; + }; + + /*ignored + detectButton dialog dialogShowStatus dlgProgress dlgRef drawBoxBorder drawImageWithHermite + each empty endsWith + */ + + env: { + WSSession: number, WSVersion: string, + bChrome: boolean, bEdge: boolean, bFileSystem: boolean, bFirefox: boolean, + bIE: boolean, bLinux: boolean, bMac: boolean, bSafari: boolean, bWin: boolean, bWin64: boolean, + basePath: string, iPluginLength: number, isX64: boolean, pathType: number, + strChromeVersion: string, strFirefoxVersion: string, strIEVersion: string + }; + + /*ignored + error escapeHtml escapeRegExp extend filter fireEvent fromUnicode get getColor getCss + getElDimensions getHex getHexColor getHttpUrl getLogger getOffset getRandom getRealPath getScript + getWS getWSUrl getWheelDelta globalEval guid hide html5 imageControlCount indexOf install + io isArray isBoolean isDef isFunction isLocalIP isNaN isNull isNumber isObject + isPlainObject isString isUndef isUndefined isWindow keys log main makeArray mix + needShowTwiceShowDialog nil noop now obj one page param parse parseHTML parser + product progressMessage ready removeEventListener replaceAll replaceControl show showProgress startWS + startWSByIP startsWith stopPropagation stringify style support switchEvent tmp toggle trim + type unEscapeHtml unparam upperCaseFirst urlDecode urlEncode utf8 win + ...other internal ones + */ + hideMask(): void; + showMask(): void; +} + +/** + * interface for a DWT container which basically defines a DIV on the page + */ +interface Container { + ContainerId: string; + Width: string | number; + Height: string | number; +} diff --git a/types/dwt/addon.ocr.d.ts b/types/dwt/addon.ocr.d.ts new file mode 100644 index 0000000000..5020d5eec3 --- /dev/null +++ b/types/dwt/addon.ocr.d.ts @@ -0,0 +1,192 @@ +declare enum EnumDWT_OCRLanguage { + OCRL_ENG = "eng", + OCRL_ARA = "ara", + OCRL_CHI_SIM = "chi_sim", + OCRL_CHI_TRA = "chi_tra", + OCRL_HIN = "hin", + OCRL_URD = "urd", + OCRL_SPA = "spa", + OCRL_FRA = "fra", + OCRL_MSA = "msa", + OCRL_IND = "ind", + OCRL_RUS = "rus", + OCRL_BEN = "ben", + OCRL_POR = "por", + OCRL_PAN = "pan", + OCRL_DEU = "deu", + OCRL_JPN = "jpn", + OCRL_FAS = "fas", + OCRL_SWA = "swa", + OCRL_JAV = "jav", + OCRL_TEL = "tel", + OCRL_TUR = "tur", + OCRL_KOR = "kor", + OCRL_MAR = "mar", + OCRL_TAM = "tam", + OCRL_VIE = "vie", + OCRL_ITA = "ita", + OCRL_THA = "tha" +} + +declare enum EnumDWT_OCRPageSetMode { + OCRPSM_OSD_ONLY = 0, + PSM_AUTO_OSD = 1, + PSM_AUTO_ONLY = 2, + PSM_AUTO = 3, + PSM_SINGLE_COLUMN = 4, + PSM_SINGLE_BLOCK_VERT_TEXT = 5, + PSM_SINGLE_BLOCK = 6, + PSM_SINGLE_LINE = 7, + PSM_SINGLE_WORD = 8, + PSM_CIRCLE_WORD = 9, + PSM_SINGLE_CHAR = 10 +} + +declare enum EnumDWT_OCROutputFormat { + OCROF_TEXT = 0, + OCROF_PDFPLAINTEXT = 1, + OCROF_PDFIMAGEOVERTEXT = 2, + OCROF_PDFPLAINTEXT_PDFX = 3, + OCROF_PDFIMAGEOVERTEXT_PDFX = 4 +} + +/** + * @class + */ +interface OCR { + /** + * Downloads and installs the ocr add-on on the local system. + * @method Dynamsoft.WebTwain#Download + * @param {string} remoteFile specifies the value of which frame to get. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + Download(remoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; + + /** + * Downloads and deploys the OCR language package on the local system. + * @method Dynamsoft.WebTwain#DownloadLangData + * @param {string} remoteFile specifies the value of which frame to get. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + DownloadLangData(remoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; + + /** + * Performs OCR on a given image. + * @method Dynamsoft.WebTwain#Read + * @param {number} sImageIndex Specifies the index of the image. + * @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess. + * @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure. + * @return {boolean} + */ + Recognize(sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; + + /** + * Peforms OCR on the given rectangle on a specified image. + * @method Dynamsoft.WebTwain#ReadRect + * @param {number} sImageIndex Specifies the index of the image. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess. + * @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure. + * @return {boolean} + */ + RecognizeRect(sImageIndex: number, left: number, top: number, right: number, bottom: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; + + /** + * Performs OCR on one or multiple specified local file(s) directly. + * @method Dynamsoft.WebTwain#Read + * @param {string} fileNames Specifies the local paths of the target files. If multiple files are given, they should be separated by the '|' character. + * @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess. + * @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure. + * @return {boolean} + */ + RecognizeFile(fileNames: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; + + /** + * Performs OCR on the currently selected images in the buffer. + * @method Dynamsoft.WebTwain#Read + * @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess. + * @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure. + * @return {boolean} + */ + RecognizeSelectedImages(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; + + /** + * Specifies a font to be used by OCR when Addon.OCR.SetIfUseDetectedFont is set to false. + * @method Dynamsoft.WebTwain#SetUnicodeFontName + * @param {string} name Specifies a font to be used by + * @return {boolean} + */ + SetUnicodeFontName(name: string): void; + + /** + * Returns the detected OCR font name. + * @method Dynamsoft.WebTwain#GetUnicodeFontName + * @return {string} Returns the detected OCR font name. + */ + GetUnicodeFontName(): void; + + /** + * Determines whether PDF output should use the fonts detected by the OCR system, or the default/provided fonts instead. + * @method Dynamsoft.WebTwain#SetIfUseDetectedFont + * @param {boolean} bValue By default this is true, indicating detected fonts should be used. The detected fonts must exist on the user's system for this to be successful. + * @return {boolean} + */ + SetIfUseDetectedFont(bValue: boolean): void; + + /** + * Returns whether PDF output should use the fonts detected by the OCR system, or the default/provided fonts instead. + * @method Dynamsoft.WebTwain#GetIfUseDetectedFont + * @return {boolean} Returns whether PDF output should use the fonts detected by the OCR system, or the default/provided fonts instead. + */ + GetIfUseDetectedFont(): void; + + /** + * Applies higher-level accuracy of OCR to the area of the image where the font size is bigger than the value set here. + * @method Dynamsoft.WebTwain#SetIfUseDetectedFont + * @param {number} nValue Specifies the font size base to apply the higher-level accracy OCR. The default value is 0 which means no regional accurate OCR is performed. + * @return {boolean} + */ + SetMinFontSizeforMoreAccurateResult(nValue: number): void; + + /** + * Returns the font size base to apply higher-level regional accarate OCR which is set through Addon.OCR.SetMinFontSizeforMoreAccurateResult. + * @method Dynamsoft.WebTwain#GetMinFontSizeforMoreAccurateResult + * @return {boolean} Returns the font size base to apply higher-level regional accarate OCR. If the return value is 0, it indicates no regional accurate OCR is performed. + */ + GetMinFontSizeforMoreAccurateResult(): void; + + /** + * Sets the target language for OCR operations. + * @method Dynamsoft.WebTwain#SetLanguage + * @param {string} value Specifies the target language for OCR operation. + * @return {boolean} + */ + SetLanguage(value: string): void; + + /** + * Sets the mode for OCR page layout analysis. Determines how pages are determined when processing OCR. + * @method Dynamsoft.WebTwain#SetPageSetMode + * @param {EnumDWT_OCRPageSetMode} value Specifies the OCR Page layout analysis mode. + * @return {boolean} + */ + SetPageSetMode(value: EnumDWT_OCRPageSetMode): void; + + /** + * Sets the OCR result format. Determines whether the OCR output is in text or PDF format. + * @method Dynamsoft.WebTwain#SetOutputFormat + * @param {EnumDWT_OCROutputFormat} value Specifies the OCR result format. + * @return {boolean} + */ + SetOutputFormat(value: EnumDWT_OCROutputFormat): void; +} + +interface WebTwainAddon { + OCR: OCR; +} diff --git a/types/dwt/addon.ocrp.d.ts b/types/dwt/addon.ocrp.d.ts new file mode 100644 index 0000000000..48931bea9d --- /dev/null +++ b/types/dwt/addon.ocrp.d.ts @@ -0,0 +1,164 @@ +interface Redaction { + FindText: string; + FindTextFlags: EnumDWT_OCRFindTextFlags.OCRFT_WHOLEWORD; + FindTextAction: EnumDWT_OCRFindTextAction.OCRFT_MARKFORREDACT; +} + +interface OCRZone { + left: number; + top: number; + right: number; + bottom: number; +} + +interface OCRReadPara { + STWAIN: WebTwain; + AjaxFunctionUrl: string; + FunctionName: string; + ImageIndex: number; + FileNames: string; + Type: string; + AryZone: number[]; + JsonString: string; + OnSuccess(): void; + OnFailure(): void; +} + +interface OCRError { + responseText: string; + errorString: string; +} + +interface Settings { + RecognitionModule: string; + Languages: string; + OutputFormat: EnumDWT_OCRProOutputFormat; + PDFVersion: EnumDWT_OCRProPDFVersion; + PDFAVersion: EnumDWT_OCRProPDFAVersion; + LicenseChecker: string; + Redaction: Redaction; +} + +interface DynamsoftLib { + NewRedaction(): Redaction; + NewOCRReadPara(): OCRReadPara; + NewOCRZone(): OCRZone; +} + +interface OCRProAddon { + NewOCRError(): OCRError; + NewOCRReadPara(): OCRReadPara; + NewOCRZone(): OCRZone; + NewSettings(): Settings; +} + +declare enum EnumDWT_OCRFindTextFlags { + OCRFT_WHOLEWORD = 1, + OCRFT_MATCHCASE = 2, + OCRFT_FUZZYMATCH = 4 +} +declare enum EnumDWT_OCRFindTextAction { + OCRFT_HIGHLIGHT = 0, + OCRFT_STRIKEOUT = 1, + OCRFT_MARKFORREDACT = 2 +} + +declare enum EnumDWT_OCRProOutputFormat { + OCRPFT_IOTPDF = "IOTPDF", + OCRPFT_IOTPDF_MRC = "IOTPDF_MRC", + OCRPFT_TXTCSV = "TXTCSV", + OCRPFT_TXTF = "TXTF", + OCRPFT_TXTS = "TXTS", + OCRPFT_XML = "XML" +} + +declare enum EnumDWT_OCRProPDFAVersion { + OCRPPDFAV_1A = "pdf/a-1a", + OCRPPDFAV_1B = "pdf/a-1b", + OCRPPDFAV_2A = "pdf/a-2a", + OCRPPDFAV_2B = "pdf/a-2b", + OCRPPDFAV_2U = "pdf/a-2u", + OCRPPDFAV_3A = "pdf/a-3a", + OCRPPDFAV_3B = "pdf/a-3b", + OCRPPDFAV_3U = "pdf/a-3u" +} + +declare enum EnumDWT_OCRProPDFVersion { + OCRPPDFV_0 = "1.0", + OCRPPDFV_1 = "1.1", + OCRPPDFV_2 = "1.2", + OCRPPDFV_3 = "1.3", + OCRPPDFV_4 = "1.4", + OCRPPDFV_5 = "1.5", + OCRPPDFV_6 = "1.6", + OCRPPDFV_7 = "1.7" +} + +declare enum EnumDWT_OCRProRecognitionModule { + OCRPM_AUTO = "AUTO", + OCRPM_MOSTACCURATE = "MOSTACCURATE", + OCRPM_BALANCED = "BALANCED", + OCRPM_FASTEST = "FASTEST" +} + +declare enum EnumDWT_OCRProType { + OCRDT_File = 0, + OCRDT_Index = 1 +} + +interface OCRPro { + /** + * Returns whether OCR Pro addon is installed + * @return {boolean} + */ + IsModuleInstalled(): boolean; + + /** + * Downloads and installs the ocr add-on on the local system. + * @param {string} remoteFile specifies the URL to download a ZIP which contains the OCR Pro addon + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {void} + */ + Download(remoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; + + /** + * Performs OCR on a given image. + * @param {number} sImageIndex Specifies the index of the image. + * @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess. + * @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure. + * @return {void} + */ + Recognize(sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; + + /** + * Performs OCR on one or multiple specified local file(s) directly. + * @param {string} fileNames Specifies the local paths of the target files. If multiple files are given, they should be separated by the '|' character. + * @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess. + * @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure. + * @return {void} + */ + RecognizeFile(fileNames: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; + + /** + * Peforms OCR on the given rectangle on a specified image. + * @param {number} sImageIndex Specifies the index of the image. + * @param {number[]} aryZone specifies the coordinates of the rectangle. + * @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess. + * @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure. + * @return {void} + */ + RecognizeRect(sImageIndex: number, aryZone: number[], optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; + + /** + * Performs OCR on the currently selected images in the buffer. + * @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess. + * @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure. + * @return {void} + */ + RecognizeSelectedImages(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; +} + +interface WebTwainAddon { + OCRPro: OCRPro; +} diff --git a/types/dwt/addon.pdf.d.ts b/types/dwt/addon.pdf.d.ts index 6a2a8636ee..6f9ad5cec1 100644 --- a/types/dwt/addon.pdf.d.ts +++ b/types/dwt/addon.pdf.d.ts @@ -1,14 +1,3 @@ -/*! -* Dynamsoft WebTwain PDF Addon -* Based on Dynamsoft WebTwain JavaScript Intellisense -* Product: Dynamsoft Web Twain -* Web Site: http://www.dynamsoft.com -* -* Copyright 2018, Dynamsoft Corporation -* Author: Dynamsoft Support Team -* Version: 14.2 -*/ - declare enum EnumDWT_ConvertMode { CM_DEFAULT = 0, CM_RENDERALL = 1 @@ -73,7 +62,3 @@ interface PDF { interface WebTwainAddon { PDF: PDF; } - -interface WebTwain { - Addon: WebTwainAddon; -} diff --git a/types/dwt/addon.webcam.d.ts b/types/dwt/addon.webcam.d.ts new file mode 100644 index 0000000000..efb31cda3e --- /dev/null +++ b/types/dwt/addon.webcam.d.ts @@ -0,0 +1,334 @@ +/** -2400 to -2499 is webcam error code */ +declare enum EnumDWT_ErrorCode { + /** All error from directshow sdk */ + WCERR_SYSTEM = -2400, + /** Create ICreateDevEnum interface failed. */ + WCERR_FAIL_ICREATEDEVENUM = -2401, + /** Create IEnumMoniker interface failed. */ + WCERR_FAIL_IENUMMONIKER = -2402, + /** The camera doesn't support IAMVideoProcAmp interface. */ + WCERR_NOT_IAMVIDEOPROPERTY = -2403, + /** The camera doesn't support IAMCameraControl interface. */ + WCERR_NOT_IAMCAMERACONTROL = -2404, + /** The property doesn't support auto capability. */ + WCERR_NOT_AUTOPROPERTY = -2405, + /** No webcam device is found. */ + WCERR_NO_DEVICE = -2406, + /** Could not get video window interface */ + WCERR_FAIL_VIDEOWINDOW = -2407, + /** Could not create filter graph. */ + WCERR_FAIL_FILTERGRAPH = -2408, + /** Could not create SampleGrabber (isqedit.all registered?). */ + WCERR_FAIL_SAMPLEGRABBER = -2409, + /** Unable to make NULL renderer */ + WCERR_NULLRENDER = -2410, + /** Can't add the filter to graph */ + WCERR_FAIL_ADDFILTER = -2411, + /** Can't build the graph */ + WCERR_FAIL_BUILDGRAPH = -2412, + /** Failed to register filter graph with ROT. */ + WCERR_FAIL_REGFILTERGRAPH = -2413, + /** Time out */ + WCERR_GRAB_TIMEOUT = -2414 +} + +/** Specifies the video rotate mode on a video capture device. */ +declare enum EnumDWT_VideoRotateMode { + /** Don't rotate */ + VRM_NONE = 0, + /** 90 deg Clockwise */ + VRM_90_DEGREES_CLOCKWISE = 1, + /** 180 deg Clockwise */ + VRM_180_DEGREES_CLOCKWISE = 2, + /** 270 deg Clockwise */ + VRM_270_DEGREES_CLOCKWISE = 3, + /** Flip */ + VRM_FLIP_VERTICAL = 4, + /** Mirror */ + VRM_FLIP_HORIZONTAL = 5 +} + +/** Specifies video properties on a video capture device. */ +declare enum EnumDWT_VideoProperty { + /** Specifies the brightness, also called the black level. For NTSC, the value is expressed in IRE units * 100. + * For non-NTSC sources, the units are arbitrary, with zero representing blanking and 10,000 representing pure white. + * Values range from -10,000 to 10,000. + */ + VP_BRIGHTNESS = 0, + /** Specifies the contrast, expressed as gain factor * 100. Values range from zero to 10,000. */ + VP_CONTRAST = 1, + /** Specifies the hue, in degrees * 100. Values range from -180,000 to 180,000 (-180 to +180 degrees). */ + VP_HUE = 2, + /** Specifies the saturation. Values range from 0 to 10,000. */ + VP_SATURATION = 3, + /** Specifies the sharpness. Values range from 0 to 100. */ + VP_SHARPNESS = 4, + /** Specifies the gamma, as gamma * 100. Values range from 1 to 500. */ + VP_GAMMA = 5, + /** Specifies the color enable setting. The possible values are 0 (off) and 1 (on). */ + VP_COLORENABLE = 6, + /** Specifies the white balance, as a color temperature in degrees Kelvin. The range of values depends on the device. */ + VP_WHITEBALANCE = 7, + /** Specifies the backlight compensation setting. Possible values are 0 (off) and 1 (on). */ + VP_BACKLIGHTCOMPENSATION = 8, + /** Specifies the gain adjustment. Zero is normal. Positive values are brighter and negative values are darker. + * The range of values depends on the device. + */ + VP_GAIN = 9 +} + +/** Specifies a setting on a camera. */ +declare enum EnumDWT_CameraControlProperty { + /** Specifies the camera's pan setting, in degrees. Values range from -180 to +180, with the default set to zero. + * Positive values are clockwise from the origin (the camera rotates clockwise when viewed from above), + * and negative values are counterclockwise from the origin. + */ + CCP_PAN = 0, + /** Specifies the camera's tilt setting, in degrees. Values range from -180 to +180, with the default set to zero. + * Positive values point the imaging plane up, and negative values point the imaging plane down. + */ + CCP_TILT = 1, + /** Specifies the camera's roll setting, in degrees. Values range from -180 to +180, with the default set to zero. + * Positive values cause a clockwise rotation of the camera along the image-viewing axis, and negative values cause a counterclockwise rotation of the camera. + */ + CCP_ROLL = 2, + /** Specifies the camera's zoom setting, in millimeters. Values range from 10 to 600, and the default is specific to the device. */ + CCP_ZOOM = 3, + /** Specifies the exposure setting, in log base 2 seconds. In other words, for values less than zero, the exposure time is 1/2^n seconds, + * and for values zero or above, the exposure time is 2^n seconds. For example: + * Value Seconds + * -3 1/8 + * -2 1/4 + * -1 1/2 + * 0 1 + * 1 2 + * 2 4 + */ + CCP_EXPOSURE = 4, + /** Specifies the camera's iris setting, in units of fstop* 10. */ + CCP_IRIS = 5, + /** Specifies the camera's focus setting, as the distance to the optimally focused target, in millimeters. + * The range and default value are specific to the device. + */ + CCP_FOCUS = 6 +} + +interface WebcamMediaType { + GetCount(): number; + Get(index: number): string; + GetCurrent(): string; +} + +interface WebcamResolution { + GetCount(): number; + Get(index: number): string; + GetCurrent(): string; +} + +interface WebcamFrameRate { + GetCount(): number; + Get(index: number): string; + GetCurrent(): string; +} + +interface CameraControlMoreSetting { + GetMinValue(): number; + GetMaxValue(): number; + GetSteppingDelta(): number; + GetDefaultValue(): number; + GetIfAuto(): boolean; +} + +interface CameraControlSetting { + GetValue(): number; + GetIfAuto(): boolean; +} + +interface VideoPropertyMoreSetting { + GetMinValue(): number; + GetMaxValue(): number; + GetSteppingDelta(): number; + GetDefaultValue(): number; + GetIfAuto(): boolean; +} + +interface VideoPropertySetting { + GetValue(): number; + GetIfAuto(): boolean; +} + +/** + * @class + */ +interface Webcam { + IsModuleInstalled(): boolean; + GetFramePartURL(): string; + GetFrameURL(): string; + + /** + * Download and install webcam add-on on the local system. + * @method Dynamsoft.WebTwain#Download + * @param {string} remoteFile:string specifies the value of which frame to get. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + Download(remoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void; + + /** + * Return supported webcam source names. + * @method Dynamsoft.WebTwain#GetSourceList + * @return {string array} + */ + GetSourceList(): string[]; + + /** + * Select the source with the specified name. + * @method Dynamsoft.WebTwain#SelectSource + * @param {string} strSourceName The source name. + * @return {boolean} + */ + SelectSource(strSourceName: string): boolean; + + /** + * Close the selected source and release the webcam. + * @method Dynamsoft.WebTwain#CloseSource + * @return {boolean} + */ + CloseSource(): boolean; + + /** + * Show video stream in a specified container + * @method Dynamsoft.WebTwain#StopVideo + * @param {WebTwain} DWObject Specifies the WebTwain Object. + * @param {number} quality Specifies the quality of each frame in the video stream. Only valid for the HTML5 edition. + * @param {function} onFrameCaptured callback of the operation to capture + * @return {void} + */ + PlayVideo(DWObject: WebTwain, quality: number, onFrameCaptured: () => void): void; + + /** + * Stop the video stream in the specified container + * @method Dynamsoft.WebTwain#StopVideo + * @return {boolean} + */ + StopVideo(): boolean; + + /** + * Capture image from the specified webcam. + * @method Dynamsoft.WebTwain#CaptureImage + * @param {function} OnCaptureSuccess he function to call when the capture succeeds. Please refer to the function prototype OnCaptureSuccess. + * @param {function} OnCaptureError The function to call when the capture fails. Please refer to the function prototype OnCaptureError. + * @return {void} + */ + CaptureImage(OnCaptureSuccess: () => void, OnCaptureError: () => void): void; + + /** + * Returns the media type for a camera. + * @method Dynamsoft.WebTwain#GetMediaType + * @return {class MediaType} + */ + GetMediaType(): WebcamMediaType; + + /** + * Returns the count in the media type list. + * @method Dynamsoft.WebTwain#GetResolution + * @return {class Resolution} + */ + GetResolution(): WebcamResolution; + + /** + * Returns the frame rate for a camera. + * @method Dynamsoft.WebTwain#GetFrameRate + * @return {class FrameRate} + */ + GetFrameRate(): WebcamFrameRate; + + /** + * Set the media type of the current selected source by the value. + * @method Dynamsoft.WebTwain#SetMediaType + * @param {string} value The new media type value. + * @return {boolean} + */ + SetMediaType(value: string): boolean; + + /** + * Set the resolution of the current camera source. + * @method Dynamsoft.WebTwain#SetResolution + * @param {string} value The new resolution value. + * @return {boolean} + */ + SetResolution(value: string): boolean; + + /** + * Set current frame rate. + * @method Dynamsoft.WebTwain#SetFrameRate + * @param {number} value The new frame rate value. + * @return {boolean} + */ + SetFrameRate(value: number): boolean; + + /** + * Gets the current setting of a video property. + * @method Dynamsoft.WebTwain#GetVideoPropertySetting + * @param {EnumDWT_VideoProperty} property The property. + * @return {class VideoPropertySetting} + */ + GetVideoPropertySetting(property: EnumDWT_VideoProperty): VideoPropertySetting; + + /** + * Gets the range and default value of a specified video property. + * @method Dynamsoft.WebTwain#GetVideoPropertyMoreSetting + * @param {EnumDWT_VideoProperty} property The property. + * @return {class VideoPropertyMoreSetting} + */ + GetVideoPropertyMoreSetting(property: EnumDWT_VideoProperty): VideoPropertyMoreSetting; + + /** + * Gets the current setting of a camera property. + * @method Dynamsoft.WebTwain#GetCameraControlPropertySetting + * @param {EnumDWT_CameraControlProperty} property The property. + * @return {class CameraControlPropertySetting} + */ + GetCameraControlPropertySetting(property: EnumDWT_CameraControlProperty): CameraControlSetting; + + /** + * Gets the range and default value of a specified camera property. + * @method Dynamsoft.WebTwain#GetVideoPropertyMoreSetting + * @param {EnumDWT_CameraControlProperty} property The property. + * @return {class CameraControlPropertyMoreSetting} + */ + GetCameraControlPropertyMoreSetting(property: EnumDWT_CameraControlProperty): CameraControlMoreSetting; + + /** + * Sets video quality for a specified property. + * @method Dynamsoft.WebTwain#SetVideoPropertySetting + * @param {EnumDWT_VideoProperty} property The property. + * @param {number} value The new value of the property. + * @param {boolean} auto The desired control setting, whether the setting is controlled manually or automatically. + * @return {boolean} + */ + SetVideoPropertySetting(property: EnumDWT_VideoProperty, value: number, auto: boolean): boolean; + + /** + * Sets video rotate mode. + * @method Dynamsoft.WebTwain#SetVideoRotateMode + * @param {EnumDWT_VideoRotateMode} enumAngle The rotate angle. + * @return {boolean} + */ + SetVideoRotateMode(enumAngle: EnumDWT_VideoRotateMode): boolean; + + /** + * Sets a specified property on the camera. + * @method Dynamsoft.WebTwain#SetCameraControlPropertySetting + * @param {EnumDWT_CameraControlProperty} property The property. + * @param {number} value The new value of the property. + * @param {boolean} auto The desired control setting, whether the setting is controlled manually or automatically. + * @return {boolean} + */ + SetCameraControlPropertySetting(property: EnumDWT_CameraControlProperty, value: number, auto: boolean): boolean; +} + +interface WebTwainAddon { + Webcam: Webcam; +} diff --git a/types/dwt/dbr.d.ts b/types/dwt/dbr.d.ts new file mode 100644 index 0000000000..e8d8f6addc --- /dev/null +++ b/types/dwt/dbr.d.ts @@ -0,0 +1,192 @@ +interface RunTimeSetting { + mAntiDamageLevel: number; + mBarcodeFormatIds: number; + mBarcodeInvertMode: number; + mBinarizationBlockSize: number; + mColourImageConvertMode: number; + mDeblurLevel: number; + mEnableFillBinaryVacancy: number; + mExpectedBarcodesCount: number; + mGrayEqualizationSensitivity: number; + mLocalizationAlgorithmPriority: string; + mMaxAlgorithmThreadCount: number; + mMaxBarcodesCount: number; + mMaxDimOfFullImageAsBarcodeZone: number; + mPDFRasterDPI: number; + mRegionPredetectionMode: number; + mReserved: string; + mScaleDownThreshold: number; + mTextFilterMode: number; + mTextureDetectionSensitivity: number; + mTimeout: number; +} + +interface dbrEnv { + bAutoConnectService: boolean; + logLevel: number; + productKey: string; + resourcesPath: string; + onAutoConnectServiceSuccess(): void; + onAutoConnectServiceError(status: any): void; +} + +declare namespace dynamsoft { + let TaskQueue: TaskQueue; + let dbrEnv: dbrEnv; + /**dbrMasterPage20170526 */ + let dcp: { + ifCheck64bitServiceFirst: boolean; + }; + /**dwtDbrDemo20170613 */ + let initOrder: any; + let lib: any; + let managerEnv: any; + let navInfo: any; + namespace BarcodeReader { + /** Barcode Formats */ + enum EnumBarcodeFormat { + All = 503317503, + OneD = 0x3FF, + CODE_39 = 0x1, + CODE_128 = 0x2, + CODE_93 = 0x4, + CODABAR = 0x8, + ITF = 0x10, + EAN_13 = 0x20, + EAN_8 = 0x40, + UPC_A = 0x80, + UPC_E = 0x100, + INDUSTRIAL_25 = 0x200, + PDF417 = 0x2000000, + QR_CODE = 0x4000000, + DATAMATRIX = 0x8000000, + AZTEC = 0x10000000 + } + + enum EnumErrorCode { + DBR_SYSTEM_EXCEPTION = 1, + DBR_SUCCESS = 0, + DBR_UNKNOWN = -10000, + DBR_NO_MEMORY = -10001, + DBR_NULL_REFERENCE = -10002, + DBR_LICENSE_INVALID = -10003, + DBR_LICENSE_EXPIRED = -10004, + DBR_FILE_NOT_FOUND = -10005, + DBR_FILETYPE_NOT_SUPPORTED = -10006, + DBR_BPP_NOT_SUPPORTED = -10007, + DBR_INDEX_INVALID = -10008, + DBR_BARCODE_FORMAT_INVALID = -10009, + DBR_CUSTOM_REGION_INVALID = -10010, + DBR_MAX_BARCODE_NUMBER_INVALID = -10011, + DBR_IMAGE_READ_FAILED = -10012, + DBR_TIFF_READ_FAILED = -10013, + DBR_QR_LICENSE_INVALID = -10016, + DBR_1D_LICENSE_INVALID = -10017, + DBR_DIB_BUFFER_INVALID = -10018, + DBR_PDF417_LICENSE_INVALID = 10019, + DBR_DATAMATRIX_LICENSE_INVALID = -10020, + DBR_PDF_READ_FAILED = -10021, + DBR_PDF_DLL_MISSING = -10022, + DBR_PAGE_NUMBER_INVALID = -10023, + DBR_CUSTOM_SIZE_INVALID = -10024, + DBR_CUSTOM_MODULESIZE_INVALID = -10025, + DBR_RECOGNITION_TIMEOUT = -10026, + DBR_JSON_PARSE_FAILED = -10030, + DBR_JSON_TYPE_INVALID = -10031, + DBR_JSON_KEY_INVALID = -10032, + DBR_JSON_VALUE_INVALID = -10033, + DBR_JSON_NAME_KEY_MISSING = -10034, + DBR_JSON_NAME_VALUE_DUPLICATED = -10035, + DBR_TEMPLATE_NAME_INVALID = -10036, + DBR_JSON_NAME_REFERENCE_INVALID = -10037, + DBR_PARAMETER_VALUE_INVALID = 10038, + DBR_DOMAIN_NOT_MATCHED = -10039, + DBR_RESERVEDINFO_NOT_MATCHED = -10040, + DBR_DBRERR_AZTEC_LICENSE_INVALID = -10041 + } + enum EnumConflictMode { + ECM_Ignore = 1, + ECM_Overwrite = 2 + } + enum EnumImagePixelFormat { + IPF_Binary = 0, + IPF_BinaryInverted = 1, + IPF_GrayScaled = 2, + IPF_NV21 = 3, + IPF_RGB_565 = 4, + IPF_RGB_555 = 5, + IPF_RGB_888 = 6, + IPF_ARGB_8888 = 7 + } + enum EnumResultType { + EDT_CandidateText = 2, + EDT_PartialText = 3, + EDT_RawText = 1, + EDT_StandardText = 0 + } + enum EnumTerminateStage { + ETS_Localized = 1, + ETS_Prelocalized = 0, + ETS_Recognized = 2 + } + } + + class BarcodeReader { + static BarcodeReaderException(): any; + static initServiceConnection(): Promise; + static name: string; + static length: number; + static version: string; + // appendTplStringToRuntimeSettings(b, d): + /** + * Read barcode from the source image. + * @method BarcodeReader#decode + * @param {string} source specifies the image to read on + * @return {Promise} + * @example + ```javascript + // dwtUrl: HTML5 Edition only + reader.decode('dwt://dwt_trial_13000404/img?id=306159652&index=0&t=1502184632022').then( + results=>{ + for(var i = 0; i < results.length; ++i){ + console.log(results[i].BarcodeText); + // Confidence >= 30 is reliable + console.log(results[i].LocalizationResult.ExtendedResultArray[0].Confidence); + } + }); + // dcsUrl + reader.decode('dcs://dcs_trial_6110531/img?id=306159652&index=0&t=1502184632022').then( + function(results){ + // ie6-7 does not support console.log + var messageArr = []; + for(var i = 0; i < results.length; ++i){ + messageArr.push(results[i].BarcodeText); + // Confidence >= 30 is reliable + messageArr.push(results[i].LocalizationResult.ExtendedResultArray[0].Confidence); + } + alert(messageArr.join('')); + })['catch'](function(ex){ + // ie6-9 does not support '.catch(function(ex){...})' + if(ex){alert(ex.message||ex);} + }); + ``` + */ + decode(source: string): Promise; + + /** + * Read barcode from base64 string + */ + decodeBase64String(base64String: string): Promise; + getAllLocalizationResults(): any; + getAllParameterTemplateNames(): any; + getRuntimeSettings(): RunTimeSetting; + initRuntimeSettingsWithString(): any; + outputSettingsToString(): any; + resetRuntimeSettings(): void; + updateRuntimeSettings(setting: RunTimeSetting): void; + /** + * Constructs a new barcode reader + */ + constructor(dbrKey?: string); + } +} diff --git a/types/dwt/dwt.d.ts b/types/dwt/dwt.d.ts new file mode 100644 index 0000000000..28f7bf567e --- /dev/null +++ b/types/dwt/dwt.d.ts @@ -0,0 +1,3681 @@ +// properties (get/set) / sync functions +interface WebTwain { + Addon: WebTwainAddon; + + /** + * Returns whether the instance of a DWT is initialized + * @type {boolean} + */ + bReady: boolean; + + /** + * Returns the runtime id of the dwt object + * @type {string} + */ + readonly clientId: string; + + /** + * Returns the runtime class for the dwt container DIV + * @type {string} + */ + containerClass: string; + + /*ignored + httpUrl + objectName + + ...other internal ones + */ + + /* + * Properties + */ + + /** + * Returns or sets whether multi-page selection is supported. + * @type {boolean} + */ + AllowMultiSelect: boolean; + + /** + * [Deprecated.] Returns or sets whether allowing the plugin to send authentication request. The default value of this property is TRUE. + * @type {boolean} + */ + AllowPluginAuthentication: boolean; + + /** + * [Deprecated.] Returns or sets whether the async mode is activated. With this mode, Dynamic Web TWAIN is able to upload/download files via HTTP/FTP asynchronously. The default value is false. + * @type {boolean} + */ + AsyncMode: boolean; + + /** + * Returns or sets the background color of the main control. It is a value specifying the 24-bit RGB value. + * @type {number} + */ + BackgroundColor: number; + + /** + * Returns or sets the fill color of the selected area of an image when it is cut, erased or rotated. It is a value specifying the 24-bit RGB value. + * @type {number} + */ + BackgroundFillColor: number; + + /** + * Returns or sets the pixel bit depths for the current value of PixelType property. This is a runtime property. + * @type {number} + */ + BitDepth: number; + + /** + * Returns the current deviation of the pixels in the image. + * @type {number} + */ + readonly BlankImageCurrentStdDev: number; + + /** + * Returns or sets the standard deviation of the pixels in the image. + * @type {number} + */ + BlankImageMaxStdDev: number; + + /** + * Returns or sets the dividing line between black and white. The default value is 128. + * @type {number} + */ + BlankImageThreshold: number; + + /** + * [Deprecated.] Returns or sets the border style. + * @type {EnumDWT_BorderStyle} + */ + BorderStyle: EnumDWT_BorderStyle; + + /** + * Returns or sets the brightness values available within the Source. This is a runtime property. + * @type {number} + */ + Brightness: number; + + /** + * [Deprecated.] Sets or returns whether brokerprocess is enabled for scanning. + * @type {number} + */ + BrokerProcessType: number; + + /** + * Sets or returns how much physical memory is allowed for storing images currently loaded in Dynamic Web TWAIN. Once the limit is reached, images will be cached on the hard disk. + * @type {number} + */ + BufferMemoryLimit: number; + + /** + * Sets or returns the index (0-based) of a list to indicate the Current Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. + * @type {number} + */ + CapCurrentIndex: number; + + /** + * Sets or returns the current value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {number} + */ + CapCurrentValue: number; + + /** + * Returns the index (0-based) of a list to indicate the Default Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime, read-only property. + * @type {number} + */ + readonly CapDefaultIndex: number; + + /** + * Returns the default value in a range when the value of the CapType property is TWON_RANGE. This is a runtime, read-only property. + * @type {number} + */ + CapDefaultValue: number; + + /** + * Retruns the description for a capability + * @type {string} + */ + CapDescription: string; + + /** + * Sets or returns the maximum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {number} + */ + CapMaxValue: number; + + /** + * Sets or returns the minimum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {number} + */ + CapMinValue: number; + + /** + * [Deprecated.] Sets or returns how many items are in the list when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. For String data type, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. + * @type {number} + */ + CapNumItems: number; + + /** + * Sets or returns the step size in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {number} + */ + CapStepSize: number; + + /** + * Sets or returns the type of capability container used to exchange capability information between application and source. This is a runtime property. + * @type {EnumDWT_CapType} + */ + CapType: EnumDWT_CapType; + + /** + * Returns or sets the value of the capability specified by Capability property when the value of the CapType property is TWON_ONEVALUE. This is a runtime property. + * @type {number} + */ + CapValue: number; + + /** + * Sets or returns the string value for a capability when the value of the CapType property is TWON_ONEVALUE. This is a runtime property. + * @type {string} + */ + CapValueString: string; + + /** + * Sets or returns the value type for reading the value of a capability. This is a runtime property. + * @type {number} + */ + CapValueType: number; + + /** + * Specifies the capabiltiy to be negotiated. This is a runtime property. + * @type {EnumDWT_Cap} + */ + Capability: EnumDWT_Cap; + + /** + * Returns or sets the contrast values available within the Source. This is a runtime property. + * @type {number} + */ + Contrast: number; + + /** + * Returns or sets current index of image in buffer. This is a runtime property. + * @type {number} + */ + CurrentImageIndexInBuffer: number; + + /** + * Returns the device name of current source. This is a runtime, read-only property. + * @type {string} + */ + readonly CurrentSourceName: string; + + /** + * Returns the value indicating the data source status. This is a runtime, read-only property. + * @type {number} + */ + readonly DataSourceStatus: number; + + /** + * Returns the device name of default source. This is a runtime, read-only property. + * @type {string} + */ + readonly DefaultSourceName: string; + + /** + * Returns whether the source supports duplex. If so, it further returns the level of duplex the Source supports (one pass or two pass duplex). This is a runtime, read-only property. + * @type {EnumDWT_DUPLEX} + */ + readonly Duplex: EnumDWT_DUPLEX; + + /** + * [Deprecated.] Returns or sets whether the user can zoom image using hot key. + * @type {boolean} + */ + EnableInteractiveZoom: boolean; + + /** + * Returns the error code. This is a runtime, read-only property. + * @type {number} + */ + readonly ErrorCode: number; + + /** + * Returns the error string. This is a runtime, read-only property. + * @type {string} + */ + readonly ErrorString: string; + + /** + * Returns or sets the password used to log into the FTP server. + * @type {string} + */ + FTPPassword: string; + + /** + * Returns or sets the port number of the FTP server. + * @type {number} + */ + FTPPort: number; + + /** + * Returns or sets the user name used to log into the FTP server. + * @type {string} + */ + FTPUserName: string; + + /** + * Returns or sets whether to resize the image to fit the image to the width or height of the window. To use the property, the view mode should be set to -1 by -1. You can use SetViewMode method to set the view mode. + * @type {EnumDWT_FitWindowType} + */ + FitWindowType: EnumDWT_FitWindowType; + + /** + * Returns the response string from the HTTP server if an error occurs for HTTPUploadThroughPost() method. This is a runtime, read-only property. + * @type {string} + */ + readonly HTTPPostResponseString: string; + + /** + * Returns whether a HTTP request has credentials + * @type {boolean} + */ + HTTPRequestswithCredentials: boolean; + + /** + * Returns or sets the height of the dwt viewer object + * @type {string|number} + */ + Height: string | number; + + /** + * Returns how many images are in buffer. This is a runtime, read-only property. + * @type {number} + */ + readonly HowManyImagesInBuffer: number; + + /** + * Specifies the content type of a http upload. + * @type {string} + */ + HttpContentTypeFieldValue: string; + + /** + * Specifies the field name of uploaded image through POST. + * @type {string} + */ + HttpFieldNameOfUploadedImage: string; + + /** + * [Deprecated.] Sets or returns the password used to log into the HTTP server. + * @type {string} + */ + HTTPPassword: string; + + /** + * Returns or sets the port number of the HTTP server. + * @type {number|string} + */ + HTTPPort: number | string; + + /** + * [Deprecated.] Returns or sets the user name used to log into the HTTP server. + * @type {string} + */ + HTTPUserName: string; + + /** + * Returns or sets whether the feature of disk caching is enabled. + * @type {boolean} + */ + IfAllowLocalCache: boolean; + + /** + * Returns or sets whether insert or append new scanned images. + * @type {boolean} + */ + IfAppendImage: boolean; + + /** + * Returns or sets whether the Source's Auto-brightness function is enabled. This is a runtime property. + * @type {boolean} + */ + IfAutoBright: boolean; + + /** + * Returns or sets whether the data source (scanner) will discard blank images during scanning. The property works only if the device and its driver support discarding blank pages. You can find whether your device supports this capbility from its user manual. Or, you can use the built-in methods of Dynamic Web TWAIN to detect blank images: IsBlankImage, IsBlankImageEx. + * @type {boolean} + */ + IfAutoDiscardBlankpages: boolean; + + /** + * Returns or sets whether the Source enable automatic document feeding process. This is a runtime property. + * @type {boolean} + */ + IfAutoFeed: boolean; + + /** + * Returns or sets whether the Source enables the automatic document scanning process. This is a runtime property. + * @type {boolean} + */ + IfAutoScan: boolean; + + /** + * Specifies whether or not to automatically scroll to the last image or stay on the current image when loading or acquiring images + * @type {boolean} + */ + IfAutoScroll: boolean; + + /** + * Turns automatic border detection on and off. The property works only if the device and its driver support detecting the border automatically. You can find whether your device supports this capbility from its user manual. + * @type {boolean} + */ + IfAutomaticBorderDetection: boolean; + + /** + * Turns automatic skew correction on and off. + * @type {boolean} + */ + IfAutomaticDeskew: boolean; + + /** + * Returns or sets whether close the Data Source User Interface after acquire all images. Default value of this property is FALSE. + * @type {boolean} + */ + IfDisableSourceAfterAcquire: boolean; + + /** + * Returns or sets whether the Source supports duplex. If TRUE, the scanner scans both sides of a paper; otherwise, the scanner will scan only one side of the image. This is a runtime property. + * @type {boolean} + */ + IfDuplexEnabled: boolean; + + /** + * Returns or sets whether the Automatic Document Feeder (ADF) is enabled. This is a runtime property. + * @type {boolean} + */ + IfFeederEnabled: boolean; + + /** + * Returns whether or not there are documents loaded in the Source's feeder when IfFeederEnabled and IfPaperDetectable are TRUE. This is a runtime, read-only property. + * @type {boolean} + */ + readonly IfFeederLoaded: boolean; + + /** + * Returns or sets whether to resize the image to fit the size of window when the view mode is set to -1 by -1. You can use SetViewMode method to set the view mode. + * @type {boolean} + */ + IfFitWindow: boolean; + + /** + * [Deprecated.] Returns or sets whether the UI (User Interface) of Source runs in modal state. Default value of this property is TRUE. + * @type {boolean} + */ + IfModalUI: boolean; + + /** + * Sets or returns whether Dynamic Web TWAIN uses Graphics Device Interface (GDI) when decoding images. + * @type {boolean} + */ + IfOpenImageWithGDIPlus: boolean; + + /** + * Returns or sets whether FTP passive mode is enabled. + * @type {boolean} + */ + IfPASVMode: boolean; + + /** + * Returns the value whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a runtime, read-only property. + * @type {boolean} + */ + readonly IfPaperDetectable: boolean; + + /** + * Returns or sets whether SSL is used when uploading or downloading images. + * @type {boolean} + */ + IfSSL: boolean; + + /** + * [Deprecated.] Returns or sets whether communicate with device in a separate thread. Default value of this property is FALSE. + * @type {boolean} + */ + IfScanInNewThread: boolean; + + /** + * Sets or returns whether to show the cancel dialog when uploading images to server. + * @type {boolean} + */ + IfShowCancelDialogWhenImageTransfer: boolean; + + /** + * Returns or sets whether to show the file dialog box when saving scanned images or loading images from local folder. + * @type {boolean} + */ + IfShowFileDialog: boolean; + + /** + * Returns or sets whether the Source displays a progress indicator during acquisition and transfer, regardless of whether the Source's user interface is active. This is a runtime property. + * @type {boolean} + */ + IfShowIndicator: boolean; + + /** + * [Deprecated.] Returns or sets whether the driver of the printer displays the User Interface. + * @type {boolean} + */ + IfShowPrintUI: boolean; + + /** + * Returns or sets whether the progress bar will be displayed during the transaction. This is a runtime property. + * @type {boolean} + */ + IfShowProgressBar: boolean; + + /** + * Returns or sets whether the Source displays the User Interface. + * @type {boolean} + */ + IfShowUI: boolean; + + /** + * Returns or sets whether to throw exceptions + * @type {boolean} + */ + IfThrowException: boolean; + + /** + * Return or sets whether the Source allows to save many images in one TIFF file. The default value is FALSE. + * @type {boolean} + */ + IfTiffMultiPage: boolean; + + /** + * Returns whether the Source supports acquisition with the UI (User Interface) disabled. If FALSE, indicates that this Source can only support acquisition with the UI enabled. This is a runtime, read-only property. + * @type {boolean} + */ + readonly IfUIControllable: boolean; + + /** + * Sets or returns whether Dynamic Web TWAIN uses the new TWAIN Data Source Manager (TWAINDSM.dll) when acquiring images from TWAIN devices. + * @type {boolean} + */ + IfUseTwainDSM: boolean; + + /** + * [Deprecated.] The number of bits in each image pixel (or bit depth). This is a runtime, read-only property. + * @type {number} + */ + ImageBitsPerPixel: number; + + /** + * Returns or sets whether a TWAIN driver or Native Scan of Mac OS X is used for document scanning. This property works for Mac edition only. + * @type {number} + */ + ImageCaptureDriverType: number; + + /** + * [Deprecated.] Returns or sets whether the image enumerator is enabled in Image Editor. + * @type {boolean} + */ + ImageEditorIfEnableEnumerator: boolean; + + /** + * [Deprecated.] Returns or sets whether the Image Editor is a modal window. + * @type {boolean} + */ + ImageEditorIfModal: boolean; + + /** + * [Deprecated.] Returns or sets whether the Image Editor is read-only. + * @type {boolean} + */ + ImageEditorIfReadonly: boolean; + + /** + * [Deprecated.] Returns or sets the title of Image Editor window. + * @type {string} + */ + ImageEditorWindowTitle: string; + + /** + * Returns the document number of the current image. This is a runtime, read-only property. + * @type {number} + */ + readonly ImageLayoutDocumentNumber: number; + + /** + * Returns the value of the bottom-most edge of the current image frame (in Unit). This is a read-only runtime property. + * @type {number} + */ + readonly ImageLayoutFrameBottom: number; + + /** + * Returns the value of the left-most edge of the current image frame (in Unit). This is a runtime, read-only property. + * @type {number} + */ + readonly ImageLayoutFrameLeft: number; + + /** + * Returns the frame number of the current image. This is a runtime, read-only property. + * @type {number} + */ + readonly ImageLayoutFrameNumber: number; + + /** + * Returns the value of the right-most edge of the current image frame (in Unit). This is a runtime, read-only property. + * @type {number} + */ + readonly ImageLayoutFrameRight: number; + + /** + * Returns the value of the top-most edge of the current image frame (in Unit). This is a runtime, read-only property. + * @type {number} + */ + readonly ImageLayoutFrameTop: number; + + /** + * Returns the page number of the current image. This is a runtime, read-only property. + * @type {Long} + */ + readonly ImageLayoutPageNumber: number; + + /** + * [Deprecated.] Returns how tall/long, in pixels, the image is. This is a runtime, read-only property. + * @type {number} + */ + ImageLength: number; + + /** + * Returns or sets the margin between images when multiple images are displayed in Dynamic Web TWAIN. + * @type {number} + */ + ImageMargin: number; + + /** + * Returns the pixel type of the current image. This is a runtime, read-only property. Please note the property is only valid in OnPreTransfer and OnPostTransfer event. + * @type {EnumDWT_PixelType} + */ + readonly ImagePixelType: EnumDWT_PixelType; + + /** + * [Deprecated.] Returns how width, in pixels, the image is. This is a runtime, read-only property. + * @type {number} + */ + ImageWidth: number; + + /** + * [Deprecated.] Returns the X resolution of the current image. X resolution is the number of pixels per Unit in the horizontal direction. This is a runtime, read-only property. + * @type {number} + */ + ImageXResolution: number; + + /** + * [Deprecated.] Returns the Y resolution of the current image. Y resolution is the number of pixels per Unit in the vertical direction. This is a runtime, read-only property. + * @type {number} + */ + ImageYResolution: number; + + /** + * Returns or sets the quality of JPEG files and PDF files using JPEG compression. + * @type {number} + */ + JPEGQuality: number; + + /** + * Returns or sets the log level for debugging. + * @type {number} + */ + LogLevel: number; + + /** + * Return the magnetic data if the scanner support magnetic data recognition. + * @type {string} + */ + readonly MagData: string; + + /** + * Return the magnetic type if the scanner support magnetic data recognition. + * @type {number} + */ + readonly MagType: number; + + /** + * Sets or returns the manufacture string for the application identity. + * @type {string} + */ + Manufacturer: string; + + /** + * Returns or sets the maximum number of images can be held in buffer. + * @type {number} + */ + MaxImagesInBuffer: number; + + /** + * [Deprecated.] Returns or sets how many threads can be used when you upload files through POST. + * @type {number} + */ + MaxInternetTransferThreads: number; + + /** + * Sets or returns the maximum allowed size when Dynamic Web TWAIN uploads a document. + * @type {number} + */ + MaxUploadImageSize: number; + + /** + * Returns or sets the shape of the mouse. + * @type {boolean} + */ + MouseShape: boolean; + + /** + * Returns the X co-ordinate of the mouse. This is a runtime property. + * @type {number} + */ + readonly MouseX: number; + + /** + * Returns the Y co-ordinate of the mouse. This is a runtime property. + * @type {number} + */ + readonly MouseY: number; + + /** + * Returns or sets the name of the person who creates the PDF document. + * @type {string} + */ + PDFAuthor: string; + + /** + * Returns or sets the compression type of PDF files. This is a runtime property. + * @type {EnumDWT_PDFCompressionType} + */ + PDFCompressionType: EnumDWT_PDFCompressionType; + + /** + * Returns or sets the date when the PDF document is created. + * @type {string} + */ + PDFCreationDate: string; + + /** + * Returns or sets the name of the application that created the original document, if the PDF document is converted from another form. + * @type {string} + */ + PDFCreator: string; + + /** + * Returns or sets the keywords associated with the PDF document. + * @type {string} + */ + PDFKeywords: string; + + /** + * Returns or sets the date when the PDF document is last modified. + * @type {string} + */ + PDFModifiedDate: string; + + /** + * Returns or sets the name of the application that converted the PDF document from its native. + * @type {string} + */ + PDFProducer: string; + + /** + * Returns or sets the subject of the PDF document. + * @type {string} + */ + PDFSubject: string; + + /** + * Returns or sets the title of the PDF document. + * @type {string} + */ + PDFTitle: string; + + /** + * Returns or sets the value of the PDF version. + * @type {string} + */ + PDFVersion: string; + + /** + * Returns or sets the page size(s) the Source can/should use to acquire image data. This is a runtime property. + * @type {EnumDWT_CapSupportedSizes} + */ + PageSize: EnumDWT_CapSupportedSizes; + + /** + * Returns the number of transfers the Source is ready to supply, upon demand. This is a runtime, read-only property. + * @type {number} + */ + readonly PendingXfers: number; + + /** + * Returns or sets the pixel flavor for acquired images. This is a runtime property. + * @type {number} + */ + PixelFlavor: number; + + /** + * Returns or sets the pixel type of current data source. This is a runtime property. Using this property after calling OpenSource() method and before calling AcquireImage(). + * @type {EnumDWT_PixelType} + */ + PixelType: EnumDWT_PixelType; + + /** + * Sets or returns the product family string for the application identity. + * @type {string} + */ + ProductFamily: string; + + /** + * Sets the product key. A product key is generated in Licensing Tool which is intalled with Dynamic Web TWAIN. Each product key corresponds with a license. + * @type {string} + */ + ProductKey: string; + + /** + * Sets or returns the product name string for the application identity. + * @type {string} + */ + ProductName: string; + + /** + * [Deprecated.] Returns or sets the name of the proxy server. + * @type {string} + */ + ProxyServer: string; + + /** + * Returns or sets the current resolution for acquired images. This is a runtime property. + * @type {number} + */ + Resolution: number; + + /** + * Returns or sets how many scanned images are selected. + * @type {number} + */ + SelectedImagesCount: number; + + /** + * Returns or sets the border color of the selected image. It is a value specifying the 24-bit RGB value. + * @type {number} + */ + SelectionImageBorderColor: number; + + /** + * Specifies a fixed aspect ratio to be used for selecting an area. + * @type {number} + */ + SelectionRectAspectRatio: number; + + /** + * Specifies whether to show the page number + * @type {boolean} + */ + ShowPageNumber: boolean; + + /** + * Returns how many sources are installed in the system. This is a runtime, read-only property. + * @type {number} + */ + readonly SourceCount: number; + + /** + * Returns or sets the compression type of TIFF files. This is a runtime property. + * @type {EnumDWT_TIFFCompressionType} + */ + TIFFCompressionType: EnumDWT_TIFFCompressionType; + + /** + * Sets or returns the transfer mode. + * @type {EnumDWT_TransferMode} + */ + TransferMode: EnumDWT_TransferMode; + + /** + * Returns or sets the unit of measure. This is a runtime property. + * @type {EnumDWT_UnitType} + */ + Unit: EnumDWT_UnitType; + + /** + * Specifies whether to show the vertical scroll bar + * @type {boolean} + */ + VScrollBar: boolean; + + /** + * Sets or returns the version info string for the application identity. + * @type {string} + */ + readonly VersionInfo: string; + + /** + * Returns or sets the width of the dwt object viewer + * @type {string|number} + */ + Width: string | number; + + /** + * Returns and sets the number of images you are willing to transfer per session. This is a runtime property. + * @type {number} + */ + XferCount: number; + + /** + * Returns or sets zoom factor for the image, only valid When the view mode is set to -1 by -1. + * @type {number} + */ + Zoom: number; + + /* ignored + style + _AutoCropMethod + */ + + /* + *Methods + */ + + /** + * Displays the source's built-in interface to acquire image. + * @method WebTwain#AcquireImage + * @param {object} optionalDeviceConfig a JS object used to set up the device for image acquisition. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + AcquireImage(optionalDeviceConfig?: object, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Add text on an image. + * @method WebTwain#AddText + * @param {number} sImageIndex the index of the image that you want to add text to. + * @param {number} x the x coordinate for the text. + * @param {number} y the y coordinate for the text. + * @param {string} text the content of the text that you want to add. + * @param {number} txtColor the color for the text. + * @param {number} backgroundColor the background color. + * @param {number} backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter. + * @param {number} backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1 + * @return {boolean} + */ + AddText(sImageIndex: number, x: number, y: number, text: string, txtColor: number, backgroundColor: number, backgroundRoundRadius: number, backgroundOpacity: number): boolean; + + /** + * Cancels all pending transfers. + * @method WebTwain#CancelAllPendingTransfers + * @return {boolean} + */ + CancelAllPendingTransfers(): boolean; + + /** + * Gets information of the capability specified by the Capability property. + * @method WebTwain#CapGet + * @return {boolean} + */ + CapGet(): boolean; + + /** + * Returns the Source's current Value for the specified capability. + * @method WebTwain#CapGetCurrent + * @return {boolean} + */ + CapGetCurrent(): boolean; + + /** + * Returns the Source's Default Value for the specified capability. This is the Source's preferred default value. + * @method WebTwain#CapGetDefault + * @return {boolean} + */ + CapGetDefault(): boolean; + + /** + * Returns the value of the bottom-most edge of the specified frame. + * @method WebTwain#CapGetFrameBottom + * @param {number} index specifies the value of which frame to get. The index is 0-based. + * @return {number} + */ + CapGetFrameBottom(index: number): number; + + /** + * Returns the value (in Unit) of the left-most edge of the specified frame. + * @method WebTwain#CapGetFrameLeft + * @param {number} index specifies the value of which frame to get. The index is 0-based. + * @return {number} + */ + CapGetFrameLeft(index: number): number; + + /** + * Returns the value (in Unit) of the left-most edge of the specified frame. + * @method WebTwain#CapGetFrameRight + * @param {number} index specifies the value of which frame to get. The index is 0-based. + * @return {number} + */ + CapGetFrameRight(index: number): number; + + /** + * Returns the value (in Unit) of the top-most edge of the specified frame. + * @method WebTwain#CapGetFrameTop + * @param {number} index specifies the value of which frame to get. The index is 0-based. + * @return {number} + */ + CapGetFrameTop(index: number): number; + + /* ignored + * CapGetHelp + * CapGetLabel + * CapGetLabels + */ + + /** + * Queries whether the Source supports a particular operation on the capability. + * @method WebTwain#CapIfSupported + * @param {EnumDWT_MessageType} messageType specifies the type of capability operation. + * @return {boolean} + */ + CapIfSupported(messageType: EnumDWT_MessageType): boolean; + + /** + * Changes the Current Value of the capability specified by Capability property back to its power-on value. + * @method WebTwain#CapReset + * @return {boolean} + */ + CapReset(): boolean; + + /** + * Sets the current capability using the container type specified by CapType property. The current capability is specified by Capability property. + * @method WebTwain#CapSet + * @return {boolean} + */ + CapSet(): boolean; + + /** + * Sets the values of the specified frame. + * @method WebTwain#CapSetFrame + * @param {number} index specifies the values of which frame to set. The index is 0-based. + * @param {number} left the value (in Unit) of the left-most edge of the specified frame. + * @param {number} top the value (in Unit) of the top-most edge of the specified frame. + * @param {number} right the value (in Unit) of the right-most edge of the specified frame. + * @param {number} bottom the value (in Unit) of the bottom-most edge of the specified frame. + * @return {boolean} + */ + CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Changes the bitdepth of a specified image. + * @method WebTwain#ChangeBitDepth + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} sBitDepth specifies the target bit depth. + * @param {boolean} bHighQuality specifies whether or not to keep high quality while changing the bit depth. When it's true, it takes more time. + * @return {boolean} + */ + ChangeBitDepth(sImageIndex: number, sBitDepth: number, bHighQuality: boolean): boolean; + + /** + * Changes width and height of the image of a specified index in the buffer. Please note the file size of the image will be changed proportionately. + * @method WebTwain#ChangeImageSize + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} iNewWidth specifies the pixel width of the new image. + * @param {number} iNewHeight specifies the pixel height of the new image. + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {boolean} + */ + ChangeImageSize(sImageIndex: number, iNewWidth: number, iNewHeight: number, newVal: EnumDWT_InterpolationMethod): boolean; + + /** + * Clears all the web forms which are used for image uploading. + * @method WebTwain#ClearAllHTTPFormField + * @return {boolean} + */ + ClearAllHTTPFormField(): boolean; + + /** + * Clears the content of all custom tiff tags. + * @method WebTwain#ClearTiffCustomTag + * @return {void} + */ + ClearTiffCustomTag(): void; + + /** + * Closes Data Source. + * @method WebTwain#CloseSource + * @return {boolean} + */ + CloseSource(): boolean; + + /** + * Closes and unloads Data Source Manager. + * @method WebTwain#CloseSourceManager + * @return {boolean} + */ + CloseSourceManager(): boolean; + + /** + * Closes the current process used to scan + * @method WebTwain#CloseWorkingProcess + * @return {boolean} + */ + CloseWorkingProcess(): boolean; + + /** + * Converts the images specified by the indices to base64 synchronously. + * @method WebTwain#ConvertToBase64 + * @param {Array} indices indices specifies which images are to be converted to base64. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. + * @return {Base64Result} + + ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType): Base64Result; + */ + + /** + * Converts the images specified by the indices to base64 asynchronously. + * @method WebTwain#ConvertToBase64 + * @param {Array} indices indices specifies which images are to be converted to base64. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType, asyncSuccessFunc: (result: Base64Result) => void, asyncFailureFunc: (errorCode: number, errorString: string) => void): boolean; + + /** + * Converts the images specified by the indices to blob synchronously. + * @method WebTwain#ConvertToBlob + * @param {Array} indices indices specifies which images are to be converted to base64. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. + * @return {Blob} + */ + ConvertToBlob(indices: number[], enumImageType: EnumDWT_ImageType): Blob; + + /** + * Converts the images specified by the indices to blob asynchronously. + * @method WebTwain#ConvertToBlob + * @param {Array} indices indices specifies which images are to be converted to base64. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + ConvertToBlob(indices: number[], enumImageType: EnumDWT_ImageType, asyncSuccessFunc: (result: any) => void, asyncFailureFunc: (errorCode: number, errorString: string) => void): boolean; + + /** + * Changes a specified image to gray scale. + * @method WebTwain#ConvertToGrayScale + * @param {number} sIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + ConvertToGrayScale(sIndex: number): boolean; + + /** + * Copies the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CopyToClipboard + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + CopyToClipboard(sImageIndex: number): boolean; + + /** + * Create the font for adding text using the method AddText. + * @method WebTwain#CreateTextFont + * @param {number} height Specifies the desired height (in logical units) of the font.The absolute value of nHeight must not exceed 16,384 device units after it is converted.For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size or the smallest font if all the fonts exceed the requested size. + * @param {number} width Specifies the average width (in logical units) of characters in the font. If Width is 0, the aspect ratio of the device will be matched against the digitization aspect ratio of the available fonts to find the closest match, which is determined by the absolute value of the difference. + * @param {number} escapement Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis. + * @param {number} orientation Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems in which the y-direction is down and clockwise from the x-axis for coordinate systems in which the y-direction is up. + * @param {number} weight Specifies the font weight (in inked pixels per 1000). The described valuesare approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used. + * @param {number} italic Specifies an italic font if set to TRUE. + * @param {number} underline Specifies an underlined font if set to TRUE. + * @param {number} strikeOut A strikeout font if set to TRUE. + * @param {number} charSet Specifies the font's character set. The OEM character set is system-dependent. Fonts with other character sets may exist in the system. An application that uses a font with an unknown character set must not attempt to translate or interpret strings that are to be rendered with that font. + * @param {number} outputPrecision Specifies the desired output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, and pitch. + * @param {number} clipPrecision Specifies the desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region. + * @param {number} quality Specifies the font's output quality, which defines how carefully the GDI must attempt to match the logical-font attributes to those of an actual physical font. + * @param {number} pitchAndFamily The pitch and family of the font. + * @param {string} faceName the typeface name, the length of this string must not exceed 32 characters, including the terminating null character. + * @return {boolean} + */ + CreateTextFont(height: number, width: number, escapement: number, orientation: number, weight: number, italic: number, underline: number, strikeOut: number, charSet: number, outputPrecision: number, clipPrecision: number, quality: number, pitchAndFamily: number, faceName: string): boolean; + + /** + * Crops the image of a specified index in buffer. + * @method WebTwain#Crop + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {boolean} + */ + Crop(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Crops the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CropToClipboard + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {boolean} + */ + CropToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Cuts the image data in the specified area to the system clipboard in DIB format. + * @method WebTwain#CutFrameToClipboard + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {boolean} + */ + CutFrameToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Cuts the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CutToClipboard + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + CutToClipboard(sImageIndex: number): boolean; + + /** + * Disable the source. If the source's user interface is displayed when the source is enabled, it will be closed. + * @method WebTwain#DisableSource + * @return {boolean} + */ + DisableSource(): boolean; + + /** + * Enables the source to accept image. + * @method WebTwain#EnableSource + * @return {boolean} + */ + EnableSource(): boolean; + + /** + * Clears the specified area of a specified image, and fill the area with the fill color. + * @method WebTwain#Erase + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {boolean} + */ + Erase(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Downloads an image from the FTP server. + * @method WebTwain#FTPDownload + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + FTPDownload(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly download a file from the FTP server to local disk without loading it into Dynamic Web TWAIN. + * @method WebTwain#FTPDownloadDirectly + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. + * @param {string} localFile specify a full path to store the file. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + FTPDownloadDirectly(FTPServer: string, FTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Downloads an image from the FTP server. + * @method WebTwain#FTPDownloadEx + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. + * @param {EnumDWT_ImageType} lImageType simage format of the file to be downloaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + FTPDownloadEx(FTPServer: string, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the FTP server. + * @method WebTwain#FTPUpload + * @param {string} FTPServer the name of the FTP server. + * @param {number} sImageIndex specifies the index of the image in the buffer. The index is 0-based. + * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + FTPUpload(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly upload a specific file to the FTP server without loading it into Dynamic Web TWAIN. + * @method WebTwain#FTPUploadDirectly + * @param {string} FTPServer the name of the FTP server. + * @param {string} localFile specify the the full path of a local file. + * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + FTPUploadDirectly(FTPServer: string, localFile: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the FTP server as a specified image format. + * @method WebTwain#FTPUploadEx + * @param {string} FTPServer the name of the FTP server. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + FTPUploadEx(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in buffer to the FTP server as Multi-Page TIFF. + * @method WebTwain#FTPUploadAllAsMultiPageTIFF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + FTPUploadAllAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in buffer to the FTP server as Multi-Page PDF. + * @method WebTwain#FTPUploadAllAsPDF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + FTPUploadAllAsPDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in buffer to the FTP server as Multi-Page PDF. + * @method WebTwain#FTPUploadAsMultiPagePDF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + FTPUploadAsMultiPagePDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in buffer to the FTP server as Multi-Page TIFF. + * @method WebTwain#FTPUploadAsMultiPageTIFF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + FTPUploadAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Sets the Source to eject the current page and advance the next page in the document feeder into the feeder acquire area when IfFeederEnabled is TRUE. + * @method WebTwain#FeedPage + * @return {boolean} + */ + FeedPage(): boolean; + + /** + * Check whether a certain file exists on the local disk. + * @method WebTwain#FileExists + * @param {string} localFile specifies the absolute path of the local file. + * @return {boolean} + */ + FileExists(localFile: string): boolean; + + /** + * Flips the image of a specified index in buffer. + * @method WebTwain#Flip + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + Flip(sImageIndex: number): boolean; + + /** + * Get the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * @method WebTwain#GetCapItems + * @param {number} index Index is 0-based. It is the index of the cap item. + * @return {number} + */ + GetCapItems(index: number): number; + + /** + * Returns the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * @method WebTwain#GetCapItemsString + * @param {number} index Index is 0-based. It is the index of the cap item. + * @return {string} + */ + GetCapItemsString(index: number): string; + + // Get custom DS data, and returned string is encoded with base64 + /** + * Gets custom DS data, the returned string is base64 encoded. + * @method WebTwain#GetCustomDSDataEx + * @return {string | boolean} + */ + GetCustomDSDataEx(): string | boolean; + + // Get custom DS data, and save the data to the specified file + /** + * Gets custom DS data and save the data in a specified file. + * @method WebTwain#GetCustomDSData + * @param {string} fileName the path of the file used for storing custom DS data. + * @return {boolean} + */ + GetCustomDSData(fileName: string): boolean; + + /** + * Retrieve the device type of the currently selected data source, it might be a scanner, a web camera, etc. + * @method WebTwain#GetDeviceType + * @return {number | boolean} + */ + GetDeviceType(): number | boolean; + + /** + * Returns the pixel bit depth of the selected image. + * @method WebTwain#GetImageBitDepth + * @param {number} sImageIndex specifies the index of image. The index is 0-based. + * @return {number} + */ + GetImageBitDepth(sImageIndex: number): number; + + /** + * Returns the height (pixels) of the selected image. This is a read-only property. + * @method WebTwain#GetImageHeight + * @param {number} sImageIndex specifies the index of image. The index is 0-based. + * @return {number} + */ + GetImageHeight(sImageIndex: number): number; + + /** + * Returns the direct URL of an image specified by index, if iWidth and iHeight are not specified, you get the original image, otherwise you get the image with specified iWidth or iHeight while keeping the same aspect ratio. The returned string is like this 'dwt://dwt_trial_13000404/img?id=306159652&index=0&t=1502184632022' + * @method WebTwain#GetImagePartURL + * @param {number} index the index of the image. + * @param {number} iWidth the width of the image, it must be 150 or bigger + * @param {number} iHeight the height of the image, it must be 150 or bigger + * @return {string} + */ + GetImagePartURL(index: number, iWidth?: number, iHeight?: number): string; + + /** + * Returns the file size of the new image resized from the image of a specified index in buffer. + * @method WebTwain#GetImageSize + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} iWidth specifies the pixel width of the new image. + * @param {number} iHeight specifies the pixel height of the new image. + * @return {number} + */ + GetImageSize(sImageIndex: number, iWidth: number, iHeight: number): number; + + /** + * Pre-calculate the file size of the local image file that is saved from an image of a specified index in buffer. + * @method WebTwain#GetImageSizeWithSpecifiedType + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {EnumDWT_ImageType} sImageType specifies the type of an image file.. + * @return {number} + */ + GetImageSizeWithSpecifiedType(sImageIndex: number, sImageType: EnumDWT_ImageType): number; + + /** + * Returns the direct URL of an image specified by index, if iWidth or iHeight is set to -1, you get the original image, otherwise you get the image with specified iWidth or iHeight while keeping the same aspect ratio. + * @method WebTwain#GetImageURL + * @param {number} index the index of the image. + * @param {number} iWidth the width of the image. + * @param {number} iHeight the height of the image. + * @return {string} + */ + GetImageURL(index: number, iWidth: number, iHeight: number): string; + + /** + * Returns the width (pixels) of the selected image. This is a read-only property. + * @method WebTwain#GetImageWidth + * @param {number} sImageIndex specifies the index of image. The index is 0-based. + * @return {number} + */ + GetImageWidth(sImageIndex: number): number; + + /** + * Return the horizontal resolution of the specified image. + * @method WebTwain#GetImageXResolution + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {number} + */ + GetImageXResolution(sImageIndex: number): number; + + /** + * Return the vertical resolution of the specified image. + * @method WebTwain#GetImageYResolution + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {number} + */ + GetImageYResolution(sImageIndex: number): number; + + /** + * Return the runtime license info. + * @method WebTwain#GetLicenseInfo + */ + GetLicenseInfo(optionalAsyncSuccessFunc?: (result: any) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Returns the index of the selected image. + * @method WebTwain#GetSelectedImageIndex + * @param {number} sSelectedIndex specifies the index of the selected image. + * @return {number} + */ + GetSelectedImageIndex(sSelectedIndex: number): number; + + /** + * Pre-calculate the file size of the local image file that is saved from the selected images in buffer. + * @method WebTwain#GetSelectedImagesSize + * @param {EnumDWT_ImageType} iImageType specifies the type of an image file. + * @return {number} + */ + GetSelectedImagesSize(iImageType: EnumDWT_ImageType): number; + + /** + * Check the skew angle of an image by its index in buffer. + * @method WebTwain#GetSkewAngle + * @param {number} sImageIndex the index of the image in the buffer. + * @return {number} + */ + GetSkewAngle(sImageIndex: number): number; + + /** + * Check the skew angle of a rectangular part of an image by its index in buffer. + * @method WebTwain#GetSkewAngleEx + * @param {number} sImageIndex the index of the image in the buffer. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {number} + */ + GetSkewAngleEx(sImageIndex: number, left: number, top: number, right: number, bottom: number): number; + + /** + * Get the source name according to the source index. + * @method WebTwain#GetSourceNameItems + * @param {number} index number index. Index is 0-based and can not be greater than SourceCount property. + * @return {string} + */ + GetSourceNameItems(index: number): string; + + /*ignored + GetSourceNames + GetSourceType + GetVersionInfoAsync + */ + + /** + * Downloads an image from the HTTP server. + * @method WebTwain#HTTPDownload + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the name of the image to be downloaded. It should be the relative path of the file on the HTTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPDownload(HTTPServer: string, HTTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly downloads a file from the HTTP server to a local disk without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPDownloadDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile The relative path of the file on the HTTP server. + * @param {string} localFile specify the location to store the downloaded file. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPDownloadDirectly(HTTPServer: string, HTTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Downloads an image from the HTTP server. + * @method WebTwain#HTTPDownloadEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) + * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPDownloadEx(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /*ignored + HTTPDownloadStreamThroughPost + HTTPDownloadThroughGet + */ + + /** + * Download an image from the server using a HTTP Post call. + * @method WebTwain#HTTPDownloadThroughPost + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) + * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; + + /** + * Uploads just a form created by SetHTTPFormField and SetHTTPHeader + * @method WebTwain#HTTPUpload + * @param {string} url the url where the images are sent in a POST request. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUpload(url: string, asyncSuccessFunc: (httppostresponsestring: string) => void, asyncFailureFunc: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; + + /** + * Uploads the images specified by the indices to the HTTP server. + * @method WebTwain#HTTPUpload + * @param {string} url the url where the images are sent in a POST request. + * @param {Array} indices indices specifies which images are to be uploaded. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded. + * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUpload(url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, asyncSuccessFunc: (httppostresponsestring: string) => void, asyncFailureFunc: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; + + /** + * Uploads the images specified by the indices to the HTTP server. + * @method WebTwain#HTTPUpload + * @param {string} url the url where the images are sent in a POST request. + * @param {Array} indices indices specifies which images are to be uploaded. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded. + * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string. + * @param {string} fileName the file name + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUpload(url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, fileName: string, asyncSuccessFunc: (httppostresponsestring: string) => void, asyncFailureFunc: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; + + /** + * Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadAllThroughPostAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; + + /** + * Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadAllThroughPostAsPDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; + + /** + * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadAllThroughPutAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadAllThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadAllThroughPutAsPDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadAllThroughPutAsPDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /*ignored + HTTPUploadStreamThroughPost + */ + + /** + * Uploads the image of a specified index in the buffer to the HTTP server through the HTTP POST method. + * @method WebTwain#HTTPUploadThroughPost + * @param {string} HTTPServer the name of the HTTP server. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; + + /** + * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadThroughPostAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; + + /** + * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadThroughPostAsMultiPagePDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; + + /** + * Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPUploadThroughPostDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} localFile specifies the path of a local file . + * @param {string} ActionPage the specified page for posting files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the file to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method. + * @method WebTwain#HTTPUploadThroughPostEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.s + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; + + /** + * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method. + * @method WebTwain#HTTPUploadThroughPut + * @param {string} HTTPServer the name of the HTTP server. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} RemoteFileName the name of the image to be created on the HTTP server. It should a relative path on the web server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadThroughPut(HTTPServer: string, sImageIndex: number, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadThroughPutAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadThroughPutAsMultiPagePDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadThroughPutAsMultiPagePDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPUploadThroughPutDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} localFile specifies the path of a local file. + * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadThroughPutDirectly(HTTPServer: string, localFile: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP PUT method. + * @method WebTwain#HTTPUploadThroughPutEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadThroughPutEx(HTTPServer: string, sImageIndex: number, RemoteFileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Detects whether an image is blank. + * @method WebTwain#IsBlankImage + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + IsBlankImage(sImageIndex: number): boolean; + + /** + * [Deprecated.] Detects whether a certain area on an image is blank. + * @method WebTwain#IsBlankImageEx + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @param {boolean} bFuzzyMatch specifies whether use fuzzy matching when detecting. + * @return {boolean} + */ + IsBlankImageEx(sImageIndex: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean; + + /** + * Detects whether a specific image is blank. + * @method WebTwain#IsBlankImageExpress + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + IsBlankImageExpress(sImageIndex: number): boolean; + + /** + * Loads a DIB format image from Clipboard into the Dynamic Web TWAIN. + * @method WebTwain#LoadDibFromClipboard + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + LoadDibFromClipboard(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads an image into the Dynamic Web TWAIN. + * @method WebTwain#LoadImage + * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + LoadImage(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads an image into the Dynamic Web TWAIN. + * @method WebTwain#LoadImageEx + * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be loaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + LoadImageEx(localFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads image from a base64 byte array with the specified file format. + * @method WebTwain#LoadImageFromBase64Binary + * @param {string} bry specifies the base64 string data. + * @param {EnumDWT_ImageType} lImageType specifies the file format. + * @return {boolean} + */ + LoadImageFromBase64Binary(bry: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Loads image from a byte array with the specified file format. + * @method WebTwain#LoadImageFromBytes + * @param {number} lBufferSize Specifies the buffer size. + * @param {Array} buffer A byte array of the image data. + * @param {EnumDWT_ImageType} lImageType Specifies the file format. + * @return {boolean} + */ + LoadImageFromBytes(lBufferSize: number, buffer: number[], lImageType: EnumDWT_ImageType): boolean; + + /** + * Mirrors the image of a specified index in buffer. + * @method WebTwain#Mirror + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + Mirror(sImageIndex: number): boolean; + + /** + * Moves a specified image. + * @method WebTwain#MoveImage + * @param {number} sSourceImageIndex Specifies the source index of image in buffer. The index is 0-based. + * @param {number} sTargetImageIndex Specifies the target index of image in buffer. The index is 0-based. + * @return {boolean} + */ + MoveImage(sSourceImageIndex: number, sTargetImageIndex: number): boolean; + + /*ignored + OnRefreshUI + */ + + /** + * Loads the specified Source into main memory and causes its initialization, + * placing Dynamic Web TWAIN into Capability Negotiation state. If no source is + * specified (no SelectSource() or SelectSourceByIndex() is called), opens the default source. + * @method WebTwain#OpenSource + * @return {boolean} + */ + OpenSource(): boolean; + + /** + * Loads and opens Data Source Manager. + * @method WebTwain#OpenSourceManager + * @return {boolean} + */ + OpenSourceManager(): boolean; + + /** + * Decorates image of a specified index in buffer with rectangles of transparent color. + * @method WebTwain#OverlayRectangle + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @param {number} color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red. + * @param {number} fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent. + * @return {boolean} + */ + OverlayRectangle(sImageIndex: number, left: number, top: number, right: number, bottom: number, color: number, fOpacity: number): boolean; + + /** + * Shows the GUI of Image Printer. + * @method WebTwain#Print + * @param {boolean} bUseSystemDefaultPrintUI specifies whether to use the system Print UI or not. + * @return {boolean} + */ + Print(bUseSystemDefaultPrintUI: boolean): boolean; + + /** + * Binds a specified function to an event, so that the function gets called whenever the event fires. + * @method WebTwain#RegisterEvent + * @param {string} name the name of the event that the function is bound to. + * @param {any} evt specifies the function to call when event fires. + * @return {boolean} + */ + RegisterEvent(name: string, evt: any): boolean; + + /** + * Removes all images in buffer. + * @method WebTwain#RemoveAllImages + * @return {boolean} + */ + RemoveAllImages(): boolean; + + /** + * Removes selected images in buffer. + * @method WebTwain#RemoveAllSelectedImages + * @return {boolean} + */ + RemoveAllSelectedImages(): boolean; + + /** + * Removes the image of a specified index in buffer. + * @method WebTwain#RemoveImage + * @param {number} sImageIndexToBeDeleted specifies the index of the image to be deleted in buffer. The index is 0-based. + * @return {boolean} + */ + RemoveImage(sImageIndexToBeDeleted: number): boolean; + + /** + * Reverts the current image layout to the Data Source's default. + * @method WebTwain#ResetImageLayout + * @return {boolean} + */ + ResetImageLayout(): boolean; + + /** + * Sets the Source to return the current page to the input side of the document feeder and + * feed the last page from the outside of the feeder back into the acquisition area if IfFeederEnabled is TRUE. + * @method WebTwain#RewindPage + * @return {boolean} + */ + RewindPage(): boolean; + + /** + * Rotates the image of a specified index in buffer by specified angle. + * @method WebTwain#Rotate + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} fAngle Specifies the rotation angle. + * @param {boolean} bKeepSize Keep size or not. + * @return {boolean} + */ + Rotate(sImageIndex: number, fAngle: number, bKeepSize: boolean): boolean; + + /** + * Rotates the image of a specified index in buffer by specified angle. + * @method WebTwain#RotateEx + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} fAngle Specifies the rotation angle. + * @param {boolean} bKeepSize Keep size or not. + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {boolean} + */ + RotateEx(sImageIndex: number, fAngle: number, bKeepSize: boolean, newVal: EnumDWT_InterpolationMethod): boolean; + + /** + * Rotates the image of a specified index in buffer by 90 degrees counter-clockwise. + * @method WebTwain#RotateLeft + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + RotateLeft(sImageIndex: number): boolean; + + /** + * Rotates the image of a specified index in buffer by 90 degrees clockwise. + * @method WebTwain#RotateRight + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + RotateRight(sImageIndex: number): boolean; + + /** + * Saves all images in buffer as a MultiPage TIFF file. + * @method WebTwain#SaveAllAsMultiPageTIFF + * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + SaveAllAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves all images in buffer as a Multi-Page PDF file. + * @method WebTwain#SaveAllAsPDF + * @param {string} localFile the name of the Multi-Page PDF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + SaveAllAsPDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the image of a specified index in buffer as a BMP file. + * @method WebTwain#SaveAsBMP + * @param {string} localFile the name of the BMP file to be saved. It should be an absolute path on the local disk. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SaveAsBMP(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /*ignored + SaveAsGIF + */ + + /** + * Saves the image of a specified index in buffer as a JPEG file. + * @method WebTwain#SaveAsJPEG + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SaveAsJPEG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the image of a specified index in buffer as a PDF file. + * @method WebTwain#SaveAsPDF + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SaveAsPDF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the image of a specified index in buffer as a PNG file. + * @method WebTwain#SaveAsPNG + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SaveAsPNG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the image of a specified index in buffer as a TIFF file. + * @method WebTwain#SaveAsTIFF + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SaveAsTIFF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the selected images in buffer as a Multipage PDF file. + * @method WebTwain#SaveSelectedImagesAsMultiPagePDF + * @param {string} localFile the name of the MultiPage PDF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + SaveSelectedImagesAsMultiPagePDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the selected images in buffer as a Multipage TIFF file. + * @method WebTwain#SaveSelectedImagesAsMultiPageTIFF + * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + SaveSelectedImagesAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the selected images in buffer to base64 string. + * @method WebTwain#SaveSelectedImagesToBase64Binary + * @return {string|boolean} + */ + SaveSelectedImagesToBase64Binary(optionalAsyncSuccessFunc?: (result: string[]) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): string | boolean; + + /** + * [Deprecated.] Saves the selected images in buffer to a byte array in the specified file format. + * @method WebTwain#SaveSelectedImagesToBytes + * @param {number} bufferSize specified the buffer size. + * @param {Array} buffer A byte array of the image data. + * @return {number} + */ + SaveSelectedImagesToBytes(bufferSize: number, buffer: number[]): number; + + /** + * Brings up the TWAIN Data Source Manager's Source Selection User Interface (UI) + * so that user can choose which Data Source to be the current Source. + * @method WebTwain#SelectSource + * @return {boolean} + */ + SelectSource(): boolean; + + /** + * Selects the index-the source in SourceNameItems property as the current source. + * @method WebTwain#SelectSourceByIndex + * @param {number} index It is the index of SourceNameItems property. + * @return {boolean} + */ + SelectSourceByIndex(index: number): boolean; + + /*ignored + SetCancel + */ + + /** + * Set the value of the specified cap item. + * @method WebTwain#SetCapItems + * @param {number} index Index is 0-based. It is the index of the cap item. + * @param {number} newVal For string type, please use CapItemsstring property. + * @return {void} + */ + SetCapItems(index: number, newVal: number): void; + + /** + * Set the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * @method WebTwain#SetCapItemsString + * @param {number} index Index is 0-based. It is the index of the cap item. + * @param {string} newVal The new value to be set. + * @return {void} + */ + SetCapItemsString(index: number, newVal: string): void; + + /** + * [Deprecated.] Sets current cookie into the Http Header to be used when uploading scanned images through POST. + * @method WebTwain#SetCookie + * @param {string} cookie the cookie on current page. + * @return {void} + */ + SetCookie(cookie: string): void; + + // Set custom DS data (DAT_CUSTOMDSDATA), the input string is encoded with base64 + /** + * Sets custom DS data to be used for scanning, the input string is encoded with base64. Custom DS data means a specific scanning profile. + * @method WebTwain#SetCustomDSDataEx + * @param {string} value the input string which is encoded with base64. + * @return {boolean} + */ + SetCustomDSDataEx(value: string): boolean; + + // Set custom DS data, load data from the specified file + /** + * Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile. + * @method WebTwain#SetCustomDSData + * @param {string} fileName the absolute path of the file where the custom data source data is stored. + * @return {boolean} + */ + SetCustomDSData(fileName: string): boolean; + + /** + * Change the DPI (dots per inch) for the specified image. + * @method WebTwain#SetDPI + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} xResolution The horizontal resolution. + * @param {number} yResolution The vertical resolution. + * @param {boolean} bResampleImage Whether to resample the image. (The image size will be changed if this is set to true). + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {boolean} + */ + SetDPI(sImageIndex: number, xResolution: number, yResolution: number, bResampleImage: boolean, newVal: EnumDWT_InterpolationMethod): boolean; + + /** + * Sets file name and file format information used in File Transfer Mode. + * @method WebTwain#SetFileXferInfo + * @param {string} fileName the name of the file to be used in transfer. + * @param {EnumDWT_FileFormat} fileFormat an enumerated value indicates the format of the image. + * @return {boolean} + */ + SetFileXferInfo(fileName: string, fileFormat: EnumDWT_FileFormat): boolean; + + /** + * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images. + * @method WebTwain#SetHTTPFormField + * @param {string} FieldName specifies the name of a text field in web form. + * @param {string} FieldValue specifies the value of a text field in web form. + * @return {boolean} + */ + SetHTTPFormField(FieldName: string, FieldValue: string): boolean; + + /** + * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images. + * @method WebTwain#SetHTTPFormField + * @param {string} FieldName specifies the name of the field which could later be used to retrieve the blob + * @param {Blob} blobValue specifies the blob to be put in the form. + * @param {string} optionalFileName specifies the file name for the blob + * @return {boolean} + */ + SetHTTPFormField(FieldName: string, blobValue: Blob, optionalFileName?: string): boolean; + + /** + * Sets a header for the current HTTP Post request. + * @method WebTwain#SetHTTPHeader + * @param {string} key the key of the header. + * @param {string} value the value of the header. + * @return {boolean} + */ + SetHTTPHeader(key: string, value: string): boolean; + + /** + * Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source. + * @method WebTwain#SetImageLayout + * @param {number} left specifies the floating point number for the left side of the image layout rectangle. + * @param {number} top specifies the floating point number for the top side of the image layout rectangle. + * @param {number} right specifies the floating point number for the right side of the image layout rectangle. + * @param {number} bottom specifies the floating point number for the bottom side of the image layout rectangle. + * @return {boolean} + */ + SetImageLayout(left: number, top: number, right: number, bottom: number): boolean; + + /** + * Change the width of an image in buffer. + * @method WebTwain#SetImageWidth + * @param {number} sImageIndex specifies which image you'd like to change. + * @param {number} iNewWidth specifies how wide you'd like to change the image. + * @return {boolean} + */ + SetImageWidth(sImageIndex: number, iNewWidth: number): boolean; + + /** + * Set the language for the authorization dialogs. + * @method WebTwain#SetLanguage + * @param {EnumDWT_Language} language specify the language + * @return {boolean} + */ + SetLanguage(language: EnumDWT_Language): boolean; + + /** + * Sets the time-out used to open a specified Data Source. + * @method WebTwain#SetOpenSourceTimeout + * @param {number} iMilliseconds specifies the number of milliseconds. + * @return {boolean} + */ + SetOpenSourceTimeout(iMilliseconds: number): boolean; + + /** + * Draws a rectangle on the viewer which represents the selected area. + * @method WebTwain#SetSelectedImageArea + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left The X axis of the left border. + * @param {number} top The Y axis of the top border. + * @param {number} right The X axis of the right border. + * @param {number} bottom The Y axis of the bottom border. + * @return {boolean} + */ + SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * You can use the method to select images programatically which is ususally done by mouse clicking. + * @method WebTwain#SetSelectedImageIndex + * @param {number} sSelectedIndex this is the index of an array that holds the indices of selected images. + * @param {number} newVal specifies the index of an image that you want to select. + * @return {boolean} + */ + SetSelectedImageIndex(selectedIndex: number, newVal: number): boolean; + + /** + * Sets a custom tiff tag. Currently you can set up to 32 tags. The string to be set in a tag can be encoded with base64. + * @method WebTwain#SetTiffCustomTag + * @param {number} tag specifies the tag identifier. The value should be between 600 and 700. + * @param {string} content the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, we'll decode it before writing it. + * @param {boolean} base64Str if you'd like to encode the string with base64, set this to true. Otherwise, the string will be plin text. + * @return {boolean} + */ + SetTiffCustomTag(tag: number, content: string, base64Str: boolean): boolean; + + /** + * Configures how segmented upload is done. + * @method WebTwain#SetUploadSegment + * @param {number} segmentUploadThreshold specifies the threshold (in MB) over which segmented upload will be invoked. + * @param {number} moduleSize specifies the size of each segment (in KB). + * @return {boolean} + */ + SetUploadSegment(segmentUploadThreshold: number, moduleSize: number): boolean; + + /** + * Sets the view mode that images are displayed in Dynamic Web TWAIN. You can use this method to display multiple images in Dynamic Web TWAIN. + * @method WebTwain#SetViewMode + * @param {number} sHorizontalImageCount specifies how many columns can be displayed in Dynamic Web TWAIN. + * @param {number} sVerticalImageCount specifies how many rows can be displayed in Dynamic Web TWAIN.. + * @return {void} + */ + SetViewMode(sHorizontalImageCount: number, sVerticalImageCount: number): void; + + /** + * Show save file dialog or show open file dialog. + * @method WebTwain#ShowFileDialog + * @param {boolean} SaveDialog True -- show save file dialog, False -- show open file dialog. + * @param {string} Filter The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically. + * @param {number} FilterIndex The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based. + * @param {string} DefExtension Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended. + * @param {string} InitialDir The initial directory. The algorithm for selecting the initial directory varies on different platforms. + * @param {boolean} AllowMultiSelect True -- allows users to select more than one file, False -- only allows to select one file. + * @param {boolean} OverwritePrompt True -- If a file already exists with the same name, the old file will be simply overwritten, False -- not allows to save and overwrite a same name file. + * @param {number} Flags If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and parameters "AllowMultiSelect" and "OverwritePrompt" will be useless. + * @return {boolean} + */ + ShowFileDialog(SaveDialog: boolean, Filter: string, FilterIndex: number, DefExtension: string, InitialDir: string, AllowMultiSelect: boolean, OverwritePrompt: boolean, Flags: number): boolean; + + /** + * Shows the GUI of Image Editor. + * @method WebTwain#ShowImageEditor + * @return {boolean} + */ + ShowImageEditor(divID?: string, divWidth?: number, divHeight?: number): boolean; + + /** + * [Deprecated.] Shows the GUI of Image Editor with custom settings. + * @method WebTwain#ShowImageEditorEx + * @param {number} x specifies the new position of the left top corner of the window. + * @param {number} y specifies the new position of the left top corner of the window. + * @param {number} cx specifies the width of the window. + * @param {number} cy specifies the height of the window. + * @param {number} nCmdShow specifices how the window should be shown. + * @return {boolean} + */ + ShowImageEditorEx(x: number, y: number, cx: number, cy: number, nCmdShow: number): boolean; + + /*ingored + SourceNameItems + */ + + /** + * Switchs two images of specified indices in buffer. + * @method WebTwain#SwitchImage + * @param {number} sImageIndex1 specifies the index of image in buffer. The index is 0-based. + * @param {number} sImageIndex2 specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SwitchImage(sImageIndex1: number, sImageIndex2: number): boolean; + + /** + * Unbinds an event from the specified function, so that the function stops receiving notifications when the event fires. + * @method WebTwain#UnregisterEvent + * @param {string} name the name of the event. + * @param {object} evt specified the function to be unbound. + * @return {boolean} + */ + UnregisterEvent(name: string, evt: object): boolean; + + /*ignored + checkErrorString + first + getInstance + last + next + on + onEvent + previous + + ...other internal ones + */ +} + +/** Border Styles */ +declare enum EnumDWT_BorderStyle { + /** No border. */ + TWBS_NONE = 0, + /** Flat border. */ + TWBS_SINGLEFLAT = 1, + /** 3D border. */ + TWBS_SINGLE3D = 2 +} + +/** Capabilities */ +declare enum EnumDWT_Cap { + /** Nothing. */ + CAP_NONE = 0, + /** The application is willing to accept this number of images. */ + CAP_XFERCOUNT = 1, + /** Allows the application and Source to identify which compression schemes they have in + * common for Buffered Memory and File transfers. + * Note for File transfers: + * Since only certain file formats support compression, this capability must be negotiated after + * setting the desired file format with ICAP_IMAGEFILEFORMAT. + */ + ICAP_COMPRESSION = 256, + /** The type of pixel data that a Source is capable of acquiring (for example, black and white, gray, RGB, etc.). */ + ICAP_PIXELTYPE = 257, + /** Unless a quantity is dimensionless or uses a specified unit of measure, ICAP_UNITS determines + * the unit of measure for all quantities. + */ + ICAP_UNITS = 258, + /** Allows the application and Source to identify which transfer mechanisms the source supports. */ + ICAP_XFERMECH = 259, + /** The name or other identifying information about the Author of the image. It may include a copyright string. */ + CAP_AUTHOR = 4096, + /** A general note about the acquired image. */ + CAP_CAPTION = 4097, + /** If TRUE, Source must acquire data from the document feeder acquire area and other feeder + * capabilities can be used. If FALSE, Source must acquire data from the non-feeder acquire area + * and no other feeder capabilities can be used. + */ + CAP_FEEDERENABLED = 4098, + /** Reflect whether there are documents loaded in the Source's feeder. */ + CAP_FEEDERLOADED = 4099, + /** The date and time the image was acquired. + * Stored in the form "YYYY/MM/DD HH:mm:SS.sss" where YYYY is the year, MM is the + * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, + * and sss is the millisecond. + */ + CAP_TIMEDATE = 4100, + /** Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate + * which capabilities the Source will allow to be set by the application. Some capabilities can only + * be set if certain setup work has been done so the Source cannot globally answer which + * capabilities are "set-able." + */ + CAP_SUPPORTEDCAPS = 4101, + /** Allows the application and Source to negotiate capabilities to be used in States 5 and 6. */ + CAP_EXTENDEDCAPS = 4102, + /** If TRUE, the Source will automatically feed the next page from the document feeder after the + * number of frames negotiated for capture from each page are acquired. CAP_FEEDERENABLED + * must be TRUE to use this capability. + */ + CAP_AUTOFEED = 4103, + /** If TRUE, the Source will eject the current page being acquired from and will leave the feeder + * acquire area empty. + * If CAP_AUTOFEED is TRUE, a fresh page will be advanced. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_CLEARPAGE = 4104, + /** If TRUE, the Source will eject the current page and advance the next page in the document feeder + * into the feeder acquire area. + * If CAP_AUTOFEED is TRUE, the same action just described will occur and CAP_AUTOFEED will + * remain active. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_FEEDPAGE = 4105, + /** If TRUE, the Source will return the current page to the input side of the document feeder and + * feed the last page from the output side of the feeder back into the acquisition area. + * If CAP_AUTOFEED is TRUE, automatic feeding will continue after all negotiated frames from this + * page are acquired. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_REWINDPAGE = 4106, + /** If TRUE, the Source will display a progress indicator during acquisition and transfer, regardless + * of whether the Source's user interface is active. If FALSE, the progress indicator will be + * suppressed if the Source's user interface is inactive. + * The Source will continue to display device-specific instructions and error messages even with + * the Source user interface and progress indicators turned off. + */ + CAP_INDICATORS = 4107, + /** Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate + * which capabilities the Source will allow to be set by the application. Some capabilities can only + * be set if certain setup work has been done so the Source cannot globally answer which + * capabilities are "set-able." + */ + CAP_SUPPORTEDCAPSEXT = 4108, + /** This capability determines whether the device has a paper sensor that can detect documents on the ADF or Flatbed. */ + CAP_PAPERDETECTABLE = 4109, + /** If TRUE, indicates that this Source supports acquisition with the UI disabled; i.e., + * TW_USERINTERFACE's ShowUI field can be set to FALSE. If FALSE, indicates that this Source + * can only support acquisition with the UI enabled. + */ + CAP_UICONTROLLABLE = 4110, + /** If TRUE, the physical hardware (e.g., scanner, digital camera, image database, etc.) that + * represents the image source is attached, powered on, and communicating. + */ + CAP_DEVICEONLINE = 4111, + /** This capability is intended to boost the performance of a Source. The fundamental assumption + * behind AutoScan is that the device is able to capture the number of images indicated by the + * value of CAP_XFERCOUNT without waiting for the Application to request the image transfers. + * This is only possible if the device has internal buffers capable of caching the images it captures. + * The default behavior is undefined, because some high volume devices are incapable of anything + * but CAP_AUTOSCAN being equal to TRUE. However, if a Source supports FALSE, it should use it + * as the mandatory default, since this best describes the behavior of pre-1.8 TWAIN Applications. + */ + CAP_AUTOSCAN = 4112, + /** Allows an application to request the delivery of thumbnail representations for the set of images + * that are to be delivered. + * Setting CAP_THUMBNAILSENABLED to TRUE turns on thumbnail mode. Images transferred + * thereafter will be sent at thumbnail size (exact thumbnail size is determined by the Data Source). + * Setting this capability to FALSE turns thumbnail mode off and returns full size images. + */ + CAP_THUMBNAILSENABLED = 4113, + /** This indicates whether the scanner supports duplex. If so, it further indicates whether one-path + * or two-path duplex is supported. + */ + CAP_DUPLEX = 4114, + /** The user can set the duplex option to be TRUE or FALSE. If TRUE, the scanner scans both sides + * of a paper; otherwise, the scanner will scan only one side of the image. + */ + CAP_DUPLEXENABLED = 4115, + /** Allows an application to query a source to see if it implements the new user interface settings dialog. */ + CAP_ENABLEDSUIONLY = 4116, + CAP_CUSTOMDSDATA = 4117, + /** Allows the application to specify the starting endorser / imprinter number. All other endorser/ + * imprinter properties should be handled through the data source's user interface. + * The user can set the starting number for the endorser. + */ + CAP_ENDORSER = 4118, + /** Turns specific audible alarms on and off. */ + CAP_ALARMS = 4120, + /** The volume of a device's audible alarm. Note that this control affects the volume of all alarms; + * no specific volume control for individual types of alarms is provided. + */ + CAP_ALARMVOLUME = 4121, + /** The number of images to automatically capture. This does not refer to the number of images to + * be sent to the Application, use CAP_XFERCOUNT for that. + */ + CAP_AUTOMATICCAPTURE = 4122, + /** For automatic capture, this value selects the number of milliseconds before the first picture is to + * be taken, or the first image is to be scanned. + */ + CAP_TIMEBEFOREFIRSTCAPTURE = 4123, + /** For automatic capture, this value selects the milliseconds to wait between pictures taken, or images scanned. */ + CAP_TIMEBETWEENCAPTURES = 4124, + /** CapGet() reports the presence of data in the scanner's buffers. CapSet() with a value of TWCB_CLEAR immediately clears the buffers. */ + CAP_CLEARBUFFERS = 4125, + /** Describes the number of pages that the scanner can buffer when CAP_AUTOSCAN is enabled. */ + CAP_MAXBATCHBUFFERS = 4126, + /** The date and time of the device's clock. + * Managed in the form "YYYY/MM/DD HH:mm:SS:sss" where YYYY is the year, MM is the + * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, + * and sss is the millisecond. + */ + CAP_DEVICETIMEDATE = 4127, + /** CapGet() reports the kinds of power available to the device. CapGetCurrent() reports the current power supply in use. */ + CAP_POWERSUPPLY = 4128, + /** This capability queries the Source for UI support for preview mode. If TRUE, the Source supports preview UI. */ + CAP_CAMERAPREVIEWUI = 4129, + /** A string containing the serial number of the currently selected device in the Source. Multiple + * devices may all report the same serial number. + */ + CAP_SERIALNUMBER = 4132, + /** CapGet() returns the current list of available printer devices, along with the one currently being used for negotiation. + * CapSet() selects the current device for negotiation, and optionally constrains the list. + * Top/Bottom refers to duplex devices, and indicates if the printer is writing on the top or the bottom of the sheet of paper. + * Simplex devices use the top settings. Before/After indicates whether printing occurs before or after the sheet of paper has been scanned. + */ + CAP_PRINTER = 4134, + /** Turns the current CAP_PRINTER device on or off. */ + CAP_PRINTERENABLED = 4135, + /** The User can set the starting number for the current CAP_PRINTER device. */ + CAP_PRINTERINDEX = 4136, + /** Specifies the appropriate current CAP_PRINTER device mode. + * Note: + * โ€ข TWPM_SINGLESTRING specifies that the printed text will consist of a single string. + * โ€ข TWPM _MULTISTRING specifies that the printed text will consist of an enumerated list of + * strings to be printed in order. + * โ€ข TWPM _COMPOUNDSTRING specifies that the printed string will consist of a compound of a + * String followed by a value followed by a suffix string. + */ + CAP_PRINTERMODE = 4137, + /** Specifies the string(s) that are to be used in the string component when the current + * CAP_PRINTER device is enabled. + */ + CAP_PRINTERSTRING = 4138, + /** Specifies the string that shall be used as the current CAP_PRINTER device's suffix. */ + CAP_PRINTERSUFFIX = 4139, + /** Allows Application and Source to identify which languages they have in common for the exchange of string data, + * and to select the language of the internal UI. Since the TWLG_xxxx codes include language and country data, there is no separate + * capability for selecting the country. + */ + CAP_LANGUAGE = 4140, + /** Helps the Application determine any special actions it may need to take when negotiating + * frames with the Source. Allowed values are listed in . + * TWFA_NONE: The alignment is free-floating. Applications should assume + * that the origin for frames is on the left. + * TWFA_LEFT: The alignment is to the left. + * TWFA_CENTER: The alignment is centered. This means that the paper will + * be fed in the middle of the ICAP_PHYSICALWIDTH of the + * device. If this is set, then the Application should calculate + * any frames with a left offset of zero. + * TWFA_RIGHT: The alignment is to the right. + */ + CAP_FEEDERALIGNMENT = 4141, + /** TWFO_FIRSTPAGEFIRST if the feeder starts with the top of the first page. + * TWFO_LASTPAGEFIRST is the feeder starts with the top of the last page. + */ + CAP_FEEDERORDER = 4142, + /** Indicates whether the physical hardware (e.g. scanner, digital camera) is capable of acquiring + * multiple images of the same page without changes to the physical registration of that page. + */ + CAP_REACQUIREALLOWED = 4144, + /** The minutes of battery power remaining to the device. */ + CAP_BATTERYMINUTES = 4146, + /** When used with CapGet(), return the percentage of battery power level on camera. If -1 is returned, it indicates that the battery is not present. */ + CAP_BATTERYPERCENTAGE = 4147, + /** Added 1.91 */ + CAP_CAMERASIDE = 4148, + /** Added 1.91 */ + CAP_SEGMENTED = 4149, + /** Added 2.0 */ + CAP_CAMERAENABLED = 4150, + /** Added 2.0 */ + CAP_CAMERAORDER = 4151, + /** Added 2.0 */ + CAP_MICRENABLED = 4152, + /** Added 2.0 */ + CAP_FEEDERPREP = 4153, + /** Added 2.0 */ + CAP_FEEDERPOCKET = 4154, + /** Added 2.1 */ + CAP_AUTOMATICSENSEMEDIUM = 4155, + /** Added 2.1 */ + CAP_CUSTOMINTERFACEGUID = 4156, + /** TRUE enables and FALSE disables the Source's Auto-brightness function (if any). */ + ICAP_AUTOBRIGHT = 4352, + /** The brightness values available within the Source. */ + ICAP_BRIGHTNESS = 4353, + /** The contrast values available within the Source. */ + ICAP_CONTRAST = 4355, + /** Specifies the square-cell halftone (dithering) matrix the Source should use to halftone the image. */ + ICAP_CUSTHALFTONE = 4356, + /** Specifies the exposure time used to capture the image, in seconds. */ + ICAP_EXPOSURETIME = 4357, + /** Describes the color characteristic of the subtractive filter applied to the image data. Multiple + * filters may be applied to a single acquisition. + */ + ICAP_FILTER = 4358, + /** Specifies whether or not the image was acquired using a flash. */ + ICAP_FLASHUSED = 4359, + /** Gamma correction value for the image data. */ + ICAP_GAMMA = 4360, + /** A list of names of the halftone patterns available within the Source. */ + ICAP_HALFTONES = 4361, + /** Specifies which value in an image should be interpreted as the lightest "highlight." All values + * "lighter" than this value will be clipped to this value. Whether lighter values are smaller or + * larger can be determined by examining the Current value of ICAP_PIXELFLAVOR. + */ + ICAP_HIGHLIGHT = 4362, + /** Informs the application which file formats the Source can generate (CapGet()). Tells the Source which file formats the application can handle (CapSet()). + * TWFF_TIFF Used for document + * TWFF_PICT Native Macintosh + * TWFF_BMP Native Microsoft + * TWFF_XBM Used for document + * TWFF_JFIF Wrapper for JPEG + * TWFF_FPX FlashPix, used with digital + * TWFF_TIFFMULTI Multi-page TIFF files + * TWFF_PNG An image format standard intended for use on the web, replaces GIF + * TWFF_SPIFF A standard from JPEG, intended to replace JFIF, also supports JBIG + * TWFF_EXIF File format for use with digital cameras. + */ + ICAP_IMAGEFILEFORMAT = 4364, + /** TRUE means the lamp is currently, or should be set to ON. Sources may not support CapSet() operations. */ + ICAP_LAMPSTATE = 4365, + /** Describes the general color characteristic of the light source used to acquire the image. */ + ICAP_LIGHTSOURCE = 4366, + /** Defines which edge of the "paper" the image's "top" is aligned with. This information is used to adjust the frames to match the + * scanning orientation of the paper. For instance, if an ICAP_SUPPORTEDSIZE of TWSS_ISOA4 has been negotiated, + * and ICAP_ORIENTATION is set to TWOR_LANDSCAPE, then the Source must rotate the frame it downloads to the scanner to reflect the + * orientation of the paper. Please note that setting ICAP_ORIENTATION does not affect the values reported by ICAP_FRAMES; + * it just causes the Source to use them in a different way. The upper-left of the image is defined as the location where both the primary and + * secondary scans originate. (The X axis is the primary scan direction and the Y axis is the secondary scan direction.) + * For a flatbed scanner, the light bar moves in the secondary scan direction. For a handheld scanner, the scanner is drug in the + * secondary scan direction. For a digital camera, the secondary direction is the vertical axis when the viewed image is considered upright. + */ + ICAP_ORIENTATION = 4368, + /** The maximum physical width (X-axis) the Source can acquire (measured in units of ICAP_UNITS). */ + ICAP_PHYSICALWIDTH = 4369, + /** The maximum physical height (Y-axis) the Source can acquire (measured in units of ICAP_UNITS). */ + ICAP_PHYSICALHEIGHT = 4370, + /** Specifies which value in an image should be interpreted as the darkest "shadow." All values + * "darker" than this value will be clipped to this value. + */ + ICAP_SHADOW = 4371, + /** The list of frames the Source will acquire on each page. */ + ICAP_FRAMES = 4372, + /** The native optical resolution along the X-axis of the device being controlled by the Source. Most + * devices will respond with a single value (TW_ONEVALUE). + * This is NOT a list of all resolutions that can be generated by the device. Rather, this is the + * resolution of the device's optics. Measured in units of pixels per unit as defined by + * ICAP_UNITS (pixels per TWUN_PIXELS yields dimensionless data). + */ + ICAP_XNATIVERESOLUTION = 4374, + /** The native optical resolution along the Y-axis of the device being controlled by the Source. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). + */ + ICAP_YNATIVERESOLUTION = 4375, + /** All the X-axis resolutions the Source can provide. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). That is, when the units are TWUN_PIXELS, both + * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources + * like to report the actual number of pixels that the device reports, but that response is more + * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. + */ + ICAP_XRESOLUTION = 4376, + /** All the Y-axis resolutions the Source can provide. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). That is, when the units are TWUN_PIXELS, both + * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources + * like to report the actual number of pixels that the device reports, but that response is more + * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. + */ + ICAP_YRESOLUTION = 4377, + /** The maximum number of frames the Source can provide or the application can accept per page. + * This is a bounding capability only. It does not establish current or future behavior. + */ + ICAP_MAXFRAMES = 4378, + /** This is used with buffered memory transfers. If TRUE, Source can provide application with tiled image data. */ + ICAP_TILES = 4379, + /** Specifies how the bytes in an image are filled by the Source. TWBO_MSBFIRST indicates that the leftmost bit in the byte (usually bit 7) is + * the byte's Most Significant Bit. + */ + ICAP_BITORDER = 4380, + /** Used for CCITT Group 3 2-dimensional compression. The 'K' factor indicates how often the + * new compression baseline should be re-established. A value of 2 or 4 is common in facsimile + * communication. A value of zero in this field will indicate an infinite K factorโ€”the baseline is + * only calculated at the beginning of the transfer. + */ + ICAP_CCITTKFACTOR = 4381, + /** Describes whether the image was captured transmissively or reflectively. */ + ICAP_LIGHTPATH = 4382, + /** Sense of the pixel whose numeric value is zero (minimum data value). */ + ICAP_PIXELFLAVOR = 4383, + /** Allows the application and Source to identify which color data formats are available. There are + * two options, "planar" and "chunky." + */ + ICAP_PLANARCHUNKY = 4384, + /** How the Source can/should rotate the scanned image data prior to transfer. This doesn't use + * ICAP_UNITS. It is always measured in degrees. Any applied value is additive with any + * rotation specified in ICAP_ORIENTATION. + */ + ICAP_ROTATION = 4385, + /** For devices that support fixed frame sizes. + * Defined sizes match typical page sizes. This specifies the size(s) the Source can/should use to acquire image data. + */ + ICAP_SUPPORTEDSIZES = 4386, + /** Specifies the dividing line between black and white. This is the value the Source will use to + * threshold, if needed, when ICAP_PIXELTYPE:TWPT_BW. + * The value is normalized so there are no units of measure associated with this ICAP. + */ + ICAP_THRESHOLD = 4387, + /** All the X-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. Do not use values less than or equal to zero. */ + ICAP_XSCALING = 4388, + /** All the Y-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. Do not use values less than or equal to zero. + * There are no units inherent with this data as it is normalized to 1.0 being "unscaled." + */ + ICAP_YSCALING = 4389, + /** Used for CCITT data compression only. Indicates the bit order representation of the stored compressed codes. */ + ICAP_BITORDERCODES = 4390, + /** Used only for CCITT data compression. Specifies whether the compressed codes' pixel "sense" + * will be inverted from the Current value of ICAP_PIXELFLAVOR prior to transfer. + */ + ICAP_PIXELFLAVORCODES = 4391, + /** Allows the application and Source to agree upon a common set of color descriptors that are + * made available by the Source. This ICAP is only useful for JPEG-compressed buffered memory image transfers. + */ + ICAP_JPEGPIXELTYPE = 4392, + /** Used only with CCITT data compression. Specifies the minimum number of words of compressed codes (compressed data) to be transmitted per line. */ + ICAP_TIMEFILL = 4394, + /** Specifies the pixel bit depths for the Current value of ICAP_PIXELTYPE. For example, when + * using ICAP_PIXELTYPE:TWPT_GRAY, this capability specifies whether this is 8-bit gray or 4-bit gray. + * This depth applies to all the data channels (for instance, the R, G, and B channels will all have + * this same bit depth for RGB data). + */ + ICAP_BITDEPTH = 4395, + /** Specifies the Reduction Method the Source should use to reduce the bit depth of the data. Most + * commonly used with ICAP_PIXELTYPE:TWPT_BW to reduce gray data to black and white. + */ + ICAP_BITDEPTHREDUCTION = 4396, + /** If TRUE the Source will issue a MSG_XFERREADY before starting the scan. + * Note: The Source may need to scan the image before initiating the transfer. This is the case if + * the scanned image is rotated or merged with another scanned image. + */ + ICAP_UNDEFINEDIMAGESIZE = 4397, + /** Allows the application to query the data source to see if it supports extended image attribute capabilities, + * such as Barcode Recognition, Shaded Area Detection and Removal, Skew detection and Removal, and so on. + */ + ICAP_EXTIMAGEINFO = 4399, + /** Allows the source to define the minimum height (Y-axis) that the source can acquire. */ + ICAP_MINIMUMHEIGHT = 4400, + /** Allows the source to define theminimum width (X-axis) that the source can acquire. */ + ICAP_MINIMUMWIDTH = 4401, + /** Use this capability to have the Source discard blank images. The Application never sees these + * images during the scanning session. + * TWBP_DISABLE โ€“ this must be the default state for the Source. It indicates that all images will + * be delivered to the Application, none of them will be discarded. + * TWBP_AUTO โ€“ if this is used, then the Source will decide if an image is blank or not and discard + * as appropriate. + * If the specified value is a positive number in the range 0 to 231โ€“1, then this capability will use it + * as the byte size cutoff point to identify which images are to be discarded. If the size of the image + * is less than or equal to this value, then it will be discarded. If the size of the image is greater + * than this value, then it will be kept so that it can be transferred to the Application. + */ + ICAP_AUTODISCARDBLANKPAGES = 4404, + /** Flip rotation is used to properly orient images that flip orientation every other image. + * TWFR_BOOK The images to be scanned are viewed in book form, flipping each page from left to right or right to left. + * TWFR_FANFOLD The images to be scanned are viewed in fanfold paper style, flipping each page up or down. + */ + ICAP_FLIPROTATION = 4406, + /** Turns bar code detection on and off. */ + ICAP_BARCODEDETECTIONENABLED = 4407, + /** Provides a list of bar code types that can be detected by the current Data Source. */ + ICAP_SUPPORTEDBARCODETYPES = 4408, + /** The maximum number of supported search priorities. */ + ICAP_BARCODEMAXSEARCHPRIORITIES = 4409, + /** A prioritized list of bar code types dictating the order in which bar codes will be sought. */ + ICAP_BARCODESEARCHPRIORITIES = 4410, + /** Restricts bar code searching to certain orientations, or prioritizes one orientation over the other. */ + ICAP_BARCODESEARCHMODE = 4411, + /** Restricts the number of times a search will be retried if none are found on each page. */ + ICAP_BARCODEMAXRETRIES = 4412, + /** Restricts the total time spent on searching for a bar code on each page. */ + ICAP_BARCODETIMEOUT = 4413, + /** When used with CapGet(), returns all camera supported lens zooming range. */ + ICAP_ZOOMFACTOR = 4414, + /** Turns patch code detection on and off. */ + ICAP_PATCHCODEDETECTIONENABLED = 4415, + /** A list of patch code types that may be detected by the current Data Source. */ + ICAP_SUPPORTEDPATCHCODETYPES = 4416, + /** The maximum number of supported search priorities. */ + ICAP_PATCHCODEMAXSEARCHPRIORITIES = 4417, + /** A prioritized list of patch code types dictating the order in which patch codes will be sought. */ + ICAP_PATCHCODESEARCHPRIORITIES = 4418, + /** Restricts patch code searching to certain orientations, or prioritizes one orientation over the other. */ + ICAP_PATCHCODESEARCHMODE = 4419, + /** Restricts the number of times a search will be retried if none are found on each page. */ + ICAP_PATCHCODEMAXRETRIES = 4420, + /** Restricts the total time spent on searching for a patch code on each page. */ + ICAP_PATCHCODETIMEOUT = 4421, + /** For devices that support flash. CapSet() selects the flash to be used (if any). CapGet() reports the current setting. + * This capability replaces ICAP_FLASHUSED, which is only able to negotiate the flash being on or off. + */ + ICAP_FLASHUSED2 = 4422, + /** For devices that support image enhancement filtering. This capability selects the algorithm used to improve the quality of the image. */ + ICAP_IMAGEFILTER = 4423, + /** For devices that support noise filtering. This capability selects the algorithm used to remove noise. */ + ICAP_NOISEFILTER = 4424, + /** Overscan is used to scan outside of the boundaries described by ICAP_FRAMES, and is used to help acquire image data that + * may be lost because of skewing. + * This is primarily of use for transport scanners which rely on edge detection to begin scanning. + * If overscan is supported, then the device is capable of scanning in the inter-document gap to get the skewed image information. + */ + ICAP_OVERSCAN = 4425, + /** Turns automatic border detection on and off. */ + ICAP_AUTOMATICBORDERDETECTION = 4432, + /** Turns automatic deskew correction on and off. */ + ICAP_AUTOMATICDESKEW = 4433, + /** When TRUE this capability depends on intelligent features within the Source to automatically + * rotate the image to the correct position. + */ + ICAP_AUTOMATICROTATE = 4434, + /** Added 1.9 */ + ICAP_JPEGQUALITY = 4435, + /** Added 1.91 */ + ICAP_FEEDERTYPE = 4436, + /** Added 1.91 */ + ICAP_ICCPROFILE = 4437, + /** Added 2.0 */ + ICAP_AUTOSIZE = 4438, + /** Added 2.1 */ + ICAP_AUTOMATICCROPUSESFRAME = 4439, + /** Added 2.1 */ + ICAP_AUTOMATICLENGTHDETECTION = 4440, + /** Added 2.1 */ + ICAP_AUTOMATICCOLORENABLED = 4441, + /** Added 2.1 */ + ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE = 4442, + /** Added 2.1 */ + ICAP_COLORMANAGEMENTENABLED = 4443, + /** Added 2.1 */ + ICAP_IMAGEMERGE = 4444, + /** Added 2.1 */ + ICAP_IMAGEMERGEHEIGHTTHRESHOLD = 4445, + /** Added 2.1 */ + ICAP_SUPPORTEDEXTIMAGEINFO = 4446 +} + +/** ICAP_BITORDER values. */ +declare enum EnumDWT_CapBitOrder { + TWBO_LSBFIRST = 0, + /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */ + TWBO_MSBFIRST = 1 +} + +/** ICAP_BITDEPTHREDUCTION values. */ +declare enum EnumDWT_CapBitdepthReduction { + TWBR_THRESHOLD = 0, + TWBR_HALFTONE = 1, + TWBR_CUSTHALFTONE = 2, + TWBR_DIFFUSION = 3 +} + +/** CAP_FEEDERALIGNMENT values. */ +declare enum EnumDWT_CapFeederAlignment { + /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */ + TWFA_NONE = 0, + /** The alignment is to the left. */ + TWFA_LEFT = 1, + /** The alignment is centered. This means that the paper will be fed in the middle of the ICAP_PHYSICALWIDTH of the + * device. If this is set, then the Application should calculate any frames with a left offset of zero. + */ + TWFA_CENTER = 2, + /** The alignment is to the right. */ + TWFA_RIGHT = 3 +} + +/** CAP_FEEDERORDER values. */ +declare enum EnumDWT_CapFeederOrder { + /** The feeder starts with the top of the first page. */ + TWFO_FIRSTPAGEFIRST = 0, + /** The feeder starts with the top of the last page. */ + TWFO_LASTPAGEFIRST = 1 +} + +/** ICAP_FILTER values. */ +declare enum EnumDWT_CapFilterType { + TWFT_RED = 0, + TWFT_GREEN = 1, + TWFT_BLUE = 2, + TWFT_NONE = 3, + TWFT_WHITE = 4, + TWFT_CYAN = 5, + TWFT_MAGENTA = 6, + TWFT_YELLOW = 7, + TWFT_BLACK = 8 +} + +/** ICAP_FLASHUSED2 values. */ +declare enum EnumDWT_CapFlash { + TWFL_NONE = 0, + TWFL_OFF = 1, + TWFL_ON = 2, + TWFL_AUTO = 3, + TWFL_REDEYE = 4 +} + +/** ICAP_FLIPROTATION values. */ +declare enum EnumDWT_CapFlipRotation { + /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */ + TWFR_BOOK = 0, + /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */ + TWFR_FANFOLD = 1 +} + +/** ICAP_IMAGEFILTER values. */ +declare enum EnumDWT_CapImageFilter { + TWIF_NONE = 0, + TWIF_AUTO = 1, + /** Good for halftone images. */ + TWIF_LOWPASS = 2, + /** Good for improving text. */ + TWIF_BANDPASS = 3, + /** Good for improving fine lines. */ + TWIF_HIGHPASS = 4, + TWIF_TEXT = 3, + TWIF_FINELINE = 4 +} + +/** CAP_LANGUAGE values. */ +declare enum EnumDWT_CapLanguage { + /** Danish */ + TWLG_DAN = 0, + /** Dutch */ + TWLG_DUT = 1, + /** International English */ + TWLG_ENG = 2, + /** French Canadian */ + TWLG_FCF = 3, + /** Finnish */ + TWLG_FIN = 4, + /** French */ + TWLG_FRN = 5, + /** German */ + TWLG_GER = 6, + /** Icelandic */ + TWLG_ICE = 7, + /** Italian */ + TWLG_ITN = 8, + /** Norwegian */ + TWLG_NOR = 9, + /** Portuguese */ + TWLG_POR = 10, + /** Spanish */ + TWLG_SPA = 11, + /** Swedish */ + TWLG_SWE = 12, + /** U.S. English */ + TWLG_USA = 13, + /** Added for 1.8 */ + TWLG_USERLOCALE = -1, + TWLG_AFRIKAANS = 14, + TWLG_ALBANIA = 15, + TWLG_ARABIC = 16, + TWLG_ARABIC_ALGERIA = 17, + TWLG_ARABIC_BAHRAIN = 18, + TWLG_ARABIC_EGYPT = 19, + TWLG_ARABIC_IRAQ = 20, + TWLG_ARABIC_JORDAN = 21, + TWLG_ARABIC_KUWAIT = 22, + TWLG_ARABIC_LEBANON = 23, + TWLG_ARABIC_LIBYA = 24, + TWLG_ARABIC_MOROCCO = 25, + TWLG_ARABIC_OMAN = 26, + TWLG_ARABIC_QATAR = 27, + TWLG_ARABIC_SAUDIARABIA = 28, + TWLG_ARABIC_SYRIA = 29, + TWLG_ARABIC_TUNISIA = 30, + /** United Arabic Emirates */ + TWLG_ARABIC_UAE = 31, + TWLG_ARABIC_YEMEN = 32, + TWLG_BASQUE = 33, + TWLG_BYELORUSSIAN = 34, + TWLG_BULGARIAN = 35, + TWLG_CATALAN = 36, + TWLG_CHINESE = 37, + TWLG_CHINESE_HONGKONG = 38, + /** People's Republic of China */ + TWLG_CHINESE_PRC = 39, + TWLG_CHINESE_SINGAPORE = 40, + TWLG_CHINESE_SIMPLIFIED = 41, + TWLG_CHINESE_TAIWAN = 42, + TWLG_CHINESE_TRADITIONAL = 43, + TWLG_CROATIA = 44, + TWLG_CZECH = 45, + TWLG_DANISH = 0, + TWLG_DUTCH = 1, + TWLG_DUTCH_BELGIAN = 46, + TWLG_ENGLISH = 2, + TWLG_ENGLISH_AUSTRALIAN = 47, + TWLG_ENGLISH_CANADIAN = 48, + TWLG_ENGLISH_IRELAND = 49, + TWLG_ENGLISH_NEWZEALAND = 50, + TWLG_ENGLISH_SOUTHAFRICA = 51, + TWLG_ENGLISH_UK = 52, + TWLG_ENGLISH_USA = 13, + TWLG_ESTONIAN = 53, + TWLG_FAEROESE = 54, + TWLG_FARSI = 55, + TWLG_FINNISH = 4, + TWLG_FRENCH = 5, + TWLG_FRENCH_BELGIAN = 56, + TWLG_FRENCH_CANADIAN = 3, + TWLG_FRENCH_LUXEMBOURG = 57, + TWLG_FRENCH_SWISS = 58, + TWLG_GERMAN = 6, + TWLG_GERMAN_AUSTRIAN = 59, + TWLG_GERMAN_LUXEMBOURG = 60, + TWLG_GERMAN_LIECHTENSTEIN = 61, + TWLG_GERMAN_SWISS = 62, + TWLG_GREEK = 63, + TWLG_HEBREW = 64, + TWLG_HUNGARIAN = 65, + TWLG_ICELANDIC = 7, + TWLG_INDONESIAN = 66, + TWLG_ITALIAN = 8, + TWLG_ITALIAN_SWISS = 67, + TWLG_JAPANESE = 68, + TWLG_KOREAN = 69, + TWLG_KOREAN_JOHAB = 70, + TWLG_LATVIAN = 71, + TWLG_LITHUANIAN = 72, + TWLG_NORWEGIAN = 9, + TWLG_NORWEGIAN_BOKMAL = 73, + TWLG_NORWEGIAN_NYNORSK = 74, + TWLG_POLISH = 75, + TWLG_PORTUGUESE = 10, + TWLG_PORTUGUESE_BRAZIL = 76, + TWLG_ROMANIAN = 77, + TWLG_RUSSIAN = 78, + TWLG_SERBIAN_LATIN = 79, + TWLG_SLOVAK = 80, + TWLG_SLOVENIAN = 81, + TWLG_SPANISH = 11, + TWLG_SPANISH_MEXICAN = 82, + TWLG_SPANISH_MODERN = 83, + TWLG_SWEDISH = 12, + TWLG_THAI = 84, + TWLG_TURKISH = 85, + TWLG_UKRANIAN = 86, + /** More stuff added for 1.8 */ + TWLG_ASSAMESE = 87, + TWLG_BENGALI = 88, + TWLG_BIHARI = 89, + TWLG_BODO = 90, + TWLG_DOGRI = 91, + TWLG_GUJARATI = 92, + TWLG_HARYANVI = 93, + TWLG_HINDI = 94, + TWLG_KANNADA = 95, + TWLG_KASHMIRI = 96, + TWLG_MALAYALAM = 97, + TWLG_MARATHI = 98, + TWLG_MARWARI = 99, + TWLG_MEGHALAYAN = 100, + TWLG_MIZO = 101, + TWLG_NAGA = 102, + TWLG_ORISSI = 103, + TWLG_PUNJABI = 104, + TWLG_PUSHTU = 105, + TWLG_SERBIAN_CYRILLIC = 106, + TWLG_SIKKIMI = 107, + TWLG_SWEDISH_FINLAND = 108, + TWLG_TAMIL = 109, + TWLG_TELUGU = 110, + TWLG_TRIPURI = 111, + TWLG_URDU = 112, + TWLG_VIETNAMESE = 113 +} + +/** ICAP_LIGHTPATH values. */ +declare enum EnumDWT_CapLightPath { + TWLP_REFLECTIVE = 0, + TWLP_TRANSMISSIVE = 1 +} + +/** ICAP_LIGHTSOURCE values. */ +declare enum EnumDWT_CapLightSource { + TWLS_RED = 0, + TWLS_GREEN = 1, + TWLS_BLUE = 2, + TWLS_NONE = 3, + TWLS_WHITE = 4, + TWLS_UV = 5, + TWLS_IR = 6 +} + +/** ICAP_NOISEFILTER values. */ +declare enum EnumDWT_CapNoiseFilter { + TWNF_NONE = 0, + TWNF_AUTO = 1, + TWNF_LONEPIXEL = 2, + TWNF_MAJORITYRULE = 3 +} + +/** ICAP_ORIENTATION values. */ +declare enum EnumDWT_CapORientation { + TWOR_ROT0 = 0, + TWOR_ROT90 = 1, + TWOR_ROT180 = 2, + TWOR_ROT270 = 3, + TWOR_PORTRAIT = 0, + TWOR_LANDSCAPE = 3, + /** 2.0 */ + TWOR_AUTO = 4, + /** 2.0 */ + TWOR_AUTOTEXT = 5, + /** 2.0 */ + TWOR_AUTOPICTURE = 6 +} + +/** ICAP_OVERSCAN values. */ +declare enum EnumDWT_CapOverscan { + TWOV_NONE = 0, + TWOV_AUTO = 1, + TWOV_TOPBOTTOM = 2, + TWOV_LEFTRIGHT = 3, + TWOV_ALL = 4 +} + +/** ICAP_PIXELFLAVOR values. */ +declare enum EnumDWT_CapPixelFlavor { + /** Zero pixel represents darkest shade. zero pixel represents darkest shade */ + TWPF_CHOCOLATE = 0, + /** Zero pixel represents lightest shade. zero pixel represents lightest shade */ + TWPF_VANILLA = 1 +} + +/** ICAP_PLANARCHUNKY values. */ +declare enum EnumDWT_CapPlanarChunky { + TWPC_CHUNKY = 0, + TWPC_PLANAR = 1 +} + +/** CAP_PRINTER values. */ +declare enum EnumDWT_CapPrinter { + TWPR_IMPRINTERTOPBEFORE = 0, + TWPR_IMPRINTERTOPAFTER = 1, + TWPR_IMPRINTERBOTTOMBEFORE = 2, + TWPR_IMPRINTERBOTTOMAFTER = 3, + TWPR_ENDORSERTOPBEFORE = 4, + TWPR_ENDORSERTOPAFTER = 5, + TWPR_ENDORSERBOTTOMBEFORE = 6, + TWPR_ENDORSERBOTTOMAFTER = 7 +} + +/** CAP_PRINTERMODE values. */ +declare enum EnumDWT_CapPrinterMode { + /** Specifies that the printed text will consist of a single string. */ + TWPM_SINGLESTRING = 0, + /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */ + TWPM_MULTISTRING = 1, + /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */ + TWPM_COMPOUNDSTRING = 2 +} + +/** TWAIN Supported sizes. */ +declare enum EnumDWT_CapSupportedSizes { + /** 0 */ + TWSS_NONE = 0, + /** 1 */ + TWSS_A4LETTER = 1, + /** 2 */ + TWSS_B5LETTER = 2, + /** 3 */ + TWSS_USLETTER = 3, + /** 4 */ + TWSS_USLEGAL = 4, + /** Added 1.5 + * 5 + */ + TWSS_A5 = 5, + /** 6 */ + TWSS_B4 = 6, + /** 7 */ + TWSS_B6 = 7, + /** Added 1.7 + * 9 + */ + TWSS_USLEDGER = 9, + /** 10 */ + TWSS_USEXECUTIVE = 10, + /** 11 */ + TWSS_A3 = 11, + /** 12 */ + TWSS_B3 = 12, + /** 13 */ + TWSS_A6 = 13, + /** 14 */ + TWSS_C4 = 14, + /** 15 */ + TWSS_C5 = 15, + /** 16 */ + TWSS_C6 = 16, + /** Added 1.8 + * 17 + */ + TWSS_4A0 = 17, + /** 18 */ + TWSS_2A0 = 18, + /** 19 */ + TWSS_A0 = 19, + /** 20 */ + TWSS_A1 = 20, + /** 21 */ + TWSS_A2 = 21, + /** 1 */ + TWSS_A4 = 1, + /** 22 */ + TWSS_A7 = 22, + /** 23 */ + TWSS_A8 = 23, + /** 24 */ + TWSS_A9 = 24, + /** 25 */ + TWSS_A10 = 25, + /** 26 */ + TWSS_ISOB0 = 26, + /** 27 */ + TWSS_ISOB1 = 27, + /** 28 */ + TWSS_ISOB2 = 28, + /** 12 */ + TWSS_ISOB3 = 12, + /** 6 */ + TWSS_ISOB4 = 6, + /** 29 */ + TWSS_ISOB5 = 29, + /** 7 */ + TWSS_ISOB6 = 7, + /** 30 */ + TWSS_ISOB7 = 30, + /** 31 */ + TWSS_ISOB8 = 31, + /** 32 */ + TWSS_ISOB9 = 32, + /** 33 */ + TWSS_ISOB10 = 33, + /** 34 */ + TWSS_JISB0 = 34, + /** 35 */ + TWSS_JISB1 = 35, + /** 36 */ + TWSS_JISB2 = 36, + /** 37 */ + TWSS_JISB3 = 37, + /** 38 */ + TWSS_JISB4 = 38, + /** 2 */ + TWSS_JISB5 = 2, + /** 39 */ + TWSS_JISB6 = 39, + /** 40 */ + TWSS_JISB7 = 40, + /** 41 */ + TWSS_JISB8 = 41, + /** 41 */ + TWSS_JISB9 = 42, + /** 43 */ + TWSS_JISB10 = 43, + /** 44 */ + TWSS_C0 = 44, + /** 45 */ + TWSS_C1 = 45, + /** 46 */ + TWSS_C2 = 46, + /** 47 */ + TWSS_C3 = 47, + /** 48 */ + TWSS_C7 = 48, + /** 49 */ + TWSS_C8 = 49, + /** 50 */ + TWSS_C9 = 50, + /** 51 */ + TWSS_C10 = 51, + /** 52 */ + TWSS_USSTATEMENT = 52, + /** 53 */ + TWSS_BUSINESSCARD = 53, + /** 54. Added 2.1 */ + TWSS_MAXSIZE = 54 +} + +/** Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected. + * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities = + * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION. + */ +declare enum EnumDWT_CapType { + /** Nothing. */ + TWON_NONE = 0, + /** A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and + * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS + * capability, would use this type of container. + */ + TWON_ARRAY = 3, + /** This is the most general type because it defines a list of values from which the Current Value can be chosen. + * The values do not progress uniformly through a range and there is not a consistent step size between the values. + * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600). + */ + TWON_ENUMERATION = 4, + /** A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value. + * For example, a capability that indicates the presence of a document feeder could be of this type. + */ + TWON_ONEVALUE = 5, + /** Many capabilities allow users to select their current value from a range of regularly spaced values. + * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values. + * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600). + */ + TWON_RANGE = 6 +} + +/** The kind of data stored in the container. */ +declare enum EnumDWT_CapValueType { + TWTY_INT8 = 0, + /** Means Item is a TW_INT16 */ + TWTY_INT16 = 1, + /** Means Item is a TW_INT32 */ + TWTY_INT32 = 2, + /** Means Item is a TW_UINT8 */ + TWTY_UINT8 = 3, + /** Means Item is a TW_UINT16 */ + TWTY_UINT16 = 4, + /** Means Item is a TW_int */ + TWTY_int = 5, + /** Means Item is a TW_BOOL */ + TWTY_BOOL = 6, + /** Means Item is a TW_FIX32 */ + TWTY_FIX32 = 7, + /** Means Item is a TW_FRAME */ + TWTY_FRAME = 8, + /** Means Item is a TW_STR32 */ + TWTY_STR32 = 9, + /** Means Item is a TW_STR64 */ + TWTY_STR64 = 10, + /** Means Item is a TW_STR128 */ + TWTY_STR128 = 11, + /** Means Item is a TW_STR255 */ + TWTY_STR255 = 12 +} + +/** ICAP_DUPLEX values. */ +declare enum EnumDWT_DUPLEX { + TWDX_NONE = 0, + TWDX_1PASSDUPLEX = 1, + TWDX_2PASSDUPLEX = 2 +} + +/** Data source status. */ +declare enum EnumDWT_DataSourceStatus { + /** Indicate the data source is closed. */ + TWDSS_CLOSED = 0, + /** Indicate the data source is opened. */ + TWDSS_OPENED = 1, + /** Indicate the data source is enabled. */ + TWDSS_ENABLED = 2, + /** Indicate the data source is acquiring image. */ + TWDSS_ACQUIRING = 3 +} + +declare enum EnumDWT_Error { + ModuleNotExists = -2371 +} + +/** ICAP_IMAGEFILEFORMAT values. */ +declare enum EnumDWT_FileFormat { + /** Used for document imaging. Tagged Image File Format */ + TWFF_TIFF = 0, + /** Native Macintosh format. Macintosh PICT */ + TWFF_PICT = 1, + /** Native Microsoft format. Windows Bitmap */ + TWFF_BMP = 2, + /** Used for document imaging. X-Windows Bitmap */ + TWFF_XBM = 3, + /** Wrapper for JPEG images. JPEG File Interchange Format */ + TWFF_JFIF = 4, + /** FlashPix, used with digital cameras. Flash Pix */ + TWFF_FPX = 5, + /** Multi-page TIFF files. Multi-page tiff file */ + TWFF_TIFFMULTI = 6, + /** An image format standard intended for use on the web, replaces GIF. */ + TWFF_PNG = 7, + /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */ + TWFF_SPIFF = 8, + /** File format for use with digital cameras. */ + TWFF_EXIF = 9, + /** A file format from Adobe. 1.91 NB: this is not PDF/A */ + TWFF_PDF = 10, + /** A file format from the Joint Photographic Experts Group. 1.91 */ + TWFF_JP2 = 11, + /** 1.91 */ + TWFF_JPN = 12, + /** 1.91 */ + TWFF_JPX = 13, + /** A file format from LizardTech. 1.91 */ + TWFF_DEJAVU = 14, + /** A file format from Adobe. 2.0 */ + TWFF_PDFA = 15, + /** 2.1 Adobe PDF/A, Version 2 */ + TWFF_PDFA2 = 16 +} + +/** Fit window type */ +declare enum EnumDWT_FitWindowType { + /** Fit the image to the width and height of the window */ + enumFitWindow = 0, + /** Fit the image to the height of the window */ + enumFitWindowHeight = 1, + /** Fit the image to the width of the window */ + enumFitWindowWidth = 2 +} + +/** Image type */ +declare enum EnumDWT_ImageType { + /** Native Microsoft format. */ + IT_BMP = 0, + /** JPEG format. */ + IT_JPG = 1, + /** Tagged Image File Format. */ + IT_TIF = 2, + /** An image format standard intended for use on the web, replaces GIF. */ + IT_PNG = 3, + /** A file format from Adobe. */ + IT_PDF = 4, + /** All supported formats which are bmp, jpg, tif, png and pdf */ + IT_ALL = 5 +} + +declare enum EnumDWT_InitMsg { + Info = 1, + Error = 2, + NotInstalledError = 3, + DownloadError = 4, + DownloadNotRestartError = 5 +} + +/** The method to do interpolation. */ +declare enum EnumDWT_InterpolationMethod { + IM_NEARESTNEIGHBOUR = 1, + IM_BILINEAR = 2, + IM_BICUBIC = 3, + IM_BESTQUALITY = 5 +} + +declare enum EnumDWT_Language { + English = 0, + French = 1, + Arabic = 2, + Spanish = 3, + Portuguese = 4, + German = 5, + Italian = 6, + Russian = 7, + Chinese = 8 +} + +/** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */ +declare enum EnumDWT_MagType { + /** Added 2.0 */ + TWMD_MICR = 0, + /** added 2.1 */ + TWMD_RAW = 1, + /** added 2.1 */ + TWMD_INVALID = 2 +} + +/** For query the operation that are supported by the data source on a capability . + * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT + */ +declare enum EnumDWT_MessageType { + TWQC_GET = 1, + TWQC_SET = 2, + TWQC_GETDEFAULT = 4, + TWQC_GETCURRENT = 8, + TWQC_RESET = 16 +} + +declare enum EnumDWT_MouseShape { + Default = 0, + Hand = 1, + Crosshair = 2, + Zoom = 3 +} + +/** PDF file compression type. */ +declare enum EnumDWT_PDFCompressionType { + /** Auto mode. */ + PDF_AUTO = 0, + /** CCITT Group 3 fax encoding. */ + PDF_FAX3 = 1, + /** CCITT Group 4 fax encoding */ + PDF_FAX4 = 2, + /** Lempel Ziv and Welch */ + PDF_LZW = 3, + /** CCITT modified Huffman RLE. */ + PDF_RLE = 4, + /** JPEG compression. */ + PDF_JPEG = 5 +} + +/** ICAP_PIXELTYPE values (PT_ means Pixel Type) */ +declare enum EnumDWT_PixelType { + TWPT_BW = 0, + TWPT_GRAY = 1, + TWPT_RGB = 2, + TWPT_PALLETE = 3, + TWPT_CMY = 4, + TWPT_CMYK = 5, + TWPT_YUV = 6, + TWPT_YUVK = 7, + TWPT_CIEXYZ = 8, + TWPT_LAB = 9, + TWPT_SRGB = 10, + TWPT_SCRGB = 11, + TWPT_INFRARED = 16 +} + +declare enum EnumDWT_PlatformType { + /// Fit the image to the width and height of the window + enumWindow = 0, + /// Fit the image to the height of the window + enumMac = 1, + /// Fit the image to the width of the window + enumLinux = 2 +} + +declare enum EnumDWT_ShowMode { + /** Activates the window and displays it in its current size and position. */ + SW_ACTIVE = 0, + /** Maximizes the window */ + SW_MAX = 1, + /** Minimize the window */ + SW_MIN = 2, + /** Close the latest opened editor window */ + SW_CLOSE = 3, + /** Check whether a window exists */ + SW_IFLIVE = 4 +} + +/** TIFF file compression type. */ +declare enum EnumDWT_TIFFCompressionType { + /** Auto mode. */ + TIFF_AUTO = 0, + /** Dump mode. */ + TIFF_NONE = 1, + /** CCITT modified Huffman RLE. */ + TIFF_RLE = 2, + /** CCITT Group 3 fax encoding. */ + TIFF_FAX3 = 3, + /** CCITT T.4 (TIFF 6 name). */ + TIFF_T4 = 3, + /** CCITT Group 4 fax encoding */ + TIFF_FAX4 = 4, + /** CCITT T.6 (TIFF 6 name). */ + TIFF_T6 = 4, + /** Lempel Ziv and Welch */ + TIFF_LZW = 5, + TIFF_JPEG = 7, + TIFF_PACKBITS = 32773 +} + +/** ICAP_XFERMECH values. */ +declare enum EnumDWT_TransferMode { + /** Native transfers require the data to be transferred to a single large block of RAM. Therefore, + * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully. + */ + TWSX_NATIVE = 0, + /** Disk File Mode Transfers. */ + TWSX_FILE = 1, + /** Buffered Memory Mode Transfers. */ + TWSX_MEMORY = 2/*,*/ + /** added 1.91 , not supported in DWT yet*/ + /** TWSX_MEMFILE = 4*/ +} + +/** ICAP_UNITS values. */ +declare enum EnumDWT_UnitType { + TWUN_INCHES = 0, + TWUN_CENTIMETERS = 1, + TWUN_PICAS = 2, + TWUN_POINTS = 3, + TWUN_TWIPS = 4, + TWUN_PIXELS = 5, + TWUN_MILLIMETERS = 6 +} + +declare enum EnumDWT_UploadDataFormat { + Binary = 0, + Base64 = 1 +} + +/** + * interface for a base64 result + */ +interface Base64Result { + getLength(): number; + getData(offset: number, length: number): string; + getMD5(): string; +} + +/** + * Copied from lib.d.ts (Typescript) + */ +interface Blob { + readonly size: number; + readonly type: string; + msClose(): void; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; +} + +/** + * Details for each license + */ +interface LicenseDetailItem { + readonly Browser: string; + readonly EnumLicenseType: string; + readonly ExpireDate: string; + readonly LicenseType: string; + readonly OS: string; + readonly Trial: string; + readonly Version: string; +} diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index 12e4ac0521..78b0846eb7 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -1,3788 +1,17 @@ -// Type definitions for dwt 14.2 +// Type definitions for dwt 14.4 // Project: http://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx // Definitions by: Xiao Ling // Josh Hall // Lincoln Hu // Tom Kent // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -/*! -* Based on Dynamsoft WebTwain JavaScript Intellisense -* Product: Dynamsoft Web Twain -* Web Site: http://www.dynamsoft.com -* -* Copyright 2018, Dynamsoft Corporation -* Author: Dynamsoft Support Team -* Version: 14.2 -*/ - -/** - * @namespace Dynamsoft - */ -declare namespace Dynamsoft { - namespace Lib { - /*ignored - Addon_Events Addon_Sendback_Events AttachAndShowImage BIO DOM DynamicLoadAddonFuns DynamicWebTwain EnumMouseButton - Errors Events IntToColorStr LS OnGetImageByURL OnGetImageFromServer Path ProgressBar UI Uri - addEventListener ajax all appendMessage appendRichMessage aryControlLoadImage attachAddon attachProperty - base64 bio cancelFrome clearMessage closeAll closeProgress colorStrToInt config css currentStyle - debug*/ - - let detect: { - /*ignored - OnCreatWS OnDetectNext OnWebTwainPostExecute OnWebTwainPreExecute StartWSByIPTimeoutId StartWSTimeoutId - aryReconnectSTwains arySTwains arySTwainsByIP bFirst bNeedUpgradeEvent bNoControlEvent bOK bPromptJSOrServerOutdated - cUrlIndex dcpCallbackType dcpStatus detectType getVersionArray global_dlg hideMask isDWTVersionLatest onNoControl - onNotAllowedForChrome ports scriptLoaded showMask starting tryTimes*/ - ssl: boolean; - }; - - /*ignored - detectButton dialog dialogShowStatus dlgProgress dlgRef drawBoxBorder drawImageWithHermite - each empty endsWith - */ - - let env: { - WSSession: number, WSVersion: string, - bChrome: boolean, bEdge: boolean, bFileSystem: boolean, bFirefox: boolean, - bIE: boolean, bLinux: boolean, bMac: boolean, bSafari: boolean, bWin: boolean, bWin64: boolean, - basePath: string, iPluginLength: number, isX64: boolean, pathType: number, - strChromeVersion: string, strFirefoxVersion: string, strIEVersion: string - }; - - /*ignored - error escapeHtml escapeRegExp extend filter fireEvent fromUnicode get getColor getCss - getElDimensions getHex getHexColor getHttpUrl getLogger getOffset getRandom getRealPath getScript - getWS getWSUrl getWheelDelta globalEval guid hide html5 imageControlCount indexOf install - io isArray isBoolean isDef isFunction isLocalIP isNaN isNull isNumber isObject - isPlainObject isString isUndef isUndefined isWindow keys log main makeArray mix - needShowTwiceShowDialog nil noop now obj one page param parse parseHTML parser - product progressMessage ready removeEventListener replaceAll replaceControl show showProgress startWS - startWSByIP startsWith stopPropagation stringify style support switchEvent tmp toggle trim - type unEscapeHtml unparam upperCaseFirst urlDecode urlEncode utf8 win - ...other internal ones - */ - } - namespace WebTwainEnv { - let ActiveXInstallWithCAB: boolean; - let ActiveXVersion: string; - let AutoLoad: boolean; - function CloseDialog(): void; - let ContainerMap: {}; - let Containers: Container[]; - function CreateDWTObject(newObjID: string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void; - function CreateDWTObject(newObjID: string, ip: number | string, port: number | string, portSSL: number | string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void; - let Debug: boolean; - function DeleteDWTObject(objID: string): void; - let DynamicContainers: string[]; - let DynamicDWTMap: {}; - function GetWebTwain(cid: string): WebTwain; - let IfUpdateService: boolean; - let IfUseActiveXForIE10Plus: boolean; - let JSVersion: string; - function Load(): void; - - /*ignored - OnWebTwainInitMessage OnWebTwainNeedUpgrade OnWebTwainNeedUpgradeWebJavascript OnWebTwainNotFound OnWebTwainOldPluginNotAllowed - */ - - function OnWebTwainPostExecute(): void; - function OnWebTwainPreExecute(): void; - - /*ignored - OnWebTwainReady - */ - - let PluginVersion: string; - let ProductKey: string; - function RegisterEvent(event: string, fn: (...args: any[]) => void): void; - function RemoveAllAuthorizations(): void; - let ResourcesPath: string; - let ServerVersionInfo: string; - function ShowDialog(_dialogWidth: number, _dialogHeight: number, _strDialogMessageWithHtmlFormat: string, _bChangeImage: boolean, bHideCloseButton: boolean): void; - let Trial: boolean; - function Unload(): void; - let UseDefaultInstallUI: boolean; - let initQueue: any[]; - let inited: boolean; - } -} - -/** Border Styles */ -declare enum EnumDWT_BorderStyle { - /** No border. */ - TWBS_NONE = 0, - /** Flat border. */ - TWBS_SINGLEFLAT = 1, - /** 3D border. */ - TWBS_SINGLE3D = 2 -} - -/** Capabilities */ -declare enum EnumDWT_Cap { - /** Nothing. */ - CAP_NONE = 0, - /** The application is willing to accept this number of images. */ - CAP_XFERCOUNT = 1, - /** Allows the application and Source to identify which compression schemes they have in - * common for Buffered Memory and File transfers. - * Note for File transfers: - * Since only certain file formats support compression, this capability must be negotiated after - * setting the desired file format with ICAP_IMAGEFILEFORMAT. - */ - ICAP_COMPRESSION = 256, - /** The type of pixel data that a Source is capable of acquiring (for example, black and white, gray, RGB, etc.). */ - ICAP_PIXELTYPE = 257, - /** Unless a quantity is dimensionless or uses a specified unit of measure, ICAP_UNITS determines - * the unit of measure for all quantities. - */ - ICAP_UNITS = 258, - /** Allows the application and Source to identify which transfer mechanisms the source supports. */ - ICAP_XFERMECH = 259, - /** The name or other identifying information about the Author of the image. It may include a copyright string. */ - CAP_AUTHOR = 4096, - /** A general note about the acquired image. */ - CAP_CAPTION = 4097, - /** If TRUE, Source must acquire data from the document feeder acquire area and other feeder - * capabilities can be used. If FALSE, Source must acquire data from the non-feeder acquire area - * and no other feeder capabilities can be used. - */ - CAP_FEEDERENABLED = 4098, - /** Reflect whether there are documents loaded in the Source's feeder. */ - CAP_FEEDERLOADED = 4099, - /** The date and time the image was acquired. - * Stored in the form "YYYY/MM/DD HH:mm:SS.sss" where YYYY is the year, MM is the - * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, - * and sss is the millisecond. - */ - CAP_TIMEDATE = 4100, - /** Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate - * which capabilities the Source will allow to be set by the application. Some capabilities can only - * be set if certain setup work has been done so the Source cannot globally answer which - * capabilities are "set-able." - */ - CAP_SUPPORTEDCAPS = 4101, - /** Allows the application and Source to negotiate capabilities to be used in States 5 and 6. */ - CAP_EXTENDEDCAPS = 4102, - /** If TRUE, the Source will automatically feed the next page from the document feeder after the - * number of frames negotiated for capture from each page are acquired. CAP_FEEDERENABLED - * must be TRUE to use this capability. - */ - CAP_AUTOFEED = 4103, - /** If TRUE, the Source will eject the current page being acquired from and will leave the feeder - * acquire area empty. - * If CAP_AUTOFEED is TRUE, a fresh page will be advanced. - * CAP_FEEDERENABLED must equal TRUE to use this capability. - * This capability must have been negotiated as an extended capability to be used in States 5 and 6. - */ - CAP_CLEARPAGE = 4104, - /** If TRUE, the Source will eject the current page and advance the next page in the document feeder - * into the feeder acquire area. - * If CAP_AUTOFEED is TRUE, the same action just described will occur and CAP_AUTOFEED will - * remain active. - * CAP_FEEDERENABLED must equal TRUE to use this capability. - * This capability must have been negotiated as an extended capability to be used in States 5 and 6. - */ - CAP_FEEDPAGE = 4105, - /** If TRUE, the Source will return the current page to the input side of the document feeder and - * feed the last page from the output side of the feeder back into the acquisition area. - * If CAP_AUTOFEED is TRUE, automatic feeding will continue after all negotiated frames from this - * page are acquired. - * CAP_FEEDERENABLED must equal TRUE to use this capability. - * This capability must have been negotiated as an extended capability to be used in States 5 and 6. - */ - CAP_REWINDPAGE = 4106, - /** If TRUE, the Source will display a progress indicator during acquisition and transfer, regardless - * of whether the Source's user interface is active. If FALSE, the progress indicator will be - * suppressed if the Source's user interface is inactive. - * The Source will continue to display device-specific instructions and error messages even with - * the Source user interface and progress indicators turned off. - */ - CAP_INDICATORS = 4107, - /** Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate - * which capabilities the Source will allow to be set by the application. Some capabilities can only - * be set if certain setup work has been done so the Source cannot globally answer which - * capabilities are "set-able." - */ - CAP_SUPPORTEDCAPSEXT = 4108, - /** This capability determines whether the device has a paper sensor that can detect documents on the ADF or Flatbed. */ - CAP_PAPERDETECTABLE = 4109, - /** If TRUE, indicates that this Source supports acquisition with the UI disabled; i.e., - * TW_USERINTERFACE's ShowUI field can be set to FALSE. If FALSE, indicates that this Source - * can only support acquisition with the UI enabled. - */ - CAP_UICONTROLLABLE = 4110, - /** If TRUE, the physical hardware (e.g., scanner, digital camera, image database, etc.) that - * represents the image source is attached, powered on, and communicating. - */ - CAP_DEVICEONLINE = 4111, - /** This capability is intended to boost the performance of a Source. The fundamental assumption - * behind AutoScan is that the device is able to capture the number of images indicated by the - * value of CAP_XFERCOUNT without waiting for the Application to request the image transfers. - * This is only possible if the device has internal buffers capable of caching the images it captures. - * The default behavior is undefined, because some high volume devices are incapable of anything - * but CAP_AUTOSCAN being equal to TRUE. However, if a Source supports FALSE, it should use it - * as the mandatory default, since this best describes the behavior of pre-1.8 TWAIN Applications. - */ - CAP_AUTOSCAN = 4112, - /** Allows an application to request the delivery of thumbnail representations for the set of images - * that are to be delivered. - * Setting CAP_THUMBNAILSENABLED to TRUE turns on thumbnail mode. Images transferred - * thereafter will be sent at thumbnail size (exact thumbnail size is determined by the Data Source). - * Setting this capability to FALSE turns thumbnail mode off and returns full size images. - */ - CAP_THUMBNAILSENABLED = 4113, - /** This indicates whether the scanner supports duplex. If so, it further indicates whether one-path - * or two-path duplex is supported. - */ - CAP_DUPLEX = 4114, - /** The user can set the duplex option to be TRUE or FALSE. If TRUE, the scanner scans both sides - * of a paper; otherwise, the scanner will scan only one side of the image. - */ - CAP_DUPLEXENABLED = 4115, - /** Allows an application to query a source to see if it implements the new user interface settings dialog. */ - CAP_ENABLEDSUIONLY = 4116, - CAP_CUSTOMDSDATA = 4117, - /** Allows the application to specify the starting endorser / imprinter number. All other endorser/ - * imprinter properties should be handled through the data source's user interface. - * The user can set the starting number for the endorser. - */ - CAP_ENDORSER = 4118, - /** Turns specific audible alarms on and off. */ - CAP_ALARMS = 4120, - /** The volume of a device's audible alarm. Note that this control affects the volume of all alarms; - * no specific volume control for individual types of alarms is provided. - */ - CAP_ALARMVOLUME = 4121, - /** The number of images to automatically capture. This does not refer to the number of images to - * be sent to the Application, use CAP_XFERCOUNT for that. - */ - CAP_AUTOMATICCAPTURE = 4122, - /** For automatic capture, this value selects the number of milliseconds before the first picture is to - * be taken, or the first image is to be scanned. - */ - CAP_TIMEBEFOREFIRSTCAPTURE = 4123, - /** For automatic capture, this value selects the milliseconds to wait between pictures taken, or images scanned. */ - CAP_TIMEBETWEENCAPTURES = 4124, - /** CapGet() reports the presence of data in the scanner's buffers. CapSet() with a value of TWCB_CLEAR immediately clears the buffers. */ - CAP_CLEARBUFFERS = 4125, - /** Describes the number of pages that the scanner can buffer when CAP_AUTOSCAN is enabled. */ - CAP_MAXBATCHBUFFERS = 4126, - /** The date and time of the device's clock. - * Managed in the form "YYYY/MM/DD HH:mm:SS:sss" where YYYY is the year, MM is the - * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, - * and sss is the millisecond. - */ - CAP_DEVICETIMEDATE = 4127, - /** CapGet() reports the kinds of power available to the device. CapGetCurrent() reports the current power supply in use. */ - CAP_POWERSUPPLY = 4128, - /** This capability queries the Source for UI support for preview mode. If TRUE, the Source supports preview UI. */ - CAP_CAMERAPREVIEWUI = 4129, - /** A string containing the serial number of the currently selected device in the Source. Multiple - * devices may all report the same serial number. - */ - CAP_SERIALNUMBER = 4132, - /** CapGet() returns the current list of available printer devices, along with the one currently being used for negotiation. - * CapSet() selects the current device for negotiation, and optionally constrains the list. - * Top/Bottom refers to duplex devices, and indicates if the printer is writing on the top or the bottom of the sheet of paper. - * Simplex devices use the top settings. Before/After indicates whether printing occurs before or after the sheet of paper has been scanned. - */ - CAP_PRINTER = 4134, - /** Turns the current CAP_PRINTER device on or off. */ - CAP_PRINTERENABLED = 4135, - /** The User can set the starting number for the current CAP_PRINTER device. */ - CAP_PRINTERINDEX = 4136, - /** Specifies the appropriate current CAP_PRINTER device mode. - * Note: - * โ€ข TWPM_SINGLESTRING specifies that the printed text will consist of a single string. - * โ€ข TWPM _MULTISTRING specifies that the printed text will consist of an enumerated list of - * strings to be printed in order. - * โ€ข TWPM _COMPOUNDSTRING specifies that the printed string will consist of a compound of a - * String followed by a value followed by a suffix string. - */ - CAP_PRINTERMODE = 4137, - /** Specifies the string(s) that are to be used in the string component when the current - * CAP_PRINTER device is enabled. - */ - CAP_PRINTERSTRING = 4138, - /** Specifies the string that shall be used as the current CAP_PRINTER device's suffix. */ - CAP_PRINTERSUFFIX = 4139, - /** Allows Application and Source to identify which languages they have in common for the exchange of string data, - * and to select the language of the internal UI. Since the TWLG_xxxx codes include language and country data, there is no separate - * capability for selecting the country. - */ - CAP_LANGUAGE = 4140, - /** Helps the Application determine any special actions it may need to take when negotiating - * frames with the Source. Allowed values are listed in . - * TWFA_NONE: The alignment is free-floating. Applications should assume - * that the origin for frames is on the left. - * TWFA_LEFT: The alignment is to the left. - * TWFA_CENTER: The alignment is centered. This means that the paper will - * be fed in the middle of the ICAP_PHYSICALWIDTH of the - * device. If this is set, then the Application should calculate - * any frames with a left offset of zero. - * TWFA_RIGHT: The alignment is to the right. - */ - CAP_FEEDERALIGNMENT = 4141, - /** TWFO_FIRSTPAGEFIRST if the feeder starts with the top of the first page. - * TWFO_LASTPAGEFIRST is the feeder starts with the top of the last page. - */ - CAP_FEEDERORDER = 4142, - /** Indicates whether the physical hardware (e.g. scanner, digital camera) is capable of acquiring - * multiple images of the same page without changes to the physical registration of that page. - */ - CAP_REACQUIREALLOWED = 4144, - /** The minutes of battery power remaining to the device. */ - CAP_BATTERYMINUTES = 4146, - /** When used with CapGet(), return the percentage of battery power level on camera. If -1 is returned, it indicates that the battery is not present. */ - CAP_BATTERYPERCENTAGE = 4147, - /** Added 1.91 */ - CAP_CAMERASIDE = 4148, - /** Added 1.91 */ - CAP_SEGMENTED = 4149, - /** Added 2.0 */ - CAP_CAMERAENABLED = 4150, - /** Added 2.0 */ - CAP_CAMERAORDER = 4151, - /** Added 2.0 */ - CAP_MICRENABLED = 4152, - /** Added 2.0 */ - CAP_FEEDERPREP = 4153, - /** Added 2.0 */ - CAP_FEEDERPOCKET = 4154, - /** Added 2.1 */ - CAP_AUTOMATICSENSEMEDIUM = 4155, - /** Added 2.1 */ - CAP_CUSTOMINTERFACEGUID = 4156, - /** TRUE enables and FALSE disables the Source's Auto-brightness function (if any). */ - ICAP_AUTOBRIGHT = 4352, - /** The brightness values available within the Source. */ - ICAP_BRIGHTNESS = 4353, - /** The contrast values available within the Source. */ - ICAP_CONTRAST = 4355, - /** Specifies the square-cell halftone (dithering) matrix the Source should use to halftone the image. */ - ICAP_CUSTHALFTONE = 4356, - /** Specifies the exposure time used to capture the image, in seconds. */ - ICAP_EXPOSURETIME = 4357, - /** Describes the color characteristic of the subtractive filter applied to the image data. Multiple - * filters may be applied to a single acquisition. - */ - ICAP_FILTER = 4358, - /** Specifies whether or not the image was acquired using a flash. */ - ICAP_FLASHUSED = 4359, - /** Gamma correction value for the image data. */ - ICAP_GAMMA = 4360, - /** A list of names of the halftone patterns available within the Source. */ - ICAP_HALFTONES = 4361, - /** Specifies which value in an image should be interpreted as the lightest "highlight." All values - * "lighter" than this value will be clipped to this value. Whether lighter values are smaller or - * larger can be determined by examining the Current value of ICAP_PIXELFLAVOR. - */ - ICAP_HIGHLIGHT = 4362, - /** Informs the application which file formats the Source can generate (CapGet()). Tells the Source which file formats the application can handle (CapSet()). - * TWFF_TIFF Used for document - * TWFF_PICT Native Macintosh - * TWFF_BMP Native Microsoft - * TWFF_XBM Used for document - * TWFF_JFIF Wrapper for JPEG - * TWFF_FPX FlashPix, used with digital - * TWFF_TIFFMULTI Multi-page TIFF files - * TWFF_PNG An image format standard intended for use on the web, replaces GIF - * TWFF_SPIFF A standard from JPEG, intended to replace JFIF, also supports JBIG - * TWFF_EXIF File format for use with digital cameras. - */ - ICAP_IMAGEFILEFORMAT = 4364, - /** TRUE means the lamp is currently, or should be set to ON. Sources may not support CapSet() operations. */ - ICAP_LAMPSTATE = 4365, - /** Describes the general color characteristic of the light source used to acquire the image. */ - ICAP_LIGHTSOURCE = 4366, - /** Defines which edge of the "paper" the image's "top" is aligned with. This information is used to adjust the frames to match the - * scanning orientation of the paper. For instance, if an ICAP_SUPPORTEDSIZE of TWSS_ISOA4 has been negotiated, - * and ICAP_ORIENTATION is set to TWOR_LANDSCAPE, then the Source must rotate the frame it downloads to the scanner to reflect the - * orientation of the paper. Please note that setting ICAP_ORIENTATION does not affect the values reported by ICAP_FRAMES; - * it just causes the Source to use them in a different way. The upper-left of the image is defined as the location where both the primary and - * secondary scans originate. (The X axis is the primary scan direction and the Y axis is the secondary scan direction.) - * For a flatbed scanner, the light bar moves in the secondary scan direction. For a handheld scanner, the scanner is drug in the - * secondary scan direction. For a digital camera, the secondary direction is the vertical axis when the viewed image is considered upright. - */ - ICAP_ORIENTATION = 4368, - /** The maximum physical width (X-axis) the Source can acquire (measured in units of ICAP_UNITS). */ - ICAP_PHYSICALWIDTH = 4369, - /** The maximum physical height (Y-axis) the Source can acquire (measured in units of ICAP_UNITS). */ - ICAP_PHYSICALHEIGHT = 4370, - /** Specifies which value in an image should be interpreted as the darkest "shadow." All values - * "darker" than this value will be clipped to this value. - */ - ICAP_SHADOW = 4371, - /** The list of frames the Source will acquire on each page. */ - ICAP_FRAMES = 4372, - /** The native optical resolution along the X-axis of the device being controlled by the Source. Most - * devices will respond with a single value (TW_ONEVALUE). - * This is NOT a list of all resolutions that can be generated by the device. Rather, this is the - * resolution of the device's optics. Measured in units of pixels per unit as defined by - * ICAP_UNITS (pixels per TWUN_PIXELS yields dimensionless data). - */ - ICAP_XNATIVERESOLUTION = 4374, - /** The native optical resolution along the Y-axis of the device being controlled by the Source. - * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS - * yields dimensionless data). - */ - ICAP_YNATIVERESOLUTION = 4375, - /** All the X-axis resolutions the Source can provide. - * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS - * yields dimensionless data). That is, when the units are TWUN_PIXELS, both - * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources - * like to report the actual number of pixels that the device reports, but that response is more - * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. - */ - ICAP_XRESOLUTION = 4376, - /** All the Y-axis resolutions the Source can provide. - * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS - * yields dimensionless data). That is, when the units are TWUN_PIXELS, both - * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources - * like to report the actual number of pixels that the device reports, but that response is more - * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. - */ - ICAP_YRESOLUTION = 4377, - /** The maximum number of frames the Source can provide or the application can accept per page. - * This is a bounding capability only. It does not establish current or future behavior. - */ - ICAP_MAXFRAMES = 4378, - /** This is used with buffered memory transfers. If TRUE, Source can provide application with tiled image data. */ - ICAP_TILES = 4379, - /** Specifies how the bytes in an image are filled by the Source. TWBO_MSBFIRST indicates that the leftmost bit in the byte (usually bit 7) is - * the byte's Most Significant Bit. - */ - ICAP_BITORDER = 4380, - /** Used for CCITT Group 3 2-dimensional compression. The 'K' factor indicates how often the - * new compression baseline should be re-established. A value of 2 or 4 is common in facsimile - * communication. A value of zero in this field will indicate an infinite K factorโ€”the baseline is - * only calculated at the beginning of the transfer. - */ - ICAP_CCITTKFACTOR = 4381, - /** Describes whether the image was captured transmissively or reflectively. */ - ICAP_LIGHTPATH = 4382, - /** Sense of the pixel whose numeric value is zero (minimum data value). */ - ICAP_PIXELFLAVOR = 4383, - /** Allows the application and Source to identify which color data formats are available. There are - * two options, "planar" and "chunky." - */ - ICAP_PLANARCHUNKY = 4384, - /** How the Source can/should rotate the scanned image data prior to transfer. This doesn't use - * ICAP_UNITS. It is always measured in degrees. Any applied value is additive with any - * rotation specified in ICAP_ORIENTATION. - */ - ICAP_ROTATION = 4385, - /** For devices that support fixed frame sizes. - * Defined sizes match typical page sizes. This specifies the size(s) the Source can/should use to acquire image data. - */ - ICAP_SUPPORTEDSIZES = 4386, - /** Specifies the dividing line between black and white. This is the value the Source will use to - * threshold, if needed, when ICAP_PIXELTYPE:TWPT_BW. - * The value is normalized so there are no units of measure associated with this ICAP. - */ - ICAP_THRESHOLD = 4387, - /** All the X-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. Do not use values less than or equal to zero. */ - ICAP_XSCALING = 4388, - /** All the Y-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. Do not use values less than or equal to zero. - * There are no units inherent with this data as it is normalized to 1.0 being "unscaled." - */ - ICAP_YSCALING = 4389, - /** Used for CCITT data compression only. Indicates the bit order representation of the stored compressed codes. */ - ICAP_BITORDERCODES = 4390, - /** Used only for CCITT data compression. Specifies whether the compressed codes' pixel "sense" - * will be inverted from the Current value of ICAP_PIXELFLAVOR prior to transfer. - */ - ICAP_PIXELFLAVORCODES = 4391, - /** Allows the application and Source to agree upon a common set of color descriptors that are - * made available by the Source. This ICAP is only useful for JPEG-compressed buffered memory image transfers. - */ - ICAP_JPEGPIXELTYPE = 4392, - /** Used only with CCITT data compression. Specifies the minimum number of words of compressed codes (compressed data) to be transmitted per line. */ - ICAP_TIMEFILL = 4394, - /** Specifies the pixel bit depths for the Current value of ICAP_PIXELTYPE. For example, when - * using ICAP_PIXELTYPE:TWPT_GRAY, this capability specifies whether this is 8-bit gray or 4-bit gray. - * This depth applies to all the data channels (for instance, the R, G, and B channels will all have - * this same bit depth for RGB data). - */ - ICAP_BITDEPTH = 4395, - /** Specifies the Reduction Method the Source should use to reduce the bit depth of the data. Most - * commonly used with ICAP_PIXELTYPE:TWPT_BW to reduce gray data to black and white. - */ - ICAP_BITDEPTHREDUCTION = 4396, - /** If TRUE the Source will issue a MSG_XFERREADY before starting the scan. - * Note: The Source may need to scan the image before initiating the transfer. This is the case if - * the scanned image is rotated or merged with another scanned image. - */ - ICAP_UNDEFINEDIMAGESIZE = 4397, - /** Allows the application to query the data source to see if it supports extended image attribute capabilities, - * such as Barcode Recognition, Shaded Area Detection and Removal, Skew detection and Removal, and so on. - */ - ICAP_EXTIMAGEINFO = 4399, - /** Allows the source to define the minimum height (Y-axis) that the source can acquire. */ - ICAP_MINIMUMHEIGHT = 4400, - /** Allows the source to define theminimum width (X-axis) that the source can acquire. */ - ICAP_MINIMUMWIDTH = 4401, - /** Use this capability to have the Source discard blank images. The Application never sees these - * images during the scanning session. - * TWBP_DISABLE โ€“ this must be the default state for the Source. It indicates that all images will - * be delivered to the Application, none of them will be discarded. - * TWBP_AUTO โ€“ if this is used, then the Source will decide if an image is blank or not and discard - * as appropriate. - * If the specified value is a positive number in the range 0 to 231โ€“1, then this capability will use it - * as the byte size cutoff point to identify which images are to be discarded. If the size of the image - * is less than or equal to this value, then it will be discarded. If the size of the image is greater - * than this value, then it will be kept so that it can be transferred to the Application. - */ - ICAP_AUTODISCARDBLANKPAGES = 4404, - /** Flip rotation is used to properly orient images that flip orientation every other image. - * TWFR_BOOK The images to be scanned are viewed in book form, flipping each page from left to right or right to left. - * TWFR_FANFOLD The images to be scanned are viewed in fanfold paper style, flipping each page up or down. - */ - ICAP_FLIPROTATION = 4406, - /** Turns bar code detection on and off. */ - ICAP_BARCODEDETECTIONENABLED = 4407, - /** Provides a list of bar code types that can be detected by the current Data Source. */ - ICAP_SUPPORTEDBARCODETYPES = 4408, - /** The maximum number of supported search priorities. */ - ICAP_BARCODEMAXSEARCHPRIORITIES = 4409, - /** A prioritized list of bar code types dictating the order in which bar codes will be sought. */ - ICAP_BARCODESEARCHPRIORITIES = 4410, - /** Restricts bar code searching to certain orientations, or prioritizes one orientation over the other. */ - ICAP_BARCODESEARCHMODE = 4411, - /** Restricts the number of times a search will be retried if none are found on each page. */ - ICAP_BARCODEMAXRETRIES = 4412, - /** Restricts the total time spent on searching for a bar code on each page. */ - ICAP_BARCODETIMEOUT = 4413, - /** When used with CapGet(), returns all camera supported lens zooming range. */ - ICAP_ZOOMFACTOR = 4414, - /** Turns patch code detection on and off. */ - ICAP_PATCHCODEDETECTIONENABLED = 4415, - /** A list of patch code types that may be detected by the current Data Source. */ - ICAP_SUPPORTEDPATCHCODETYPES = 4416, - /** The maximum number of supported search priorities. */ - ICAP_PATCHCODEMAXSEARCHPRIORITIES = 4417, - /** A prioritized list of patch code types dictating the order in which patch codes will be sought. */ - ICAP_PATCHCODESEARCHPRIORITIES = 4418, - /** Restricts patch code searching to certain orientations, or prioritizes one orientation over the other. */ - ICAP_PATCHCODESEARCHMODE = 4419, - /** Restricts the number of times a search will be retried if none are found on each page. */ - ICAP_PATCHCODEMAXRETRIES = 4420, - /** Restricts the total time spent on searching for a patch code on each page. */ - ICAP_PATCHCODETIMEOUT = 4421, - /** For devices that support flash. CapSet() selects the flash to be used (if any). CapGet() reports the current setting. - * This capability replaces ICAP_FLASHUSED, which is only able to negotiate the flash being on or off. - */ - ICAP_FLASHUSED2 = 4422, - /** For devices that support image enhancement filtering. This capability selects the algorithm used to improve the quality of the image. */ - ICAP_IMAGEFILTER = 4423, - /** For devices that support noise filtering. This capability selects the algorithm used to remove noise. */ - ICAP_NOISEFILTER = 4424, - /** Overscan is used to scan outside of the boundaries described by ICAP_FRAMES, and is used to help acquire image data that - * may be lost because of skewing. - * This is primarily of use for transport scanners which rely on edge detection to begin scanning. - * If overscan is supported, then the device is capable of scanning in the inter-document gap to get the skewed image information. - */ - ICAP_OVERSCAN = 4425, - /** Turns automatic border detection on and off. */ - ICAP_AUTOMATICBORDERDETECTION = 4432, - /** Turns automatic deskew correction on and off. */ - ICAP_AUTOMATICDESKEW = 4433, - /** When TRUE this capability depends on intelligent features within the Source to automatically - * rotate the image to the correct position. - */ - ICAP_AUTOMATICROTATE = 4434, - /** Added 1.9 */ - ICAP_JPEGQUALITY = 4435, - /** Added 1.91 */ - ICAP_FEEDERTYPE = 4436, - /** Added 1.91 */ - ICAP_ICCPROFILE = 4437, - /** Added 2.0 */ - ICAP_AUTOSIZE = 4438, - /** Added 2.1 */ - ICAP_AUTOMATICCROPUSESFRAME = 4439, - /** Added 2.1 */ - ICAP_AUTOMATICLENGTHDETECTION = 4440, - /** Added 2.1 */ - ICAP_AUTOMATICCOLORENABLED = 4441, - /** Added 2.1 */ - ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE = 4442, - /** Added 2.1 */ - ICAP_COLORMANAGEMENTENABLED = 4443, - /** Added 2.1 */ - ICAP_IMAGEMERGE = 4444, - /** Added 2.1 */ - ICAP_IMAGEMERGEHEIGHTTHRESHOLD = 4445, - /** Added 2.1 */ - ICAP_SUPPORTEDEXTIMAGEINFO = 4446 -} - -/** ICAP_BITORDER values. */ -declare enum EnumDWT_CapBitOrder { - TWBO_LSBFIRST = 0, - /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */ - TWBO_MSBFIRST = 1 -} - -/** ICAP_BITDEPTHREDUCTION values. */ -declare enum EnumDWT_CapBitdepthReduction { - TWBR_THRESHOLD = 0, - TWBR_HALFTONE = 1, - TWBR_CUSTHALFTONE = 2, - TWBR_DIFFUSION = 3 -} - -/** CAP_FEEDERALIGNMENT values. */ -declare enum EnumDWT_CapFeederAlignment { - /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */ - TWFA_NONE = 0, - /** The alignment is to the left. */ - TWFA_LEFT = 1, - /** The alignment is centered. This means that the paper will be fed in the middle of the ICAP_PHYSICALWIDTH of the - * device. If this is set, then the Application should calculate any frames with a left offset of zero. - */ - TWFA_CENTER = 2, - /** The alignment is to the right. */ - TWFA_RIGHT = 3 -} - -/** CAP_FEEDERORDER values. */ -declare enum EnumDWT_CapFeederOrder { - /** The feeder starts with the top of the first page. */ - TWFO_FIRSTPAGEFIRST = 0, - /** The feeder starts with the top of the last page. */ - TWFO_LASTPAGEFIRST = 1 -} - -/** ICAP_FILTER values. */ -declare enum EnumDWT_CapFilterType { - TWFT_RED = 0, - TWFT_GREEN = 1, - TWFT_BLUE = 2, - TWFT_NONE = 3, - TWFT_WHITE = 4, - TWFT_CYAN = 5, - TWFT_MAGENTA = 6, - TWFT_YELLOW = 7, - TWFT_BLACK = 8 -} - -/** ICAP_FLASHUSED2 values. */ -declare enum EnumDWT_CapFlash { - TWFL_NONE = 0, - TWFL_OFF = 1, - TWFL_ON = 2, - TWFL_AUTO = 3, - TWFL_REDEYE = 4 -} - -/** ICAP_FLIPROTATION values. */ -declare enum EnumDWT_CapFlipRotation { - /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */ - TWFR_BOOK = 0, - /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */ - TWFR_FANFOLD = 1 -} - -/** ICAP_IMAGEFILTER values. */ -declare enum EnumDWT_CapImageFilter { - TWIF_NONE = 0, - TWIF_AUTO = 1, - /** Good for halftone images. */ - TWIF_LOWPASS = 2, - /** Good for improving text. */ - TWIF_BANDPASS = 3, - /** Good for improving fine lines. */ - TWIF_HIGHPASS = 4, - TWIF_TEXT = 3, - TWIF_FINELINE = 4 -} - -/** CAP_LANGUAGE values. */ -declare enum EnumDWT_CapLanguage { - /** Danish */ - TWLG_DAN = 0, - /** Dutch */ - TWLG_DUT = 1, - /** International English */ - TWLG_ENG = 2, - /** French Canadian */ - TWLG_FCF = 3, - /** Finnish */ - TWLG_FIN = 4, - /** French */ - TWLG_FRN = 5, - /** German */ - TWLG_GER = 6, - /** Icelandic */ - TWLG_ICE = 7, - /** Italian */ - TWLG_ITN = 8, - /** Norwegian */ - TWLG_NOR = 9, - /** Portuguese */ - TWLG_POR = 10, - /** Spanish */ - TWLG_SPA = 11, - /** Swedish */ - TWLG_SWE = 12, - /** U.S. English */ - TWLG_USA = 13, - /** Added for 1.8 */ - TWLG_USERLOCALE = -1, - TWLG_AFRIKAANS = 14, - TWLG_ALBANIA = 15, - TWLG_ARABIC = 16, - TWLG_ARABIC_ALGERIA = 17, - TWLG_ARABIC_BAHRAIN = 18, - TWLG_ARABIC_EGYPT = 19, - TWLG_ARABIC_IRAQ = 20, - TWLG_ARABIC_JORDAN = 21, - TWLG_ARABIC_KUWAIT = 22, - TWLG_ARABIC_LEBANON = 23, - TWLG_ARABIC_LIBYA = 24, - TWLG_ARABIC_MOROCCO = 25, - TWLG_ARABIC_OMAN = 26, - TWLG_ARABIC_QATAR = 27, - TWLG_ARABIC_SAUDIARABIA = 28, - TWLG_ARABIC_SYRIA = 29, - TWLG_ARABIC_TUNISIA = 30, - /** United Arabic Emirates */ - TWLG_ARABIC_UAE = 31, - TWLG_ARABIC_YEMEN = 32, - TWLG_BASQUE = 33, - TWLG_BYELORUSSIAN = 34, - TWLG_BULGARIAN = 35, - TWLG_CATALAN = 36, - TWLG_CHINESE = 37, - TWLG_CHINESE_HONGKONG = 38, - /** People's Republic of China */ - TWLG_CHINESE_PRC = 39, - TWLG_CHINESE_SINGAPORE = 40, - TWLG_CHINESE_SIMPLIFIED = 41, - TWLG_CHINESE_TAIWAN = 42, - TWLG_CHINESE_TRADITIONAL = 43, - TWLG_CROATIA = 44, - TWLG_CZECH = 45, - TWLG_DANISH = 0, - TWLG_DUTCH = 1, - TWLG_DUTCH_BELGIAN = 46, - TWLG_ENGLISH = 2, - TWLG_ENGLISH_AUSTRALIAN = 47, - TWLG_ENGLISH_CANADIAN = 48, - TWLG_ENGLISH_IRELAND = 49, - TWLG_ENGLISH_NEWZEALAND = 50, - TWLG_ENGLISH_SOUTHAFRICA = 51, - TWLG_ENGLISH_UK = 52, - TWLG_ENGLISH_USA = 13, - TWLG_ESTONIAN = 53, - TWLG_FAEROESE = 54, - TWLG_FARSI = 55, - TWLG_FINNISH = 4, - TWLG_FRENCH = 5, - TWLG_FRENCH_BELGIAN = 56, - TWLG_FRENCH_CANADIAN = 3, - TWLG_FRENCH_LUXEMBOURG = 57, - TWLG_FRENCH_SWISS = 58, - TWLG_GERMAN = 6, - TWLG_GERMAN_AUSTRIAN = 59, - TWLG_GERMAN_LUXEMBOURG = 60, - TWLG_GERMAN_LIECHTENSTEIN = 61, - TWLG_GERMAN_SWISS = 62, - TWLG_GREEK = 63, - TWLG_HEBREW = 64, - TWLG_HUNGARIAN = 65, - TWLG_ICELANDIC = 7, - TWLG_INDONESIAN = 66, - TWLG_ITALIAN = 8, - TWLG_ITALIAN_SWISS = 67, - TWLG_JAPANESE = 68, - TWLG_KOREAN = 69, - TWLG_KOREAN_JOHAB = 70, - TWLG_LATVIAN = 71, - TWLG_LITHUANIAN = 72, - TWLG_NORWEGIAN = 9, - TWLG_NORWEGIAN_BOKMAL = 73, - TWLG_NORWEGIAN_NYNORSK = 74, - TWLG_POLISH = 75, - TWLG_PORTUGUESE = 10, - TWLG_PORTUGUESE_BRAZIL = 76, - TWLG_ROMANIAN = 77, - TWLG_RUSSIAN = 78, - TWLG_SERBIAN_LATIN = 79, - TWLG_SLOVAK = 80, - TWLG_SLOVENIAN = 81, - TWLG_SPANISH = 11, - TWLG_SPANISH_MEXICAN = 82, - TWLG_SPANISH_MODERN = 83, - TWLG_SWEDISH = 12, - TWLG_THAI = 84, - TWLG_TURKISH = 85, - TWLG_UKRANIAN = 86, - /** More stuff added for 1.8 */ - TWLG_ASSAMESE = 87, - TWLG_BENGALI = 88, - TWLG_BIHARI = 89, - TWLG_BODO = 90, - TWLG_DOGRI = 91, - TWLG_GUJARATI = 92, - TWLG_HARYANVI = 93, - TWLG_HINDI = 94, - TWLG_KANNADA = 95, - TWLG_KASHMIRI = 96, - TWLG_MALAYALAM = 97, - TWLG_MARATHI = 98, - TWLG_MARWARI = 99, - TWLG_MEGHALAYAN = 100, - TWLG_MIZO = 101, - TWLG_NAGA = 102, - TWLG_ORISSI = 103, - TWLG_PUNJABI = 104, - TWLG_PUSHTU = 105, - TWLG_SERBIAN_CYRILLIC = 106, - TWLG_SIKKIMI = 107, - TWLG_SWEDISH_FINLAND = 108, - TWLG_TAMIL = 109, - TWLG_TELUGU = 110, - TWLG_TRIPURI = 111, - TWLG_URDU = 112, - TWLG_VIETNAMESE = 113 -} - -/** ICAP_LIGHTPATH values. */ -declare enum EnumDWT_CapLightPath { - TWLP_REFLECTIVE = 0, - TWLP_TRANSMISSIVE = 1 -} - -/** ICAP_LIGHTSOURCE values. */ -declare enum EnumDWT_CapLightSource { - TWLS_RED = 0, - TWLS_GREEN = 1, - TWLS_BLUE = 2, - TWLS_NONE = 3, - TWLS_WHITE = 4, - TWLS_UV = 5, - TWLS_IR = 6 -} - -/** ICAP_NOISEFILTER values. */ -declare enum EnumDWT_CapNoiseFilter { - TWNF_NONE = 0, - TWNF_AUTO = 1, - TWNF_LONEPIXEL = 2, - TWNF_MAJORITYRULE = 3 -} - -/** ICAP_ORIENTATION values. */ -declare enum EnumDWT_CapORientation { - TWOR_ROT0 = 0, - TWOR_ROT90 = 1, - TWOR_ROT180 = 2, - TWOR_ROT270 = 3, - TWOR_PORTRAIT = 0, - TWOR_LANDSCAPE = 3, - /** 2.0 */ - TWOR_AUTO = 4, - /** 2.0 */ - TWOR_AUTOTEXT = 5, - /** 2.0 */ - TWOR_AUTOPICTURE = 6 -} - -/** ICAP_OVERSCAN values. */ -declare enum EnumDWT_CapOverscan { - TWOV_NONE = 0, - TWOV_AUTO = 1, - TWOV_TOPBOTTOM = 2, - TWOV_LEFTRIGHT = 3, - TWOV_ALL = 4 -} - -/** ICAP_PIXELFLAVOR values. */ -declare enum EnumDWT_CapPixelFlavor { - /** Zero pixel represents darkest shade. zero pixel represents darkest shade */ - TWPF_CHOCOLATE = 0, - /** Zero pixel represents lightest shade. zero pixel represents lightest shade */ - TWPF_VANILLA = 1 -} - -/** ICAP_PLANARCHUNKY values. */ -declare enum EnumDWT_CapPlanarChunky { - TWPC_CHUNKY = 0, - TWPC_PLANAR = 1 -} - -/** CAP_PRINTER values. */ -declare enum EnumDWT_CapPrinter { - TWPR_IMPRINTERTOPBEFORE = 0, - TWPR_IMPRINTERTOPAFTER = 1, - TWPR_IMPRINTERBOTTOMBEFORE = 2, - TWPR_IMPRINTERBOTTOMAFTER = 3, - TWPR_ENDORSERTOPBEFORE = 4, - TWPR_ENDORSERTOPAFTER = 5, - TWPR_ENDORSERBOTTOMBEFORE = 6, - TWPR_ENDORSERBOTTOMAFTER = 7 -} - -/** CAP_PRINTERMODE values. */ -declare enum EnumDWT_CapPrinterMode { - /** Specifies that the printed text will consist of a single string. */ - TWPM_SINGLESTRING = 0, - /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */ - TWPM_MULTISTRING = 1, - /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */ - TWPM_COMPOUNDSTRING = 2 -} - -/** TWAIN Supported sizes. */ -declare enum EnumDWT_CapSupportedSizes { - /** 0 */ - TWSS_NONE = 0, - /** 1 */ - TWSS_A4LETTER = 1, - /** 2 */ - TWSS_B5LETTER = 2, - /** 3 */ - TWSS_USLETTER = 3, - /** 4 */ - TWSS_USLEGAL = 4, - /** Added 1.5 - * 5 - */ - TWSS_A5 = 5, - /** 6 */ - TWSS_B4 = 6, - /** 7 */ - TWSS_B6 = 7, - /** Added 1.7 - * 9 - */ - TWSS_USLEDGER = 9, - /** 10 */ - TWSS_USEXECUTIVE = 10, - /** 11 */ - TWSS_A3 = 11, - /** 12 */ - TWSS_B3 = 12, - /** 13 */ - TWSS_A6 = 13, - /** 14 */ - TWSS_C4 = 14, - /** 15 */ - TWSS_C5 = 15, - /** 16 */ - TWSS_C6 = 16, - /** Added 1.8 - * 17 - */ - TWSS_4A0 = 17, - /** 18 */ - TWSS_2A0 = 18, - /** 19 */ - TWSS_A0 = 19, - /** 20 */ - TWSS_A1 = 20, - /** 21 */ - TWSS_A2 = 21, - /** 1 */ - TWSS_A4 = 1, - /** 22 */ - TWSS_A7 = 22, - /** 23 */ - TWSS_A8 = 23, - /** 24 */ - TWSS_A9 = 24, - /** 25 */ - TWSS_A10 = 25, - /** 26 */ - TWSS_ISOB0 = 26, - /** 27 */ - TWSS_ISOB1 = 27, - /** 28 */ - TWSS_ISOB2 = 28, - /** 12 */ - TWSS_ISOB3 = 12, - /** 6 */ - TWSS_ISOB4 = 6, - /** 29 */ - TWSS_ISOB5 = 29, - /** 7 */ - TWSS_ISOB6 = 7, - /** 30 */ - TWSS_ISOB7 = 30, - /** 31 */ - TWSS_ISOB8 = 31, - /** 32 */ - TWSS_ISOB9 = 32, - /** 33 */ - TWSS_ISOB10 = 33, - /** 34 */ - TWSS_JISB0 = 34, - /** 35 */ - TWSS_JISB1 = 35, - /** 36 */ - TWSS_JISB2 = 36, - /** 37 */ - TWSS_JISB3 = 37, - /** 38 */ - TWSS_JISB4 = 38, - /** 2 */ - TWSS_JISB5 = 2, - /** 39 */ - TWSS_JISB6 = 39, - /** 40 */ - TWSS_JISB7 = 40, - /** 41 */ - TWSS_JISB8 = 41, - /** 41 */ - TWSS_JISB9 = 42, - /** 43 */ - TWSS_JISB10 = 43, - /** 44 */ - TWSS_C0 = 44, - /** 45 */ - TWSS_C1 = 45, - /** 46 */ - TWSS_C2 = 46, - /** 47 */ - TWSS_C3 = 47, - /** 48 */ - TWSS_C7 = 48, - /** 49 */ - TWSS_C8 = 49, - /** 50 */ - TWSS_C9 = 50, - /** 51 */ - TWSS_C10 = 51, - /** 52 */ - TWSS_USSTATEMENT = 52, - /** 53 */ - TWSS_BUSINESSCARD = 53, - /** 54. Added 2.1 */ - TWSS_MAXSIZE = 54 -} - -/** Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected. - * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities = - * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION. - */ -declare enum EnumDWT_CapType { - /** Nothing. */ - TWON_NONE = 0, - /** A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and - * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS - * capability, would use this type of container. - */ - TWON_ARRAY = 3, - /** This is the most general type because it defines a list of values from which the Current Value can be chosen. - * The values do not progress uniformly through a range and there is not a consistent step size between the values. - * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600). - */ - TWON_ENUMERATION = 4, - /** A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value. - * For example, a capability that indicates the presence of a document feeder could be of this type. - */ - TWON_ONEVALUE = 5, - /** Many capabilities allow users to select their current value from a range of regularly spaced values. - * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values. - * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600). - */ - TWON_RANGE = 6 -} - -/** The kind of data stored in the container. */ -declare enum EnumDWT_CapValueType { - TWTY_INT8 = 0, - /** Means Item is a TW_INT16 */ - TWTY_INT16 = 1, - /** Means Item is a TW_INT32 */ - TWTY_INT32 = 2, - /** Means Item is a TW_UINT8 */ - TWTY_UINT8 = 3, - /** Means Item is a TW_UINT16 */ - TWTY_UINT16 = 4, - /** Means Item is a TW_int */ - TWTY_int = 5, - /** Means Item is a TW_BOOL */ - TWTY_BOOL = 6, - /** Means Item is a TW_FIX32 */ - TWTY_FIX32 = 7, - /** Means Item is a TW_FRAME */ - TWTY_FRAME = 8, - /** Means Item is a TW_STR32 */ - TWTY_STR32 = 9, - /** Means Item is a TW_STR64 */ - TWTY_STR64 = 10, - /** Means Item is a TW_STR128 */ - TWTY_STR128 = 11, - /** Means Item is a TW_STR255 */ - TWTY_STR255 = 12 -} - -/** ICAP_DUPLEX values. */ -declare enum EnumDWT_DUPLEX { - TWDX_NONE = 0, - TWDX_1PASSDUPLEX = 1, - TWDX_2PASSDUPLEX = 2 -} - -/** Data source status. */ -declare enum EnumDWT_DataSourceStatus { - /** Indicate the data source is closed. */ - TWDSS_CLOSED = 0, - /** Indicate the data source is opened. */ - TWDSS_OPENED = 1, - /** Indicate the data source is enabled. */ - TWDSS_ENABLED = 2, - /** Indicate the data source is acquiring image. */ - TWDSS_ACQUIRING = 3 -} - -declare enum EnumDWT_Error { - ModuleNotExists = -2371 -} - -/** ICAP_IMAGEFILEFORMAT values. */ -declare enum EnumDWT_FileFormat { - /** Used for document imaging. Tagged Image File Format */ - TWFF_TIFF = 0, - /** Native Macintosh format. Macintosh PICT */ - TWFF_PICT = 1, - /** Native Microsoft format. Windows Bitmap */ - TWFF_BMP = 2, - /** Used for document imaging. X-Windows Bitmap */ - TWFF_XBM = 3, - /** Wrapper for JPEG images. JPEG File Interchange Format */ - TWFF_JFIF = 4, - /** FlashPix, used with digital cameras. Flash Pix */ - TWFF_FPX = 5, - /** Multi-page TIFF files. Multi-page tiff file */ - TWFF_TIFFMULTI = 6, - /** An image format standard intended for use on the web, replaces GIF. */ - TWFF_PNG = 7, - /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */ - TWFF_SPIFF = 8, - /** File format for use with digital cameras. */ - TWFF_EXIF = 9, - /** A file format from Adobe. 1.91 NB: this is not PDF/A */ - TWFF_PDF = 10, - /** A file format from the Joint Photographic Experts Group. 1.91 */ - TWFF_JP2 = 11, - /** 1.91 */ - TWFF_JPN = 12, - /** 1.91 */ - TWFF_JPX = 13, - /** A file format from LizardTech. 1.91 */ - TWFF_DEJAVU = 14, - /** A file format from Adobe. 2.0 */ - TWFF_PDFA = 15, - /** 2.1 Adobe PDF/A, Version 2 */ - TWFF_PDFA2 = 16 -} - -/** Fit window type */ -declare enum EnumDWT_FitWindowType { - /** Fit the image to the width and height of the window */ - enumFitWindow = 0, - /** Fit the image to the height of the window */ - enumFitWindowHeight = 1, - /** Fit the image to the width of the window */ - enumFitWindowWidth = 2 -} - -/** Image type */ -declare enum EnumDWT_ImageType { - /** Native Microsoft format. */ - IT_BMP = 0, - /** JPEG format. */ - IT_JPG = 1, - /** Tagged Image File Format. */ - IT_TIF = 2, - /** An image format standard intended for use on the web, replaces GIF. */ - IT_PNG = 3, - /** A file format from Adobe. */ - IT_PDF = 4, - /** All supported formats which are bmp, jpg, tif, png and pdf */ - IT_ALL = 5 -} - -declare enum EnumDWT_InitMsg { - Info = 1, - Error = 2, - NotInstalledError = 3, - DownloadError = 4, - DownloadNotRestartError = 5 -} - -/** The method to do interpolation. */ -declare enum EnumDWT_InterpolationMethod { - IM_NEARESTNEIGHBOUR = 1, - IM_BILINEAR = 2, - IM_BICUBIC = 3, - IM_BESTQUALITY = 5 -} - -declare enum EnumDWT_Language { - English = 0, - French = 1, - Arabic = 2, - Spanish = 3, - Portuguese = 4, - German = 5, - Italian = 6, - Russian = 7, - Chinese = 8 -} - -/** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */ -declare enum EnumDWT_MagType { - /** Added 2.0 */ - TWMD_MICR = 0, - /** added 2.1 */ - TWMD_RAW = 1, - /** added 2.1 */ - TWMD_INVALID = 2 -} - -/** For query the operation that are supported by the data source on a capability . - * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT - */ -declare enum EnumDWT_MessageType { - TWQC_GET = 1, - TWQC_SET = 2, - TWQC_GETDEFAULT = 4, - TWQC_GETCURRENT = 8, - TWQC_RESET = 16 -} - -declare enum EnumDWT_MouseShape { - Default = 0, - Hand = 1, - Crosshair = 2, - Zoom = 3 -} - -/** PDF file compression type. */ -declare enum EnumDWT_PDFCompressionType { - /** Auto mode. */ - PDF_AUTO = 0, - /** CCITT Group 3 fax encoding. */ - PDF_FAX3 = 1, - /** CCITT Group 4 fax encoding */ - PDF_FAX4 = 2, - /** Lempel Ziv and Welch */ - PDF_LZW = 3, - /** CCITT modified Huffman RLE. */ - PDF_RLE = 4, - /** JPEG compression. */ - PDF_JPEG = 5 -} - -/** ICAP_PIXELTYPE values (PT_ means Pixel Type) */ -declare enum EnumDWT_PixelType { - TWPT_BW = 0, - TWPT_GRAY = 1, - TWPT_RGB = 2, - TWPT_PALLETE = 3, - TWPT_CMY = 4, - TWPT_CMYK = 5, - TWPT_YUV = 6, - TWPT_YUVK = 7, - TWPT_CIEXYZ = 8, - TWPT_LAB = 9, - TWPT_SRGB = 10, - TWPT_SCRGB = 11, - TWPT_INFRARED = 16 -} - -declare enum EnumDWT_PlatformType { - /// Fit the image to the width and height of the window - enumWindow = 0, - /// Fit the image to the height of the window - enumMac = 1, - /// Fit the image to the width of the window - enumLinux = 2 -} - -declare enum EnumDWT_ShowMode { - /** Activates the window and displays it in its current size and position. */ - SW_ACTIVE = 0, - /** Maximizes the window */ - SW_MAX = 1, - /** Minimize the window */ - SW_MIN = 2, - /** Close the latest opened editor window */ - SW_CLOSE = 3, - /** Check whether a window exists */ - SW_IFLIVE = 4 -} - -/** TIFF file compression type. */ -declare enum EnumDWT_TIFFCompressionType { - /** Auto mode. */ - TIFF_AUTO = 0, - /** Dump mode. */ - TIFF_NONE = 1, - /** CCITT modified Huffman RLE. */ - TIFF_RLE = 2, - /** CCITT Group 3 fax encoding. */ - TIFF_FAX3 = 3, - /** CCITT T.4 (TIFF 6 name). */ - TIFF_T4 = 3, - /** CCITT Group 4 fax encoding */ - TIFF_FAX4 = 4, - /** CCITT T.6 (TIFF 6 name). */ - TIFF_T6 = 4, - /** Lempel Ziv and Welch */ - TIFF_LZW = 5, - TIFF_JPEG = 7, - TIFF_PACKBITS = 32773 -} - -/** ICAP_XFERMECH values. */ -declare enum EnumDWT_TransferMode { - /** Native transfers require the data to be transferred to a single large block of RAM. Therefore, - * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully. - */ - TWSX_NATIVE = 0, - /** Disk File Mode Transfers. */ - TWSX_FILE = 1, - /** Buffered Memory Mode Transfers. */ - TWSX_MEMORY = 2/*,*/ - /** added 1.91 , not supported in DWT yet*/ - /** TWSX_MEMFILE = 4*/ -} - -/** ICAP_UNITS values. */ -declare enum EnumDWT_UnitType { - TWUN_INCHES = 0, - TWUN_CENTIMETERS = 1, - TWUN_PICAS = 2, - TWUN_POINTS = 3, - TWUN_TWIPS = 4, - TWUN_PIXELS = 5, - TWUN_MILLIMETERS = 6 -} - -declare enum EnumDWT_UploadDataFormat { - Binary = 0, - Base64 = 1 -} - -/** - * interface for a DWT container which basically defines a DIV on the page - */ -interface Container { - ContainerId: string; - Width: string | number; - Height: string | number; -} - -/** - * interface for a base64 result - */ -interface Base64Result { - getLength(): number; - getData(offset: number, length: number): string; - getMD5(): string; -} - -/** - * Copied from lib.d.ts (Typescript) - */ -interface Blob { - readonly size: number; - readonly type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -/** - * Details for each license - */ -interface LicenseDetailItem { - readonly Browser: string; - readonly EnumLicenseType: string; - readonly ExpireDate: string; - readonly LicenseType: string; - readonly OS: string; - readonly Trial: string; - readonly Version: string; -} - -/** - * @class - */ -// properties (get/set) / sync functions -interface WebTwain { - /** - * Returns whether the instance of a DWT is initialized - * @type {boolean} - */ - bReady: boolean; - - /** - * Returns the runtime id of the dwt object - * @type {string} - */ - readonly clientId: string; - - /** - * Returns the runtime class for the dwt container DIV - * @type {string} - */ - containerClass: string; - - /*ignored - httpUrl - objectName - - ...other internal ones - */ - - /* - * Properties - */ - - /** - * Returns or sets whether multi-page selection is supported. - * @type {boolean} - */ - AllowMultiSelect: boolean; - - /** - * [Deprecated.] Returns or sets whether allowing the plugin to send authentication request. The default value of this property is TRUE. - * @type {boolean} - */ - AllowPluginAuthentication: boolean; - - /** - * [Deprecated.] Returns or sets whether the async mode is activated. With this mode, Dynamic Web TWAIN is able to upload/download files via HTTP/FTP asynchronously. The default value is false. - * @type {boolean} - */ - AsyncMode: boolean; - - /** - * Returns or sets the background color of the main control. It is a value specifying the 24-bit RGB value. - * @type {number} - */ - BackgroundColor: number; - - /** - * Returns or sets the fill color of the selected area of an image when it is cut, erased or rotated. It is a value specifying the 24-bit RGB value. - * @type {number} - */ - BackgroundFillColor: number; - - /** - * Returns or sets the pixel bit depths for the current value of PixelType property. This is a runtime property. - * @type {number} - */ - BitDepth: number; - - /** - * Returns the current deviation of the pixels in the image. - * @type {number} - */ - readonly BlankImageCurrentStdDev: number; - - /** - * Returns or sets the standard deviation of the pixels in the image. - * @type {number} - */ - BlankImageMaxStdDev: number; - - /** - * Returns or sets the dividing line between black and white. The default value is 128. - * @type {number} - */ - BlankImageThreshold: number; - - /** - * [Deprecated.] Returns or sets the border style. - * @type {EnumDWT_BorderStyle} - */ - BorderStyle: EnumDWT_BorderStyle; - - /** - * Returns or sets the brightness values available within the Source. This is a runtime property. - * @type {number} - */ - Brightness: number; - - /** - * [Deprecated.] Sets or returns whether brokerprocess is enabled for scanning. - * @type {number} - */ - BrokerProcessType: number; - - /** - * Sets or returns how much physical memory is allowed for storing images currently loaded in Dynamic Web TWAIN. Once the limit is reached, images will be cached on the hard disk. - * @type {number} - */ - BufferMemoryLimit: number; - - /** - * Sets or returns the index (0-based) of a list to indicate the Current Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. - * @type {number} - */ - CapCurrentIndex: number; - - /** - * Sets or returns the current value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {number} - */ - CapCurrentValue: number; - - /** - * Returns the index (0-based) of a list to indicate the Default Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime, read-only property. - * @type {number} - */ - readonly CapDefaultIndex: number; - - /** - * Returns the default value in a range when the value of the CapType property is TWON_RANGE. This is a runtime, read-only property. - * @type {number} - */ - CapDefaultValue: number; - - /** - * Retruns the description for a capability - * @type {string} - */ - CapDescription: string; - - /** - * Sets or returns the maximum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {number} - */ - CapMaxValue: number; - - /** - * Sets or returns the minimum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {number} - */ - CapMinValue: number; - - /** - * [Deprecated.] Sets or returns how many items are in the list when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. For String data type, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. - * @type {number} - */ - CapNumItems: number; - - /** - * Sets or returns the step size in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {number} - */ - CapStepSize: number; - - /** - * Sets or returns the type of capability container used to exchange capability information between application and source. This is a runtime property. - * @type {EnumDWT_CapType} - */ - CapType: EnumDWT_CapType; - - /** - * Returns or sets the value of the capability specified by Capability property when the value of the CapType property is TWON_ONEVALUE. This is a runtime property. - * @type {number} - */ - CapValue: number; - - /** - * Sets or returns the string value for a capability when the value of the CapType property is TWON_ONEVALUE. This is a runtime property. - * @type {string} - */ - CapValueString: string; - - /** - * Sets or returns the value type for reading the value of a capability. This is a runtime property. - * @type {number} - */ - CapValueType: number; - - /** - * Specifies the capabiltiy to be negotiated. This is a runtime property. - * @type {EnumDWT_Cap} - */ - Capability: EnumDWT_Cap; - - /** - * Returns or sets the contrast values available within the Source. This is a runtime property. - * @type {number} - */ - Contrast: number; - - /** - * Returns or sets current index of image in buffer. This is a runtime property. - * @type {number} - */ - CurrentImageIndexInBuffer: number; - - /** - * Returns the device name of current source. This is a runtime, read-only property. - * @type {string} - */ - readonly CurrentSourceName: string; - - /** - * Returns the value indicating the data source status. This is a runtime, read-only property. - * @type {number} - */ - readonly DataSourceStatus: number; - - /** - * Returns the device name of default source. This is a runtime, read-only property. - * @type {string} - */ - readonly DefaultSourceName: string; - - /** - * Returns whether the source supports duplex. If so, it further returns the level of duplex the Source supports (one pass or two pass duplex). This is a runtime, read-only property. - * @type {EnumDWT_DUPLEX} - */ - readonly Duplex: EnumDWT_DUPLEX; - - /** - * [Deprecated.] Returns or sets whether the user can zoom image using hot key. - * @type {boolean} - */ - EnableInteractiveZoom: boolean; - - /** - * Returns the error code. This is a runtime, read-only property. - * @type {number} - */ - readonly ErrorCode: number; - - /** - * Returns the error string. This is a runtime, read-only property. - * @type {string} - */ - readonly ErrorString: string; - - /** - * Returns or sets the password used to log into the FTP server. - * @type {string} - */ - FTPPassword: string; - - /** - * Returns or sets the port number of the FTP server. - * @type {number} - */ - FTPPort: number; - - /** - * Returns or sets the user name used to log into the FTP server. - * @type {string} - */ - FTPUserName: string; - - /** - * Returns or sets whether to resize the image to fit the image to the width or height of the window. To use the property, the view mode should be set to -1 by -1. You can use SetViewMode method to set the view mode. - * @type {EnumDWT_FitWindowType} - */ - FitWindowType: EnumDWT_FitWindowType; - - /** - * Returns the response string from the HTTP server if an error occurs for HTTPUploadThroughPost() method. This is a runtime, read-only property. - * @type {string} - */ - readonly HTTPPostResponseString: string; - - /** - * Returns whether a HTTP request has credentials - * @type {boolean} - */ - HTTPRequestswithCredentials: boolean; - - /** - * Returns or sets the height of the dwt viewer object - * @type {string|number} - */ - Height: string | number; - - /** - * Returns how many images are in buffer. This is a runtime, read-only property. - * @type {number} - */ - readonly HowManyImagesInBuffer: number; - - /** - * Specifies the content type of a http upload. - * @type {string} - */ - HttpContentTypeFieldValue: string; - - /** - * Specifies the field name of uploaded image through POST. - * @type {string} - */ - HttpFieldNameOfUploadedImage: string; - - /** - * [Deprecated.] Sets or returns the password used to log into the HTTP server. - * @type {string} - */ - HTTPPassword: string; - - /** - * Returns or sets the port number of the HTTP server. - * @type {number|string} - */ - HTTPPort: number | string; - - /** - * [Deprecated.] Returns or sets the user name used to log into the HTTP server. - * @type {string} - */ - HTTPUserName: string; - - /** - * Returns or sets whether the feature of disk caching is enabled. - * @type {boolean} - */ - IfAllowLocalCache: boolean; - - /** - * Returns or sets whether insert or append new scanned images. - * @type {boolean} - */ - IfAppendImage: boolean; - - /** - * Returns or sets whether the Source's Auto-brightness function is enabled. This is a runtime property. - * @type {boolean} - */ - IfAutoBright: boolean; - - /** - * Returns or sets whether the data source (scanner) will discard blank images during scanning. The property works only if the device and its driver support discarding blank pages. You can find whether your device supports this capbility from its user manual. Or, you can use the built-in methods of Dynamic Web TWAIN to detect blank images: IsBlankImage, IsBlankImageEx. - * @type {boolean} - */ - IfAutoDiscardBlankpages: boolean; - - /** - * Returns or sets whether the Source enable automatic document feeding process. This is a runtime property. - * @type {boolean} - */ - IfAutoFeed: boolean; - - /** - * Returns or sets whether the Source enables the automatic document scanning process. This is a runtime property. - * @type {boolean} - */ - IfAutoScan: boolean; - - /** - * Specifies whether or not to automatically scroll to the last image or stay on the current image when loading or acquiring images - * @type {boolean} - */ - IfAutoScroll: boolean; - - /** - * Turns automatic border detection on and off. The property works only if the device and its driver support detecting the border automatically. You can find whether your device supports this capbility from its user manual. - * @type {boolean} - */ - IfAutomaticBorderDetection: boolean; - - /** - * Turns automatic skew correction on and off. - * @type {boolean} - */ - IfAutomaticDeskew: boolean; - - /** - * Returns or sets whether close the Data Source User Interface after acquire all images. Default value of this property is FALSE. - * @type {boolean} - */ - IfDisableSourceAfterAcquire: boolean; - - /** - * Returns or sets whether the Source supports duplex. If TRUE, the scanner scans both sides of a paper; otherwise, the scanner will scan only one side of the image. This is a runtime property. - * @type {boolean} - */ - IfDuplexEnabled: boolean; - - /** - * Returns or sets whether the Automatic Document Feeder (ADF) is enabled. This is a runtime property. - * @type {boolean} - */ - IfFeederEnabled: boolean; - - /** - * Returns whether or not there are documents loaded in the Source's feeder when IfFeederEnabled and IfPaperDetectable are TRUE. This is a runtime, read-only property. - * @type {boolean} - */ - readonly IfFeederLoaded: boolean; - - /** - * Returns or sets whether to resize the image to fit the size of window when the view mode is set to -1 by -1. You can use SetViewMode method to set the view mode. - * @type {boolean} - */ - IfFitWindow: boolean; - - /** - * [Deprecated.] Returns or sets whether the UI (User Interface) of Source runs in modal state. Default value of this property is TRUE. - * @type {boolean} - */ - IfModalUI: boolean; - - /** - * Sets or returns whether Dynamic Web TWAIN uses Graphics Device Interface (GDI) when decoding images. - * @type {boolean} - */ - IfOpenImageWithGDIPlus: boolean; - - /** - * Returns or sets whether FTP passive mode is enabled. - * @type {boolean} - */ - IfPASVMode: boolean; - - /** - * Returns the value whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a runtime, read-only property. - * @type {boolean} - */ - readonly IfPaperDetectable: boolean; - - /** - * Returns or sets whether SSL is used when uploading or downloading images. - * @type {boolean} - */ - IfSSL: boolean; - - /** - * [Deprecated.] Returns or sets whether communicate with device in a separate thread. Default value of this property is FALSE. - * @type {boolean} - */ - IfScanInNewThread: boolean; - - /** - * Sets or returns whether to show the cancel dialog when uploading images to server. - * @type {boolean} - */ - IfShowCancelDialogWhenImageTransfer: boolean; - - /** - * Returns or sets whether to show the file dialog box when saving scanned images or loading images from local folder. - * @type {boolean} - */ - IfShowFileDialog: boolean; - - /** - * Returns or sets whether the Source displays a progress indicator during acquisition and transfer, regardless of whether the Source's user interface is active. This is a runtime property. - * @type {boolean} - */ - IfShowIndicator: boolean; - - /** - * [Deprecated.] Returns or sets whether the driver of the printer displays the User Interface. - * @type {boolean} - */ - IfShowPrintUI: boolean; - - /** - * Returns or sets whether the progress bar will be displayed during the transaction. This is a runtime property. - * @type {boolean} - */ - IfShowProgressBar: boolean; - - /** - * Returns or sets whether the Source displays the User Interface. - * @type {boolean} - */ - IfShowUI: boolean; - - /** - * Returns or sets whether to throw exceptions - * @type {boolean} - */ - IfThrowException: boolean; - - /** - * Return or sets whether the Source allows to save many images in one TIFF file. The default value is FALSE. - * @type {boolean} - */ - IfTiffMultiPage: boolean; - - /** - * Returns whether the Source supports acquisition with the UI (User Interface) disabled. If FALSE, indicates that this Source can only support acquisition with the UI enabled. This is a runtime, read-only property. - * @type {boolean} - */ - readonly IfUIControllable: boolean; - - /** - * Sets or returns whether Dynamic Web TWAIN uses the new TWAIN Data Source Manager (TWAINDSM.dll) when acquiring images from TWAIN devices. - * @type {boolean} - */ - IfUseTwainDSM: boolean; - - /** - * [Deprecated.] The number of bits in each image pixel (or bit depth). This is a runtime, read-only property. - * @type {number} - */ - ImageBitsPerPixel: number; - - /** - * Returns or sets whether a TWAIN driver or Native Scan of Mac OS X is used for document scanning. This property works for Mac edition only. - * @type {number} - */ - ImageCaptureDriverType: number; - - /** - * [Deprecated.] Returns or sets whether the image enumerator is enabled in Image Editor. - * @type {boolean} - */ - ImageEditorIfEnableEnumerator: boolean; - - /** - * [Deprecated.] Returns or sets whether the Image Editor is a modal window. - * @type {boolean} - */ - ImageEditorIfModal: boolean; - - /** - * [Deprecated.] Returns or sets whether the Image Editor is read-only. - * @type {boolean} - */ - ImageEditorIfReadonly: boolean; - - /** - * [Deprecated.] Returns or sets the title of Image Editor window. - * @type {string} - */ - ImageEditorWindowTitle: string; - - /** - * Returns the document number of the current image. This is a runtime, read-only property. - * @type {number} - */ - readonly ImageLayoutDocumentNumber: number; - - /** - * Returns the value of the bottom-most edge of the current image frame (in Unit). This is a read-only runtime property. - * @type {number} - */ - readonly ImageLayoutFrameBottom: number; - - /** - * Returns the value of the left-most edge of the current image frame (in Unit). This is a runtime, read-only property. - * @type {number} - */ - readonly ImageLayoutFrameLeft: number; - - /** - * Returns the frame number of the current image. This is a runtime, read-only property. - * @type {number} - */ - readonly ImageLayoutFrameNumber: number; - - /** - * Returns the value of the right-most edge of the current image frame (in Unit). This is a runtime, read-only property. - * @type {number} - */ - readonly ImageLayoutFrameRight: number; - - /** - * Returns the value of the top-most edge of the current image frame (in Unit). This is a runtime, read-only property. - * @type {number} - */ - readonly ImageLayoutFrameTop: number; - - /** - * Returns the page number of the current image. This is a runtime, read-only property. - * @type {Long} - */ - readonly ImageLayoutPageNumber: number; - - /** - * [Deprecated.] Returns how tall/long, in pixels, the image is. This is a runtime, read-only property. - * @type {number} - */ - ImageLength: number; - - /** - * Returns or sets the margin between images when multiple images are displayed in Dynamic Web TWAIN. - * @type {number} - */ - ImageMargin: number; - - /** - * Returns the pixel type of the current image. This is a runtime, read-only property. Please note the property is only valid in OnPreTransfer and OnPostTransfer event. - * @type {EnumDWT_PixelType} - */ - readonly ImagePixelType: EnumDWT_PixelType; - - /** - * [Deprecated.] Returns how width, in pixels, the image is. This is a runtime, read-only property. - * @type {number} - */ - ImageWidth: number; - - /** - * [Deprecated.] Returns the X resolution of the current image. X resolution is the number of pixels per Unit in the horizontal direction. This is a runtime, read-only property. - * @type {number} - */ - ImageXResolution: number; - - /** - * [Deprecated.] Returns the Y resolution of the current image. Y resolution is the number of pixels per Unit in the vertical direction. This is a runtime, read-only property. - * @type {number} - */ - ImageYResolution: number; - - /** - * Returns or sets the quality of JPEG files and PDF files using JPEG compression. - * @type {number} - */ - JPEGQuality: number; - - /** - * Returns or sets the log level for debugging. - * @type {number} - */ - LogLevel: number; - - /** - * Return the magnetic data if the scanner support magnetic data recognition. - * @type {string} - */ - readonly MagData: string; - - /** - * Return the magnetic type if the scanner support magnetic data recognition. - * @type {number} - */ - readonly MagType: number; - - /** - * Sets or returns the manufacture string for the application identity. - * @type {string} - */ - Manufacturer: string; - - /** - * Returns or sets the maximum number of images can be held in buffer. - * @type {number} - */ - MaxImagesInBuffer: number; - - /** - * [Deprecated.] Returns or sets how many threads can be used when you upload files through POST. - * @type {number} - */ - MaxInternetTransferThreads: number; - - /** - * Sets or returns the maximum allowed size when Dynamic Web TWAIN uploads a document. - * @type {number} - */ - MaxUploadImageSize: number; - - /** - * Returns or sets the shape of the mouse. - * @type {boolean} - */ - MouseShape: boolean; - - /** - * Returns the X co-ordinate of the mouse. This is a runtime property. - * @type {number} - */ - readonly MouseX: number; - - /** - * Returns the Y co-ordinate of the mouse. This is a runtime property. - * @type {number} - */ - readonly MouseY: number; - - /** - * Returns or sets the name of the person who creates the PDF document. - * @type {string} - */ - PDFAuthor: string; - - /** - * Returns or sets the compression type of PDF files. This is a runtime property. - * @type {EnumDWT_PDFCompressionType} - */ - PDFCompressionType: EnumDWT_PDFCompressionType; - - /** - * Returns or sets the date when the PDF document is created. - * @type {string} - */ - PDFCreationDate: string; - - /** - * Returns or sets the name of the application that created the original document, if the PDF document is converted from another form. - * @type {string} - */ - PDFCreator: string; - - /** - * Returns or sets the keywords associated with the PDF document. - * @type {string} - */ - PDFKeywords: string; - - /** - * Returns or sets the date when the PDF document is last modified. - * @type {string} - */ - PDFModifiedDate: string; - - /** - * Returns or sets the name of the application that converted the PDF document from its native. - * @type {string} - */ - PDFProducer: string; - - /** - * Returns or sets the subject of the PDF document. - * @type {string} - */ - PDFSubject: string; - - /** - * Returns or sets the title of the PDF document. - * @type {string} - */ - PDFTitle: string; - - /** - * Returns or sets the value of the PDF version. - * @type {string} - */ - PDFVersion: string; - - /** - * Returns or sets the page size(s) the Source can/should use to acquire image data. This is a runtime property. - * @type {EnumDWT_CapSupportedSizes} - */ - PageSize: EnumDWT_CapSupportedSizes; - - /** - * Returns the number of transfers the Source is ready to supply, upon demand. This is a runtime, read-only property. - * @type {number} - */ - readonly PendingXfers: number; - - /** - * Returns or sets the pixel flavor for acquired images. This is a runtime property. - * @type {number} - */ - PixelFlavor: number; - - /** - * Returns or sets the pixel type of current data source. This is a runtime property. Using this property after calling OpenSource() method and before calling AcquireImage(). - * @type {EnumDWT_PixelType} - */ - PixelType: EnumDWT_PixelType; - - /** - * Sets or returns the product family string for the application identity. - * @type {string} - */ - ProductFamily: string; - - /** - * Sets the product key. A product key is generated in Licensing Tool which is intalled with Dynamic Web TWAIN. Each product key corresponds with a license. - * @type {string} - */ - ProductKey: string; - - /** - * Sets or returns the product name string for the application identity. - * @type {string} - */ - ProductName: string; - - /** - * [Deprecated.] Returns or sets the name of the proxy server. - * @type {string} - */ - ProxyServer: string; - - /** - * Returns or sets the current resolution for acquired images. This is a runtime property. - * @type {number} - */ - Resolution: number; - - /** - * Returns or sets how many scanned images are selected. - * @type {number} - */ - SelectedImagesCount: number; - - /** - * Returns or sets the border color of the selected image. It is a value specifying the 24-bit RGB value. - * @type {number} - */ - SelectionImageBorderColor: number; - - /** - * Specifies a fixed aspect ratio to be used for selecting an area. - * @type {number} - */ - SelectionRectAspectRatio: number; - - /** - * Specifies whether to show the page number - * @type {boolean} - */ - ShowPageNumber: boolean; - - /** - * Returns how many sources are installed in the system. This is a runtime, read-only property. - * @type {number} - */ - readonly SourceCount: number; - - /** - * Returns or sets the compression type of TIFF files. This is a runtime property. - * @type {EnumDWT_TIFFCompressionType} - */ - TIFFCompressionType: EnumDWT_TIFFCompressionType; - - /** - * Sets or returns the transfer mode. - * @type {EnumDWT_TransferMode} - */ - TransferMode: EnumDWT_TransferMode; - - /** - * Returns or sets the unit of measure. This is a runtime property. - * @type {EnumDWT_UnitType} - */ - Unit: EnumDWT_UnitType; - - /** - * Specifies whether to show the vertical scroll bar - * @type {boolean} - */ - VScrollBar: boolean; - - /** - * Sets or returns the version info string for the application identity. - * @type {string} - */ - readonly VersionInfo: string; - - /** - * Returns or sets the width of the dwt object viewer - * @type {string|number} - */ - Width: string | number; - - /** - * Returns and sets the number of images you are willing to transfer per session. This is a runtime property. - * @type {number} - */ - XferCount: number; - - /** - * Returns or sets zoom factor for the image, only valid When the view mode is set to -1 by -1. - * @type {number} - */ - Zoom: number; - - /* ignored - style - _AutoCropMethod - */ - - /* - *Methods - */ - - /** - * Displays the source's built-in interface to acquire image. - * @method WebTwain#AcquireImage - * @param {object} optionalDeviceConfig a JS object used to set up the device for image acquisition. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - AcquireImage(optionalDeviceConfig?: object, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Add text on an image. - * @method WebTwain#AddText - * @param {number} sImageIndex the index of the image that you want to add text to. - * @param {number} x the x coordinate for the text. - * @param {number} y the y coordinate for the text. - * @param {string} text the content of the text that you want to add. - * @param {number} txtColor the color for the text. - * @param {number} backgroundColor the background color. - * @param {number} backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter. - * @param {number} backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1 - * @return {boolean} - */ - AddText(sImageIndex: number, x: number, y: number, text: string, txtColor: number, backgroundColor: number, backgroundRoundRadius: number, backgroundOpacity: number): boolean; - - /** - * Cancels all pending transfers. - * @method WebTwain#CancelAllPendingTransfers - * @return {boolean} - */ - CancelAllPendingTransfers(): boolean; - - /** - * Gets information of the capability specified by the Capability property. - * @method WebTwain#CapGet - * @return {boolean} - */ - CapGet(): boolean; - - /** - * Returns the Source's current Value for the specified capability. - * @method WebTwain#CapGetCurrent - * @return {boolean} - */ - CapGetCurrent(): boolean; - - /** - * Returns the Source's Default Value for the specified capability. This is the Source's preferred default value. - * @method WebTwain#CapGetDefault - * @return {boolean} - */ - CapGetDefault(): boolean; - - /** - * Returns the value of the bottom-most edge of the specified frame. - * @method WebTwain#CapGetFrameBottom - * @param {number} index specifies the value of which frame to get. The index is 0-based. - * @return {number} - */ - CapGetFrameBottom(index: number): number; - - /** - * Returns the value (in Unit) of the left-most edge of the specified frame. - * @method WebTwain#CapGetFrameLeft - * @param {number} index specifies the value of which frame to get. The index is 0-based. - * @return {number} - */ - CapGetFrameLeft(index: number): number; - - /** - * Returns the value (in Unit) of the left-most edge of the specified frame. - * @method WebTwain#CapGetFrameRight - * @param {number} index specifies the value of which frame to get. The index is 0-based. - * @return {number} - */ - CapGetFrameRight(index: number): number; - - /** - * Returns the value (in Unit) of the top-most edge of the specified frame. - * @method WebTwain#CapGetFrameTop - * @param {number} index specifies the value of which frame to get. The index is 0-based. - * @return {number} - */ - CapGetFrameTop(index: number): number; - - /* ignored - * CapGetHelp - * CapGetLabel - * CapGetLabels - */ - - /** - * Queries whether the Source supports a particular operation on the capability. - * @method WebTwain#CapIfSupported - * @param {EnumDWT_MessageType} messageType specifies the type of capability operation. - * @return {boolean} - */ - CapIfSupported(messageType: EnumDWT_MessageType): boolean; - - /** - * Changes the Current Value of the capability specified by Capability property back to its power-on value. - * @method WebTwain#CapReset - * @return {boolean} - */ - CapReset(): boolean; - - /** - * Sets the current capability using the container type specified by CapType property. The current capability is specified by Capability property. - * @method WebTwain#CapSet - * @return {boolean} - */ - CapSet(): boolean; - - /** - * Sets the values of the specified frame. - * @method WebTwain#CapSetFrame - * @param {number} index specifies the values of which frame to set. The index is 0-based. - * @param {number} left the value (in Unit) of the left-most edge of the specified frame. - * @param {number} top the value (in Unit) of the top-most edge of the specified frame. - * @param {number} right the value (in Unit) of the right-most edge of the specified frame. - * @param {number} bottom the value (in Unit) of the bottom-most edge of the specified frame. - * @return {boolean} - */ - CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Changes the bitdepth of a specified image. - * @method WebTwain#ChangeBitDepth - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} sBitDepth specifies the target bit depth. - * @param {boolean} bHighQuality specifies whether or not to keep high quality while changing the bit depth. When it's true, it takes more time. - * @return {boolean} - */ - ChangeBitDepth(sImageIndex: number, sBitDepth: number, bHighQuality: boolean): boolean; - - /** - * Changes width and height of the image of a specified index in the buffer. Please note the file size of the image will be changed proportionately. - * @method WebTwain#ChangeImageSize - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} iNewWidth specifies the pixel width of the new image. - * @param {number} iNewHeight specifies the pixel height of the new image. - * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. - * @return {boolean} - */ - ChangeImageSize(sImageIndex: number, iNewWidth: number, iNewHeight: number, newVal: EnumDWT_InterpolationMethod): boolean; - - /** - * Clears all the web forms which are used for image uploading. - * @method WebTwain#ClearAllHTTPFormField - * @return {boolean} - */ - ClearAllHTTPFormField(): boolean; - - /** - * Clears the content of all custom tiff tags. - * @method WebTwain#ClearTiffCustomTag - * @return {void} - */ - ClearTiffCustomTag(): void; - - /** - * Closes Data Source. - * @method WebTwain#CloseSource - * @return {boolean} - */ - CloseSource(): boolean; - - /** - * Closes and unloads Data Source Manager. - * @method WebTwain#CloseSourceManager - * @return {boolean} - */ - CloseSourceManager(): boolean; - - /** - * Closes the current process used to scan - * @method WebTwain#CloseWorkingProcess - * @return {boolean} - */ - CloseWorkingProcess(): boolean; - - /** - * Converts the images specified by the indices to base64 synchronously. - * @method WebTwain#ConvertToBase64 - * @param {Array} indices indices specifies which images are to be converted to base64. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. - * @return {Base64Result} - - ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType): Base64Result; - */ - - /** - * Converts the images specified by the indices to base64 asynchronously. - * @method WebTwain#ConvertToBase64 - * @param {Array} indices indices specifies which images are to be converted to base64. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType, asyncSuccessFunc: (result: Base64Result) => void, asyncFailureFunc: (errorCode: number, errorString: string) => void): boolean; - - /** - * Converts the images specified by the indices to blob synchronously. - * @method WebTwain#ConvertToBlob - * @param {Array} indices indices specifies which images are to be converted to base64. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. - * @return {Blob} - */ - ConvertToBlob(indices: number[], enumImageType: EnumDWT_ImageType): Blob; - - /** - * Converts the images specified by the indices to blob asynchronously. - * @method WebTwain#ConvertToBlob - * @param {Array} indices indices specifies which images are to be converted to base64. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - ConvertToBlob(indices: number[], enumImageType: EnumDWT_ImageType, asyncSuccessFunc: (result: any) => void, asyncFailureFunc: (errorCode: number, errorString: string) => void): boolean; - - /** - * Changes a specified image to gray scale. - * @method WebTwain#ConvertToGrayScale - * @param {number} sIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - ConvertToGrayScale(sIndex: number): boolean; - - /** - * Copies the image of a specified index in buffer to clipboard in DIB format. - * @method WebTwain#CopyToClipboard - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - CopyToClipboard(sImageIndex: number): boolean; - - /** - * Create the font for adding text using the method AddText. - * @method WebTwain#CreateTextFont - * @param {number} height Specifies the desired height (in logical units) of the font.The absolute value of nHeight must not exceed 16,384 device units after it is converted.For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size or the smallest font if all the fonts exceed the requested size. - * @param {number} width Specifies the average width (in logical units) of characters in the font. If Width is 0, the aspect ratio of the device will be matched against the digitization aspect ratio of the available fonts to find the closest match, which is determined by the absolute value of the difference. - * @param {number} escapement Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis. - * @param {number} orientation Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems in which the y-direction is down and clockwise from the x-axis for coordinate systems in which the y-direction is up. - * @param {number} weight Specifies the font weight (in inked pixels per 1000). The described valuesare approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used. - * @param {number} italic Specifies an italic font if set to TRUE. - * @param {number} underline Specifies an underlined font if set to TRUE. - * @param {number} strikeOut A strikeout font if set to TRUE. - * @param {number} charSet Specifies the font's character set. The OEM character set is system-dependent. Fonts with other character sets may exist in the system. An application that uses a font with an unknown character set must not attempt to translate or interpret strings that are to be rendered with that font. - * @param {number} outputPrecision Specifies the desired output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, and pitch. - * @param {number} clipPrecision Specifies the desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region. - * @param {number} quality Specifies the font's output quality, which defines how carefully the GDI must attempt to match the logical-font attributes to those of an actual physical font. - * @param {number} pitchAndFamily The pitch and family of the font. - * @param {string} faceName the typeface name, the length of this string must not exceed 32 characters, including the terminating null character. - * @return {boolean} - */ - CreateTextFont(height: number, width: number, escapement: number, orientation: number, weight: number, italic: number, underline: number, strikeOut: number, charSet: number, outputPrecision: number, clipPrecision: number, quality: number, pitchAndFamily: number, faceName: string): boolean; - - /** - * Crops the image of a specified index in buffer. - * @method WebTwain#Crop - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @return {boolean} - */ - Crop(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Crops the image of a specified index in buffer to clipboard in DIB format. - * @method WebTwain#CropToClipboard - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @return {boolean} - */ - CropToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Cuts the image data in the specified area to the system clipboard in DIB format. - * @method WebTwain#CutFrameToClipboard - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @return {boolean} - */ - CutFrameToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Cuts the image of a specified index in buffer to clipboard in DIB format. - * @method WebTwain#CutToClipboard - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - CutToClipboard(sImageIndex: number): boolean; - - /** - * Disable the source. If the source's user interface is displayed when the source is enabled, it will be closed. - * @method WebTwain#DisableSource - * @return {boolean} - */ - DisableSource(): boolean; - - /** - * Enables the source to accept image. - * @method WebTwain#EnableSource - * @return {boolean} - */ - EnableSource(): boolean; - - /** - * Clears the specified area of a specified image, and fill the area with the fill color. - * @method WebTwain#Erase - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @return {boolean} - */ - Erase(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Downloads an image from the FTP server. - * @method WebTwain#FTPDownload - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPDownload(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Directly download a file from the FTP server to local disk without loading it into Dynamic Web TWAIN. - * @method WebTwain#FTPDownloadDirectly - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. - * @param {string} localFile specify a full path to store the file. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPDownloadDirectly(FTPServer: string, FTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Downloads an image from the FTP server. - * @method WebTwain#FTPDownloadEx - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. - * @param {EnumDWT_ImageType} lImageType simage format of the file to be downloaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPDownloadEx(FTPServer: string, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the image of a specified index in the buffer to the FTP server. - * @method WebTwain#FTPUpload - * @param {string} FTPServer the name of the FTP server. - * @param {number} sImageIndex specifies the index of the image in the buffer. The index is 0-based. - * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUpload(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Directly upload a specific file to the FTP server without loading it into Dynamic Web TWAIN. - * @method WebTwain#FTPUploadDirectly - * @param {string} FTPServer the name of the FTP server. - * @param {string} localFile specify the the full path of a local file. - * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUploadDirectly(FTPServer: string, localFile: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the image of a specified index in the buffer to the FTP server as a specified image format. - * @method WebTwain#FTPUploadEx - * @param {string} FTPServer the name of the FTP server. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. - * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUploadEx(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads all images in buffer to the FTP server as Multi-Page TIFF. - * @method WebTwain#FTPUploadAllAsMultiPageTIFF - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUploadAllAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads all images in buffer to the FTP server as Multi-Page PDF. - * @method WebTwain#FTPUploadAllAsPDF - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUploadAllAsPDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the selected images in buffer to the FTP server as Multi-Page PDF. - * @method WebTwain#FTPUploadAsMultiPagePDF - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUploadAsMultiPagePDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the selected images in buffer to the FTP server as Multi-Page TIFF. - * @method WebTwain#FTPUploadAsMultiPageTIFF - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUploadAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Sets the Source to eject the current page and advance the next page in the document feeder into the feeder acquire area when IfFeederEnabled is TRUE. - * @method WebTwain#FeedPage - * @return {boolean} - */ - FeedPage(): boolean; - - /** - * Check whether a certain file exists on the local disk. - * @method WebTwain#FileExists - * @param {string} localFile specifies the absolute path of the local file. - * @return {boolean} - */ - FileExists(localFile: string): boolean; - - /** - * Flips the image of a specified index in buffer. - * @method WebTwain#Flip - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - Flip(sImageIndex: number): boolean; - - /** - * Get the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. - * @method WebTwain#GetCapItems - * @param {number} index Index is 0-based. It is the index of the cap item. - * @return {number} - */ - GetCapItems(index: number): number; - - /** - * Returns the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. - * @method WebTwain#GetCapItemsString - * @param {number} index Index is 0-based. It is the index of the cap item. - * @return {string} - */ - GetCapItemsString(index: number): string; - - // Get custom DS data, and returned string is encoded with base64 - /** - * Gets custom DS data, the returned string is base64 encoded. - * @method WebTwain#GetCustomDSDataEx - * @return {string | boolean} - */ - GetCustomDSDataEx(): string | boolean; - - // Get custom DS data, and save the data to the specified file - /** - * Gets custom DS data and save the data in a specified file. - * @method WebTwain#GetCustomDSData - * @param {string} fileName the path of the file used for storing custom DS data. - * @return {boolean} - */ - GetCustomDSData(fileName: string): boolean; - - /** - * Retrieve the device type of the currently selected data source, it might be a scanner, a web camera, etc. - * @method WebTwain#GetDeviceType - * @return {number | boolean} - */ - GetDeviceType(): number | boolean; - - /** - * Returns the pixel bit depth of the selected image. - * @method WebTwain#GetImageBitDepth - * @param {number} sImageIndex specifies the index of image. The index is 0-based. - * @return {number} - */ - GetImageBitDepth(sImageIndex: number): number; - - /** - * Returns the height (pixels) of the selected image. This is a read-only property. - * @method WebTwain#GetImageHeight - * @param {number} sImageIndex specifies the index of image. The index is 0-based. - * @return {number} - */ - GetImageHeight(sImageIndex: number): number; - - /** - * Returns the direct URL of an image specified by index, if iWidth and iHeight are not specified, you get the original image, otherwise you get the image with specified iWidth or iHeight while keeping the same aspect ratio. The returned string is like this 'dwt://dwt_trial_13000404/img?id=306159652&index=0&t=1502184632022' - * @method WebTwain#GetImagePartURL - * @param {number} index the index of the image. - * @param {number} iWidth the width of the image, it must be 150 or bigger - * @param {number} iHeight the height of the image, it must be 150 or bigger - * @return {string} - */ - GetImagePartURL(index: number, iWidth?: number, iHeight?: number): string; - - /** - * Returns the file size of the new image resized from the image of a specified index in buffer. - * @method WebTwain#GetImageSize - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} iWidth specifies the pixel width of the new image. - * @param {number} iHeight specifies the pixel height of the new image. - * @return {number} - */ - GetImageSize(sImageIndex: number, iWidth: number, iHeight: number): number; - - /** - * Pre-calculate the file size of the local image file that is saved from an image of a specified index in buffer. - * @method WebTwain#GetImageSizeWithSpecifiedType - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {EnumDWT_ImageType} sImageType specifies the type of an image file.. - * @return {number} - */ - GetImageSizeWithSpecifiedType(sImageIndex: number, sImageType: EnumDWT_ImageType): number; - - /** - * Returns the direct URL of an image specified by index, if iWidth or iHeight is set to -1, you get the original image, otherwise you get the image with specified iWidth or iHeight while keeping the same aspect ratio. - * @method WebTwain#GetImageURL - * @param {number} index the index of the image. - * @param {number} iWidth the width of the image. - * @param {number} iHeight the height of the image. - * @return {string} - */ - GetImageURL(index: number, iWidth: number, iHeight: number): string; - - /** - * Returns the width (pixels) of the selected image. This is a read-only property. - * @method WebTwain#GetImageWidth - * @param {number} sImageIndex specifies the index of image. The index is 0-based. - * @return {number} - */ - GetImageWidth(sImageIndex: number): number; - - /** - * Return the horizontal resolution of the specified image. - * @method WebTwain#GetImageXResolution - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {number} - */ - GetImageXResolution(sImageIndex: number): number; - - /** - * Return the vertical resolution of the specified image. - * @method WebTwain#GetImageYResolution - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {number} - */ - GetImageYResolution(sImageIndex: number): number; - - /** - * Return the runtime license info. - * @method WebTwain#GetLicenseInfo - */ - GetLicenseInfo(optionalAsyncSuccessFunc?: (result: any) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Returns the index of the selected image. - * @method WebTwain#GetSelectedImageIndex - * @param {number} sSelectedIndex specifies the index of the selected image. - * @return {number} - */ - GetSelectedImageIndex(sSelectedIndex: number): number; - - /** - * Pre-calculate the file size of the local image file that is saved from the selected images in buffer. - * @method WebTwain#GetSelectedImagesSize - * @param {EnumDWT_ImageType} iImageType specifies the type of an image file. - * @return {number} - */ - GetSelectedImagesSize(iImageType: EnumDWT_ImageType): number; - - /** - * Check the skew angle of an image by its index in buffer. - * @method WebTwain#GetSkewAngle - * @param {number} sImageIndex the index of the image in the buffer. - * @return {number} - */ - GetSkewAngle(sImageIndex: number): number; - - /** - * Check the skew angle of a rectangular part of an image by its index in buffer. - * @method WebTwain#GetSkewAngleEx - * @param {number} sImageIndex the index of the image in the buffer. - * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @return {number} - */ - GetSkewAngleEx(sImageIndex: number, left: number, top: number, right: number, bottom: number): number; - - /** - * Get the source name according to the source index. - * @method WebTwain#GetSourceNameItems - * @param {number} index number index. Index is 0-based and can not be greater than SourceCount property. - * @return {string} - */ - GetSourceNameItems(index: number): string; - - /*ignored - GetSourceNames - GetSourceType - GetVersionInfoAsync - */ - - /** - * Downloads an image from the HTTP server. - * @method WebTwain#HTTPDownload - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile the name of the image to be downloaded. It should be the relative path of the file on the HTTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPDownload(HTTPServer: string, HTTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Directly downloads a file from the HTTP server to a local disk without loading it into Dynamic Web TWAIN. - * @method WebTwain#HTTPDownloadDirectly - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile The relative path of the file on the HTTP server. - * @param {string} localFile specify the location to store the downloaded file. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPDownloadDirectly(HTTPServer: string, HTTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Downloads an image from the HTTP server. - * @method WebTwain#HTTPDownloadEx - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) - * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPDownloadEx(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /*ignored - HTTPDownloadStreamThroughPost - HTTPDownloadThroughGet - */ - - /** - * Download an image from the server using a HTTP Post call. - * @method WebTwain#HTTPDownloadThroughPost - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) - * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads just a form created by SetHTTPFormField and SetHTTPHeader - * @method WebTwain#HTTPUpload - * @param {string} url the url where the images are sent in a POST request. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUpload(url: string, asyncSuccessFunc: (httppostresponsestring: string) => void, asyncFailureFunc: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads the images specified by the indices to the HTTP server. - * @method WebTwain#HTTPUpload - * @param {string} url the url where the images are sent in a POST request. - * @param {Array} indices indices specifies which images are to be uploaded. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded. - * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUpload(url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, asyncSuccessFunc: (httppostresponsestring: string) => void, asyncFailureFunc: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadAllThroughPostAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadAllThroughPostAsPDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadAllThroughPutAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadAllThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadAllThroughPutAsPDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadAllThroughPutAsPDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /*ignored - HTTPUploadStreamThroughPost - */ - - /** - * Uploads the image of a specified index in the buffer to the HTTP server through the HTTP POST method. - * @method WebTwain#HTTPUploadThroughPost - * @param {string} HTTPServer the name of the HTTP server. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadThroughPostAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadThroughPostAsMultiPagePDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN. - * @method WebTwain#HTTPUploadThroughPostDirectly - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} localFile specifies the path of a local file . - * @param {string} ActionPage the specified page for posting files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the file to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method. - * @method WebTwain#HTTPUploadThroughPostEx - * @param {string} HTTPServer the name of the HTTP server. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.s - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method. - * @method WebTwain#HTTPUploadThroughPut - * @param {string} HTTPServer the name of the HTTP server. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} RemoteFileName the name of the image to be created on the HTTP server. It should a relative path on the web server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadThroughPut(HTTPServer: string, sImageIndex: number, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadThroughPutAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadThroughPutAsMultiPagePDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadThroughPutAsMultiPagePDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN. - * @method WebTwain#HTTPUploadThroughPutDirectly - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} localFile specifies the path of a local file. - * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadThroughPutDirectly(HTTPServer: string, localFile: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP PUT method. - * @method WebTwain#HTTPUploadThroughPutEx - * @param {string} HTTPServer the name of the HTTP server. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. - * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadThroughPutEx(HTTPServer: string, sImageIndex: number, RemoteFileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Detects whether an image is blank. - * @method WebTwain#IsBlankImage - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - IsBlankImage(sImageIndex: number): boolean; - - /** - * [Deprecated.] Detects whether a certain area on an image is blank. - * @method WebTwain#IsBlankImageEx - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @param {boolean} bFuzzyMatch specifies whether use fuzzy matching when detecting. - * @return {boolean} - */ - IsBlankImageEx(sImageIndex: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean; - - /** - * Detects whether a specific image is blank. - * @method WebTwain#IsBlankImageExpress - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - IsBlankImageExpress(sImageIndex: number): boolean; - - /** - * Loads a DIB format image from Clipboard into the Dynamic Web TWAIN. - * @method WebTwain#LoadDibFromClipboard - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - LoadDibFromClipboard(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Loads an image into the Dynamic Web TWAIN. - * @method WebTwain#LoadImage - * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - LoadImage(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Loads an image into the Dynamic Web TWAIN. - * @method WebTwain#LoadImageEx - * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. - * @param {EnumDWT_ImageType} lImageType the image format of the file to be loaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - LoadImageEx(localFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Loads image from a base64 byte array with the specified file format. - * @method WebTwain#LoadImageFromBase64Binary - * @param {string} bry specifies the base64 string data. - * @param {EnumDWT_ImageType} lImageType specifies the file format. - * @return {boolean} - */ - LoadImageFromBase64Binary(bry: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Loads image from a byte array with the specified file format. - * @method WebTwain#LoadImageFromBytes - * @param {number} lBufferSize Specifies the buffer size. - * @param {Array} buffer A byte array of the image data. - * @param {EnumDWT_ImageType} lImageType Specifies the file format. - * @return {boolean} - */ - LoadImageFromBytes(lBufferSize: number, buffer: number[], lImageType: EnumDWT_ImageType): boolean; - - /** - * Mirrors the image of a specified index in buffer. - * @method WebTwain#Mirror - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - Mirror(sImageIndex: number): boolean; - - /** - * Moves a specified image. - * @method WebTwain#MoveImage - * @param {number} sSourceImageIndex Specifies the source index of image in buffer. The index is 0-based. - * @param {number} sTargetImageIndex Specifies the target index of image in buffer. The index is 0-based. - * @return {boolean} - */ - MoveImage(sSourceImageIndex: number, sTargetImageIndex: number): boolean; - - /*ignored - OnRefreshUI - */ - - /** - * Loads the specified Source into main memory and causes its initialization, - * placing Dynamic Web TWAIN into Capability Negotiation state. If no source is - * specified (no SelectSource() or SelectSourceByIndex() is called), opens the default source. - * @method WebTwain#OpenSource - * @return {boolean} - */ - OpenSource(): boolean; - - /** - * Loads and opens Data Source Manager. - * @method WebTwain#OpenSourceManager - * @return {boolean} - */ - OpenSourceManager(): boolean; - - /** - * Decorates image of a specified index in buffer with rectangles of transparent color. - * @method WebTwain#OverlayRectangle - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @param {number} color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red. - * @param {number} fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent. - * @return {boolean} - */ - OverlayRectangle(sImageIndex: number, left: number, top: number, right: number, bottom: number, color: number, fOpacity: number): boolean; - - /** - * Shows the GUI of Image Printer. - * @method WebTwain#Print - * @param {boolean} bUseSystemDefaultPrintUI specifies whether to use the system Print UI or not. - * @return {boolean} - */ - Print(bUseSystemDefaultPrintUI: boolean): boolean; - - /** - * Binds a specified function to an event, so that the function gets called whenever the event fires. - * @method WebTwain#RegisterEvent - * @param {string} name the name of the event that the function is bound to. - * @param {any} evt specifies the function to call when event fires. - * @return {boolean} - */ - RegisterEvent(name: string, evt: any): boolean; - - /** - * Removes all images in buffer. - * @method WebTwain#RemoveAllImages - * @return {boolean} - */ - RemoveAllImages(): boolean; - - /** - * Removes selected images in buffer. - * @method WebTwain#RemoveAllSelectedImages - * @return {boolean} - */ - RemoveAllSelectedImages(): boolean; - - /** - * Removes the image of a specified index in buffer. - * @method WebTwain#RemoveImage - * @param {number} sImageIndexToBeDeleted specifies the index of the image to be deleted in buffer. The index is 0-based. - * @return {boolean} - */ - RemoveImage(sImageIndexToBeDeleted: number): boolean; - - /** - * Reverts the current image layout to the Data Source's default. - * @method WebTwain#ResetImageLayout - * @return {boolean} - */ - ResetImageLayout(): boolean; - - /** - * Sets the Source to return the current page to the input side of the document feeder and - * feed the last page from the outside of the feeder back into the acquisition area if IfFeederEnabled is TRUE. - * @method WebTwain#RewindPage - * @return {boolean} - */ - RewindPage(): boolean; - - /** - * Rotates the image of a specified index in buffer by specified angle. - * @method WebTwain#Rotate - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} fAngle Specifies the rotation angle. - * @param {boolean} bKeepSize Keep size or not. - * @return {boolean} - */ - Rotate(sImageIndex: number, fAngle: number, bKeepSize: boolean): boolean; - - /** - * Rotates the image of a specified index in buffer by specified angle. - * @method WebTwain#RotateEx - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} fAngle Specifies the rotation angle. - * @param {boolean} bKeepSize Keep size or not. - * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. - * @return {boolean} - */ - RotateEx(sImageIndex: number, fAngle: number, bKeepSize: boolean, newVal: EnumDWT_InterpolationMethod): boolean; - - /** - * Rotates the image of a specified index in buffer by 90 degrees counter-clockwise. - * @method WebTwain#RotateLeft - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - RotateLeft(sImageIndex: number): boolean; - - /** - * Rotates the image of a specified index in buffer by 90 degrees clockwise. - * @method WebTwain#RotateRight - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - RotateRight(sImageIndex: number): boolean; - - /** - * Saves all images in buffer as a MultiPage TIFF file. - * @method WebTwain#SaveAllAsMultiPageTIFF - * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - SaveAllAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves all images in buffer as a Multi-Page PDF file. - * @method WebTwain#SaveAllAsPDF - * @param {string} localFile the name of the Multi-Page PDF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - SaveAllAsPDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the image of a specified index in buffer as a BMP file. - * @method WebTwain#SaveAsBMP - * @param {string} localFile the name of the BMP file to be saved. It should be an absolute path on the local disk. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SaveAsBMP(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /*ignored - SaveAsGIF - */ - - /** - * Saves the image of a specified index in buffer as a JPEG file. - * @method WebTwain#SaveAsJPEG - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SaveAsJPEG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the image of a specified index in buffer as a PDF file. - * @method WebTwain#SaveAsPDF - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SaveAsPDF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the image of a specified index in buffer as a PNG file. - * @method WebTwain#SaveAsPNG - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SaveAsPNG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the image of a specified index in buffer as a TIFF file. - * @method WebTwain#SaveAsTIFF - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SaveAsTIFF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the selected images in buffer as a Multipage PDF file. - * @method WebTwain#SaveSelectedImagesAsMultiPagePDF - * @param {string} localFile the name of the MultiPage PDF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - SaveSelectedImagesAsMultiPagePDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the selected images in buffer as a Multipage TIFF file. - * @method WebTwain#SaveSelectedImagesAsMultiPageTIFF - * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - SaveSelectedImagesAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the selected images in buffer to base64 string. - * @method WebTwain#SaveSelectedImagesToBase64Binary - * @return {string|boolean} - */ - SaveSelectedImagesToBase64Binary(optionalAsyncSuccessFunc?: (result: string[]) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): string | boolean; - - /** - * [Deprecated.] Saves the selected images in buffer to a byte array in the specified file format. - * @method WebTwain#SaveSelectedImagesToBytes - * @param {number} bufferSize specified the buffer size. - * @param {Array} buffer A byte array of the image data. - * @return {number} - */ - SaveSelectedImagesToBytes(bufferSize: number, buffer: number[]): number; - - /** - * Brings up the TWAIN Data Source Manager's Source Selection User Interface (UI) - * so that user can choose which Data Source to be the current Source. - * @method WebTwain#SelectSource - * @return {boolean} - */ - SelectSource(): boolean; - - /** - * Selects the index-the source in SourceNameItems property as the current source. - * @method WebTwain#SelectSourceByIndex - * @param {number} index It is the index of SourceNameItems property. - * @return {boolean} - */ - SelectSourceByIndex(index: number): boolean; - - /*ignored - SetCancel - */ - - /** - * Set the value of the specified cap item. - * @method WebTwain#SetCapItems - * @param {number} index Index is 0-based. It is the index of the cap item. - * @param {number} newVal For string type, please use CapItemsstring property. - * @return {void} - */ - SetCapItems(index: number, newVal: number): void; - - /** - * Set the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. - * @method WebTwain#SetCapItemsString - * @param {number} index Index is 0-based. It is the index of the cap item. - * @param {string} newVal The new value to be set. - * @return {void} - */ - SetCapItemsString(index: number, newVal: string): void; - - /** - * [Deprecated.] Sets current cookie into the Http Header to be used when uploading scanned images through POST. - * @method WebTwain#SetCookie - * @param {string} cookie the cookie on current page. - * @return {void} - */ - SetCookie(cookie: string): void; - - // Set custom DS data (DAT_CUSTOMDSDATA), the input string is encoded with base64 - /** - * Sets custom DS data to be used for scanning, the input string is encoded with base64. Custom DS data means a specific scanning profile. - * @method WebTwain#SetCustomDSDataEx - * @param {string} value the input string which is encoded with base64. - * @return {boolean} - */ - SetCustomDSDataEx(value: string): boolean; - - // Set custom DS data, load data from the specified file - /** - * Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile. - * @method WebTwain#SetCustomDSData - * @param {string} fileName the absolute path of the file where the custom data source data is stored. - * @return {boolean} - */ - SetCustomDSData(fileName: string): boolean; - - /** - * Change the DPI (dots per inch) for the specified image. - * @method WebTwain#SetDPI - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} xResolution The horizontal resolution. - * @param {number} yResolution The vertical resolution. - * @param {boolean} bResampleImage Whether to resample the image. (The image size will be changed if this is set to true). - * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. - * @return {boolean} - */ - SetDPI(sImageIndex: number, xResolution: number, yResolution: number, bResampleImage: boolean, newVal: EnumDWT_InterpolationMethod): boolean; - - /** - * Sets file name and file format information used in File Transfer Mode. - * @method WebTwain#SetFileXferInfo - * @param {string} fileName the name of the file to be used in transfer. - * @param {EnumDWT_FileFormat} fileFormat an enumerated value indicates the format of the image. - * @return {boolean} - */ - SetFileXferInfo(fileName: string, fileFormat: EnumDWT_FileFormat): boolean; - - /** - * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images. - * @method WebTwain#SetHTTPFormField - * @param {string} FieldName specifies the name of a text field in web form. - * @param {string} FieldValue specifies the value of a text field in web form. - * @return {boolean} - */ - SetHTTPFormField(FieldName: string, FieldValue: string): boolean; - - /** - * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images. - * @method WebTwain#SetHTTPFormField - * @param {string} FieldName specifies the name of the field which could later be used to retrieve the blob - * @param {Blob} blobValue specifies the blob to be put in the form. - * @param {string} optionalFileName specifies the file name for the blob - * @return {boolean} - */ - SetHTTPFormField(FieldName: string, blobValue: Blob, optionalFileName?: string): boolean; - - /** - * Sets a header for the current HTTP Post request. - * @method WebTwain#SetHTTPHeader - * @param {string} key the key of the header. - * @param {string} value the value of the header. - * @return {boolean} - */ - SetHTTPHeader(key: string, value: string): boolean; - - /** - * Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source. - * @method WebTwain#SetImageLayout - * @param {number} left specifies the floating point number for the left side of the image layout rectangle. - * @param {number} top specifies the floating point number for the top side of the image layout rectangle. - * @param {number} right specifies the floating point number for the right side of the image layout rectangle. - * @param {number} bottom specifies the floating point number for the bottom side of the image layout rectangle. - * @return {boolean} - */ - SetImageLayout(left: number, top: number, right: number, bottom: number): boolean; - - /** - * Change the width of an image in buffer. - * @method WebTwain#SetImageWidth - * @param {number} sImageIndex specifies which image you'd like to change. - * @param {number} iNewWidth specifies how wide you'd like to change the image. - * @return {boolean} - */ - SetImageWidth(sImageIndex: number, iNewWidth: number): boolean; - - /** - * Set the language for the authorization dialogs. - * @method WebTwain#SetLanguage - * @param {EnumDWT_Language} language specify the language - * @return {boolean} - */ - SetLanguage(language: EnumDWT_Language): boolean; - - /** - * Sets the time-out used to open a specified Data Source. - * @method WebTwain#SetOpenSourceTimeout - * @param {number} iMilliseconds specifies the number of milliseconds. - * @return {boolean} - */ - SetOpenSourceTimeout(iMilliseconds: number): boolean; - - /** - * Draws a rectangle on the viewer which represents the selected area. - * @method WebTwain#SetSelectedImageArea - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} left The X axis of the left border. - * @param {number} top The Y axis of the top border. - * @param {number} right The X axis of the right border. - * @param {number} bottom The Y axis of the bottom border. - * @return {boolean} - */ - SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * You can use the method to select images programatically which is ususally done by mouse clicking. - * @method WebTwain#SetSelectedImageIndex - * @param {number} sSelectedIndex this is the index of an array that holds the indices of selected images. - * @param {number} newVal specifies the index of an image that you want to select. - * @return {boolean} - */ - SetSelectedImageIndex(selectedIndex: number, newVal: number): boolean; - - /** - * Sets a custom tiff tag. Currently you can set up to 32 tags. The string to be set in a tag can be encoded with base64. - * @method WebTwain#SetTiffCustomTag - * @param {number} tag specifies the tag identifier. The value should be between 600 and 700. - * @param {string} content the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, we'll decode it before writing it. - * @param {boolean} base64Str if you'd like to encode the string with base64, set this to true. Otherwise, the string will be plin text. - * @return {boolean} - */ - SetTiffCustomTag(tag: number, content: string, base64Str: boolean): boolean; - - /** - * Configures how segmented upload is done. - * @method WebTwain#SetUploadSegment - * @param {number} segmentUploadThreshold specifies the threshold (in MB) over which segmented upload will be invoked. - * @param {number} moduleSize specifies the size of each segment (in KB). - * @return {boolean} - */ - SetUploadSegment(segmentUploadThreshold: number, moduleSize: number): boolean; - - /** - * Sets the view mode that images are displayed in Dynamic Web TWAIN. You can use this method to display multiple images in Dynamic Web TWAIN. - * @method WebTwain#SetViewMode - * @param {number} sHorizontalImageCount specifies how many columns can be displayed in Dynamic Web TWAIN. - * @param {number} sVerticalImageCount specifies how many rows can be displayed in Dynamic Web TWAIN.. - * @return {void} - */ - SetViewMode(sHorizontalImageCount: number, sVerticalImageCount: number): void; - - /** - * Show save file dialog or show open file dialog. - * @method WebTwain#ShowFileDialog - * @param {boolean} SaveDialog True -- show save file dialog, False -- show open file dialog. - * @param {string} Filter The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically. - * @param {number} FilterIndex The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based. - * @param {string} DefExtension Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended. - * @param {string} InitialDir The initial directory. The algorithm for selecting the initial directory varies on different platforms. - * @param {boolean} AllowMultiSelect True -- allows users to select more than one file, False -- only allows to select one file. - * @param {boolean} OverwritePrompt True -- If a file already exists with the same name, the old file will be simply overwritten, False -- not allows to save and overwrite a same name file. - * @param {number} Flags If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and parameters "AllowMultiSelect" and "OverwritePrompt" will be useless. - * @return {boolean} - */ - ShowFileDialog(SaveDialog: boolean, Filter: string, FilterIndex: number, DefExtension: string, InitialDir: string, AllowMultiSelect: boolean, OverwritePrompt: boolean, Flags: number): boolean; - - /** - * Shows the GUI of Image Editor. - * @method WebTwain#ShowImageEditor - * @return {boolean} - */ - ShowImageEditor(): boolean; - - /** - * [Deprecated.] Shows the GUI of Image Editor with custom settings. - * @method WebTwain#ShowImageEditorEx - * @param {number} x specifies the new position of the left top corner of the window. - * @param {number} y specifies the new position of the left top corner of the window. - * @param {number} cx specifies the width of the window. - * @param {number} cy specifies the height of the window. - * @param {number} nCmdShow specifices how the window should be shown. - * @return {boolean} - */ - ShowImageEditorEx(x: number, y: number, cx: number, cy: number, nCmdShow: number): boolean; - - /*ingored - SourceNameItems - */ - - /** - * Switchs two images of specified indices in buffer. - * @method WebTwain#SwitchImage - * @param {number} sImageIndex1 specifies the index of image in buffer. The index is 0-based. - * @param {number} sImageIndex2 specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SwitchImage(sImageIndex1: number, sImageIndex2: number): boolean; - - /** - * Unbinds an event from the specified function, so that the function stops receiving notifications when the event fires. - * @method WebTwain#UnregisterEvent - * @param {string} name the name of the event. - * @param {object} evt specified the function to be unbound. - * @return {boolean} - */ - UnregisterEvent(name: string, evt: object): boolean; - - /*ignored - checkErrorString - first - getInstance - last - next - on - onEvent - previous - - ...other internal ones - */ -} +// TypeScript Version: 2.4 + +/// +/// +/// +/// +/// +/// +/// +/// diff --git a/types/dwt/mbc.d.ts b/types/dwt/mbc.d.ts new file mode 100644 index 0000000000..3c27fd8ac0 --- /dev/null +++ b/types/dwt/mbc.d.ts @@ -0,0 +1,1047 @@ +/**`constructor` MBC() + * Syntax:* `new MBC(license)` + * | parameter | type | description | + * | | | | + * | license | `String` | | + * example:* +```javascript + // MBC without a license can be used for evaluation purposes. It is not stable for long time usage. + var painter = new MBC(); + // MBC need a license in production environments. + painter = new MBC('xxxxx'); +``` + */ +declare namespace MBC { + /** + * Tell this painter the directory where you place`cv-wasm.js` and`cv-wasm.wasm`. + + * Syntax:* `MBC.cvFolder = 'js';` + */ + let cvFolder: string; + + /** + * You should call`MBC.loadCvScriptAsync()` first before use`Free Transform` and`Brush` module. + + * Syntax:* `MBC.loadCvScriptAsync(callback)` + + | parameter | type | description | + | | | | + | callback | `function(boolean bSuccess)` | | + + @example +```javascript + MBC.loadCvScriptAsync(function(bSuccess){ + if(bSuccess){ + console.log('load cv script success.'); + painter.enterFreeTransformModeAsync(); + }else{ + console.log('load cv script fail.'); + } + }); +``` + */ + function loadCvScriptAsync(): any; +} + +interface rectangle { + left: number; + top: number; + right: number; + bottom: number; +} + +interface point { + x: number; + y: number; +} + +interface cornerPoints { + leftTop: point; + rightTop: point; + leftBottom: point; + rightBottom: point; +} + +declare class TaskQueue { + _queue: any[]; + isWorking: boolean; + timeout: number; + /** + * Constructs a new task queue + */ + constructor(); +} + +interface TaskQueue { + push(task: any, context?: any, args?: any): void; + unshift(task: any, context?: any, args?: any): void; + next(): void; +} + +declare class KPainter { + /** + * Constructs a new KPainter + */ + constructor(mbcKey?: string); + /** + * @example +```javascript + var painterDom = painter.getHtmlElement(); + painterDom.style.width = '100%'; + painterDom.style.height = '100%'; + document.getElementById('painter-container').appendChild(painterDom); +``` + * + */ + getHtmlElement(): HTMLDivElement; + + /** + * Get the current showing image index a in MBC instance. + */ + getCurIndex(): number; + + /** + * Get the image count in a MBC instance. + */ + getCount(): number; + + /** + * Identify whether the MBC instance is in `Editing` mode. + */ + isEditing(): boolean; + + /** + * +@example +```javascript + // A way to access to inner data. Don't modify it if you are not sure. + var imgOri = painter.getImage(true); + // This image can be used in any place and free to modify it. + var imgCopyed = painter.getImage(); + imgCopyed.style.width = '100px'; + imgCopyed.style.height = '100px'; + document.getElementById('image-container').appendChild(imgCopyed); +``` + */ + getImage(isOri: boolean, index: number): HTMLImageElement; + + /** + * Binding a function that would be called when starting an expensive operation. + * Syntax:* `function(){}` +@example +```javascript + painter.onStartLoading = function(){ + document.getElementById('animation').show(); + }; +``` + */ + onStartLoading: () => void; + + /** + * Binding a function that would be called when finishing an expensive operation. + + * Syntax:* `function(){}` + + @example```javascript + painter.onFinishLoading = function(){ + document.getElementById('animation').hide(); + }; + ``` + */ + onFinishLoading: () => void; + + // Image Store + + /** + * Show file choose window by click the hidden file input.Can't process during `Editing` mode. + * @example +```javascript + document.getElementById('btn-add-image').addEventListener('click', function(){ + painter.showFileChooseWindow(); + }); +``` + */ + showFileChooseWindow(): boolean; + + /** + * @example +```javascript + // warning: never redefine it if you are not sure + // painter.defaultFileInput = document.createElement('input'); + painter.defaultFileInput.accept = "image/png"; + painter.defaultFileInput.multiple = false; +``` + */ + defaultFileInput: HTMLInputElement; + + /** + * Binding a function that would be called when`defaultFileInput` change by`showFileChooseWindow()`. + + * Syntax:* `function(event, callback){}` + + @example +```javascript + painter.beforeAddImgFromFileChooseWindow = function(ev, callback){ + var files = ev.target.files; + var newBlobs = []; + var finishedIndex = 0; + for(var i = 0; i < files.length; ++i){ + var file = files[i]; + doSomeWorkToGetANewBlob(file, function(blob){ + newBlobs.push(blob); + if(files.length == ++finishedIndex){ + callback(newBlobs); + } + }); + } + }; +``` + */ + beforeAddImgFromFileChooseWindow: () => void; + + /** + * Binding a function that would be called after adding image from`defaultFileInput`. + + * Syntax:* `function(){}` + + @example +```javascript + painter.afterAddImgFromFileChooseWindow = function(bSuccess){ + if(bSuccess){console.log('The new image(s) has been added from file choose window.');} + }; +``` + */ + afterAddImgFromFileChooseWindow: () => void; + + /*** + * Syntax:* `function(event, callback){}` + @example +```javascript + painter.beforeAddImgFromDropFile = function(ev, callback){ + var files = ev.dataTransfer.files; + var newBlobs = []; + var finishedIndex = 0; + for(var i = 0; i < files.length; ++i){ + var file = files[i]; + doSomeWorkToGetANewBlob(file, function(blob){ + newBlobs.push(blob); + if(files.length == ++finishedIndex){ + callback(newBlobs); + } + }); + } + }; +``` + */ + beforeAddImgFromDropFile: () => any; + + /** + * + * Syntax:* `function(){}` + + @example +```javascript + painter.afterAddImgFromDropFile = function(bSuccess){ + if(bSuccess){console.log('The new image(s) has been added from dropping.');} + }; +``` + * + */ + afterAddImgFromDropFile: () => void; + + /** + * Syntax:* `.addImageAsync(imgData, callback)` + + | parameter | type | description | + | | | | + | imgData | `Blob`, `HTMLCanvasElement`, `HTMLImageElement`, `String` * (url) *, `Array` * (a array of source)*, `FileList` | | + | callback * (optional) * | `function(bSuccess)` | | + + @example +```javascript + painter.addImageAsync(image, function(bSuccess){ + console.log('Add success'); + }); +``` + */ + addImageAsync(imgData: Blob | HTMLCanvasElement | HTMLImageElement | string | string[], callback?: () => void): void; + + /** + The image whose width or height larger than`addedImageMaxWH` would be compressed when adding. + + * Syntax:* `.addedImageMaxWH = 4096;` + */ + addedImageMaxWH: number; + + /** + * Whether`changePage` to the new added image. + + * Syntax:* `.isShowNewImgWhenAdd = true;` + */ + isShowNewImgWhenAdd: boolean; + + /** + * Update the`htmlElement` of a MBC instance.Should call it manually when the`htmlElement` resize. + + * Syntax:* `.updateUIOnResize(isLazy, callback)` + + | parameter | type | description | + | | | | + | isLazy * (optional) *| `boolean` | Default false.Set true to avoid to update too frequently. | + | callback | `function()` | Callback of finish updating.Might abort the earlier callback when`isLazy` is true. | + + @example +```javascript + window.addEventListener('resize',function(){ + painter.updateUIOnResize(true, function(){ + console.log('painter update'); + }); + }); +``` + */ + updateUIOnResize(isLazy?: boolean, callback?: () => void): void; + + /** + * Binding a function that would be called when current image index or total length change. + + * Syntax:* `function(Number curIndex, Number length){}` + + @example +```javascript + painter.onNumChange = function(curIndex, length){ + console.log('curIndex: '+curIndex+', length:'+length); + }; +``` + */ + onNumChange: (curIndex: number, length: number) => void; + + /** + * Change index of the current page.Can only process in `Viewing` mode. + + * Syntax:* `.changePage(cmd)` + + | parameter | type | description | + | | | | + | * (return value)* | `boolean` | | + | cmd | `Number` * (index) *, `String` * ('f', 'p', 'n', 'l') * | Index number, or command string of 'f'(first), 'p'(pre), 'n'(next), 'l'(last). | + + @example +```javascript + document.getElementById('btn-first').addEventListener('click', function(){ + painter.changePage('f'); + }); + document.getElementById('btn-pre').addEventListener('click', function(){ + painter.changePage('p'); + }); + document.getElementById('btn-next').addEventListener('click', function(){ + painter.changePage('n'); + }); + document.getElementById('btn-last').addEventListener('click', function(){ + painter.changePage('l'); + }); + document.getElementById('btn-toThisPage').addEventListener('click', function(){ + painter.changePage(parseInt(document.getElementById('ipt-page').value)); + }); +``` + */ + changePage(cmd: number | string): boolean; + + /** + * Delete a image.Can only process in `Viewing` mode. + + * Syntax:* `.del(index)` + + | parameter | type | description | + | | | | + | * (return value)* | `boolean` | | + | index * (optional) * | `Number` | Default current index. | + + */ + del(index: number): boolean; + + /** + * Get width of current image in the MBC instance. + + * Syntax:* `.getWidth(index)` + + | parameter | type | description | + | | | | + | * (return value)* | `Number` | | + | index * (optional) * | `Number` | Default current index. | + */ + getWidth(index: number): number; + + /** + * Get height of current image in the MBC instance. + + * Syntax:* `.getHeight(index)` + + | parameter | type | description | + | | | | + | * (return value)* | `Number` | | + | index * (optional) * | `Number` | Default current index. | + */ + getHeight(index: number): number; + + /** + * Get the image data in `Blob` type. + + * Syntax:* `.getBlob(index)` + + | parameter | type | description | + | | | | + | * (return value)* | `Number` | | + | index * (optional) * | `Number` | Default current index. | + */ + getBlob(index: number): Blob; + + /** + * Download the image to users' local system. The function should be invoked directly by the user. Async invoking may have problems. + + * Syntax:* `.download(filename, index)` + + | parameter | type | description | + | | | | + | * (return value)* | `Number` | | + | filename * (optional) * | `String` | | + | index * (optional) * | `Number` | Default current index. | + + @example +```javascript + document.getElementById('btn-download').addEventListener('click', function(){ + for(var i = 0; i < painter.getCount(); ++i){ + painter.download(null, i); + } + }); +``` + */ + download(filename?: string, index?: number): number; + + /** + * Syntax:* `.bindThumbnailBox(container, funWrap, maxWH)` + + | parameter | type | description | + | | | | + | * (return value)* | `boolean` | | + | container | `HTMLElement` | | + | funWrap * (optional) * | `HTMLElement function(HTMLCanvasElement cvs)` | | + | maxWH * (optional) * | `Number` | Default 256. | + + @example +```javascript + painter.bindThumbnailBox(document.getElementById('div-thumbnailContainer'), function(cvs){ + console.log(cvs.className);// 'kPainterThumbnailCanvas', never remove this class + var box = document.createElement('div'); + box.className = 'div-thumbnailBox'; + box.appendChild(cvs); + box.addEventListener('click', function(){ + var idx = box.getKPainterIndex();// get index + painter.changePage(idx); + }); + return box; + }); +``` + */ + bindThumbnailBox(container: HTMLElement, funWrap?: () => HTMLElement, maxWH?: number): boolean; + + /** + * Syntax:* `.unbindThumbnailBox(container)` + + | parameter | type | description | + | | | | + | * (return value)* | `boolean` | | + | container | `HTMLElement` | | + + @example +```javascript + painter.bindThumbnailBox(document.getElementById('div-thumbnailContainer')); +``` + */ + unbindThumbnailBox(container: HTMLElement): boolean; + + // Gesture + + /** + * + Set the zoom rate when user left double click. + + * Syntax:* `.leftDoubleClickZoomRate = 2;` + + */ + leftDoubleClickZoomRate: number; + + /** + * Set the zoom rate when user right double click. + + * Syntax:* `.rightDoubleClickZoomRate = 0.5;` + */ + rightDoubleClickZoomRate: number; + + /** + * Whether allow switch from last to first or from first to last by`touchmove` gesture. + + * Syntax:* `.allowedTouchMoveSwitchImgOverBoundary = true;` + */ + allowedTouchMoveSwitchImgOverBoundary: boolean; + + /** + * Binding a function that would be called when the performence of the current image or canvas(in `Editing` mode) update. + + * Syntax:* `function(){}` + + @example +```javascript + painter.onUpdateImgPosZoom(function(){ + console.log(painter.getZoom()); + console.log(painter.getEditWidth()); + console.log(painter.getEditHeight()); + }); +``` + */ + onUpdateImgPosZoom: () => void; + + /** + * Get the zoom of current image or canvas(in `Editing` mode). + + * Syntax:* `.getZoom()` + + | parameter | type | description | + | | | | + | * (return value)* | `Number` | | + */ + getZoom(): number; + + /** + * Set the zoom of current image or canvas(in `Editing` mode). + + * Syntax:* `.setZoom(num, isRate)` + + | parameter | type | description | + | | | | + | * (return value)* | `Number` | The finally effective zoom. | + | num | `Number` | | + | isRate | `boolean` | | + */ + setZoom(num: number, isRate: boolean): number; + + // Basic Editor + + /** + * The can - not - store step(freeTransform, brush) will generate a step image.If the step images' count over `stepImgsGCThreshold`, oldest not protected one would be GC. + + * Syntax:* `.stepImgsGCThreshold = 10;` + */ + stepImgsGCThreshold: number; + + /** + * Add a protected step.Then this step would not be GC.Can only process in `Editing` mode. + + * Syntax:* `.addProtectedStep(index)` + + | parameter | type | description | + | | | | + | index | `Number` | | + + @example +```javascript + // sample code: save and give up editing about freeTransform mode + document.getElementById('btn-enterFreeTransformMode').addEventListener('click', function(){ + // pretect step when enter freeTransform mode + painter.addProtectedStep(painter.getCurStep()); + // presume that `MBC.loadCvScriptAsync(callback)` has been called and success + painter.enterFreeTransformModeAsync(); + }); + + document.getElementById('btn-saveFreeTransform').addEventListener('click', function(){ + // remove the the last pretect step + var protectedSteps = painter.getProtectedSteps(); + painter.removeProtectedStep(protectedSteps[protectedSteps.length - 1]); + // transform and exitFreeTransformMode + painter.freeTransformAsync(function(){ + painter.exitFreeTransformModeAsync(); + }); + }); + + document.getElementById('btn-giveUpFreeTransform').addEventListener('click', function(){ + // pretect step when enter freeTransform mode + var protectedSteps = painter.getProtectedSteps(); + var lastPretectedStep = protectedSteps[protectedSteps.length - 1]; + // remove the the last pretect step + painter.removeProtectedStep(lastPretectedStep); + // exitFreeTransformMode + painter.exitFreeTransformModeAsync(function(){ + // jump to the last pretect step + painter.setCurStepAsync(lastPretectedStep); + }); + }); +``` + */ + addProtectedStep(index: number): boolean; + + /** + * Remove a protected step.Then this step can be GC.Can only process in `Editing` mode. + + * Syntax:* `.removeProtectedStep(index)` + + | parameter | type | description | + | | | | + | index | `Number` | | + + */ + removeProtectedStep(index: number): boolean; + + /** + * Get All protected steps.Can only process in `Editing` mode. + + * Syntax:* `.getProtectedSteps()` + + | parameter | type | description | + | | | | + | * (return value)* | `Array` | A array of the protected numbers. | + */ + getProtectedSteps(): number[]; + + /** + * Undo an editing step.Can only process in `Editing` mode. + + * Syntax:* `.undo(callback)` + + | parameter | type | description | + | | | | + | callback | `function(boolean bSuccess)` | | + */ + undo(callback: () => void): void; + + /** + * Redo an editing step.Can only process in `Editing` mode. + + * Syntax:* `.redo(callback)` + + | parameter | type | description | + | | | | + | callback | `function(boolean bSuccess)` | | + */ + redo(callback: () => void): void; + + /** + * Get count of editing steps.Can only process in `Editing` mode. + + * Syntax:* `.getStepCount()` + + | parameter | type | description | + | | | | + | * (return value)* | `Number` | | + */ + getStepCount(): number; + + /** + * Get current editing step.Can only process in `Editing` mode. + + * Syntax:* `.getCurStep()` + + | parameter | type | description | + | | | | + | * (return value)* | `Number` | | + */ + getCurStep(): number; + + /** + * Set current editing step.Can only process in `Editing` mode. + + * Syntax:* `.setCurStepAsync(index, callback)` + + | parameter | type | description | + | | | | + | index | `Number` | | + | callback | `function(boolean bSuccess)` | | + */ + setCurStepAsync(index: number, callback: () => void): void; + + /** + * Enter the`Editing` mode. + + * Syntax:* `.enterEditAsync(callback)` + + | parameter | type | description | + | | | | + | callback | `function(boolean bSuccess)` | | + */ + enterEditAsync(callback: () => void): void; + + /** + * Leave the`Editing` mode without saving change. + + * Syntax:* `.cancelEdit(callback)` + + | parameter | type | description | + | | | | + | * (return value)* | `boolean` | | + */ + cancelEdit(callback: () => void): boolean; + + /** + * Save change and leave the`Editing` mode. + + * Syntax:* `.saveEditAsync(callback, isCover)` + + | parameter | type | description | + | | | | + | callback | `function(boolean bSuccess)` | | + | isCover | `boolean` | | + */ + saveEditAsync(callback: () => void, isCover: boolean): void; + + /** + * Rotate right.Can only process in `Editing` mode. + + * Syntax:* `.rotateRight()` + + | parameter | type | description | + | | | | + | * (return value)* | `boolean` | | + */ + rotateRight(): boolean; + + /** + * Rotate left.Can only process in `Editing` mode. + + * Syntax:* `.rotateLeft()` + + | parameter | type | description | + | | | | + | * (return value)* | `boolean` | | + */ + rotateLeft(): boolean; + + /** + * Mirror.Can only process in `Editing` mode. + + * Syntax:* `.mirror()` + + | parameter | type | description | + | | | | + | * (return value)* | `boolean` | | + */ + mirror(): boolean; + + /** + * Flip.Can only process in `Editing` mode. + + * Syntax:* `.flip()` + + | parameter | type | description | + | | | | + | * (return value)* | `boolean` | | + */ + flip(): boolean; + + /** + * Resize.Can only process in `Editing` mode. + + * Syntax:* `.resizeAsync(newWidth, newHeight, callback)` + + | parameter | type | description | + | | | | + | newWidth | `Number` | | + | newHeight | `Number` | | + | callback | `function(boolean bSuccess)` | | + */ + resizeAsync(newWidth: number, newHeight: number, callback: () => void): void; + + /** + * Get width of current editing canvas. + + * Syntax:* `.getEditWidth()` + + | parameter | type | description | + | | | | + | * (return value)* | `Number` | | + */ + getEditWidth(): number; + + /** + * Get height of current editing canvas. + + * Syntax:* `.getEditHeight()` + + | parameter | type | description | + | | | | + | * (return value)* | `Number` | | + */ + getEditHeight(): number; + + // Crop + + /** + * Whether show`Crop Rect` UI when enter`Editing` mode + + * Syntax:* `.isAutoShowCropUI = true;` + */ + isAutoShowCropUI: boolean; + + /** + Show`Crop Rect`.Can only process in `Editing` mode. + + * Syntax:* `.showCropRect()` + */ + showCropRect(): void; + + /** + * Hide`Crop Rect`.Can only process in `Editing` mode. + + * Syntax:* `.hideCropRect()` + */ + hideCropRect(): void; + + /** + * Default 0. + 0: touch / click moving inside`Crop Rect` will move the back canvas. + 1: touch / click moving inside`Crop Rect` will move the`Crop Rect`. + + * Syntax:* `.setCropRectStyle(styleNo)` + + | parameter | type | description | + | | | | + | * (return value)* | `boolean` | | + | styleNo | `Number` | 0, 1 | + */ + setCropRectStyle(styleNo: number): boolean; + + /** + * `Crop Rect` min width. + + * Syntax:* `.cropRectMinW = 50;` + */ + cropRectMinW: number; + + /** + `Crop Rect` min height. + + * Syntax:* `.cropRectMinH = 50;` + */ + cropRectMinH: number; + + /** + * Binding a function that would be called when the`Crop Rect` change. + + * Syntax:* `function(){}` + + @example +```javascript + painter.onCropRectChange = function(){ + var cropArea = painter.getCropRectArea(true); + document.getElementById('cropWidth').innerText = cropArea[2] - cropArea[0]; + document.getElementById('cropHeight').innerText = cropArea[3] - cropArea[1]; + }; +``` + */ + onCropRectChange: () => void; + + /** + * + * Syntax:* `.setCropRectArea(left, top, right, bottom)` + `Crop Rect` select an area. + + | parameter | type | description | + | | | | + | * (return value)* | `boolean` | | + | left * (optional) * | `Number` | -0.5 ~0.5, default -0.5. | + | top * (optional) * | `Number` | -0.5 ~0.5, default -0.5. | + | right * (optional) * | `Number` | -0.5 ~0.5, default 0.5. | + | bottom * (optional) * | `Number` | -0.5 ~0.5, default 0.5. | + */ + setCropRectArea(left: number, top: number, right: number, bottom: number): boolean; + + /** + * Syntax:* `.getCropRectArea(isAbsolute)` + + | parameter | type | description | + | | | | + | * (return value)* | `Array` | A array of[left, top, right, bottom]. | + | isAbsolute | `boolean` | Default`false`, get precentage(-50 % ~50 %) array. | + + */ + getCropRectArea(isAbsolute: boolean): rectangle[]; + + /** + * Crop the selected area.Can only process in `Editing` mode. + + * Syntax:* `.cropAsync(callback, array)` + + | parameter | type | description | + | | | | + | callback * (optional) * | `function([left, top, right, bottom])` | | + | array * (optional) * | `Array` | A array of[left, top, right, bottom]\(each - 0.5 ~0.5\).Default use an area accroding to`Crop Rect`. | + + */ + cropAsync(callback?: () => void, array?: rectangle[]): void; + + // Free Transform + + /** + * You should call`KPainter.loadCvScriptAsync()` first before use`FreeTransform` mode. + */ + + /** + * Detect a document.Would auto call`setFreeTransformCornerPos()` after detected.Can only process in `FreeTransform` mode. + + * Syntax:* `.documentDetectAsync(callback, importSrc)` + + | parameter | type | description | + | | | | + | callback * (optional) * | `function([[x0,y0], [x1,y1], [x2,y2], [x3,y3]])` | x0, y0...is from - 0.5 to 0.5. | + | importSrc * (optional) * | | TUDO.Not easy enough to use now. | + */ + documentDetectAsync(callback?: () => void, importSrc?: any): void; + + /** + * Set the`FreeTransform` corner position.Can only process in `FreeTransform` mode. + + * Syntax:* `.setFreeTransformCornerPos(cornerPoints)` + + | parameter | type | description | + | | | | + | cornerPoints | `Array` | A array of[[x0, y0], [x1, y1], [x2, y2], [x3, y3]].x0, y0...is from - 0.5 to 0.5. | + + */ + setFreeTransformCornerPos(cornerPoints: cornerPoints): any; + + /** + * Get the`FreeTransform` corner position. + + * Syntax:* `.getFreeTransformCornerPos()` + + | parameter | type | description | + | | | | + | * (return value)* | `Array` | A array of[[x0, y0], [x1, y1], [x2, y2], [x3, y3]].x0, y0...is from - 0.5 to 0.5.| + + */ + getFreeTransformCornerPos(): cornerPoints[]; + + /** + * Binding a function that would be called when the`FreeTransform` corner position change. + + * Syntax:* `function()` + + @example +```javascript + painter.onFreeTransformCornerPosChange = function(){ + console.log(painter.getFreeTransformCornerPos()); + }; +``` + */ + onFreeTransformCornerPosChange: () => void; + + /** + * + * `freeTransformAsync()` is a really expensive operation. `freeTransformMaxWH` would limit the max width and height of the result. + + * Syntax:* `.freeTransformMaxWH = 2048;` + */ + freeTransformMaxWH: number; + + /** + * + Transform the quadrilateral surround by the`FreeTransform` corner into a rectangle.Can only process in `FreeTransform` mode. + + * Syntax:* `.freeTransformAsync(callback, cornerPoints, importSrc)` + + | parameter | type | description | + | | | | + | callback * (optional) * | `function(boolean bSuccess)` | | + | cornerPoints * (optional) * | `Array` | A array of[[x0, y0], [x1, y1], [x2, y2], [x3, y3]].x0, y0...is from - 0.5 to 0.5. | + | importSrc * (optional) * | | TUDO.Not show for user. | + */ + freeTransformAsync(callback?: () => void, cornerPoints?: cornerPoints[], importSrc?: any): any; + + /** + * + Enter`FreeTransform` mode.Can only process in `Editing` mode. + + * Syntax:* `.enterFreeTransformModeAsync(callback)` + + | parameter | type | description | + | | | | + | callback * (optional) * | `function(boolean bSuccess)` | | + */ + enterFreeTransformModeAsync(callback: () => void): any; + + /** + * Exist`FreeTransform` mode. + + * Syntax:* `.exitFreeTransformModeAsync(callback)` + + | parameter | type | description | + | | | | + | callback * (optional) * | `function(boolean bSuccess)` | | + */ + exitFreeTransformModeAsync(callback?: () => void): any; + + // Video + + videoSettings: MediaStreamConstraints; + + // `MediaStreamConstraints`.videoSettings + /** + A[MediaStreamConstraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints). + + * reference:* [getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) + + * Syntax:* `.showVideo(callback, videoSettings)` + + | parameter | type | description | + | | | | + | callback * (optional) * | `function(boolean bSuccess)` | | + | videoSettings * (optional) * | `MediaStreamConstraints` | A[MediaStreamConstraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints). *reference:* [getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) | + */ + showVideo(callback?: () => void, videoSettings?: MediaStreamConstraints): boolean; + + /** + * Syntax:* `.grabVideo()` + + Grab a image from the video and return the image. + + | parameter | type | description | + | | | | + | * (return value)* | `HTMLCanvasElement` | | + * Syntax:* `.grabVideo(true, callback)` + + Grab a image from the video and auto add image to the painter.Can only process in `Viewing` mode. + + | parameter | type | description | + | | | | + | callback * (optional) * | `function(boolean bSuccess)` | | + */ + grabVideo(isAutoAdd?: boolean, callback?: () => void): HTMLCanvasElement | void; + + /** + * Syntax:* `.hideVideo()` + */ + hideVideo(): boolean; + + /** + * Syntax:* `function(canvas, callback){}` + + @example +```javascript + painter.beforeAddImgFromGrabVideoBtn = function(canvas, callback){ + doSomeWorkToGetNewSrc(canvas, function(srcValidForAddImage){ + callback(srcValidForAddImage); + }); + }; +``` + */ + beforeAddImgFromGrabVideoBtn: () => void; + + /** + * Syntax:* `function(){}` + + @example +```javascript + painter.afterAddImgFromGrabVideoBtn = function(bSuccess){ + if(bSuccess){console.log('The new image(s) has been added from video.');} + }; +``` + */ + afterAddImgFromGrabVideoBtn: () => void; +} diff --git a/types/dwt/tsconfig.json b/types/dwt/tsconfig.json index 13f35fcfbf..60686cd69f 100644 --- a/types/dwt/tsconfig.json +++ b/types/dwt/tsconfig.json @@ -2,11 +2,12 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -17,8 +18,15 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts", + "addon.ocr.d.ts", + "addon.ocrp.d.ts", "addon.pdf.d.ts", - "dwt-tests.ts" + "addon.webcam.d.ts", + "dbr.d.ts", + "dwt-tests.ts", + "dwt.d.ts", + "index.d.ts", + "Dynamsoft.d.ts", + "mbc.d.ts" ] -} \ No newline at end of file +} diff --git a/types/ember__string/ember__string-tests.ts b/types/ember__string/ember__string-tests.ts index 1f045b849d..500c67546e 100644 --- a/types/ember__string/ember__string-tests.ts +++ b/types/ember__string/ember__string-tests.ts @@ -1,4 +1,4 @@ -import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w } from '@ember/string'; +import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w, isHTMLSafe } from '@ember/string'; import { SafeString } from 'handlebars'; dasherize(); // $ExpectError @@ -36,3 +36,11 @@ loc("_Hello %@ %@", ["John", "Smith"]); // $ExpectType string const handlebarsSafeString: SafeString = htmlSafe('lorem ipsum...'); htmlSafe('lorem ipsum...'); // $ExpectType SafeString const regularString: string = htmlSafe('lorem ipsum...'); // $ExpectError + +function isSafeTest(a: string|Handlebars.SafeString) { + if (isHTMLSafe(a)) { + a = a.toString(); + } + + camelize(a); +} diff --git a/types/ember__string/index.d.ts b/types/ember__string/index.d.ts index 8a2a46c022..66b5199bfd 100644 --- a/types/ember__string/index.d.ts +++ b/types/ember__string/index.d.ts @@ -11,8 +11,8 @@ export function capitalize(str: string): string; export function classify(str: string): string; export function dasherize(str: string): string; export function decamelize(str: string): string; -export function htmlSafe(str: string): Handlebars.SafeString; -export function isHTMLSafe(str: string): boolean; +export function htmlSafe(str: string): SafeString; +export function isHTMLSafe(str: any): str is SafeString; export function loc(template: string, args?: string[]): string; export function underscore(str: string): string; export function w(str: string): string[]; diff --git a/types/emoji-mart/index.d.ts b/types/emoji-mart/index.d.ts index a92bcb77ff..8ea741ca9f 100644 --- a/types/emoji-mart/index.d.ts +++ b/types/emoji-mart/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for emoji-mart 2.8 // Project: https://github.com/missive/emoji-mart -// Definitions by: Jessica Franco +// Definitions by: Jessica Franco // Nick Winans // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/enzyme/enzyme-tests.tsx b/types/enzyme/enzyme-tests.tsx index 0711243d0c..0c7e2c2e90 100644 --- a/types/enzyme/enzyme-tests.tsx +++ b/types/enzyme/enzyme-tests.tsx @@ -35,6 +35,10 @@ interface MyComponentState { stateProperty: string; } +function toComponentType(Component: ComponentClass | StatelessComponent): ComponentClass | StatelessComponent { + return Component; +} + class MyComponent extends Component { handleEcho(value: string) { return value; @@ -59,6 +63,8 @@ const MyStatelessComponent = (props: StatelessProps) => ; const AnotherStatelessComponent = (props: AnotherStatelessProps) => ; +const ComponentType = toComponentType(MyComponent); + // Enzyme.configure function configureTest() { const configureAdapter: { adapter: EnzymeAdapter } = { adapter: {} }; @@ -859,6 +865,14 @@ function ReactWrapperTest() { reactWrapper = new ReactWrapper(, undefined, { attachTo: document.createElement('div') }); reactWrapper = new ReactWrapper(, reactWrapper, { attachTo: document.createElement('div') }); } + + function test_component_type() { + const wrapper1 = shallow(
); + wrapper1.find(ComponentType).props().stringProp; // $ExpectType string + + const wrapper2 = mount(
); + wrapper2.find(ComponentType).props().stringProp; // $ExpectType string + } } // CheerioWrapper diff --git a/types/enzyme/index.d.ts b/types/enzyme/index.d.ts index 0818b4e5ce..58e5938a8f 100644 --- a/types/enzyme/index.d.ts +++ b/types/enzyme/index.d.ts @@ -27,7 +27,9 @@ export interface ComponentClass { new(props: Props, context?: any): Component; } -export type StatelessComponent = (props: Props, context?: any) => JSX.Element; +export type StatelessComponent = (props: Props, context?: any) => JSX.Element | null; + +export type ComponentType = ComponentClass | StatelessComponent; /** * Many methods in Enzyme's API accept a selector as an argument. Selectors in Enzyme can fall into one of the @@ -372,8 +374,8 @@ export class ShallowWrapper

{ * Find every node in the render tree that matches the provided selector. * @param selector The selector to match. */ - find(component: ComponentClass): ShallowWrapper; find(statelessComponent: StatelessComponent): ShallowWrapper; + find(component: ComponentType): ShallowWrapper; find(props: EnzymePropSelector): ShallowWrapper; find(selector: string): ShallowWrapper; @@ -381,8 +383,8 @@ export class ShallowWrapper

{ * Removes nodes in the current wrapper that do not match the provided selector. * @param selector The selector to match. */ - filter(component: ComponentClass): ShallowWrapper; filter(statelessComponent: StatelessComponent): ShallowWrapper; + filter(component: ComponentType): ShallowWrapper; filter(props: EnzymePropSelector | string): ShallowWrapper; /** @@ -394,8 +396,8 @@ export class ShallowWrapper

{ * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector * can be provided and it will filter the children by this selector. */ - children(component: ComponentClass): ShallowWrapper; children(statelessComponent: StatelessComponent): ShallowWrapper; + children(component: ComponentType): ShallowWrapper; children(selector: string): ShallowWrapper; children(props?: EnzymePropSelector): ShallowWrapper; @@ -425,8 +427,8 @@ export class ShallowWrapper

{ * * Note: can only be called on a wrapper of a single node. */ - parents(component: ComponentClass): ShallowWrapper; parents(statelessComponent: StatelessComponent): ShallowWrapper; + parents(component: ComponentType): ShallowWrapper; parents(selector: string): ShallowWrapper; parents(props?: EnzymePropSelector): ShallowWrapper; @@ -436,8 +438,8 @@ export class ShallowWrapper

{ * * Note: can only be called on a wrapper of a single node. */ - closest(component: ComponentClass): ShallowWrapper; closest(statelessComponent: StatelessComponent): ShallowWrapper; + closest(component: ComponentType): ShallowWrapper; closest(props: EnzymePropSelector): ShallowWrapper; closest(selector: string): ShallowWrapper; @@ -487,8 +489,8 @@ export class ReactWrapper

{ * Find every node in the render tree that matches the provided selector. * @param selector The selector to match. */ - find(component: ComponentClass): ReactWrapper; find(statelessComponent: StatelessComponent): ReactWrapper; + find(component: ComponentType): ReactWrapper; find(props: EnzymePropSelector): ReactWrapper; find(selector: string): ReactWrapper; @@ -501,16 +503,16 @@ export class ReactWrapper

{ * Removes nodes in the current wrapper that do not match the provided selector. * @param selector The selector to match. */ - filter(component: ComponentClass): ReactWrapper; filter(statelessComponent: StatelessComponent): ReactWrapper; + filter(component: ComponentType): ReactWrapper; filter(props: EnzymePropSelector | string): ReactWrapper; /** * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector * can be provided and it will filter the children by this selector. */ - children(component: ComponentClass): ReactWrapper; children(statelessComponent: StatelessComponent): ReactWrapper; + children(component: ComponentType): ReactWrapper; children(selector: string): ReactWrapper; children(props?: EnzymePropSelector): ReactWrapper; @@ -526,8 +528,8 @@ export class ReactWrapper

{ * * Note: can only be called on a wrapper of a single node. */ - parents(component: ComponentClass): ReactWrapper; parents(statelessComponent: StatelessComponent): ReactWrapper; + parents(component: ComponentType): ReactWrapper; parents(selector: string): ReactWrapper; parents(props?: EnzymePropSelector): ReactWrapper; @@ -537,8 +539,8 @@ export class ReactWrapper

{ * * Note: can only be called on a wrapper of a single node. */ - closest(component: ComponentClass): ReactWrapper; closest(statelessComponent: StatelessComponent): ReactWrapper; + closest(component: ComponentType): ReactWrapper; closest(props: EnzymePropSelector): ReactWrapper; closest(selector: string): ReactWrapper; diff --git a/types/eslint/eslint-tests.ts b/types/eslint/eslint-tests.ts index ed211d220e..6d175716b3 100644 --- a/types/eslint/eslint-tests.ts +++ b/types/eslint/eslint-tests.ts @@ -539,4 +539,12 @@ ruleTester.run('my-rule', rule, { ] }); +ruleTester.run('simple-valid-test', rule, { + valid: [ + 'foo', + 'bar', + { code: 'foo', options: [{ allowFoo: true }] }, + ] +}); + //#endregion diff --git a/types/eslint/index.d.ts b/types/eslint/index.d.ts index 01f39ee83e..f1a585046c 100644 --- a/types/eslint/index.d.ts +++ b/types/eslint/index.d.ts @@ -540,7 +540,7 @@ export class RuleTester { name: string, rule: Rule.RuleModule, tests: { - valid?: RuleTester.ValidTestCase[]; + valid?: Array; invalid?: RuleTester.InvalidTestCase[]; }, ): void; diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 1b24c3151c..c206bc12ff 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -2451,6 +2451,8 @@ export interface SvgCommonProps { export interface SvgRectProps extends SvgCommonProps { width: number | string; height: number | string; + rx?: number | string; + ry?: number | string; } export interface SvgCircleProps extends SvgCommonProps { diff --git a/types/expo/v24/index.d.ts b/types/expo/v24/index.d.ts index 35d1e9be92..7c515a0268 100644 --- a/types/expo/v24/index.d.ts +++ b/types/expo/v24/index.d.ts @@ -1949,6 +1949,8 @@ export interface SvgCommonProps { export interface SvgRectProps extends SvgCommonProps { width: number | string; height: number | string; + rx?: number | string; + ry?: number | string; } export interface SvgCircleProps extends SvgCommonProps { diff --git a/types/expo/v25/index.d.ts b/types/expo/v25/index.d.ts index 766c055911..9e2da6c790 100644 --- a/types/expo/v25/index.d.ts +++ b/types/expo/v25/index.d.ts @@ -1978,6 +1978,8 @@ export interface SvgCommonProps { export interface SvgRectProps extends SvgCommonProps { width: number | string; height: number | string; + rx?: number | string; + ry?: number | string; } export interface SvgCircleProps extends SvgCommonProps { diff --git a/types/expo/v26/index.d.ts b/types/expo/v26/index.d.ts index 9804579e66..e8386db63c 100644 --- a/types/expo/v26/index.d.ts +++ b/types/expo/v26/index.d.ts @@ -2006,6 +2006,8 @@ export interface SvgCommonProps { export interface SvgRectProps extends SvgCommonProps { width: number | string; height: number | string; + rx?: number | string; + ry?: number | string; } export interface SvgCircleProps extends SvgCommonProps { diff --git a/types/expo/v27/index.d.ts b/types/expo/v27/index.d.ts index a80fb657ee..179315ba69 100644 --- a/types/expo/v27/index.d.ts +++ b/types/expo/v27/index.d.ts @@ -2083,6 +2083,8 @@ export interface SvgCommonProps { export interface SvgRectProps extends SvgCommonProps { width: number | string; height: number | string; + rx?: number | string; + ry?: number | string; } export interface SvgCircleProps extends SvgCommonProps { diff --git a/types/expo/v30/index.d.ts b/types/expo/v30/index.d.ts index d5891bad2d..8a77777c49 100644 --- a/types/expo/v30/index.d.ts +++ b/types/expo/v30/index.d.ts @@ -2083,6 +2083,8 @@ export interface SvgCommonProps { export interface SvgRectProps extends SvgCommonProps { width: number | string; height: number | string; + rx?: number | string; + ry?: number | string; } export interface SvgCircleProps extends SvgCommonProps { diff --git a/types/expo__vector-icons/expo__vector-icons-tests.tsx b/types/expo__vector-icons/expo__vector-icons-tests.tsx index 7d918c917f..33e1056957 100644 --- a/types/expo__vector-icons/expo__vector-icons-tests.tsx +++ b/types/expo__vector-icons/expo__vector-icons-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { View, Text, TabBarIOS } from 'react-native'; -import { createIconSet, MaterialIcons, FontAwesome, Ionicons } from 'expo__vector-icons'; +import { createIconSet, MaterialIcons, FontAwesome, AntDesign } from 'expo__vector-icons'; const glyphMap = { custom: 58918 @@ -48,7 +48,7 @@ class TabTest extends React.Component<{}, { selectedTab: string }> { render() { return ( - { onPress={() => this.setState({ selectedTab: 'tab1' })} > - + - { onPress={() => this.setState({ selectedTab: 'tab2' })} > - + ); } diff --git a/types/expo__vector-icons/index.d.ts b/types/expo__vector-icons/index.d.ts index 529142c0e9..7a7ac587ec 100644 --- a/types/expo__vector-icons/index.d.ts +++ b/types/expo__vector-icons/index.d.ts @@ -1,13 +1,16 @@ -// Type definitions for @expo/vector-icons 6.2 +// Type definitions for @expo/vector-icons 9.0 // Project: https://github.com/expo/vector-icons // Definitions by: Hyeonsu Lee +// Robert Ying // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from 'react'; import { TextProps } from 'react-native'; +import { Icon } from 'react-native-vector-icons/Icon'; export { createIconSet, createIconSetFromFontello, createIconSetFromIcoMoon } from 'react-native-vector-icons'; +export { Icon as AntDesign }; export { default as Entypo } from 'react-native-vector-icons/Entypo'; export { default as EvilIcons } from 'react-native-vector-icons/EvilIcons'; export { default as Feather } from 'react-native-vector-icons/Feather'; diff --git a/types/extra-watch-webpack-plugin/extra-watch-webpack-plugin-tests.ts b/types/extra-watch-webpack-plugin/extra-watch-webpack-plugin-tests.ts new file mode 100644 index 0000000000..7eb729eb31 --- /dev/null +++ b/types/extra-watch-webpack-plugin/extra-watch-webpack-plugin-tests.ts @@ -0,0 +1,6 @@ +import ExtraWatchWebpackPlugin = require("extra-watch-webpack-plugin"); + +new ExtraWatchWebpackPlugin(); +new ExtraWatchWebpackPlugin({}); +new ExtraWatchWebpackPlugin({ files: "string", dirs: "string" }); +new ExtraWatchWebpackPlugin({ files: ["array"], dirs: ["array"] }); diff --git a/types/extra-watch-webpack-plugin/index.d.ts b/types/extra-watch-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..058dae79e7 --- /dev/null +++ b/types/extra-watch-webpack-plugin/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for extra-watch-webpack-plugin 1.0 +// Project: https://github.com/pigcan/extra-watch-webpack-plugin#readme +// Definitions by: Dave Cardwell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Plugin } from "webpack"; + +export = ExtraWatchWebpackPlugin; + +declare class ExtraWatchWebpackPlugin extends Plugin { + constructor(options?: ExtraWatchWebpackPlugin.Options); +} + +declare namespace ExtraWatchWebpackPlugin { + interface Options { + /** + * `string` (absolute path or glob pattern) or `array`, default `[]`, attach extra files to webpack's watch system + */ + files?: string | ReadonlyArray; + /** + * `string` or `array`, default `[]`, attach extra dirs to webpack's watch system + */ + dirs?: string | ReadonlyArray; + } +} diff --git a/types/extra-watch-webpack-plugin/tsconfig.json b/types/extra-watch-webpack-plugin/tsconfig.json new file mode 100644 index 0000000000..0e52bc6c44 --- /dev/null +++ b/types/extra-watch-webpack-plugin/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "extra-watch-webpack-plugin-tests.ts"] +} diff --git a/types/extra-watch-webpack-plugin/tslint.json b/types/extra-watch-webpack-plugin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/extra-watch-webpack-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/fastify-rate-limit/fastify-rate-limit-tests.ts b/types/fastify-rate-limit/fastify-rate-limit-tests.ts new file mode 100644 index 0000000000..ee79951f48 --- /dev/null +++ b/types/fastify-rate-limit/fastify-rate-limit-tests.ts @@ -0,0 +1,22 @@ +import fastifyRateLimit = require("fastify-rate-limit"); +import * as IORedis from 'ioredis'; +import { FastifyRequest, DefaultQuery } from "fastify"; +import { IncomingMessage } from "http"; + +fastifyRateLimit(); + +const fastifyRateLimitOptions: fastifyRateLimit.FastifyRateLimitOptions> = { + max: 3, + timeWindow: 5000, + cache: 10000, + whitelist: ['127.0.0.1'], + redis: new IORedis({ host: '127.0.0.1' }), + skipOnError: true, // default false + keyGenerator: (req) => { + return req.headers['x-real-ip'] + || req.headers['x-client-ip'] + || req.headers['x-forwarded-for'] + || req.params.test + || req.ip; + }, +}; diff --git a/types/fastify-rate-limit/index.d.ts b/types/fastify-rate-limit/index.d.ts new file mode 100644 index 0000000000..888611ad72 --- /dev/null +++ b/types/fastify-rate-limit/index.d.ts @@ -0,0 +1,74 @@ +// Type definitions for fastify-rate-limit 2.0 +// Project: https://github.com/fastify/fastify-rate-limit#readme +// Definitions by: Christian D +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { Redis } from "ioredis"; +import { FastifyRequest } from "fastify"; +import { IncomingMessage } from "http"; + +declare function fastifyRateLimit(): void; + +declare namespace fastifyRateLimit { + interface FastifyRateLimitOptions> { + /** + * Is the maximum number of requests a single client can perform inside a + * timeWindow. + * + * default: 1000 + */ + max?: number; + + /** + * The duration of the time window, can be expressed in milliseconds (as a + * number) or as a string, see ms too see the supported formats + * + * default: 1000 * 60 + */ + timeWindow?: number; + + /** + * This plugin internally uses a lru cache to handle the clients, you can + * change the size of the cache with this option. + * + * default: 5000 + */ + cache?: number; + + /** + * Array of string of ips to exclude from rate limiting. + * + * default: [] + */ + whitelist?: string[]; + + /** + * By default this plugins uses an in-memory store, which is fast but if + * you application works on more than one server it is useless, since the + * data is store locally. You can pass a Redis client here and magically + * the issue is solved. To achieve the maximum speed, this plugins requires + * the use of ioredis. + * + * default: null + */ + redis?: Redis; + + /** + * If `true` it will skip errors generated by the storage (eg, redis not + * reachable). + * + * default: false + */ + skipOnError?: boolean; + + /** + * Function to generate a unique identifier for each incoming request. + * + * default: (req) => req.ip + */ + keyGenerator?: (req: T) => string; + } +} + +export = fastifyRateLimit; diff --git a/types/fastify-rate-limit/package.json b/types/fastify-rate-limit/package.json new file mode 100644 index 0000000000..e8c68ab969 --- /dev/null +++ b/types/fastify-rate-limit/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "fastify": "^1.11.2" + } +} diff --git a/types/fastify-rate-limit/tsconfig.json b/types/fastify-rate-limit/tsconfig.json new file mode 100644 index 0000000000..5dc0e91ea2 --- /dev/null +++ b/types/fastify-rate-limit/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "fastify-rate-limit-tests.ts"], + "exclude": ["node-modules"] +} diff --git a/types/fastify-rate-limit/tslint.json b/types/fastify-rate-limit/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/fastify-rate-limit/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/feathersjs__authentication-oauth2/feathersjs__authentication-oauth2-tests.ts b/types/feathersjs__authentication-oauth2/feathersjs__authentication-oauth2-tests.ts index 34dba17062..4784a885b5 100644 --- a/types/feathersjs__authentication-oauth2/feathersjs__authentication-oauth2-tests.ts +++ b/types/feathersjs__authentication-oauth2/feathersjs__authentication-oauth2-tests.ts @@ -1,5 +1,10 @@ import feathers, { Application } from '@feathersjs/feathers'; -import feathersAuthenticationOAuth2, { Verifier } from '@feathersjs/authentication-oauth2'; +import feathersAuthenticationOAuth2, { Verifier, FeathersAuthenticationOAuth2Options } from '@feathersjs/authentication-oauth2'; +import { RequestHandler, Response, NextFunction } from 'express'; +import { Request } from 'express-serve-static-core'; +import { Strategy } from 'passport'; +import { Profile as GithubProfile } from 'passport-github'; +import { Profile as FacebookProfile } from 'passport-facebook'; const app: Application<{}> = feathers().configure(feathersAuthenticationOAuth2()); @@ -8,3 +13,79 @@ class CustomVerifier extends Verifier { super(app, options); } } + +const handler: RequestHandler = (req: Request, res: Response, next: NextFunction) => { }; + +class someStrategy extends Strategy { + something = "foo"; +} +/** + * Strongly Typed Verifier + */ + +interface User { + name?: string; + email?: string; + facebookId?: string; + orSomeOtherProviderId?: string; +} + +interface VerifierOptions extends FeathersAuthenticationOAuth2Options { + foo?: boolean; +} + +type IProfileType = GithubProfile | FacebookProfile; + +export default class TestVerifier extends Verifier { } + +const testVerifier = new TestVerifier(app, { + name: "test", + foo: false, + successRedirect: "foo", + failureRedirect: "bar", + service: 'Users', + Strategy: someStrategy, + passReqToCallback: false, + session: false +}); + +testVerifier._createEntity({ + profile: { + id: "", + displayName: "", + birthday: "", + _raw: "", + _json: "", + provider: "" + }, + accessToken: "", + refreshToken: "" +}); + +/** + * Options + */ + +const coreOptions: FeathersAuthenticationOAuth2Options = { + name: "foo", + Strategy: someStrategy, + successRedirect: "foo", + failureRedirect: "foo", + service: "foo", + passReqToCallback: true, + session: true +}; + +const options: FeathersAuthenticationOAuth2Options = { + ...coreOptions, + idField: "foo", + path: "foo", + callbackPath: "foo", + callbackURL: "foo", + entity: "foo", + service: "foo", + handler, + errorHandler: handler, + formatter: handler, + Verifier: TestVerifier +}; diff --git a/types/feathersjs__authentication-oauth2/index.d.ts b/types/feathersjs__authentication-oauth2/index.d.ts index b2bf133c68..65e8989ae9 100644 --- a/types/feathersjs__authentication-oauth2/index.d.ts +++ b/types/feathersjs__authentication-oauth2/index.d.ts @@ -1,73 +1,126 @@ // Type definitions for @feathersjs/authentication-oauth2 1.0 // Project: http://feathersjs.com/ -// Definitions by: Jan Lohage +// Definitions by: Jan Lohage +// Nick Bolles // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 -import { - Application, - Paginated -} from '@feathersjs/feathers'; -import { Request } from 'express'; import * as self from '@feathersjs/authentication-oauth2'; +import { Application, Paginated, Service } from '@feathersjs/feathers'; +import { Request, RequestHandler } from 'express'; +import { Profile, Strategy } from 'passport'; declare const feathersAuthenticationOAuth2: ((options?: FeathersAuthenticationOAuth2Options) => () => void) & typeof self; export default feathersAuthenticationOAuth2; -export interface FeathersAuthenticationOAuth2Options { +// todo: make a base options interface in feathers/authentication that we can extend here +export interface FeathersAuthenticationOAuth2Options { /** - * The field to look up the entity by when logging in with the provider. Defaults to 'Id' (ie. 'facebookId'). + * The name of the OAuth2 provider */ - idField: string; + name: string; /** - * The route to register the middleware + * The OAuth strategy to use */ - path: string; + Strategy: string | typeof Strategy; /** - * The route to register the callback handler + * The route to register the callback handler, defaults to `${path}/callback` */ - callbackPath: string; + callbackPath?: string; /** - * The callback url. + * The callback url. Defaults to @feathersjs/common's makeUrl + callbackPath */ - callbackURL: string; + callbackURL?: string; successRedirect: string; failureRedirect: string; /** - * the entity that you are looking up + * Express middleware for handling the oauth callback. Defaults to the built in middleware. todo: needs a proper type */ - entity: string; + handler?: RequestHandler; + /** + * Express middleware for handling the oauth error callback. Defaults to the built in middleware. todo: needs a proper type + */ + errorHandler?: RequestHandler; + /** + * The response formatter. Defaults the the built in feathers-rest formatter, which returns JSON. todo: needs a proper type + */ + formatter?: RequestHandler; + /** + * A Verifier class. Defaults to the built-in one but can be a custom one. See below for details. + */ + Verifier?: VerifierType; + // todo: some of these options are actually @feathersjs/authentication options, + /** + * The field to look up the entity by when logging in with the provider. Defaults to 'Id' (ie. 'facebookId'). + * This can also be set on app.get('auth') or app.get('authentication') + */ + idField?: string; + /** + * The route to register the middleware on. Defaults to `/auth/${name}` + * This can also be set on app.get('auth') or app.get('authentication') + */ + path?: string; + /** + * the entity that you are looking up. + * This can also be set on app.get('auth') or app.get('authentication') + */ + entity?: string; /** * the service to look up the entity + * This can also be set on app.get('auth') or app.get('authentication') */ - service: string; + service: string | Service; /** * whether the request object should be passed to `verify` + * This can also be set on app.get('auth') or app.get('authentication') */ passReqToCallback: boolean; /** * whether to use sessions, + * This can also be set on app.get('auth') or app.get('authentication') */ session: boolean; /** - * Express middleware for handling the oauth callback. Defaults to the built in middleware. todo: needs a proper type + * Oauth flag to tell @feathersjs/authentication that this is an oauth authentication + * Set by feathersOAuth2 to pass into @feathersjs/authentication */ - handler: any; - /** - * The response formatter. Defaults the the built in feathers-rest formatter, which returns JSON. todo: needs a proper type - */ - formatter: any; - /** - * A Verifier class. Defaults to the built-in one but can be a custom one. See below for details. - */ - Verifier: Verifier; + __oath?: boolean; } -export class Verifier { - constructor(app: Application, options: any) - - _updateEntity(entity: any, data: { profile: any, accessToken: string, refreshToken: string }): Promise; // updates an existing entity - _createEntity(data: { profile: any, accessToken: string, refreshToken: string }): Promise; // creates an entity if they didn't exist already - _normalizeResult(results: T[] | Paginated): Promise; // normalizes result from service to account for pagination - verify(req: Request, accessToken: string, refreshToken: string, profile: any, done: (err: Error | null, user: object, info: object) => void): void; +interface FeathersAuthenticationOAuth2Data { + profile: T; + accessToken: string; + refreshToken: string; } + +export class Verifier< + /** + * The data type for the service object, used in _normalizeResults + */ + DataType = any, + /** + * The interface for the options that are passed into the verifier + */ + OptionType extends FeathersAuthenticationOAuth2Options = FeathersAuthenticationOAuth2Options, + /** + * The profile type for the response, 99% f use cases will be fine with passports default Profile, but you can get more specific like this + * @example + * import {Profile as GithubProfile} from 'passport-github'; + * import {Profile as FacebookProfile} from 'passport-facebook'; + * type IProfileType = GithubProfile | FacebookProfile; + * class MyVerifier extends Verifier { + constructor(app: Application, options: OptionType) + options: OptionType; + service: Service; + _updateEntity(entity: any, data: FeathersAuthenticationOAuth2Data): Promise; // updates an existing entity + _createEntity(data: FeathersAuthenticationOAuth2Data): Promise; // creates an entity if they didn't exist already + _normalizeResult(results: T[] | Paginated): Promise; // normalizes result from service to account for pagination + _setPayloadAndDone(entity: any, done: (err: Error | null, user: object, info: object) => void): Promise; + verify(req: Request, accessToken: string, refreshToken: string, profile: ProfileType, done: (err: Error | null, user: object, info: object) => void): void; +} + +export const defaultHandler: RequestHandler; +export const defaultErrorHandler: RequestHandler; diff --git a/types/feathersjs__authentication/index.d.ts b/types/feathersjs__authentication/index.d.ts index 7bb88a903d..8094c6002a 100644 --- a/types/feathersjs__authentication/index.d.ts +++ b/types/feathersjs__authentication/index.d.ts @@ -1,11 +1,15 @@ // Type definitions for @feathersjs/authentication 2.1 // Project: http://feathersjs.com/ -// Definitions by: Abraao Alves , Jan Lohage +// Definitions by: Abraao Alves +// Jan Lohage +// Nick Bolles // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript // TypeScript Version: 2.3 -import { Hook } from '@feathersjs/feathers'; +import { Hook, Params } from '@feathersjs/feathers'; import * as self from '@feathersjs/authentication'; +import { RequestHandler, Application } from 'express'; +import { create } from 'domain'; declare const feathersAuthentication: ((config?: FeathersAuthenticationOptions) => () => void) & typeof self; export default feathersAuthentication; @@ -52,6 +56,26 @@ export interface FeathersAuthenticationOptions { }; } +export namespace express { + function exposeHeaders(): RequestHandler; + function exposeCookies(): RequestHandler; + function authenticate(strategy: string | string[], options?: FeathersAuthenticationOptions): RequestHandler; + function setCookie(options?: FeathersAuthenticationOptions): RequestHandler; + function successRedirect(): RequestHandler; + function failureRedirect(options?: FeathersAuthenticationOptions): RequestHandler; + function emitEvents(): RequestHandler; +} + +export function service(options: FeathersAuthenticationOptions): (app?: Application) => void; + +export namespace service { + class Service { + constructor(app: Application) + create(data: Partial, params: Params): Promise<{ accessToken: string }>; + remove(id: null | string, params: Params): Promise<{ accessToken: string }>; + } +} + export namespace AuthHooks { interface HashPassOptions { passwordField: string; diff --git a/types/flexmonster/flexmonster-tests.ts b/types/flexmonster/flexmonster-tests.ts new file mode 100644 index 0000000000..fb9840c6cb --- /dev/null +++ b/types/flexmonster/flexmonster-tests.ts @@ -0,0 +1,7 @@ +import Flexmonster = require('flexmonster'); + +new Flexmonster({ + container: 'pivot-container', + height: '550px', + width: '100%' +}); diff --git a/types/flexmonster/index.d.ts b/types/flexmonster/index.d.ts new file mode 100644 index 0000000000..00a6c49bcb --- /dev/null +++ b/types/flexmonster/index.d.ts @@ -0,0 +1,479 @@ +// Type definitions for flexmonster 2.6 +// Project: https://www.flexmonster.com/ +// Definitions by: Flexmonster +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +export as namespace Flexmonster; + +declare const Flexmonster: FlexmonsterConstructor; +export = Flexmonster; + +interface FlexmonsterConstructor { + new (params: Flexmonster.Params): Flexmonster.Pivot; + (params: Flexmonster.Params): Flexmonster.Pivot; +} + +declare namespace Flexmonster { + interface Params { + // params + toolbar?: boolean; + licenseKey?: string; + width?: string | number; + height?: string | number; + componentFolder?: string; + report?: Report | string; + global?: Report; + customizeCell?: (cell: CellBuilder, data: CellData) => void; + customizeContextMenu?: (items: ContextMenuItem[], data: CellData | ChartData, viewType: string) => ContextMenuItem[]; + // events + afterchartdraw?: () => void; + aftergriddraw?: (param: object) => void; + beforegriddraw?: (param: object) => void; + beforetoolbarcreated?: (toolbar: Toolbar) => void; + cellclick?: (cell: CellData) => void; + celldoubleclick?: (cell: CellData) => void; + datachanged?: (param: object) => void; + dataerror?: (param: object) => void; + datafilecancelled?: () => void; + dataloaded?: () => void; + exportcomplete?: () => void; + exportstart?: () => void; + fieldslistclose?: () => void; + fieldslistopen?: () => void; + filterclose?: () => void; + filteropen?: () => void; + loadingdata?: () => void; + loadinglocalization?: () => void; + loadingolapstructure?: () => void; + loadingreportfile?: () => void; + localizationerror?: () => void; + localizationloaded?: () => void; + olapstructureerror?: () => void; + olapstructureloaded?: () => void; + openingreportfile?: () => void; + printcomplete?: () => void; + printstart?: () => void; + querycomplete?: () => void; + queryerror?: () => void; + ready?: () => void; + reportchange?: () => void; + reportcomplete?: () => void; + reportfilecancelled?: () => void; + reportfileerror?: () => void; + runningquery?: () => void; + update?: () => void; + // other + container?: string; + } + + interface Pivot { + addCalculatedMeasure(measure: Measure): void; + addCondition(condition: ConditionalFormat): void; + addJSON(json: object[]): void; + alert(options: { title?: string; message?: string; type?: string; buttons?: Array<{ label: string; handler?: () => void; }>; blocking?: boolean; }): void; + clear(): void; + clearFilter(hierarchyName: string): void; + clearXMLACache(proxyUrl: string, databaseId: string, callbackHandler: ((reponse: object) => void) | string, cubeId: string, measuresGroupId: string, + username?: string, password?: string): void; + closeFieldsList(): void; + collapseAllData(): void; + collapseData(hierarchyName: string): void; + connectTo(object: DataSource): void; + customizeCell(customizeCellFunction: (cell: CellBuilder, data: CellData) => void): void; + customizeContextMenu(customizeFunction: (items: ContextMenuItem[], data: CellData | ChartData, viewType: string) => ContextMenuItem[]): void; + dispose(): void; + expandAllData(withAllChildren?: boolean): void; + expandData(hierarchyName: string): void; + exportTo(type: string, exportOptions?: ExportOptions, callbackHandler?: ((result: object) => void) | string): void; + getAllConditions(): ConditionalFormat[]; + getAllHierarchies(): Hierarchy[]; + getAllMeasures(): Measure[]; + getCell(rowIdx: number, colIdx: number): CellData; + getColumns(): Hierarchy[]; + getCondition(id: string): ConditionalFormat; + getData(options: { slice?: Slice }, callbackHandler: ((rawData: any) => void) | string, updateHandler?: ((rawData: any) => void) | string): void; + getFilter(hierarchyName: string): FilterItem[]; + getFilterProperties(hierarchyName: string): FilterProperties; + getFormat(measureName: string): Format; + getMeasures(): Measure[]; + getMembers(hierarchyName: string, memberName: string, callbackHandler: ((members: Member[]) => void) | string): Member[]; + getOptions(): Options; + getReport(format?: string): Report | string; + getReportFilters(): Hierarchy[]; + getRows(): Hierarchy[]; + getSelectedCell(): CellData | CellData[]; + getSort(hierarchyName: string): string; + getXMLACatalogs(proxyURL: string, dataSource: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): void; + getXMLACubes(proxyURL: string, dataSource: string, catalog: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): void; + getXMLADataSources(proxyURL: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): void; + getXMLAProviderName(proxyURL: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): string; + load(url: string, componentFolder?: string): void; + off(eventType: string, handler?: ((...args: any[]) => any) | string): void; + on(eventType: string, handler: ((...args: any[]) => any) | string): void; + open(): void; + openFieldsList(): void; + openFilter(hierarchyName: string): void; + print(options?: PrintOptions): void; + refresh(): void; + removeAllCalculatedMeasures(): void; + removeAllConditions(): void; + removeCalculatedMeasure(uniqueName: string): void; + removeCondition(id: string): void; + removeSelection(): void; + runQuery(slice: Slice): void; + save(filename: string, destination: string, callbackHandler?: (() => void) | string, url?: string, embedData?: boolean): string; + setBottomX(hierarchyName: string, num: number, measure: MeasureObject): void; + setFilter(hierarchyName: string, items: string[], negation?: boolean): void; + setFormat(format: Format, measureName: string): void; + setOptions(options: Options): void; + setReport(report: Report): void; + setSort(hierarchyName: string, sortName: string, customSorting?: string[]): void; + setTopX(hierarchyName: string, num: number, measure: MeasureObject): void; + showCharts(type?: string, multiple?: boolean): void; + showGrid(): void; + showGridAndCharts(type?: string, position?: string, multiple?: boolean): void; + sortingMethod(hierarchyName: string, compareFunction: (a: string, b: string) => boolean): void; + sortValues(axisName: string, type: string, tuple: number[], measure: MeasureObject): void; + updateData(object: DataSource | object[]): void; + version: string; + fusioncharts?: { + getData(options: { type: string; slice?: Slice; prepareDataFunction?: (rawData: any) => any }, callbackHandler: ((rawData: any) => void) | string, + updateHandler?: ((rawData: any) => void) | string): void; + getNumberFormat(format: object): object; + }; + googlecharts?: { + getData(options: { type?: string; slice?: Slice; prepareDataFunction?: (rawData: any) => any }, callbackHandler: ((rawData: any) => void) | string, + updateHandler?: ((rawData: any) => void) | string): void; + getNumberFormat(format: object): object; + getNumberFormatPattern(format: object): string; + }; + highcharts?: { + getData(options: { type?: string; slice?: Slice; xAxisType?: string; valuesOnly?: boolean, withDrilldown?: boolean, prepareDataFunction?: (rawData: any) => any }, + callbackHandler: ((rawData: any) => void) | string, updateHandler?: ((rawData: any) => void) | string): void; + getAxisFormat(format: object): string; + getPointXFormat(format: object): string; + getPointYFormat(format: object): string; + getPointZFormat(format: object): string; + }; + } + + interface Report { + dataSource?: DataSource; + slice?: Slice; + options?: Options; + conditions?: ConditionalFormat[]; + formats?: Format[]; + tableSizes?: { + columns?: ColumnSize[]; + rows?: RowSize[]; + }; + localization?: object | string; + } + + interface DataSource { + browseForFile?: boolean; + catalog?: string; + cube?: string; + data?: object[]; + dataSourceInfo?: string; + dataSourceType?: string; + fieldSeparator?: string; + filename?: string; + ignoreQuotedLineBreaks?: boolean; + proxyUrl?: string; + recordsetDelimiter?: string; + binary?: boolean; + roles?: string; + localeIdentifier?: string; + effectiveUserName?: string; + customData?: string; + hash?: string; + username?: string; + password?: string; + } + + interface Slice { + columns?: Hierarchy[]; + measures?: Measure[]; + reportFilters?: Hierarchy[]; + rows?: Hierarchy[]; + drills?: { + drillAll?: boolean; + columns?: Array<{ tuple: string[]; measure?: MeasureObject; }>; + rows?: Array<{ tuple: string[]; measure?: MeasureObject; }>; + }; + expands?: { + expandAll?: boolean; + columns?: Array<{ tuple: string[]; measure?: MeasureObject; }>; + rows?: Array<{ tuple: string[]; measure?: MeasureObject; }>; + }; + sorting?: { + column?: Array<{ type: string; tuple: string[]; measure: MeasureObject; }>; + row?: Array<{ type: string; tuple: string[]; measure: MeasureObject; }>; + }; + drillThrough?: string[]; + } + + interface Options { + chart?: { + activeMeasure?: MeasureObject; + activeTupleIndex?: number; + autoRange?: boolean; + labelsHierarchy?: string; + multipleMeasures?: boolean; + oneLevel?: boolean; + showFilter?: boolean; + showLegend?: boolean; + showLegendButton?: boolean; + showMeasures?: boolean; + showWarning?: boolean; + title?: string; + type?: string; + showDataLabels?: boolean; + reversedAxes?: boolean; + showAllLabels?: boolean; + showOneMeasureSelection?: boolean; + position?: string; + pieDataIndex?: string; + }; + grid?: { + showFilter?: boolean; + showGrandTotals?: string; + showHeaders?: boolean; + showHierarchies?: boolean; + showHierarchyCaptions?: boolean; + showReportFiltersArea?: boolean; + showTotals?: boolean; + title?: string; + type?: string; + showAutoCalculationBar?: boolean; + dragging?: boolean; + grandTotalsPosition?: string; + drillThroughMaxRows?: number; + }; + configuratorActive?: boolean; + configuratorButton?: boolean; + dateTimezoneOffset?: number; + datePattern?: string; + dateTimePattern?: string; + defaultHierarchySortName?: string; + drillThrough?: boolean; + editing?: boolean; + selectEmptyCells?: boolean; + showAggregations?: boolean; + showCalculatedValuesButton?: boolean; + showDefaultSlice?: boolean; + showMemberProperties?: boolean; + sorting?: string; + viewType?: string; + showAggregationLabels?: boolean; + useOlapFormatting?: boolean; + defaultDateType?: string; + timePattern?: string; + showOutdatedDataAlert?: boolean; + showEmptyData?: boolean; + saveAllFormats?: boolean; + showDrillThroughConfigurator?: boolean; + grouping?: boolean; + } + + interface PrintOptions { + header?: string; + footer?: string; + } + + interface Member { + caption?: string; + uniqueName?: string; + hierarchyName?: string; + children?: Member[]; + isLeaf?: boolean; + parentMember?: string; + } + + interface FilterProperties { + type: string; + members?: FilterItem[]; + quantity?: number; + measure?: MeasureObject; + } + + interface FilterItem { + caption?: string; + uniqueName?: string; + hierarchyName?: string; + } + + interface CellData { + columnIndex?: number; + columns?: object[]; + escapedLabel?: string; + height?: number; + hierarchy?: Hierarchy; + isClassicTotalRow?: boolean; + isDrillThrough?: boolean; + isGrandTotal?: boolean; + isGrandTotalColumn?: boolean; + isGrandTotalRow?: boolean; + isTotal?: boolean; + isTotalColumn?: boolean; + isTotalRow?: boolean; + member?: Member; + width?: number; + x?: number; + y?: number; + label?: string; + measure?: MeasureObject; + rowIndex?: number; + rows?: object[]; + type?: string; + value?: number; + } + + interface ExportOptions { + filename?: string; + destinationType?: string; + excelSheetName?: string; + footer?: string; + header?: string; + pageOrientation?: string; + showFilters?: boolean; + url?: string; + useOlapFormattingInExcel?: boolean; + useCustomizeCellForData?: boolean; + excelExportAll?: boolean; + } + + interface Hierarchy { + caption?: string; + dimensionName?: string; + filter?: { + members?: string[]; + negation?: boolean; + measure?: MeasureObject; + quantity?: number; + type?: string; + }; + sortName?: string; + sortOrder?: string[]; + uniqueName?: string; + } + + interface Measure { + uniqueName?: string; + active?: boolean; + aggregation?: string; + availableAggregations?: string[]; + caption?: string; + formula?: string; + format?: string; + grandTotalCaption?: string; + } + + interface MeasureObject { + uniqueName: string; + aggregation?: string; + } + + interface ConditionalFormat { + formula?: string; + format?: Style; + formatCSS?: string; + row?: number; + column?: number; + measureName?: string; + hierarchy?: string; + member?: string; + isTotal?: number; + } + + interface Style { + color?: string; + backgroundColor?: string; + backgroundImage?: string; + borderColor?: string; + fontSize?: string; + fontWeight?: string; + fill?: string; + textAlign?: string; + fontFamily?: string; + width?: number; + maxWidth?: number; + height?: number; + maxHeight?: number; + } + + interface Format { + name?: string; + thousandsSeparator?: string; + decimalSeparator?: string; + decimalPlaces?: number; + maxDecimalPlaces?: number; + maxSymbols?: number; + currencySymbol?: string; + currencySymbolAlign?: string; + nullValue?: string; + infinityValue?: string; + divideByZeroValue?: string; + textAlign?: string; + isPercent?: boolean; + beautifyFloatingPoint?: boolean; + } + + interface ColumnSize { + width?: number; + idx?: number; + tuple?: string[]; + measure?: MeasureObject; + } + + interface RowSize { + height?: number; + idx?: number; + tuple?: string[]; + measure?: MeasureObject; + } + + interface CellBuilder { + attr?: object; + classes?: string[]; + style?: object; + tag?: string; + text?: string; + addClass(value?: string): void; + toHtml(): string; + } + + interface ContextMenuItem { + label?: string; + handler?: (() => void) | string; + submenu?: ContextMenuItem[]; + isSelected?: boolean; + } + + interface ChartData { + columnTuple?: number[]; + id?: string; + label?: string; + measure?: MeasureObject; + rawTuple?: number[]; + value?: number; + } + + interface Toolbar { + getTabs: () => ToolbarTab[]; + } + + interface ToolbarTab { + android: boolean; + args: any; + handler: (() => void) | string; + icon: string; + id: string; + ios: boolean; + mobile: boolean; + menu: ToolbarTab[]; + title: string; + } +} diff --git a/types/flexmonster/tsconfig.json b/types/flexmonster/tsconfig.json new file mode 100644 index 0000000000..9e3ef7747b --- /dev/null +++ b/types/flexmonster/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "flexmonster-tests.ts" + ] +} \ No newline at end of file diff --git a/types/flexmonster/tslint.json b/types/flexmonster/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/flexmonster/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/forge-apis/README.md b/types/forge-apis/README.md new file mode 100644 index 0000000000..9da41d3d61 --- /dev/null +++ b/types/forge-apis/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/forge-apis` + +# Summary +This package contains type definitions for Forge Node.js SDK (https://github.com/Autodesk-Forge/forge-api-nodejs-client). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/forge-apis + +Additional Details + * Last updated: Fri, 11 Jan 2019 10:39:13 GMT + * Dependencies: @types/three + * Global values: none + +# Credits +Forge Partner Development diff --git a/types/forge-apis/forge-apis-tests.ts b/types/forge-apis/forge-apis-tests.ts new file mode 100644 index 0000000000..d7031facb9 --- /dev/null +++ b/types/forge-apis/forge-apis-tests.ts @@ -0,0 +1,13 @@ +import { AuthClientTwoLegged, AuthClientThreeLegged, BucketsApi, HubsApi, FoldersApi, DerivativesApi } from 'forge-apis'; + +const authClientTwoLegged: AuthClientTwoLegged = new AuthClientTwoLegged("", "", []); + +const authClientThreeLegged: AuthClientThreeLegged = new AuthClientThreeLegged("", "", "", []); + +const bucketsApi: BucketsApi = new BucketsApi(); + +const hubsApi: HubsApi = new HubsApi(); + +const foldersApi: FoldersApi = new FoldersApi(); + +const derivativesApi: DerivativesApi = new DerivativesApi(); diff --git a/types/forge-apis/index.d.ts b/types/forge-apis/index.d.ts new file mode 100644 index 0000000000..07dca58812 --- /dev/null +++ b/types/forge-apis/index.d.ts @@ -0,0 +1,193 @@ +// Type definitions for Forge-apis 0.4 +// Project: https://github.com/Autodesk-Forge/forge-api-nodejs-client +// Definitions by: Autodesk Forge Partner Development +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +// Copyright (c) Autodesk, Inc. All rights reserved +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. +// + +export class AuthClientTwoLegged { + constructor(clientId: string, clientSecret: string, scope: string[]); + + authenticate(): Promise; + getCredentials(): AuthToken; + setCredentials(credentials: AuthToken): void; + isAuthorized(): boolean; +} + +export class AuthClientThreeLegged { + constructor(clientId: string, clientSecret: string, redirectUri: string, scope: string[]); + + generateAuthUrl(): string; + getToken(code: string): Promise; + refreshToken(credentials: AuthToken): Promise; +} + +export interface ApiResponse { + body: any; + headers: any; + statusCode: number; +} + +export interface ApiError { + statusCode: number; + statusMessage: string; +} + +export class BucketsApi { + constructor(); + + createBucket(postBuckets: object, opts: object, credentials: AuthToken): Promise; + deleteBucket(bucketKey: string, credentials: AuthToken): Promise; + getBucketDetails(bucketKey: string, credentials: AuthToken): Promise; + getBuckets(options: object, credentials: AuthToken): Promise; +} + +export class HubsApi { + constructor(); + + getHub(hubId: string, opts: object, credentials: AuthToken): Promise; + getHubs(opts: object, credentials: AuthToken): Promise; + getHubProjects(hubId: string, opts: object, credentials: AuthToken): Promise; +} + +export class FoldersApi { + constructor(); + + getFolderContents(projectId: string, folderId: string, opts: object, credentials: AuthToken): Promise; +} + +export interface JobPayload { + input: JobPayloadInput; + output: JobPayloadOutput; +} + +export interface JobPayloadInput { + urn: string; + compressedUrn?: boolean; + rootFilename?: string; +} + +export interface JobPayloadOutput { + formats: JobPayloadItem[]; +} + +export interface JobPayloadItem { + type: string; + views?: string[]; + advanced?: { + applicationProtocol: string; + tolerance: number; + }; + format?: string; + exportColor?: boolean; + exportFileStructure?: string; +} + +export class DerivativesApi { + constructor(); + + deleteManifest(urn: string, credentials: AuthToken): Promise; + getDerivativeManifest(urn: string, derivativeUrn: string, opts: object, credentials: AuthToken): Promise; + getFormats(opts: object, credentials: AuthToken): Promise; + getManifest(urn: string, opts: object, credentials: AuthToken): Promise; + getMetadata(urn: string, opts: object, credentials: AuthToken): Promise; + getModelviewMetadata(urn: string, guid: string, opts: object, credentials: AuthToken): Promise; + getModelviewProperties(urn: string, guid: string, opts: object, credentials: AuthToken): Promise; + getThumbnail(urn: string, opts: object, credentials: AuthToken): Promise; + translate(job: JobPayload, opts: { xAdsForce?: boolean }, credentials: AuthToken): Promise; +} + +export interface Credentials { + client_id: string; + client_secret: string; + grant_type: string; + scope?: string; +} + +export interface AuthToken { + access_token: string; + expires_in: number; + token_type: string; + refresh_token?: string; +} + +export namespace Dm { + interface BucketResponse { + bucketKey: string; + bucketOwner: string; + createdDate: number; + permissions: Array<{ + access: string; + authId: string; + }>; + policyKey: string; + } + + interface ItemResponse { + data: any[]; + included: Item[]; + jsonapi: { + version: string; + }; + links: any; + } + + interface Item { + attributes: { + createTime: string; + createUserId: string; + displayName: string; + extension: object; + fileType: string; + lastModifiedTime: string; + lastModifiedUserId: string; + mimeType: string; + name: string; + storageSize: number; + versionNumber: number; + }; + id: string; + links: { + self: { + href: string; + }; + }; + relationships: { + derivatives: { + data: { + id: string; + }, + meta: { + link: { + href: string; + } + } + }, + item: any; + refs: any; + storage: { + data: { + id: string; + type: string; + } + }; + thumbnail: any; + }; + type: string; + } +} diff --git a/types/forge-apis/tsconfig.json b/types/forge-apis/tsconfig.json new file mode 100644 index 0000000000..3e026ae2b1 --- /dev/null +++ b/types/forge-apis/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "forge-apis-tests.ts" + ] +} diff --git a/types/forge-apis/tslint.json b/types/forge-apis/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/forge-apis/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/frisby/frisby-tests.ts b/types/frisby/frisby-tests.ts index d0bb27ff20..65a7315790 100644 --- a/types/frisby/frisby-tests.ts +++ b/types/frisby/frisby-tests.ts @@ -18,4 +18,9 @@ describe('Test Suite 1', () => { .expect('status', 418) .done(done); }); + + it('should handle jest matchers', () => { + const str = 'bar'; + expect(str).toHaveLength(3); + }); }); diff --git a/types/frisby/index.d.ts b/types/frisby/index.d.ts index 1bcd6fdabb..85151daa68 100644 --- a/types/frisby/index.d.ts +++ b/types/frisby/index.d.ts @@ -5,7 +5,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -/// +/// // #region Imports export import nodeFetch = require('node-fetch'); // Import all definitions from node-fetch. diff --git a/types/generic-pool/generic-pool-tests.ts b/types/generic-pool/generic-pool-tests.ts index 4b8a69aa93..28590def30 100644 --- a/types/generic-pool/generic-pool-tests.ts +++ b/types/generic-pool/generic-pool-tests.ts @@ -34,7 +34,7 @@ const opts = { priorityRange: 5, autostart: false, evictionRunIntervalMillis: 200, - numTestsPerRun: 3, + numTestsPerEvictionRun: 3, softIdleTimeoutMillis: 100, idleTimeoutMillis: 5000 }; diff --git a/types/generic-pool/index.d.ts b/types/generic-pool/index.d.ts index 80a3c0e9df..6bb537e9ba 100644 --- a/types/generic-pool/index.d.ts +++ b/types/generic-pool/index.d.ts @@ -43,7 +43,7 @@ export interface Options { priorityRange?: number; autostart?: boolean; evictionRunIntervalMillis?: number; - numTestsPerRun?: number; + numTestsPerEvictionRun?: number; softIdleTimeoutMillis?: number; idleTimeoutMillis?: number; } diff --git a/types/gestalt/index.d.ts b/types/gestalt/index.d.ts index 162d61dd52..dd9ff81e41 100644 --- a/types/gestalt/index.d.ts +++ b/types/gestalt/index.d.ts @@ -359,7 +359,15 @@ export type Icons = | "sound" | "speech" | "speech-ellipsis" - | "tag"; + | "tag" + | "terms" + | "text-align-left" + | "text-align-center" + | "text-align-right" + | "twitter" + | "view-type-default" + | "view-type-dense" + | "view-type-list"; export interface IconProps { accessibilityLabel: string; diff --git a/types/google-cloud__tasks/google-cloud__tasks-tests.ts b/types/google-cloud__tasks/google-cloud__tasks-tests.ts new file mode 100644 index 0000000000..4539f345ff --- /dev/null +++ b/types/google-cloud__tasks/google-cloud__tasks-tests.ts @@ -0,0 +1,18 @@ +import Tasks, { Queue } from "@google-cloud/tasks"; + +const client = new Tasks({}); + +const formattedParent = client.locationPath("[PROJECT]", "[LOCATION]"); +const queue: Partial = {}; +const request = { + parent: formattedParent, + queue +}; +client + .createQueue(request) + .then(([queue]) => { + const q = queue; + }) + .catch(err => { + console.error(err); + }); diff --git a/types/google-cloud__tasks/index.d.ts b/types/google-cloud__tasks/index.d.ts new file mode 100644 index 0000000000..c3347c8ea4 --- /dev/null +++ b/types/google-cloud__tasks/index.d.ts @@ -0,0 +1,1627 @@ +// Type definitions for @google-cloud/tasks 0.2 +// Project: https://github.com/googleapis/nodejs-tasks +// Definitions by: Ifiok Jr. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 2.8 + +/// + +import { Transform } from "stream"; +export type GoogleError = any; +export type GoogleAuthOptions = any; +export type CallOptions = any; +export type GoogleAuth = any; + +export interface CloudTasksConfig extends GoogleAuthOptions { + key?: string; + autoRetry?: boolean; + maxRetries?: number; + libName?: string; + libVersion?: string; + promise?: PromiseConstructor; +} + +export interface AppEngineHttpQueue { + appEngineRoutingOverride: AppEngineRouting; +} + +export interface AppEngineHttpRequest { + appEngineRouting: AppEngineRouting; + body: string; + headers: { + [key: string]: string; + }; + httpMethod: string; + relativeUri: string; +} + +export interface AppEngineRouting { + host: string; + instance: string; + service: string; + version: string; +} + +export interface Attempt { + dispatchTime: string; + responseStatus: Status; + responseTime: string; + scheduleTime: string; +} + +export interface Binding { + condition: Expr; + members: string[]; + role: string; +} + +export interface CreateTaskRequest { + responseView: View; + task: Partial; +} + +export interface Expr { + description: string; + expression: string; + location: string; + title: string; +} + +export interface ListLocationsResponse { + locations: Location[]; + nextPageToken?: string; +} + +export interface ListQueuesResponse { + nextPageToken?: string; + queues: Queue[]; +} + +export interface ListTasksResponse { + nextPageToken?: string; + tasks: Task[]; +} + +export interface Location { + displayName: string; + labels: { + [key: string]: string; + }; + locationId: string; + metadata: object; + name: string; +} + +export interface Policy { + bindings: Binding[]; + etag: string; + version: number; +} + +export interface Queue { + appEngineHttpQueue: AppEngineHttpQueue; + name: string; + purgeTime: string; + rateLimits: RateLimits; + retryConfig: RetryConfig; + state: string; +} + +export interface RateLimits { + maxBurstSize: number; + maxConcurrentDispatches: number; + maxDispatchesPerSecond: number; +} + +export interface RetryConfig { + maxAttempts: number; + maxBackoff: string; + maxDoublings: number; + maxRetryDuration: string; + minBackoff: string; +} + +export interface RunTaskRequest { + responseView?: View; +} + +export interface SetIamPolicyRequest { + policy: Partial; +} + +export interface Status { + code: number; + details: object[]; + message: string; +} + +/** + * `VIEW_UNSPECIFIED = 0;` + * When Unspecified. Defaults to the behaviour of BASIC. + * + * `BASIC = 1;` + * The basic view omits fields which can be large or can contain + * sensitive data. + * This view does not include the + * ([payload in AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] and + * [payload in PullMessage][google.cloud.tasks.v2beta2.PullMessage.payload]). These payloads are + * desirable to return only when needed, because they can be large + * and because of the sensitivity of the data that you choose to + * store in it. + * + * `FULL = 2;` + * All information is returned. + * + * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Queue][google.cloud.tasks.v2beta2.Queue] resource. + */ +export type View = 0 | 1 | 2; + +export interface Task { + appEngineHttpRequest: AppEngineHttpRequest; + createTime: string; + dispatchCount: number; + firstAttempt: Attempt; + lastAttempt: Attempt; + name: string; + responseCount: number; + scheduleTime: string; + view: View; +} + +export interface TestIamPermissionsRequest { + permissions?: string[]; +} + +export interface TestIamPermissionsResponse { + permissions?: string[]; +} + +export interface PromiseLike extends Promise { + /** + * Cancel the ongoing promise + */ + cancel(): void; +} + +export type Keys = keyof T; + +export type EnhancedPick< + T, + Req extends keyof T, + Opt extends keyof T +> = Required> & Partial>; + +export type ProjectIdCallback = ( + err?: Error | null, + projectId?: string | null +) => void; + +export type APICallback = ( + err: GoogleError | null, + response?: T +) => void; + +export type APIPaginatedCallback = ( + err: GoogleError | null, + response?: T, + next?: U | null, + rawResponse?: V +) => void; + +export interface CallOptionsWithPagination extends CallOptions { + autoPaginate: false; +} + +export interface MethodOverload { + (data: T, options?: CallOptions): PromiseLike<[R]>; + (data: T, options: CallOptions, callback: APICallback): void; + (data: T, callback: APICallback): void; +} + +export interface PaginatedMethodOverload { + (data: T, options: CallOptionsWithPagination): PromiseLike<[R, V, U]>; + (data: T, options?: CallOptions): PromiseLike<[R]>; + (data: T, options: CallOptions, callback: APICallback): void; + ( + data: T, + options: CallOptionsWithPagination, + callback: APIPaginatedCallback + ): void; + (data: T, callback: APICallback): void; +} + +export interface ParentRequest { + /** + * The location name. For example: projects/PROJECT_ID/locations/LOCATION_ID + */ + parent: string; +} + +export interface ResourceRequest { + /** + * The resource for which the policy is being requested. resource is usually specified as a path. For example, a Project resource is specified as projects/{project}. + */ + resource: string; +} + +export interface ListRequestObject extends ParentRequest { + /** + * `filter` can be used to specify a subset of queues. Any Queue field can be used as a filter and several operators as supported. + * For example: <=, <, >=, >, !=, =, :. The filter syntax is the same as described in Stackdriver's Advanced Logs Filters. + * Sample filter "state: PAUSED". + * Note that using filters might cause fewer queues than the requested page_size to be returned. + */ + filter?: string; + + /** + * The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, + * this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. + */ + pageSize?: number; +} + +export interface NamedRequest { + /** + * The resource name of the queue. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID + */ + name: string; +} + +export type CreateNamedRequest = ParentRequest & + { [P in N]: T }; +export type UpdateNamedRequest = ParentRequest & + { [P in N]: T }; + +/** + * Cloud Tasks allows developers to manage the execution of background + * work in their applications. + */ +export default class CloudTasksClient { + /** + * The DNS address for this API service. + * @default 'cloudtasks.googleapis.com' + */ + static readonly servicePath: string; + + /** + * The port for this API service. + * @default 443 + */ + static readonly port: number; + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @default ["https://www.googleapis.com/auth/cloud-platform"] + */ + static readonlyscopes: string; + + auth: GoogleAuth; + + /** + * Construct an instance of CloudTasksClient. + * + * @param [options] - The configuration object. See the subsequent + * parameters for more details. + * @param [options.credentials] - Credentials object. + * @param [options.credentials.client_email] + * @param [options.credentials.private_key] + * @param [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param [options.port] - The port on which to connect to + * the remote host. + * @param [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param [options.promise] - Custom promise module to use instead + * of native Promises. + * @param [options.servicePath] - The domain name of the + * API remote host. + */ + constructor(config: CloudTasksConfig); + + /** + * Return the project ID used by this class. + * @param callback - the callback to + * be called with the current project Id. + */ + getProjectId(): PromiseLike; + getProjectId(callback: ProjectIdCallback): void; + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Lists queues. + * + * Queues are returned in lexicographical order. + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The location name. + * For example: `projects/PROJECT_ID/locations/LOCATION_ID` + * @param [request.filter] + * `filter` can be used to specify a subset of queues. Any Queue + * field can be used as a filter and several operators as supported. + * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as + * described in + * [Stackdriver's Advanced Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters). + * + * Sample filter "state: PAUSED". + * + * Note that using filters might cause fewer queues than the + * requested page_size to be returned. + * @param [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is Array of [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * + * When autoPaginate: false is specified through options, it contains the result + * in a single response. If the response indicates the next page exists, the third + * parameter is set to be used for the next request object. The fourth parameter keeps + * the raw response object of an object representing [ListQueuesResponse]{@link google.cloud.tasks.v2beta3.ListQueuesResponse}. + * The first element of the array is Array of [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Queue]{@link google.cloud.tasks.v2beta3.Queue} in a single response. + * The second element is the next request object if the response + * indicates the next page exists, or null. The third element is + * an object representing [ListQueuesResponse]{@link google.cloud.tasks.v2beta3.ListQueuesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * // Iterate over all elements. + * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); + * + * client.listQueues({parent: formattedParent}) + * .then(responses => { + * const resources = responses[0]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]) + * } + * }) + * .catch(err => { + * console.error(err); + * }); + * + * // Or obtain the paged response. + * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); + * + * + * const options = {autoPaginate: false}; + * const callback = responses => { + * // The actual resources in a response. + * const resources = responses[0]; + * // The next request if the response shows that there are more responses. + * const nextRequest = responses[1]; + * // The actual response object, if necessary. + * // const rawResponse = responses[2]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]); + * } + * if (nextRequest) { + * // Fetch the next page. + * return client.listQueues(nextRequest, options).then(callback); + * } + * } + * client.listQueues({parent: formattedParent}, options) + * .then(callback) + * .catch(err => { + * console.error(err); + * }); + */ + listQueues: PaginatedMethodOverload< + ListRequestObject, + Queue[], + ListQueuesResponse + >; + + /** + * Equivalent to {@link listQueues}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listQueues} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The location name. + * For example: `projects/PROJECT_ID/locations/LOCATION_ID` + * @param [request.filter] + * `filter` can be used to specify a subset of queues. Any Queue + * field can be used as a filter and several operators as supported. + * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as + * described in + * [Stackdriver's Advanced Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters). + * + * Sample filter "state: PAUSED". + * + * Note that using filters might cause fewer queues than the + * requested page_size to be returned. + * @param [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * An object stream which emits an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue} on 'data' event. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); + * client.listQueuesStream({parent: formattedParent}) + * .on('data', element => { + * // doThingsWith(element) + * }).on('error', err => { + * console.log(err); + * }); + */ + listQueuesStream( + request: ListRequestObject, + options?: CallOptions + ): Transform; + + /** + * Gets a queue. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The resource name of the queue. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.getQueue({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + getQueue: MethodOverload; + + /** + * Creates a queue. + * + * Queues created with this method allow tasks to live for a maximum of 31 + * days. After a task is 31 days old, the task will be deleted regardless of whether + * it was dispatched or not. + * + * WARNING: Using this method may have unintended side effects if you are + * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + * Read + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + * before using this method. + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The location name in which the queue will be created. + * For example: `projects/PROJECT_ID/locations/LOCATION_ID` + * + * The list of allowed locations can be obtained by calling Cloud + * Tasks' implementation of + * ListLocations. + * @param request.queue + * Required. + * + * The queue to create. + * + * Queue's name cannot be the same as an existing queue. + * + * This object should have the same structure as [Queue]{@link google.cloud.tasks.v2beta3.Queue} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); + * const queue = {}; + * const request = { + * parent: formattedParent, + * queue: queue, + * }; + * client.createQueue(request) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + createQueue: MethodOverload< + CreateNamedRequest<"queue", Partial>, + Queue + >; + + /** + * Updates a queue. + * + * This method creates the queue if it does not exist and updates + * the queue if it does exist. + * + * Queues created with this method allow tasks to live for a maximum of 31 + * days. After a task is 31 days old, the task will be deleted regardless of whether + * it was dispatched or not. + * + * WARNING: Using this method may have unintended side effects if you are + * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + * Read + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + * before using this method. + * + * @param request + * The request object that will be sent. + * @param request.queue + * Required. + * + * The queue to create or update. + * + * The queue's name must be specified. + * + * Output only fields cannot be modified using UpdateQueue. + * Any value specified for an output only field will be ignored. + * The queue's name cannot be changed. + * + * This object should have the same structure as [Queue]{@link google.cloud.tasks.v2beta3.Queue} + * @param [request.updateMask] + * A mask used to specify which fields of the queue are being updated. + * + * If empty, then all fields will be updated. + * + * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const queue = {}; + * client.updateQueue({queue: queue}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + updateQueue: MethodOverload< + UpdateNamedRequest< + "queue", + EnhancedPick< + Queue, + "name", + "appEngineHttpQueue" | "rateLimits" | "retryConfig" + > + >, + Queue + >; + + /** + * Deletes a queue. + * + * This command will delete the queue even if it has tasks in it. + * + * Note: If you delete a queue, a queue with the same name can't be created + * for 7 days. + * + * WARNING: Using this method may have unintended side effects if you are + * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + * Read + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + * before using this method. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.deleteQueue({name: formattedName}).catch(err => { + * console.error(err); + * }); + */ + deleteQueue: MethodOverload; + + /** + * Purges a queue by deleting all of its tasks. + * + * All tasks created before this method is called are permanently deleted. + * + * Purge operations can take up to one minute to take effect. Tasks + * might be dispatched before the purge takes effect. A purge is irreversible. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.purgeQueue({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + purgeQueue: MethodOverload; + + /** + * Pauses the queue. + * + * If a queue is paused then the system will stop dispatching tasks + * until the queue is resumed via + * ResumeQueue. Tasks can still be added + * when the queue is paused. A queue is paused if its + * state is PAUSED. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.pauseQueue({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + pauseQueue: MethodOverload; + + /** + * Resume a queue. + * + * This method resumes a queue after it has been + * PAUSED or + * DISABLED. The state of a queue is stored + * in the queue's state; after calling this method it + * will be set to RUNNING. + * + * WARNING: Resuming many high-QPS queues at the same time can + * lead to target overloading. If you are resuming high-QPS + * queues, follow the 500/50/5 pattern described in + * [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.resumeQueue({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + resumeQueue: MethodOverload; + + /** + * Gets the access control policy for a Queue. + * Returns an empty policy if the resource exists and does not have a policy + * set. + * + * Authorization requires the following + * [Google IAM](https://cloud.google.com/iam) permission on the specified + * resource parent: + * + * * `cloudtasks.queues.getIamPolicy` + * + * @param request + * The request object that will be sent. + * @param request.resource + * REQUIRED: The resource for which the policy is being requested. + * `resource` is usually specified as a path. For example, a Project + * resource is specified as `projects/{project}`. + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedResource = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.getIamPolicy({resource: formattedResource}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + getIamPolicy: MethodOverload; + + /** + * Sets the access control policy for a Queue. Replaces any existing + * policy. + * + * Note: The Cloud Console does not check queue-level IAM permissions yet. + * Project-level permissions are required to use the Cloud Console. + * + * Authorization requires the following + * [Google IAM](https://cloud.google.com/iam) permission on the specified + * resource parent: + * + * * `cloudtasks.queues.setIamPolicy` + * + * @param request + * The request object that will be sent. + * @param request.resource + * REQUIRED: The resource for which the policy is being specified. + * `resource` is usually specified as a path. For example, a Project + * resource is specified as `projects/{project}`. + * @param request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * + * This object should have the same structure as [Policy]{@link google.iam.v1.Policy} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedResource = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * const policy = {}; + * const request = { + * resource: formattedResource, + * policy: policy, + * }; + * client.setIamPolicy(request) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + setIamPolicy: MethodOverload; + + /** + * Returns permissions that a caller has on a Queue. + * If the resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building permission-aware + * UIs and command-line tools, not for authorization checking. This operation + * may "fail open" without warning. + * + * @param request + * The request object that will be sent. + * @param request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * `resource` is usually specified as a path. For example, a Project + * resource is specified as `projects/{project}`. + * @param request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedResource = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * const permissions = []; + * const request = { + * resource: formattedResource, + * permissions: permissions, + * }; + * client.testIamPermissions(request) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + testIamPermissions: MethodOverload< + ResourceRequest & TestIamPermissionsRequest, + TestIamPermissionsResponse + >; + + /** + * Lists the tasks in a queue. + * + * By default, only the BASIC view is retrieved + * due to performance considerations; + * response_view controls the + * subset of information which is returned. + * + * The tasks may be returned in any order. The ordering may change at any + * time. + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * @param [request.responseView] + * The response_view specifies which subset of the Task will be + * returned. + * + * By default response_view is BASIC; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * + * Authorization for FULL requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the Task resource. + * + * The number should be among the values of [View]{@link google.cloud.tasks.v2beta3.View} + * @param [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is Array of [Task]{@link google.cloud.tasks.v2beta3.Task}. + * + * When autoPaginate: false is specified through options, it contains the result + * in a single response. If the response indicates the next page exists, the third + * parameter is set to be used for the next request object. The fourth parameter keeps + * the raw response object of an object representing [ListTasksResponse]{@link google.cloud.tasks.v2beta3.ListTasksResponse}. + * The first element of the array is Array of [Task]{@link google.cloud.tasks.v2beta3.Task}. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Task]{@link google.cloud.tasks.v2beta3.Task} in a single response. + * The second element is the next request object if the response + * indicates the next page exists, or null. The third element is + * an object representing [ListTasksResponse]{@link google.cloud.tasks.v2beta3.ListTasksResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * // Iterate over all elements. + * const formattedParent = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * + * client.listTasks({parent: formattedParent}) + * .then(responses => { + * const resources = responses[0]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]) + * } + * }) + * .catch(err => { + * console.error(err); + * }); + * + * // Or obtain the paged response. + * const formattedParent = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * + * + * const options = {autoPaginate: false}; + * const callback = responses => { + * // The actual resources in a response. + * const resources = responses[0]; + * // The next request if the response shows that there are more responses. + * const nextRequest = responses[1]; + * // The actual response object, if necessary. + * // const rawResponse = responses[2]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]); + * } + * if (nextRequest) { + * // Fetch the next page. + * return client.listTasks(nextRequest, options).then(callback); + * } + * } + * client.listTasks({parent: formattedParent}, options) + * .then(callback) + * .catch(err => { + * console.error(err); + * }); + */ + listTasks: PaginatedMethodOverload< + ListRequestObject & RunTaskRequest, + Task[], + ListTasksResponse + >; + + /** + * Equivalent to {@link listTasks}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listTasks} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * @param [request.responseView] + * The response_view specifies which subset of the Task will be + * returned. + * + * By default response_view is BASIC; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * + * Authorization for FULL requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the Task resource. + * + * The number should be among the values of [View]{@link google.cloud.tasks.v2beta3.View} + * @param [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * An object stream which emits an object representing [Task]{@link google.cloud.tasks.v2beta3.Task} on 'data' event. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedParent = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.listTasksStream({parent: formattedParent}) + * .on('data', element => { + * // doThingsWith(element) + * }).on('error', err => { + * console.log(err); + * }); + */ + listTasksStream( + request: ListRequestObject & RunTaskRequest, + options?: CallOptions + ): Transform; + + /** + * Gets a task. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * @param [request.responseView] + * The response_view specifies which subset of the Task will be + * returned. + * + * By default response_view is BASIC; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * + * Authorization for FULL requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the Task resource. + * + * The number should be among the values of [View]{@link google.cloud.tasks.v2beta3.View} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The first element of the array is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.taskPath('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]'); + * client.getTask({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + getTask: MethodOverload; + /** + * Creates a task and adds it to a queue. + * + * Tasks cannot be updated after creation; there is no UpdateTask command. + * + * * For App Engine queues, the maximum task size is + * 100KB. + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * + * The queue must already exist. + * @param request.task + * Required. + * + * The task to add. + * + * Task names have the following format: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. + * The user can optionally specify a task name. If a + * name is not specified then the system will generate a random + * unique task id, which will be set in the task returned in the + * response. + * + * If schedule_time is not set or is in the + * past then Cloud Tasks will set it to the current time. + * + * Task De-duplication: + * + * Explicitly specifying a task ID enables task de-duplication. If + * a task's ID is identical to that of an existing task or a task + * that was deleted or executed recently then the call will fail + * with ALREADY_EXISTS. + * If the task's queue was created using Cloud Tasks, then another task with + * the same name can't be created for ~1hour after the original task was + * deleted or executed. If the task's queue was created using queue.yaml or + * queue.xml, then another task with the same name can't be created + * for ~9days after the original task was deleted or executed. + * + * Because there is an extra lookup cost to identify duplicate task + * names, these CreateTask calls have significantly + * increased latency. Using hashed strings for the task id or for + * the prefix of the task id is recommended. Choosing task ids that + * are sequential or have sequential prefixes, for example using a + * timestamp, causes an increase in latency and error rates in all + * task commands. The infrastructure relies on an approximately + * uniform distribution of task ids to store and serve tasks + * efficiently. + * + * This object should have the same structure as [Task]{@link google.cloud.tasks.v2beta3.Task} + * @param [request.responseView] + * The response_view specifies which subset of the Task will be + * returned. + * + * By default response_view is BASIC; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * + * Authorization for FULL requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the Task resource. + * + * The number should be among the values of [View]{@link google.cloud.tasks.v2beta3.View} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The first element of the array is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedParent = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * const task = {}; + * const request = { + * parent: formattedParent, + * task: task, + * }; + * client.createTask(request) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + createTask: MethodOverload; + + /** + * Deletes a task. + * + * A task can be deleted if it is scheduled or dispatched. A task + * cannot be deleted if it has executed successfully or permanently + * failed. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.taskPath('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]'); + * client.deleteTask({name: formattedName}).catch(err => { + * console.error(err); + * }); + */ + deleteTask: MethodOverload; + + /** + * Forces a task to run now. + * + * When this method is called, Cloud Tasks will dispatch the task, even if + * the task is already running, the queue has reached its RateLimits or + * is PAUSED. + * + * This command is meant to be used for manual debugging. For + * example, RunTask can be used to retry a failed + * task after a fix has been made or to manually force a task to be + * dispatched now. + * + * The dispatched task is returned. That is, the task that is returned + * contains the status after the task is dispatched but + * before the task is received by its target. + * + * If Cloud Tasks receives a successful response from the task's + * target, then the task will be deleted; otherwise the task's + * schedule_time will be reset to the time that + * RunTask was called plus the retry delay specified + * in the queue's RetryConfig. + * + * RunTask returns + * NOT_FOUND when it is called on a + * task that has already succeeded or permanently failed. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * @param [request.responseView] + * The response_view specifies which subset of the Task will be + * returned. + * + * By default response_view is BASIC; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * + * Authorization for FULL requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the Task resource. + * + * The number should be among the values of [View]{@link google.cloud.tasks.v2beta3.View} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The first element of the array is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.taskPath('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]'); + * client.runTask({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + runTask: MethodOverload; + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param project + */ + projectPath(project: string): string; + + /** + * Return a fully-qualified location resource name string. + * + * @param project + * @param location + */ + locationPath(project: string, location: string): string; + + /** + * Return a fully-qualified queue resource name string. + * + * @param project + * @param location + * @param queue + */ + queuePath(project: string, location: string, queue: string): string; + + /** + * Return a fully-qualified task resource name string. + * + * @param project + * @param location + * @param queue + * @param task + */ + taskPath( + project: string, + location: string, + queue: string, + task: string + ): string; + + /** + * Parse the projectName from a project resource. + * + * @param projectName + * A fully-qualified path representing a project resources. + */ + matchProjectFromProjectName(projectName: string): string; + + /** + * Parse the locationName from a location resource. + * + * @param locationName + * A fully-qualified path representing a location resources. + */ + matchProjectFromLocationName(locationName: string): string; + + /** + * Parse the locationName from a location resource. + * + * @param locationName + * A fully-qualified path representing a location resources. + */ + matchLocationFromLocationName(locationName: string): string; + + /** + * Parse the queueName from a queue resource. + * + * @param queueName + * A fully-qualified path representing a queue resources. + */ + matchProjectFromQueueName(queueName: string): string; + + /** + * Parse the queueName from a queue resource. + * + * @param queueName + * A fully-qualified path representing a queue resources. + */ + matchLocationFromQueueName(queueName: string): string; + + /** + * Parse the queueName from a queue resource. + * + * @param queueName + * A fully-qualified path representing a queue resources. + */ + matchQueueFromQueueName(queueName: string): string; + + /** + * Parse the taskName from a task resource. + * + * @param taskName + * A fully-qualified path representing a task resources. + */ + matchProjectFromTaskName(taskName: string): string; + + /** + * Parse the taskName from a task resource. + * + * @param taskName + * A fully-qualified path representing a task resources. + */ + matchLocationFromTaskName(taskName: string): string; + + /** + * Parse the taskName from a task resource. + * + * @param taskName + * A fully-qualified path representing a task resources. + */ + matchQueueFromTaskName(taskName: string): string; + + /** + * Parse the taskName from a task resource. + * + * @param taskName + * A fully-qualified path representing a task resources. + */ + matchTaskFromTaskName(taskName: string): string; +} diff --git a/types/google-cloud__tasks/package.json b/types/google-cloud__tasks/package.json new file mode 100644 index 0000000000..c4a850824a --- /dev/null +++ b/types/google-cloud__tasks/package.json @@ -0,0 +1,14 @@ +{ + "private": true, + "dependencies": { + "google-gax": "^0.22.1" + }, + "types": "index", + "typesVersions": { + ">=3.1.0-0": { + "*": [ + "ts3.1/*" + ] + } + } +} diff --git a/types/google-cloud__tasks/ts3.1/google-cloud__tasks-tests.ts b/types/google-cloud__tasks/ts3.1/google-cloud__tasks-tests.ts new file mode 100644 index 0000000000..94a7ebcfa4 --- /dev/null +++ b/types/google-cloud__tasks/ts3.1/google-cloud__tasks-tests.ts @@ -0,0 +1,21 @@ +import Tasks, { Queue } from "@google-cloud/tasks"; + +const client = new Tasks({}); + +// $ExpectError +const failedClient = new Tasks({ unrecognized: "" }); + +const formattedParent = client.locationPath("[PROJECT]", "[LOCATION]"); +const queue: Partial = {}; +const request = { + parent: formattedParent, + queue +}; +client + .createQueue(request) + .then(([queue]) => { + const q = queue; + }) + .catch(err => { + console.error(err); + }); diff --git a/types/google-cloud__tasks/ts3.1/index.d.ts b/types/google-cloud__tasks/ts3.1/index.d.ts new file mode 100644 index 0000000000..6b09fdd06d --- /dev/null +++ b/types/google-cloud__tasks/ts3.1/index.d.ts @@ -0,0 +1,1622 @@ +/// + +import { Transform } from "stream"; +import { + GoogleAuthOptions, + GoogleError, + CallOptions, + GoogleAuth +} from "google-gax"; + +export interface CloudTasksConfig extends GoogleAuthOptions { + key?: string; + autoRetry?: boolean; + maxRetries?: number; + libName?: string; + libVersion?: string; + promise?: PromiseConstructor; +} + +export interface AppEngineHttpQueue { + appEngineRoutingOverride: AppEngineRouting; +} + +export interface AppEngineHttpRequest { + appEngineRouting: AppEngineRouting; + body: string; + headers: { + [key: string]: string; + }; + httpMethod: string; + relativeUri: string; +} + +export interface AppEngineRouting { + host: string; + instance: string; + service: string; + version: string; +} + +export interface Attempt { + dispatchTime: string; + responseStatus: Status; + responseTime: string; + scheduleTime: string; +} + +export interface Binding { + condition: Expr; + members: string[]; + role: string; +} + +export interface CreateTaskRequest { + responseView: View; + task: Partial; +} + +export interface Expr { + description: string; + expression: string; + location: string; + title: string; +} + +export interface ListLocationsResponse { + locations: Location[]; + nextPageToken?: string; +} + +export interface ListQueuesResponse { + nextPageToken?: string; + queues: Queue[]; +} + +export interface ListTasksResponse { + nextPageToken?: string; + tasks: Task[]; +} + +export interface Location { + displayName: string; + labels: { + [key: string]: string; + }; + locationId: string; + metadata: object; + name: string; +} + +export interface Policy { + bindings: Binding[]; + etag: string; + version: number; +} + +export interface Queue { + appEngineHttpQueue: AppEngineHttpQueue; + name: string; + purgeTime: string; + rateLimits: RateLimits; + retryConfig: RetryConfig; + state: string; +} + +export interface RateLimits { + maxBurstSize: number; + maxConcurrentDispatches: number; + maxDispatchesPerSecond: number; +} + +export interface RetryConfig { + maxAttempts: number; + maxBackoff: string; + maxDoublings: number; + maxRetryDuration: string; + minBackoff: string; +} + +export interface RunTaskRequest { + responseView?: View; +} + +export interface SetIamPolicyRequest { + policy: Partial; +} + +export interface Status { + code: number; + details: object[]; + message: string; +} + +/** + * `VIEW_UNSPECIFIED = 0;` + * When Unspecified. Defaults to the behaviour of BASIC. + * + * `BASIC = 1;` + * The basic view omits fields which can be large or can contain + * sensitive data. + * This view does not include the + * ([payload in AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] and + * [payload in PullMessage][google.cloud.tasks.v2beta2.PullMessage.payload]). These payloads are + * desirable to return only when needed, because they can be large + * and because of the sensitivity of the data that you choose to + * store in it. + * + * `FULL = 2;` + * All information is returned. + * + * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Queue][google.cloud.tasks.v2beta2.Queue] resource. + */ +export type View = 0 | 1 | 2; + +export interface Task { + appEngineHttpRequest: AppEngineHttpRequest; + createTime: string; + dispatchCount: number; + firstAttempt: Attempt; + lastAttempt: Attempt; + name: string; + responseCount: number; + scheduleTime: string; + view: View; +} + +export interface TestIamPermissionsRequest { + permissions?: string[]; +} + +export interface TestIamPermissionsResponse { + permissions?: string[]; +} + +export interface PromiseLike extends Promise { + /** + * Cancel the ongoing promise + */ + cancel(): void; +} + +export type Keys = keyof T; + +export type EnhancedPick< + T, + Req extends keyof T, + Opt extends keyof T +> = Required> & Partial>; + +export type ProjectIdCallback = ( + err?: Error | null, + projectId?: string | null +) => void; + +export type APICallback = ( + err: GoogleError | null, + response?: T +) => void; + +export type APIPaginatedCallback = ( + err: GoogleError | null, + response?: T, + next?: U | null, + rawResponse?: V +) => void; + +export interface CallOptionsWithPagination extends CallOptions { + autoPaginate: false; +} + +export interface MethodOverload { + (data: T, options?: CallOptions): PromiseLike<[R]>; + (data: T, options: CallOptions, callback: APICallback): void; + (data: T, callback: APICallback): void; +} + +export interface PaginatedMethodOverload { + (data: T, options: CallOptionsWithPagination): PromiseLike<[R, V, U]>; + (data: T, options?: CallOptions): PromiseLike<[R]>; + (data: T, options: CallOptions, callback: APICallback): void; + ( + data: T, + options: CallOptionsWithPagination, + callback: APIPaginatedCallback + ): void; + (data: T, callback: APICallback): void; +} + +export interface ParentRequest { + /** + * The location name. For example: projects/PROJECT_ID/locations/LOCATION_ID + */ + parent: string; +} + +export interface ResourceRequest { + /** + * The resource for which the policy is being requested. resource is usually specified as a path. For example, a Project resource is specified as projects/{project}. + */ + resource: string; +} + +export interface ListRequestObject extends ParentRequest { + /** + * `filter` can be used to specify a subset of queues. Any Queue field can be used as a filter and several operators as supported. + * For example: <=, <, >=, >, !=, =, :. The filter syntax is the same as described in Stackdriver's Advanced Logs Filters. + * Sample filter "state: PAUSED". + * Note that using filters might cause fewer queues than the requested page_size to be returned. + */ + filter?: string; + + /** + * The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, + * this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. + */ + pageSize?: number; +} + +export interface NamedRequest { + /** + * The resource name of the queue. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID + */ + name: string; +} + +export type CreateNamedRequest = ParentRequest & + { [P in N]: T }; +export type UpdateNamedRequest = ParentRequest & + { [P in N]: T }; + +/** + * Cloud Tasks allows developers to manage the execution of background + * work in their applications. + */ +export default class CloudTasksClient { + /** + * The DNS address for this API service. + * @default 'cloudtasks.googleapis.com' + */ + static readonly servicePath: string; + + /** + * The port for this API service. + * @default 443 + */ + static readonly port: number; + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @default ["https://www.googleapis.com/auth/cloud-platform"] + */ + static readonlyscopes: string; + + auth: GoogleAuth; + + /** + * Construct an instance of CloudTasksClient. + * + * @param [options] - The configuration object. See the subsequent + * parameters for more details. + * @param [options.credentials] - Credentials object. + * @param [options.credentials.client_email] + * @param [options.credentials.private_key] + * @param [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param [options.port] - The port on which to connect to + * the remote host. + * @param [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param [options.promise] - Custom promise module to use instead + * of native Promises. + * @param [options.servicePath] - The domain name of the + * API remote host. + */ + constructor(config: CloudTasksConfig); + + /** + * Return the project ID used by this class. + * @param callback - the callback to + * be called with the current project Id. + */ + getProjectId(): PromiseLike; + getProjectId(callback: ProjectIdCallback): void; + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Lists queues. + * + * Queues are returned in lexicographical order. + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The location name. + * For example: `projects/PROJECT_ID/locations/LOCATION_ID` + * @param [request.filter] + * `filter` can be used to specify a subset of queues. Any Queue + * field can be used as a filter and several operators as supported. + * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as + * described in + * [Stackdriver's Advanced Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters). + * + * Sample filter "state: PAUSED". + * + * Note that using filters might cause fewer queues than the + * requested page_size to be returned. + * @param [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is Array of [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * + * When autoPaginate: false is specified through options, it contains the result + * in a single response. If the response indicates the next page exists, the third + * parameter is set to be used for the next request object. The fourth parameter keeps + * the raw response object of an object representing [ListQueuesResponse]{@link google.cloud.tasks.v2beta3.ListQueuesResponse}. + * The first element of the array is Array of [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Queue]{@link google.cloud.tasks.v2beta3.Queue} in a single response. + * The second element is the next request object if the response + * indicates the next page exists, or null. The third element is + * an object representing [ListQueuesResponse]{@link google.cloud.tasks.v2beta3.ListQueuesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * // Iterate over all elements. + * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); + * + * client.listQueues({parent: formattedParent}) + * .then(responses => { + * const resources = responses[0]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]) + * } + * }) + * .catch(err => { + * console.error(err); + * }); + * + * // Or obtain the paged response. + * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); + * + * + * const options = {autoPaginate: false}; + * const callback = responses => { + * // The actual resources in a response. + * const resources = responses[0]; + * // The next request if the response shows that there are more responses. + * const nextRequest = responses[1]; + * // The actual response object, if necessary. + * // const rawResponse = responses[2]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]); + * } + * if (nextRequest) { + * // Fetch the next page. + * return client.listQueues(nextRequest, options).then(callback); + * } + * } + * client.listQueues({parent: formattedParent}, options) + * .then(callback) + * .catch(err => { + * console.error(err); + * }); + */ + listQueues: PaginatedMethodOverload< + ListRequestObject, + Queue[], + ListQueuesResponse + >; + + /** + * Equivalent to {@link listQueues}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listQueues} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The location name. + * For example: `projects/PROJECT_ID/locations/LOCATION_ID` + * @param [request.filter] + * `filter` can be used to specify a subset of queues. Any Queue + * field can be used as a filter and several operators as supported. + * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as + * described in + * [Stackdriver's Advanced Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters). + * + * Sample filter "state: PAUSED". + * + * Note that using filters might cause fewer queues than the + * requested page_size to be returned. + * @param [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * An object stream which emits an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue} on 'data' event. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); + * client.listQueuesStream({parent: formattedParent}) + * .on('data', element => { + * // doThingsWith(element) + * }).on('error', err => { + * console.log(err); + * }); + */ + listQueuesStream( + request: ListRequestObject, + options?: CallOptions + ): Transform; + + /** + * Gets a queue. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The resource name of the queue. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.getQueue({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + getQueue: MethodOverload; + + /** + * Creates a queue. + * + * Queues created with this method allow tasks to live for a maximum of 31 + * days. After a task is 31 days old, the task will be deleted regardless of whether + * it was dispatched or not. + * + * WARNING: Using this method may have unintended side effects if you are + * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + * Read + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + * before using this method. + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The location name in which the queue will be created. + * For example: `projects/PROJECT_ID/locations/LOCATION_ID` + * + * The list of allowed locations can be obtained by calling Cloud + * Tasks' implementation of + * ListLocations. + * @param request.queue + * Required. + * + * The queue to create. + * + * Queue's name cannot be the same as an existing queue. + * + * This object should have the same structure as [Queue]{@link google.cloud.tasks.v2beta3.Queue} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); + * const queue = {}; + * const request = { + * parent: formattedParent, + * queue: queue, + * }; + * client.createQueue(request) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + createQueue: MethodOverload< + CreateNamedRequest<"queue", Partial>, + Queue + >; + + /** + * Updates a queue. + * + * This method creates the queue if it does not exist and updates + * the queue if it does exist. + * + * Queues created with this method allow tasks to live for a maximum of 31 + * days. After a task is 31 days old, the task will be deleted regardless of whether + * it was dispatched or not. + * + * WARNING: Using this method may have unintended side effects if you are + * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + * Read + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + * before using this method. + * + * @param request + * The request object that will be sent. + * @param request.queue + * Required. + * + * The queue to create or update. + * + * The queue's name must be specified. + * + * Output only fields cannot be modified using UpdateQueue. + * Any value specified for an output only field will be ignored. + * The queue's name cannot be changed. + * + * This object should have the same structure as [Queue]{@link google.cloud.tasks.v2beta3.Queue} + * @param [request.updateMask] + * A mask used to specify which fields of the queue are being updated. + * + * If empty, then all fields will be updated. + * + * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const queue = {}; + * client.updateQueue({queue: queue}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + updateQueue: MethodOverload< + UpdateNamedRequest< + "queue", + EnhancedPick< + Queue, + "name", + "appEngineHttpQueue" | "rateLimits" | "retryConfig" + > + >, + Queue + >; + + /** + * Deletes a queue. + * + * This command will delete the queue even if it has tasks in it. + * + * Note: If you delete a queue, a queue with the same name can't be created + * for 7 days. + * + * WARNING: Using this method may have unintended side effects if you are + * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + * Read + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + * before using this method. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.deleteQueue({name: formattedName}).catch(err => { + * console.error(err); + * }); + */ + deleteQueue: MethodOverload; + + /** + * Purges a queue by deleting all of its tasks. + * + * All tasks created before this method is called are permanently deleted. + * + * Purge operations can take up to one minute to take effect. Tasks + * might be dispatched before the purge takes effect. A purge is irreversible. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.purgeQueue({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + purgeQueue: MethodOverload; + + /** + * Pauses the queue. + * + * If a queue is paused then the system will stop dispatching tasks + * until the queue is resumed via + * ResumeQueue. Tasks can still be added + * when the queue is paused. A queue is paused if its + * state is PAUSED. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.pauseQueue({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + pauseQueue: MethodOverload; + + /** + * Resume a queue. + * + * This method resumes a queue after it has been + * PAUSED or + * DISABLED. The state of a queue is stored + * in the queue's state; after calling this method it + * will be set to RUNNING. + * + * WARNING: Resuming many high-QPS queues at the same time can + * lead to target overloading. If you are resuming high-QPS + * queues, follow the 500/50/5 pattern described in + * [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The first element of the array is an object representing [Queue]{@link google.cloud.tasks.v2beta3.Queue}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.resumeQueue({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + resumeQueue: MethodOverload; + + /** + * Gets the access control policy for a Queue. + * Returns an empty policy if the resource exists and does not have a policy + * set. + * + * Authorization requires the following + * [Google IAM](https://cloud.google.com/iam) permission on the specified + * resource parent: + * + * * `cloudtasks.queues.getIamPolicy` + * + * @param request + * The request object that will be sent. + * @param request.resource + * REQUIRED: The resource for which the policy is being requested. + * `resource` is usually specified as a path. For example, a Project + * resource is specified as `projects/{project}`. + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedResource = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.getIamPolicy({resource: formattedResource}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + getIamPolicy: MethodOverload; + + /** + * Sets the access control policy for a Queue. Replaces any existing + * policy. + * + * Note: The Cloud Console does not check queue-level IAM permissions yet. + * Project-level permissions are required to use the Cloud Console. + * + * Authorization requires the following + * [Google IAM](https://cloud.google.com/iam) permission on the specified + * resource parent: + * + * * `cloudtasks.queues.setIamPolicy` + * + * @param request + * The request object that will be sent. + * @param request.resource + * REQUIRED: The resource for which the policy is being specified. + * `resource` is usually specified as a path. For example, a Project + * resource is specified as `projects/{project}`. + * @param request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * + * This object should have the same structure as [Policy]{@link google.iam.v1.Policy} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedResource = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * const policy = {}; + * const request = { + * resource: formattedResource, + * policy: policy, + * }; + * client.setIamPolicy(request) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + setIamPolicy: MethodOverload; + + /** + * Returns permissions that a caller has on a Queue. + * If the resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building permission-aware + * UIs and command-line tools, not for authorization checking. This operation + * may "fail open" without warning. + * + * @param request + * The request object that will be sent. + * @param request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * `resource` is usually specified as a path. For example, a Project + * resource is specified as `projects/{project}`. + * @param request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedResource = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * const permissions = []; + * const request = { + * resource: formattedResource, + * permissions: permissions, + * }; + * client.testIamPermissions(request) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + testIamPermissions: MethodOverload< + ResourceRequest & TestIamPermissionsRequest, + TestIamPermissionsResponse + >; + + /** + * Lists the tasks in a queue. + * + * By default, only the BASIC view is retrieved + * due to performance considerations; + * response_view controls the + * subset of information which is returned. + * + * The tasks may be returned in any order. The ordering may change at any + * time. + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * @param [request.responseView] + * The response_view specifies which subset of the Task will be + * returned. + * + * By default response_view is BASIC; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * + * Authorization for FULL requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the Task resource. + * + * The number should be among the values of [View]{@link google.cloud.tasks.v2beta3.View} + * @param [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is Array of [Task]{@link google.cloud.tasks.v2beta3.Task}. + * + * When autoPaginate: false is specified through options, it contains the result + * in a single response. If the response indicates the next page exists, the third + * parameter is set to be used for the next request object. The fourth parameter keeps + * the raw response object of an object representing [ListTasksResponse]{@link google.cloud.tasks.v2beta3.ListTasksResponse}. + * The first element of the array is Array of [Task]{@link google.cloud.tasks.v2beta3.Task}. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Task]{@link google.cloud.tasks.v2beta3.Task} in a single response. + * The second element is the next request object if the response + * indicates the next page exists, or null. The third element is + * an object representing [ListTasksResponse]{@link google.cloud.tasks.v2beta3.ListTasksResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * // Iterate over all elements. + * const formattedParent = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * + * client.listTasks({parent: formattedParent}) + * .then(responses => { + * const resources = responses[0]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]) + * } + * }) + * .catch(err => { + * console.error(err); + * }); + * + * // Or obtain the paged response. + * const formattedParent = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * + * + * const options = {autoPaginate: false}; + * const callback = responses => { + * // The actual resources in a response. + * const resources = responses[0]; + * // The next request if the response shows that there are more responses. + * const nextRequest = responses[1]; + * // The actual response object, if necessary. + * // const rawResponse = responses[2]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]); + * } + * if (nextRequest) { + * // Fetch the next page. + * return client.listTasks(nextRequest, options).then(callback); + * } + * } + * client.listTasks({parent: formattedParent}, options) + * .then(callback) + * .catch(err => { + * console.error(err); + * }); + */ + listTasks: PaginatedMethodOverload< + ListRequestObject & RunTaskRequest, + Task[], + ListTasksResponse + >; + + /** + * Equivalent to {@link listTasks}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listTasks} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * @param [request.responseView] + * The response_view specifies which subset of the Task will be + * returned. + * + * By default response_view is BASIC; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * + * Authorization for FULL requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the Task resource. + * + * The number should be among the values of [View]{@link google.cloud.tasks.v2beta3.View} + * @param [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * An object stream which emits an object representing [Task]{@link google.cloud.tasks.v2beta3.Task} on 'data' event. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedParent = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * client.listTasksStream({parent: formattedParent}) + * .on('data', element => { + * // doThingsWith(element) + * }).on('error', err => { + * console.log(err); + * }); + */ + listTasksStream( + request: ListRequestObject & RunTaskRequest, + options?: CallOptions + ): Transform; + + /** + * Gets a task. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * @param [request.responseView] + * The response_view specifies which subset of the Task will be + * returned. + * + * By default response_view is BASIC; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * + * Authorization for FULL requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the Task resource. + * + * The number should be among the values of [View]{@link google.cloud.tasks.v2beta3.View} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The first element of the array is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.taskPath('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]'); + * client.getTask({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + getTask: MethodOverload; + /** + * Creates a task and adds it to a queue. + * + * Tasks cannot be updated after creation; there is no UpdateTask command. + * + * * For App Engine queues, the maximum task size is + * 100KB. + * + * @param request + * The request object that will be sent. + * @param request.parent + * Required. + * + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * + * The queue must already exist. + * @param request.task + * Required. + * + * The task to add. + * + * Task names have the following format: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. + * The user can optionally specify a task name. If a + * name is not specified then the system will generate a random + * unique task id, which will be set in the task returned in the + * response. + * + * If schedule_time is not set or is in the + * past then Cloud Tasks will set it to the current time. + * + * Task De-duplication: + * + * Explicitly specifying a task ID enables task de-duplication. If + * a task's ID is identical to that of an existing task or a task + * that was deleted or executed recently then the call will fail + * with ALREADY_EXISTS. + * If the task's queue was created using Cloud Tasks, then another task with + * the same name can't be created for ~1hour after the original task was + * deleted or executed. If the task's queue was created using queue.yaml or + * queue.xml, then another task with the same name can't be created + * for ~9days after the original task was deleted or executed. + * + * Because there is an extra lookup cost to identify duplicate task + * names, these CreateTask calls have significantly + * increased latency. Using hashed strings for the task id or for + * the prefix of the task id is recommended. Choosing task ids that + * are sequential or have sequential prefixes, for example using a + * timestamp, causes an increase in latency and error rates in all + * task commands. The infrastructure relies on an approximately + * uniform distribution of task ids to store and serve tasks + * efficiently. + * + * This object should have the same structure as [Task]{@link google.cloud.tasks.v2beta3.Task} + * @param [request.responseView] + * The response_view specifies which subset of the Task will be + * returned. + * + * By default response_view is BASIC; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * + * Authorization for FULL requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the Task resource. + * + * The number should be among the values of [View]{@link google.cloud.tasks.v2beta3.View} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The first element of the array is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedParent = client.queuePath('[PROJECT]', '[LOCATION]', '[QUEUE]'); + * const task = {}; + * const request = { + * parent: formattedParent, + * task: task, + * }; + * client.createTask(request) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + createTask: MethodOverload; + + /** + * Deletes a task. + * + * A task can be deleted if it is scheduled or dispatched. A task + * cannot be deleted if it has executed successfully or permanently + * failed. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.taskPath('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]'); + * client.deleteTask({name: formattedName}).catch(err => { + * console.error(err); + * }); + */ + deleteTask: MethodOverload; + + /** + * Forces a task to run now. + * + * When this method is called, Cloud Tasks will dispatch the task, even if + * the task is already running, the queue has reached its RateLimits or + * is PAUSED. + * + * This command is meant to be used for manual debugging. For + * example, RunTask can be used to retry a failed + * task after a fix has been made or to manually force a task to be + * dispatched now. + * + * The dispatched task is returned. That is, the task that is returned + * contains the status after the task is dispatched but + * before the task is received by its target. + * + * If Cloud Tasks receives a successful response from the task's + * target, then the task will be deleted; otherwise the task's + * schedule_time will be reset to the time that + * RunTask was called plus the retry delay specified + * in the queue's RetryConfig. + * + * RunTask returns + * NOT_FOUND when it is called on a + * task that has already succeeded or permanently failed. + * + * @param request + * The request object that will be sent. + * @param request.name + * Required. + * + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * @param [request.responseView] + * The response_view specifies which subset of the Task will be + * returned. + * + * By default response_view is BASIC; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * + * Authorization for FULL requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the Task resource. + * + * The number should be among the values of [View]{@link google.cloud.tasks.v2beta3.View} + * @param [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The first element of the array is an object representing [Task]{@link google.cloud.tasks.v2beta3.Task}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * import CloudTasks from '@google-cloud/tasks'; + * + * const client = new tasks.v2beta3.CloudTasksClient({ + * // optional auth parameters. + * }); + * + * const formattedName = client.taskPath('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]'); + * client.runTask({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + runTask: MethodOverload; + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param project + */ + projectPath(project: string): string; + + /** + * Return a fully-qualified location resource name string. + * + * @param project + * @param location + */ + locationPath(project: string, location: string): string; + + /** + * Return a fully-qualified queue resource name string. + * + * @param project + * @param location + * @param queue + */ + queuePath(project: string, location: string, queue: string): string; + + /** + * Return a fully-qualified task resource name string. + * + * @param project + * @param location + * @param queue + * @param task + */ + taskPath( + project: string, + location: string, + queue: string, + task: string + ): string; + + /** + * Parse the projectName from a project resource. + * + * @param projectName + * A fully-qualified path representing a project resources. + */ + matchProjectFromProjectName(projectName: string): string; + + /** + * Parse the locationName from a location resource. + * + * @param locationName + * A fully-qualified path representing a location resources. + */ + matchProjectFromLocationName(locationName: string): string; + + /** + * Parse the locationName from a location resource. + * + * @param locationName + * A fully-qualified path representing a location resources. + */ + matchLocationFromLocationName(locationName: string): string; + + /** + * Parse the queueName from a queue resource. + * + * @param queueName + * A fully-qualified path representing a queue resources. + */ + matchProjectFromQueueName(queueName: string): string; + + /** + * Parse the queueName from a queue resource. + * + * @param queueName + * A fully-qualified path representing a queue resources. + */ + matchLocationFromQueueName(queueName: string): string; + + /** + * Parse the queueName from a queue resource. + * + * @param queueName + * A fully-qualified path representing a queue resources. + */ + matchQueueFromQueueName(queueName: string): string; + + /** + * Parse the taskName from a task resource. + * + * @param taskName + * A fully-qualified path representing a task resources. + */ + matchProjectFromTaskName(taskName: string): string; + + /** + * Parse the taskName from a task resource. + * + * @param taskName + * A fully-qualified path representing a task resources. + */ + matchLocationFromTaskName(taskName: string): string; + + /** + * Parse the taskName from a task resource. + * + * @param taskName + * A fully-qualified path representing a task resources. + */ + matchQueueFromTaskName(taskName: string): string; + + /** + * Parse the taskName from a task resource. + * + * @param taskName + * A fully-qualified path representing a task resources. + */ + matchTaskFromTaskName(taskName: string): string; +} diff --git a/types/google-cloud__tasks/ts3.1/tsconfig.json b/types/google-cloud__tasks/ts3.1/tsconfig.json new file mode 100644 index 0000000000..08ba955879 --- /dev/null +++ b/types/google-cloud__tasks/ts3.1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "paths": { + "@google-cloud/tasks": ["google-cloud__tasks"] + }, + "baseUrl": "../../", + "typeRoots": ["../../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "google-cloud__tasks-tests.ts"] +} diff --git a/types/google-cloud__tasks/ts3.1/tslint.json b/types/google-cloud__tasks/ts3.1/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/google-cloud__tasks/ts3.1/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/google-cloud__tasks/tsconfig.json b/types/google-cloud__tasks/tsconfig.json new file mode 100644 index 0000000000..498e1217fc --- /dev/null +++ b/types/google-cloud__tasks/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "paths": { + "@google-cloud/tasks": ["google-cloud__tasks"] + }, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "google-cloud__tasks-tests.ts"] +} diff --git a/types/google-cloud__tasks/tslint.json b/types/google-cloud__tasks/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/google-cloud__tasks/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/google__maps/index.d.ts b/types/google__maps/index.d.ts index d393286dfe..f1df5d8f38 100644 --- a/types/google__maps/index.d.ts +++ b/types/google__maps/index.d.ts @@ -3107,7 +3107,7 @@ export interface QueryAutocompleteResult { * contains an `offset` value and a `length`. * These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired. */ - matched_substring: PredictionSubstring[]; + matched_substrings: PredictionSubstring[]; } /** A Radar Search request must include at least one of `keyword`, `name`, or `type`. */ diff --git a/types/happypack/happypack-tests.ts b/types/happypack/happypack-tests.ts new file mode 100644 index 0000000000..c0ab2d77cf --- /dev/null +++ b/types/happypack/happypack-tests.ts @@ -0,0 +1,7 @@ +import * as happyPack from 'happypack'; + +const ref: happyPack = new happyPack({ + id: '1', + threads: 1, + loaders: ['ts-loader'] +}); diff --git a/types/happypack/index.d.ts b/types/happypack/index.d.ts new file mode 100644 index 0000000000..13c212a3f8 --- /dev/null +++ b/types/happypack/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for happypack 5.0 +// Project: https://github.com/amireh/happypack +// Definitions by: Akash Vishwakarma +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { Plugin } from 'webpack'; + +export = happypack; + +declare namespace happypack { + interface PluginOptions { + id?: string; + threads?: number; + loaders: any; + } +} + +declare class happypack extends Plugin { + constructor(options: happypack.PluginOptions); +} diff --git a/types/happypack/tsconfig.json b/types/happypack/tsconfig.json new file mode 100644 index 0000000000..bfd5e35551 --- /dev/null +++ b/types/happypack/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "happypack-tests.ts" + ] +} \ No newline at end of file diff --git a/types/happypack/tslint.json b/types/happypack/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/happypack/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/hls.js/index.d.ts b/types/hls.js/index.d.ts index 9b7986b99f..b5c3cdf3ba 100644 --- a/types/hls.js/index.d.ts +++ b/types/hls.js/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/video-dev/hls.js // Definitions by: John G. Gainfort, Jr. // Johan Brook +// Adriรกn Caballero // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -189,33 +190,65 @@ declare namespace Hls { */ interface Level { /** - * level url. might contain sever items if failover/redundant streams are found in the manifest + * attribute list */ - url: string[]; + attrs: LevelAttr[]; + /** + * audio codec + */ + audioCodec: string; /** * level bitrate */ bitrate: number; /** - * level name + * level details */ - name: string; + details?: LevelDetails; /** - * used codecs + * whether there is any error on the fragment */ - codecs: string; - /** - * video width - */ - width: number; + fragmentError?: boolean; /** * video height */ height: number; /** - * level details + * index of the level */ - details: LevelDetails; + level?: number; + /** + * error code + */ + loadError: number; + /** + * level name + */ + name: string; + /** + * array of unrecognized codecs + */ + unkownCodecs: string[]; + /** + * level url. might contain several items if failover/redundant streams are found in the manifest + */ + url: string[]; + /** + * index of current url from url[] array + */ + urlId: number; + /** + * video codec + */ + videoCodec: string; + /** + * video width + */ + width: number; + } + + interface LevelAttr { + [key: string]: string; } /** diff --git a/types/http-aws-es/http-aws-es-tests.ts b/types/http-aws-es/http-aws-es-tests.ts index df432dbab4..18ae2b666c 100644 --- a/types/http-aws-es/http-aws-es-tests.ts +++ b/types/http-aws-es/http-aws-es-tests.ts @@ -1,42 +1,43 @@ -import { EnvironmentCredentials } from "aws-sdk/lib/core"; +import * as AWS from "aws-sdk"; import { Client } from "elasticsearch"; import HttpAmazonESConnector = require("http-aws-es"); new Client({ - amazonES: { - accessKey: "AKID", + awsConfig: new AWS.Config({ + accessKeyId: "AKID", region: "us-east-1", - secretKey: "secret", - }, + secretAccessKey: "secret", + }), connectionClass: HttpAmazonESConnector, host: "https://amazon-es-host.us-east-1.es.amazonaws.com", }); new Client({ - amazonES: { - accessKey: "AKID", + awsConfig: new AWS.Config({ + accessKeyId: "AKID", region: "us-east-1", - secretKey: "secret", - }, + secretAccessKey: "secret", + }), connectionClass: require("http-aws-es"), host: "https://amazon-es-host.us-east-1.es.amazonaws.com", }); -const myCredentials = new EnvironmentCredentials("AWS"); +const myCredentials = new AWS.EnvironmentCredentials("AWS"); + new Client({ - amazonES: { + awsConfig: new AWS.Config({ credentials: myCredentials, region: "us-east-1", - }, + }), connectionClass: HttpAmazonESConnector, host: "https://amazon-es-host.us-east-1.es.amazonaws.com", }); new Client({ - amazonES: { + awsConfig: new AWS.Config({ credentials: myCredentials, region: "us-east-1", - }, + }), connectionClass: require("http-aws-es"), host: "https://amazon-es-host.us-east-1.es.amazonaws.com", }); diff --git a/types/http-aws-es/index.d.ts b/types/http-aws-es/index.d.ts index 91e12604f8..2a6ca11629 100644 --- a/types/http-aws-es/index.d.ts +++ b/types/http-aws-es/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for http-aws-es 1.1 +// Type definitions for http-aws-es 6.0 // Project: https://github.com/TheDeveloper/http-aws-es#readme // Definitions by: Marco Gonzalez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,18 +7,11 @@ /// import * as e from "elasticsearch"; -import { Credentials } from "aws-sdk/lib/core"; +import * as AWS from "aws-sdk"; declare module "elasticsearch" { - interface AmazonESOptions { - accessKey?: string; - credentials?: Credentials; - region: string; - secretKey?: string; - } - interface ConfigOptions { - amazonES?: AmazonESOptions; + awsConfig?: AWS.Config; } } diff --git a/types/http-cache-semantics/http-cache-semantics-tests.ts b/types/http-cache-semantics/http-cache-semantics-tests.ts new file mode 100644 index 0000000000..73de43b370 --- /dev/null +++ b/types/http-cache-semantics/http-cache-semantics-tests.ts @@ -0,0 +1,19 @@ +const req = { url: 'https://foo.bar', method: 'GET', headers: { foo: 'bar' } }; +const res = { status: 200, headers: { foo: 'bar' } }; + +import CachePolicy = require('http-cache-semantics'); + +const policy = new CachePolicy(req, res); +new CachePolicy(req, res, { shared: true }); +new CachePolicy(req, res, { cacheHeuristic: 0.1 }); +new CachePolicy(req, res, { immutableMinTimeToLive: 24 * 3600 * 1000 }); +new CachePolicy(req, res, { ignoreCargoCult: false }); +new CachePolicy(req, res, { trustServerDate: true }); + +policy.storable(); // $ExpectType boolean +policy.satisfiesWithoutRevalidation(req); // $ExpectType boolean +policy.responseHeaders(); // $ExpectType Headers +policy.timeToLive(); // $ExpectType number +CachePolicy.fromObject(policy.toObject()); // $ExpectType CachePolicy +policy.revalidationHeaders(req); // $ExpectType Headers +policy.revalidatedPolicy(req, res); // $ExpectType RevalidationPolicy diff --git a/types/http-cache-semantics/index.d.ts b/types/http-cache-semantics/index.d.ts new file mode 100644 index 0000000000..40545f3e0a --- /dev/null +++ b/types/http-cache-semantics/index.d.ts @@ -0,0 +1,170 @@ +// Type definitions for http-cache-semantics 4.0 +// Project: https://github.com/kornelski/http-cache-semantics#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = CachePolicy; + +declare class CachePolicy { + constructor(req: CachePolicy.Request, res: CachePolicy.Response, options?: CachePolicy.Options); + + /** + * Returns `true` if the response can be stored in a cache. + * If it's `false` then you MUST NOT store either the request or the response. + */ + storable(): boolean; + + /** + * This is the most important method. Use this method to check whether the cached response is still fresh + * in the context of the new request. + * + * If it returns `true`, then the given `request` matches the original response this cache policy has been + * created with, and the response can be reused without contacting the server. Note that the old response + * can't be returned without being updated, see `responseHeaders()`. + * + * If it returns `false`, then the response may not be matching at all (e.g. it's for a different URL or method), + * or may require to be refreshed first (see `revalidationHeaders()`). + */ + satisfiesWithoutRevalidation(newRequest: CachePolicy.Request): boolean; + + /** + * Returns updated, filtered set of response headers to return to clients receiving the cached response. + * This function is necessary, because proxies MUST always remove hop-by-hop headers (such as `TE` and `Connection`) + * and update response's `Age` to avoid doubling cache time. + * + * @example + * cachedResponse.headers = cachePolicy.responseHeaders(cachedResponse); + */ + responseHeaders(): CachePolicy.Headers; + + /** + * Returns approximate time in milliseconds until the response becomes stale (i.e. not fresh). + * + * After that time (when `timeToLive() <= 0`) the response might not be usable without revalidation. However, + * there are exceptions, e.g. a client can explicitly allow stale responses, so always check with + * `satisfiesWithoutRevalidation()`. + */ + timeToLive(): number; + + /** + * Chances are you'll want to store the `CachePolicy` object along with the cached response. + * `obj = policy.toObject()` gives a plain JSON-serializable object. + */ + toObject(): CachePolicy.CachePolicyObject; + + /** + * `policy = CachePolicy.fromObject(obj)` creates an instance from object created by `toObject()`. + */ + static fromObject(obj: CachePolicy.CachePolicyObject): CachePolicy; + + /** + * Returns updated, filtered set of request headers to send to the origin server to check if the cached + * response can be reused. These headers allow the origin server to return status 304 indicating the + * response is still fresh. All headers unrelated to caching are passed through as-is. + * + * Use this method when updating cache from the origin server. + * + * @example + * updateRequest.headers = cachePolicy.revalidationHeaders(updateRequest); + */ + revalidationHeaders(newRequest: CachePolicy.Request): CachePolicy.Headers; + + /** + * Use this method to update the cache after receiving a new response from the origin server. + */ + revalidatedPolicy( + revalidationRequest: CachePolicy.Request, + revalidationResponse: CachePolicy.Response + ): CachePolicy.RevalidationPolicy; +} + +declare namespace CachePolicy { + interface Request { + url?: string; + method?: string; + headers: Headers; + } + + interface Response { + status?: number; + headers: Headers; + } + + interface Options { + /** + * If `true`, then the response is evaluated from a perspective of a shared cache (i.e. `private` is not + * cacheable and `s-maxage` is respected). If `false`, then the response is evaluated from a perspective + * of a single-user cache (i.e. `private` is cacheable and `s-maxage` is ignored). + * `true` is recommended for HTTP clients. + * @default true + */ + shared?: boolean; + /** + * A fraction of response's age that is used as a fallback cache duration. The default is 0.1 (10%), + * e.g. if a file hasn't been modified for 100 days, it'll be cached for 100*0.1 = 10 days. + * @default 0.1 + */ + cacheHeuristic?: number; + /** + * A number of milliseconds to assume as the default time to cache responses with `Cache-Control: immutable`. + * Note that [per RFC](https://httpwg.org/specs/rfc8246.html#the-immutable-cache-control-extension) + * these can become stale, so `max-age` still overrides the default. + * @default 24*3600*1000 (24h) + */ + immutableMinTimeToLive?: number; + /** + * If `true`, common anti-cache directives will be completely ignored if the non-standard `pre-check` + * and `post-check` directives are present. These two useless directives are most commonly found + * in bad StackOverflow answers and PHP's "session limiter" defaults. + * @default false + */ + ignoreCargoCult?: boolean; + /** + * If `false`, then server's `Date` header won't be used as the base for `max-age`. This is against the RFC, + * but it's useful if you want to cache responses with very short `max-age`, but your local clock + * is not exactly in sync with the server's. + * @default true + */ + trustServerDate?: boolean; + } + + interface CachePolicyObject { + v: number; + t: number; + sh: boolean; + ch: number; + imm: number; + st: number; + resh: Headers; + rescc: { [key: string]: string }; + m: string; + u?: string; + h?: string; + a: boolean; + reqh: Headers | null; + reqcc: { [key: string]: string }; + } + + interface Headers { + [header: string]: string | string[] | undefined; + } + + interface RevalidationPolicy { + /** + * A new `CachePolicy` with HTTP headers updated from `revalidationResponse`. You can always replace + * the old cached `CachePolicy` with the new one. + */ + policy: CachePolicy; + /** + * Boolean indicating whether the response body has changed. + * + * - If `false`, then a valid 304 Not Modified response has been received, and you can reuse the old + * cached response body. + * - If `true`, you should use new response's body (if present), or make another request to the origin + * server without any conditional headers (i.e. don't use `revalidationHeaders()` this time) to get + * the new resource. + */ + modified: boolean; + matches: boolean; + } +} diff --git a/types/http-cache-semantics/tsconfig.json b/types/http-cache-semantics/tsconfig.json new file mode 100644 index 0000000000..9940b3d2e6 --- /dev/null +++ b/types/http-cache-semantics/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "http-cache-semantics-tests.ts" + ] +} diff --git a/types/http-cache-semantics/tslint.json b/types/http-cache-semantics/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/http-cache-semantics/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/idyll-document/idyll-document-tests.ts b/types/idyll-document/idyll-document-tests.ts index 880e017013..7a08c0189d 100644 --- a/types/idyll-document/idyll-document-tests.ts +++ b/types/idyll-document/idyll-document-tests.ts @@ -1,5 +1,7 @@ import IdyllDocument, { IdyllDocumentProps } from "idyll-document"; -import { createElement } from "react"; +import { createElement, ReactElement } from "react"; -// $ExpectType ReactElement -createElement(IdyllDocument); +const doc = createElement(IdyllDocument); + +// $ExpectType true +type test = typeof doc extends ReactElement ? true : false; diff --git a/types/ink/index.d.ts b/types/ink/index.d.ts index f91d83df75..23f4fe5d80 100644 --- a/types/ink/index.d.ts +++ b/types/ink/index.d.ts @@ -59,7 +59,7 @@ export abstract class Component< S extends Record = {}, C extends Record = {} > { - readonly props: P; + readonly props: P & { children?: InkNode }; readonly context: C; setState( diff --git a/types/iobroker/index.d.ts b/types/iobroker/index.d.ts index 81381d801d..0479eceeb9 100644 --- a/types/iobroker/index.d.ts +++ b/types/iobroker/index.d.ts @@ -1327,19 +1327,39 @@ declare global { unsubscribeForeignObjects(pattern: string, options?: unknown, callback?: ErrorCallback): void; /** Subscribe to changes of states in this instance */ - subscribeStates(pattern: string, options?: unknown, callback?: ErrorCallback): void; + subscribeStates(pattern: string, callback?: ErrorCallback): void; + subscribeStates(pattern: string, options: unknown, callback?: ErrorCallback): void; + /** Subscribe to changes of states in this instance */ + subscribeStatesAsync(pattern: string, options?: unknown): Promise; + /** Subscribe to changes of states (which might not belong to this adapter) */ - subscribeForeignStates(pattern: string, options?: unknown, callback?: ErrorCallback): void; + subscribeForeignStates(pattern: string, callback?: ErrorCallback): void; + subscribeForeignStates(pattern: string, options: unknown, callback?: ErrorCallback): void; + /** Subscribe to changes of states (which might not belong to this adapter) */ + subscribeForeignStatesAsync(pattern: string, options?: unknown): Promise; + /** * Subscribe from changes of states in this instance * @param pattern - Must match the pattern used to subscribe */ - unsubscribeStates(pattern: string, options?: unknown, callback?: ErrorCallback): void; + unsubscribeStates(pattern: string, callback?: ErrorCallback): void; + unsubscribeStates(pattern: string, options: unknown, callback?: ErrorCallback): void; + /** + * Subscribe from changes of states in this instance + * @param pattern - Must match the pattern used to subscribe + */ + unsubscribeStatesAsync(pattern: string, options?: unknown): Promise; /** * Subscribe from changes of states (which might not belong to this adapter) * @param pattern - Must match the pattern used to subscribe */ - unsubscribeForeignStates(pattern: string, options?: unknown, callback?: ErrorCallback): void; + unsubscribeForeignStates(pattern: string, callback?: ErrorCallback): void; + unsubscribeForeignStates(pattern: string, options: unknown, callback?: ErrorCallback): void; + /** + * Subscribe from changes of states (which might not belong to this adapter) + * @param pattern - Must match the pattern used to subscribe + */ + unsubscribeForeignStatesAsync(pattern: string, options?: unknown): Promise; // ============================== // devices and channels diff --git a/types/iobroker/iobroker-tests.ts b/types/iobroker/iobroker-tests.ts index f49eb34576..21233e20fd 100644 --- a/types/iobroker/iobroker-tests.ts +++ b/types/iobroker/iobroker-tests.ts @@ -241,3 +241,14 @@ adapter.sendToHostAsync("host-foo", "command", "message").then(handleMessageResp adapter.sendToHostAsync("host-foo", "message").then(handleMessageResponse); adapter.sendToHostAsync("host-foo", "command", {msg: "message"}).then(handleMessageResponse); adapter.sendToHostAsync("host-foo", {msg: "message"}).then(handleMessageResponse); + +function handleError(err?: string) { } +adapter.subscribeStates("*", handleError); +adapter.subscribeForeignStates("*", handleError); +adapter.unsubscribeStates("*", handleError); +adapter.unsubscribeForeignStates("*", handleError); + +adapter.subscribeStatesAsync("*").catch(handleError); +adapter.subscribeForeignStatesAsync("*").catch(handleError); +adapter.unsubscribeStatesAsync("*").catch(handleError); +adapter.unsubscribeForeignStatesAsync("*").catch(handleError); diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 8f5e7b7a2a..4ecf403a6f 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -488,7 +488,6 @@ export interface BooleanSchema extends AnySchema { /** * Allows the values provided to truthy and falsy as well as the "true" and "false" default conversion * (when not in strict() mode) to be matched in a case insensitive manner. - * @param enabled */ insensitive(enabled?: boolean): this; } @@ -792,6 +791,11 @@ export interface ObjectSchema extends AnySchema { */ length(limit: number): this; + /** + * Requires the object to be a Joi schema instance. + */ + schema(): this; + /** * Specify validation rules for unknown keys matching a pattern. * diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index af85cab0ac..4dbc784756 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -706,6 +706,8 @@ objSchema = objSchema.nand(str, str); objSchema = objSchema.nand(str, str, str); objSchema = objSchema.nand(strArr); +objSchema = objSchema.schema(); + objSchema = objSchema.or(str); objSchema = objSchema.or(str, str); objSchema = objSchema.or(str, str, str); diff --git a/types/jquery.soap/index.d.ts b/types/jquery.soap/index.d.ts index 36674a677b..9a802163e4 100644 --- a/types/jquery.soap/index.d.ts +++ b/types/jquery.soap/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jQuery.SOAP 1.6.7 +// Type definitions for jQuery.SOAP 1.7 // Project: https://github.com/doedje/jquery.soap // Definitions by: Roland Greim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/ @@ -72,6 +72,7 @@ declare namespace JQuerySOAP { SOAPHeader?: Object; statusCode?: Object; success?: (SOAPResponse: SOAPResponse) => void; + timeout?: number; url?: string; wss?: Object; } diff --git a/types/jquery.soap/tslint.json b/types/jquery.soap/tslint.json index a41bf5d19a..a0357daa61 100644 --- a/types/jquery.soap/tslint.json +++ b/types/jquery.soap/tslint.json @@ -7,7 +7,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/jsforce/api/chatter.d.ts b/types/jsforce/api/chatter.d.ts index c712187559..4b65740f36 100644 --- a/types/jsforce/api/chatter.d.ts +++ b/types/jsforce/api/chatter.d.ts @@ -27,7 +27,7 @@ interface RequestParams { export class RequestResult { } -export class Request implements Promise { +export class Request implements PromiseLike { constructor(chatter: Chatter, params: RequestParams); batchParams(): BatchRequestParams; @@ -36,16 +36,12 @@ export class Request implements Promise { stream(): Stream; - catch(onrejected?: ((reason: any) => (PromiseLike | TResult)) | null | undefined): Promise; - then(onfulfilled?: ((value: T) => (PromiseLike | TResult1)) | null | undefined, onrejected?: ((reason: any) => (PromiseLike | TResult2)) | null | undefined): Promise; finally(onfinally?: () => void): Promise; thenCall(callback?: (err: Error, records: T) => void): Query; - - readonly [Symbol.toStringTag]: 'Promise'; } export class Resource extends Request { diff --git a/types/jsforce/api/metadata.d.ts b/types/jsforce/api/metadata.d.ts index c6aec12e7e..88dbdaa52d 100644 --- a/types/jsforce/api/metadata.d.ts +++ b/types/jsforce/api/metadata.d.ts @@ -112,21 +112,17 @@ interface DeployOptions { singlePackage?: boolean; } -export class AsyncResultLocator extends EventEmitter implements Promise { +export class AsyncResultLocator extends EventEmitter implements PromiseLike { check(callback?: Callback): Promise complete(callback?: Callback): Promise poll(interval: number, timeout: number): void; - catch(onrejected?: ((reason: any) => (PromiseLike | TResult)) | null | undefined): Promise; - then(onfulfilled?: ((value: T) => (PromiseLike | TResult1)) | null | undefined, onrejected?: ((reason: any) => (PromiseLike | TResult2)) | null | undefined): Promise; finally(onfinally?: () => void): Promise; - - readonly [Symbol.toStringTag]: "Promise"; } export class DeployResultLocator extends AsyncResultLocator {} diff --git a/types/jsforce/jsforce-tests.ts b/types/jsforce/jsforce-tests.ts index 08ea888062..45442b91dc 100644 --- a/types/jsforce/jsforce-tests.ts +++ b/types/jsforce/jsforce-tests.ts @@ -615,7 +615,7 @@ async function testChatter(conn: sf.Connection): Promise { const feedResource: sf.Resource = chatter.resource('/feed-elements'); - const feedCreateRequest: any = await (feedResource.create({ + const feedCreateRequest: any = await feedResource.create({ body: { messageSegments: [{ type: 'Text', @@ -624,13 +624,13 @@ async function testChatter(conn: sf.Connection): Promise { }, feedElementType: 'FeedItem', subjectId: 'me' - }) as Promise); + }); console.log(`feedCreateRequest.id: ${feedCreateRequest.id}`); const itemLikesUrl = `/feed-elements/${feedCreateRequest.id}/capabilities/chatter-likes/items`; const itemsLikeResource: sf.Resource = chatter.resource(itemLikesUrl); - const itemsLikeCreateResult: sf.RequestResult = await (itemsLikeResource.create('') as Promise); + const itemsLikeCreateResult: sf.RequestResult = await itemsLikeResource.create(''); console.log(`itemsLikeCreateResult['likedItem']: ${itemsLikeCreateResult as any['likedItem']}`); } diff --git a/types/jsforce/tslint.json b/types/jsforce/tslint.json index 43829466b8..12201695b9 100644 --- a/types/jsforce/tslint.json +++ b/types/jsforce/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "array-type": false, + "await-promise": [true, "Request"], "ban-types": false, "eofline": false, "max-line-length": false, diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index 05d9c50aa6..91f0d455cc 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -7,6 +7,7 @@ // Benjamin Dobson // Be Birchall // Daniel Cassidy +// Drew Wyatt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -264,6 +265,13 @@ declare namespace jwplayer { reason: 'auto' | 'api' | 'initial choice'; } + interface CastParam { + available: boolean; + active: boolean; + deviceName: string; + type: 'cast'; + } + interface EventParams { adClick: AdProgressParam; adCompanions: AdCompanionsParam; @@ -277,6 +285,7 @@ declare namespace jwplayer { adPlay: AdPlayParam; adPause: AdPlayParam; adTime: AdTimeParam; + cast: CastParam; meta: MetadataParam; audioTracks: AudioTracksParam; audioTrackChanged: AudioTrackChangedParam; diff --git a/types/jws/index.d.ts b/types/jws/index.d.ts index fdbf1851c4..6c9d7194f5 100644 --- a/types/jws/index.d.ts +++ b/types/jws/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jws 3.1 +// Type definitions for jws 3.2 // Project: https://github.com/brianloveswords/node-jws // Definitions by: Justin Beckwith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -145,7 +145,8 @@ export interface VerifyOptions { export type Algorithm = 'HS256' | 'HS384' | 'HS512' | 'RS256' | 'RS384' | 'RS512' | 'ES256' | 'ES384' | - 'ES512' | 'none'; + 'ES512' | 'PS256' | 'PS384' | 'PS512' | + 'none'; export interface Header { alg: Algorithm; diff --git a/types/koa-bouncer/index.d.ts b/types/koa-bouncer/index.d.ts index 7b881f2b5c..af3a8b6693 100644 --- a/types/koa-bouncer/index.d.ts +++ b/types/koa-bouncer/index.d.ts @@ -7,7 +7,7 @@ import { Middleware, Context } from 'koa'; declare namespace KoaBouncer { - export class ValidatorError extends Error { + export class ValidationError extends Error { name: string; message: string; bouncer: { @@ -88,4 +88,4 @@ declare module "koa" { } } -export = KoaBouncer; \ No newline at end of file +export = KoaBouncer; diff --git a/types/koa-session/index.d.ts b/types/koa-session/index.d.ts index 08e6e66f70..512b888e1c 100644 --- a/types/koa-session/index.d.ts +++ b/types/koa-session/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for koa-session 5.7 +// Type definitions for koa-session 5.10 // Project: https://github.com/koajs/session // Definitions by: Yu Hsin Lu // Tomek ลaziuk +// Hiroshi Ioka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /* =================== USAGE =================== @@ -16,6 +17,9 @@ =============================================== */ import Koa = require("koa"); +import Cookies = require("cookies"); + +type Omit = Pick>; declare namespace session { /** @@ -108,7 +112,7 @@ declare namespace session { hash(sess: any): string; } - interface opts { + interface opts extends Omit { /** * cookie key (default is koa:sess) */ @@ -121,21 +125,6 @@ declare namespace session { */ maxAge?: number | "session"; - /** - * can overwrite or not (default true) - */ - overwrite: boolean; - - /** - * httpOnly or not (default true) - */ - httpOnly: boolean; - - /** - * signed or not (default true) - */ - signed: boolean; - /** * custom encode method */ diff --git a/types/koa-session/koa-session-tests.ts b/types/koa-session/koa-session-tests.ts index a647b43e42..4930a6f1c2 100644 --- a/types/koa-session/koa-session-tests.ts +++ b/types/koa-session/koa-session-tests.ts @@ -37,6 +37,7 @@ app.use(session({ console.log(key); }, }, + path: "/", }, app)); app.use((ctx, next) => { diff --git a/types/koa2-session-redis/index.d.ts b/types/koa2-session-redis/index.d.ts index 24e85e1674..049c655f5f 100644 --- a/types/koa2-session-redis/index.d.ts +++ b/types/koa2-session-redis/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/lonord/koa2-session-redis // Definitions by: Dima Mukhin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as Redis from 'redis'; import * as session from 'koa-session'; diff --git a/types/lory.js/index.d.ts b/types/lory.js/index.d.ts index dd37fb8efa..82c1f6fbc6 100644 --- a/types/lory.js/index.d.ts +++ b/types/lory.js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for lory 2.2.1 +// Type definitions for lory 2.5.3 // Project: https://github.com/meandmax/lory/ // Definitions by: kubosho // philip bulley @@ -80,6 +80,11 @@ interface LoryOptions { * cubic bezier easing functions: http://easings.net/de (default: 'cubic-bezier(0.455, 0.03, 0.515, 0.955)'). */ ease?: string; + + /** + * the slide index to show when the slider is initialized ( default: 0 ) + */ + initialIndex?: number; /** * if slider reached the last slide, with next click the slider goes back to the startindex (default: false). diff --git a/types/lory.js/lory.js-tests.ts b/types/lory.js/lory.js-tests.ts index 616073f180..f3ca0464c2 100644 --- a/types/lory.js/lory.js-tests.ts +++ b/types/lory.js/lory.js-tests.ts @@ -19,6 +19,7 @@ import { lory } from 'lory.js'; rewindSpeed: 600, snapBackSpeed: 200, ease: 'ease', + initialIndex: 0, rewind: true, infinite: false, classNameFrame: 'js_frame', diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index 890d0731ad..b5f1134fb5 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -5,6 +5,7 @@ // Jonathan Siebern // Matt R. Wilson // Pietro Vismara +// Janeene Beeforth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -467,11 +468,11 @@ export interface ZoneOffsetOptions { } export class Zone { - static offsetName(ts: number, options?: ZoneOffsetOptions): string; - static isValid: boolean; - static name: string; - static type: string; - static universal: boolean; + offsetName(ts: number, options?: ZoneOffsetOptions): string; + isValid: boolean; + name: string; + type: string; + universal: boolean; equals(other: Zone): boolean; offset(ts: number): number; } diff --git a/types/luxon/luxon-tests.ts b/types/luxon/luxon-tests.ts index 3cadfa5779..df5481094b 100644 --- a/types/luxon/luxon-tests.ts +++ b/types/luxon/luxon-tests.ts @@ -1,4 +1,4 @@ -import { DateTime, Duration, Interval, Info, Settings, IANAZone } from 'luxon'; +import { DateTime, Duration, Interval, Info, Settings, IANAZone, Zone, ZoneOffsetOptions } from 'luxon'; /* DateTime */ const dt = DateTime.local(2017, 5, 15, 8, 30); @@ -285,3 +285,21 @@ dur.reconfigure({ conversionAccuracy: 'longterm' }); // $ExpectType Duration start.until(end); // $ExpectType Interval i.toDuration(['years', 'months', 'days']); // $ExpectType Duration + +/* Sample Zone Implementation */ +class SampleZone extends Zone { + readonly isValid = false; + readonly name = 'Sample'; + readonly type = 'Example'; + readonly universal = true; + + offsetName(ts: number, options?: ZoneOffsetOptions) { + return 'SampleZone'; + } + equals(other: Zone) { + return other.name === this.name; + } + offset(ts: number) { + return 0; + } +} diff --git a/types/mapbox__s3urls/index.d.ts b/types/mapbox__s3urls/index.d.ts new file mode 100644 index 0000000000..523cb0fc07 --- /dev/null +++ b/types/mapbox__s3urls/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for mapbox__s3urls 1.5 +// Project: https://github.com/mapbox/s3urls +// Definitions by: Sebastian Vera +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// tslint:disable-next-line no-single-declare-module +declare module "@mapbox/s3urls" { + function fromUrl( + url: string + ): { Bucket: string | undefined; Key: string | undefined }; + + function toUrl( + bucket: string, + key: string + ): { + s3: string; + "bucket-in-path": string; + "bucket-in-host": string; + }; + + function convert( + url: string, + to: "s3" | "bucket-in-path" | "bucket-in-host" + ): string; + + function signed( + url: string, + expires: number, + cb: (err: Error | undefined, url: string) => void + ): void; + + function valid(url: string): boolean; +} diff --git a/types/mapbox__s3urls/mapbox__s3urls-tests.ts b/types/mapbox__s3urls/mapbox__s3urls-tests.ts new file mode 100644 index 0000000000..7a50fdcfac --- /dev/null +++ b/types/mapbox__s3urls/mapbox__s3urls-tests.ts @@ -0,0 +1,15 @@ +import * as s3urls from "@mapbox/s3urls"; + +s3urls.toUrl("bucket", "key"); // $ExpectType { s3: string; "bucket-in-path": string; "bucket-in-host": string; } +s3urls.toUrl("bucket", "key")["s3"]; // $ExpectType string +s3urls.toUrl("bucket", "key")["bucket-in-host"]; // $ExpectType string +s3urls.toUrl("bucket", "key")["bucket-in-path"]; // $ExpectType string + +s3urls.valid("s3://bucket/key"); // $ExpectType boolean +s3urls.valid("invalid"); // $ExpectType boolean + +s3urls.convert("s3://bucket/key", "s3"); // $ExpectType string +s3urls.convert("s3://bucket/key", "bucket-in-path"); // $ExpectType string +s3urls.convert("s3://bucket/key", "bucket-in-host"); // $ExpectType string + +s3urls.fromUrl("s3://bucket/key"); // $ExpectType object diff --git a/types/mapbox__s3urls/tsconfig.json b/types/mapbox__s3urls/tsconfig.json new file mode 100644 index 0000000000..9c3d217340 --- /dev/null +++ b/types/mapbox__s3urls/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "paths": { + "@mapbox/s3urls": ["mapbox__s3urls"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "mapbox__s3urls-tests.ts"] +} diff --git a/types/mapbox__s3urls/tslint.json b/types/mapbox__s3urls/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mapbox__s3urls/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/mem-cache/index.d.ts b/types/mem-cache/index.d.ts new file mode 100644 index 0000000000..df2a0db47d --- /dev/null +++ b/types/mem-cache/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for mem-cache 1.0 +// Project: https://github.com/silviom/node-mem-cache +// Definitions by: Pedro Mutter +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { EventEmitter } from 'events'; + +interface CacheOptions { + timeout?: number; + doesNotRenewTimeout?: boolean; + timeoutDisabled?: boolean; +} + +declare class Cache extends EventEmitter { + keys: string[]; + length: number; + + constructor(options?: number | CacheOptions); + + set(key: string, value: any, timeout?: number): void; + get(key: string): any; + remove(key: string): void; + clean(): void; +} + +export = Cache; diff --git a/types/mem-cache/mem-cache-tests.ts b/types/mem-cache/mem-cache-tests.ts new file mode 100644 index 0000000000..747ffd75c2 --- /dev/null +++ b/types/mem-cache/mem-cache-tests.ts @@ -0,0 +1,10 @@ +import Cache = require('mem-cache'); + +const cache = new Cache(); // $ExpectType Cache + +cache.set('foo', 'bar'); // $ExpectType void +cache.get('foo'); // $ExpectType any +cache.remove('foo'); // $ExpectType void +cache.clean(); // $ExpectType void +cache.length; // $ExpectType number +cache.keys; // $ExpectType string[] diff --git a/types/mem-cache/tsconfig.json b/types/mem-cache/tsconfig.json new file mode 100644 index 0000000000..3c3a2e701a --- /dev/null +++ b/types/mem-cache/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mem-cache-tests.ts" + ], + "baseUrl": "types", + "typeRoots": ["types"] +} diff --git a/types/mem-cache/tslint.json b/types/mem-cache/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mem-cache/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/mermaid/mermaid-tests.ts b/types/mermaid/mermaid-tests.ts index 6d5b218ce4..a94355fb67 100644 --- a/types/mermaid/mermaid-tests.ts +++ b/types/mermaid/mermaid-tests.ts @@ -13,7 +13,7 @@ mermaid.initialize(config); // mermaidAPI usage const { mermaidAPI } = mermaid; -mermaidAPI.initalize({}); +mermaidAPI.initialize({}); const element = document.querySelector("#graphDiv")!; diff --git a/types/mermaid/mermaidAPI.d.ts b/types/mermaid/mermaidAPI.d.ts index 11077d88c4..127a679dae 100644 --- a/types/mermaid/mermaidAPI.d.ts +++ b/types/mermaid/mermaidAPI.d.ts @@ -240,7 +240,7 @@ declare namespace mermaidAPI { function parse(text: string): any; - function initalize(options: Config): void; + function initialize(options: Config): void; function getConfig(): Config; } diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index b7d3b5d9c6..d9f9d789f0 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -16,6 +16,8 @@ // Dan Manastireanu // stablio // Emmanuel Gautier +// Frontend Monster +// Ming Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -316,6 +318,16 @@ declare module "mongoose" { readyState: number; } + /** + * Connection optional settings. + * + * see + * https://mongoosejs.com/docs/api.html#mongoose_Mongoose-connect + * and + * http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html + * for all available options. + * + */ interface ConnectionOptionsBase { /** database Name for Mongodb Atlas Connection */ dbName?: string; @@ -339,11 +351,13 @@ declare module "mongoose" { poolSize?: number; /** Reconnect on error (default: true) */ autoReconnect?: boolean; - /** TCP KeepAlive on the socket with a X ms delay before start (default: 0). */ - keepAlive?: number; - /** TCP Connection timeout setting (default: 0) */ + /** TCP Connection keep alive enabled (default: true) */ + keepAlive?: boolean; + /** The number of milliseconds to wait before initiating keepAlive on the TCP socket (default 30000) */ + keepAliveInitialDelay?: number; + /** TCP Connection timeout setting (default: 30000) */ connectTimeoutMS?: number; - /** TCP Socket timeout setting (default: 0) */ + /** TCP Socket timeout setting (default: 360000) */ socketTimeoutMS?: number; /** If the database authentication is dependent on another databaseName. */ authSource?: string; @@ -1310,7 +1324,7 @@ declare module "mongoose" { * @param kind optional kind property for the error * @returns the current ValidationError, with all currently invalidated paths */ - invalidate(path: string, errorMsg: string | NativeError, value: any, kind?: string): Error.ValidationError | boolean; + invalidate(path: string, errorMsg: string | NativeError, value?: any, kind?: string): Error.ValidationError | boolean; /** Returns true if path was directly set and modified, else false. */ isDirectModified(path: string): boolean; diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index 8e6a60fdc7..30b5b51a84 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -726,6 +726,7 @@ doc.execPopulate().then(function (arg) { doc.get('path', Number); doc.init(doc).init(doc, {}); doc.inspect(); +doc.invalidate('path', new Error('hi')).toString(); doc.invalidate('path', new Error('hi'), 999).toString(); doc.isDirectModified('path').valueOf(); doc.isInit('path').valueOf(); diff --git a/types/moo/index.d.ts b/types/moo/index.d.ts index fd53f98e0a..2dd1a4b4db 100644 --- a/types/moo/index.d.ts +++ b/types/moo/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for moo 0.4 +// Type definitions for moo 0.5 // Project: https://github.com/tjvr/moo#readme // Definitions by: Nikita Litvin // Jรถrg Vehlow @@ -11,6 +11,15 @@ export as namespace moo; */ export const error: { error: true }; +/** + * Reserved token for indicating a fallback rule. + */ +export const fallback: { fallback: true }; + +export type TypeMapper = (x: string) => string; + +export function keywords(kws: {[k: string]: string | string[]}): TypeMapper; + export function compile(rules: Rules): Lexer; export function states(states: {[x: string]: Rules}, start?: string): Lexer; @@ -45,9 +54,11 @@ export interface Rule { */ value?: (x: string) => string; - keywords?: { - [x: string]: string | string[] - }; + /** + * Used for mapping one set of types to another. + * See https://github.com/no-context/moo#keywords for an example + */ + type?: TypeMapper; } export interface Rules { [x: string]: RegExp | string | string[] | Rule | Rule[]; diff --git a/types/moo/moo-tests.ts b/types/moo/moo-tests.ts index c82bedd219..5cb9fa6f5b 100644 --- a/types/moo/moo-tests.ts +++ b/types/moo/moo-tests.ts @@ -20,20 +20,21 @@ lexer = moo.compile({ lexer = moo.compile({ IDEN: { - match: /[a-zA-Z]+/, keywords: { + match: /[a-zA-Z]+/, + type: moo.keywords({ KW: ['while', 'if', 'else', 'moo', 'reloacows'] - } + }) }, SPACE: { match: /\s+/, lineBreaks: true } }); lexer = moo.compile({ name: { - match: /[a-zA-Z]+/, keywords: { + match: /[a-zA-Z]+/, type: moo.keywords({ 'kw-class': 'class', 'kw-def': 'def', 'kw-if': 'if', - } + }) } }); diff --git a/types/mssql/index.d.ts b/types/mssql/index.d.ts index 891186f7ee..085ab122c1 100644 --- a/types/mssql/index.d.ts +++ b/types/mssql/index.d.ts @@ -288,6 +288,12 @@ export declare class RequestError implements Error { public name: string; public message: string; public code: string; + public number?: number; + public state?: number; + public class?: number; + public lineNumber?: number; + public serverName?: string; + public procName?: string; } export declare class Transaction extends events.EventEmitter { diff --git a/types/mui-datatables/index.d.ts b/types/mui-datatables/index.d.ts new file mode 100644 index 0000000000..055406cc6f --- /dev/null +++ b/types/mui-datatables/index.d.ts @@ -0,0 +1,173 @@ +// Type definitions for mui-datatables 2.0 +// Project: https://github.com/gregnb/mui-datatable +// Definitions by: Jeroen "Favna" Claassens +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from 'react'; + +interface MUIDataTableData { + index: number; + data: any[]; +} + +interface MUIDataTableStateRows { + data: string[]; + lookup: any; +} + +interface MUIDataTableState { + announceText: string | null; + activeColumn: string | null; + page: number; + rowsPerPage: number; + filterList: string[][]; + selectedRows: MUIDataTableStateRows; + expandedRows: MUIDataTableStateRows; + showResponsive: boolean; + searchText: string | null; + rowsPerPageOptions: number[]; +} + +interface MUIDataTableMeta { + rowIndex: number; + columnIndex: number; + columnData: MUIDataTableColumnOptions[]; + rowData: any[]; + tableData: MUIDataTableData[]; + tableState: MUIDataTableState; +} + +interface MUIDataTableCustomHeadRenderer extends MUIDataTableColumn { + index: number; +} + +interface MUIDataTableColumn { + name: string; + options?: MUIDataTableColumnOptions; +} + +interface MUIDataTableTextLabelsBody { + noMatch: string; + toolTip: string; +} + +interface MUIDataTableTextLabelsPagination { + next: string; + previous: string; + rowsPerPage: string; + displayRows: string; +} + +interface MUIDataTableTextLabelsToolbar { + search: string; + downloadCsv: string; + print: string; + viewColumns: string; + filterTable: string; +} + +interface MUIDataTableTextLabelsFilter { + all: string; + title: string; + reset: string; +} + +interface MUIDataTableTextLabelsViewColumns { + title: string; + titleAria: string; +} + +interface MUIDataTableTextLabelsSelectedRows { + text: string; + delete: string; + deleteAria: string; +} + +interface MUIDataTableTextLabels { + body: MUIDataTableTextLabelsBody; + pagination: MUIDataTableTextLabelsPagination; + toolbar: MUIDataTableTextLabelsToolbar; + filter: MUIDataTableTextLabelsFilter; + viewColumns: MUIDataTableTextLabelsViewColumns; + selectedRows: MUIDataTableTextLabelsSelectedRows; +} + +export interface MUIDataTableColumnOptions { + display?: 'true' | 'false' | 'excluded'; + filter?: boolean; + filterList?: string[]; + filterOptions?: string[]; + sort?: boolean; + sortDirection?: 'asc' | 'desc'; + download?: boolean; + hint?: string; + customHeadRender?: (columnMeta: MUIDataTableCustomHeadRenderer, updateDirection: (params: any) => any) => string; + customBodyRender?: (value: any, tableMeta: MUIDataTableMeta, updateValue: (s: any, c: any, p: any) => any) => string | React.ReactNode; + setCellProps?: (cellValue: string, rowIndex: number, columnIndex: number) => string; +} + +export interface MUIDataTableOptions { + page?: number; + count?: number; + serverSide?: boolean; + rowsSelected?: any[]; + filterType?: 'dropdown' | 'checkbox' | 'multiselect' | 'textField'; + textLabels?: MUIDataTableTextLabels; + pagination?: boolean; + selectableRows?: boolean; + IsRowSelectable?: (dataIndex: any) => boolean; + resizableColumns?: boolean; + expandableRows?: boolean; + renderExpandableRow?: (rowData: string[], rowMeta: { dataIndex: number; rowIndex: number }) => React.ReactNode; + customToolbar?: () => React.ReactNode; + customToolbarSelect?: () => React.ReactNode; + customFooter?: () => React.ReactNode; + customSort?: (data: any[], colIndex: number, order: string) => any[]; + elevation?: number; + caseSensitive?: boolean; + responsive?: 'stacked' | 'scroll'; + rowsPerPage?: number; + rowsPerPageOptions?: number[]; + rowHover?: boolean; + fixedHeader?: boolean; + sortFilterList?: boolean; + sort?: boolean; + filter?: boolean; + search?: boolean; + print?: boolean; + download?: boolean; + downloadOptions?: { filename: string; separator: string }; + viewColumns?: boolean; + onRowsSelect?: (currentRowsSelected: any[], rowsSelected: any[]) => void; + onRowsDelete?: (rowsDeleted: any[]) => void; + onRowClick?: (rowData: string[], rowMeta: { dataIndex: number; rowIndex: number }) => void; + onCellClick?: (colIndex: number, rowIndex: number) => void; + onChangePage?: (currentPage: number) => void; + onChangeRowsPerPage?: (numberOfRows: number) => void; + onSearchChange?: (searchText: string) => void; + onFilterChange?: (changedColumn: string, filterList: any[]) => void; + onColumnSortChange?: (changedColumn: string, direction: string) => void; + onColumnViewChange?: (changedColumn: string, action: string) => void; + onTableChange?: (action: string, tableState: object) => void; + setRowProps?: (row: any[], rowIndex: number) => any; +} + +export type MUIDataTableColumnDef = string | MUIDataTableColumn; + +export interface MuiDatatablesTableState { + page: number; + rowsPerPage: number; + filterList: any[]; +} + +export interface MUIDataTableProps { + title: string; + columns: MUIDataTableColumnDef[]; + data: any[]; + options?: MUIDataTableOptions; +} + +declare const MUIDataTable: React.ComponentType; + +export default MUIDataTable; diff --git a/types/mui-datatables/mui-datatables-tests.tsx b/types/mui-datatables/mui-datatables-tests.tsx new file mode 100644 index 0000000000..5ad018082e --- /dev/null +++ b/types/mui-datatables/mui-datatables-tests.tsx @@ -0,0 +1,83 @@ +import MUIDataTable, { MUIDataTableColumnDef, MUIDataTableOptions } from 'mui-datatables'; +import * as React from 'react'; + +const dataSimple: string[][] = [ + ['Joe James', 'Test Corp', 'Yonkers', 'NY'], + ['John Walsh', 'Test Corp', 'Hartford', 'CT'], + ['Bob Herm', 'Test Corp', 'Tampa', 'FL'], + ['James Houston', 'Test Corp', 'Dallas', 'TX'] +]; + +const columnWithOptions: MUIDataTableColumnDef[] = [ + { + name: 'Name', + options: { + display: 'true', + filter: true, + sort: true, + sortDirection: 'asc', + download: true, + } + } +]; + +const options: MUIDataTableOptions = { + filterType: 'checkbox', + responsive: 'scroll', + selectableRows: false, + elevation: 0, + rowsPerPageOptions: [5, 10, 20, 25, 50, 100], + downloadOptions: { + filename: 'filename.csv', + separator: ',' + }, + sortFilterList: false, + textLabels: { + body: { + noMatch: 'Sorry, no matching records found', + toolTip: 'Sort', + }, + pagination: { + next: 'Next Page', + previous: 'Previous Page', + rowsPerPage: 'Rows per page:', + displayRows: 'of', + }, + toolbar: { + search: 'Search', + downloadCsv: 'Download CSV', + print: 'Print', + viewColumns: 'View Columns', + filterTable: 'Filter Table', + }, + filter: { + all: 'All', + title: 'FILTERS', + reset: 'RESET', + }, + viewColumns: { + title: 'Show Columns', + titleAria: 'Show/Hide Table Columns', + }, + selectedRows: { + text: 'rows(s) selected', + delete: 'Delete', + deleteAria: 'Delete Selected Rows', + } + } +}; + +class MuiDataTable extends React.Component { + render() { + return ( + + ); + } +} + +; diff --git a/types/mui-datatables/tsconfig.json b/types/mui-datatables/tsconfig.json new file mode 100644 index 0000000000..280efbb284 --- /dev/null +++ b/types/mui-datatables/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mui-datatables-tests.tsx" + ] +} diff --git a/types/mui-datatables/tslint.json b/types/mui-datatables/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mui-datatables/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/multiparty/index.d.ts b/types/multiparty/index.d.ts index ca968fefcf..1dbb3e272b 100644 --- a/types/multiparty/index.d.ts +++ b/types/multiparty/index.d.ts @@ -19,6 +19,13 @@ export declare class Form extends events.EventEmitter { * @param callback */ parse(request: http.IncomingMessage, callback?: (error: Error, fields: any, files: any) => any): void; + + on(event: "part", listener: (part: Part) => void): this; + on(event: "close", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "progress", listener: (bytesReceived: number, bytesExpected: number) => void): this; + on(event: "field", listener: (name: string, value: string) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; } export interface File { @@ -29,7 +36,7 @@ export interface File { /** * the filename that the user reports for the file */ - originalFileName: string; + originalFilename: string; /** * the absolute path of the uploaded file on disk */ @@ -44,7 +51,7 @@ export interface File { size: number; } -interface Part extends stream.Readable { +export interface Part extends stream.Readable { /** * the headers for this part. For example, you may be interested in content-type */ diff --git a/types/nconf/index.d.ts b/types/nconf/index.d.ts index ff2d4b77ad..06aba7c8c6 100644 --- a/types/nconf/index.d.ts +++ b/types/nconf/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for nconf +// Type definitions for nconf 0.10 // Project: https://github.com/flatiron/nconf -// Definitions by: Jeff Goddard , Jean-Martin Thibault +// Definitions by: Jeff Goddard , +// Jean-Martin Thibault +// Dave Houston // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/nconf.d.ts @@ -57,6 +59,11 @@ export interface IOptions { [index: string]: any; } +export interface ISecureFileOptions { + secret: string; + alg?: string; +} + export interface IFileOptions { type?: string; file?: string; @@ -64,6 +71,7 @@ export interface IFileOptions { search?: boolean; format?: IFormat; json_spacing?: number; + secure?: ISecureFileOptions; } export interface ICallbackFunction { diff --git a/types/nconf/tslint.json b/types/nconf/tslint.json index a41bf5d19a..a0357daa61 100644 --- a/types/nconf/tslint.json +++ b/types/nconf/tslint.json @@ -7,7 +7,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/needle/index.d.ts b/types/needle/index.d.ts index 509e212c6e..af879cfacc 100644 --- a/types/needle/index.d.ts +++ b/types/needle/index.d.ts @@ -247,6 +247,7 @@ declare namespace needle { export type NeedleCallback = core.NeedleCallback; export type NeedleHttpVerbs = core.NeedleHttpVerbs; export type NeedleOptions = core.NeedleOptions; + export type NeedleResponse = core.NeedleResponse; export type ReadableStream = core.ReadableStream; /** diff --git a/types/needle/needle-tests.ts b/types/needle/needle-tests.ts index a216b1f686..fac7efa58c 100644 --- a/types/needle/needle-tests.ts +++ b/types/needle/needle-tests.ts @@ -73,14 +73,18 @@ function API_head() { function API_get() { // using promises + let resp: needle.NeedleResponse; + needle('get', 'google.com/search?q=syd+barrett') - .then((resp) => { + .then((_resp) => { // if no http:// is found, Needle will automagically prepend it. + resp = _resp; }); // using callback - needle.get('google.com/search?q=syd+barrett', (err, resp) => { + needle.get('google.com/search?q=syd+barrett', (err, _resp) => { // if no http:// is found, Needle will automagically prepend it. + resp = _resp; // assign response }); } diff --git a/types/next-seo/index.d.ts b/types/next-seo/index.d.ts new file mode 100644 index 0000000000..8d7c487393 --- /dev/null +++ b/types/next-seo/index.d.ts @@ -0,0 +1,84 @@ +// Type definitions for next-seo 1.10 +// Project: https://github.com/garmeeh/next-seo#readme +// Definitions by: Thomas Kosiewski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { Component } from "react"; + +export interface NextSeoProps { + config: Config; +} + +export interface Config { + title?: string; + titleTemplate?: string; + description?: string; + canonical?: string; + + dangerouslySetAllPagesToNoIndex?: boolean; + noindex?: boolean; + + twitter?: Twitter; + facebook?: Facebook; + openGraph?: OpenGraph; +} + +export interface Twitter { + cardType?: string; + site?: string; + handle?: string; +} + +export interface Facebook { + appId?: number; +} + +export interface OpenGraph { + url?: string; + type?: string; + title?: string; + description?: string; + images?: ReadonlyArray; + defaultImageHeight?: number; + defaultImageWidth?: number; + locale?: string; + site_name?: string; + + profile?: OpenGraphProfile; + book?: OpenGraphBook; + article?: OpenGraphArticle; +} + +export interface OpenGraphImages { + url?: string; + width?: number; + height?: number; + alt?: string; +} + +export interface OpenGraphProfile { + firstName?: string; + lastName?: string; + username?: string; + gender?: string; +} + +export interface OpenGraphBook { + authors?: ReadonlyArray; + isbn?: string; + releaseDate?: string; + tags?: ReadonlyArray; +} + +export interface OpenGraphArticle { + publishedTime?: string; + modifiedTime?: string; + expirationTime?: string; + + authors?: ReadonlyArray; + section?: string; + tags?: ReadonlyArray; +} + +export default class NextSeo extends Component { } diff --git a/types/next-seo/next-seo-tests.ts b/types/next-seo/next-seo-tests.ts new file mode 100644 index 0000000000..3c2da4b032 --- /dev/null +++ b/types/next-seo/next-seo-tests.ts @@ -0,0 +1,48 @@ +import NextSeo from 'next-seo'; + +new NextSeo({ + config: { + canonical: "", + dangerouslySetAllPagesToNoIndex: false, + description: "", + facebook: { + appId: 0, + }, + noindex: false, + openGraph: { + book: { + authors: [""], + isbn: "", + releaseDate: "", + tags: [""], + }, + defaultImageHeight: 0, + defaultImageWidth: 0, + description: "", + images: [{ + alt: "", + height: 0, + url: "", + width: 0, + }], + locale: "", + profile: { + firstName: "", + gender: "", + lastName: "", + username: "", + }, + site_name: "", + title: "", + type: "", + url: "", + }, + title: "", + titleTemplate: "", + twitter: { + cardType: "", + handle: "", + site: "", + }, + }, +}); diff --git a/types/next-seo/tsconfig.json b/types/next-seo/tsconfig.json new file mode 100644 index 0000000000..faea26b9bc --- /dev/null +++ b/types/next-seo/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "target": "es6", + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "next-seo-tests.ts" + ] +} diff --git a/types/next-seo/tslint.json b/types/next-seo/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/next-seo/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/next/app.d.ts b/types/next/app.d.ts index 392b997f89..3e933c09c6 100644 --- a/types/next/app.d.ts +++ b/types/next/app.d.ts @@ -53,6 +53,6 @@ export type AppComponentType

= NextComponent >; export class Container extends React.Component {} -export default class App

extends React.Component

{ +export default class App

extends React.Component

{ static getInitialProps(context: NextAppContext): Promise; } diff --git a/types/next/document.d.ts b/types/next/document.d.ts index 9ac8985cdf..e0879e1c68 100644 --- a/types/next/document.d.ts +++ b/types/next/document.d.ts @@ -37,7 +37,7 @@ export interface NextDocumentContext exte * https://github.com/zeit/next.js/blob/7.0.0/server/document.js#L16 */ export interface DefaultDocumentIProps extends RenderPageResponse { - styles?: React.ReactNode; + styles?: React.ReactNode[]; } /** diff --git a/types/next/test/next-app-tests.tsx b/types/next/test/next-app-tests.tsx index eaa2c0ad07..514cc24436 100644 --- a/types/next/test/next-app-tests.tsx +++ b/types/next/test/next-app-tests.tsx @@ -6,6 +6,10 @@ interface TestAppProps { pageProps: any; } +interface TestAppState { + color: string; +} + interface TypedQuery extends DefaultQuery { id?: string; } @@ -33,6 +37,20 @@ class TestAppWithProps extends App { } } +class ErrorTestAppWithState extends App { + static async getInitialProps({ Component, router, ctx }: NextAppContext) { + const pageProps = Component.getInitialProps && (await Component.getInitialProps(ctx)); + return { pageProps }; + } + + render() { + const { Component, router, pageProps, example } = this.props; + return ; + } + + state: {}; // $ExpectError +} + class TestAppWithTypedQuery extends App { static async getInitialProps({ ctx }: NextAppContext) { const { id } = ctx.query; diff --git a/types/next/test/next-document-tests.tsx b/types/next/test/next-document-tests.tsx index bf7ccf036d..83d0a0e8a3 100644 --- a/types/next/test/next-document-tests.tsx +++ b/types/next/test/next-document-tests.tsx @@ -35,7 +35,9 @@ class MyDocumentDefault extends Document { } class MyDoc extends Document { - static getInitialProps({ req, renderPage }: NextDocumentContext) { + static async getInitialProps(ctx: NextDocumentContext) { + const { req, renderPage } = ctx; + // without callback const _page = renderPage(); @@ -43,7 +45,9 @@ class MyDoc extends Document { const enhancer: Enhancer = App => props => ; const { html, head, buildManifest } = renderPage(enhancer); - const styles = [ - - {body} + + + + {body} ) ); diff --git a/types/react-loadable/index.d.ts b/types/react-loadable/index.d.ts index 8661716e75..2e38f58c39 100644 --- a/types/react-loadable/index.d.ts +++ b/types/react-loadable/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-loadable 5.5 // Project: https://github.com/thejameskyle/react-loadable#readme -// Definitions by: Jessica Franco +// Definitions by: Jessica Franco // Oden S. // Ian Ker-Seymer // Tomek ลaziuk diff --git a/types/react-native-fbsdk/index.d.ts b/types/react-native-fbsdk/index.d.ts index eacc05209e..5049669e35 100644 --- a/types/react-native-fbsdk/index.d.ts +++ b/types/react-native-fbsdk/index.d.ts @@ -639,6 +639,12 @@ export namespace AppEventsLogger { */ function flush(): void; + /** + * Sets a custom user ID to associate with all app events. + * The userID is persisted until it is cleared by passing nil. + */ + function setUserID(userID: string | null): void; + /** * For iOS only, sets and sends device token to register the current application for push notifications. * @platform ios diff --git a/types/react-native-platform-touchable/index.d.ts b/types/react-native-platform-touchable/index.d.ts new file mode 100644 index 0000000000..561019475e --- /dev/null +++ b/types/react-native-platform-touchable/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for react-native-platform-touchable 1.1 +// Project: https://github.com/react-native-community/react-native-platform-touchable +// Definitions by: Toni Granados +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; +import { BackgroundPropType, RippleBackgroundPropType, ThemeAttributeBackgroundPropType, TouchableWithoutFeedbackProps } from "react-native"; + +export interface PlatformTouchableProps extends TouchableWithoutFeedbackProps { + // TouchableOpacity (default iOS) + activeOpacity?: number; + // TouchableNativeFeedback (default Android) + background?: BackgroundPropType; + foreground?: boolean; + // TouchableHighlight + underlayColor?: string; + onHideUnderlay?: () => void; + onShowUnderlay?: () => void; +} + +export class Touchable extends React.Component { + // TouchableOpacity (default iOS) + setOpacityTo: (value: number) => void; + // TouchableNativeFeedback (default Android) + static SelectableBackground(): ThemeAttributeBackgroundPropType; + static SelectableBackgroundBorderless(): ThemeAttributeBackgroundPropType; + static Ripple(color: string, borderless?: boolean): RippleBackgroundPropType; + static canUseNativeForeground(): boolean; +} + +export default Touchable; diff --git a/types/react-native-platform-touchable/react-native-platform-touchable-tests.tsx b/types/react-native-platform-touchable/react-native-platform-touchable-tests.tsx new file mode 100644 index 0000000000..19f9952d6c --- /dev/null +++ b/types/react-native-platform-touchable/react-native-platform-touchable-tests.tsx @@ -0,0 +1,19 @@ +import * as React from "react"; +import { Text, View } from "react-native"; +import Touchable from "react-native-platform-touchable"; + +class PlatformTouchableExample extends React.Component { + render() { + return ( + + {}} + style={{ backgroundColor: "#eee", padding: 30 }} + background={Touchable.Ripple("pink", false)} + > + Hello there! + + + ); + } +} diff --git a/types/react-native-platform-touchable/tsconfig.json b/types/react-native-platform-touchable/tsconfig.json new file mode 100644 index 0000000000..5cbb1ffb1a --- /dev/null +++ b/types/react-native-platform-touchable/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "jsx": "react-native", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "react-native-platform-touchable-tests.tsx"] +} diff --git a/types/react-native-platform-touchable/tslint.json b/types/react-native-platform-touchable/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-platform-touchable/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 2b59454222..4b06119df2 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -4111,6 +4111,11 @@ export class FlatList extends React.Component> { * by taps on items or by navigation actions. */ recordInteraction: () => void; + + /** + * Displays the scroll indicators momentarily. + */ + flashScrollIndicators: () => void; } /** diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 1fcbe153e6..801565dc8d 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -332,6 +332,14 @@ InteractionManager.runAfterInteractions(() => { }).then(() => "done"); export class FlatListTest extends React.Component, {}> { + list: FlatList | null = null; + + componentDidMount(): void { + if (this.list) { + this.list.flashScrollIndicators(); + } + } + _renderItem = (rowData: any) => { return ( @@ -345,6 +353,7 @@ export class FlatListTest extends React.Component, {}> { render() { return ( (this.list = list)} data={[1, 2, 3, 4, 5]} renderItem={this._renderItem} ItemSeparatorComponent={this._renderSeparator} diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 08e4343e42..2d5146289f 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -6,6 +6,7 @@ // Nicolas Pirotte // Cameron Knight // Kaare Hoff Skovgaard +// Matt Krick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 @@ -131,14 +132,14 @@ export interface PageInfo { } export interface ConnectionData { edges?: ReadonlyArray; - pageInfo?: Partial; + pageInfo?: Partial | null; } export type RelayPaginationProp = RelayProp & { hasMore(): boolean; isLoading(): boolean; loadMore( pageSize: number, - callback: (error?: Error) => void, + callback?: ((error?: Error) => void) | null, options?: RefetchOptions ): RelayRuntimeTypes.Disposable | undefined | null; refetchConnection( diff --git a/types/react-simple-maps/index.d.ts b/types/react-simple-maps/index.d.ts index e76c4e3f0d..49e392035d 100644 --- a/types/react-simple-maps/index.d.ts +++ b/types/react-simple-maps/index.d.ts @@ -1,10 +1,12 @@ // Type definitions for react-simple-maps 0.12 // Project: https://github.com/zcreativelabs/react-simple-maps#readme // Definitions by: Novikov Mihail +// Andrej Mihajlov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from 'react'; +import { GeoProjection } from 'd3-geo'; export type Point = [number, number]; @@ -19,17 +21,21 @@ export interface Line { }; } +export interface ProjectionConfig { + scale: number; + xOffset: number; + yOffset: number; + rotation: [number, number, number]; + precision: number; +} + +export type ProjectionFunction = (width: number, height: number, config: ProjectionConfig) => GeoProjection; + export interface ComposableMapProps { width?: number; height?: number; - projection?: string | (() => void); - projectionConfig?: { - scale?: number; - xOffset?: number; - yOffset?: number; - rotation?: number[]; - precision?: number; - }; + projection?: string | ProjectionFunction; + projectionConfig?: Partial; style?: React.CSSProperties; defs?: SVGDefsElement; className?: string; @@ -68,7 +74,7 @@ export interface ZoomableGroupProps { export interface GeographiesProps { disableOptimization?: boolean; geography?: string | { [key: string]: any } | string[]; - children?: (geographies: object[], projection: (point: Point) => void) => void; + children?: (geographies: object[], projection: GeoProjection) => void; } export interface GeographyProps { @@ -76,7 +82,7 @@ export interface GeographyProps { precision?: number; round?: boolean; geography?: object; - projection?: (point: Point) => void; + projection?: GeoProjection; tabable?: boolean; style?: { default?: React.CSSProperties; diff --git a/types/react-slick/index.d.ts b/types/react-slick/index.d.ts index d20aef9a02..ba91138017 100644 --- a/types/react-slick/index.d.ts +++ b/types/react-slick/index.d.ts @@ -8,19 +8,21 @@ import * as React from "react"; -type ComponentConstructor = React.ComponentClass | React.StatelessComponent; +type ComponentConstructor = + | React.ComponentClass + | React.StatelessComponent; export interface CustomArrowProps { - className?: string; - style?: React.CSSProperties; - onClick?: React.MouseEventHandler; - currentSlide?: number; - slideCount?: number; + className?: string; + style?: React.CSSProperties; + onClick?: React.MouseEventHandler; + currentSlide?: number; + slideCount?: number; } export interface ResponsiveObject { - breakpoint: number; - settings: "unslick" | Settings; + breakpoint: number; + settings: "unslick" | Settings; } export type SwipeDirection = "left" | "down" | "right" | "up" | string; @@ -28,64 +30,66 @@ export type SwipeDirection = "left" | "down" | "right" | "up" | string; export type LazyLoadTypes = "ondemand" | "progressive"; export interface Settings { - accessibility?: boolean; - adaptiveHeight?: boolean; - afterChange?(currentSlide: number): void; - appendDots?(dots: React.ReactNode): JSX.Element; - arrows?: boolean; - asNavFor?: Slider; - autoplaySpeed?: number; - autoplay?: boolean; - beforeChange?(currentSlide: number, nextSlide: number): void; - centerMode?: boolean; - centerPadding?: string; - className?: string; - cssEase?: string; - customPaging?(index: number): JSX.Element; - dotsClass?: string; - dots?: boolean; - draggable?: boolean; - easing?: string; - edgeFriction?: number; - fade?: boolean; - focusOnSelect?: boolean; - infinite?: boolean; - initialSlide?: number; - lazyLoad?: LazyLoadTypes; - nextArrow?: JSX.Element; - onEdge?(swipeDirection: SwipeDirection): void; - onInit?(): void; - onLazyLoad?(slidesToLoad: number[]): void; - onReInit?(): void; - onSwipe?(swipeDirection: SwipeDirection): void; - pauseOnDotsHover?: boolean; - pauseOnFocus?: boolean; - pauseOnHover?: boolean; - prevArrow?: JSX.Element; - responsive?: ResponsiveObject[]; - rows?: number; - rtl?: boolean; - slide?: string; - slidesPerRow?: number; - slidesToScroll?: number; - slidesToShow?: number; - speed?: number; - swipeToSlide?: boolean; - swipe?: boolean; - swipeEvent?(swipeDirection: SwipeDirection): void; - touchMove?: boolean; - touchThreshold?: number; - useCSS?: boolean; - useTransform?: boolean; - variableWidth?: boolean; - vertical?: boolean; - waitForAnimate?: boolean; + accessibility?: boolean; + adaptiveHeight?: boolean; + afterChange?(currentSlide: number): void; + appendDots?(dots: React.ReactNode): JSX.Element; + arrows?: boolean; + asNavFor?: Slider; + autoplaySpeed?: number; + autoplay?: boolean; + beforeChange?(currentSlide: number, nextSlide: number): void; + centerMode?: boolean; + centerPadding?: string; + className?: string; + cssEase?: string; + customPaging?(index: number): JSX.Element; + dotsClass?: string; + dots?: boolean; + draggable?: boolean; + easing?: string; + edgeFriction?: number; + fade?: boolean; + focusOnSelect?: boolean; + infinite?: boolean; + initialSlide?: number; + lazyLoad?: LazyLoadTypes; + nextArrow?: JSX.Element; + onEdge?(swipeDirection: SwipeDirection): void; + onInit?(): void; + onLazyLoad?(slidesToLoad: number[]): void; + onReInit?(): void; + onSwipe?(swipeDirection: SwipeDirection): void; + pauseOnDotsHover?: boolean; + pauseOnFocus?: boolean; + pauseOnHover?: boolean; + prevArrow?: JSX.Element; + responsive?: ResponsiveObject[]; + rows?: number; + rtl?: boolean; + slide?: string; + slidesPerRow?: number; + slidesToScroll?: number; + slidesToShow?: number; + speed?: number; + swipeToSlide?: boolean; + swipe?: boolean; + swipeEvent?(swipeDirection: SwipeDirection): void; + touchMove?: boolean; + touchThreshold?: number; + useCSS?: boolean; + useTransform?: boolean; + variableWidth?: boolean; + vertical?: boolean; + waitForAnimate?: boolean; } declare class Slider extends React.Component { - slickNext(): void; - slickPrev(): void; - slickGoTo(slideNumber: number, dontAnimate?: boolean): void; + slickNext(): void; + slickPause(): void; + slickPlay(): void; + slickPrev(): void; + slickGoTo(slideNumber: number, dontAnimate?: boolean): void; } export default Slider; diff --git a/types/react-sortable-tree/utils/tree-data-utils.d.ts b/types/react-sortable-tree/utils/tree-data-utils.d.ts index b80e82dd81..88dc6d82ac 100644 --- a/types/react-sortable-tree/utils/tree-data-utils.d.ts +++ b/types/react-sortable-tree/utils/tree-data-utils.d.ts @@ -8,7 +8,7 @@ export function getDescendantCount(data: TreeNode & {ignoreCollapsed?: boolean}) export function getVisibleNodeCount(data: FullTree): number; export function getVisibleNodeInfoAtIndex( data: FullTree & { - targetIndex: number, + index: number, getNodeKey: GetNodeKeyFunction, }): TreeNode & TreePath & {lowerSiblingsCounts: number[]} | null; export function walk(data: WalkAndMapFunctionParameters): void; diff --git a/types/react-ultimate-pagination/index.d.ts b/types/react-ultimate-pagination/index.d.ts new file mode 100644 index 0000000000..2f7c26c210 --- /dev/null +++ b/types/react-ultimate-pagination/index.d.ts @@ -0,0 +1,130 @@ +// Type definitions for react-ultimate-pagination 1.2 +// Project: https://github.com/ultimate-pagination/react-ultimate-pagination +// Definitions by: Ben Lorantfy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 +import * as React from "react"; + +export interface PaginationComponentProps { + /** + * Number of pages that user should navigate to when item is activated (for items with type `PAGE` it also can be used as a label in UI) + */ + value: number; + + /** + * Show if `currentPage` if the same as `value` of an item (can be used to highlight a current page or disable first, previous, next or last page links when user is already on first/last page) + */ + isActive: boolean; + + /** + * Show if button should be disabled + */ + isDisabled: boolean; + + /** + * Should be called when user interacted with a component and the current page should be changed to the page represented by item (no arguments should be used, can be used for all item types) + */ + onClick: () => void; +} + +export enum ITEM_TYPES { + PAGE = "PAGE", + ELLIPSIS = "ELLIPSIS", + FIRST_PAGE_LINK = "FIRST_PAGE_LINK", + PREVIOUS_PAGE_LINK = "PREVIOUS_PAGE_LINK", + NEXT_PAGE_LINK = "NEXT_PAGE_LINK", + LAST_PAGE_LINK = "LAST_PAGE_LINK", +} + +export interface ItemTypeToComponent { + /** + * A link to a page + */ + PAGE: React.ComponentType; + + /** + * An item that represents groups of pages that currently are not visible in paginator (can be used to navigate to the page in the group that is the nearest to the current page) + */ + ELLIPSIS: React.ComponentType; + + /** + * A link to the first page + */ + FIRST_PAGE_LINK: React.ComponentType; + + /** + * A link to the previous page + */ + PREVIOUS_PAGE_LINK: React.ComponentType; + + /** + * A link to the next page + */ + NEXT_PAGE_LINK: React.ComponentType; + + /** + * A link to the last page + */ + LAST_PAGE_LINK: React.ComponentType; +} + +export interface CreateUltimatePaginationOptions { + /** + * An object that is used as a map from the item type to the React.js component that will be used to render this item + */ + itemTypeToComponent: ItemTypeToComponent; + + /** + * A React.js component that will be used as a wrapper for pagination items + */ + WrapperComponent?: string|React.ComponentType; +} + +export interface UltimatePaginationProps { + /** + * Current page number + */ + currentPage: number; + + /** + * Total number of pages + */ + totalPages: number; + + /** + * Number of always visible pages at the beginning and end + */ + boundaryPagesRange?: number; + + /** + * Number of always visible pages before and after the current one + */ + siblingPagesRange?: number; + + /** + * Boolean flag to hide ellipsis + */ + hideEllipsis?: boolean; + + /** + * Boolean flag to hide previous and next page links + */ + hidePreviousAndNextPageLinks?: boolean; + + /** + * Boolean flag to hide first and last page links + */ + hideFirstAndLastPageLinks?: boolean; + + /** + * Callback that will be called with new page when it should be changed by user interaction + */ + onChange?: (newPage: number) => void; + + /** + * Boolean flag to disable all buttons in pagination + */ + disabled?: boolean; +} + +export function createUltimatePagination(options: CreateUltimatePaginationOptions): React.ComponentType; diff --git a/types/react-ultimate-pagination/react-ultimate-pagination-tests.tsx b/types/react-ultimate-pagination/react-ultimate-pagination-tests.tsx new file mode 100644 index 0000000000..8cebdcbf52 --- /dev/null +++ b/types/react-ultimate-pagination/react-ultimate-pagination-tests.tsx @@ -0,0 +1,93 @@ +import * as React from "react"; +import { + PaginationComponentProps, + createUltimatePagination, + ItemTypeToComponent, + ITEM_TYPES +} from "react-ultimate-pagination"; + +function Page(props: PaginationComponentProps) { + return ( + + ); +} + +function PageWithExtraProps(props: PaginationComponentProps & { color: "red" }) { + return ( + + ); +} + +function Ellipsis(props: PaginationComponentProps) { + return ; +} + +function FirstPageLink(props: PaginationComponentProps) { + return ; +} + +function PreviousPageLink(props: PaginationComponentProps) { + return ; +} + +function NextPageLink(props: PaginationComponentProps) { + return ; +} + +function LastPageLink(props: PaginationComponentProps) { + return ; +} + +function Wrapper(props: { children: React.ReactChildren }) { + return

{props.children}
; +} + +// ItemTypeToComponent using strings +const itemTypeToComponent: ItemTypeToComponent = { + PAGE: Page, + ELLIPSIS: Ellipsis, + FIRST_PAGE_LINK: FirstPageLink, + PREVIOUS_PAGE_LINK: PreviousPageLink, + NEXT_PAGE_LINK: NextPageLink, + LAST_PAGE_LINK: LastPageLink +}; + +// ItemTypeToComponent using enum +const itemTypeToComponent2: ItemTypeToComponent = { + [ITEM_TYPES.PAGE]: Page, + [ITEM_TYPES.ELLIPSIS]: Ellipsis, + [ITEM_TYPES.FIRST_PAGE_LINK]: FirstPageLink, + [ITEM_TYPES.PREVIOUS_PAGE_LINK]: PreviousPageLink, + [ITEM_TYPES.NEXT_PAGE_LINK]: NextPageLink, + [ITEM_TYPES.LAST_PAGE_LINK]: LastPageLink +}; + +// ItemTypeToComponent using Page with extra props +const itemTypeToComponent3: Partial = { + [ITEM_TYPES.PAGE]: PageWithExtraProps, +}; + +const UltimatePagination = createUltimatePagination({ itemTypeToComponent, WrapperComponent: Wrapper }); // $ExpectType ComponentType + +// With required props +; + +// With all props + {}} + siblingPagesRange={99} +/>; + +// With unspported prop +; // $ExpectError diff --git a/types/react-ultimate-pagination/tsconfig.json b/types/react-ultimate-pagination/tsconfig.json new file mode 100644 index 0000000000..748045849b --- /dev/null +++ b/types/react-ultimate-pagination/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-ultimate-pagination-tests.tsx" + ] +} diff --git a/types/react-ultimate-pagination/tslint.json b/types/react-ultimate-pagination/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-ultimate-pagination/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 1df5c5256a..a87874b9fd 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React 16.7 +// Type definitions for React 16.8 // Project: http://facebook.github.io/react/ // Definitions by: Asana // AssureSign @@ -18,8 +18,9 @@ // Olivier Pascal // Martin Hochel // Frank Li -// Jessica Franco +// Jessica Franco // Paul Sherman +// Sunil Pai // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -57,6 +58,10 @@ declare namespace React { ComponentType

; type ComponentType

= ComponentClass

| FunctionComponent

; + type JSXElementConstructor

= + | ((props: P) => ReactElement | null) + | (new (props: P) => Component); + type Key = string | number; interface RefObject { @@ -78,33 +83,35 @@ declare namespace React { ref?: LegacyRef; } - interface ReactElement

{ - type: string | ComponentClass

| FunctionComponent

; + interface ReactElement = string | JSXElementConstructor> { + type: T; props: P; key: Key | null; } + interface ReactComponentElement< + T extends keyof JSX.IntrinsicElements | JSXElementConstructor, + P = Pick, Exclude, 'key' | 'ref'>> + > extends ReactElement { } + /** * @deprecated Please use `FunctionComponentElement` */ type SFCElement

= FunctionComponentElement

; - interface FunctionComponentElement

extends ReactElement

{ - type: FunctionComponent

; + interface FunctionComponentElement

extends ReactElement> { ref?: 'ref' extends keyof P ? P extends { ref?: infer R } ? R : never : never; } type CElement> = ComponentElement; - interface ComponentElement> extends ReactElement

{ - type: ComponentClass

; + interface ComponentElement> extends ReactElement> { ref?: LegacyRef; } type ClassicElement

= CElement>; // string fallback for custom web-components - interface DOMElement

| SVGAttributes, T extends Element> extends ReactElement

{ - type: string; + interface DOMElement

| SVGAttributes, T extends Element> extends ReactElement { ref: LegacyRef; } @@ -469,7 +476,7 @@ declare namespace React { } interface RefForwardingComponent { - (props: P & { children?: ReactNode }, ref: Ref | null): ReactElement | null; + (props: P & { children?: ReactNode }, ref: Ref): ReactElement | null; propTypes?: WeakValidationMap

; contextTypes?: ValidationMap; defaultProps?: Partial

; @@ -491,10 +498,6 @@ declare namespace React { getDefaultProps?(): P; } - type JSXElementConstructor

= - | ((props: P) => ReactElement | null) - | (new (props: P) => Component); - /** * We use an intersection type to infer multiple type parameters from * a single argument, which is useful for many top-level API defs. @@ -867,15 +870,15 @@ declare namespace React { function useEffect(effect: EffectCallback, inputs?: InputIdentityList): void; // NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref /** - * `useImperativeMethods` customizes the instance value that is exposed to parent components when using + * `useImperativeHandle` customizes the instance value that is exposed to parent components when using * `ref`. As always, imperative code using refs should be avoided in most cases. * - * `useImperativeMethods` should be used with `React.forwardRef`. + * `useImperativeHandle` should be used with `React.forwardRef`. * * @version experimental - * @see https://reactjs.org/docs/hooks-reference.html#useimperativemethods + * @see https://reactjs.org/docs/hooks-reference.html#useimperativehandle */ - function useImperativeMethods(ref: Ref|undefined, init: () => R, inputs?: InputIdentityList): void; + function useImperativeHandle(ref: Ref|undefined, init: () => R, inputs?: InputIdentityList): void; // I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key // useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y. /** @@ -2586,12 +2589,11 @@ declare namespace React { // ---------------------------------------------------------------------- interface ReactChildren { - map>(children: C[], fn: (child: C, index: number) => T): T[]; - map(children: ReactNode, fn: (child: ReactChild, index: number) => T): T[]; - forEach(children: ReactNode, fn: (child: ReactChild, index: number) => void): void; - count(children: ReactNode): number; - only(children: ReactNode): ReactElement; - toArray(children: ReactNode): ReactChild[]; + map(children: C | C[], fn: (child: C, index: number) => T): T[]; + forEach(children: C | C[], fn: (child: C, index: number) => void): void; + count(children: any): number; + only(children: C): C extends any[] ? never : C; + toArray(children: C | C[]): C[]; } // @@ -2670,7 +2672,7 @@ type ReactManagedAttributes = C extends { propTypes: infer T; defaultProps declare global { namespace JSX { // tslint:disable-next-line:no-empty-interface - interface Element extends React.ReactElement { } + interface Element extends React.ReactElement { } interface ElementClass extends React.Component { render(): React.ReactNode; } diff --git a/types/react/test/hooks.tsx b/types/react/test/hooks.tsx index 5239d3b522..5cb0c1512c 100644 --- a/types/react/test/hooks.tsx +++ b/types/react/test/hooks.tsx @@ -21,7 +21,7 @@ export const FancyButton = React.forwardRef((props: FancyButtonProps, ref: React const buttonRef = React.useRef(null); const [count, setCount] = React.useState(0); - React.useImperativeMethods(ref, () => ({ + React.useImperativeHandle(ref, () => ({ fancyClick() { buttonRef.current!; // $ExpectType HTMLButtonElement }, @@ -91,7 +91,7 @@ function useEveryHook(ref: React.Ref<{ id: number }>|undefined): () => boolean { const didLayout = React.useRef(false); const id = React.useMemo(() => Math.random(), []); - React.useImperativeMethods(ref, () => ({ id }), [id]); + React.useImperativeHandle(ref, () => ({ id }), [id]); // $ExpectError React.useImperativeMethods(ref, () => ({}), [id]); diff --git a/types/react/test/index.ts b/types/react/test/index.ts index a2c6ebab36..ada2f860ba 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -488,7 +488,7 @@ DOM.svg({ // -------------------------------------------------------------------------- const mappedChildrenArray: number[] = - React.Children.map(children, (child) => 42); + React.Children.map(children, (child: any) => 42); const childrenArray: Array> = children; const mappedChildrenArrayWithKnownChildren: number[] = React.Children.map(childrenArray, (child) => child.props.p); @@ -498,6 +498,23 @@ let onlyChild: React.ReactElement = React.Children.only(DOM.div()); // ok onlyChild = React.Children.only([null, [[["Hallo"], true]], false]); // error const childrenToArray: React.ReactChild[] = React.Children.toArray(children); +declare const numberChildren: number[]; +declare const elementChildren: JSX.Element[]; +declare const mixedChildren: Array; +declare const singlePluralChildren: JSX.Element | JSX.Element[]; +declare const renderPropsChildren: () => JSX.Element; + +// $ExpectType number[] +const mappedChildrenArray2 = React.Children.map(numberChildren, num => num); +// $ExpectType Element[] +const mappedChildrenArray3 = React.Children.map(elementChildren, element => element); +// $ExpectType (string | Element)[] +const mappedChildrenArray4 = React.Children.map(mixedChildren, elementOrString => elementOrString); +// $ExpectType (string | number | null)[] +const mappedChildrenArray5 = React.Children.map(singlePluralChildren, element => element.key); +// $ExpectType string[] +const mappedChildrenArray6 = React.Children.map(renderPropsChildren, element => element.name); + // // Example from http://facebook.github.io/react/ // -------------------------------------------------------------------------- @@ -774,7 +791,7 @@ class RenderChildren extends React.Component { const Memoized1 = React.memo(function Foo(props: { foo: string }) { return null; }); React.createElement(Memoized1, { foo: 'string' }); -const Memoized2 = React.memo( +const Memoized2 = React.memo<{ bar: string }>( function Bar(props: { bar: string }) { return null; }, (prevProps, nextProps) => prevProps.bar === nextProps.bar ); diff --git a/types/react/test/tsx.tsx b/types/react/test/tsx.tsx index 9309799de7..119a82db11 100644 --- a/types/react/test/tsx.tsx +++ b/types/react/test/tsx.tsx @@ -361,7 +361,7 @@ interface TestPropTypesProps3 { const testPropTypes = { foo: PropTypes.string }; -type DeclaredPropTypes

= Required['propTypes'], undefined>>; +type DeclaredPropTypes

= Required['propTypes'], undefined>>; // $ExpectType false type propTypesTest = typeof testPropTypes extends DeclaredPropTypes ? true : false; // $ExpectType true diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index f05d136f69..0536a600ee 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Rebass 0.3.8 +// Type definitions for Rebass 3.0 // Project: https://github.com/jxnblk/rebass -// Definitions by: rhysd +// Definitions by: rhysd // ryee-dev // jamesmckenzie // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,32 +14,33 @@ export interface BaseProps extends React.ClassAttributes { } export interface SpaceProps extends BaseProps { - m?: number | string; - mt?: number | string; - mr?: number | string; - mb?: number | string; - ml?: number | string; - mx?: number | string; - my?: number | string; - p?: number | string; - pt?: number | string; - pr?: number | string; - pb?: number | string; - pl?: number | string; - px?: number | string; - py?: number | string; + m?: number | string | ReadonlyArray; + mt?: number | string | ReadonlyArray; + mr?: number | string | ReadonlyArray; + mb?: number | string | ReadonlyArray; + ml?: number | string | ReadonlyArray; + mx?: number | string | ReadonlyArray; + my?: number | string | ReadonlyArray; + p?: number | string | ReadonlyArray; + pt?: number | string | ReadonlyArray; + pr?: number | string | ReadonlyArray; + pb?: number | string | ReadonlyArray; + pl?: number | string | ReadonlyArray; + px?: number | string | ReadonlyArray; + py?: number | string | ReadonlyArray; } export interface BoxProps extends SpaceProps { className?: string; width?: number | string | ReadonlyArray; fontSize?: number | ReadonlyArray; - css?: Object; + css?: object; color?: string; bg?: string; } -type BoxClass = React.StatelessComponent; -export declare const Box: BoxClass; +// tslint:disable-next-line:strict-export-declare-modifiers +type BoxClass = React.FunctionComponent; +export const Box: BoxClass; export interface ButtonProps extends BoxProps { fontWeight?: string; @@ -48,8 +49,7 @@ export interface ButtonProps extends BoxProps { borderRadius?: number | string; variant?: string; } -type ButtonClass = React.StatelessComponent; -export declare const Button: ButtonClass; +export const Button: React.FunctionComponent; export interface CardProps extends BoxProps { border?: number | string; @@ -63,8 +63,7 @@ export interface CardProps extends BoxProps { opacity?: number; variant?: string; } -type CardClass = React.StatelessComponent; -export declare const Card: CardClass; +export const Card: React.FunctionComponent; export interface FlexProps extends BoxProps { alignItems?: string; @@ -72,8 +71,7 @@ export interface FlexProps extends BoxProps { flexDirection?: string; flexWrap?: string; } -type FlexClass = React.StatelessComponent; -export declare const Flex: FlexClass; +export const Flex: React.FunctionComponent; export interface ImageProps extends BoxProps { height?: number | string; @@ -81,14 +79,12 @@ export interface ImageProps extends BoxProps { src?: string; alt?: string; } -type ImageClass = React.StatelessComponent; -export declare const Image: ImageClass; +export const Image: React.FunctionComponent; export interface LinkProps extends BoxProps { href?: string; } -type LinkClass = React.StatelessComponent; -export declare const Link: LinkClass; +export const Link: React.FunctionComponent; export interface TextProps extends BoxProps { fontSize?: number | ReadonlyArray; @@ -99,9 +95,7 @@ export interface TextProps extends BoxProps { lineHeight?: number | string; letterSpacing?: number | string; } -type TextClass = React.StatelessComponent; -export declare const Text: TextClass; +export const Text: React.FunctionComponent; -export interface HeadingProps extends TextProps {} -type HeadingClass = React.StatelessComponent; -export declare const Heading: HeadingClass; +export type HeadingProps = TextProps; +export const Heading: React.FunctionComponent; diff --git a/types/rebass/rebass-tests.tsx b/types/rebass/rebass-tests.tsx index fb0eae1ed4..53735775ff 100644 --- a/types/rebass/rebass-tests.tsx +++ b/types/rebass/rebass-tests.tsx @@ -1,8 +1,8 @@ -import * as React from 'react' -import { Box, Flex, Text, Heading, Button, Link, Image, Card } from 'rebass' +import * as React from 'react'; +import { Box, Flex, Text, Heading, Button, Link, Image, Card } from 'rebass'; -const RebassTests = () => ( - +() => ( + Hi, I'm a heading. @@ -32,4 +32,4 @@ const RebassTests = () => ( -) +); diff --git a/types/rebass/tslint.json b/types/rebass/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/rebass/tslint.json +++ b/types/rebass/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 426e74d6ba..fc127e9251 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -12,6 +12,7 @@ // Harry Cruse // Andrew Palugniok // Robert Stigsson +// Kosaku Kurino // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -451,12 +452,23 @@ export interface PieProps extends EventAttributes, Partial | React.ReactElement | boolean; label?: { offsetRadius: number; - } | React.ReactElement | ContentRenderer | boolean; + } | React.ReactElement | ContentRenderer | boolean; activeShape?: object | ContentRenderer | React.ReactElement; activeIndex?: number | number[]; blendStroke?: boolean; } +export interface PieLabelRenderProps extends PieProps { + name: string; + percent?: number; + stroke: string; + index?: number; + textAnchor: string; + x: number; + y: number; + [key: string]: any; +} + export class Pie extends React.Component { } // NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it). diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index fc9ec4f15f..f571753468 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -360,7 +360,8 @@ declare module 'recompose' { // hoistStatics: https://github.com/acdlite/recompose/blob/master/docs/API.md#hoistStatics export function hoistStatics( - hoc: InferableComponentEnhancer + hoc: InferableComponentEnhancer, + blacklist?: {[key: string]: boolean} ): InferableComponentEnhancer; diff --git a/types/reduce-reducers/index.d.ts b/types/reduce-reducers/index.d.ts index d4bde0bc8a..19499c452c 100644 --- a/types/reduce-reducers/index.d.ts +++ b/types/reduce-reducers/index.d.ts @@ -1,7 +1,81 @@ -// Type definitions for reduce-reducers 0.1 +// Type definitions for reduce-reducers 0.2 // Project: https://github.com/acdlite/reduce-reducers // Definitions by: Huy Nguyen +// Dalius Dobravolskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { Reducer } from 'redux'; +export default function reduceReducer(r0: Reducer, s: S | null): Reducer; +export default function reduceReducer(r0: Reducer, r1: Reducer, s: S | null): Reducer; +export default function reduceReducer(r0: Reducer, r1: Reducer, r2: Reducer, s: S | null): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + r5: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + r5: Reducer, + r6: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + r5: Reducer, + r6: Reducer, + r7: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + r5: Reducer, + r6: Reducer, + r7: Reducer, + r8: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + r5: Reducer, + r6: Reducer, + r7: Reducer, + r8: Reducer, + r9: Reducer, + s: S | null, +): Reducer; export default function reduceReducer(...reducers: Array>): Reducer; diff --git a/types/reduce-reducers/reduce-reducers-tests.ts b/types/reduce-reducers/reduce-reducers-tests.ts index f542fe834a..f4fdd8fff3 100644 --- a/types/reduce-reducers/reduce-reducers-tests.ts +++ b/types/reduce-reducers/reduce-reducers-tests.ts @@ -1,13 +1,188 @@ import { - Reducer, - Action, + Reducer, + Action, } from 'redux'; import reduceReducers from 'reduce-reducers'; interface TestStore { - a: number; - b: string; + a: number; + b: string; } const firstReducer: (state: TestStore, action: Action) => TestStore = (a, b) => a; const secondReducer: (state: TestStore, action: Action) => TestStore = (a, b) => a; const finalReducer: (state: TestStore, action: Action) => TestStore = reduceReducers(firstReducer, secondReducer); +const finalReducerWithState: (state: TestStore, action: Action) => TestStore = reduceReducers(firstReducer, secondReducer, null); + +const initialState: TestStore = { + a: 1, + b: '2', +}; + +const finalReducerWithInitialState: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + initialState); + +const reducer02: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer03: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer04: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer05: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer06: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer07: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer08: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer09: (state: TestStore, action: Action) => TestStore = (a, b) => a; + +const finalReducerWithInitialState02: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + initialState); +const finalReducerWithInitialState02null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + null); + +const finalReducerWithInitialState03: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + initialState); +const finalReducerWithInitialState03null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + null); + +const finalReducerWithInitialState04: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + initialState); +const finalReducerWithInitialState04null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + null); + +const finalReducerWithInitialState05: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + initialState); +const finalReducerWithInitialState05null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + null); + +const finalReducerWithInitialState06: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + initialState); +const finalReducerWithInitialState06null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + null); + +const finalReducerWithInitialState07: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + initialState); +const finalReducerWithInitialState07null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + null); + +const finalReducerWithInitialState08: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + reducer08, + initialState); +const finalReducerWithInitialState08null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + reducer08, + null); + +const finalReducerWithoutInitialState09: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + reducer08, + reducer09); +const finalReducerWithInitialState09: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + reducer08, + reducer09, + initialState); +const finalReducerWithInitialState09null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + reducer08, + reducer09, + null); diff --git a/types/redux-state-sync/index.d.ts b/types/redux-state-sync/index.d.ts new file mode 100644 index 0000000000..fb7e0f84b5 --- /dev/null +++ b/types/redux-state-sync/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for redux-state-sync 2.0 +// Project: https://github.com/AOHUA/redux-state-sync#readme +// Definitions by: MU AOHUA +// AntonioMendez +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import { Store, Reducer, Middleware, AnyAction } from "redux"; +import BroadcastChannel from "broadcast-channel"; + +export interface Stamp { + $uuid: string; + $wuid: string; +} +export type StampedAction = Stamp & AnyAction; + +export interface Config { + channel?: string; + predicate?: (type?: string) => boolean | null; + blacklist?: string[]; + whitelist?: string[]; + broadcastChannelOption?: object | null; +} + +export interface MessageListenerConfig { + channel: BroadcastChannel; + dispatch: (action: AnyAction | StampedAction) => void; + allowed: (type?: string) => boolean; +} + +export function generateUuidForAction(action: AnyAction): StampedAction; +export function isActionAllowed(config: Config): (type: string) => boolean; +export function createMessageListener(config: MessageListenerConfig): void; +export function createStateSyncMiddleware(config?: Config): Middleware; +export function withReduxStateSync( + appReducer: Reducer +): (state: any, action: AnyAction) => Reducer; +export function initStateWithPrevTab(store: Store): Store; diff --git a/types/redux-state-sync/package.json b/types/redux-state-sync/package.json new file mode 100644 index 0000000000..d39f9e8fc6 --- /dev/null +++ b/types/redux-state-sync/package.json @@ -0,0 +1,7 @@ +{ + "private": true, + "dependencies": { + "broadcast-channel": "^2.1.8", + "redux": "^4.0.1" + } +} diff --git a/types/redux-state-sync/redux-state-sync-tests.ts b/types/redux-state-sync/redux-state-sync-tests.ts new file mode 100644 index 0000000000..3f5e689675 --- /dev/null +++ b/types/redux-state-sync/redux-state-sync-tests.ts @@ -0,0 +1,22 @@ +import { createStore, applyMiddleware, Action } from "redux"; +import { createStateSyncMiddleware, initStateWithPrevTab, withReduxStateSync } from "redux-state-sync"; + +interface TestState { + a: number; + b: string; + c: string; +} +const middleware = createStateSyncMiddleware({ + channel: 'test', + predicate: (type) => true, + blacklist: [], + whitelist: [], + broadcastChannelOption: {} + }); + +function rootReducer(state: TestState, action: Action): TestState { + return state; +} + +const store = createStore(withReduxStateSync(rootReducer), ['test'], applyMiddleware(middleware)); +initStateWithPrevTab(store); diff --git a/types/redux-state-sync/tsconfig.json b/types/redux-state-sync/tsconfig.json new file mode 100644 index 0000000000..dd15d9a067 --- /dev/null +++ b/types/redux-state-sync/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "redux-state-sync-tests.ts" + ] +} diff --git a/types/redux-state-sync/tslint.json b/types/redux-state-sync/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/redux-state-sync/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 27ae20706c..a4b7106c4f 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -23,6 +23,7 @@ export type RelayMutationRequest = any; export type RelayQueryRequest = any; export type ConcreteFragmentDefinition = object; export type ConcreteOperationDefinition = object; +export type ReaderFragment = object; /** * FIXME: RelayContainer used to be typed with ReactClass, but @@ -41,9 +42,40 @@ export type RelayContainer = any; // ~~~~~~~~~~~~~~~~~~~~~ // File: https://github.com/facebook/relay/blob/fe0e70f10bbcba1fff89911313ea69f24569464b/packages/relay-runtime/util/RelayConcreteNode.js -export type ConcreteFragment = any; -export type ConcreteRequest = any; -export type ConcreteBatchRequest = any; +export interface ConcreteFragment { + kind: string; + name: string; + type: string; + metadata: {[key: string]: any} | null; + argumentDefinitions: any[]; + selections: any[]; +} +export interface ConcreteRequest { + kind: string; + operationKind: string; + name: string; + id: string | null; + text: string | null; + metadata: {[key: string]: any}; + fragment: ConcreteFragment; + operation: any; +} +export interface ConcreteBatchRequest { + kind: string; + operationKind: string; + name: string; + metadata: {[key: string]: any}; + fragment: ConcreteFragment; + requests: Array<{ + name: string; + id: string | null; + text: string | null; + argumentDependencies: any[] | null; + operation: any; + }>; +} + +export function getRequest(taggedNode: GraphQLTaggedNode): ConcreteRequest; export type RequestNode = ConcreteRequest | ConcreteBatchRequest; diff --git a/types/responselike/index.d.ts b/types/responselike/index.d.ts new file mode 100644 index 0000000000..7152388232 --- /dev/null +++ b/types/responselike/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for responselike 1.0 +// Project: https://github.com/lukechilds/responselike#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { IncomingMessage } from 'http'; +import { Stream } from 'stream'; + +export = ResponseLike; + +/** + * Returns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage). + */ +declare class ResponseLike extends Stream.Readable { + statusCode: number; + headers: { [header: string]: string | string[] | undefined }; + body: Buffer; + url: string; + + /** + * @param statusCode HTTP response status code. + * @param headers HTTP headers object. Keys will be automatically lowercased. + * @param body A Buffer containing the response body. The Buffer contents will be streamable but is also exposed directly as `response.body`. + * @param url Request URL string. + */ + constructor( + statusCode: number, + headers: { [header: string]: string | string[] | undefined }, + body: Buffer, + url: string + ); +} diff --git a/types/responselike/responselike-tests.ts b/types/responselike/responselike-tests.ts new file mode 100644 index 0000000000..95c5e4f701 --- /dev/null +++ b/types/responselike/responselike-tests.ts @@ -0,0 +1,10 @@ +import Response = require('responselike'); + +const response = new Response(200, { foo: 'bar' }, Buffer.from('Hi!'), 'https://example.com'); + +response.statusCode; // $ExpectType number +response.headers; // $ExpectType { [header: string]: string | string[] | undefined; } +response.body; // $ExpectType Buffer +response.url; // $ExpectType string + +response.pipe(process.stdout); diff --git a/types/responselike/tsconfig.json b/types/responselike/tsconfig.json new file mode 100644 index 0000000000..2c0a9e392b --- /dev/null +++ b/types/responselike/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "responselike-tests.ts" + ] +} diff --git a/types/responselike/tslint.json b/types/responselike/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/responselike/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/rollup-plugin-delete/index.d.ts b/types/rollup-plugin-delete/index.d.ts new file mode 100644 index 0000000000..9f9cfe020d --- /dev/null +++ b/types/rollup-plugin-delete/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for rollup-plugin-delete 0.2 +// Project: https://github.com/vladshcherbin/rollup-plugin-delete#readme +// Definitions by: Vlad Shcherbin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import del = require('del'); +import { Plugin } from 'rollup'; + +export interface Options extends del.Options { + /** + * Patterns of files and folders to be deleted. + * @default [] + */ + readonly targets: ReadonlyArray | string; + + /** + * Outputs removed files and folders to console. + * @default false + */ + readonly verbose?: boolean; +} + +export default function(options?: Options): Plugin; diff --git a/types/rollup-plugin-delete/package.json b/types/rollup-plugin-delete/package.json new file mode 100644 index 0000000000..272f65edde --- /dev/null +++ b/types/rollup-plugin-delete/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "rollup": ">=0.60.0" + } +} diff --git a/types/rollup-plugin-delete/rollup-plugin-delete-tests.ts b/types/rollup-plugin-delete/rollup-plugin-delete-tests.ts new file mode 100644 index 0000000000..eff3508e29 --- /dev/null +++ b/types/rollup-plugin-delete/rollup-plugin-delete-tests.ts @@ -0,0 +1,13 @@ +import del from 'rollup-plugin-delete'; + +del(); // $ExpectType Plugin + +del({}); // $ExpectError + +del({ targets: '/dist' }); // $ExpectType Plugin + +del({ targets: ['/dist'], verbose: true }); // $ExpectType Plugin + +del({ targets: ['/dist'], verbose: true, dryRun: true }); // $ExpectType Plugin + +del({ targets: ['/dist'], verbose: true, dryRun: true, debug: true }); // $ExpectType Plugin diff --git a/types/rollup-plugin-delete/tsconfig.json b/types/rollup-plugin-delete/tsconfig.json new file mode 100644 index 0000000000..d03999e03a --- /dev/null +++ b/types/rollup-plugin-delete/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "rollup-plugin-delete-tests.ts" + ] +} diff --git a/types/rollup-plugin-delete/tslint.json b/types/rollup-plugin-delete/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rollup-plugin-delete/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/rollup-plugin-node-builtins/index.d.ts b/types/rollup-plugin-node-builtins/index.d.ts new file mode 100644 index 0000000000..e839485ac9 --- /dev/null +++ b/types/rollup-plugin-node-builtins/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for rollup-plugin-node-builtins 2.1 +// Project: https://github.com/calvinmetcalf/rollup-plugin-node-builtins#readme +// Definitions by: Hugo Alliaume +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +import { Plugin } from 'rollup'; + +export interface Options { + crypto?: boolean; + fs?: boolean; +} + +export default function builtins(options?: Options): Plugin; diff --git a/types/rollup-plugin-node-builtins/package.json b/types/rollup-plugin-node-builtins/package.json new file mode 100644 index 0000000000..ee69ca3cd2 --- /dev/null +++ b/types/rollup-plugin-node-builtins/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "rollup": "^0.63.4" + } +} diff --git a/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts b/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts new file mode 100644 index 0000000000..53e488cd00 --- /dev/null +++ b/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts @@ -0,0 +1,16 @@ +import builtins from 'rollup-plugin-node-builtins'; + +// No options (default) +(() => { + // $ExpectType Plugin + builtins(); +})(); + +// With `crypto` and `fs` enabled +(() => { + // $ExpectType Plugin + builtins({ + crypto: true, + fs: true, + }); +})(); diff --git a/types/rollup-plugin-node-builtins/tsconfig.json b/types/rollup-plugin-node-builtins/tsconfig.json new file mode 100644 index 0000000000..c0a6e1e787 --- /dev/null +++ b/types/rollup-plugin-node-builtins/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "rollup-plugin-node-builtins-tests.ts" + ] +} diff --git a/types/rollup-plugin-node-builtins/tslint.json b/types/rollup-plugin-node-builtins/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rollup-plugin-node-builtins/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/rollup-plugin-node-globals/index.d.ts b/types/rollup-plugin-node-globals/index.d.ts new file mode 100644 index 0000000000..2cf29ae912 --- /dev/null +++ b/types/rollup-plugin-node-globals/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for rollup-plugin-node-globals 1.4 +// Project: https://github.com/calvinmetcalf/rollup-plugin-node-globals#readme +// Definitions by: Hugo Alliaume +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +import { Plugin } from 'rollup'; + +export interface Options { + // Every files will be parsed by default, but you can specify which files to include or exclude + include?: Array | string | RegExp | null; + exclude?: Array | string | RegExp | null; + + // Enable sourcemaps support + sourceMap ?: boolean; + + // Plugin's options + process?: boolean; + global?: boolean; + buffer?: boolean; + dirname?: boolean; + filename?: boolean; + baseDir?: string; +} + +export default function globals(options?: Options): Plugin; diff --git a/types/rollup-plugin-node-globals/package.json b/types/rollup-plugin-node-globals/package.json new file mode 100644 index 0000000000..ee69ca3cd2 --- /dev/null +++ b/types/rollup-plugin-node-globals/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "rollup": "^0.63.4" + } +} diff --git a/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts b/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts new file mode 100644 index 0000000000..93d10a2730 --- /dev/null +++ b/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts @@ -0,0 +1,43 @@ +import globals from 'rollup-plugin-node-globals'; + +// No options (default) +(() => { + // $ExpectType Plugin + globals(); +})(); + +// With every options +(() => { + // $ExpectType Plugin + globals({ + process: false, + global: false, + buffer: false, + dirname: false, + filename: false, + baseDir: '/', + }); +})(); + +// Filter files +(() => { + // $ExpectType Plugin + globals({ + include: '*.js', + exclude: '*.js', + }); + + // $ExpectType Plugin + globals({ + include: /.js$/, + exclude: ['foo.js', 'bar.js'], + }); +})(); + +// Sourcemaps +(() => { + // $ExpectType Plugin + globals({ + sourceMap: false, + }); +})(); diff --git a/types/rollup-plugin-node-globals/tsconfig.json b/types/rollup-plugin-node-globals/tsconfig.json new file mode 100644 index 0000000000..29e93758c9 --- /dev/null +++ b/types/rollup-plugin-node-globals/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "rollup-plugin-node-globals-tests.ts" + ] +} diff --git a/types/rollup-plugin-node-globals/tslint.json b/types/rollup-plugin-node-globals/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rollup-plugin-node-globals/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/script-ext-html-webpack-plugin/index.d.ts b/types/script-ext-html-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..636ac550e5 --- /dev/null +++ b/types/script-ext-html-webpack-plugin/index.d.ts @@ -0,0 +1,79 @@ +// Type definitions for script-ext-html-webpack-plugin 2.1 +// Project: https://github.com/numical/script-ext-html-webpack-plugin +// Definitions by: Dave Cardwell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Plugin } from "webpack"; + +export = ScriptExtHtmlWebpackPlugin; + +declare class ScriptExtHtmlWebpackPlugin extends Plugin { + constructor(options?: ScriptExtHtmlWebpackPlugin.Options); +} + +type ScriptMatchingPatternBase = + | string + | RegExp + | ReadonlyArray; + +interface ScriptMatchingPatternHash { + test: ScriptMatchingPatternBase; +} + +type ScriptMatchingPattern = + | ScriptMatchingPatternBase + | ScriptMatchingPatternHash; + +type ScriptMatchingPatternPre = + | ScriptMatchingPatternBase + | ScriptMatchingPatternHash & { + chunks?: "initial" | "async" | "all"; + }; + +interface Custom { + test: ScriptMatchingPattern; + attribute: string; + value?: string; +} + +declare namespace ScriptExtHtmlWebpackPlugin { + interface Options { + /** + * scripts that should be inlined in the html (default: `[]`) + */ + inline?: ScriptMatchingPattern; + /** + * script names that should have no attribute (default: `[]`) + */ + sync?: ScriptMatchingPattern; + /** + * script names that should have an async attribute (default: `[]`) + */ + async?: ScriptMatchingPattern; + /** + * script names that should have a defer attribute (default: `[]`) + */ + defer?: ScriptMatchingPattern; + /** + * the default attribute to set - 'sync' actually results in no attribute (default: 'sync') + */ + defaultAttribute?: "sync" | "async" | "defer"; + /** + * script names that should have a type="module" attribute (default: `[]`) + */ + module?: ScriptMatchingPattern; + /** + * scripts that should have accompanying preload resource hints (default: `[]`) + */ + preload?: ScriptMatchingPatternPre; + /** + * scripts that should have accompanying prefetch resource hints (default: `[]`) + */ + prefetch?: ScriptMatchingPatternPre; + /** + * scripts that should have a custom attribute(s) added, the attribute(s), and the value(s) + */ + custom?: Custom | Custom[]; + } +} diff --git a/types/script-ext-html-webpack-plugin/script-ext-html-webpack-plugin-tests.ts b/types/script-ext-html-webpack-plugin/script-ext-html-webpack-plugin-tests.ts new file mode 100644 index 0000000000..84c42b2ae9 --- /dev/null +++ b/types/script-ext-html-webpack-plugin/script-ext-html-webpack-plugin-tests.ts @@ -0,0 +1,112 @@ +import ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin"); + +new ScriptExtHtmlWebpackPlugin(); +new ScriptExtHtmlWebpackPlugin({}); + +new ScriptExtHtmlWebpackPlugin({ + inline: "string", + sync: "string", + async: "string", + defer: "string", + module: "string", + preload: "string", + prefetch: "string" +}); + +new ScriptExtHtmlWebpackPlugin({ + inline: ["array"], + sync: ["array"], + async: ["array"], + defer: ["array"], + module: ["array"], + preload: ["array"], + prefetch: ["array"] +}); + +new ScriptExtHtmlWebpackPlugin({ + inline: /regexp/, + sync: /regexp/, + async: /regexp/, + defer: /regexp/, + module: /regexp/, + preload: /regexp/, + prefetch: /regexp/ +}); + +new ScriptExtHtmlWebpackPlugin({ + inline: { test: "string" }, + sync: { test: "string" }, + async: { test: "string" }, + defer: { test: "string" }, + module: { test: "string" }, + preload: { test: "string" }, + prefetch: { test: "string" } +}); + +new ScriptExtHtmlWebpackPlugin({ + inline: { test: ["array"] }, + sync: { test: ["array"] }, + async: { test: ["array"] }, + defer: { test: ["array"] }, + module: { test: ["array"] }, + preload: { test: ["array"] }, + prefetch: { test: ["array"] } +}); + +new ScriptExtHtmlWebpackPlugin({ + inline: { test: /regexp/ }, + sync: { test: /regexp/ }, + async: { test: /regexp/ }, + defer: { test: /regexp/ }, + module: { test: /regexp/ }, + preload: { test: /regexp/ }, + prefetch: { test: /regexp/ } +}); + +new ScriptExtHtmlWebpackPlugin({ + preload: { test: "string", chunks: "initial" }, + prefetch: { test: "string", chunks: "initial" } +}); + +new ScriptExtHtmlWebpackPlugin({ + preload: { test: "string", chunks: "async" }, + prefetch: { test: "string", chunks: "async" } +}); + +new ScriptExtHtmlWebpackPlugin({ + preload: { test: "string", chunks: "all" }, + prefetch: { test: "string", chunks: "all" } +}); + +new ScriptExtHtmlWebpackPlugin({ defaultAttribute: "sync" }); +new ScriptExtHtmlWebpackPlugin({ defaultAttribute: "async" }); +new ScriptExtHtmlWebpackPlugin({ defaultAttribute: "defer" }); + +new ScriptExtHtmlWebpackPlugin({ + custom: { + test: "string", + attribute: "string" + } +}); + +new ScriptExtHtmlWebpackPlugin({ + custom: { + test: ["array"], + attribute: "string", + value: "string" + } +}); + +new ScriptExtHtmlWebpackPlugin({ + custom: [ + { + test: /regexp/, + attribute: "string" + }, + { + test: "string", + attribute: "string", + value: "string" + } + ] +}); diff --git a/types/script-ext-html-webpack-plugin/tsconfig.json b/types/script-ext-html-webpack-plugin/tsconfig.json new file mode 100644 index 0000000000..32c8e618e3 --- /dev/null +++ b/types/script-ext-html-webpack-plugin/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "script-ext-html-webpack-plugin-tests.ts"] +} diff --git a/types/script-ext-html-webpack-plugin/tslint.json b/types/script-ext-html-webpack-plugin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/script-ext-html-webpack-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/select2/v3/index.d.ts b/types/select2/v3/index.d.ts index 3c8fc11155..f4a0c01efb 100644 --- a/types/select2/v3/index.d.ts +++ b/types/select2/v3/index.d.ts @@ -4,7 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 - /// interface Select2QueryOptions { @@ -23,8 +22,8 @@ interface AjaxFunction { interface Select2AjaxOptions extends JQueryAjaxSettings { transport?: AjaxFunction; /** - * Url to make request to, Can be string or a function returning a string. - */ + * Url to make request to, Can be string or a function returning a string. + */ url?: any; dataType?: string; quietMillis?: number; @@ -93,77 +92,77 @@ interface Select2Plugin { (): JQuery; (it: IdTextPair): JQuery; - /** - * Get the id value of the current selection - */ + /** + * Get the id value of the current selection + */ (method: 'val'): any; - /** - * Set the id value of the current selection - * @params value Value to set the id to - * @params triggerChange Should a change event be triggered - */ + /** + * Set the id value of the current selection + * @params value Value to set the id to + * @params triggerChange Should a change event be triggered + */ (method: 'val', value: any, triggerChange?: boolean): any; - /** - * Get the data object of the current selection - */ + /** + * Get the data object of the current selection + */ (method: 'data'): any; - /** - * Set the data of the current selection - * @params value Object to set the data to - * @params triggerChange Should a change event be triggered - */ + /** + * Set the data of the current selection + * @params value Object to set the data to + * @params triggerChange Should a change event be triggered + */ (method: 'data', value: any, triggerChange?: boolean): any; - /** - * Whether it is open - */ + /** + * Whether it is open + */ (method: 'opened'): boolean; - /** - * Whether it is in focus - */ + /** + * Whether it is in focus + */ (method: 'isFocused'): boolean; - /** - * Reverts changes to DOM done by Select2. Any selection done via Select2 will be preserved. - */ + /** + * Reverts changes to DOM done by Select2. Any selection done via Select2 will be preserved. + */ (method: 'destroy'): JQuery; - /** - * Opens the dropdown - */ + /** + * Opens the dropdown + */ (method: 'open'): JQuery; - /** - * Closes the dropdown - */ + /** + * Closes the dropdown + */ (method: 'close'): JQuery; - /** - * Disables Select2 - */ + /** + * Disables Select2 + */ (method: 'disable'): JQuery; - /** - * Enables or disables Select2 and its underlying form component - * @param value True if it should be enabled false if it should be disabled - */ + /** + * Enables or disables Select2 and its underlying form component + * @param value True if it should be enabled false if it should be disabled + */ (method: 'enable', value?: boolean): JQuery; - /** - * Enable its focus - */ + /** + * Enable its focus + */ (method: 'focus'): JQuery; - /** - * Toggles readonly mode on Select2 and its underlying form component - * @param value True if it should be readonly false if it should be read write - */ + /** + * Toggles readonly mode on Select2 and its underlying form component + * @param value True if it should be readonly false if it should be read write + */ (method: 'readonly', value: boolean): JQuery; - /** - * Retrieves the main container element that wraps all of DOM added by Select2 - */ + /** + * Retrieves the main container element that wraps all of DOM added by Select2 + */ (method: 'container'): JQuery; - /** - * Notifies Select2 that a drag and drop sorting operation has started - */ + /** + * Notifies Select2 that a drag and drop sorting operation has started + */ (method: 'onSortStart'): JQuery; - /** - * Notifies Select2 that a drag and drop sorting operation has finished - */ + /** + * Notifies Select2 that a drag and drop sorting operation has finished + */ (method: 'onSortEnd'): JQuery; - /** + /** * Executes a new search using the provided value. Example: $("#tags").select2("search", "California") */ (method: 'search'): JQuery; diff --git a/types/select2/v3/select2-tests.ts b/types/select2/v3/select2-tests.ts index fe7f900e3d..4a0a496e13 100644 --- a/types/select2/v3/select2-tests.ts +++ b/types/select2/v3/select2-tests.ts @@ -9,9 +9,9 @@ $("#e2_2").select2({ $("#e3").select2({ minimumInputLength: 2 }); -function format(state) { +function format(state: any) { if (!state.id) return state.text; - return "" + state.text; + return `${state.text}`; } $("#e4").select2({ formatResult: format, @@ -21,10 +21,10 @@ $("#e5").select2({ minimumInputLength: 1, query: function (query) { console.info('current element value:', query.element.val()); - var data = { results: [] }, i, j, s; - for (i = 1; i < 5; i++) { - s = ""; - for (j = 0; j < i; j++) { s = s + query.term; } + const data = { results: [] as IdTextPair[] }; + for (let i = 1; i < 5; i++) { + let s = ""; + for (let j = 0; j < i; j++) { s = s + query.term; } data.results.push({ id: query.term + i, text: s }); } } @@ -35,7 +35,7 @@ $("#e10").select2({ data: [{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' }, { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' }] }); -var data = [{ id: 0, tag: 'enhancement' }, { id: 1, tag: 'bug' }, { id: 2, tag: 'duplicate' }, { id: 3, tag: 'invalid' }, { id: 4, tag: 'wontfix' }]; +const data = [{ id: 0, tag: 'enhancement' }, { id: 1, tag: 'bug' }, { id: 2, tag: 'duplicate' }, { id: 3, tag: 'invalid' }, { id: 4, tag: 'wontfix' }]; $("#e10_2").select2({ data: { results: data, text: 'tag' }, @@ -44,11 +44,20 @@ $("#e10_2").select2({ }); $("#e10_3").select2({ - data: { results: data, text: function (item) { console.log('called with', item); return item.tag; } }, + data: { + results: data, + text: (item: {tag: string}) => { + console.log('called with', item); + return item.tag; + } + }, formatSelection: format, formatResult: format }); -var movieFormatResult, movieFormatSelection; + +let movieFormatResult; +let movieFormatSelection; + $("#e6").select2({ placeholder: "Search for a movie", minimumInputLength: 1, @@ -75,7 +84,7 @@ $("#e6").select2({ placeholder: "Search for a movie", minimumInputLength: 1, ajax: { - url: () => { return "http://api.rottentomatoes.com/api/public/v1.0/movies.json"; }, + url: () => "http://api.rottentomatoes.com/api/public/v1.0/movies.json", dataType: 'jsonp', data: function (term, page) { return { @@ -131,7 +140,7 @@ $("#e7").select2({ }; }, results: function (data, page) { - var more = (page * 10) < data.total; + const more = (page * 10) < data.total; return { results: data.movies, more: more }; } }, @@ -140,7 +149,7 @@ $("#e7").select2({ dropdownCssClass: "bigdrop" }); -function sort(elements) { +function sort(elements: any) { return elements.sort(); } @@ -170,13 +179,12 @@ $("#e11_2").select2({ multiple: true, data: [{ id: 0, text: 'story' }, { id: 1, text: 'bug' }, { id: 2, text: 'task' }] }); -function log(e) { - var item = $("

  • " + e + "
  • "); +function log(e: string) { + const item = $(`
  • ${e}
  • `); $("#events_11").append(item); item.animate({ opacity: 1 }, 10000, 'linear', function () { item.animate({ opacity: 0 }, 2000, 'linear', function () { item.remove(); }); }); } $("#e11") - // TS 0.9.5: correct overload not resolved https://typescript.codeplex.com/discussions/472172 .on("change", function (e: Select2JQueryEventObject) { log(JSON.stringify({ val: e.val, added: e.added, removed: e.removed })); }) .on("open", function () { log("open"); }); $("#e11_2") @@ -201,7 +209,7 @@ $("#e16_2").select2(); $("#e16_enable").click(function () { $("#e16,#e16_2").select2("enable"); }); $("#e16_disable").click(function () { $("#e16,#e16_2").select2("enable", false); }); $("#e17").select2({ - matcher: function (term, text) { return text.toUpperCase().indexOf(term.toUpperCase()) == 0; } + matcher: function (term, text) { return text.toUpperCase().indexOf(term.toUpperCase()) === 0; } }); $("#e17_2").select2({ matcher: function (term, text, opt) { @@ -210,22 +218,26 @@ $("#e17_2").select2({ } }); $("#e18,#e18_2").select2(); -alert("Selected value is: " + $("#e8").select2("val")); $("#e8").select2("val", { id: "CA", text: "Califoria" }); -$("#e19").select2({nextSearchTerm: function(selectedObject: object, currentSearchTerm: string) { - return currentSearchTerm; -}}); +alert("Selected value is: " + $("#e8").select2("val")); +$("#e8").select2("val", {id: "CA", text: "Califoria"}); -$('#e20').select2({ - tokenizer: (textInput, selection, selectCallback, options) => { - if (options.dropdownAutoWidth) { - selectCallback(); - return null; - } else if (options.allowClear) { - selectCallback(textInput + '_'); - return textInput + '_'; +$("#e1").select2({ + nextSearchTerm: (selectedObject: object, currentSearchTerm: string) => { + return currentSearchTerm; + } +}); + +$("#id").select2({ + tokenizer: (textInput, selection, selectCallback, options) => { + if (options.dropdownAutoWidth) { + selectCallback(); + return null; + } else if (options.allowClear) { + selectCallback(textInput + '_'); + return textInput + '_'; + } + selection.push('extra'); } - selection.push('extra'); - } }); $("#e8").select2("val"); diff --git a/types/select2/v3/tsconfig.json b/types/select2/v3/tsconfig.json index 8b8f30ed05..aeb9f31a86 100644 --- a/types/select2/v3/tsconfig.json +++ b/types/select2/v3/tsconfig.json @@ -5,8 +5,8 @@ "es6", "dom" ], - "noImplicitAny": false, - "noImplicitThis": false, + "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "strictFunctionTypes": true, "baseUrl": "../../", diff --git a/types/select2/v3/tslint.json b/types/select2/v3/tslint.json index a41bf5d19a..fdbd83d321 100644 --- a/types/select2/v3/tslint.json +++ b/types/select2/v3/tslint.json @@ -1,79 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "unified-signatures": false } } diff --git a/types/semantic-release/index.d.ts b/types/semantic-release/index.d.ts new file mode 100644 index 0000000000..656461b756 --- /dev/null +++ b/types/semantic-release/index.d.ts @@ -0,0 +1,46 @@ +// Type definitions for semantic-release 15.13 +// Project: https://github.com/semantic-release/semantic-release#readme +// Definitions by: Leonardo Gatica +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * The semantic release configuration itself. + */ +export interface GlobalConfig { + /** The full prepare step configuration. */ + prepare?: any; + /** The branch on which releases should happen. */ + branch: string; + /** The Git repository URL, in any supported format. */ + repositoryUrl: string; + /** The Git tag format used by semantic-release to identify releases. */ + tagFormat: string; +} + +export interface LastRelease { + /** The version name of the release */ + version: string; + /** The Git tag of the release. */ + gitTag: string; + /** The Git checksum of the last commit of the release. */ + gitHead: string; +} + +export interface NextRelease extends LastRelease { + /** The release notes of the next release. */ + notes: string; +} + +export interface Context { + /** The semantic release configuration itself. */ + options?: GlobalConfig; + /** The previous release details. */ + lastRelease?: LastRelease; + /** The next release details. */ + nextRelease?: NextRelease; + /** The shared logger instance of semantic release. */ + logger: { + log: (message: string, ...vars: any[]) => void, + error: (message: string, ...vars: any[]) => void, + }; +} diff --git a/types/semantic-release/semantic-release-tests.ts b/types/semantic-release/semantic-release-tests.ts new file mode 100644 index 0000000000..0c954fe295 --- /dev/null +++ b/types/semantic-release/semantic-release-tests.ts @@ -0,0 +1,17 @@ +import * as lib from 'semantic-release'; + +function publish(pluginConfig: any, context: lib.Context) { + const version = context.nextRelease && context.nextRelease.version; + context.logger.log(`New version ${version}`); +} + +const context = { + nextRelease: { + version: '1.0.0', + gitTag: '1.0.0', + gitHead: 'f1eed296d2ffe184fb15f52b1c5ad778f5c87645', + notes: 'New release' + }, + logger: console +}; +publish({}, context); diff --git a/types/semantic-release/tsconfig.json b/types/semantic-release/tsconfig.json new file mode 100644 index 0000000000..d226e296ce --- /dev/null +++ b/types/semantic-release/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "semantic-release-tests.ts" + ] +} diff --git a/types/semantic-release/tslint.json b/types/semantic-release/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/semantic-release/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/set-cookie-parser/index.d.ts b/types/set-cookie-parser/index.d.ts index ea00ab4399..3da321ddb0 100644 --- a/types/set-cookie-parser/index.d.ts +++ b/types/set-cookie-parser/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for set-cookie-parser // Project: https://github.com/nfriedly/set-cookie-parser // Definitions by: Nick Paddock +// Ilya Zaytsev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -8,10 +9,10 @@ declare module "set-cookie-parser" { import http = require("http"); - function SetCookieParser(input: string | ReadonlyArray | http.IncomingMessage): SetCookieParser.Cookie[]; + function SetCookieParser(input: string | ReadonlyArray | http.IncomingMessage, options?: SetCookieParser.Options): SetCookieParser.Cookie[]; namespace SetCookieParser { - function parse(input: string | ReadonlyArray | http.IncomingMessage): Cookie[]; + function parse(input: string | ReadonlyArray | http.IncomingMessage, options?: Options): Cookie[]; function splitCookiesString(input: string | ReadonlyArray | void): string[]; @@ -25,6 +26,11 @@ declare module "set-cookie-parser" { secure?: boolean; httpOnly?: boolean; } + + type Options = { + decodeValues?: boolean; + map?: boolean; + } } export = SetCookieParser; diff --git a/types/set-cookie-parser/set-cookie-parser-tests.ts b/types/set-cookie-parser/set-cookie-parser-tests.ts index ab4e88005d..578e257f0c 100644 --- a/types/set-cookie-parser/set-cookie-parser-tests.ts +++ b/types/set-cookie-parser/set-cookie-parser-tests.ts @@ -88,3 +88,22 @@ assert.deepStrictEqual(cookiesString, [ 'foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure', 'baz=buz; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure', ]) + +// Use decodeValues=false option +var notDecodedValueCookies = setCookie.parse('user=%D0%98%D0%BB%D1%8C%D1%8F%20%D0%97%D0%B0%D0%B9%D1%86%D0%B5%D0%B2; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 3000 10:01:11 GMT; HttpOnly; Secure', { decodeValues: false }); +assert.equal(notDecodedValueCookies[0].value, '%D0%98%D0%BB%D1%8C%D1%8F%20%D0%97%D0%B0%D0%B9%D1%86%D0%B5%D0%B2'); + +var decodedValueCookies = setCookie.parse('user=%D0%98%D0%BB%D1%8C%D1%8F%20%D0%97%D0%B0%D0%B9%D1%86%D0%B5%D0%B2; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 3000 10:01:11 GMT; HttpOnly; Secure', { decodeValues: true }); +assert.equal(decodedValueCookies[0].value, 'ะ˜ะปัŒั ะ—ะฐะนั†ะตะฒ'); + +// Use map=true option +var expectedCookiesMap = { + foo: { + name: 'foo', + value: 'bar', + maxAge: 1000, + domain: '.example.com', + } +}; +var cookiesMap = setCookie.parse('foo=bar; Max-Age=1000; Domain=.example.com;', { map: true }); +assert.deepStrictEqual(cookiesMap, expectedCookiesMap); \ No newline at end of file diff --git a/types/shelljs-exec-proxy/shelljs-exec-proxy-tests.ts b/types/shelljs-exec-proxy/shelljs-exec-proxy-tests.ts index 71b7038a44..be6bde704d 100644 --- a/types/shelljs-exec-proxy/shelljs-exec-proxy-tests.ts +++ b/types/shelljs-exec-proxy/shelljs-exec-proxy-tests.ts @@ -5,5 +5,5 @@ shell.git.add('.'); // $ExpectType ExecOutputReturnValue shell.git.commit('-am', 'Fixed issue #1'); // $ExpectType ExecOutputReturnValue shell.git.push('origin', 'master'); // $ExpectType ExecOutputReturnValue -shell.cd('string'); // $ExpectType void +shell.cd('string'); // $ExpectType ShellString shell.cd(123); // $ExpectError diff --git a/types/shelljs/index.d.ts b/types/shelljs/index.d.ts index 1f1eb5c375..38f55bfceb 100644 --- a/types/shelljs/index.d.ts +++ b/types/shelljs/index.d.ts @@ -4,6 +4,7 @@ // Vojtech Jasny // George Kalpakas // Paul Huynh +// Alexander Futรกsz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -14,8 +15,9 @@ import glob = require("glob"); /** * Changes to directory dir for the duration of the script. Changes to home directory if no argument is supplied. * @param dir Directory to change in. + * @return Object with shell exit code, stderr and stdout. */ -export function cd(dir?: string): void; +export function cd(dir?: string): ShellString; /** * Returns the current directory. @@ -49,57 +51,65 @@ export function find(...path: Array): ShellArray; * Copies files. The wildcard * is accepted. * @param source The source. * @param dest The destination. + * @return Object with shell exit code, stderr and stdout. */ -export function cp(source: string | string[], dest: string): void; +export function cp(source: string | string[], dest: string): ShellString; /** * Copies files. The wildcard * is accepted. * @param options Available options: -f: force (default behavior) -n: no-clobber -u: only copy if source is newer than dest -r, -R: recursive -L: follow symlinks -P: don't follow symlinks * @param source The source. * @param dest The destination. + * @return Object with shell exit code, stderr and stdout. */ -export function cp(options: string, source: string | string[], dest: string): void; +export function cp(options: string, source: string | string[], dest: string): ShellString; /** * Removes files. The wildcard * is accepted. * @param ...files Files to remove. + * @return Object with shell exit code, stderr and stdout. */ -export function rm(...files: Array): void; +export function rm(...files: Array): ShellString; /** * Removes files. The wildcard * is accepted. * @param options Available options: -f (force), -r, -R (recursive) * @param ...files Files to remove. + * @return Object with shell exit code, stderr and stdout. */ -export function rm(options: string, ...files: Array): void; +export function rm(options: string, ...files: Array): ShellString; /** * Moves files. The wildcard * is accepted. * @param source The source. * @param dest The destination. + * @return Object with shell exit code, stderr and stdout. */ -export function mv(source: string | string[], dest: string): void; +export function mv(source: string | string[], dest: string): ShellString; /** * Moves files. The wildcard * is accepted. * @param options Available options: -f: force (default behavior) -n: no-clobber * @param source The source. * @param dest The destination. + * @return Object with shell exit code, stderr and stdout. */ -export function mv(options: string, source: string | string[], dest: string): void; +export function mv(options: string, source: string | string[], dest: string): ShellString; /** * Creates directories. * @param ...dir Directories to create. + * @return Object with shell exit code, stderr and stdout. */ -export function mkdir(...dir: Array): void; +export function mkdir(...dir: Array): ShellString; /** * Creates directories. * @param options Available options: p (full paths, will create intermediate dirs if necessary) * @param ...dir The directories to create. + * @return Object with shell exit code, stderr and stdout. */ -export function mkdir(options: string, ...dir: Array): void; +export function mkdir(options: string, ...dir: Array): ShellString; /** * Evaluates expression using the available primaries and returns corresponding value. @@ -304,16 +314,18 @@ export function dirs(options: string): any; * Links source to dest. Use -f to force the link, should dest already exist. * @param source The source. * @param dest The destination. + * @return Object with shell exit code, stderr and stdout. */ -export function ln(source: string, dest: string): void; +export function ln(source: string, dest: string): ShellString; /** * Links source to dest. Use -f to force the link, should dest already exist. * @param options Available options: s (symlink), f (force) * @param source The source. * @param dest The destination. + * @return Object with shell exit code, stderr and stdout. */ -export function ln(options: string, source: string, dest: string): void; +export function ln(options: string, source: string, dest: string): ShellString; /** * Exits the current process with the given exit code. @@ -400,8 +412,9 @@ export type ShellArray = string[] & ShellReturnValue; * - There is no "quiet" option since default behavior is to run silent. * @param octalMode The access mode. Octal. * @param file The file to use. + * @return Object with shell exit code, stderr and stdout. */ -export function chmod(octalMode: number, file: string): void; +export function chmod(octalMode: number, file: string): ShellString; /** * Alters the permissions of a file or directory by either specifying the absolute permissions in octal form or expressing the changes in symbols. This command tries to mimic the POSIX behavior as much as possible. Notable exceptions: @@ -410,8 +423,9 @@ export function chmod(octalMode: number, file: string): void; * @param options Available options: -v (output a diagnostic for every file processed), -c (like -v but report only when a change is made), -R (change files and directories recursively) * @param octalMode The access mode. Octal. * @param file The file to use. + * @return Object with shell exit code, stderr and stdout. */ -export function chmod(options: string, octalMode: number, file: string): void; +export function chmod(options: string, octalMode: number, file: string): ShellString; /** * Alters the permissions of a file or directory by either specifying the absolute permissions in octal form or expressing the changes in symbols. This command tries to mimic the POSIX behavior as much as possible. Notable exceptions: @@ -419,8 +433,9 @@ export function chmod(options: string, octalMode: number, file: string): void; * - There is no "quiet" option since default behavior is to run silent. * @param mode The access mode. Can be an octal string or a symbolic mode string. * @param file The file to use. + * @return Object with shell exit code, stderr and stdout. */ -export function chmod(mode: string, file: string): void; +export function chmod(mode: string, file: string): ShellString; /** * Alters the permissions of a file or directory by either specifying the absolute permissions in octal form or expressing the changes in symbols. This command tries to mimic the POSIX behavior as much as possible. Notable exceptions: @@ -429,8 +444,9 @@ export function chmod(mode: string, file: string): void; * @param options Available options: -v (output a diagnostic for every file processed), -c (like -v but report only when a change is made), -R (change files and directories recursively) * @param mode The access mode. Can be an octal string or a symbolic mode string. * @param file The file to use. + * @return Object with shell exit code, stderr and stdout. */ -export function chmod(options: string, mode: string, file: string): void; +export function chmod(options: string, mode: string, file: string): ShellString; // Non-Unix commands @@ -456,10 +472,10 @@ export interface TouchOptionsArray { '-r'?: string; } -export function touch(...files: string[]): void; -export function touch(files: string[]): void; -export function touch(options: TouchOptionsLiteral, ...files: Array): void; -export function touch(options: TouchOptionsArray, ...files: Array): void; +export function touch(...files: string[]): ShellString; +export function touch(files: string[]): ShellString; +export function touch(options: TouchOptionsLiteral, ...files: Array): ShellString; +export function touch(options: TouchOptionsArray, ...files: Array): ShellString; export interface HeadOptions { /** Show the first lines of the files. */ diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index 8e8d25847e..f5d7a86927 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -352,7 +352,7 @@ declare namespace Sinon { * The original method can be restored by calling object.method.restore(). * The returned spy is the function object which replaced the original method. spy === object.method. */ - (obj: T, method: keyof T): SinonSpy; + (obj: T, method: keyof T, types?: string[]): SinonSpy; } interface SinonStub extends SinonSpy { diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index b922b6791e..aebe96ae25 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -328,6 +328,8 @@ function testSpy() { const fn = () => { }; const obj = class { foo() { } + set bar(val: number) { } + get bar() { return 0; } }; const instance = new obj(); @@ -336,6 +338,7 @@ function testSpy() { spy = sinon.spy(fn); spy = sinon.spy(instance, 'foo'); + spy = sinon.spy(instance, 'bar', ['set', 'get']); let count = 0; count = spy.callCount; diff --git a/types/sinon/ts3.1/index.d.ts b/types/sinon/ts3.1/index.d.ts index 4052dfbc0a..7123e75d49 100644 --- a/types/sinon/ts3.1/index.d.ts +++ b/types/sinon/ts3.1/index.d.ts @@ -346,7 +346,7 @@ declare namespace Sinon { * The original method can be restored by calling object.method.restore(). * The returned spy is the function object which replaced the original method. spy === object.method. */ - (obj: T, method: K): T[K] extends ( + (obj: T, method: K, types?: string[]): T[K] extends ( ...args: infer TArgs ) => infer TReturnValue ? SinonSpy diff --git a/types/sinon/ts3.1/sinon-tests.ts b/types/sinon/ts3.1/sinon-tests.ts index f81c77aefe..2db25348ae 100644 --- a/types/sinon/ts3.1/sinon-tests.ts +++ b/types/sinon/ts3.1/sinon-tests.ts @@ -328,6 +328,8 @@ function testSpy() { const fn = () => { }; const obj = class { foo() { } + set bar(val: number) { } + get bar() { return 0; } }; const instance = new obj(); @@ -336,6 +338,7 @@ function testSpy() { spy = sinon.spy(fn); spy = sinon.spy(instance, 'foo'); + spy = sinon.spy(instance, 'bar', ['set', 'get']); let count = 0; count = spy.callCount; diff --git a/types/snoowrap/dist/objects/LiveThread.d.ts b/types/snoowrap/dist/objects/LiveThread.d.ts index ba34886fbb..594fc50247 100644 --- a/types/snoowrap/dist/objects/LiveThread.d.ts +++ b/types/snoowrap/dist/objects/LiveThread.d.ts @@ -26,8 +26,8 @@ export default class LiveThread extends RedditContent { deleteUpdate(options: { id: string; }): Promise; editSettings(options: LiveThreadSettings): Promise; getContributors(): Promise; - getDiscussions(options?: ListingOptions): Listing; - getRecentUpdates(options?: ListingOptions): Listing; + getDiscussions(options?: ListingOptions): Promise>; + getRecentUpdates(options?: ListingOptions): Promise>; inviteContributor(options: { name: string; permissions: Permissions[]}): Promise; leaveContributor(): Promise; removeContributor(options: { name: string; }): Promise; diff --git a/types/snoowrap/dist/objects/RedditUser.d.ts b/types/snoowrap/dist/objects/RedditUser.d.ts index a93cac98cd..35bc56eb9e 100644 --- a/types/snoowrap/dist/objects/RedditUser.d.ts +++ b/types/snoowrap/dist/objects/RedditUser.d.ts @@ -100,18 +100,18 @@ export default class RedditUser extends RedditContent { assignFlair(options: any): Promise; friend(options: any): Promise; - getComments(options?: any): Listing; - getDownvotedContent(options?: any): Listing; + getComments(options?: any): Promise>; + getDownvotedContent(options?: any): Promise>; getFriendInformation(): Promise; - getGildedContent(options?: any): Listing; - getHiddenContent(options?: any): Listing; + getGildedContent(options?: any): Promise>; + getHiddenContent(options?: any): Promise>; getMultireddit(name: string): MultiReddit; getMultireddits(): Promise; - getOverview(options?: any): Listing; - getSavedContent(options?: any): Listing; - getSubmissions(options?: any): Listing; + getOverview(options?: any): Promise>; + getSavedContent(options?: any): Promise>; + getSubmissions(options?: any): Promise>; getTrophies(): Promise; - getUpvotedContent(options?: any): Listing; + getUpvotedContent(options?: any): Promise>; giveGold(months: string): Promise; unfriend(): Promise; } diff --git a/types/snoowrap/dist/objects/Submission.d.ts b/types/snoowrap/dist/objects/Submission.d.ts index e2e7dc78d1..5986ac59cc 100644 --- a/types/snoowrap/dist/objects/Submission.d.ts +++ b/types/snoowrap/dist/objects/Submission.d.ts @@ -1,8 +1,7 @@ import { Sort } from '../..'; import Comment from './Comment'; import Listing, { ListingOptions } from './Listing'; -import RedditUser from './RedditUser'; -import Subreddit, { FlairTemplate } from './Subreddit'; +import { FlairTemplate } from './Subreddit'; import VoteableContent, { RichTextFlair } from './VoteableContent'; interface Media { @@ -113,7 +112,7 @@ export default class Submission extends VoteableContent { assignFlair(options: { text: string; cssClass: string; }): Promise; disableContestMode(): Promise; enableContestMode(): Promise; - getDuplicates(options?: ListingOptions): Listing; + getDuplicates(options?: ListingOptions): Promise>; getLinkFlairTemplates(): Promise; /* @deprecated */ getRelated(options?: ListingOptions): Submission; hide(): Promise; diff --git a/types/snoowrap/dist/objects/Subreddit.d.ts b/types/snoowrap/dist/objects/Subreddit.d.ts index 67623a17af..a9de52632d 100644 --- a/types/snoowrap/dist/objects/Subreddit.d.ts +++ b/types/snoowrap/dist/objects/Subreddit.d.ts @@ -1,12 +1,12 @@ -import { Sort, ModAction, SubmitSelfPostOptions, SubmitLinkOptions, BaseSearchOptions } from '../..'; +import { BaseSearchOptions, ModAction, Sort, SubmitLinkOptions, SubmitSelfPostOptions } from '../..'; import Comment from './Comment'; import Listing, { ListingOptions } from './Listing'; import PrivateMessage from './PrivateMessage'; import RedditContent from './RedditContent'; import RedditUser from './RedditUser'; import Submission from './Submission'; -import WikiPage, { WikiPageRevision } from './WikiPage'; import { RichTextFlair } from './VoteableContent'; +import WikiPage, { WikiPageRevision } from './WikiPage'; export default class Subreddit extends RedditContent { accounts_active_is_fuzzed: boolean; @@ -108,40 +108,40 @@ export default class Subreddit extends RedditContent { deleteImage(options: { imageName: string; }): Promise; deleteUserFlair(name: string): Promise; editSettings(options: SubredditSettings): Promise; - getBannedUsers(options?: ListingOptions & { name?: string }): Listing; - getContributors(options?: ListingOptions & { name?: string }): Listing; - getControversial(options?: ListingOptions & { time?: string }): Listing; - getEdited(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; - getHot(options?: ListingOptions): Listing; + getBannedUsers(options?: ListingOptions & { name?: string }): Promise>; + getContributors(options?: ListingOptions & { name?: string }): Promise>; + getControversial(options?: ListingOptions & { time?: string }): Promise>; + getEdited(options?: ListingOptions & { only?: 'links' | 'comments' }): Promise>; + getHot(options?: ListingOptions): Promise>; getLinkFlairTemplates(linkId: string): Promise; - getModerationLog(opts?: ListingOptions & { mods?: string[]; type?: ModActionType}): Listing; + getModerationLog(opts?: ListingOptions & { mods?: string[]; type?: ModActionType}): Promise>; getModerators(options?: ListingOptions & { name?: string }): RedditUser[]; - getModmail(options?: ListingOptions): Listing; - getModqueue(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; - getMutedUsers(options?: ListingOptions & { name?: string }): Listing; + getModmail(options?: ListingOptions): Promise>; + getModqueue(options?: ListingOptions & { only?: 'links' | 'comments' }): Promise>; + getMutedUsers(options?: ListingOptions & { name?: string }): Promise>; getMyFlair(): Promise; - getNew(options?: ListingOptions): Listing; - getNewComments(options?: ListingOptions): Listing; + getNew(options?: ListingOptions): Promise>; + getNewComments(options?: ListingOptions): Promise>; getRandomSubmission(): Promise; getRecommendedSubreddits(options?: { omit?: string[]; }): Promise; - getReports(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; - getRising(options?: ListingOptions): Listing; + getReports(options?: ListingOptions & { only?: 'links' | 'comments' }): Promise>; + getRising(options?: ListingOptions): Promise>; getRules(): Promise<{ rules: Rule[]; site_rules: string[] }>; getSettings(): Promise; - getSpam(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; + getSpam(options?: ListingOptions & { only?: 'links' | 'comments' }): Promise>; getSticky(options?: { num?: number }): Promise; getStylesheet(): Promise; getSubmitText(): Promise; - getTop(options?: ListingOptions & { time?: Timespan }): Listing; - getUnmoderated(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; + getTop(options?: ListingOptions & { time?: Timespan }): Promise>; + getUnmoderated(options?: ListingOptions & { only?: 'links' | 'comments' }): Promise>; getUserFlair(name: string): Promise; - getUserFlairList(options?: ListingOptions & { name?: string; }): Listing; + getUserFlairList(options?: ListingOptions & { name?: string; }): Promise>; getUserFlairTemplates(): Promise; - getWikiBannedUsers(options?: ListingOptions & { name?: string }): Listing; - getWikiContributors(options?: ListingOptions & { name?: string }): Listing; + getWikiBannedUsers(options?: ListingOptions & { name?: string }): Promise>; + getWikiContributors(options?: ListingOptions & { name?: string }): Promise>; getWikiPage(name: string): WikiPage; getWikiPages(): Promise; - getWikiRevisions(options?: ListingOptions): Listing; + getWikiRevisions(options?: ListingOptions): Promise>; hideMyFlair(): Promise; inviteModerator(options: { name: string; permissions?: ModeratorPermission[]; }): Promise; leaveContributor(): Promise; @@ -151,7 +151,7 @@ export default class Subreddit extends RedditContent { removeModerator(options: { name: string; }): Promise; removeWikiContributor(options: { name: string; }): Promise; revokeModeratorInvite(options: { name: string; }): Promise; - search(options: BaseSearchOptions): Listing; + search(options: BaseSearchOptions): Promise>; selectMyFlair(options: { flair_template_id: string; text?: string; }): Promise; setModeratorPermissions(options: { name: string; permissions: ModeratorPermission; }): Promise; setMultipleUserFlairs(flairs: Array<{ diff --git a/types/snoowrap/dist/objects/WikiPage.d.ts b/types/snoowrap/dist/objects/WikiPage.d.ts index ab9de1bdf6..88f16e2f23 100644 --- a/types/snoowrap/dist/objects/WikiPage.d.ts +++ b/types/snoowrap/dist/objects/WikiPage.d.ts @@ -13,8 +13,8 @@ export default class WikiPage extends RedditContent { addEditor(options: { name: string; }): Promise; edit(options: EditOptions): Promise; editSettings(options: Settings): Promise; - getDiscussions(options?: ListingOptions): Listing; - getRevisions(options?: ListingOptions): Listing; + getDiscussions(options?: ListingOptions): Promise>; + getRevisions(options?: ListingOptions): Promise>; getSettings(): Promise; hideRevision(options: { id: string; }): Promise; removeEditor(options: { name: string; }): Promise; diff --git a/types/snoowrap/snoowrap-tests.ts b/types/snoowrap/snoowrap-tests.ts index b83a9514f1..61aca46ffa 100644 --- a/types/snoowrap/snoowrap-tests.ts +++ b/types/snoowrap/snoowrap-tests.ts @@ -81,3 +81,7 @@ export function submissionSearch(query: string, subreddit: string): Promise> { return r.searchSubreddits({ query }); } + +export function getHotFromSubreddit(subreddit: string): Promise> { + return r.getSubreddit(subreddit).getHot({ limit: 10 }); +} diff --git a/types/socketcluster-server/scserver.d.ts b/types/socketcluster-server/scserver.d.ts index c04c4888f0..d6e808b245 100644 --- a/types/socketcluster-server/scserver.d.ts +++ b/types/socketcluster-server/scserver.d.ts @@ -3,7 +3,7 @@ import { Secret } from "jsonwebtoken"; import { ServerOptions } from "https"; import { IncomingMessage, Server } from "http"; import { SCAuthEngine } from "sc-auth"; -import { SCExchange } from "sc-broker-cluster"; +import { SCExchange, Client } from "sc-broker-cluster"; import WebSocket = require("ws"); import SCServerSocket = require("./scserversocket"); @@ -18,6 +18,7 @@ declare class SCServer extends EventEmitter { readonly MIDDLEWARE_EMIT: "emit"; options: SCServer.SCServerOptions; + brokerEngine: Client; exchange: SCExchange; clients: { @@ -58,7 +59,10 @@ declare class SCServer extends EventEmitter { removeMiddleware(type: "emit", middlewareFn: (req: SCServer.EmitRequest, next: SCServer.nextMiddlewareFunction) => void): void; setAuthEngine(authEngine: SCAuthEngine): void; + auth: SCAuthEngine; + setCodecEngine(codecEngine: SCServer.SCCodecEngine): void; + codec: SCServer.SCCodecEngine; close(cb?: (err?: Error) => void): void; @@ -348,7 +352,7 @@ declare namespace SCServer { interface SCCodecEngine { decode: (input: any) => any; - ncode: (object: any) => any; + encode: (object: any) => any; } interface VerifyHandshakeInfo { diff --git a/types/socketcluster-server/scserversocket.d.ts b/types/socketcluster-server/scserversocket.d.ts index 7b32cef72c..c4440a13f3 100644 --- a/types/socketcluster-server/scserversocket.d.ts +++ b/types/socketcluster-server/scserversocket.d.ts @@ -29,15 +29,65 @@ declare class SCServerSocket extends Emitter { constructor(id: string, server: SCServer, socket: WebSocket); + on(event: "error", listener: (error: Error) => void): this; + on(event: "message" | "raw", listener: (message: WebSocket.Data) => void): this; + on(event: "connectAbort" | "disconnect" | "close", listener: (code: number, data?: any) => void): this; + on(event: "authStateChange", listener: (stateChangeData: SCServerSocket.StateChangeData) => void): this; + on(event: "authenticate", listener: (authToken?: SCServer.AuthToken) => void): this; + on(event: "deauthenticate", listener: (oldToken?: SCServer.AuthToken) => void): this; + getState(): "connecting" | "open" | "closed"; + getBytesReceived(): number; + disconnect(code?: number, data?: any): void; + destroy(code?: number, data?: any): void; + terminate(): void; + send(data: any, options: { mask?: boolean; binary?: boolean; compress?: boolean; fin?: boolean }): void; + + decode(message: any): any; + encode(object: any): any; + + sendObjectBatch(object: any): void; + sendObjectSingle(object: any): void; + sendObject(object: any, options?: { batch?: boolean }): void; + + emit(event: string, ...args: any[]): boolean; + emit(event: string, data: any, callback?: SCServerSocket.EmitCallback, options?: SCServerSocket.EmitOptions): void; + + triggerAuthenticationEvents(oldState: "authenticated" | "unauthenticated"): void; + getAuthToken(): SCServer.AuthToken; - setAuthToken(data: SCServer.AuthToken, options?: SignOptions): void; - deauthenticate(): void; + setAuthToken(data: SCServer.AuthToken, options?: SignOptions, callback?: SCServerSocket.EmitCallback): void; + + deauthenticateSelf(): void; + deauthenticate(callback?: SCServerSocket.EmitCallback): void; + kickOut(channel?: string, message?: string, callback?: () => void): void; + subscriptions(): string[]; isSubscribed(channel?: string): boolean; } export = SCServerSocket; + +declare namespace SCServerSocket { + type EmitCallback = (err: Error, eventObject: EventObject) => void; + + interface EventObject { + event: string; + data?: any; + cid?: number; + } + + interface EmitOptions { + useCache?: boolean; + stringifiedData?: string; + } + + interface StateChangeData { + oldState: "authenticated" | "unauthenticated"; + newState: "authenticated" | "unauthenticated"; + authToken?: SCServer.AuthToken; + } +} diff --git a/types/ssh2-streams/index.d.ts b/types/ssh2-streams/index.d.ts index df1e001e0a..54d6359538 100644 --- a/types/ssh2-streams/index.d.ts +++ b/types/ssh2-streams/index.d.ts @@ -1628,6 +1628,11 @@ export interface TransferOptions { * Called every time a part of a file was transferred */ step?: (total_transferred: number, chunk: number, total: number) => void; + + /** + * Integer or string representing the file mode to set for the uploaded file. + */ + mode?: number | string; } export interface ReadStreamOptions { @@ -1703,4 +1708,4 @@ export interface ParsedKey { export interface ReadFileOptions { encoding?: string; flag?: string; -} \ No newline at end of file +} diff --git a/types/ssh2-streams/ssh2-streams-tests.ts b/types/ssh2-streams/ssh2-streams-tests.ts index 9ae121a454..7fd73756d5 100644 --- a/types/ssh2-streams/ssh2-streams-tests.ts +++ b/types/ssh2-streams/ssh2-streams-tests.ts @@ -102,4 +102,6 @@ sftp.createReadStream("path"); sftp.createWriteStream("path"); sftp.data(0, buffer); sftp.fastGet("remotePath", "localPath", () => {}); -sftp.fastPut("localPath", "remotePath", () => {}); \ No newline at end of file +sftp.fastGet("remotePath", "localPath", { concurrency: 64, chunkSize: 32768, step: () => {} }, () => {}); +sftp.fastPut("localPath", "remotePath", () => {}); +sftp.fastPut("localPath", "remotePath", { concurrency: 64, chunkSize: 32768, step: () => {}, mode: '0755' }, () => {}); diff --git a/types/storybook__addon-info/index.d.ts b/types/storybook__addon-info/index.d.ts index 111f7dc54d..a6c463f5d9 100644 --- a/types/storybook__addon-info/index.d.ts +++ b/types/storybook__addon-info/index.d.ts @@ -6,7 +6,7 @@ // TypeScript Version: 2.8 import * as React from 'react'; -import { RenderFunction } from '@storybook/react'; +import { RenderFunction, StoryDecorator } from '@storybook/react'; export interface WrapStoryProps { storyFn?: RenderFunction; @@ -29,6 +29,10 @@ export interface Options { maxPropStringLength?: number; } +// TODO: it would be better to use type inference for the parameters +// type DecoratorParams = StoryDecorator extends (...a: infer A) => any ? A: never; +export function withInfo(story: RenderFunction, context: { kind: string, story: string }): ReturnType; +// Legacy, but supported export function withInfo(textOrOptions?: string | Options): (storyFn: RenderFunction) => (context?: object) => React.ReactElement; export function setDefaults(newDefaults: Options): Options; diff --git a/types/storybook__addon-info/storybook__addon-info-tests.tsx b/types/storybook__addon-info/storybook__addon-info-tests.tsx index 46fd799314..505780bf7e 100644 --- a/types/storybook__addon-info/storybook__addon-info-tests.tsx +++ b/types/storybook__addon-info/storybook__addon-info-tests.tsx @@ -1,11 +1,13 @@ /// import * as React from 'react'; -import { storiesOf } from '@storybook/react'; +import { addDecorator, storiesOf } from '@storybook/react'; import { setDefaults, withInfo } from '@storybook/addon-info'; const { Component } = React; +addDecorator(withInfo); + setDefaults({ inline: false, propTables: false diff --git a/types/storybook__addon-notes/index.d.ts b/types/storybook__addon-notes/index.d.ts index b669ce0a9c..096da8fa34 100644 --- a/types/storybook__addon-notes/index.d.ts +++ b/types/storybook__addon-notes/index.d.ts @@ -17,5 +17,9 @@ export type WithNotesOptions = string | { markdownOptions?: MarkedOptions; }; +// It would be preferable to infer the argument types, but that requires TS v 3.1 +// export function withNotes(...args: StoryDecorator extends (...a: infer A) => any ? A : never): ReturnType; +export function withNotes(story: RenderFunction, context: { kind: string, story: string }): ReturnType; +// Less-preferred but still supported: export function withNotes(options?: WithNotesOptions): StoryDecorator; export function withMarkdownNotes(markdown: string, options?: MarkedOptions): StoryDecorator; diff --git a/types/storybook__addon-notes/storybook__addon-notes-tests.tsx b/types/storybook__addon-notes/storybook__addon-notes-tests.tsx index ebf24ce227..edfe0daf14 100644 --- a/types/storybook__addon-notes/storybook__addon-notes-tests.tsx +++ b/types/storybook__addon-notes/storybook__addon-notes-tests.tsx @@ -1,8 +1,11 @@ import * as React from 'react'; -import { storiesOf } from '@storybook/react'; +import { addDecorator, storiesOf } from '@storybook/react'; import { withNotes, withMarkdownNotes, } from '@storybook/addon-notes'; +// New, preferred global registration: +addDecorator(withNotes); + const SIMPLE_MARKDOWN = ` ## Markdown for component diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index bbb003eca0..068755e157 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -4642,9 +4642,10 @@ declare namespace Stripe { items: IList; /** - * Hash describing the plan the customer is subscribed to + * Hash describing the plan the customer is subscribed to. Only set if the subscription + * contains a single plan. */ - plan: plans.IPlan; + plan?: plans.IPlan | null; /** * The number of subscriptions for the associated plan diff --git a/types/styled-components/index.d.ts b/types/styled-components/index.d.ts index 1ab41d31e1..924699dd3a 100644 --- a/types/styled-components/index.d.ts +++ b/types/styled-components/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Igor Oleinikov // Ihor Chulinda // Adam Lavin -// Jessica Franco +// Jessica Franco // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 diff --git a/types/styled-react-modal/index.d.ts b/types/styled-react-modal/index.d.ts index 3598e8d55b..48a0d67b32 100644 --- a/types/styled-react-modal/index.d.ts +++ b/types/styled-react-modal/index.d.ts @@ -10,6 +10,7 @@ import { StyledComponent, AnyStyledComponent, CSSObject, InterpolationFunction } declare const BaseModalBackground: StyledComponent<'div', any>; interface ModalProps { + children?: React.ReactNode; isOpen: boolean; allowScroll?: boolean; afterOpen?: () => void; diff --git a/types/styled-system/index.d.ts b/types/styled-system/index.d.ts index aa94ab2aed..19b9afcd5f 100644 --- a/types/styled-system/index.d.ts +++ b/types/styled-system/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for styled-system 3.1 +// Type definitions for styled-system 3.2 // Project: https://github.com/jxnblk/styled-system#readme // Definitions by: Marshall Bowers // Ben McCormick @@ -9,6 +9,7 @@ // Adam Lavin // Joachim Schuler // Adam Misiorny +// Sara F-P // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -41,7 +42,9 @@ export interface LowLevelStylefunctionArguments { scale?: Array; } -export function style(args: LowLevelStylefunctionArguments): {[cssProp: string]: string}; +export function style( + args: LowLevelStylefunctionArguments +): { [cssProp: string]: string }; export type TLengthStyledSystem = string | 0 | number; export type ResponsiveValue = T | Array | { [key: string]: T }; @@ -100,7 +103,7 @@ export function variant(props: VariantArgs): (...args: any[]) => any; export type ObjectOrArray = T[] | { [K: string]: T }; export interface BaseTheme { - breakpoints?: number[]; + breakpoints?: string[] | number[] | object; colors?: ObjectOrArray; fontSizes?: number[]; space?: number[]; diff --git a/types/terminal-kit/Rect.d.ts b/types/terminal-kit/Rect.d.ts new file mode 100644 index 0000000000..c1a41f6056 --- /dev/null +++ b/types/terminal-kit/Rect.d.ts @@ -0,0 +1,61 @@ +import Terminal = require("./Terminal"); +import ScreenBuffer = require("./ScreenBuffer"); +import TextBuffer = require("./TextBuffer"); + +declare class Rect { + readonly width: number; + readonly height: number; + readonly xmin: number; + readonly ymin: number; + readonly xmax: number; + readonly ymax: number; + readonly isNull: boolean; + + constructor( + options: + | Rect.AbsoluteOptions + | Rect.Region + | Rect + | Terminal + | ScreenBuffer + | TextBuffer + ); + constructor(xmin: number, xmax: number, ymin: number, ymax: number); + + static wrappingRect(params: { + srcRect: Rect; + dstRect: Rect; + offsetX: number; + offsetY: number; + wrapOnly?: "x" | "y"; + }): void; + + set(obj: Rect.Region): void; + + clip( + dstRect: Rect, + offsetX: number, + offsetY: number, + dstClipping: boolean + ): void; +} + +export = Rect; + +declare namespace Rect { + type Options = AbsoluteOptions | Region; + + interface AbsoluteOptions { + width: number; + height: number; + x?: number; + y?: number; + } + + interface Region { + xmin: number; + ymin: number; + xmax: number; + ymax: number; + } +} diff --git a/types/terminal-kit/ScreenBuffer.d.ts b/types/terminal-kit/ScreenBuffer.d.ts new file mode 100644 index 0000000000..45df94b729 --- /dev/null +++ b/types/terminal-kit/ScreenBuffer.d.ts @@ -0,0 +1,139 @@ +import NextGenEvents = require("nextgen-events"); + +import Terminal = require("./Terminal"); +import ScreenBufferHD = require("./ScreenBufferHD"); +import Rect = require("./Rect"); + +declare class ScreenBuffer extends NextGenEvents { + readonly dst: Terminal | ScreenBuffer; + readonly x: number; + readonly y: number; + readonly blending: boolean | ScreenBufferHD.IsBlending; + + constructor(options: ScreenBuffer.Options); + + static create(options: ScreenBuffer.Options): ScreenBuffer; + + static createFromString( + options: { + attr: number | ScreenBuffer.Attributes; + transparencyChar: string; + transparencyType: number; + }, + str: string + ): ScreenBuffer; + + static loadImage( + url: string, + options: { + terminal: Terminal; + shrink?: { + width: number; + height: number; + }; + }, + calback: (error: any, image: ScreenBufferHD) => void + ): void; + + static loadImage( + url: string, + calback: (error?: any, image?: ScreenBufferHD) => void + ): void; + + static attr2object(attrFlags: number): void; + attr2object(attrFlags: number): void; + + static object2attr(attrObject: ScreenBuffer.Attributes): void; + object2attr(attrObject: ScreenBuffer.Attributes): void; + + static loadSync(filepath: string): ScreenBuffer; + + fill(options?: { + attr: ScreenBuffer.Attributes | number; + char?: string; + }): void; + + clear(): void; + + put( + options: ScreenBuffer.PutOptions, + format: string, + ...formatArgumets: any[] + ): void; + + get(options?: { + x: number; + y: number; + }): { char: string; attr: ScreenBuffer.Attributes }; + + resize(fromRect: Rect | Rect.Options): void; + + draw(options?: ScreenBuffer.DrawOptions): void; + + drawCursor(options?: { dst: Terminal | ScreenBuffer }): void; + + moveTo(x: number, y: number): void; + + vScroll(offset: number, drawToTerminal: boolean): void; + + dumpChars(): string; + + saveSync(filepath: string): void; +} + +export = ScreenBuffer; + +declare namespace ScreenBuffer { + interface Options { + width?: number; + height?: number; + dst: Terminal | ScreenBuffer; + x?: number; + y?: number; + blending?: boolean; + wrap?: boolean; + noFill?: boolean; + } + + interface DrawOptions { + dst?: Terminal | ScreenBuffer; + x?: number; + y?: number; + srcClipRect?: Rect; + dstClipRect?: Rect; + blending?: boolean; + delta?: boolean; + wrap?: boolean | "x" | "y"; + tile?: boolean; + } + + interface Attributes { + color?: number; + defaultColor?: boolean; + bgColor?: number; + bgDefaultColor?: boolean; + bold?: boolean; + dim?: boolean; + italic?: boolean; + underline?: boolean; + blink?: boolean; + inverse?: boolean; + hidden?: boolean; + strike?: boolean; + transparency?: boolean; + fgTransparency?: boolean; + bgTransparency?: boolean; + styleTransparency?: boolean; + charTransparency?: boolean; + } + + interface PutOptions { + x: number; + y: number; + attr: Attributes | number; + wrap: boolean; + direction?: "right" | "left" | "up" | "down" | null; + dx: number; + dy: number; + } +} diff --git a/types/terminal-kit/ScreenBufferHD.d.ts b/types/terminal-kit/ScreenBufferHD.d.ts new file mode 100644 index 0000000000..76a9571cda --- /dev/null +++ b/types/terminal-kit/ScreenBufferHD.d.ts @@ -0,0 +1,83 @@ +import ScreenBuffer = require("./ScreenBuffer"); + +declare class ScreenBufferHD extends ScreenBuffer { + constructor( + options: { blending: ScreenBufferHD.IsBlending } | ScreenBuffer.Options + ); + + readonly blending: ScreenBufferHD.IsBlending; + + static loadImage( + url: string, + calback: (error?: any, image?: ScreenBufferHD) => void + ): void; + + static loadImage( + url: string, + options: { shrink?: { height: number; width: number } }, + callback: (error: any, image: ScreenBufferHD) => void + ): void; + + draw( + options?: ScreenBuffer.DrawOptions | { blending: ScreenBufferHD.IsBlending } + ): void; + + fill( + options?: + | { + attr: ScreenBuffer.Attributes | number; + char?: string; + } + | { + attr: ScreenBufferHD.Attributes | number; + char?: string; + } + ): void; +} + +export = ScreenBufferHD; + +declare namespace ScreenBufferHD { + interface Attributes { + r: number; + g: number; + b: number; + a?: number; + defaultColor?: boolean; + bgR: number; + bgG: number; + bgB: number; + bgA?: number; + bgDefaultColor?: boolean; + bold?: boolean; + dim?: boolean; + italic?: boolean; + underline?: boolean; + blink?: boolean; + inverse?: boolean; + hidden?: boolean; + strike?: boolean; + transparency?: boolean; + styleTransparency?: boolean; + charTransparency?: boolean; + } + + type IsBlending = false | Blending; + + interface Blending { + fn: BlendFunction; + opacity: number; + blendSrcFgWithDstBg: boolean; + } + + type BlendFunction = (src: number, dst: number) => number; + + interface BlendFn { + normal: BlendFunction; + multiply: BlendFunction; + screen: BlendFunction; + overlay: BlendFunction; + hardLight: BlendFunction; + softLight: BlendFunction; + } +} diff --git a/types/terminal-kit/Terminal.d.ts b/types/terminal-kit/Terminal.d.ts new file mode 100644 index 0000000000..21434c1a5c --- /dev/null +++ b/types/terminal-kit/Terminal.d.ts @@ -0,0 +1,545 @@ +import EventEmitter = require("nextgen-events"); + +type Terminal = Terminal.Impl & EventEmitter; + +export = Terminal; + +type Callback = ((err: any) => void) | ((err: undefined, arg: T) => void); + +declare namespace Terminal { + interface Impl { + width: number; + height: number; + appName: string; + app: string; + generic: string; + termconfigFile: string; + + (str?: string): Terminal; + (...args: any[]): Terminal; + + defaultColor: CTerminal; + black: CTerminal; + red: CTerminal; + green: CTerminal; + yellow: CTerminal; + blue: CTerminal; + magenta: CTerminal; + cyan: CTerminal; + white: CTerminal; + brightBlack: CTerminal; + gray: CTerminal; + grey: CTerminal; + brightRed: CTerminal; + brightGreen: CTerminal; + brightYellow: CTerminal; + brightBlue: CTerminal; + brightMagenta: CTerminal; + brightCyan: CTerminal; + brightWhite: CTerminal; + color: (register: number) => Terminal; + darkColor: (register: number) => Terminal; + brightColor: (register: number) => Terminal; + color256: (register: number) => Terminal; + colorRgb: (r: number, g: number, b: number) => Terminal; + colorRgbHex: (rgb: string) => Terminal; + colorGrayscale: (I: number) => Terminal; + + bgDefaultColor: CTerminal; + bgBlack: CTerminal; + bgRed: CTerminal; + bgGreen: CTerminal; + bgYellow: CTerminal; + bgBlue: CTerminal; + bgMagenta: CTerminal; + bgCyan: CTerminal; + bgWhite: CTerminal; + bgBrightBlack: CTerminal; + bgGray: CTerminal; + bgGrey: CTerminal; + bgBrightRed: CTerminal; + bgBrightGreen: CTerminal; + bgBrightYellow: CTerminal; + bgBrightBlue: CTerminal; + bgBrightMagenta: CTerminal; + bgBrightCyan: CTerminal; + bgBrightWhite: CTerminal; + bgColor: (register: number) => Terminal; + bgDarkColor: (register: number) => Terminal; + bgBrightColor: (register: number) => Terminal; + bgColor256: (register: number) => Terminal; + bgColorRgb: (r: number, g: number, b: number) => Terminal; + bgColorRgbHex: (rgb: string) => Terminal; + bgColorGrayscale: (I: number) => Terminal; + + styleReset: CTerminal; + bold: CTerminal; + dim: CTerminal; + italic: CTerminal; + underline: CTerminal; + blink: CTerminal; + inverse: CTerminal; + hidden: CTerminal; + strike: CTerminal; + + saveCursor: Terminal; + restoreCursor: Terminal; + up: ((n: number) => Terminal) | ((n: number, ...args: any[]) => Terminal); + down: (n: number) => Terminal; + right: (n: number) => Terminal; + left: (n: number) => Terminal; + nextLine: (n: number) => Terminal; + previousLine: (n: number) => Terminal; + column: (x: number) => Terminal; + scrollUp: (n: number) => Terminal; + scrollDown: (n: number) => Terminal; + scrollingRegion: (top: number, bottom: number) => Terminal; + resetScrollingRegion: Terminal; + moveTo: CTerminal; + move: (x: number, y: number) => Terminal; + hideCursor: Terminal; + tabSet: Terminal; + tabClear: Terminal; + tabClearAll: Terminal; + forwardTab: (n: number) => Terminal; + backwardTab: (n: number) => Terminal; + + clear: Terminal; + eraseDisplayBelow: Terminal; + eraseDisplayAbove: Terminal; + eraseDisplay: Terminal; + eraseScrollback: Terminal; + eraseLineAfter: Terminal; + eraseLineBefore: Terminal; + eraseLine: Terminal; + eraseArea: ( + x: number, + y: number, + width?: number, + height?: number + ) => Terminal; + insertLine: (n: number) => Terminal; + deleteLine: (n: number) => Terminal; + insert: (n: number) => Terminal; + delete: (n: number) => Terminal; + backDelete: Terminal; + alternateScreenBuffer: Terminal; + + requestCursorLocation: Terminal; + requestScreenSize: Terminal; + requestColor: (n: number) => Terminal; + applicationKeypad: Terminal; + + mouseButton: Terminal; + mouseDrag: Terminal; + mouseMotion: Terminal; + mouseSGR: Terminal; + focusEvent: Terminal; + cwd: (uri: string) => Terminal; + windowTitle: (str: string) => Terminal; + iconName: (str: string) => Terminal; + notify: (title: string, text: string) => Terminal; + + error: Terminal; + str: Terminal; + noFormat: (str: string) => Terminal; + markupOnly: (str: string) => Terminal; + wrap: CTerminal; + bindArgs: (...args: any[]) => Terminal; + + reset: Terminal; + bell: Terminal; + setCursorColor: (register: number) => Terminal; + setCursorColorRgb: (r: number, g: number, b: number) => Terminal; + resetCursorColorRgb: Terminal; + setDefaultColorRgb: (r: number, g: number, b: number) => Terminal; + resetDefaultColorRgb: Terminal; + setDefaultBgColorRgb: (r: number, g: number, b: number) => Terminal; + resetDefaultBgColorRgb: Terminal; + setHighlightBgColorRgb: (r: number, g: number, b: number) => Terminal; + resetHighlightBgColorRgb: Terminal; + + fullscreen: (options: boolean | { noAlternate: boolean }) => void; + processExit: (code: number) => void; + grabInput( + options: + | boolean + | { + mouse?: "button" | "drag" | "motion"; + safe?: boolean; + }, + safeCallback?: boolean + ): void; + + getCursorLocation: ( + callback: (error: any, x?: number, y?: number) => void + ) => void; + getColor( + register: number, + callback?: Callback<{ r: number; g: number; b: number }> + ): void; + setColor( + register: number, + r: number, + g: number, + b: number, + names?: ReadonlyArray + ): void; + setColor( + register: number, + rgb: { r: number; g: number; b: number }, + names?: ReadonlyArray + ): void; + getPalette(register: number, callback?: Callback): void; + setPalette(palette: string | Palette): void; + + wrapColumn(options?: { + width: null | number; + x: number; + continue?: boolean; + offset?: number; + }): void; + wrapColumn(x: undefined | number, width: number): void; + + yesOrNo(options: YesOrNoOptions, callback: Callback): void; + + yesOrNo( + options?: YesOrNoOptions + ): { + abort: () => void; + promise?: Promise; + }; + + inputField(options: InputFieldOptions, callback: Callback): void; + inputField(callback: Callback): void; + inputField( + options?: InputFieldOptions + ): { + abort: () => void; + promise?: Promise; + }; + + fileInput(options: IFileInputOptions, callback: Callback): void; + fileInput(options?: IFileInputOptions): Promise; + + singleLineMenu( + menuItems: ReadonlyArray, + options: SingleLineMenuOptions, + callback: Callback + ): void; + + singleLineMenu( + menuItems: ReadonlyArray, + callback: Callback + ): void; + + singleLineMenu( + menuItems: ReadonlyArray, + options?: SingleLineMenuOptions + ): { + promise: Promise; + }; + + singleRowMenu( + menuItems: ReadonlyArray, + options: SingleLineMenuOptions, + callback: Callback + ): void; + + singleRowMenu( + menuItems: ReadonlyArray, + callback: Callback + ): void; + + singleRowMenu( + menuItems: ReadonlyArray, + options?: SingleLineMenuOptions + ): { + promise: Promise; + }; + + singleColumnMenu( + menuItems: ReadonlyArray, + options: SingleColumnMenuOptions, + callback: Callback + ): void; + + singleColumnMenu( + menuItems: ReadonlyArray, + callback: Callback + ): void; + + singleColumnMenu( + menuItems: ReadonlyArray, + options?: SingleColumnMenuOptions + ): { + promise: Promise; + }; + + gridMenu( + menuItems: ReadonlyArray, + options: GridMenuOptions, + callback: Callback + ): void; + + gridMenu( + menuItems: ReadonlyArray, + callback: Callback + ): void; + + gridMenu( + menuItems: ReadonlyArray, + options?: GridMenuOptions + ): { + promise: Promise; + }; + + progressBar(options?: ProgressBarOptions): ProgressBarController; + + bar( + value: number, + options?: { innerSize?: number; barStyle?: CTerminal } + ): void; + + slowTyping( + str: string, + options: { + style?: CTerminal; + flashStyle?: CTerminal; + delay?: number; + flashDelay?: number; + }, + callback: Callback + ): void; + slowTyping(str: string, callback: Callback): void; + + slowTyping( + str: string, + options?: { + style?: CTerminal; + flashStyle?: CTerminal; + delay?: number; + flashDelay?: number; + } + ): Promise; + + drawImage( + url: string, + options: { + shrink?: { + width: number; + height: number; + }; + }, + callback: Callback + ): void; + + drawImage(url: string, callback: Callback): void; + + drawImage( + url: string, + options?: { + shrink?: { + width: number; + height: number; + }; + } + ): Promise; + } + + interface ChainableInterface { + (str: string, ...args: any[]): T; + (...args: any[]): T; + } + + type Chainable = T & ChainableInterface; + + type CTerminal = Terminal & ((...args: any[]) => Terminal); + + type Palette = Array<{ + r: number; + g: number; + b: number; + names: ReadonlyArray; + }>; + + interface YesOrNoOptions { + yes: string | ReadonlyArray; + no: string | ReadonlyArray; + echoYes?: string; + echoNo?: string; + } + + type Autocompletion = + | (( + inputString: string, + callback: Callback> + ) => void) + | ((inputString: string) => Promise>); + + interface CreateOptions { + stdin?: NodeJS.Process; + stdout?: NodeJS.Process; + stderr?: NodeJS.Process; + generic?: string; + appId: string; + appName: string; + isTTY?: boolean; + isSSH?: boolean; + pid?: any; + preferProcessSigwinch?: boolean; + processSigwinch?: boolean; + } + + class AutocompletionArray extends Array { + prefix?: string; + postfix?: string; + } + + interface HookConfig { + style?: CTerminal; + hintStyle?: CTerminal; + tokenRegExp?: RegExp; + autoComplete?: string[] | Autocompletion; + autoCompleteMenu?: boolean | Autocompletion; + autoCompleteHint?: boolean; + } + + interface InputFieldOptions { + echo?: boolean; + echoChar?: string | true; + default?: string; + cursorPosition?: number; + cancelable?: boolean; + style?: CTerminal; + hintStyle?: CTerminal; + maxLength?: number; + minLength?: number; + history?: string[]; + autoComplete?: string[] | Autocompletion; + autoCompleteMenu?: boolean | Autocompletion; + autoCompleteHint?: boolean; + keyBindings?: { [key: string]: string }; + tokenHook?: ( + token: string, + isEndOfInput: boolean, + previousTokens: ReadonlyArray, + term: Terminal, + config: HookConfig + ) => string | CTerminal | null | void; + tokenResetHook?: ( + term: Terminal, + config?: HookConfig + ) => string | CTerminal; + tokenRegExp?: RegExp; + } + + type IFileInputOptions = InputFieldOptions & { baseDir: string }; + + interface SingleLineMenuResponse { + selectedIndex: number; + selectedText: string; + x: number; + y: number; + canceled: boolean; + unexpectedKey: string; + } + + interface SingleLineMenuOptions { + y?: number; + separator?: string; + nextPageHint?: string; + previousPageHint?: string; + style?: CTerminal; + selectedStyle?: CTerminal; + keyBindings?: { [key: string]: string }; + cancelable?: boolean; + exitOnUnexpectedKey?: boolean; + } + + interface SingleColumnMenuOptions { + y?: number; + style?: CTerminal; + selectedStyle?: CTerminal; + submittedStyle?: CTerminal; + leftPadding?: string; + selectedLeftPadding?: string; + submittedLeftPadding?: string; + extraLines?: number; + oneLineItem?: boolean; + itemMaxWidth?: number; + continueOnSubmit?: boolean; + selectedIndex?: number; + keyBindings?: { [key: string]: string }; + cancelable?: boolean; + exitOnUnexpectedKey?: boolean; + } + + interface SingleColumnMenuResponse { + selectedIndex: number; + selectedText: string; + submitted: boolean; + x: number; + y: number; + canceled: boolean; + unexpectedKey: string; + } + + interface GridMenuOptions { + y?: number; + x?: number; + width: number; + style?: CTerminal; + selectedStyle?: CTerminal; + leftPadding?: string; + selectedLeftPadding?: string; + rightPadding?: string; + selectedRightPadding?: string; + itemMaxWidth?: number; + keyBindings?: { [key: string]: string }; + exitOnUnexpectedKey?: boolean; + } + + interface GridMenuResponse { + selectedIndex: number; + selectedText: string; + x: number; + y: number; + unexpectedKey: string; + } + + interface ProgressBarOptions { + width?: number; + percent?: boolean; + eta?: boolean; + items?: number; + title?: string; + barStyle?: CTerminal; + barBracketStyle?: CTerminal; + percentStyle?: CTerminal; + etaStyle?: CTerminal; + itemStyle?: CTerminal; + titleStyle?: CTerminal; + itemSize?: number; + titleSize?: number; + barChar?: string; + barHeadChar?: string; + maxRefreshTime?: number; + minRefreshTime?: number; + inline?: boolean; + syncMode?: boolean; + } + + interface ProgressBarController { + update: ( + updateObject: + | number + | { progress: number | null; items?: number; title?: string } + ) => void; + startItem: (name: string) => void; + itemDone: (name: string) => void; + stop: () => void; + resume: () => void; + reset: () => void; + } +} diff --git a/types/terminal-kit/TextBuffer.d.ts b/types/terminal-kit/TextBuffer.d.ts new file mode 100644 index 0000000000..ef7c79458b --- /dev/null +++ b/types/terminal-kit/TextBuffer.d.ts @@ -0,0 +1,94 @@ +import ScreenBuffer = require("./ScreenBuffer"); +import Rect = require("./Rect"); + +export as namespace TextBuffer; + +declare class TextBuffer { + readonly x: number; + readonly y: number; + + constructor(options: TextBuffer.Options); + + getText(): string; + setText(text: string): void; + + getHidden(): boolean; + setHidden(state: boolean): void; + + getContentSize(): { width: number; height: number }; + + setEmptyCellAttr(attr: ScreenBuffer.Attributes | number): void; + + setAttrAt(attr: ScreenBuffer.Attributes | number, x: number, y: number): void; + setAttrCodeAt(attr: number, x: number, y: number): void; + + setAttrRegion( + attr: ScreenBuffer.Attributes | number, + region?: Rect.Region + ): void; + setAttrCodeRegion(attr: number, region?: Rect.Region): void; + + getMisc(): any; + getMiscAt(x: number, y: number): any; + + moveTo(x: number, y: number): void; + moveToColumn(x: number): void; + moveToLine(y: number): void; + moveToRow(y: number): void; + + move(x: number, y: number): void; + moveUp(): void; + moveDown(): void; + moveLeft(): void; + moveRight(): void; + moveForward(justSkipNullCells: boolean): void; + moveBackward(justSkipNullCells: boolean): void; + moveToEndOfLine(): void; + moveInBound(ignoreCx: boolean): void; + + insert(text: string, attr?: ScreenBuffer.Attributes | number): void; + + delete(n?: number): void; + bulkDelete(n?: number): void; + + newLine(): void; + joinLine(): void; + + iterate( + options: { finalCall: boolean }, + callback: ( + cellData: { + offset: number; + x: number; + y: number; + text: string; + attr: number; + misc: any; + } + ) => void + ): void; + + draw(options?: ScreenBuffer.DrawOptions): void; + + drawCursor(options?: { dst: ScreenBuffer }): void; + + load(filepath: string, callback: (error?: any) => void): void; + + save(filepath: string, callback: (error?: any) => void): void; +} + +export = TextBuffer; + +declare namespace TextBuffer { + interface Options { + dst: ScreenBuffer; + width?: number; + height?: number; + x?: number; + y?: number; + tabWidth?: number; + forceInBound?: number; + hidden?: boolean; + wrap?: boolean; + } +} diff --git a/types/terminal-kit/index.d.ts b/types/terminal-kit/index.d.ts new file mode 100644 index 0000000000..4746623fbd --- /dev/null +++ b/types/terminal-kit/index.d.ts @@ -0,0 +1,43 @@ +// Type definitions for terminal-kit 1.26 +// Project: https://github.com/cronvel/terminal-kit#readme +// Definitions by: katsanva +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +import Rect = require("./Rect"); +import ScreenBuffer = require("./ScreenBuffer"); +import ScreenBufferHD = require("./ScreenBufferHD"); +import Terminal = require("./Terminal"); +import TextBuffer = require("./TextBuffer"); + +export const terminal: Terminal; + +export const realTerminal: Terminal; + +export function createTerminal( + createOptions?: Terminal.CreateOptions +): Terminal; + +export function getParentTerminalInfo( + callback: (error: any, codename?: string, name?: string, pid?: number) => void +): void; + +export function getDetectedTerminal( + calback: (error: any, term: Terminal) => void +): void; + +export function autoComplete( + array: ReadonlyArray, + startString: string, + returnAlternatives?: boolean, + prefix?: string, + postfix?: string +): string; + +export function stripEscapeSequences(str: string): string; + +export function stringWidth(str: string): number; + +export function truncateString(str: string, maxWidth: number): string; + +export { Rect, ScreenBuffer, ScreenBufferHD, Terminal, TextBuffer }; diff --git a/types/terminal-kit/terminal-kit-tests.ts b/types/terminal-kit/terminal-kit-tests.ts new file mode 100644 index 0000000000..cdcdd4f5ac --- /dev/null +++ b/types/terminal-kit/terminal-kit-tests.ts @@ -0,0 +1,469 @@ +// Require the lib, get a working terminal +import t, { + terminal as term, + autoComplete as ac, + getDetectedTerminal, + ScreenBufferHD, + ScreenBuffer, + Terminal +} from "terminal-kit"; +import "node"; +import * as fs from "fs"; + +new t.Rect({width: 4, height: 4}); +// The term() function simply output a string to stdout, using current style +// output "Hello world!" in default terminal's colors +t.terminal("Hello world!\n"); + +// This output 'red' in red +term.red("red"); + +// This output 'bold' in bold +term.bold("bold"); + +// output 'mixed' using bold, underlined & red, exposing the style-mixing syntax +term.bold.underline.red("mixed"); + +// printf() style formatting everywhere: +// this will output 'My name is Jack, I'm 32.' in green +term.green("My name is %s, I'm %d.\n", "Jack", 32); + +// Since v0.16.x, style markup are supported as a shorthand. +// Those two lines produce the same result. +term("My name is ") + .red("Jack")(" and I'm ") + .green("32\n"); +term("My name is ^rJack^ and I'm ^g32\n"); + +// Width and height of the terminal +term("The terminal size is %dx%d", term.width, term.height); + +// Move the cursor at the upper-left corner +term.moveTo(1, 1); + +// We can always pass additional arguments that will be displayed... +term.moveTo(1, 1, "Upper-left corner"); + +// ... and formated +term.moveTo(1, 1, "My name is %s, I'm %d.\n", "Jack", 32); + +// ... or even combined with other styles +term.moveTo.cyan(1, 1, "My name is %s, I'm %d.\n", "Jack", 32); + +// Get some user input +term.magenta("Enter your name: "); +term.inputField((error: any, input: any) => { + term.green("\nYour name is '%s'\n", input); +}); + +function terminate() { + term.grabInput(false); + setTimeout(() => {}, 100); +} + +term.bold.cyan("Type anything on the keyboard...\n"); +term.green("Hit CTRL-C to quit.\n\n"); + +term.grabInput({ mouse: "button" }); + +term.on("key", (name: string, matches: any[], data: any) => { + console.log("'key' event:", name); + if (name === "CTRL_C") { + terminate(); + } +}); + +term.on("terminal", (name: string, data: any) => { + console.log("'terminal' event:", name, data); +}); + +term.on("mouse", (name: string, data: any) => { + console.log("'mouse' event:", name, data); +}); + +// Word-wrap this along the full terminal width +term.wrap.yellow( + `'Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish'` +); + +// Word-wrap this inside a column starting at x=10 with a width of 25 terminal cells +term.wrapColumn({ x: 10, width: 25 }); +term.wrap.green( + `'Permission is hereby granted, free of charge, to any person obtaining a copy of this software an + d associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish'` +); + +// This reset the offset +term("\n"); +// term.wrapColumn() could be used as well, but the next text would overwrite the last line + +// Text continuation: the second text start at the end of line of the first text +term.wrap.blue("^GP^re^Yr^um^Mi^bs^bs^ci^ro^mn^ is "); +term.wrap.red("hereby granted"); + +function question() { + term("Do you like javascript? [Y|n]\n"); + + // Exit on y and ENTER key + // Ask again on n + term.yesOrNo( + { yes: ["y", "ENTER"], no: ["n"] }, + (error: any, result: any) => { + if (result) { + term.green("'Yes' detected! Good bye!\n"); + } else { + term.red("'No' detected, are you sure?\n"); + question(); + } + } + ); +} + +question(); + +const history = ["John", "Jack", "Joey", "Billy", "Bob"]; + +const autoComplete = [ + "Barack Obama", + "George W. Bush", + "Bill Clinton", + "George Bush", + "Ronald W. Reagan", + "Jimmy Carter", + "Gerald Ford", + "Richard Nixon", + "Lyndon Johnson", + "John F. Kennedy", + "Dwight Eisenhower", + "Harry Truman", + "Franklin Roosevelt" +]; + +term("Please enter your name: "); + +term.inputField( + { history, autoComplete, autoCompleteMenu: true }, + (error: any, input: string) => { + term.green("\nYour name is '%s'\n", input); + } +); + +const history1 = ["John", "Jack", "Joey", "Billy", "Bob"]; + +const autoComplete1 = [ + "Barack Obama", + "George W. Bush", + "Bill Clinton", + "George Bush", + "Ronald W. Reagan", + "Jimmy Carter", + "Gerald Ford", + "Richard Nixon", + "Lyndon Johnson", + "John F. Kennedy", + "Dwight Eisenhower", + "Harry Truman", + "Franklin Roosevelt" +]; + +term("Please enter your name: "); +() => { + const input = term.inputField({ + history: history1, + autoComplete: autoComplete1, + autoCompleteMenu: true + }).promise; + + term.green("\nYour name is '%s'\n", input); +}; + +const autoCompleter = function autoCompleter( + inputString: string, + callback: (err: any, input: string) => void +) { + fs.readdir(__dirname, (error, files) => { + callback(undefined, ac(files, inputString, true)); + }); +}; + +term("Choose a file: "); + +term.inputField( + { autoComplete: autoCompleter, autoCompleteMenu: true }, + (error: any, input: any) => { + if (error) { + term.red.bold(`'\nAn error occurs: ' + ${error} + '\n'`); + } else { + term.green("\nYour file is '%s'\n", input); + } + } +); + +const autoComplete2 = [ + "dnf install", + "dnf install nodejs", + "dnf search", + "sudo", + "sudo dnf install", + "sudo dnf install nodejs", + "sudo dnf search" +]; + +term.inputField( + { + autoComplete: autoComplete2, + autoCompleteHint: true, + autoCompleteMenu: true, + tokenHook: ( + token: any, + isEndOfInput: any, + previousTokens: any, + term: any, + config: any + ) => { + const previousText = previousTokens.join(" "); + + switch (token) { + case "sudo": + config.style = term.red; + return previousTokens.length ? null : term.bold.red; + case "dnf": + return previousText === "" || previousText === "sudo" + ? term.brightMagenta + : null; + case "install": + config.style = term.brightBlue; + config.hintStyle = term.brightBlack.italic; + return previousText === "dnf" || previousText === "sudo dnf" + ? term.brightYellow + : null; + case "search": + config.style = term.brightBlue; + return previousText === "dnf" || previousText === "sudo dnf" + ? term.brightCyan + : null; + default: + return; + } + } + }, + (error: any, input: any) => { + term.green("\nYour command is: '%s'\n", input); + } +); + +term("Choose a file: "); + +term.fileInput({ baseDir: "../" }, (error: any, input: any) => { + if (error) { + term.red.bold(`'\nAn error occurs: ' + ${error} + '\n'`); + } else { + term.green("\nYour file is '%s'\n", input); + } +}); + +const items1 = [ + "File", + "Edit", + "View", + "History", + "Bookmarks", + "Tools", + "Help" +]; + +const options = { + y: 1, // the menu will be on the top of the terminal + style: term.inverse, + selectedStyle: term.dim.blue.bgGreen +}; + +term.clear(); + +term.singleLineMenu(items1, options, (error: any, response: any) => { + term("\n").eraseLineAfter.green( + "#%s selected: %s (%s,%s)\n", + response.selectedIndex, + response.selectedText, + response.x, + response.y + ); +}); + +term.cyan("The hall is spacious. Someone lighted few chandeliers.\n"); +term.cyan("There are doorways south and west.\n"); + +const items2 = ["a. Go south", "b. Go west", "c. Go back to the street"]; + +term.singleColumnMenu(items2, (error: any, response: any) => { + term("\n").eraseLineAfter.green( + "#%s selected: %s (%s,%s)\n", + response.selectedIndex, + response.selectedText, + response.x, + response.y + ); +}); + +term.cyan("Choose a file:\n"); + +const items = fs.readdirSync(process.cwd()); + +term.gridMenu(items, (error: any, response: any) => { + term("\n").eraseLineAfter.green( + "#%s selected: %s (%s,%s)\n", + response.selectedIndex, + response.selectedText, + response.x, + response.y + ); +}); + +let progressBar: Terminal.ProgressBarController; +let progress = 0; + +function doProgress() { + // Add random progress + progress += Math.random() / 10; + progressBar.update(progress); + + if (progress >= 1) { + // Cleanup and exit + setTimeout(() => { + term("\n"); + }, 200); + } else { + setTimeout(doProgress, 100 + Math.random() * 400); + } +} + +progressBar = term.progressBar({ + width: 80, + title: "Serious stuff in progress:", + eta: true, + percent: true +}); + +doProgress(); + +const thingsToDo = [ + "update my lib", + "data analyzing", + "serious business", + "decrunching data", + "do my laundry", + "optimizing" +]; + +let countDown = thingsToDo.length; + +function start() { + const task = thingsToDo.shift(); + + if (!task) { + return; + } + + progressBar.startItem(task); + + // Finish the task in... + setTimeout(done.bind(null, task), 500 + Math.random() * 1200); + + // Start another parallel task in... + setTimeout(start, 400 + Math.random() * 400); +} + +function done(task: string) { + progressBar.itemDone(task); + countDown--; + + // Cleanup and exit + if (!countDown) { + setTimeout(() => { + term("\n"); + }, 200); + } +} + +progressBar = term.progressBar({ + width: 80, + title: "Daily tasks:", + eta: true, + percent: true, + items: thingsToDo.length +}); + +start(); + +term.slowTyping( + "What a wonderful world!\n", + { flashStyle: term.brightWhite }, + () => {} +); + +// low level + +term("My name is ") + .red("Jack")(" and I'm ") + .green("32\n"); +term("My name is ^rJack^ and I'm ^g32\n"); + +getDetectedTerminal((error: any, term: any) => { + term.cyan("Terminal name: %s\n", term.appName); + term.cyan("Terminal app: %s\n", term.app); + term.cyan("Terminal generic: %s\n", term.generic); + term.cyan("Config file: %s\n", term.termconfigFile); +}); + +const screen = new ScreenBufferHD({ dst: term, noFill: true }); + +screen.fill({ + attr: { + // Both foreground and background must have the same color + r: 40, + g: 20, + b: 0, + bgR: 40, + bgG: 20, + bgB: 0 + } +}); + +const path_to_image = "/home/imoti/Downloads/photo_2019-01-24_13-15-50.jpg"; + +ScreenBufferHD.loadImage( + path_to_image, + { shrink: { width: term.width, height: term.height * 2 } }, + (error: any, image: any) => { + if (error) { + throw error; + } // Doh! + + image.draw({ dst: screen, blending: true }); + screen.draw(); + } +); + +const screen1 = new ScreenBuffer({ dst: term, noFill: true }); + +screen1.fill({ + attr: { + // Both foreground and background must have the same color + color: 0, + bgColor: 0 + } +}); + +ScreenBuffer.loadImage( + path_to_image, + { terminal: term, shrink: { width: term.width, height: term.height * 2 } }, + (error: any, image: any) => { + if (error) { + throw error; + } // Doh! + + image.draw({ dst: screen, blending: true }); + screen.draw(); + } +); diff --git a/types/terminal-kit/tsconfig.json b/types/terminal-kit/tsconfig.json new file mode 100644 index 0000000000..949b61722b --- /dev/null +++ b/types/terminal-kit/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es2017"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "esModuleInterop": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": false + }, + "files": ["index.d.ts", "terminal-kit-tests.ts"] +} diff --git a/types/terminal-kit/tslint.json b/types/terminal-kit/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/terminal-kit/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/text-clipper/index.d.ts b/types/text-clipper/index.d.ts new file mode 100644 index 0000000000..1f86ac405b --- /dev/null +++ b/types/text-clipper/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for text-clipper 1.2 +// Project: https://github.com/arendjr/text-clipper +// Definitions by: Krzysztof Grzybek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface Options { + breakWords?: boolean; + html?: boolean; + imageWeight?: number; + indicator?: string; + maxLines?: number; +} + +declare function clip(string: string, maxLength: number, options?: Options): string; +export = clip; diff --git a/types/text-clipper/text-clipper-tests.ts b/types/text-clipper/text-clipper-tests.ts new file mode 100644 index 0000000000..f4ca7e6f19 --- /dev/null +++ b/types/text-clipper/text-clipper-tests.ts @@ -0,0 +1,5 @@ +import clip = require('text-clipper'); + +clip('text', 123); // $ExpectType string +clip('text', 123, { breakWords: true, html: false }); // $ExpectType string +clip('text', 123, { imageWeight: 123, indicator: 'something', maxLines: 321 }); // $ExpectType string diff --git a/types/text-clipper/tsconfig.json b/types/text-clipper/tsconfig.json new file mode 100644 index 0000000000..caf06929bb --- /dev/null +++ b/types/text-clipper/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "text-clipper-tests.ts" + ] +} diff --git a/types/text-clipper/tslint.json b/types/text-clipper/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/text-clipper/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 25f10d1cf1..4866cbfd54 100755 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -867,6 +867,7 @@ export class BufferGeometry extends EventDispatcher { boundingBox: Box3; boundingSphere: Sphere; drawRange: { start: number, count: number }; + userData: {[key: string]: any}; getIndex(): BufferAttribute; setIndex( index: BufferAttribute|number[] ): void; @@ -3393,6 +3394,7 @@ export class Color { equals(color: Color): boolean; fromArray(rgb: number[], offset?: number): this; toArray(array?: number[], offset?: number): number[]; + toArray(xyz: ArrayLike, offset?: number): ArrayLike; } export namespace ColorKeywords { @@ -4707,9 +4709,18 @@ export class Vector2 implements Vector { * Returns an array [x, y], or copies x and y into the provided array. * @param array (optional) array to store the vector to. If this is not provided, a new array will be created. * @param offset (optional) optional offset into the array. + * @return The created or provided array. */ toArray(array?: number[], offset?: number): number[]; + /** + * Copies x and y into the provided array-like. + * @param array array-like to store the vector to. + * @param offset (optional) optional offset into the array. + * @return The provided array-like. + */ + toArray(array: ArrayLike, offset?: number): ArrayLike; + /** * Sets this vector's x and y values from the attribute. * @param attribute the source attribute. @@ -4985,7 +4996,23 @@ export class Vector3 implements Vector { equals(v: Vector3): boolean; fromArray(xyz: number[], offset?: number): Vector3; + + /** + * Returns an array [x, y, z], or copies x, y and z into the provided array. + * @param array (optional) array to store the vector to. If this is not provided, a new array will be created. + * @param offset (optional) optional offset into the array. + * @return The created or provided array. + */ toArray(xyz?: number[], offset?: number): number[]; + + /** + * Copies x, y and z into the provided array-like. + * @param array array-like to store the vector to. + * @param offset (optional) optional offset into the array. + * @return The provided array-like. + */ + toArray(xyz: ArrayLike, offset?: number): ArrayLike; + fromBufferAttribute( attribute: BufferAttribute, index: number, offset?: number): this; } diff --git a/types/trezor-connect/index.d.ts b/types/trezor-connect/index.d.ts index c9c5fb258d..282117efda 100644 --- a/types/trezor-connect/index.d.ts +++ b/types/trezor-connect/index.d.ts @@ -249,7 +249,13 @@ export interface Input { export interface RegularOutput { address: string; amount: string; - script_type: string; + script_type?: string; +} + +export interface InternalOutput { + address_n: number[]; + amount: string; + script_type?: string; } export interface SendMaxOutput { @@ -262,7 +268,7 @@ export interface OpReturnOutput { dataHex: string; } -export type Output = RegularOutput | SendMaxOutput | OpReturnOutput; +export type Output = RegularOutput | InternalOutput | SendMaxOutput | OpReturnOutput; export interface SignTransactionParams extends CommonParams { inputs: Input[]; diff --git a/types/tween.js/index.d.ts b/types/tween.js/index.d.ts index bd92bbdce7..66f5aa25cc 100644 --- a/types/tween.js/index.d.ts +++ b/types/tween.js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for tween.js v16.9.0 +// Type definitions for tween.js 17.2 // Project: https://github.com/tweenjs/tween.js/ // Definitions by: jordan , sunetos , jzarnikov , alexburner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -13,11 +13,14 @@ declare namespace TWEEN { export class Tween { constructor(object?: any, group?: Group); + getId(): number; + isPlaying(): boolean; to(properties: any, duration: number): Tween; start(time?: number): Tween; stop(): Tween; end(): Tween; stopChainedTweens(): Tween; + group(group: Group): Tween; delay(amount: number): Tween; repeat(times: number): Tween; repeatDelay(times: number): Tween; diff --git a/types/tween.js/tslint.json b/types/tween.js/tslint.json index a41bf5d19a..b981a4d162 100644 --- a/types/tween.js/tslint.json +++ b/types/tween.js/tslint.json @@ -6,8 +6,7 @@ "arrow-return-shorthand": false, "ban-types": false, "callable-types": false, - "comment-format": false, - "dt-header": false, + "comment-format": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/user-event/index.d.ts b/types/user-event/index.d.ts new file mode 100644 index 0000000000..4c4bebb1f8 --- /dev/null +++ b/types/user-event/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for user-event 1.4 +// Project: https://github.com/Gpx/user-event#readme +// Definitions by: Wu Haotian +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface UserOpts { + allAtOnce?: boolean; + delay?: number; +} +declare const userEvent: { + click: (element: Element | Window) => void; + dblClick: (element: Element | Window) => void; + type: ( + element: Element | Window, + text: string, + userOpts?: UserOpts + ) => Promise; +}; + +export default userEvent; diff --git a/types/user-event/tsconfig.json b/types/user-event/tsconfig.json new file mode 100644 index 0000000000..38348b184c --- /dev/null +++ b/types/user-event/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["dom", "es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "user-event-tests.ts"] +} diff --git a/types/user-event/tslint.json b/types/user-event/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/user-event/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/user-event/user-event-tests.ts b/types/user-event/user-event-tests.ts new file mode 100644 index 0000000000..0ecf6eb439 --- /dev/null +++ b/types/user-event/user-event-tests.ts @@ -0,0 +1,11 @@ +import userEvent, { UserOpts } from "user-event"; + +userEvent.click(document.body); // $ExpectType void +userEvent.dblClick(window); // $ExpectType void +userEvent.type(document.body, "s"); // $ExpectType Promise +userEvent.type(document.body, "s", {}); // $ExpectType Promise +userEvent.type(document.body, "s", { delay: 5000 }); // $ExpectType Promise +userEvent.type(document.body, "s", { allAtOnce: true }); // $ExpectType Promise +userEvent.type(document.body, "s", { delay: 1000, allAtOnce: false }); // $ExpectType Promise + +const u: UserOpts = { delay: 20 }; diff --git a/types/uuidv4/index.d.ts b/types/uuidv4/index.d.ts new file mode 100644 index 0000000000..44f8fc4efe --- /dev/null +++ b/types/uuidv4/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for uuidv4 2.0 +// Project: https://github.com/thenativeweb/uuidv4#readme +// Definitions by: Rindo Hinase +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = uuidv4; + +declare function uuidv4(): string; + +declare namespace uuidv4 { + type EmptyUUIDv4 = '00000000-0000-0000-0000-000000000000'; + + function is(value: string): boolean; + + function empty(): string; + + function fromString(text: string): string; +} diff --git a/types/uuidv4/tsconfig.json b/types/uuidv4/tsconfig.json new file mode 100644 index 0000000000..4ae973d9cb --- /dev/null +++ b/types/uuidv4/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "strictFunctionTypes": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "uuidv4-tests.ts" + ] +} diff --git a/types/uuidv4/tslint.json b/types/uuidv4/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/uuidv4/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/uuidv4/uuidv4-tests.ts b/types/uuidv4/uuidv4-tests.ts new file mode 100644 index 0000000000..0c5f915d95 --- /dev/null +++ b/types/uuidv4/uuidv4-tests.ts @@ -0,0 +1,13 @@ +import * as uuidv4 from 'uuidv4'; // uuidv4 is () => string + +// $ExpectType string +uuidv4(); + +// $ExpectType string +uuidv4.empty(); + +// $ExpectType boolean +uuidv4.is('00000000-0000-0000-0000-000000000000'); + +// $ExpectType string +uuidv4.fromString("test"); diff --git a/types/vinyl-fs/.editorconfig b/types/vinyl-fs/.editorconfig deleted file mode 100644 index 831139084b..0000000000 --- a/types/vinyl-fs/.editorconfig +++ /dev/null @@ -1,3 +0,0 @@ -[*.ts] -indent_style = space -indent_size = 3 diff --git a/types/vinyl-fs/index.d.ts b/types/vinyl-fs/index.d.ts index d35dd6bcef..f437276c4e 100644 --- a/types/vinyl-fs/index.d.ts +++ b/types/vinyl-fs/index.d.ts @@ -2,16 +2,17 @@ // Project: https://github.com/wearefractal/vinyl-fs // Definitions by: vvakame // remisery +// TeamworkGuy2 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// declare global { - namespace NodeJS { - interface WritableStream { - write(buffer: any/* Vinyl.File */, cb?: (err?: Error | null) => void): boolean; - } - } + namespace NodeJS { + interface WritableStream { + write(buffer: any/* Vinyl.File */, cb?: (err?: Error | null) => void): boolean; + } + } } import * as _events from 'events'; @@ -19,128 +20,128 @@ import * as File from 'vinyl'; import * as globStream from 'glob-stream'; export interface SrcOptions extends globStream.Options { - /** Prevents stream from emitting an error when file not found. */ - allowEmpty?: boolean; + /** Prevents stream from emitting an error when file not found. */ + allowEmpty?: boolean; - /** Specifies the working directory the folder is relative to */ - cwd?: string; + /** Specifies the working directory the folder is relative to */ + cwd?: string; - /** - * Specifies the folder relative to the cwd - * This is used to determine the file names when saving in .dest() - * Default: where the glob begins - */ - base?: string; + /** + * Specifies the folder relative to the cwd + * This is used to determine the file names when saving in .dest() + * Default: where the glob begins + */ + base?: string; - /** - * Setting this to false will make file.contents a paused stream - * If true it will buffer the file contents - * Default: true - */ - buffer?: boolean; + /** + * Setting this to false will make file.contents a paused stream + * If true it will buffer the file contents + * Default: true + */ + buffer?: boolean; - /** - * The mode the directory should be created with. - * Default: the process mode - */ - dirMode?: number; + /** + * The mode the directory should be created with. + * Default: the process mode + */ + dirMode?: number; - /** - * Whether or not you want globs to match on dot files or not - * (e.g., `.gitignore`). - */ - dot?: boolean; + /** + * Whether or not you want globs to match on dot files or not + * (e.g., `.gitignore`). + */ + dot?: boolean; - /** - * Whether or not to recursively resolve symlinks to their targets. - * Setting to `false` to preserve them as symlinks and make `file.symlink` - * equal the original symlink's target path. - * Default: true - */ - followSymlinks?: boolean; + /** + * Whether or not to recursively resolve symlinks to their targets. + * Setting to `false` to preserve them as symlinks and make `file.symlink` + * equal the original symlink's target path. + * Default: true + */ + followSymlinks?: boolean; - /** - * Setting this to false will ignore the contents of the file and disable - * writing to disk to speed up operations - * Default: true - */ - read?: boolean; + /** + * Setting this to false will ignore the contents of the file and disable + * writing to disk to speed up operations + * Default: true + */ + read?: boolean; - /** - * Whether or not the symlink should be relative or absolute. - * Default: false - */ - relative?: boolean; + /** + * Whether or not the symlink should be relative or absolute. + * Default: false + */ + relative?: boolean; - /** Only find files that have been modified since the time specified */ - since?: Date|number; + /** Only find files that have been modified since the time specified */ + since?: Date | number; - /** - * Causes the BOM to be stripped on UTF-8 encoded files. Set to `false` - * if you need the BOM for some reason. - */ - stripBOM?: boolean; + /** + * Causes the BOM to be stripped on UTF-8 encoded files. Set to `false` + * if you need the BOM for some reason. + */ + stripBOM?: boolean; - /** - * Setting this to true will create a duplex stream, one that passes - * through items and emits globbed files. - * Default: false - */ - passthrough?: boolean; + /** + * Setting this to true will create a duplex stream, one that passes + * through items and emits globbed files. + * Default: false + */ + passthrough?: boolean; - /** - * Setting this to true will enable sourcemaps. - * Default: false - */ - sourcemaps?: boolean; + /** + * Setting this to true will enable sourcemaps. + * Default: false + */ + sourcemaps?: boolean; - /** - * Whether or not to recursively resolve symlinks to their targets. Setting to false to - * preserve them as symlinks and make file.symlink equal the original symlink's target path. - * Default: false - */ - resolveSymlinks?: boolean; - /** - * Causes the BOM to be removed on UTF-8 encoded files. Set to false if you need the BOM for some reason. - * Default: true - */ - removeBOM?: boolean; + /** + * Whether or not to recursively resolve symlinks to their targets. Setting to false to + * preserve them as symlinks and make file.symlink equal the original symlink's target path. + * Default: false + */ + resolveSymlinks?: boolean; + /** + * Causes the BOM to be removed on UTF-8 encoded files. Set to false if you need the BOM for some reason. + * Default: true + */ + removeBOM?: boolean; } export interface DestOptions { - /** - * Specify the working directory the folder is relative to - * Default is process.cwd() - */ - cwd?: string; + /** + * Specify the working directory the folder is relative to + * Default is process.cwd() + */ + cwd?: string; - /** - * Specify the mode the files should be created with - * Default is the mode of the input file (file.stat.mode) - * or the process mode if the input file has no mode property - */ - mode?: number|string; + /** + * Specify the mode the files should be created with + * Default is the mode of the input file (file.stat.mode) + * or the process mode if the input file has no mode property + */ + mode?: number | string; - /** Specify the mode the directory should be created with. Default is the process mode */ - dirMode?: number|string; + /** Specify the mode the directory should be created with. Default is the process mode */ + dirMode?: number | string; - /** Specify if existing files with the same path should be overwritten or not. Default is true, to always overwrite existing files */ - overwrite?: boolean; + /** Specify if existing files with the same path should be overwritten or not. Default is true, to always overwrite existing files */ + overwrite?: boolean; - /** - * Enables sourcemap support on files passed through the stream. Will write inline soucemaps if - * specified as true. Specifying a string path will write external sourcemaps at the given path. - */ - sourcemaps?: true | string; + /** + * Enables sourcemap support on files passed through the stream. Will write inline soucemaps if + * specified as true. Specifying a string path will write external sourcemaps at the given path. + */ + sourcemaps?: true | string; - /** - * When creating a symlink, whether or not the created symlink should be relative. If false, - * the symlink will be absolute. Note: This option will be ignored if a junction is being created. - */ - relativeSymlinks?: boolean; + /** + * When creating a symlink, whether or not the created symlink should be relative. If false, + * the symlink will be absolute. Note: This option will be ignored if a junction is being created. + */ + relativeSymlinks?: boolean; - /* When creating a symlink, whether or not a directory symlink should be created as a junction. */ - useJunctions?: boolean; + /* When creating a symlink, whether or not a directory symlink should be created as a junction. */ + useJunctions?: boolean; } /** @@ -152,32 +153,6 @@ export interface DestOptions { */ export function src(globs: string|string[], opt?: SrcOptions): NodeJS.ReadWriteStream; -/** - * This is just a glob-watcher - * - * @param globs Takes a glob string or an array of glob strings as the first argument - * Globs are executed in order, so negations should follow positive globs - * fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js']) - */ -export function watch(globs: string|string[], cb?: (outEvt: { type: any; path: any; old: any; }) => void): _events.EventEmitter; - -/** - * This is just a glob-watcher - * - * @param globs Takes a glob string or an array of glob strings as the first argument - * Globs are executed in order, so negations should follow positive globs - * fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js']) - */ -export function watch( - globs: string|string[], - opt?: { - interval?: number; - debounceDelay?: number; - cwd?: string; - maxListeners?(): number; - }, - cb?: (outEvt: { type: any; path: any; old: any; }) => void): _events.EventEmitter; - /** * On write the stream will save the vinyl File to disk at the folder/cwd specified. * After writing the file to disk, it will be emitted from the stream so you can keep piping these around. @@ -207,20 +182,20 @@ export function dest(getFolderPath: (file: File) => string): NodeJS.ReadWriteStr * cwd, base, and path will be overwritten to match the folder */ export function symlink(folder: string, opts?: { - /** - * Specify the working directory the folder is relative to - * Default is process.cwd() - */ - cwd?: string; + /** + * Specify the working directory the folder is relative to + * Default is process.cwd() + */ + cwd?: string; - /** Specify the mode the directory should be created with. Default is the process mode */ - mode?: number|string; + /** Specify the mode the directory should be created with. Default is the process mode */ + mode?: number | string; - /** - * Specify the mode the directory should be created with - * Default is the process mode - */ - dirMode?: number + /** + * Specify the mode the directory should be created with + * Default is the process mode + */ + dirMode?: number }): NodeJS.ReadWriteStream; /** @@ -229,17 +204,16 @@ export function symlink(folder: string, opts?: { * The file will be modified after being written to this stream: * cwd, base, and path will be overwritten to match the folder */ -export function symlink(getFolderPath: (File: File) => string, opts?: - { - /** - * Specify the working directory the folder is relative to - * Default is process.cwd() - */ - cwd?: string; +export function symlink(getFolderPath: (File: File) => string, opts?: { + /** + * Specify the working directory the folder is relative to + * Default is process.cwd() + */ + cwd?: string; - /** - * Specify the mode the directory should be created with - * Default is the process mode - */ - dirMode?: number - }): NodeJS.ReadWriteStream; + /** + * Specify the mode the directory should be created with + * Default is the process mode + */ + dirMode?: number +}): NodeJS.ReadWriteStream; diff --git a/types/vinyl-fs/tsconfig.json b/types/vinyl-fs/tsconfig.json index 6f041838fd..7780364fc3 100644 --- a/types/vinyl-fs/tsconfig.json +++ b/types/vinyl-fs/tsconfig.json @@ -5,8 +5,8 @@ "es6" ], "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/vinyl-fs/tslint.json b/types/vinyl-fs/tslint.json index f2821adb2b..f93cf8562a 100644 --- a/types/vinyl-fs/tslint.json +++ b/types/vinyl-fs/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-object-literal-type-assertion": false - } + "extends": "dtslint/dt.json" } diff --git a/types/vinyl-fs/v0/index.d.ts b/types/vinyl-fs/v0/index.d.ts new file mode 100644 index 0000000000..5b30adcea0 --- /dev/null +++ b/types/vinyl-fs/v0/index.d.ts @@ -0,0 +1,201 @@ +// Type definitions for vinyl-fs 0.3 +// Project: https://github.com/wearefractal/vinyl-fs +// Definitions by: vvakame +// remisery +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare global { + namespace NodeJS { + interface WritableStream { + write(buffer: any/* Vinyl.File */, cb?: (err?: Error | null) => void): boolean; + } + } +} + +import * as _events from 'events'; +import * as File from 'vinyl'; +import * as globStream from 'glob-stream'; + +export interface SrcOptions extends globStream.Options { + /** Prevents stream from emitting an error when file not found. */ + allowEmpty?: boolean; + + /** Specifies the working directory the folder is relative to */ + cwd?: string; + + /** + * Specifies the folder relative to the cwd + * This is used to determine the file names when saving in .dest() + * Default: where the glob begins + */ + base?: string; + + /** + * Setting this to false will make file.contents a paused stream + * If true it will buffer the file contents + * Default: true + */ + buffer?: boolean; + + /** + * The mode the directory should be created with. + * Default: the process mode + */ + dirMode?: number; + + /** + * Whether or not you want globs to match on dot files or not + * (e.g., `.gitignore`). + */ + dot?: boolean; + + /** + * Whether or not to recursively resolve symlinks to their targets. + * Setting to `false` to preserve them as symlinks and make `file.symlink` + * equal the original symlink's target path. + * Default: true + */ + followSymlinks?: boolean; + + /** + * Setting this to false will ignore the contents of the file and disable + * writing to disk to speed up operations + * Default: true + */ + read?: boolean; + + /** + * Whether or not the symlink should be relative or absolute. + * Default: false + */ + relative?: boolean; + + /** Only find files that have been modified since the time specified */ + since?: Date|number; + + /** + * Causes the BOM to be stripped on UTF-8 encoded files. Set to `false` + * if you need the BOM for some reason. + */ + stripBOM?: boolean; + + /** + * Setting this to true will create a duplex stream, one that passes + * through items and emits globbed files. + * Default: false + */ + passthrough?: boolean; + + /** + * Setting this to true will enable sourcemaps. + * Default: false + */ + sourcemaps?: boolean; + + /** + * Whether or not to recursively resolve symlinks to their targets. Setting to false to + * preserve them as symlinks and make file.symlink equal the original symlink's target path. + * Default: false + */ + resolveSymlinks?: boolean; + /** + * Causes the BOM to be removed on UTF-8 encoded files. Set to false if you need the BOM for some reason. + * Default: true + */ + removeBOM?: boolean; +} + +export interface DestOptions { + /** + * Specify the working directory the folder is relative to + * Default is process.cwd() + */ + cwd?: string; + + /** + * Specify the mode the files should be created with + * Default is the mode of the input file (file.stat.mode) + * or the process mode if the input file has no mode property + */ + mode?: number|string; + + /** Specify the mode the directory should be created with. Default is the process mode */ + dirMode?: number|string; + + /** Specify if existing files with the same path should be overwritten or not. Default is true, to always overwrite existing files */ + overwrite?: boolean; + + /** + * Enables sourcemap support on files passed through the stream. Will write inline soucemaps if + * specified as true. Specifying a string path will write external sourcemaps at the given path. + */ + sourcemaps?: true | string; + + /** + * When creating a symlink, whether or not the created symlink should be relative. If false, + * the symlink will be absolute. Note: This option will be ignored if a junction is being created. + */ + relativeSymlinks?: boolean; + + /* When creating a symlink, whether or not a directory symlink should be created as a junction. */ + useJunctions?: boolean; +} + +/** + * Gets files that match the glob and converts them into the vinyl format + * @param globs Takes a glob string or an array of glob strings as the first argument + * Globs are executed in order, so negations should follow positive globs + * fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js']) + * @param opt Options Vinyl source options, changes the way the files are read, found, or stored in the vinyl stream + */ +export function src(globs: string|string[], opt?: SrcOptions): NodeJS.ReadWriteStream; + +/** + * This is just a glob-watcher + * + * @param globs Takes a glob string or an array of glob strings as the first argument + * Globs are executed in order, so negations should follow positive globs + * fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js']) + */ +export function watch(globs: string|string[], cb?: (outEvt: { type: any; path: any; old: any; }) => void): _events.EventEmitter; + +/** + * This is just a glob-watcher + * + * @param globs Takes a glob string or an array of glob strings as the first argument + * Globs are executed in order, so negations should follow positive globs + * fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js']) + */ +export function watch( + globs: string|string[], + opt?: { + interval?: number; + debounceDelay?: number; + cwd?: string; + maxListeners?(): number; + }, + cb?: (outEvt: { type: any; path: any; old: any; }) => void): _events.EventEmitter; + +/** + * On write the stream will save the vinyl File to disk at the folder/cwd specified. + * After writing the file to disk, it will be emitted from the stream so you can keep piping these around. + * The file will be modified after being written to this stream: + * cwd, base, and path will be overwritten to match the folder + * stat.mode will be overwritten if you used a mode parameter + * contents will have it's position reset to the beginning if it is a stream + * @param folder destination folder + */ +export function dest(folder: string, opt?: DestOptions): NodeJS.ReadWriteStream; + +/** + * On write the stream will save the vinyl File to disk at the folder/cwd specified. + * After writing the file to disk, it will be emitted from the stream so you can keep piping these around. + * The file will be modified after being written to this stream: + * cwd, base, and path will be overwritten to match the folder + * stat.mode will be overwritten if you used a mode parameter + * contents will have it's position reset to the beginning if it is a stream + * @param getFolderPath function that takes in a file and returns a folder path + */ +export function dest(getFolderPath: (file: File) => string): NodeJS.ReadWriteStream; diff --git a/types/vinyl-fs/v0/tsconfig.json b/types/vinyl-fs/v0/tsconfig.json new file mode 100644 index 0000000000..08ae9db69c --- /dev/null +++ b/types/vinyl-fs/v0/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "vinyl-fs": [ + "vinyl-fs/v0" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "vinyl-fs-tests.ts" + ] +} \ No newline at end of file diff --git a/types/vinyl-fs/v0/tslint.json b/types/vinyl-fs/v0/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/vinyl-fs/v0/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/vinyl-fs/v0/vinyl-fs-tests.ts b/types/vinyl-fs/v0/vinyl-fs-tests.ts new file mode 100644 index 0000000000..4d0316a0a0 --- /dev/null +++ b/types/vinyl-fs/v0/vinyl-fs-tests.ts @@ -0,0 +1,534 @@ +// from src + +import * as vfs from 'vinyl-fs'; + +import * as path from 'path'; +import * as fs from 'fs'; // require('graceful-fs'); + +// import bufEqual = require('buffer-equal'); +declare const bufEqual: any; +// import through = require('through2'); +declare const through: any; +import File = require('vinyl'); +// const spies = require('./spy'); +declare const spies: any; + +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + +// TODO: These aren't useful as types tests since they take `any`. +declare const should: ShouldStatic; +interface ShouldStatic { + exist(obj: any, desc?: string): void; + not: this; +} +declare global { + interface Object { + should: { equal(obj: any): void; }; + } +} + +declare const gulp: any; +let bufferStream: any; + +let dataWrap = (fn: any) => { + return (data: any, enc: any, cb: any) => { + fn(data); + cb(); + }; +}; + +describe('source stream', () => { + it('should explode on invalid glob (empty)', done => { + let stream: any; + try { + stream = gulp.src(); + } catch (err) { + should.exist(err); + should.not.exist(stream); + done(); + } + }); + + it('should explode on invalid glob (number)', done => { + let stream: any; + try { + stream = gulp.src(123); + } catch (err) { + should.exist(err); + should.not.exist(stream); + done(); + } + }); + + it('should explode on invalid glob (empty array)', done => { + let stream: any; + try { + stream = gulp.src([]); + } catch (err) { + should.exist(err); + should.not.exist(stream); + done(); + } + }); + + it('should pass through writes', done => { + const expectedPath = path.join(__dirname, "./fixtures/test.coffee"); + const expectedContent = fs.readFileSync(expectedPath); + + const expectedFile = new File({ + base: __dirname, + cwd: __dirname, + path: expectedPath, + contents: expectedContent + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + bufEqual(buffered[0].contents, expectedContent).should.equal(true); + done(); + }; + + const stream = vfs.src("./fixtures/nothing.coffee"); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should glob a file with default settings', done => { + const expectedPath = path.join(__dirname, "./fixtures/test.coffee"); + const expectedContent = fs.readFileSync(expectedPath); + + const onEnd = () => { + buffered.length.should.equal(1); + should.exist(buffered[0].stat); + buffered[0].path.should.equal(expectedPath); + buffered[0].isBuffer().should.equal(true); + bufEqual(buffered[0].contents, expectedContent).should.equal(true); + done(); + }; + + const stream = vfs.src("./fixtures/*.coffee", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + }); + + it('should glob a file with default settings and relative cwd', done => { + const expectedPath = path.join(__dirname, "./fixtures/test.coffee"); + const expectedContent = fs.readFileSync(expectedPath); + + const onEnd = () => { + buffered.length.should.equal(1); + should.exist(buffered[0].stat); + buffered[0].path.should.equal(expectedPath); + buffered[0].isBuffer().should.equal(true); + bufEqual(buffered[0].contents, expectedContent).should.equal(true); + done(); + }; + + const stream = vfs.src("./fixtures/*.coffee", { cwd: path.relative(process.cwd(), __dirname) }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + }); + + it('should glob a directory with default settings', done => { + const expectedPath = path.join(__dirname, "./fixtures/wow"); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].path.should.equal(expectedPath); + buffered[0].isNull().should.equal(true); + buffered[0].isDirectory().should.equal(true); + done(); + }; + + const stream = vfs.src("./fixtures/wow/", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + }); + + it('should glob a file with with no contents', done => { + const expectedPath = path.join(__dirname, "./fixtures/test.coffee"); + const expectedContent = fs.readFileSync(expectedPath); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].path.should.equal(expectedPath); + buffered[0].isNull().should.equal(true); + should.not.exist(buffered[0].contents); + done(); + }; + + const stream = vfs.src("./fixtures/*.coffee", { cwd: __dirname, read: false }); + + const buffered: any = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + }); + + it('should glob a file with streaming contents', done => { + const expectedPath = path.join(__dirname, "./fixtures/test.coffee"); + const expectedContent = fs.readFileSync(expectedPath); + + const onEnd = () => { + buffered.length.should.equal(1); + should.exist(buffered[0].stat); + buffered[0].path.should.equal(expectedPath); + buffered[0].isStream().should.equal(true); + + let contentBuffer = new Buffer([]); + const contentBufferStream = through(dataWrap((data: any) => { + contentBuffer = Buffer.concat([contentBuffer, data]); + })); + buffered[0].contents.pipe(contentBufferStream); + buffered[0].contents.once('end', () => { + bufEqual(contentBuffer, expectedContent); + done(); + }); + }; + + const stream = vfs.src("./fixtures/*.coffee", { cwd: __dirname, buffer: false }); + + const buffered: any = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + }); +}); + +// from dest +// const vfs = require('../'); + +// const path = require('path'); +// const fs = require('graceful-fs'); +import rimraf = require('rimraf'); + +// const bufEqual = require('buffer-equal'); +// const through = require('through2'); +// const File = require('vinyl'); + +// const should = require('should'); +// require('mocha'); + +const wipeOut = (cb: any) => { + rimraf(path.join(__dirname, "./out-fixtures/"), cb); +}; + +dataWrap = (fn: any) => { + return (data: any, enc: any, cb: any) => { + fn(data); + cb(); + }; +}; + +const realMode = (n: any) => { + return n & parseInt("07777", 8); +}; + +describe('dest stream', () => { + beforeEach(wipeOut); + afterEach(wipeOut); + + it('should explode on invalid folder', done => { + let stream: any; + try { + stream = gulp.dest(); + } catch (err) { + should.exist(err); + should.not.exist(stream); + done(); + } + }); + + it('should pass through writes with cwd', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + + const expectedFile = new File({ + base: __dirname, + cwd: __dirname, + path: inputPath, + contents: null + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should pass through writes with default cwd', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + + const expectedFile = new File({ + base: __dirname, + cwd: __dirname, + path: inputPath, + contents: null + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + done(); + }; + + const stream = vfs.dest(path.join(__dirname, "./out-fixtures/")); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should not write null files', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + const inputBase = path.join(__dirname, "./fixtures/"); + const expectedPath = path.join(__dirname, "./out-fixtures/test.coffee"); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, "./out-fixtures"); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: null + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(expectedCwd, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(false); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should write buffer files to the right folder with relative cwd', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + const inputBase = path.join(__dirname, "./fixtures/"); + const expectedPath = path.join(__dirname, "./out-fixtures/test.coffee"); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, "./out-fixtures"); + const expectedContents = fs.readFileSync(inputPath); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: expectedContents + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(expectedCwd, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + bufEqual(fs.readFileSync(expectedPath), expectedContents).should.equal(true); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: path.relative(process.cwd(), __dirname) }); + + const buffered: any = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should write buffer files to the right folder', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + const inputBase = path.join(__dirname, "./fixtures/"); + const expectedPath = path.join(__dirname, "./out-fixtures/test.coffee"); + const expectedContents = fs.readFileSync(inputPath); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, "./out-fixtures"); + const expectedMode = parseInt("0655", 8); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: expectedContents, + stat: { + mode: expectedMode + } as fs.Stats + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(expectedCwd, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + bufEqual(fs.readFileSync(expectedPath), expectedContents).should.equal(true); + realMode(fs.lstatSync(expectedPath).mode).should.equal(expectedMode); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should write streaming files to the right folder', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + const inputBase = path.join(__dirname, "./fixtures/"); + const expectedPath = path.join(__dirname, "./out-fixtures/test.coffee"); + const expectedContents = fs.readFileSync(inputPath); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, "./out-fixtures"); + const expectedMode = parseInt("0655", 8); + + const contentStream = through.obj(); + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: contentStream, + stat: { + mode: expectedMode + } as fs.Stats + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(expectedCwd, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + bufEqual(fs.readFileSync(expectedPath), expectedContents).should.equal(true); + realMode(fs.lstatSync(expectedPath).mode).should.equal(expectedMode); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: __dirname }); + + const buffered: any = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + setTimeout(() => { + contentStream.write(expectedContents); + contentStream.end(); + }, 100); + stream.end(); + }); + + it('should write directories to the right folder', done => { + const inputPath = path.join(__dirname, "./fixtures/test"); + const inputBase = path.join(__dirname, "./fixtures/"); + const expectedPath = path.join(__dirname, "./out-fixtures/test"); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, "./out-fixtures"); + const expectedMode = parseInt("0655", 8); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: null, + stat: { + isDirectory: () => true, + mode: expectedMode + } as fs.Stats + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(expectedCwd, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + fs.lstatSync(expectedPath).isDirectory().should.equal(true); + realMode(fs.lstatSync(expectedPath).mode).should.equal(expectedMode); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should allow piping multiple dests in streaming mode', done => { + const inputPath1 = path.join(__dirname, "./out-fixtures/multiple-first"); + const inputPath2 = path.join(__dirname, "./out-fixtures/multiple-second"); + const inputBase = path.join(__dirname, "./out-fixtures/"); + const srcPath = path.join(__dirname, "./fixtures/test.coffee"); + const stream1 = vfs.dest('./out-fixtures/', { cwd: __dirname }); + const stream2 = vfs.dest('./out-fixtures/', { cwd: __dirname }); + const content = fs.readFileSync(srcPath); + const rename = through.obj((file: any, _: any, next: any) => { + file.path = inputPath2; + this.push(file); + next(); + }); + + stream1.on('data', (file: any) => { + file.path.should.equal(inputPath1); + }); + + stream1.pipe(rename).pipe(stream2); + stream2.on('data', (file: any) => { + file.path.should.equal(inputPath2); + }).once('end', () => { + fs.readFileSync(inputPath1, 'utf8').should.equal(content.toString()); + fs.readFileSync(inputPath2, 'utf8').should.equal(content.toString()); + done(); + }); + + const file = new File({ + base: inputBase, + path: inputPath1, + cwd: __dirname, + contents: content + }); + + stream1.write(file); + stream1.end(); + }); +}); diff --git a/types/vinyl-fs/v1/index.d.ts b/types/vinyl-fs/v1/index.d.ts new file mode 100644 index 0000000000..2159567816 --- /dev/null +++ b/types/vinyl-fs/v1/index.d.ts @@ -0,0 +1,245 @@ +// Type definitions for vinyl-fs 1.0 +// Project: https://github.com/wearefractal/vinyl-fs +// Definitions by: vvakame +// remisery +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare global { + namespace NodeJS { + interface WritableStream { + write(buffer: any/* Vinyl.File */, cb?: (err?: Error | null) => void): boolean; + } + } +} + +import * as _events from 'events'; +import * as File from 'vinyl'; +import * as globStream from 'glob-stream'; + +export interface SrcOptions extends globStream.Options { + /** Prevents stream from emitting an error when file not found. */ + allowEmpty?: boolean; + + /** Specifies the working directory the folder is relative to */ + cwd?: string; + + /** + * Specifies the folder relative to the cwd + * This is used to determine the file names when saving in .dest() + * Default: where the glob begins + */ + base?: string; + + /** + * Setting this to false will make file.contents a paused stream + * If true it will buffer the file contents + * Default: true + */ + buffer?: boolean; + + /** + * The mode the directory should be created with. + * Default: the process mode + */ + dirMode?: number; + + /** + * Whether or not you want globs to match on dot files or not + * (e.g., `.gitignore`). + */ + dot?: boolean; + + /** + * Whether or not to recursively resolve symlinks to their targets. + * Setting to `false` to preserve them as symlinks and make `file.symlink` + * equal the original symlink's target path. + * Default: true + */ + followSymlinks?: boolean; + + /** + * Setting this to false will ignore the contents of the file and disable + * writing to disk to speed up operations + * Default: true + */ + read?: boolean; + + /** + * Whether or not the symlink should be relative or absolute. + * Default: false + */ + relative?: boolean; + + /** Only find files that have been modified since the time specified */ + since?: Date|number; + + /** + * Causes the BOM to be stripped on UTF-8 encoded files. Set to `false` + * if you need the BOM for some reason. + */ + stripBOM?: boolean; + + /** + * Setting this to true will create a duplex stream, one that passes + * through items and emits globbed files. + * Default: false + */ + passthrough?: boolean; + + /** + * Setting this to true will enable sourcemaps. + * Default: false + */ + sourcemaps?: boolean; + + /** + * Whether or not to recursively resolve symlinks to their targets. Setting to false to + * preserve them as symlinks and make file.symlink equal the original symlink's target path. + * Default: false + */ + resolveSymlinks?: boolean; + /** + * Causes the BOM to be removed on UTF-8 encoded files. Set to false if you need the BOM for some reason. + * Default: true + */ + removeBOM?: boolean; +} + +export interface DestOptions { + /** + * Specify the working directory the folder is relative to + * Default is process.cwd() + */ + cwd?: string; + + /** + * Specify the mode the files should be created with + * Default is the mode of the input file (file.stat.mode) + * or the process mode if the input file has no mode property + */ + mode?: number|string; + + /** Specify the mode the directory should be created with. Default is the process mode */ + dirMode?: number|string; + + /** Specify if existing files with the same path should be overwritten or not. Default is true, to always overwrite existing files */ + overwrite?: boolean; + + /** + * Enables sourcemap support on files passed through the stream. Will write inline soucemaps if + * specified as true. Specifying a string path will write external sourcemaps at the given path. + */ + sourcemaps?: true | string; + + /** + * When creating a symlink, whether or not the created symlink should be relative. If false, + * the symlink will be absolute. Note: This option will be ignored if a junction is being created. + */ + relativeSymlinks?: boolean; + + /* When creating a symlink, whether or not a directory symlink should be created as a junction. */ + useJunctions?: boolean; +} + +/** + * Gets files that match the glob and converts them into the vinyl format + * @param globs Takes a glob string or an array of glob strings as the first argument + * Globs are executed in order, so negations should follow positive globs + * fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js']) + * @param opt Options Vinyl source options, changes the way the files are read, found, or stored in the vinyl stream + */ +export function src(globs: string|string[], opt?: SrcOptions): NodeJS.ReadWriteStream; + +/** + * This is just a glob-watcher + * + * @param globs Takes a glob string or an array of glob strings as the first argument + * Globs are executed in order, so negations should follow positive globs + * fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js']) + */ +export function watch(globs: string|string[], cb?: (outEvt: { type: any; path: any; old: any; }) => void): _events.EventEmitter; + +/** + * This is just a glob-watcher + * + * @param globs Takes a glob string or an array of glob strings as the first argument + * Globs are executed in order, so negations should follow positive globs + * fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js']) + */ +export function watch( + globs: string|string[], + opt?: { + interval?: number; + debounceDelay?: number; + cwd?: string; + maxListeners?(): number; + }, + cb?: (outEvt: { type: any; path: any; old: any; }) => void): _events.EventEmitter; + +/** + * On write the stream will save the vinyl File to disk at the folder/cwd specified. + * After writing the file to disk, it will be emitted from the stream so you can keep piping these around. + * The file will be modified after being written to this stream: + * cwd, base, and path will be overwritten to match the folder + * stat.mode will be overwritten if you used a mode parameter + * contents will have it's position reset to the beginning if it is a stream + * @param folder destination folder + */ +export function dest(folder: string, opt?: DestOptions): NodeJS.ReadWriteStream; + +/** + * On write the stream will save the vinyl File to disk at the folder/cwd specified. + * After writing the file to disk, it will be emitted from the stream so you can keep piping these around. + * The file will be modified after being written to this stream: + * cwd, base, and path will be overwritten to match the folder + * stat.mode will be overwritten if you used a mode parameter + * contents will have it's position reset to the beginning if it is a stream + * @param getFolderPath function that takes in a file and returns a folder path + */ +export function dest(getFolderPath: (file: File) => string): NodeJS.ReadWriteStream; + +/** + * On write the stream will create a symbolic link (i.e. symlink) on disk at the folder/cwd specified. + * After creating the symbolic link, it will be emitted from the stream so you can keep piping these around. + * The file will be modified after being written to this stream: + * cwd, base, and path will be overwritten to match the folder + */ +export function symlink(folder: string, opts?: { + /** + * Specify the working directory the folder is relative to + * Default is process.cwd() + */ + cwd?: string; + + /** Specify the mode the directory should be created with. Default is the process mode */ + mode?: number|string; + + /** + * Specify the mode the directory should be created with + * Default is the process mode + */ + dirMode?: number +}): NodeJS.ReadWriteStream; + +/** + * On write the stream will create a symbolic link (i.e. symlink) on disk at the folder/cwd generated from getFolderPath. + * After creating the symbolic link, it will be emitted from the stream so you can keep piping these around. + * The file will be modified after being written to this stream: + * cwd, base, and path will be overwritten to match the folder + */ +export function symlink(getFolderPath: (File: File) => string, opts?: + { + /** + * Specify the working directory the folder is relative to + * Default is process.cwd() + */ + cwd?: string; + + /** + * Specify the mode the directory should be created with + * Default is the process mode + */ + dirMode?: number + }): NodeJS.ReadWriteStream; diff --git a/types/vinyl-fs/v1/tsconfig.json b/types/vinyl-fs/v1/tsconfig.json new file mode 100644 index 0000000000..4e7c14e299 --- /dev/null +++ b/types/vinyl-fs/v1/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "vinyl-fs": [ + "vinyl-fs/v1" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "vinyl-fs-tests.ts" + ] +} \ No newline at end of file diff --git a/types/vinyl-fs/v1/tslint.json b/types/vinyl-fs/v1/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/vinyl-fs/v1/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/vinyl-fs/v1/vinyl-fs-tests.ts b/types/vinyl-fs/v1/vinyl-fs-tests.ts new file mode 100644 index 0000000000..5b29b0465d --- /dev/null +++ b/types/vinyl-fs/v1/vinyl-fs-tests.ts @@ -0,0 +1,919 @@ +// from src + +import * as vfs from 'vinyl-fs'; + +import * as path from 'path'; +import * as fs from 'fs'; // require('graceful-fs'); + +// import bufEqual = require('buffer-equal'); +declare const bufEqual: any; +// import through = require('through2'); +declare const through: any; +import File = require('vinyl'); +// const spies = require('./spy'); +declare const spies: any; + +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + +// TODO: These aren't useful as types tests since they take `any`. +declare const should: ShouldStatic; +interface ShouldStatic { + exist(obj: any, desc?: string): void; + not: this; +} +declare global { + interface Object { + should: { equal(obj: any): void; }; + } +} + +declare const gulp: any; +let bufferStream: any; + +let dataWrap = (fn: any) => { + return (data: any, enc: any, cb: any) => { + fn(data); + cb(); + }; +}; + +describe('source stream', () => { + it('should explode on invalid glob (empty)', done => { + let stream: any; + try { + stream = gulp.src(); + } catch (err) { + should.exist(err); + should.not.exist(stream); + done(); + } + }); + + it('should explode on invalid glob (number)', done => { + let stream: any; + try { + stream = gulp.src(123); + } catch (err) { + should.exist(err); + should.not.exist(stream); + done(); + } + }); + + it('should explode on invalid glob (empty array)', done => { + let stream: any; + try { + stream = gulp.src([]); + } catch (err) { + should.exist(err); + should.not.exist(stream); + done(); + } + }); + + it('should pass through writes', done => { + const expectedPath = path.join(__dirname, "./fixtures/test.coffee"); + const expectedContent = fs.readFileSync(expectedPath); + + const expectedFile = new File({ + base: __dirname, + cwd: __dirname, + path: expectedPath, + contents: expectedContent + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + bufEqual(buffered[0].contents, expectedContent).should.equal(true); + done(); + }; + + const stream = vfs.src("./fixtures/nothing.coffee"); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should glob a file with default settings', done => { + const expectedPath = path.join(__dirname, "./fixtures/test.coffee"); + const expectedContent = fs.readFileSync(expectedPath); + + const onEnd = () => { + buffered.length.should.equal(1); + should.exist(buffered[0].stat); + buffered[0].path.should.equal(expectedPath); + buffered[0].isBuffer().should.equal(true); + bufEqual(buffered[0].contents, expectedContent).should.equal(true); + done(); + }; + + const stream = vfs.src("./fixtures/*.coffee", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + }); + + it('should glob a file with default settings and relative cwd', done => { + const expectedPath = path.join(__dirname, "./fixtures/test.coffee"); + const expectedContent = fs.readFileSync(expectedPath); + + const onEnd = () => { + buffered.length.should.equal(1); + should.exist(buffered[0].stat); + buffered[0].path.should.equal(expectedPath); + buffered[0].isBuffer().should.equal(true); + bufEqual(buffered[0].contents, expectedContent).should.equal(true); + done(); + }; + + const stream = vfs.src("./fixtures/*.coffee", { cwd: path.relative(process.cwd(), __dirname) }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + }); + + it('should glob a directory with default settings', done => { + const expectedPath = path.join(__dirname, "./fixtures/wow"); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].path.should.equal(expectedPath); + buffered[0].isNull().should.equal(true); + buffered[0].isDirectory().should.equal(true); + done(); + }; + + const stream = vfs.src("./fixtures/wow/", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + }); + + it('should glob a file with with no contents', done => { + const expectedPath = path.join(__dirname, "./fixtures/test.coffee"); + const expectedContent = fs.readFileSync(expectedPath); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].path.should.equal(expectedPath); + buffered[0].isNull().should.equal(true); + should.not.exist(buffered[0].contents); + done(); + }; + + const stream = vfs.src("./fixtures/*.coffee", { cwd: __dirname, read: false }); + + const buffered: any = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + }); + + it('should glob a file with streaming contents', done => { + const expectedPath = path.join(__dirname, "./fixtures/test.coffee"); + const expectedContent = fs.readFileSync(expectedPath); + + const onEnd = () => { + buffered.length.should.equal(1); + should.exist(buffered[0].stat); + buffered[0].path.should.equal(expectedPath); + buffered[0].isStream().should.equal(true); + + let contentBuffer = new Buffer([]); + const contentBufferStream = through(dataWrap((data: any) => { + contentBuffer = Buffer.concat([contentBuffer, data]); + })); + buffered[0].contents.pipe(contentBufferStream); + buffered[0].contents.once('end', () => { + bufEqual(contentBuffer, expectedContent); + done(); + }); + }; + + const stream = vfs.src("./fixtures/*.coffee", { cwd: __dirname, buffer: false }); + + const buffered: any = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + }); +}); + +// from dest +// const vfs = require('../'); + +// const path = require('path'); +// const fs = require('graceful-fs'); +import rimraf = require('rimraf'); + +// const bufEqual = require('buffer-equal'); +// const through = require('through2'); +// const File = require('vinyl'); + +// const should = require('should'); +// require('mocha'); + +let wipeOut = (cb: any) => { + rimraf(path.join(__dirname, "./out-fixtures/"), cb); +}; + +dataWrap = (fn: any) => { + return (data: any, enc: any, cb: any) => { + fn(data); + cb(); + }; +}; + +let realMode = (n: any) => { + return n & parseInt("07777", 8); +}; + +describe('dest stream', () => { + beforeEach(wipeOut); + afterEach(wipeOut); + + it('should explode on invalid folder', done => { + let stream: any; + try { + stream = gulp.dest(); + } catch (err) { + should.exist(err); + should.not.exist(stream); + done(); + } + }); + + it('should pass through writes with cwd', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + + const expectedFile = new File({ + base: __dirname, + cwd: __dirname, + path: inputPath, + contents: null + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should pass through writes with default cwd', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + + const expectedFile = new File({ + base: __dirname, + cwd: __dirname, + path: inputPath, + contents: null + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + done(); + }; + + const stream = vfs.dest(path.join(__dirname, "./out-fixtures/")); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should not write null files', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + const inputBase = path.join(__dirname, "./fixtures/"); + const expectedPath = path.join(__dirname, "./out-fixtures/test.coffee"); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, "./out-fixtures"); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: null + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(expectedCwd, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(false); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should write buffer files to the right folder with relative cwd', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + const inputBase = path.join(__dirname, "./fixtures/"); + const expectedPath = path.join(__dirname, "./out-fixtures/test.coffee"); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, "./out-fixtures"); + const expectedContents = fs.readFileSync(inputPath); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: expectedContents + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(expectedCwd, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + bufEqual(fs.readFileSync(expectedPath), expectedContents).should.equal(true); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: path.relative(process.cwd(), __dirname) }); + + const buffered: any = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should write buffer files to the right folder', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + const inputBase = path.join(__dirname, "./fixtures/"); + const expectedPath = path.join(__dirname, "./out-fixtures/test.coffee"); + const expectedContents = fs.readFileSync(inputPath); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, "./out-fixtures"); + const expectedMode = parseInt("0655", 8); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: expectedContents, + stat: { + mode: expectedMode + } as fs.Stats + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(expectedCwd, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + bufEqual(fs.readFileSync(expectedPath), expectedContents).should.equal(true); + realMode(fs.lstatSync(expectedPath).mode).should.equal(expectedMode); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should write streaming files to the right folder', done => { + const inputPath = path.join(__dirname, "./fixtures/test.coffee"); + const inputBase = path.join(__dirname, "./fixtures/"); + const expectedPath = path.join(__dirname, "./out-fixtures/test.coffee"); + const expectedContents = fs.readFileSync(inputPath); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, "./out-fixtures"); + const expectedMode = parseInt("0655", 8); + + const contentStream = through.obj(); + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: contentStream, + stat: { + mode: expectedMode + } as fs.Stats + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(expectedCwd, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + bufEqual(fs.readFileSync(expectedPath), expectedContents).should.equal(true); + realMode(fs.lstatSync(expectedPath).mode).should.equal(expectedMode); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: __dirname }); + + const buffered: any = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + setTimeout(() => { + contentStream.write(expectedContents); + contentStream.end(); + }, 100); + stream.end(); + }); + + it('should write directories to the right folder', done => { + const inputPath = path.join(__dirname, "./fixtures/test"); + const inputBase = path.join(__dirname, "./fixtures/"); + const expectedPath = path.join(__dirname, "./out-fixtures/test"); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, "./out-fixtures"); + const expectedMode = parseInt("0655", 8); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: null, + stat: { + isDirectory: () => true, + mode: expectedMode + } as fs.Stats + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(expectedCwd, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + fs.lstatSync(expectedPath).isDirectory().should.equal(true); + realMode(fs.lstatSync(expectedPath).mode).should.equal(expectedMode); + done(); + }; + + const stream = vfs.dest("./out-fixtures/", { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should allow piping multiple dests in streaming mode', done => { + const inputPath1 = path.join(__dirname, "./out-fixtures/multiple-first"); + const inputPath2 = path.join(__dirname, "./out-fixtures/multiple-second"); + const inputBase = path.join(__dirname, "./out-fixtures/"); + const srcPath = path.join(__dirname, "./fixtures/test.coffee"); + const stream1 = vfs.dest('./out-fixtures/', { cwd: __dirname }); + const stream2 = vfs.dest('./out-fixtures/', { cwd: __dirname }); + const content = fs.readFileSync(srcPath); + const rename = through.obj((file: any, _: any, next: any) => { + file.path = inputPath2; + this.push(file); + next(); + }); + + stream1.on('data', (file: any) => { + file.path.should.equal(inputPath1); + }); + + stream1.pipe(rename).pipe(stream2); + stream2.on('data', (file: any) => { + file.path.should.equal(inputPath2); + }).once('end', () => { + fs.readFileSync(inputPath1, 'utf8').should.equal(content.toString()); + fs.readFileSync(inputPath2, 'utf8').should.equal(content.toString()); + done(); + }); + + const file = new File({ + base: inputBase, + path: inputPath1, + cwd: __dirname, + contents: content + }); + + stream1.write(file); + stream1.end(); + }); +}); + +// This test is from + +const chmodSpy = spies.chmodSpy; +const statSpy = spies.statSpy; + +wipeOut = (cb: any) => { + rimraf(path.join(__dirname, './out-fixtures/'), cb); + spies.setError('false'); + statSpy.reset(); + chmodSpy.reset(); +}; + +dataWrap = (fn: any) => { + return (data: any, enc: any, cb: any) => { + fn(data); + cb(); + }; +}; + +realMode = (n: any) => { + return n & parseInt("07777", 8); +}; + +describe('symlink stream', () => { + beforeEach(wipeOut); + afterEach(wipeOut); + + it('should explode on invalid folder', (done: any) => { + let stream: any; + try { + stream = gulp.symlink(); + } catch (err) { + should.exist(err); + should.not.exist(stream); + done(); + } + }); + + it('should pass through writes with cwd', done => { + const inputPath = path.join(__dirname, './fixtures/test.coffee'); + + const expectedFile = new File({ + base: __dirname, + cwd: __dirname, + path: inputPath, + contents: null + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + done(); + }; + + const stream = vfs.symlink('./out-fixtures/', { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should pass through writes with default cwd', done => { + const inputPath = path.join(__dirname, './fixtures/test.coffee'); + + const expectedFile = new File({ + base: __dirname, + cwd: __dirname, + path: inputPath, + contents: null + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + done(); + }; + + const stream = vfs.symlink(path.join(__dirname, './out-fixtures/')); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should make link to the right folder with relative cwd', done => { + const inputPath = path.join(__dirname, './fixtures/test.coffee'); + const inputBase = path.join(__dirname, './fixtures/'); + const expectedPath = path.join(__dirname, './out-fixtures/test.coffee'); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, './out-fixtures'); + const expectedContents = fs.readFileSync(inputPath); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: expectedContents + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(__dirname, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + bufEqual(fs.readFileSync(expectedPath), expectedContents).should.equal(true); + fs.readlinkSync(expectedPath).should.equal(inputPath); + done(); + }; + + const stream = vfs.symlink('./out-fixtures/', { cwd: path.relative(process.cwd(), __dirname) }); + + const buffered: any = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should write buffer files to the right folder with function and relative cwd', done => { + const inputPath = path.join(__dirname, './fixtures/test.coffee'); + const inputBase = path.join(__dirname, './fixtures/'); + const expectedPath = path.join(__dirname, './out-fixtures/test.coffee'); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, './out-fixtures'); + const expectedContents = fs.readFileSync(inputPath); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: expectedContents + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(__dirname, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + bufEqual(fs.readFileSync(expectedPath), expectedContents).should.equal(true); + fs.readlinkSync(expectedPath).should.equal(inputPath); + done(); + }; + + const stream = vfs.symlink(file => { + should.exist(file); + file.should.equal(expectedFile); + return './out-fixtures'; + }, { cwd: path.relative(process.cwd(), __dirname) }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should write buffer files to the right folder', done => { + const inputPath = path.join(__dirname, './fixtures/test.coffee'); + const inputBase = path.join(__dirname, './fixtures/'); + const expectedPath = path.join(__dirname, './out-fixtures/test.coffee'); + const expectedContents = fs.readFileSync(inputPath); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, './out-fixtures'); + const expectedMode = parseInt("0655", 8); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: expectedContents, + stat: { + mode: expectedMode + } as fs.Stats + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(__dirname, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + bufEqual(fs.readFileSync(expectedPath), expectedContents).should.equal(true); + fs.readlinkSync(expectedPath).should.equal(inputPath); + done(); + }; + + const stream = vfs.symlink('./out-fixtures/', { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should write streaming files to the right folder', done => { + const inputPath = path.join(__dirname, './fixtures/test.coffee'); + const inputBase = path.join(__dirname, './fixtures/'); + const expectedPath = path.join(__dirname, './out-fixtures/test.coffee'); + const expectedContents = fs.readFileSync(inputPath); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, './out-fixtures'); + const expectedMode = parseInt("0655", 8); + + const contentStream = through.obj(); + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: contentStream, + stat: { + mode: expectedMode + } as fs.Stats + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(__dirname, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.existsSync(expectedPath).should.equal(true); + bufEqual(fs.readFileSync(expectedPath), expectedContents).should.equal(true); + fs.readlinkSync(expectedPath).should.equal(inputPath); + done(); + }; + + const stream = vfs.symlink('./out-fixtures/', { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + setTimeout(() => { + contentStream.write(expectedContents); + contentStream.end(); + }, 100); + stream.end(); + }); + + it('should write directories to the right folder', done => { + const inputPath = path.join(__dirname, './fixtures/wow'); + const inputBase = path.join(__dirname, './fixtures/'); + const expectedPath = path.join(__dirname, './out-fixtures/wow'); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, './out-fixtures'); + const expectedMode = parseInt("0655", 8); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: null, + stat: { + isDirectory: () => true, + mode: expectedMode + } as fs.Stats + }); + + const onEnd = () => { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + buffered[0].cwd.should.equal(__dirname, 'cwd should have changed'); + buffered[0].base.should.equal(expectedBase, 'base should have changed'); + buffered[0].path.should.equal(expectedPath, 'path should have changed'); + fs.readlinkSync(expectedPath).should.equal(inputPath); + fs.lstatSync(expectedPath).isDirectory().should.equal(false); + fs.statSync(expectedPath).isDirectory().should.equal(true); + done(); + }; + + const stream = vfs.symlink('./out-fixtures/', { cwd: __dirname }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + + it('should use different modes for files and directories', done => { + const inputBase = path.join(__dirname, './fixtures'); + const inputPath = path.join(__dirname, './fixtures/wow/suchempty'); + const expectedBase = path.join(__dirname, './out-fixtures/wow'); + const expectedDirMode = parseInt("0755", 8); + const expectedFileMode = parseInt("0655", 8); + + const firstFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + stat: fs.statSync(inputPath) + }); + + const onEnd = () => { + realMode(fs.lstatSync(expectedBase).mode).should.equal(expectedDirMode); + realMode(buffered[0].stat.mode).should.equal(expectedFileMode); + done(); + }; + + const stream = vfs.symlink('./out-fixtures/', { + cwd: __dirname, + mode: expectedFileMode, + dirMode: expectedDirMode + }); + + const buffered: any[] = []; + bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + + stream.pipe(bufferStream); + stream.write(firstFile); + stream.end(); + }); + + it('should report IO errors', done => { + const inputPath = path.join(__dirname, './fixtures/test.coffee'); + const inputBase = path.join(__dirname, './fixtures/'); + const expectedPath = path.join(__dirname, './out-fixtures/test.coffee'); + const expectedContents = fs.readFileSync(inputPath); + const expectedCwd = __dirname; + const expectedBase = path.join(__dirname, './out-fixtures'); + const expectedMode = parseInt("0722", 8); + + const expectedFile = new File({ + base: inputBase, + cwd: __dirname, + path: inputPath, + contents: expectedContents, + stat: { + mode: expectedMode + } as fs.Stats + }); + + fs.mkdirSync(expectedBase); + fs.chmodSync(expectedBase, 0); + + const stream = vfs.symlink('./out-fixtures/', { cwd: __dirname }); + stream.on('error', (err: any) => { + err.code.should.equal('EACCES'); + done(); + }); + stream.write(expectedFile); + }); + + ['end', 'finish'].forEach(eventName => { + it(`should emit ${eventName} event`, done => { + const srcPath = path.join(__dirname, './fixtures/test.coffee'); + const stream = vfs.symlink('./out-fixtures/', { cwd: __dirname }); + + stream.on(eventName, () => { + done(); + }); + + const file = new File({ + path: srcPath, + cwd: __dirname, + contents: new Buffer("1234567890") + }); + + stream.write(file); + stream.end(); + }); + }); + it('should check if it"s a vinyl file', () => { + const srcPath = path.join(__dirname, './fixtures/test.coffee'); + const options = { + path: srcPath, + cwd: __dirname, + contents: new Buffer("1234567890") + }; + const file = new File(options); + File.isVinyl(file).should.equal(true); + File.isVinyl(options).should.equal(false); + }); +}); diff --git a/types/vinyl-fs/vinyl-fs-tests.ts b/types/vinyl-fs/vinyl-fs-tests.ts index aac3c4f49e..2a38bcf811 100644 --- a/types/vinyl-fs/vinyl-fs-tests.ts +++ b/types/vinyl-fs/vinyl-fs-tests.ts @@ -3,13 +3,14 @@ import * as vfs from 'vinyl-fs'; import * as path from 'path'; -import * as fs from 'fs'; // require('graceful-fs'); +import * as fs from 'fs'; +import * as stream from 'stream'; // import bufEqual = require('buffer-equal'); declare const bufEqual: any; -// import through = require('through2'); -declare const through: any; +import gulp = require('gulp'); import File = require('vinyl'); +import through = require('through2'); // const spies = require('./spy'); declare const spies: any; @@ -30,8 +31,7 @@ declare global { } } -declare const gulp: any; -let bufferStream: any; +let bufferStream: stream.Transform; let dataWrap = (fn: any) => { return (data: any, enc: any, cb: any) => { @@ -44,7 +44,7 @@ describe('source stream', () => { it('should explode on invalid glob (empty)', done => { let stream: any; try { - stream = gulp.src(); + stream = ( gulp).src(); } catch (err) { should.exist(err); should.not.exist(stream); @@ -55,7 +55,7 @@ describe('source stream', () => { it('should explode on invalid glob (number)', done => { let stream: any; try { - stream = gulp.src(123); + stream = gulp.src( 123); } catch (err) { should.exist(err); should.not.exist(stream); @@ -243,7 +243,7 @@ describe('dest stream', () => { it('should explode on invalid folder', done => { let stream: any; try { - stream = gulp.dest(); + stream = ( gulp).dest(); } catch (err) { should.exist(err); should.not.exist(stream); @@ -383,7 +383,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -424,7 +424,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: contentStream, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -467,7 +467,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: null, - stat: { + stat: { isDirectory: () => true, mode: expectedMode } as fs.Stats @@ -502,7 +502,7 @@ describe('dest stream', () => { const stream1 = vfs.dest('./out-fixtures/', { cwd: __dirname }); const stream2 = vfs.dest('./out-fixtures/', { cwd: __dirname }); const content = fs.readFileSync(srcPath); - const rename = through.obj((file: any, _: any, next: any) => { + const rename = through.obj(function t(this: stream.Transform, file: any, _: any, next: any) { file.path = inputPath2; this.push(file); next(); @@ -563,7 +563,7 @@ describe('symlink stream', () => { it('should explode on invalid folder', (done: any) => { let stream: any; try { - stream = gulp.symlink(); + stream = ( gulp).symlink(); } catch (err) { should.exist(err); should.not.exist(stream); @@ -711,7 +711,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -752,7 +752,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: contentStream, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -795,7 +795,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: null, - stat: { + stat: { isDirectory: () => true, mode: expectedMode } as fs.Stats @@ -870,7 +870,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode } as fs.Stats }); diff --git a/types/vis/index.d.ts b/types/vis/index.d.ts index 84ff769270..187c01c9b7 100644 --- a/types/vis/index.d.ts +++ b/types/vis/index.d.ts @@ -459,7 +459,7 @@ export class DataSet { * @returns When no item is found, null is returned when a single item was requested, * and and empty Array is returned in case of multiple id's. */ - get(id: IdType, options?: DataSelectionOptions): T; + get(id: IdType, options?: DataSelectionOptions): T|null; /** * Get multiple items from the DataSet. @@ -494,7 +494,7 @@ export class DataSet { * @param [options] Optional options. * @returns The mapped items. */ - map(callback: (item: T, id: IdType) => any, options?: DataSelectionOptions): any[]; + map(callback: (item: T, id: IdType) => M, options?: DataSelectionOptions): M[]; /** * Find the item with maximum value of specified field. @@ -589,7 +589,7 @@ export interface DataSelectionOptions { /** * Order the items by a field name or custom sort function. */ - order?: string | any; + order?: string | ((a: T, b: T) => number); /** * Determine the type of output of the get function. @@ -597,7 +597,7 @@ export interface DataSelectionOptions { * The default returnType is an Array. * The Object type will return a JSON object with the ID's as keys. */ - returnType?: string; + returnType?: "Array" | "Object"; } export class DataView { diff --git a/types/watchpack/index.d.ts b/types/watchpack/index.d.ts index 880e0d8a6d..4ef4ad2e67 100644 --- a/types/watchpack/index.d.ts +++ b/types/watchpack/index.d.ts @@ -23,7 +23,7 @@ declare class Watchpack extends EventEmitter { constructor(options: Watchpack.WatchOptions); - watch(files: string[], directories: string[], startTime: number): void; + watch(files: string[], directories: string[], startTime?: number): void; close(): void; diff --git a/types/watchpack/watchpack-tests.ts b/types/watchpack/watchpack-tests.ts index 7ae28bc514..f3eb459aef 100644 --- a/types/watchpack/watchpack-tests.ts +++ b/types/watchpack/watchpack-tests.ts @@ -2,6 +2,7 @@ import Watchpack = require('watchpack'); const watch = new Watchpack({}); watch.watch(['test.js'], ['lib/'], 1000); +watch.watch(['test.js'], ['lib/']); let time: number; time = watch.getTimes()['test.js']; diff --git a/types/webdriverio/index.d.ts b/types/webdriverio/index.d.ts deleted file mode 100644 index a17d121e34..0000000000 --- a/types/webdriverio/index.d.ts +++ /dev/null @@ -1,1934 +0,0 @@ -// Type definitions for WebdriverIO 4.13 -// Project: http://www.webdriver.io/ -// Definitions by: Nick Malaguti -// Tim Brust -// Fredrik Smedberg -// Tanvir ul Islam -// Dave Parslow -// Phil Leger -// Oskar Lindgren -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare namespace WebdriverIO { - type Method = 'POST' | 'GET' | 'DELETE'; - - interface RawResult { - sessionId: string; - value: T; - state: 'failure' | 'success'; - selector?: string; - message?: string; - hCode?: number; - class?: string; - error?: string; - } - - type ElementId = string; - - interface Element { - ELEMENT: ElementId; - } - - interface CssProperty { - property: string; - value: string; - parsed: ParsedCssProperty; - } - - interface ParsedCssProperty { - hex: string; - alpha: number; - rgb: string; - rgba: string; - type: string; - string: string; - quote: string; - unit: string; - value: string | number | string[] | number[]; - } - - interface Size { - width: number; - height: number; - } - - interface Position { - x: number; - y: number; - } - - interface DOMRect { - width: number; - height: number; - x: number; - y: number; - } - - enum ApplicationCacheStatus { - UNCACHED = 0, - IDLE = 1, - CHECKING = 2, - DOWNLOADING = 3, - UPDATE_READY = 4, - OBSOLETE = 5 - } - - enum Button { - left = 0, - middle = 1, - right = 2 - } - - interface Status { - build?: { - version: string; - revision?: string; - time?: string; - }; - - os?: { - name: string; - arch?: string; - version?: string; - }; - - java?: { - version?: string; - }; - } - - interface StorageItem { - key: string; - value: any; - } - - interface StorageItems { - [key: string]: any; - } - - interface GeoLocation { - latitude: number; - longitude: number; - altitude: number; - } - - interface CommandHistoryEntry { - command: string; - args: any[]; - } - - type Axis = 'x' | 'y'; - - type Timeouts = 'script' | 'pageLoad' | 'implicit'; - - type PageLoadingStrategy = 'none' | 'eager' | 'normal'; - - type LocatorStrategy = 'css selector' - | 'link text' - | 'partial link text' - | 'tag name' - | 'xpath'; - - interface LogEntry { - timestamp: number; - level: string; - message: string; - } - - type LoggingPreferenceType = - 'OFF' | 'SEVERE' | 'WARNING' | - 'INFO' | 'CONFIG' | 'FINE' | - 'FINER' | 'FINEST' | 'ALL'; - - interface LoggingPreferences { - browser?: LoggingPreferenceType; - driver?: LoggingPreferenceType; - server?: LoggingPreferenceType; - client?: LoggingPreferenceType; - } - - interface ProxyObject { - proxyType?: 'pac' | 'noproxy' | 'autodetect' | 'system' | 'manual'; - proxyAutoconfigUrl?: string; - ftpProxy?: string; - ftpProxyPort?: number; - httpProxy?: string; - httpProxyPort?: number; - sslProxy?: string; - sslProxyPort?: number; - socksProxy?: string; - socksProxyPort?: number; - socksVersion?: string; - socksUsername?: string; - socksPassword?: string; - } - - interface Session { - id: string; - capabilities: DesiredCapabilities; - } - - interface Capabilities { - browserName?: string; - acceptInsecureCerts?: boolean; - browserVersion?: string; - platformName?: string; - pageLoadStrategy?: PageLoadingStrategy; - proxy?: ProxyObject; - setWindowRect?: boolean; - timeouts?: Timeouts; - unhandledPromptBehavior?: string; - - // wdio-sauce-service specific - build?: string; - } - - interface DesiredCapabilities extends Capabilities { - // Read-only capabilities - cssSelectorsEnabled?: boolean; - handlesAlerts?: boolean; - version?: string; - platform?: string; - - // Read-write capabilities - javascriptEnabled?: boolean; - databaseEnabled?: boolean; - locationContextEnabled?: boolean; - applicationCacheEnabled?: boolean; - browserConnectionEnabled?: boolean; - webStorageEnabled?: boolean; - acceptSslCerts?: boolean; - rotatable?: boolean; - nativeEvents?: boolean; - unexpectedAlertBehaviour?: string; - elementScrollBehavior?: number; - - // Grid-specific - seleniumProtocol?: string; - maxInstances?: number; - environment?: string; - - // Selenium RC (1.0) only - commandLineFlags?: string; - executablePath?: string; - timeoutInSeconds?: number; - onlyProxySeleniumTraffic?: boolean; - avoidProxy?: boolean; - proxyEverything?: boolean; - proxyRequired?: boolean; - browserSideLog?: boolean; - optionsSet?: boolean; - singleWindow?: boolean; - dontInjectRegex?: RegExp; - userJSInjection?: boolean; - userExtensions?: string; - - // RemoteWebDriver specific - 'webdriver.remote.sessionid'?: string; - 'webdriver.remote.quietExceptions'?: boolean; - - // Selenese-Backed-WebDriver specific - 'selenium.server.url'?: string; - - loggingPrefs?: { - browser?: LoggingPreferences; - driver?: LoggingPreferences; - server?: LoggingPreferences; - client?: LoggingPreferences; - }; - - // Firefox - firefox_binary?: string; - firefoxProfileTemplate?: string; - captureNetworkTraffic?: boolean; - addCustomRequestHeaders?: boolean; - trustAllSSLCertificates?: boolean; - changeMaxConnections?: boolean; - profile?: string; - pageLoadingStrategy?: string; - - // IE specific - 'ie.forceCreateProcessApi'?: boolean; - 'ie.browserCommandLineSwitches'?: string; - 'ie.usePerProcessProxy'?: boolean; - 'ie.ensureCleanSession'?: boolean; - 'ie.setProxyByServer'?: boolean; - ignoreProtectedModeSettings?: boolean; - ignoreZoomSetting?: boolean; - initialBrowserUrl?: string; - enablePersistentHover?: boolean; - enableElementCacheCleanup?: boolean; - requireWindowFocus?: boolean; - browserAttachTimeout?: number; - logFile?: string; - logLevel?: string; - host?: string; - extractPath?: string; - silent?: string; - killProcessesByName?: boolean; - - // Safari specific - 'safari.options'?: { - [name: string]: any; - }; - - // Appium specific - platformVersion?: string; - automationName?: string; - app?: string; - deviceName?: string; - - cleanSession?: boolean; - - // Chrome specific - chromeOptions?: { - args?: string[]; - binary?: string; - extensions?: string[]; - - localState?: { - [name: string]: any; - }; - - detach?: boolean; - debuggerAddress?: string; - excludeSwitches?: string[]; - minidumpPath?: string; - - mobileEmulation?: { - [name: string]: any; - }; - - perfLoggingPrefs?: { - [name: string]: any; - }; - - windowTypes?: string[]; - }; - - perfLoggingPrefs?: { - enableNetwork?: boolean; - enablePage?: boolean; - enableTimeline?: boolean; - tracingCategories?: boolean; - bufferUsageReportingInterval?: boolean; - }; - - // RC - honorSystemProxy?: boolean; - ensureCleanSession?: boolean; - - // Exclude - exclude?: string[]; - - // Define which test specs should run (only on the desired capability) - specs?: string[]; - } - - interface Cookie { - name: string; - value: string; - path?: string; - httpOnly?: boolean; - expiry?: number; - secure?: boolean; - domain?: string; - } - - interface Suite { - file: string; - parent: string; - pending: boolean; - title: string; - type: string; - } - - interface Test extends Suite { - currentTest: string; - passed: boolean; - duration: any; - } - - interface Hooks { - onError?(error: Error): Promise | void; - - onPrepare?( - config: Options, - capabilities: DesiredCapabilities - ): Promise | void; - - onComplete?(exitCode: number): Promise | void; - - before?( - capabilities: DesiredCapabilities, - specs: string[] - ): Promise | undefined; - - beforeCommand?( - commandName: string, - args: any[] - ): Promise | void; - - beforeHook?(): Promise | void; - - beforeSession?( - config: Options, - capabilities: DesiredCapabilities, - specs: string[] - ): Promise | void; - - beforeSuite?(suite: Suite): Promise | void; - beforeTest?(test: Test): Promise | void; - afterHook?(): Promise | void; - - after?( - result: number, - capabilities: DesiredCapabilities, - specs: string[] - ): Promise | void; - - afterCommand?( - commandName: string, - args: any[], - result: any, - error?: Error - ): Promise | undefined; - - afterSession?( - config: Options, - capabilities: DesiredCapabilities, - specs: string[] - ): Promise | void; - - afterSuite?(suite: Suite): Promise | void; - afterTest?(test: Test): Promise | void; - - // cucumber specific hooks - beforeFeature?(feature: string): Promise | void; - beforeScenario?(scenario: string): Promise | void; - beforeStep?(step: string): Promise | void; - afterFeature?(feature: string): Promise | void; - afterScenario?(scenario: any): Promise | void; - afterStep?(stepResult: any): Promise | void; - } - - interface Options { - baseUrl?: string; - bail?: number; - deprecationWarnings?: boolean; - browserstackLocal?: boolean; - coloredLogs?: boolean; - capabilities?: DesiredCapabilities[]; - connectionRetryTimeout?: number; - connectionRetryCount?: number; - debug?: number; - execArgv?: string[] | null; - desiredCapabilities?: DesiredCapabilities; - exclude?: string[]; - framework?: string; - host?: string; - isWDIO?: boolean; - protocol?: string; - port?: number; - path?: string; - plugins?: { [name: string]: any; }; - reporters?: string[] | ((...args: any[]) => void); - reporterOptions?: { outputDir?: string, [reporterName: string]: any }; - logLevel?: string; - maxInstances?: number; - maxInstancesPerCapability?: number; - maxSession?: number; - mochaOpts?: { [name: string]: any; }; - jasmineNodeOpts?: { [name: string]: any; }; - cucumberOpts?: { [name: string]: any; }; - services?: string[] | ((...args: any[]) => void); - screenshotPath?: string; - specs?: string[]; - seleniumLogs?: string; - suites?: { [name: string]: string[]; }; - sync?: boolean; - waitforTimeout?: number; - waitforInterval?: number; - user?: string; - key?: string; - - // wdio-sauce-service specific - sauceConnect?: boolean; - sauceConnectOpts?: { [name: string]: any; }; - - // wdio-docker-service specific - dockerOptions?: { [name: string]: any; }; - onDockerReady?: ((...args: any[]) => void); - dockerLogs?: string; - } - - interface UnknownOptions { - [name: string]: any; - } - - interface MultiRemoteOptions { - [name: string]: Options; - } - - interface Config extends Options, Hooks { } - - interface Client { - desiredCapabilities: DesiredCapabilities; - } - - interface Client { - sessionId: string; - } - - // Options - interface Client { - options: Options; - } - - class Launcher { - constructor(file: string, data: Options); - run(): Promise; - } - - class ErrorHandler extends Error { - constructor(type: string, msg: string | number, details?: string); - } - - function multiremote(options: MultiRemoteOptions): Client; - function remote(options?: Options, modifier?: (...args: any[]) => any): Client; - - // EventEmitter - interface Client { - addListener( - event: string, - listener: (...args: any[]) => void - ): Client; - - on( - event: string, - listener: (...args: any[]) => void - ): Client; - - once( - event: string, - listener: (...args: any[]) => void - ): Client; - - removeListener( - event: string, - listener: (...args: any[]) => void - ): Client; - - removeAllListeners(event?: string): Client; - setMaxListeners(n: number): Client; - listeners(event: string): Client; - emit( - event: string, - ...args: any[] - ): Client; - } - - // Promise - interface Client { - finally(callback: (...args: any[]) => void): Client; - - then

    ( - onFulfilled?: (value: T) => P | Client

    , - onRejected?: (error: any) => P | Client

    - ): Client

    ; - - catch

    ( - onRejected?: (error: any) => P | Client

    - ): Client

    ; - - inspect(): { - state: "fulfilled" | "rejected" | "pending"; - value?: T; - reason?: any; - }; - } - - interface Client { - addValue( - selector: string, - value: string | number - ): Client> & RawResult; - - addValue(value: string | number): Client> & RawResult; - - addValue

    ( - selector: string, - value: string | number, - ): Client

    ; - - addValue

    (value: string | number): Client

    ; - - clearElement(selector?: string): Client> & RawResult; - clearElement

    (selector?: string): Client

    ; - - click(selector?: string): Client> & RawResult; - click

    (selector?: string): Client

    ; - - doubleClick(selector?: string): Client> & RawResult; - doubleClick

    (selector?: string): Client

    ; - - dragAndDrop( - sourceElem: string, - destinationElem: string - ): Client> & RawResult; - - dragAndDrop

    ( - sourceElem: string, - destinationElem: string - ): Client

    ; - - dragAndDrop(destinationElem: string): Client> & RawResult; - dragAndDrop

    (destinationElem: string): Client

    ; - - leftClick(selector?: string): Client> & RawResult; - - leftClick( - selector: string, - xoffset?: number, - yoffset?: number - ): Client> & RawResult; - - leftClick( - xoffset?: number, - yoffset?: number - ): Client & undefined; - - leftClick

    (selector?: string): Client

    ; - - leftClick

    ( - selector: string, - xoffset?: number, - yoffset?: number - ): Client

    ; - - leftClick

    ( - xoffset?: number, - yoffset?: number - ): Client

    ; - - middleClick(selector?: string): Client> & RawResult; - - middleClick( - selector: string, - xoffset?: number, - yoffset?: number - ): Client> & RawResult; - - middleClick( - xoffset?: number, - yoffset?: number - ): Client> & RawResult; - - middleClick

    (selector?: string): Client

    ; - - middleClick

    ( - selector: string, - xoffset?: number, - yoffset?: number - ): Client

    ; - - middleClick

    ( - xoffset?: number, - yoffset?: number - ): Client

    ; - - moveToObject(selector?: string): Client> & RawResult; - - moveToObject( - selector: string, - xoffset?: number, - yoffset?: number - ): Client> & RawResult; - - moveToObject( - xoffset?: number, - yoffset?: number - ): Client> & RawResult; - - moveToObject

    (selector?: string): Client

    ; - - moveToObject

    ( - selector: string, - xoffset?: number, - yoffset?: number - ): Client

    ; - - moveToObject

    ( - xoffset?: number, - yoffset?: number - ): Client

    ; - - rightClick(selector?: string): Client> & RawResult; - - rightClick( - selector: string, - xoffset?: number, - yoffset?: number - ): Client> & RawResult; - - rightClick( - xoffset?: number, - yoffset?: number - ): Client> & RawResult; - - rightClick

    (selector?: string): Client

    ; - - rightClick

    ( - selector: string, - xoffset?: number, - yoffset?: number - ): Client

    ; - - rightClick

    ( - xoffset?: number, - yoffset?: number - ): Client

    ; - - selectByAttribute( - selector: string, - attribute: string, - value: string | number - ): Client> & RawResult; - - selectByAttribute( - attribute: string, - value: string | number - ): Client> & RawResult; - - selectByAttribute

    ( - selector: string, - attribute: string, - value: string | number - ): Client

    ; - - selectByAttribute

    ( - attribute: string, - value: string | number - ): Client

    ; - - selectByIndex( - selectElem: string, - index: number - ): Client> & RawResult; - - selectByIndex(index: number): Client> & RawResult; - - selectByIndex

    ( - selectElem: string, - index: number - ): Client

    ; - - selectByIndex

    (index: number): Client

    ; - - selectByValue( - selectElem: string, - value: string - ): Client> & RawResult; - - selectByValue(value: string): Client> & RawResult; - - selectByValue

    ( - selectElem: string, - value: string - ): Client

    ; - - selectByValue

    (value: string): Client

    ; - - selectByVisibleText( - selectElem: string, - text: string - ): Client> & RawResult; - - selectByVisibleText(text: string): Client> & RawResult; - - selectByVisibleText

    ( - selectElem: string, - text: string - ): Client

    ; - - selectByVisibleText

    (text: string): Client> & RawResult; - - selectorExecute

    ( - selectors: string | string[], - script: (elements: HTMLElement | HTMLElement[], ...args: any[]) => P, - ...args: any[] - ): Client

    & any; - - selectorExecute

    ( - selectors: string | string[], - script: (elements: HTMLElement | HTMLElement[], ...args: any[]) => P, - ...args: any[] - ): Client

    & any; - - selectorExecuteAsync

    ( - selectors: string | string[], - script: (elements: HTMLElement | HTMLElement[], ...args: any[]) => P, - ...args: any[] - ): Client

    & any; - - setValue( - selector: string, - values: number | string | string[] - ): Client> & RawResult; - - setValue( - values: number | string | string[] - ): Client> & RawResult; - - setValue

    ( - selector: string, - values: number | string | string[] - ): Client & undefined; - - setValue

    ( - values: number | string | string[] - ): Client & undefined; - - submitForm(selector?: string): Client> & RawResult; - submitForm

    (selector?: string): Client

    ; - } - - // Cookie - interface Client { - deleteCookie(name?: string): Client> & RawResult; - deleteCookie

    (name?: string): Client

    ; - - getCookie(): Client>> & Cookie[] & Array>; - getCookie(name: string): Client> & Cookie & RawResult; - getCookie

    (name?: string): Client

    ; - - setCookie(cookie: Cookie): Client> & RawResult; - setCookie

    (cookie: Cookie): Client

    ; - } - - // Grid - interface Client { - getGridNodeDetails(): Client & UnknownOptions; - getGridNodeDetails

    (): Client

    ; - - gridProxyDetails(): Client & UnknownOptions; - gridProxyDetails

    (): Client

    ; - - gridTestSession(): Client & UnknownOptions; - gridTestSession

    (): Client

    ; - } - - // Mobile - interface Client { - background(seconds: number): Client; - closeApp(): Client; - context(id?: string): Client & RawResult; - contexts(): Client & RawResult; - currentActivity(): any; - deviceKeyEvent(keyValue: number): Client; - getAppStrings(language: string): Client; - getCurrentDeviceActivity(): Client; - getDeviceTime(): Client; - getGeoLocation(): Client; - getNetworkConnection(): Client; - getOrientation(): Client; - hideDeviceKeyboard(strategy: 'tapOutside' | 'pressKey'): Client; - hold(selector: string): Client; - installApp(path: string): Client; - isAppInstalled(bundleId: string): Client; - isLocked(): boolean; - launch(): Client; - lock(seconds: number): Client; - longPressKeycode(keyCode: string, metaState: string): Client; - openNotifications(): Client; - orientation(setTo?: 'landscape' | 'portrait'): 'landscape' | 'portrait'; - performMultiAction(touchAttributes: any): Client; - performTouchAction(touchAttributes: any): Client; - pressKeycode(keyCode: string, metaState: string): Client; - pullFile(path: string): Client; - pullFolder(path: string): Client; - pushFile(path: string, data: any): Client; - release(selector: string): Client; - removeApp(bundleId: string): Client; - reset(): Client; - - rotate( - x: number, - y: number, - duration?: number, - radius?: number, - rotation?: number, - touchCount?: number - ): Client; - - setGeoLocation(location: GeoLocation): Client; - setImmediateValue(id: string, value: string | string[]): Client; - setNetworkConnection(flags: 0 | 1 | 2 | 4 | 6): Client; - setOrientation(setTo: 'landscape' | 'portrait'): Client; - settings(settings?: { [key: string]: string }): Client; - shake(): Client; - startActivity(appPackage: string, activity: string, appWaitPackage?: string, appWaitActivity?: string): Client; - strings(language: string): Client; - - swipe( - selector?: string, - xOffset?: number, - yOffset?: number, - speed?: number - ): Client; - - swipeDown(selector: string, speed?: number): Client; - swipeLeft(selector: string, speed?: number): Client; - swipeRight(selector: string, speed?: number): Client; - swipeUp(selector: string, speed?: number): Client; - toggleAirplaneMode(): Client; - toggleData(): Client; - toggleLocationServices(): Client; - toggleTouchIdEnrollment(match: boolean): Client; - toggleWiFi(): Client; - touch(selector: string, longClick: boolean): Client; - touchAction(selector: string, action: 'tap' | 'press'): Client; - touchId(validFingerprint?: boolean): Client; - touchMultiPerform(actions: any): Client; - touchPerform(actions: any): Client; - unlock(): Client; - isIOS: boolean; - isAndroid: boolean; - isMobile: boolean; - } - - // Property - interface Client { - getAttribute( - selector: string, - attributeName: string - ): Client & Client & string & null; - - getAttribute( - selector: string, - attributeName: string - ): Client & Client & string[] & null[]; - - getAttribute(attributeName: string): Client & Client & string & null; - getAttribute(attributeName: string): Client & Client & string[] & null[]; - - getAttribute

    ( - selector: string, - attributeName: string - ): Client

    ; - - getAttribute

    (attributeName: string): Client

    ; - - getCssProperty( - selector: string, - cssProperty: string - ): Client & CssProperty; - - getCssProperty( - selector: string, - cssProperty: string - ): Client & CssProperty[]; - - getCssProperty(cssProperty: string): Client & CssProperty; - getCssProperty(cssProperty: string): Client & CssProperty[]; - - getCssProperty

    ( - selector: string, - cssProperty: string - ): Client

    ; - - getCssProperty

    (cssProperty: string): Client

    ; - - getElementSize(selector: string): Client & Size; - getElementSize(): Client & Size; - - getElementSize(selector: string): Client & Size[]; - getElementSize(): Client & Size[]; - - getElementSize( - selector: string, - dimension?: string - ): Client & number; - - getElementSize( - selector: string, - dimension?: string - ): Client & number[]; - - getElementSize(dimension?: string): Client & number; - getElementSize(dimension?: string): Client & number[]; - - getElementSize

    (selector?: string): Client

    ; - getElementSize

    (dimension?: string): Client

    ; - - getElementSize

    ( - selector: string, - dimension?: string - ): Client

    ; - - getHTML( - selector: string, - includeSelectorTag?: boolean - ): Client & string; - - getHTML( - selector: string, - includeSelectorTag?: boolean - ): Client & string[]; - - getHTML(includeSelectorTag?: boolean): Client & string; - getHTML(includeSelectorTag?: boolean): Client & string[]; - getHTML

    (selector?: string): Client

    ; - - getHTML

    ( - selector: string, - includeSelectorTag?: boolean - ): Client

    ; - - getHTML

    (includeSelectorTag?: boolean): Client

    ; - - getLocation(axis?: Axis): Client & number; - getLocation

    (axis?: Axis): Client

    ; - getLocation(selector?: string): Client & Position; - getLocation

    (selector?: string): Client

    ; - getLocation(selector: string, axis?: Axis): Client & number; - getLocation

    (selector: string, axis?: Axis): Client

    ; - - getLocationInView(axis?: Axis): Client & number; - getLocationInView(axis?: Axis): Client & number[]; - getLocationInView

    (axis?: Axis): Client

    ; - getLocationInView(selector?: string): Client & Position; - getLocationInView(selector?: string): Client & Position[]; - getLocationInView

    (selector?: string): Client

    ; - getLocationInView(selector: string, axis?: Axis): Client & number; - getLocationInView(selector: string, axis?: Axis): Client & number[]; - getLocationInView

    (selector: string, axis?: Axis): Client

    ; - - getSource(): Client & string; - getSource

    (): Client

    ; - - getTagName(selector?: string): Client & string; - getTagName(selector?: string): Client & string[]; - getTagName

    (selector?: string): Client

    ; - - getText(selector?: string): Client & string; - getText(selector?: string): Client & string[]; - getText

    (selector?: string): Client

    ; - - getTitle(): Client & string; - getTitle

    (): Client

    ; - - getUrl(): Client & string; - getUrl

    (): Client

    ; - - getValue(selector?: string): Client & string; - getValue(selector?: string): Client & string[]; - getValue

    (selector?: string): Client

    ; - } - - // Protocol - interface Client { - alertAccept(): Client>; - alertAccept

    (): Client

    ; - - alertDismiss(): Client>; - alertDismiss

    (): Client

    ; - - alertText(): Client | string; - alertText(text: string): Client | null; - alertText

    (text?: string): Client

    ; - - /** @deprecated */ - applicationCacheStatus(): Client> & RawResult & never; - - /** @deprecated */ - applicationCacheStatus

    (): Client

    ; - - back(): Client>; - back

    (): Client

    ; - - /** @deprecated in favour of Actions.pointerDown */ - buttonDown(button?: string | Button): Client> & RawResult & never; - - /** @deprecated in favour of Actions.pointerDown */ - buttonDown

    (button?: string | Button): Client

    ; - - /** @deprecated in favour of Actions.pointerDown */ - buttonPress(button?: string | Button): Client> & RawResult & never; - - /** @deprecated in favour of Actions.pointerDown */ - buttonPress

    (button?: string | Button): Client

    ; - - /** @deprecated in favour of Actions.pointerUp */ - buttonUp(button?: string | Button): Client> & RawResult; - - /** @deprecated in favour of Actions.pointerUp */ - buttonUp

    (button?: string | Button): Client

    ; - - cookie(): Client>>> & RawResult>>; - - cookie( - method: Method, - key?: (Cookie & RawResult) | string - ): Client>>> & RawResult>>; - - /** @deprecated in favour of Actions.pointerDown(0) + Actions.pointerMove */ - doDoubleClick(): Client> & RawResult & never; - - /** @deprecated in favour of Actions.pointerDown(0) + Actions.pointerMove */ - doDoubleClick

    (): Client

    ; - - element(selector: string): Client> & RawResult; - element

    (selector: string): Client

    ; - - elementActive(): Client> & RawResult; - elementActive

    (): Client

    ; - - elementIdAttribute( - id: ElementId, - attributeName: string - ): Client> & RawResult; - - elementIdAttribute

    ( - id: ElementId, - attributeName: string - ): Client

    ; - - elementIdClear(id: ElementId): Client> & RawResult; - elementIdClear

    (id: ElementId): Client

    ; - - elementIdClick(id: ElementId): Client> & RawResult; - elementIdClick

    (id: ElementId): Client

    ; - - elementIdCssProperty( - id: ElementId, - propertyName: string - ): Client> & RawResult; - - elementIdCssProperty

    ( - id: ElementId, - propertyName: string - ): Client

    ; - - /** @deprecated */ - elementIdDisplayed(id: ElementId): Client> & RawResult & never; - - /** @deprecated */ - elementIdDisplayed

    (id: ElementId): Client

    ; - - elementIdElement( - id: ElementId, - selector: string - ): Client> & RawResult; - - elementIdElement

    ( - id: ElementId, - selector: string - ): Client

    ; - - elementIdElements( - id: ElementId, - selector: string - ): Client> & RawResult; - - elementIdElements

    ( - id: ElementId, - selector: string - ): Client

    ; - - elementIdEnabled(id: ElementId): Client> & RawResult; - elementIdEnabled

    (id: ElementId): Client

    ; - - /** @deprecated in favour of elementIdRect */ - elementIdLocation(id: ElementId): Client> & RawResult & never; - - /** @deprecated in favour of elementIdRect */ - elementIdLocation

    (id: ElementId): Client

    ; - - /** @deprecated in favour of elementIdRect */ - elementIdLocationInView(id: ElementId): Client> & RawResult & never; - - /** @deprecated in favour of elementIdRect */ - elementIdLocationInView

    (id: ElementId): Client

    ; - - elementIdName(id: ElementId): Client> & RawResult; - elementIdName

    (id: ElementId): Client

    ; - - elementIdRect(id: ElementId): Client> & RawResult; - elementIdRect

    (id: ElementId): Client

    ; - - elementIdSelected(id: ElementId): Client> & RawResult; - elementIdSelected

    (id: ElementId): Client

    ; - - /** @deprecated in favour of elementIdRect */ - elementIdSize(id: ElementId): Client> & RawResult & never; - - /** @deprecated in favour of elementIdRect */ - elementIdSize

    (id: ElementId): Client

    ; - - elementIdText(id: ElementId): Client> & RawResult; - elementIdText

    (id: ElementId): Client

    ; - - elementIdValue( - id: ElementId, - values: string | string[] - ): Client> & RawResult; - - elementIdValue

    ( - id: ElementId, - values: string | string[] - ): Client

    ; - - elements(selector: string): Client> & RawResult; - elements

    (selector: string): Client

    ; - - execute( - script: string | ((...args: any[]) => void), - ...args: any[] - ): Client> & RawResult; - - executeAsync( - script: string | ((...args: any[]) => void), - ...args: any[] - ): Client> & RawResult; - - /** @deprecated */ - file(date: string): Client> & never; - - /** @deprecated */ - file

    (date: string): Client

    & never; - - forward(): Client> & RawResult; - forward

    (): Client

    ; - - frame(id: any): Client> & RawResult; - frame

    (id: any): Client

    ; - - frameParent(): Client> & RawResult; - frameParent

    (): Client

    ; - - /** @deprecated */ - imeActivate(engine: string): Client> & RawResult & never; - - /** @deprecated */ - imeActivate

    (engine: string): Client

    & never; - - /** @deprecated */ - imeActivated(): Client> & RawResult & never; - - /** @deprecated */ - imeActivated

    (): Client

    ; - - /** @deprecated */ - imeActiveEngine(): Client> & string & never; - - /** @deprecated */ - imeActiveEngine

    (): Client

    ; - - /** @deprecated */ - imeAvailableEngines(): Client> & RawResult & never; - - /** @deprecated */ - imeAvailableEngines

    (): Client

    ; - - /** @deprecated */ - imeDeactivated(): Client> & RawResult & never; - - /** @deprecated */ - imeDeactivated

    (): Client

    ; - - init(capabilities?: DesiredCapabilities): Client> & RawResult; - init

    (capabilities?: DesiredCapabilities): Client

    ; - - /** @deprecated in favour of Actions.keyDown */ - keys(value: string | string[]): Client> & RawResult & Client; - - /** @deprecated in favour of Actions.keyDown */ - keys

    (value: string | string[]): Client

    ; - - /** @deprecated */ - localStorage(): Client> & RawResult; - - /** @deprecated */ - localStorage

    (): Client

    ; - - /** @deprecated */ - localStorage( - method: Method, - key?: string - ): Client> & RawResult & never; - - /** @deprecated */ - localStorage( - method: Method, - key?: string - ): Client> & RawResult & never; - - /** @deprecated */ - localStorage

    ( - method: Method, - key?: string | StorageItems - ): Client

    ; - - /** @deprecated */ - localStorageSize(): Client> & RawResult & never; - - /** @deprecated */ - localStorageSize

    (): Client

    ; - - /** @deprecated in favour of elementIdRect */ - location(type: GeoLocation): Client> & RawResult & never; - - /** @deprecated in favour of elementIdRect */ - location

    (type: GeoLocation): Client

    ; - - /** @deprecated */ - log(type: LoggingPreferences): Client> & never; - - /** @deprecated */ - log

    (type: LoggingPreferences): Client

    ; - - /** @deprecated */ - logTypes(): Client> & RawResult & never; - - /** @deprecated */ - logTypes

    (): Client

    ; - - /** @deprecated in favour of Actions.pointerMove */ - moveTo( - id: ElementId, - xoffset: number, - yoffset: number - ): Client> & RawResult & never; - - /** @deprecated in favour of Actions.pointerMove */ - moveTo( - xoffset: number, - yoffset: number - ): Client> & RawResult & never; - - /** @deprecated in favour of Actions.pointerMove */ - moveTo

    (id: ElementId): Client

    ; - - /** @deprecated in favour of Actions.pointerMove */ - moveTo

    ( - id: ElementId, - xoffset: number, - yoffset: number - ): Client

    ; - - refresh(): Client> & RawResult; - refresh

    (): Client

    ; - - screenshot(): Client> & RawResult; - - session

    (): Client

    ; - - session( - action?: Method, - sessionId?: string - ): Client> & RawResult; - - session

    (action?: Method): Client

    ; - - session

    ( - action?: Method, - sessionId?: string - ): Client

    & null; - - /** @deprecated */ - sessions(): Client> & RawResult & never; - - /** @deprecated */ - sessions

    (): Client

    ; - - /** @deprecated */ - sessionStorage(): Client> & RawResult & never; - - /** @deprecated */ - sessionStorage

    (): Client

    ; - - /** @deprecated */ - sessionStorage(method: Method): Client> & RawResult & never; - - /** @deprecated */ - sessionStorage(method: Method): Client> & RawResult & never; - - /** @deprecated */ - sessionStorage

    (method: Method): Client

    ; - - /** @deprecated */ - sessionStorage( - method: Method, - key: string - ): Client> & RawResult & never; - - /** @deprecated */ - sessionStorage( - method: Method, - key: string - ): Client> & RawResult & never; - - /** @deprecated */ - sessionStorage

    ( - method: Method, - key: string - ): Client

    ; - - /** @deprecated */ - sessionStorage( - method: Method, - key: StorageItems - ): Client> & RawResult; - - /** @deprecated */ - sessionStorage

    ( - method: Method, - key: StorageItems - ): Client

    ; - - /** @deprecated */ - sessionStorageSize(): Client> & RawResult & never; - - /** @deprecated */ - sessionStorageSize

    (): Client

    ; - - source(): Client> & RawResult; - source

    (): Client

    ; - - status(): Client> & RawResult; - status(): Client; - - /** @deprecated */ - submit(id: ElementId): Client> & RawResult & never; - - /** @deprecated */ - submit

    (id: ElementId): Client

    ; - - timeouts

    (type: Timeouts, ms: number): Client> & RawResult; - - /** @deprecated in favour of timeouts */ - timeoutsAsyncScript(ms: number): Client> & RawResult & never; - - /** @deprecated in favour of timeouts */ - timeoutsAsyncScript

    (ms: number): Client

    ; - - /** @deprecated in favour of timeouts */ - timeoutsImplicitWait(ms: number): Client> & RawResult & never; - - /** @deprecated in favour of timeouts */ - timeoutsImplicitWait

    (ms: number): Client

    ; - - url(): Client> & RawResult; - url(url: string): Client> & RawResult; - url

    (url?: string): Client

    ; - - title(): Client> & RawResult; - title

    (): Client

    ; - - /** @deprecated in favour of Actions.pointerDown */ - touchClick(id: ElementId): Client> & RawResult & never; - - /** @deprecated in favour of Actions.pointerDown */ - touchClick

    (id: ElementId): Client

    ; - - /** @deprecated in favour of Actions.pointerDown */ - touchDown( - xoffset: number, - yoffset: number - ): Client> & RawResult & never; - - /** @deprecated in favour of Actions.pointerDown */ - touchDown

    ( - xoffset: number, - yoffset: number - ): Client

    ; - - /** @deprecated in favour of Actions.perform */ - touchFlick( - id: ElementId, - xoffset: number, - yoffset: number, - speed: number - ): Client> & RawResult & never; - - /** @deprecated in favour of Actions.perform */ - touchFlick

    ( - id: ElementId, - xoffset: number, - yoffset: number, - speed: number - ): Client

    ; - - /** @deprecated in favour of Actions.perform */ - touchLongClick(id: ElementId): Client> & RawResult & never; - - /** @deprecated in favour of Actions.perform */ - touchLongClick

    (id: ElementId): Client

    ; - - /** @deprecated in favour of Actions.pointerMove */ - touchMove( - xoffset: number, - yoffset: number - ): Client> & RawResult & never; - - /** @deprecated in favour of Actions.pointerMove */ - touchMove

    ( - xoffset: number, - yoffset: number - ): Client

    ; - - /** @deprecated in favour of Actions.perform */ - touchScroll( - id: ElementId, - xoffset: number, - yoffset: number, - ): Client> & RawResult & never; - - /** @deprecated in favour of Actions.perform */ - touchScroll

    ( - id: ElementId, - xoffset: number, - yoffset: number, - ): Client

    ; - - /** @deprecated in favour of Actions.pointerUp */ - touchUp( - xoffset: number, - yoffset: number, - ): Client> & RawResult & never; - - /** @deprecated in favour of Actions.pointerUp */ - touchUp

    ( - xoffset: number, - yoffset: number, - ): Client

    ; - - window(windowHandle?: string): Client> & RawResult; - window

    (windowHandle?: string): Client

    ; - - windowHandle(): Client> & RawResult; - windowHandle

    (): Client

    ; - - windowHandleFullscreen(): Client> & RawResult; - windowHandleFullscreen

    (): Client

    ; - - windowHandleMaximize(): Client> & RawResult; - windowHandleMaximize

    (): Client

    ; - - /** @deprecated in favour of /session/{session id}/window/rect */ - windowHandlePosition( - windowHandle?: string, - position?: Position - ): Client> & RawResult & never; - - /** @deprecated in favour of /session/{session id}/window/rect */ - windowHandlePosition( - position: Position - ): Client> & RawResult & never; - - /** @deprecated in favour of /session/{session id}/window/rect */ - windowHandlePosition

    ( - windowHandle?: string, - position?: Position - ): Client

    ; - - /** @deprecated in favour of /session/{session id}/window/rect */ - windowHandlePosition

    ( - position: Position - ): Client

    ; - - /** @deprecated in favour of /session/{session id}/window/rect */ - windowHandleSize( - windowHandle?: string, - dimension?: Size - ): Client> & RawResult & never; - - /** @deprecated in favour of /session/{session id}/window/rect */ - windowHandleSize( - dimension: Size - ): Client> & RawResult & never; - - /** @deprecated in favour of /session/{session id}/window/rect */ - windowHandleSize

    ( - windowHandle?: string, - dimension?: Size - ): Client

    ; - - /** @deprecated in favour of /session/{session id}/window/rect */ - windowHandleSize

    ( - dimension?: Size - ): Client

    ; - - /** @deprecated */ - windowHandles(): Client> & RawResult & never; - - /** @deprecated */ - windowHandles

    (): Client

    & never; - } - - // State - interface Client { - hasFocus(selector?: string): Client & boolean; - hasFocus

    (selector?: string): Client

    ; - - isEnabled(selector?: string): Client & boolean; - isEnabled

    (selector?: string): Client

    ; - - isExisting(selector?: string): Client & boolean; - isExisting

    (selector?: string): Client

    ; - - isSelected(selector?: string): Client & boolean; - isSelected

    (selector?: string): Client

    ; - - isVisible(selector?: string): Client & boolean; - isVisible

    (selector?: string): Client

    ; - - isVisibleWithinViewport(selector?: string): Client & boolean; - isVisibleWithinViewport

    (selector?: string): Client

    ; - } - - // Utility - interface Client { - $(selector: string): Client> & RawResult; - $

    (selector: string): Client

    ; - - $$(selector: string): Array>> & Array>; - $$

    (selector: string): Client

    ; - - addCommand( - commandName: string, - customMethod: (...args: any[]) => void, - overwrite?: boolean - ): Client & undefined; - - addCommand

    ( - commandName: string, - customMethod: (...args: any[]) => void, - overwrite?: boolean - ): Client

    ; - - call

    (callback: () => void): Client

    & any; - - chooseFile( - selector: string, - localPath: string - ): Client & undefined; - - chooseFile(localPath: string): Client; - - chooseFile

    ( - selector: string, - localPath: string - ): Client

    ; - - chooseFile

    (localPath: string): Client

    ; - - debug(): Client; - debug

    (): Client

    ; - - end(): Client; - end

    (): Client

    ; - - endAll(): Client; - endAll

    (): Client

    ; - - getCommandHistory(): Client & CommandHistoryEntry[]; - getCommandHistory

    (): Client

    ; - - pause(milliseconds: number): Client; - pause

    (milliseconds: number): Client

    ; - - reload(): Client & string[]; - reload

    (): Client

    ; - - saveScreenshot(filename?: string): Client & Buffer; - saveScreenshot

    (filename?: string): Client

    ; - - scroll(selector?: string): Client> & RawResult; - - scroll( - selector: string, - xoffset: number, - yoffset: number - ): Client> & RawResult; - - scroll( - xoffset: number, - yoffset: number - ): Client> & RawResult; - - scroll

    (selector?: string): Client

    ; - - scroll

    ( - selector: string, - xoffset: number, - yoffset: number - ): Client

    ; - - scroll

    ( - xoffset: number, - yoffset: number - ): Client

    ; - - uploadFile(localPath: string): Client> & RawResult; - uploadFile

    (localPath: string): Client

    ; - - waitForEnabled( - selector: string, - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForEnabled( - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForEnabled

    (selector?: string): Client

    ; - - waitForEnabled

    ( - selector: string, - milliseconds?: number, - ): Client

    ; - - waitForEnabled

    (milliseconds?: number): Client

    ; - - waitForEnabled

    ( - selector: string, - milliseconds?: number, - reverse?: boolean - ): Client

    ; - - waitForEnabled

    ( - milliseconds?: number, - reverse?: boolean - ): Client

    ; - - waitForExist( - selector: string, - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForExist( - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForExist

    (selector?: string): Client

    ; - - waitForExist

    ( - selector: string, - milliseconds?: number - ): Client

    ; - - waitForExist

    (milliseconds: number): Client

    ; - - waitForExist

    ( - selector: string, - milliseconds?: number, - reverse?: boolean - ): Client

    ; - - waitForExist

    ( - milliseconds: number, - reverse?: boolean - ): Client

    ; - - waitForSelected( - selector: string, - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForSelected( - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForSelected

    (selector?: string): Client

    ; - - waitForSelected

    ( - selector: string, - milliseconds?: number - ): Client

    ; - - waitForSelected

    (milliseconds: number): Client

    ; - - waitForSelected

    ( - selector: string, - milliseconds?: number, - reverse?: boolean - ): Client

    ; - - waitForSelected

    ( - milliseconds?: number, - reverse?: boolean - ): Client

    ; - - waitForText( - selector: string, - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForText( - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForText

    (selector?: string): Client

    ; - - waitForText

    ( - selector: string, - milliseconds?: number - ): Client

    ; - - waitForText

    (milliseconds?: number): Client

    ; - - waitForText

    ( - selector: string, - milliseconds?: number, - reverse?: boolean - ): Client

    ; - - waitForText

    ( - milliseconds?: number, - reverse?: boolean - ): Client

    ; - - waitForValue( - selector: string, - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForValue( - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForValue

    (selector?: string): Client

    ; - - waitForValue

    ( - selector: string, - milliseconds?: number - ): Client

    ; - - waitForValue

    (milliseconds?: number): Client

    ; - - waitForValue

    ( - selector: string, - milliseconds?: number, - reverse?: boolean, - ): Client

    ; - - waitForValue

    ( - milliseconds?: number, - reverse?: boolean, - ): Client

    ; - - waitForVisible( - selector: string, - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForVisible( - milliseconds?: number, - reverse?: boolean - ): Client & boolean; - - waitForVisible

    (selector?: string): Client

    ; - - waitForVisible

    ( - selector: string, - milliseconds?: number - ): Client

    ; - - waitForVisible

    (milliseconds?: number): Client

    ; - - waitForVisible

    ( - selector: string, - milliseconds?: number, - reverse?: boolean - ): Client

    ; - - waitForVisible

    ( - milliseconds?: number, - reverse?: boolean - ): Client

    ; - - waitUntil( - condition: () => boolean | Promise | Client> & RawResult, - timeout?: number, - timeoutMsg?: string, - interval?: number - ): Client & any; - - waitUntil

    ( - condition: () => boolean | Promise | Client> & RawResult, - timeout?: number, - timeoutMsg?: string, - interval?: number - ): Client

    ; - } - - // Window - interface Client { - close(windowHandle?: string): Client> & RawResult; - close

    (windowHandle?: string): Client

    ; - - getCurrentTabId(): Client & string; - getCurrentTabId

    (): Client

    ; - - getTabIds(): Client & string[]; - getTabIds

    (): Client

    ; - - getViewportSize(): Client & Size; - getViewportSize(dimension: string): Client & number; - getViewportSize

    (dimension?: string): Client

    ; - - newWindow( - url: string, - windowName: string, - windowFeatures: string - ): Client> & RawResult; - - newWindow

    ( - url: string, - windowName: string, - windowFeatures: string - ): Client

    ; - - setViewportSize( - size: Size, - type?: boolean - ): Client & undefined; - - setViewportSize

    ( - size: Size, - type?: boolean - ): Client

    ; - - switchTab(windowHandle?: string): Client> & RawResult; - switchTab

    (windowHandle?: string): Client

    ; - } - - const VERSION: string; -} - -declare var browser: WebdriverIO.Client; - -declare function $(selector: string): WebdriverIO.Client> & WebdriverIO.RawResult; -declare function $

    (selector: string): WebdriverIO.Client

    ; - -declare function $$(selector: string): Array>> & Array>; -declare function $$

    (selector: string): WebdriverIO.Client

    ; - -declare module "webdriverio" { - export = WebdriverIO; -} diff --git a/types/webdriverio/tslint.json b/types/webdriverio/tslint.json deleted file mode 100644 index 5ab241cb96..0000000000 --- a/types/webdriverio/tslint.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // TODOs - "await-promise": false, - "no-declare-current-package": false, - "no-single-declare-module": false, - "unified-signatures": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false - } -} diff --git a/types/webdriverio/webdriverio-tests.ts b/types/webdriverio/webdriverio-tests.ts deleted file mode 100644 index f5e33e776e..0000000000 --- a/types/webdriverio/webdriverio-tests.ts +++ /dev/null @@ -1,155 +0,0 @@ -import * as webdriverio from "webdriverio"; -import { assert } from "chai"; - -// Stub mocha functions -const { describe, it, before, after, beforeEach, afterEach } = null as any as { - [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & { only: any, skip: any }; -}; - -describe("my webdriverio tests", () => { - let client: webdriverio.Client; - - before(async () => { - client = webdriverio.remote({ deprecationWarnings: true, desiredCapabilities: { browserName: "phantomjs" } }); - await client.init(); - }); - - it("should have the right title - the good old callback way", () => { - assert.equal( - browser - .url("/") - .getTitle(), - "WebdriverIO - Selenium 2.0 javascript bindings for nodejs" - ); - }); - - it("should have the right title - the promise way", () => { - return browser - .url("/") - .getTitle().then((title) => { - assert.equal(title, "WebdriverIO - Selenium 2.0 javascript bindings for nodejs"); - }); - }); - - it("Github test", async () => { - await client.url("https://github.com/"); - await client.waitForVisible('.header-logo-invertocat'); - - const elementSize = await client.getElementSize(".header-logo-invertocat"); - - assert.isNumber(elementSize.height); - assert.isNumber(elementSize.width); - assert.strictEqual(elementSize.height, 32); - assert.strictEqual(elementSize.width, 32); - - const title = await client.getTitle(); - assert.isString(title); - assert.strictEqual(title, "The world's leading software development platform ยท GitHub"); - - const cssProperty = await client.getCssProperty("a[href='/pricing']", "color"); - assert.strictEqual(cssProperty.value, "rgba(255,255,255,1)"); - }); - - after(async () => { - await client.end(); - }); -}); - -describe("multiremote test", () => { - let matrix: webdriverio.Client; - - before(async () => { - matrix = webdriverio.multiremote({ - browserA: { - desiredCapabilities: { - browserName: "chrome", - chromeOptions: { - args: [ - "use-fake-device-for-media-stream", - "use-fake-ui-for-media-stream", - ], - }, - }, - }, - browserB: { - desiredCapabilities: { - browserName: "chrome", - chromeOptions: { - args: [ - "use-fake-device-for-media-stream", - "use-fake-ui-for-media-stream", - ], - }, - }, - }, - }); - }); - - it("clicks a button in a random channel at apprtc", () => { - const channel = Math.round(Math.random() * 100000000000); - - matrix - .init() - .url("https://apprtc.appspot.com/r/" + channel) - .click("#confirm-join-button") - .pause(5000) - .end(); - }); - - after(async () => { - await matrix.end(); - }); -}); - -describe("testing feaures with chrome", () => { - const options = { - desiredCapabilities: { - browserName: "chrome", - }, - }; - - it("can use selectorExecute", () => { - webdriverio - .remote(options) - .init() - .url("https://news.ycombinator.com/") - .selectorExecute("//div", (inputs: HTMLElement[], message: string) => { - return `${inputs.length} ${message}`; - }, "divs on the page") - .then((res: string) => { - console.log(res); - }) - .end(); - }); - - it("can waitForVisible", () => { - webdriverio - .remote(options) - .init() - .url("http://www.google.com/") - .waitForVisible("//input[@type='submit']", 5000) - .then((visible) => { - console.log(visible); // Should return true - }) - .end(); - }); -}); - -let hooks: webdriverio.Hooks = {}; - -hooks = { - // Hooks can be a noop function - onPrepare: () => undefined, - onError() { - // Hooks don't have to return a value - } -}; - -hooks.onComplete = async () => { - // Hooks can return a promise but the promise can be void -}; - -hooks.afterTest = async () => { - // Hooks can have a promise with a result but it is not typically used - return false; -}; diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index d9047f965e..293f06797d 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -32,7 +32,7 @@ declare namespace __WebpackModuleApi { * This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used. */ ensure(paths: string[], callback: (require: NodeRequire) => void, errorCallback?: (error: any) => void, chunkName?: string): void; - context(path: string, deep?: boolean, filter?: RegExp): RequireContext; + context(path: string, deep?: boolean, filter?: RegExp, mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once"): RequireContext; /** * Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available. * diff --git a/types/xmlserializer/index.d.ts b/types/xmlserializer/index.d.ts new file mode 100644 index 0000000000..384def9ded --- /dev/null +++ b/types/xmlserializer/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for xmlserializer 0.6 +// Project: https://github.com/cburgmer/xmlserializer#readme +// Definitions by: Eoin O'Brien +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +import * as parse5 from 'parse5'; + +export as namespace xmlserializer; + +/** + * Serializes a DOM subtree or DOM document into XML/XHTML. + * + * It understands documents generated by `parse5` and regular browser DOMs (and + * thus can act as a drop-in replacement for `XMLSerializer` which for some + * browsers only serializes true XML documents). + * + * Currently some cases are treated differently to the `XMLSerializer` + * implementation of the browsers: + * + * - Invalid characters (ASCII control characters) that are invalid in XML 1.0 + * are removed on serialization. The browsers silently include those + * characters and on reparsing those documents throw a parser exception. + * - Dashes in comments are escaped to provide valid comments in XHTML. Firefox + * does not do this. + * - The xmlns attribute has higher precedence than the type of the DOM object + * passed to the serializer. + * - Small differences in style: no space in self-closing tag, empty value for + * boolean attributes, quoting of single apostrophes in attribute values. + * + * This behaviour might become optional in the future. + * + * @example + * import * as xmlserializer from 'xmlserializer'; + * import * as parse5 from 'parse5'; + * + * const html2xhtml = (htmlString: string) => { + * const dom = parse5.parse(htmlString); + * return xmlserializer.serializeToString(dom); + * }; + * + * console.log(html2xhtml('
    ')); + * + * @param node the DOM element to be serialized to XML/XHTML + */ +export function serializeToString(node: parse5.Element): string; diff --git a/types/xmlserializer/package.json b/types/xmlserializer/package.json new file mode 100644 index 0000000000..da7376aaf1 --- /dev/null +++ b/types/xmlserializer/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "parse5": "^5.1.0" + } +} diff --git a/types/xmlserializer/tsconfig.json b/types/xmlserializer/tsconfig.json new file mode 100644 index 0000000000..48e2207ddb --- /dev/null +++ b/types/xmlserializer/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "xmlserializer-tests.ts" + ] +} diff --git a/types/xmlserializer/tslint.json b/types/xmlserializer/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/xmlserializer/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/xmlserializer/xmlserializer-tests.ts b/types/xmlserializer/xmlserializer-tests.ts new file mode 100644 index 0000000000..2e16f3a52a --- /dev/null +++ b/types/xmlserializer/xmlserializer-tests.ts @@ -0,0 +1,8 @@ +import * as xmlserializer from 'xmlserializer'; +import * as parse5 from 'parse5'; + +const htmlString = '
    '; +const dom = parse5.parse(htmlString); + +// $ExpectType string +xmlserializer.serializeToString(dom); diff --git a/types/xxhashjs/index.d.ts b/types/xxhashjs/index.d.ts index 40c45cf3ab..9c9d7e4318 100644 --- a/types/xxhashjs/index.d.ts +++ b/types/xxhashjs/index.d.ts @@ -1,19 +1,29 @@ -// Type definitions for xxhashjs 0.1 +// Type definitions for xxhashjs 0.2 // Project: https://github.com/pierrec/js-xxhash // Definitions by: Dibyo Majumdar +// Nick Zahn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + export as namespace XXH; +// Ideally we would have a type definition for the "cuint" package. +// The following interface `UINT` is to resolve the bare minimum. +interface UINT { + toNumber(): number; + toString(radix?: number): string; +} + export interface HashObject { - init(seed: number): this; - update(data: string | ArrayBuffer): this; - digest(): number; + init(seed: number): this; + update(data: string | ArrayBuffer | Buffer): this; + digest(): UINT; } export interface HashInterface { - (seed?: number): HashObject; - (data: string | ArrayBuffer, seed: number): number; + (seed?: number): HashObject; + (data: string | ArrayBuffer | Buffer, seed: number): UINT; } export const h32: HashInterface; diff --git a/types/xxhashjs/xxhashjs-tests.ts b/types/xxhashjs/xxhashjs-tests.ts index ee2d7ef8f3..889bf9bb40 100644 --- a/types/xxhashjs/xxhashjs-tests.ts +++ b/types/xxhashjs/xxhashjs-tests.ts @@ -1,7 +1,37 @@ import XXH from 'xxhashjs'; -// examples adapted from https://github.com/pierrec/js-xxhash -const h1 = XXH.h32('abcd', 0xABCD).toString(16); +// Test data +const seed = 0xABCD; +const stringData = 'abcd'; +const arrayBufferData = new ArrayBuffer(4); +const bufferData = Buffer.from([1, 2, 3, 4]); -const H = XXH.h32(0xABCD); -const h2 = H.update('abcd').digest().toString(16); +// Test XXH.h32 methods, initialising with string data +const value32_1 = XXH.h32(stringData, seed); +value32_1.toString(); +value32_1.toString(16); +value32_1.toNumber(); + +const value32_2 = XXH.h32(seed).update(stringData).digest(); +value32_2.toString(); +value32_2.toString(16); +value32_2.toNumber(); + +// Test XXH.h64 methods, initialising with string data +const value64_1 = XXH.h64(stringData, seed); +value64_1.toString(); +value64_1.toString(16); +value64_1.toNumber(); + +const value64_2 = XXH.h64(seed).update(stringData).digest(); +value64_2.toString(); +value64_2.toString(16); +value64_2.toNumber(); + +// Initialise with ArrayBuffer +XXH.h32(arrayBufferData, seed); +XXH.h64(arrayBufferData, seed); + +// Initialise with Buffer +XXH.h32(bufferData, seed); +XXH.h64(bufferData, seed); diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index ffba765581..9f3cb687a2 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -8,6 +8,7 @@ // Vincent Pizzo // Robert Bullen // Yusuke Sato +// Dan Rumney // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -66,7 +67,8 @@ export interface Schema { strict(isStrict: boolean): this; strip(strip: boolean): this; withMutation(fn: (current: this) => void): void; - default(value?: any): this; + default(value: any): this; + default(): T; nullable(isNullable: boolean): this; required(message?: TestOptionsMessage): this; notRequired(): this;