diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a03915a264..a769c20dfc 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,4 @@ /types/abbrev/ @BendingBender -/types/ably/ @ably /types/abs/ @AyaMorisawa /types/absolute/ @AyaMorisawa /types/acc-wizard/ @cyrilschumacher @@ -14,8 +13,11 @@ /types/activex-access/ @zspitz /types/activex-adodb/ @zspitz /types/activex-dao/ @zspitz +/types/activex-diskquota/ @zspitz /types/activex-excel/ @zspitz +/types/activex-faxcomexlib/ @zspitz /types/activex-infopath/ @zspitz +/types/activex-iwshruntimelibrary/ @zspitz /types/activex-libreoffice/ @zspitz /types/activex-msforms/ @zspitz /types/activex-mshtml/ @zspitz @@ -24,6 +26,8 @@ /types/activex-outlook/ @zspitz /types/activex-powerpoint/ @zspitz /types/activex-scripting/ @zspitz +/types/activex-shdocvw/ @zspitz +/types/activex-shell/ @zspitz /types/activex-stdole/ @zspitz /types/activex-vbide/ @zspitz /types/activex-wia/ @zspitz @@ -36,7 +40,7 @@ /types/agenda/ @meirgottlieb /types/aggregate-error/ @BendingBender /types/alertify/ @jjeffery -/types/alexa-sdk/ @petebeegle @hoo29 @pascalwhoop @blforce @rk-7 +/types/alexa-sdk/ @petebeegle @hoo29 @pascalwhoop @blforce @rk-7 @alexmalcoci /types/alexa-voice-service/ @dolanmiu /types/algebra.js/ @CaselIT /types/algoliasearch/ @cbaptiste @haroenv @aherve @@ -49,7 +53,7 @@ /types/amqp/ @seikho @jonnysparkplugs /types/amqp-rpc/ @wokim /types/amqplib/ @mnahkies @abreits @nfantone -/types/analytics-node/ @fongandrew +/types/analytics-node/ @fongandrew @thomasthiebaud /types/angular/ @diegovilar @thorn0 @calebstdenis @leonard-thieu /types/angular-agility/ @rolandzwaga /types/angular-animate/ @michelsalib @adidahiya @rasch @codyschaaf @@ -136,12 +140,14 @@ /types/api-error-handler/ @tkrotoff /types/apigee-access/ @CasperSkydt /types/apollo-codegen/ @bradleyayers +/types/app-root-dir/ @chenyang-biu /types/app-root-path/ @shantmarouti /types/appdmg/ @unindented /types/appframework/ @kyo-ago /types/applepayjs/ @martincostello /types/appletvjs/ @brainded /types/applicationinsights-js/ @kamilszostak +/types/aqb/ @Athenkosi-Mase /types/arbiter/ @arash16 /types/arcgis-js-api/v3/ @Esri /types/arcgis-js-api/ @Esri @@ -167,15 +173,16 @@ /types/aspnet-identity-pw/ @jt000 /types/assert-equal-jsx/ @seryl /types/assert-plus/ @KostyaTretyak -/types/assertion-error/ @Bartvds /types/assertsharp/ @brunolm /types/assets-webpack-plugin/ @kryops /types/async/ @borisyankov @kern0 @Penryn @fenying @pascalmartin /types/async-cache/ @BendingBender -/types/async-lock/ @elisee +/types/async-lock/ @elisee @afharo @rhymmor /types/async-polling/ @Goldsmith42 +/types/async-retry/ @albertywu /types/async.nexttick/ @pyrho /types/asynciterator/ @rubensworks +/types/atlaskit__button/ @dijimsta /types/atmosphere.js/ @toedter @Mory1879 /types/atom/ @GlenCFL @smhxx @lierdakil /types/atom-keymap/ @GlenCFL @@ -186,7 +193,7 @@ /types/auth0-angular/ @homesar /types/auth0-js/v7/ @advancedrei /types/auth0-js/ @adrianchia @mdurrant @peterblazejewicz -/types/auth0-lock/ @carusology @goldcaddy77 +/types/auth0-lock/ @carusology @goldcaddy77 @lfaudreejr /types/auth0.widget/ @advancedrei /types/auto-launch/ @rhysd @unindented /types/auto-sni/ @janwo @@ -194,10 +201,11 @@ /types/autolinker/ @leonyu /types/autoprefixer/ @odnamrataizem /types/autosize/ @kingdango @keika299 @NeekSandhu +/types/autosuggest-highlight/ @senukartur /types/awesomplete/ @webbiesdk @bmdixon @tbekolay /types/aws-iot-device-sdk/ @niik @mlamp -/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart -/types/aws-serverless-express/ @threesquared @jcaffey @mattmeye +/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart @palmithor @daniloraisi @simonbuchan @Haydabase +/types/aws-serverless-express/ @threesquared @jcaffey @mattmeye @albertovasquez /types/aws4/ @ajcrites /types/axel/ @ruslan-molodyko /types/azure/ @AndrewGaspar @antiveeranna @SomaticIT @@ -237,6 +245,7 @@ /types/base-x/ @chrootsu /types/base16/ @alechill /types/base64-js/ @pe8ter +/types/base64topdf/ @lucasriondel /types/bases/ @harikv /types/bash-glob/ @mrmlnc /types/basic-auth/ @moonpyk @vesse @@ -267,6 +276,7 @@ /types/bip39/ @micksatana /types/bit-array/ @mudkipme /types/bitcoinjs-lib/ @mhegazy @dlebrecht @rbuckton @micksatana @youssefgh +/types/bitcore-lib/ @lautarodragan /types/bittorrent-protocol/ @feross @tlaziuk /types/bitwise-xor/ @rogierschouten /types/bl/ @Bartvds @@ -295,8 +305,10 @@ /types/bootbox/ @vbortone @konpikwastaken @kanup @icereed @trodi @stannynuytkens @renjfk /types/bootpag/ @rdeneau /types/bootstrap/ @borisyankov +/types/bootstrap-3-typeahead/ @AndersonFriaca /types/bootstrap-datepicker/ @borisyankov /types/bootstrap-fileinput/ @CheCoxshall +/types/bootstrap-growl-ifightcrime/ @AndersonFriaca /types/bootstrap-maxlength/ @danmana /types/bootstrap-notify/ @niemyjski @mouse0270 @robert-voica /types/bootstrap-select/ @LKay @@ -334,8 +346,9 @@ /types/buffer-equal/ @Bartvds /types/buffers/ @rhencke /types/bufferstream/ @Bartvds +/types/builtin-modules/ @ajafff /types/bull/v2/ @bgrieder @JProgrammer -/types/bull/ @bgrieder @JProgrammer @marshall007 @weeco +/types/bull/ @bgrieder @JProgrammer @marshall007 @weeco @blaugold /types/bump-regex/ @silkentrance /types/bunnymq/ @cyrilschumacher /types/bunyan/ @amikhalev @@ -351,27 +364,31 @@ /types/byline/ @reppners /types/bytebuffer/ @cappellin /types/bytes/ @danny8002 -/types/c3/ @mcliment @gerinjacob @denyo +/types/c3/ @mcliment @gerinjacob @denyo @dmitryshindin /types/cache-manager/ @GausSim /types/cal-heatmap/ @RetroChrisB /types/callsite/ @newclear /types/callsites/ @BendingBender /types/calq/ @eirikhm +/types/camaro/ @tuananh /types/camelcase/ @samverschueren /types/camelcase-keys/ @mhegazy /types/camo/ @lucasmciruzzi /types/cancan/ @Vincent-Pang /types/cannon/ @clark-stevenson @Gelio +/types/canvas-confetti/ @matracey /types/canvas-gauges/ @Mikhus /types/canvasjs/ @brutalimp /types/capitalize/ @frederickfogerty /types/card-validator/ @ChanceM /types/case-sensitive-paths-webpack-plugin/ @r3nya -/types/caseless/ @downace +/types/caseless/ @downace @mastermatt /types/cash/ @akvlko /types/casperjs/ @jedmao @urielch /types/cassandra-driver/ @Svjard -/types/catbox/ @jasonswearingen @AJamesPhillips +/types/catalog/ @grossbart @wereHamster +/types/catbox/v7/ @jasonswearingen @AJamesPhillips +/types/catbox/ @jasonswearingen @AJamesPhillips @saboya /types/cbor/ @pushplay /types/ccap/ @taoqf /types/chai/v2/ @Bartvds @AGBrown @@ -382,7 +399,7 @@ /types/chai-dom/ @mattlewis92 /types/chai-enzyme/ @asvetliakov /types/chai-fuzzy/ @Bartvds -/types/chai-http/ @Nemo157 @G1itcher @CaselIT +/types/chai-http/ @Nemo157 @G1itcher @CaselIT @bas-l /types/chai-jest-snapshot/ @mattvperry /types/chai-jquery/ @kazimanzurrashid /types/chai-json-schema/ @ulrichheiniger @@ -395,7 +412,8 @@ /types/chance/ @cbowdon @brikou /types/change-emitter/ @iskandersierra /types/charm/ @Xananax -/types/chart.js/ @anuti @FabienLavocat @KentarouTakeda @larrybahr @mernen @josefpaij @danmana +/types/charset/ @cspotcode +/types/chart.js/ @anuti @FabienLavocat @KentarouTakeda @larrybahr @mernen @josefpaij @danmana @guillaume-ro-fr @chicoxyzzy /types/chartist/ @mtgibbs @psimonski @clottman /types/chayns/ @HenningKuehl /types/check-sum/ @BendingBender @@ -403,6 +421,7 @@ /types/checkstyle-formatter/ @mhegazy /types/checksum/ @rogierschouten /types/cheerio/ @blittle @wmaurer @umarniz @LiJinyao +/types/chessboardjs/ @sliverb @davidmpaz /types/chmodr/ @BendingBender /types/chokidar/ @reppners @felixfbecker @bayssmekanique /types/chosen-js/ @borisyankov @denisname @@ -420,7 +439,7 @@ /types/clean-stack/ @BendingBender /types/clean-webpack-plugin/ @j-f1 /types/clear-require/ @dan-j -/types/cleave.js/ @clentfort @jasongi-at-sportsbet +/types/cleave.js/ @clentfort @jasongi-at-sportsbet @sashashakun /types/cli/ @kayahr /types/cli-color/ @ChaosinaCan /types/cli-spinner/ @janslow @@ -449,9 +468,11 @@ /types/collections/ @scarabedore /types/color/v0/ @LKay /types/color/v1/ @LKay -/types/color/ @Airlun +/types/color/v2/ @Airlun +/types/color/ @Airlun @jameswlane /types/color-convert/ @Airlun /types/color-name/ @Ailrun +/types/color-namer/ @in19farkt /types/color-string/ @BendingBender @danmarshall /types/colorbrewer/ @mtraynham /types/colors/ @Bartvds @staeke @@ -479,7 +500,7 @@ /types/conf/v0/ @SamVerschueren /types/conf/ @SamVerschueren @BendingBender /types/confidence/ @jppellerin -/types/config/ @RWander @forrestbice @jndonald3 +/types/config/ @RWander @forrestbice @jndonald3 @albertovasquez /types/configstore/ @ArcticLight /types/confit/ @ethanresnick /types/connect/ @SomaticIT @@ -561,6 +582,7 @@ /types/cron/ @horiuchi /types/cropperjs/ @stepancar /types/croppie/ @connor4312 @dklmuc @sarunint +/types/cross-spawn/ @Alorel /types/crossfilter/ @schmuli @iebaker @nordfjord /types/crossroads/ @diullei /types/cryptiles/ @awendland @@ -579,6 +601,7 @@ /types/csvrow/ @codeanimal /types/csvtojson/ @EricByers @wcarson /types/cucumber/v1/ @abraaoalves @jan-molak @isoung @BendingBender +/types/cucumber/v3/ @abraaoalves @jan-molak @isoung @BendingBender @ErikSchierboom /types/cucumber/ @abraaoalves @jan-molak @isoung @BendingBender @ErikSchierboom /types/currency-formatter/ @mhegazy @davidmpaz /types/custom-error-generator/ @thmiceli @@ -586,8 +609,9 @@ /types/cwise-compiler/ @taoqf /types/cwise-parser/ @taoqf /types/cybozulabs-md5/ @pine613 -/types/cytoscape/ @phreed @wy193777 @ypconstante +/types/cytoscape/ @phreed @wy193777 @ypconstante @janniclas /types/d3/v3/ @gustavderdrache @borisyankov @MatthiasJobst +/types/d3/v4/ @tomwanzek @gustavderdrache @borisyankov /types/d3/ @tomwanzek @gustavderdrache @borisyankov /types/d3-array/ @gustavderdrache @borisyankov @tomwanzek /types/d3-axis/ @tomwanzek @gustavderdrache @borisyankov @@ -601,6 +625,7 @@ /types/d3-drag/ @tomwanzek @gustavderdrache @borisyankov /types/d3-dsv/ @tomwanzek @gustavderdrache @borisyankov /types/d3-ease/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-fetch/ @ledragon /types/d3-force/ @tomwanzek @gustavderdrache @borisyankov /types/d3-format/ @tomwanzek @gustavderdrache @borisyankov /types/d3-geo/ @Ledragon @tomwanzek @gustavderdrache @borisyankov @@ -615,6 +640,7 @@ /types/d3-random/ @tomwanzek @gustavderdrache @borisyankov /types/d3-request/ @Ledragon @gustavderdrache @borisyankov @tomwanzek /types/d3-sankey/ @tomwanzek @gustavderdrache +/types/d3-scale/v1/ @tomwanzek @gustavderdrache @borisyankov /types/d3-scale/ @tomwanzek @gustavderdrache @borisyankov /types/d3-scale-chromatic/ @Ledragon @gustavderdrache @borisyankov @henriquefm /types/d3-selection/ @tomwanzek @gustavderdrache @borisyankov @@ -635,12 +661,14 @@ /types/dagre-d3/ @markwongsk /types/dagre-layout/ @qinfchen @Frankrike @vilterp /types/dargs/ @BendingBender -/types/dat-gui/ @gyohk @sonic3d @rroylance +/types/dashify/ @rokt33r +/types/dat.gui/ @gyohk @sonic3d @rroylance /types/data-driven/ @mrhen /types/datadog-metrics/ @pushplay /types/datatables.net/ @Silver-Connection @omidkrad @pragmatrix @CNBoland /types/datatables.net-buttons/ @Silver-Connection @SammyG4Free @jimhartford /types/datatables.net-fixedheader/ @szechyjs @Silver-Connection +/types/datatables.net-rowgroup/ @maixiu /types/datatables.net-rowreorder/ @baywet /types/datatables.net-select/ @szechyjs /types/date-arithmetic/ @HeeL @@ -659,6 +687,7 @@ /types/decamelize/ @samverschueren /types/decay/ @enaeseth /types/decompress/ @plantain-00 +/types/decompress-response/ @DanielRosenwasser /types/decorum/ @dflor003 /types/dedent/ @douglasduteil /types/deep-assign/ @souldreamer @@ -706,7 +735,7 @@ /types/discontinuous-range/ @OiCMudkips /types/disposable-email-domains/ @geoffreak /types/doccookies/ @jonegerton -/types/dockerode/ @seikho @nlaplante @isac322 @lazarusx @meisenzahl +/types/dockerode/ @seikho @nlaplante @isac322 @lazarusx @meisenzahl @thegecko /types/docopt/ @giggio /types/doctrine/ @rictic /types/documentdb/ @NoelAbrahams @brettferdosi @ctstone @yifanwu @@ -761,6 +790,7 @@ /types/dynatable/ @francoismassart /types/dynogels/ @SpartanLabs /types/each/ @misak113 +/types/earcut/ @NaridaL /types/easeljs/ @evilangelist /types/easy-api-request/ @DeadAlready /types/easy-jsend/ @DeadAlready @@ -772,6 +802,7 @@ /types/echarts/ @xieisabug @AntiMoron /types/ecurve/ @mhegazy /types/ed25519/ @erikma +/types/ed2curve/ @ffflorian /types/egg-mock/ @sheperdwind /types/egg.js/ @ToastHawaii /types/egjs__axes/ @naver @@ -788,11 +819,11 @@ /types/electron-json-storage/ @stpettersens @nrlquaker @jbw91 /types/electron-notifications/ @djpereira /types/electron-notify/ @djpereira -/types/electron-packager/ @SomaticIT @cortopy +/types/electron-packager/ @SomaticIT @cortopy @jkleinsc /types/electron-settings/v2/ @leonard-thieu /types/electron-settings/ @icopp @nrlquaker /types/electron-spellchecker/ @unindented -/types/electron-store/ @unindented +/types/electron-store/ @unindented @jsynowiec /types/electron-util/ @kputh /types/electron-window-state/ @rhysd /types/electron-winstaller/ @shiftkey @unindented @@ -803,7 +834,7 @@ /types/email-templates/ @cyrilschumacher @gurisko @blankstar85 /types/ember/v1/ @jedmao /types/ember/ @jedmao @bttf @dwickern @chriskrycho @theroncross @mfeckie -/types/ember-data/ @dwickern @mike-north +/types/ember-data/ @dwickern @mike-north @chriskrycho /types/ember-feature-flags/ @tansongyang /types/ember-mocha/ @dwickern /types/ember-modal-dialog/ @tansongyang @@ -827,6 +858,7 @@ /types/envify/ @tkQubo /types/enzyme/ @MarianPalkus @NoHomey @jwbay @huhuanming @MartynasZilinskas @thovden /types/enzyme-adapter-react-15/ @tkrotoff +/types/enzyme-adapter-react-15.4/ @nali /types/enzyme-adapter-react-16/ @tkrotoff /types/enzyme-to-json/ @joscha /types/eonasdan-bootstrap-datetimepicker/ @ToastHawaii @@ -836,14 +868,17 @@ /types/eq.js/ @stephenlautier /types/errorhandler/ @santialbo /types/es6-collections/ @rbuckton -/types/es6-promisify/ @harryshipton +/types/es6-promisify/ @harryshipton @bschlenk /types/es6-shim/ @rbuckton /types/es6-weak-map/ @pine /types/escape-html/ @elisee /types/escape-latex/ @olsio /types/escape-string-regexp/ @kruncher @faergeek /types/escodegen/ @simondel +/types/eslint/ @pmdartus @j-f1 /types/eslint-plugin-prettier/ @ikatyang +/types/eslint-scope/ @mysticatea +/types/eslint-visitor-keys/ @mysticatea /types/esprima/v2/ @teppeis @RReverser /types/esprima/ @teppeis @RReverser @peter-scott /types/esprima-walk/ @tswaters @@ -872,8 +907,9 @@ /types/expect.js/ @teppeis /types/expectations/ @vvakame /types/expo/v23/ @KonstantinKai -/types/expo/ @KonstantinKai @martynaskadisa -/types/expr-eval/ @connor4312 +/types/expo/v24/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger +/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger +/types/expo__vector-icons/ @incleaf /types/express/ @borisyankov /types/express-brute/ @cyrilschumacher /types/express-brute-memcached/ @cyrilschumacher @@ -889,7 +925,7 @@ /types/express-flash-2/ @mathsalmi /types/express-flash-notification/ @Mister4Eyes /types/express-formidable/ @tdolsen @evanshortiss -/types/express-graphql/ @isman-usoh @nitintutlani @hubel +/types/express-graphql/ @isman-usoh @nitintutlani @hubel @zya /types/express-handlebars/ @stpettersens @yhaskell /types/express-jwt/ @wokim @kacepe @Sl1MBoy /types/express-less/ @xieyubo @@ -905,8 +941,9 @@ /types/express-rate-limit/ @cyrilschumacher @makepost /types/express-route-fs/ @kripod /types/express-sanitized/ @cjbarth -/types/express-serve-static-core/ @borisyankov @19majkel94 @kacepe @micksatana -/types/express-session/ @horiuchi @jacobbogers +/types/express-serve-static-core/ @borisyankov @19majkel94 @kacepe @micksatana @samijaber +/types/express-session/ @horiuchi @jacobbogers @builtinnya @ry7n +/types/express-to-koa/ @xiaohanzhang /types/express-unless/ @wokim /types/express-winston/ @bricka /types/extend/ @reppners @@ -916,7 +953,7 @@ /types/extract-zip/ @mizunashi-mana /types/eyes/ @brynbellomy /types/f1/ @neolwc -/types/fabric/ @oklemencic @joewashear007 @mrand01 +/types/fabric/ @oklemencic @joewashear007 @mrand01 @NotWoods /types/facebook-js-sdk/ @amritk /types/facebook-pixel/ @noctishsu /types/faker/v3/ @Kuniwak @@ -939,6 +976,22 @@ /types/fb/ @JoshStrobl /types/fbemitter/ @kmxz /types/featherlight/ @xStrom +/types/feathersjs__authentication/ @AbraaoAlves @j2L4e +/types/feathersjs__authentication-client/ @AbraaoAlves @j2L4e +/types/feathersjs__authentication-jwt/ @j2L4e +/types/feathersjs__authentication-local/ @j2L4e +/types/feathersjs__authentication-oauth1/ @j2L4e +/types/feathersjs__authentication-oauth2/ @j2L4e +/types/feathersjs__configuration/ @j2L4e +/types/feathersjs__errors/ @j2L4e +/types/feathersjs__express/ @j2L4e +/types/feathersjs__feathers/ @j2L4e @AbraaoAlves +/types/feathersjs__primus/ @j2L4e +/types/feathersjs__primus-client/ @j2L4e +/types/feathersjs__rest-client/ @j2L4e +/types/feathersjs__socket-commons/ @j2L4e +/types/feathersjs__socketio/ @j2L4e +/types/feathersjs__socketio-client/ @j2L4e /types/feedme/ @codeanimal /types/feedparser/ @cortopy /types/fetch-jsonp/ @tkrotoff @@ -954,11 +1007,12 @@ /types/file-type/ @tcaesvk @BendingBender /types/file-url/ @coderslagoon /types/filenamify/ @rokt33r -/types/filesize/ @GiedriusGrabauskas +/types/filesize/ @GiedriusGrabauskas @renchap /types/fill-pdf/ @westy92 /types/finalhandler/ @chrootsu /types/finch/ @DavidSichau /types/find/ @andypyrope +/types/find-root/ @Alorel /types/find-up/ @BendingBender /types/findup-sync/ @Bartvds @ngbrown /types/fingerprintjs/ @zaneli @@ -986,6 +1040,7 @@ /types/fm-websync/ @markusmauch /types/fontfaceobserver/ @RandScullard /types/fontoxml/ @rolandzwaga +/types/forever-agent/ @yavanosta /types/forever-monitor/ @shuntksh /types/forge-di/ @adamcarr /types/form-data/ @soywiz @leonyu @BendingBender @@ -995,6 +1050,7 @@ /types/format-io/ @amitbeck /types/format-unicorn/ @kruncher /types/formidable/ @Nemo157 +/types/forms/ @suXinjke /types/forwarded/ @BendingBender /types/fossil-delta/ @endel /types/foundation/ @borisyankov @@ -1028,12 +1084,11 @@ /types/ftpd/ @rogierschouten /types/fullname/ @kayahr /types/fullpage.js/ @jodiwarren -/types/fuse/ @smrq /types/fusioncharts/ @rohitkr @shivarajkv /types/fuzzaldrin/ @mhegazy /types/fuzzaldrin-plus/ @jeancroy @jkillian -/types/fuzzyset/ @lgrignon -/types/fuzzyset.js/ @lgrignon +/types/fuzzyset/ @lgrignon @narainsagar +/types/fuzzyset.js/ @lgrignon @narainsagar /types/fxn/ @charrondev /types/gae.channel.api/ @vvakame /types/gamequery/ @Laubi @@ -1176,6 +1231,7 @@ /types/gapi.youtube/ @sgtfrankieboy /types/gapi.youtubeanalytics/ @sgtfrankieboy /types/gaussian/ @scttcper +/types/geetest/ @plantain-00 /types/gen-readlines/ @CodeAnimal /types/generic-functions/ @stpettersens /types/generic-pool/ @jerray @@ -1186,9 +1242,12 @@ /types/geokdbush/ @DenisCarriere /types/geometry-dom/ @nakakura /types/geopattern/ @Gaelan +/types/get-caller-file/ @ajafff /types/get-node-dimensions/ @vincekovacs /types/get-stdin/ @DanielRosenwasser /types/get-stream/ @douglasduteil @BendingBender +/types/get-value/ @DanielRosenwasser +/types/getopts/ @azasypkin /types/getos/ @BendingBender /types/gettext.js/ @jucrouzet /types/gifffer/ @gatimus @@ -1214,7 +1273,7 @@ /types/gm/ @ChaosinaCan @maartenvanvliet /types/go/ @NorthwoodsSoftware /types/google-adwords-scripts/ @jafaircl -/types/google-apps-script/ @motemen +/types/google-apps-script/ @motemen @grant /types/google-apps-script-oauth2/ @dhayab /types/google-cloud__datastore/ @beaulac /types/google-cloud__pubsub/ @pheromonez @@ -1238,9 +1297,11 @@ /types/graceful-fs/ @Bartvds @BendingBender /types/graham_scan/ @hberntsen /types/graphite-udp/ @EricByers -/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal +/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio /types/graphql-date/ @enaeseth +/types/graphql-iso-date/ @jwaldrip /types/graphql-relay/ @arvitaly @nitintutlani @Grelinfo +/types/graphql-resolve-batch/ @nayni /types/graphql-type-json/ @schfkt /types/graphviz/ @mhfrantz /types/grasp/ @agnoster @@ -1250,10 +1311,11 @@ /types/grecaptcha/v0/ @brentj73 /types/grecaptcha/ @DethAriel /types/gregorian-calendar/ @cwalv +/types/grid-styled/ @antonvasin /types/gridfs-stream/ @liorm /types/gridstack/ @PascalSenn @ZoolWay @Sl1MBoy /types/grunt/ @jeffmay @basarat -/types/gsap/ @codebelt @ProbablePrime +/types/gsap/ @codebelt @ProbablePrime @philipbulley /types/guid/ @maroy1986 /types/gulp/ @GiedriusGrabauskas /types/gulp-angular-templatecache/ @amanmahajan7 @@ -1331,7 +1393,8 @@ /types/hapi/v8/ @jasonswearingen /types/hapi/v12/ @jasonswearingen /types/hapi/v15/ @jasonswearingen -/types/hapi/ @jasonswearingen @AJamesPhillips +/types/hapi/v16/ @jasonswearingen @AJamesPhillips +/types/hapi/ @BorntraegerMarc @rafaelsouzaf @jhsimms /types/hapi-auth-basic/ @AJamesPhillips @saboya /types/hapi-auth-jwt2/ @warrenseymour /types/hapi-decorators/ @kenhowardpdx @@ -1346,13 +1409,14 @@ /types/hashids/ @pocesar /types/hashmap/ @outring /types/haversine/ @screendriver +/types/hbs/ @davidm77 /types/he/ @sedwards2009 /types/headroom/ @hakubo /types/heap/ @ryan10132 /types/heapdump/ @weekens /types/heatmap.js/ @lookuptable @rhys-vdw /types/hedron/ @dborysov -/types/hellojs/ @PavelPZ @vuorinem +/types/hellojs/ @PavelPZ @vuorinem @baywet /types/hellosign-embedded/ @xt0rted /types/helmet/ @cyrilschumacher @EvanHahn @bluehatbrit /types/heredatalens/ @denyo @@ -1395,7 +1459,7 @@ /types/http-codes/ @mhegazy /types/http-context/ @mtraynham /types/http-errors/ @tkrotoff @BendingBender -/types/http-proxy/ @SomaticIT +/types/http-proxy/ @SomaticIT @Raigen /types/http-proxy-agent/ @mrmlnc /types/http-proxy-middleware/ @zebMcCorkle @BendingBender /types/http-server/ @plantain-00 @@ -1406,6 +1470,7 @@ /types/hubspot-pace/ @borislavjivkov /types/humane/ @jmvrbanac /types/humanize-plus/ @DenisCarriere +/types/humanize-string/ @ragnarok56 /types/humanparser/ @MichalPodeszwa /types/humps/ @nikeee /types/hyco-ws/ @mrcabellom @@ -1443,12 +1508,12 @@ /types/imap/ @psnider /types/imap-simple/ @pushplay /types/imgur-rest-api/ @lukewestby -/types/immutability-helper/ @seansfkelley /types/impress/ @borisyankov /types/in-range/ @DanielRosenwasser /types/incremental-dom/ @basarat @lanthaler @vvakame /types/indent-string/ @mhegazy -/types/inert/ @nycdotnet @AJamesPhillips +/types/inert/v4/ @nycdotnet @AJamesPhillips +/types/inert/ @nycdotnet @AJamesPhillips @lenovouser /types/inflected/ @dsci /types/inflection/ @shiwano /types/inherits/ @chrootsu @@ -1477,6 +1542,7 @@ /types/iota.lib.js/ @fogsh /types/ip/ @codeanimal /types/ip-regex/ @unindented +/types/ipcheck/ @bengry /types/irc/ @phillips1012 /types/iron/ @simonschick @rafaelsouzaf /types/is/ @cabralRodrigo @@ -1488,6 +1554,7 @@ /types/is-compressed/ @mhegazy /types/is-finite/ @mhegazy /types/is-glob/ @mrmlnc +/types/is-hotkey/ @petester42 /types/is-ip/ @coderslagoon /types/is-my-json-valid/ @kruncher /types/is-negated-glob/ @ajafff @@ -1508,6 +1575,7 @@ /types/is-windows/ @mizunashi-mana /types/isbn-utils/ @elhaard /types/iscroll/ @csrakowski +/types/ismobilejs/ @Ty3uK /types/iso-3166-2/ @sicilica /types/iso8601-localizer/ @avielfedida /types/isomorphic-fetch/ @toddlucas @@ -1525,7 +1593,7 @@ /types/jade/ @panuhorsmalahti /types/jalaali-js/ @alitaheri /types/japanese-holidays/ @syamatoo -/types/jasmine/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software +/types/jasmine/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software @Engineer2B /types/jasmine-ajax/ @lgrignon /types/jasmine-data_driven_tests/ @AnthonyMacKinnon /types/jasmine-enzyme/ @bolatovumar @@ -1549,7 +1617,7 @@ /types/jdataview/ @RReverser /types/jdenticon/ @mtr /types/jest/v16/ @NoHomey @jwbay -/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil +/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @AhnpGit /types/jest-diff/ @myabc /types/jest-docblock/ @ikatyang /types/jest-get-type/ @myabc @@ -1562,11 +1630,12 @@ /types/jjv/ @Nemo157 /types/jjve/ @Nemo157 /types/jmespath/ @pushplay -/types/johnny-five/ @nakakura +/types/johnny-five/ @nakakura @ujvzolee @workshop2 /types/joi/v6/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW /types/joi/v10/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku -/types/joi/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus +/types/joi/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun /types/joigoose/ @boothwhack +/types/josa/ @vichyssoise /types/jpeg-js/ @DanielRosenwasser /types/jpm/ @github-account-because-they-want-it /types/jqgrid/ @lokeshpeta @@ -1576,7 +1645,9 @@ /types/jquery/ @leonard-thieu @borisyankov @choffmeister @Steve-Fenton @Diullei @tasoili @jasons-novaleaf @seanski @Guuz @ksummerlin @basarat @nwolverson @derekcicerone @AndrewGaspar @seikichi @benjaminjackman @s093294 @JoshStrobl @johnnyreilly @DickvdBrink @King2500 /types/jquery-ajax-chain/ @humana-fragilitas /types/jquery-alertable/ @stever +/types/jquery-awesome-cursor/ @zskovacs /types/jquery-backstretch/ @dkulyk +/types/jquery-countdown/ @AndersonFriaca /types/jquery-cropbox/ @PerKastman /types/jquery-deparam/ @patsissons /types/jquery-easy-loading/ @delphinus35 @@ -1587,7 +1658,9 @@ /types/jquery-jcrop/ @joeskeen /types/jquery-jsonrpcclient/ @Ty3uK /types/jquery-knob/ @iain8 -/types/jquery-mask-plugin/ @avidenic +/types/jquery-lazyload/ @AndersonFriaca +/types/jquery-mask-plugin/ @avidenic @AndersonFriaca +/types/jquery-maskmoney/ @AndersonFriaca /types/jquery-match-height/ @kbytesys /types/jquery-mockjax/ @laszlojakab @vladeck /types/jquery-mousewheel/ @xt0rted @@ -1595,6 +1668,8 @@ /types/jquery-param/ @patsissons /types/jquery-sortable/ @Seltzer /types/jquery-steps/ @jblank @nickwph +/types/jquery-sticky/ @maixiu +/types/jquery-tags-input/ @AndersonFriaca /types/jquery-timeentry/ @marknadig /types/jquery-toastmessage-plugin/ @joeskeen /types/jquery-truncate-html/ @abraaoalves @@ -1649,6 +1724,7 @@ /types/jquery.slimscroll/ @Promact /types/jquery.soap/ @tigerxy /types/jquery.sortelements/ @tbureck +/types/jquery.stickem/ @davidmpaz /types/jquery.superlink/ @niemyjski /types/jquery.tagsmanager/ @vbortone /types/jquery.tile/ @zaneli @@ -1679,6 +1755,7 @@ /types/js-quantities/ @wrummler /types/js-schema/ @marcinporebski @roblabat /types/js-search/ @guoyunhe +/types/js-sha512/ @nicojs /types/js-to-java/ @skyitachi /types/js-url/ @pine613 /types/js-yaml/ @Bartvds @sclausen @@ -1696,7 +1773,9 @@ /types/jshamcrest/ @dharkness /types/jsmockito/ @shiver-me-timbers /types/jsnox/ @stkb @DovydasNavickas +/types/json-js/ @NN--- /types/json-merge-patch/ @senyaarseniy +/types/json-parse-better-errors/ @DanielRosenwasser /types/json-patch/ @vvakame /types/json-pointer/ @Bartvds /types/json-query/ @mtraynham @@ -1714,12 +1793,14 @@ /types/jsonnet/ @hookclaw /types/jsonp/ @surenkov /types/jsonpath/ @horiuchi @ikatyang -/types/jsonrpc-serializer/ @Akim95 +/types/jsonrpc-serializer/ @Akim95 @many20 /types/jsonstream/ @Bartvds +/types/jsontoxml/ @benstevens48 /types/jsonwebtoken/ @SomaticIT @danielheim @brikou /types/jspdf/ @amberjs /types/jsqrcode/ @lordazzi /types/jsrender/ @zakki +/types/jsreport-core/ @taoqf /types/jsrp/ @harryshipton /types/jss/ @appsforartists @kof /types/jssha/ @randombk @SrTobi @@ -1737,7 +1818,7 @@ /types/jui-core/ @easylogic /types/jui-grid/ @easylogic /types/jweixin/ @taoqf @gomydodo -/types/jwplayer/ @martinduparc @kutomer +/types/jwplayer/ @martinduparc @kutomer @philippguertler /types/jws/ @JustinBeckwith /types/jwt-client/ @timoteoponce /types/jwt-decode/v1/ @QuatroDevOfficial @@ -1767,6 +1848,7 @@ /types/klaw/v1/ @mceachen /types/klaw/ @mceachen /types/klaw-sync/ @shiftkey +/types/kms-json/ @sunnyone /types/knex/ @tkQubo @baronfel @MeLlamoPablo @mastermatt @micksatana /types/knex-postgis/ @vesse /types/knockback/ @borisyankov @@ -1807,7 +1889,8 @@ /types/koa-logger/ @geoffreak @tlaziuk /types/koa-logger-winston/ @stevehipwell /types/koa-morgan/ @vesse -/types/koa-mount/ @amirsaber +/types/koa-mount/ @amirsaber @tlaziuk +/types/koa-multer/ @benstevens48 /types/koa-passport/ @horiuchi @tlaziuk @brendtumi /types/koa-pino-logger/ @khell /types/koa-pug/ @Xstoudi @@ -1816,7 +1899,7 @@ /types/koa-route/ @migstopheles /types/koa-router/ @hellopao @schfkt /types/koa-send/ @pe8ter @tlaziuk -/types/koa-session/ @kerol2r20 +/types/koa-session/ @kerol2r20 @tlaziuk /types/koa-session-minimal/ @longztian /types/koa-sslify/ @wingsbob /types/koa-static/ @hellopao @tlaziuk @@ -1855,6 +1938,7 @@ /types/leaflet-gpx/ @soucekv /types/leaflet-imageoverlay-rotated/ @tkleinke /types/leaflet-label/ @Nemo157 +/types/leaflet-mouse-position/ @Hanyon /types/leaflet-polylinedecorator/ @soucekv /types/leaflet-providers/ @BendingBender /types/leaflet-rotatedmarker/ @robert-prib-polestar @@ -1866,7 +1950,6 @@ /types/leaflet.locatecontrol/ @DenisCarriere /types/leaflet.markercluster/ @rimig /types/leaflet.markercluster.layersupport/ @AsamK -/types/leaflet.mouseposition/ @Hanyon /types/leaflet.pancontrol/ @Brictarus /types/leaflet.pm/ @tkleinke /types/leaflet.polylinemeasure/ @RiON69 @@ -1890,7 +1973,6 @@ /types/line-by-line/ @etomsen /types/line-reader/ @stpettersens /types/linkify-it/ @praxxis -/types/linq4js/ @morrisjdev /types/lls/ @borislavjivkov /types/load-json-file/ @SamVerschueren /types/loader-runner/ @e-cloud @@ -1898,7 +1980,6 @@ /types/loadware/ @ALyman /types/lobibox/ @itboy87 /types/local-dynamo/ @Sicilica -/types/localforage-cordovasqlitedriver/ @thgreasi /types/localized-countries/ @coderslagoon /types/localizejs-library/ @salbahra /types/locate-path/ @me @@ -1907,7 +1988,7 @@ /types/lockr/ @droritos /types/locutus/ @hookclaw /types/lodash/v3/ @bczengel @chrootsu -/types/lodash/ @bczengel @chrootsu @stepancar @ericanderson @aj-r @ailrun @e-cloud @thorn0 @jtmthf +/types/lodash/ @bczengel @chrootsu @stepancar @aj-r @ailrun @e-cloud @thorn0 @jtmthf @DomiR /types/lodash-es/ @stephenlautier @e-cloud /types/lodash-webpack-plugin/ @bumbleblym /types/lodash.add/ @bczengel @chrootsu @stepancar @@ -2197,11 +2278,12 @@ /types/log-symbols/ @BendingBender /types/log-update/ @BendingBender /types/logat/ @krvikash35 +/types/logform/ @DABH /types/logg/ @blittle /types/loggly/ @rmartone @geoffreak /types/loglevel/ @Pro @szmeti @screendriver /types/logrotate-stream/ @rogierschouten -/types/lokijs/ @TeamworkGuy2 +/types/lokijs/ @TeamworkGuy2 @thomasconner /types/lolex/ @Nemo157 @joshuakgoldberg @rogierschouten /types/long/ @peterkooijmans /types/loopback/ @kattsushi @enko @sequoia @drmikecrowe @@ -2220,7 +2302,7 @@ /types/lunr/v0/ @sebastian-lenz /types/lunr/ @seantanly /types/lusca/ @crutchcorn -/types/luxon/ @colbydehart @FourwingsY +/types/luxon/ @colbydehart @FourwingsY @jsiebern /types/lwip/ @AyaMorisawa /types/lz-string/ @M0ns1gn0r /types/magic-number/ @stpettersens @@ -2255,15 +2337,36 @@ /types/massive/v3/ @swissspidy @clarenceh /types/massive/ @swissspidy @clarenceh @AmazingTurtle /types/match-media-mock/ @asvetliakov +/types/material-components-web/ @BrentDouglas /types/material-design-lite/ @bradzacher /types/material-ui/ @ngbrown @theigor @alitaheri @herrmanno @DaIgeb @allienna @schlesingermatthias @InsidersByte @artyomsv @dan-j @minodisk /types/material-ui-datatables/ @coding2012 -/types/materialize-css/v0/ @eriklieben @leonyu @SinghSukhdeep @jfcere @scote +/types/material__animation/ @BrentDouglas +/types/material__auto-init/ @BrentDouglas +/types/material__base/ @BrentDouglas +/types/material__checkbox/ @BrentDouglas +/types/material__dialog/ @BrentDouglas +/types/material__drawer/ @BrentDouglas +/types/material__form-field/ @BrentDouglas +/types/material__grid-list/ @BrentDouglas +/types/material__icon-toggle/ @BrentDouglas +/types/material__linear-progress/ @BrentDouglas +/types/material__menu/ @BrentDouglas +/types/material__radio/ @BrentDouglas +/types/material__ripple/ @BrentDouglas +/types/material__select/ @BrentDouglas +/types/material__selection-control/ @BrentDouglas +/types/material__slider/ @BrentDouglas +/types/material__snackbar/ @BrentDouglas +/types/material__tabs/ @BrentDouglas +/types/material__textfield/ @BrentDouglas +/types/material__toolbar/ @BrentDouglas +/types/materialize-css/v0/ @eriklieben @leonyu @SinghSukhdeep @jfcere @scote @LiadIdan /types/materialize-css/ @huww98 /types/math3d/ @laszlojakab @jimsmart /types/mathjax/ @rolandzwaga /types/mathjs/ @siavol -/types/matter-js/ @piranha771 +/types/matter-js/ @piranha771 @hasparus /types/maxmind/ @geoffreak /types/mcustomscrollbar/ @flurg /types/md5/ @arcdev1 @jprogrammer @@ -2277,10 +2380,11 @@ /types/memory-cache/ @jedigo @thieman /types/memory-fs/ @e-cloud /types/memwatch-next/ @cyrilschumacher -/types/meow/ @KnisterPeter +/types/meow/ @KnisterPeter @praxxis /types/merge-descriptors/ @danny8002 /types/merge-stream/ @k-kagurazaka @daniel-zazula /types/merge2/ @tkrotoff @smac89 +/types/merkle/ @kerol2r20 /types/mersenne-twister/ @KentarouTakeda /types/meshblu/ @fnipo /types/mess/ @Nemo157 @@ -2315,6 +2419,7 @@ /types/minimatch/ @vvakame @shantmarouti /types/minimist/ @Bartvds @Necroskillz @kamranayub /types/minimist-options/ @ikatyang +/types/minio/ @barinbritva /types/minipass/ @BendingBender /types/mirrorx/ @aaronphy /types/mithril/ @spacejack @andraaspar @isiahmeadows @@ -2326,7 +2431,9 @@ /types/mkpath/ @optical /types/mobx-apollo/ @pselden /types/mocha/ @kazimanzurrashid @otiai10 @jt000 @enlight +/types/mocha-each/ @magnostherobot /types/mocha-phantomjs/ @ErikSchierboom +/types/mocha-steps/ @Arylo /types/mochaccino/ @thomas-p /types/mock-aws-s3/ @bluehatbrit /types/mock-fs/ @Nemo157 @tkqubo @@ -2340,15 +2447,18 @@ /types/moji/ @yasupeke /types/moment-business/ @wonbyte /types/moment-business-time/ @swist -/types/moment-duration-format/ @SwintDC @TwoStone @leonard-thieu +/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-round/ @jacobbaskin /types/moment-strftime2/ @dex4er /types/moment-timezone/ @michelsalib @alanblins +/types/mongo-sanitize/ @CedricCazin +/types/mongodb/v2/ @CaselIT @alanmarcell @kikar @bitjson @dante-101 @mcortesi /types/mongodb/ @CaselIT @alanmarcell @kikar @bitjson @dante-101 @mcortesi -/types/mongoose/ @simonxca @horiuchi @sindrenm @lukasz-zak +/types/mongoose/v4/ @simonxca @horiuchi @sindrenm @lukasz-zak +/types/mongoose/ @simonxca @horiuchi @sindrenm @lukasz-zak @Alorel @jendrikw @ethanresnick /types/mongoose-auto-increment/ @AyaMorisawa /types/mongoose-deep-populate/ @AyaMorisawa /types/mongoose-geojson-schema/ @bondz @@ -2367,6 +2477,7 @@ /types/move-concurrently/ @mgroenhoff /types/moviedb/ @basarat @0x6368656174 /types/moxios/ @itoasuka +/types/mozilla-readability/ @charlesvdv /types/mpromise/ @sgkim126 /types/mri/ @shiftkey @j-f1 /types/ms/ @danny8002 @@ -2385,7 +2496,7 @@ /types/multiparty/ @kenfdev /types/multiplexjs/ @KamyarNazeri /types/multisort/ @CzBuCHi -/types/multistream/ @mrmlnc +/types/multistream/ @mrmlnc @kenzierocks /types/murmurhash-js/ @cvle /types/murmurhash3js/ @dlee-nvisia /types/musicmetadata/ @Xstoudi @@ -2396,6 +2507,7 @@ /types/n3/ @phreed /types/nano/ @timjacobi @vincekovacs /types/nanoajax/ @nathancahill +/types/nanoid/ @bash /types/nanomsg/ @titan /types/nanoscroller/ @zihark17 /types/nanp/ @karn @@ -2405,7 +2517,7 @@ /types/natural-sort/ @a-morales /types/navigation/ @grahammendick /types/navigation-react/ @grahammendick -/types/navigo/ @aersamkull +/types/navigo/ @aersamkull @dancespiele /types/nblas/ @erikgerrits /types/nconf/ @jedigo @jmthibault /types/ncp/ @bartvds @@ -2421,6 +2533,9 @@ /types/nes/ @NoHomey @saboya /types/net-keepalive/ @hertzg /types/netmask/ @mhfrantz +/types/new-relic-browser/ @renehamburger @piotrkubisa +/types/newline-remove/ @OpenByteDev +/types/newrelic/ @mastermatt /types/nexpect/ @vvakame /types/next/ @dru89 @brikou /types/next-redux-wrapper/ @stevegeek @@ -2447,19 +2562,20 @@ /types/nightmare/ @horiuchi @samyang-au /types/nightwatch/ @rkavalap @schlesiger /types/noble/ @swook @wind-rider @shantanubhadoria @lukel99 @bioball @keton -/types/nock/ @bonnici @horiuchi @afharo @mastermatt +/types/nock/ @bonnici @horiuchi @afharo @mastermatt @damour /types/nodal/ @charrondev /types/node/v4/ @eps1lon -/types/node/v6/ @WilcoBakker @inlined @eps1lon +/types/node/v6/ @WilcoBakker @inlined @eps1lon @Alorel /types/node/v7/ @parambirs @tellnes @WilcoBakker @eps1lon -/types/node/v8/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno -/types/node/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff +/types/node/v8/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 +/types/node/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 /types/node-7z/ @erkie /types/node-array-ext/ @Beng89 /types/node-cache/ @chrootsu @dthunell @useltmann /types/node-calendar/ @luzianz /types/node-cleanup/ @agadar /types/node-common-errors/ @icopp +/types/node-cron/ @maximelkin /types/node-dir/ @panuhorsmalahti /types/node-dogstatsd/ @chrisbobo /types/node-emoji/ @jonestristand @styu @@ -2478,7 +2594,6 @@ /types/node-json-db/ @kuzn-ilya /types/node-mysql-wrapper/ @kataras /types/node-notifier/ @tkQubo -/types/node-pg-migrate/ @bradleyayers /types/node-polyglot/ @timjk /types/node-powershell/ @rodrigoff /types/node-ral/ @ssddi456 @@ -2494,7 +2609,6 @@ /types/node-uuid/ @jeffmay /types/node-validator/ @kengorab /types/node-vault/ @YuJianrong -/types/node-waves/ @stephenlautier /types/node-wit/ @julienduf /types/node-xmpp-client/ @PJakcson /types/node-xmpp-core/ @PJakcson @@ -2527,6 +2641,7 @@ /types/novnc-core/ @smithkl42 @BendingBender /types/npm/ @SomaticIT /types/npm-package-arg/ @mgroenhoff +/types/npm-packlist/ @ajafff /types/ns-api/ @Archcry /types/nslog/ @unindented /types/nsqjs/ @cezaryrk @@ -2549,6 +2664,7 @@ /types/object-hash/ @misak113 /types/object-inspect/ @demurgos /types/object-map/ @wolfgang42 +/types/object-merge/ @OpenByteDev /types/object-path/ @pocesar /types/object-refs/ @3fd /types/oblo-util/ @Oblosys @@ -2557,10 +2673,11 @@ /types/oclazyload/ @rolandzwaga /types/odata/ @janhommes @jcchalte /types/ofe/ @Morfent -/types/office-js/ @OfficeDev @LanceEA +/types/office-js/ @OfficeDev @LanceEA @Zlatkovsky @kbrandl @Rick-Kirkham /types/offline-js/ @cgwrench /types/oibackoff/ @geoffreak /types/oidc-token-manager/ @rosieks +/types/ol/ @yairtawil /types/on-finished/ @czechboy0 @BendingBender /types/on-headers/ @jjeffery @BendingBender /types/once/ @denis-sokolov @BendingBender @@ -2574,16 +2691,16 @@ /types/openjscad/ @danmarshall /types/openlayers/v2/ @bolhovsky /types/openlayers/v3/ @osechet @matthiasdailey-ccri -/types/openlayers/ @osechet @wb14123 @ailrun @mylen @iamthechad @danmana +/types/openlayers/ @osechet @wb14123 @ailrun @mylen @iamthechad @danmana @yairtawil @pierremarc /types/openstack-wrapper/ @sanjaymadane /types/opentok/ @westy92 @CatGuardian -/types/opentype.js/ @danmarshall +/types/opentype.js/ @danmarshall @edzis /types/opn/ @shinnn @SomaticIT @tlent /types/optics-agent/ @crevil /types/optimist/ @soywiz @chbrown /types/optimize-css-assets-webpack-plugin/ @odnamrataizem /types/ora/v0/ @screendriver -/types/ora/ @basarat @screendriver @BendingBender +/types/ora/ @basarat @screendriver @BendingBender @azasypkin /types/oracledb/ @Bigous /types/orchestrator/ @tkQubo @TeamworkGuy2 /types/orderedmap/ @bradleyayers @@ -2593,7 +2710,7 @@ /types/os-locale/ @AyaMorisawa @BendingBender /types/os-name/ @BendingBender /types/os-tmpdir/ @mhegazy -/types/osmosis/ @jurajkocan +/types/osmosis/ @jurajkocan @evanshortiss /types/osmtogeojson/ @tkqubo /types/osrm/ @DenisCarriere /types/otplib/ @renjfk @@ -2611,6 +2728,7 @@ /types/p-every/ @BendingBender /types/p-lazy/ @BendingBender /types/p-limit/ @BendingBender +/types/p-loading/ @renjfk /types/p-locate/ @BendingBender /types/p-log/ @BendingBender /types/p-map/ @BendingBender @@ -2641,7 +2759,10 @@ /types/paper/ @clark-stevenson @Xakaloz /types/paralleljs/ @jbaldwin /types/parent-package-json/ @sgmccli -/types/parse/ @dpoetzsch @jaeggerr @flavionegrao +/types/parity-pmd/ @leovujanic @jewbre +/types/parity-pmr/ @leovujanic +/types/parity-poe/ @leovujanic +/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes /types/parse-git-config/ @leonard-thieu /types/parse-glob/ @glen-84 /types/parse-json/ @mrmlnc @@ -2653,7 +2774,7 @@ /types/parse-unit/ @Jack-Works /types/parseurl/ @bomret /types/parsimmon/ @Bartvds @mizunashi-mana @bcherny @bvanreeven @leonard-thieu -/types/passport/ @horiuchi @enaeseth @theigor @tlaziuk +/types/passport/ @horiuchi @enaeseth @theigor @tlaziuk @danielpa9708 /types/passport-anonymous/ @0x6368656174 /types/passport-beam/ @AtlasDev /types/passport-discord/ @kzay @@ -2663,10 +2784,13 @@ /types/passport-github2/ @yasupeke @mthmulders /types/passport-google-oauth/ @staticfunction /types/passport-google-oauth2/ @bluehatbrit -/types/passport-http/ @krizalys +/types/passport-http/ @krizalys @tlaziuk @cjbarth /types/passport-http-bearer/ @isman-usoh +/types/passport-jwt/ @jindev +/types/passport-kakao/ @Park9eon /types/passport-local/ @SomaticIT /types/passport-local-mongoose/ @linusbrolin +/types/passport-naver/ @Park9eon /types/passport-oauth2/ @pasieronen /types/passport-oauth2-client-password/ @akaNightmare /types/passport-saml/ @cjbarth @@ -2741,7 +2865,7 @@ /types/playcanvas/ @Neoflash1979 /types/playerframework/ @ricardosabino /types/pleasejs/ @nakakura -/types/plotly.js/ @chrisgervang @martinduparc @frederikaalund @taoqf +/types/plotly.js/ @chrisgervang @martinduparc @frederikaalund @taoqf @Dadstart /types/plugapi/ @BNedry /types/plugin-error/ @rogierschouten /types/plupload/ @patrickbussmann @@ -2802,6 +2926,7 @@ /types/promise-pg/ @coldacid /types/promise-polyfill/ @skysteve /types/promise-pool/ @vilic +/types/promise-queue/ @LachlanStuart /types/promise-retry/ @shirakaba /types/promise.prototype.finally/ @slavik57 @BendingBender /types/promised-temp/ @rokadias @@ -2820,7 +2945,7 @@ /types/prosemirror-keymap/ @bradleyayers @davidka @timjb /types/prosemirror-markdown/ @bradleyayers @davidka @timjb /types/prosemirror-menu/ @bradleyayers @davidka @timjb -/types/prosemirror-model/ @bradleyayers @davidka @timjb +/types/prosemirror-model/ @bradleyayers @davidka @timjb @neknalb /types/prosemirror-schema-basic/ @bradleyayers @davidka @timjb /types/prosemirror-schema-list/ @bradleyayers @davidka @timjb /types/prosemirror-state/ @bradleyayers @davidka @timjb @@ -2835,18 +2960,19 @@ /types/proxyquire/ @jt000 /types/pty.js/ @enlight /types/public-ip/ @BendingBender -/types/pubnub/ @bitbankinc @rollymaduk +/types/pubnub/ @bitbankinc @rollymaduk @vitosamson /types/pubsub-js/ @borisyankov /types/pug/ @TonyPythoneer @19majkel94 -/types/pulltorefreshjs/ @DanielRosenwasser +/types/pulltorefreshjs/ @DanielRosenwasser @humpedli /types/pump/ @tlaziuk /types/pupa/ @nju33 -/types/puppeteer/ @marvinhagemeister @cdeutsch +/types/puppeteer/v0/ @marvinhagemeister @cdeutsch +/types/puppeteer/ @marvinhagemeister @cdeutsch @jwbay /types/pure-render-decorator/ @seansfkelley /types/purl/ @danfma /types/pusher-js/ @tkqubo /types/pvutils/ @microshine -/types/python-shell/ @dolanmiu +/types/python-shell/ @dolanmiu @WORMSS /types/q/v0/ @bnemetchek @johnnyreilly /types/q/ @bnemetchek @AndrewGaspar @johnnyreilly @mboudreau /types/q-io/ @Bartvds @@ -2859,7 +2985,7 @@ /types/qrcode.react/ @mleko /types/qs/ @RWander @leonyu @tehbelinda @zyml @artursvonda @CarlosBonetti /types/qtip2/ @Seltzer @leonard-thieu -/types/query-string/ @SamVerschueren @tkrotoff @huhuanming +/types/query-string/ @SamVerschueren @tkrotoff @huhuanming @MadaraUchiha /types/quick-lru/ @BendingBender /types/quill/ @sumitkm @guillaume-ro-fr @43081j /types/quixote/ @greybax @@ -2871,8 +2997,9 @@ /types/rabbit.js/ @wokim /types/radium/ @alexgorbatchev @nupplaphil @asvetliakov @mihe /types/radius/ @codeanimal -/types/ramda/ @donnut @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @charlespwd @samsonkeung @angeloocana @raynerd @googol @moshensky +/types/ramda/ @donnut @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @charlespwd @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick /types/random-js/ @pistacchio +/types/random-number/ @OpenByteDev /types/random-seed/ @endel /types/random-string/ @stpettersens /types/randomcolor/ @feitzi @BradyLiles @@ -2882,7 +3009,14 @@ /types/rappid/ @DenEwout /types/raspi/ @nebrius /types/raspi-board/ @nebrius +/types/raspi-gpio/ @nebrius +/types/raspi-i2c/ @nebrius +/types/raspi-led/ @nebrius +/types/raspi-onewire/ @nebrius /types/raspi-peripheral/ @nebrius +/types/raspi-pwm/ @nebrius +/types/raspi-serial/ @nebrius +/types/raspi-soft-pwm/ @nebrius /types/ratelimiter/ @AyaMorisawa /types/raty/ @terrawheat /types/raven/ @scttcper @1999 @@ -2904,13 +3038,14 @@ /types/react-aria-menubutton/ @forabi @crohlfs /types/react-autosuggest/ @nicolas-schmitt @pjo256 @robessog @tbayne @cdeutsch @rosskevin /types/react-beautiful-dnd/ @varHarrie @bradleyayers +/types/react-big-calendar/ @piotrwitek @paustint @pikpok /types/react-body-classname/ @mhegazy /types/react-bootstrap/ @walkerburgin @vsiao @danilojrr @Batbold-Gansukh @octatone @chengsieuly @mretolaza @katbusch @vitosamson @LKay @aaronbeall /types/react-bootstrap-date-picker/ @LKay @ssi-hu-antal-bodnar /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 +/types/react-bootstrap-typeahead/ @Guymestef @radziksh /types/react-breadcrumbs/ @KostyaEsmukov /types/react-breadcrumbs-dynamic/ @mitsuruog /types/react-broadcast/ @kandros @@ -2918,12 +3053,13 @@ /types/react-calendar-heatmap/ @9renpoto /types/react-calendar-timeline/ @radziksh /types/react-cartographer/ @trevonmckay +/types/react-click-outside/ @screendriver /types/react-codemirror/ @velveret @rudi-c /types/react-collapse/ @Kimahriman /types/react-color/ @LKay @markspolakovs @mntdn /types/react-confirm/ @santiagodoldan /types/react-content-loader/ @alaatm -/types/react-copy-to-clipboard/ @mabels +/types/react-copy-to-clipboard/ @mabels @BernabeFelix /types/react-cropper/ @stepancar /types/react-css-modules/ @KostyaEsmukov @skirsdeda /types/react-css-transition-replace/ @LKay @@ -2933,7 +3069,7 @@ /types/react-data-grid/ @SupernaviX @KieranPeat @martinnov92 /types/react-datagrid/ @stephenjelfs /types/react-date-range/ @Junbong -/types/react-datepicker/ @radziksh @andrewBalekha @smrq @Rogach @royxue +/types/react-datepicker/ @radziksh @andrewBalekha @smrq @Rogach @royxue @KoalaHuman /types/react-daterange-picker/ @uncovertruth @MartynasZilinskas /types/react-dates/ @Artur-A /types/react-daum-postcode/ @Sa-ryong @@ -2948,13 +3084,15 @@ /types/react-dropzone/v2/ @matdube @LynxEyes @goblindegook @benbayard /types/react-dropzone/v3/ @matdube @LynxEyes @goblindegook @benbayard @LKay /types/react-dropzone/ @matdube @LynxEyes @goblindegook @benbayard @LKay @codeaid @jurosh +/types/react-dynamic-number/ @eugrdn /types/react-easy-chart/ @danzel /types/react-event-listener/ @asvetliakov /types/react-fa/ @flaub @patsissons @LKay /types/react-facebook-login/ @apare @jankarres -/types/react-faux-dom/ @alitaheri @cleverguy25 +/types/react-faux-dom/ @alitaheri @cleverguy25 @deviousm /types/react-file-input/ @dmitryrogozhny /types/react-file-reader-input/ @dmitryrogozhny @alitaheri +/types/react-flags-select/ @senukartur /types/react-flatpickr/ @begincalendar /types/react-flex/ @pushplay /types/react-flexr/ @pushplay @@ -2969,6 +3107,7 @@ /types/react-hamburger-menu/ @grzesie2k /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-highlight-words/ @mhegazy /types/react-highlighter/ @oizie /types/react-holder/ @isman-usoh @@ -2986,7 +3125,7 @@ /types/react-input-calendar/ @stepancar /types/react-input-mask/ @apare /types/react-intl/v1/ @bgrieder -/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari +/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos /types/react-intl-redux/ @LKay /types/react-is-deprecated/ @seansfkelley /types/react-joyride/ @DanielRosenwasser @bendxn @@ -2997,7 +3136,7 @@ /types/react-lazyload/ @m0a /types/react-leaflet/ @danzel @davschne @yuit /types/react-list/ @buptyyf @tomshen -/types/react-loadable/ @Kovensky @odensc +/types/react-loadable/ @Kovensky @odensc @ianks @tlaziuk /types/react-loader/ @artfuldev /types/react-maskedinput/ @LKay @lavoaster @CarlosBonetti /types/react-mce/ @morphologue @@ -3006,7 +3145,7 @@ /types/react-mixin/ @tkqubo /types/react-modal/ @radziksh @drewnoakes @homburg @ttamminen @hallowatcher @peterblazejewicz /types/react-monaco-editor/ @jnetterf -/types/react-motion/ @stepancar @asvetliakov +/types/react-motion/ @stepancar @asvetliakov @dimitarnestorov /types/react-motion-slider/ @asvetliakov /types/react-native/ @alloy @huhuanming @iRoachie @timwangdev @kamal @nelyousfi /types/react-native-collapsible/ @iRoachie @@ -3023,19 +3162,21 @@ /types/react-native-google-signin/ @j-fro /types/react-native-keep-awake/ @huhuanming /types/react-native-linear-gradient/ @j-fro +/types/react-native-loading-spinner-overlay/ @fhelwanger /types/react-native-material-design-searchbar/ @iRoachie /types/react-native-material-kit/ @iRoachie @timwangdev /types/react-native-material-ui/ @iRoachie /types/react-native-mixpanel/ @r3nya /types/react-native-modalbox/ @iRoachie +/types/react-native-navigation/ @egorshulga /types/react-native-orientation/ @MoLow /types/react-native-popup-dialog/ @PaitoAnderson @connectdotz -/types/react-native-push-notification/ @PaitoAnderson +/types/react-native-push-notification/ @PaitoAnderson @tomSawkins /types/react-native-qrcode/ @plantain-00 /types/react-native-safari-view/ @mrand01 -/types/react-native-scrollable-tab-view/ @CaiHuan +/types/react-native-scrollable-tab-view/ @CaiHuan @egorshulga /types/react-native-sensor-manager/ @SahinVardar -/types/react-native-snap-carousel/ @jnbt +/types/react-native-snap-carousel/ @jnbt @j-fro /types/react-native-sortable-grid/ @j-fro /types/react-native-sortable-list/ @sivolobov /types/react-native-svg-uri/ @iRoachie @@ -3045,12 +3186,13 @@ /types/react-native-touch-id/ @huhuanming /types/react-native-vector-icons/ @iRoachie @timwangdev /types/react-native-video/ @huhuanming @abrahambotros -/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @abrahambotros @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko +/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @abrahambotros @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @robertohuertasm @YourGamesBeOver /types/react-notification-system/ @GiedriusGrabauskas @DeividasBakanas @LKay @sztobar /types/react-notification-system-redux/ @LKay /types/react-numeric-input/ @heatherbooker /types/react-onclickoutside/v5/ @LKay /types/react-onclickoutside/ @LKay +/types/react-onsenui/ @salim7 @jemmyw /types/react-overlays/ @aaronbeall @vitosamson /types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold /types/react-pointable/ @istefo @mdibyo @@ -3058,29 +3200,32 @@ /types/react-props-decorators/ @tkqubo /types/react-recaptcha/ @mhegazy @zzanol /types/react-redux/ @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva +/types/react-redux-epic/ @forabi /types/react-redux-i18n/ @clementdevos /types/react-redux-toastr/ @Smiche @artyomsv @kulmajaba -/types/react-relay/ @graphcool @voxmatt @alloy +/types/react-relay/ @graphcool @voxmatt @alloy @npirotte /types/react-resolver/ @forabi /types/react-responsive/v1/ @asvetliakov /types/react-responsive/ @asvetliakov @alechill @xaviergonz /types/react-router/v2/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov /types/react-router/v3/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @ssorallen -/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga +/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy /types/react-router-bootstrap/ @vlesierse @LKay @olmobrutall /types/react-router-config/ @lith-light-g /types/react-router-dom/ @tkrotoff @huy-nguyen /types/react-router-native/ @ezintz +/types/react-router-navigation/ @kaoDev +/types/react-router-navigation-core/ @kaoDev /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 /types/react-s-alert/ @mitsuruog /types/react-scroll/ @sudoplz @GiedriusGrabauskas /types/react-scrollbar/ @stephenjelfs -/types/react-select/ @Hesquibet @giladgray @iebaker @skirsdeda @vujevits @devrelm @MartynasZilinskas @onatm @ninjaferret @tehbi4 +/types/react-select/ @Hesquibet @giladgray @iebaker @skirsdeda @vujevits @devrelm @MartynasZilinskas @onatm @ninjaferret @tehbi4 @misantronic /types/react-side-effect/ @remojansen /types/react-sidebar/ @jeroenvervaeke -/types/react-sketchapp/ @ricokahler +/types/react-sketchapp/ @ricokahler @DomiR /types/react-slick/ @andrewBalekha @GiedriusGrabauskas @r3nya /types/react-smooth-scrollbar/ @asvetliakov /types/react-sortable-hoc/ @NoHomey @charlesrey @@ -3105,6 +3250,7 @@ /types/react-test-renderer/v15/ @arvitaly @lochbrunner @lochbrunner @johnnyreilly /types/react-test-renderer/ @arvitaly @lochbrunner @johnnyreilly @jgoz /types/react-tether/ @ryprice +/types/react-text-mask/ @guilhermehubner /types/react-textarea-autosize/ @asvetliakov @zry656565 /types/react-toastr/ @shssoichiro /types/react-toggle/v2/ @LKay @@ -3116,28 +3262,31 @@ /types/react-transition-group/ @LKay /types/react-treeview/ @janslow /types/react-truncate/ @mattvperry +/types/react-twitter-auth/ @paulfasola /types/react-user-tour/ @ccancellieri /types/react-virtual-keyboard/ @bsurai /types/react-virtualized/ @kaoDev @guntherjh @wasd171 @szabolcsx @kraenhansen /types/react-virtualized-select/ @seansfkelley /types/react-weui/ @tairan -/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 +/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya /types/react-widgets-moment/ @dawnmist /types/react-youtube/ @kgtkr /types/reactable/ @spielc /types/reactcss/ @chrisgervang @LKay /types/reactstrap/v4/ @alihammad @mfal @danilobjr @fabiopaiva -/types/reactstrap/ @alihammad @mfal @danilobjr @fabiopaiva @FaithForHumans @KurtPreston +/types/reactstrap/ @alihammad @mfal @danilobjr @fabiopaiva @FaithForHumans @KurtPreston @kraenhansen @timc13 /types/read/ @timjk /types/read-chunk/ @crispybee /types/read-package-tree/ @mgroenhoff /types/read-pkg/ @jdxcode /types/read-pkg-up/ @dudeofawesome @jdxcode +/types/readdir-enhanced/ @mrmlnc /types/readdir-stream/ @Bartvds /types/readline-sync/ @jonestristand +/types/readline-transform/ @dex4er /types/reapop/ @Barrokgl /types/recase/ @18steps -/types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong +/types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong @richbai90 /types/recompose/ @iskandersierra @mrapogee @clayne11 /types/reconnectingwebsocket/ @nguarracino /types/recursive-readdir/v1/ @elisee @@ -3171,6 +3320,7 @@ /types/redux-immutable-state-invariant/ @remojansen @highflying /types/redux-infinite-scroll/ @silkyfray /types/redux-injectable-store/ @unindented +/types/redux-little-router/ @priecint /types/redux-localstorage/ @LKay /types/redux-localstorage-debounce/ @LKay /types/redux-localstorage-filter/ @LKay @@ -3184,6 +3334,7 @@ /types/redux-promise-middleware/ @ianks /types/redux-recycle/ @LKay /types/redux-router/ @stepancar +/types/redux-socket.io/ @snakeego /types/redux-storage/ @asvetliakov /types/redux-storage-engine-jsurl/ @screendriver /types/redux-storage-engine-localstorage/ @screendriver @@ -3196,20 +3347,23 @@ /types/relateurl/ @tkrotoff /types/relaxed-json/ @18steps /types/relay-runtime/ @voxmatt @alloy +/types/remarkable/ @makepost /types/remote-redux-devtools/ @ColinEberhardt @unindented /types/remove-markdown/ @RagibHasin /types/replace-ext/ @DeividasBakanas /types/request/ @soywiz @bonnici @Bartvds @joeskeen @ccurrens @lookfirst @mastermatt /types/request-ip/ @mrhen -/types/request-promise/ @cglantschnig @joeskeen @AyaMorisawa -/types/request-promise-native/ @gustavohenke +/types/request-promise/ @cglantschnig @joeskeen @AyaMorisawa @mastermatt +/types/request-promise-native/ @gustavohenke @mastermatt /types/requestretry/ @EricByers @trainerbill /types/require-dir/ @weekens /types/require-directory/ @Igmat /types/require-from-string/ @ikatyang +/types/require-relative/ @MattiasBuelens /types/requirejs/ @jbaldwin /types/requirejs-domready/ @lefb766 /types/resemblejs/ @pimterry +/types/reservoir/ @danvk /types/resolve/ @marionebl @ajafff /types/resolve-from/ @unional /types/resourcejs/ @shaunluttin @@ -3228,12 +3382,14 @@ /types/resumablejs/ @DanielMcAssey /types/rethinkdb/ @alexgorbatchev /types/retry/ @krenor +/types/retry-as-promised/ @Raigen /types/rev-hash/ @ikatyang /types/revalidate/ @alex3165 /types/revalidator/ @brewsoftware /types/reveal/ @robertop87 @Nava2 /types/rewire/ @borislavjivkov @CaselIT /types/rfc2047/ @mugifly +/types/rgrove__parse-xml/ @petejohanson /types/rheostat/ @SashaBayan @kourge /types/rickshaw/ @niemyjski /types/rimraf/ @soywiz @e-cloud @bash @@ -3244,16 +3400,16 @@ /types/riotjs/ @vvakame /types/rison/ @impworks /types/rivets/ @TrevorDev @matjanos -/types/rollup/ @flying-sheep @csvn +/types/roads/ @dancespiele /types/rollup-plugin-json/ @asmockler /types/ronomon__crypto-async/ @BendingBender /types/rosie/ @abner @subvertallchris -/types/roslib/ @Pro @skycoop +/types/roslib/ @Pro @skycoop @dgorobopec /types/rot-js/ @atiaxi /types/route-parser/ @ianks @bobbuehler /types/routie/ @Adilson /types/royalslider/ @csrakowski -/types/rpio/ @DominikPalo +/types/rpio/ @DominikPalo @Pencl /types/rrc/ @DeividasBakanas /types/rrule/ @waratuman /types/rsmq/ @MugeSo @@ -3280,6 +3436,7 @@ /types/rx-lite-time/ @Igorbek /types/rx-lite-virtualtime/ @Igorbek /types/rx.wamp/ @darkl +/types/s3-download-stream/ @everettcaleb /types/s3-upload-stream/ @geoffreak /types/safari-extension/ @luukd /types/safari-extension-content/ @luukd @@ -3298,6 +3455,7 @@ /types/sanitize-html/ @rogierschouten @afshin @BehindTheMath /types/sap__xsenv/ @mad-mike /types/sass-graph/ @marvinhagemeister +/types/sass-webpack-plugin/ @AepKill /types/sat/ @omni360 /types/satnav/ @DotNetNerd /types/saywhen/ @SeanSobey @@ -3310,7 +3468,7 @@ /types/scroller/ @haskellcamargo /types/scrollreveal/ @Davidblkx /types/scrolltofixed/ @bmdixon -/types/scrypt-async/ @xStrom +/types/scrypt-async/ @xStrom @stesix /types/scryptsy/ @micksatana /types/seamless/ @danmana /types/seamless-immutable/ @alex3165 @xsburg @geirsagberg @@ -3350,7 +3508,7 @@ /types/send/ @MikeJerred /types/seneca/ @psnider /types/sequelize/v3/ @samuelneff @codeanimal @drinchev @morpheusxaut @torhal -/types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut @TitaneBoy @zjy01 +/types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut @TitaneBoy @zjy01 @nidzov @Raigen @todd /types/sequelize-fixtures/ @cschwarz /types/sequencify/ @npenin /types/sequester/ @Strate @@ -3363,6 +3521,7 @@ /types/server-destroy/ @gyszalai /types/session-file-store/ @blendsdk @rokt33r /types/set-cookie-parser/ @nickp10 +/types/set-value/ @DanielRosenwasser /types/sha1/ @arcdev1 /types/shallowequal/ @seansfkelley /types/shapefile/ @DenisCarriere @@ -3379,6 +3538,7 @@ /types/shopify-buy/ @openminder /types/shortid/ @stpettersens @despairblue /types/shot/ @AJamesPhillips +/types/should-sinon/ @Arylo /types/showdown/ @cbowdon @tan9 /types/shrink-ray/ @forabi /types/siema/ @Irmiz @0x6368656174 @samnau @@ -3391,33 +3551,37 @@ /types/signature_pad/ @AbubakerB @jrmihalick /types/simple-assign/ @NoHomey /types/simple-cw-node/ @vvakame +/types/simple-lru/ @NN--- /types/simple-mock/ @leonyu /types/simple-oauth2/ @mad-mike /types/simple-peer/ @tlaziuk /types/simple-url-cache/ @a-lucas /types/simple-xml/ @notVitaliy /types/simplebar/v1/ @gregonnet @leonard-thieu -/types/simplebar/ @leonard-thieu +/types/simplebar/ @gregonnet @leonard-thieu /types/simplemde/ @Scalesoft /types/simplesmtp/ @rogierschouten /types/simplestorage.js/ @axelcostaspena @mxl +/types/single-line-log/ @ffflorian /types/sinon/ @mrbigdog2u @rationull @lumaxis @nicojs @43081j /types/sinon-as-promised/ @igrayson /types/sinon-chai/ @kazimanzurrashid @jedmao -/types/sinon-chrome/ @pimterry +/types/sinon-chrome/ @pimterry @crimx /types/sinon-express-mock/ @jpchip @tlaziuk /types/sinon-mongoose/ @stevehipwell -/types/sinon-stub-promise/ @vintem +/types/sinon-stub-promise/ @vintem @tstackhouse /types/sinon-test/ @mummybot /types/sip.js/ @decyrus /types/sipml/ @chookies /types/sitemap2/ @shundy /types/sizzle/ @leonard-thieu /types/sjcl/ @Evgenus +/types/skatejs/ @Hotell /types/ski/ @AyaMorisawa /types/skyway/ @nakakura /types/slack-node/ @geoffreak /types/slack-winston/ @BlueHatbRit +/types/slackdown/ @nju33 /types/slackify-html/ @hypexr /types/slate-irc/ @elisee /types/sleep/ @rajarz @@ -3439,8 +3603,9 @@ /types/socket.io/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi /types/socket.io-client/ @progre @divillysausages @florentpoujol /types/socket.io-parser/ @plantain-00 -/types/socket.io-redis/ @nupplaphil +/types/socket.io-redis/ @nupplaphil @seeLuck /types/socket.io.users/ @kataras +/types/socketio-jwt-auth/ @codeanimal /types/socketio-wildcard/ @BendingBender /types/socketty/ @Nax /types/sockjs/ @pmccloghrylaing @@ -3461,7 +3626,7 @@ /types/spdx-correct/ @jinwoo /types/spdx-satisfies/ @jinwoo /types/spdy/ @tony19 -/types/speakeasy/ @legendecas @mrOlorin +/types/speakeasy/ @legendecas @mrOlorin @xeoneux /types/speakingurl/ @Goldsmith42 /types/spectacle/ @zmaybury /types/spectrum/ @M-Zuber @@ -3469,7 +3634,7 @@ /types/split.js/ @icholy /types/split2/ @mugeso /types/spotify-api/ @skovmand -/types/spotify-web-playback-sdk/ @Festify +/types/spotify-web-playback-sdk/ @Festify @mraerino @NeoLegends /types/sprintf/ @soywiz @BendingBender /types/sprintf-js/ @jasonswearingen @BendingBender /types/sql.js/ @Hozuki @@ -3493,21 +3658,24 @@ /types/stats.js/ @gregolai @hberntsen @danvk /types/statsd-client/ @peterkooijmans @chrisleck /types/statuses/ @tkrotoff @BendingBender +/types/std-mocks/ @jdxcode /types/steam/ @kant2002 /types/steed/ @Paul-Isache /types/stemmer/ @will-ockmore /types/sticky-cluster/ @paustint -/types/stompjs/ @jimic +/types/stompjs/ @jimic @Dr4k4n /types/stoppable/ @EricByers /types/storejs/ @vbortone @harry0000 +/types/storybook__addon-a11y/ @hyunseob /types/storybook__addon-actions/ @joscha /types/storybook__addon-backgrounds/ @hyunseob /types/storybook__addon-info/ @mkornblum @fyrkant /types/storybook__addon-knobs/ @joscha @martynaskadisa -/types/storybook__addon-links/ @joscha +/types/storybook__addon-links/ @joscha @jessepinho /types/storybook__addon-notes/ @joscha /types/storybook__addon-options/ @joscha /types/storybook__react/ @joscha @wapgear +/types/storybook__vue/ @pntgupta /types/stream-buffers/ @Jason3S /types/stream-meter/ @mugeso /types/stream-series/ @k-kagurazaka @@ -3530,7 +3698,9 @@ /types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/strong-cluster-control/ @shuntksh +/types/strong-log-transformer/ @azasypkin /types/strophe/ @DavidKDeutsch +/types/structured-source/ @azu /types/styled-jsx/ @R1ZZU /types/stylelint/ @alan-agius4 /types/stylelint-webpack-plugin/ @bahlo @@ -3541,7 +3711,7 @@ /types/suitescript/ @darrenhillconsulting /types/sumo-logger/ @forabi /types/superagent/v2/ @varju @NicoZelaya @mxl -/types/superagent/ @NicoZelaya @mxl @paplorinc +/types/superagent/ @NicoZelaya @mxl @paplorinc @shreyjain1994 /types/superagent-no-cache/ @mxl /types/superagent-prefix/ @mxl /types/supercluster/ @DenisCarriere @@ -3555,7 +3725,7 @@ /types/svg4everybody/ @BendingBender /types/svgjs.draggable/ @LiFeleSs /types/svgjs.resize/ @jkevingutierrez -/types/svgo/ @bradleyayers +/types/svgo/ @bradleyayers @giladgray /types/swag/ @shiwano /types/swagger-express-middleware/ @alexandreroba /types/swagger-express-mw/ @micmro @@ -3588,6 +3758,7 @@ /types/tapable/ @e-cloud /types/tape/ @Bartvds @sodatea @DennisSchwartz @mikehenrty /types/tar/ @SomaticIT @connor4312 +/types/tar-fs/ @Umoxfo /types/tcp-ping/ @stegano /types/tedious/ @rogierschouten @cjthompson /types/tedious-connection-pool/ @sandorfr @@ -3604,7 +3775,7 @@ /types/text-buffer/ @GlenCFL /types/text-encoding/ @pine613 /types/text-encoding-utf-8/ @trxcllnt -/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv +/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv @apurvaojas /types/thrift/ @kamek-pf @kevin-greene-ck @jessezhang91 /types/throng/ @cyrilschumacher @tatethurston /types/throttle/ @BendingBender @@ -3623,7 +3794,7 @@ /types/tinder/ @pingec /types/tinycolor2/ @M-Zuber @geertjansen @nvh /types/tinycopy/ @vvatanabe -/types/tinymce/ @martinduparc @ipoul +/types/tinymce/ @martinduparc @ipoul @nicohartto /types/titanium/ @cyounkins /types/title/ @fa7ad /types/tldjs/ @geoffreak @@ -3660,17 +3831,19 @@ /types/tweezer.js/ @praxxis /types/twig/ @soywiz @enko /types/twilio/ @nickiannone @ashleybrener -/types/twit/ @Volox @lostfictions +/types/twit/ @Volox @lostfictions @sapphiredev /types/twitter/ @chitoku-k /types/twitter-stream-channels/ @adrianbardan /types/twitter-text/ @rhysd /types/twix/ @j3ko /types/type-check/ @hansrwindhoff +/types/type-detect/v0/ @Bartvds /types/type-detect/ @Bartvds /types/type-is/ @BendingBender /types/type-name/ @armorik83 /types/typeahead/ @igochkov @gjunge /types/typedarray-pool/ @pawsong +/types/typeof/ @OpenByteDev /types/typescript-deferred/ @DirtyHairy /types/tz-format/ @samverschueren /types/ua-parser-js/ @superduper @legendecas @MeLlamoPablo @@ -3703,26 +3876,31 @@ /types/untildify/ @BendingBender /types/unused-filename/ @BendingBender /types/unzip/ @coding2012 +/types/unzipper/ @s73obrien +/types/update-notifier/v1/ @vvakame @nchen63 /types/update-notifier/ @vvakame @nchen63 +/types/upng-js/ @plantain-00 /types/uppercamelcase/ @plantain-00 /types/urbanairship-cordova/ @Justin-Credible /types/uri-templates/ @Bartvds -/types/urijs/ @RodneyJT @xt0rted +/types/urijs/ @RodneyJT @xt0rted @petejohanson /types/uritemplate/ @teyc @rubensworks /types/url-assembler/ @wolfgang42 /types/url-join/ @rogierschouten @devrelm /types/url-metadata/ @mrkmg /types/url-parse/ @ChernenkoPaul /types/url-regex/ @unindented -/types/url-search-params/ @nick121212 +/types/url-search-params/ @nick121212 @nrathi /types/url-template/ @marcinporebski +/types/urllib/ @sorayama +/types/urlparser/ @OpenByteDev /types/urlrouter/ @soywiz /types/urlsafe-base64/ @tkrotoff /types/usage/ @pvomhoff -/types/usb/ @underscorebrody +/types/usb/ @underscorebrody @thegecko /types/user-home/ @mhegazy /types/useragent/ @geoffreak -/types/username/ @kayahr +/types/username/ @kayahr @krivachy /types/utf8/ @zelein /types/util-deprecate/ @BendingBender /types/util.promisify/ @adamvoss @@ -3752,13 +3930,14 @@ /types/vex-js/ @gdcohan /types/vexflow/ @rquiring @sebastianhaas @bohoffi /types/vfile/ @bizen241 @rokt33r +/types/vfile-location/ @ikatyang /types/victory/ @asvetliakov @snerks @Havret /types/video.js/ @vbortone @scleriot @SWBennett06 @IgelCampus /types/viewability-helper/ @lironzluf /types/viewerjs/ @lrh3321 /types/viewporter/ @borisyankov /types/vimeo/ @DazWilkin -/types/vimeo__player/ @denisyilmaz +/types/vimeo__player/ @denisyilmaz @timc13 /types/vinyl/v0/ @jedmao /types/vinyl/ @vvakame @jedmao @thorn0 /types/vinyl-buffer/ @tkQubo @@ -3767,11 +3946,14 @@ /types/virtual-dom/ @chbrown /types/virtual-keyboard/ @bsurai /types/vis/ @MichaelBitard @macleodbroad-wf @adripanico @seveves @kaktus40 @mmaitre314 @supercargo @takato1314 -/types/vision/ @jasonswearingen @AJamesPhillips +/types/vision/v4/ @jasonswearingen @AJamesPhillips +/types/vision/ @jasonswearingen @AJamesPhillips @lenovouser /types/vitalsigns/ @cyrilschumacher /types/vivus/ @DanielRosenwasser @lekhmanrus /types/vkbeautify/ @sch3lp +/types/vnu-jar/ @Umoxfo /types/voca/ @pine +/types/void-elements/ @ajafff /types/voronoi-diagram/ @michaelneu /types/vortex-web-client/ @Pro /types/voximplant-websdk/ @aylarov @@ -3794,7 +3976,7 @@ /types/watchpack/ @e-cloud /types/waterline/ @arvitaly /types/watson-developer-cloud/ @waldo000000 @Naktibalda -/types/waypoints/ @dominikbulaj @Koloto +/types/waypoints/ @dominikbulaj @Koloto @evil-shrike /types/wcwidth/ @rokt33r /types/weak/ @int0h /types/weapp-api/ @vargeek @@ -3809,9 +3991,8 @@ /types/webfontloader/ @doskallemaskin /types/webgl-ext/ @zenmumbler /types/webgl2/ @nkemnitz -/types/webix/ @mkozhukh /types/webmidi/ @lostfictions -/types/webpack/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @ahmed-taj @alan-agius4 +/types/webpack/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @ahmed-taj @alan-agius4 @elliottsj @jason0x43 /types/webpack-bundle-analyzer/ @kryops /types/webpack-chain/ @eirikurn @psachs21 /types/webpack-chunk-hash/ @mtraynham @@ -3832,7 +4013,7 @@ /types/webpack-stream/ @iclanton @bumbleblym /types/webpack-validator/ @deevus /types/webrtc/ @nakakura -/types/websocket/ @loyd @flynetworks @zhaoleimxd +/types/websocket/ @loyd @flynetworks @zhaoleimxd @jdneo /types/webspeechapi/ @saschanaz /types/websql/ @TeamworkGuy2 /types/webtorrent/ @niieani @tlaziuk @@ -3869,7 +4050,8 @@ /types/wrench/ @soywiz /types/write-file-atomic/ @BendingBender /types/write-json-file/ @DenisCarriere -/types/ws/ @loyd @elithrar @mlamp +/types/write-pkg/ @azasypkin +/types/ws/ @loyd @elithrar @mlamp @TitaneBoy /types/wtfnode/ @dex4er /types/wu/ @phiresky /types/wx-js-sdk-dt/ @agasbzj @@ -3878,13 +4060,12 @@ /types/x-ray-crawler/ @mtraynham /types/xdate/ @yamada28go /types/xdg-basedir/ @tlaziuk -/types/xhr-mock/ @joscha /types/xml/ @YuJianrong /types/xml-parser/ @mhfrantz /types/xml2js/ @michelsalib @jasonrm @ccurrens @edwardhinkle @BehindTheMath /types/xml2json/ @dolanmiu /types/xmlbuilder/ @wallymathieu -/types/xmldoc/ @Xstoudi @ajsheehan +/types/xmldoc/ @Xstoudi @ajsheehan @notlaforge /types/xmldom/ @tkqubo /types/xmlpoke/ @garthk /types/xmltojson/ @traviscrowe @@ -3895,18 +4076,19 @@ /types/xrm/ @6ix4our @mattngan @markusmauch @daryllabar @clownwilleatme @scottdurow /types/xsd-schema-validator/ @Goldsmith42 /types/xsockets/ @pushplay -/types/xterm/ @blink1073 @LucianBuzzo /types/xxhashjs/ @mDibyo /types/yallist/ @BendingBender /types/yandex-maps/ @Delagen /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/ @poelstra @mizunashi-mana @pushplay @jeffkenney @JimiC +/types/yauzl/ @ffflorian /types/yayson/ @Codesleuth /types/ydn-db/ @yathit @gabrielmaldi /types/yeoman-generator/ @armorik83 @janslow @ikatyang /types/yeoman-test/ @ikatyang -/types/yfiles/ @yGuy /types/yog-bigpipe/ @ssddi456 /types/yog-log/ @ssddi456 /types/yog2-kernel/ @ssddi456 @@ -3914,7 +4096,7 @@ /types/youtube/ @DazWilkin @JoshuaKGoldberg @eliotfallon213 /types/youtube-dl/ @bsurai /types/yui/ @giabao -/types/yup/ @dhardtke @vtserman +/types/yup/ @dhardtke @vtserman @MoretonBayRC /types/z-schema/ @pgonzal /types/zapier-platform-core/ @bradleyayers /types/zen-observable/ @aicest @@ -3923,9 +4105,13 @@ /types/zepto/ @jbaldwin /types/zeroclipboard/v1/ @ejsmith @niemyjski @balassy @leonyu /types/zeroclipboard/ @ejsmith @niemyjski @balassy @leonyu -/types/zeromq/ @davemckeown @erikma +/types/zeromq/ @davemckeown @erikma @TitaneBoy /types/zip.js/ @lgrignon /types/zipcodes/ @headdetect +/types/zipkin-context-cls/ @plantain-00 +/types/zipkin-instrumentation-express/ @plantain-00 +/types/zipkin-instrumentation-fetch/ @plantain-00 +/types/zipkin-transport-http/ @plantain-00 /types/zmq/ @davemckeown /types/zookeeper/ @xialeistudio /types/zui/ @yuanxu diff --git a/README.es.md b/README.es.md new file mode 100644 index 0000000000..ce94bb0298 --- /dev/null +++ b/README.es.md @@ -0,0 +1,335 @@ +# DefinitelyTyped [![Build Status](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped.svg?branch=master)](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped) + +[![Join the chat at https://gitter.im/borisyankov/DefinitelyTyped](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +> El repositorio de definiciones de TypeScript de alta calidad. + +Vea también el sitio web [definitelytyped.org](http://definitelytyped.org), aunque la información en este README está más actualizada. + + +## ¿Qué son los `declaration files`? + +Vea el [Manual de TypeScript](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html). + + +## ¿Cómo los obtengo? + +### npm + +Este es el método preferido. Solo está disponible para usuarios TypeScript 2.0+. Por ejemplo: + +```sh +npm install --save-dev @types/node +``` + +Los types deberían ser incluidos automaticamente por el compilador. +Vea más en el [manual](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html). + +Para un paquete NPM "foo", Estos `typings` estarán en "@types/foo". +Si no puedes encontrar tu paquete, búscalo en [TypeSearch](https://microsoft.github.io/TypeSearch/). + +Si aún no puedes encontrarlo, comprueba si el paquete ya [incluye](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) los typings. +Esto es provisto usualmente en el campo `"types"` o `"typings"` en el `package.json`, +o solo busca por cualquier archivo ".d.ts" en el paquete e incluyelo manualmente con un `/// `. + + +### Otros métodos + +Estos pueden ser utilizados por TypeScript 1.0. + +* [Typings](https://github.com/typings/typings) +* ~~[NuGet](http://nuget.org/packages?q=DefinitelyTyped)~~ (use las alternativas preferidas, la publicación DT type de nuget ha sido desactivada) +* Descarguelo manualmente desde la `master` branch de este repositorio + +Tal vez debas añadir manualmente las [referencias](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html). + + +## ¿Cómo puedo contribuir? + +¡DefinitelyTyped solo trabaja gracias a contribuidores como tú! + +### Prueba + +Antes de compartir tu mejora con el mundo, úselo usted mismo. + +#### Prueba editando un paquete existente + +Para agregar nuevas funciones puedes usar el [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html). +También puedes editar directamente los types en `node_modules/@types/foo/index.d.ts`, o copiarlos de ahí y seguir los pasos explicados a continuación. + + +#### Prueba un nuevo paquete + +Añade a tu `tsconfig.json`: + +```json +"baseUrl": "types", +"typeRoots": ["types"], +``` + +(También puedes usar `src/types`.) +Crea un `types/foo/index.d.ts` que contenga declaraciones del módulo "foo". +Ahora deberías poder importar desde `"foo"` a tu código y te enviara a un nuevo tipo de definición. +Entonces compila *y* ejecuta el código para asegurarte que el tipo de definición en realidad corresponde a lo que suceda en el momento de la ejecución. +Una vez que hayas probado tus definiciones con el código real, haz un [PR](#make-a-pull-request) +luego sigue las instrucciones para [editar un paquete existente](#edit-an-existing-package) o +[crear un nuevo paquete](#create-a-new-package). + + +### Haz un pull request + +Una vez que hayas probado tu paquete, podrás compartirlo en DefinitelyTyped. + +Primero, haz un [fork](https://guides.github.com/activities/forking/) en este repositorio, instala [node](https://nodejs.org/), y luego ejecuta la `npm install`. + + +#### Editar un paquete existente + +* `cd types/my-package-to-edit` +* Haz cambios. Recuerda editar las pruebas. +* También puede que quieras añadirte la sección "Definitions by" en el encabezado del paquete. + - Esto hará que seas notificado (a través de tu nombre de usuario en GitHub) cada vez que alguien haga un pull request o issue sobre el paquete. + - Haz esto añadiendo tu nombre al final de la línea, así como en `// Definitions by: Alice , Bob `. + - O si hay más personas, puede ser multiline + ```typescript + // Definitions by: Alice + // Bob + // Steve + // John + ``` +* Si hay un `tslint.json`, ejecuta `npm run lint package-name`. De lo contrario, ejecuta `tsc` en el directorio del paquete. + +Cuando hagas un PR para editar un paquete existente, `dt-bot` deberá @-mencionar a los autores previos. +Si no lo hace, puedes hacerlo en el comentario asociado con el PR. + + +#### Crear un nuevo paquete + +Si eres el autor de la librería, o puedes hacer un pull request a la biblioteca, [bundle types](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) en vez de publicarlo en DefinitelyTyped. + +Si estás agregando typings para un paquete NPM, crea un directorio con el mismo nombre. +Si el paquete al que le estás agregando typings no es para NPM, asegurate de que el nombre que escojas no genere problemas con el nombre del paquete en NPM. +(Puedes usar `npm info foo` para verificar la existencia del paquete `foo`.) + +Tu paquete debería tener esta estructura: + +| Archivo | Propósito | +| --- | --- | +| index.d.ts | Este contiene los typings del paquete. | +| foo-tests.ts | Este contiene una muestra del código con el que se realiza la prueba de escritura. Este código *no* es ejecutable, pero sí es type-checked. | +| tsconfig.json | Este permite ejecutar `tsc` dentro del paquete. | +| tslint.json | Permite linting. | + +Generalas ejecutando `npm install -g dts-gen` y `dts-gen --dt --name my-package-name --template module`. +Ve todas las opciones en [dts-gen](https://github.com/Microsoft/dts-gen). + +También puedes configurar el `tsconfig.json` para añadir nuevos archivos, para agregar un `"target": "es6"` (necesitado por las funciones asíncronas), para agregar a la `"lib"`, o para agregar la opción de compilación `"jsx"`. + +Los miembros de DefinitelyTyped frecuentemente monitorean nuevos PRs, pero ten en mente que la cantidad de PRs podrian ralentizar el proceso. + +Para un buen paquete de ejemplo, vea [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/base64-js). + + +#### Errores comunes + +* Primero, sigue el consejo del [manual](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html). +* Formatear: Ya sea utilizar todo en tabs, o siempre utiliza 4 espacios. +* `function sum(nums: number[]): number`: Utiliza `ReadonlyArray` si una funcion no escribe a sus parámetros. +* `interface Foo { new(): Foo; }`: + Este define el tipo de objeto que esten nuevos. Probablemente quieras `declare class Foo { constructor(); }`. +* `const Class: { new(): IClass; }`: + Prefiere usar una declaración de clase `class Class { constructor(); }` En vez de una nueva constante. +* `getMeAT(): T`: + Si un tipo de parámetro no aparece en los tipos de ningún parámetro, no tienes una función genérica, solo tienes un afirmación del tipo disfrazado. + Prefiera utilizar una afirmación de tipo real, p.ej. `getMeAT() as number`. + Un ejemplo donde un tipo de parámetro es aceptable: `function id(value: T): T;`. + Un ejemplo donde no es aceptable: `function parseJson(json: string): T;`. + Una excepción: `new Map()` está bien. +* Utilizando los tipos `Function` y `Object` casi nunca es una buena idea. En 99% de los casos es posible especificar un tipo más especifico. Los ejemplos son `(x: number) => number` para [funciones](http://www.typescriptlang.org/docs/handbook/functions.html#function-types) y `{ x: number, y: number }` para objetos. Si no hay certeza en lo absoluto del tipo, [`any`](http://www.typescriptlang.org/docs/handbook/basic-types.html#any) es la opción correcta, no `Object`. Si el único hecho conocido sobre el tipo es que es un objecto, usa el tipo [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type), no `Object` o `{ [key: string]: any }`. +* `var foo: string | any`: + Cuando es usado `any` en un tipo de unión, el tipo resultante todavía es `any`. Así que mientras la porción `string` de este tipo de anotación puede _verse_ útil, de hecho, no ofrece ningún typechecking adicional más que un simple `any`. + Dependiendo de la intención, una alternativa aceptable puede ser `any`, `string`, o `string | object`. + + +#### Remover un paquete + +Cuando un paquete [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) sus propios tipos, estos tipos deberán ser removidos de DefinitelyTyped para evitar que generen confusión. + +Se puede remover ejecutando `npm run not-needed -- typingsPackageName asOfVersion sourceRepoURL [libraryName]`. +- `typingsPackageName`: Este es el nombre del directorio que tienes que eliminar. +- `asOfVersion`: Un stub será publicado a `@types/foo` con esta versión. Debería ser más grande que cualquier versión publicada actualmente. +- `sourceRepoURL`: Esto debería señalar el repositorio que contiene los typings. +- `libraryName`: Un nombre descriptivo de la librería, p.ej. "Angular 2" en vez de "angular2". (Si es omitido, será idéntico a "typingsPackageName".) + +Cualquier otro paquete en DefinitelyTyped que referencie el paquete eliminado deberá ser actualizado para referenciar los tipos bundled. para hacer esto, añade `package.json` con `"dependencies": { "foo": "x.y.z" }`. + +Si un paquete nunca estuvo en DefinitelyTyped, no será necesario añadirlo a `notNeededPackages.json`. + + +#### Lint + +Para realizar el lint a un paquete, solo añade `tslint.json` al paquete que contiene `{ "extends": "dtslint/dt.json" }`. Todos los paquetes nuevos deberán pasar por el proceso de linted. +Si el `tslint.json` deshabilita algunas reglas esto se debe a que aún no se ha acomodado. Por ejemplo: + +```js +{ + "extends": "dtslint/dt.json", + "rules": { + // This package uses the Function type, and it will take effort to fix. + "ban-types": false + } +} +``` + +(Para indicar que la regla lint realmente no es utilizada, usa `// tslint:disable rule-name` o mejor, `//tslint:disable-next-line rule-name`.) + +Para afirmar que una expresión es de un tipo dado, utilice `$ExpectType`. Para afirmar que una expresión causa un error de compilación, utilice `$ExpectError`. + +```js +// $ExpectType void +f(1); + +// $ExpectError +f("one"); +``` + +Para más detalles, vea el [dtslint](https://github.com/Microsoft/dtslint#write-tests) readme. + +Realiza una prueba ejecutando `npm run lint package-name` donde `package-name` es el nombre de tu paquete. +Este script utiliza [dtslint](https://github.com/Microsoft/dtslint). + + +## FAQ + +#### ¿Cuál es exactamente la relación entre este repositorio y los paquetes de `@types` en NPM? + +La `master` branch es automaticamente publicada en el alcance de los `@types` en NPM gracias a los [types-publisher](https://github.com/Microsoft/types-publisher). + +#### He enviado un pull request. ¿Cuánto tardará en ser merged? + +Esto depende, pero la mayoría de los pull requests serán merged en alrededor de una semana. PRs que hayan sido aprovados por un autor listado en el encabezado de las definiciones usualmente son merged más rápidamente; PRs para nuevas definiciones tomarán más tiempo ya que requieren más revisiones de los mantenedores. Cada PR es revisado por un miembro de TypeScript o DefinitelyTyped antes de ser merged, por favor se paciente debido a que factores humanos pueden causar retrasos. Revisa el [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) para ver el progreso mientras los mantenedores trabajan on los PRs abiertos. + +#### Mi PR ha sido merged; ¿cuándo será actualizado el paquete de `@types` NPM? + +Los paquetes NPM deberán ser actualizados en unas cuantas horas. Si ha pasado más de 24 horas, menciona a @RyanCavanaugh y/o a @andy-ms en el PR para investigar. + +#### Estoy escribiendo una definición que depende de otra definición. Debería utilizar `` o una import? + +Si el modulo al cual te estás refiriendo es un módulo externo (utiliza `export`), utilice una import. +Si el módulo al cual te refieres es un módulo ambiente (utiliza `declare module`, o simplemente declara las globales), utilice ``. + +#### He notado que algunos paquetes aquí tienen `package.json`. + +Normalmente no lo necesitaras. Cuando publicas un paquete normalmente nosotros automáticamente crearemos un `package.json` para eso. +Un `package.json` puede ser incluido por el bien de especificar dependencias. Aquí tienen un [ejemplo](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pikaday/package.json). +No aceptamos otros campos, tales como `"description"`, para que sean definidos manualmente. +Además, si necesitas referencia a una versión anterior de typings, debes hacerlo añadiendo `"dependencies": { "@types/foo": "x.y.z" }` al package.json. + +#### Algunos paquetes no tienen `tslint.json`, y algunos `tsconfig.json` no contienen `"noImplicitAny": true`, `"noImplicitThis": true`, o `"strictNullChecks": true`. + +Entonces están equivocados. Puedes ayudar enviando un pull request para arreglarlos. + +#### Puedo pedir una definition? + +Aquí están las [definiciones solicitadas actualmente](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest). + +#### ¿Qué pasa con las type definitions para el DOM? + +Si las types son parte de los estándares web, estas deberán ser contribuidas a [TSJS-lib-generator](https://github.com/Microsoft/TSJS-lib-generator) para que se hagan parte de la librería predeterminada `lib.dom.d.ts`. + +#### Un paquete utiliza `export =`, pero prefiero utilizar las import predeterminadas. ¿Puedo cambiar `export =` por `export default`? + +Si la import predeterminada trabaja en tu ambiente, considera hacer un cambio en la opción de compilación [`--allowSyntheticDefaultImports`](http://www.typescriptlang.org/docs/handbook/compiler-options.html) opción compilar. +No cambies la type definition si es preciso. +Para un paquete NPM, `export =` es exacto si `node -p 'require("foo")'` es la export, y `export default` es exacto si `node -p 'require("foo").default'` es el export. + +#### Quiero usar las características de TypeScript 2.1 o superior. + +Entonces deberás añadir un comentario a la última línea de la definición en el encabezado (despues de `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`): `// TypeScript Version: 2.1`. + +#### Quiero añadir un DOM API que no está presente en TypeScript por defecto. + +Esto puede pertenecer a [TSJS-Lib-Generator](https://github.com/Microsoft/TSJS-lib-generator#readme). Vea las guías allí. +Si el estándar sigue siendo un borrador, este pertenece aquí. +Utilice un nombre que empiece con `dom-` e incluya un link al estándar como el "Project" con el link en el encabezado. +Cuando ya no sea un borrador, lo podremos eliminar desde DefinitelyType y hacer obsoleto el paquete `@types` asociado. + +#### Quiero actualizar un paquete a una nueva versión principal + +Si planeas continuar actualizando la versión anterior del paquete, puedes crear una subcarpeta con la versión actual p.ej. `v2`, y copia los archivos existentes. Si es así, necesitarás: + +1. Actualiza las rutas relativas en `tsconfig.json` al igual que `tslint.json`. +2. Añadir reglas de mapeo de rutas para asegurart de que la prueba se está ejecutando contra la versión prevista. + +Por ejemplo [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/history/v2/tsconfig.json) se ve así: + +```json +{ + "compilerOptions": { + "baseUrl": "../../", + "typeRoots": ["../../"], + "paths": { + "history": [ "history/v2" ] + }, + }, + "files": [ + "index.d.ts", + "history-tests.ts" + ] +} +``` + +Si hay otros paquetes en DefinitelyTyped que son incompatibles con la nueva versión, necesitaras mapear las rutas a la versión anterior. También deberá hacer esto para los paquetes que dependen de paquetes que dependen de una version anterior. + +Por ejemplo, `react-router` depende de `history@2`, así que [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) tiene una ruta mapeada a "history": `[ "history/v2" ]`; +transitivo así mismo, `react-router-bootstrap` (que depende de `react-router`) también añade una ruta mapeada en su [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json). + +Además, `/// ` no trabajara con rutas mapeadas, así que las dependencias deberán utilizar `import`. + +#### ¿Cómo escribo definitions para paquetes que pueden ser usados globalmente y como un módulo? + +El manual de TypeScript contiene excelente [información general para escribir definiciones](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html), ademas [este archivo de definiciones de ejemplo](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-modifying-module-d-ts.html) el cual muestra como crear una definición utilizando la sintaxis de módulo en ES6, asi como también especificando objetos que son disponibles en el alcance global. Esta técnica es demostrada practicamente en la [definición para big.js](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/big.js/index.d.ts), el cual es una librería que puede ser cargada globalmente a travéz de una etiqueta script en una página web, o importada via require o imports estilo ES6. + +Para probar como puede ser usada tu definición cuando se refieren globalmente o como un módulo importado, crea una carpeta `test`, y coloca dos archivos de prueba en él. nombra uno `YourLibraryName-global.test.ts` y el otro `YourLibraryName-module.test.ts`. El archivo de prueba _global_ debe ejercer la definición de acuerdo como va a ser usado en un script cargado en una página web donde la librería estará disponible en el alcance global - en este escenario no debes de especificar la sentencia de import. El archivo _módulo_ de prueba debe de ejercer la definición de acuerdo a como va a ser utilizado cuando sea importado (incluyendo las sentencias `import`). Si especificas un propiedad `files` en tu archivo tsconfig.json, asegurate de incluir ambos archivos de prueba. Un [ejemplo práctico de esto](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/big.js/test) es también disponible en la definición de big.js. + +Por favor tenga en cuenta que no es necesario para ejercer plenamente la definición en cada archivo de prueba - Es suficiente con probar solo los elementos globalmente accesibles en la prueba de archivos globales y ejercer la definición en el módulo del archivo de prueba, o viceversa. + +#### ¿Qué pasa con paquetes scoped? + +Types para un paquete scoped `@foo/bar` deberán ir en `types/foo__bar`. tenga en cuenta el doble guion bajo. + +Cuando `dts-gen` es utilizado como scaffold en un paquete scoped, las propiedades `paths` deberán ser adaptadas manualmente en el paquete generado +`tsconfig.json` para referenciar correctamente el paquete scoped: + +```json +{ + "paths":{ + "@foo/bar": ["foo__bar"] + } +} +``` + +#### El historial de archivos en GitHub parece incompleto. + +GitHub no le hace [support](http://stackoverflow.com/questions/5646174/how-to-make-github-follow-directory-history-after-renames) historial de archivos para archivos renombrados. Utilice [`git log --follow`](https://www.git-scm.com/docs/git-log) en su lugar. + +#### Debería añadir un namespace que no exporte un módulo que utilice que utilice imports estilo ES6? + +Algunos paquetes, como [chai-http](https://github.com/chaijs/chai-http), exportan una función. + +importar este módulo con un ES6 style import de forma `import * as foo from "foo";` conduce al error: + +> error ts2497: El módulo 'foo' se resuelve en una entidad que no es un módulo y no se puede importar mediante esta construcción + +Este error puede ser suprimido al unir la declaración de una función con un namespace vacío del mismo nombre pero esta práctica no es recomendable. +Esto es un citado común [Respuestas de Stack Overflow](https://stackoverflow.com/questions/39415661/what-does-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this) con respecto a este asunto. + +Es más apropiado importar este módulo utilizando la sintaxis `import foo = require("foo");`, o utilizando una importación predeterminada como `import foo from "foo";` si usas la bandera `--allowSyntheticDefaultImports` si la ejecución de tu módulo soporta un esquema de interoperación para módulos no ECMAScript como tal. + +## Licencia + +Este proyecto es licenciado bajo la licencia MIT. + +Los derechos de autor de cada archivo de definición son respectivos de cada contribuidor listado al comienzo de cada archivo de definición. + +[![Analytics](https://ga-beacon.appspot.com/UA-47495295-4/borisyankov/DefinitelyTyped)](https://github.com/igrigorik/ga-beacon) diff --git a/README.md b/README.md index 854cae7e40..cc59284394 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,12 @@ Also see the [definitelytyped.org](http://definitelytyped.org) website, although information in this README is more up-to-date. +*[You can also read this README in Spanish!](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md)* ## What are declaration files? See the [TypeScript handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html). - ## How do I get them? ### npm @@ -256,7 +256,7 @@ When it graduates draft mode, we may remove it from DefinitelyTyped and deprecat #### I want to update a package to a new major version -Before making your change, please create a new subfolder with the current version e.g. `v2`, and copy existing files to it. You will need to: +If you intend to continue updating the older version of the package, you may create a new subfolder with the current version e.g. `v2`, and copy existing files to it. If so, you will need to: 1. Update the relative paths in `tsconfig.json` as well as `tslint.json`. 2. Add path mapping rules to ensure that tests are running against the intended version. @@ -279,7 +279,8 @@ For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/Defi } ``` -Please note that unless upgrading something backwards-compatible like `node`, all packages depending of the updated package need a path mapping to it, as well as packages depending on *those*. +If there are other packages on DefinitelyTyped that are incompatible with the new version, you will need to add path mappings to the old version. You will also need to do this for packages depending on packages depending on the old version. + For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`; transitively `react-router-bootstrap` (which depends on `react-router`) also adds a path mapping in its [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json). diff --git a/notNeededPackages.json b/notNeededPackages.json index 8f3270392f..a3423d479c 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -6,6 +6,12 @@ "sourceRepoURL": "https://github.com/betterwaysystems/packer", "asOfVersion": "1.1.3" }, + { + "libraryName": "Ably Realtime and Rest client library", + "typingsPackageName": "ably", + "sourceRepoURL": "https://www.ably.io/", + "asOfVersion": "1.0.0" + }, { "libraryName": "ag-grid", "typingsPackageName": "ag-grid", @@ -18,6 +24,12 @@ "sourceRepoURL": "https://github.com/epoberezkin/ajv", "asOfVersion": "1.0.0" }, + { + "libraryName": "angular-touchspin", + "typingsPackageName": "angular-touchspin", + "sourceRepoURL": "https://github.com/nkovacic/angular-touchspin", + "asOfVersion": "1.8.2" + }, { "libraryName": "angular-ui-router-default", "typingsPackageName": "angular-ui-router-default", @@ -78,6 +90,12 @@ "sourceRepoURL": "https://github.com/AlexTeixeira/Askmethat-Rating", "asOfVersion": "0.4.0" }, + { + "libraryName": "assertion-error", + "typingsPackageName": "assertion-error", + "sourceRepoURL": "https://github.com/chaijs/assertion-error", + "asOfVersion": "1.1.0" + }, { "libraryName": "asyncblock", "typingsPackageName": "asyncblock", @@ -546,6 +564,12 @@ "sourceRepoURL": "http://arshaw.com/fullcalendar/", "asOfVersion": "3.8.0" }, + { + "libraryName": "fuse", + "typingsPackageName": "fuse", + "sourceRepoURL": "https://github.com/krisk/Fuse", + "asOfVersion": "2.6.0" + }, { "libraryName": "gaea-model", "typingsPackageName": "gaea-model", @@ -582,6 +606,12 @@ "sourceRepoURL": "https://github.com/panuhorsmalahti/gulp-tslint", "asOfVersion": "4.2.0" }, + { + "libraryName": "gulp-typedoc", + "typingsPackageName": "gulp-typedoc", + "sourceRepoURL": "https://github.com/rogierschouten/gulp-typedoc", + "asOfVersion": "2.2.0" + }, { "libraryName": "gulp-typescript", "typingsPackageName": "gulp-typescript", @@ -798,6 +828,12 @@ "sourceRepoURL": "https://linqjs.codeplex.com/", "asOfVersion": "2.2.33" }, + { + "libraryName": "Linq4JS", + "typingsPackageName": "linq4js", + "sourceRepoURL": "https://github.com/morrisjdev/Linq4JS", + "asOfVersion": "2.1.8" + }, { "libraryName": "LinqSharp", "typingsPackageName": "linqsharp", @@ -810,6 +846,12 @@ "sourceRepoURL": "https://github.com/localForage/localForage", "asOfVersion": "0.0.34" }, + { + "libraryName": "localforage-cordovasqlitedriver", + "typingsPackageName": "localforage-cordovasqlitedriver", + "sourceRepoURL": "https://github.com/thgreasi/localForage-cordovaSQLiteDriver", + "asOfVersion": "1.5.0" + }, { "libraryName": "lodash-decorators", "typingsPackageName": "lodash-decorators", @@ -912,6 +954,12 @@ "sourceRepoURL": "https://github.com/theoephraim/node-pg-migrate#readme", "asOfVersion": "2.15.0" }, + { + "libraryName": "node-waves", + "typingsPackageName": "node-waves", + "sourceRepoURL": "http://fian.my.id/Waves", + "asOfVersion": "0.7.6" + }, { "libraryName": "Normalizr", "typingsPackageName": "normalizr", @@ -1194,6 +1242,12 @@ "sourceRepoURL": "https://github.com/EnoF/rest-io", "asOfVersion": "4.1.0" }, + { + "libraryName": "rollup", + "typingsPackageName": "rollup", + "sourceRepoURL": "https://github.com/rollup/rollup", + "asOfVersion": "0.54.0" + }, { "libraryName": "route-recognizer", "typingsPackageName": "route-recognizer", @@ -1482,6 +1536,12 @@ "sourceRepoURL": "https://webgme.org", "asOfVersion": "2.11.0" }, + { + "libraryName": "Webix UI", + "typingsPackageName": "webix", + "sourceRepoURL": "http://webix.com", + "asOfVersion": "5.1.1" + }, { "libraryName": "wolfy87-eventemitter", "typingsPackageName": "wolfy87-eventemitter", @@ -1512,6 +1572,12 @@ "sourceRepoURL": "https://github.com/PeculiarVentures/xadesjs", "asOfVersion": "2.0.2" }, + { + "libraryName": "xhr-mock", + "typingsPackageName": "xhr-mock", + "sourceRepoURL": "https://github.com/jameslnewell/xhr-mock#readme", + "asOfVersion": "2.0.0" + }, { "libraryName": "xlsx", "typingsPackageName": "xlsx", @@ -1530,6 +1596,18 @@ "sourceRepoURL": "github.com/node-xmpp/node-xmpp/", "asOfVersion": "1.2.0" }, + { + "libraryName": "xterm.js", + "typingsPackageName": "xterm", + "sourceRepoURL": "https://github.com/sourcelair/xterm.js/", + "asOfVersion": "3.0.0" + }, + { + "libraryName": "yFiles for HTML", + "typingsPackageName": "yfiles", + "sourceRepoURL": "none", + "asOfVersion": "2.1.0" + }, { "libraryName": "zetapush-js", "typingsPackageName": "zetapush-js", diff --git a/scripts/generate-tsconfigs.ts b/scripts/generate-tsconfigs.ts index 0115067e34..e1e1998950 100644 --- a/scripts/generate-tsconfigs.ts +++ b/scripts/generate-tsconfigs.ts @@ -5,7 +5,7 @@ import * as fs from 'fs'; import * as path from 'path'; -const home = path.join(__dirname, '..'); +const home = path.join(__dirname, "..", "types"); for (const dirName of fs.readdirSync(home)) { if (dirName.startsWith(".") || dirName === "node_modules" || dirName === "scripts") { diff --git a/types/ably/ably-tests.ts b/types/ably/ably-tests.ts deleted file mode 100644 index bc50d03ce6..0000000000 --- a/types/ably/ably-tests.ts +++ /dev/null @@ -1,253 +0,0 @@ -import * as Ably from 'ably'; - -declare const console: { log(message: any): void }; - -const ApiKey = 'appId.keyId:secret'; -const client = new Ably.Realtime(ApiKey); -const restClient = new Ably.Rest(ApiKey); - -// Connection -// Successful connection: - -client.connection.on('connected', () => { - // successful connection -}); - -// Failed connection: - -client.connection.on('failed', () => { - // failed connection -}); - -// Subscribing to a channel - -const channel = client.channels.get('test'); -channel.subscribe(message => { - message.name; // 'greeting' - message.data; // 'Hello World!' -}); - -// Only certain events: - -channel.subscribe('myEvent', message => { - message.name; // 'myEvent' - message.data; // 'myData' -}); - -// Publishing to a channel - -// Publish a single message with name and data -channel.publish('greeting', 'Hello World!'); - -// Optionally, you can use a callback to be notified of success or failure -channel.publish('greeting', 'Hello World!', err => { - if (err) { - console.log('publish failed with error ' + err); - } else { - console.log('publish succeeded'); - } -}); - -// Publish several messages at once -channel.publish([{name: 'greeting', data: 'Hello World!'}], () => { }); - -// Querying the History - -channel.history((err, messagesPage) => { - messagesPage.items; // array of Message - messagesPage.items[0].data; // payload for first message - messagesPage.items.length; // number of messages in the current page of history - messagesPage.hasNext(); // true if there are further pages - messagesPage.isLast(); // true if this page is the last page - messagesPage.next(nextPage => { nextPage; }); // retrieves the next page as PaginatedResult -}); - -// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history -channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards'}, (err, messagesPage) => { - console.log(messagesPage.items.length); -}); - -// Presence on a channel -// Getting presence: - -channel.presence.get(presenceSet => { - presenceSet; // array of PresenceMessages -}); - -// Note that presence#get on a realtime channel does not return a PaginatedResult, as the library maintains a local copy of the presence set. - -// Entering (and leaving) the presence set: - -channel.presence.enter('my status', err => { - // now I am entered -}); - -channel.presence.update('new status', err => { - // my presence data is updated -}); - -channel.presence.leave(null, err => { - // I've left the presence set -}); - -channel.presence.enterClient('myClientId', 'status', err => { -}); - -// and similiarly, updateClient and leaveClient -// Querying the Presence History - -channel.presence.history((err, messagesPage) => { // PaginatedResult - messagesPage.items; // array of PresenceMessage - messagesPage.items[0].data; // payload for first message - messagesPage.items.length; // number of messages in the current page of history - messagesPage.hasNext(); // true if there are further pages - messagesPage.isLast(); // true if this page is the last page - messagesPage.next(nextPage => { }); // retrieves the next page as PaginatedResult -}); - -// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history -channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards' }, (err, messagesPage) => {}); - -// Symmetrical end-to-end encrypted payloads on a channel - -// When a 128 bit or 256 bit key is provided to the library, the data attributes of all messages are encrypted and decrypted automatically using that key. -// The secret key is never transmitted to Ably. See https://www.ably.io/documentation/realtime/encryption - -// Generate a random 256-bit key for demonstration purposes (in -// practice you need to create one and distribute it to clients yourselves) -Ably.Realtime.Crypto.generateRandomKey((err, key) => { - const channel = client.channels.get('channelName', { cipher: { key } }); - - channel.subscribe(message => { - message.name; // 'name is not encrypted' - message.data; // 'sensitive data is encrypted' - }); - - channel.publish('name is not encrypted', 'sensitive data is encrypted'); -}); - -// You can also change the key on an existing channel using setOptions (which takes a callback which is called after the new encryption settings have taken effect): - -channel.setOptions({cipher: {key: ''}}, () => { - // New encryption settings are in effect -}); - -// Using the REST API - -const restChannel = restClient.channels.get('test'); - -// Publishing to a channel - -// Publish a single message with name and data -restChannel.publish('greeting', 'Hello World!'); - -// Optionally, you can use a callback to be notified of success or failure -restChannel.publish('greeting', 'Hello World!', err => { - if (err) { - console.log('publish failed with error ' + err); - } else { - console.log('publish succeeded'); - } -}); - -// Publish several messages at once -restChannel.publish([{name: 'greeting', data: 'Hello World!'}], () => {}); - -// Querying the History - -restChannel.history((err, messagesPage) => { - messagesPage; // PaginatedResult - messagesPage.items; // array of Message - messagesPage.items[0].data; // payload for first message - messagesPage.items.length; // number of messages in the current page of history - messagesPage.hasNext(); // true if there are further pages - messagesPage.isLast(); // true if this page is the last page - messagesPage.next(nextPage => {}); // retrieves the next page as PaginatedResult -}); - -// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history -restChannel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards' }, (err, messagesPage) => {}); - -// Presence on a channel - -restChannel.presence.get((err, presencePage) => { // PaginatedResult - presencePage.items; // array of PresenceMessage - presencePage.items[0].data; // payload for first message - presencePage.items.length; // number of messages in the current page of members - presencePage.hasNext(); // true if there are further pages - presencePage.isLast(); // true if this page is the last page - presencePage.next(nextPage => {}); // retrieves the next page as PaginatedResult -}); - -// Querying the Presence History - -restChannel.presence.history((err, messagesPage) => { // PaginatedResult - messagesPage.items; // array of PresenceMessage - messagesPage.items[0].data; // payload for first message - messagesPage.items.length; // number of messages in the current page of history - messagesPage.hasNext(); // true if there are further pages - messagesPage.isLast(); // true if this page is the last page - messagesPage.next(nextPage => { }); // retrieves the next page as PaginatedResult -}); - -// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history -restChannel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards' }, (err, messagesPage) => {}); - -// Generate Token and Token Request -// See https://www.ably.io/documentation/general/authentication for an explanation of Ably's authentication mechanism. - -// Requesting a token: - -client.auth.requestToken((err, tokenDetails) => { - // tokenDetails is instance of TokenDetails - // see https://www.ably.io/documentation/rest/authentication/#token-details for its properties - - // Now we have the token, we can send it to someone who can instantiate a client with it: - const clientUsingToken = new Ably.Realtime(tokenDetails.token); -}); - -// requestToken can take two optional params -// tokenParams: https://www.ably.io/documentation/rest/authentication/#token-params -// authOptions: https://www.ably.io/documentation/rest/authentication/#auth-options -client.auth.requestToken({}, {}, (err, tokenDetails) => { }); - -// Creating a token request (for example, on a server in response to a request by a client using the authCallback or authUrl mechanisms): - -client.auth.createTokenRequest((err, tokenRequest) => { - // now send the tokenRequest back to the client, which will - // use it to request a token and connect to Ably -}); - -// createTokenRequest can take two optional params -// tokenParams: https://www.ably.io/documentation/rest/authentication/#token-params -// authOptions: https://www.ably.io/documentation/rest/authentication/#auth-options -client.auth.createTokenRequest({}, {}, (err, tokenRequest) => { }); - -// Fetching your application's stats - -client.stats({ limit: 50 }, (err, statsPage) => { // statsPage as PaginatedResult - statsPage.items; // array of Stats - statsPage.items[0].inbound.rest.messages.count; // total messages published over REST - statsPage.items.length; // number of stats in the current page of history - statsPage.hasNext(); // true if there are wrther pages - statsPage.isLast(); // true if this page is the last page - statsPage.next((nextPage) => {}); // retrieves the next page as PaginatedResult -}); - -// Fetching the Ably service time - -client.time({}, (err, time) => {}); // time is in ms since epoch - -// Getting decoded Message objects from JSON -const messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]); -console.log(messages[0].id); - -const message = Ably.Rest.Message.fromEncoded({ id: 'foo' }); -console.log(message.id); - -// Getting decoded PresenceMessage objects from JSON -const presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]); -console.log(presenceMessages[0].action); - -const presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' }); -console.log(presenceMessage.action); diff --git a/types/ably/index.d.ts b/types/ably/index.d.ts deleted file mode 100644 index 3a150257ba..0000000000 --- a/types/ably/index.d.ts +++ /dev/null @@ -1,473 +0,0 @@ -// Type definitions for Ably Realtime and Rest client library 0.9 -// Project: https://www.ably.io/ -// Definitions by: Ably -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export namespace ablyLib { - namespace ChannelState { - type INITIALIZED = 'initialized'; - type ATTACHING = 'attaching'; - type ATTACHED = "attached"; - type DETACHING = "detaching"; - type DETACHED = "detached"; - type SUSPENDED = "suspended"; - type FAILED = "failed"; - } - type ChannelState = ChannelState.FAILED | ChannelState.INITIALIZED | ChannelState.SUSPENDED | ChannelState.ATTACHED | ChannelState.ATTACHING | ChannelState.DETACHED | ChannelState.DETACHING; - - namespace ConnectionState { - type INITIALIZED = "initialized"; - type CONNECTING = "connecting"; - type CONNECTED = "connected"; - type DISCONNECTED = "disconnected"; - type SUSPENDED = "suspended"; - type CLOSING = "closing"; - type CLOSED = "closed"; - type FAILED = "failed"; - } - type ConnectionState = ConnectionState.INITIALIZED | ConnectionState.CONNECTED | ConnectionState.CONNECTING | ConnectionState.DISCONNECTED | - ConnectionState.SUSPENDED | ConnectionState.CLOSED | ConnectionState.CLOSING | ConnectionState.FAILED; - - namespace ConnectionEvent { - type INITIALIZED = "initialized"; - type CONNECTING = "connecting"; - type CONNECTED = "connected"; - type DISCONNECTED = "disconnected"; - type SUSPENDED = "suspended"; - type CLOSING = "closing"; - type CLOSED = "closed"; - type FAILED = "failed"; - type UPDATE = "update"; - } - type ConnectionEvent = ConnectionEvent.INITIALIZED | ConnectionEvent.CONNECTED | ConnectionEvent.CONNECTING | ConnectionEvent.DISCONNECTED | - ConnectionEvent.SUSPENDED | ConnectionEvent.CLOSED | ConnectionEvent.CLOSING | ConnectionEvent.FAILED | ConnectionEvent.UPDATE; - - namespace PresenceAction { - type ABSENT = "absent"; - type PRESENT = "present"; - type ENTER = "enter"; - type LEAVE = "leave"; - type UPDATE = "update"; - } - type PresenceAction = PresenceAction.ABSENT | PresenceAction.PRESENT | PresenceAction.ENTER | PresenceAction.LEAVE | PresenceAction.UPDATE; - - namespace StatsIntervalGranularity { - type MINUTE = "minute"; - type HOUR = "hour"; - type DAY = "day"; - type MONTH = "month"; - } - type StatsIntervalGranularity = StatsIntervalGranularity.MINUTE | StatsIntervalGranularity.HOUR | StatsIntervalGranularity.DAY | StatsIntervalGranularity.MONTH; - - namespace HTTPMethods { - type POST = "POST"; - type GET = "GET"; - } - type HTTPMethods = HTTPMethods.GET | HTTPMethods.POST; - - // Interfaces - interface ClientOptions extends AuthOptions { - /** - * When true will automatically connect to Ably when library is instanced. This is true by default - */ - autoConnect?: boolean; - - /** - * Optional clientId that can be used to specify the identity for this client. In most cases - * it is preferable to instead specift a clientId in the token issued to this client. - */ - clientId?: string; - - defaultTokenParams?: TokenParams; - - /** - * When true, messages published on channels by this client will be echoed back to this client. - * This is true by default - */ - echoMessages?: boolean; - - /** - * Use this only if you have been provided a dedicated environment by Ably - */ - environment?: string; - - /** - * Logger configuration - */ - log?: LogInfo; - port?: number; - - /** - * When true, messages will be queued whilst the connection is disconnected. True by default. - */ - queueMessages?: boolean; - - restHost?: string; - realtimeHost?: string; - fallbackHosts?: string[]; - - /** - * Can be used to explicitly recover a connection. - * See https://www.ably.io/documentation/realtime/connection#connection-state-recovery - */ - recover?: standardCallback | string; - - /** - * Use a non-secure connection connection. By default, a TLS connection is used to connect to Ably - */ - tls?: boolean; - tlsPort?: number; - - /** - * When true, the more efficient MsgPack binary encoding is used. - * When false, JSON text encoding is used. - */ - useBinaryProtocol?: boolean; - } - - interface AuthOptions { - /** - * A function which is called when a new token is required. - * The role of the callback is to either generate a signed TokenRequest which may then be submitted automatically - * by the library to the Ably REST API requestToken; or to provide a valid token in as a TokenDetails object. - */ - authCallback?(data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void): void; - authHeaders?: { [index: string]: string }; - authMethod?: HTTPMethods; - authParams?: { [index: string]: string }; - - /** - * A URL that the library may use to obtain a token string (in plain text format), or a signed TokenRequest or TokenDetails (in JSON format). - */ - authUrl?: string; - key?: string; - queryTime?: boolean; - token?: TokenDetails | string; - tokenDetails?: TokenDetails; - useTokenAuth?: boolean; - } - - interface TokenParams { - capability?: string; - clientId?: string; - nonce?: string; - timestamp?: number; - ttl?: number; - } - - interface CipherParams { - algorithm: string; - key: any; - keyLength: number; - mode: string; - } - - interface ErrorInfo { - code: number; - message: string; - statusCode: number; - } - - interface StatsMessageCount { - count: number; - data: number; - } - - interface StatsMessageTypes { - all: StatsMessageCount; - messages: StatsMessageCount; - presence: StatsMessageCount; - } - - interface StatsRequestCount { - failed: number; - refused: number; - succeeded: number; - } - - interface StatsResourceCount { - mean: number; - min: number; - opened: number; - peak: number; - refused: number; - } - - interface StatsConnectionTypes { - all: StatsResourceCount; - plain: StatsResourceCount; - tls: StatsResourceCount; - } - - interface StatsMessageTraffic { - all: StatsMessageTypes; - realtime: StatsMessageTypes; - rest: StatsMessageTypes; - webhook: StatsMessageTypes; - } - - interface TokenDetails { - capability: string; - clientId?: string; - expires: number; - issued: number; - token: string; - } - - interface TokenRequest { - capability: string; - clientId?: string; - keyName: string; - mac: string; - nonce: string; - timestamp: number; - ttl?: number; - } - - interface ChannelOptions { - cipher: any; - } - - interface RestPresenceHistoryParams { - start?: number; - end?: number; - direction?: string; - limit?: number; - } - - interface RestPresenceParams { - limit?: number; - clientId?: string; - connectionId?: string; - } - - interface RealtimePresenceParams { - waitForSync?: boolean; - clientId?: string; - connectionId?: string; - } - - interface RealtimePresenceHistoryParams { - start?: number; - end?: number; - direction?: string; - limit?: number; - untilAttach?: boolean; - } - - interface LogInfo { - /** - * A number controlling the verbosity of the output. Valid values are: 0 (no logs), 1 (errors only), - * 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output). - */ - level?: number; - - /** - * A function to handle each line of log output. If handler is not specified, console.log is used. - */ - handler?(...args: any[]): void; - } - - interface ChannelEvent { - state: ChannelState; - } - - interface ChannelStateChange { - current: ChannelState; - previous: ChannelState; - reason?: ErrorInfo; - resumed: boolean; - } - - interface ConnectionStateChange { - current: ConnectionState; - previous: ConnectionState; - reason?: ErrorInfo; - retryIn?: number; - } - - // Common Listeners - type paginatedResultCallback = (error: ErrorInfo, results: PaginatedResult) => void; - type standardCallback = (error: ErrorInfo, results: any) => void; - type messageCallback = (message: T) => void; - type errorCallback = (error: ErrorInfo) => void; - type channelEventCallback = (channelEvent: ChannelEvent, changeStateChange: ChannelStateChange) => void; - type connectionEventCallback = (connectionEvent: ConnectionEvent, connectionStateChange: ConnectionStateChange) => void; - type timeCallback = (error: ErrorInfo, time: number) => void; - type realtimePresenceGetCallback = (error: ErrorInfo, messages: PresenceMessage[]) => void; - type tokenDetailsCallback = (error: ErrorInfo, Results: TokenDetails) => void; - type tokenRequestCallback = (error: ErrorInfo, Results: TokenRequest) => void; - type fromEncoded = (JsonObject: any, channelOptions?: ChannelOptions) => T; - type fromEncodedArray = (JsonArray: any[], channelOptions?: ChannelOptions) => T[]; - - // Internal Classes - class EventEmitter { - on: (eventOrCallback: string | T, callback?: T) => void; - once: (eventOrCallback: string | T, callback?: T) => void; - off: (eventOrCallback?: string | T, callback?: T) => void; - } - - // Classes - class Auth { - clientId: string; - authorize: (tokenParams?: TokenParams | tokenDetailsCallback, authOptions?: AuthOptions | tokenDetailsCallback, callback?: tokenDetailsCallback) => void; - createTokenRequest: (tokenParams?: TokenParams | tokenRequestCallback, authOptions?: AuthOptions | tokenRequestCallback, callback?: tokenRequestCallback) => void; - requestToken: (TokenParams?: TokenParams | tokenDetailsCallback, authOptions?: AuthOptions | tokenDetailsCallback, callback?: tokenDetailsCallback) => void; - } - - class Presence { - get: (params: RestPresenceParams | paginatedResultCallback, callback?: paginatedResultCallback) => void; - history: (params: RestPresenceHistoryParams | paginatedResultCallback, callback?: paginatedResultCallback) => void; - } - - class RealtimePresence { - syncComplete: () => boolean; - get: (Params: realtimePresenceGetCallback | RealtimePresenceParams, callback?: realtimePresenceGetCallback) => void; - history: (ParamsOrCallback: RealtimePresenceHistoryParams | paginatedResultCallback, callback?: paginatedResultCallback) => void; - subscribe: (presenceOrCallback: PresenceAction | messageCallback, listener?: messageCallback) => void; - unsubscribe: (presence?: PresenceAction, listener?: messageCallback) => void; - enter: (data?: errorCallback | any, callback?: errorCallback) => void; - update: (data?: errorCallback | any, callback?: errorCallback) => void; - leave: (data?: errorCallback | any, callback?: errorCallback) => void; - enterClient: (clientId: string, data?: errorCallback | any, callback?: errorCallback) => void; - updateClient: (clientId: string, data?: errorCallback | any, callback?: errorCallback) => void; - leaveClient: (clientId: string, data?: errorCallback | any, callback?: errorCallback) => void; - } - - class Channel { - name: string; - presence: Presence; - history: (paramsOrCallback?: RestPresenceHistoryParams | paginatedResultCallback, callback?: paginatedResultCallback) => void; - publish: (messagesOrName: any, messagedataOrCallback?: errorCallback | any, callback?: errorCallback) => void; - } - - class RealtimeChannel extends EventEmitter { - name: string; - errorReason: ErrorInfo; - state: ChannelState; - presence: RealtimePresence; - attach: (callback?: standardCallback) => void; - detach: (callback?: standardCallback) => void; - history: (paramsOrCallback?: RealtimePresenceHistoryParams | paginatedResultCallback, callback?: paginatedResultCallback) => void; - subscribe: (eventOrCallback: messageCallback | string, listener?: messageCallback) => void; - unsubscribe: (eventOrCallback?: messageCallback | string, listener?: messageCallback) => void; - publish: (messagesOrName: any, messageDataOrCallback?: errorCallback | any, callback?: errorCallback) => void; - setOptions: (options: any, callback?: errorCallback) => void; - } - - class Channels { - get: (name: string, channelOptions?: ChannelOptions) => T; - release: (name: string) => void; - } - - class Message { - constructor(); - static fromEncoded: fromEncoded; - static fromEncodedArray: fromEncodedArray; - clientId: string; - connectionId: string; - data: any; - encoding: string; - extras: any; - id: string; - name: string; - timestamp: number; - } - - interface MessageStatic { - fromEncoded: fromEncoded; - fromEncodedArray: fromEncodedArray; - } - - class PresenceMessage { - constructor(); - static fromEncoded: fromEncoded; - static fromEncodedArray: fromEncodedArray; - action: PresenceAction; - clientId: string; - connectionId: string; - data: any; - encoding: string; - id: string; - timestamp: number; - } - - interface PresenceMessageStatic { - fromEncoded: fromEncoded; - fromEncodedArray: fromEncodedArray; - } - - interface Crypto { - generateRandomKey(callback: (error: ErrorInfo, key: string) => void): void; - } - - class Connection extends EventEmitter { - errorReason: ErrorInfo; - id: string; - key: string; - recoveryKey: string; - serial: number; - state: ConnectionState; - close: () => void; - connect: () => void; - ping: (callback?: (error: ErrorInfo, responseTime: number) => void) => void; - } - - class Stats { - all: StatsMessageTypes; - apiRequests: StatsRequestCount; - channels: StatsResourceCount; - connections: StatsConnectionTypes; - inbound: StatsMessageTraffic; - intervalId: string; - outbound: StatsMessageTraffic; - persisted: StatsMessageTypes; - tokenRequests: StatsRequestCount; - } - - class PaginatedResult { - items: T[]; - first: (results: paginatedResultCallback) => void; - next: (results: paginatedResultCallback) => void; - current: (results: paginatedResultCallback) => void; - hasNext: () => boolean; - isLast: () => boolean; - } - - class HttpPaginatedResponse extends PaginatedResult { - items: string[]; - statusCode: number; - success: boolean; - errorCode: number; - errorMessage: string; - headers: any; - } -} - -export class Rest { - constructor(options: ablyLib.ClientOptions | string); - static Crypto: ablyLib.Crypto; - static Message: ablyLib.MessageStatic; - static PresenceMessage: ablyLib.PresenceMessageStatic; - auth: ablyLib.Auth; - channels: ablyLib.Channels; - request: (method: string, path: string, params?: any, body?: any[] | any, headers?: any, callback?: (error: ablyLib.ErrorInfo, response: ablyLib.HttpPaginatedResponse) => void) => void; - stats: (paramsOrCallback?: ablyLib.paginatedResultCallback | any, callback?: ablyLib.paginatedResultCallback) => void; - time: (paramsOrCallback?: ablyLib.timeCallback | any, callback?: ablyLib.timeCallback) => void; -} - -export class Realtime { - constructor(options: ablyLib.ClientOptions | string); - static Crypto: ablyLib.Crypto; - static Message: ablyLib.MessageStatic; - static PresenceMessage: ablyLib.PresenceMessageStatic; - auth: ablyLib.Auth; - channels: ablyLib.Channels; - clientId: string; - connection: ablyLib.Connection; - request: (method: string, path: string, params?: any, body?: any[] | any, headers?: any, callback?: (error: ablyLib.ErrorInfo, response: ablyLib.HttpPaginatedResponse) => void) => void; - stats: (paramsOrCallback?: ablyLib.paginatedResultCallback | any, callback?: ablyLib.paginatedResultCallback) => void; - close: () => void; - connect: () => void; - time: (paramsOrCallback?: ablyLib.timeCallback | any, callback?: ablyLib.timeCallback) => void; -} diff --git a/types/accepts/index.d.ts b/types/accepts/index.d.ts index 33ee0db8a1..02cb0fbb97 100644 --- a/types/accepts/index.d.ts +++ b/types/accepts/index.d.ts @@ -12,36 +12,75 @@ declare namespace accepts { interface Accepts { /** * Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned. + * If no charsets are supplied, all accepted charsets are returned, in the order of the client's preference + * (most preferred first). */ + charset(): string[]; charset(charsets: string[]): string | false; charset(...charsets: string[]): string | false; /** - * Return the charsets that the request accepts, in the order of the client's preference (most preferred first). + * Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned. + * If no charsets are supplied, all accepted charsets are returned, in the order of the client's preference + * (most preferred first). */ charsets(): string[]; + charsets(charsets: string[]): string | false; + charsets(...charsets: string[]): string | false; /** * Return the first accepted encoding. If nothing in `encodings` is accepted, then `false` is returned. + * If no encodings are supplied, all accepted encodings are returned, in the order of the client's preference + * (most preferred first). */ + encoding(): string[]; encoding(encodings: string[]): string | false; encoding(...encodings: string[]): string | false; /** - * Return the encodings that the request accepts, in the order of the client's preference (most preferred first). + * Return the first accepted encoding. If nothing in `encodings` is accepted, then `false` is returned. + * If no encodings are supplied, all accepted encodings are returned, in the order of the client's preference + * (most preferred first). */ encodings(): string[]; + encodings(encodings: string[]): string | false; + encodings(...encodings: string[]): string | false; /** * Return the first accepted language. If nothing in `languages` is accepted, then `false` is returned. + * If no languaes are supplied, all accepted languages are returned, in the order of the client's preference + * (most preferred first). */ + language(): string[]; language(languages: string[]): string | false; language(...languages: string[]): string | false; /** - * Return the languages that the request accepts, in the order of the client's preference (most preferred first). + * Return the first accepted language. If nothing in `languages` is accepted, then `false` is returned. + * If no languaes are supplied, all accepted languages are returned, in the order of the client's preference + * (most preferred first). */ languages(): string[]; + languages(languages: string[]): string | false; + languages(...languages: string[]): string | false; + + /** + * Return the first accepted language. If nothing in `languages` is accepted, then `false` is returned. + * If no languaes are supplied, all accepted languages are returned, in the order of the client's preference + * (most preferred first). + */ + lang(): string[]; + lang(languages: string[]): string | false; + lang(...languages: string[]): string | false; + + /** + * Return the first accepted language. If nothing in `languages` is accepted, then `false` is returned. + * If no languaes are supplied, all accepted languages are returned, in the order of the client's preference + * (most preferred first). + */ + langs(): string[]; + langs(languages: string[]): string | false; + langs(...languages: string[]): string | false; /** * Return the first accepted type (and it is returned as the same text as what appears in the `types` array). If nothing in `types` is accepted, then `false` is returned. diff --git a/types/actions-on-google/actions-on-google-tests.ts b/types/actions-on-google/actions-on-google-tests.ts index e57e1e8d98..d24c3093b4 100644 --- a/types/actions-on-google/actions-on-google-tests.ts +++ b/types/actions-on-google/actions-on-google-tests.ts @@ -1,6 +1,6 @@ import { ActionsSdkApp, ActionsSdkAppOptions, DialogflowApp, DialogflowAppOptions, AssistantApp, Responses, Transactions } from 'actions-on-google'; -import * as express from 'express'; +import express = require('express'); function testActionsSdk(request: express.Request, response: express.Response) { const app = new ActionsSdkApp({request, response}); diff --git a/types/actions-on-google/assistant-app.d.ts b/types/actions-on-google/assistant-app.d.ts index 58d933baf2..d835915259 100644 --- a/types/actions-on-google/assistant-app.d.ts +++ b/types/actions-on-google/assistant-app.d.ts @@ -263,8 +263,8 @@ export interface UserName { * User's permissioned device location. */ export interface DeviceLocation { - /** {latitude, longitude}. Requested with SupportedPermissions.DEVICE_PRECISE_LOCATION. */ - coordinates: object; + /** Coordinates: {latitude, longitude}. Requested with SupportedPermissions.DEVICE_PRECISE_LOCATION. */ + coordinates: Coordinates; /** Full, formatted street address. Requested with SupportedPermissions.DEVICE_PRECISE_LOCATION. */ address: string; /** Zip code. Requested with SupportedPermissions.DEVICE_COARSE_LOCATION. */ @@ -273,6 +273,16 @@ export interface DeviceLocation { city: string; } +/** + * Coordinates containing latitude and longitude + */ +export interface Coordinates { + /** Latitude coordinate. */ + latitude: number; + /** Longitude coordinate. */ + longitude: number; +} + /** * User object. */ diff --git a/types/actions-on-google/index.d.ts b/types/actions-on-google/index.d.ts index 23a2c1483d..937943e1f0 100644 --- a/types/actions-on-google/index.d.ts +++ b/types/actions-on-google/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for actions-on-google 1.7 +// Type definitions for actions-on-google 1.8 // Project: https://github.com/actions-on-google/actions-on-google-nodejs // Definitions by: Joel Hegg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/actions-on-google/response-builder.d.ts b/types/actions-on-google/response-builder.d.ts index 4ebb9b3007..227d102958 100644 --- a/types/actions-on-google/response-builder.d.ts +++ b/types/actions-on-google/response-builder.d.ts @@ -20,7 +20,9 @@ export enum ImageDisplays { */ WHITE, /** - * Image is centered and resized so the image fits perfectly in the container. + * Image is scaled such that the image width matches the container width. This may crop the top + * and bottom of the image if the scaled image height is greater than the container height. This + * is similar to "Zoom Mode" on a widescreen TV when playing a 4:3 video. */ CROPPED } diff --git a/types/actions-on-google/transactions.d.ts b/types/actions-on-google/transactions.d.ts index 59e6cd9b37..06e44b33dd 100644 --- a/types/actions-on-google/transactions.d.ts +++ b/types/actions-on-google/transactions.d.ts @@ -594,7 +594,12 @@ export namespace TransactionValues { /** * Use external payment gateway tokenization API to tokenize selected payment method. */ - PAYMENT_GATEWAY + PAYMENT_GATEWAY, + /** + * Allows payment service to pass public key for payment info encryption and receive encrypted + * response. + */ + DIRECT } } diff --git a/types/actions-on-google/tsconfig.json b/types/actions-on-google/tsconfig.json index 6682b5c194..776b12264b 100644 --- a/types/actions-on-google/tsconfig.json +++ b/types/actions-on-google/tsconfig.json @@ -25,4 +25,4 @@ "transactions.d.ts", "actions-on-google-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/activex-access/tslint.json b/types/activex-access/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-access/tslint.json +++ b/types/activex-access/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/activex-adodb/tslint.json b/types/activex-adodb/tslint.json index 2750cc0197..3224b40b8b 100644 --- a/types/activex-adodb/tslint.json +++ b/types/activex-adodb/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file +{ + "extends": "dtslint/dt.json", + "rules": { + "no-const-enum": false + } +} diff --git a/types/activex-dao/tslint.json b/types/activex-dao/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-dao/tslint.json +++ b/types/activex-dao/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/activex-diskquota/activex-diskquota-tests.ts b/types/activex-diskquota/activex-diskquota-tests.ts new file mode 100644 index 0000000000..2672b590ca --- /dev/null +++ b/types/activex-diskquota/activex-diskquota-tests.ts @@ -0,0 +1,44 @@ +const collectionToArray = (col: any) => { // tslint:disable-line no-unnecessary-generics + const results: T[] = []; + const enumerator = new Enumerator(col); + enumerator.moveFirst(); + while (!enumerator.atEnd()) { + results.push(enumerator.item()); + enumerator.moveNext(); + } + return results; +}; + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787925(v=vs.85).aspx +(() => { + const enumUsers = (label: string) => { + const volume = new ActiveXObject('Microsoft.DiskQuota'); + volume.Initialize(label, true); + collectionToArray(volume).forEach(x => { + // Use the QuotaUser object to retrieve or set one or more of the user's disk quota properties + }); + }; +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787916(v=vs.85).aspx +(() => { + const volume = new ActiveXObject('Microsoft.DiskQuota'); + volume.Initialize('MYDISK', true); + ActiveXObject.on(volume, 'OnUserNameChanged', ['pUser'], p => { + // Code to handle the event. + }); +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787904(v=vs.85).aspx +(() => { + const dqc = new ActiveXObject('Microsoft.DiskQuota'); + dqc.Initialize('MYDISK', true); + const findName = (name: string) => { + try { + return dqc.FindUser(name); + } catch { } + try { + return dqc.FindUser(dqc.TranslateLogonNameToSID(name)); + } catch { } + }; +})(); diff --git a/types/activex-diskquota/index.d.ts b/types/activex-diskquota/index.d.ts new file mode 100644 index 0000000000..d27863de3c --- /dev/null +++ b/types/activex-diskquota/index.d.ts @@ -0,0 +1,152 @@ +// Type definitions for DiskQuotaTypeLibrary 1.0 +// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/bb773938(v=vs.85).aspx +// Definitions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.5 + +declare namespace DiskQuotaTypeLibrary { + // tslint:disable-next-line no-const-enum + const enum AccountStatusConstants { + dqAcctDeleted = 2, + dqAcctInvalid = 3, + dqAcctResolved = 0, + dqAcctUnavailable = 1, + dqAcctUnknown = 4, + dqAcctUnresolved = 5, + } + + // tslint:disable-next-line no-const-enum + const enum QuotaStateConstants { + dqStateDisable = 0, + dqStateEnforce = 2, + dqStateTrack = 1, + } + + // tslint:disable-next-line no-const-enum + const enum UserNameResolutionConstants { + dqResolveAsync = 2, + dqResolveNone = 0, + dqResolveSync = 1, + } + + /** Automation interface for DiskQuotaUser */ + class DIDiskQuotaUser { + private 'DiskQuotaTypeLibrary.DIDiskQuotaUser_typekey': DIDiskQuotaUser; + private constructor(); + + /** Name of user's account container */ + readonly AccountContainerName: string; + + /** Status of user's account */ + readonly AccountStatus: AccountStatusConstants; + + /** User's display name */ + readonly DisplayName: string; + + /** Unique ID number */ + readonly ID: number; + + /** Invalidate data cached in user object */ + Invalidate(): void; + + /** User's logon account name */ + readonly LogonName: string; + + /** User's quota limit (bytes) */ + QuotaLimit: number; + + /** User's quota limit (text) */ + readonly QuotaLimitText: string; + + /** User's quota warning threshold (bytes) */ + QuotaThreshold: number; + + /** User's quota warning threshold (text) */ + readonly QuotaThresholdText: string; + + /** Quota charged to user (bytes) */ + readonly QuotaUsed: number; + + /** Quota charged to user (text) */ + readonly QuotaUsedText: string; + } + + /** Microsoft Disk Quota */ + class DiskQuotaControl { + private 'DiskQuotaTypeLibrary.DiskQuotaControl_typekey': DiskQuotaControl; + private constructor(); + + /** Add a user quota entry by Name */ + AddUser(LogonName: string): DIDiskQuotaUser; + + /** Default quota limit applied to new volume users (byte value) */ + DefaultQuotaLimit: number; + + /** Default quota limit applied to new volume users (text string) */ + readonly DefaultQuotaLimitText: string; + + /** Default warning threshold applied to new volume users (byte value) */ + DefaultQuotaThreshold: number; + + /** Default warning threshold applied to new volume users (text string) */ + readonly DefaultQuotaThresholdText: string; + + /** Delete a user quota entry */ + DeleteUser(pUser: DIDiskQuotaUser): void; + + /** Find a user quota entry by Name */ + FindUser(LogonName: string): DIDiskQuotaUser; + + /** Promote a user quota entry to the head of the name resolution queue */ + GiveUserNameResolutionPriority(pUser: DIDiskQuotaUser): void; + + /** Initialize the quota control object for a specified volume */ + Initialize(path: string, bReadWrite: boolean): void; + + /** Invalidate the cache of user name information */ + InvalidateSidNameCache(): void; + + /** Write event log entry when user exceeds quota limit */ + LogQuotaLimit: boolean; + + /** Write event log entry when user exceeds quota warning threshold */ + LogQuotaThreshold: boolean; + + /** Indicates if quota information is out of date */ + readonly QuotaFileIncomplete: boolean; + + /** Indicates if quota information is being rebuilt */ + readonly QuotaFileRebuilding: boolean; + + /** State of the volume's disk quota system */ + QuotaState: QuotaStateConstants; + + /** Terminate the user name resolution thread */ + ShutdownNameResolution(): void; + + /** Translates a user logon name to a security ID */ + TranslateLogonNameToSID(LogonName: string): string; + + /** Control the resolution of user Security IDs to user Names */ + UserNameResolution: UserNameResolutionConstants; + } +} + +interface ActiveXObject { + on( + obj: DiskQuotaTypeLibrary.DiskQuotaControl, event: 'OnUserNameChanged', argNames: ['pUser'], handler: ( + this: DiskQuotaTypeLibrary.DiskQuotaControl, parameter: {readonly pUser: DiskQuotaTypeLibrary.DIDiskQuotaUser}) => void): void; + new(progid: K): ActiveXObjectNameMap[K]; +} + +interface ActiveXObjectNameMap { + 'Microsoft.DiskQuota': DiskQuotaTypeLibrary.DiskQuotaControl; +} + +interface EnumeratorConstructor { + new(col: DiskQuotaTypeLibrary.DiskQuotaControl): Enumerator; +} + +interface SafeArray { + _brand: SafeArray; +} diff --git a/types/activex-diskquota/package.json b/types/activex-diskquota/package.json new file mode 100644 index 0000000000..d9b1031263 --- /dev/null +++ b/types/activex-diskquota/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "activex-helpers": "*" + } +} \ No newline at end of file diff --git a/types/activex-diskquota/tsconfig.json b/types/activex-diskquota/tsconfig.json new file mode 100644 index 0000000000..597d998a96 --- /dev/null +++ b/types/activex-diskquota/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5", + "scripthost" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "activex-diskquota-tests.ts" + ] +} \ No newline at end of file diff --git a/types/activex-diskquota/tslint.json b/types/activex-diskquota/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/activex-diskquota/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/activex-excel/index.d.ts b/types/activex-excel/index.d.ts index ec2044f1e7..cdf2a79551 100644 --- a/types/activex-excel/index.d.ts +++ b/types/activex-excel/index.d.ts @@ -2,13 +2,14 @@ // Project: https://msdn.microsoft.com/en-us/library/fp179694.aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// /// /// declare namespace Excel { + // tslint:disable-next-line:no-const-enum const enum Constants { xl3DBar = -4099, xl3DEffects1 = 13, @@ -179,6 +180,7 @@ declare namespace Excel { xlWorksheetShort = 5, } + // tslint:disable-next-line:no-const-enum const enum XlAboveBelow { xlAboveAverage = 0, xlAboveStdDev = 4, @@ -188,6 +190,7 @@ declare namespace Excel { xlEqualBelowAverage = 3, } + // tslint:disable-next-line:no-const-enum const enum XlActionType { xlActionTypeDrillthrough = 256, xlActionTypeReport = 128, @@ -195,21 +198,25 @@ declare namespace Excel { xlActionTypeUrl = 1, } + // tslint:disable-next-line:no-const-enum const enum XlAllocation { xlAutomaticAllocation = 2, xlManualAllocation = 1, } + // tslint:disable-next-line:no-const-enum const enum XlAllocationMethod { xlEqualAllocation = 1, xlWeightedAllocation = 2, } + // tslint:disable-next-line:no-const-enum const enum XlAllocationValue { xlAllocateIncrement = 2, xlAllocateValue = 1, } + // tslint:disable-next-line:no-const-enum const enum XlApplicationInternational { xl24HourClock = 33, xl4DigitYears = 43, @@ -258,11 +265,13 @@ declare namespace Excel { xlYearCode = 19, } + // tslint:disable-next-line:no-const-enum const enum XlApplyNamesOrder { xlColumnThenRow = 2, xlRowThenColumn = 1, } + // tslint:disable-next-line:no-const-enum const enum XlArabicModes { xlArabicBothStrict = 3, xlArabicNone = 0, @@ -270,6 +279,7 @@ declare namespace Excel { xlArabicStrictFinalYaa = 2, } + // tslint:disable-next-line:no-const-enum const enum XlArrangeStyle { xlArrangeStyleCascade = 7, xlArrangeStyleHorizontal = -4128, @@ -277,12 +287,14 @@ declare namespace Excel { xlArrangeStyleVertical = -4166, } + // tslint:disable-next-line:no-const-enum const enum XlArrowHeadLength { xlArrowHeadLengthLong = 3, xlArrowHeadLengthMedium = -4138, xlArrowHeadLengthShort = 1, } + // tslint:disable-next-line:no-const-enum const enum XlArrowHeadStyle { xlArrowHeadStyleClosed = 3, xlArrowHeadStyleDoubleClosed = 5, @@ -291,12 +303,14 @@ declare namespace Excel { xlArrowHeadStyleOpen = 2, } + // tslint:disable-next-line:no-const-enum const enum XlArrowHeadWidth { xlArrowHeadWidthMedium = -4138, xlArrowHeadWidthNarrow = 1, xlArrowHeadWidthWide = 3, } + // tslint:disable-next-line:no-const-enum const enum XlAutoFillType { xlFillCopy = 1, xlFillDays = 5, @@ -311,6 +325,7 @@ declare namespace Excel { xlLinearTrend = 9, } + // tslint:disable-next-line:no-const-enum const enum XlAutoFilterOperator { xlAnd = 1, xlBottom10Items = 4, @@ -328,6 +343,7 @@ declare namespace Excel { xlTop10Percent = 5, } + // tslint:disable-next-line:no-const-enum const enum XlAxisCrosses { xlAxisCrossesAutomatic = -4105, xlAxisCrossesCustom = -4114, @@ -335,23 +351,27 @@ declare namespace Excel { xlAxisCrossesMinimum = 4, } + // tslint:disable-next-line:no-const-enum const enum XlAxisGroup { xlPrimary = 1, xlSecondary = 2, } + // tslint:disable-next-line:no-const-enum const enum XlAxisType { xlCategory = 1, xlSeriesAxis = 3, xlValue = 2, } + // tslint:disable-next-line:no-const-enum const enum XlBackground { xlBackgroundAutomatic = -4105, xlBackgroundOpaque = 3, xlBackgroundTransparent = 2, } + // tslint:disable-next-line:no-const-enum const enum XlBarShape { xlBox = 0, xlConeToMax = 5, @@ -361,6 +381,7 @@ declare namespace Excel { xlPyramidToPoint = 1, } + // tslint:disable-next-line:no-const-enum const enum XlBordersIndex { xlDiagonalDown = 5, xlDiagonalUp = 6, @@ -372,6 +393,7 @@ declare namespace Excel { xlInsideVertical = 11, } + // tslint:disable-next-line:no-const-enum const enum XlBorderWeight { xlHairline = 1, xlMedium = -4138, @@ -379,6 +401,7 @@ declare namespace Excel { xlThin = 2, } + // tslint:disable-next-line:no-const-enum const enum XlBuiltInDialog { _xlDialogChartSourceData = 541, _xlDialogPhonetic = 538, @@ -641,53 +664,62 @@ declare namespace Excel { xlDialogZoom = 256, } + // tslint:disable-next-line:no-const-enum const enum XlCalcFor { xlAllValues = 0, xlColGroups = 2, xlRowGroups = 1, } + // tslint:disable-next-line:no-const-enum const enum XlCalculatedMemberType { xlCalculatedMember = 0, xlCalculatedSet = 1, } + // tslint:disable-next-line:no-const-enum const enum XlCalculation { xlCalculationAutomatic = -4105, xlCalculationManual = -4135, xlCalculationSemiautomatic = 2, } + // tslint:disable-next-line:no-const-enum const enum XlCalculationInterruptKey { xlAnyKey = 2, xlEscKey = 1, xlNoKey = 0, } + // tslint:disable-next-line:no-const-enum const enum XlCalculationState { xlCalculating = 1, xlDone = 0, xlPending = 2, } + // tslint:disable-next-line:no-const-enum const enum XlCategoryType { xlAutomaticScale = -4105, xlCategoryScale = 2, xlTimeScale = 3, } + // tslint:disable-next-line:no-const-enum const enum XlCellChangedState { xlCellChangeApplied = 3, xlCellChanged = 2, xlCellNotChanged = 1, } + // tslint:disable-next-line:no-const-enum const enum XlCellInsertionMode { xlInsertDeleteCells = 1, xlInsertEntireRows = 2, xlOverwriteCells = 0, } + // tslint:disable-next-line:no-const-enum const enum XlCellType { xlCellTypeAllFormatConditions = -4172, xlCellTypeAllValidation = -4174, @@ -701,17 +733,20 @@ declare namespace Excel { xlCellTypeVisible = 12, } + // tslint:disable-next-line:no-const-enum const enum XlChartElementPosition { xlChartElementPositionAutomatic = -4105, xlChartElementPositionCustom = -4114, } + // tslint:disable-next-line:no-const-enum const enum XlChartGallery { xlAnyGallery = 23, xlBuiltIn = 21, xlUserDefined = 22, } + // tslint:disable-next-line:no-const-enum const enum XlChartItem { xlAxis = 21, xlAxisTitle = 17, @@ -747,12 +782,14 @@ declare namespace Excel { xlYErrorBars = 11, } + // tslint:disable-next-line:no-const-enum const enum XlChartLocation { xlLocationAsNewSheet = 1, xlLocationAsObject = 2, xlLocationAutomatic = 3, } + // tslint:disable-next-line:no-const-enum const enum XlChartPicturePlacement { xlAllFaces = 7, xlEnd = 2, @@ -763,12 +800,14 @@ declare namespace Excel { xlSides = 1, } + // tslint:disable-next-line:no-const-enum const enum XlChartPictureType { xlStack = 2, xlStackScale = 3, xlStretch = 1, } + // tslint:disable-next-line:no-const-enum const enum XlChartSplitType { xlSplitByCustomSplit = 4, xlSplitByPercentValue = 3, @@ -776,6 +815,7 @@ declare namespace Excel { xlSplitByValue = 2, } + // tslint:disable-next-line:no-const-enum const enum XlChartType { xl3DArea = -4098, xl3DAreaStacked = 78, @@ -852,12 +892,14 @@ declare namespace Excel { xlXYScatterSmoothNoMarkers = 73, } + // tslint:disable-next-line:no-const-enum const enum XlCheckInVersionType { xlCheckInMajorVersion = 1, xlCheckInMinorVersion = 0, xlCheckInOverwriteVersion = 2, } + // tslint:disable-next-line:no-const-enum const enum XlClipboardFormat { xlClipboardFormatBIFF = 8, xlClipboardFormatBIFF12 = 63, @@ -895,6 +937,7 @@ declare namespace Excel { xlClipboardFormatWK1 = 10, } + // tslint:disable-next-line:no-const-enum const enum XlCmdType { xlCmdCube = 1, xlCmdDefault = 4, @@ -903,11 +946,13 @@ declare namespace Excel { xlCmdTable = 3, } + // tslint:disable-next-line:no-const-enum const enum XlColorIndex { xlColorIndexAutomatic = -4105, xlColorIndexNone = -4142, } + // tslint:disable-next-line:no-const-enum const enum XlColumnDataType { xlDMYFormat = 4, xlDYMFormat = 7, @@ -921,18 +966,21 @@ declare namespace Excel { xlYMDFormat = 5, } + // tslint:disable-next-line:no-const-enum const enum XlCommandUnderlines { xlCommandUnderlinesAutomatic = -4105, xlCommandUnderlinesOff = -4146, xlCommandUnderlinesOn = 1, } + // tslint:disable-next-line:no-const-enum const enum XlCommentDisplayMode { xlCommentAndIndicator = 1, xlCommentIndicatorOnly = -1, xlNoIndicator = 0, } + // tslint:disable-next-line:no-const-enum const enum XlConditionValueTypes { xlConditionValueAutomaticMax = 7, xlConditionValueAutomaticMin = 6, @@ -945,6 +993,7 @@ declare namespace Excel { xlConditionValuePercentile = 5, } + // tslint:disable-next-line:no-const-enum const enum XlConnectionType { xlConnectionTypeODBC = 2, xlConnectionTypeOLEDB = 1, @@ -953,6 +1002,7 @@ declare namespace Excel { xlConnectionTypeXMLMAP = 3, } + // tslint:disable-next-line:no-const-enum const enum XlConsolidationFunction { xlAverage = -4106, xlCount = -4112, @@ -968,6 +1018,7 @@ declare namespace Excel { xlVarP = -4165, } + // tslint:disable-next-line:no-const-enum const enum XlContainsOperator { xlBeginsWith = 2, xlContains = 0, @@ -975,27 +1026,32 @@ declare namespace Excel { xlEndsWith = 3, } + // tslint:disable-next-line:no-const-enum const enum XlCopyPictureFormat { xlBitmap = 2, xlPicture = -4147, } + // tslint:disable-next-line:no-const-enum const enum XlCorruptLoad { xlExtractData = 2, xlNormalLoad = 0, xlRepairFile = 1, } + // tslint:disable-next-line:no-const-enum const enum XlCreator { xlCreatorCode = 1480803660, } + // tslint:disable-next-line:no-const-enum const enum XlCredentialsMethod { xlCredentialsMethodIntegrated = 0, xlCredentialsMethodNone = 1, xlCredentialsMethodStored = 2, } + // tslint:disable-next-line:no-const-enum const enum XlCubeFieldSubType { xlCubeAttribute = 4, xlCubeCalculatedMeasure = 5, @@ -1009,17 +1065,20 @@ declare namespace Excel { xlCubeSet = 3, } + // tslint:disable-next-line:no-const-enum const enum XlCubeFieldType { xlHierarchy = 1, xlMeasure = 2, xlSet = 3, } + // tslint:disable-next-line:no-const-enum const enum XlCutCopyMode { xlCopy = 1, xlCut = 2, } + // tslint:disable-next-line:no-const-enum const enum XlCVError { xlErrDiv0 = 2007, xlErrNA = 2042, @@ -1030,27 +1089,32 @@ declare namespace Excel { xlErrValue = 2015, } + // tslint:disable-next-line:no-const-enum const enum XlDataBarAxisPosition { xlDataBarAxisAutomatic = 0, xlDataBarAxisMidpoint = 1, xlDataBarAxisNone = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDataBarBorderType { xlDataBarBorderNone = 0, xlDataBarBorderSolid = 1, } + // tslint:disable-next-line:no-const-enum const enum XlDataBarFillType { xlDataBarFillGradient = 1, xlDataBarFillSolid = 0, } + // tslint:disable-next-line:no-const-enum const enum XlDataBarNegativeColorType { xlDataBarColor = 0, xlDataBarSameAsPositive = 1, } + // tslint:disable-next-line:no-const-enum const enum XlDataLabelPosition { xlLabelPositionAbove = 0, xlLabelPositionBelow = 1, @@ -1065,10 +1129,12 @@ declare namespace Excel { xlLabelPositionRight = -4152, } + // tslint:disable-next-line:no-const-enum const enum XlDataLabelSeparator { xlDataLabelSeparatorDefault = 1, } + // tslint:disable-next-line:no-const-enum const enum XlDataLabelsType { xlDataLabelsShowBubbleSizes = 6, xlDataLabelsShowLabel = 4, @@ -1078,6 +1144,7 @@ declare namespace Excel { xlDataLabelsShowValue = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDataSeriesDate { xlDay = 1, xlMonth = 3, @@ -1085,6 +1152,7 @@ declare namespace Excel { xlYear = 4, } + // tslint:disable-next-line:no-const-enum const enum XlDataSeriesType { xlAutoFill = 4, xlChronological = 3, @@ -1092,11 +1160,13 @@ declare namespace Excel { xlGrowth = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDeleteShiftDirection { xlShiftToLeft = -4159, xlShiftUp = -4162, } + // tslint:disable-next-line:no-const-enum const enum XlDirection { xlDown = -4121, xlToLeft = -4159, @@ -1104,18 +1174,21 @@ declare namespace Excel { xlUp = -4162, } + // tslint:disable-next-line:no-const-enum const enum XlDisplayBlanksAs { xlInterpolated = 3, xlNotPlotted = 1, xlZero = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDisplayDrawingObjects { xlDisplayShapes = -4104, xlHide = 3, xlPlaceholders = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDisplayUnit { xlHundredMillions = -8, xlHundreds = -2, @@ -1128,17 +1201,20 @@ declare namespace Excel { xlThousands = -3, } + // tslint:disable-next-line:no-const-enum const enum XlDupeUnique { xlDuplicate = 1, xlUnique = 0, } + // tslint:disable-next-line:no-const-enum const enum XlDVAlertStyle { xlValidAlertInformation = 3, xlValidAlertStop = 1, xlValidAlertWarning = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDVType { xlValidateCustom = 7, xlValidateDate = 4, @@ -1150,6 +1226,7 @@ declare namespace Excel { xlValidateWholeNumber = 1, } + // tslint:disable-next-line:no-const-enum const enum XlDynamicFilterCriteria { xlFilterAboveAverage = 33, xlFilterAllDatesInPeriodApril = 24, @@ -1187,6 +1264,7 @@ declare namespace Excel { xlFilterYesterday = 2, } + // tslint:disable-next-line:no-const-enum const enum XlEditionFormat { xlBIFF = 2, xlPICT = 1, @@ -1194,6 +1272,7 @@ declare namespace Excel { xlVALU = 8, } + // tslint:disable-next-line:no-const-enum const enum XlEditionOptionsOption { xlAutomaticUpdate = 4, xlCancel = 1, @@ -1205,33 +1284,39 @@ declare namespace Excel { xlUpdateSubscriber = 2, } + // tslint:disable-next-line:no-const-enum const enum XlEditionType { xlPublisher = 1, xlSubscriber = 2, } + // tslint:disable-next-line:no-const-enum const enum XlEnableCancelKey { xlDisabled = 0, xlErrorHandler = 2, xlInterrupt = 1, } + // tslint:disable-next-line:no-const-enum const enum XlEnableSelection { xlNoRestrictions = 0, xlNoSelection = -4142, xlUnlockedCells = 1, } + // tslint:disable-next-line:no-const-enum const enum XlEndStyleCap { xlCap = 1, xlNoCap = 2, } + // tslint:disable-next-line:no-const-enum const enum XlErrorBarDirection { xlX = -4168, xlY = 1, } + // tslint:disable-next-line:no-const-enum const enum XlErrorBarInclude { xlErrorBarIncludeBoth = 1, xlErrorBarIncludeMinusValues = 3, @@ -1239,6 +1324,7 @@ declare namespace Excel { xlErrorBarIncludePlusValues = 2, } + // tslint:disable-next-line:no-const-enum const enum XlErrorBarType { xlErrorBarTypeCustom = -4114, xlErrorBarTypeFixedValue = 1, @@ -1247,6 +1333,7 @@ declare namespace Excel { xlErrorBarTypeStError = 4, } + // tslint:disable-next-line:no-const-enum const enum XlErrorChecks { xlEmptyCellReferences = 7, xlEvaluateToError = 1, @@ -1259,11 +1346,13 @@ declare namespace Excel { xlUnlockedFormulaCells = 6, } + // tslint:disable-next-line:no-const-enum const enum XlFileAccess { xlReadOnly = 3, xlReadWrite = 2, } + // tslint:disable-next-line:no-const-enum const enum XlFileFormat { xlAddIn = 18, xlAddIn8 = 18, @@ -1321,23 +1410,27 @@ declare namespace Excel { xlXMLSpreadsheet = 46, } + // tslint:disable-next-line:no-const-enum const enum XlFileValidationPivotMode { xlFileValidationPivotDefault = 0, xlFileValidationPivotRun = 1, xlFileValidationPivotSkip = 2, } + // tslint:disable-next-line:no-const-enum const enum XlFillWith { xlFillWithAll = -4104, xlFillWithContents = 2, xlFillWithFormats = -4122, } + // tslint:disable-next-line:no-const-enum const enum XlFilterAction { xlFilterCopy = 2, xlFilterInPlace = 1, } + // tslint:disable-next-line:no-const-enum const enum XlFilterAllDatesInPeriod { xlFilterAllDatesInPeriodDay = 2, xlFilterAllDatesInPeriodHour = 3, @@ -1347,22 +1440,26 @@ declare namespace Excel { xlFilterAllDatesInPeriodYear = 0, } + // tslint:disable-next-line:no-const-enum const enum XlFindLookIn { xlComments = -4144, xlFormulas = -4123, xlValues = -4163, } + // tslint:disable-next-line:no-const-enum const enum XlFixedFormatQuality { xlQualityMinimum = 1, xlQualityStandard = 0, } + // tslint:disable-next-line:no-const-enum const enum XlFixedFormatType { xlTypePDF = 0, xlTypeXPS = 1, } + // tslint:disable-next-line:no-const-enum const enum XlFormatConditionOperator { xlBetween = 1, xlEqual = 3, @@ -1374,6 +1471,7 @@ declare namespace Excel { xlNotEqual = 4, } + // tslint:disable-next-line:no-const-enum const enum XlFormatConditionType { xlAboveAverageCondition = 12, xlBlanksCondition = 10, @@ -1391,6 +1489,7 @@ declare namespace Excel { xlUniqueValues = 8, } + // tslint:disable-next-line:no-const-enum const enum XlFormatFilterTypes { xlFilterBottom = 0, xlFilterBottomPercent = 2, @@ -1398,6 +1497,7 @@ declare namespace Excel { xlFilterTopPercent = 3, } + // tslint:disable-next-line:no-const-enum const enum XlFormControl { xlButtonControl = 0, xlCheckBox = 1, @@ -1411,6 +1511,7 @@ declare namespace Excel { xlSpinner = 9, } + // tslint:disable-next-line:no-const-enum const enum XlFormulaLabel { xlColumnLabels = 2, xlMixedLabels = 3, @@ -1418,16 +1519,19 @@ declare namespace Excel { xlRowLabels = 1, } + // tslint:disable-next-line:no-const-enum const enum XlGenerateTableRefs { xlGenerateTableRefA1 = 0, xlGenerateTableRefStruct = 1, } + // tslint:disable-next-line:no-const-enum const enum XlGradientFillType { xlGradientFillLinear = 0, xlGradientFillPath = 1, } + // tslint:disable-next-line:no-const-enum const enum XlHAlign { xlHAlignCenter = -4108, xlHAlignCenterAcrossSelection = 7, @@ -1439,6 +1543,7 @@ declare namespace Excel { xlHAlignRight = -4152, } + // tslint:disable-next-line:no-const-enum const enum XlHebrewModes { xlHebrewFullScript = 0, xlHebrewMixedAuthorizedScript = 3, @@ -1446,12 +1551,14 @@ declare namespace Excel { xlHebrewPartialScript = 1, } + // tslint:disable-next-line:no-const-enum const enum XlHighlightChangesTime { xlAllChanges = 2, xlNotYetReviewed = 3, xlSinceMyLastSave = 1, } + // tslint:disable-next-line:no-const-enum const enum XlHtmlType { xlHtmlCalc = 1, xlHtmlChart = 3, @@ -1459,6 +1566,7 @@ declare namespace Excel { xlHtmlStatic = 0, } + // tslint:disable-next-line:no-const-enum const enum XlIcon { xlIcon0Bars = 37, xlIcon0FilledBoxes = 52, @@ -1515,6 +1623,7 @@ declare namespace Excel { xlIconYellowUpInclineArrow = 25, } + // tslint:disable-next-line:no-const-enum const enum XlIconSet { xl3Arrows = 1, xl3ArrowsGray = 2, @@ -1539,6 +1648,7 @@ declare namespace Excel { xlCustomSet = -1, } + // tslint:disable-next-line:no-const-enum const enum XlIMEMode { xlIMEModeAlpha = 8, xlIMEModeAlphaFull = 7, @@ -1553,33 +1663,39 @@ declare namespace Excel { xlIMEModeOn = 1, } + // tslint:disable-next-line:no-const-enum const enum XlImportDataAs { xlPivotTableReport = 1, xlQueryTable = 0, xlTable = 2, } + // tslint:disable-next-line:no-const-enum const enum XlInsertFormatOrigin { xlFormatFromLeftOrAbove = 0, xlFormatFromRightOrBelow = 1, } + // tslint:disable-next-line:no-const-enum const enum XlInsertShiftDirection { xlShiftDown = -4121, xlShiftToRight = -4161, } + // tslint:disable-next-line:no-const-enum const enum XlLayoutFormType { xlOutline = 1, xlTabular = 0, } + // tslint:disable-next-line:no-const-enum const enum XlLayoutRowType { xlCompactRow = 0, xlOutlineRow = 2, xlTabularRow = 1, } + // tslint:disable-next-line:no-const-enum const enum XlLegendPosition { xlLegendPositionBottom = -4107, xlLegendPositionCorner = 2, @@ -1589,6 +1705,7 @@ declare namespace Excel { xlLegendPositionTop = -4160, } + // tslint:disable-next-line:no-const-enum const enum XlLineStyle { xlContinuous = 1, xlDash = -4115, @@ -1600,6 +1717,7 @@ declare namespace Excel { xlSlantDashDot = 13, } + // tslint:disable-next-line:no-const-enum const enum XlLink { xlExcelLinks = 1, xlOLELinks = 2, @@ -1607,18 +1725,21 @@ declare namespace Excel { xlSubscribers = 6, } + // tslint:disable-next-line:no-const-enum const enum XlLinkInfo { xlEditionDate = 2, xlLinkInfoStatus = 3, xlUpdateState = 1, } + // tslint:disable-next-line:no-const-enum const enum XlLinkInfoType { xlLinkInfoOLELinks = 2, xlLinkInfoPublishers = 5, xlLinkInfoSubscribers = 6, } + // tslint:disable-next-line:no-const-enum const enum XlLinkStatus { xlLinkStatusCopiedValues = 10, xlLinkStatusIndeterminate = 5, @@ -1633,11 +1754,13 @@ declare namespace Excel { xlLinkStatusSourceOpen = 9, } + // tslint:disable-next-line:no-const-enum const enum XlLinkType { xlLinkTypeExcelLinks = 1, xlLinkTypeOLELinks = 2, } + // tslint:disable-next-line:no-const-enum const enum XlListConflict { xlListConflictDialog = 0, xlListConflictDiscardAllConflicts = 2, @@ -1645,6 +1768,7 @@ declare namespace Excel { xlListConflictRetryAllConflicts = 1, } + // tslint:disable-next-line:no-const-enum const enum XlListDataType { xlListDataTypeCheckbox = 9, xlListDataTypeChoice = 6, @@ -1661,6 +1785,7 @@ declare namespace Excel { xlListDataTypeText = 1, } + // tslint:disable-next-line:no-const-enum const enum XlListObjectSourceType { xlSrcExternal = 0, xlSrcQuery = 3, @@ -1668,6 +1793,7 @@ declare namespace Excel { xlSrcXml = 2, } + // tslint:disable-next-line:no-const-enum const enum XlLocationInTable { xlColumnHeader = -4110, xlColumnItem = 5, @@ -1680,23 +1806,27 @@ declare namespace Excel { xlTableBody = 8, } + // tslint:disable-next-line:no-const-enum const enum XlLookAt { xlPart = 2, xlWhole = 1, } + // tslint:disable-next-line:no-const-enum const enum XlLookFor { xlLookForBlanks = 0, xlLookForErrors = 1, xlLookForFormulas = 2, } + // tslint:disable-next-line:no-const-enum const enum XlMailSystem { xlMAPI = 1, xlNoMailSystem = 0, xlPowerTalk = 2, } + // tslint:disable-next-line:no-const-enum const enum XlMarkerStyle { xlMarkerStyleAutomatic = -4105, xlMarkerStyleCircle = 8, @@ -1712,18 +1842,21 @@ declare namespace Excel { xlMarkerStyleX = -4168, } + // tslint:disable-next-line:no-const-enum const enum XlMeasurementUnits { xlCentimeters = 1, xlInches = 0, xlMillimeters = 2, } + // tslint:disable-next-line:no-const-enum const enum XlMouseButton { xlNoButton = 0, xlPrimaryButton = 1, xlSecondaryButton = 2, } + // tslint:disable-next-line:no-const-enum const enum XlMousePointer { xlDefault = -4143, xlIBeam = 3, @@ -1731,6 +1864,7 @@ declare namespace Excel { xlWait = 2, } + // tslint:disable-next-line:no-const-enum const enum XlMSApplication { xlMicrosoftAccess = 4, xlMicrosoftFoxPro = 5, @@ -1741,39 +1875,46 @@ declare namespace Excel { xlMicrosoftWord = 1, } + // tslint:disable-next-line:no-const-enum const enum XlOartHorizontalOverflow { xlOartHorizontalOverflowClip = 1, xlOartHorizontalOverflowOverflow = 0, } + // tslint:disable-next-line:no-const-enum const enum XlOartVerticalOverflow { xlOartVerticalOverflowClip = 1, xlOartVerticalOverflowEllipsis = 2, xlOartVerticalOverflowOverflow = 0, } + // tslint:disable-next-line:no-const-enum const enum XlObjectSize { xlFitToPage = 2, xlFullPage = 3, xlScreenSize = 1, } + // tslint:disable-next-line:no-const-enum const enum XlOLEType { xlOLEControl = 2, xlOLEEmbed = 1, xlOLELink = 0, } + // tslint:disable-next-line:no-const-enum const enum XlOLEVerb { xlVerbOpen = 2, xlVerbPrimary = 1, } + // tslint:disable-next-line:no-const-enum const enum XlOrder { xlDownThenOver = 1, xlOverThenDown = 2, } + // tslint:disable-next-line:no-const-enum const enum XlOrientation { xlDownward = -4170, xlHorizontal = -4128, @@ -1781,22 +1922,26 @@ declare namespace Excel { xlVertical = -4166, } + // tslint:disable-next-line:no-const-enum const enum XlPageBreak { xlPageBreakAutomatic = -4105, xlPageBreakManual = -4135, xlPageBreakNone = -4142, } + // tslint:disable-next-line:no-const-enum const enum XlPageBreakExtent { xlPageBreakFull = 1, xlPageBreakPartial = 2, } + // tslint:disable-next-line:no-const-enum const enum XlPageOrientation { xlLandscape = 2, xlPortrait = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPaperSize { xlPaper10x14 = 16, xlPaper11x17 = 17, @@ -1842,6 +1987,7 @@ declare namespace Excel { xlPaperUser = 256, } + // tslint:disable-next-line:no-const-enum const enum XlParameterDataType { xlParamTypeBigInt = -5, xlParamTypeBinary = -2, @@ -1866,12 +2012,14 @@ declare namespace Excel { xlParamTypeWChar = -8, } + // tslint:disable-next-line:no-const-enum const enum XlParameterType { xlConstant = 1, xlPrompt = 0, xlRange = 2, } + // tslint:disable-next-line:no-const-enum const enum XlPasteSpecialOperation { xlPasteSpecialOperationAdd = 2, xlPasteSpecialOperationDivide = 5, @@ -1880,6 +2028,7 @@ declare namespace Excel { xlPasteSpecialOperationSubtract = 3, } + // tslint:disable-next-line:no-const-enum const enum XlPasteType { xlPasteAll = -4104, xlPasteAllExceptBorders = 7, @@ -1895,6 +2044,7 @@ declare namespace Excel { xlPasteValuesAndNumberFormats = 12, } + // tslint:disable-next-line:no-const-enum const enum XlPattern { xlPatternAutomatic = -4105, xlPatternChecker = 9, @@ -1920,6 +2070,7 @@ declare namespace Excel { xlPatternVertical = -4166, } + // tslint:disable-next-line:no-const-enum const enum XlPhoneticAlignment { xlPhoneticAlignCenter = 2, xlPhoneticAlignDistributed = 3, @@ -1927,6 +2078,7 @@ declare namespace Excel { xlPhoneticAlignNoControl = 0, } + // tslint:disable-next-line:no-const-enum const enum XlPhoneticCharacterType { xlHiragana = 2, xlKatakana = 1, @@ -1934,11 +2086,13 @@ declare namespace Excel { xlNoConversion = 3, } + // tslint:disable-next-line:no-const-enum const enum XlPictureAppearance { xlPrinter = 2, xlScreen = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPictureConvertorType { xlBMP = 1, xlCGM = 7, @@ -1955,6 +2109,7 @@ declare namespace Excel { xlWPG = 3, } + // tslint:disable-next-line:no-const-enum const enum XlPieSliceIndex { xlCenterPoint = 5, xlInnerCenterPoint = 8, @@ -1967,11 +2122,13 @@ declare namespace Excel { xlOuterCounterClockwisePoint = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPieSliceLocation { xlHorizontalCoordinate = 1, xlVerticalCoordinate = 2, } + // tslint:disable-next-line:no-const-enum const enum XlPivotCellType { xlPivotCellBlankCell = 9, xlPivotCellCustomSubtotal = 7, @@ -1985,12 +2142,14 @@ declare namespace Excel { xlPivotCellValue = 0, } + // tslint:disable-next-line:no-const-enum const enum XlPivotConditionScope { xlDataFieldScope = 2, xlFieldsScope = 1, xlSelectionScope = 0, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFieldCalculation { xlDifferenceFrom = 2, xlIndex = 9, @@ -2009,12 +2168,14 @@ declare namespace Excel { xlRunningTotal = 5, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFieldDataType { xlDate = 2, xlNumber = -4145, xlText = -4158, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFieldOrientation { xlColumnField = 2, xlDataField = 4, @@ -2023,11 +2184,13 @@ declare namespace Excel { xlRowField = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFieldRepeatLabels { xlDoNotRepeatLabels = 1, xlRepeatLabels = 2, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFilterType { xlAfter = 33, xlAfterOrEqualTo = 34, @@ -2099,6 +2262,7 @@ declare namespace Excel { xlYearToDate = 52, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFormatType { xlPTClassic = 20, xlPTNone = 21, @@ -2124,6 +2288,7 @@ declare namespace Excel { xlTable9 = 18, } + // tslint:disable-next-line:no-const-enum const enum XlPivotLineType { xlPivotLineBlank = 3, xlPivotLineGrandTotal = 2, @@ -2131,6 +2296,7 @@ declare namespace Excel { xlPivotLineSubtotal = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPivotTableMissingItems { xlMissingItemsDefault = -1, xlMissingItemsMax = 32500, @@ -2138,6 +2304,7 @@ declare namespace Excel { xlMissingItemsNone = 0, } + // tslint:disable-next-line:no-const-enum const enum XlPivotTableSourceType { xlConsolidation = 3, xlDatabase = 1, @@ -2146,6 +2313,7 @@ declare namespace Excel { xlScenario = 4, } + // tslint:disable-next-line:no-const-enum const enum XlPivotTableVersionList { xlPivotTableVersion10 = 1, xlPivotTableVersion11 = 2, @@ -2155,24 +2323,28 @@ declare namespace Excel { xlPivotTableVersionCurrent = -1, } + // tslint:disable-next-line:no-const-enum const enum XlPlacement { xlFreeFloating = 3, xlMove = 2, xlMoveAndSize = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPlatform { xlMacintosh = 1, xlMSDOS = 3, xlWindows = 2, } + // tslint:disable-next-line:no-const-enum const enum XlPortugueseReform { xlPortugueseBoth = 3, xlPortuguesePostReform = 2, xlPortuguesePreReform = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPrintErrors { xlPrintErrorsBlank = 1, xlPrintErrorsDash = 2, @@ -2180,36 +2352,42 @@ declare namespace Excel { xlPrintErrorsNA = 3, } + // tslint:disable-next-line:no-const-enum const enum XlPrintLocation { xlPrintInPlace = 16, xlPrintNoComments = -4142, xlPrintSheetEnd = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPriority { xlPriorityHigh = -4127, xlPriorityLow = -4134, xlPriorityNormal = -4143, } + // tslint:disable-next-line:no-const-enum const enum XlPropertyDisplayedIn { xlDisplayPropertyInPivotTable = 1, xlDisplayPropertyInPivotTableAndTooltip = 3, xlDisplayPropertyInTooltip = 2, } + // tslint:disable-next-line:no-const-enum const enum XlProtectedViewCloseReason { xlProtectedViewCloseEdit = 1, xlProtectedViewCloseForced = 2, xlProtectedViewCloseNormal = 0, } + // tslint:disable-next-line:no-const-enum const enum XlProtectedViewWindowState { xlProtectedViewWindowMaximized = 2, xlProtectedViewWindowMinimized = 1, xlProtectedViewWindowNormal = 0, } + // tslint:disable-next-line:no-const-enum const enum XlPTSelectionMode { xlBlanks = 4, xlButton = 15, @@ -2220,6 +2398,7 @@ declare namespace Excel { xlOrigin = 3, } + // tslint:disable-next-line:no-const-enum const enum XlQueryType { xlADORecordset = 7, xlDAORecordset = 2, @@ -2229,6 +2408,7 @@ declare namespace Excel { xlWebQuery = 4, } + // tslint:disable-next-line:no-const-enum const enum XlRangeAutoFormat { xlRangeAutoFormat3DEffects1 = 13, xlRangeAutoFormat3DEffects2 = 14, @@ -2275,17 +2455,20 @@ declare namespace Excel { xlRangeAutoFormatTable9 = 40, } + // tslint:disable-next-line:no-const-enum const enum XlRangeValueDataType { xlRangeValueDefault = 10, xlRangeValueMSPersistXML = 12, xlRangeValueXMLSpreadsheet = 11, } + // tslint:disable-next-line:no-const-enum const enum XlReferenceStyle { xlA1 = 1, xlR1C1 = -4150, } + // tslint:disable-next-line:no-const-enum const enum XlReferenceType { xlAbsolute = 1, xlAbsRowRelColumn = 2, @@ -2293,6 +2476,7 @@ declare namespace Excel { xlRelRowAbsColumn = 3, } + // tslint:disable-next-line:no-const-enum const enum XlRemoveDocInfoType { xlRDIAll = 99, xlRDIComments = 1, @@ -2313,6 +2497,7 @@ declare namespace Excel { xlRDISendForReview = 7, } + // tslint:disable-next-line:no-const-enum const enum XlRgbColor { rgbAliceBlue = 16775408, rgbAntiqueWhite = 14150650, @@ -2460,28 +2645,33 @@ declare namespace Excel { rgbYellowGreen = 3329434, } + // tslint:disable-next-line:no-const-enum const enum XlRobustConnect { xlAlways = 1, xlAsRequired = 0, xlNever = 2, } + // tslint:disable-next-line:no-const-enum const enum XlRoutingSlipDelivery { xlAllAtOnce = 2, xlOneAfterAnother = 1, } + // tslint:disable-next-line:no-const-enum const enum XlRoutingSlipStatus { xlNotYetRouted = 0, xlRoutingComplete = 2, xlRoutingInProgress = 1, } + // tslint:disable-next-line:no-const-enum const enum XlRowCol { xlColumns = 2, xlRows = 1, } + // tslint:disable-next-line:no-const-enum const enum XlRunAutoMacro { xlAutoActivate = 3, xlAutoClose = 2, @@ -2489,43 +2679,51 @@ declare namespace Excel { xlAutoOpen = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSaveAction { xlDoNotSaveChanges = 2, xlSaveChanges = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSaveAsAccessMode { xlExclusive = 3, xlNoChange = 1, xlShared = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSaveConflictResolution { xlLocalSessionChanges = 2, xlOtherSessionChanges = 3, xlUserResolution = 1, } + // tslint:disable-next-line:no-const-enum const enum XlScaleType { xlScaleLinear = -4132, xlScaleLogarithmic = -4133, } + // tslint:disable-next-line:no-const-enum const enum XlSearchDirection { xlNext = 1, xlPrevious = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSearchOrder { xlByColumns = 2, xlByRows = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSearchWithin { xlWithinSheet = 1, xlWithinWorkbook = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSheetType { xlChart = -4109, xlDialogSheet = -4116, @@ -2534,29 +2732,34 @@ declare namespace Excel { xlWorksheet = -4167, } + // tslint:disable-next-line:no-const-enum const enum XlSheetVisibility { xlSheetHidden = 0, xlSheetVeryHidden = 2, xlSheetVisible = -1, } + // tslint:disable-next-line:no-const-enum const enum XlSizeRepresents { xlSizeIsArea = 1, xlSizeIsWidth = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSlicerCrossFilterType { xlSlicerCrossFilterShowItemsWithDataAtTop = 2, xlSlicerCrossFilterShowItemsWithNoData = 3, xlSlicerNoCrossFilter = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSlicerSort { xlSlicerSortAscending = 2, xlSlicerSortDataSourceOrder = 1, xlSlicerSortDescending = 3, } + // tslint:disable-next-line:no-const-enum const enum XlSmartTagControlType { xlSmartTagControlActiveX = 13, xlSmartTagControlButton = 6, @@ -2574,27 +2777,32 @@ declare namespace Excel { xlSmartTagControlTextbox = 10, } + // tslint:disable-next-line:no-const-enum const enum XlSmartTagDisplayMode { xlButtonOnly = 2, xlDisplayNone = 1, xlIndicatorAndButton = 0, } + // tslint:disable-next-line:no-const-enum const enum XlSortDataOption { xlSortNormal = 0, xlSortTextAsNumbers = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSortMethod { xlPinYin = 1, xlStroke = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSortMethodOld { xlCodePage = 2, xlSyllabary = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSortOn { xlSortOnCellColor = 1, xlSortOnFontColor = 2, @@ -2602,21 +2810,25 @@ declare namespace Excel { xlSortOnValues = 0, } + // tslint:disable-next-line:no-const-enum const enum XlSortOrder { xlAscending = 1, xlDescending = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSortOrientation { xlSortColumns = 1, xlSortRows = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSortType { xlSortLabels = 2, xlSortValues = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSourceType { xlSourceAutoFilter = 3, xlSourceChart = 5, @@ -2628,35 +2840,41 @@ declare namespace Excel { xlSourceWorkbook = 0, } + // tslint:disable-next-line:no-const-enum const enum XlSpanishModes { xlSpanishTuteoAndVoseo = 1, xlSpanishTuteoOnly = 0, xlSpanishVoseoOnly = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSparklineRowCol { xlSparklineColumnsSquare = 2, xlSparklineNonSquare = 0, xlSparklineRowsSquare = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSparkScale { xlSparkScaleCustom = 3, xlSparkScaleGroup = 1, xlSparkScaleSingle = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSparkType { xlSparkColumn = 2, xlSparkColumnStacked100 = 3, xlSparkLine = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSpeakDirection { xlSpeakByColumns = 1, xlSpeakByRows = 0, } + // tslint:disable-next-line:no-const-enum const enum XlSpecialCellsValue { xlErrors = 16, xlLogical = 4, @@ -2664,6 +2882,7 @@ declare namespace Excel { xlTextValues = 2, } + // tslint:disable-next-line:no-const-enum const enum XlStdColorScale { xlColorScaleBlackWhite = 3, xlColorScaleGYR = 2, @@ -2671,31 +2890,37 @@ declare namespace Excel { xlColorScaleWhiteBlack = 4, } + // tslint:disable-next-line:no-const-enum const enum XlSubscribeToFormat { xlSubscribeToPicture = -4147, xlSubscribeToText = -4158, } + // tslint:disable-next-line:no-const-enum const enum XlSubtototalLocationType { xlAtBottom = 2, xlAtTop = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSummaryColumn { xlSummaryOnLeft = -4131, xlSummaryOnRight = -4152, } + // tslint:disable-next-line:no-const-enum const enum XlSummaryReportType { xlStandardSummary = 1, xlSummaryPivotTable = -4148, } + // tslint:disable-next-line:no-const-enum const enum XlSummaryRow { xlSummaryAbove = 0, xlSummaryBelow = 1, } + // tslint:disable-next-line:no-const-enum const enum XlTableStyleElementType { xlBlankRow = 19, xlColumnStripe1 = 7, @@ -2737,27 +2962,32 @@ declare namespace Excel { xlWholeTable = 0, } + // tslint:disable-next-line:no-const-enum const enum XlTabPosition { xlTabPositionFirst = 0, xlTabPositionLast = 1, } + // tslint:disable-next-line:no-const-enum const enum XlTextParsingType { xlDelimited = 1, xlFixedWidth = 2, } + // tslint:disable-next-line:no-const-enum const enum XlTextQualifier { xlTextQualifierDoubleQuote = 1, xlTextQualifierNone = -4142, xlTextQualifierSingleQuote = 2, } + // tslint:disable-next-line:no-const-enum const enum XlTextVisualLayoutType { xlTextVisualLTR = 1, xlTextVisualRTL = 2, } + // tslint:disable-next-line:no-const-enum const enum XlThemeColor { xlThemeColorAccent1 = 5, xlThemeColorAccent2 = 6, @@ -2773,17 +3003,20 @@ declare namespace Excel { xlThemeColorLight2 = 4, } + // tslint:disable-next-line:no-const-enum const enum XlThemeFont { xlThemeFontMajor = 1, xlThemeFontMinor = 2, xlThemeFontNone = 0, } + // tslint:disable-next-line:no-const-enum const enum XlThreadMode { xlThreadModeAutomatic = 0, xlThreadModeManual = 1, } + // tslint:disable-next-line:no-const-enum const enum XlTickLabelOrientation { xlTickLabelOrientationAutomatic = -4105, xlTickLabelOrientationDownward = -4170, @@ -2792,6 +3025,7 @@ declare namespace Excel { xlTickLabelOrientationVertical = -4166, } + // tslint:disable-next-line:no-const-enum const enum XlTickLabelPosition { xlTickLabelPositionHigh = -4127, xlTickLabelPositionLow = -4134, @@ -2799,6 +3033,7 @@ declare namespace Excel { xlTickLabelPositionNone = -4142, } + // tslint:disable-next-line:no-const-enum const enum XlTickMark { xlTickMarkCross = 4, xlTickMarkInside = 2, @@ -2806,6 +3041,7 @@ declare namespace Excel { xlTickMarkOutside = 3, } + // tslint:disable-next-line:no-const-enum const enum XlTimePeriods { xlLast7Days = 2, xlLastMonth = 5, @@ -2819,12 +3055,14 @@ declare namespace Excel { xlYesterday = 1, } + // tslint:disable-next-line:no-const-enum const enum XlTimeUnit { xlDays = 0, xlMonths = 1, xlYears = 2, } + // tslint:disable-next-line:no-const-enum const enum XlToolbarProtection { xlNoButtonChanges = 1, xlNoChanges = 4, @@ -2833,11 +3071,13 @@ declare namespace Excel { xlToolbarProtectionNone = -4143, } + // tslint:disable-next-line:no-const-enum const enum XlTopBottom { xlTop10Bottom = 0, xlTop10Top = 1, } + // tslint:disable-next-line:no-const-enum const enum XlTotalsCalculation { xlTotalsCalculationAverage = 2, xlTotalsCalculationCount = 3, @@ -2851,6 +3091,7 @@ declare namespace Excel { xlTotalsCalculationVar = 8, } + // tslint:disable-next-line:no-const-enum const enum XlTrendlineType { xlExponential = 5, xlLinear = -4132, @@ -2860,6 +3101,7 @@ declare namespace Excel { xlPower = 4, } + // tslint:disable-next-line:no-const-enum const enum XlUnderlineStyle { xlUnderlineStyleDouble = -4119, xlUnderlineStyleDoubleAccounting = 5, @@ -2868,12 +3110,14 @@ declare namespace Excel { xlUnderlineStyleSingleAccounting = 4, } + // tslint:disable-next-line:no-const-enum const enum XlUpdateLinks { xlUpdateLinksAlways = 3, xlUpdateLinksNever = 2, xlUpdateLinksUserSetting = 1, } + // tslint:disable-next-line:no-const-enum const enum XlVAlign { xlVAlignBottom = -4107, xlVAlignCenter = -4108, @@ -2882,6 +3126,7 @@ declare namespace Excel { xlVAlignTop = -4160, } + // tslint:disable-next-line:no-const-enum const enum XlWBATemplate { xlWBATChart = -4109, xlWBATExcel4IntlMacroSheet = 4, @@ -2889,24 +3134,28 @@ declare namespace Excel { xlWBATWorksheet = -4167, } + // tslint:disable-next-line:no-const-enum const enum XlWebFormatting { xlWebFormattingAll = 1, xlWebFormattingNone = 3, xlWebFormattingRTF = 2, } + // tslint:disable-next-line:no-const-enum const enum XlWebSelectionType { xlAllTables = 2, xlEntirePage = 1, xlSpecifiedTables = 3, } + // tslint:disable-next-line:no-const-enum const enum XlWindowState { xlMaximized = -4137, xlMinimized = -4140, xlNormal = -4143, } + // tslint:disable-next-line:no-const-enum const enum XlWindowType { xlChartAsWindow = 5, xlChartInPlace = 4, @@ -2915,29 +3164,34 @@ declare namespace Excel { xlWorkbook = 1, } + // tslint:disable-next-line:no-const-enum const enum XlWindowView { xlNormalView = 1, xlPageBreakPreview = 2, xlPageLayoutView = 3, } + // tslint:disable-next-line:no-const-enum const enum XlXLMMacroType { xlCommand = 2, xlFunction = 1, xlNotXLM = 3, } + // tslint:disable-next-line:no-const-enum const enum XlXmlExportResult { xlXmlExportSuccess = 0, xlXmlExportValidationFailed = 1, } + // tslint:disable-next-line:no-const-enum const enum XlXmlImportResult { xlXmlImportElementsTruncated = 1, xlXmlImportSuccess = 0, xlXmlImportValidationFailed = 2, } + // tslint:disable-next-line:no-const-enum const enum XlXmlLoadOption { xlXmlLoadImportToList = 2, xlXmlLoadMapXml = 3, @@ -2945,6 +3199,7 @@ declare namespace Excel { xlXmlLoadPromptUser = 0, } + // tslint:disable-next-line:no-const-enum const enum XlYesNoGuess { xlGuess = 0, xlNo = 2, @@ -6547,7 +6802,7 @@ declare namespace Excel { /** @param Excel.XlSearchDirection [SearchDirection=1] */ Find(What: any, After?: any, LookIn?: XlFindLookIn, LookAt?: XlLookAt, SearchOrder?: XlSearchOrder, SearchDirection?: XlSearchDirection, MatchCase?: boolean, - MatchByte?: boolean, SearchFormat?: any): Range; + MatchByte?: boolean, SearchFormat?: any): Range; FindNext(After?: any): Range; FindPrevious(After?: any): Range; readonly Font: Font; @@ -7049,7 +7304,7 @@ declare namespace Excel { AddLabel(Orientation: Office.MsoTextOrientation, Left: number, Top: number, Width: number, Height: number): Shape; AddLine(BeginX: number, BeginY: number, EndX: number, EndY: number): Shape; AddOLEObject(ClassType?: any, Filename?: any, Link?: any, DisplayAsIcon?: any, IconFileName?: any, IconIndex?: any, IconLabel?: any, Left?: any, Top?: any, Width?: any, - Height?: any): Shape; + Height?: any): Shape; AddPicture(Filename: string, LinkToFile: Office.MsoTriState, SaveWithDocument: Office.MsoTriState, Left: number, Top: number, Width: number, Height: number): Shape; AddPolyline(SafeArrayOfPoints: any): Shape; AddShape(Type: Office.MsoAutoShapeType, Left: number, Top: number, Width: number, Height: number): Shape; @@ -9243,217 +9498,221 @@ declare namespace Excel { interface ActiveXObject { on( obj: Excel.Application, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Application, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.Application, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.Application, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Application, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.Application, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Application, parameter: {pctinfo: number}) => void): void; + this: Excel.Application, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Application, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Application, parameter: { pctinfo: number }) => void): void; on( obj: Excel.Application, event: 'Invoke', argNames: Excel.EventHelperTypes.Application_Invoke_ArgNames, handler: ( this: Excel.Application, parameter: Excel.EventHelperTypes.Application_Invoke_Parameter) => void): void; on( obj: Excel.Application, event: 'NewWorkbook' | 'WorkbookActivate' | 'WorkbookAddinInstall' | 'WorkbookAddinUninstall' | 'WorkbookDeactivate' | 'WorkbookOpen', - argNames: ['Wb'], handler: (this: Excel.Application, parameter: {readonly Wb: Excel.Workbook}) => void): void; + argNames: ['Wb'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook }) => void): void; on( obj: Excel.Application, event: 'ProtectedViewWindowActivate' | 'ProtectedViewWindowDeactivate' | 'ProtectedViewWindowOpen' | 'ProtectedViewWindowResize', - argNames: ['Pvw'], handler: (this: Excel.Application, parameter: {readonly Pvw: Excel.ProtectedViewWindow}) => void): void; + argNames: ['Pvw'], handler: (this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow }) => void): void; on( obj: Excel.Application, event: 'ProtectedViewWindowBeforeClose', argNames: ['Pvw', 'Reason', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Pvw: Excel.ProtectedViewWindow, readonly Reason: Excel.XlProtectedViewCloseReason, Cancel: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow, readonly Reason: Excel.XlProtectedViewCloseReason, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'ProtectedViewWindowBeforeEdit', argNames: ['Pvw', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Pvw: Excel.ProtectedViewWindow, Cancel: boolean}) => void): void; - on(obj: Excel.Application, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Application, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; - on(obj: Excel.Application, event: 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: (this: Excel.Application, parameter: {readonly Sh: any}) => void): void; + this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Application, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; + on(obj: Excel.Application, event: 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: (this: Excel.Application, parameter: { readonly Sh: any }) => void): void; on( obj: Excel.Application, event: 'SheetBeforeDoubleClick' | 'SheetBeforeRightClick', argNames: ['Sh', 'Target', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly Target: Excel.Range, Cancel: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.Range, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'SheetChange' | 'SheetSelectionChange', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly Target: Excel.Range}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.Range }) => void): void; on( obj: Excel.Application, event: 'SheetFollowHyperlink', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly Target: Excel.Hyperlink}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.Hyperlink }) => void): void; on( obj: Excel.Application, event: 'SheetPivotTableAfterValueChange', argNames: ['Sh', 'TargetPivotTable', 'TargetRange'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; on( obj: Excel.Application, event: 'SheetPivotTableBeforeAllocateChanges' | 'SheetPivotTableBeforeCommitChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: ( this: Excel.Application, - parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean}) => void): void; + parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'SheetPivotTableBeforeDiscardChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; on( obj: Excel.Application, event: 'SheetPivotTableUpdate', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly Target: Excel.PivotTable}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.PivotTable }) => void): void; on( obj: Excel.Application, event: 'WindowActivate' | 'WindowDeactivate' | 'WindowResize', argNames: ['Wb', 'Wn'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Wn: Excel.Window}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Wn: Excel.Window }) => void): void; on( obj: Excel.Application, event: 'WorkbookAfterSave', argNames: ['Wb', 'Success'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Success: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Success: boolean }) => void): void; on( obj: Excel.Application, event: 'WorkbookAfterXmlExport', argNames: ['Wb', 'Map', 'Url', 'Result'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult }) => void): void; on( obj: Excel.Application, event: 'WorkbookAfterXmlImport', argNames: ['Wb', 'Map', 'IsRefresh', 'Result'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult }) => void): void; on( obj: Excel.Application, event: 'WorkbookBeforeClose' | 'WorkbookBeforePrint', argNames: ['Wb', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, Cancel: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'WorkbookBeforeSave', argNames: ['Wb', 'SaveAsUI', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly SaveAsUI: boolean, Cancel: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly SaveAsUI: boolean, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'WorkbookBeforeXmlExport', argNames: ['Wb', 'Map', 'Url', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'WorkbookBeforeXmlImport', argNames: ['Wb', 'Map', 'Url', 'IsRefresh', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean}) => void): void; - on(obj: Excel.Application, event: 'WorkbookNewChart', argNames: ['Wb', 'Ch'], handler: (this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Ch: Excel.Chart}) => void): void; - on(obj: Excel.Application, event: 'WorkbookNewSheet', argNames: ['Wb', 'Sh'], handler: (this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Sh: any}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'WorkbookNewChart', argNames: ['Wb', 'Ch'], handler: ( + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Ch: Excel.Chart }) => void): void; + on(obj: Excel.Application, event: 'WorkbookNewSheet', argNames: ['Wb', 'Sh'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Sh: any }) => void): void; on( obj: Excel.Application, event: 'WorkbookPivotTableCloseConnection' | 'WorkbookPivotTableOpenConnection', argNames: ['Wb', 'Target'], - handler: (this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Target: Excel.PivotTable}) => void): void; + handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Target: Excel.PivotTable }) => void): void; on( obj: Excel.Application, event: 'WorkbookRowsetComplete', argNames: ['Wb', 'Description', 'Sheet', 'Success'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Description: string, readonly Sheet: string, readonly Success: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Description: string, readonly Sheet: string, readonly Success: boolean }) => void): void; on( obj: Excel.Application, event: 'WorkbookSync', argNames: ['Wb', 'SyncEventType'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly SyncEventType: Office.MsoSyncEventType}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly SyncEventType: Office.MsoSyncEventType }) => void): void; on( obj: Excel.Chart, event: 'BeforeDoubleClick', argNames: ['ElementID', 'Arg1', 'Arg2', 'Cancel'], handler: ( - this: Excel.Chart, parameter: {readonly ElementID: number, readonly Arg1: number, readonly Arg2: number, Cancel: boolean}) => void): void; - on(obj: Excel.Chart, event: 'BeforeRightClick', argNames: ['Cancel'], handler: (this: Excel.Chart, parameter: {Cancel: boolean}) => void): void; + this: Excel.Chart, parameter: { readonly ElementID: number, readonly Arg1: number, readonly Arg2: number, Cancel: boolean }) => void): void; + on(obj: Excel.Chart, event: 'BeforeRightClick', argNames: ['Cancel'], handler: (this: Excel.Chart, parameter: { Cancel: boolean }) => void): void; on( obj: Excel.Chart, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Chart, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.Chart, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.Chart, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Chart, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.Chart, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Chart, parameter: {pctinfo: number}) => void): void; + this: Excel.Chart, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Chart, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Chart, parameter: { pctinfo: number }) => void): void; on(obj: Excel.Chart, event: 'Invoke', argNames: Excel.EventHelperTypes.Chart_Invoke_ArgNames, handler: (this: Excel.Chart, parameter: Excel.EventHelperTypes.Chart_Invoke_Parameter) => void): void; on( obj: Excel.Chart, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'x', 'y'], handler: ( - this: Excel.Chart, parameter: {readonly Button: number, readonly Shift: number, readonly x: number, readonly y: number}) => void): void; - on(obj: Excel.Chart, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Chart, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; + this: Excel.Chart, parameter: { readonly Button: number, readonly Shift: number, readonly x: number, readonly y: number }) => void): void; + on(obj: Excel.Chart, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Chart, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; on( obj: Excel.Chart, event: 'Select', argNames: ['ElementID', 'Arg1', 'Arg2'], handler: ( - this: Excel.Chart, parameter: {readonly ElementID: number, readonly Arg1: number, readonly Arg2: number}) => void): void; + this: Excel.Chart, parameter: { readonly ElementID: number, readonly Arg1: number, readonly Arg2: number }) => void): void; on( obj: Excel.Chart, event: 'SeriesChange', argNames: ['SeriesIndex', 'PointIndex'], handler: ( - this: Excel.Chart, parameter: {readonly SeriesIndex: number, readonly PointIndex: number}) => void): void; + this: Excel.Chart, parameter: { readonly SeriesIndex: number, readonly PointIndex: number }) => void): void; on( obj: Excel.OLEObject, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.OLEObject, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.OLEObject, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.OLEObject, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.OLEObject, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.OLEObject, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.OLEObject, parameter: {pctinfo: number}) => void): void; + this: Excel.OLEObject, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.OLEObject, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.OLEObject, parameter: { pctinfo: number }) => void): void; on( obj: Excel.OLEObject, event: 'Invoke', argNames: Excel.EventHelperTypes.OLEObject_Invoke_ArgNames, handler: ( this: Excel.OLEObject, parameter: Excel.EventHelperTypes.OLEObject_Invoke_Parameter) => void): void; - on(obj: Excel.OLEObject, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.OLEObject, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; - on(obj: Excel.QueryTable, event: 'AfterRefresh', argNames: ['Success'], handler: (this: Excel.QueryTable, parameter: {readonly Success: boolean}) => void): void; - on(obj: Excel.QueryTable, event: 'BeforeRefresh', argNames: ['Cancel'], handler: (this: Excel.QueryTable, parameter: {Cancel: boolean}) => void): void; + on(obj: Excel.OLEObject, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.OLEObject, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; + on(obj: Excel.QueryTable, event: 'AfterRefresh', argNames: ['Success'], handler: (this: Excel.QueryTable, parameter: { readonly Success: boolean }) => void): void; + on(obj: Excel.QueryTable, event: 'BeforeRefresh', argNames: ['Cancel'], handler: (this: Excel.QueryTable, parameter: { Cancel: boolean }) => void): void; on( obj: Excel.QueryTable, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.QueryTable, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.QueryTable, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.QueryTable, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.QueryTable, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.QueryTable, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.QueryTable, parameter: {pctinfo: number}) => void): void; + this: Excel.QueryTable, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.QueryTable, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.QueryTable, parameter: { pctinfo: number }) => void): void; on( obj: Excel.QueryTable, event: 'Invoke', argNames: Excel.EventHelperTypes.QueryTable_Invoke_ArgNames, handler: ( this: Excel.QueryTable, parameter: Excel.EventHelperTypes.QueryTable_Invoke_Parameter) => void): void; - on(obj: Excel.QueryTable, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.QueryTable, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; - on(obj: Excel.Workbook, event: 'AfterSave', argNames: ['Success'], handler: (this: Excel.Workbook, parameter: {readonly Success: boolean}) => void): void; + on(obj: Excel.QueryTable, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.QueryTable, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; + on(obj: Excel.Workbook, event: 'AfterSave', argNames: ['Success'], handler: (this: Excel.Workbook, parameter: { readonly Success: boolean }) => void): void; on( obj: Excel.Workbook, event: 'AfterXmlExport', argNames: ['Map', 'Url', 'Result'], handler: ( - this: Excel.Workbook, parameter: {readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult}) => void): void; + this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult }) => void): void; on( obj: Excel.Workbook, event: 'AfterXmlImport', argNames: ['Map', 'IsRefresh', 'Result'], handler: ( - this: Excel.Workbook, parameter: {readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult}) => void): void; - on(obj: Excel.Workbook, event: 'BeforeClose' | 'BeforePrint', argNames: ['Cancel'], handler: (this: Excel.Workbook, parameter: {Cancel: boolean}) => void): void; - on(obj: Excel.Workbook, event: 'BeforeSave', argNames: ['SaveAsUI', 'Cancel'], handler: (this: Excel.Workbook, parameter: {readonly SaveAsUI: boolean, Cancel: boolean}) => void): void; + this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult }) => void): void; + on(obj: Excel.Workbook, event: 'BeforeClose' | 'BeforePrint', argNames: ['Cancel'], handler: (this: Excel.Workbook, parameter: { Cancel: boolean }) => void): void; + on(obj: Excel.Workbook, event: 'BeforeSave', argNames: ['SaveAsUI', 'Cancel'], handler: (this: Excel.Workbook, parameter: { readonly SaveAsUI: boolean, Cancel: boolean }) => void): void; on( obj: Excel.Workbook, event: 'BeforeXmlExport', argNames: ['Map', 'Url', 'Cancel'], handler: ( - this: Excel.Workbook, parameter: {readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean}) => void): void; + this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean }) => void): void; on( obj: Excel.Workbook, event: 'BeforeXmlImport', argNames: ['Map', 'Url', 'IsRefresh', 'Cancel'], handler: ( - this: Excel.Workbook, parameter: {readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean}) => void): void; + this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean }) => void): void; on( obj: Excel.Workbook, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Workbook, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.Workbook, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.Workbook, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Workbook, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.Workbook, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Workbook, parameter: {pctinfo: number}) => void): void; + this: Excel.Workbook, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Workbook, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Workbook, parameter: { pctinfo: number }) => void): void; on( obj: Excel.Workbook, event: 'Invoke', argNames: Excel.EventHelperTypes.Workbook_Invoke_ArgNames, handler: ( this: Excel.Workbook, parameter: Excel.EventHelperTypes.Workbook_Invoke_Parameter) => void): void; - on(obj: Excel.Workbook, event: 'NewChart', argNames: ['Ch'], handler: (this: Excel.Workbook, parameter: {readonly Ch: Excel.Chart}) => void): void; - on(obj: Excel.Workbook, event: 'NewSheet' | 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: (this: Excel.Workbook, parameter: {readonly Sh: any}) => void): void; + on(obj: Excel.Workbook, event: 'NewChart', argNames: ['Ch'], handler: (this: Excel.Workbook, parameter: { readonly Ch: Excel.Chart }) => void): void; + on(obj: Excel.Workbook, event: 'NewSheet' | 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: ( + this: Excel.Workbook, parameter: { readonly Sh: any }) => void): void; on( obj: Excel.Workbook, event: 'PivotTableCloseConnection' | 'PivotTableOpenConnection', argNames: ['Target'], handler: ( - this: Excel.Workbook, parameter: {readonly Target: Excel.PivotTable}) => void): void; - on(obj: Excel.Workbook, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Workbook, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; + this: Excel.Workbook, parameter: { readonly Target: Excel.PivotTable }) => void): void; + on(obj: Excel.Workbook, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Workbook, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; on( obj: Excel.Workbook, event: 'RowsetComplete', argNames: ['Description', 'Sheet', 'Success'], handler: ( - this: Excel.Workbook, parameter: {readonly Description: string, readonly Sheet: string, readonly Success: boolean}) => void): void; + this: Excel.Workbook, parameter: { readonly Description: string, readonly Sheet: string, readonly Success: boolean }) => void): void; on( obj: Excel.Workbook, event: 'SheetBeforeDoubleClick' | 'SheetBeforeRightClick', argNames: ['Sh', 'Target', 'Cancel'], handler: ( - this: Excel.Workbook, parameter: {readonly Sh: any, readonly Target: Excel.Range, Cancel: boolean}) => void): void; + this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.Range, Cancel: boolean }) => void): void; on( obj: Excel.Workbook, event: 'SheetChange' | 'SheetSelectionChange', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Workbook, parameter: {readonly Sh: any, readonly Target: Excel.Range}) => void): void; - on(obj: Excel.Workbook, event: 'SheetFollowHyperlink', argNames: ['Sh', 'Target'], handler: (this: Excel.Workbook, parameter: {readonly Sh: any, readonly Target: Excel.Hyperlink}) => void): void; + this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.Range }) => void): void; + on(obj: Excel.Workbook, event: 'SheetFollowHyperlink', argNames: ['Sh', 'Target'], handler: ( + this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.Hyperlink }) => void): void; on( obj: Excel.Workbook, event: 'SheetPivotTableAfterValueChange', argNames: ['Sh', 'TargetPivotTable', 'TargetRange'], handler: ( - this: Excel.Workbook, parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range}) => void): void; + this: Excel.Workbook, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; on( obj: Excel.Workbook, event: 'SheetPivotTableBeforeAllocateChanges' | 'SheetPivotTableBeforeCommitChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: ( this: Excel.Workbook, - parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean}) => void): void; + parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; on( - obj: Excel.Workbook, event: 'SheetPivotTableBeforeDiscardChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], - handler: (this: Excel.Workbook, parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number}) => void): void; + obj: Excel.Workbook, event: 'SheetPivotTableBeforeDiscardChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], handler: ( + this: Excel.Workbook, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; on( obj: Excel.Workbook, event: 'SheetPivotTableChangeSync' | 'SheetPivotTableUpdate', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Workbook, parameter: {readonly Sh: any, readonly Target: Excel.PivotTable}) => void): void; - on(obj: Excel.Workbook, event: 'Sync', argNames: ['SyncEventType'], handler: (this: Excel.Workbook, parameter: {readonly SyncEventType: Office.MsoSyncEventType}) => void): void; - on(obj: Excel.Workbook, event: 'WindowActivate' | 'WindowDeactivate' | 'WindowResize', argNames: ['Wn'], handler: (this: Excel.Workbook, parameter: {readonly Wn: Excel.Window}) => void): void; + this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.PivotTable }) => void): void; + on(obj: Excel.Workbook, event: 'Sync', argNames: ['SyncEventType'], handler: (this: Excel.Workbook, parameter: { readonly SyncEventType: Office.MsoSyncEventType }) => void): void; + on(obj: Excel.Workbook, event: 'WindowActivate' | 'WindowDeactivate' | 'WindowResize', argNames: ['Wn'], handler: (this: Excel.Workbook, parameter: { readonly Wn: Excel.Window }) => void): void; on( obj: Excel.Worksheet, event: 'BeforeDoubleClick' | 'BeforeRightClick', argNames: ['Target', 'Cancel'], handler: ( - this: Excel.Worksheet, parameter: {readonly Target: Excel.Range, Cancel: boolean}) => void): void; - on(obj: Excel.Worksheet, event: 'Change' | 'SelectionChange', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: {readonly Target: Excel.Range}) => void): void; - on(obj: Excel.Worksheet, event: 'FollowHyperlink', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: {readonly Target: Excel.Hyperlink}) => void): void; + this: Excel.Worksheet, parameter: { readonly Target: Excel.Range, Cancel: boolean }) => void): void; + on(obj: Excel.Worksheet, event: 'Change' | 'SelectionChange', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: { readonly Target: Excel.Range }) => void): void; + on(obj: Excel.Worksheet, event: 'FollowHyperlink', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: { readonly Target: Excel.Hyperlink }) => void): void; on( obj: Excel.Worksheet, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Worksheet, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.Worksheet, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.Worksheet, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Worksheet, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.Worksheet, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Worksheet, parameter: {pctinfo: number}) => void): void; + this: Excel.Worksheet, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Worksheet, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Worksheet, parameter: { pctinfo: number }) => void): void; on( obj: Excel.Worksheet, event: 'Invoke', argNames: Excel.EventHelperTypes.Worksheet_Invoke_ArgNames, handler: ( this: Excel.Worksheet, parameter: Excel.EventHelperTypes.Worksheet_Invoke_Parameter) => void): void; on( obj: Excel.Worksheet, event: 'PivotTableAfterValueChange', argNames: ['TargetPivotTable', 'TargetRange'], handler: ( - this: Excel.Worksheet, parameter: {readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range}) => void): void; + this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; on( obj: Excel.Worksheet, event: 'PivotTableBeforeAllocateChanges' | 'PivotTableBeforeCommitChanges', argNames: ['TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: ( - this: Excel.Worksheet, parameter: {readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean}) => void): void; + this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; on( obj: Excel.Worksheet, event: 'PivotTableBeforeDiscardChanges', argNames: ['TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], - handler: (this: Excel.Worksheet, parameter: {readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number}) => void): void; - on(obj: Excel.Worksheet, event: 'PivotTableChangeSync' | 'PivotTableUpdate', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: {readonly Target: Excel.PivotTable}) => void): void; - on(obj: Excel.Worksheet, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Worksheet, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; + handler: (this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; + on(obj: Excel.Worksheet, event: 'PivotTableChangeSync' | 'PivotTableUpdate', argNames: ['Target'], handler: ( + this: Excel.Worksheet, parameter: { readonly Target: Excel.PivotTable }) => void): void; + on(obj: Excel.Worksheet, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Worksheet, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; on(obj: Excel.Application, event: 'AddRef' | 'AfterCalculate' | 'Release', handler: (this: Excel.Application, parameter: {}) => void): void; on(obj: Excel.Chart, event: 'Activate' | 'AddRef' | 'Calculate' | 'Deactivate' | 'DragOver' | 'DragPlot' | 'Release' | 'Resize', handler: (this: Excel.Chart, parameter: {}) => void): void; on(obj: Excel.OLEObject, event: 'AddRef' | 'GotFocus' | 'LostFocus' | 'Release', handler: (this: Excel.OLEObject, parameter: {}) => void): void; @@ -9464,7 +9723,7 @@ interface ActiveXObject { set(obj: Excel.Workbook, propertyName: 'Colors', parameterTypes: [any], newValue: any): void; set(obj: Excel.Range, propertyName: 'Value', parameterTypes: [Excel.XlRangeValueDataType], newValue: any): void; set(obj: Excel.Range, propertyName: 'Value', newValue: any): void; // because Value is defined on the type as a method, not a property - new(progid: K): ActiveXObjectNameMap[K]; + new (progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { @@ -9474,26 +9733,8 @@ interface ActiveXObjectNameMap { } interface EnumeratorConstructor { - new(col: Excel.Actions): Enumerator; - new(col: Excel.AddIns | Excel.AddIns2): Enumerator; - new(col: Excel.AllowEditRanges): Enumerator; - new(col: Excel.Areas | Excel.Ranges): Enumerator; - new(col: Excel.Borders): Enumerator; - new(col: Excel.CalculatedFields): Enumerator; - new(col: Excel.CalculatedItems | Excel.PivotItemList): Enumerator; - new(col: Excel.CalculatedMembers): Enumerator; - new(col: Excel.Comments): Enumerator; - new(col: Excel.Connections): Enumerator; - new(col: Excel.CubeFields): Enumerator; - new(col: Excel.CustomProperties): Enumerator; - new(col: Excel.CustomViews): Enumerator; - new(col: Excel.DiagramNodeChildren | Excel.DiagramNodes): Enumerator; - new(col: Excel.Dialogs): Enumerator; - new(col: Excel.FileExportConverters): Enumerator; - new(col: Excel.Filters): Enumerator; - new( - col: Excel.FormatConditions | Excel.IconSets | Excel.MenuItems | Excel.Modules | Excel.Phonetics | Excel.PivotFields | Excel.Range | Excel.ServerViewableItems | - Excel.SheetViews | Excel.UsedObjects): Enumerator; // tslint:disable-line:use-default-type-parameter + new(col: Excel.Range): Enumerator; + new(col: Excel.GroupShapes | Excel.ShapeRange | Excel.Shapes): Enumerator; new(col: Excel.HPageBreaks): Enumerator; new(col: Excel.Hyperlinks): Enumerator; @@ -9544,7 +9785,3 @@ interface EnumeratorConstructor { new(col: Excel.XmlNamespaces): Enumerator; new(col: Excel.XmlSchemas): Enumerator; } - -interface SafeArray { - _brand: SafeArray; -} diff --git a/types/activex-excel/tslint.json b/types/activex-excel/tslint.json index 4ac54521fe..f93cf8562a 100644 --- a/types/activex-excel/tslint.json +++ b/types/activex-excel/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "interface-name": [false] - } -} \ No newline at end of file + "extends": "dtslint/dt.json" +} diff --git a/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts b/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts new file mode 100644 index 0000000000..ef3e403998 --- /dev/null +++ b/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts @@ -0,0 +1,729 @@ +/// + +const collectionToArray = (col: { Item(index: any): T } | SafeArray) => { + const results: T[] = []; + const enumerator = new Enumerator(col); + enumerator.moveFirst(); + while (!enumerator.atEnd()) { + results.push(enumerator.item()); + enumerator.moveNext(); + } + return results; +}; + +const toSafeArray = (...items: T[]): SafeArray => { + const dict = new ActiveXObject('Scripting.Dictionary'); + items.forEach((x, index) => dict.Add(index, x)); + return dict.Items() as SafeArray; +}; + +const VB = { + InputBox: (prompt: string): string => '' +}; + +const getServer = () => { + const server = new ActiveXObject('FaxComEx.FaxServer'); + server.Connect(''); + return server; +}; + +{ + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693376(v=vs.85).aspx + const server = new ActiveXObject('FaxComEx.FaxServer'); + const document = new ActiveXObject('FaxComEx.FaxDocument'); + + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms692919(v=vs.85).aspx + server.Connect(''); + server.Connect('computername'); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693502(v=vs.85).aspx +{ + const getInitializedDevice = () => { + const ret = getServer().GetDevices().ItemById(1); + ret.ReceiveMode = FAXCOMEXLib.FAX_DEVICE_RECEIVE_MODE_ENUM.fdrmAUTO_ANSWER; + ret.RingsBeforeAnswer = 5; + ret.SendEnabled = true; + return ret; + }; + + // saving configuration + let device = getInitializedDevice(); + device.Save(); + + // abandoning changes to configuration, using the Refresh method + device = getInitializedDevice(); + device.Refresh(); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693502(v=vs.85).aspx +{ + const incomingJob = getServer().Folders.IncomingQueue.GetJobs().Item(1); + incomingJob.Refresh(); + const currentPage = incomingJob.CurrentPage; +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692922(v=vs.85).aspx +{ + const server = getServer(); + + WScript.Echo(`Server information: +API Version: ${server.APIVersion} +Debug: ${server.Debug} +Build and version: ${server.MajorBuild}.${server.MinorBuild}.${server.MajorVersion}.${server.MinorVersion} +Server name: ${server.ServerName}`); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693455(v=vs.85).aspx +{ + const activity = getServer().Activity; + activity.Refresh(); + + WScript.Echo(` +${activity.IncomingMessages} incoming messages +${activity.OutgoingMessages} outgoing messages +${activity.RoutingMessages} routing messages +${activity.QueuedMessages} queued messages`); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693400(v=vs.85).aspx +{ + const device = getServer().GetDevices().Item(1); + device.CSID = 'Accounts payable'; + device.Description = 'Primary fax device'; + device.ReceiveMode = FAXCOMEXLib.FAX_DEVICE_RECEIVE_MODE_ENUM.fdrmAUTO_ANSWER; + device.RingsBeforeAnswer = 5; + device.SendEnabled = true; + device.TSID = 'Accounts payable'; + device.Save(); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692985(v=vs.85).aspx +{ + const devices = getServer().GetDevices(); + WScript.Echo(`This server has ${devices.Count} fax devices`); + for (let i = 1; i <= devices.Count; i++) { + WScript.Echo(`Device ID for device number ${i} is ${devices.Item(i).Id}`); + } + + collectionToArray(devices).forEach(device => { + device.Refresh(); + WScript.Echo(` +Device name: ${device.DeviceName} +Provider unique name: ${device.ProviderUniqueName} +Powered off: ${device.PoweredOff} +Receiving now: ${device.ReceivingNow} +Ringing now: ${device.RingingNow} +Sending now: ${device.SendingNow}`); + + const routingMethods = new VBArray(device.UsedRoutingMethods).toArray(); + routingMethods.forEach((guid, index) => { + WScript.Echo(`Method number ${index} = ${guid}`); + }); + + device.UseRoutingMethod(routingMethods[0], false); + device.Save(); + }); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693486(v=vs.85).aspx +{ + const outputRuleInfo = (rule: FAXCOMEXLib.FaxOutboundRoutingRule, index?: number) => { + WScript.Echo(` +Outbound routing rule number: ${index || 'unknown'} +Area code: ${rule.AreaCode} +Country/region code: ${rule.CountryCode} +Device ID: ${rule.DeviceId} +Group name: ${rule.GroupName} +Status: ${rule.Status} +Is device used: ${rule.UseDevice}` + .trim()); + }; + + const server = getServer(); + const device = server.GetDevices().Item(1); + const id = device.Id; + const rules = server.OutboundRouting.GetRules(); + const outboundRoutingRules = server.OutboundRouting.GetRules(); + WScript.Echo(`There are ${outboundRoutingRules.Count} outbound routing rules on this server.`); + + collectionToArray(outboundRoutingRules).forEach((rule, index) => { + rule.Refresh(); + outputRuleInfo(rule, index); + + if (!rule.UseDevice) { return; } + if (VB.InputBox('Do you want to change the device for this rule (Y/N)?') === 'Y') { + const newDeviceID = parseInt(VB.InputBox('Enter new device ID'), 10); + rule.DeviceId = newDeviceID; + rule.Save(); + } + }); + + const msg = ` +Do you want to: +1) display an item based on its country/region and area code, +2) remove an item based on its country/region and area code, +3) remove an item based on its item number, or +4) add a rule? +Input 1, 2, 3, 4, or 0 to exit +`.trim(); + const result = parseInt(VB.InputBox(msg), 10); + let countryCode: number; + let areaCode: number; + let itemNumber: number; + let rule: FAXCOMEXLib.FaxOutboundRoutingRule; + switch (result) { + case 1: + countryCode = parseInt(VB.InputBox('Enter the country/region code'), 10); + areaCode = parseInt(VB.InputBox('Enter the area code'), 10); + rule = outboundRoutingRules.ItemByCountryAndArea(countryCode, areaCode); + outputRuleInfo(rule); + break; + case 2: + countryCode = parseInt(VB.InputBox('Enter the country/region code'), 10); + areaCode = parseInt(VB.InputBox('Enter the area code'), 10); + outboundRoutingRules.RemoveByCountryAndArea(countryCode, areaCode); + break; + case 3: + itemNumber = parseInt(VB.InputBox('Enter the item number'), 10); + outboundRoutingRules.Remove(itemNumber); + break; + case 4: + countryCode = parseInt(VB.InputBox('Enter the country/region code'), 10); + areaCode = parseInt(VB.InputBox('Enter the area code'), 10); + rule = outboundRoutingRules.Add(countryCode, areaCode, true, '', id); + break; + } +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693408(v=vs.85).aspx +{ + const server = getServer(); + const outboundRouting = server.OutboundRouting; + const outboundRoutingGroups = outboundRouting.GetGroups(); + const groupName = VB.InputBox('Provide a name for the outbound routing group'); + const outboundRoutingGroup = outboundRoutingGroups.Add(groupName); + const devices = collectionToArray(server.GetDevices()); + + // add the devices to the routing group + devices.forEach(device => outboundRoutingGroup.DeviceIds.Add(device.Id)); + // move the last device to the top of the order + outboundRoutingGroup.DeviceIds.SetOrder(devices[devices.length - 1].Id, 1); + + // display the number of devices, and the device ID of the first device,to confirm its location in the order + const msg = ` +Number of devices: ${outboundRoutingGroup.DeviceIds.Count} +ID of first device: ${outboundRoutingGroup.DeviceIds.Item(1)} +`.trim(); + WScript.Echo(msg); + + // remove the first device + outboundRoutingGroup.DeviceIds.Remove(1); + + WScript.Echo(`There are now ${outboundRoutingGroups.Count} routing groups on the server`); + + collectionToArray(outboundRoutingGroups).forEach((routingGroup, index) => { + const msg = ` +Routing group number: ${index} +Outbound routing group name: ${routingGroup.Name} +Device status: ${routingGroup.Status} +`.trim(); + }); + + // allow user to remove a routing group + if (VB.InputBox('Do you want to remove a routing group (Y/N)?') === 'Y') { + const itemNumber = VB.InputBox('Enter the item number for the group you want to remove'); + outboundRoutingGroups.Remove(itemNumber); + } +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/aa964960(v=vs.85).aspx +{ + const accountSet = getServer().FaxAccountSet; + const accounts = collectionToArray(accountSet.GetAccounts()); + WScript.Echo(`Number of accounts: ${accounts.length}`); + accounts.forEach(account => WScript.Echo(account.AccountName)); + + const accountName = VB.InputBox('Enter an account name'); + accountSet.AddAccount(accountName); + accountSet.RemoveAccount(accountName); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692952(v=vs.85).aspx +{ + const incomingJobs = collectionToArray(getServer().Folders.IncomingQueue.GetJobs()); + WScript.Echo(`There are ${incomingJobs.length} jobs in the incoming queue.`); + const n = parseInt(VB.InputBox('Input the number of a job for which you want information'), 10); + const job = incomingJobs[n - 1]; + WScript.Echo(` +Available operations: ${job.AvailableOperations} +Caller ID: ${job.CallerId} +CSID: ${job.CSID} +Current page: ${job.CurrentPage} +Device ID: ${job.DeviceId} +Extended status: ${job.ExtendedStatus} +Extended status code: ${job.ExtendedStatusCode} +Job ID: ${job.Id} +Job type: ${job.JobType} +Retries: ${job.Retries} +Routing information: ${job.RoutingInformation} +Size: ${job.Size} +Status: ${job.Status} +Transmission start: ${new Date(job.TransmissionStart)} +Transmission end: ${new Date(job.TransmissionEnd)} +TSID: ${job.TSID} +`.trim()); + + if (VB.InputBox('Cancel this fax (Y/N)?') === 'Y') { + job.Cancel(); + } + + if (VB.InputBox('Open this fax (Y/N)?') === 'Y') { + const fileName = VB.InputBox('Enter path to save'); + job.CopyTiff(fileName); + new ActiveXObject('WScript.Shell').Run(fileName); + } +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692914(v=vs.85).aspx +{ + const server = new ActiveXObject('FaxComEx.FaxServer'); + server.Connect(''); + const outgoingQueue = server.Folders.OutgoingQueue; + outgoingQueue.AgeLimit = 2; + outgoingQueue.AllowPersonalCoverPages = true; + outgoingQueue.Blocked = false; + outgoingQueue.Paused = false; + outgoingQueue.Branding = true; + outgoingQueue.DiscountRateStart = new Date(0, 0, 0, 0).getVarDate(); + outgoingQueue.DiscountRateStart = new Date(0, 0, 0, 1).getVarDate(); + outgoingQueue.UseDeviceTSID = true; + outgoingQueue.Save(); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693393(v=vs.85).aspx +{ + const outgoingQueue = getServer().Folders.OutgoingQueue; + outgoingQueue.Refresh(); + WScript.Echo(`There are ${outgoingQueue.GetJobs().Count} faxes in the outgoing queue`); + const inputResult = VB.InputBox('Which fax should be displayed (item number or job name)?'); + const itemNumber = parseInt(inputResult, 10); + const job = + isNaN(itemNumber) ? + outgoingQueue.GetJob(inputResult) : + outgoingQueue.GetJobs().Item(itemNumber); + + WScript.Echo(` +Available operations: ${job.AvailableOperations} +Broadcast receipts grouped? ${job.GroupBroadcastReceipts} +CSID: ${job.CSID} +Current page: ${job.CurrentPage} +Device ID: ${job.DeviceId} +Document name: ${job.DocumentName} +Extended status: ${job.ExtendedStatus} +Extended status code: ${job.ExtendedStatusCode} +Job ID: ${job.Id} +Original scheduled time: ${new Date(job.OriginalScheduledTime)} +Pages: ${job.Pages} +Priority: ${job.Priority} +Receipt type: ${job.ReceiptType} +`.trim()); + + const fileName = VB.InputBox('Enter path to save'); + job.CopyTiff(fileName); + new ActiveXObject('WScript.Shell').Run(fileName); + + const answer = VB.InputBox(` +Do you want to: +(C) cancel +(P) pause +(R) restart +(E) resume +the job? +`.trim()); + + switch (answer) { + case 'C': + job.Cancel(); + break; + case 'P': + job.Pause(); + break; + case 'R': + job.Restart(); + break; + case 'E': + job.Resume(); + break; + } +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692936(v=vs.85).aspx +{ + const document = new ActiveXObject('FaxComEx.FaxDocument'); + document.Body = 'C:\\docs\\body.txt'; + document.DocumentName = 'My First Fax'; + document.Priority = FAXCOMEXLib.FAX_PRIORITY_TYPE_ENUM.fptHIGH; + document.Recipients.Add('12225550100', 'Bud'); + document.AttachFaxToReceipt = true; + document.CoverPageType = FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptSERVER; + document.Note = 'Here is the info you requested'; + document.ReceiptAddress = 'someone@example.com'; + document.ReceiptType = FAXCOMEXLib.FAX_RECEIPT_TYPE_ENUM.frtMAIL; + document.ScheduleType = FAXCOMEXLib.FAX_SCHEDULE_TYPE_ENUM.fstSPECIFIC_TIME; + document.ScheduleTime = new Date(0, 0, 0, 16, 35, 47).getVarDate(); + document.Subject = 'Today\'s fax'; + + // set sender properties + const sender = document.Sender; + sender.Title = 'Mr.'; + sender.Name = 'Bob'; + sender.City = 'Cleveland Heights'; + sender.State = 'Ohio'; + sender.Company = 'Microsoft'; + sender.Country = 'USA'; + sender.Email = 'someone@microsoft.com'; + sender.FaxNumber = '12165555554'; + sender.HomePhone = '12165555555'; + sender.OfficeLocation = 'Downtown'; + sender.OfficePhone = '12165555553'; + sender.StreetAddress = '123 Main Street'; + sender.TSID = 'Office fax machine'; + sender.ZipCode = '44118'; + sender.BillingCode = '23A54'; + sender.Department = 'Accts Payable'; + sender.SaveDefaultSender(); + + const server = getServer(); + + const jobID = document.ConnectedSubmit(server); + WScript.Echo(`The job ID is ${jobID}`); + + server.Disconnect(); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693479(v=vs.85).aspx +{ + const document = new ActiveXObject('FaxComEx.FaxDocument'); + document.Body = 'C:\\docs\\body.txt'; + document.DocumentName = 'My First Fax'; + + const recipients = document.Recipients; + recipients.Add('12225550105', 'H'); + recipients.Add('12225550104', 'N'); + recipients.Add('12225550103', 'G'); + + WScript.Echo(`Number of recipients: ${recipients.Count}`); + collectionToArray(recipients).forEach((recipient, index) => + WScript.Echo(`Recipient number ${index}: ${recipient.Name}, ${recipient.FaxNumber}`) + ); + + document.Sender.LoadDefaultSender(); + document.GroupBroadcastReceipts = true; + + const jobIDs = document.Submit(''); + collectionToArray(jobIDs).forEach(jobID => WScript.Echo(`The job ID is ${jobID}`)); + + while (recipients.Count > 0) { + recipients.Remove(1); + } +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/aa964962(v=vs.85).aspx +{ + const server = getServer(); + const prefetchCount = parseInt(VB.InputBox('How many messages should be prefetched?'), 10); + server.CurrentAccount.Folders.IncomingArchive.Refresh(); + const messageIterator = server.Folders.IncomingArchive.GetMessages(prefetchCount); + messageIterator.MoveFirst(); + for (let i = 1; i <= prefetchCount; i++) { + if (i > 1 && VB.InputBox('View next message? (Y/N)') !== 'Y') { break; } + const message = messageIterator.Message as FAXCOMEXLib.FaxIncomingMessage; + if (messageIterator.AtEOF) { + WScript.Echo(`End of file reached`); + break; + } + if (!message.WasReAssigned) { + if (VB.InputBox('Message not reassigned. Reassign (Y/N)?') === 'Y') { + message.Subject = 'Reassigning message'; + message.SenderName = 'Test user'; + message.Recipients = VB.InputBox('Enter username, e.g. Domain\\UserName'); + message.SenderFaxNumber = '1234'; + message.ReAssign(); + } + } + messageIterator.MoveNext(); + } +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693402(v=vs.85).aspx +{ + const server = getServer(); + const prefetchCount = parseInt(VB.InputBox('How many messages should be prefetched?'), 10); + server.Folders.OutgoingArchive.Refresh(); + const messageIterator = server.Folders.OutgoingArchive.GetMessages(prefetchCount); + messageIterator.MoveFirst(); + for (let i = 1; i <= prefetchCount; i++) { + if (i > 1 && VB.InputBox('View next message? (Y/N)') !== 'Y') { break; } + if (messageIterator.AtEOF) { + WScript.Echo(`End of file reached`); + break; + } + const message = messageIterator.Message as FAXCOMEXLib.FaxOutgoingMessage; + + const fileName = VB.InputBox('Enter path to save'); + message.CopyTiff(fileName); + new ActiveXObject('WScript.Shell').Run(fileName); + + WScript.Echo(`Message information: +CSID: ${message.CSID} +Device name: ${message.DeviceName} +Document name: ${message.DocumentName} +Message ID: ${message.Id} +Original scheduled time: ${new Date(message.OriginalScheduledTime)} +Pages: ${message.Pages} +Recipient fax number: ${message.Recipient.FaxNumber} +Retries: ${message.Retries} +Sender name: ${message.Sender.Name} +Size: ${message.Size} +Subject: ${message.Subject} +Submission ID: ${message.SubmissionId} +Submission time: ${new Date(message.SubmissionTime)} +Transmission end time: ${new Date(message.TransmissionEnd)} +Transmission start time: ${new Date(message.TransmissionStart)} +TSID: ${message.TSID}`); + + if (VB.InputBox('Delete this fax from the archive (Y/N)?') === 'Y') { + message.Delete(); + } + } +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693472(v=vs.85).aspx +{ + const server = getServer(); + const outgoingArchive = server.Folders.OutgoingArchive; + WScript.Echo(` +Age limit: ${outgoingArchive.AgeLimit} +Archive folder: ${outgoingArchive.ArchiveFolder} +High quota mark: ${outgoingArchive.HighQuotaWaterMark} +Low quota water mark: ${outgoingArchive.LowQuotaWaterMark} +Size high: ${outgoingArchive.SizeHigh} +Size low: ${outgoingArchive.SizeLow} +Size quota warning: ${outgoingArchive.SizeQuotaWarning} +Is archive used? ${outgoingArchive.UseArchive}`.trim() + ); + + const newLimit = VB.InputBox('Set new age limit (enter empty value or Cancel to leave unchanged'); + if (newLimit) { + outgoingArchive.AgeLimit = parseInt(newLimit, 10); + } + + const messageID = VB.InputBox('Retrieve a message by ID (enter an empty value or press Cancel to exit'); + if (messageID) { + const fileName = VB.InputBox('Enter path to save'); + outgoingArchive.GetMessage(messageID).CopyTiff(fileName); + new ActiveXObject('WScript.Shell').Run(fileName); + } +} + +{ + const server = getServer(); + const messageIterator = server.Folders.OutgoingArchive.GetMessages(); + messageIterator.MoveFirst(); + while (!messageIterator.AtEOF) { + const message = messageIterator.Message; + WScript.Echo(` +Document name: ${message.DocumentName} +ID: ${message.Id} +Transmission end: ${new Date(message.TransmissionEnd)} +Transmission start: ${new Date(message.TransmissionStart)} +`.trim()); + messageIterator.MoveNext(); + } +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692976(v=vs.85).aspx +{ + const server = getServer(); + const prefetchCount = parseInt(VB.InputBox('How many messages should be prefetched?'), 10); + server.Folders.IncomingArchive.Refresh(); + const messageIterator = server.Folders.IncomingArchive.GetMessages(prefetchCount); + messageIterator.MoveFirst(); + for (let i = 1; i <= prefetchCount; i++) { + if (i > 1 && VB.InputBox('View next message? (Y/N)') !== 'Y') { break; } + const message = messageIterator.Message as FAXCOMEXLib.FaxIncomingMessage; + if (messageIterator.AtEOF) { + WScript.Echo(`End of file reached`); + break; + } + const fileName = VB.InputBox('Enter path to save TIFF file'); + message.CopyTiff(fileName); + new ActiveXObject('WScript.Shell').Run(fileName); + + messageIterator.MoveNext(); + } +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693406(v=vs.85).aspx +{ + const server = getServer(); + const incomingArchive = server.Folders.IncomingArchive; + incomingArchive.Refresh(); + WScript.Echo(` +High quota water mark: ${incomingArchive.HighQuotaWaterMark} +Low quota water mark: ${incomingArchive.LowQuotaWaterMark} +Archive folder: ${incomingArchive.ArchiveFolder} +Age limit: ${incomingArchive.AgeLimit} +Size high: ${incomingArchive.SizeHigh} +Size low: ${incomingArchive.SizeLow} +Is size quota warning on? ${incomingArchive.SizeQuotaWarning} +Is archive used? ${incomingArchive.UseArchive} +`.trim()); + + incomingArchive.AgeLimit = 4; + incomingArchive.Save(); + + const messageID = VB.InputBox('Message ID to retrieve information? (Leave empty, or Cancel, to exit)'); + if (messageID !== '') { + const message = incomingArchive.GetMessage(messageID); + WScript.Echo(` +Caller ID: ${message.CallerId} +CSID: ${message.CSID} +Device name: ${message.DeviceName} +Message ID: ${message.Id} +Number of pages: ${message.Pages} +Retries: ${message.Retries} +Routing information: ${message.RoutingInformation} +Size: ${message.Size} +Transmission start: ${new Date(message.TransmissionStart)} +Transmission end: ${new Date(message.TransmissionEnd)} +TSID: ${message.TSID} +`.trim()); + + if (VB.InputBox('Delete this message from the archive (Y/N)?') === 'Y') { + message.Delete(); + } + } +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693401(v=vs.85).aspx +{ + const server = getServer(); + const loggingOptions = server.LoggingOptions; + const activityLogging = loggingOptions.ActivityLogging; + const eventLogging = loggingOptions.EventLogging; + + activityLogging.Refresh(); + activityLogging.LogIncoming = true; + activityLogging.LogOutgoing = true; + activityLogging.Save(); + + eventLogging.Refresh(); + eventLogging.GeneralEventsLevel = FAXCOMEXLib.FAX_LOG_LEVEL_ENUM.fllMED; + eventLogging.InboundEventsLevel = FAXCOMEXLib.FAX_LOG_LEVEL_ENUM.fllMAX; + eventLogging.InitEventsLevel = FAXCOMEXLib.FAX_LOG_LEVEL_ENUM.fllMAX; + eventLogging.OutboundEventsLevel = FAXCOMEXLib.FAX_LOG_LEVEL_ENUM.fllNONE; + eventLogging.Save(); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693387(v=vs.85).aspx +{ + const server = getServer(); + const receiptOptions = server.ReceiptOptions; + receiptOptions.Refresh(); + WScript.Echo(` +Allowed receipt types: ${receiptOptions.AllowedReceipts} +Authentication types: ${receiptOptions.AuthenticationType} +SMTP port: ${receiptOptions.SMTPPort} +SMTP sender: ${receiptOptions.SMTPSender} +SMTP server: ${receiptOptions.SMTPSender} +Use for inbound routing? ${receiptOptions.UseForInboundRouting} +`.trim()); + + receiptOptions.AllowedReceipts = FAXCOMEXLib.FAX_RECEIPT_TYPE_ENUM.frtMAIL; + receiptOptions.AuthenticationType = FAXCOMEXLib.FAX_SMTP_AUTHENTICATION_TYPE_ENUM.fsatBASIC; + receiptOptions.SMTPPort = 25; + receiptOptions.SMTPSender = 'someone@example.com'; + receiptOptions.SMTPServer = 'My SMTP Server'; + receiptOptions.UseForInboundRouting = true; + receiptOptions.Save(); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693462(v=vs.85).aspx +{ + const server = getServer(); + collectionToArray(server.GetDeviceProviders()).forEach((provider, index) => { + WScript.Echo(` +Debug: ${provider.Debug} +Name: ${provider.FriendlyName} +Image name: ${provider.ImageName} +Init error code: ${provider.InitErrorCode} +Build and version: ${provider.MajorBuild}.${provider.MajorVersion}.${provider.MinorBuild}.${provider.MinorVersion} +Status: ${provider.Status} +TAPI provider: ${provider.TapiProviderName} +Unique name: ${provider.UniqueName} +`.trim()); + + new VBArray(provider.DeviceIds).toArray().forEach(id => WScript.Echo(id)); + }); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693437(v=vs.85).aspx -- for a fax device +{ + const server = getServer(); + const device = server.GetDevices().Item(1); + const deviceProperty = toSafeArray(1, 2, 3); + const propertyName = '{B1F944B9-9A16-45d1-933A-4060A4871AB0}'; + device.SetExtensionProperty(propertyName, deviceProperty); + new VBArray(device.GetExtensionProperty(propertyName)).toArray().forEach(x => WScript.Echo(x)); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693437(v=vs.85).aspx -- for a fax device +{ + const server = getServer(); + const serverProperty = toSafeArray(4, 2, 3); + const propertyName = `{AC7D0DEE-B6E5-4a44-AF45-835C58CB44D2}`; + server.SetExtensionProperty(propertyName, serverProperty); + new VBArray(server.GetExtensionProperty(propertyName)).toArray().forEach(x => WScript.Echo(x)); +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693013(v=vs.85).aspx +{ + const server = getServer(); + + ActiveXObject.on(server, 'OnOutgoingJobAdded', ['pFaxServer', 'bstrJobId'], prm => WScript.Echo('New job added to queue')); + + ActiveXObject.on(server, 'OnOutgoingJobChanged', ['pFaxServer', 'bstrJobId', 'pJobStatus'], prm => { + const status = prm.pJobStatus; + WScript.Echo(` +Available operations: ${status.AvailableOperations} +Caller ID: ${status.CallerId} +CSID: ${status.CSID} +Current page: ${status.CurrentPage} +Device ID: ${status.DeviceId} +Extended status: ${status.ExtendedStatus} +Extended status code: ${status.ExtendedStatusCode} +Job type: ${status.JobType} +Pages: ${status.Pages} +Retries: ${status.Retries} +Routing information: ${status.RoutingInformation} +Scheduled time: ${new Date(status.ScheduledTime)} +Size: ${status.Size} +Status: ${status.Status} +Transmission start: ${new Date(status.TransmissionStart)} +TSID: ${status.TSID} +`.trim()); + + try { + WScript.Echo(`Transmission end: ${new Date(status.TransmissionEnd)}`); + } catch {} + }); + + ActiveXObject.on(server, 'OnServerShutDown', ['pFaxServer'], prm => WScript.Echo('The local fax server has been shut down')); + + server.ListenToServerEvents( + FAXCOMEXLib.FAX_SERVER_EVENTS_TYPE_ENUM.fsetFXSSVC_ENDED + + FAXCOMEXLib.FAX_SERVER_EVENTS_TYPE_ENUM.fsetOUT_QUEUE + ); +} diff --git a/types/activex-faxcomexlib/index.d.ts b/types/activex-faxcomexlib/index.d.ts new file mode 100644 index 0000000000..d4078061f7 --- /dev/null +++ b/types/activex-faxcomexlib/index.d.ts @@ -0,0 +1,2020 @@ +// Type definitions for Microsoft Fax Service Extended COM Type Library - FAXCOMEXLib 1.0 +// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684513(v=vs.85).aspx +// Definitions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/// + +declare namespace FAXCOMEXLib { + // tslint:disable-next-line:no-const-enum + const enum FAX_ACCESS_RIGHTS_ENUM { + farMANAGE_CONFIG = 64, + farMANAGE_IN_ARCHIVE = 256, + farMANAGE_JOBS = 16, + farMANAGE_OUT_ARCHIVE = 1024, + farQUERY_CONFIG = 32, + farQUERY_IN_ARCHIVE = 128, + farQUERY_JOBS = 8, + farQUERY_OUT_ARCHIVE = 512, + farSUBMIT_HIGH = 4, + farSUBMIT_LOW = 1, + farSUBMIT_NORMAL = 2, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_ACCESS_RIGHTS_ENUM_2 { + far2MANAGE_ARCHIVES = 256, + far2MANAGE_CONFIG = 64, + far2MANAGE_OUT_JOBS = 16, + far2MANAGE_RECEIVE_FOLDER = 512, + far2QUERY_ARCHIVES = 128, + far2QUERY_CONFIG = 32, + far2QUERY_OUT_JOBS = 8, + far2SUBMIT_HIGH = 4, + far2SUBMIT_LOW = 1, + far2SUBMIT_NORMAL = 2, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_ACCOUNT_EVENTS_TYPE_ENUM { + faetFXSSVC_ENDED = 16, + faetIN_ARCHIVE = 4, + faetIN_QUEUE = 1, + faetNONE = 0, + faetOUT_ARCHIVE = 8, + faetOUT_QUEUE = 2, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_COVERPAGE_TYPE_ENUM { + fcptLOCAL = 1, + fcptNONE = 0, + fcptSERVER = 2, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_DEVICE_RECEIVE_MODE_ENUM { + fdrmAUTO_ANSWER = 1, + fdrmMANUAL_ANSWER = 2, + fdrmNO_ANSWER = 0, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_GROUP_STATUS_ENUM { + fgsALL_DEV_NOT_VALID = 2, + fgsALL_DEV_VALID = 0, + fgsEMPTY = 1, + fgsSOME_DEV_NOT_VALID = 3, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_JOB_EXTENDED_STATUS_ENUM { + fjesANSWERED = 5, + fjesBAD_ADDRESS = 10, + fjesBUSY = 8, + fjesCALL_ABORTED = 19, + fjesCALL_BLACKLISTED = 14, + fjesCALL_COMPLETED = 18, + fjesCALL_DELAYED = 13, + fjesDIALING = 3, + fjesDISCONNECTED = 1, + fjesFATAL_ERROR = 12, + fjesHANDLED = 17, + fjesINITIALIZING = 2, + fjesLINE_UNAVAILABLE = 7, + fjesNO_ANSWER = 9, + fjesNO_DIAL_TONE = 11, + fjesNONE = 0, + fjesNOT_FAX_CALL = 15, + fjesPARTIALLY_RECEIVED = 16, + fjesPROPRIETARY = 16777216, + fjesRECEIVING = 6, + fjesTRANSMITTING = 4, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_JOB_OPERATIONS_ENUM { + fjoDELETE = 16, + fjoPAUSE = 2, + fjoRECIPIENT_INFO = 32, + fjoRESTART = 8, + fjoRESUME = 4, + fjoSENDER_INFO = 64, + fjoVIEW = 1, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_JOB_STATUS_ENUM { + fjsCANCELED = 512, + fjsCANCELING = 1024, + fjsCOMPLETED = 256, + fjsFAILED = 8, + fjsINPROGRESS = 2, + fjsNOLINE = 32, + fjsPAUSED = 16, + fjsPENDING = 1, + fjsRETRIES_EXCEEDED = 128, + fjsRETRYING = 64, + fjsROUTING = 2048, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_JOB_TYPE_ENUM { + fjtRECEIVE = 1, + fjtROUTING = 2, + fjtSEND = 0, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_LOG_LEVEL_ENUM { + fllMAX = 3, + fllMED = 2, + fllMIN = 1, + fllNONE = 0, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_PRIORITY_TYPE_ENUM { + fptHIGH = 2, + fptLOW = 0, + fptNORMAL = 1, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_PROVIDER_STATUS_ENUM { + fpsBAD_GUID = 2, + fpsBAD_VERSION = 3, + fpsCANT_INIT = 6, + fpsCANT_LINK = 5, + fpsCANT_LOAD = 4, + fpsSERVER_ERROR = 1, + fpsSUCCESS = 0, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_RECEIPT_TYPE_ENUM { + frtMAIL = 1, + frtMSGBOX = 4, + frtNONE = 0, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_ROUTING_RULE_CODE_ENUM { + frrcANY_CODE = 0, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_RULE_STATUS_ENUM { + frsALL_GROUP_DEV_NOT_VALID = 2, + frsBAD_DEVICE = 4, + frsEMPTY_GROUP = 1, + frsSOME_GROUP_DEV_NOT_VALID = 3, + frsVALID = 0, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_SCHEDULE_TYPE_ENUM { + fstDISCOUNT_PERIOD = 2, + fstNOW = 0, + fstSPECIFIC_TIME = 1, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_SERVER_APIVERSION_ENUM { + fsAPI_VERSION_0 = 0, + fsAPI_VERSION_1 = 65536, + fsAPI_VERSION_2 = 131072, + fsAPI_VERSION_3 = 196608, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_SERVER_EVENTS_TYPE_ENUM { + fsetACTIVITY = 8, + fsetCONFIG = 4, + fsetDEVICE_STATUS = 256, + fsetFXSSVC_ENDED = 128, + fsetIN_ARCHIVE = 32, + fsetIN_QUEUE = 1, + fsetINCOMING_CALL = 512, + fsetNONE = 0, + fsetOUT_ARCHIVE = 64, + fsetOUT_QUEUE = 2, + fsetQUEUE_STATE = 16, + } + + // tslint:disable-next-line:no-const-enum + const enum FAX_SMTP_AUTHENTICATION_TYPE_ENUM { + fsatANONYMOUS = 0, + fsatBASIC = 1, + fsatNTLM = 2, + } + + // tslint:disable-next-line:no-const-enum + const enum FaxConstants { + bstrGROUPNAME_ALLDEVICES = '', + lDEFAULT_PREFETCH_SIZE = 100, + wcharREASSIGN_RECIPIENTS_DELIMITER = 59, + } + + /** FaxAccount Class */ + class FaxAccount { + private 'FAXCOMEXLib.FaxAccount_typekey': FaxAccount; + private constructor(); + + /** Name of the fax account */ + readonly AccountName: string; + + /** Folders belonging to the account */ + readonly Folders: FaxAccountFolders; + + /** Set bit-wise combination of events the fax account listens to */ + ListenToAccountEvents(EventTypes: FAX_ACCOUNT_EVENTS_TYPE_ENUM): void; + + /** Events the fax account is listening to */ + readonly RegisteredEvents: FAX_ACCOUNT_EVENTS_TYPE_ENUM; + } + + /** FaxAccountFolders Class */ + class FaxAccountFolders { + private 'FAXCOMEXLib.FaxAccountFolders_typekey': FaxAccountFolders; + private constructor(); + + /** Incoming archive */ + readonly IncomingArchive: FaxAccountIncomingArchive; + + /** Incoming queue */ + readonly IncomingQueue: FaxAccountIncomingQueue; + + /** Outgoing archive */ + readonly OutgoingArchive: FaxAccountOutgoingArchive; + + /** Outgoing queue */ + readonly OutgoingQueue: FaxAccountOutgoingQueue; + } + + /** FaxAccountIncomingArchive Class */ + class FaxAccountIncomingArchive { + private 'FAXCOMEXLib.FaxAccountIncomingArchive_typekey': FaxAccountIncomingArchive; + private constructor(); + + /** Get an archived message by its ID */ + GetMessage(bstrMessageId: string): IFaxIncomingMessage; + + /** + * Iterator on the archived messages + * @param number [lPrefetchSize=100] + */ + GetMessages(lPrefetchSize?: number): FaxIncomingMessageIterator; + + /** Refresh the object */ + Refresh(): void; + + /** The high 32-bit value of the archive size */ + readonly SizeHigh: number; + + /** The low 32-bit value of the archive size */ + readonly SizeLow: number; + } + + /** FaxAccountIncomingQueue Class */ + class FaxAccountIncomingQueue { + private 'FAXCOMEXLib.FaxAccountIncomingQueue_typekey': FaxAccountIncomingQueue; + private constructor(); + + /** Get incoming job by ID */ + GetJob(bstrJobId: string): FaxIncomingJob; + + /** Collection of incoming jobs */ + GetJobs(): FaxIncomingJobs; + } + + /** FaxAccountOutgoingArchive Class */ + class FaxAccountOutgoingArchive { + private 'FAXCOMEXLib.FaxAccountOutgoingArchive_typekey': FaxAccountOutgoingArchive; + private constructor(); + + /** Get an archived message by its ID */ + GetMessage(bstrMessageId: string): IFaxOutgoingMessage; + + /** + * Iterator on the archived messages + * @param number [lPrefetchSize=100] + */ + GetMessages(lPrefetchSize?: number): FaxOutgoingMessageIterator; + + /** Refresh the object */ + Refresh(): void; + + /** The high 32-bit value of the archive size */ + readonly SizeHigh: number; + + /** The low 32-bit value of the archive size */ + readonly SizeLow: number; + } + + /** FaxAccountOutgoingQueue Class */ + class FaxAccountOutgoingQueue { + private 'FAXCOMEXLib.FaxAccountOutgoingQueue_typekey': FaxAccountOutgoingQueue; + private constructor(); + + /** Get outgoing job by ID */ + GetJob(bstrJobId: string): IFaxOutgoingJob; + + /** Collection of outgoing jobs */ + GetJobs(): FaxOutgoingJobs; + } + + /** FaxAccounts Class */ + interface FaxAccounts { + readonly Count: number; + Item(vIndex: any): FaxAccount; + (vIndex: any): FaxAccount; + } + + /** FaxAccountSet Class */ + class FaxAccountSet { + private 'FAXCOMEXLib.FaxAccountSet_typekey': FaxAccountSet; + private constructor(); + + /** Adds a fax account */ + AddAccount(bstrAccountName: string): FaxAccount; + + /** Get fax account by name */ + GetAccount(bstrAccountName: string): FaxAccount; + + /** Collection of fax accounts */ + GetAccounts(): FaxAccounts; + + /** Removes a fax account by name */ + RemoveAccount(bstrAccountName: string): void; + } + + /** FaxActivity Class */ + class FaxActivity { + private 'FAXCOMEXLib.FaxActivity_typekey': FaxActivity; + private constructor(); + + /** Number of incoming messages */ + readonly IncomingMessages: number; + + /** Number of outgoing messages */ + readonly OutgoingMessages: number; + + /** Number of queued messages */ + readonly QueuedMessages: number; + + /** Refresh the object */ + Refresh(): void; + + /** Number of routed incoming messages */ + readonly RoutingMessages: number; + } + + /** FaxActivityLogging Class */ + class FaxActivityLogging { + private 'FAXCOMEXLib.FaxActivityLogging_typekey': FaxActivityLogging; + private constructor(); + + /** Activity log database files path */ + DatabasePath: string; + + /** Does the server log incoming fax activity */ + LogIncoming: boolean; + + /** Does the server log outgoing fax activity */ + LogOutgoing: boolean; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + } + + /** FaxConfiguration Class */ + class FaxConfiguration { + private 'FAXCOMEXLib.FaxConfiguration_typekey': FaxConfiguration; + private constructor(); + + /** Are personal cover pages allowed */ + AllowPersonalCoverPages: boolean; + + /** Indicates how long the fax message is kept on the server */ + ArchiveAgeLimit: number; + + /** Location of the archive on the server */ + ArchiveLocation: string; + + /** The high 32-bit value of the archive size */ + readonly ArchiveSizeHigh: number; + + /** The low 32-bit value of the archive size */ + readonly ArchiveSizeLow: number; + + /** Does the server auto-create fax account on connect */ + AutoCreateAccountOnConnect: boolean; + + /** Does the server generate a brand */ + Branding: boolean; + + /** End of the discount rate period */ + DiscountRateEnd: VarDate; + + /** Start of the discount rate period */ + DiscountRateStart: VarDate; + + /** High quota water mark */ + HighQuotaWaterMark: number; + + /** Are incoming faxes viewable by everyone */ + IncomingFaxesArePublic: boolean; + + /** Is queue blocked for incoming faxes */ + IncomingQueueBlocked: boolean; + + /** Low quota water mark */ + LowQuotaWaterMark: number; + + /** How long the failed fax job is kept on the server */ + OutgoingQueueAgeLimit: number; + + /** Is queue blocked for outgoing faxes */ + OutgoingQueueBlocked: boolean; + + /** Is queue paused for outgoing faxes */ + OutgoingQueuePaused: boolean; + + /** Refresh the object */ + Refresh(): void; + + /** Number of retries */ + Retries: number; + + /** Retry delay */ + RetryDelay: number; + + /** Save the object */ + Save(): void; + + /** Is size quota warning on */ + SizeQuotaWarning: boolean; + + /** Whether faxes should be archived */ + UseArchive: boolean; + + /** Is device Transmitting Station ID used */ + UseDeviceTSID: boolean; + } + + /** FaxDevice Class */ + class FaxDevice { + private 'FAXCOMEXLib.FaxDevice_typekey': FaxDevice; + private constructor(); + + /** Answer the call */ + AnswerCall(): void; + + /** Device's Called Station ID */ + CSID: string; + + /** Description of the device */ + Description: string; + + /** Device name */ + readonly DeviceName: string; + + /** Get the device level extention property */ + GetExtensionProperty(bstrGUID: string): SafeArray; + + /** Unique device ID */ + readonly Id: number; + + /** Is the device is turned off */ + readonly PoweredOff: boolean; + + /** Device provider */ + readonly ProviderUniqueName: string; + + /** The receive mode of the device */ + ReceiveMode: FAX_DEVICE_RECEIVE_MODE_ENUM; + + /** Is the device receiving now */ + readonly ReceivingNow: boolean; + + /** Refresh the object */ + Refresh(): void; + + /** Is the device ringing now */ + readonly RingingNow: boolean; + + /** Number of rings before the device answers */ + RingsBeforeAnswer: number; + + /** Save the object */ + Save(): void; + + /** Is the device is enabled to send */ + SendEnabled: boolean; + + /** Is the device sending now */ + readonly SendingNow: boolean; + + /** Set the device level extention property */ + SetExtensionProperty(bstrGUID: string, vProperty: SafeArray): void; + + /** Device's Transmitting Station ID */ + TSID: string; + + /** Array of routing methods GUIDs */ + readonly UsedRoutingMethods: SafeArray; + + /** Adds or removes routing method */ + UseRoutingMethod(bstrMethodGUID: string, bUse: boolean): void; + } + + /** FaxDeviceIds Class */ + interface FaxDeviceIds { + /** Add a device */ + Add(lDeviceId: number): void; + readonly Count: number; + Item(lIndex: number): number; + + /** Remove a device */ + Remove(lIndex: number): void; + + /** Set order of the device */ + SetOrder(lDeviceId: number, lNewOrder: number): void; + (lIndex: number): number; + } + + /** FaxDeviceProvider Class */ + class FaxDeviceProvider { + private 'FAXCOMEXLib.FaxDeviceProvider_typekey': FaxDeviceProvider; + private constructor(); + + /** Is device provider built in debug environment */ + readonly Debug: boolean; + + /** Array of device IDs exposed by the provider */ + readonly DeviceIds: SafeArray; + + /** Provider's friendly name */ + readonly FriendlyName: string; + + /** Full path and file name of the provider DLL */ + readonly ImageName: string; + + /** Last error code at load or initialization */ + readonly InitErrorCode: number; + + /** The major part of the device provider's build number */ + readonly MajorBuild: number; + + /** The major part of the device provider's version number */ + readonly MajorVersion: number; + + /** The minor part of the device provider's build number */ + readonly MinorBuild: number; + + /** The minor part of the device provider's version number */ + readonly MinorVersion: number; + + /** Status of the device provider */ + readonly Status: FAX_PROVIDER_STATUS_ENUM; + + /** TSP name used by the provider */ + readonly TapiProviderName: string; + + /** Unique name of the provider */ + readonly UniqueName: string; + } + + /** FaxDeviceProviders Class */ + interface FaxDeviceProviders { + readonly Count: number; + Item(vIndex: any): FaxDeviceProvider; + (vIndex: any): FaxDeviceProvider; + } + + /** FaxDevices Class */ + interface FaxDevices { + readonly Count: number; + Item(vIndex: any): FaxDevice; + + /** Get device by its ID */ + ItemById(lId: number): FaxDevice; + (vIndex: any): FaxDevice; + } + + /** FaxDocument Class */ + class FaxDocument { + private 'FAXCOMEXLib.FaxDocument_typekey': FaxDocument; + private constructor(); + + /** Whether to attach a fax to the receipt */ + AttachFaxToReceipt: boolean; + + /** Full paths to the fax document body files */ + Bodies: any; + + /** Full path to the fax document body file */ + Body: string; + + /** Call handle */ + CallHandle: number; + + /** Submit the fax document on the already connected server */ + ConnectedSubmit(pFaxServer: IFaxServer): SafeArray; + + /** Submit the fax document on the already connected server */ + ConnectedSubmit2(pFaxServer: IFaxServer, pvFaxOutgoingJobIDs: SafeArray): number; + + /** Cover page file path */ + CoverPage: string; + + /** Is server, local, or no cover page used */ + CoverPageType: FAX_COVERPAGE_TYPE_ENUM; + + /** The document name */ + DocumentName: string; + + /** Whether to group the broadcast receipts */ + GroupBroadcastReceipts: boolean; + + /** Contents of cover page note field */ + Note: string; + + /** Priority of the fax */ + Priority: FAX_PRIORITY_TYPE_ENUM; + + /** Address of the receipt */ + ReceiptAddress: string; + + /** Type of the receipt */ + ReceiptType: FAX_RECEIPT_TYPE_ENUM; + + /** Collection of recipients */ + readonly Recipients: FaxRecipients; + + /** Time to send the fax */ + ScheduleTime: VarDate; + + /** When to send the fax */ + ScheduleType: FAX_SCHEDULE_TYPE_ENUM; + + /** Sender information object */ + readonly Sender: FaxSender; + + /** Contents of cover page subject field */ + Subject: string; + + /** Submission Id for the Fax document */ + readonly SubmissionId: string; + + /** Connect to server, submit the fax document, disconnect */ + Submit(bstrFaxServerName: string): SafeArray; + + /** Connect to server, submit the fax document, disconnect */ + Submit2(bstrFaxServerName: string, pvFaxOutgoingJobIDs: any): number; + + /** Tapi connection */ + TapiConnection: any; + } + + /** FaxEventLogging Class */ + class FaxEventLogging { + private 'FAXCOMEXLib.FaxEventLogging_typekey': FaxEventLogging; + private constructor(); + + /** Detail level of event logs for general (other) events */ + GeneralEventsLevel: FAX_LOG_LEVEL_ENUM; + + /** Detail level of event logs for inbound fax events */ + InboundEventsLevel: FAX_LOG_LEVEL_ENUM; + + /** Detail level of event logs for initialization events */ + InitEventsLevel: FAX_LOG_LEVEL_ENUM; + + /** Detail level of event logs for outbound fax events */ + OutboundEventsLevel: FAX_LOG_LEVEL_ENUM; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + } + + /** FaxFolders Class */ + class FaxFolders { + private 'FAXCOMEXLib.FaxFolders_typekey': FaxFolders; + private constructor(); + + /** Incoming archive */ + readonly IncomingArchive: FaxIncomingArchive; + + /** Incoming queue */ + readonly IncomingQueue: FaxIncomingQueue; + + /** Outgoing archive */ + readonly OutgoingArchive: FaxOutgoingArchive; + + /** Outgoing queue */ + readonly OutgoingQueue: FaxOutgoingQueue; + } + + /** FaxInboundRouting Class */ + class FaxInboundRouting { + private 'FAXCOMEXLib.FaxInboundRouting_typekey': FaxInboundRouting; + private constructor(); + + /** Registered inbound routing extensions collection */ + GetExtensions(): FaxInboundRoutingExtensions; + + /** Ordered collection of all the registered methods */ + GetMethods(): FaxInboundRoutingMethods; + } + + /** FaxInboundRoutingExtension Class */ + class FaxInboundRoutingExtension { + private 'FAXCOMEXLib.FaxInboundRoutingExtension_typekey': FaxInboundRoutingExtension; + private constructor(); + + /** Is extension built in debug environment */ + readonly Debug: boolean; + + /** Extension's friendly name */ + readonly FriendlyName: string; + + /** Full path and file name of the extension DLL */ + readonly ImageName: string; + + /** Last error code at load or initialization */ + readonly InitErrorCode: number; + + /** The major part of extension's build number */ + readonly MajorBuild: number; + + /** The major part of extension's version number */ + readonly MajorVersion: number; + + /** Array of methods exposed by extension */ + readonly Methods: SafeArray; + + /** The minor part of extension's build number */ + readonly MinorBuild: number; + + /** The minor part of extension's version number */ + readonly MinorVersion: number; + + /** Load and initialization status of the extension */ + readonly Status: FAX_PROVIDER_STATUS_ENUM; + + /** Extension's unique name */ + readonly UniqueName: string; + } + + /** FaxInboundRoutingExtensions Class */ + interface FaxInboundRoutingExtensions { + readonly Count: number; + Item(vIndex: any): FaxInboundRoutingExtension; + (vIndex: any): FaxInboundRoutingExtension; + } + + /** FaxInboundRoutingMethod Class */ + class FaxInboundRoutingMethod { + private 'FAXCOMEXLib.FaxInboundRoutingMethod_typekey': FaxInboundRoutingMethod; + private constructor(); + + /** Friendly name of the extension exposing this method */ + readonly ExtensionFriendlyName: string; + + /** Image name of the extension exposing this method */ + readonly ExtensionImageName: string; + + /** Internal function name */ + readonly FunctionName: string; + + /** GUID of the method */ + readonly GUID: string; + + /** The name of the method */ + readonly Name: string; + + /** Priority of the method */ + Priority: number; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + } + + /** FaxInboundRoutingMethods Class */ + interface FaxInboundRoutingMethods { + readonly Count: number; + Item(vIndex: any): FaxInboundRoutingMethod; + (vIndex: any): FaxInboundRoutingMethod; + } + + /** FaxIncomingArchive Class */ + class FaxIncomingArchive { + private 'FAXCOMEXLib.FaxIncomingArchive_typekey': FaxIncomingArchive; + private constructor(); + + /** How long the fax message is kept on the Server */ + AgeLimit: number; + + /** Location of the archive folder on the server */ + ArchiveFolder: string; + + /** Get archived message by its ID */ + GetMessage(bstrMessageId: string): IFaxIncomingMessage; + + /** + * Iterator on the archived messages + * @param number [lPrefetchSize=100] + */ + GetMessages(lPrefetchSize?: number): FaxIncomingMessageIterator; + + /** High quota water mark */ + HighQuotaWaterMark: number; + + /** Low quota water mark */ + LowQuotaWaterMark: number; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + + /** The high 32-bit value of the archive size */ + readonly SizeHigh: number; + + /** The low 32-bit value of the archive size */ + readonly SizeLow: number; + + /** Is size quota warning on */ + SizeQuotaWarning: boolean; + + /** Whether received faxes should be archived */ + UseArchive: boolean; + } + + /** FaxIncomingJob Class */ + class FaxIncomingJob { + private 'FAXCOMEXLib.FaxIncomingJob_typekey': FaxIncomingJob; + private constructor(); + + /** Available operations, a bit-wise combination of FAX_JOB_OPERATIONS values */ + readonly AvailableOperations: FAX_JOB_OPERATIONS_ENUM; + + /** Caller ID */ + readonly CallerId: string; + + /** Cancel the incoming job */ + Cancel(): void; + + /** Copy TIFF image to the local file */ + CopyTiff(bstrTiffPath: string): void; + + /** Called Station ID */ + readonly CSID: string; + + /** Page currently in transmision */ + readonly CurrentPage: number; + + /** Device ID that transmits the job */ + readonly DeviceId: number; + + /** Extended status description */ + readonly ExtendedStatus: string; + + /** Code of the job's extended status */ + readonly ExtendedStatusCode: FAX_JOB_EXTENDED_STATUS_ENUM; + + /** Unique message ID */ + readonly Id: string; + + /** Job type */ + readonly JobType: FAX_JOB_TYPE_ENUM; + + /** Refresh the object */ + Refresh(): void; + + /** Number of failed transmission retries */ + readonly Retries: number; + + /** Routing information */ + readonly RoutingInformation: string; + + /** Size in bytes of the message's TIFF file */ + readonly Size: number; + + /** Current queue status of the job, a bit-wise combination of FAX_JOB_STATUS values */ + readonly Status: FAX_JOB_STATUS_ENUM; + + /** Transmission end time */ + readonly TransmissionEnd: VarDate; + + /** Transmission start time */ + readonly TransmissionStart: VarDate; + + /** Transmitting Station ID */ + readonly TSID: string; + } + + /** FaxIncomingJobs Class */ + interface FaxIncomingJobs { + readonly Count: number; + Item(vIndex: any): FaxIncomingJob; + (vIndex: any): FaxIncomingJob; + } + + /** FaxIncomingMessage Class */ + class FaxIncomingMessage extends IFaxIncomingMessage { + private 'FAXCOMEXLib.FaxIncomingMessage_typekey': FaxIncomingMessage; + private constructor(); + + /** Has Cover page */ + HasCoverPage: boolean; + + /** Read flag on the message */ + Read: boolean; + + /** Reassigns the message */ + ReAssign(): void; + + /** Set of recipient names */ + Recipients: string; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + + /** Sender's fax number */ + SenderFaxNumber: string; + + /** Sender's name */ + SenderName: string; + + /** Contents of cover page subject field */ + Subject: string; + + /** Is message reassigned? */ + readonly WasReAssigned: boolean; + } + + /** FaxIncomingMessageIterator Class */ + class FaxIncomingMessageIterator { + private 'FAXCOMEXLib.FaxIncomingMessageIterator_typekey': FaxIncomingMessageIterator; + private constructor(); + + /** End of archive marker */ + readonly AtEOF: boolean; + + /** The current message */ + readonly Message: IFaxIncomingMessage; + + /** Move to the first message in the archive */ + MoveFirst(): void; + + /** Move to the next message in the archive */ + MoveNext(): void; + + /** Size of the prefetch buffer */ + PrefetchSize: number; + } + + /** FaxIncomingQueue Class */ + class FaxIncomingQueue { + private 'FAXCOMEXLib.FaxIncomingQueue_typekey': FaxIncomingQueue; + private constructor(); + + /** Is queue blocked */ + Blocked: boolean; + + /** Get incoming job by ID */ + GetJob(bstrJobId: string): FaxIncomingJob; + + /** Collection of incoming jobs */ + GetJobs(): FaxIncomingJobs; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + } + + /** FaxJobStatus Class */ + class FaxJobStatus { + private 'FAXCOMEXLib.FaxJobStatus_typekey': FaxJobStatus; + private constructor(); + + /** Available operations, a bit-wise combination of FAX_JOB_OPERATIONS values */ + readonly AvailableOperations: FAX_JOB_OPERATIONS_ENUM; + + /** Caller ID */ + readonly CallerId: string; + + /** Called Station ID */ + readonly CSID: string; + + /** Page currently in transmision */ + readonly CurrentPage: number; + + /** Device ID of device that transmits the job */ + readonly DeviceId: number; + + /** Extended status description */ + readonly ExtendedStatus: string; + + /** Code of the job's extended status */ + readonly ExtendedStatusCode: FAX_JOB_EXTENDED_STATUS_ENUM; + + /** Job type */ + readonly JobType: FAX_JOB_TYPE_ENUM; + + /** Total number of pages */ + readonly Pages: number; + + /** Number of failed transmission retries */ + readonly Retries: number; + + /** Routing information */ + readonly RoutingInformation: string; + + /** The time the fax job is scheduled to be transmitted */ + readonly ScheduledTime: VarDate; + + /** Size in bytes of TIFF file */ + readonly Size: number; + + /** Current queue status of the job, a bit-wise combination of FAX_JOB_STATUS values */ + readonly Status: FAX_JOB_STATUS_ENUM; + + /** The time the fax job finished its transmission */ + readonly TransmissionEnd: VarDate; + + /** The time the fax job started its transmission */ + readonly TransmissionStart: VarDate; + + /** Transmitting Station ID */ + readonly TSID: string; + } + + /** FaxLoggingOptions Class */ + class FaxLoggingOptions { + private 'FAXCOMEXLib.FaxLoggingOptions_typekey': FaxLoggingOptions; + private constructor(); + + /** Activity logging configuration object */ + readonly ActivityLogging: FaxActivityLogging; + + /** Event logging configuration object */ + readonly EventLogging: FaxEventLogging; + } + + /** FaxOutboundRouting Class */ + class FaxOutboundRouting { + private 'FAXCOMEXLib.FaxOutboundRouting_typekey': FaxOutboundRouting; + private constructor(); + + /** Configuration of the outbound routing groups */ + GetGroups(): FaxOutboundRoutingGroups; + + /** Configuration of the outbound routing rules */ + GetRules(): FaxOutboundRoutingRules; + } + + /** FaxOutboundRoutingGroup Class */ + class FaxOutboundRoutingGroup { + private 'FAXCOMEXLib.FaxOutboundRoutingGroup_typekey': FaxOutboundRoutingGroup; + private constructor(); + + /** Ordered collection of device IDs */ + readonly DeviceIds: FaxDeviceIds; + + /** Name of the group */ + readonly Name: string; + + /** Status of the group */ + readonly Status: FAX_GROUP_STATUS_ENUM; + } + + /** FaxOutboundRoutingGroups Class */ + interface FaxOutboundRoutingGroups { + /** Add a group */ + Add(bstrName: string): FaxOutboundRoutingGroup; + readonly Count: number; + Item(vIndex: number | string): FaxOutboundRoutingGroup; + + /** Remove a group */ + Remove(vIndex: number | string): void; + (vIndex: number | string): FaxOutboundRoutingGroup; + } + + /** FaxOutboundRoutingRule Class */ + class FaxOutboundRoutingRule { + private 'FAXCOMEXLib.FaxOutboundRoutingRule_typekey': FaxOutboundRoutingRule; + private constructor(); + + /** Area code */ + readonly AreaCode: number; + + /** Country code */ + readonly CountryCode: number; + + /** Destination device */ + DeviceId: number; + + /** Group name */ + GroupName: string; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + + /** Status */ + readonly Status: FAX_RULE_STATUS_ENUM; + + /** Uses single device or group */ + UseDevice: boolean; + } + + /** FaxOutboundRoutingRules Class */ + interface FaxOutboundRoutingRules { + /** Add a rule */ + Add(lCountryCode: number, lAreaCode: number, bUseDevice: boolean, bstrGroupName: string, lDeviceId: number): FaxOutboundRoutingRule; + readonly Count: number; + Item(lIndex: number): FaxOutboundRoutingRule; + + /** Get a rule by criteria */ + ItemByCountryAndArea(lCountryCode: number, lAreaCode: number): FaxOutboundRoutingRule; + + /** Remove a rule */ + Remove(lIndex: number): void; + + /** Remove a rule by criteria */ + RemoveByCountryAndArea(lCountryCode: number, lAreaCode: number): void; + (lIndex: number): FaxOutboundRoutingRule; + } + + /** FaxOutgoingArchive Class */ + class FaxOutgoingArchive { + private 'FAXCOMEXLib.FaxOutgoingArchive_typekey': FaxOutgoingArchive; + private constructor(); + + /** Indicates how long the fax message is kept on the server */ + AgeLimit: number; + + /** Location of the outgoing archive on the server */ + ArchiveFolder: string; + + /** Get an archived message by its ID */ + GetMessage(bstrMessageId: string): IFaxOutgoingMessage; + + /** + * Iterator on the archived messages + * @param number [lPrefetchSize=100] + */ + GetMessages(lPrefetchSize?: number): FaxOutgoingMessageIterator; + + /** High quota water mark */ + HighQuotaWaterMark: number; + + /** Low quota water mark */ + LowQuotaWaterMark: number; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + + /** The high 32-bit value of the archive size */ + readonly SizeHigh: number; + + /** The low 32-bit value of the archive size */ + readonly SizeLow: number; + + /** Is the size quota warning on or off */ + SizeQuotaWarning: boolean; + + /** Whether sent faxes should be archived */ + UseArchive: boolean; + } + + /** FaxOutgoingJob Class */ + class FaxOutgoingJob { + private 'FAXCOMEXLib.FaxOutgoingJob_typekey': FaxOutgoingJob; + private constructor(); + + /** Available operations, a bit-wise combination of FAX_JOB_OPERATIONS values */ + readonly AvailableOperations: FAX_JOB_OPERATIONS_ENUM; + + /** Cancel the outbound job */ + Cancel(): void; + + /** Copy the job's TIFF image */ + CopyTiff(bstrTiffPath: string): void; + + /** Called Station ID */ + readonly CSID: string; + + /** Page currently in transmision */ + readonly CurrentPage: number; + + /** Device ID that transmits the job */ + readonly DeviceId: number; + + /** Document's friendly name */ + readonly DocumentName: string; + + /** Extended status description */ + readonly ExtendedStatus: string; + + /** Code of the job's extended status */ + readonly ExtendedStatusCode: FAX_JOB_EXTENDED_STATUS_ENUM; + + /** Whether to group broadcast receipts */ + readonly GroupBroadcastReceipts: boolean; + + /** Has Cover page */ + readonly HasCoverPage: boolean; + + /** Unique job ID */ + readonly Id: string; + + /** Time the job was originally scheduled to be transmitted */ + readonly OriginalScheduledTime: VarDate; + + /** Total number of pages */ + readonly Pages: number; + + /** Pause the outbound job */ + Pause(): void; + + /** Priority of the fax */ + readonly Priority: FAX_PRIORITY_TYPE_ENUM; + + /** Address of the receipt */ + readonly ReceiptAddress: string; + + /** Type of receipt */ + readonly ReceiptType: FAX_RECEIPT_TYPE_ENUM; + + /** Recipient information object */ + readonly Recipient: FaxRecipient; + + /** Refresh the object */ + Refresh(): void; + + /** Restart the outbound job */ + Restart(): void; + + /** Resume the outbound job */ + Resume(): void; + + /** Number of failed transmission retries */ + readonly Retries: number; + + /** The time the fax job is scheduled to be transmitted */ + readonly ScheduledTime: VarDate; + + /** When to send the fax */ + readonly ScheduleType: FAX_SCHEDULE_TYPE_ENUM; + + /** Sender information object */ + readonly Sender: FaxSender; + + /** Size in bytes of TIFF file */ + readonly Size: number; + + /** Current queue status of the job */ + readonly Status: FAX_JOB_STATUS_ENUM; + + /** Cover page's subject field */ + readonly Subject: string; + + /** Unique ID the submission process created for the Job */ + readonly SubmissionId: string; + + /** Time the job was submitted */ + readonly SubmissionTime: VarDate; + + /** The time the fax job finished its transmission */ + readonly TransmissionEnd: VarDate; + + /** The time the fax job started its transmission */ + readonly TransmissionStart: VarDate; + + /** Transmitting Station ID */ + readonly TSID: string; + } + + /** FaxOutgoingJobs Class */ + interface FaxOutgoingJobs { + readonly Count: number; + Item(vIndex: any): IFaxOutgoingJob; + (vIndex: any): IFaxOutgoingJob; + } + + /** FaxOutgoingMessage Class */ + class FaxOutgoingMessage extends IFaxOutgoingMessage { + private 'FAXCOMEXLib.FaxOutgoingMessage_typekey': FaxOutgoingMessage; + private constructor(); + + /** Copy Tiff image to the local file */ + CopyTiff(bstrTiffPath: string): void; + + /** Has Cover page */ + readonly HasCoverPage: boolean; + + /** Read flag on the message */ + Read: boolean; + + /** Address of the receipt */ + readonly ReceiptAddress: string; + + /** Type of the receipt */ + readonly ReceiptType: FAX_RECEIPT_TYPE_ENUM; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + } + + /** FaxOutgoingMessageIterator Class */ + class FaxOutgoingMessageIterator { + private 'FAXCOMEXLib.FaxOutgoingMessageIterator_typekey': FaxOutgoingMessageIterator; + private constructor(); + + /** End of archive marker */ + readonly AtEOF: boolean; + + /** Current message */ + readonly Message: IFaxOutgoingMessage; + + /** Move to the first message */ + MoveFirst(): void; + + /** Move to the next message */ + MoveNext(): void; + + /** Size of prefetch buffer */ + PrefetchSize: number; + } + + /** FaxOutgoingQueue Class */ + class FaxOutgoingQueue { + private 'FAXCOMEXLib.FaxOutgoingQueue_typekey': FaxOutgoingQueue; + private constructor(); + + /** How long the failed fax message is kept on the server */ + AgeLimit: number; + + /** Are personal cover pages allowed */ + AllowPersonalCoverPages: boolean; + + /** Is the queue blocked */ + Blocked: boolean; + + /** Does the server generate a brand */ + Branding: boolean; + + /** End of the discount rate period */ + DiscountRateEnd: VarDate; + + /** Start of the discount rate period */ + DiscountRateStart: VarDate; + + /** Outgoing job by ID */ + GetJob(bstrJobId: string): IFaxOutgoingJob; + + /** Collection of outgoing jobs */ + GetJobs(): FaxOutgoingJobs; + + /** Is the queue paused */ + Paused: boolean; + + /** Refresh the object */ + Refresh(): void; + + /** Number of retries */ + Retries: number; + + /** Retry delay */ + RetryDelay: number; + + /** Save the object */ + Save(): void; + + /** Is device Transmitting Station ID used */ + UseDeviceTSID: boolean; + } + + /** FaxReceiptOptions Class */ + class FaxReceiptOptions { + private 'FAXCOMEXLib.FaxReceiptOptions_typekey': FaxReceiptOptions; + private constructor(); + + /** Allowed receipt types, a bit-wise combination of FAX_RECEIPT_TYPE values */ + AllowedReceipts: FAX_RECEIPT_TYPE_ENUM; + + /** Authentication type used by server */ + AuthenticationType: FAX_SMTP_AUTHENTICATION_TYPE_ENUM; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + + /** SMTP password */ + SMTPPassword: string; + + /** SMTP port number */ + SMTPPort: number; + + /** SMTP sender e-mail address */ + SMTPSender: string; + + /** Name of the SMTP server */ + SMTPServer: string; + + /** SMTP user name */ + SMTPUser: string; + + /** Whether to use the IFaxReceiptOptions settings for MS routing extension */ + UseForInboundRouting: boolean; + } + + /** FaxRecipient Class */ + class FaxRecipient { + private 'FAXCOMEXLib.FaxRecipient_typekey': FaxRecipient; + private constructor(); + + /** Recipient's fax number */ + FaxNumber: string; + + /** Recipient's name */ + Name: string; + } + + /** FaxRecipients Class */ + interface FaxRecipients { + /** + * Add a recipient + * @param string [bstrRecipientName=''] + */ + Add(bstrFaxNumber: string, bstrRecipientName?: string): FaxRecipient; + readonly Count: number; + Item(lIndex: number): FaxRecipient; + + /** Remove a recipient */ + Remove(lIndex: number): void; + (lIndex: number): FaxRecipient; + } + + /** FaxSecurity Class */ + class FaxSecurity { + private 'FAXCOMEXLib.FaxSecurity_typekey': FaxSecurity; + private constructor(); + + /** Security descriptor */ + Descriptor: any; + + /** Granted rights, a bit-wise combination of FAX_ACCESS_RIGHTS values */ + readonly GrantedRights: FAX_ACCESS_RIGHTS_ENUM; + + /** Security Information Type */ + InformationType: number; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + } + + /** FaxSecurity2 Class */ + class FaxSecurity2 { + private 'FAXCOMEXLib.FaxSecurity2_typekey': FaxSecurity2; + private constructor(); + + /** Security descriptor */ + Descriptor: any; + + /** Granted rights, a bit-wise combination */ + readonly GrantedRights: FAX_ACCESS_RIGHTS_ENUM_2; + + /** Security Information Type */ + InformationType: number; + + /** Refresh the object */ + Refresh(): void; + + /** Save the object */ + Save(): void; + } + + /** FaxSender Class */ + class FaxSender { + private 'FAXCOMEXLib.FaxSender_typekey': FaxSender; + private constructor(); + + /** Sender's billing code */ + BillingCode: string; + + /** City */ + City: string; + + /** Sender's company */ + Company: string; + + /** Sender's country or region */ + Country: string; + + /** Sender's department */ + Department: string; + + /** Sender's e-mail address */ + Email: string; + + /** Sender's fax number */ + FaxNumber: string; + + /** Sender's home phone */ + HomePhone: string; + + /** Load default sender */ + LoadDefaultSender(): void; + + /** Sender's name */ + Name: string; + + /** Sender's office location */ + OfficeLocation: string; + + /** Sender's office phone */ + OfficePhone: string; + + /** Save default sender */ + SaveDefaultSender(): void; + + /** Sender's state */ + State: string; + + /** Sender's street address */ + StreetAddress: string; + + /** Sender's title */ + Title: string; + + /** Transmitting Station ID */ + TSID: string; + + /** Sender's zip code */ + ZipCode: string; + } + + /** FaxServer Class */ + class FaxServer extends IFaxServer { + private 'FAXCOMEXLib.FaxServer_typekey': FaxServer; + private constructor(); + + /** Fax server configuration */ + readonly Configuration: FaxConfiguration; + + /** FaxAccount for the current connection */ + readonly CurrentAccount: FaxAccount; + + /** The FaxAccountSet configuration object */ + readonly FaxAccountSet: FaxAccountSet; + + /** The security configuration object */ + readonly Security2: FaxSecurity2; + } + + /** IFaxIncomingMessage interface */ + class IFaxIncomingMessage { + /** Caller ID */ + readonly CallerId: string; + + /** Copy Tiff image to the local file */ + CopyTiff(bstrTiffPath: string): void; + + /** Called Station ID */ + readonly CSID: string; + + /** Delete the message from the archive */ + Delete(): void; + + /** Name of the device that received the message */ + readonly DeviceName: string; + + /** Unique message ID */ + readonly Id: string; + + /** Total number of pages */ + readonly Pages: number; + + /** Number of failed routing retries */ + readonly Retries: number; + + /** Routing information */ + readonly RoutingInformation: string; + + /** Size in bytes of the message's TIFF file */ + readonly Size: number; + + /** Transmission end time */ + readonly TransmissionEnd: VarDate; + + /** Transmission start time */ + readonly TransmissionStart: VarDate; + + /** Transmitting Station ID */ + readonly TSID: string; + } + + /** IFaxOutgoingJob interface */ + class IFaxOutgoingJob { + private 'FAXCOMEXLib.IFaxOutgoingJob_typekey': IFaxOutgoingJob; + private constructor(); + + /** Available operations, a bit-wise combination of FAX_JOB_OPERATIONS values */ + readonly AvailableOperations: FAX_JOB_OPERATIONS_ENUM; + + /** Cancel the outbound job */ + Cancel(): void; + + /** Copy the job's TIFF image */ + CopyTiff(bstrTiffPath: string): void; + + /** Called Station ID */ + readonly CSID: string; + + /** Page currently in transmision */ + readonly CurrentPage: number; + + /** Device ID that transmits the job */ + readonly DeviceId: number; + + /** Document's friendly name */ + readonly DocumentName: string; + + /** Extended status description */ + readonly ExtendedStatus: string; + + /** Code of the job's extended status */ + readonly ExtendedStatusCode: FAX_JOB_EXTENDED_STATUS_ENUM; + + /** Whether to group broadcast receipts */ + readonly GroupBroadcastReceipts: boolean; + + /** Unique job ID */ + readonly Id: string; + + /** Time the job was originally scheduled to be transmitted */ + readonly OriginalScheduledTime: VarDate; + + /** Total number of pages */ + readonly Pages: number; + + /** Pause the outbound job */ + Pause(): void; + + /** Priority of the fax */ + readonly Priority: FAX_PRIORITY_TYPE_ENUM; + + /** Type of receipt */ + readonly ReceiptType: FAX_RECEIPT_TYPE_ENUM; + + /** Recipient information object */ + readonly Recipient: FaxRecipient; + + /** Refresh the object */ + Refresh(): void; + + /** Restart the outbound job */ + Restart(): void; + + /** Resume the outbound job */ + Resume(): void; + + /** Number of failed transmission retries */ + readonly Retries: number; + + /** The time the fax job is scheduled to be transmitted */ + readonly ScheduledTime: VarDate; + + /** Sender information object */ + readonly Sender: FaxSender; + + /** Size in bytes of TIFF file */ + readonly Size: number; + + /** Current queue status of the job */ + readonly Status: FAX_JOB_STATUS_ENUM; + + /** Cover page's subject field */ + readonly Subject: string; + + /** Unique ID the submission process created for the Job */ + readonly SubmissionId: string; + + /** Time the job was submitted */ + readonly SubmissionTime: VarDate; + + /** The time the fax job finished its transmission */ + readonly TransmissionEnd: VarDate; + + /** The time the fax job started its transmission */ + readonly TransmissionStart: VarDate; + + /** Transmitting Station ID */ + readonly TSID: string; + } + + /** IFaxOutgoingMessage interface */ + class IFaxOutgoingMessage { + /** Copy Tiff image to the local file */ + CopyTiff(bstrTiffPath: string): void; + + /** Called Station ID */ + readonly CSID: string; + + /** Delete the message from the archive */ + Delete(): void; + + /** Name of the device transmitting the message */ + readonly DeviceName: string; + + /** Document's friendly name */ + readonly DocumentName: string; + + /** Unique message ID */ + readonly Id: string; + + /** Time the job was originally scheduled to be transmitted */ + readonly OriginalScheduledTime: VarDate; + + /** Total number of pages */ + readonly Pages: number; + + /** Priority of the fax */ + readonly Priority: FAX_PRIORITY_TYPE_ENUM; + + /** Recipient information object */ + readonly Recipient: FaxRecipient; + + /** Number of failed routing retries */ + readonly Retries: number; + + /** Sender information object */ + readonly Sender: FaxSender; + + /** Size in bytes of TIFF file */ + readonly Size: number; + + /** Cover page's subject field */ + readonly Subject: string; + + /** Unique ID the submission process created for the job */ + readonly SubmissionId: string; + + /** Time the job was submitted */ + readonly SubmissionTime: VarDate; + + /** Transmission end time */ + readonly TransmissionEnd: VarDate; + + /** Transmission start time */ + readonly TransmissionStart: VarDate; + + /** Transmitting Station ID */ + readonly TSID: string; + } + + /** IFaxServer interface */ + class IFaxServer { + /** The fax server activity status object */ + readonly Activity: FaxActivity; + + /** Version of the fax server API */ + readonly APIVersion: FAX_SERVER_APIVERSION_ENUM; + + /** Connect to the fax server */ + Connect(bstrServerName: string): void; + + /** Is fax server built in debug environment */ + readonly Debug: boolean; + + /** Disconnect from the fax server */ + Disconnect(): void; + + /** The fax folders object */ + readonly Folders: FaxFolders; + + /** The collection of device providers */ + GetDeviceProviders(): FaxDeviceProviders; + + /** The collection of all available devices */ + GetDevices(): FaxDevices; + + /** Return server level extention property */ + GetExtensionProperty(bstrGUID: string): any; + + /** The inbound routing configuration object */ + readonly InboundRouting: FaxInboundRouting; + + /** Set bit-wise combination of events the fax server listens to */ + ListenToServerEvents(EventTypes: FAX_SERVER_EVENTS_TYPE_ENUM): void; + + /** The logging options configuration object */ + readonly LoggingOptions: FaxLoggingOptions; + + /** The major part of the fax server's build number */ + readonly MajorBuild: number; + + /** The major part of the fax server's version number */ + readonly MajorVersion: number; + + /** The minor part of the fax server's build number */ + readonly MinorBuild: number; + + /** The minor part of the fax server's version number */ + readonly MinorVersion: number; + + /** The outbound routing configuration object */ + readonly OutboundRouting: FaxOutboundRouting; + + /** The receipt options configuration object */ + readonly ReceiptOptions: FaxReceiptOptions; + + /** Register device provider */ + RegisterDeviceProvider(bstrGUID: string, bstrFriendlyName: string, bstrImageName: string, TspName: string, lFSPIVersion: number): void; + + /** Events the fax Server is listening to */ + readonly RegisteredEvents: FAX_SERVER_EVENTS_TYPE_ENUM; + + /** Register inbound routing extension */ + RegisterInboundRoutingExtension(bstrExtensionName: string, bstrFriendlyName: string, bstrImageName: string, vMethods: any): void; + + /** The security configuration object */ + readonly Security: FaxSecurity; + + /** The name of the fax server */ + readonly ServerName: string; + + /** Set server level extention property */ + SetExtensionProperty(bstrGUID: string, vProperty: SafeArray): void; + + /** Unregister device provider */ + UnregisterDeviceProvider(bstrUniqueName: string): void; + + /** Unregister inbound routing extension */ + UnregisterInboundRoutingExtension(bstrExtensionUniqueName: string): void; + } + + namespace EventHelperTypes { + type FaxAccount_Invoke_ArgNames = ['dispidMember', 'riid', 'lcid', 'wFlags', 'pdispparams', 'pvarResult', 'pexcepinfo', 'puArgErr']; + + type FaxServer_Invoke_ArgNames = ['dispidMember', 'riid', 'lcid', 'wFlags', 'pdispparams', 'pvarResult', 'pexcepinfo', 'puArgErr']; + + type FaxServer_OnDeviceStatusChange_ArgNames = ['pFaxServer', 'lDeviceId', 'bPoweredOff', 'bSending', 'bReceiving', 'bRinging']; + + interface FaxAccount_Invoke_Parameter { + readonly dispidMember: number; + readonly lcid: number; + readonly pdispparams: stdole.DISPPARAMS; + pexcepinfo: stdole.EXCEPINFO; + puArgErr: number; + pvarResult: any; + readonly riid: stdole.GUID; + readonly wFlags: number; + } + + interface FaxServer_Invoke_Parameter { + readonly dispidMember: number; + readonly lcid: number; + readonly pdispparams: stdole.DISPPARAMS; + pexcepinfo: stdole.EXCEPINFO; + puArgErr: number; + pvarResult: any; + readonly riid: stdole.GUID; + readonly wFlags: number; + } + + interface FaxServer_OnDeviceStatusChange_Parameter { + readonly bPoweredOff: boolean; + readonly bReceiving: boolean; + readonly bRinging: boolean; + readonly bSending: boolean; + readonly lDeviceId: number; + readonly pFaxServer: FaxServer; + } + } +} + +interface ActiveXObject { + on( + obj: FAXCOMEXLib.FaxAccount, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( + this: FAXCOMEXLib.FaxAccount, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + on( + obj: FAXCOMEXLib.FaxAccount, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( + this: FAXCOMEXLib.FaxAccount, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; + on(obj: FAXCOMEXLib.FaxAccount, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: FAXCOMEXLib.FaxAccount, parameter: {pctinfo: number}) => void): void; + on( + obj: FAXCOMEXLib.FaxAccount, event: 'Invoke', argNames: FAXCOMEXLib.EventHelperTypes.FaxAccount_Invoke_ArgNames, handler: ( + this: FAXCOMEXLib.FaxAccount, parameter: FAXCOMEXLib.EventHelperTypes.FaxAccount_Invoke_Parameter) => void): void; + on( + obj: FAXCOMEXLib.FaxAccount, event: 'OnIncomingJobAdded' | 'OnIncomingJobRemoved' | 'OnOutgoingJobAdded' | 'OnOutgoingJobRemoved', + argNames: ['pFaxAccount', 'bstrJobId'], handler: (this: FAXCOMEXLib.FaxAccount, parameter: {readonly pFaxAccount: FAXCOMEXLib.FaxAccount, readonly bstrJobId: string}) => void): void; + on( + obj: FAXCOMEXLib.FaxAccount, event: 'OnIncomingJobChanged' | 'OnOutgoingJobChanged', argNames: ['pFaxAccount', 'bstrJobId', 'pJobStatus'], + handler: (this: FAXCOMEXLib.FaxAccount, parameter: {readonly pFaxAccount: FAXCOMEXLib.FaxAccount, readonly bstrJobId: string, readonly pJobStatus: FAXCOMEXLib.FaxJobStatus}) => void): void; + on( + obj: FAXCOMEXLib.FaxAccount, event: 'OnIncomingMessageAdded', argNames: ['pFaxAccount', 'bstrMessageId', 'fAddedToReceiveFolder'], + handler: (this: FAXCOMEXLib.FaxAccount, parameter: {readonly pFaxAccount: FAXCOMEXLib.FaxAccount, readonly bstrMessageId: string, readonly fAddedToReceiveFolder: boolean}) => void): void; + on( + obj: FAXCOMEXLib.FaxAccount, event: 'OnIncomingMessageRemoved', argNames: ['pFaxAccount', 'bstrMessageId', 'fRemovedFromReceiveFolder'], + handler: (this: FAXCOMEXLib.FaxAccount, parameter: {readonly pFaxAccount: FAXCOMEXLib.FaxAccount, readonly bstrMessageId: string, readonly fRemovedFromReceiveFolder: boolean}) => void): void; + on( + obj: FAXCOMEXLib.FaxAccount, event: 'OnOutgoingMessageAdded' | 'OnOutgoingMessageRemoved', argNames: ['pFaxAccount', 'bstrMessageId'], + handler: (this: FAXCOMEXLib.FaxAccount, parameter: {readonly pFaxAccount: FAXCOMEXLib.FaxAccount, readonly bstrMessageId: string}) => void): void; + on( + obj: FAXCOMEXLib.FaxAccount, event: 'OnServerShutDown', argNames: ['pFaxServer'], handler: ( + this: FAXCOMEXLib.FaxAccount, parameter: {readonly pFaxServer: FAXCOMEXLib.FaxServer}) => void): void; + on( + obj: FAXCOMEXLib.FaxAccount, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: ( + this: FAXCOMEXLib.FaxAccount, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( + this: FAXCOMEXLib.FaxServer, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( + this: FAXCOMEXLib.FaxServer, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; + on(obj: FAXCOMEXLib.FaxServer, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: FAXCOMEXLib.FaxServer, parameter: {pctinfo: number}) => void): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'Invoke', argNames: FAXCOMEXLib.EventHelperTypes.FaxServer_Invoke_ArgNames, handler: ( + this: FAXCOMEXLib.FaxServer, parameter: FAXCOMEXLib.EventHelperTypes.FaxServer_Invoke_Parameter) => void): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'OnActivityLoggingConfigChange' | 'OnDevicesConfigChange' | 'OnEventLoggingConfigChange' | 'OnGeneralServerConfigChanged' | + 'OnIncomingArchiveConfigChange' | 'OnOutboundRoutingGroupsConfigChange' | 'OnOutboundRoutingRulesConfigChange' | 'OnOutgoingArchiveConfigChange' | + 'OnOutgoingQueueConfigChange' | 'OnReceiptOptionsChange' | 'OnSecurityConfigChange' | 'OnServerShutDown', + argNames: ['pFaxServer'], + handler: (this: FAXCOMEXLib.FaxServer, parameter: {readonly pFaxServer: FAXCOMEXLib.FaxServer}) => void): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'OnDeviceStatusChange', argNames: FAXCOMEXLib.EventHelperTypes.FaxServer_OnDeviceStatusChange_ArgNames, + handler: (this: FAXCOMEXLib.FaxServer, parameter: FAXCOMEXLib.EventHelperTypes.FaxServer_OnDeviceStatusChange_Parameter) => void): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'OnIncomingJobAdded' | 'OnIncomingJobRemoved' | 'OnOutgoingJobAdded' | 'OnOutgoingJobRemoved', + argNames: ['pFaxServer', 'bstrJobId'], handler: (this: FAXCOMEXLib.FaxServer, parameter: {readonly pFaxServer: FAXCOMEXLib.FaxServer, readonly bstrJobId: string}) => void): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'OnIncomingJobChanged' | 'OnOutgoingJobChanged', argNames: ['pFaxServer', 'bstrJobId', 'pJobStatus'], + handler: (this: FAXCOMEXLib.FaxServer, parameter: {readonly pFaxServer: FAXCOMEXLib.FaxServer, readonly bstrJobId: string, readonly pJobStatus: FAXCOMEXLib.FaxJobStatus}) => void): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'OnIncomingMessageAdded' | 'OnIncomingMessageRemoved' | 'OnOutgoingMessageAdded' | 'OnOutgoingMessageRemoved', + argNames: ['pFaxServer', 'bstrMessageId'], handler: (this: FAXCOMEXLib.FaxServer, parameter: {readonly pFaxServer: FAXCOMEXLib.FaxServer, readonly bstrMessageId: string}) => void): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'OnNewCall', argNames: ['pFaxServer', 'lCallId', 'lDeviceId', 'bstrCallerId'], handler: ( + this: FAXCOMEXLib.FaxServer, parameter: {readonly pFaxServer: FAXCOMEXLib.FaxServer, readonly lCallId: number, readonly lDeviceId: number, readonly bstrCallerId: string}) => void): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'OnQueuesStatusChange', argNames: ['pFaxServer', 'bOutgoingQueueBlocked', 'bOutgoingQueuePaused', 'bIncomingQueueBlocked'], + handler: ( + this: FAXCOMEXLib.FaxServer, + parameter: { + readonly pFaxServer: FAXCOMEXLib.FaxServer, readonly bOutgoingQueueBlocked: boolean, readonly bOutgoingQueuePaused: boolean, readonly bIncomingQueueBlocked: boolean}) => void): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'OnServerActivityChange', + argNames: ['pFaxServer', 'lIncomingMessages', 'lRoutingMessages', 'lOutgoingMessages', 'lQueuedMessages'], handler: ( + this: FAXCOMEXLib.FaxServer, + parameter: { + readonly pFaxServer: FAXCOMEXLib.FaxServer, readonly lIncomingMessages: number, readonly lRoutingMessages: number, readonly lOutgoingMessages: number, readonly lQueuedMessages: number + }) => void + ): void; + on( + obj: FAXCOMEXLib.FaxServer, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: ( + this: FAXCOMEXLib.FaxServer, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; + on(obj: FAXCOMEXLib.FaxAccount, event: 'AddRef' | 'Release', handler: (this: FAXCOMEXLib.FaxAccount, parameter: {}) => void): void; + on(obj: FAXCOMEXLib.FaxServer, event: 'AddRef' | 'Release', handler: (this: FAXCOMEXLib.FaxServer, parameter: {}) => void): void; + new(progid: K): ActiveXObjectNameMap[K]; +} + +interface ActiveXObjectNameMap { + 'FaxComEx.FaxDocument': FAXCOMEXLib.FaxDocument; + 'FaxComEx.FaxServer': FAXCOMEXLib.FaxServer; +} diff --git a/types/activex-faxcomexlib/package.json b/types/activex-faxcomexlib/package.json new file mode 100644 index 0000000000..d9b1031263 --- /dev/null +++ b/types/activex-faxcomexlib/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "activex-helpers": "*" + } +} \ No newline at end of file diff --git a/types/activex-faxcomexlib/tsconfig.json b/types/activex-faxcomexlib/tsconfig.json new file mode 100644 index 0000000000..6509ab4701 --- /dev/null +++ b/types/activex-faxcomexlib/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5", + "scripthost" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "activex-faxcomexlib-tests.ts" + ] +} \ No newline at end of file diff --git a/types/activex-faxcomexlib/tslint.json b/types/activex-faxcomexlib/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/activex-faxcomexlib/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/activex-infopath/tslint.json b/types/activex-infopath/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-infopath/tslint.json +++ b/types/activex-infopath/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts b/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts new file mode 100644 index 0000000000..14a90f9a8a --- /dev/null +++ b/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts @@ -0,0 +1,49 @@ +const wshn = new ActiveXObject('WScript.Network'); + +// https://msdn.microsoft.com/en-us/library/s6wt333f(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/wck0hkd7(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/tte130y1(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/3fxhka75(v=vs.84).aspx +{ + WScript.Echo('Domain = ' + wshn.UserDomain); + WScript.Echo('Computer Name = ' + wshn.ComputerName); + WScript.Echo('User Name = ' + wshn.UserName); +} + +// https://msdn.microsoft.com/en-us/library/zsdh7hkb(v=vs.84).aspx +wshn.AddWindowsPrinterConnection('\\\\printserv\\DefaultPrinter'); + +// https://msdn.microsoft.com/en-us/library/kxsdca3c(v=vs.84).aspx +wshn.AddPrinterConnection("LPT1", "\\\\Server\\Print1"); + +// https://msdn.microsoft.com/en-us/library/t9zt39at(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/zhds6k80(v=vs.84).aspx +{ + const drives = wshn.EnumNetworkDrives(); + const printers = wshn.EnumPrinterConnections(); + WScript.Echo("Network drive mappings:"); + for (let i = 0; i < drives.length; i += 2) { + WScript.Echo(`Drive ${drives.Item(i)} = ${drives.Item(i + 1)}`); + } + WScript.Echo(''); + WScript.Echo("Network printer mappings:"); + for (let i = 0; i < printers.length; i += 2) { + WScript.Echo(`Port ${printers.Item(i)} = ${printers.Item(i + 1)}`); + } +} + +// https://msdn.microsoft.com/en-us/library/8kst88h6(v=vs.84).aspx +wshn.MapNetworkDrive('E:', '\\\\Server\\Public'); + +// https://msdn.microsoft.com/en-us/library/d16d7wbf(v=vs.84).aspx +wshn.RemoveNetworkDrive('E:'); + +// https://msdn.microsoft.com/en-us/library/tsbh2yy7(v=vs.84).aspx +wshn.RemovePrinterConnection('\\\\PRN-CORP1\\B41-4523-A', true, true); + +// https://msdn.microsoft.com/en-us/library/2ccwwdct(v=vs.84).aspx +{ + const printerPath = "\\\\research\\library1"; + wshn.AddWindowsPrinterConnection(printerPath); + wshn.SetDefaultPrinter(printerPath); +} diff --git a/types/activex-iwshruntimelibrary/index.d.ts b/types/activex-iwshruntimelibrary/index.d.ts new file mode 100644 index 0000000000..d5b052eaae --- /dev/null +++ b/types/activex-iwshruntimelibrary/index.d.ts @@ -0,0 +1,348 @@ +// Type definitions for Windows Script Host Object Model - IWshRuntimeLibrary 1.0 +// Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k(v=vs.84).aspx +// Definitions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +declare namespace IWshRuntimeLibrary { + type WindowStyle = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; + type ShortcutWindowStyle = 1 | 3 | 7; + + // tslint:disable-next-line no-const-enum + const enum ButtonType { + OK, + OKCancel, + AbortRetryIgnore, + YesNoCancel, + YesNo, + RetryCancel, + CancelTryagainContinue + } + + // tslint:disable-next-line no-const-enum + const enum EventType { + AuditFailure = 5, + AuditSuccess = 4, + Error = 1, + Information = 3, + Success = 0, + Warning = 2 + } + + // tslint:disable-next-line no-const-enum + const enum IconType { + Stop = 16, + QuestionMark = 32, + ExclamationMakr = 48, + InformationMark = 64, + } + + // tslint:disable-next-line no-const-enum + const enum PopupType { + SecondButtonDefault = 256, + ThirdButtonDefault = 512, + Modal = 4096, + RightJustified = 524288, + RTL = 1048576, + } + + // tslint:disable-next-line no-const-enum + const enum PopupSelection { + NoButton = -1, + OK = 1, + Cancel = 2, + Abort = 3, + Retry = 4, + Ignore = 5, + Yes = 6, + No = 7, + TryAgain = 10, + Continue = 11, + } + + // tslint:disable-next-line no-const-enum + const enum WshExecStatus { + WshFailed = 2, + WshFinished = 1, + WshRunning = 0, + } + + // tslint:disable-next-line no-const-enum + const enum WshWindowStyle { + WshHide = 0, + WshMaximizedFocus = 3, + WshMinimizedFocus = 2, + WshMinimizedNoFocus = 6, + WshNormalFocus = 1, + WshNormalNoFocus = 4, + } + + class TextStream { + private 'IWshRuntimeLibrary.TextStream_typekey': TextStream; + private constructor(); + readonly AtEndOfLine: boolean; + readonly AtEndOfStream: boolean; + Close(): void; + readonly Column: number; + readonly Line: number; + Read(Characters: number): string; + ReadAll(): string; + ReadLine(): string; + Skip(Characters: number): void; + SkipLine(): void; + Write(Text: string): void; + WriteBlankLines(Lines: number): void; + + /** @param string [Text=''] */ + WriteLine(Text?: string): void; + } + + /** Generic Collection Object */ + interface WshCollection { + Count(): number; + Item(Index: any): any; + readonly length: number; + (Index: any): any; + } + + /** Environment Variables Collection Object */ + interface WshEnvironment { + Count(): number; + Item(Name: string): string; + readonly length: number; + Remove(Name: string): void; + (Name: string): string; + } + + /** WSHExec object */ + class WshExec { + private 'IWshRuntimeLibrary.WshExec_typekey': WshExec; + private constructor(); + readonly ExitCode: number; + readonly ProcessID: number; + readonly Status: WshExecStatus; + readonly StdErr: TextStream; + readonly StdIn: TextStream; + readonly StdOut: TextStream; + Terminate(): void; + } + + /** Network Object */ + class WshNetwork { + private 'IWshRuntimeLibrary.WshNetwork_typekey': WshNetwork; + private constructor(); + + /** + * Adds a remote MS-DOS-based printer connection to your computer system. + * @param LocalName Local name to assign to the connected printer. + * @param RemoteName Name of the remote printer. + * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. + * + * If you are mapping a remote printer using the profile of someone other than current user, you can specify _UserName_ and _Password_. + */ + AddPrinterConnection(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; + + /** + * @param string Path to printer connection + * @param string [DriverName=''] + * @param string [Port='LPT1'] + * + * Unlike the **AddPrinterConnection** method, this method allows you to create a printer connection without directing it to a specific port, such as LPT1. + */ + AddWindowsPrinterConnection(PrinterName: string, DriverName?: string, Port?: string): void; + readonly ComputerName: string; + EnumNetworkDrives(): WshCollection; + EnumPrinterConnections(): WshCollection; + + /** + * Adds a remote MS-DOS-based printer connection to your computer system. + * @param LocalName Name by which the mapped drive will be known locally + * @param RemoteName Share's UNC name (\\xxx\yyy) + * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. + * + * If you are mapping a network drive using the profile of someone other than current user, you can specify _UserName_ and _Password_. + */ + MapNetworkDrive(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; + readonly Organization: string; + + /** + * Removes a shared network drive from your computer system + * @param Name Name of the mapped drive you want to remove. This will be the drive letter if the drive has a mapping between a local name (drive letter) and a remote name (UNC name); + * it will be the UNC path if there is no such mapping + * @param Force [false] Remove the connections even if the resource is in use + * @param UpdateProfile [false] Remove the mapping from the user's profile + */ + RemoveNetworkDrive(Name: string, Force?: boolean, UpdateProfile?: boolean): void; + + /** + * Removes a shared network printer connection from your computer system + * @param Name Name that identifies the printer. Can be a UNC name (in the form `\\xxx\yyy`) or a local name (such as `LPT1`) + * @param Force [false] Remove printer connection even if a user is still connected + * @param UpdateProfile [false] Remove the printer connection from the user's profile + * + * The **RemovePrinterConnection** method removes both Windows and MS-DOS based printer connections. If the printer was connected using the method **AddPrinterConnection**, + * _Name_ must be the printer's local name. If the printer was connected using the **AddWindowsPrinterConnection** method or was added manually (using the Add Printer wizard), + * then _Name_ must be the printer's UNC name. + */ + RemovePrinterConnection(Name: string, Force?: true, UpdateProfile?: true): void; + SetDefaultPrinter(Name: string): void; + readonly Site: string; + readonly UserDomain: string; + readonly UserName: string; + readonly UserProfile: string; + } + + /** Shell Object */ + class WshShell { + private 'IWshRuntimeLibrary.WshShell_typekey': WshShell; + private constructor(); + + /** + * Activates an application window + * @param App Title of application as it appears in the title bar, or the process ID + * @param Wait + * + * This method changes the focus to the named application or window. The window must be attached to the calling thread's message queue. It does not affect whether it is maximized or + * minimized. Focus moves from the activated application window when the user takes action to change the focus (or closes the window). + * + * In determining which application to activate, the specified title is compared to the title string of each running application. If no exact match exists, any application whose title + * string begins with title is activated. If an application still cannot be found, any application whose title string ends with title is activated. If more than one instance of the + * application named by title exists, one instance is arbitrarily activated. + * + * The method might return `false` under the following conditions: + * + * * The window is not brought to the foreground. + * * The window is brought to the foreground but is not given keyboard focus. + * * A Command Prompt window (`cmd.exe`) is brought to the foreground and is given keyboard focus. + */ + AppActivate(App: string | number, Wait?: any): boolean; + + /** + * Creates a shortcut + * @param PathLink Path where the shortcut should be created + * + * The shortcut object exists in memory until you save it to disk with the **Save** method. + */ + CreateShortcut(PathLink: string): WshShortcut | WshURLShortcut; + CurrentDirectory: string; + + /** + * Note that **Environment** doesn't actually return a callable object; the call is only usable in the context of the **Environment** property. The following: + * + * let env = new ActiveXObject('WScript.Shell').Environment; + * WScript.Echo(env('System')); + * + * will return an empty string, unless there is an environment variable named `System` + */ + Environment: WshEnvironment & ((Type: 'System' | 'User' | 'Process' | 'Volatile') => WshEnvironment); + Exec(Command: string): WshExec; + ExpandEnvironmentStrings(Src: string): string; + + /** @param string [Target=''] Name of the computer system where the event should be logged; default is the local computer system */ + LogEvent(Type: EventType, Message: string, Target?: string): boolean; + Popup(Text: string, SecondsToWait?: number, Title?: string, Type?: ButtonType | IconType | PopupType): PopupSelection; + RegDelete(Name: string): void; + + /** + * Returns the value of a key or value-name from the registry + * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) + * + * Returns one of the following, based on the registry value type: + * + * * **REG_SZ** -- a string + * * **REG_DWORD** -- a number + * * **REG_SBINARY** -- a binary value, as a COM SafeArray containing integers + * * **REG_EXPAND_SZ** -- an expandable string + * * **REG_MULTI_SZ** -- an array of srings, as a COM SafeArray + */ + RegRead(Name: string): string | number | SafeArray | SafeArray; + + /** + * Creates a new key, adds another value-name to an existing key and assigns it a value, or changes the value of an existing value-name + * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) + * @param Value Will be coerced to `string` or `integer` based on the value-name type: + * `REG_SZ | REG_EXPAND_SZ` will be converted to `string`; + * `REG_DWORD | REG_BINARY` will be converted to `integer` + * @param Type + */ + RegWrite(Name: string, Value: any, Type?: 'REG_SZ' | 'REG_DWORD' | 'REG_BINARY' | 'REG_EXPAND_SZ'): void; + + /** + * Runs a program in a new process. + * @param Command Command-line, including any parameters you want to pass to the executable file. + * @param WindowStyle Appearance of the program window. Not all programs make use of this information. + * @param WaitOnReturn Block script until program finishes executing. + * + * If `false` is passed into **WaitOnReturn**, the **Run** method will return 0 immediately. If `true` is passed in, **Run** will return the program's error code, if any. + * + * Environment variables will be expanded within the command line. + * + * Passing a registered file type will automatically open the program registered to the file type. + * + * Possible values for **WindowStyle**: + * + * * **0** -- Hides the window and activates another window. + * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when displaying the window for the first time. + * * **2** -- Activates the window and displays it as a minimized window. + * * **3** -- Activates the window and displays it as a maximized window. + * * **4** -- Displays a window in its most recent size and position. The active window remains active. + * * **5** -- Activates the window and displays it in its current size and position. + * * **6** -- Minimizes the specified window and activates the next top-level window in the Z order. + * * **7** -- Displays the window as a minimized window. The active window remains active. + * * **8** -- Displays the window in its current state. The active window remains active. + * * **9** -- Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when restoring a minimized window. + * * **10** -- Sets the show-state based on the state of the program that started the application. + */ + Run(Command: string, WindowStyle?: WindowStyle, WaitOnReturn?: boolean): number; + SendKeys(Keys: string, Wait?: boolean): void; + readonly SpecialFolders: WshCollection; + } + + /** Shortcut Object */ + class WshShortcut { + private 'IWshRuntimeLibrary.WshShortcut_typekey': WshShortcut; + private constructor(); + Arguments: string; + Description: string; + readonly FullName: string; + Hotkey: string; + IconLocation: string; + Load(PathLink: string): void; + readonly RelativePath: string; + Save(): void; + TargetPath: string; + + /** + * Possible values: + * + * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when displaying the window for the first time. + * * **3** -- Activates the window and displays it as a maximized window. + * * **7** -- Displays the window as a minimized window. The active window remains active. + */ + WindowStyle: ShortcutWindowStyle; + WorkingDirectory: string; + } + + /** URLShortcut Object */ + class WshURLShortcut { + private 'IWshRuntimeLibrary.WshURLShortcut_typekey': WshURLShortcut; + private constructor(); + readonly FullName: string; + Load(PathLink: string): void; + Save(): void; + TargetPath: string; + } +} + +interface ActiveXObject { + set(obj: IWshRuntimeLibrary.WshEnvironment, propertyName: 'Item', parameterTypes: [string], newValue: string): void; + new (progid: K): ActiveXObjectNameMap[K]; +} + +interface ActiveXObjectNameMap { + 'WScript.Network': IWshRuntimeLibrary.WshNetwork; + 'WScript.Shell': IWshRuntimeLibrary.WshShell; +} diff --git a/types/activex-iwshruntimelibrary/package.json b/types/activex-iwshruntimelibrary/package.json new file mode 100644 index 0000000000..d9b1031263 --- /dev/null +++ b/types/activex-iwshruntimelibrary/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "activex-helpers": "*" + } +} \ No newline at end of file diff --git a/types/activex-iwshruntimelibrary/tsconfig.json b/types/activex-iwshruntimelibrary/tsconfig.json new file mode 100644 index 0000000000..1fa5abc39b --- /dev/null +++ b/types/activex-iwshruntimelibrary/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5", + "scripthost" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "activex-iwshruntimelibrary-tests.ts" + ] +} \ No newline at end of file diff --git a/types/activex-iwshruntimelibrary/tslint.json b/types/activex-iwshruntimelibrary/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/activex-iwshruntimelibrary/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/activex-libreoffice/tslint.json b/types/activex-libreoffice/tslint.json index 8e56cb082c..37a3c27489 100644 --- a/types/activex-libreoffice/tslint.json +++ b/types/activex-libreoffice/tslint.json @@ -1,8 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false], "ban-types": false, + "no-const-enum": false, "no-redundant-jsdoc": false, "no-redundant-jsdoc-2": false, "no-unnecessary-qualifier": false diff --git a/types/activex-msforms/tslint.json b/types/activex-msforms/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-msforms/tslint.json +++ b/types/activex-msforms/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/activex-mshtml/tslint.json b/types/activex-mshtml/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-mshtml/tslint.json +++ b/types/activex-mshtml/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/activex-msxml2/tslint.json b/types/activex-msxml2/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-msxml2/tslint.json +++ b/types/activex-msxml2/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/activex-office/tslint.json b/types/activex-office/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-office/tslint.json +++ b/types/activex-office/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/activex-outlook/tslint.json b/types/activex-outlook/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-outlook/tslint.json +++ b/types/activex-outlook/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/activex-powerpoint/tslint.json b/types/activex-powerpoint/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-powerpoint/tslint.json +++ b/types/activex-powerpoint/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/activex-scripting/activex-scripting-tests.ts b/types/activex-scripting/activex-scripting-tests.ts index 2297548b81..313e480cb5 100644 --- a/types/activex-scripting/activex-scripting-tests.ts +++ b/types/activex-scripting/activex-scripting-tests.ts @@ -1,60 +1,324 @@ -// source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx +// Note -- running these tests under cscript requires some ES5 polyfills -// Generates a string describing the drive type of a given Drive object. -function showDriveType(drive: Scripting.Drive) { - switch (drive.DriveType) { - case Scripting.DriveTypeConst.Removable: - return 'Removeable'; - case Scripting.DriveTypeConst.Fixed: - return 'Fixecd'; - case Scripting.DriveTypeConst.Remote: - return 'Network'; - case Scripting.DriveTypeConst.CDRom: - return 'CD-ROM'; - case Scripting.DriveTypeConst.RamDisk: - return 'RAM Disk'; - default: - return 'Unknown'; +const collectionToArray = (col: { Item(key: any): T }): T[] => { + const results: T[] = []; + const enumerator = new Enumerator(col); + enumerator.moveFirst(); + while (!enumerator.atEnd()) { + results.push(enumerator.item()); + enumerator.moveNext(); } -} + return results; +}; -// Generates a string describing the attributes of a file or folder. -function showFileAttributes(file: Scripting.File) { - const attr = file.Attributes; - if (attr === 0) { - return 'Normal'; +const fso = new ActiveXObject('Scripting.FileSystemObject'); + +// https://msdn.microsoft.com/en-us/library/ebkhfaaz(v=vs.84).aspx +{ + /** Generates a string describing the drive type of a given Drive object. */ + const driveTypeString = (drive: Scripting.Drive) => { + switch (drive.DriveType) { + case Scripting.DriveTypeConst.Removable: + return 'Removeable'; + case Scripting.DriveTypeConst.Fixed: + return 'Fixecd'; + case Scripting.DriveTypeConst.Remote: + return 'Network'; + case Scripting.DriveTypeConst.CDRom: + return 'CD-ROM'; + case Scripting.DriveTypeConst.RamDisk: + return 'RAM Disk'; + default: + return 'Unknown'; + } + }; + + /** Generates a string describing the attributes of a file or folder. */ + const attributesString = (f: Scripting.File | Scripting.Folder) => { + const attr = f.Attributes; + if (attr === 0) { + return 'Normal'; + } + const attributeStrings: string[] = []; + if (attr & Scripting.FileAttribute.Directory) { attributeStrings.push('Directory'); } + if (attr & Scripting.FileAttribute.ReadOnly) { attributeStrings.push('Read-only'); } + if (attr & Scripting.FileAttribute.Hidden) { attributeStrings.push('Hidden'); } + if (attr & Scripting.FileAttribute.System) { attributeStrings.push('System'); } + if (attr & Scripting.FileAttribute.Volume) { attributeStrings.push('Volume'); } + if (attr & Scripting.FileAttribute.Archive) { attributeStrings.push('Archive'); } + if (attr & Scripting.FileAttribute.Alias) { attributeStrings.push('Alias'); } + if (attr & Scripting.FileAttribute.Compressed) { attributeStrings.push('Compressed'); } + return attributeStrings.join(','); + }; + + const drivesInfoReport = () => { + const driveLine = (d: Scripting.Drive) => { + let parts: Array = [ + d.DriveLetter, + d.Path, + driveTypeString(d), + d.IsReady ? 'true' : 'false' + ]; + if (d.IsReady) { + parts = parts.concat([ + d.DriveType === Scripting.DriveTypeConst.Remote ? d.ShareName : d.VolumeName, + d.FileSystem, + d.TotalSize, + d.FreeSpace, + d.AvailableSpace, + d.SerialNumber.toString(16) + ]); + } + return parts.join(' '); + }; + + const ret = ` +Number of drives: ${fso.Drives.Count} + + Drive File Total Free Available Serial +Letter Path Type Ready? Name System Space Space Space Number +${new Array(106).join('-')} +${collectionToArray(fso.Drives).map(driveLine).join('\n')}` + .trim().replace(' ', '\t'); + }; + + type fiileFolderKey = keyof Scripting.File & keyof Scripting.Folder; + type keys = fiileFolderKey | 'Attribs' | 'Created' | 'Accessed' | 'Modified'; + const detailBuilder = (f: Scripting.File | Scripting.Folder, x: fiileFolderKey | 'Attribs' | 'Created' | 'Accessed' | 'Modified') => { + if (x === 'Attribs') { return attributesString(f); } + const label = x; + switch (x) { + case 'Created': + x = 'DateCreated'; + break; + case 'Accessed': + x = 'DateLastAccessed'; + break; + case 'Modified': + x = 'DateLastModified'; + break; + } + return `${label}\t${f[x]}\n`; + }; + + const fileDetailsString = (f: Scripting.File) => { + const keys: keys[] = ['Path', 'Name', 'Type', 'Attribs', 'Created', 'Accessed', 'Modified', 'Size']; + return keys.map(x => detailBuilder(f, x)).join(''); + }; + + const folderDetailsString = (f: Scripting.Folder) => { + const keys: keys[] = ['Path', 'Name', 'Attribs', 'Created', 'Accessed', 'Modified', 'Size']; + return keys.map(x => detailBuilder(f, x)).join(''); + }; + + const folderContentsString = (f: Scripting.Folder): string => { + const files = collectionToArray(f.Files); + const subfolders = collectionToArray(f.SubFolders); + return ` +Folder: ${f.Path} + +There ${files.length === 1 ? 'is 1 file' : `are ${files.length} files`} +${files.map(fileDetailsString).join('')} + +There ${subfolders.length === 1 ? 'is 1 subfolder' : `are ${subfolders.length} subfolders`} +${subfolders.map(folderDetailsString).join('')} +${subfolders.map(folderContentsString).join('')}` + .trim().replace(' ', '\t'); + }; + + const testDrive = 'C:\\'; + const testPath = 'C:\\test'; + const testfolderInfo = () => { + if (!fso.DriveExists(testDrive) || !fso.FolderExists(testPath)) { return ''; } + return folderContentsString(fso.GetFolder(testPath)); + }; + + const deleteTestFolder = () => { + // two ways to delete a file: + const filepathToDelete = `${testPath}\\LoremIpsum\\Paragraph1.txt`; + fso.DeleteFile(filepathToDelete); + // fso.GetFile(filepathToDelete).Delete(); + + // two ways to delete a folder: + fso.DeleteFolder(`${testPath}\\LoremIpsum`); + fso.GetFolder(testPath).Delete(); + }; + + const createLyrics = (folder: Scripting.Folder) => { + let stream = folder.CreateTextFile('Paragraph1.txt'); + stream.Write('Lorem Ipsum - Paragraph 1'); + stream.WriteBlankLines(1); + stream.WriteLine('Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sem.'); + stream.WriteLine('Donec ante. Nulla facilisi. Phasellus interdum nulla a nunc. Morbi laoreet nunc.'); + stream.WriteBlankLines(2); + stream.Close(); + + stream = folder.CreateTextFile('Paragraph2.txt'); + stream.WriteLine('Lorem Ipsum - Paragraph 2'); + stream.WriteBlankLines(1); + stream.WriteLine('Nullam nulla quam, sollicitudin ut, lobortis ornare, tristique a, augue.'); + stream.WriteLine('Vestibulum sem felis, fermentum eu, volutpat eu, vulputate eget, elit. '); + stream.WriteBlankLines(2); + stream.Close(); + }; + + const getLyrics = () => { + const folderPath = `${testPath}\\LoremIpsum`; + let lyrics = ''; + + // One way to read from a file + let stream = fso.OpenTextFile(fso.BuildPath(folderPath, 'Paragraph1.txt')); + lyrics = stream.ReadAll() + '\n\n'; + stream.Close(); + + // Another way to read from a file + stream = fso.GetFile(fso.BuildPath(folderPath, 'Paragraph2.txt')).OpenAsTextStream(); + while (!stream.AtEndOfStream) { + lyrics += stream.ReadLine() + '\n'; + } + stream.Close(); + + return lyrics; + }; + + const buildTestFolder = () => { + // Bail out if the drive doesn't exists ... + if (!fso.DriveExists(testDrive)) { return false; } + // or the directory already exists + if (fso.FolderExists(testPath)) { return false; } + + const testFolder = fso.CreateFolder(testPath); + + const stream = fso.CreateTextFile(fso.BuildPath(testPath, 'readme.txt')); + stream.WriteLine('My sample text collection'); + stream.Close(); + + const subfolder = testFolder.SubFolders.Add('LoremIpsum'); + createLyrics(subfolder); + return true; + }; + + const echoLines = (linecount = 1) => new Array(linecount).forEach(() => WScript.Echo('')); + + if (!buildTestFolder()) { + WScript.Echo('Test directory already exists or cannot be created. Cannot continue.'); + } else { + drivesInfoReport(); + echoLines(2); + WScript.Echo(testfolderInfo()); + echoLines(2); + WScript.Echo(getLyrics()); + echoLines(2); + deleteTestFolder(); } - const attributeStrings: string[] = []; - if (attr & Scripting.FileAttribute.Directory) { attributeStrings.push('Directory'); } - if (attr & Scripting.FileAttribute.ReadOnly) { attributeStrings.push('Read-only'); } - if (attr & Scripting.FileAttribute.Hidden) { attributeStrings.push('Hidden'); } - if (attr & Scripting.FileAttribute.System) { attributeStrings.push('System'); } - if (attr & Scripting.FileAttribute.Volume) { attributeStrings.push('Volume'); } - if (attr & Scripting.FileAttribute.Archive) { attributeStrings.push('Archive'); } - if (attr & Scripting.FileAttribute.Alias) { attributeStrings.push('Alias'); } - if (attr & Scripting.FileAttribute.Compressed) { attributeStrings.push('Compressed'); } - return attributeStrings.join(','); } // source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx -function showFreeSpace(drvPath: string) { - const fso = new ActiveXObject('Scripting.FileSystemObject'); - const d = fso.GetDrive(fso.GetDriveName(drvPath)); - let s = `Drive ${drvPath} - `; - s += d.VolumeName + '
'; - s += `Free Space: ${d.FreeSpace / 1024} Kbytes`; - return (s); +{ + const showFreeSpace = (drvPath: string) => { + const d = fso.GetDrive(fso.GetDriveName(drvPath)); + let s = `Drive ${drvPath} - `; + s += d.VolumeName + '
'; + s += `Free Space: ${d.FreeSpace / 1024} Kbytes`; + return (s); + }; } // source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx -function getALine(filespec: string) { - const fso = new ActiveXObject('Scripting.FileSystemObject'); - const file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false); +{ + const getALine = (filespec: string) => { + const file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false); - let s = ''; - while (!file.AtEndOfLine) { - s += file.Read(1); - } - file.Close(); - return (s); + let s = ''; + while (!file.AtEndOfLine) { + s += file.Read(1); + } + file.Close(); + return (s); + }; +} + +// https://msdn.microsoft.com/en-us/library/ch28h2s7(v=vs.84).aspx +{ + const showDriveInfo = (path: string) => { + const bytesPerGB = 1024 * 1024 * 1024; + const drv = fso.GetDrive(fso.GetDriveName(path)); + const ret = + drv.IsReady ? + `${drv.Path} - ${drv.FreeSpace / bytesPerGB} GB free of ${drv.TotalSize / bytesPerGB} GB` : + 'Not ready'; + WScript.Echo(ret); + }; + + const showFolderInfo = () => { + const fldr = fso.GetFolder("c:\\"); + let ret = ` +Folder: ${fldr.Path} +Drive: ${fldr.Drive} +${fldr.IsRootFolder ? 'Is root folder' : `Parent folder: ${fldr.ParentFolder}`} + `.trim(); + + // Create and delete a folder. + const newFolderName = 'C:\\TempFolder1'; + fso.CreateFolder(newFolderName); + ret += `Base Name of Added Folder: ${fso.GetBaseName(newFolderName)}`; + fso.DeleteFolder(newFolderName); + + WScript.Echo(ret); + }; +} + +// https://msdn.microsoft.com/en-us/library/czxefwt8(v=vs.84).aspx +{ + const readFiles = () => { + const file = fso.CreateTextFile("c:\\testfile.txt", true); + + // Write a line. + WScript.Echo('Writing file'); + file.WriteLine("Hello World"); + file.WriteBlankLines(1); + file.Close(); + + // Read the contents of the file. + WScript.Echo('Reading file'); + const textStream = fso.OpenTextFile("c:\\testfile.txt", Scripting.IOMode.ForReading); + WScript.Echo(`File contents = "${textStream.ReadLine()}"`); + textStream.Close(); + }; + + const manipulateFiles = () => { + const file = fso.CreateTextFile("c:\\testfile.txt", true); + + WScript.Echo('Writing file'); + + // Write a line. + file.Write("This is a test."); + + // Close the file to writing. + file.Close(); + + WScript.Echo('Moving file to c:\\tmp'); + + // Get a handle to the file in root of C:\. + let file2 = fso.GetFile("c:\\testfile.txt"); + + // Move the file to \tmp directory. + file2.Move("c:\\tmp\\testfile.txt"); + + WScript.Echo('Copying file to c:\\temp
'); + + // Copy the file to \temp. + file2.Copy('c:\\temp\\testfile.txt'); + + WScript.Echo('Deleting files
'); + + // Get handles to files' current location. + file2 = fso.GetFile('c:\\tmp\\testfile.txt'); + const file3 = fso.GetFile('c:\\temp\\testfile.txt'); + + // Delete the files. + file2.Delete(); + file3.Delete(); + WScript.Echo('All done!'); + }; } diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts index c4a64c54af..42e4f0c9e0 100644 --- a/types/activex-scripting/index.d.ts +++ b/types/activex-scripting/index.d.ts @@ -1,24 +1,28 @@ // Type definitions for Microsoft Scripting Runtime 1.0 -// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx +// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7(v=vs.84).aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 declare namespace Scripting { + // tslint:disable-next-line:no-const-enum const enum CompareMethod { BinaryCompare = 0, DatabaseCompare = 2, - TextCompare = 1 + TextCompare = 1, } + // tslint:disable-next-line:no-const-enum const enum DriveTypeConst { CDRom = 4, Fixed = 2, RamDisk = 5, Remote = 3, Removable = 1, - UnknownType = 0 + UnknownType = 0, } + // tslint:disable-next-line:no-const-enum const enum FileAttribute { Alias = 1024, Archive = 32, @@ -28,38 +32,42 @@ declare namespace Scripting { Normal = 0, ReadOnly = 1, System = 4, - Volume = 8 + Volume = 8, } + // tslint:disable-next-line:no-const-enum const enum IOMode { ForAppending = 8, ForReading = 1, - ForWriting = 2 + ForWriting = 2, } + // tslint:disable-next-line:no-const-enum const enum SpecialFolderConst { SystemFolder = 1, TemporaryFolder = 2, - WindowsFolder = 0 + WindowsFolder = 0, } + // tslint:disable-next-line:no-const-enum const enum StandardStreamTypes { StdErr = 2, StdIn = 0, - StdOut = 1 + StdOut = 1, } + // tslint:disable-next-line:no-const-enum const enum Tristate { TristateFalse = 0, TristateMixed = -2, TristateTrue = -1, - TristateUseDefault = -2 + TristateUseDefault = -2, } /** Scripting.Dictionary */ - interface Dictionary { + interface Dictionary { /** Add a new key and item to the dictionary. */ - Add(Key: any, Item: any): void; + Add(Key: TKey, Item: TItem): void; /** Set or get the string comparison method. */ CompareMode: CompareMethod; @@ -68,32 +76,38 @@ declare namespace Scripting { readonly Count: number; /** Determine if a given key is in the dictionary. */ - Exists(Key: any): boolean; - HashVal(Key: any): any; + Exists(Key: TKey): boolean; + HashVal(Key: TKey): any; /** Set or get the item for a given key */ - Item(Key: any): any; + Item(Key: TKey): TItem; /** Get an array containing all items in the dictionary. */ - Items(): any; + Items(): SafeArray; /** Change a key to a different key. */ - Key(Key: any): any; + Key(Key: TKey): TKey; /** Get an array containing all keys in the dictionary. */ - Keys(): any; + Keys(): SafeArray; /** Remove a given key from the dictionary. */ - Remove(Key: any): void; + Remove(Key: TKey): void; /** Remove all information from the dictionary. */ RemoveAll(): void; + + /** Set or get the item for a given key */ + (Key: TKey): TItem; } /** Drive Object */ - interface Drive { + class Drive { + private constructor(); + private 'Scripting.Drive_typekey': Drive; + /** Get available space */ - readonly AvailableSpace: any; + readonly AvailableSpace: number; /** Drive letter */ readonly DriveLetter: string; @@ -105,7 +119,7 @@ declare namespace Scripting { readonly FileSystem: string; /** Get drive free space */ - readonly FreeSpace: any; + readonly FreeSpace: number; /** Check if disk is available */ readonly IsReady: boolean; @@ -123,7 +137,7 @@ declare namespace Scripting { readonly ShareName: string; /** Get total drive size */ - readonly TotalSize: any; + readonly TotalSize: number; /** Name of volume */ VolumeName: string; @@ -134,18 +148,27 @@ declare namespace Scripting { /** Number of drives */ readonly Count: number; - /** Get drive */ - Item(Key: any): Drive; + /** Get drive using the drive letter (`C`) or path (`C:\\`) */ + Item(Key: string): Drive; + + /** Get drive using the drive letter (`C`) or path (`C:\\`) */ + (Key: string): Drive; } /** Script Encoder Object */ interface Encoder { /** Call the Encoder determined by szExt, passing bstrStreamIn and optional arguments */ EncodeScriptFile(szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string): string; + + /** Call the Encoder determined by szExt, passing bstrStreamIn and optional arguments */ + (szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string): string; } /** File object */ - interface File { + class File { + private constructor(); + private 'Scripting.File_typekey': File; + /** File attributes */ Attributes: FileAttribute; @@ -166,7 +189,7 @@ declare namespace Scripting { /** * Delete this file - * @param boolean [Force=false] + * @param boolean [Force=false] Pass `true` to delete the file even if the read-only attribute is set */ Delete(Force?: boolean): void; @@ -199,7 +222,7 @@ declare namespace Scripting { readonly ShortPath: string; /** File size */ - readonly Size: any; + readonly Size: number; /** Type description */ readonly Type: string; @@ -210,12 +233,18 @@ declare namespace Scripting { /** Number of folders */ readonly Count: number; + /** Get file object using the name and extension of the file */ + Item(Key: string): File; + /** Get file */ - Item(Key: any): File; + (Key: string): File; } /** FileSystem Object */ - interface FileSystemObject { + class FileSystemObject { + private constructor(); + private 'Scripting.FileSystemObject_typekey': FileSystemObject; + /** Generate a path from an existing path and a name */ BuildPath(Path: string, Name: string): string; @@ -243,13 +272,13 @@ declare namespace Scripting { /** * Delete a file - * @param boolean [Force=false] + * @param boolean [Force=false] Pass `true` to also delete files with the read-only attribute set */ DeleteFile(FileSpec: string, Force?: boolean): void; /** * Delete a folder - * @param boolean [Force=false] + * @param boolean [Force=false] Pass `true` to also delete folders with the read-only attribute set */ DeleteFolder(FolderSpec: string, Force?: boolean): void; @@ -317,13 +346,16 @@ declare namespace Scripting { * Open a file as a TextStream * @param Scripting.IOMode [IOMode=1] * @param boolean [Create=false] - * @param Scripting.Tristate [Format=0] + * @param Scripting.Tristate [Format=0] **TristateTrue** opens the file as Unicode; **TristateFalse** opens the file as ASCII; **TristateUseDefault** opens the file with the system default */ OpenTextFile(FileName: string, IOMode?: IOMode, Create?: boolean, Format?: Tristate): TextStream; } /** Folder object */ - interface Folder { + class Folder { + private constructor(); + private 'Scripting.Folder_typekey': Folder; + /** Folder attributes */ Attributes: FileAttribute; @@ -351,7 +383,7 @@ declare namespace Scripting { /** * Delete this folder - * @param boolean [Force=false] + * @param boolean [Force=false] Pass `true` to delete the folder even if the read-only attribute set */ Delete(Force?: boolean): void; @@ -383,7 +415,7 @@ declare namespace Scripting { readonly ShortPath: string; /** Sum of files and subfolders */ - readonly Size: any; + readonly Size: number; /** Get folders collection */ readonly SubFolders: Folders; @@ -400,12 +432,18 @@ declare namespace Scripting { /** Number of folders */ readonly Count: number; - /** Get folder */ - Item(Key: any): Folder; + /** Get folder in collection using the folder's name */ + Item(Key: string): Folder; + + /** Get folder in collection using the folder's name */ + (Key: string): Folder; } /** TextStream object */ - interface TextStream { + class TextStream { + private constructor(); + private 'Scripting.TextStream_typekey': TextStream; + /** Is the current position at the end of a line? */ readonly AtEndOfLine: boolean; @@ -451,15 +489,12 @@ declare namespace Scripting { } interface ActiveXObject { + new (progid: K): ActiveXObjectNameMap[K]; set(obj: Scripting.Dictionary, propertyName: 'Item', parameterTypes: [any], newValue: any): void; - new(progid: 'Scripting.Dictionary'): Scripting.Dictionary; - new(progid: 'Scripting.Encoder'): Scripting.Encoder; - new(progid: 'Scripting.FileSystemObject'): Scripting.FileSystemObject; } -interface EnumeratorConstructor { - new(col: Scripting.Dictionary): any; - new(col: Scripting.Drives): Scripting.Drive; - new(col: Scripting.Files): Scripting.File; - new(col: Scripting.Folders): Scripting.Folder; +interface ActiveXObjectNameMap { + 'Scripting.Dictionary': Scripting.Dictionary; + 'Scripting.Encoder': Scripting.Encoder; + 'Scripting.FileSystemObject': Scripting.FileSystemObject; } diff --git a/types/activex-scripting/tslint.json b/types/activex-scripting/tslint.json index 2750cc0197..f93cf8562a 100644 --- a/types/activex-scripting/tslint.json +++ b/types/activex-scripting/tslint.json @@ -1 +1,3 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file +{ + "extends": "dtslint/dt.json" +} diff --git a/types/activex-shdocvw/activex-shdocvw-tests.ts b/types/activex-shdocvw/activex-shdocvw-tests.ts new file mode 100644 index 0000000000..713578fb06 --- /dev/null +++ b/types/activex-shdocvw/activex-shdocvw-tests.ts @@ -0,0 +1,12 @@ +// https://msdn.microsoft.com/en-us/library/aa752044(v=vs.85).aspx +(() => { + const ie = new ActiveXObject('InternetExplorer.Application'); + ie.Navigate('http://contoso.com'); + ie.Visible = true; +})(); + +let obj1 = new ActiveXObject('ShellNameSpace.ShellNameSpace'); + +let obj2 = new ActiveXObject('Shell.UIHelper'); + +let obj3 = new ActiveXObject('Shell.Explorer'); diff --git a/types/activex-shdocvw/index.d.ts b/types/activex-shdocvw/index.d.ts new file mode 100644 index 0000000000..86568f6c5d --- /dev/null +++ b/types/activex-shdocvw/index.d.ts @@ -0,0 +1,1577 @@ +// Type definitions for Microsoft Internet Controls - SHDocVw 1.1 +// Project: https://msdn.microsoft.com/en-us/library/aa752040(v=vs.85).aspx +// Definitions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +declare namespace SHDocVw { + // tslint:disable-next-line no-const-enum + const enum BrowserBarConstants { + AddressBar = 0x0009, + Tools = 0x000A, + Links = 0x000B, + Search = '{30D02401-6A81-11D0-8274-00C04FD5AE38}', + Favorites = '{EFA24E61-B078-11D0-89E4-00C04FC9E26E}', + History = '{EFA24E62-B078-11D0-89E4-00C04FC9E26E}', + Channels = '{EFA24E63-B078-11D0-89E4-00C04FC9E26E}' + } + + // tslint:disable-next-line no-const-enum + const enum BrowserNavConstants { + /** Open the resource or file in a new window. */ + OpenInNewWindow = 1, + + /** Do not add the resource or file to the history list. The new page replaces the current page in the list. */ + NoHistory = 2, + + /** If the navigation fails, the autosearch functionality attempts to navigate common root domains (.com, .edu, and so on). If this also fails, the URL is passed to a search engine. */ + AllowAutosearch = 16, + + /** Causes the current Explorer Bar to navigate to the given item, if possible. */ + BrowserBar = 32, + + /** + * Internet Explorer 6 for Windows XP SP2 and later. If the navigation fails when a hyperlink is being followed, this constant specifies that the resource should then be bound to the + * moniker using the [**BINDF_HYPERLINK**](https://msdn.microsoft.com/en-us/library/ms775130(v=vs.85).aspx) flag. + */ + Hyperlink = 64, + + /** Internet Explorer 6 for Windows XP SP2 and later. Force the URL into the restricted zone. */ + EnforceRestricted = 128, + + /** Internet Explorer 6 for Windows XP SP2 and later. Use the default Popup Manager to block pop-up windows. */ + NewWindowsManaged = 256, + + /** Internet Explorer 6 for Windows XP SP2 and later. Block files that normally trigger a file download dialog box. */ + UntrustedForDownload = 512, + + /** Internet Explorer 6 for Windows XP SP2 and later. Prompt for the installation of ActiveX controls. */ + TrustedForActiveX = 1024, + + /** Internet Explorer 7. Open the resource or file in a new tab. Allow the destination window to come to the foreground, if necessary. */ + OpenInNewTab = 2048, + + /** Internet Explorer 7. Open the resource or file in a new background tab; the currently active window and/or tab remains open on top. */ + OpenInBackgroundTab = 4096, + + /** + * Internet Explorer 7. Maintain state for dynamic navigation based on the filter string entered in the search band text box (wordwheel). Restore the wordwheel text when the navigation + * completes. + */ + KeepWordWheelText = 8192, + + /** + * Internet Explorer 8. Open the resource as a replacement for the current or target tab. The existing tab is closed while the new tab takes its place in the tab bar and replaces it in the + * tab group, if any. Browser history is copied forward to the new tab. On Windows Vista, this flag is implied if the navigation would cross integrity levels and **navOpenInNewTab**, + * **navOpenInBackgroundTab**, or **navOpenInNewWindow**> is not specified. + */ + VirtualTab = 16384, + + /** + * Internet Explorer 8. Block cross-domain redirect requests. The navigation triggers the + * [**DWebBrowserEvents2::RedirectXDomainBlocked**](https://msdn.microsoft.com/en-us/library/dd565686(v=vs.85).aspx) event if blocked. + */ + BlockRedirectsXDomain = 32768, + + /** Internet Explorer 8 and later. Open the resource in a new tab that becomes the foreground tab. */ + OpenNewForegroundTab = 65536 + } + + /** Constants for WebBrowser CommandStateChange */ + // tslint:disable-next-line no-const-enum + const enum CommandStateChangeConstants { + CSC_NAVIGATEBACK = 2, + CSC_NAVIGATEFORWARD = 1, + CSC_UPDATECOMMANDS = -1, + } + + /** Constants for WebBrowser NewProcess notification */ + // tslint:disable-next-line no-const-enum + const enum NewProcessCauseConstants { + ProtectedModeRedirect = 1, + } + + // tslint:disable-next-line no-const-enum + const enum OLECMDEXECOPT { + OLECMDEXECOPT_DODEFAULT = 0, + OLECMDEXECOPT_DONTPROMPTUSER = 2, + OLECMDEXECOPT_PROMPTUSER = 1, + OLECMDEXECOPT_SHOWHELP = 3, + } + + // tslint:disable-next-line no-const-enum + const enum OLECMDF { + OLECMDF_DEFHIDEONCTXTMENU = 32, + OLECMDF_ENABLED = 2, + OLECMDF_INVISIBLE = 16, + OLECMDF_LATCHED = 4, + OLECMDF_NINCHED = 8, + OLECMDF_SUPPORTED = 1, + } + + // tslint:disable-next-line no-const-enum + const enum OLECMDID { + OLECMDID_ACTIVEXINSTALLSCOPE = 66, + OLECMDID_ADDTRAVELENTRY = 60, + OLECMDID_ALLOWUILESSSAVEAS = 46, + OLECMDID_CLEARSELECTION = 18, + OLECMDID_CLOSE = 45, + OLECMDID_COPY = 12, + OLECMDID_CUT = 11, + OLECMDID_DELETE = 33, + OLECMDID_DONTDOWNLOADCSS = 47, + OLECMDID_ENABLE_INTERACTION = 36, + OLECMDID_ENABLE_VISIBILITY = 77, + OLECMDID_EXITFULLSCREEN = 81, + OLECMDID_FIND = 32, + OLECMDID_FOCUSVIEWCONTROLS = 57, + OLECMDID_FOCUSVIEWCONTROLSQUERY = 58, + OLECMDID_GETPRINTTEMPLATE = 52, + OLECMDID_GETUSERSCALABLE = 75, + OLECMDID_GETZOOMRANGE = 20, + OLECMDID_HIDETOOLBARS = 24, + OLECMDID_HTTPEQUIV = 34, + OLECMDID_HTTPEQUIV_DONE = 35, + OLECMDID_LAYOUT_VIEWPORT_WIDTH = 71, + OLECMDID_MEDIA_PLAYBACK = 78, + OLECMDID_NEW = 2, + OLECMDID_ONBEFOREUNLOAD = 83, + OLECMDID_ONTOOLBARACTIVATED = 31, + OLECMDID_ONUNLOAD = 37, + OLECMDID_OPEN = 1, + OLECMDID_OPTICAL_GETZOOMRANGE = 64, + OLECMDID_OPTICAL_ZOOM = 63, + OLECMDID_PAGEACTIONBLOCKED = 55, + OLECMDID_PAGEACTIONUIQUERY = 56, + OLECMDID_PAGEAVAILABLE = 74, + OLECMDID_PAGESETUP = 8, + OLECMDID_PASTE = 13, + OLECMDID_PASTESPECIAL = 14, + OLECMDID_POPSTATEEVENT = 69, + OLECMDID_PREREFRESH = 39, + OLECMDID_PRINT = 6, + OLECMDID_PRINT2 = 49, + OLECMDID_PRINTPREVIEW = 7, + OLECMDID_PRINTPREVIEW2 = 50, + OLECMDID_PROPERTIES = 10, + OLECMDID_PROPERTYBAG2 = 38, + OLECMDID_REDO = 16, + OLECMDID_REFRESH = 22, + OLECMDID_SAVE = 3, + OLECMDID_SAVEAS = 4, + OLECMDID_SAVECOPYAS = 5, + OLECMDID_SCROLLCOMPLETE = 82, + OLECMDID_SELECTALL = 17, + OLECMDID_SET_HOST_FULLSCREENMODE = 80, + OLECMDID_SETDOWNLOADSTATE = 29, + OLECMDID_SETFAVICON = 79, + OLECMDID_SETPRINTTEMPLATE = 51, + OLECMDID_SETPROGRESSMAX = 25, + OLECMDID_SETPROGRESSPOS = 26, + OLECMDID_SETPROGRESSTEXT = 27, + OLECMDID_SETTITLE = 28, + OLECMDID_SHOWFIND = 42, + OLECMDID_SHOWMESSAGE = 41, + OLECMDID_SHOWMESSAGE_BLOCKABLE = 84, + OLECMDID_SHOWPAGEACTIONMENU = 59, + OLECMDID_SHOWPAGESETUP = 43, + OLECMDID_SHOWPRINT = 44, + OLECMDID_SHOWSCRIPTERROR = 40, + OLECMDID_SHOWTASKDLG = 68, + OLECMDID_SHOWTASKDLG_BLOCKABLE = 85, + OLECMDID_SPELL = 9, + OLECMDID_STOP = 23, + OLECMDID_STOPDOWNLOAD = 30, + OLECMDID_UNDO = 15, + OLECMDID_UPDATE_CARET = 76, + OLECMDID_UPDATEBACKFORWARDSTATE = 62, + OLECMDID_UPDATECOMMANDS = 21, + OLECMDID_UPDATEPAGESTATUS = 48, + OLECMDID_UPDATETRAVELENTRY = 61, + OLECMDID_UPDATETRAVELENTRY_DATARECOVERY = 67, + OLECMDID_USER_OPTICAL_ZOOM = 73, + OLECMDID_VIEWPORT_MODE = 70, + OLECMDID_VISUAL_VIEWPORT_EXCLUDE_BOTTOM = 72, + OLECMDID_WINDOWSTATECHANGED = 65, + OLECMDID_ZOOM = 19, + } + + // tslint:disable-next-line no-const-enum + const enum RefreshConstants { + Normal = 0, + IfExpired = 1, + Completely = 3 + } + + /** Constants for WebBrowser security icon notification */ + // tslint:disable-next-line no-const-enum + const enum SecureLockIconConstants { + secureLockIconMixed = 1, + secureLockIconSecure128Bit = 6, + secureLockIconSecure40Bit = 3, + secureLockIconSecure56Bit = 4, + secureLockIconSecureFortezza = 5, + secureLockIconSecureUnknownBits = 2, + secureLockIconUnsecure = 0, + } + + /** Options for ShellWindows FindWindow */ + // tslint:disable-next-line no-const-enum + const enum ShellWindowFindWindowOptions { + SWFO_COOKIEPASSED = 4, + SWFO_INCLUDEPENDING = 2, + SWFO_NEEDDISPATCH = 1, + } + + /** Constants for ShellWindows registration */ + // tslint:disable-next-line no-const-enum + const enum ShellWindowTypeConstants { + SWC_3RDPARTY = 2, + SWC_BROWSER = 1, + SWC_CALLBACK = 4, + SWC_DESKTOP = 8, + SWC_EXPLORER = 0, + } + + // tslint:disable-next-line no-const-enum + const enum tagREADYSTATE { + READYSTATE_COMPLETE = 4, + READYSTATE_INTERACTIVE = 3, + READYSTATE_LOADED = 2, + READYSTATE_LOADING = 1, + READYSTATE_UNINITIALIZED = 0, + } + + type TargetFrameValues = '_blank' | '_parent' | '_self' | '_top' ; + + class CScriptErrorList { + private 'SHDocVw.CScriptErrorList_typekey': CScriptErrorList; + private constructor(); + advanceError(): void; + canAdvanceError(): number; + canRetreatError(): number; + getAlwaysShowLockState(): number; + getDetailsPaneOpen(): number; + getErrorChar(): number; + getErrorCode(): number; + getErrorLine(): number; + getErrorMsg(): string; + getErrorUrl(): string; + getPerErrorDisplay(): number; + retreatError(): void; + setDetailsPaneOpen(fDetailsPaneOpen: number): void; + setPerErrorDisplay(fPerErrorDisplay: number): void; + } + + /** Internet Explorer Application. */ + class InternetExplorer { + private 'SHDocVw.InternetExplorer_typekey': InternetExplorer; + private constructor(); + + /** Controls whether address bar is shown */ + AddressBar: boolean; + + /** Returns the application automation object if accessible, this automation object otherwise.. */ + readonly Application: any; + + /** Query to see if something is still in progress. */ + readonly Busy: boolean; + + /** Converts client sizes into window sizes. */ + ClientToWindow(pcx: number, pcy: number): void; + + /** Returns the container/parent automation object, if any. */ + readonly Container: any; + + /** Returns the active Document automation object, if any. */ + readonly Document: any; + + /** IOleCommandTarget::Exec */ + ExecWB(cmdID: OLECMDID, cmdexecopt: OLECMDEXECOPT, pvaIn?: any, pvaOut?: any): void; + + /** Returns file specification of the application, including path. */ + readonly FullName: string; + + /** Maximizes window and turns off statusbar, toolbar, menubar, and titlebar. */ + FullScreen: boolean; + + /** Retrieve the Associated value for the property vtValue in the context of the object. */ + GetProperty(Property: string): any; + + /** Navigates to the previous item in the history list. */ + GoBack(): void; + + /** Navigates to the next item in the history list. */ + GoForward(): void; + + /** Go home/start page. */ + GoHome(): void; + + /** Go Search Page. */ + GoSearch(): void; + + /** The vertical dimension (pixels) of the frame window/object. */ + Height: number; + + /** Returns the HWND of the current IE window. */ + readonly HWND: number; + + /** The horizontal position (pixels) of the frame window relative to the screen/container. */ + Left: number; + + /** Gets the short (UI-friendly) name of the URL/file currently viewed. */ + readonly LocationName: string; + + /** Gets the full URL/path currently viewed. */ + readonly LocationURL: string; + + /** Controls whether menubar is shown. */ + MenuBar: boolean; + + /** Returns name of the application. */ + readonly Name: string; + + /** Navigates to a URL or file. */ + Navigate(URL: string, Flags?: BrowserNavConstants, TargetFrameName?: TargetFrameValues | string, PostData?: any, Headers?: string): void; + + /** Navigates to a URL or file or pidl. */ + Navigate2(URL: any, Flags?: BrowserNavConstants, TargetFrameName?: TargetFrameValues | string, PostData?: any, Headers?: string): void; + + /** Controls if the frame is offline (read from cache) */ + Offline: boolean; + + /** Returns the automation object of the container/parent if one exists or this automation object. */ + readonly Parent: any; + + /** Returns the path to the application. */ + readonly Path: string; + + /** Associates vtValue with the name szProperty in the context of the object. */ + PutProperty(Property: string, vtValue: any): void; + + /** IOleCommandTarget::QueryStatus */ + QueryStatusWB(cmdID: OLECMDID): OLECMDF; + + /** Exits application and closes the open document. */ + Quit(): void; + readonly ReadyState: tagREADYSTATE; + + /** Refresh the currently viewed page. */ + Refresh(): void; + + /** Refresh the currently viewed page. */ + Refresh2(Level?: RefreshConstants): void; + + /** Registers OC as a top-level browser (for target name resolution) */ + RegisterAsBrowser: boolean; + + /** Registers OC as a drop target for navigation */ + RegisterAsDropTarget: boolean; + + /** Controls whether the window is resizable */ + Resizable: boolean; + + /** Set BrowserBar to Clsid */ + ShowBrowserBar(pvaClsid: string | BrowserBarConstants, pvarShow?: boolean): void; + + /** Controls if any dialog boxes can be shown */ + Silent: boolean; + + /** Turn on or off the statusbar. */ + StatusBar: boolean; + + /** Text of Status window. */ + StatusText: string; + + /** Stops opening a file. */ + Stop(): void; + + /** Controls if the browser is in theater mode */ + TheaterMode: boolean; + + /** Controls which toolbar is shown. */ + ToolBar: number; + + /** The vertical position (pixels) of the frame window relative to the screen/container. */ + Top: number; + + /** Returns True if this is the top level object. */ + readonly TopLevelContainer: boolean; + + /** Returns the type of the contained document object. */ + readonly Type: string; + + /** Determines whether the application is visible or hidden. */ + Visible: boolean; + + /** The horizontal dimension (pixels) of the frame window/object. */ + Width: number; + } + + /** Internet Explorer Application with default integrity of Medium */ + class InternetExplorerMedium { + private 'SHDocVw.InternetExplorerMedium_typekey': InternetExplorerMedium; + private constructor(); + + /** Controls whether address bar is shown */ + AddressBar: boolean; + + /** Returns the application automation object if accessible, this automation object otherwise.. */ + readonly Application: any; + + /** Query to see if something is still in progress. */ + readonly Busy: boolean; + + /** Converts client sizes into window sizes. */ + ClientToWindow(pcx: number, pcy: number): void; + + /** Returns the container/parent automation object, if any. */ + readonly Container: any; + + /** Returns the active Document automation object, if any. */ + readonly Document: any; + + /** IOleCommandTarget::Exec */ + ExecWB(cmdID: OLECMDID, cmdexecopt: OLECMDEXECOPT, pvaIn?: any, pvaOut?: any): void; + + /** Returns file specification of the application, including path. */ + readonly FullName: string; + + /** Maximizes window and turns off statusbar, toolbar, menubar, and titlebar. */ + FullScreen: boolean; + + /** Retrieve the Associated value for the property vtValue in the context of the object. */ + GetProperty(Property: string): any; + + /** Navigates to the previous item in the history list. */ + GoBack(): void; + + /** Navigates to the next item in the history list. */ + GoForward(): void; + + /** Go home/start page. */ + GoHome(): void; + + /** Go Search Page. */ + GoSearch(): void; + + /** The vertical dimension (pixels) of the frame window/object. */ + Height: number; + + /** Returns the HWND of the current IE window. */ + readonly HWND: number; + + /** The horizontal position (pixels) of the frame window relative to the screen/container. */ + Left: number; + + /** Gets the short (UI-friendly) name of the URL/file currently viewed. */ + readonly LocationName: string; + + /** Gets the full URL/path currently viewed. */ + readonly LocationURL: string; + + /** Controls whether menubar is shown. */ + MenuBar: boolean; + + /** Returns name of the application. */ + readonly Name: string; + + /** Navigates to a URL or file. */ + Navigate(URL: string, Flags?: BrowserNavConstants, TargetFrameName?: TargetFrameValues | string, PostData?: any, Headers?: string): void; + + /** Navigates to a URL or file or pidl. */ + Navigate2(URL: any, Flags?: BrowserNavConstants, TargetFrameName?: TargetFrameValues | string, PostData?: any, Headers?: string): void; + + /** Controls if the frame is offline (read from cache) */ + Offline: boolean; + + /** Returns the automation object of the container/parent if one exists or this automation object. */ + readonly Parent: any; + + /** Returns the path to the application. */ + readonly Path: string; + + /** Associates vtValue with the name szProperty in the context of the object. */ + PutProperty(Property: string, vtValue: any): void; + + /** IOleCommandTarget::QueryStatus */ + QueryStatusWB(cmdID: OLECMDID): OLECMDF; + + /** Exits application and closes the open document. */ + Quit(): void; + readonly ReadyState: tagREADYSTATE; + + /** Refresh the currently viewed page. */ + Refresh(): void; + + /** Refresh the currently viewed page. */ + Refresh2(Level?: RefreshConstants): void; + + /** Registers OC as a top-level browser (for target name resolution) */ + RegisterAsBrowser: boolean; + + /** Registers OC as a drop target for navigation */ + RegisterAsDropTarget: boolean; + + /** Controls whether the window is resizable */ + Resizable: boolean; + + /** Set BrowserBar to Clsid */ + ShowBrowserBar(pvaClsid: string | BrowserBarConstants, pvarShow?: boolean): void; + + /** Controls if any dialog boxes can be shown */ + Silent: boolean; + + /** Turn on or off the statusbar. */ + StatusBar: boolean; + + /** Text of Status window. */ + StatusText: string; + + /** Stops opening a file. */ + Stop(): void; + + /** Controls if the browser is in theater mode */ + TheaterMode: boolean; + + /** Controls which toolbar is shown. */ + ToolBar: number; + + /** The vertical position (pixels) of the frame window relative to the screen/container. */ + Top: number; + + /** Returns True if this is the top level object. */ + readonly TopLevelContainer: boolean; + + /** Returns the type of the contained document object. */ + readonly Type: string; + + /** Determines whether the application is visible or hidden. */ + Visible: boolean; + + /** The horizontal dimension (pixels) of the frame window/object. */ + Width: number; + } + + /** Shell Browser Window. */ + class ShellBrowserWindow { + private 'SHDocVw.ShellBrowserWindow_typekey': ShellBrowserWindow; + private constructor(); + + /** Controls whether address bar is shown */ + AddressBar: boolean; + + /** Returns the application automation object if accessible, this automation object otherwise.. */ + readonly Application: any; + + /** Query to see if something is still in progress. */ + readonly Busy: boolean; + + /** Converts client sizes into window sizes. */ + ClientToWindow(pcx: number, pcy: number): void; + + /** Returns the container/parent automation object, if any. */ + readonly Container: any; + + /** Returns the active Document automation object, if any. */ + readonly Document: any; + + /** IOleCommandTarget::Exec */ + ExecWB(cmdID: OLECMDID, cmdexecopt: OLECMDEXECOPT, pvaIn?: any, pvaOut?: any): void; + + /** Returns file specification of the application, including path. */ + readonly FullName: string; + + /** Maximizes window and turns off statusbar, toolbar, menubar, and titlebar. */ + FullScreen: boolean; + + /** Retrieve the Associated value for the property vtValue in the context of the object. */ + GetProperty(Property: string): any; + + /** Navigates to the previous item in the history list. */ + GoBack(): void; + + /** Navigates to the next item in the history list. */ + GoForward(): void; + + /** Go home/start page. */ + GoHome(): void; + + /** Go Search Page. */ + GoSearch(): void; + + /** The vertical dimension (pixels) of the frame window/object. */ + Height: number; + + /** Returns the HWND of the current IE window. */ + readonly HWND: number; + + /** The horizontal position (pixels) of the frame window relative to the screen/container. */ + Left: number; + + /** Gets the short (UI-friendly) name of the URL/file currently viewed. */ + readonly LocationName: string; + + /** Gets the full URL/path currently viewed. */ + readonly LocationURL: string; + + /** Controls whether menubar is shown. */ + MenuBar: boolean; + + /** Returns name of the application. */ + readonly Name: string; + + /** Navigates to a URL or file. */ + Navigate(URL: string, Flags?: BrowserNavConstants, TargetFrameName?: TargetFrameValues | string, PostData?: any, Headers?: string): void; + + /** Navigates to a URL or file or pidl. */ + Navigate2(URL: any, Flags?: BrowserNavConstants, TargetFrameName?: TargetFrameValues | string, PostData?: any, Headers?: string): void; + + /** Controls if the frame is offline (read from cache) */ + Offline: boolean; + + /** Returns the automation object of the container/parent if one exists or this automation object. */ + readonly Parent: any; + + /** Returns the path to the application. */ + readonly Path: string; + + /** Associates vtValue with the name szProperty in the context of the object. */ + PutProperty(Property: string, vtValue: any): void; + + /** IOleCommandTarget::QueryStatus */ + QueryStatusWB(cmdID: OLECMDID): OLECMDF; + + /** Exits application and closes the open document. */ + Quit(): void; + readonly ReadyState: tagREADYSTATE; + + /** Refresh the currently viewed page. */ + Refresh(): void; + + /** Refresh the currently viewed page. */ + Refresh2(Level?: RefreshConstants): void; + + /** Registers OC as a top-level browser (for target name resolution) */ + RegisterAsBrowser: boolean; + + /** Registers OC as a drop target for navigation */ + RegisterAsDropTarget: boolean; + + /** Controls whether the window is resizable */ + Resizable: boolean; + + /** Set BrowserBar to Clsid */ + ShowBrowserBar(pvaClsid: string | BrowserBarConstants, pvarShow?: boolean): void; + + /** Controls if any dialog boxes can be shown */ + Silent: boolean; + + /** Turn on or off the statusbar. */ + StatusBar: boolean; + + /** Text of Status window. */ + StatusText: string; + + /** Stops opening a file. */ + Stop(): void; + + /** Controls if the browser is in theater mode */ + TheaterMode: boolean; + + /** Controls which toolbar is shown. */ + ToolBar: number; + + /** The vertical position (pixels) of the frame window relative to the screen/container. */ + Top: number; + + /** Returns True if this is the top level object. */ + readonly TopLevelContainer: boolean; + + /** Returns the type of the contained document object. */ + readonly Type: string; + + /** Determines whether the application is visible or hidden. */ + Visible: boolean; + + /** The horizontal dimension (pixels) of the frame window/object. */ + Width: number; + } + + class ShellNameSpace { + private 'SHDocVw.ShellNameSpace_typekey': ShellNameSpace; + private constructor(); + Columns: string; + + /** number of view types */ + readonly CountViewTypes: number; + + /** method CreateSubscriptionForSelection */ + CreateSubscriptionForSelection(): boolean; + + /** method DeleteSubscriptionForSelection */ + DeleteSubscriptionForSelection(): boolean; + Depth: number; + + /** options */ + EnumOptions: number; + + /** expands item specified depth */ + Expand(var_0: any, iDepth: number): void; + + /** method Export */ + Export(): void; + Flags: number; + + /** method Import */ + Import(): void; + + /** method InvokeContextMenuCommand */ + InvokeContextMenuCommand(strCommand: string): void; + Mode: number; + + /** method MoveSelectionDown */ + MoveSelectionDown(): void; + + /** method MoveSelectionTo */ + MoveSelectionTo(): void; + + /** method MoveSelectionUp */ + MoveSelectionUp(): void; + + /** method NewFolder */ + NewFolder(): void; + + /** method ResetSort */ + ResetSort(): void; + + /** get the root item */ + Root: any; + + /** get the selected item */ + SelectedItem: any; + + /** collection of selected items */ + SelectedItems(): any; + + /** old, use put_Root() instead */ + SetRoot(bstrFullPath: string): void; + + /** set view type */ + SetViewType(iType: number): void; + + /** Query to see if subscriptions are enabled */ + readonly SubscriptionsEnabled: boolean; + + /** method Synchronize */ + Synchronize(): void; + TVFlags: number; + + /** unselects all items */ + UnselectAll(): void; + } + + class ShellUIHelper { + private 'SHDocVw.ShellUIHelper_typekey': ShellUIHelper; + private constructor(); + AddChannel(URL: string): void; + AddDesktopComponent(URL: string, Type: string, Left?: any, Top?: any, Width?: any, Height?: any): void; + AddFavorite(URL: string, Title?: any): void; + AddSearchProvider(URL: string): void; + AddService(URL: string): void; + AddToFavoritesBar(URL: string, Title: string, Type?: any): void; + AutoCompleteAttach(Reserved?: any): void; + AutoCompleteSaveForm(Form?: any): void; + AutoScan(strSearch: string, strFailureUrl: string, pvarTargetFrame?: any): void; + BrandImageUri(): string; + BuildNewTabPage(): void; + ContentDiscoveryReset(): void; + CustomizeClearType(fSet: boolean): void; + CustomizeSettings(fSQM: boolean, fPhishing: boolean, bstrLocale: string): void; + DefaultSearchProvider(): string; + DiagnoseConnection(): void; + EnableSuggestedSites(fEnable: boolean): void; + GetCVListData(): string; + GetCVListLocalData(): string; + GetEMIEListData(): string; + GetEMIEListLocalData(): string; + GetExperimentalFlag(bstrFlagString: string): boolean; + GetExperimentalValue(bstrValueString: string): number; + GetNeedIEAutoLaunchFlag(bstrUrl: string): boolean; + HasNeedIEAutoLaunchFlag(bstrUrl: string): boolean; + ImportExportFavorites(fImport: boolean, strImpExpPath: string): void; + InPrivateFilteringEnabled(): boolean; + IsSearchMigrated(): boolean; + IsSearchProviderInstalled(URL: string): number; + IsServiceInstalled(URL: string, Verb: string): number; + IsSubscribed(URL: string): boolean; + IsSuggestedSitesEnabled(): boolean; + LaunchIE(bstrUrl: string, automated: boolean): void; + LaunchInHVSI(bstrUrl: string): void; + msActiveXFilteringEnabled(): boolean; + msAddSiteMode(): void; + msAddTrackingProtectionList(URL: string, bstrFilterName: string): void; + msChangeDefaultBrowser(fChange: boolean): void; + msClearTile(): void; + msDiagnoseConnectionUILess(): void; + msEnableTileNotificationQueue(fChange: boolean): void; + msEnableTileNotificationQueueForSquare150x150(fChange: boolean): void; + msEnableTileNotificationQueueForSquare310x310(fChange: boolean): void; + msEnableTileNotificationQueueForWide310x150(fChange: boolean): void; + msIsSiteMode(): boolean; + msIsSiteModeFirstRun(fPreserveState: boolean): any; + msLaunchInternetOptions(): void; + msLaunchNetworkClientHelp(): void; + msPinnedSiteState(): any; + msProvisionNetworks(bstrProvisioningXml: string): any; + msRemoveScheduledTileNotification(bstrNotificationId: string): void; + msReportSafeUrl(): void; + msScheduledTileNotification(bstrNotificationXml: string, bstrNotificationId: string, bstrNotificationTag: string, startTime?: any, expirationTime?: any): void; + msSiteModeActivate(): void; + msSiteModeAddButtonStyle(uiButtonID: any, bstrIconURL: string, bstrTooltip: string): any; + msSiteModeAddJumpListItem(bstrName: string, bstrActionUri: string, bstrIconUri: string, pvarWindowType?: any): void; + msSiteModeAddThumbBarButton(bstrIconURL: string, bstrTooltip: string): any; + msSiteModeClearBadge(): void; + msSiteModeClearIconOverlay(): void; + msSiteModeClearJumpList(): void; + msSiteModeCreateJumpList(bstrHeader: string): void; + msSiteModeRefreshBadge(): void; + msSiteModeSetIconOverlay(IconUrl: string, pvarDescription?: any): void; + msSiteModeShowButtonStyle(uiButtonID: any, uiStyleID: any): void; + msSiteModeShowJumpList(): void; + msSiteModeShowThumbBar(): void; + msSiteModeUpdateThumbBarButton(ButtonID: any, fEnabled: boolean, fVisible: boolean): void; + msStartPeriodicBadgeUpdate(pollingUri: string, startTime?: any, uiUpdateRecurrence?: any): void; + msStartPeriodicTileUpdate(pollingUris: any, startTime?: any, uiUpdateRecurrence?: any): void; + msStartPeriodicTileUpdateBatch(pollingUris: any, startTime?: any, uiUpdateRecurrence?: any): void; + msStopPeriodicBadgeUpdate(): void; + msStopPeriodicTileUpdate(): void; + msTrackingProtectionEnabled(): boolean; + NavigateAndFind(URL: string, strQuery: string, varTargetFrame: any): void; + NavigateToSuggestedSites(bstrRelativeUrl: string): void; + OpenFavoritesPane(): void; + OpenFavoritesSettings(): void; + PhishingEnabled(): boolean; + RefreshOfflineDesktop(): void; + ResetAllExperimentalFlagsAndValues(): void; + ResetFirstBootMode(): void; + ResetSafeMode(): void; + RunOnceHasShown(): boolean; + RunOnceRequiredSettingsComplete(fComplete: boolean): void; + RunOnceShown(): void; + SearchGuideUrl(): string; + SetActivitiesVisible(fVisible: boolean): void; + SetExperimentalFlag(bstrFlagString: string, vfFlag: boolean): void; + SetExperimentalValue(bstrValueString: string, dwValue: number): void; + SetNeedIEAutoLaunchFlag(bstrUrl: string, flag: boolean): void; + SetRecentlyClosedVisible(fVisible: boolean): void; + ShowBrowserUI(bstrName: string, pvarIn: any): any; + ShowInPrivateHelp(): void; + ShowTabsHelp(): void; + SkipRunOnce(): void; + SkipTabsWelcome(): void; + SqmEnabled(): boolean; + } + + /** ShellDispatch Load in Shell Context */ + class ShellWindows { + private 'SHDocVw.ShellWindows_typekey': ShellWindows; + private constructor(); + + /** Get count of open Shell windows */ + readonly Count: number; + + /** Find the window based on the location */ + FindWindowSW(pvarloc: any, pvarlocRoot: any, swClass: number, pHWND: number, swfwOptions: number): any; + + /** Return the shell window for the given index */ + Item(index?: any): any; + + /** Notifies the activation */ + OnActivated(lCookie: number, fActive: boolean): void; + + /** Notifies on creation and frame name set */ + OnCreated(lCookie: number, punk: any): void; + + /** Notifies the new location */ + OnNavigate(lCookie: number, pvarloc: any): void; + + /** Used by IExplore to register different processes */ + ProcessAttachDetach(fAttach: boolean): void; + + /** Register a window with the list */ + Register(pid: any, HWND: number, swClass: number, plCookie: number): void; + + /** Register a pending open with the list */ + RegisterPending(lThreadId: number, pvarloc: any, pvarlocRoot: any, swClass: number, plCookie: number): void; + + /** Remove a window from the list */ + Revoke(lCookie: number): void; + } + + /** WebBrowser Control */ + class WebBrowser { + private 'SHDocVw.WebBrowser_typekey': WebBrowser; + private constructor(); + + /** Controls whether address bar is shown (ignored by WebBrowser) */ + AddressBar: boolean; + + /** Returns the application automation object if accessible, this automation object otherwise.. */ + readonly Application: any; + + /** Query to see if something is still in progress. */ + readonly Busy: boolean; + + /** Converts client sizes into window sizes. */ + ClientToWindow(pcx: number, pcy: number): void; + + /** Returns the container/parent automation object, if any. */ + readonly Container: any; + + /** Returns the active Document automation object, if any. */ + readonly Document: any; + + /** IOleCommandTarget::Exec */ + ExecWB(cmdID: OLECMDID, cmdexecopt: OLECMDEXECOPT, pvaIn?: any, pvaOut?: any): void; + + /** Returns file specification of the application, including path. */ + readonly FullName: string; + + /** Maximizes window and turns off statusbar, toolbar, menubar, and titlebar. */ + FullScreen: boolean; + + /** Retrieve the Associated value for the property vtValue in the context of the object. */ + GetProperty(Property: string): any; + + /** Navigates to the previous item in the history list. */ + GoBack(): void; + + /** Navigates to the next item in the history list. */ + GoForward(): void; + + /** Go home/start page. */ + GoHome(): void; + + /** Go Search Page. */ + GoSearch(): void; + + /** The vertical dimension (pixels) of the frame window/object. */ + Height: number; + + /** Returns the HWND of the current IE window. */ + readonly HWND: number; + + /** The horizontal position (pixels) of the frame window relative to the screen/container. */ + Left: number; + + /** Gets the short (UI-friendly) name of the URL/file currently viewed. */ + readonly LocationName: string; + + /** Gets the full URL/path currently viewed. */ + readonly LocationURL: string; + + /** Controls whether menubar is shown. */ + MenuBar: boolean; + + /** Returns name of the application. */ + readonly Name: string; + + /** Navigates to a URL or file. */ + Navigate(URL: string, Flags?: BrowserNavConstants, TargetFrameName?: TargetFrameValues | string, PostData?: any, Headers?: string): void; + + /** Navigates to a URL or file or pidl. */ + Navigate2(URL: any, Flags?: BrowserNavConstants, TargetFrameName?: TargetFrameValues | string, PostData?: any, Headers?: string): void; + + /** Controls if the frame is offline (read from cache) */ + Offline: boolean; + + /** Returns the automation object of the container/parent if one exists or this automation object. */ + readonly Parent: any; + + /** Returns the path to the application. */ + readonly Path: string; + + /** Associates vtValue with the name szProperty in the context of the object. */ + PutProperty(Property: string, vtValue: any): void; + + /** IOleCommandTarget::QueryStatus */ + QueryStatusWB(cmdID: OLECMDID): OLECMDF; + + /** Exits application and closes the open document. */ + Quit(): void; + readonly ReadyState: tagREADYSTATE; + + /** Refresh the currently viewed page. */ + Refresh(): void; + + /** Refresh the currently viewed page. */ + Refresh2(Level?: RefreshConstants): void; + + /** Registers OC as a top-level browser (for target name resolution) */ + RegisterAsBrowser: boolean; + + /** Registers OC as a drop target for navigation */ + RegisterAsDropTarget: boolean; + + /** Controls whether the window is resizable */ + Resizable: boolean; + + /** Set BrowserBar to Clsid */ + ShowBrowserBar(pvaClsid: string | BrowserBarConstants, pvarShow?: boolean): void; + + /** Controls if any dialog boxes can be shown */ + Silent: boolean; + + /** Turn on or off the statusbar. */ + StatusBar: boolean; + + /** Text of Status window. */ + StatusText: string; + + /** Stops opening a file. */ + Stop(): void; + + /** Controls if the browser is in theater mode */ + TheaterMode: boolean; + + /** Controls which toolbar is shown. */ + ToolBar: number; + + /** The vertical position (pixels) of the frame window relative to the screen/container. */ + Top: number; + + /** Returns True if this is the top level object. */ + readonly TopLevelContainer: boolean; + + /** Returns the type of the contained document object. */ + readonly Type: string; + + /** Determines whether the application is visible or hidden. */ + Visible: boolean; + + /** The horizontal dimension (pixels) of the frame window/object. */ + Width: number; + } + + /** WebBrowser Control */ + class WebBrowser_V1 { + private 'SHDocVw.WebBrowser_V1_typekey': WebBrowser_V1; + private constructor(); + + /** Returns the application automation object if accessible, this automation object otherwise.. */ + readonly Application: any; + + /** Query to see if something is still in progress. */ + readonly Busy: boolean; + + /** Returns the container/parent automation object, if any. */ + readonly Container: any; + + /** Returns the active Document automation object, if any. */ + readonly Document: any; + + /** Navigates to the previous item in the history list. */ + GoBack(): void; + + /** Navigates to the next item in the history list. */ + GoForward(): void; + + /** Go home/start page. */ + GoHome(): void; + + /** Go Search Page. */ + GoSearch(): void; + + /** The vertical dimension (pixels) of the frame window/object. */ + Height: number; + + /** The horizontal position (pixels) of the frame window relative to the screen/container. */ + Left: number; + + /** Gets the short (UI-friendly) name of the URL/file currently viewed. */ + readonly LocationName: string; + + /** Gets the full URL/path currently viewed. */ + readonly LocationURL: string; + + /** Navigates to a URL or file. */ + Navigate(URL: string, Flags?: BrowserNavConstants, TargetFrameName?: TargetFrameValues | string, PostData?: any, Headers?: string): void; + + /** Returns the automation object of the container/parent if one exists or this automation object. */ + readonly Parent: any; + + /** Refresh the currently viewed page. */ + Refresh(): void; + + /** Refresh the currently viewed page. */ + Refresh2(Level?: RefreshConstants): void; + + /** Stops opening a file. */ + Stop(): void; + + /** The vertical position (pixels) of the frame window relative to the screen/container. */ + Top: number; + + /** Returns True if this is the top level object. */ + readonly TopLevelContainer: boolean; + + /** Returns the type of the contained document object. */ + readonly Type: string; + + /** The horizontal dimension (pixels) of the frame window/object. */ + Width: number; + } + + namespace EventHelperTypes { + type InternetExplorer_BeforeNavigate2_ArgNames = ['pDisp', 'URL', 'Flags', 'TargetFrameName', 'PostData', 'Headers', 'Cancel']; + + type InternetExplorerMedium_BeforeNavigate2_ArgNames = ['pDisp', 'URL', 'Flags', 'TargetFrameName', 'PostData', 'Headers', 'Cancel']; + + type ShellBrowserWindow_BeforeNavigate2_ArgNames = ['pDisp', 'URL', 'Flags', 'TargetFrameName', 'PostData', 'Headers', 'Cancel']; + + type ShellNameSpace_FavoritesSelectionChange_ArgNames = ['cItems', 'hItem', 'strName', 'strUrl', 'cVisits', 'strDate', 'fAvailableOffline']; + + type WebBrowser_BeforeNavigate2_ArgNames = ['pDisp', 'URL', 'Flags', 'TargetFrameName', 'PostData', 'Headers', 'Cancel']; + + type WebBrowser_V1_BeforeNavigate_ArgNames = ['URL', 'Flags', 'TargetFrameName', 'PostData', 'Headers', 'Cancel']; + + type WebBrowser_V1_FrameBeforeNavigate_ArgNames = ['URL', 'Flags', 'TargetFrameName', 'PostData', 'Headers', 'Cancel']; + + type WebBrowser_V1_FrameNewWindow_ArgNames = ['URL', 'Flags', 'TargetFrameName', 'PostData', 'Headers', 'Processed']; + + type WebBrowser_V1_NewWindow_ArgNames = ['URL', 'Flags', 'TargetFrameName', 'PostData', 'Headers', 'Processed']; + + interface InternetExplorer_BeforeNavigate2_Parameter { + Cancel: boolean; + readonly Flags: any; + readonly Headers: any; + readonly pDisp: any; + readonly PostData: any; + readonly TargetFrameName: any; + readonly URL: any; + } + + interface InternetExplorerMedium_BeforeNavigate2_Parameter { + Cancel: boolean; + readonly Flags: any; + readonly Headers: any; + readonly pDisp: any; + readonly PostData: any; + readonly TargetFrameName: any; + readonly URL: any; + } + + interface ShellBrowserWindow_BeforeNavigate2_Parameter { + Cancel: boolean; + readonly Flags: any; + readonly Headers: any; + readonly pDisp: any; + readonly PostData: any; + readonly TargetFrameName: any; + readonly URL: any; + } + + interface ShellNameSpace_FavoritesSelectionChange_Parameter { + readonly cItems: number; + readonly cVisits: number; + readonly fAvailableOffline: number; + readonly hItem: number; + readonly strDate: string; + readonly strName: string; + readonly strUrl: string; + } + + interface WebBrowser_BeforeNavigate2_Parameter { + Cancel: boolean; + readonly Flags: any; + readonly Headers: any; + readonly pDisp: any; + readonly PostData: any; + readonly TargetFrameName: any; + readonly URL: any; + } + + interface WebBrowser_V1_BeforeNavigate_Parameter { + Cancel: boolean; + readonly Flags: number; + readonly Headers: string; + readonly PostData: any; + readonly TargetFrameName: string; + readonly URL: string; + } + + interface WebBrowser_V1_FrameBeforeNavigate_Parameter { + Cancel: boolean; + readonly Flags: number; + readonly Headers: string; + readonly PostData: any; + readonly TargetFrameName: string; + readonly URL: string; + } + + interface WebBrowser_V1_FrameNewWindow_Parameter { + readonly Flags: number; + readonly Headers: string; + readonly PostData: any; + Processed: boolean; + readonly TargetFrameName: string; + readonly URL: string; + } + + interface WebBrowser_V1_NewWindow_Parameter { + readonly Flags: number; + readonly Headers: string; + readonly PostData: any; + Processed: boolean; + readonly TargetFrameName: string; + readonly URL: string; + } + } +} + +interface ActiveXObject { + on( + obj: SHDocVw.InternetExplorer, event: 'BeforeNavigate2', argNames: SHDocVw.EventHelperTypes.InternetExplorer_BeforeNavigate2_ArgNames, + handler: (this: SHDocVw.InternetExplorer, parameter: SHDocVw.EventHelperTypes.InternetExplorer_BeforeNavigate2_Parameter) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'BeforeScriptExecute', argNames: ['pDispWindow'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly pDispWindow: any }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'ClientToHostWindow', argNames: ['CX', 'CY'], handler: (this: SHDocVw.InternetExplorer, parameter: { CX: number, CY: number }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'CommandStateChange', argNames: ['Command', 'Enable'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly Command: number, readonly Enable: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'DocumentComplete' | 'NavigateComplete2', argNames: ['pDisp', 'URL'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly pDisp: any, readonly URL: any }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'FileDownload', argNames: ['ActiveDocument', 'Cancel'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly ActiveDocument: boolean, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'NavigateError', argNames: ['pDisp', 'URL', 'Frame', 'StatusCode', 'Cancel'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly pDisp: any, readonly URL: any, readonly Frame: any, readonly StatusCode: any, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'NewProcess', argNames: ['lCauseFlag', 'pWB2', 'Cancel'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly lCauseFlag: number, readonly pWB2: any, Cancel: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'NewWindow2', argNames: ['ppDisp', 'Cancel'], handler: (this: SHDocVw.InternetExplorer, parameter: { ppDisp: any, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'NewWindow3', argNames: ['ppDisp', 'Cancel', 'dwFlags', 'bstrUrlContext', 'bstrUrl'], + handler: (this: SHDocVw.InternetExplorer, parameter: { ppDisp: any, Cancel: boolean, readonly dwFlags: number, readonly bstrUrlContext: string, readonly bstrUrl: string }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'OnFullScreen', argNames: ['FullScreen'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly FullScreen: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'OnMenuBar', argNames: ['MenuBar'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly MenuBar: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'OnStatusBar', argNames: ['StatusBar'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly StatusBar: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'OnTheaterMode', argNames: ['TheaterMode'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly TheaterMode: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'OnToolBar', argNames: ['ToolBar'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly ToolBar: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'OnVisible', argNames: ['Visible'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly Visible: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'PrintTemplateInstantiation' | 'PrintTemplateTeardown', argNames: ['pDisp'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly pDisp: any }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'PrivacyImpactedStateChange', argNames: ['bImpacted'], handler: (this: SHDocVw.InternetExplorer, + parameter: { readonly bImpacted: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'ProgressChange', argNames: ['Progress', 'ProgressMax'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly Progress: number, readonly ProgressMax: number }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'PropertyChange', argNames: ['szProperty'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly szProperty: string }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'RedirectXDomainBlocked', argNames: ['pDisp', 'StartURL', 'RedirectURL', 'Frame', 'StatusCode'], + handler: (this: SHDocVw.InternetExplorer, parameter: { readonly pDisp: any, readonly StartURL: any, readonly RedirectURL: any, readonly Frame: any, readonly StatusCode: any }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'SetPhishingFilterStatus', argNames: ['PhishingFilterStatus'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly PhishingFilterStatus: number }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'SetSecureLockIcon', argNames: ['SecureLockIcon'], handler: (this: SHDocVw.InternetExplorer, + parameter: { readonly SecureLockIcon: number }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'StatusTextChange' | 'TitleChange', argNames: ['Text'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly Text: string }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'ThirdPartyUrlBlocked', argNames: ['URL', 'dwCount'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly URL: any, readonly dwCount: number }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'UpdatePageStatus', argNames: ['pDisp', 'nPage', 'fDone'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly pDisp: any, readonly nPage: any, readonly fDone: any }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'WebWorkerFinsihed', argNames: ['dwUniqueID'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly dwUniqueID: number }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'WebWorkerStarted', argNames: ['dwUniqueID', 'bstrWorkerLabel'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly dwUniqueID: number, readonly bstrWorkerLabel: string }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'WindowClosing', argNames: ['IsChildWindow', 'Cancel'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly IsChildWindow: boolean, Cancel: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'WindowSetHeight', argNames: ['Height'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly Height: number }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'WindowSetLeft', argNames: ['Left'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly Left: number }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'WindowSetResizable', argNames: ['Resizable'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly Resizable: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'WindowSetTop', argNames: ['Top'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly Top: number }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'WindowSetWidth', argNames: ['Width'], handler: (this: SHDocVw.InternetExplorer, parameter: { readonly Width: number }) => void): void; + on( + obj: SHDocVw.InternetExplorer, event: 'WindowStateChanged', argNames: ['dwWindowStateFlags', 'dwValidFlagsMask'], handler: ( + this: SHDocVw.InternetExplorer, parameter: { readonly dwWindowStateFlags: number, readonly dwValidFlagsMask: number }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'BeforeNavigate2', argNames: SHDocVw.EventHelperTypes.InternetExplorerMedium_BeforeNavigate2_ArgNames, + handler: (this: SHDocVw.InternetExplorerMedium, parameter: SHDocVw.EventHelperTypes.InternetExplorerMedium_BeforeNavigate2_Parameter) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'BeforeScriptExecute', argNames: ['pDispWindow'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly pDispWindow: any }) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'ClientToHostWindow', argNames: ['CX', 'CY'], handler: (this: SHDocVw.InternetExplorerMedium, parameter: { CX: number, CY: number }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'CommandStateChange', argNames: ['Command', 'Enable'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly Command: number, readonly Enable: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'DocumentComplete' | 'NavigateComplete2', argNames: ['pDisp', 'URL'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly pDisp: any, readonly URL: any }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'FileDownload', argNames: ['ActiveDocument', 'Cancel'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly ActiveDocument: boolean, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'NavigateError', argNames: ['pDisp', 'URL', 'Frame', 'StatusCode', 'Cancel'], + handler: (this: SHDocVw.InternetExplorerMedium, parameter: { readonly pDisp: any, readonly URL: any, readonly Frame: any, readonly StatusCode: any, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'NewProcess', argNames: ['lCauseFlag', 'pWB2', 'Cancel'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly lCauseFlag: number, readonly pWB2: any, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'NewWindow2', argNames: ['ppDisp', 'Cancel'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { ppDisp: any, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'NewWindow3', argNames: ['ppDisp', 'Cancel', 'dwFlags', 'bstrUrlContext', 'bstrUrl'], + handler: (this: SHDocVw.InternetExplorerMedium, parameter: { + ppDisp: any, Cancel: boolean, readonly dwFlags: number, readonly bstrUrlContext: string, + readonly bstrUrl: string + }) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'OnFullScreen', argNames: ['FullScreen'], handler: (this: SHDocVw.InternetExplorerMedium, + parameter: { readonly FullScreen: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'OnMenuBar', argNames: ['MenuBar'], handler: (this: SHDocVw.InternetExplorerMedium, parameter: { readonly MenuBar: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'OnStatusBar', argNames: ['StatusBar'], handler: (this: SHDocVw.InternetExplorerMedium, parameter: { readonly StatusBar: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'OnTheaterMode', argNames: ['TheaterMode'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly TheaterMode: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'OnToolBar', argNames: ['ToolBar'], handler: (this: SHDocVw.InternetExplorerMedium, parameter: { readonly ToolBar: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'OnVisible', argNames: ['Visible'], handler: (this: SHDocVw.InternetExplorerMedium, parameter: { readonly Visible: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'PrintTemplateInstantiation' | 'PrintTemplateTeardown', argNames: ['pDisp'], + handler: (this: SHDocVw.InternetExplorerMedium, parameter: { readonly pDisp: any }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'PrivacyImpactedStateChange', argNames: ['bImpacted'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly bImpacted: boolean }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'ProgressChange', argNames: ['Progress', 'ProgressMax'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly Progress: number, readonly ProgressMax: number }) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'PropertyChange', argNames: ['szProperty'], handler: (this: SHDocVw.InternetExplorerMedium, + parameter: { readonly szProperty: string }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'RedirectXDomainBlocked', argNames: ['pDisp', 'StartURL', 'RedirectURL', 'Frame', 'StatusCode'], + handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly pDisp: any, readonly StartURL: any, readonly RedirectURL: any, readonly Frame: any, readonly StatusCode: any }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'SetPhishingFilterStatus', argNames: ['PhishingFilterStatus'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly PhishingFilterStatus: number }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'SetSecureLockIcon', argNames: ['SecureLockIcon'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly SecureLockIcon: number }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'StatusTextChange' | 'TitleChange', argNames: ['Text'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly Text: string }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'ThirdPartyUrlBlocked', argNames: ['URL', 'dwCount'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly URL: any, readonly dwCount: number }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'UpdatePageStatus', argNames: ['pDisp', 'nPage', 'fDone'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly pDisp: any, readonly nPage: any, readonly fDone: any }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'WebWorkerFinsihed', argNames: ['dwUniqueID'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly dwUniqueID: number }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'WebWorkerStarted', argNames: ['dwUniqueID', 'bstrWorkerLabel'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly dwUniqueID: number, readonly bstrWorkerLabel: string }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'WindowClosing', argNames: ['IsChildWindow', 'Cancel'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly IsChildWindow: boolean, Cancel: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'WindowSetHeight', argNames: ['Height'], handler: (this: SHDocVw.InternetExplorerMedium, parameter: { readonly Height: number }) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'WindowSetLeft', argNames: ['Left'], handler: (this: SHDocVw.InternetExplorerMedium, parameter: { readonly Left: number }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'WindowSetResizable', argNames: ['Resizable'], handler: ( + this: SHDocVw.InternetExplorerMedium, parameter: { readonly Resizable: boolean }) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'WindowSetTop', argNames: ['Top'], handler: (this: SHDocVw.InternetExplorerMedium, parameter: { readonly Top: number }) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'WindowSetWidth', argNames: ['Width'], handler: (this: SHDocVw.InternetExplorerMedium, parameter: { readonly Width: number }) => void): void; + on( + obj: SHDocVw.InternetExplorerMedium, event: 'WindowStateChanged', argNames: ['dwWindowStateFlags', 'dwValidFlagsMask'], + handler: (this: SHDocVw.InternetExplorerMedium, parameter: { readonly dwWindowStateFlags: number, readonly dwValidFlagsMask: number }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'BeforeNavigate2', argNames: SHDocVw.EventHelperTypes.ShellBrowserWindow_BeforeNavigate2_ArgNames, + handler: (this: SHDocVw.ShellBrowserWindow, parameter: SHDocVw.EventHelperTypes.ShellBrowserWindow_BeforeNavigate2_Parameter) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'BeforeScriptExecute', argNames: ['pDispWindow'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly pDispWindow: any }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'ClientToHostWindow', argNames: ['CX', 'CY'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { CX: number, CY: number }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'CommandStateChange', argNames: ['Command', 'Enable'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly Command: number, readonly Enable: boolean }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'DocumentComplete' | 'NavigateComplete2', argNames: ['pDisp', 'URL'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly pDisp: any, readonly URL: any }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'FileDownload', argNames: ['ActiveDocument', 'Cancel'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly ActiveDocument: boolean, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'NavigateError', argNames: ['pDisp', 'URL', 'Frame', 'StatusCode', 'Cancel'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly pDisp: any, readonly URL: any, readonly Frame: any, readonly StatusCode: any, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'NewProcess', argNames: ['lCauseFlag', 'pWB2', 'Cancel'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly lCauseFlag: number, readonly pWB2: any, Cancel: boolean }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'NewWindow2', argNames: ['ppDisp', 'Cancel'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { ppDisp: any, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'NewWindow3', argNames: ['ppDisp', 'Cancel', 'dwFlags', 'bstrUrlContext', 'bstrUrl'], + handler: (this: SHDocVw.ShellBrowserWindow, parameter: { ppDisp: any, Cancel: boolean, readonly dwFlags: number, readonly bstrUrlContext: string, readonly bstrUrl: string }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'OnFullScreen', argNames: ['FullScreen'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly FullScreen: boolean }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'OnMenuBar', argNames: ['MenuBar'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly MenuBar: boolean }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'OnStatusBar', argNames: ['StatusBar'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly StatusBar: boolean }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'OnTheaterMode', argNames: ['TheaterMode'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly TheaterMode: boolean }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'OnToolBar', argNames: ['ToolBar'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly ToolBar: boolean }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'OnVisible', argNames: ['Visible'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly Visible: boolean }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'PrintTemplateInstantiation' | 'PrintTemplateTeardown', argNames: ['pDisp'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly pDisp: any }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'PrivacyImpactedStateChange', argNames: ['bImpacted'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly bImpacted: boolean }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'ProgressChange', argNames: ['Progress', 'ProgressMax'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly Progress: number, readonly ProgressMax: number }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'PropertyChange', argNames: ['szProperty'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly szProperty: string }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'RedirectXDomainBlocked', argNames: ['pDisp', 'StartURL', 'RedirectURL', 'Frame', 'StatusCode'], + handler: (this: SHDocVw.ShellBrowserWindow, parameter: { + readonly pDisp: any, readonly StartURL: any, readonly RedirectURL: any, readonly Frame: any, + readonly StatusCode: any + }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'SetPhishingFilterStatus', argNames: ['PhishingFilterStatus'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly PhishingFilterStatus: number }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'SetSecureLockIcon', argNames: ['SecureLockIcon'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly SecureLockIcon: number }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'StatusTextChange' | 'TitleChange', argNames: ['Text'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly Text: string }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'ThirdPartyUrlBlocked', argNames: ['URL', 'dwCount'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly URL: any, readonly dwCount: number }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'UpdatePageStatus', argNames: ['pDisp', 'nPage', 'fDone'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly pDisp: any, readonly nPage: any, readonly fDone: any }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'WebWorkerFinsihed', argNames: ['dwUniqueID'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly dwUniqueID: number }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'WebWorkerStarted', argNames: ['dwUniqueID', 'bstrWorkerLabel'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly dwUniqueID: number, readonly bstrWorkerLabel: string }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'WindowClosing', argNames: ['IsChildWindow', 'Cancel'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly IsChildWindow: boolean, Cancel: boolean }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'WindowSetHeight', argNames: ['Height'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly Height: number }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'WindowSetLeft', argNames: ['Left'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly Left: number }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'WindowSetResizable', argNames: ['Resizable'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly Resizable: boolean }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'WindowSetTop', argNames: ['Top'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly Top: number }) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'WindowSetWidth', argNames: ['Width'], handler: (this: SHDocVw.ShellBrowserWindow, parameter: { readonly Width: number }) => void): void; + on( + obj: SHDocVw.ShellBrowserWindow, event: 'WindowStateChanged', argNames: ['dwWindowStateFlags', 'dwValidFlagsMask'], handler: ( + this: SHDocVw.ShellBrowserWindow, parameter: { readonly dwWindowStateFlags: number, readonly dwValidFlagsMask: number }) => void): void; + on( + obj: SHDocVw.ShellNameSpace, event: 'FavoritesSelectionChange', argNames: SHDocVw.EventHelperTypes.ShellNameSpace_FavoritesSelectionChange_ArgNames, + handler: (this: SHDocVw.ShellNameSpace, parameter: SHDocVw.EventHelperTypes.ShellNameSpace_FavoritesSelectionChange_Parameter) => void): void; + on(obj: SHDocVw.ShellWindows, event: 'WindowRegistered' | 'WindowRevoked', argNames: ['lCookie'], handler: (this: SHDocVw.ShellWindows, parameter: { readonly lCookie: number }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'BeforeNavigate2', argNames: SHDocVw.EventHelperTypes.WebBrowser_BeforeNavigate2_ArgNames, handler: ( + this: SHDocVw.WebBrowser, parameter: SHDocVw.EventHelperTypes.WebBrowser_BeforeNavigate2_Parameter) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'BeforeScriptExecute', argNames: ['pDispWindow'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly pDispWindow: any }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'ClientToHostWindow', argNames: ['CX', 'CY'], handler: (this: SHDocVw.WebBrowser, parameter: { CX: number, CY: number }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'CommandStateChange', argNames: ['Command', 'Enable'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly Command: number, readonly Enable: boolean }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'DocumentComplete' | 'NavigateComplete2', argNames: ['pDisp', 'URL'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly pDisp: any, readonly URL: any }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'FileDownload', argNames: ['ActiveDocument', 'Cancel'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly ActiveDocument: boolean, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'NavigateError', argNames: ['pDisp', 'URL', 'Frame', 'StatusCode', 'Cancel'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly pDisp: any, readonly URL: any, readonly Frame: any, readonly StatusCode: any, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'NewProcess', argNames: ['lCauseFlag', 'pWB2', 'Cancel'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly lCauseFlag: number, readonly pWB2: any, Cancel: boolean }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'NewWindow2', argNames: ['ppDisp', 'Cancel'], handler: (this: SHDocVw.WebBrowser, parameter: { ppDisp: any, Cancel: boolean }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'NewWindow3', argNames: ['ppDisp', 'Cancel', 'dwFlags', 'bstrUrlContext', 'bstrUrl'], handler: ( + this: SHDocVw.WebBrowser, parameter: { ppDisp: any, Cancel: boolean, readonly dwFlags: number, readonly bstrUrlContext: string, readonly bstrUrl: string }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'OnFullScreen', argNames: ['FullScreen'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly FullScreen: boolean }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'OnMenuBar', argNames: ['MenuBar'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly MenuBar: boolean }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'OnStatusBar', argNames: ['StatusBar'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly StatusBar: boolean }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'OnTheaterMode', argNames: ['TheaterMode'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly TheaterMode: boolean }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'OnToolBar', argNames: ['ToolBar'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly ToolBar: boolean }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'OnVisible', argNames: ['Visible'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly Visible: boolean }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'PrintTemplateInstantiation' | 'PrintTemplateTeardown', argNames: ['pDisp'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly pDisp: any }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'PrivacyImpactedStateChange', argNames: ['bImpacted'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly bImpacted: boolean }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'ProgressChange', argNames: ['Progress', 'ProgressMax'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly Progress: number, readonly ProgressMax: number }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'PropertyChange', argNames: ['szProperty'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly szProperty: string }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'RedirectXDomainBlocked', argNames: ['pDisp', 'StartURL', 'RedirectURL', 'Frame', 'StatusCode'], + handler: (this: SHDocVw.WebBrowser, parameter: { readonly pDisp: any, readonly StartURL: any, readonly RedirectURL: any, readonly Frame: any, readonly StatusCode: any }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'SetPhishingFilterStatus', argNames: ['PhishingFilterStatus'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly PhishingFilterStatus: number }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'SetSecureLockIcon', argNames: ['SecureLockIcon'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly SecureLockIcon: number }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'StatusTextChange' | 'TitleChange', argNames: ['Text'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly Text: string }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'ThirdPartyUrlBlocked', argNames: ['URL', 'dwCount'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly URL: any, readonly dwCount: number }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'UpdatePageStatus', argNames: ['pDisp', 'nPage', 'fDone'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly pDisp: any, readonly nPage: any, readonly fDone: any }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'WebWorkerFinsihed', argNames: ['dwUniqueID'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly dwUniqueID: number }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'WebWorkerStarted', argNames: ['dwUniqueID', 'bstrWorkerLabel'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly dwUniqueID: number, readonly bstrWorkerLabel: string }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'WindowClosing', argNames: ['IsChildWindow', 'Cancel'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly IsChildWindow: boolean, Cancel: boolean }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'WindowSetHeight', argNames: ['Height'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly Height: number }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'WindowSetLeft', argNames: ['Left'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly Left: number }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'WindowSetResizable', argNames: ['Resizable'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly Resizable: boolean }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'WindowSetTop', argNames: ['Top'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly Top: number }) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'WindowSetWidth', argNames: ['Width'], handler: (this: SHDocVw.WebBrowser, parameter: { readonly Width: number }) => void): void; + on( + obj: SHDocVw.WebBrowser, event: 'WindowStateChanged', argNames: ['dwWindowStateFlags', 'dwValidFlagsMask'], handler: ( + this: SHDocVw.WebBrowser, parameter: { readonly dwWindowStateFlags: number, readonly dwValidFlagsMask: number }) => void): void; + on( + obj: SHDocVw.WebBrowser_V1, event: 'BeforeNavigate', argNames: SHDocVw.EventHelperTypes.WebBrowser_V1_BeforeNavigate_ArgNames, + handler: (this: SHDocVw.WebBrowser_V1, parameter: SHDocVw.EventHelperTypes.WebBrowser_V1_BeforeNavigate_Parameter) => void): void; + on( + obj: SHDocVw.WebBrowser_V1, event: 'CommandStateChange', argNames: ['Command', 'Enable'], handler: ( + this: SHDocVw.WebBrowser_V1, parameter: { readonly Command: number, readonly Enable: boolean }) => void): void; + on( + obj: SHDocVw.WebBrowser_V1, event: 'FrameBeforeNavigate', argNames: SHDocVw.EventHelperTypes.WebBrowser_V1_FrameBeforeNavigate_ArgNames, + handler: (this: SHDocVw.WebBrowser_V1, parameter: SHDocVw.EventHelperTypes.WebBrowser_V1_FrameBeforeNavigate_Parameter) => void): void; + on(obj: SHDocVw.WebBrowser_V1, event: 'FrameNavigateComplete' | 'NavigateComplete', argNames: ['URL'], handler: (this: SHDocVw.WebBrowser_V1, parameter: { readonly URL: string }) => void): void; + on( + obj: SHDocVw.WebBrowser_V1, event: 'FrameNewWindow', argNames: SHDocVw.EventHelperTypes.WebBrowser_V1_FrameNewWindow_ArgNames, + handler: (this: SHDocVw.WebBrowser_V1, parameter: SHDocVw.EventHelperTypes.WebBrowser_V1_FrameNewWindow_Parameter) => void): void; + on( + obj: SHDocVw.WebBrowser_V1, event: 'NewWindow', argNames: SHDocVw.EventHelperTypes.WebBrowser_V1_NewWindow_ArgNames, handler: ( + this: SHDocVw.WebBrowser_V1, parameter: SHDocVw.EventHelperTypes.WebBrowser_V1_NewWindow_Parameter) => void): void; + on( + obj: SHDocVw.WebBrowser_V1, event: 'ProgressChange', argNames: ['Progress', 'ProgressMax'], handler: ( + this: SHDocVw.WebBrowser_V1, parameter: { readonly Progress: number, readonly ProgressMax: number }) => void): void; + on(obj: SHDocVw.WebBrowser_V1, event: 'PropertyChange', argNames: ['Property'], handler: (this: SHDocVw.WebBrowser_V1, parameter: { readonly Property: string }) => void): void; + on(obj: SHDocVw.WebBrowser_V1, event: 'Quit', argNames: ['Cancel'], handler: (this: SHDocVw.WebBrowser_V1, parameter: { Cancel: boolean }) => void): void; + on(obj: SHDocVw.WebBrowser_V1, event: 'StatusTextChange' | 'TitleChange', argNames: ['Text'], handler: (this: SHDocVw.WebBrowser_V1, parameter: { readonly Text: string }) => void): void; + on(obj: SHDocVw.InternetExplorer, event: 'DownloadBegin' | 'DownloadComplete' | 'OnQuit', handler: (this: SHDocVw.InternetExplorer, parameter: {}) => void): void; + on(obj: SHDocVw.InternetExplorerMedium, event: 'DownloadBegin' | 'DownloadComplete' | 'OnQuit', handler: (this: SHDocVw.InternetExplorerMedium, parameter: {}) => void): void; + on(obj: SHDocVw.ShellBrowserWindow, event: 'DownloadBegin' | 'DownloadComplete' | 'OnQuit', handler: (this: SHDocVw.ShellBrowserWindow, parameter: {}) => void): void; + on(obj: SHDocVw.ShellNameSpace, event: 'DoubleClick' | 'Initialized' | 'SelectionChange', handler: (this: SHDocVw.ShellNameSpace, parameter: {}) => void): void; + on(obj: SHDocVw.WebBrowser, event: 'DownloadBegin' | 'DownloadComplete' | 'OnQuit', handler: (this: SHDocVw.WebBrowser, parameter: {}) => void): void; + on(obj: SHDocVw.WebBrowser_V1, event: 'DownloadBegin' | 'DownloadComplete' | 'WindowActivate' | 'WindowMove' | 'WindowResize', handler: (this: SHDocVw.WebBrowser_V1, parameter: {}) => void): void; + new (progid: K): ActiveXObjectNameMap[K]; +} + +interface ActiveXObjectNameMap { + 'InternetExplorer.Application': SHDocVw.InternetExplorer; + 'Shell.Explorer': SHDocVw.WebBrowser; + 'Shell.UIHelper': SHDocVw.ShellUIHelper; + 'ShellNameSpace.ShellNameSpace': SHDocVw.ShellNameSpace; +} + +interface EnumeratorConstructor { + new(col: SHDocVw.ShellWindows): Enumerator; +} diff --git a/types/activex-shdocvw/package.json b/types/activex-shdocvw/package.json new file mode 100644 index 0000000000..d9b1031263 --- /dev/null +++ b/types/activex-shdocvw/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "activex-helpers": "*" + } +} \ No newline at end of file diff --git a/types/activex-shdocvw/tsconfig.json b/types/activex-shdocvw/tsconfig.json new file mode 100644 index 0000000000..1907cb1ef6 --- /dev/null +++ b/types/activex-shdocvw/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5", + "scripthost" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "activex-shdocvw-tests.ts" + ] +} \ No newline at end of file diff --git a/types/activex-shdocvw/tslint.json b/types/activex-shdocvw/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/activex-shdocvw/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/activex-shell/activex-shell-tests.ts b/types/activex-shell/activex-shell-tests.ts new file mode 100644 index 0000000000..f236f6e592 --- /dev/null +++ b/types/activex-shell/activex-shell-tests.ts @@ -0,0 +1,489 @@ +/// + +const shell = new ActiveXObject('Shell.Application'); + +const getWindowsFolder = () => shell.NameSpace(Shell32.ShellSpecialFolderConstants.ssfWINDOWS); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/gg537735(v=vs.85).aspx +(() => { + const folder = getWindowsFolder(); + if (!folder) { return; } + const folderItem = folder.ParseName('system.ini'); + if (!folderItem) { return; } + shell.AddToRecent(folderItem.Path); +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774065(v=vs.85).aspx +(() => { + const folder = shell.BrowseForFolder(0, 'Example', 0, Shell32.ShellSpecialFolderConstants.ssfWINDOWS); +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/gg537736(v=vs.85).aspx +const canStartStop = shell.CanStartStopService('service name'); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774069(v=vs.85).aspx +shell.ControlPanelItem('desk.cpl'); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774073(v=vs.85).aspx +shell.Explore('C:\\'); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/gg537737(v=vs.85).aspx +const explorerPolicy = shell.ExplorerPolicy('ValueName'); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/gg537739(v=vs.85).aspx +const settingValue = shell.GetSetting(Shell32.SettingKey.SSF_SHOWALLOBJECTS); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/gg537740(v=vs.85).aspx +const processorLevel = shell.GetSystemInformation('ProcessorLevel'); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/gg537741(v=vs.85).aspx +const isRestricted = shell.IsRestricted('system', 'undockwithoutlogon'); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/gg537742(v=vs.85).aspx +const isServiceRunning = shell.IsServiceRunning('Themes'); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774086(v=vs.85).aspx +shell.Open(Shell32.ShellSpecialFolderConstants.ssfWINDOWS); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/gg537743(v=vs.85).aspx +shell.ServiceStart('Messenger', true); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/gg537744(v=vs.85).aspx +shell.ServiceStop('Messenger', true); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/gg537745(v=vs.85).aspx +shell.ShellExecute("notepad.exe", "", "", "open", Shell32.ShellExecuteShow.Normal); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/gg537746(v=vs.85).aspx?cs-save-lang=1&cs-lang=jscript#code-snippet-1 +shell.ShowBrowserBar(Shell32.ExplorerBarCLSID.Favorites, true); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774107(v=vs.85).aspx +const wshShell = new ActiveXObject('WScript.Shell'); +wshShell.Popup(shell.Windows().Count.toString()); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787866(v=vs.85).aspx +shell.NameSpace(`c:\\windows`)!.CopyHere('c:\\autoexec.bat'); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787870(v=vs.85).aspx +(() => { + const folder = shell.NameSpace('c:\\windows'); + const folderItem = folder ? folder.ParseName('clock.avi') : undefined; + if (folder && folderItem) { + const info = folder.GetDetailsOf(folderItem, Shell32.FileSystemDetails.Type); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787874(v=vs.85).aspx +shell.NameSpace('c:\\windows')!.MoveHere('c:\\temp.txt', Shell32.FileOperationFlag.FOF_NOCONFIRMATION); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787876(v=vs.85).aspx +shell.NameSpace('c:\\')!.NewFolder('TestFolder'); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787858(v=vs.85).aspx +(() => { + const folder = shell.NameSpace("\\\\server\\share\\folder"); + const offlineStatus = folder ? folder.OfflineStatus : undefined; +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787880(v=vs.85).aspx +(() => { + const folder = shell.NameSpace(Shell32.ShellSpecialFolderConstants.ssfPROGRAMS); + WScript.Echo(folder!.ParentFolder.Title); +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787860(v=vs.85).aspx +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787816(v=vs.85).aspx +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787850(v=vs.85).aspx +(() => { + const folder = shell.NameSpace('C:\\WINDOWS'); + const folderItem = folder ? folder.Self : undefined; + if (folderItem) { + const verbs = folderItem.Verbs(); + folderItem.InvokeVerb(); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787812(v=vs.85).aspx +(() => { + const parentFolder = getWindowsFolder(); + const folderItem = parentFolder ? parentFolder.ParseName('system32') : undefined; + const folder = folderItem ? folderItem.GetFolder : undefined; +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787814(v=vs.85).aspx +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787824(v=vs.85).aspx +(() => { + const folder = shell.NameSpace(Shell32.ShellSpecialFolderConstants.ssfPROGRAMS); + const folderItem = folder ? folder.ParseName('Internet Explorer.lnk') : undefined; + if (folderItem && folderItem.IsLink) { + const link = folderItem.GetLink; + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787818(v=vs.85).aspx +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787819(v=vs.85).aspx +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787821(v=vs.85).aspx +(() => { + const folder = getWindowsFolder(); + const folderItem = folder ? folder.Self : undefined; + if (folderItem) { + const isBrowsable = folderItem.IsBrowsable; + const isFileSystem = folderItem.IsFileSystem; + const isFolder = folderItem.IsFolder; + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787825(v=vs.85).aspx +(() => { + const folder = getWindowsFolder(); + const folderItem = folder!.ParseName('notepad.exe'); + if (folderItem) { + const oldDate = folderItem.ModifyDate; + folderItem.ModifyDate = new Date(1900, 1, 1, 18, 5).getVarDate(); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787827(v=vs.85).aspx +(() => { + const rootFolder = shell.NameSpace('C:\\'); + const folderItem = rootFolder ? rootFolder.ParseName('autoexec.bat') : undefined; + if (folderItem) { + const oldName = folderItem.Name; + folderItem.Name = 'test.bat'; + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787829(v=vs.85).aspx +(() => { + const folder = getWindowsFolder(); + const folderItem = folder ? folder.Self : undefined; + const parent = folderItem ? folderItem.Parent : undefined; + if (parent) { + WScript.Echo('Got parent object'); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787844(v=vs.85).aspx +(() => { + const folder = getWindowsFolder(); + const folderItem = folder ? folder.Self : undefined; + const path = folderItem ? folderItem.Path : ''; +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787846(v=vs.85).aspx +(() => { + const folder = getWindowsFolder(); + const folderItem = folder!.ParseName('notepad.exe'); + const size = folderItem ? folderItem.Size : undefined; +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787848(v=vs.85).aspx +(() => { + const folder = getWindowsFolder(); + if (folder) { + WScript.Echo(folder.Self.Type); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787798(v=vs.85).aspx +(() => { + const folder = getWindowsFolder(); + const folderItems = folder ? folder.Items() : undefined; + const count = folderItems ? folderItems.Count : undefined; +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787794(v=vs.85).aspx +(() => { + const folder = shell.NameSpace(Shell32.ShellSpecialFolderConstants.ssfDRIVES); + if (folder) { + folder.Items().InvokeVerbEx(); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774170(v=vs.85).aspx +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774174(v=vs.85).aspx +(() => { + const folder = shell.NameSpace(Shell32.ShellSpecialFolderConstants.ssfPROGRAMS); + const verbs = folder ? folder.Self.Verbs() : undefined; + if (verbs) { + const verb = verbs.Item(0); + WScript.Echo(verb.Name); + verb.DoIt(); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787787(v=vs.85).aspx +(() => { + const folder = getWindowsFolder(); + if (folder) { + const folderItems = folder.Items(); + WScript.Echo(folderItems.Count); + folderItems.Filter(Shell32.ShellFolderEnumerationFlags.SHCONTF_NONFOLDERS, '*.txt'); + WScript.Echo(folderItems.Count); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787791(v=vs.85).aspx +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774162(v=vs.85).aspx +(() => { + const echoFirstVerbName = (folder: Shell32.Folder3 | null) => { + if (!folder) { return; } + const verbs = folder.Items().Verbs; + WScript.Echo(verbs.Item(0).Name); + }; + + let folder = getWindowsFolder(); + echoFirstVerbName(folder); + + folder = shell.NameSpace(Shell32.ShellSpecialFolderConstants.ssfCONTROLS); + echoFirstVerbName(folder); +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774158(v=vs.85).aspx +(() => { + const folder = shell.NameSpace(Shell32.ShellSpecialFolderConstants.ssfCONTROLS); + if (folder) { + const verbs = folder.Self.Verbs(); + WScript.Echo(verbs.Count); + } +})(); + +const getIELink = () => { + const folder = shell.NameSpace(Shell32.ShellSpecialFolderConstants.ssfPROGRAMS); + const folderItem = folder ? folder.ParseName('Internet Explorer.lnk') : undefined; + return { + link: folderItem ? folderItem.GetLink : undefined, + folderItem + }; +}; + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb773990(v=vs.85).aspx +(() => { + const { link, folderItem } = getIELink(); + if (link && folderItem) { + WScript.Echo(link.GetIconLocation(folderItem.Path)); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb773996(v=vs.85).aspx +(() => { + const { link } = getIELink(); + if (link) { + link.Resolve(Shell32.ShellLinkResolveFlags.NoUI); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb773998(v=vs.85).aspx +(() => { + const { link } = getIELink(); + if (link) { + link.Description = 'New Description'; + link.Save(); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774002(v=vs.85).aspx +(() => { + const { link } = getIELink(); + if (link) { + link.SetIconLocation(link.Path, 1); + link.Save(); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb773986(v=vs.85).aspx +(() => { + const { link } = getIELink(); + if (link) { + WScript.Echo(link.Arguments); + link.Arguments = '/s'; + link.Save(); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb773988(v=vs.85).aspx +(() => { + const { link } = getIELink(); + if (link) { + WScript.Echo(link.Description); + link.Description = 'Test'; + link.Save(); + } +})(); + +const parseHotkey = (hotkey: number) => { + // missing implementation + return { + shift: false, + ctrl: false, + alt: false, + extended: false, + hotkey + }; +}; +const buildHotkey = (hotkey: number, shift: boolean = false, ctrl: boolean = false, alt: boolean = false, extended: boolean = false) => { + // missing implementation + return 0; +}; + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb773992(v=vs.85).aspx +(() => { + const { link } = getIELink(); + if (link) { + const { hotkey } = parseHotkey(link.Hotkey); + WScript.Echo(hotkey); + link.Hotkey = buildHotkey(4); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb773994(v=vs.85).aspx +(() => { + const { link } = getIELink(); + if (link) { + WScript.Echo(link.Path); + link.Path = 'C:\\Program Files\\IE\\IEXPLORE.EXE'; + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774006(v=vs.85).aspx +(() => { + const { link } = getIELink(); + if (link) { + WScript.Echo(link.ShowCommand); + link.ShowCommand = Shell32.LinkShowWindowState.Normal; + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774008(v=vs.85).aspx +(() => { + const { link } = getIELink(); + if (link) { + WScript.Echo(link.WorkingDirectory); + link.WorkingDirectory = ''; + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774115(v=vs.85).aspx +(() => { + const { link } = getIELink(); + if (link) { + const target = link.Target; + if (target) { + WScript.Echo(target.Size); + } + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774055(v=vs.85).aspx +(() => { + const folder = getWindowsFolder(); + const folderItem = folder ? folder.ParseName('notepad.exe') : undefined; + if (folderItem) { + WScript.Echo(folderItem.ExtendedProperty('infotip')); + } + + const wordDoc = shell.NameSpace('C:\\')!.ParseName('test.doc'); + if (wordDoc) { + const FMTID_SummaryInfo = "{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"; + const PID_TITLE = "2"; + const PID_AUTHOR = "4"; + const SCID_TITLE = `${FMTID_SummaryInfo} ${PID_TITLE}`; + const SCID_AUTHOR = `${FMTID_SummaryInfo} ${PID_AUTHOR}`; + const docTitle = wordDoc.ExtendedProperty(SCID_TITLE); + const docAuthor = wordDoc.ExtendedProperty(SCID_AUTHOR); + } +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774057(v=vs.85).aspx +(() => { + const folder = getWindowsFolder(); + const folderItem = folder ? folder.ParseName('notepad.exe') : undefined; + if (folderItem) { + folderItem.InvokeVerbEx("open", "c:\\autoexec.bat"); + } +})(); + +const collectionToArray = (col: any): T[] => { // tslint:disable-line no-unnecessary-generics + const results: T[] = []; + const enumerator = new Enumerator(col); + enumerator.moveFirst(); + while (!enumerator.atEnd()) { + results.push(enumerator.item()); + enumerator.moveNext(); + } + return results; +}; + +interface String { + endsWith(searchString: string, length?: number): boolean; +} +if (!String.prototype.endsWith) { + String.prototype.endsWith = function(search, this_len) { + if (this_len === undefined || this_len > this.length) { + this_len = this.length; + } + return this.substring(this_len - search.length, this_len) === search; + }; +} + +// shell.Windows() includes items other than Explorer windows, such as Internet Explorer tabs +const getExplorerWindows = () => + collectionToArray(shell.Windows()) + .filter(x => x.FullName.toLowerCase().endsWith('explorer.exe')); + +const getFolderViews = () => + getExplorerWindows() + .map(x => x.Document as Shell32.ShellFolderView); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774045(v=vs.85).aspx +(() => { + getFolderViews().forEach(x => + ActiveXObject.on(x, 'SelectionChanged', function(this: Shell32.ShellFolderView) { + WScript.Echo(`Selection change in ${this.Folder.Title} -- count: ${this.SelectedItems().Count}`); + }) + ); +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb773970(v=vs.85).aspx +WScript.Echo(shell.Windows().Item().Path); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb773969(v=vs.85).aspx +WScript.Echo(shell.Windows().Count); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774043(v=vs.85).aspx +(() => { + getFolderViews().forEach(x => + WScript.Echo(`${x.Folder.Title} -- ${x.SelectedItems().Count} selected items`) + ); +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774047(v=vs.85).aspx +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774022(v=vs.85).aspx +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774053(v=vs.85).aspx +(() => { + const folderView = getExplorerWindows()[0].Document as Shell32.ShellFolderView; + const folder = folderView.Folder; + if (folder) { + const folderItem = folder.Self; + folderView.SelectItem(folder.Self, Shell32.ShellFolderViewSelectItem.Focus); + } + WScript.Echo(folderView.ViewOptions); +})(); + +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb774020(v=vs.85).aspx +(() => { + const folderView = getExplorerWindows()[0].Document as Shell32.ShellFolderView; + const focusedItem = folderView.FocusedItem; + if (focusedItem) { + WScript.Echo(`Focused item in first Excplorer window -- ${focusedItem.Path}`); + } +})(); + +(() => { + const router = new ActiveXObject('Shell.FolderView'); + const folder = getFolderViews()[0]; + router.SetFolderView(folder); + ActiveXObject.on(router, 'EnumDone', () => WScript.Echo('Current folder view was finisehd enumerating')); + ActiveXObject.on(router, 'SelectionChanged', () => WScript.Echo('Selection changed in current folder view')); + // the folder view monitored by the ShellFolderViewOC object can be changed via SetFolderView without disconnecting and reconnecting the handlers +})(); diff --git a/types/activex-shell/index.d.ts b/types/activex-shell/index.d.ts new file mode 100644 index 0000000000..cb59a11c5e --- /dev/null +++ b/types/activex-shell/index.d.ts @@ -0,0 +1,1016 @@ +// Type definitions for Microsoft Shell Controls And Automation - Shell32 1.0 +// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/bb773938(v=vs.85).aspx +// Definitions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/// + +declare namespace Shell32 { + // tslint:disable-next-line no-const-enum + const enum BrowseInfoFlags { + /** + * Allow folder junctions such as a library or a compressed file with a .zip file name extension to be browsed. + * + * _Windows 7 and later._ + */ + BIF_BROWSEFILEJUNCTIONS = 0x00010000, + + /** Only return computers. If the user selects anything other than a computer, the **OK** button is grayed. */ + BIF_BROWSEFORCOMPUTER = 0x00001000, + + /** + * Only allow the selection of printers. If the user selects anything other than a printer, the **OK** button is grayed. + * + * In Windows XP and later systems, the best practice is to use a Windows XP-style dialog, setting the root of the dialog to the **Printers and Faxes** folder (`CSIDL_PRINTERS`). + */ + BIF_BROWSEFORPRINTER = 0x00002000, + + /** + * The browse dialog box displays files as well as folders. + * + * _[Version 4.7.1](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779.aspx)_ + */ + BIF_BROWSEINCLUDEFILES = 0x00004000, + + /** + * The browse dialog box can display URLs. The `BIF_USENEWUI` and `BIF_BROWSEINCLUDEFILES` flags must also be set. If any of these three flags are not set, the browser dialog box rejects URLs. + * Even when these flags are set, the browse dialog box displays URLs only if the folder that contains the selected item supports URLs. + * + * When the folder's [IShellFolder::GetAttributesOf](https://msdn.microsoft.com/en-us/library/windows/desktop/bb775068.aspx) method is called to request the selected item's attributes, the + * folder must set the `SFGAO_FOLDER` attribute flag. Otherwise, the browse dialog box will not display the URL. + * + * _[Version 5.0](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779.aspx)_ + */ + BIF_BROWSEINCLUDEURLS = 0x00000080, + + /** Do not include network folders below the domain level in the dialog box's tree view control. */ + BIF_DONTGOBELOWDOMAIN = 0x00000002, + + /** + * Include an edit control in the browse dialog box that allows the user to type the name of an item. + * + * _[Version 4.7.1](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779.aspx)_ + */ + BIF_EDITBOX = 0x00000010, + + /** + * Use the new user interface. Setting this flag provides the user with a larger dialog box that can be resized. The dialog box has several new capabilities, including: drag-and-drop + * capability within the dialog box, reordering, shortcut menus, new folders, delete, and other shortcut menu commands. + * + * _[Version 5.0](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779.aspx)_ + */ + BIF_NEWDIALOGSTYLE = 0x00000040, + + /** + * Do not include the **New Folder** button in the browse dialog box. + * + * _[Version 6.0](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779.aspx)_ + */ + BIF_NONEWFOLDERBUTTON = 0x00000200, + + /** + * When the selected item is a shortcut, return the PIDL of the shortcut itself rather than its target. + * + * _[Version 6.0](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779.aspx)_ + */ + BIF_NOTRANSLATETARGETS = 0x00000400, + + /** + * Only return file system ancestors. An ancestor is a subfolder that is beneath the root folder in the namespace hierarchy. If the user selects an ancestor of the root folder that is not + * part of the file system, the **OK** button is grayed. + */ + BIF_RETURNFSANCESTORS = 0x00000008, + + /** + * Only return file system directories. If the user selects folders that are not part of the file system, the **OK** button is grayed. + * + * **Note** The **OK** button remains enabled for `\\server` items, as well as `\\server\share` and directory items. However, if the user selects a `\\server` item, passing the PIDL + * returned by [SHBrowseForFolder](https://msdn.microsoft.com/en-us/library/windows/desktop/bb762115.aspx) to + * [SHGetPathFromIDList](https://msdn.microsoft.com/en-us/library/windows/desktop/bb762194.aspx) fails. + */ + BIF_RETURNONLYFSDIRS = 0x00000001, + + /** + * The browse dialog box can display sharable resources on remote systems. This is intended for applications that want to expose remote shares on a local system. The BIF_NEWDIALOGSTYLE flag + * must also be set. + * + * _[Version 5.0](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779.aspx)_ + */ + BIF_SHAREABLE = 0x00008000, + + /** + * Include a status area in the dialog box. The callback function can set the status text by sending messages to the dialog box. This flag is not supported when BIF_NEWDIALOGSTYLE + * is specified. + */ + BIF_STATUSTEXT = 0x00000004, + + /** + * When combined with `BIF_NEWDIALOGSTYLE`, adds a usage hint to the dialog box, in place of the edit box. `BIF_EDITBOX` overrides this flag. + * + * _[Version 6.0](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779.aspx)_ + */ + BIF_UAHINT = 0x00000100, + + /** + * Use the new user interface, including an edit box. This flag is equivalent to `BIF_EDITBOX | BIF_NEWDIALOGSTYLE`. + * + * _[Version 5.0](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779.aspx)_ + */ + BIF_USENEWUI = 0x00000090, + + /** + * If the user types an invalid name into the edit box, the browse dialog box calls the application's + * [BrowseCallbackProc](https://msdn.microsoft.com/en-us/library/windows/desktop/bb762598.aspx) with the **BFFM_VALIDATEFAILED** message. This flag is ignored if BIF_EDITBOX is not specified. + * + * _[Version 4.71](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779)_ + */ + BIF_VALIDATE = 0x00000020, + } + + // tslint:disable-next-line no-const-enum + const enum ExplorerBarCLSID { + Favorites = '{EFA24E61-B078-11d0-89E4-00C04FC9E26E}', + Folders = '{EFA24E64-B078-11d0-89E4-00C04FC9E26E}', + History = '{EFA24E62-B078-11d0-89E4-00C04FC9E26E}', + Search = '{30D02401-6A81-11d0-8274-00C04FD5AE38}', + } + + // tslint:disable-next-line no-const-enum + const enum FileOperationFlag { + /** Preserve undo information, if possible. */ + FOF_ALLOWUNDO = 64, + + /** Perform the operation on files only if a wildcard file name (*.*) is specified. */ + FOF_FILESONLY = 128, + + /** Respond with "Yes to All" for any dialog box that is displayed. */ + FOF_NOCONFIRMATION = 16, + + /** Do not confirm the creation of a new directory if the operation requires one to be created. */ + FOF_NOCONFIRMMKDIR = 512, + + /** + * Do not copy connected files as a group. Only copy the specified files. + * + * _[Version 5.0](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779.aspx)_ + */ + FOF_NO_CONNECTED_ELEMENTS = 8192, + + /** + * Do not copy the security attributes of the file. + * + * _[Version 4.7.1](https://msdn.microsoft.com/en-us/library/windows/desktop/bb776779.aspx)_ + */ + FOF_NOCOPYSECURITYATTRIBS = 2048, + + /** Do not display a user interface if an error occurs. */ + FOF_NOERRORUI = 1024, + + /** Only operate in the local directory. Do not operate recursively into subdirectories. */ + FOF_NORECURSION = 4096, + + /** Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists. */ + FOF_RENAMEONCOLLISION = 8, + + /** Do not display a progress dialog box. */ + FOF_SILENT = 4, + + /** Display a progress dialog box but do not show the file names. */ + FOF_SIMPLEPROGRESS = 256, + } + + // tslint:disable-next-line no-const-enum + const enum FileSystemDetails { + Name = 0, + Size = 1, + Type = 2, + LastModified = 3, + Attributes = 4, + InfoTip = -1, + } + + // tslint:disable-next-line no-const-enum + const enum HotkeyModifiers { + SHIFT = 1, + CTRL = 2, + ALT = 4, + Extended = 8 + } + + // tslint:disable-next-line no-const-enum + const enum LinkShowWindowState { + /** Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. */ + Normal = 1, + + /** Activates the window and displays it as a minimized window. */ + Minimized = 2, + + /** Activates the window and displays it as a maximized window. */ + Maximized = 3 + } + + /** Constants for Folder2.OfflineStatus */ + // tslint:disable-next-line no-const-enum + const enum OfflineFolderStatus { + OFS_DIRTYCACHE = 3, + OFS_INACTIVE = -1, + OFS_OFFLINE = 1, + OFS_ONLINE = 0, + OFS_SERVERBACK = 2, + } + + // tslint:disable-next-line no-const-enum + const enum ShellFolderEnumerationFlags { + /** **Windows 7 and later** The calling application is checking for the existence of child items in the folder. */ + SHCONTF_CHECKING_FOR_CHILDREN = 0x00010, + + /** Include items that are folders in the enumeration. */ + SHCONTF_FOLDERS = 0x00020, + + /** Include items that are not folders in the enumeration. */ + SHCONTF_NONFOLDERS = 0x00040, + + /** Include hidden items in the enumeration. This does not include hidden system items. (To include hidden system items, use SHCONTF_INCLUDESUPERHIDDEN.) */ + SHCONTF_INCLUDEHIDDEN = 0x00080, + + /** The calling application is looking for printer objects. */ + SHCONTF_NETPRINTERSRCH = 0x00200, + + /** The calling application is looking for resources that can be shared. */ + SHCONTF_SHAREABLE = 0x00400, + + /** Include items with accessible storage and their ancestors, including hidden items. */ + SHCONTF_STORAGE = 0x00800, + + /** **Windows 7 and later**. Child folders should provide a navigation enumeration. */ + SHCONTF_NAVIGATION_ENUM = 0x01000, + + /** **Windows Vista and later**. The calling application is looking for resources that can be enumerated quickly. */ + SHCONTF_FASTITEMS = 0x02000, + + /** **Windows Vista and later**. Enumerate items as a simple list even if the folder itself is not structured in that way. */ + SHCONTF_FLATLIST = 0x04000, + + /** + * **Windows Vista and later**. The calling application is monitoring for change notifications.This means that the enumerator does not have to return all results. + * Items can be reported through change notifications. + */ + SHCONTF_ENABLE_ASYNC = 0x08000, + + /** + * **Windows 7 and later**. Include hidden system items in the enumeration. This value does not include hidden non-system items. + * (To include hidden non-system items, use SHCONTF_INCLUDEHIDDEN.) + */ + SHCONTF_INCLUDESUPERHIDDEN = 0x10000, + } + + // tslint:disable-next-line no-const-enum + const enum ShellFolderViewOptions { + /** The **Show All Files** option is enabled. */ + SFVVO_SHOWALLOBJECTS = 0x00000001, + + /** The **Hide extensions for known file types** option is disabled. */ + SFVVO_SHOWEXTENSIONS = 0x00000002, + + /** The **Display Compressed Files and Folders with Alternate Color** option is enabled. */ + SFVVO_SHOWCOMPCOLOR = 0x00000008, + + /** The **Do Not Show Hidden Files** option is enabled. */ + SFVVO_SHOWSYSFILES = 0x00000020, + + /** The **Classic Style** option is enabled. */ + SFVVO_WIN95CLASSIC = 0x00000040, + + /** The **Double-Click to Open an Item** option is enabled. */ + SFVVO_DOUBLECLICKINWEBVIEW = 0x00000080, + + /** The **Active Desktop – View as Web Page** option is enabled. */ + SFVVO_DESKTOPHTML = 0x00000200 + } + + // tslint:disable-next-line no-const-enum + const enum ShellFolderViewSelectItem { + Deselect = 0, + Select = 1, + EditMode = 3, + DeselectAllButThis = 4, + ScrollIntoView = 8, + Focus = 16 + } + + // tslint:disable-next-line no-const-enum + const enum ShellLinkResolveFlags { + /** + * Do not display a dialog box if the link cannot be resolved. When this flag is set, the high-order word of _fFlags_ specifies a time-out duration, in milliseconds. + * The method returns if the link cannot be resolved within the time-out duration. If the high-order word is set to zero, the time-out duration defaults to 3000 milliseconds (3 seconds). + */ + NoUI = 1, + + /** If the link has changed, update its path and list of identifiers. */ + Update = 4, + + /** Do not update the link information. */ + NoUpdate = 8, + + /** Do not execute the search heuristics. */ + NoSearch = 16, + + /** Do not use distributed link tracking. */ + NoTrack = 32, + + /** + * Disable distributed link tracking. By default, distributed link tracking tracks removable media across multiple devices based on the volume name. + * It also uses the UNC path to track remote file systems whose drive letter has changed. Setting this flag disables both types of tracking. + */ + NoLinkInfo = 64, + + /** Call the Windows Installer. */ + InvokeMSI = 128 + } + + // tslint:disable-next-line no-const-enum + const enum SettingKey { + /** + * The state of the **Use check boxes to select items** option. This option is enabled automatically when the system has a pen input device configured. + * + * _Windows Vista and later_ + */ + SSF_AUTOCHECKSELECT = 0x00800000, + + /** Not used. */ + SSF_DESKTOPHTML = 0x00000200, + + /** The state of the **Allow all uppercase names** option. As of Windows Vista, this folder option is no longer available. */ + SSF_DONTPRETTYPATH = 0x00000800, + + /** The state of the **Double-click to open an item (single-click to select)** option. */ + SSF_DOUBLECLICKINWEBVIEW = 0x00000080, + + /** Not used. */ + SSF_FILTER = 0x00010000, + + /** Not used. */ + SSF_HIDDENFILEEXTS = 0x00000004, + + /** The state of icon display in the Windows Explorer list view. If this option is active, no icons are displayed in the list view. */ + SSF_HIDEICONS = 0x00004000, + + /** + * The state of display name display in the Windows Explorer list view. If this option is active, icons are displayed in the list view, but display names are not. + * + * _Windows Vista and later_ + */ + SSF_ICONSONLY = 0x01000000, + + /** The state of the **Show map network drive button in toolbar** option. As of Windows Vista, this option is no longer available. */ + SSF_MAPNETDRVBUTTON = 0x00001000, + + /** The state of the Recycle Bin's **Display delete confirmation dialog** option. */ + SSF_NOCONFIRMRECYCLE = 0x00008000, + + /** The state of the **Automatically search for network folders and printers** option. As of Windows Vista, this option is no longer available. */ + SSF_NONETCRAWLING = 0x00100000, + + /** The state of the **Launch folder windows in a separate process** option. */ + SSF_SEPPROCESS = 0x00080000, + + /** Not used. */ + SSF_SERVERADMINUI = 0x00000004, + + /** The state of the **Hidden files and folders** option. */ + SSF_SHOWALLOBJECTS = 0x00000001, + + /** The state of the **Show File Attributes in Detail View** option. As of Windows Vista, this option is no longer available. */ + SSF_SHOWATTRIBCOL = 0x00000100, + + /** The state of the **Show encrypted or compressed NTFS files in color** option. */ + SSF_SHOWCOMPCOLOR = 0x00000008, + + /** The state of the **Hide extensions for known file types** option. */ + SSF_SHOWEXTENSIONS = 0x00000002, + + /** The state of the **Show pop-up description for folder and desktop items** option. */ + SSF_SHOWINFOTIP = 0x00002000, + + /** Not used. */ + SSF_SHOWSTARTPAGE = 0x00400000, + + /** The state of the **Hide protected operating system files** option. */ + SSF_SHOWSUPERHIDDEN = 0x00040000, + + /** + * The state of the **Hidden files and folders** option. In Windows Vista and later, this is equivalent to `SSF_SHOWALLOBJECTS`. In versions of Windows before Windows Vista, this value + * referred to the state of the **Do not show hidden files and folders** option. + */ + SSF_SHOWSYSFILES = 0x00000020, + + /** + * The state of the **Display file icon on thumbnails** option. If this option is active, a file type overlay is applied when a file supplies a thumbnail representation. + * + * _Windows Vista and later_ + */ + SSF_SHOWTYPEOVERLAY = 0x02000000, + + /** Not used. */ + SSF_SORTCOLUMNS = 0x00000010, + + /** The state of the Windows XP display option, which selects between the Windows XP style and the classic style. As of Windows Vista, this option is no longer available. */ + SSF_STARTPANELON = 0x00200000, + + /** The state of the **Display as a web view option**. As of Windows Vista, this option is no longer available. */ + SSF_WEBVIEW = 0x00020000, + + /** The state of the **Classic Style** option. As of Windows Vista, this option is no longer available. */ + SSF_WIN95CLASSIC = 0x00000400, + } + + // tslint:disable-next-line no-const-enum + const enum ShellExecuteShow { + /** Open the application with a hidden window. */ + Hidden = 0, + + /** Open the application with a normal window. If the window is minimized or maximized, the system restores it to its original size and position. */ + Normal = 1, + + /** Open the application with a minimized window. */ + Minimized = 2, + + /** Open the application with a maximized window. */ + Maximized = 3, + + /** Open the application with its window at its most recent size and position. The active window remains active. */ + Last = 4, + + /** Open the application with its window at its current size and position. */ + Current = 5, + + /** Open the application with a minimized window. The active window remains active. */ + MinimizedNotActivated = 7, + + /** Open the application with its window in the default state specified by the application. */ + Application = 10, + } + + /** Constants for Special Folders for open/Explore */ + // tslint:disable-next-line no-const-enum + const enum ShellSpecialFolderConstants { + ssfALTSTARTUP = 29, + ssfAPPDATA = 26, + ssfBITBUCKET = 10, + ssfCOMMONALTSTARTUP = 30, + ssfCOMMONAPPDATA = 35, + ssfCOMMONDESKTOPDIR = 25, + ssfCOMMONFAVORITES = 31, + ssfCOMMONPROGRAMS = 23, + ssfCOMMONSTARTMENU = 22, + ssfCOMMONSTARTUP = 24, + ssfCONTROLS = 3, + ssfCOOKIES = 33, + ssfDESKTOP = 0, + ssfDESKTOPDIRECTORY = 16, + ssfDRIVES = 17, + ssfFAVORITES = 6, + ssfFONTS = 20, + ssfHISTORY = 34, + ssfINTERNETCACHE = 32, + ssfLOCALAPPDATA = 28, + ssfMYPICTURES = 39, + ssfNETHOOD = 19, + ssfNETWORK = 18, + ssfPERSONAL = 5, + ssfPRINTERS = 4, + ssfPRINTHOOD = 27, + ssfPROFILE = 40, + ssfPROGRAMFILES = 38, + ssfPROGRAMFILESx86 = 48, + ssfPROGRAMS = 2, + ssfRECENT = 8, + ssfSENDTO = 9, + ssfSTARTMENU = 11, + ssfSTARTUP = 7, + ssfSYSTEM = 37, + ssfSYSTEMx86 = 41, + ssfTEMPLATES = 21, + ssfWINDOWS = 36, + } + + /** FileSearchBand Class */ + class FileSearchBand { + private 'Shell32.FileSearchBand_typekey': FileSearchBand; + private constructor(); + + /** Retrieve the file from which the search was restored. */ + readonly QueryFile: any; + + /** Get the search scope */ + readonly Scope: any; + + /** Retrieve the guid of the currently active search. */ + readonly SearchID: string; + + /** method SetFocus */ + SetFocus(): void; + + /** method SetSearchParameters */ + SetSearchParameters(pbstrSearchID: string, bNavToResults: boolean, pvarScope?: any, pvarQueryFile?: any): void; + } + + /** Definition of interface Folder version 3 */ + class Folder3 { + private 'Shell32.Folder3_typekey': Folder3; + private constructor(); + + /** Get Application object */ + readonly Application: any; + + /** Copy Items to this folder. */ + CopyHere(vItem: string | ShellFolderItem | FolderItems3, vOptions?: FileOperationFlag): void; + + /** Call this after the WebView barricade is dismissed by the user */ + DismissedWebViewBarricade(): void; + + /** + * Get the details about an item. + * @param vItem The item for which to retrieve the information. + * @param iColumn An integer value that specifies the information to be retrieved. The information available for an item depends on the folder in which it is displayed. This value + * corresponds to the zero-based column number that is displayed in a Shell view. + */ + GetDetailsOf(vItem: ShellFolderItem, iColumn: number): string; + + /** Should the WebView barricade be shown? */ + readonly HaveToShowWebViewBarricade: boolean; + + /** The collection of Items in folder */ + Items(): FolderItems3; + + /** Move Items to this folder. */ + MoveHere(vItem: string | ShellFolderItem | FolderItems3, vOptions?: FileOperationFlag): void; + + /** Create a new sub folder in this folder. */ + NewFolder(bName: string): void; + + /** Offline status of the server? */ + readonly OfflineStatus: OfflineFolderStatus; + + /** Get Parent object */ + readonly ParentFolder: Folder3; + + /** Parse the name to get an item. */ + ParseName(bName: string): ShellFolderItem | null; + + /** Folder's FolderItem interface */ + readonly Self: ShellFolderItem; + + /** Ask if the WebView barricade should be shown or not */ + ShowWebViewBarricade: boolean; + + /** Synchronize all offline files */ + Synchronize(): void; + + /** Get the display name for the window */ + readonly Title: string; + } + + /** Definition of interface FolderItems3 */ + class FolderItems3 { + private 'Shell32.FolderItems3_typekey': FolderItems3; + private constructor(); + + /** Get Application object */ + readonly Application: any; + + /** Get count of items in the folder */ + readonly Count: number; + + /** Set a wildcard filter to apply to the items returned */ + Filter(grfFlags: ShellFolderEnumerationFlags, bstrFileSpec: string): void; + + /** + * Executes a verb on a collection of `FolderItem` objects + * @param vVerb String that corresponds to the command to be executed. If no verb is specified, the default verb is executed. + * @param vArgs String with one or more arguments to the command specified by vVerb. The format of this string depends on the particular verb. + */ + InvokeVerbEx(vVerb?: string, vArgs?: string): void; + + /** Return the figure for the given index */ + Item(index?: any): ShellFolderItem; + + /** Get the list of verbs common to all the items */ + readonly Verbs: FolderItemVerbs; + } + + /** Definition of interface FolderItemVerb */ + class FolderItemVerb { + private 'Shell32.FolderItemVerb_typekey': FolderItemVerb; + private constructor(); + + /** Execute the verb */ + DoIt(): void; + + /** Get display name for item */ + readonly Name: string; + } + + /** Definition of interface FolderItemVerbs */ + class FolderItemVerbs { + private 'Shell32.FolderItemVerbs_typekey': FolderItemVerbs; + private constructor(); + + /** Get count of open folder windows */ + readonly Count: number; + + /** Return the specified verb */ + Item(index?: any): FolderItemVerb; + } + + /** Shell Object Type Information */ + class Shell { + private 'Shell32.Shell_typekey': Shell; + private constructor(); + + /** Add an object to the Recent Docuements */ + AddToRecent(varFile: string | null, bstrCategory?: string): void; + + /** Get Application object */ + readonly Application: any; + + /** Browse the name space for a Folder */ + BrowseForFolder(Hwnd: number, Title: string, Options: number | BrowseInfoFlags, RootFolder?: string | ShellSpecialFolderConstants): Folder3; + + /** Determine if the current user can start/stop the named service. */ + CanStartStopService(ServiceName: string): boolean; + + /** Cascade Windows */ + CascadeWindows(): void; + + /* + * Runs the specified Control Panel (*.cpl) application. If the application is already open, it will activate the running instance. + * + * **Note** As of Windows Vista, most Control Panel applications are Shell items and cannot be opened with this function. To open those Control Panel applications, pass the canonical name to + * `control.exe`. For example: + * + * `control.exe /name Microsoft.Personalization` + */ + ControlPanelItem(bstrDir: string): void; + + /** Eject the pc */ + EjectPC(): void; + + /** Explore a folder */ + Explore(vDir: string | ShellSpecialFolderConstants): void; + + /** + * Return explorer policy value + * + * The specified value name must be within the **HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer** subkey. + * If the value name does not exist then the method returns null. + */ + ExplorerPolicy(bstrPolicyName: string): any; + + /** Bring up the file run dialog box */ + FileRun(): void; + + /** Find a computer */ + FindComputer(): void; + + /** Find Files */ + FindFiles(): void; + + /** Find a Printer in the Directory Service */ + FindPrinter(Name?: string, location?: string, model?: string): void; + + /** Return shell global setting */ + GetSetting(lSetting: number | SettingKey): boolean; + + /** + * `DirectoryServiceAvailable` -- Returns **true** if the directory service is available + * + * `IsOS_DomainMember` -- Returns **true** if the computer is a member of a domain (_Windows XP and later_) + * + * `IsOS_Personal` -- Returns **true** if the operating system is Windows XP Home Edition (_Windows XP only_) + * + * `IsOS_Professional` -- Returns **true** if the operating system is Windows XP Professional Edition (_Windows XP only_) + */ + GetSystemInformation(Name: 'DirectoryServiceAvailable' | 'IsOS_DomainMember' | 'IsOS_Personal' | 'IsOS_Professional'): boolean; + + /** + * `DoubleClickTime` -- The double-click time, in milliseconds + * + * `PhysicalMemoryInstalled` -- The amount of physical memory installed, in bytes + * + * `ProcessorArchitecture` -- The processor architecture. For details, see the discussion of the **wProcessorArchitecture** member of the + * [`SYSTEM_INFO`](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724958.aspx) structure + * + * `ProcessorLevel` -- The processor level. Returns 3, 4, or 5, for x386, x486, and Pentium-level processors, respectively (_Windows Vista and later_) + * + * `ProcessorSpeed` -- The processor speed, in megahertz (MHz) + */ + GetSystemInformation(Name: 'DoubleClickTime' | 'PhysicalMemoryInstalled' | 'ProcessorArchitecture' | 'ProcessorLevel' | 'ProcessorSpeed'): number; + + /** Display shell help */ + Help(): void; + + /** get restriction settings */ + IsRestricted(Group: string, Restriction: string): number; + + /** Determine if a service is running by name. */ + IsServiceRunning(ServiceName: string): any; + + /** Minimize all windows */ + MinimizeAll(): void; + + /** Get special folder from ShellSpecialFolderConstants */ + NameSpace(vDir: string | ShellSpecialFolderConstants): Folder3 | null; + + /** Open a folder */ + Open(vDir: string | ShellSpecialFolderConstants): void; + + /** Get Parent object */ + readonly Parent: any; + + /** Refresh the menu */ + RefreshMenu(): void; + + /** Immersive Search */ + SearchCommand(): void; + + /** + * Start a service by name, and optionally set it to autostart. + * + * The method returns `false` if the service has already been started. Before calling this method, you can call + * [Shell.IsServiceRunning](https://msdn.microsoft.com/en-us/library/windows/desktop/gg537742.aspx) to ascertain the status of the service. + */ + ServiceStart(ServiceName: string, Persistent?: boolean): boolean; + + /** + * Stop a service by name, and optionally disable autostart. + * + * The method returns `false` if the service has already been stopped. Before calling this method, you can call + * [Shell.IsServiceRunning](https://msdn.microsoft.com/en-us/library/windows/desktop/gg537742.aspx) to ascertain the status of the service. + */ + ServiceStop(ServiceName: string, Persistent?: boolean): boolean; + + /** Displays the **Date and Time Properties** dialog box. */ + SetTime(): void; + + /** + * Execute generic command + * @param sFile A string that contains the name of the file on which `ShellExecute` will perform the action specified by `vOperation`. + * @param [vArgs] A string that contains parameter values for the operation. + * @param [vDir] The fully qualified path of the directory that contains the file specified by `sFile`. If this parameter is not specified, the current working directory is used. + * @param [vOperation] The operation to be performed. This value is set to one of the verb strings that is supported by the file. If this parameter is not specified, the default operation is + * performed. + * @param [vShow] A recommendation as to how the application window should be displayed initially. The application can ignore this recommendation. + */ + ShellExecute(File: string, vArgs?: string, vDir?: string, vOperation?: string, vShow?: ShellExecuteShow): void; + + /** Show/Hide browser bar. */ + ShowBrowserBar(bstrClsid: ExplorerBarCLSID, bShow: boolean): any; + + /** Exit Windows */ + ShutdownWindows(): void; + + /** Tile windows horizontally */ + TileHorizontally(): void; + + /** Tile windows vertically */ + TileVertically(): void; + + /** Raise/lower the desktop */ + ToggleDesktop(): void; + + /** Displays the **Taskbar and Start Menu Properties** dialog box. */ + TrayProperties(): void; + + /** Undo Minimize All */ + UndoMinimizeALL(): void; + + /** The collection of open folder windows */ + Windows(): ShellWindows; + + /** Displays the **Windows Security** dialog box. */ + WindowsSecurity(): void; + + /** Displays your open windows in a 3D stack that you can flip through. */ + WindowSwitcher(): void; + } + + /** ShellDispatch Load in Shell Context */ + class ShellDispatchInproc { + private 'Shell32.ShellDispatchInproc_typekey': ShellDispatchInproc; + private constructor(); + } + + /** Shell Folder Item */ + class ShellFolderItem { + private 'Shell32.ShellFolderItem_typekey': ShellFolderItem; + private constructor(); + + /** Get Application object */ + readonly Application: any; + + /** Access an extended property */ + ExtendedProperty(bstrPropName: string): any; + + /** If item is a folder return folder object */ + readonly GetFolder: Folder3 | null; + + /** If item is link return link object */ + readonly GetLink: ShellLinkObject | null; + + /** + * Execute a command on the item. + * Must be one of the values returned by the item's `FolderItemVerb.Name` property. + * If no verb is specified, the default verb will be invoked. + */ + InvokeVerb(vVerb?: string): void; + + /** + * Extended version of InvokeVerb + * @param vVerb String that corresponds to the command to be executed. If no verb is specified, the default verb is executed. + * @param vArgs String with one or more arguments to the command specified by vVerb. The format of this string depends on the particular verb. + */ + InvokeVerbEx(vVerb?: string, vArgs?: string): void; + + /** Indicates if the item can be hosted inside a browser or Windows Explorer frame. */ + readonly IsBrowsable: boolean; + + /** Is the item a file system object? */ + readonly IsFileSystem: boolean; + + /** Is the item a Folder? */ + readonly IsFolder: boolean; + + /** Is the item a link? */ + readonly IsLink: boolean; + + /** Modification Date? */ + ModifyDate: VarDate; + + /** Get display name for item */ + Name: string; + + /** Get Parent object */ + readonly Parent: any; + + /** Get the pathname to the item */ + readonly Path: string; + + /** Size */ + readonly Size: number; + + /** Contains a string representation of the item's type */ + readonly Type: string; + + /** Get the list of verbs for the object */ + Verbs(): FolderItemVerbs; + } + + /** Shell Folder View Object */ + class ShellFolderView { + private 'Shell32.ShellFolderView_typekey': ShellFolderView; + private constructor(); + + /** Get Application object */ + readonly Application: any; + + /** Get Current View Mode */ + CurrentViewMode: number; + + /** Filter View */ + FilterView(bstrFilterText: string): void; + + /** The currently focused item in the folder */ + readonly FocusedItem: ShellFolderItem; + + /** Get the folder being viewed */ + readonly Folder: Folder3; + + /** Get Folder Flags */ + FolderFlags: number; + + /** Get Group By Column */ + GroupBy: string; + + /** Set Icon Size */ + IconSize: number; + + /** Show items menu and return command selected */ + PopupItemMenu(pfi: ShellFolderItem, vx?: any, vy?: any): string; + + /** The collection of Selected Items in folder */ + SelectedItems(): FolderItems3; + + /** Select the item */ + SelectItem(pvfi: ShellFolderItem, dwFlags: ShellFolderViewSelectItem): void; + + /** Select Item relative to the Current Item */ + SelectItemRelative(iRelative: number): void; + + /** Get Sorting Columns */ + SortColumns: string; + + /** Returns the view options for showing a folder. */ + readonly ViewOptions: ShellFolderViewOptions; + } + + /** + * The **ShellFolderView** object fires two events, **EnumDone** and **SelectionChanged**, that are typically handled by applications. However, some applications + * must handle events from a series of **ShellFolderView** objects. For example, an application might host a **WebBrowser** control that allows users to navigate through + * a series of folders. Each folder has its own **ShellFolderView** object with its associated events. Handling these events can be difficult. + * + * The **ShellFolderViewOC** object simplifies event handling for such scenarios. It allows applications to handle events for all ShellFolderView objects with a single + * pair of **ShellFolderViewOC** event handlers. Each time the user navigates to a new folder, the application passes the associated **ShellFolderView** object to the + * **ShellFolderViewOC** object by calling **SetFolderView**. Then, when an **EnumDone** or **SelectionChanged** event is fired, the **ShellFolderViewOC** object + * forwards the event to its own handler for processing. + */ + class ShellFolderViewOC { + private 'Shell32.ShellFolderViewOC_typekey': ShellFolderViewOC; + private constructor(); + + /** Set the ShellFolderView object to monitor events of. */ + SetFolderView(pdisp: ShellFolderView): void; + } + + /** Shell Link object */ + class ShellLinkObject { + private 'Shell32.ShellLinkObject_typekey': ShellLinkObject; + private constructor(); + + /** Arguments for the link */ + Arguments: string; + + /** Description of the link */ + Description: string; + + /** Get the IconLocation for the link */ + GetIconLocation(pbs: string): number; + + /** Hotkey for the link */ + Hotkey: number; + + /** Fully qualified path of the link */ + Path: string; + + /** Tell the link to resolve itself */ + Resolve(fFlags: ShellLinkResolveFlags): void; + + /** + * Tell the link to save the changes + * @param sFile The fully qualified path of the file where the new link information is to be saved. If no file is specified, the current file is used. + */ + Save(vWhere?: string): void; + + /** + * Set the IconLocation for the link + * @param sPath The fully qualified path of the file that contains the icon. + * @param iIcon The index of the icon in the file specified by _sPath_. + */ + SetIconLocation(sPath: string, iIcon: number): void; + + /** Get the Show Command for the link */ + ShowCommand: LinkShowWindowState; + + /** Get the target of a link object */ + readonly Target: ShellFolderItem | null; + + /** Get the working directory for the link */ + WorkingDirectory: string; + } + + class ShellWindows { + private 'Shell32.ShellWindows_typekey': ShellWindows; + private constructor(); + + /** + * Retrieves an InternetExplorer object that represents the Shell window. + * @param index Default is 0 + */ + Item(index?: number): SHDocVw.InternetExplorer; + + /** Contains the number of items in the collection. */ + readonly Count: number; + } +} + +interface ActiveXObject { + on( + obj: Shell32.ShellFolderView, event: 'BeginDrag' | 'DefaultVerbInvoked' | 'EnumDone' | 'SelectionChanged' | 'VerbInvoked', handler: ( + this: Shell32.ShellFolderView, parameter: {}) => void): void; + on( + obj: Shell32.ShellFolderViewOC, event: 'BeginDrag' | 'DefaultVerbInvoked' | 'EnumDone' | 'SelectionChanged' | 'VerbInvoked', + handler: (this: Shell32.ShellFolderViewOC, parameter: {}) => void): void; + new (progid: K): ActiveXObjectNameMap[K]; +} + +interface ActiveXObjectNameMap { + 'Shell.Application': Shell32.Shell; + 'Shell.FolderView': Shell32.ShellFolderViewOC; +} + +interface EnumeratorConstructor { + new(col: Shell32.FolderItems3): Enumerator; + new(col: Shell32.FolderItemVerbs): Enumerator; + new(col: Shell32.ShellWindows): Enumerator; +} diff --git a/types/activex-shell/package.json b/types/activex-shell/package.json new file mode 100644 index 0000000000..d9b1031263 --- /dev/null +++ b/types/activex-shell/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "activex-helpers": "*" + } +} \ No newline at end of file diff --git a/types/activex-shell/tsconfig.json b/types/activex-shell/tsconfig.json new file mode 100644 index 0000000000..f4b549f649 --- /dev/null +++ b/types/activex-shell/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5", + "scripthost" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "activex-shell-tests.ts" + ] +} \ No newline at end of file diff --git a/types/activex-shell/tslint.json b/types/activex-shell/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/activex-shell/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/activex-stdole/tslint.json b/types/activex-stdole/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-stdole/tslint.json +++ b/types/activex-stdole/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/activex-vbide/tslint.json b/types/activex-vbide/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-vbide/tslint.json +++ b/types/activex-vbide/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index d8046ef319..c33385af14 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -1,79 +1,505 @@ +// Note -- running these tests under cscript requires some ES5 polyfills + +const collectionToArray = (col: { Item(key: any): T }): T[] => { + const results: T[] = []; + const enumerator = new Enumerator(col); + enumerator.moveFirst(); + while (!enumerator.atEnd()) { + results.push(enumerator.item()); + enumerator.moveNext(); + } + return results; +}; + // source -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms630826(v=vs.85).aspx +{ + const cd = new ActiveXObject('WIA.CommonDialog'); + const dm = new ActiveXObject('WIA.DeviceManager'); -// Convert a file -let commonDialog = new ActiveXObject('WIA.CommonDialog'); -let img = commonDialog.ShowAcquireImage(); + // Download new items as they are created + { + dm.RegisterEvent(WIA.EventID.wiaEventItemCreated, WIA.Miscellaneous.wiaAnyDeviceID); + ActiveXObject.on(dm, 'OnEvent', ['EventID', 'DeviceID', 'ItemID'], x => { + const dev = dm.DeviceInfos(x.DeviceID).Connect(); + const itm = dev.GetItem(x.ItemID); + const img = cd.ShowTransfer(itm); + const v = img.FileData; + // Picture type not available in Javascript + }); + } -// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these: -let jpegFormatID = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}'; -if (img.FormatID !== jpegFormatID) { - const ip = new ActiveXObject('WIA.ImageProcess'); - ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID); - ip.Filters.Item(1).Properties.Item('FormatID').Value = jpegFormatID; - img = ip.Apply(img); -} -// with this: -/*if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) { - let ip = new ActiveXObject('WIA.ImageProcess'); - ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID); - ip.Filters.Item(1).Properties.Item('FormatID').Value = WIA.FormatID.wiaFormatJPEG; - img = ip.Apply(img); -}*/ - -// Take a picture -let dev = commonDialog.ShowSelectDevice(); -if (dev.Type === WIA.WiaDeviceType.CameraDeviceType) { - // when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these: - const commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}'; - const itm = dev.ExecuteCommand(commandID); - - // with this: - // let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture); -} - -// Display detailed property information -dev = commonDialog.ShowSelectDevice(); -let e = new Enumerator(dev.Properties); // no foreach over ActiveX collections -e.moveFirst(); -while (!e.atEnd()) { - const p = e.item(); - let s = `${p.Name} (${p.PropertyID}) = `; - if (p.IsVector) { - s += '[vector of data]'; - } else { - s += p.Value; - if (p.SubType !== WIA.WiaSubType.UnspecifiedSubType) { - if (p.Value !== p.SubTypeDefault) { - s += ` (Default = ${p.SubTypeDefault})`; - } + // Convert a file + { + let img = cd.ShowAcquireImage(); + if (img && img.FormatID !== WIA.FormatID.wiaFormatJPEG) { + const ip = new ActiveXObject('WIA.ImageProcess'); + ip.Filters.Add(ip.FilterInfos('Convert').FilterID); + ip.Filters(1).Properties('FormatID').Value = WIA.FormatID.wiaFormatJPEG; + img = ip.Apply(img); } } - if (p.IsReadOnly) { - s += ' [READ ONLY]'; - } else { - switch (p.SubType) { - case WIA.WiaSubType.FlagSubType: - case WIA.WiaSubType.ListSubType: - if (p.SubType === WIA.WiaSubType.FlagSubType) { - s += ' [valid flags include: '; + // Take a picture + { + const dev = cd.ShowSelectDevice(); + if (dev && dev.Type === WIA.WiaDeviceType.CameraDeviceType) { + const item = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture); + } + } + + // Display detailed property information + { + const dev = cd.ShowSelectDevice(); + if (dev) { + collectionToArray(dev.Properties).forEach(p => { + let s = `${p.Name} (${p.PropertyID}) = `; + if (p.IsVector) { + s += '[vector of data]'; } else { - s += ' [valid values include: '; - } - const count = p.SubTypeValues.Count; - for (let i = 1; i <= count; i++) { - s += p.SubTypeValues.Item(i); - if (i < count) { - s += ', '; + s += p.Value; + if (p.SubType !== WIA.WiaSubType.UnspecifiedSubType + && p.Value !== p.SubTypeDefault) { + s += ` (Default = ${p.SubTypeDefault})`; } } - s += ']'; - break; - case WIA.WiaSubType.RangeSubType: - s += ` [valid values in the range from ${p.SubTypeMin} to ${p.SubTypeMax} in increments of ${p.SubTypeStep}]`; - break; + + if (p.IsReadOnly) { + s += ' [READ ONLY]'; + } else { + switch (p.SubType) { + case WIA.WiaSubType.FlagSubType: + case WIA.WiaSubType.ListSubType: + const count = p.SubTypeValues.Count; + const items: string[] = []; + for (let i = 1; i <= count; i++) { + items.push(p.SubTypeValues(i)); + } + const descr = p.SubType === WIA.WiaSubType.FlagSubType ? 'flags' : 'values'; + s += ` [valid ${descr} include: ${items.join(',')}]`; + break; + case WIA.WiaSubType.RangeSubType: + s += ` [valid values in the range from ${p.SubTypeMin} to ${p.SubTypeMax} in increments of ${p.SubTypeStep}]`; + break; + } + } + + WScript.Echo(s); + }); } } - WScript.Echo(s); + // Determine whether the selected device is a camera + { + const dev = cd.ShowSelectDevice(); + if (dev && dev.Type === WIA.WiaDeviceType.CameraDeviceType) { + WScript.Echo('Selectd device is a camera'); + } + } + + // Count root - level images for transfer + { + const dev = cd.ShowSelectDevice(); + if (dev) { + const count = collectionToArray(dev.Items).filter(f => { + const imageFlag = WIA.WiaItemFlag.ImageItemFlag; + return (f.Properties('Item Flags').Value & imageFlag) === imageFlag; + }).length; + WScript.Echo(`Selected device has ${count} top-level images`); + } + } + + // Display all imagefile properties + { + const img = cd.ShowAcquireImage(); + if (img) { + collectionToArray(img.Properties).forEach(p => { + let contents = ''; + if (p.IsVector) { + contents = '[vector data not emitted]'; + } else if (p.Type === WIA.WiaImagePropertyType.RationalImagePropertyType) { + contents = `${p.Value.Nunerator}/${p.Value.Denominator}`; + } else if (p.Type === WIA.WiaImagePropertyType.StringImagePropertyType) { + contents = `"${p.Value}"`; + } else { + contents = p.Value; + } + WScript.Echo(`${p.Name} (${p.PropertyID}) = ${contents}`); + }); + } + } + + // Determine the event type + { + const dev = cd.ShowSelectDevice(); + if (dev) { + const actionEvent = WIA.WiaEventFlag.ActionEvent; + collectionToArray(dev.Events).forEach(e => { + const msg = (e.Type & actionEvent) === actionEvent ? + `${e.Name} is an Action event` : + `${e.Name} is not an Action event`; + WScript.Echo(msg); + }); + } + } + + // Set rational numerator and denominator + { + const r = new ActiveXObject('WIA.Rational'); + r.Numerator = 1; + r.Denominator = 3; + WScript.Echo(`1/3 = ${r.Value}`); + r.Numerator = 2; + r.Denominator = 6; + WScript.Echo(`2/6 = ${r.Value}`); + } + + // Create and initialize a vector object + { + const v: WIA.Vector = new ActiveXObject('WIA.Vector'); + v.SetFromString('This is a test', true, false); + + // when iterated using Enumerator / collectionToArray, each item comes back as an Automation Byte + // https://stackoverflow.com/questions/48757982/wia-vector-returns-something-which-is-not-a-number + // so the following falls, because fromCharCode is expecting a number + // collectionToArray(v).forEach(item => WScript.Echo(String.fromCharCode(item))); + + // Instead, use the Vector's Item method, or the Vector's default property: + for (let i = 1; i <= v.Count; i++) { + WScript.Echo(String.fromCharCode(v(i))); + } + } + + // Display detailed image information + { + const img = new ActiveXObject('WIA.ImageFile'); + img.LoadFile('c:\\windows\\web\\Screen\\img102.jpg'); + + let s = ` +Width = ${img.Width} +Height = ${img.Height} +Depth = ${img.PixelDepth} +Horizontal resolution = ${img.HorizontalResolution} +Vertical resolution = ${img.VerticalResolution} +Frame count = ${img.FrameCount}} + `.trim(); + + let arr: string[] = []; + + if (img.IsIndexedPixelFormat) { arr.push('Pixel data contains palette indexes'); } + if (img.IsAlphaPixelFormat) { arr.push('Pixel data has alpha information'); } + if (img.IsExtendedPixelFormat) { arr.push('Pixel data has extended color information (16 bit/channel)'); } + if (img.IsAnimated) { arr.push('Image is animated'); } + + const propertyTests = [40091, 40092, 40093, 40094, 40095] + .filter(n => img.Properties.Exists(n)) + .map(n => { + const prp = img.Properties(n); + return `${prp.Name} = ${prp.Value.String}`; + }); + arr = arr.concat(propertyTests); + + if (arr.length) { + s += '\n' + arr.join('\n'); + } + + WScript.Echo(s); + } + + // Create an imageprocess object and enumerate filters + { + const ip = new ActiveXObject('WIA.ImageProcess'); + collectionToArray(ip.FilterInfos).forEach(fi => { + const s = [ + fi.Name, + new Array(51).join('='), + fi.Description + ].join('\n'); + WScript.Echo(s); + }); + } + + // Create an imageprocess object and create one of each available filter + { + const ip = new ActiveXObject('WIA.ImageProcess'); + + const stringValue = (v: any) => { + if (typeof v === 'string') { return `"${v}"`; } + return v; + }; + + const listValues = (v: any) => collectionToArray(v).join(', '); + + const listProperties = (filter: WIA.Filter) => { + let s = [ + `${filter.Name} (${filter.FilterID})`, + new Array(51).join('='), + filter.Description, + new Array(51).join('=') + ].map(line => line + '\n').join(''); + + s += collectionToArray(filter.Properties).map(p => { + let contents: string; + + switch (typeof p.Value) { + // these case clauses replace the IsObject function in VB6/VBScript + case 'boolean': + case 'string': + case 'number': + contents = stringValue(p.Value); + default: + switch (p.SubType) { + case WIA.WiaSubType.FlagSubType: + contents = ` // [valid values formed by using the OR operator with the following bit flags: ${listValues(p.SubTypeValues)}]`; + break; + case WIA.WiaSubType.ListSubType: + contents = ` // [valid values from the following list: ${listValues(p.SubTypeValues)}]`; + break; + case WIA.WiaSubType.RangeSubType: + contents = ` // [valid values between ${p.SubTypeMin} and ${p.SubTypeMax}, with a step of ${p.SubTypeStep}]`; + break; + default: + contents = ''; + break; + } + } + + return `ip.Filters(1).Properties("${p.Name}") = ${contents}`; + }).join('\n'); + + WScript.Echo(s); + }; + + collectionToArray(ip.FilterInfos).forEach(fi => { + ip.Filters.Add(fi.FilterID); + listProperties(ip.Filters(1)); + ip.Filters.Remove(1); + }); + } + + // List the supported transfer formats + { + const stringFormat = (fld: string) => { + switch (fld) { + case WIA.FormatID.wiaFormatBMP: return 'BMP'; + case WIA.FormatID.wiaFormatPNG: return 'PNG'; + case WIA.FormatID.wiaFormatGIF: return 'GIF'; + case WIA.FormatID.wiaFormatJPEG: return 'JPEG'; + case WIA.FormatID.wiaFormatTIFF: return 'TIFF'; + default: return 'Unknown'; + } + }; + + const dev = cd.ShowSelectDevice(); + const items = dev && cd.ShowSelectItems(dev, WIA.WiaImageIntent.UnspecifiedIntent, WIA.WiaImageBias.MaximizeQuality, true); + if (items) { + WScript.Echo(collectionToArray(items(1).Formats).map(stringFormat).join(', ')); + } + } + + // Enumerate supported commands in commands collection + { + const dev = cd.ShowSelectDevice(); + if (dev && collectionToArray(dev.Commands).some(dc => dc.CommandID === WIA.CommandID.wiaCommandTakePicture)) { + WScript.Echo('Selected device supports the TakePicture command'); + } + } + + // Enumerate root - level items and display their names + { + const dev = cd.ShowSelectDevice(); + if (dev) { + collectionToArray(dev.Items).forEach(item => { + let s: string = item.Properties("Item Name").Value; + if (item.Properties.Exists("Item Time Stamp")) { + const v: WIA.Vector = item.Properties("Item Time Stamp").Value; + if (v.Count === 8) { s += ` (${v.Date})`; } + } + WScript.Echo(s); + }); + } + } + + // Determine the number of items returned by ShowSelectItems + { + const dev = cd.ShowSelectDevice(); + const items = dev && cd.ShowSelectItems(dev, WIA.WiaImageIntent.UnspecifiedIntent, WIA.WiaImageBias.MaximizeQuality, true); + if (items) { + WScript.Echo(`You selected ${items.Count} items`); + } + } + + // Enumerate all the supported events for the selected device + { + const dev = cd.ShowSelectDevice(); + if (dev) { + const msg = collectionToArray(dev.Events) + .map(e => `\n${e.Name} (${e.EventID}): ${e.Description}`) + .join(''); + WScript.Echo('The selected device supports the following events: ' + msg); + } + } + + // List all available devices by name and deviceid + collectionToArray(dm.DeviceInfos).forEach(di => { + const name: string = di.Properties("Name").Value; + WScript.Echo(`${name} (${di.DeviceID})`); + }); + + // Display all the properties for the selected device + { + const dev = cd.ShowSelectDevice(); + if (dev) { + collectionToArray(dev.Properties).forEach(p => { + const name = `${p.Name} (${p.PropertyID})`; + let contents: string; + if (p.IsVector) { + contents = '[vector of data]'; + } else if (p.Type === WIA.WiaPropertyType.StringPropertyType) { + contents = `"${p.Value}"`; + } else { + contents = p.Value; + } + WScript.Echo(`${name} = ${contents}`); + }); + } + } + + // Enumerate the supported commands + { + const dev = cd.ShowSelectDevice(); + const items = dev && cd.ShowSelectItems(dev, WIA.WiaImageIntent.UnspecifiedIntent, WIA.WiaImageBias.MaximizeQuality, true); + if (items) { + const msg = collectionToArray(items(1).Commands) + .map(c => `${c.Name}: ${c.Description}\n`) + .join(''); + WScript.Echo(`The selected item supports the following commands:\n${msg}`); + } + } + + // Create an imagefile object that contains a blank page + { + // This fails with the error: `The Vector's Type is not compatible with this operation` + /*const c = 0xFF0000FF; + const v: WIA.Vector = new ActiveXObject('WIA.Vector'); + for (let i = 0; i < 4; i++) { + v.Add(c); + } + const img = v.ImageFile(2, 2); + img.SaveFile('C:\\test.' + img.FileExtension);*/ + } + + interface WshArgumentsBase { + Item(index: TKey): string; + (index: TKey): string; + length: number; + Count(): number; + } + + interface WshArguments extends WshArgumentsBase { // not sure if WshArguments takes a string as well, or only a number + Named: WshArgumentsBase; + Unnamed: WshArgumentsBase; + ShowUsage(): void; + } + + // Implement a windows script host script that runs automatically + { + const args = collectionToArray(WScript.Arguments as WshArguments) + .map(arg => arg.toLowerCase()); + + switch (args.length) { + case 1: + case 2: + const command = `${WScript.FullName} "${WScript.ScriptFullName}" connect`; + const name = 'QuickTransfer'; + const title = 'Quick Scripting Transfer'; + const icon = `${WScript.FullName}, 0`; + const eventID = WIA.EventID.wiaEventDeviceConnected; + const deviceID = args.length === 2 ? args[1] : WIA.Miscellaneous.wiaAnyDeviceID; + + if (args[0] === 'register') { + WScript.Echo('Registering event handler'); + dm.RegisterPersistentEvent(command, name, title, icon, eventID, deviceID); + WScript.Quit(); + } else if (args[0] === 'unregister') { + WScript.Echo('Unregistering event handler'); + dm.UnregisterPersistentEvent(command, name, title, icon, eventID, deviceID); + WScript.Quit(); + } + break; + case 3: + if (args[0] === 'connect') { + const deviceID = args[1].substr(12); + const device = dm.DeviceInfos(deviceID).Connect(); + collectionToArray(device.Items).forEach(item => { + const img = item.Transfer(); + img.SaveFile(`C:\\${item.Properties('Item Name').Value}.${img.FileExtension}`); + + // Uncomment the following lines to remove the picture from the camera after transfer + for (let i = 1; i < device.Items.Count; i++) { + const item2 = device.Items(i); + if (item2.ItemID !== item.ItemID) { continue; } + try { + // some cameras don't support deleting a picture + device.Items.Remove(i); + } catch (error) { + WScript.Echo(error); + } + } + }); + WScript.Quit(); + } + break; + } + + const usage = ` +Usage: + +To register, type: + + ${WScript.ScriptName} register [] + +To unregister, type: + + ${WScript.ScriptName} unregister [] + +Available device ids: +${collectionToArray(dm.DeviceInfos) + .map(device => `${device.DeviceID} '${device.Properties("Name").Value}'`) + .join('\n')} + `.trim(); + + WScript.Echo(usage); + } + + // Count the number of child items available for transfer + { + const device = cd.ShowSelectDevice(); + const items = device && cd.ShowSelectItems(device, WIA.WiaImageIntent.UnspecifiedIntent, WIA.WiaImageBias.MaximizeQuality, true); + const item = items && items(1); + if (item) { + const count = collectionToArray(item.Items).filter(childItem => { + const flags = childItem.Properties('Item Flags').Value as number; + return (flags & WIA.WiaItemFlag.TransferItemFlag) === WIA.WiaItemFlag.TransferItemFlag; + }).length; + WScript.Echo(`Selected device has ${count} child items that can be transferred.`); + } + } + + // Use a vector object + { + const v: WIA.Vector = new ActiveXObject('WIA.Vector'); + v.Add(1); + v.Add(42); + v.Add(3); + v.Remove(1); + v.Remove(2); + WScript.Echo(`v(1) = ${v(1)}`); + v.Clear(); + v.Add('This'); + v.Add('is'); + v.Add('Cool'); + v.Remove(1); + v.Remove(2); + WScript.Echo(`v(1) = ${v(1)}`); + } } diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts index 7d7cbae727..18e474e09c 100644 --- a/types/activex-wia/index.d.ts +++ b/types/activex-wia/index.d.ts @@ -2,22 +2,20 @@ // Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Typescript Version: 2.4 +// TypeScript Version: 2.6 declare namespace WIA { /** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */ - // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) - /*const enum CommandID { + const enum CommandID { wiaCommandChangeDocument = '{04E725B0-ACAE-11D2-A093-00C04F72DC3C}', wiaCommandDeleteAllItems = '{E208C170-ACAD-11D2-A093-00C04F72DC3C}', wiaCommandSynchronize = '{9B26B7B2-ACAD-11D2-A093-00C04F72DC3C}', wiaCommandTakePicture = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}', - wiaCommandUnloadDocument = '{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}' - }*/ + wiaCommandUnloadDocument = '{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}', + } /** String versions of globally unique identifiers (GUIDs) that identify DeviceManager events. */ - // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) - /*const enum EventID { + const enum EventID { wiaEventDeviceConnected = '{A28BBADE-64B6-11D2-A231-00C04FA31809}', wiaEventDeviceDisconnected = '{143E4E83-6497-11D2-A231-00C04FA31809}', wiaEventItemCreated = '{4C8F4EF5-E14F-11D2-B326-00C04F68CE61}', @@ -30,50 +28,48 @@ declare namespace WIA { wiaEventScanImage3 = '{154E27BE-B617-4653-ACC5-0FD7BD4C65CE}', wiaEventScanImage4 = '{A65B704A-7F3C-4447-A75D-8A26DFCA1FDF}', wiaEventScanOCRImage = '{9D095B89-37D6-4877-AFED-62A297DC6DBE}', - wiaEventScanPrintImage = '{B441F425-8C6E-11D2-977A-0000F87A926F}' - }*/ + wiaEventScanPrintImage = '{B441F425-8C6E-11D2-977A-0000F87A926F}', + } /** String versions of globally unique identifiers (GUIDs) that indicate the file format of an image. */ - // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) - /*const enum FormatID { + const enum FormatID { wiaFormatBMP = '{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}', wiaFormatGIF = '{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}', wiaFormatJPEG = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}', wiaFormatPNG = '{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}', - wiaFormatTIFF = '{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}' - }*/ + wiaFormatTIFF = '{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}', + } /** Miscellaneous string constants */ - // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) - /*const enum Miscellaneous { + const enum Miscellaneous { wiaAnyDeviceID = '*', - wiaIDUnknown = '{00000000-0000-0000-0000-000000000000}' - }*/ + wiaIDUnknown = '{00000000-0000-0000-0000-000000000000}', + } /** * The WiaDeviceType enumeration specifies the type of device attached to a user's computer. Use the Type property on the DeviceInfo object or the Device - * object to obtain these values from the device. + * object to obtain these values from the device. */ const enum WiaDeviceType { CameraDeviceType = 2, ScannerDeviceType = 1, UnspecifiedDeviceType = 0, - VideoDeviceType = 3 + VideoDeviceType = 3, } /** - * A DeviceEvent's type is composed of bits from the WiaEventFlags enumeration. You can test a DeviceEvent's type by using the AND operation with DeviceEv - * ent.Type and a member from the WiaEventFlags enumeration. + * A DeviceEvent's type is composed of bits from the WiaEventFlags enumeration. You can test a DeviceEvent's type by using the AND operation with + * DeviceEvent.Type and a member from the WiaEventFlags enumeration. */ const enum WiaEventFlag { ActionEvent = 2, - NotificationEvent = 1 + NotificationEvent = 1, } /** The WiaImageBias enumeration helps specify what type of data the image is intended to represent. */ const enum WiaImageBias { MaximizeQuality = 131072, - MinimizeSize = 65536 + MinimizeSize = 65536, } /** The WiaImageIntent enumeration helps specify what type of data the image is intended to represent. */ @@ -81,12 +77,12 @@ declare namespace WIA { ColorIntent = 1, GrayscaleIntent = 2, TextIntent = 4, - UnspecifiedIntent = 0 + UnspecifiedIntent = 0, } /** - * The WiaImagePropertyType enumeration specifies the type of the value of an image property. Image properties can be found in the Properties collection o - * f an ImageFile object. + * The WiaImagePropertyType enumeration specifies the type of the value of an image property. Image properties can be found in the Properties collection + * of an ImageFile object. */ const enum WiaImagePropertyType { ByteImagePropertyType = 1001, @@ -103,12 +99,12 @@ declare namespace WIA { VectorOfUndefinedImagePropertyType = 1100, VectorOfUnsignedIntegersImagePropertyType = 1102, VectorOfUnsignedLongsImagePropertyType = 1104, - VectorOfUnsignedRationalsImagePropertyType = 1106 + VectorOfUnsignedRationalsImagePropertyType = 1106, } /** - * An Item's type is composed of bits from the WiaItemFlags enumeration. You can test an Item's type by using the AND operation with Item.Properties("Item - * Flags") and a member from the WiaItemFlags enumeration. + * An Item's type is composed of bits from the WiaItemFlags enumeration. You can test an Item's type by using the AND operation with + * Item.Properties("Item Flags") and a member from the WiaItemFlags enumeration. */ const enum WiaItemFlag { AnalyzeItemFlag = 16, @@ -129,12 +125,12 @@ declare namespace WIA { StorageItemFlag = 4096, TransferItemFlag = 8192, VideoItemFlag = 65536, - VPanoramaItemFlag = 1024 + VPanoramaItemFlag = 1024, } /** - * The WiaPropertyType enumeration specifies the type of the value of an item property. Item properties can be found in the Properties collection of a Dev - * ice or Item object. + * The WiaPropertyType enumeration specifies the type of the value of an item property. Item properties can be found in the Properties collection of a + * Device or Item object. */ const enum WiaPropertyType { BooleanPropertyType = 1, @@ -173,28 +169,31 @@ declare namespace WIA { VectorOfUnsignedIntegersPropertyType = 104, VectorOfUnsignedLargeIntegersPropertyType = 109, VectorOfUnsignedLongsPropertyType = 106, - VectorOfVariantsPropertyType = 119 + VectorOfVariantsPropertyType = 119, } /** - * The WiaSubType enumeration specifies more detail about the property value. Use the SubType property on the Property object to obtain these values for t - * he property. + * The WiaSubType enumeration specifies more detail about the property value. Use the SubType property on the Property object to obtain these values for + * the property. */ const enum WiaSubType { FlagSubType = 3, ListSubType = 2, RangeSubType = 1, - UnspecifiedSubType = 0 + UnspecifiedSubType = 0, } /** * The CommonDialog control is an invisible-at-runtime control that contains all the methods that display a User Interface. A CommonDialog control can be - * created using "WIA.CommonDialog" in a call to CreateObject or by dropping a CommonDialog on a form. + * created using "WIA.CommonDialog" in a call to CreateObject or by dropping a CommonDialog on a form. */ - interface CommonDialog { + class CommonDialog { + private constructor(); + private 'WIA.CommonDialog_typekey': CommonDialog; + /** - * Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile object - * on success, otherwise Nothing + * Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile + * object on success, otherwise Nothing * @param WIA.WiaDeviceType [DeviceType=0] * @param WIA.WiaImageIntent [Intent=0] * @param WIA.WiaImageBias [Bias=131072] @@ -203,11 +202,11 @@ declare namespace WIA { * @param boolean [UseCommonUI=true] * @param boolean [CancelError=false] */ - ShowAcquireImage( - DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean): ImageFile; + ShowAcquireImage(DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, + CancelError?: boolean): ImageFile | null; /** Launches the Windows Scanner and Camera Wizard and returns Nothing. Future versions may return a collection of ImageFile objects. */ - ShowAcquisitionWizard(Device: Device): any; + ShowAcquisitionWizard(Device: Device): null; /** * Displays the properties dialog box for the specified Device @@ -222,38 +221,41 @@ declare namespace WIA { ShowItemProperties(Item: Item, CancelError?: boolean): void; /** Launches the Photo Printing Wizard with the absolute path of a specific file or Vector of absolute paths to files */ - ShowPhotoPrintingWizard(Files: any): void; + ShowPhotoPrintingWizard(Files: string | Vector): void; /** - * Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, otherwise - * Nothing + * Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, + * otherwise Nothing * @param WIA.WiaDeviceType [DeviceType=0] * @param boolean [AlwaysSelectDevice=false] * @param boolean [CancelError=false] */ - ShowSelectDevice(DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean): Device; + ShowSelectDevice(DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean): Device | null; /** - * Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an It - * ems collection on success, otherwise Nothing + * Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an + * Items collection on success, otherwise Nothing * @param WIA.WiaImageIntent [Intent=0] * @param WIA.WiaImageBias [Bias=131072] * @param boolean [SingleSelect=true] * @param boolean [UseCommonUI=true] * @param boolean [CancelError=false] */ - ShowSelectItems(Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean): Items; + ShowSelectItems(Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean): Items | null; /** * Displays a progress dialog box while transferring the specified Item to the local machine. See Item.Transfer for additional information. * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] * @param boolean [CancelError=false] */ - ShowTransfer(Item: Item, FormatID?: string, CancelError?: boolean): any; + ShowTransfer(Item: Item, FormatID?: string, CancelError?: boolean): ImageFile; } /** The Device object represents an active connection to an imaging device. */ - interface Device { + class Device { + private constructor(); + private 'WIA.Device_typekey': Device; + /** A collection of all commands for this imaging device */ readonly Commands: DeviceCommands; @@ -264,8 +266,8 @@ declare namespace WIA { readonly Events: DeviceEvents; /** - * Issues the command specified by CommandID to the imaging device. CommandIDs are device dependent. Valid CommandIDs for this Device are contained in the - * Commands collection. + * Issues the command specified by CommandID to the imaging device. CommandIDs are device dependent. Valid CommandIDs for this Device are contained in + * the Commands collection. */ ExecuteCommand(CommandID: string): Item; @@ -280,13 +282,13 @@ declare namespace WIA { /** Returns the Type of Device */ readonly Type: WiaDeviceType; - - /** Returns the underlying IWiaItem interface for this Device object */ - readonly WiaItem: any; } /** The DeviceCommand object describes a CommandID that can be used when calling ExecuteCommand on a Device or Item object. */ - interface DeviceCommand { + class DeviceCommand { + private constructor(); + private 'WIA.DeviceCommand_typekey': DeviceCommand; + /** Returns the commandID for this Command */ readonly CommandID: string; @@ -298,8 +300,8 @@ declare namespace WIA { } /** - * The DeviceCommands object is a collection of all the supported DeviceCommands for an imaging device. See the Commands property of a Device or Item obje - * ct for more details on determining the collection of supported device commands. + * The DeviceCommands object is a collection of all the supported DeviceCommands for an imaging device. See the Commands property of a Device or Item + * object for more details on determining the collection of supported device commands. */ interface DeviceCommands { /** Returns the number of members in the collection */ @@ -307,10 +309,16 @@ declare namespace WIA { /** Returns the specified item in the collection by position */ Item(Index: number): DeviceCommand; + + /** Returns the specified item in the collection by position */ + (Index: number): DeviceCommand; } /** The DeviceEvent object describes an EventID that can be used when calling RegisterEvent or RegisterPersistentEvent on a DeviceManager object. */ - interface DeviceEvent { + class DeviceEvent { + private constructor(); + private 'WIA.DeviceEvent_typekey': DeviceEvent; + /** Returns the event Description */ readonly Description: string; @@ -325,8 +333,8 @@ declare namespace WIA { } /** - * The DeviceEvents object is a collection of all the supported DeviceEvent for an imaging device. See the Events property of a Device object for more det - * ails on determining the collection of supported device events. + * The DeviceEvents object is a collection of all the supported DeviceEvent for an imaging device. See the Events property of a Device object for more + * details on determining the collection of supported device events. */ interface DeviceEvents { /** Returns the number of members in the collection */ @@ -334,13 +342,19 @@ declare namespace WIA { /** Returns the specified item in the collection by position */ Item(Index: number): DeviceEvent; + + /** Returns the specified item in the collection by position */ + (Index: number): DeviceEvent; } /** - * The DeviceInfo object is a container that describes the unchanging (static) properties of an imaging device that is currently connected to the computer - * . + * The DeviceInfo object is a container that describes the unchanging (static) properties of an imaging device that is currently connected to the + * computer. */ - interface DeviceInfo { + class DeviceInfo { + private constructor(); + private 'WIA.DeviceInfo_typekey': DeviceInfo; + /** Establish a connection with this device and return a Device object */ Connect(): Device; @@ -355,59 +369,68 @@ declare namespace WIA { } /** - * The DeviceInfos object is a collection of all the imaging devices currently connected to the computer. See the DeviceInfos property on the DeviceManage - * r object for detail on accessing the DeviceInfos object. + * The DeviceInfos object is a collection of all the imaging devices currently connected to the computer. See the DeviceInfos property on the + * DeviceManager object for detail on accessing the DeviceInfos object. */ interface DeviceInfos { /** Returns the number of members in the collection */ readonly Count: number; /** Returns the specified item in the collection either by position or Device ID */ - Item(Index: any): DeviceInfo; + Item(Index: number | string): DeviceInfo; + + /** Returns the specified item in the collection either by position or Device ID */ + (Index: number | string): DeviceInfo; } /** - * The DeviceManager control is an invisible-at-runtime control that manages the imaging devices connected to the computer. A DeviceManager control can be - * created using "WIA.DeviceManager" in a call to CreateObject or by dropping a DeviceManager on a form. + * The DeviceManager control is an invisible-at-runtime control that manages the imaging devices connected to the computer. A DeviceManager control can + * be created using "WIA.DeviceManager" in a call to CreateObject or by dropping a DeviceManager on a form. */ - interface DeviceManager { + class DeviceManager { + private constructor(); + private 'WIA.DeviceManager_typekey': DeviceManager; + /** A collection of all imaging devices connected to this computer */ readonly DeviceInfos: DeviceInfos; /** * Registers the specified EventID for the specified DeviceID. If DeviceID is "*" then OnEvent will be called whenever the event specified occurs for any - * device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified. + * device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified. * @param string [DeviceID='*'] */ RegisterEvent(EventID: string, DeviceID?: string): void; /** - * Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full pat - * h name and the appropriate command-line arguments needed to invoke the application. + * Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full + * path name and the appropriate command-line arguments needed to invoke the application. * @param string [DeviceID='*'] */ RegisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; /** - * Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called Regis - * terEvent. + * Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called + * RegisterEvent. * @param string [DeviceID='*'] */ UnregisterEvent(EventID: string, DeviceID?: string): void; /** - * Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the Command - * , Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent. + * Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the + * Command, Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent. * @param string [DeviceID='*'] */ UnregisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; } /** - * The Filter object represents a unit of modification on an ImageFile. To use a Filter, add it to the Filters collection, then set the filter's propertie - * s and finally use the Apply method of the ImageProcess object to filter an ImageFile. + * The Filter object represents a unit of modification on an ImageFile. To use a Filter, add it to the Filters collection, then set the filter's + * properties and finally use the Apply method of the ImageProcess object to filter an ImageFile. */ - interface Filter { + class Filter { + private constructor(); + private 'WIA.Filter_typekey': Filter; + /** Returns a Description of what the filter does */ readonly Description: string; @@ -422,10 +445,13 @@ declare namespace WIA { } /** - * The FilterInfo object is a container that describes a Filter object without requiring a Filter to be Added to the process chain. See the FilterInfos pr - * operty on the ImageProcess object for details on accessing FilterInfo objects. + * The FilterInfo object is a container that describes a Filter object without requiring a Filter to be Added to the process chain. See the FilterInfos + * property on the ImageProcess object for details on accessing FilterInfo objects. */ - interface FilterInfo { + class FilterInfo { + private constructor(); + private 'WIA.FilterInfo_typekey': FilterInfo; + /** Returns a technical Description of what the filter does and how to use it in a filter chain */ readonly Description: string; @@ -437,15 +463,18 @@ declare namespace WIA { } /** - * The FilterInfos object is a collection of all the available FilterInfo objects. See the FilterInfos property on the ImageProcess object for detail on a - * ccessing the FilterInfos object. + * The FilterInfos object is a collection of all the available FilterInfo objects. See the FilterInfos property on the ImageProcess object for detail on + * accessing the FilterInfos object. */ interface FilterInfos { /** Returns the number of members in the collection */ readonly Count: number; /** Returns the specified item in the collection either by position or name */ - Item(Index: any): FilterInfo; + Item(Index: number | string): FilterInfo; + + /** Returns the specified item in the collection either by position or name */ + (Index: number | string): FilterInfo; } /** The Filters object is a collection of the Filters that will be applied to an ImageFile when you call the Apply method on the ImageProcess object. */ @@ -464,11 +493,14 @@ declare namespace WIA { /** Removes the designated filter */ Remove(Index: number): void; + + /** Returns the specified item in the collection by position or FilterID */ + (Index: number): Filter; } /** - * The Formats object is a collection of supported FormatIDs that you can use when calling Transfer on an Item object or ShowTransfer on a CommonDialog ob - * ject for this Item. + * The Formats object is a collection of supported FormatIDs that you can use when calling Transfer on an Item object or ShowTransfer on a CommonDialog + * object for this Item. */ interface Formats { /** Returns the number of members in the collection */ @@ -476,13 +508,19 @@ declare namespace WIA { /** Returns the specified item in the collection by position */ Item(Index: number): string; + + /** Returns the specified item in the collection by position */ + (Index: number): string; } /** - * The ImageFile object is a container for images transferred to your computer when you call Transfer or ShowTransfer. It also supports image files throug - * h LoadFile. An ImageFile object can be created using "WIA.ImageFile" in a call to CreateObject. + * The ImageFile object is a container for images transferred to your computer when you call Transfer or ShowTransfer. It also supports image files + * through LoadFile. An ImageFile object can be created using "WIA.ImageFile" in a call to CreateObject. */ - interface ImageFile { + class ImageFile { + private constructor(); + private 'WIA.ImageFile_typekey': ImageFile; + /** Returns/Sets the current frame in the image */ ActiveFrame: number; @@ -539,7 +577,10 @@ declare namespace WIA { } /** The ImageProcess object manages the filter chain. An ImageProcess object can be created using "WIA.ImageProcess" in a call to CreateObject. */ - interface ImageProcess { + class ImageProcess { + private constructor(); + private 'WIA.ImageProcess_typekey': ImageProcess; + /** Takes the specified ImageFile and returns the new ImageFile with all the filters applied on success */ Apply(Source: ImageFile): ImageFile; @@ -551,10 +592,13 @@ declare namespace WIA { } /** - * The Item object is a container for an item on an imaging device object. See the Items property on the Device or Item object for details on accessing It - * em objects. + * The Item object is a container for an item on an imaging device object. See the Items property on the Device or Item object for details on accessing + * Item objects. */ - interface Item { + class Item { + private constructor(); + private 'WIA.Item_typekey': Item; + /** A collection of all commands for this item */ readonly Commands: DeviceCommands; @@ -574,17 +618,15 @@ declare namespace WIA { readonly Properties: Properties; /** - * Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging d - * evice. Future versions may return a collection of ImageFile objects. + * Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging + * device. Future versions may return a collection of ImageFile objects. * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] */ - Transfer(FormatID?: string): any; - - /** Returns the underlying IWiaItem interface for this Item object */ - readonly WiaItem: any; + Transfer(FormatID?: string): ImageFile; } /** The Items object contains a collection of Item objects. See the Items property on the Device or Item object for details on accessing the Items object. */ + // tslint:disable-next-line interface-name interface Items { /** Adds a new Item with the specified Name and Flags. The Flags value is created by using the OR operation with members of the WiaItemFlags enumeration. */ Add(Name: string, Flags: number): void; @@ -597,28 +639,37 @@ declare namespace WIA { /** Removes the designated Item */ Remove(Index: number): void; + + /** Returns the specified item in the collection by position */ + (Index: number): Item; } /** - * The Properties object is a collection of all the Property objects associated with a given Device, DeviceInfo, Filter, ImageFile or Item object. See the - * Properties property on any of these objects for detail on accessing the Properties object. + * The Properties object is a collection of all the Property objects associated with a given Device, DeviceInfo, Filter, ImageFile or Item object. See + * the Properties property on any of these objects for detail on accessing the Properties object. */ interface Properties { /** Returns the number of members in the collection */ readonly Count: number; /** Indicates whether the specified Property exists in the collection */ - Exists(Index: any): boolean; + Exists(Index: number | string): boolean; /** Returns the specified item in the collection either by position or name. */ - Item(Index: any): Property; + Item(Index: number | string): Property; + + /** Returns the specified item in the collection either by position or name. */ + (Index: number | string): Property; } /** - * The Property object is a container for a property associated with a Device, DeviceInfo, Filter, ImageFile or Item object. See the Properties property o - * n any of these objects for details on accessing Property objects. + * The Property object is a container for a property associated with a Device, DeviceInfo, Filter, ImageFile or Item object. See the Properties property + * on any of these objects for details on accessing Property objects. */ - interface Property { + class Property { + private constructor(); + private 'WIA.Property_typekey': Property; + /** Indicates whether the Property Value is read only */ readonly IsReadOnly: boolean; @@ -657,10 +708,13 @@ declare namespace WIA { } /** - * The Rational object is a container for the rational values found in Exif tags. It is a supported element type of the Vector object and may be created u - * sing "WIA.Rational" in a call to CreateObject. + * The Rational object is a container for the rational values found in Exif tags. It is a supported element type of the Vector object and may be created + * using "WIA.Rational" in a call to CreateObject. */ - interface Rational { + class Rational { + private constructor(); + private 'WIA.Rational_typekey': Rational; + /** Returns/Sets the Rational Value Denominator */ Denominator: number; @@ -672,19 +726,19 @@ declare namespace WIA { } /** - * The Vector object is a collection of values of the same type. It is used throughout the library in many different ways. The Vector object may be create - * d using "WIA.Vector" in a call to CreateObject. + * The Vector object is a collection of values of the same type. It is used throughout the library in many different ways. The Vector object may be + * created using "WIA.Vector" in a call to CreateObject. */ - interface Vector { + interface Vector { /** - * If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the Vecto - * r collection. + * If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the + * Vector collection. * @param number [Index=0] */ - Add(Value: any, Index?: number): void; + Add(Value: TItem, Index?: number): void; /** Returns/Sets the Vector of Bytes as an array of bytes */ - BinaryData: any; + BinaryData: SafeArray; /** Removes all elements. */ Clear(): void; @@ -696,30 +750,30 @@ declare namespace WIA { Date: VarDate; /** - * Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an ImageFil - * e from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details. + * Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an + * ImageFile from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details. * @param number [Width=0] * @param number [Height=0] */ ImageFile(Width?: number, Height?: number): ImageFile; - /** Returns/Sets the specified item in the vector by position */ - Item(Index: number): any; + /** Returns the specified item in the vector by position */ + Item(Index: number): TItem; /** - * If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs mu - * st be ARGB data. Returns a Picture object on success. See the ImageFile method for more details. + * If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs + * must be ARGB data. Returns a Picture object on success. See the ImageFile method for more details. * @param number [Width=0] * @param number [Height=0] */ Picture(Width?: number, Height?: number): any; /** Removes the designated element and returns it if successful */ - Remove(Index: number): any; + Remove(Index: number): TItem | null; /** - * Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be sto - * red as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string. + * Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be + * stored as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string. * @param boolean [Resizable=true] * @param boolean [Unicode=true] */ @@ -730,30 +784,24 @@ declare namespace WIA { * @param boolean [Unicode=true] */ String(Unicode?: boolean): string; + + /** Returns the specified item in the vector by position */ + (Index: number): TItem; } } interface ActiveXObject { + new(progid: K): ActiveXObjectNameMap[K]; on(obj: WIA.DeviceManager, event: 'OnEvent', argNames: ['EventID', 'DeviceID', 'ItemID'], handler: ( - this: WIA.DeviceManager, parameter: { - EventID: string, DeviceID: string, ItemID: string}) => void): void; - set(obj: WIA.Vector, propertyName: 'Item', parameterTypes: [number], newValue: any): void; - new(progid: 'WIA.CommonDialog'): WIA.CommonDialog; - new(progid: 'WIA.DeviceManager'): WIA.DeviceManager; - new(progid: 'WIA.ImageFile'): WIA.ImageFile; - new(progid: 'WIA.ImageProcess'): WIA.ImageProcess; - new(progid: 'WIA.Rational'): WIA.Rational; - new(progid: 'WIA.Vector'): WIA.Vector; + this: WIA.DeviceManager, parameter: { readonly EventID: string, readonly DeviceID: string, readonly ItemID: string }) => void): void; + set(obj: WIA.Vector, propertyName: 'Item', parameterTypes: [number], newValue: TItem): void; } -interface EnumeratorConstructor { - new(col: WIA.DeviceCommands): WIA.DeviceCommand; - new(col: WIA.DeviceEvents): WIA.DeviceEvent; - new(col: WIA.DeviceInfos): WIA.DeviceInfo; - new(col: WIA.FilterInfos): WIA.FilterInfo; - new(col: WIA.Filters): WIA.Filter; - new(col: WIA.Formats): string; - new(col: WIA.Items): WIA.Item; - new(col: WIA.Properties): WIA.Property; - new(col: WIA.Vector): any; +interface ActiveXObjectNameMap { + 'WIA.CommonDialog': WIA.CommonDialog; + 'WIA.DeviceManager': WIA.DeviceManager; + 'WIA.ImageFile': WIA.ImageFile; + 'WIA.ImageProcess': WIA.ImageProcess; + 'WIA.Rational': WIA.Rational; + 'WIA.Vector': WIA.Vector; } diff --git a/types/activex-wia/tslint.json b/types/activex-wia/tslint.json index 2750cc0197..457cebbb55 100644 --- a/types/activex-wia/tslint.json +++ b/types/activex-wia/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file +{ + "extends": "dtslint/dt.json", + "rules":{ + "no-const-enum": false + } +} diff --git a/types/activex-word/tslint.json b/types/activex-word/tslint.json index 4ac54521fe..3224b40b8b 100644 --- a/types/activex-word/tslint.json +++ b/types/activex-word/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [false] + "no-const-enum": false } -} \ No newline at end of file +} diff --git a/types/add-zero/tsconfig.json b/types/add-zero/tsconfig.json index e71d235cdf..d7645a2e3c 100644 --- a/types/add-zero/tsconfig.json +++ b/types/add-zero/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "add-zero-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/adone/adone.d.ts b/types/adone/adone.d.ts index 34540761b5..91ebc4db7c 100644 --- a/types/adone/adone.d.ts +++ b/types/adone/adone.d.ts @@ -7,16 +7,15 @@ declare namespace adone { export function identity(x: T): T; export function truly(): true; export function falsely(): false; - export const ok: "OK"; - export const bad: "BAD"; - export const exts: [".js", ".tjs", ".ajs"]; + export const ok: "ok"; + export const bad: "bad"; export function log(...args: any[]): void; - export function fatal(...args: any[]): void; - export function error(...args: any[]): void; - export function warn(...args: any[]): void; - export function info(...args: any[]): void; - export function debug(...args: any[]): void; - export function trace(...args: any[]): void; + export function logFatal(...args: any[]): void; + export function logError(...args: any[]): void; + export function logWarn(...args: any[]): void; + export function logInfo(...args: any[]): void; + export function logDebug(...args: any[]): void; + export function logTrace(...args: any[]): void; export function o(...props: any[]): object; export const Date: typeof global.Date; export const hrtime: typeof global.process.hrtime; @@ -76,40 +75,16 @@ declare namespace adone { set(Class: object, tag: string): void; has(obj: object, tag: string): boolean; define(tag: string, predicate?: string): void; - SUBSYSTEM: symbol; - APPLICATION: symbol; - TRANSFORM: symbol; - CORE_STREAM: symbol; - LOGGER: symbol; - LONG: symbol; - BIGNUMBER: symbol; - EXBUFFER: symbol; - EXDATE: symbol; - CONFIGURATION: symbol; - GENESIS_NETRON: symbol; - GENESIS_PEER: symbol; - NETRON: symbol; - NETRON_PEER: symbol; - NETRON_ADAPTER: symbol; - NETRON_DEFINITION: symbol; - NETRON_DEFINITIONS: symbol; - NETRON_REFERENCE: symbol; - NETRON_INTERFACE: symbol; - NETRON_STUB: symbol; - NETRON_REMOTESTUB: symbol; - NETRON_STREAM: symbol; - FAST_STREAM: symbol; - FAST_FS_STREAM: symbol; - FAST_FS_MAP_STREAM: symbol; } } export const tag: I.Tag; - export function bind(libName: string): object; export function getAssetAbsolutePath(relPath: string): string; export function loadAsset(relPath: string): string | Buffer; export function require(path: string): object; export const package: object; + export function sprintf(format: string, ...args: any[]): string; + namespace I { interface Runtime { term: object; // TODO @@ -120,11 +95,10 @@ declare namespace adone { export const runtime: I.Runtime; - export const homePath: string; - export const rootPath: string; - export const etcPath: string; - export const config: object; - export const emptyBuffer: Buffer; + export const ROOT_PATH: string; + export const ETC_PATH: string; + export const configuration: object; + export const EMPTY_BUFFER: Buffer; export const assert: assertion.I.AssertFunction; export const expect: assertion.I.ExpectFunction; diff --git a/types/adone/glosses/application.d.ts b/types/adone/glosses/application.d.ts index 6b2b783d68..4c9661843a 100644 --- a/types/adone/glosses/application.d.ts +++ b/types/adone/glosses/application.d.ts @@ -1,5 +1,275 @@ declare namespace adone { namespace application { - function run(app: object, ignoreArgs?: boolean): Promise; + namespace I { + type ArgumentType = ((x: string, index: number) => any) | RegExp; + + interface ArgumentInfo { + name: string | string[]; + action?: "store" + | "store_const" + | "store_true" + | "store_false" + | "append" + | "count" + | "set"; + nargs?: number | "+" | "*" | "?" + type?: ArgumentType | ArgumentType[]; + verify?: (args: any, opts: any) => boolean; // TODO + required?: boolean; + description?: string; + help?: string; + holder?: string | string[]; + appendDefaultMessage?: boolean; + appendChoicesHelpMessage?: boolean; + default?: any; + enabled?: boolean; + } + + interface Group { + name: string; + description?: string; + } + + interface MainCommandInfo { + arguments?: Array; + options?: Array; + description?: string; + optionsGroups?: Group[]; + blindMode?: boolean; + match?: (name: string) => boolean; + handler?: (args: object, opts: object) => void; + } + + interface CommandInfo extends MainCommandInfo { + name?: string | string[]; + group?: string; + } + + interface ApplicationInfo { + name?: string; + description?: string; + subsystems?: SubsystemInfo[]; + commandsGroups?: Group[] + } + + interface SubsystemInfo { + name: string; + description?: string; + subsystem: string; + transpile?: boolean; + group?: string; + } + } + + function DSubsystem(info?: I.ApplicationInfo): (...args: any[]) => void; + + function DApplication(info?: I.ApplicationInfo): (...args: any[]) => void; + + function DCliCommand(info?: I.CommandInfo): (...args: any[]) => void; + + function DMainCliCommand(info?: I.MainCommandInfo): (...args: any[]) => void; + + namespace I { + interface LoadSubsystemOptions { + name?: string, + description?: string, + group?: string, + transpile?: boolean + } + + interface CommonAddSubsystemInfo { + name?: string, + useFilename?: boolean + description?: string, + group?: string, + configureArgs?: any[] + transpile?: boolean, + bind?: boolean | string + } + + interface AddSubsystemInfo extends CommonAddSubsystemInfo { + subsystem: Subsystem | string, + } + + interface SysInfo { + name: string; + description: string; + group: string; + configureArgs: any[]; + instance: Subsystem; + path: string | null; + } + + interface SysInfoWithPath extends SysInfo { + path: string; + } + + interface SysInfoNoPath extends SysInfo { + path: null; + } + + interface AddSubsystemsFromOptions extends CommonAddSubsystemInfo { + filter?: string[] | ((file: string) => boolean | Promise) + } + } + + class Subsystem extends event.AsyncEmitter { + constructor(options?: { name?: string }); + + readonly name?: string; + + readonly root?: Subsystem; + + setRoot(root: Subsystem): void; + + readonly parent?: Subsystem; + + readonly state: number; + + readonly isOwned: boolean; + + setState(state: number): void; + + waitForState(expectedState: number, timeout?: number): Promise; + + configure(): void; + + initialize(): void; + + uninitialize(): void; + + configureSubsystems(): Promise; + + uninitializeSubsystems(): Promise; + + reinitializeSubsystems(): Promise; + + configureSubsystem(name: string): Promise; + + loadSubsystem(subsystem: string | Subsystem, options?: I.LoadSubsystemOptions): Promise; + + unloadSubsystem(name: string): Promise; + + initializeSubsystem(name: string): Promise; + + uninitializeSubsystem(name: string): Promise; + + reinitializeSubsystem(name: string): Promise; + + getSubsystem(name: string): Subsystem; + + hasSubsystem(name: string): boolean; + + hasSubsystems(): boolean; + + addSubsystem(info: I.AddSubsystemInfo & { subsystem: Subsystem }): I.SysInfoNoPath; + addSubsystem(info: I.AddSubsystemInfo & { subsystem: string }): I.SysInfoWithPath; + + addSubsystemsFrom(path: string, options?: I.AddSubsystemsFromOptions): I.SysInfoWithPath; + + instantiateSubsystem(subsystem: string | Subsystem, options?: { + transpile?: boolean + }): Subsystem; + + deleteSubsystem(name: string, force?: boolean): void; + + getSubsystemInfo(name: string): I.SysInfo; + + getSubsystems(): I.SysInfo[]; + } + + namespace I { + interface ReportOptions { + events?: string; + signal?: string; + filename?: string; + directory?: string; + } + } + + class Application extends Subsystem { + readonly isMain: boolean; + + main(): void; + + enableReport(opts?: I.ReportOptions): void; + + reportEnabled(): boolean; + + run(): Promise; + + exit(code?: number): Promise; + + exitOnSignal(...names: string[]): void; + + removeProcesshandlers(): void; + + _uncaughtException(err: any): void; + + _unhandledRejection(reson: any, p: Promise): void; + + _rejectionHandled(p: Promise): void; + + _signalExit(sigName: string): void; + + } + + namespace I { + interface Command { + // ? + } + + interface Argument { + // ? + } + + interface PositionalArgument extends Argument { + // ? + } + + interface OptionalArgument extends Argument { + // ? + } + + interface DefineCommandFromSubsystemOptions { + name?: string; + description?: string; + group?: string; + subsystem: string | Subsystem; + configureArgs?: any[]; + lazily?: boolean; + transpile?: boolean; + } + } + + class CliApplication extends Application { + run(options?: { ignoreArgs?: boolean }): Promise; + + getVersion(): Promise; + + exposeCliInterface(ctxId?: string): void; + + readonly mainCommand: I.Command; + + defineMainCommand(schema: I.MainCommandInfo): this; + + defineArguments(schema: I.MainCommandInfo): this; + + defineCommand(schema: I.CommandInfo): I.Command; + + defineCommandFromSubsystem(options?: I.DefineCommandFromSubsystemOptions): void; + + defineOption(schema: I.ArgumentInfo): void; + + defineOptionsGroup(schema: I.Group): void; + + defineCommandsGroup(schema: I.Group): void; + + option(path: string, options?: { value?: boolean }): any; + } + + function run(app: Application, ignoreArgs?: boolean): Promise; + + function runCli(app: CliApplication, ignoreArgs?: boolean): Promise; } } diff --git a/types/adone/glosses/archives.d.ts b/types/adone/glosses/archives.d.ts index 3f059ff14d..ddeb25d891 100644 --- a/types/adone/glosses/archives.d.ts +++ b/types/adone/glosses/archives.d.ts @@ -448,7 +448,7 @@ declare namespace adone { isCompressed(): boolean; } - interface ZipFile extends event.EventEmitter { + interface ZipFile extends event.Emitter { /** * true until close() is called; then it's false */ diff --git a/types/adone/glosses/assertion.d.ts b/types/adone/glosses/assertion.d.ts index e7ba662791..f0cf377a21 100644 --- a/types/adone/glosses/assertion.d.ts +++ b/types/adone/glosses/assertion.d.ts @@ -38,7 +38,7 @@ declare namespace adone { proxyExcludedKeys: string[]; } - type PossibleTypes = util.I.PossibleTypes | "array"; + type PossibleTypes = meta.I.PossibleTypes | "array"; type UseFunction = (fn: () => void) => assertion; @@ -53,18 +53,10 @@ declare namespace adone { * Throws an AssertionError, like node.js */ fail(actual?: any, expected?: any, message?: string, operator?: any): void; - /** - * Asserts that value is truthy - */ - isOk(value: any, message?: string): void; /** * Asserts that value is truthy */ ok(value: any, message?: string): void; - /** - * Asserts that value is falsy - */ - isNotOk(value: any, message?: string): void; /** * Asserts that value is falsy */ @@ -104,51 +96,51 @@ declare namespace adone { /** * Asserts that value > above */ - isAbove(value: any, above: any, message?: string): void; + above(value: any, above: any, message?: string): void; /** * Asserts that value >= atLeast */ - isAtLeast(value: any, atLeast: any, message?: string): void; + atLeast(value: any, atLeast: any, message?: string): void; /** * Asserts that value < below */ - isBelow(value: any, below: any, message?: string): void; + below(value: any, below: any, message?: string): void; /** * Asserts that value <= atMost */ - isAtMost(value: any, atMost: any, message?: string): void; + atMost(value: any, atMost: any, message?: string): void; /** * Asserts that value is true */ - isTrue(value: any, message?: string): void; + true(value: any, message?: string): void; /** * Asserts that value is not true */ - isNotTrue(value: any, message?: string): void; + notTrue(value: any, message?: string): void; /** * Asserts that value is false */ - isFalse(value: any, message?: string): void; + false(value: any, message?: string): void; /** * Asserts that value is not false */ - isNotFalse(value: any, message?: string): void; + notFalse(value: any, message?: string): void; /** * Asserts that value is null */ - isNull(value: any, message?: string): void; + null(value: any, message?: string): void; /** * Asserts that valus is not null */ - isNotNull(value: any, message?: string): void; + notNull(value: any, message?: string): void; /** * Asserts that value is NaN */ - isNaN(value: any, message?: string): void; + NaN(value: any, message?: string): void; /** * Asserts that value is not NaN */ - isNotNaN(value: any, message?: string): void; + NotNaN(value: any, message?: string): void; /** * Asserts that value is neither null nor undefined */ @@ -160,63 +152,63 @@ declare namespace adone { /** * Asserts that value is undefined */ - isUndefined(value: any, message?: string): void; + undefined(value: any, message?: string): void; /** * Asserts that value is not undefined */ - isDefined(value: any, message?: string): void; + defined(value: any, message?: string): void; /** * Asserts that value is a function */ - isFunction(value: any, message?: string): void; + function(value: any, message?: string): void; /** * Asserts that value is not a function */ - isNotFunction(value: any, message?: string): void; + notFunction(value: any, message?: string): void; /** * Asserts that value is an object of type Object */ - isObject(value: any, message?: string): void; + object(value: any, message?: string): void; /** * Asserts that value is not an object of type Object */ - isNotObject(value: any, message?: string): void; + notObject(value: any, message?: string): void; /** * Asserts that value is an array */ - isArray(value: any, message?: string): void; + array(value: any, message?: string): void; /** * Asserts that value is not an array */ - isNotArray(value: any, message?: string): void; + notArray(value: any, message?: string): void; /** * Asserts that value is a string */ - isString(value: any, message?: string): void; + string(value: any, message?: string): void; /** * Asserts that value is not a string */ - isNotString(value: any, message?: string): void; + notString(value: any, message?: string): void; /** * Asserts that value is a number */ - isNumber(value: any, message?: string): void; + number(value: any, message?: string): void; /** * Asserts that value is not a number */ - isNotNumber(value: any, message?: string): void; + notNumber(value: any, message?: string): void; /** * Asserts that value is a finite number */ - isFinite(value: any, message?: string): void; + finite(value: any, message?: string): void; /** * Asserts that value is a boolean */ - isBoolean(value: any, message?: string): void; + boolean(value: any, message?: string): void; /** * Asserts that value is not a boolean */ - isNotBoolean(value: any, message?: string): void; + notBoolean(value: any, message?: string): void; /** * Asserts that value's type is `type` */ @@ -562,66 +554,34 @@ declare namespace adone { * Throws an error if value is truthy */ ifError(value: any): void; - /** - * Asserts that object is extensible - */ - isExtensible(object: object, message?: string): void; /** * Asserts that object is extensible */ extensible(object: object, message?: string): void; - /** - * Asserts that object is not extensible - */ - isNotExtensible(object: object, message?: string): void; /** * Asserts that object is not extensible */ notExtensible(object: object, message?: string): void; - /** - * Asserts that object is sealed - */ - isSealed(object: object, message?: string): void; /** * Asserts that object is sealed */ sealed(object: object, message?: string): void; - /** - * Asserts that object is not sealed - */ - isNotSealed(object: object, message?: string): void; /** * Asserts that object is not sealed */ notSealed(object: object, message?: string): void; - /** - * Asserts that object is frozen - */ - isFrozen(object: object, message?: string): void; /** * Asserts that object is frozen */ frozen(object: object, message?: string): void; - /** - * Asserts that object is not frozen - */ - isNotFrozen(object: object, message?: string): void; /** * Asserts that object is not frozen */ notFrozen(object: object, message?: string): void; - /** - * Asserts that value is empty - */ - isEmpty(value: any, message?: string): void; /** * Asserts that value is empty */ empty(value: any, message?: string): void; - /** - * Asserts that value is not empty - */ - isNotEmpty(value: any, message?: string): void; /** * Asserts that value is not empty */ @@ -710,43 +670,43 @@ declare namespace adone { /** * Asserts that the target is non-strictly equal to true */ - ok: this; + ok(): this; /** * Asserts that the target is true */ - true: this; + true(): this; /** * Asserts that the target is false */ - false: this; + false(): this; /** * Asserts that the target is null */ - null: this; + null(): this; /** * Asserts that the target is undefined */ - undefined: this; + undefined(): this; /** * Asserts that the target is NaN */ - NaN: this; + NaN(): this; /** * Asserts that the target is neither null nor undefined */ - exist: this; + exist(): this; /** * Asserts that the target is empty */ - empty: this; + empty(): this; /** * Asserts that the target is an arguments object */ - arguments: this; + arguments(): this; /** * Asserts that the target is an arguments object */ - Arguments: this; + Arguments(): this; /** * Asserts that the target is strictly equal to value(===) */ @@ -976,26 +936,26 @@ declare namespace adone { /** * Asserts that the target is extensible */ - extensible: this; + extensible(): this; /** * Asserts that the target is sealed */ - sealed: this; + sealed(): this; /** * Asserts that the target is frozen */ - frozen: this; + frozen(): this; /** * Asserts that the target is a finite number */ - finite: this; + finite(): this; } interface MockAssertions extends Assertion { /** * Asserts that the spy has been called */ - called: this; + called(): this; /** * Asserts that the spy has been called n times */ @@ -1003,15 +963,15 @@ declare namespace adone { /** * Asserts that the spy has been called once */ - calledOnce: this; + calledOnce(): this; /** * Asserts that the spy has been called twice */ - calledTwice: this; + calledTwice(): this; /** * Asserts that the spy has been been called with `new` */ - calledThrice: this; + calledThrice(): this; /** * Asserts that the spy has been called before anotherSpy */ @@ -1059,7 +1019,7 @@ declare namespace adone { } } - class AssertionError extends x.Exception { + class AssertionError extends error.Exception { constructor(message?: string, props?: object, ssf?: object) } diff --git a/types/adone/glosses/collections.d.ts b/types/adone/glosses/collections.d.ts deleted file mode 100644 index 178921136d..0000000000 --- a/types/adone/glosses/collections.d.ts +++ /dev/null @@ -1,1965 +0,0 @@ -declare namespace adone { - namespace collection { - namespace I.LinkedList { - /** - * Represents the node of a linked list - */ - interface Node { - /** - * The next node - */ - next?: Node; - - /** - * The previous node - */ - prev?: Node; - - /** - * The value this node contains - */ - value: T; - } - } - - /** - * Represents a linked list - */ - class LinkedList { - /** - * The maximum length of the list - */ - readonly maxLength: number; - - /** - * Current length of the list - */ - readonly length: number; - - /** - * Whether the list is autoresizable - */ - readonly autoresize: boolean; - - /** - * @param maxLength Maximum length of the linked list - */ - constructor(maxLength?: number); - - /** - * Whether the list is full - */ - readonly full: boolean; - - /** - * Whether the list is empty - */ - readonly empty: boolean; - - /** - * Resizes the list - */ - resize(newLength: number): this; - - /** - * Adds a new node to the end - * - * @returns Added node - */ - push(value: T): I.LinkedList.Node; - - /** - * Removes the last node, returns undefined if the list is empty - */ - pop(): T | undefined; - - /** - * Removes the first node, returns undefined if the list is empty - */ - shift(): T | undefined; - - /** - * Inserts a new node at the beginning of the list - * - * @returns Added node - */ - unshift(value: T): I.LinkedList.Node; - - /** - * Moves the given node to the end of the list - */ - pushNode(node: I.LinkedList.Node): void; - - /** - * Moved the given node to the beginning of the list - */ - unshiftNode(node: I.LinkedList.Node): void; - - /** - * Removes the given node from the list - */ - removeNode(node: I.LinkedList.Node): void; - - /** - * Clears the list - * - * @param strong Whether to reset all the node's values - */ - clear(strong?: boolean): void; - - /** - * Convers the list to an array - */ - toArray(): T[]; - - /** - * The first element of the list - */ - readonly front: T; - - /** - * The last element of the list - */ - readonly back: T; - - /** - * Returns an iterator over the list elements - */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns the next node for the given node - */ - nextNode(node: I.LinkedList.Node): I.LinkedList.Node; - - /** - * Maps this linked list to a new one using the given function - */ - map(fn: (value: T, index: number) => R): LinkedList; - - /** - * Invokes the given callback for each value from the beginning to the end (much faster than for-of). - * If the given function returns false it stops iterating. - */ - forEach(callback: (value: T, index: number) => void | boolean): void; - - /** - * Default length of a new created linked list - */ - static DEFAULT_LENGTH: number; - } - - namespace I { - type Long = math.Long; - - type Longable = math.I.Longable; - - namespace ByteArray { - interface Varint32 { - value: number; - length: number; - } - - interface Varint64 { - value: Long; - length: number; - } - - interface String { - string: string; - length: number; - } - - type Wrappable = string | ByteArray | Buffer | Uint8Array | ArrayBuffer; - - type Metrics = "b" | "c"; - } - } - - /** - * Represents an array of bytes, enhanced Node.js Buffer - */ - class ByteArray { - /** - * Constructs a new ByteArray - * - * @param capacity Initial capacity. Defaults to ByteArray.DEFAULT_CAPACITY(64) - * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) - */ - constructor(capacity?: number, noAssert?: boolean); - - /** - * Reads a BitSet as an array of booleans. - * - * @param offset Offset to read from. Will use and increase offset by length if omitted. - */ - readBitSet(offset?: number): boolean[]; - - /** - * Reads the specified number of bytes. - * - * @param length Number of bytes to read - * @param offset Offset to read from. Will use and increase offset by length if omitted. - */ - read(length: number, offset?: number): ByteArray; - - /** - * Reads an 8bit signed integer - * - * @param offset Offset to read from - */ - readInt8(offset?: number): number; - - /** - * Reads an 8bit unsigned integer - * - * @param offset Offset to read from - */ - readUInt8(offset?: number): number; - - /** - * Reads a 16bit signed le integer - * - * @param offset Offset to read from - */ - readInt16LE(offset?: number): number; - - /** - * Reads a 16bit unsigned le integer - * - * @param offset Offset to read from - */ - readUInt16LE(offset?: number): number; - - /** - * Reads a 16bit signed be integer - * - * @param offset Offset to read from - */ - readInt16BE(offset?: number): number; - - /** - * Reads a 16bit unsigned be integer - * - * @param offset Offset to read from - */ - readUInt16BE(offset?: number): number; - - /** - * Reads a 32bit signed le integer - * - * @param offset Offset to read from - */ - readInt32LE(offset?: number): number; - - /** - * Reads a 32bit unsigned le integer - * - * @param offset Offset to read from - */ - readUInt32LE(offset?: number): number; - - /** - * Reads a 32bit signed be integer - * - * @param offset Offset to read from - */ - readInt32BE(offset?: number): number; - - /** - * Reads a 32bit unsigned be integer - * - * @param offset Offset to read from - */ - readUInt32BE(offset?: number): number; - - /** - * Reads a 64bit signed le integer as math.Long - * - * @param offset Offset to read from - */ - readInt64LE(offset?: number): math.Long; - - /** - * Reads a 64bit unsigned le integer as math.Long - * - * @param offset Offset to read from - */ - readUInt64LE(offset?: number): math.Long; - - /** - * Reads a 64bit signed be integer as math.Long - * - * @param offset Offset to read from - */ - readInt64BE(offset?: number): math.Long; - - /** - * Reads a 64bit unsigned be integer as math.Long - * - * @param offset Offset to read from - */ - readUInt64BE(offset?: number): math.Long; - - /** - * Reads a 32bit le float - * - * @param offset Offset to read from - */ - readFloatLE(offset?: number): number; - - /** - * Reads a 32bit be float - * - * @param offset Offset to read from - */ - readFloatBE(offset?: number): number; - - /** - * Reads a 64bit le float - * - * @param offset Offset to read from - */ - readDoubleLE(offset?: number): number; - - /** - * Reads a 64bit be float - * - * @param offset Offset to read from - */ - readDoubleBE(offset?: number): number; - - /** - * Appends some data to this ByteArray. - * This will overwrite any contents behind the specified offset up to the appended data's length. - * - * @param source The source write from - * @param offset Offset to write to - * @param length length to read from the source - * @param encoding encoding to use for wrapping the source in bytearray - */ - write(source: I.ByteArray.Wrappable, offset?: number, length?: number, encoding?: string): this; - - /** - * Writes the array as a bitset. - * @param value Array of booleans to write - */ - writeBitSet(value: number[]): this; - - /** - * Writes the array as a bitset. - * @param value Array of booleans to write - * @param offset Offset to write to - */ - writeBitSet(value: number[], offset: number): number; - - /** - * Writes an 8bit signed integer - * - * @param offset Offset to write to - */ - writeInt8(value: number, offset?: number): this; - - /** - * Writes an 8bit unsigned integer - * - * @param offset Offset to write to - */ - writeUInt8(value: number, offset?: number): this; - - /** - * Writes a 16bit signed le integer - * - * @param offset Offset to write to - */ - writeInt16LE(value: number, offset?: number): this; - - /** - * Writes a 16bit signed be integer - * - * @param offset Offset to write to - */ - writeInt16BE(value: number, offset?: number): this; - - /** - * Writes a 16bit unsigned le integer - * - * @param offset Offset to write to - */ - writeUInt16LE(value: number, offset?: number): this; - - /** - * Writes a 16bit unsigned be integer - * - * @param offset Offset to write to - */ - writeUInt16BE(value: number, offset?: number): this; - - /** - * Writes a 32bit signed le integer - * - * @param offset Offset to write to - */ - writeInt32LE(value: number, offset?: number): this; - - /** - * Writes a 32bit signed be integer - * - * @param offset Offset to write to - */ - writeInt32BE(value: number, offset?: number): this; - - /** - * Writes a 32bit unsigned le integer - * - * @param offset Offset to write to - */ - writeUInt32LE(value: number, offset?: number): this; - - /** - * Writes a 32bit unsigned be integer - * - * @param offset Offset to write to - */ - writeUInt32BE(value: number, offset?: number): this; - - /** - * Writes a 64bit signed le long integer - * - * @param offset Offset to write to - */ - writeInt64LE(value: math.Long | string | number, offset?: number): this; - - /** - * Writes a 64bit signed be long integer - * - * @param offset Offset to write to - */ - writeInt64BE(value: math.Long | string | number, offset?: number): this; - - /** - * Writes a 64bit unsigned le long integer - * - * @param offset Offset to write to - */ - writeUInt64LE(value: math.Long | string | number, offset?: number): this; - - /** - * Writes a 64bit unsigned be long integer - * - * @param offset Offset to write to - */ - writeUInt64BE(value: math.Long | string | number, offset?: number): this; - - /** - * Writes a 32bit le float - * - * @param offset Offset to write to - */ - writeFloatLE(value: number, offset?: number): this; - - /** - * Writes a 32bit be float - * - * @param offset Offset to write to - */ - writeFloatBE(value: number, offset?: number): this; - - /** - * Writes a 64bit le float - * - * @param offset Offset to write to - */ - writeDoubleLE(value: number, offset?: number): this; - - /** - * Writes a 64bit be float - * - * @param offset Offset to write to - */ - writeDoubleBE(value: number, offset?: number): this; - - /** - * Writes a 32bit base 128 variable-length integer - */ - writeVarint32(value: number): this; - - /** - * Writes a 32bit base 128 variable-length integer - * - * @param offset Offset to write to - */ - writeVarint32(value: number, offset: number): number; - - /** - * Writes a zig-zag encoded 32bit base 128 variable-length integer - */ - writeVarint32ZigZag(value: number): this; - - /** - * Writes a zig-zag encoded 32bit base 128 variable-length integer - * - * @param offset Offset to write to - */ - writeVarint32ZigZag(value: number, offset: number): number; - - /** - * Reads a 32bit base 128 variable-length integer - */ - readVarint32(): number; - - /** - * Reads a 32bit base 128 variable-length integer - * - * @param offset Offset to read from - */ - readVarint32(offset: number): I.ByteArray.Varint32; - - /** - * Reads a zig-zag encoded 32bit base 128 variable-length integer - */ - readVarint32ZigZag(): number; - - /** - * Reads a zig-zag encoded 32bit base 128 variable-length integer - * - * @param offset Offset to read from - */ - readVarint32ZigZag(offset: number): I.ByteArray.Varint32; - - /** - * Writes a 64bit base 128 variable-length integer - */ - writeVarint64(value: math.Long | string | number): this; - - /** - * Writes a 64bit base 128 variable-length integer - * - * @param offset Offset to write to - */ - writeVarint64(value: math.Long | string | number, offset: number): number; - - /** - * Writes a zig-zag encoded 64bit base 128 variable-length integer - */ - writeVarint64ZigZag(value: math.Long | string | number): this; - - /** - * Writes a zig-zag encoded 64bit base 128 variable-length integer - * - * @param offset Offset to write to - */ - writeVarint64ZigZag(value: math.Long | string | number, offset: number): number; - - /** - * Reads a 64bit base 128 variable-length integer - */ - readVarint64(): I.Long; - - /** - * Reads a 64bit base 128 variable-length integer - * - * @param offset Offset to read from - */ - readVarint64(offset: number): I.ByteArray.Varint64; - - /** - * Reads a zig-zag encoded 64bit base 128 variable-length integer - */ - readVarint64ZigZag(): math.Long; - - /** - * Reads a zig-zag encoded 64bit base 128 variable-length integer - * - * @param offset Offset to read from - */ - readVarint64ZigZag(offset: number): I.ByteArray.Varint64; - - /** - * Writes a NULL-terminated UTF8 encoded string. - * For this to work the specified string must not contain any NULL characters itself - */ - writeCString(str: string): this; - - /** - * Writes a NULL-terminated UTF8 encoded string. - * For this to work the specified string must not contain any NULL characters itself - * - * @param offset Offset to write to - */ - writeCString(str: string, offset: number): number; - - /** - * Reads a NULL-terminated UTF8 encoded string. - * For this to work the string read must not contain any NULL characters itself - */ - readCString(): string; - - /** - * Reads a NULL-terminated UTF8 encoded string. - * For this to work the string read must not contain any NULL characters itself - * - * @param offset Offset to read from - */ - readCString(offset: number): I.ByteArray.String; - - /** - * Writes an UTF8 encoded string - */ - writeString(str: string): this; - - /** - * Writes an UTF8 encoded string - * - * @param offset Offset to write to - */ - writeString(str: string, offset: number): number; - - /** - * Reads an UTF8 encoded string - * - * @param length Number of characters or bytes to read - * @param metrics Metrics specifying what n is meant to count. Defaults to ByteArray.METRICS_CHARS("c") - */ - readString(length: number, metrics?: I.ByteArray.Metrics): string; - - /** - * Reads an UTF8 encoded string - * - * @param length Number of characters or bytes to read - * @param metrics Metrics specifying what n is meant to count. Defaults to ByteArray.METRICS_CHARS("c") - * @param offset Offset to read from - */ - readString(length: number, metrics: I.ByteArray.Metrics, offset: number): I.ByteArray.String; - - /** - * Reads an UTF8 encoded string - * - * @param length Number of characters or bytes to read - * @param offset Offset to read from - */ - readString(length: number, offset: number): I.ByteArray.String; - - /** - * Writes a length as varint32 prefixed UTF8 encoded string - */ - writeVString(str: string): this; - - /** - * Writes a length as varint32 prefixed UTF8 encoded string - * - * @param offset Offset to read from - */ - writeVString(str: string, offset: number): number; - - /** - * Reads a length as varint32 prefixed UTF8 encoded string - */ - readVString(): string; - - /** - * Reads a length as varint32 prefixed UTF8 encoded string - * - * @param offset Offset to read from - */ - readVString(offset: number): I.ByteArray.String; - - /** - * Appends this ByteArray's contents to another ByteArray. - * This will overwrite any contents behind the specified offset up to the length of this ByteArray's data - * - * @param offset Offset to append to - */ - appendTo(target: ByteArray, offset?: number): this; - - /** - * Enables or disables assertions of argument types and offsets. - * Assertions are enabled by default but you can opt to disable them if your code already makes sure that everything is valid - */ - assert(assert?: boolean): this; - - /** - * Gets the capacity of this ByteArray's backing buffer - */ - capacity(): number; - - /** - * Clears this ByteArray's offsets by setting offset to 0 and limit to the backing buffer's capacity - */ - clear(): this; - - /** - * Creates a cloned instance of this ByteArray, - * preset with this ByteArray's values for offset, markedOffset and limit - * - * @param copy Whether to copy the backing buffer or to return another view on the same, false by default - */ - clone(copy?: boolean): ByteArray; - - /** - * Compacts this ByteArray to be backed by a buffer of its contents' length. - * Will set offset = 0 and limit = capacity and adapt markedOffset to the same relative position if set - * - * @param begin Offset to start at, buffer offset by default - * @param end Offset to end at, buffer limit by default - */ - compact(begin?: number, end?: number): this; - - /** - * Creates a copy of this ByteArray's contents. - * - * @param begin Begin offset, buffer offset by default - * @param end End offset, buffer limit by default - */ - copy(begin?: number, end?: number): ByteArray; - - /** - * Copies this ByteArray's contents to another ByteArray. - * - * @param targetOffset Offset to copy to. Will use and increase the target's offset by the number of bytes copied if omitted - * @param sourceOffset Offset to start copying from. Will use and increase offset by the number of bytes copied if omitted - * @param sourceLimit Offset to end copying from, defaults to the buffer limit - */ - copyTo(target: ByteArray, targetOffset?: number, souceOffset?: number, sourceLimit?: number): this | ByteArray; - - /** - * Makes sure that this ByteArray is backed by a ByteArray#buffer of at least the specified capacity. - * If the current capacity is exceeded, it will be doubled. - * If double the current capacity is less than the required capacity, the required capacity will be used instead - */ - ensureCapacity(capacity: number): this; - - /** - * Overwrites this ByteArray's contents with the specified value. - * - * @param value Byte value to fill with. If given as a string, the first character is used - * @param begin Begin offset. Will use and increase offset by the number of bytes written if omitted. defaults to offset - * @param end End offset, defaults to limit. - */ - fill(value: string | number, begin?: number, end?: number): this; - - /** - * Makes this ByteArray ready for a new sequence of write or relative read operations. - * Sets limit = offset and offset = 0. - * Make sure always to flip a ByteArray when all relative read or write operations are complete - */ - flip(): this; - - /** - * Marks an offset on this ByteArray to be used later - * - * @param offset Offset to mark. Defaults to offset. - */ - mark(offset?: number): this; - - /** - * Prepends some data to this ByteArray. - * This will overwrite any contents before the specified offset up to the prepended data's length. - * If there is not enough space available before the specified offset, - * the backing buffer will be resized and its contents moved accordingly - * - * @param source Data to prepend - * @param offset Offset to prepend at. Will use and decrease offset by the number of bytes prepended if omitted. - */ - prepend(source: I.ByteArray.Wrappable, offset: number): this; - - /** - * Prepends some data to this ByteArray. - * This will overwrite any contents before the specified offset up to the prepended data's length. - * If there is not enough space available before the specified offset, - * the backing buffer will be resized and its contents moved accordingly - * - * @param source Data to prepend - * @param encoding Encoding if data is a string - * @param offset Offset to prepend at. Will use and decrease offset by the number of bytes prepended if omitted. - */ - prepend(source: I.ByteArray.Wrappable, encoding?: string, offset?: number): this; - - /** - * Prepends this ByteArray to another ByteArray. - * This will overwrite any contents before the specified offset up to the prepended data's length. - * If there is not enough space available before the specified offset, - * the backing buffer will be resized and its contents moved accordingly - * - * @param offset Offset to prepend at - */ - prependTo(target: ByteArray, offset?: number): this; - - /** - * Gets the number of remaining readable bytes - */ - remaining(): number; - - /** - * Resets this ByteArray's offset. - * If an offset has been marked through mark before, offset will be set to markedOffset, which will then be discarded. - * If no offset has been marked, sets offset = 0 - */ - reset(): this; - - /** - * Resizes this ByteArray to be backed by a buffer of at least the given capacity. - * Will do nothing if already that large or larger. - * - * @param capacity Capacity required - */ - resize(capacity: number): this; - - /** - * Reverses this ByteArray's contents. - * - * @param begin Offset to start at, defaults to offset - * @param end Offset to end at, defaults to limit - */ - reverse(begin?: number, end?: number): this; - - /** - * Skips the next length bytes. This will just advance - */ - skip(length: number): this; - - /** - * Slices this ByteArray by creating a cloned instance with offset = begin and limit = end - * - * @param begin Begin offset, defaults to offset - * @param end End offset, defaults to limit - */ - slice(begin?: number, end?: number): ByteArray; - - /** - * Returns a copy of the backing buffer that contains this ByteArray's contents. - * - * @param forceCopy If true returns a copy, otherwise returns a view referencing the same memory if possible, false by default - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toBuffer(forceCopy?: boolean, begin?: number, end?: number): Buffer; - - /** - * Returns a raw buffer compacted to contain this ByteArray's contents - */ - toArrayBuffer(): ArrayBuffer; - - /** - * Converts the ByteArray's contents to a string - * - * @param encoding Output encoding - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toString(encoding?: string, begin?: number, end?: number): string; - - /** - * Encodes this ByteArray's contents to a base64 encoded string - * - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toBase64(begin?: number, end?: number): string; - - /** - * Encodes this ByteArray to a binary encoded string, that is using only characters 0x00-0xFF as bytes - * - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toBinary(begin?: number, end?: number): string; - - /** - * Encodes this ByteArray to a hex encoded string with marked offsets - * - * @param columns If true returns two columns hex + ascii, defaults to false - */ - toDebug(columns?: boolean): string; - - /** - * Encodes this ByteArray's contents to a hex encoded string - * - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toHex(begin?: number, end?: number): string; - - /** - * Encodes this ByteArray's contents to an UTF8 encoded string - * - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toUTF8(begin?: number, end?: number): string; - - static accessor(): typeof Buffer; - - /** - * Allocates a new ByteArray backed by a buffer of the specified capacity. - * - * @param capacity Initial capacity. Defaults to ByteArray.DEFAULT_CAPACITY(64) - * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) - */ - static allocate(capacity?: number, noAssert?: boolean): ByteArray; - - /** - * Concatenates multiple ByteArrays into one - * - * @param encoding Encoding for strings - * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) - */ - static concat(buffers: I.ByteArray.Wrappable[], encoding?: string, noAssert?: boolean): ByteArray; - - static type(): typeof Buffer; - - /** - * Wraps a buffer or a string. - * Sets the allocated ByteArray's offset to 0 and its limit to the length of the wrapped data - * - * @param encoding Encoding for strings - * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) - */ - static wrap(buffer: I.ByteArray.Wrappable, encoding?: string, noAssert?: boolean): ByteArray; - - /** - * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer - */ - static calculateVarint32(value: number): number; - - /** - * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding - */ - static zigZagEncode32(n: number): number; - - /** - * Decodes a zigzag encoded signed 32bit integer - */ - static zigZagDecode32(n: number): number; - - /** - * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer - */ - static calculateVarint64(value: number | string): number; - - /** - * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding - */ - static zigZagEncode64(value: number | string | I.Long): I.Long; - - /** - * Decodes a zigzag encoded signed 64bit integer. - */ - static zigZagDecode64(value: number | string | I.Long): I.Long; - - /** - * 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. - */ - static calculateString(str: string): number; - - /** - * Decodes a base64 encoded string to a ByteArray - */ - static fromBase64(str: string): ByteArray; - - /** - * Encodes a binary string to base64 like window.btoa does - */ - static btoa(str: string): string; - - /** - * Decodes a base64 encoded string to binary like window.atob does - */ - static atob(b64: string): string; - - /** - * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteArray - */ - static fromBinary(str: string): ByteArray; - - /** - * Decodes a hex encoded string with marked offsets to a ByteArray - */ - static fromDebug(str: string, noAssert?: boolean): ByteArray; - - /** - * Decodes a hex encoded string to a ByteArray - */ - static fromHex(str: string, noAssert?: boolean): ByteArray; - - /** - * Decodes an UTF8 encoded string to a ByteArray - */ - static fromUTF8(str: string, noAssert?: boolean): ByteArray; - - /** - * Default initial capacity - */ - static DEFAULT_CAPACITY: number; - - /** - * Default no assertions flag - */ - static DEFAULT_NOASSERT: boolean; - - /** - * Maximum number of bytes required to store a 32bit base 128 variable-length integer - */ - static MAX_VARINT32_BYTES: number; - - /** - * Maximum number of bytes required to store a 64bit base 128 variable-length integer - */ - static MAX_VARINT64_BYTES: number; - - /** - * Metrics representing number of UTF8 characters. Evaluates to `c`. - */ - static METRICS_CHARS: string; - - /** - * Metrics representing number of bytes. Evaluates to `b`. - */ - static METRICS_BYTES: string; - } - - /** - * Represents a queue - */ - class Queue { - /** - * Whether the queue is full - */ - readonly full: boolean; - - /** - * The length of the queue - */ - readonly length: number; - - /** - * Whether the queue is empty - */ - readonly empty: boolean; - - /** - * Inserts a new element at the end - */ - push(x: S): this; - - /** - * Removes and returns an element from the beginning - */ - pop(): T | undefined; - } - - /** - * Represents an asynchronous queue, each pop is a promise - * that is resolved with an existing element or an element that will be pushed in the future - */ - class AsyncQueue extends Queue> { - /** - * Returns a promise that will be resolved with an existing element or an element that will be pushed in the future - */ - pop(): Promise; - } - - namespace I.PriorityQueue { - interface ConstructorOptions { - /** - * Function that compares objects. - * - * Must return a positive value if a > b, a negative if a < b, and zero for equal objects - */ - compare?(a: T, b: T): number; - - /** - * Function that evaluates the priority value by the given objects, - * if the returned value > 0, then the first argument has higher priority, - * = 0 same priority, < 0 lower priority. - * By default the top element is an element that has the highest priority, - * the default priority function is equal to the compare function - */ - priority?(a: T, b: T): number; - } - } - - /** - * Represents a priority queue - */ - class PriorityQueue { - /** - * Whether the queue is empty - */ - readonly empty: boolean; - - /** - * The length of the queue - */ - readonly length: number; - - constructor(options?: I.PriorityQueue.ConstructorOptions); - - /** - * Clones the queue - */ - clone(): PriorityQueue; - - /** - * Inserts a new element - */ - push(x: T): this; - - /** - * Removes the top element (that has the highest priority) - */ - pop(): T | undefined; - - /** - * Deletes the given element from the queue - */ - delete(x: T): this; - - /** - * Replaces the top element (pop + push) - */ - replace(x: T): T; - - /** - * Faster push + pop - */ - pushpop(x: T): T; - - /** - * Converts the queue to an array, it works with a clone of the queue, so the original queue is untouched - */ - toArray(): T[]; - - /** - * Creates a queue object from the given iterable - */ - static from(iterable: Iterable, options?: I.PriorityQueue.ConstructorOptions): PriorityQueue; - } - - /** - * Represents a faster LRU cache but with less functionality - */ - class FastLRU { - /** - * @param size Cache size, unlimited by default - */ - constructor(size?: number, options?: { - /** - * Function that is called when a value is deleted - */ - dispose?(key: K, value: V): void - }); - - /** - * The actual size of the cache - */ - readonly size: number; - - /** - * Gets the value by the given key - */ - get(key: K): V | undefined; - - /** - * Sets a new value for the given key - */ - set(key: K, value: V): void; - - /** - * Deletes the given key from the cache - */ - delete(key: K): boolean; - - /** - * Checks whether the cache has an element with the given key - */ - has(key: K): boolean; - - /** - * Returns the keys iterator - */ - keys(): IterableIterator; - - /** - * Returns the values iterator - */ - values(): IterableIterator; - - /** - * Returns the entries iterator - */ - entries(): IterableIterator<[K, V]>; - - /** - * Clears the cache - */ - clear(): void; - } - - /** - * Represents a stack - */ - class Stack { - /** - * Whether the stack is empty - */ - readonly empty: boolean; - - /** - * The top element of the stack - */ - readonly top: T; - - /** - * Inserts a new element - */ - push(x: T): this; - - /** - * Removes the top element - */ - pop(): T | undefined; - - /** - * Returns an iterator over the values - */ - [Symbol.iterator](): IterableIterator; - - /** - * Creates a stack and pushed all the values from the given iterable object - */ - static from(iterable: Iterable): Stack; - } - - namespace I.BinarySearchTree { - interface ConstructorOptions { - /** - * The parent tree - */ - parent?: Tree; - - /** - * Value to keep in this node - */ - value?: V; - - /** - * WHether the values must be unique, false by default. - * If false you can store many values for same keys, otherwise only one - */ - unique?: boolean; - - /** - * Custom keys comparator, by default if a > b => -1, a < b -1, a === b => 0 - */ - compareKeys?(a: K, b: K): number; - - /** - * Function that defines whether 2 values are the same, by default a === b - */ - checkValueEquality?(a: V, b: V): boolean; - } - - interface Query { - $lt?: K; - $lte?: K; - $gt?: K; - $gte?: K; - } - } - - /** - * Represents a binary search tree - */ - class BinarySearchTree { - constructor(options?: I.BinarySearchTree.ConstructorOptions>); - - /** - * Returns the max descendant tree - */ - getMaxKeyDescendant(): BinarySearchTree; - - /** - * Returns the maximum key - */ - getMaxKey(): K; - - /** - * Returns the min descendant tree - */ - getMinKeyDescendant(): BinarySearchTree; - - /** - * Returns the minumum key - */ - getMinKey(): K; - - /** - * Traverses the tree and calls the given function for each node - */ - checkAllNodesFullfillCondition(test: (key: K, value: V) => void): void; - - /** - * Checks whether the tree is a binary search tree - */ - checkIsBST(): void; - - /** - * Returns the of keys in the tree - */ - getNumberOfKeys(): number; - - /** - * Inserts a new key/value - */ - insert(key: K, value: V): void; - - /** - * Searches the given key in the tree - */ - search(key: K): V[]; - - /** - * Returns all the values from the given key bounds - */ - betweenBounds(query: I.BinarySearchTree.Query): V[]; - - /** - * Deletes the given key/value from the tree - */ - delete(key: K, value?: V): void; - - /** - * Executed the given callback for each node from left to right - */ - executeOnEveryNode(fn: (tree: BinarySearchTree) => void): void; - - /** - * Prints the tree - */ - prettyPrint(printData?: boolean, spacing?: string): void; - } - - /** - * Represents an AVL tree, a self-balancing binary search tree - */ - class AVLTree { - constructor(options?: I.BinarySearchTree.ConstructorOptions>); - - /** - * Checks whether the tree is an avl tree - */ - checkIsAVLT(): void; - - /** - * Inserts a new key/value - */ - insert(key: K, value: V): void; - - /** - * Deletes the given key/value from the tree - */ - delete(key: K, value?: V): void; - - /** - * Returns the of keys in the tree - */ - getNumberOFKeys(): number; - - /** - * Searches the given key in the tree - */ - search(key: K): V[]; - - /** - * Returns all the values from the given key bounds - */ - betweenBounds(query: I.BinarySearchTree.Query): V[]; - - /** - * Executed the given callback for each node from left to right - */ - executeOnEveryNode(fn: (tree: AVLTree) => void): void; - - /** - * Prints the tree - */ - prettyPrint(printDate?: boolean, spacing?: string): void; - } - - namespace I.RedBlackTree { - interface Node { - /** - * The key associated to the node - */ - key: K; - - /** - * The value associated to the node - */ - value: V; - - /** - * The left subtree of the node - */ - left?: Node; - - /** - * The right subtree of the node - */ - right?: Node; - } - - interface Iterator { - /** - * Checks if the iterator is valid - */ - readonly valid: boolean; - - /** - * The value of the node at the iterator's current position, null if invalid - */ - readonly node: Node | null; - - /** - * The key of the item referenced by the iterator, undefined if invalid - */ - readonly key?: K; - - /** - * The value of the item referenced by the iterator, undefined if invalid - */ - readonly value?: V; - - /** - * Returns the position of this iterator in the sequence - */ - readonly index: number; - - /** - * If true, then the iterator is not at the end of the sequence - */ - readonly hasNext: boolean; - - /** - * If true, then the iterator is not at the beginning of the sequence - */ - readonly hasPrev: boolean; - - /** - * The tree associated to the iterator - */ - tree: RedBlackTree; - - /** - * Makes a copy of the iterator - */ - clone(): Iterator; - - /** - * Removes the item at the position of the iterator and returns a new rb-tree - */ - remove(): RedBlackTree; - - /** - * Advances the iterator to the next position - */ - next(): void; - - /** - * Updates the value of the node in the tree at this iterator and returns a new rb-tree - */ - update(value: V): RedBlackTree; - - /** - * Moves the iterator backward one element - */ - prev(): void; - } - } - - /** - * Represents a fully persistent red-black tree - */ - class RedBlackTree { - /** - * The root node of the tree - */ - root: I.RedBlackTree.Node; - - constructor(compare?: (a: K, b: K) => number, root?: RedBlackTree); - - /** - * A sorted array of all the keys in the tree - */ - readonly keys: K[]; - - /** - * An array of all the values in the tree - */ - readonly values: V[]; - - /** - * The number of items in the tree - */ - readonly length: number; - - /** - * An iterator pointing to the first element in the tree - */ - readonly begin: I.RedBlackTree.Iterator; - - /** - * An iterator pointing to the last element in the tree - */ - readonly end: I.RedBlackTree.Iterator; - - /** - * Creates a new tree with the new pair inserted - */ - insert(key: K, value: V): RedBlackTree; - - /** - * Walks a visitor function over the nodes of the tree in order - * - * @param visit A callback that gets executed on each node. - * If a truthy value is returned from the visitor, then iteration is stopped. - * @param lo An optional start of the range to visit (inclusive) - * @param hi An optional end of the range to visit (non-inclusive) - */ - forEach(visit: (key: K, value: V) => T, lo?: K, hi?: K): T; - - /** - * Finds an iterator starting at the given element - */ - at(idx: number): I.RedBlackTree.Iterator; - - /** - * Finds the first item in the tree whose key is >= key - */ - ge(key: K): I.RedBlackTree.Iterator; - - /** - * Finds the first item in the tree whose key is > key - */ - gt(key: K): I.RedBlackTree.Iterator; - - /** - * Finds the first item in the tree whose key is < key - */ - lt(key: K): I.RedBlackTree.Iterator; - - /** - * Finds the first item in the tree whose key is <= key - */ - le(key: K): I.RedBlackTree.Iterator; - - /** - * Returns an iterator pointing to the first item in the tree with key, otherwise null - */ - find(key: K): I.RedBlackTree.Iterator | null; - - /** - * Removes the first item with key in the tree - */ - remove(key: K): RedBlackTree; - - /** - * Retrieves the value associated to the given key - */ - get(key: K): V | undefined; - } - - /** - * Respresetns a data structure which is a combination of an array and a set. - * Adding a new member is O(1), testing for membership is O(1), - * and finding the index of an element is O(1). - */ - class ArraySet { - /** - * The number of unique items in this ArraySet. - * If duplicates have been added, than those do not count towards the size. - */ - readonly length: number; - - /** - * Adds the given value to this set. - * - * @param allowDuplicates Whether to allow duplicates in the set, false by default - */ - add(value: T, allowDuplicates?: boolean): this; - - /** - * Checks whether the given value is a member of the set - */ - has(value: T): boolean; - - /** - * Returns the index of the given element. - * If the value is not present it will return -1 - */ - indexOf(value: T): number; - - /** - * Converts the set to an array - */ - toArray(): T[]; - - /** - * Creates an ArraySet from the given iterable object - * - * @param allowDuplicates Whether to allow duplicates in the set, false by default - */ - static from(iterable: Iterable, allowDuplicates?: boolean): ArraySet; - } - - namespace I.BufferList { - type Appendable = Buffer | BufferList | string | number | Array; - } - - /** - * Represents a Node.js Buffer list collector, reader and streamer with callback/promise interface support - */ - class BufferList extends std.stream.Duplex implements PromiseLike { - /** - * Creates a new buffer list - */ - constructor(); - - /** - * Creates a new buffer list and initiates with the given value - */ - constructor(buffer: I.BufferList.Appendable); - - /** - * Creates a new buffer list and subscribes the given callback on the end/error event - */ - constructor(callback: (err: any, data: Buffer) => void); - - /** - * Adds an additional buffer or BufferList to the internal list - */ - append(buf: I.BufferList.Appendable): this; - - /** - * Ends the stream - */ - end(chunk?: Buffer): void; - end(chunk?: () => void): void; - - /** - * Returns the byte at the specified index - */ - get(idx: number): number; - - /** - * Returns a new Buffer object containing the bytes within the range specified. - */ - slice(start?: number, end?: number): Buffer; - - /** - * Copies the content of the list in the dest buffer - * starting from destStart and containing the bytes within the range specified with srcStart to srcEnd - * - * @param dstStart writes from this position - * @param srcStart reads bytes from this position - * @param srcEnd read bytes to this position - */ - copy(dst: T, dstStart?: number, srcStart?: number, srcEnd?: number): T; - - /** - * Returns a new BufferList object containing the bytes within the range specified. - * No copies will be performed. All buffers in the result share memory with the original list. - * - * @param start slice from - * @param end slice to - */ - shallowSlice(start?: number, end?: number): BufferList; - - /** - * Return a string representation of the buffer - */ - toString(encoding?: fs.I.Encoding, start?: number, end?: number): string; - - /** - * Shifts bytes off the start of the list - */ - consume(bytes: number): this; - - /** - * Performs a shallow-copy of the list. - */ - duplicate(): BufferList; - - /** - * Destroys the stream - */ - destroy(): void; - - then( - onfulfilled?: ((value: Buffer) => T1 | PromiseLike) | null, - onrejected?: ((reason: any) => T2 | PromiseLike) | null - ): PromiseLike; - - catch(onrejected?: ((reason: any) => T | PromiseLike) | null): PromiseLike; - } - - /** - * Represents a Map that has a default values factory object or function. - * Each get of non-existent key goes through the factory - */ - class DefaultMap extends Map { - constructor(factory?: ((key: K) => V) | { [key: string]: V }, iterable?: Iterable<[K, V]>); - } - - namespace I.LRU { - type LengthCalculator = (value: V, key: K) => number; - interface ConstructorOptions { - /** - * The maximum size of the cache, checked by applying the length function to all values in the cache. - * Default is Infinity - */ - max?: number; - - /** - * Maximum age in ms. Items are not pro-actively pruned out as they age, - * but if you try to get an item that is too old, - * it'll drop it and return undefined instead of giving it to you - */ - maxAge?: number; - - /** - * Function that is used to calculate the length of stored items - */ - length?: LengthCalculator; - - /** - * Function that is called on items when they are dropped from the cache - */ - dispose?(key: K, value: V): void; - - /** - * Whether to return the stale value before deleting it - */ - stale?: boolean; - - /** - * Dispose will only be called when a key falls out of the cache, not when it is overwritten - */ - noDisposeOnSet?: boolean; - } - - interface SerializedEntry { - /** - * key - */ - key: K; - - /** - * value - */ - value: V; - - /** - * when it becomes expired - */ - e: number; - } - - interface Entry { - /** - * key - */ - key: K; - - /** - * value - */ - value: V; - - /** - * entry length - */ - length: number; - - /** - * Timestamp when the entry was created - */ - now: number; - - /** - * Maximum live time - */ - maxAge: number; - } - } - - /** - * Represent an LRU cache - */ - class LRU { - /** - * Creates an LRU cache of the given size - */ - constructor(max: number); - - /** - * Creates an LRU cache with the given options - */ - constructor(options?: I.LRU.ConstructorOptions); - - /** - * The length of the cache, setter resizes the cache - */ - max: number; - - /** - * stale setting - */ - allowStale: boolean; - - /** - * maxAge setting - */ - maxAge: number; - - /** - * length setting - */ - lengthCalculator: I.LRU.LengthCalculator; - - /** - * Total length of objects in cache taking into account length options function - */ - readonly length: number; - - /** - * Total quantity of objects currently in cache. - * Note, that stale items are returned as part of this item count. - */ - readonly itemCount: number; - - /** - * Iterates over all the keys in the cache, in reverse recent-ness order. (ie, less recently used items are iterated over first.) - */ - rforEach(fn: (this: T, value: V, key: K, cache: LRU) => void, thisp?: T): void; - - /** - * Iterates over all the keys in the cache, in order of recent-ness - */ - forEach(fn: (this: T, value: V, key: K, cache: LRU) => void, thisp?: T): void; - - /** - * Returns an array of the keys in the cache - */ - keys(): K[]; - - /** - * Returns an array of the values in the cache - */ - values(): V[]; - - /** - * Clears the cache entirely, throwing away all values - */ - reset(): void; - - /** - * Return an array of the cache entries ready for serialization and usage with 'destinationCache.load(arr)` - */ - dump(): Array>; - - /** - * Returns an internal lru list of entries - */ - dumpLru(): LinkedList>; - - /** - * @param opts std.util.inspect options - */ - inspect(opts?: object): string; - - /** - * Sets a new value for the given key. Updates the "recently used"-ness of the key - * - * @param maxAge maxAge option specific for this key - * @returns Whether the key was set - */ - set(key: K, value: V, maxAge?: number): boolean; - - /** - * Check if a key is in the cache, without updating the recent-ness or deleting it for being stale - */ - has(key: K): boolean; - - /** - * Gets the value of the given key. Updates the "recently used"-ness of the key - */ - get(key: K): V | undefined; - - /** - * Returns the key value without updating the "recently used"-ness of the key - */ - peek(key: K): V | undefined; - - /** - * Deletes the less recently used element - */ - pop(): I.LRU.Entry; - - /** - * Deletes a key out of the cache - */ - del(key: K): void; - - /** - * Loads another cache entries array, obtained with sourceCache.dump(), into the cache. - * The destination cache is reset before loading new entries - */ - load(arr: Array>): void; - - /** - * Manually iterates over the entire cache proactively pruning old entries - */ - prune(): void; - } - - /** - * Represents a Map that keeps keys only for a specified interval of time - */ - class TimedoutMap extends Map { - /** - * @param timeout maximum age of the keys, 1000 by default - * @param callback callback that is called with each key when the timeout is passed - */ - constructor(timeout?: number, callback?: (key: K) => void); - - /** - * Gets the timeout - */ - getTimeout(): number; - - /** - * Sets the timeout - */ - setTimeout(ms: number): void; - - /** - * Iterates over the map and calls the callback for each element - */ - forEach(callback: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): this; - - /** - * Deletes the given key - */ - delete(key: K): boolean; - } - } -} diff --git a/types/adone/glosses/collections/array_set.d.ts b/types/adone/glosses/collections/array_set.d.ts new file mode 100644 index 0000000000..c13d8769f1 --- /dev/null +++ b/types/adone/glosses/collections/array_set.d.ts @@ -0,0 +1,44 @@ +declare namespace adone.collection { + /** + * Respresetns a data structure which is a combination of an array and a set. + * Adding a new member is O(1), testing for membership is O(1), + * and finding the index of an element is O(1). + */ + class ArraySet { + /** + * The number of unique items in this ArraySet. + * If duplicates have been added, than those do not count towards the size. + */ + readonly length: number; + + /** + * Adds the given value to this set. + * + * @param allowDuplicates Whether to allow duplicates in the set, false by default + */ + add(value: T, allowDuplicates?: boolean): this; + + /** + * Checks whether the given value is a member of the set + */ + has(value: T): boolean; + + /** + * Returns the index of the given element. + * If the value is not present it will return -1 + */ + indexOf(value: T): number; + + /** + * Converts the set to an array + */ + toArray(): T[]; + + /** + * Creates an ArraySet from the given iterable object + * + * @param allowDuplicates Whether to allow duplicates in the set, false by default + */ + static from(iterable: Iterable, allowDuplicates?: boolean): ArraySet; + } +} diff --git a/types/adone/glosses/collections/async_queue.d.ts b/types/adone/glosses/collections/async_queue.d.ts new file mode 100644 index 0000000000..9a575a33be --- /dev/null +++ b/types/adone/glosses/collections/async_queue.d.ts @@ -0,0 +1,12 @@ +declare namespace adone.collection { + /** + * Represents an asynchronous queue, each pop is a promise + * that is resolved with an existing element or an element that will be pushed in the future + */ + class AsyncQueue extends Queue> { + /** + * Returns a promise that will be resolved with an existing element or an element that will be pushed in the future + */ + pop(): Promise; + } +} diff --git a/types/adone/glosses/collections/avl_tree.d.ts b/types/adone/glosses/collections/avl_tree.d.ts new file mode 100644 index 0000000000..2b5dc132b6 --- /dev/null +++ b/types/adone/glosses/collections/avl_tree.d.ts @@ -0,0 +1,48 @@ +declare namespace adone.collection { + /** + * Represents an AVL tree, a self-balancing binary search tree + */ + class AVLTree { + constructor(options?: I.BinarySearchTree.ConstructorOptions>); + + /** + * Checks whether the tree is an avl tree + */ + checkIsAVLT(): void; + + /** + * Inserts a new key/value + */ + insert(key: K, value: V): void; + + /** + * Deletes the given key/value from the tree + */ + delete(key: K, value?: V): void; + + /** + * Returns the of keys in the tree + */ + getNumberOFKeys(): number; + + /** + * Searches the given key in the tree + */ + search(key: K): V[]; + + /** + * Returns all the values from the given key bounds + */ + betweenBounds(query: I.BinarySearchTree.Query): V[]; + + /** + * Executed the given callback for each node from left to right + */ + executeOnEveryNode(fn: (tree: AVLTree) => void): void; + + /** + * Prints the tree + */ + prettyPrint(printDate?: boolean, spacing?: string): void; + } +} diff --git a/types/adone/glosses/collections/binary_search_tree.d.ts b/types/adone/glosses/collections/binary_search_tree.d.ts new file mode 100644 index 0000000000..878bd7e6a4 --- /dev/null +++ b/types/adone/glosses/collections/binary_search_tree.d.ts @@ -0,0 +1,110 @@ +declare namespace adone.collection { + namespace I.BinarySearchTree { + interface ConstructorOptions { + /** + * The parent tree + */ + parent?: Tree; + + /** + * Value to keep in this node + */ + value?: V; + + /** + * WHether the values must be unique, false by default. + * If false you can store many values for same keys, otherwise only one + */ + unique?: boolean; + + /** + * Custom keys comparator, by default if a > b => -1, a < b -1, a === b => 0 + */ + compareKeys?(a: K, b: K): number; + + /** + * Function that defines whether 2 values are the same, by default a === b + */ + checkValueEquality?(a: V, b: V): boolean; + } + + interface Query { + $lt?: K; + $lte?: K; + $gt?: K; + $gte?: K; + } + } + + /** + * Represents a binary search tree + */ + class BinarySearchTree { + constructor(options?: I.BinarySearchTree.ConstructorOptions>); + + /** + * Returns the max descendant tree + */ + getMaxKeyDescendant(): BinarySearchTree; + + /** + * Returns the maximum key + */ + getMaxKey(): K; + + /** + * Returns the min descendant tree + */ + getMinKeyDescendant(): BinarySearchTree; + + /** + * Returns the minumum key + */ + getMinKey(): K; + + /** + * Traverses the tree and calls the given function for each node + */ + checkAllNodesFullfillCondition(test: (key: K, value: V) => void): void; + + /** + * Checks whether the tree is a binary search tree + */ + checkIsBST(): void; + + /** + * Returns the of keys in the tree + */ + getNumberOfKeys(): number; + + /** + * Inserts a new key/value + */ + insert(key: K, value: V): void; + + /** + * Searches the given key in the tree + */ + search(key: K): V[]; + + /** + * Returns all the values from the given key bounds + */ + betweenBounds(query: I.BinarySearchTree.Query): V[]; + + /** + * Deletes the given key/value from the tree + */ + delete(key: K, value?: V): void; + + /** + * Executed the given callback for each node from left to right + */ + executeOnEveryNode(fn: (tree: BinarySearchTree) => void): void; + + /** + * Prints the tree + */ + prettyPrint(printData?: boolean, spacing?: string): void; + } +} diff --git a/types/adone/glosses/collections/buffer_list.d.ts b/types/adone/glosses/collections/buffer_list.d.ts new file mode 100644 index 0000000000..b2a4157385 --- /dev/null +++ b/types/adone/glosses/collections/buffer_list.d.ts @@ -0,0 +1,92 @@ +declare namespace adone.collection { + namespace I.BufferList { + type Appendable = Buffer | BufferList | string | number | Array; + } + + /** + * Represents a Node.js Buffer list collector, reader and streamer with callback/promise interface support + */ + class BufferList extends std.stream.Duplex implements PromiseLike { + /** + * Creates a new buffer list + */ + constructor(); + + /** + * Creates a new buffer list and initiates with the given value + */ + constructor(buffer: I.BufferList.Appendable); + + /** + * Creates a new buffer list and subscribes the given callback on the end/error event + */ + constructor(callback: (err: any, data: Buffer) => void); + + /** + * Adds an additional buffer or BufferList to the internal list + */ + append(buf: I.BufferList.Appendable): this; + + /** + * Ends the stream + */ + end(chunk?: Buffer): void; + end(chunk?: () => void): void; + + /** + * Returns the byte at the specified index + */ + get(idx: number): number; + + /** + * Returns a new Buffer object containing the bytes within the range specified. + */ + slice(start?: number, end?: number): Buffer; + + /** + * Copies the content of the list in the dest buffer + * starting from destStart and containing the bytes within the range specified with srcStart to srcEnd + * + * @param dstStart writes from this position + * @param srcStart reads bytes from this position + * @param srcEnd read bytes to this position + */ + copy(dst: T, dstStart?: number, srcStart?: number, srcEnd?: number): T; + + /** + * Returns a new BufferList object containing the bytes within the range specified. + * No copies will be performed. All buffers in the result share memory with the original list. + * + * @param start slice from + * @param end slice to + */ + shallowSlice(start?: number, end?: number): BufferList; + + /** + * Return a string representation of the buffer + */ + toString(encoding?: fs.I.Encoding, start?: number, end?: number): string; + + /** + * Shifts bytes off the start of the list + */ + consume(bytes: number): this; + + /** + * Performs a shallow-copy of the list. + */ + duplicate(): BufferList; + + /** + * Destroys the stream + */ + destroy(): void; + + then( + onfulfilled?: ((value: Buffer) => T1 | PromiseLike) | null, + onrejected?: ((reason: any) => T2 | PromiseLike) | null + ): PromiseLike; + + catch(onrejected?: ((reason: any) => T | PromiseLike) | null): PromiseLike; + } +} diff --git a/types/adone/glosses/collections/byte_array.d.ts b/types/adone/glosses/collections/byte_array.d.ts new file mode 100644 index 0000000000..1dc3080fb3 --- /dev/null +++ b/types/adone/glosses/collections/byte_array.d.ts @@ -0,0 +1,892 @@ +declare namespace adone.collection { + namespace I { + type Long = math.Long; + + type Longable = math.I.Longable; + + namespace ByteArray { + interface Varint32 { + value: number; + length: number; + } + + interface Varint64 { + value: Long; + length: number; + } + + interface String { + string: string; + length: number; + } + + type Wrappable = string | ByteArray | Buffer | Uint8Array | ArrayBuffer; + + type Metrics = "b" | "c"; + } + } + + /** + * Represents an array of bytes, enhanced Node.js Buffer + */ + class ByteArray { + readonly woffset: number; + + readonly roffset: number; + + readonly buffer: Buffer; + + readonly noAssert: boolean; + + /** + * Constructs a new ByteArray + * + * @param capacity Initial capacity. Defaults to ByteArray.DEFAULT_CAPACITY(64) + * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) + */ + constructor(capacity?: number, noAssert?: boolean); + + /** + * Reads a BitSet as an array of booleans. + * + * @param offset Offset to read from. Will use and increase offset by length if omitted. + */ + readBitSet(offset?: number): boolean[]; + + /** + * Reads the specified number of bytes. + * + * @param length Number of bytes to read + * @param offset Offset to read from. Will use and increase offset by length if omitted. + */ + read(length: number, offset?: number): ByteArray; + + /** + * Reads an 8bit signed integer + * + * @param offset Offset to read from + */ + readInt8(offset?: number): number; + + /** + * Reads an 8bit unsigned integer + * + * @param offset Offset to read from + */ + readUInt8(offset?: number): number; + + /** + * Reads a 16bit signed le integer + * + * @param offset Offset to read from + */ + readInt16LE(offset?: number): number; + + /** + * Reads a 16bit unsigned le integer + * + * @param offset Offset to read from + */ + readUInt16LE(offset?: number): number; + + /** + * Reads a 16bit signed be integer + * + * @param offset Offset to read from + */ + readInt16BE(offset?: number): number; + + /** + * Reads a 16bit unsigned be integer + * + * @param offset Offset to read from + */ + readUInt16BE(offset?: number): number; + + /** + * Reads a 32bit signed le integer + * + * @param offset Offset to read from + */ + readInt32LE(offset?: number): number; + + /** + * Reads a 32bit unsigned le integer + * + * @param offset Offset to read from + */ + readUInt32LE(offset?: number): number; + + /** + * Reads a 32bit signed be integer + * + * @param offset Offset to read from + */ + readInt32BE(offset?: number): number; + + /** + * Reads a 32bit unsigned be integer + * + * @param offset Offset to read from + */ + readUInt32BE(offset?: number): number; + + /** + * Reads a 64bit signed le integer as math.Long + * + * @param offset Offset to read from + */ + readInt64LE(offset?: number): math.Long; + + /** + * Reads a 64bit unsigned le integer as math.Long + * + * @param offset Offset to read from + */ + readUInt64LE(offset?: number): math.Long; + + /** + * Reads a 64bit signed be integer as math.Long + * + * @param offset Offset to read from + */ + readInt64BE(offset?: number): math.Long; + + /** + * Reads a 64bit unsigned be integer as math.Long + * + * @param offset Offset to read from + */ + readUInt64BE(offset?: number): math.Long; + + /** + * Reads a 32bit le float + * + * @param offset Offset to read from + */ + readFloatLE(offset?: number): number; + + /** + * Reads a 32bit be float + * + * @param offset Offset to read from + */ + readFloatBE(offset?: number): number; + + /** + * Reads a 64bit le float + * + * @param offset Offset to read from + */ + readDoubleLE(offset?: number): number; + + /** + * Reads a 64bit be float + * + * @param offset Offset to read from + */ + readDoubleBE(offset?: number): number; + + /** + * Appends some data to this ByteArray. + * This will overwrite any contents behind the specified offset up to the appended data's length. + * + * @param source The source write from + * @param offset Offset to write at + * @param length length to read from the source + * @param encoding encoding to use for wrapping the source in bytearray + */ + write(source: I.ByteArray.Wrappable, offset?: number, length?: number, encoding?: string): this; + + /** + * Writes the array as a bitset. + * @param value Array of booleans to write + */ + writeBitSet(value: number[]): this; + + /** + * Writes the array as a bitset. + * @param value Array of booleans to write + * @param offset Offset to write at + */ + writeBitSet(value: number[], offset: number): number; + + /** + * Writes a buffer at the given offset + * @param buf Buffer to write + * @param offset Offset to write at + */ + writeBuffer(buf: Buffer, offset?: number): this; + + /** + * Writes an 8bit signed integer + * + * @param offset Offset to write at + */ + writeInt8(value: number, offset?: number): this; + + /** + * Writes an 8bit unsigned integer + * + * @param offset Offset to write at + */ + writeUInt8(value: number, offset?: number): this; + + /** + * Writes a 16bit signed le integer + * + * @param offset Offset to write at + */ + writeInt16LE(value: number, offset?: number): this; + + /** + * Writes a 16bit signed be integer + * + * @param offset Offset to write at + */ + writeInt16BE(value: number, offset?: number): this; + + /** + * Writes a 16bit unsigned le integer + * + * @param offset Offset to write at + */ + writeUInt16LE(value: number, offset?: number): this; + + /** + * Writes a 16bit unsigned be integer + * + * @param offset Offset to write at + */ + writeUInt16BE(value: number, offset?: number): this; + + /** + * Writes a 32bit signed le integer + * + * @param offset Offset to write at + */ + writeInt32LE(value: number, offset?: number): this; + + /** + * Writes a 32bit signed be integer + * + * @param offset Offset to write at + */ + writeInt32BE(value: number, offset?: number): this; + + /** + * Writes a 32bit unsigned le integer + * + * @param offset Offset to write at + */ + writeUInt32LE(value: number, offset?: number): this; + + /** + * Writes a 32bit unsigned be integer + * + * @param offset Offset to write at + */ + writeUInt32BE(value: number, offset?: number): this; + + /** + * Writes a 64bit signed le long integer + * + * @param offset Offset to write at + */ + writeInt64LE(value: math.Long | string | number, offset?: number): this; + + /** + * Writes a 64bit signed be long integer + * + * @param offset Offset to write at + */ + writeInt64BE(value: math.Long | string | number, offset?: number): this; + + /** + * Writes a 64bit unsigned le long integer + * + * @param offset Offset to write at + */ + writeUInt64LE(value: math.Long | string | number, offset?: number): this; + + /** + * Writes a 64bit unsigned be long integer + * + * @param offset Offset to write at + */ + writeUInt64BE(value: math.Long | string | number, offset?: number): this; + + /** + * Writes a 32bit le float + * + * @param offset Offset to write at + */ + writeFloatLE(value: number, offset?: number): this; + + /** + * Writes a 32bit be float + * + * @param offset Offset to write at + */ + writeFloatBE(value: number, offset?: number): this; + + /** + * Writes a 64bit le float + * + * @param offset Offset to write at + */ + writeDoubleLE(value: number, offset?: number): this; + + /** + * Writes a 64bit be float + * + * @param offset Offset to write at + */ + writeDoubleBE(value: number, offset?: number): this; + + /** + * Writes a 32bit base 128 variable-length integer + */ + writeVarint32(value: number): this; + + /** + * Writes a 32bit base 128 variable-length integer + * + * @param offset Offset to write at + */ + writeVarint32(value: number, offset: number): number; + + /** + * Writes a zig-zag encoded 32bit base 128 variable-length integer + */ + writeVarint32ZigZag(value: number): this; + + /** + * Writes a zig-zag encoded 32bit base 128 variable-length integer + * + * @param offset Offset to write at + */ + writeVarint32ZigZag(value: number, offset: number): number; + + /** + * Reads a 32bit base 128 variable-length integer + */ + readVarint32(): number; + + /** + * Reads a 32bit base 128 variable-length integer + * + * @param offset Offset to read from + */ + readVarint32(offset: number): I.ByteArray.Varint32; + + /** + * Reads a zig-zag encoded 32bit base 128 variable-length integer + */ + readVarint32ZigZag(): number; + + /** + * Reads a zig-zag encoded 32bit base 128 variable-length integer + * + * @param offset Offset to read from + */ + readVarint32ZigZag(offset: number): I.ByteArray.Varint32; + + /** + * Writes a 64bit base 128 variable-length integer + */ + writeVarint64(value: math.Long | string | number): this; + + /** + * Writes a 64bit base 128 variable-length integer + * + * @param offset Offset to write at + */ + writeVarint64(value: math.Long | string | number, offset: number): number; + + /** + * Writes a zig-zag encoded 64bit base 128 variable-length integer + */ + writeVarint64ZigZag(value: math.Long | string | number): this; + + /** + * Writes a zig-zag encoded 64bit base 128 variable-length integer + * + * @param offset Offset to write at + */ + writeVarint64ZigZag(value: math.Long | string | number, offset: number): number; + + /** + * Reads a 64bit base 128 variable-length integer + */ + readVarint64(): I.Long; + + /** + * Reads a 64bit base 128 variable-length integer + * + * @param offset Offset to read from + */ + readVarint64(offset: number): I.ByteArray.Varint64; + + /** + * Reads a zig-zag encoded 64bit base 128 variable-length integer + */ + readVarint64ZigZag(): math.Long; + + /** + * Reads a zig-zag encoded 64bit base 128 variable-length integer + * + * @param offset Offset to read from + */ + readVarint64ZigZag(offset: number): I.ByteArray.Varint64; + + /** + * Writes a NULL-terminated UTF8 encoded string. + * For this to work the specified string must not contain any NULL characters itself + */ + writeCString(str: string): this; + + /** + * Writes a NULL-terminated UTF8 encoded string. + * For this to work the specified string must not contain any NULL characters itself + * + * @param offset Offset to write at + */ + writeCString(str: string, offset: number): number; + + /** + * Reads a NULL-terminated UTF8 encoded string. + * For this to work the string read must not contain any NULL characters itself + */ + readCString(): string; + + /** + * Reads a NULL-terminated UTF8 encoded string. + * For this to work the string read must not contain any NULL characters itself + * + * @param offset Offset to read from + */ + readCString(offset: number): I.ByteArray.String; + + /** + * Writes an UTF8 encoded string + */ + writeString(str: string): this; + + /** + * Writes an UTF8 encoded string + * + * @param offset Offset to write at + */ + writeString(str: string, offset: number): number; + + /** + * Reads an UTF8 encoded string + * + * @param length Number of characters or bytes to read + * @param metrics Metrics specifying what n is meant to count. Defaults to ByteArray.METRICS_CHARS("c") + */ + readString(length: number, metrics?: I.ByteArray.Metrics): string; + + /** + * Reads an UTF8 encoded string + * + * @param length Number of characters or bytes to read + * @param metrics Metrics specifying what n is meant to count. Defaults to ByteArray.METRICS_CHARS("c") + * @param offset Offset to read from + */ + readString(length: number, metrics: I.ByteArray.Metrics, offset: number): I.ByteArray.String; + + /** + * Reads an UTF8 encoded string + * + * @param length Number of characters or bytes to read + * @param offset Offset to read from + */ + readString(length: number, offset: number): I.ByteArray.String; + + /** + * Writes a length as varint32 prefixed UTF8 encoded string + */ + writeVString(str: string): this; + + /** + * Writes a length as varint32 prefixed UTF8 encoded string + * + * @param offset Offset to read from + */ + writeVString(str: string, offset: number): number; + + /** + * Reads a length as varint32 prefixed UTF8 encoded string + */ + readVString(): string; + + /** + * Reads a length as varint32 prefixed UTF8 encoded string + * + * @param offset Offset to read from + */ + readVString(offset: number): I.ByteArray.String; + + /** + * Appends this ByteArray's contents to another ByteArray. + * This will overwrite any contents behind the specified offset up to the length of this ByteArray's data + * + * @param offset Offset to append to + */ + appendTo(target: ByteArray, offset?: number): this; + + /** + * Enables or disables assertions of argument types and offsets. + * Assertions are enabled by default but you can opt to disable them if your code already makes sure that everything is valid + */ + assert(assert?: boolean): this; + + /** + * Gets the capacity of this ByteArray's backing buffer + */ + capacity(): number; + + /** + * Clears this ByteArray's offsets by setting offset to 0 and limit to the backing buffer's capacity + */ + clear(): this; + + /** + * Creates a cloned instance of this ByteArray, + * preset with this ByteArray's values for offset, markedOffset and limit + * + * @param copy Whether to copy the backing buffer or to return another view on the same, false by default + */ + clone(copy?: boolean): ByteArray; + + /** + * Compacts this ByteArray to be backed by a buffer of its contents' length. + * Will set offset = 0 and limit = capacity and adapt markedOffset to the same relative position if set + * + * @param begin Offset to start at, buffer offset by default + * @param end Offset to end at, buffer limit by default + */ + compact(begin?: number, end?: number): this; + + /** + * Creates a copy of this ByteArray's contents. + * + * @param begin Begin offset, buffer offset by default + * @param end End offset, buffer limit by default + */ + copy(begin?: number, end?: number): ByteArray; + + /** + * Copies this ByteArray's contents to another ByteArray. + * + * @param targetOffset Offset to copy to. Will use and increase the target's offset by the number of bytes copied if omitted + * @param sourceOffset Offset to start copying from. Will use and increase offset by the number of bytes copied if omitted + * @param sourceLimit Offset to end copying from, defaults to the buffer limit + */ + copyTo(target: ByteArray, targetOffset?: number, souceOffset?: number, sourceLimit?: number): this | ByteArray; + + /** + * Makes sure that this ByteArray is backed by a ByteArray#buffer of at least the specified capacity. + * If the current capacity is exceeded, it will be doubled. + * If double the current capacity is less than the required capacity, the required capacity will be used instead + */ + ensureCapacity(capacity: number): this; + + /** + * Overwrites this ByteArray's contents with the specified value. + * + * @param value Byte value to fill with. If given as a string, the first character is used + * @param begin Begin offset. Will use and increase offset by the number of bytes written if omitted. defaults to offset + * @param end End offset, defaults to limit. + */ + fill(value: string | number, begin?: number, end?: number): this; + + /** + * Makes this ByteArray ready for a new sequence of write or relative read operations. + * Sets limit = offset and offset = 0. + * Make sure always to flip a ByteArray when all relative read or write operations are complete + */ + flip(): this; + + /** + * Marks an offset on this ByteArray to be used later + * + * @param offset Offset to mark. Defaults to offset. + */ + mark(offset?: number): this; + + /** + * Prepends some data to this ByteArray. + * This will overwrite any contents before the specified offset up to the prepended data's length. + * If there is not enough space available before the specified offset, + * the backing buffer will be resized and its contents moved accordingly + * + * @param source Data to prepend + * @param offset Offset to prepend at. Will use and decrease offset by the number of bytes prepended if omitted. + */ + prepend(source: I.ByteArray.Wrappable, offset: number): this; + + /** + * Prepends some data to this ByteArray. + * This will overwrite any contents before the specified offset up to the prepended data's length. + * If there is not enough space available before the specified offset, + * the backing buffer will be resized and its contents moved accordingly + * + * @param source Data to prepend + * @param encoding Encoding if data is a string + * @param offset Offset to prepend at. Will use and decrease offset by the number of bytes prepended if omitted. + */ + prepend(source: I.ByteArray.Wrappable, encoding?: string, offset?: number): this; + + /** + * Prepends this ByteArray to another ByteArray. + * This will overwrite any contents before the specified offset up to the prepended data's length. + * If there is not enough space available before the specified offset, + * the backing buffer will be resized and its contents moved accordingly + * + * @param offset Offset to prepend at + */ + prependTo(target: ByteArray, offset?: number): this; + + /** + * Gets the number of remaining readable bytes + */ + remaining(): number; + + /** + * Resets this ByteArray's offset. + * If an offset has been marked through mark before, offset will be set to markedOffset, which will then be discarded. + * If no offset has been marked, sets offset = 0 + */ + reset(): this; + + /** + * Resizes this ByteArray to be backed by a buffer of at least the given capacity. + * Will do nothing if already that large or larger. + * + * @param capacity Capacity required + */ + resize(capacity: number): this; + + /** + * Reverses this ByteArray's contents. + * + * @param begin Offset to start at, defaults to offset + * @param end Offset to end at, defaults to limit + */ + reverse(begin?: number, end?: number): this; + + /** + * Skips the next length bytes. This will just advance + */ + skip(length: number): this; + + /** + * Slices this ByteArray by creating a cloned instance with offset = begin and limit = end + * + * @param begin Begin offset, defaults to offset + * @param end End offset, defaults to limit + */ + slice(begin?: number, end?: number): ByteArray; + + /** + * Returns a copy of the backing buffer that contains this ByteArray's contents. + * + * @param forceCopy If true returns a copy, otherwise returns a view referencing the same memory if possible, false by default + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toBuffer(forceCopy?: boolean, begin?: number, end?: number): Buffer; + + /** + * Returns a raw buffer compacted to contain this ByteArray's contents + */ + toArrayBuffer(): ArrayBuffer; + + /** + * Converts the ByteArray's contents to a string + * + * @param encoding Output encoding + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toString(encoding?: string, begin?: number, end?: number): string; + + /** + * Encodes this ByteArray's contents to a base64 encoded string + * + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toBase64(begin?: number, end?: number): string; + + /** + * Encodes this ByteArray to a binary encoded string, that is using only characters 0x00-0xFF as bytes + * + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toBinary(begin?: number, end?: number): string; + + /** + * Encodes this ByteArray to a hex encoded string with marked offsets + * + * @param columns If true returns two columns hex + ascii, defaults to false + */ + toDebug(columns?: boolean): string; + + /** + * Encodes this ByteArray's contents to a hex encoded string + * + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toHex(begin?: number, end?: number): string; + + /** + * Encodes this ByteArray's contents to an UTF8 encoded string + * + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toUTF8(begin?: number, end?: number): string; + + static accessor(): typeof Buffer; + + /** + * Allocates a new ByteArray backed by a buffer of the specified capacity. + * + * @param capacity Initial capacity. Defaults to ByteArray.DEFAULT_CAPACITY(64) + * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) + */ + static allocate(capacity?: number, noAssert?: boolean): ByteArray; + + /** + * Concatenates multiple ByteArrays into one + * + * @param encoding Encoding for strings + * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) + */ + static concat(buffers: I.ByteArray.Wrappable[], encoding?: string, noAssert?: boolean): ByteArray; + + static type(): typeof Buffer; + + /** + * Wraps a buffer or a string. + * Sets the allocated ByteArray's offset to 0 and its limit to the length of the wrapped data + * + * @param encoding Encoding for strings + * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) + */ + static wrap(buffer: I.ByteArray.Wrappable, encoding?: string, noAssert?: boolean): ByteArray; + + /** + * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer + */ + static calculateVarint32(value: number): number; + + /** + * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding + */ + static zigZagEncode32(n: number): number; + + /** + * Decodes a zigzag encoded signed 32bit integer + */ + static zigZagDecode32(n: number): number; + + /** + * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer + */ + static calculateVarint64(value: number | string): number; + + /** + * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding + */ + static zigZagEncode64(value: number | string | I.Long): I.Long; + + /** + * Decodes a zigzag encoded signed 64bit integer. + */ + static zigZagDecode64(value: number | string | I.Long): I.Long; + + /** + * 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. + */ + static calculateString(str: string): number; + + /** + * Decodes a base64 encoded string to a ByteArray + */ + static fromBase64(str: string): ByteArray; + + /** + * Encodes a binary string to base64 like window.btoa does + */ + static btoa(str: string): string; + + /** + * Decodes a base64 encoded string to binary like window.atob does + */ + static atob(b64: string): string; + + /** + * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteArray + */ + static fromBinary(str: string): ByteArray; + + /** + * Decodes a hex encoded string with marked offsets to a ByteArray + */ + static fromDebug(str: string, noAssert?: boolean): ByteArray; + + /** + * Decodes a hex encoded string to a ByteArray + */ + static fromHex(str: string, noAssert?: boolean): ByteArray; + + /** + * Decodes an UTF8 encoded string to a ByteArray + */ + static fromUTF8(str: string, noAssert?: boolean): ByteArray; + + /** + * Default initial capacity + */ + static DEFAULT_CAPACITY: number; + + /** + * Default no assertions flag + */ + static DEFAULT_NOASSERT: boolean; + + /** + * Maximum number of bytes required to store a 32bit base 128 variable-length integer + */ + static MAX_VARINT32_BYTES: number; + + /** + * Maximum number of bytes required to store a 64bit base 128 variable-length integer + */ + static MAX_VARINT64_BYTES: number; + + /** + * Metrics representing number of UTF8 characters. Evaluates to `c`. + */ + static METRICS_CHARS: string; + + /** + * Metrics representing number of bytes. Evaluates to `b`. + */ + static METRICS_BYTES: string; + } +} diff --git a/types/adone/glosses/collections/default_map.d.ts b/types/adone/glosses/collections/default_map.d.ts new file mode 100644 index 0000000000..46b8ccebfe --- /dev/null +++ b/types/adone/glosses/collections/default_map.d.ts @@ -0,0 +1,9 @@ +declare namespace adone.collection { + /** + * Represents a Map that has a default values factory object or function. + * Each get of non-existent key goes through the factory + */ + class DefaultMap extends Map { + constructor(factory?: ((key: K) => V) | { [key: string]: V }, iterable?: Iterable<[K, V]>); + } +} diff --git a/types/adone/glosses/collections/fast_lru.d.ts b/types/adone/glosses/collections/fast_lru.d.ts new file mode 100644 index 0000000000..e991322bc0 --- /dev/null +++ b/types/adone/glosses/collections/fast_lru.d.ts @@ -0,0 +1,61 @@ +declare namespace adone.collection { + /** + * Represents a faster LRU cache but with less functionality + */ + class FastLRU { + /** + * @param size Cache size, unlimited by default + */ + constructor(size?: number, options?: { + /** + * Function that is called when a value is deleted + */ + dispose?(key: K, value: V): void + }); + + /** + * The actual size of the cache + */ + readonly size: number; + + /** + * Gets the value by the given key + */ + get(key: K): V | undefined; + + /** + * Sets a new value for the given key + */ + set(key: K, value: V): void; + + /** + * Deletes the given key from the cache + */ + delete(key: K): boolean; + + /** + * Checks whether the cache has an element with the given key + */ + has(key: K): boolean; + + /** + * Returns the keys iterator + */ + keys(): IterableIterator; + + /** + * Returns the values iterator + */ + values(): IterableIterator; + + /** + * Returns the entries iterator + */ + entries(): IterableIterator<[K, V]>; + + /** + * Clears the cache + */ + clear(): void; + } +} diff --git a/types/adone/glosses/collections/index.d.ts b/types/adone/glosses/collections/index.d.ts new file mode 100644 index 0000000000..234ffe85f4 --- /dev/null +++ b/types/adone/glosses/collections/index.d.ts @@ -0,0 +1,28 @@ +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// + +declare namespace adone { + /** + * Data structures + */ + namespace collection { + // + } +} diff --git a/types/adone/glosses/collections/linked_list.d.ts b/types/adone/glosses/collections/linked_list.d.ts new file mode 100644 index 0000000000..69ffa4da4b --- /dev/null +++ b/types/adone/glosses/collections/linked_list.d.ts @@ -0,0 +1,150 @@ +declare namespace adone.collection { + namespace I.LinkedList { + /** + * Represents the node of a linked list + */ + interface Node { + /** + * The next node + */ + next?: Node; + + /** + * The previous node + */ + prev?: Node; + + /** + * The value this node contains + */ + value: T; + } + } + + /** + * Represents a linked list + */ + class LinkedList { + /** + * The maximum length of the list + */ + readonly maxLength: number; + + /** + * Current length of the list + */ + readonly length: number; + + /** + * Whether the list is autoresizable + */ + readonly autoresize: boolean; + + /** + * @param maxLength Maximum length of the linked list + */ + constructor(maxLength?: number); + + /** + * Whether the list is full + */ + readonly full: boolean; + + /** + * Whether the list is empty + */ + readonly empty: boolean; + + /** + * Resizes the list + */ + resize(newLength: number): this; + + /** + * Adds a new node to the end + * + * @returns Added node + */ + push(value: T): I.LinkedList.Node; + + /** + * Removes the last node, returns undefined if the list is empty + */ + pop(): T | undefined; + + /** + * Removes the first node, returns undefined if the list is empty + */ + shift(): T | undefined; + + /** + * Inserts a new node at the beginning of the list + * + * @returns Added node + */ + unshift(value: T): I.LinkedList.Node; + + /** + * Moves the given node to the end of the list + */ + pushNode(node: I.LinkedList.Node): void; + + /** + * Moved the given node to the beginning of the list + */ + unshiftNode(node: I.LinkedList.Node): void; + + /** + * Removes the given node from the list + */ + removeNode(node: I.LinkedList.Node): void; + + /** + * Clears the list + * + * @param strong Whether to reset all the node's values + */ + clear(strong?: boolean): void; + + /** + * Convers the list to an array + */ + toArray(): T[]; + + /** + * The first element of the list + */ + readonly front: T; + + /** + * The last element of the list + */ + readonly back: T; + + /** + * Returns an iterator over the list elements + */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns the next node for the given node + */ + nextNode(node: I.LinkedList.Node): I.LinkedList.Node; + + /** + * Maps this linked list to a new one using the given function + */ + map(fn: (value: T, index: number) => R): LinkedList; + + /** + * Invokes the given callback for each value from the beginning to the end (much faster than for-of). + * If the given function returns false it stops iterating. + */ + forEach(callback: (value: T, index: number) => void | boolean): void; + + /** + * Default length of a new created linked list + */ + static DEFAULT_LENGTH: number; + } +} diff --git a/types/adone/glosses/collections/lru.d.ts b/types/adone/glosses/collections/lru.d.ts new file mode 100644 index 0000000000..7d41e32cd5 --- /dev/null +++ b/types/adone/glosses/collections/lru.d.ts @@ -0,0 +1,213 @@ +declare namespace adone.collection { + namespace I.LRU { + type LengthCalculator = (value: V, key: K) => number; + interface ConstructorOptions { + /** + * The maximum size of the cache, checked by applying the length function to all values in the cache. + * Default is Infinity + */ + max?: number; + + /** + * Maximum age in ms. Items are not pro-actively pruned out as they age, + * but if you try to get an item that is too old, + * it'll drop it and return undefined instead of giving it to you + */ + maxAge?: number; + + /** + * Function that is used to calculate the length of stored items + */ + length?: LengthCalculator; + + /** + * Function that is called on items when they are dropped from the cache + */ + dispose?(key: K, value: V): void; + + /** + * Whether to return the stale value before deleting it + */ + stale?: boolean; + + /** + * Dispose will only be called when a key falls out of the cache, not when it is overwritten + */ + noDisposeOnSet?: boolean; + } + + interface SerializedEntry { + /** + * key + */ + key: K; + + /** + * value + */ + value: V; + + /** + * when it becomes expired + */ + e: number; + } + + interface Entry { + /** + * key + */ + key: K; + + /** + * value + */ + value: V; + + /** + * entry length + */ + length: number; + + /** + * Timestamp when the entry was created + */ + now: number; + + /** + * Maximum live time + */ + maxAge: number; + } + } + + /** + * Represent an LRU cache + */ + class LRU { + /** + * Creates an LRU cache of the given size + */ + constructor(max: number); + + /** + * Creates an LRU cache with the given options + */ + constructor(options?: I.LRU.ConstructorOptions); + + /** + * The length of the cache, setter resizes the cache + */ + max: number; + + /** + * stale setting + */ + allowStale: boolean; + + /** + * maxAge setting + */ + maxAge: number; + + /** + * length setting + */ + lengthCalculator: I.LRU.LengthCalculator; + + /** + * Total length of objects in cache taking into account length options function + */ + readonly length: number; + + /** + * Total quantity of objects currently in cache. + * Note, that stale items are returned as part of this item count. + */ + readonly itemCount: number; + + /** + * Iterates over all the keys in the cache, in reverse recent-ness order. (ie, less recently used items are iterated over first.) + */ + rforEach(fn: (this: T, value: V, key: K, cache: LRU) => void, thisp?: T): void; + + /** + * Iterates over all the keys in the cache, in order of recent-ness + */ + forEach(fn: (this: T, value: V, key: K, cache: LRU) => void, thisp?: T): void; + + /** + * Returns an array of the keys in the cache + */ + keys(): K[]; + + /** + * Returns an array of the values in the cache + */ + values(): V[]; + + /** + * Clears the cache entirely, throwing away all values + */ + reset(): void; + + /** + * Return an array of the cache entries ready for serialization and usage with 'destinationCache.load(arr)` + */ + dump(): Array>; + + /** + * Returns an internal lru list of entries + */ + dumpLru(): LinkedList>; + + /** + * @param opts std.util.inspect options + */ + inspect(opts?: object): string; + + /** + * Sets a new value for the given key. Updates the "recently used"-ness of the key + * + * @param maxAge maxAge option specific for this key + * @returns Whether the key was set + */ + set(key: K, value: V, maxAge?: number): boolean; + + /** + * Check if a key is in the cache, without updating the recent-ness or deleting it for being stale + */ + has(key: K): boolean; + + /** + * Gets the value of the given key. Updates the "recently used"-ness of the key + */ + get(key: K): V | undefined; + + /** + * Returns the key value without updating the "recently used"-ness of the key + */ + peek(key: K): V | undefined; + + /** + * Deletes the less recently used element + */ + pop(): I.LRU.Entry; + + /** + * Deletes a key out of the cache + */ + del(key: K): void; + + /** + * Loads another cache entries array, obtained with sourceCache.dump(), into the cache. + * The destination cache is reset before loading new entries + */ + load(arr: Array>): void; + + /** + * Manually iterates over the entire cache proactively pruning old entries + */ + prune(): void; + } +} diff --git a/types/adone/glosses/collections/map_cache.d.ts b/types/adone/glosses/collections/map_cache.d.ts new file mode 100644 index 0000000000..55bbb6e05f --- /dev/null +++ b/types/adone/glosses/collections/map_cache.d.ts @@ -0,0 +1,13 @@ +declare namespace adone.collection { + class MapCache { + has(key: string): boolean; + + get(key: string): T; + + set(key: string, value: T): void; + + delete(key: string): void; + + clear(): void; + } +} diff --git a/types/adone/glosses/collections/ns_cache.d.ts b/types/adone/glosses/collections/ns_cache.d.ts new file mode 100644 index 0000000000..5630c295d3 --- /dev/null +++ b/types/adone/glosses/collections/ns_cache.d.ts @@ -0,0 +1,17 @@ +declare namespace adone.collection { + class NSCache { + constructor(size: number, namespaces: string[]); + + resize(newSize: number): void; + + set(ns: string, key: string, value: T): void; + + get(ns: string, key: string): T; + + has(ns: string, key: string): boolean; + + delete(ns: string, key: string): void; + + clear(): void; + } +} diff --git a/types/adone/glosses/collections/priority_queue.d.ts b/types/adone/glosses/collections/priority_queue.d.ts new file mode 100644 index 0000000000..0fb1e92814 --- /dev/null +++ b/types/adone/glosses/collections/priority_queue.d.ts @@ -0,0 +1,78 @@ +declare namespace adone.collection { + namespace I.PriorityQueue { + interface ConstructorOptions { + /** + * Function that compares objects. + * + * Must return a positive value if a > b, a negative if a < b, and zero for equal objects + */ + compare?(a: T, b: T): number; + + /** + * Function that evaluates the priority value by the given objects, + * if the returned value > 0, then the first argument has higher priority, + * = 0 same priority, < 0 lower priority. + * By default the top element is an element that has the highest priority, + * the default priority function is equal to the compare function + */ + priority?(a: T, b: T): number; + } + } + + /** + * Represents a priority queue + */ + class PriorityQueue { + /** + * Whether the queue is empty + */ + readonly empty: boolean; + + /** + * The length of the queue + */ + readonly length: number; + + constructor(options?: I.PriorityQueue.ConstructorOptions); + + /** + * Clones the queue + */ + clone(): PriorityQueue; + + /** + * Inserts a new element + */ + push(x: T): this; + + /** + * Removes the top element (that has the highest priority) + */ + pop(): T | undefined; + + /** + * Deletes the given element from the queue + */ + delete(x: T): this; + + /** + * Replaces the top element (pop + push) + */ + replace(x: T): T; + + /** + * Faster push + pop + */ + pushpop(x: T): T; + + /** + * Converts the queue to an array, it works with a clone of the queue, so the original queue is untouched + */ + toArray(): T[]; + + /** + * Creates a queue object from the given iterable + */ + static from(iterable: Iterable, options?: I.PriorityQueue.ConstructorOptions): PriorityQueue; + } +} diff --git a/types/adone/glosses/collections/queue.d.ts b/types/adone/glosses/collections/queue.d.ts new file mode 100644 index 0000000000..8a0832a7e6 --- /dev/null +++ b/types/adone/glosses/collections/queue.d.ts @@ -0,0 +1,33 @@ +declare namespace adone.collection { + /** + * Represents a queue + */ + class Queue { + /** + * Whether the queue is full + */ + readonly full: boolean; + + /** + * The length of the queue + */ + readonly length: number; + + /** + * Whether the queue is empty + */ + readonly empty: boolean; + + /** + * Inserts a new element at the end + */ + push(x: S): this; + + /** + * Removes and returns an element from the beginning + */ + pop(): T | undefined; + + static from(iterable: Iterable, length?: number): Queue; + } +} diff --git a/types/adone/glosses/collections/rb_tree.d.ts b/types/adone/glosses/collections/rb_tree.d.ts new file mode 100644 index 0000000000..2ed7a81323 --- /dev/null +++ b/types/adone/glosses/collections/rb_tree.d.ts @@ -0,0 +1,184 @@ +declare namespace adone.collection { + namespace I.RedBlackTree { + interface Node { + /** + * The key associated to the node + */ + key: K; + + /** + * The value associated to the node + */ + value: V; + + /** + * The left subtree of the node + */ + left?: Node; + + /** + * The right subtree of the node + */ + right?: Node; + } + + interface Iterator { + /** + * Checks if the iterator is valid + */ + readonly valid: boolean; + + /** + * The value of the node at the iterator's current position, null if invalid + */ + readonly node: Node | null; + + /** + * The key of the item referenced by the iterator, undefined if invalid + */ + readonly key?: K; + + /** + * The value of the item referenced by the iterator, undefined if invalid + */ + readonly value?: V; + + /** + * Returns the position of this iterator in the sequence + */ + readonly index: number; + + /** + * If true, then the iterator is not at the end of the sequence + */ + readonly hasNext: boolean; + + /** + * If true, then the iterator is not at the beginning of the sequence + */ + readonly hasPrev: boolean; + + /** + * The tree associated to the iterator + */ + tree: RedBlackTree; + + /** + * Makes a copy of the iterator + */ + clone(): Iterator; + + /** + * Removes the item at the position of the iterator and returns a new rb-tree + */ + remove(): RedBlackTree; + + /** + * Advances the iterator to the next position + */ + next(): void; + + /** + * Updates the value of the node in the tree at this iterator and returns a new rb-tree + */ + update(value: V): RedBlackTree; + + /** + * Moves the iterator backward one element + */ + prev(): void; + } + } + + /** + * Represents a fully persistent red-black tree + */ + class RedBlackTree { + /** + * The root node of the tree + */ + root: I.RedBlackTree.Node; + + constructor(compare?: (a: K, b: K) => number, root?: RedBlackTree); + + /** + * A sorted array of all the keys in the tree + */ + readonly keys: K[]; + + /** + * An array of all the values in the tree + */ + readonly values: V[]; + + /** + * The number of items in the tree + */ + readonly length: number; + + /** + * An iterator pointing to the first element in the tree + */ + readonly begin: I.RedBlackTree.Iterator; + + /** + * An iterator pointing to the last element in the tree + */ + readonly end: I.RedBlackTree.Iterator; + + /** + * Creates a new tree with the new pair inserted + */ + insert(key: K, value: V): RedBlackTree; + + /** + * Walks a visitor function over the nodes of the tree in order + * + * @param visit A callback that gets executed on each node. + * If a truthy value is returned from the visitor, then iteration is stopped. + * @param lo An optional start of the range to visit (inclusive) + * @param hi An optional end of the range to visit (non-inclusive) + */ + forEach(visit: (key: K, value: V) => T, lo?: K, hi?: K): T; + + /** + * Finds an iterator starting at the given element + */ + at(idx: number): I.RedBlackTree.Iterator; + + /** + * Finds the first item in the tree whose key is >= key + */ + ge(key: K): I.RedBlackTree.Iterator; + + /** + * Finds the first item in the tree whose key is > key + */ + gt(key: K): I.RedBlackTree.Iterator; + + /** + * Finds the first item in the tree whose key is < key + */ + lt(key: K): I.RedBlackTree.Iterator; + + /** + * Finds the first item in the tree whose key is <= key + */ + le(key: K): I.RedBlackTree.Iterator; + + /** + * Returns an iterator pointing to the first item in the tree with key, otherwise null + */ + find(key: K): I.RedBlackTree.Iterator | null; + + /** + * Removes the first item with key in the tree + */ + remove(key: K): RedBlackTree; + + /** + * Retrieves the value associated to the given key + */ + get(key: K): V | undefined; + } +} diff --git a/types/adone/glosses/collections/refcounted_cache.d.ts b/types/adone/glosses/collections/refcounted_cache.d.ts new file mode 100644 index 0000000000..79410423a4 --- /dev/null +++ b/types/adone/glosses/collections/refcounted_cache.d.ts @@ -0,0 +1,9 @@ +declare namespace adone.collection { + class RefcountedCache extends MapCache { + ref(key: string): void; + + unref(key: string): void; + + references(key: string): number; + } +} diff --git a/types/adone/glosses/collections/set.d.ts b/types/adone/glosses/collections/set.d.ts new file mode 100644 index 0000000000..f1a6bae96d --- /dev/null +++ b/types/adone/glosses/collections/set.d.ts @@ -0,0 +1,17 @@ +declare namespace adone.collection { + class Set { + constructor(key?: (x: T) => any); + + has(value: T): boolean; + + add(value: T): void; + + delete(value: T): void; + + get(value: T): T; // ??? + + readonly size: number; + + only(): T; + } +} diff --git a/types/adone/glosses/collections/stack.d.ts b/types/adone/glosses/collections/stack.d.ts new file mode 100644 index 0000000000..90fe35b99b --- /dev/null +++ b/types/adone/glosses/collections/stack.d.ts @@ -0,0 +1,36 @@ +declare namespace adone.collection { + /** + * Represents a stack + */ + class Stack { + /** + * Whether the stack is empty + */ + readonly empty: boolean; + + /** + * The top element of the stack + */ + readonly top: T; + + /** + * Inserts a new element + */ + push(x: T): this; + + /** + * Removes the top element + */ + pop(): T | undefined; + + /** + * Returns an iterator over the values + */ + [Symbol.iterator](): IterableIterator; + + /** + * Creates a stack and pushed all the values from the given iterable object + */ + static from(iterable: Iterable): Stack; + } +} diff --git a/types/adone/glosses/collections/timedout_map.d.ts b/types/adone/glosses/collections/timedout_map.d.ts new file mode 100644 index 0000000000..fedcf79fa2 --- /dev/null +++ b/types/adone/glosses/collections/timedout_map.d.ts @@ -0,0 +1,32 @@ +declare namespace adone.collection { + /** + * Represents a Map that keeps keys only for a specified interval of time + */ + class TimedoutMap extends Map { + /** + * @param timeout maximum age of the keys, 1000 by default + * @param callback callback that is called with each key when the timeout is passed + */ + constructor(timeout?: number, callback?: (key: K) => void); + + /** + * Gets the timeout + */ + getTimeout(): number; + + /** + * Sets the timeout + */ + setTimeout(ms: number): void; + + /** + * Iterates over the map and calls the callback for each element + */ + forEach(callback: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): this; + + /** + * Deletes the given key + */ + delete(key: K): boolean; + } +} diff --git a/types/adone/glosses/crypto/asn1.d.ts b/types/adone/glosses/crypto/asn1.d.ts new file mode 100644 index 0000000000..2c4f2134a0 --- /dev/null +++ b/types/adone/glosses/crypto/asn1.d.ts @@ -0,0 +1,597 @@ +declare namespace adone.crypto { + namespace asn1 { + namespace I { + interface LocalBaseBlockParams { + blockLength?: number; + error?: string; + warnings?: string[]; + valueBeforeDecode?: ArrayBuffer; + } + + interface JsonLocalBaseBlock { + blockName: string; + blockLength: number; + error: string; + warnings: string[]; + valueBeforeDecode: ArrayBuffer; + } + + class LocalBaseBlock { + blockLength: number; + error: string; + warnings: string[]; + valueBeforeDecode: ArrayBuffer; + + constructor(params?: LocalBaseBlockParams); + /** + * Aux function, need to get a block name. Need to have it here for inhiritence + */ + static blockName(): string; + /** + * Convertion for the block to JSON object + */ + toJSON(): JsonLocalBaseBlock; + } + + interface LocalHexBlockParams extends LocalBaseBlockParams { + isHexOnly?: boolean; + valueHex?: ArrayBuffer; + } + + class LocalHexBlock { + isHexOnly: boolean; + + valueHex: ArrayBuffer; + + constructor(params: any); + + /** + * Aux function, need to get a block name. Need to have it here for inhiritence + */ + static blockName(): string; + + /** + * Base function for converting block from BER encoded array of bytes + * + * @param inputBuffer ASN.1 BER encoded array + * @param inputOffset Offset in ASN.1 BER encoded array where decoding should be started + * @param inputLength Maximum length of array of bytes which can be using in this function + */ + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + + /** + * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules) + * + * @param sizeOnly Flag that we need only a size of encoding, not a real array of bytes + */ + toBER(sizeOnly?: boolean): ArrayBuffer; + + /** + * Convertion for the block to JSON object + */ + toJSON(): any; + } + + interface LocalIdentificationBlockParams { + idBlock?: LocalHexBlockParams & { + isConstructed?: boolean; + tagClass?: number; + tagNumber?: number; + }; + } + + class LocalIdentificationBlock extends LocalBaseBlock { + isConstructed: boolean; + + tagClass: number; + + tagNumber: number; + + constructor(params?: LocalIdentificationBlockParams); + + // ILocalHexBlock implementation + isHexOnly: boolean; + valueHex: ArrayBuffer; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalLengthBlockParams { + lenBlock?: { + isIndefiniteForm?: boolean; + longFormUsed?: boolean; + length: number; + }; + } + + class LocalLengthBlock extends LocalBaseBlock { + isIndefiniteForm: boolean; + longFormUsed: boolean; + length: number; + constructor(params?: LocalLengthBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): void; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + class LocalValueBlock extends LocalBaseBlock { + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): void; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface BaseBlockParams extends LocalBaseBlockParams { + name?: string; + optional?: boolean; + primitiveSchema?: object; + } + + interface LocalPrimitiveValueBlockParams extends LocalBaseBlockParams { + valueHex?: ArrayBuffer; + isHexOnly?: boolean; + } + + class LocalPrimitiveValueBlock extends LocalValueBlock { + valueHex: ArrayBuffer; + isHexOnly: boolean; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalConstructedValueBlockParams extends LocalBaseBlockParams { + value?: LocalValueBlock; + isIndefiniteForm?: boolean; + } + + class LocalConstructedValueBlock extends LocalValueBlock { + value: LocalValueBlock[]; + isIndefiniteForm: boolean; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + class LocalEndOfContentValueBlock extends LocalValueBlock { + constructor(params?: LocalBaseBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalBooleanValueBlockParams extends LocalBaseBlockParams { + value?: boolean; + isHexOnly?: boolean; + valueHex?: ArrayBuffer; + } + + class LocalBooleanValueBlock extends LocalValueBlock { + value: boolean; + isHexOnly: boolean; + valueHex: ArrayBuffer; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalOctetStringValueBlockParams extends LocalConstructedValueBlockParams, LocalHexBlockParams { + isConstructed?: boolean; + } + + class LocalOctetStringValueBlock extends LocalConstructedValueBlock { + isConstructed: boolean; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalOctetStringValueBlockParams); + } + + interface LocalBitStringValueBlockParams extends LocalConstructedValueBlockParams, LocalHexBlockParams { + unusedBits?: number; + isConstructed?: boolean; + blockLength?: number; + } + + class LocalBitStringValueBlock extends LocalConstructedValueBlock implements LocalHexBlock { + unusedBits: number; + isConstructed: boolean; + blockLength: number; + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalBitStringValueBlockParams); + } + + interface LocalIntegerValueBlockParams extends LocalBaseBlockParams, LocalHexBlockParams { + } + + class LocalIntegerValueBlock extends LocalValueBlock implements LocalHexBlock { + valueDec: number; + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalIntegerValueBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + /** + * Base function for converting block from DER encoded array of bytes + * + * @param inputBuffer ASN.1 DER encoded array + * @param inputOffset Offset in ASN.1 DER encoded array where decoding should be started + * @param inputLength Maximum length of array of bytes which can be using in this function + * @param expectedLength Expected length of converted "valueHex" buffer + */ + fromDER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number, expectedLength?: number): number; + /** + * Encoding of current ASN.1 block into ASN.1 encoded array (DER rules) + * + * @param sizeOnly Flag that we need only a size of encoding, not a real array of bytes + */ + toDER(sizeOnly?: boolean): ArrayBuffer; + } + + interface IntegerParams { + value?: number; + } + + interface LocalSidValueBlockParams extends LocalBaseBlockParams, LocalHexBlockParams { + valueDec?: number; + isFirstSid?: boolean; + } + + class LocalSidValueBlock extends LocalBaseBlock implements LocalHexBlock { + valueDec: number; + isFirstSid: boolean; + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalSidValueBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + toString(): string; + } + + interface LocalObjectIdentifierValueBlockParams extends LocalBaseBlockParams { + value?: string; + } + + class LocalObjectIdentifierValueBlock extends LocalValueBlock { + constructor(params?: LocalObjectIdentifierValueBlockParams); + + /** + * Create "LocalObjectIdentifierValueBlock" class from string + * + * @param string Input string to convert from + */ + fromString(data: string): boolean; + /** + * Converts "LocalObjectIdentifierValueBlock" class to string + */ + toString(): string; + } + + interface LocalUtf8StringValueBlockParams extends LocalBaseBlockParams, LocalHexBlock { + } + + class LocalUtf8StringValueBlock extends LocalBaseBlock implements LocalHexBlock { + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalSidValueBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + toString(): string; + } + + interface Utf8StringParams { + value?: string; + } + + interface LocalBmpStringValueBlockParams extends LocalHexBlockParams, LocalBaseBlockParams { + } + + class LocalBmpStringValueBlock extends LocalBaseBlock implements LocalHexBlock { + value: string; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalBmpStringValueBlockParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalUniversalStringValueParams extends LocalHexBlockParams, LocalBaseBlockParams { + } + + class LocalUniversalStringValueBlock extends LocalBaseBlock implements LocalHexBlock { + value: string; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalUniversalStringValueParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalSimpleLocalSimpleStringValueBlockParams extends LocalHexBlockParams, LocalBaseBlockParams { + } + + class LocalSimpleLocalSimpleStringValueBlock extends LocalBaseBlock implements LocalHexBlock { + value: string; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalSimpleLocalSimpleStringValueBlockParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalSimpleStringBlockParams { + value?: string; + } + + class LocalSimpleStringBlock extends BaseBlock { + constructor(params?: LocalSimpleStringBlockParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param inputBuffer ASN.1 BER encoded array + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param inputString ASN.1 BER encoded array + */ + fromString(inputString: string): void; + } + + interface BmpStringParams { + value?: string; + } + + interface UniversalStringParams { + value?: string; + } + + interface UTCTimeParams extends LocalSimpleLocalSimpleStringValueBlockParams { + value?: string; + valueDate?: Date; + } + + interface ChoiceParams { + value?: LocalValueBlock[]; + optional?: boolean; + } + + interface AnyParams { + name?: string; + optional?: boolean; + } + + interface RepeatedParams { + name?: string; + optional?: boolean; + value?: Any; + local?: boolean; + } + + interface RawDataParams { + data?: ArrayBuffer; + } + } + + class BaseBlock extends I.LocalBaseBlock { + constructor(parameters?: I.BaseBlockParams, valueBlockType?: typeof I.LocalValueBlock); + idBlock: I.LocalIdentificationBlock; + lenBlock: I.LocalLengthBlock; + valueBlock: T; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + class Primitive extends BaseBlock { + } + + class Constructed extends BaseBlock { } + + class EndOfContent extends BaseBlock { } + + class Boolean extends BaseBlock { } + + class Sequence extends Constructed { } + + class Set extends Constructed { } + + class Null extends BaseBlock { } + + class OctetString extends BaseBlock { + constructor(params?: I.LocalOctetStringValueBlockParams); + /** + * Checking that two OCTETSTRINGs are equal + */ + isEqual(octetString: OctetString): boolean; + } + + class BitString extends BaseBlock { + constructor(params?: I.LocalBitStringValueBlockParams); + /** + * Checking that two BITSTRINGs are equal + * @param bitString + */ + isEqual(bitString: BitString): boolean; + } + + class Integer extends BaseBlock { + constructor(params?: I.IntegerParams) + /** + * Compare two Integer object, or Integer and ArrayBuffer objects + */ + isEqual(otherValue: Integer | ArrayBuffer): boolean; + /** + * Convert current Integer value from BER into DER format + */ + convertToDER(): Integer; + /** + * Convert current Integer value from DER to BER format + */ + convertFromDER(): Integer; + } + + class Enumerated extends Integer { } + + class ObjectIdentifier extends BaseBlock { + constructor(params?: I.LocalObjectIdentifierValueBlockParams); + } + + class Utf8String extends BaseBlock { + constructor(params?: I.Utf8StringParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param inputBuffer ASN.1 BER encoded array + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param inputString ASN.1 BER encoded array + */ + fromString(inputString: string): void; + } + + class BmpString extends BaseBlock { + constructor(params?: I.BmpStringParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param inputBuffer ASN.1 BER encoded array + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param inputString ASN.1 BER encoded array + */ + fromString(inputString: string): void; + } + + class UniversalString extends BaseBlock { + constructor(params?: I.UniversalStringParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param inputBuffer ASN.1 BER encoded array + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param inputString ASN.1 BER encoded array + */ + fromString(inputString: string): void; + } + + class NumericString extends I.LocalSimpleStringBlock { } + + class PrintableString extends I.LocalSimpleStringBlock { } + + class TeletexString extends I.LocalSimpleStringBlock { } + + class VideotexString extends I.LocalSimpleStringBlock { } + + class IA5String extends I.LocalSimpleStringBlock { } + + class GraphicString extends I.LocalSimpleStringBlock { } + + class VisibleString extends I.LocalSimpleStringBlock { } + + class GeneralString extends I.LocalSimpleStringBlock { } + + class CharacterString extends I.LocalSimpleStringBlock { } + + class UTCTime extends VisibleString { + year: number; + month: number; + day: number; + hour: number; + minute: number; + second: number; + constructor(params?: I.UTCTimeParams); + /** + * Function converting ASN.1 internal string into ArrayBuffer + */ + toBuffer(): ArrayBuffer; + /** + * Function converting "Date" object into ASN.1 internal string + * + * @param inputDate JavaScript "Date" object + */ + fromDate(inputDate: Date): void; + /** + * Function converting ASN.1 internal string into "Date" object + */ + toDate(): Date; + } + + class GeneralizedTime extends UTCTime { + millisecond: number; + } + + class DATE extends Utf8String { } + + class TimeOfDay extends Utf8String { } + + class DateTime extends Utf8String { } + + class Duration extends Utf8String { } + + class TIME extends Utf8String { } + + class Choice { + value: I.LocalValueBlock[]; + optional: boolean; + constructor(params?: I.ChoiceParams); + } + + class Any { + name: string; + optional: boolean; + constructor(params?: I.AnyParams); + } + + class Repeated { + name: string; + optional: boolean; + value: Any; + local: boolean; + constructor(params?: I.RepeatedParams); + } + + class RawData { + data: ArrayBuffer; + + constructor(params?: I.RawDataParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + /** + * Major function for decoding ASN.1 BER array into internal library structuries + * + * @param inputBuffer ASN.1 BER encoded array of bytes + */ + function fromBER(inputBuffer: ArrayBuffer): { offset: number; result: I.LocalBaseBlock }; + + /** + * Compare of two ASN.1 object trees + * + * @param root Root of input ASN.1 object tree + * @param inputData Input ASN.1 object tree + * @param inputSchema Input ASN.1 schema to compare with + */ + function compareSchema(root: any, inputData: any, inputSchema: any): { verified: boolean, result?: any }; + + /** + * ASN.1 schema verification for ArrayBuffer data + * + * @param inputBuffer Input BER-encoded ASN.1 data + * @param inputSchema Input ASN.1 schema to verify against to + */ + function verifySchema(inputBuffer: ArrayBuffer, inputSchema: any): { verified: boolean, result?: any }; + } +} diff --git a/types/adone/glosses/crypto/ed25519.d.ts b/types/adone/glosses/crypto/ed25519.d.ts new file mode 100644 index 0000000000..7e4f6e2f33 --- /dev/null +++ b/types/adone/glosses/crypto/ed25519.d.ts @@ -0,0 +1,20 @@ +declare namespace adone.crypto { + namespace ed25519 { + const publicKeyLength: number; + + const privateKeyLength: number; + + namespace I { + interface KeyPair { + publicKey: Buffer; + privateKey: Buffer; + } + } + + function generateKeyPair(seed: Buffer): I.KeyPair; + + function sign(message: Buffer, seed: Buffer | I.KeyPair): Buffer; + + function verify(message: Buffer, signature: Buffer, publicKey: Buffer): boolean; + } +} diff --git a/types/adone/glosses/crypto/index.d.ts b/types/adone/glosses/crypto/index.d.ts new file mode 100644 index 0000000000..ea4b76967f --- /dev/null +++ b/types/adone/glosses/crypto/index.d.ts @@ -0,0 +1,9 @@ +/// +/// +/// + +declare namespace adone { + namespace crypto { + // + } +} diff --git a/types/adone/glosses/crypto/secp256k1.d.ts b/types/adone/glosses/crypto/secp256k1.d.ts new file mode 100644 index 0000000000..87167cc441 --- /dev/null +++ b/types/adone/glosses/crypto/secp256k1.d.ts @@ -0,0 +1,127 @@ +declare namespace adone.crypto { + namespace secp256k1 { + /** + * Verifies an ECDSA privateKey + */ + function privateKeyVerify(privateKey: Buffer): boolean; + + /** + * Exports a privateKey in DER format + */ + function privateKeyExport(privateKey: Buffer, compressed?: boolean): Buffer; + + /** + * Imports a privateKey in DER format + */ + function privateKeyImport(privateKey: Buffer): Buffer; + + /** + * Negates a privateKey by subtracting it from the order of the curve's base point + */ + function privateKeyNegate(privateKey: Buffer): Buffer; + + /** + * Computes the inverse of a privateKey (modulo the order of the curve's base point) + */ + function privateKeyModInverse(privateKey: Buffer): Buffer; + + /** + * Tweaks a privateKey by adding tweak to it + */ + function privateKeyTweakAdd(privateKey: Buffer, tweak: Buffer): Buffer; + + /** + * Tweaks a privateKey by multiplying it by a tweak + */ + function privateKeyTweakMul(privateKey: Buffer, tweak: Buffer): Buffer; + + /** + * Computes the public key for a privateKey + */ + function publicKeyCreate(privateKey: Buffer, compressed?: boolean): Buffer; + + /** + * Converts a publicKey to compressed or uncompressed form + */ + function publicKeyConvert(publicKey: Buffer, compressed?: boolean): Buffer; + + /** + * Verifies an ECDSA publicKey + */ + function publicKeyVerify(publicKey: Buffer): boolean; + + /** + * Tweaks a publicKey by adding tweak times the generator to it + */ + function publicKeyTweakAdd(publicKey: Buffer, tweak: Buffer, compressed?: boolean): Buffer; + + /** + * Tweaks a publicKey by multiplying it by a tweak value + */ + function publicKeyTweakMul(publicKey: Buffer, tweak: Buffer, compressed?: boolean): Buffer; + + /** + * Adds a given publicKeys together + */ + function publicKeyCombine(publicKeys: Buffer[], compressed?: boolean): Buffer; + + /** + * Converts a signature to a normalized lower-S form + */ + function signatureNormalize(signature: Buffer): Buffer; + + /** + * Serializes an ECDSA signature in DER format + */ + function signatureExport(signature: Buffer): Buffer; + + /** + * Parse a DER ECDSA signature (follow by BIP66) + */ + function signatureImport(signature: Buffer): Buffer; + + /** + * Same as signatureImport but not follow by BIP66 + */ + function signatureImportLax(signature: Buffer): Buffer; + + namespace I { + interface SignOptions { + noncefn?: (message: Buffer, privateKey: Buffer, algo: Buffer, data: Buffer, attempt: number) => Buffer; + data?: Buffer | null; + } + + interface SignResult { + signature: Buffer; + recovery: number; + } + } + + /** + * Creates an ECDSA signature. Always return low-S signature. + */ + function sign(message: Buffer, privateKey: Buffer, options?: I.SignOptions): I.SignResult; + + /** + * Verifies an ECDSA signature + * + * Note: return false for high signatures! + */ + function verify(message: Buffer, signature: Buffer, publicKey: Buffer): boolean; + + /** + * Recovers an ECDSA public key from a signature + */ + function recover(message: Buffer, signature: Buffer, recovery: number, compressed?: boolean): Buffer; + + /** + * Computes an EC Diffie-Hellman secret and applied sha256 to compressed public key + */ + function ecdh(publicKey: Buffer, privateKey: Buffer): Buffer; + + /** + * Computes an EC Diffie-Hellman secret and return public key as result + */ + function ecdhUnsafe(publicKey: Buffer, privateKey: Buffer, compressed?: boolean): Buffer; + } +} diff --git a/types/adone/glosses/data.d.ts b/types/adone/glosses/data.d.ts index f711836bdd..3a979cae98 100644 --- a/types/adone/glosses/data.d.ts +++ b/types/adone/glosses/data.d.ts @@ -30,7 +30,12 @@ declare namespace adone { * or an array of String and Number objects that serve as a whitelist * for selecting/filtering the properties of the value object to be included in the JSON string */ - replacer?: I.Replacer + replacer?: I.Replacer, + + /** + * Wheter to append a newline + */ + newline?: boolean }): Buffer; /** @@ -84,6 +89,8 @@ declare namespace adone { */ function decode(buf: collection.I.ByteArray.Wrappable): any; + function tryDecode(buf: collection.ByteArray): any; + namespace I { type Type = string | number; // ? type DecodeFunction = (buf: collection.ByteArray) => any; @@ -153,6 +160,8 @@ declare namespace adone { * Represents a MessagePack serializer */ class Serializer { + constructor(initialCapacity?: number); + /** * Encoder instance */ @@ -211,6 +220,8 @@ declare namespace adone { * x.Exception, Error, Date, Map, Set, math.Long */ const serializer: Serializer; + + function registerCommonTypesFor(s: Serializer): void; } /** @@ -244,21 +255,32 @@ declare namespace adone { * Base64 encoder */ namespace base64 { + namespace I { + interface DecodeOptions { + buffer?: boolean; + encoding?: string; + } + + interface EncodeOptions { + buffer?: boolean; + } + } + /** * Encodes a string/Buffer to base64 */ - function encode(str: string | Buffer, options: { buffer: false }): string; - function encode(str: string | Buffer, options?: { buffer?: true }): Buffer; + function encode(str: string | Buffer, options: I.EncodeOptions & { buffer: false }): string; + function encode(str: string | Buffer, options?: I.EncodeOptions): Buffer; /** * Decodes base64 string/buffer into a buffer */ - function decode(str: string | Buffer, options: { buffer: true }): Buffer; + function decode(str: string | Buffer, options: I.DecodeOptions & { buffer: true }): Buffer; /** * Decodes base64 string/buffer into a string */ - function decode(str: string | Buffer, options?: { buffer?: false }): string; + function decode(str: string | Buffer, options?: I.DecodeOptions): string; function encodeVLQ(value: number): string; @@ -560,7 +582,7 @@ declare namespace adone { /** * Represents a YAML exception */ - class Exception extends adone.x.Exception { + class Exception extends adone.error.Exception { reason: string; mark: Mark; @@ -1028,5 +1050,183 @@ declare namespace adone { */ function decode(buf: Buffer, options?: I.DeserializeOptions): any; } + + namespace protobuf { + namespace schema { + namespace I { + interface Field { + name: string | null; + type: string | null; + tag: number; + map: { + from: string; + to: string; + } | null; + oneof: string | null; + required: boolean; + repeated: boolean; + options: object; + } + + interface Enum { + name: string; + values: object; + options: object; + } + + interface Extend { + name: string; + message: Message; + } + + interface Message { + name: string; + enums: Enum[]; + extends: Extend[]; + messages: Message[]; + fields: Field[]; + extensions: { + from: number, + to: number + } | null; + } + + interface RPCMethod { + name: string; + input_type: string | null; + output_type: string | null; + client_streaming: boolean; + server_streaming: boolean; + options: object; + } + + interface Service { + name: string; + methods: RPCMethod[]; + options: object; + } + + interface Schema { + syntax: any; // ?? + package: string | null; + imports: string[]; + enums: Enum[]; + messages: Message[]; + options: object; + extends: Extend[]; + services?: Service[]; + } + } + + function parse(buf: Buffer | string): I.Schema; + + function stringify(schema: object): string; + } + + function create(proto: Buffer | string | object, opts?: object): object; + } + + namespace base32 { + function charmap(alphabet: string, mappings?: T): T; + + namespace I { + interface Spec { + alphabet: string; + charmap: { + [c: string]: number; + }; + } + } + + const rfc4648: I.Spec; + + const crockford: I.Spec; + + const base32hex: I.Spec; + + namespace I { + interface DecoderOptions { + type: "rfc4648" | "crockford" | "base32hex"; + charmap?: object; + } + + interface EncoderOptions { + type: "rfc4648" | "crockford" | "base32hex"; + alphabet?: string; + } + } + + class Decoder { + constructor(options?: I.DecoderOptions); + + write(str: string): this; + + finalize(str?: string): Buffer; + } + + class Encoder { + constructor(options?: I.EncoderOptions); + + write(buf: Buffer): this; + + finalize(buf?: Buffer): string; + } + + function encode(buf: Buffer, options?: I.EncoderOptions): string; + + function decode(str: string, options?: I.DecoderOptions): Buffer; + } + + namespace I { + interface BaseX { + encode(buf: Buffer): string; + + decode(str: string): Buffer; + + decodeUnsafe(str: string): Buffer; + } + } + + function basex(alphabet: string): I.BaseX; + + const base58: I.BaseX; + + namespace base64url { + function unescape(str: string): string; + + function escape(str: string): string; + + namespace I { + interface EncodeOptions { + encoding?: string; + } + + interface DecodeOptions { + encoding?: string; + buffer?: boolean; + } + } + + function encode(str: Buffer | string, options?: I.EncodeOptions): string; + + function decode(str: string, options: I.DecodeOptions & { buffer: true }): Buffer; + function decode(str: string, options?: I.DecodeOptions): string; + } + + namespace varint { + function encode(num: number, out?: T[], offset?: number): T[]; + + function decode(buf: Buffer, offset?: number): number; + + function encodingLength(value: number): number; + } + + namespace varintSigned { + function encode(num: number, out?: T[], offset?: number): T[]; + + function decode(buf: Buffer, offset?: number): number; + + function encodingLength(value: number): number; + } } } diff --git a/types/adone/glosses/exceptions.d.ts b/types/adone/glosses/errors.d.ts similarity index 98% rename from types/adone/glosses/exceptions.d.ts rename to types/adone/glosses/errors.d.ts index 347a3c632d..c3d9e1f632 100644 --- a/types/adone/glosses/exceptions.d.ts +++ b/types/adone/glosses/errors.d.ts @@ -1,5 +1,5 @@ declare namespace adone { - namespace x { + namespace error { class Exception extends Error { constructor(message?: string | Error, captureStackTrace?: boolean); } diff --git a/types/adone/glosses/events.d.ts b/types/adone/glosses/events.d.ts index ecb323f925..e812624aa9 100644 --- a/types/adone/glosses/events.d.ts +++ b/types/adone/glosses/events.d.ts @@ -1,25 +1,48 @@ declare namespace adone { namespace event { - class EventEmitter { - static listenerCount(emitter: EventEmitter, event: string | symbol): number; + namespace I { + interface PropagateEventsEnder { + end(): void; + } + } + + class Emitter { + static listenerCount(emitter: Emitter, event: string | symbol): number; + static defaultMaxListeners: number; addListener(event: string | symbol, listener: (...args: any[]) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + removeAllListeners(event?: string | symbol): this; + setMaxListeners(n: number): this; + getMaxListeners(): number; + listeners(event: string | symbol): Array<(...args: any[]) => any>; + emit(event: string | symbol, ...args: any[]): boolean; + eventNames(): Array; + listenerCount(type: string | symbol): number; + + propagateEvents(dest: Emitter, events: string[]): I.PropagateEventsEnder; + + static propagateEvents(source: Emitter, dest: Emitter, events: string[]): I.PropagateEventsEnder; } - class AsyncEmitter extends EventEmitter { + class AsyncEmitter extends Emitter { constructor(concurrency?: number); setConcurrency(max?: number): this; diff --git a/types/adone/glosses/fake.d.ts b/types/adone/glosses/fake.d.ts new file mode 100644 index 0000000000..0c403747e4 --- /dev/null +++ b/types/adone/glosses/fake.d.ts @@ -0,0 +1,337 @@ +declare namespace adone { + namespace fake { + namespace I { + interface Card { + name: string; + username: string; + email: string; + address: FullAddress; + phone: string; + website: string; + company: Company; + posts: Post[]; + accountHistory: string[]; + } + + interface FullAddress { + streetA: string; + streetB: string; + streetC: string; + streetD: string; + city: string; + state: string; + county: string; + zipcode: string; + geo: Geo; + } + + interface Geo { + lat: string; + lng: string; + } + + interface Company { + name: string; + catchPhrase: string; + bs: string; + } + + interface Post { + words: string; + sentence: string; + sentences: string; + paragraph: string; + } + + interface ContextualCard { + name: string; + username: string; + email: string; + dob: Date; + phone: string; + address: Address; + website: string; + company: Company; + } + + interface Address { + street: string; + suite: string; + city: string; + state: string; + zipcode: string; + geo: Geo; + } + + interface UserCard { + name: string; + username: string; + email: string; + address: Address; + phone: string; + website: string; + company: Company; + } + + interface Transaction { + amount: string; + date: Date; + business: string; + name: string; + type: string; + account: string; + } + } + + namespace address { + function zipCode(format?: string): string; + function city(format?: number): string; + function cityPrefix(): string; + function citySuffix(): string; + function streetName(): string; + function streetAddress(useFullAddress?: boolean): string; + function streetSuffix(): string; + function streetPrefix(): string; + function secondaryAddress(): string; + function county(): string; + function country(): string; + function countryCode(): string; + function state(useAbbr?: boolean): string; + function stateAbbr(): string; + function latitude(): string; + function longitude(): string; + } + + namespace commerce { + function color(): string; + function department(): string; + function productName(): string; + function price(min?: number, max?: number, dec?: number, symbol?: string): string; + function productAdjective(): string; + function productMaterial(): string; + function product(): string; + } + + namespace company { + function suffixes(): string[]; + function companyName(format?: number): string; + function companySuffix(): string; + function catchPhrase(): string; + function bs(): string; + function catchPhraseAdjective(): string; + function catchPhraseDescriptor(): string; + function catchPhraseNoun(): string; + function bsAdjective(): string; + function bsBuzz(): string; + function bsNoun(): string; + } + + namespace database { + function column(): string; + function type(): string; + function collation(): string; + function engine(): string; + } + + namespace date { + function past(years?: number, refDate?: string|Date): Date; + function future(years?: number, refDate?: string|Date): Date; + function between(from: string|number|Date, to: string|Date): Date; + function recent(days?: number): Date; + function soon(days?: number): Date; + function month(options?: { abbr?: boolean, context?: boolean }): string; + function weekday(options?: { abbr?: boolean, context?: boolean }): string; + } + + function fake(str: string): string; + + namespace finance { + function account(length?: number): string; + function accountName(): string; + function mask(length?: number, parens?: boolean, elipsis?: boolean): string; + function amount(min?: number, max?: number, dec?: number, symbol?: string): string; + function transactionType(): string; + function currencyCode(): string; + function currencyName(): string; + function currencySymbol(): string; + function bitcoinAddress(): string; + function ethereumAddress(): string; + function iban(formatted?: boolean): string; + function bic(): string; + } + + namespace hacker { + function abbreviation(): string; + function adjective(): string; + function noun(): string; + function verb(): string; + function ingverb(): string; + function phrase(): string; + } + + namespace helpers { + function randomize(array: T[]): T; + function randomize(): string; + function slugify(string?: string): string; + function replaceSymbolWithNumber(string?: string, symbol?: string): string; + function replaceSymbols(string?: string): string; + function shuffle(o: T[]): T[]; + function shuffle(): string[]; + function mustache(str: string, data: { [key: string]: string|((substring: string, ...args: any[]) => string) }): string; + function createCard(): I.Card; + function contextualCard(): I.ContextualCard; + function userCard(): I.UserCard; + function createTransaction(): I.Transaction; + } + + namespace image { + function image(): string; + function avatar(): string; + function imageUrl(width?: number, height?: number, category?: string): string; + function abstract(width?: number, height?: number): string; + function animals(width?: number, height?: number): string; + function business(width?: number, height?: number): string; + function cats(width?: number, height?: number): string; + function city(width?: number, height?: number): string; + function food(width?: number, height?: number): string; + function nightlife(width?: number, height?: number): string; + function fashion(width?: number, height?: number): string; + function people(width?: number, height?: number): string; + function nature(width?: number, height?: number): string; + function sports(width?: number, height?: number): string; + function technics(width?: number, height?: number): string; + function transport(width?: number, height?: number): string; + function dataUri(width?: number, height?: number): string; + } + + namespace internet { + function avatar(): string; + function email(firstName?: string, lastName?: string, provider?: string): string; + function exampleEmail(firstName?: string, lastName?: string): string; + function userName(firstName?: string, lastName?: string): string; + function protocol(): string; + function url(): string; + function domainName(): string; + function domainSuffix(): string; + function domainWord(): string; + function ip(): string; + function ipv6(): string; + function userAgent(): string; + function color(baseRed255?: number, baseGreen255?: number, baseBlue255?: number): string; + function mac(): string; + function password(len?: number, memorable?: boolean, pattern?: string|RegExp, prefix?: string): string; + } + + namespace lorem { + function word(): string; + function words(num?: number): string; + function sentence(wordCount?: number, range?: number): string; + function slug(wordCount?: number): string; + function sentences(sentenceCount?: number): string; + function paragraph(sentenceCount?: number): string; + function paragraphs(paragraphCount?: number, separator?: string): string; + function text(times?: number): string; + function lines(lineCount?: number): string; + } + + namespace name { + function firstName(gender?: number): string; + function lastName(gender?: number): string; + function findName(firstName?: string, lastName?: string, gender?: number): string; + function jobTitle(): string; + function prefix(): string; + function suffix(): string; + function title(): string; + function jobDescriptor(): string; + function jobArea(): string; + function jobType(): string; + } + + namespace phone { + function phoneNumber(format?: string): string; + function phoneNumberFormat(phoneFormatsArrayIndex?: number): string; + function phoneFormats(): string; + } + + namespace random { + function number(max: number): number; + function number(options?: { min?: number, max?: number, precision?: number }): number; + function arrayElement(): string; + function arrayElement(array: T[]): T; + function objectElement(object?: { [key: string]: any }, field?: "key"): string; + function objectElement(object?: { [key: string]: T }, field?: any): T; + function uuid(): string; + function boolean(): boolean; + function word(type?: string): string; + function words(count?: number): string; + function image(): string; + function locale(): string; + function alphaNumeric(count?: number): string; + function hexaDecimal(count?: number): string; + } + + namespace system { + function fileName(ext: string, type: string): string; + function commonFileName(ext: string, type: string): string; + function mimeType(): string; + function commonFileType(): string; + function commonFileExt(): string; + function fileType(): string; + function fileExt(mimeType: string): string; + function directoryPath(): string; + function filePath(): string; + function semver(): string; + } + + function seed(value: number): void; + + namespace I { + type Locale = + | "az" + | "cz" + | "de" + | "de_AT" + | "de_CH" + | "el" + | "en" + | "en_AU" + | "en_BORK" + | "en_CA" + | "en_GB" + | "en_IE" + | "en_IND" + | "en_US" + | "en_au_ocker" + | "es" + | "es_MX" + | "fa" + | "fr" + | "fr_CA" + | "ge" + | "id_ID" + | "it" + | "ja" + | "ko" + | "lv" + | "nb_NO" + | "nep" + | "nl" + | "nl_BE" + | "pl" + | "pt_BR" + | "ro" + | "ru" + | "sk" + | "sv" + | "tr" + | "uk" + | "vi" + | "zh_CN" + | "zh_TW"; + } + + function getLocale(): I.Locale; + + function setLocale(locale: I.Locale): void; + } +} diff --git a/types/adone/glosses/fast.d.ts b/types/adone/glosses/fast.d.ts index 725e0e9db3..1b04bec6d3 100644 --- a/types/adone/glosses/fast.d.ts +++ b/types/adone/glosses/fast.d.ts @@ -152,7 +152,7 @@ declare namespace adone { type SymbolicFile = File; /* tslint:disable-next-line:no-empty-interface */ - interface Stream extends stream.CoreStream { + interface Stream extends stream.core.Stream { // } } @@ -160,7 +160,7 @@ declare namespace adone { export const File: I.FileConstructor; namespace I { - type CoreStreamSource = stream.I.CoreStream.Source; + type CoreStreamSource = stream.core.I.Source; interface LocalStreamConstructorOptions { /** @@ -586,7 +586,7 @@ declare namespace adone { /** * Read JSON manifests written out by revisionHash */ - manifest?: File[] | stream.CoreStream, + manifest?: File[] | stream.core.Stream, /** * Modify the name of the unreved files before using them diff --git a/types/adone/glosses/fs.d.ts b/types/adone/glosses/fs.d.ts index 7fa8f51593..7517764faf 100644 --- a/types/adone/glosses/fs.d.ts +++ b/types/adone/glosses/fs.d.ts @@ -22,6 +22,14 @@ declare namespace adone { function readlink(path: string | Buffer | I.URL, options: { encoding: null }): Promise; function readlink(path: string | Buffer | I.URL, options?: { encoding?: I.Encoding }): Promise; + /** + * Reads the value of a symbolic link + */ + function readlinkSync(path: string | Buffer | I.URL, encoding: null): Buffer; + function readlinkSync(path: string | Buffer | I.URL, encoding: I.Encoding): string; + function readlinkSync(path: string | Buffer | I.URL, options: { encoding: null }): Buffer; + function readlinkSync(path: string | Buffer | I.URL, options?: { encoding?: I.Encoding }): string; + /** * Deletes a name and possibly the file it refers to */ @@ -32,6 +40,21 @@ declare namespace adone { */ function unlinkSync(path: string | Buffer | I.URL): void; + /** + * Changes the file system timestamps of the object referenced by path + */ + function utimes(path: string | Buffer | I.URL, atime: number | string | Date, mtime: number | string | Date): Promise; + + /** + * Changes the file system timestamps of the object referenced by path + */ + function utimesSync(path: string | Buffer | I.URL, atime: number | string | Date, mtime: number | string | Date): void; + + /** + * Changes the file system timestamps of the object referenced by path + */ + function utimesMillis(path: string | Buffer | I.URL, atime: number, mtime: number): Promise; + /** * Changes permissions of a file */ @@ -42,6 +65,11 @@ declare namespace adone { */ function chown(path: string | Buffer | I.URL, uid: number, gid: number): Promise; + /** + * Changes ownership recursively for a given path + */ + function chownr(path: string | Buffer | I.URL, uid: number, gid: number): Promise; + /** * Deletes a directory */ @@ -63,6 +91,87 @@ declare namespace adone { function readdirSync(path: string | Buffer | I.URL, options: { encoding: null }): Buffer[]; function readdirSync(path: string | Buffer | I.URL, options?: { encoding?: I.Encoding }): string[]; + namespace I { + interface ReaddirpEntry { + /** + * filename + */ + name: string; + + /** + * full path to a file + */ + fullPath: string; + + /** + * relative path to a file + */ + path: string; + + /** + * relative path to the parent dir + */ + parentDir: string; + + /** + * full path to the parent dir + */ + fullParentDir: string; + + /** + * file stats + */ + stat: fs.I.Stats; + } + + type ReaddirpFilter = string | ((entry: ReaddirpEntry) => boolean); + + interface ReaddirpOptions { + /** + * filter for files + */ + fileFilter?: ReaddirpFilter | ReaddirpFilter[]; + + /** + * filter for directories + */ + directoryFilter?: ReaddirpFilter | ReaddirpFilter[]; + + /** + * maximum recursion depth + * + * Infinity by default + */ + depth?: number; + + /** + * whether to emit files + * + * true by default + */ + files?: boolean; + + /** + * whether to emit directories + * + * true by default + */ + directories?: boolean; + + /** + * whether to use lstat for stating + * + * false by default + */ + lstat?: boolean; + } + } + + /** + * Traverses the given path + */ + function readdirp(root: string | Buffer | I.URL, options?: I.ReaddirpOptions): stream.core.Stream; + /** * Gets file status, identical to stat, except that if pathname is a symbolic link, * then it returns information about the link itself, not the file that it refers to @@ -117,6 +226,15 @@ declare namespace adone { flag?: I.Flag }): Promise; + /** + * Appends data to a file, creating the file if it does not yet exist + */ + function appendFileSync(file: string | Buffer | number, data: string | Buffer, options?: { + encoding?: I.Encoding, + mode?: number, + flag?: I.Flag + }): void; + /** * Tests a user's permissions for the file or directory specified by path */ @@ -154,6 +272,14 @@ declare namespace adone { cwd?: string }): Promise; + /** + * Recursively deletes empty directiries inside the given directory + */ + function rmEmpty(path: string, options?: { + cwd?: string; + filter?: (filename: string) => boolean + }): Promise; + namespace I { interface Access { read: boolean; @@ -460,12 +586,12 @@ declare namespace adone { /** * Copies this from this directory to the given path */ - copyTo(destPath: string, options?: I.CopyOptions): Promise; + copyTo(destPath: string, options?: I.CopyToOptions): Promise; /** * Copies files from the given path to this directory */ - copyFrom(srcPath: string, options?: I.CopyOptions): Promise; + copyFrom(srcPath: string, options?: I.CopyToOptions): Promise; /** * Creates a new directory with the given path @@ -560,7 +686,7 @@ declare namespace adone { /** * Represents a file that supports random access */ - class RandomAccessFile extends event.EventEmitter { + class RandomAccessFile extends event.Emitter { constructor(filename: string, options?: I.RandomAccessFile.ConstructorOptions); /** @@ -602,7 +728,7 @@ declare namespace adone { /** * Represents an abstract random access reader */ - class AbstractRandomAccessReader extends event.EventEmitter { + class AbstractRandomAccessReader extends event.Emitter { /** * Increments the reference counter */ @@ -826,7 +952,7 @@ declare namespace adone { }>; } - type Stream = stream.CoreStream; + type Stream = stream.core.Stream; interface EmitterConstructor { new(pattern: string, optons: Options, callback?: (error: any, matches: string[]) => void): Emitter; @@ -835,7 +961,7 @@ declare namespace adone { prototype: Emitter; } - interface Emitter extends event.EventEmitter { + interface Emitter extends event.Emitter { isIgnored(path: string): boolean; /** @@ -999,7 +1125,7 @@ declare namespace adone { /** * Represents a file watcher */ - class Watcher extends event.EventEmitter { + class Watcher extends event.Emitter { constructor(options?: I.Watcher.ConstructorOptions); /** @@ -1128,214 +1254,209 @@ declare namespace adone { function whichSync(cmd: string, options?: I.Which.Options): string; /** - * Functions to work with files using file descriptors + * Opens and possibly creates a file */ - namespace fd { - /** - * Opens and possibly create a file - */ - function open(path: string | Buffer | I.URL, flags: I.Flag | number, mode?: number): Promise; + function open(path: string | Buffer | I.URL, flags: I.Flag | number, mode?: number): Promise; - /** - * Opens and possibly create a file - */ - function openSync(path: string | Buffer | I.URL, flags: I.Flag | number, mode?: number): I.FD; + /** + * Opens and possibly creates a file + */ + function openSync(path: string | Buffer | I.URL, flags: I.Flag | number, mode?: number): I.FD; - /** - * Closes a file descriptor - */ - function close(fd: I.FD): Promise; + /** + * Closes a file descriptor + */ + function close(fd: I.FD): Promise; - /** - * Closes a file descriptor - */ - function closeSync(fd: I.FD): void; + /** + * Closes a file descriptor + */ + function closeSync(fd: I.FD): void; - /** - * Changes the file timestamps of a file referenced by the supplied file descriptor - */ - function utimes(fd: I.FD, atime: number, mtime: number): Promise; + /** + * Changes the file timestamps of a file referenced by the supplied file descriptor + */ + function futimes(fd: I.FD, atime: number, mtime: number): Promise; - /** - * Changes the file timestamps of a file referenced by the supplied file descriptor - */ - function utimesSync(fd: I.FD, atime: number, mtime: number): void; + /** + * Changes the file timestamps of a file referenced by the supplied file descriptor + */ + function futimesSync(fd: I.FD, atime: number, mtime: number): void; - /** - * Gets file status - */ - function stat(fd: I.FD): Promise; + /** + * Gets file status + */ + function fstat(fd: I.FD): Promise; - /** - * Gets file status - */ - function statSync(fd: I.FD): I.Stats; + /** + * Gets file status + */ + function fstatSync(fd: I.FD): I.Stats; - /** - * Truncates a file to a specified length - */ - function truncate(fd: I.FD, length?: number): Promise; + /** + * Truncates a file to a specified length + */ + function ftruncate(fd: I.FD, length?: number): Promise; - /** - * Truncates a file to a specified length - */ - function truncateSync(fd: I.FD, length?: number): void; + /** + * Truncates a file to a specified length + */ + function ftruncateSync(fd: I.FD, length?: number): void; + /** + * Read data from the file specified by fd + */ + function read( + fd: I.FD, /** - * Read data from the file specified by fd + * The buffer that the data will be written to */ - function read( - fd: I.FD, - /** - * The buffer that the data will be written to - */ - buffer: Buffer | Uint8Array, - /** - * The offset in the buffer to start writing at - */ - offset: number, - /** - * An integer specifying the number of bytes to read - */ - length: number, - /** - * An argument specifying where to begin reading from in the file - */ - position: number - ): Promise; - - function readSync( - fd: I.FD, - /** - * The buffer that the data will be written to - */ - buffer: Buffer | Uint8Array, - /** - * The offset in the buffer to start writing at - */ - offset: number, - /** - * An integer specifying the number of bytes to read - */ - length: number, - /** - * An argument specifying where to begin reading from in the file - */ - position: number - ): number; - + buffer: Buffer | Uint8Array, /** - * Writes buffer to the file specified by fd + * The offset in the buffer to start writing at */ - function write( - fd: I.FD, - buffer: Buffer | Uint8Array, - /** - * Determines the part of the buffer to be written - */ - offset?: number, - /** - * An integer specifying the number of bytes to write - */ - length?: number, - /** - * The offset from the beginning of the file where this data should be written - */ - position?: number - ): Promise; - + offset: number, /** - * Writes string to the file specified by fd + * An integer specifying the number of bytes to read */ - function write( - fd: I.FD, - string: string, - /** - * The offset from the beginning of the file where this data should be written - */ - position?: number, - /** - * The expected string encoding - */ - encoding?: I.Encoding - ): Promise; - + length: number, /** - * Writes buffer to the file specified by fd + * An argument specifying where to begin reading from in the file */ - function writeSync( - fd: I.FD, - buffer: Buffer | Uint8Array, - /** - * Determines the part of the buffer to be written - */ - offset?: number, - /** - * An integer specifying the number of bytes to write - */ - length?: number, - /** - * The offset from the beginning of the file where this data should be written - */ - position?: number - ): number; + position: number + ): Promise; + function readSync( + fd: I.FD, /** - * Writes string to the file specified by fd + * The buffer that the data will be written to */ - function writeSync( - fd: I.FD, - string: string, - /** - * The offset from the beginning of the file where this data should be written - */ - position?: number, - /** - * The expected string encoding - */ - encoding?: I.Encoding - ): number; + buffer: Buffer | Uint8Array, + /** + * The offset in the buffer to start writing at + */ + offset: number, + /** + * An integer specifying the number of bytes to read + */ + length: number, + /** + * An argument specifying where to begin reading from in the file + */ + position: number + ): number; + /** + * Writes buffer to the file specified by fd + */ + function write( + fd: I.FD, + buffer: Buffer | Uint8Array, /** - * Synchronizes a file's in-core state with storage + * Determines the part of the buffer to be written */ - function sync(fd: I.FD): Promise; + offset?: number, + /** + * An integer specifying the number of bytes to write + */ + length?: number, + /** + * The offset from the beginning of the file where this data should be written + */ + position?: number + ): Promise; + /** + * Writes string to the file specified by fd + */ + function write( + fd: I.FD, + string: string, /** - * Synchronizes a file's in-core state with storage + * The offset from the beginning of the file where this data should be written */ - function syncSync(fd: I.FD): void; + position?: number, + /** + * The expected string encoding + */ + encoding?: I.Encoding + ): Promise; + /** + * Writes buffer to the file specified by fd + */ + function writeSync( + fd: I.FD, + buffer: Buffer | Uint8Array, /** - * Changes ownership of a file + * Determines the part of the buffer to be written */ - function chown(fd: I.FD, uid: number, gid: number): Promise; + offset?: number, + /** + * An integer specifying the number of bytes to write + */ + length?: number, + /** + * The offset from the beginning of the file where this data should be written + */ + position?: number + ): number; + /** + * Writes string to the file specified by fd + */ + function writeSync( + fd: I.FD, + string: string, /** - * Changes ownership of a file + * The offset from the beginning of the file where this data should be written */ - function chownSync(fd: I.FD, uid: number, gid: number): void; + position?: number, + /** + * The expected string encoding + */ + encoding?: I.Encoding + ): number; - /** - * Changes permissions of a file - */ - function chmod(fd: I.FD, mode: number): Promise; + /** + * Synchronizes a file's in-core state with storage + */ + function fsync(fd: I.FD): Promise; - /** - * Changes permissions of a file - */ - function chmodSync(fd: I.FD, mode: number): void; + /** + * Synchronizes a file's in-core state with storage + */ + function fsyncSync(fd: I.FD): void; - /** - * Repositions read/write file offset - */ - function seek(fd: I.FD, offset: number, whence: number): Promise; + /** + * Changes ownership of a file + */ + function fchown(fd: I.FD, uid: number, gid: number): Promise; - /** - * Applies or removes an advisory lock on an open file - */ - function lock(fd: I.FD, flags: "sh" | "ex" | "shnb" | "exnb" | "un" | number): Promise; - } + /** + * Changes ownership of a file + */ + function fchownSync(fd: I.FD, uid: number, gid: number): void; + + /** + * Changes permissions of a file + */ + function fchmod(fd: I.FD, mode: number): Promise; + + /** + * Changes permissions of a file + */ + function fchmodSync(fd: I.FD, mode: number): void; + + /** + * Repositions read/write file offset + */ + function seek(fd: I.FD, offset: number, whence: number): Promise; + + /** + * Applies or removes an advisory lock on an open file + */ + function flock(fd: I.FD, flags: "sh" | "ex" | "shnb" | "exnb" | "un" | number): Promise; namespace constants { const F_OK: number; @@ -1475,12 +1596,63 @@ declare namespace adone { function existsSync(path: string | Buffer | I.URL): boolean; /** - * Creates a new directory and any necessary subdirectories + * Creates a new directory */ function mkdir(path: string, mode?: number): Promise; + /** + * Creates a new directory + */ + function mkdirSync(path: string, mode?: number): Promise; + + /** + * Creates a new directory and any necessary subdirectories + */ + function mkdirp(path: string, mode?: number): Promise; + + /** + * Creates a new directory and any necessary subdirectories + */ + function mkdirpSync(path: string, mode?: number): Promise; + namespace I { interface CopyOptions { + /** + * regexp or function against which each filename is tested whether to copy it or not + */ + filter?: RegExp | ((src: string, dst: string) => boolean); + + /** + * transform function which applies when files are streamed + */ + transform?( + readStream: NodeJS.ReadableStream, + writeStream: NodeJS.WritableStream, + file: { + name: string, + mode: number, + mtime: Date, + atime: Date, + stats: adone.fs.I.Stats + } + ): void; + + /** + * Whether to overwrite destination files if they exist. + * + * true by default + */ + clobber?: boolean; // ??? + + /** + * Whether to overwrite destination files if they exist. + * + * true by default + */ + overwrite?: boolean; + } + + interface CopyToOptions { /** * Do not replace existing files */ @@ -1494,10 +1666,15 @@ declare namespace adone { } /** - * Copies all files from src to dst + * Recursively copies all the files from src to dst */ function copy(src: string, dst: string, options?: I.CopyOptions): Promise; + /** + * Copies all files from src to dst + */ + function copyTo(src: string, dst: string, options?: I.CopyToOptions): Promise; + /** * Renames a file */ @@ -1514,8 +1691,32 @@ declare namespace adone { /** * Returns the last lines of a file + * + * @param path path to a file + * @param n number of lines to return */ - function tail(path: string, n: number, options?: { separator?: string, chunkLength?: number }): Promise; + function tail(path: string, n: number, options?: { + /** + * Line separator + * + * By default "\r\n" for windows and "\n" for others + */ + separator?: string, + + /** + * The number of bytes to read at once + * + * By default 4096 + */ + chunkLength?: number + + /** + * Position from which to start reading (from the end) + * + * By default stats.size of the file + */ + pos?: number + }): Promise; namespace I { interface StatVFS { @@ -1667,11 +1868,6 @@ declare namespace adone { */ function lookup(path: string): Promise; - /** - * Recursively changes ownership of files - */ - function chownr(path: string, uid: number, gid: number): Promise; - namespace I.TailWatcher { interface ConstructorOptions { /** @@ -1709,7 +1905,7 @@ declare namespace adone { * Represents an event emitter that watches for a file growing, * emits "line" event for each new line in a file */ - class TailWatcher extends event.EventEmitter { + class TailWatcher extends event.Emitter { constructor(filename: string, options?: I.TailWatcher.ConstructorOptions); /** diff --git a/types/adone/glosses/is.d.ts b/types/adone/glosses/is.d.ts index 335439a0bf..20d898ca7b 100644 --- a/types/adone/glosses/is.d.ts +++ b/types/adone/glosses/is.d.ts @@ -6,13 +6,13 @@ declare namespace adone { /** * Checks whether the given object is `null` */ - function _null(obj: any): boolean; + function _null(obj: any): obj is null; export { _null as null }; /** * Checks whether the given object is `undefined` */ - export function undefined(obj: any): boolean; + export function undefined(obj: any): obj is undefined; /** * Checks whether the given object is nither `undefined` nor `null` @@ -22,52 +22,54 @@ declare namespace adone { /** * Checks whether the given object is either `undefined` or `null` */ - export function nil(obj: any): boolean; + export function nil(obj: any): obj is undefined | null; /** * Checks whether the given object is a number */ - export function number(obj: any): boolean; + export function number(obj: any): obj is number; /** * Checks whether the given object is a finite number or a string represents a finite number */ - export function numeral(obj: any): boolean; + export function numeral(obj: number): obj is number; + export function numeral(obj: string): obj is string; + export function numeral(obj: any): obj is number | string; /** * Checks whether the given object is either +Infinity or -Inginity */ - export function infinite(obj: any): boolean; + export function infinite(obj: any): obj is number; /** * Checks whether the given object is an odd number */ - export function odd(obj: any): boolean; + export function odd(obj: any): obj is number; /** * Checks whether the given object is an even number */ - export function even(obj: any): boolean; + export function even(obj: any): obj is number; /** * Checks whether the given object is a float */ - export function float(obj: any): boolean; + export function float(obj: any): obj is number; /** * Checks whether the given object is -0 */ - export function negativeZero(obj: any): boolean; + export function negativeZero(obj: any): obj is number; /** * Checks whether the given object is a string */ - export function string(obj: any): boolean; + export function string(obj: any): obj is string; /** - * Checks whether the given object is an empty string + * Checks whether the given object is an empty string, i.e. a string with only whitespace characters */ - export function emptyString(obj: any): boolean; + export function emptyString(obj: any): obj is string; /** * Checks whether the first string is a substring of the second string from the given offset @@ -87,7 +89,7 @@ declare namespace adone { /** * Checks whether the given object is a boolean */ - export function boolean(obj: any): boolean; + export function boolean(obj: any): obj is boolean; /** * Checks whether the given object is a string with ".json" extension or an object @@ -97,12 +99,12 @@ declare namespace adone { /** * Checks whether the given object is not a primitive, i.e. neither `undefined` nor `null` nor number nor string nor boolean nor symbol) */ - export function object(obj: any): boolean; + export function object(obj: any): obj is object; /** * Checks whether the given object is a plain object, i.e. created by Object */ - export function plainObject(obj: any): boolean; + export function plainObject(obj: any): obj is object; /** * Checks whether the given object is an adone namespace @@ -118,7 +120,7 @@ declare namespace adone { /** * Checks whether the given object is empty, i.e. it is an object(not a primitive), and Object.keys returns an empty array */ - export function emptyObject(obj: any): boolean; + export function emptyObject(obj: any): obj is object; /** * Checks whether the given object has the given owned property @@ -138,7 +140,7 @@ declare namespace adone { /** * Checks whether the given object is like an array, i.e. it is not a primitive, not a function and has length */ - export function arrayLikeObject(obj: any): boolean; + export function arrayLikeObject(obj: any): obj is ArrayLike; /** * Checks whether the given array has the given value @@ -215,7 +217,7 @@ declare namespace adone { /** * Checks whether the given string is a glob */ - export function glob(str: string): boolean; + export function glob(str: any): str is string; /** * Checks whether the given path is not a dot-file path (.secret) @@ -225,18 +227,18 @@ declare namespace adone { /** * Checks whether the given object is a function */ - function _function(obj: any): boolean; + function _function(obj: any): obj is (...args: any[]) => any; export { _function as function }; /** * Checks whether the given object is an async function */ - export function asyncFunction(obj: any): boolean; + export function asyncFunction(obj: any): obj is (...args: any[]) => Promise; /** * Checks whether the given object is a promise */ - export function promise(obj: any): boolean; + export function promise(obj: any): obj is PromiseLike; /** * Checks whether the given string is a valid date-string @@ -246,7 +248,7 @@ declare namespace adone { /** * Checks whether the given object is a buffer */ - export function buffer(obj: any): boolean; + export function buffer(obj: any): obj is Buffer; /** * Checks whether the given object is a callback function, i.e. it has a common function name @@ -256,7 +258,7 @@ declare namespace adone { /** * Checks whether the given object is a generator function */ - export function generator(obj: any): boolean; + export function generator(obj: any): obj is GeneratorFunction; /** * Checks whether the given object is NaN @@ -266,27 +268,27 @@ declare namespace adone { /** * Checks whether the given object is a finite number */ - export function finite(obj: any): boolean; + export function finite(obj: any): obj is number; /** * Checks whether the given object is an integer */ - export function integer(obj: any): boolean; + export function integer(obj: any): obj is number; /** * Checks whether the given object is a safe integer */ - export function safeInteger(obj: any): boolean; + export function safeInteger(obj: any): obj is number; /** * Checks whether the given object is an array */ - export function array(obj: any): boolean; + export function array(obj: any): obj is any[]; /** * Checks whether the given object is a Uint8 array */ - export function uint8Array(obj: any): boolean; + export function uint8Array(obj: any): obj is Uint8Array; /** * Checks whether the given object is an adone configuration @@ -296,34 +298,34 @@ declare namespace adone { /** * Checks whether the given object is an instance of adone.math.Long */ - export function long(obj: any): boolean; + export function long(obj: any): obj is adone.math.Long; /** * Checks whether the given object is an instance of adone.math.BigNumber */ - export function bigNumber(obj: any): boolean; + export function bigNumber(obj: any): obj is adone.math.BigNumber; /** * Checks whether the given object is an instance of adone.collection.ByteArray */ - export function byteArray(obj: any): boolean; + export function byteArray(obj: any): obj is adone.collection.ByteArray; /** * Checks whether the given object is an instance of adone.datetime */ - export function datetime(obj: any): boolean; + export function datetime(obj: any): obj is adone.I.datetime.Datetime; export function transform(obj: any): boolean; /** * Checks whether the given object is an adone subsystem */ - export function subsystem(obj: any): boolean; + export function subsystem(obj: any): obj is adone.application.Subsystem; /** * Checks whether the given object is an adone application */ - export function application(obj: any): boolean; + export function application(obj: any): obj is adone.application.Application; /** * Checks whether the given object is an adone logger @@ -333,22 +335,22 @@ declare namespace adone { /** * Checks whether the given object is a core stream */ - export function coreStream(obj: any): boolean; + export function coreStream(obj: any): obj is adone.stream.core.Stream; /** * Checks whether the given object is a fast local map stream */ - export function fastLocalMapStream(obj: any): boolean; + export function fastLocalMapStream(obj: any): obj is adone.fast.I.LocalMapStream; /** * Checks whether the given object is a fast local stream */ - export function fastLocalStream(obj: any): boolean; + export function fastLocalStream(obj: any): obj is adone.fast.I.LocalStream; /** * Checks whether the given object is a fast stream */ - export function fastStream(obj: any): boolean; + export function fastStream(obj: any): obj is adone.fast.I.Stream; /** * Checks whether the given object is a genesis netron @@ -428,7 +430,7 @@ declare namespace adone { /** * Checks whether the given object is iterable, has defined Symbol.iterator property */ - export function iterable(obj: any): boolean; + export function iterable(obj: any): obj is Iterable; /** * true if the OS is Windows @@ -498,17 +500,17 @@ declare namespace adone { /** * Checks whether the given object is an array buffer */ - export function arrayBuffer(obj: any): boolean; + export function arrayBuffer(obj: any): obj is ArrayBuffer; /** * Checks whether the given object is an array buffer view */ - export function arrayBufferView(obj: any): boolean; + export function arrayBufferView(obj: any): obj is ArrayBufferView; /** * Checks whether the given object is a date */ - export function date(obj: any): boolean; + export function date(obj: any): obj is Date; /** * Checks whether the given object is an error, instance of Error @@ -518,27 +520,22 @@ declare namespace adone { /** * Checks whether the given object is a map */ - export function map(obj: any): boolean; + export function map(obj: any): obj is Map; /** * Checks whether the given object is a regexp */ - export function regexp(obj: any): boolean; + export function regexp(obj: any): obj is RegExp; /** * Checks whether the given object is a set */ - export function set(obj: any): boolean; + export function set(obj: any): obj is Set; /** * Checks whether the given object is a symbol */ - export function symbol(obj: any): boolean; - - /** - * Checks whether the given buffer a valid UTF-8 encoded text - */ - export function validUTF8(obj: Buffer): boolean; + export function symbol(obj: any): obj is symbol; /** * Checks whether the given object is a vault valuable @@ -549,5 +546,135 @@ declare namespace adone { * Checks whether the given object is an adone task */ export function task(obj: any): boolean; + + namespace I { + interface FQDNOptions { + /** + * Whether to require top-level domain, default `true` + */ + requireTld?: boolean; + + /** + * Whether to allow underscores("_"), default `false` + */ + allowUnderscores?: boolean; + + /** + * Whether to allow trailing dot, default `false` + */ + allowTrailingDot?: boolean; + } + } + + /** + * Checks whether the given object(string) is a fully qualified domain name (e.g. domain.com). + */ + export function fqdn(obj: any, options?: I.FQDNOptions): obj is string; + + /** + * Checks whether the given object(string) is a url + */ + export function url(obj: any, options?: I.FQDNOptions & { + /** + * List of valid protocols. + * Used when requireValidProtocol is `true`. + * Default ["http", "https", "ftp"] + */ + protocols?: string[], + + /** + * Whether to require protocol, default `true` + */ + requireProtocol?: boolean, + + /** + * Whether to require host, default `true` + */ + requireHost?: boolean, + + /** + * Whether to require valid protocol defined in `protocols` options, default `true` + */ + requireValidProtocol?: boolean, + + /** + * Whether to allow urls like "//example.com", default `false` + */ + allowProtocolRelativeUrls?: boolean + }): obj is string; + + /** + * Checks whether the given object(string) is a valid email address + */ + export function email(obj: any, options?: { + /** + * Whether to allow email addresses with display names ("Name "") + */ + allowDisplayName?: boolean, + + /** + * Whether to require display name + */ + requireDisplayName?: boolean, + + /** + * Whether to allow UTF8 characters in the local part + */ + allowUtf8LocalPart?: boolean, + + /** + * Whether to require top-level domain, default `true` + */ + requireTld?: boolean + }): obj is string; + + /** + * Checks whether the given object is a valid IPv4 address + */ + export function ip(obj: any, version: 4): boolean; + + /** + * Checks whether the given object is a valid IPv6 address + */ + export function ip(obj: any, version: 6): boolean; + + /** + * Checks whether the given object in a valid IPv4 or IPv6 address + */ + export function ip(obj: any): boolean; + + /** + * Checks whether the given object is a valid UUIDv1 identifier + */ + export function uuid(obj: any, version: 1): obj is string; + + /** + * Checks whether the given object is a valid UUIDv2 identifier + */ + export function uuid(obj: any, version: 2): obj is string; + + /** + * Checks whether the given object is a valid UUIDv3 identifier + */ + export function uuid(obj: any, version: 3): obj is string; + + /** + * Checks whether the given object is a valid UUIDv4 identifier + */ + export function uuid(obj: any, version: 4): obj is string; + + /** + * Checks whether the given object is a valid UUIDv5 identifier + */ + export function uuid(obj: any, version: 5): obj is string; + + /** + * Checks whether the given object is a valid UUID identifier (v1, v2, v3, v4 or v5) + */ + export function uuid(obj: any, version?: "all"): obj is string; + + export function emitter(obj: any): obj is event.Emitter; + + export function asyncEmitter(obj: any): obj is event.AsyncEmitter; } } diff --git a/types/adone/glosses/meta.d.ts b/types/adone/glosses/meta.d.ts new file mode 100644 index 0000000000..bc96c1e148 --- /dev/null +++ b/types/adone/glosses/meta.d.ts @@ -0,0 +1,13 @@ +declare namespace adone { + namespace meta { + namespace I { + type PossibleTypes = "object" | "class" | "null" | "global" | "Array" | "RegExp" | "Date" + | "Promise" | "Set" | "Map" | "WeakSet" | "DataView" | "Map Iterator" | "Set Iterator" + | "Array Iterator" | "String Iterator" | "Object" | "function" | "boolean" | "number" + | "undefined" | "string" | "symbol"; + } + + function typeOf(obj: any): I.PossibleTypes; + function typeOf(obj: any): string; + } +} diff --git a/types/adone/glosses/net/http/client.d.ts b/types/adone/glosses/net/http/client.d.ts new file mode 100644 index 0000000000..33bccc95ac --- /dev/null +++ b/types/adone/glosses/net/http/client.d.ts @@ -0,0 +1,275 @@ +declare namespace adone.net.http { + namespace client { + namespace I { + interface RequestHeaders { + "Accept"?: string; + "Accept-Charset"?: string; + "Accept-Encoding"?: string; + "Accept-Language"?: string; + "Accept-Datetime"?: string; + "Access-Control-Request-Method"?: string; + "Access-Control-Request-Headers"?: string; + "Authorization"?: string; + "Cache-Control"?: string; + "Connection"?: string; + "Cookie"?: string; + "Content-Length"?: string; + "Content-MD5"?: string; + "Content-Type"?: string; + "Date"?: string; + "Expect"?: string; + "Forwarded"?: string; + "From"?: string; + "Host"?: string; + "If-Match"?: string; + "If-Modified-Since"?: string; + "If-None-Match"?: string; + "If-Range"?: string; + "If-Unmodified-Since"?: string; + "Max-Forwards"?: string; + "Origin"?: string; + "Pragma"?: string; + "Proxy-Authorization"?: string; + "Range"?: string; + "Referer"?: string; + "TE"?: string; + "User-Agent"?: string; + "Upgrade"?: string; + "Via"?: string; + "Warning"?: string; + "X-Requested-With"?: string; + "DNT"?: string; + "X-Forwarded-For"?: string; + "X-Forwarded-Host"?: string; + "X-Forwarded-Proto"?: string; + "Front-End-Https"?: string; + "X-Http-Method-Override"?: string; + "X-ATT-DeviceId"?: string; + "X-Wap-Profile"?: string; + "Proxy-Connection"?: string; + "X-UIDH"?: string; + "X-Csrf-Token"?: string; + "X-Request-ID"?: string; + "X-Correlation-ID"?: string; + + [name: string]: string | undefined; + } + + interface ResponseHeaders { + "accept-patch": string | undefined; + "accept-ranges": string | undefined; + "access-control-allow-credentials": string | undefined; + "access-control-allow-headers": string | undefined; + "access-control-allow-methods": string | undefined; + "access-control-allow-origin": string | undefined; + "access-control-expose-headers": string | undefined; + "access-control-max-age": string | undefined; + "age": string | undefined; + "allow": string | undefined; + "alt-svc": string | undefined; + "cache-control": string | undefined; + "connection": string| undefined; + "content-disposition": string | undefined; + "content-encoding": string| undefined; + "content-language": string | undefined; + "content-length": string| undefined; + "content-location": string| undefined; + "content-md5": string| undefined; + "content-range": string| undefined; + "content-security-policy": string | undefined; + "content-type": string| undefined; + "date": string| undefined; + "etag": string| undefined; + "expires": string| undefined; + "keep-alive": string | undefined; + "last-modified": string | undefined; + "link": string| undefined; + "location": string| undefined; + "p3p": string| undefined; + "pragma": string| undefined; + "proxy-authenticate": string | undefined; + "public-key-pins": string| undefined; + "referer-policy": string | undefined; + "refresh": string | undefined; + "retry-after": string | undefined; + "server": string | undefined; + "set-cookie": string | undefined; + "status": string | undefined; + "strict-transport-security": string| undefined; + "timing-allow-origin": string | undefined; + "tk": string| undefined; + "transfer-encoding": string | undefined; + "upgrade-insecure-requests": string | undefined; + "upgrade": string| undefined; + "vary": string | undefined; + "via": string| undefined; + "warning": string| undefined; + "www-authenticate": string | undefined; + "x-content-duration": string | undefined; + "x-content-security-policy": string | undefined; + "x-content-type-options": string | undefined; + "x-correlation-id": string | undefined; + "x-frame-options": string| undefined; + "x-powered-by": string | undefined; + "x-request-id": string | undefined; + "x-ua-compatible": string | undefined; + "x-webkit-csp": string | undefined; + "x-xss-protection": string | undefined; + + [header: string]: string | undefined; + } + + interface Response { + status: number; + statusText: string; + headers: ResponseHeaders; + data: T; + } + + type Transformer = (data: Data, headers: object, config: I.Options) => Data; + + interface FormValueOptions { + header?: string | { [key: string]: string }; + knownLength?: number; + filename?: string; + filepath?: string; + contentType?: string; + } + + type FormValue = string | Buffer | nodestd.stream.Readable | { + value: string | Buffer | nodestd.stream.Readable; + options: FormValueOptions + }; + + interface UploadProgressEvent { + lengthComputable: boolean; + loaded: number; + total: number; + } + + interface ProxyObject { + protocol?: string; + host?: string; + port?: number; + auth?: { + username?: string; + password?: string; + }; + } + + interface Config { + adapter(config: I.Config): Promise>; + transformRequest: Transformer[]; + transformResponse: Transformer[]; + timeout: number; + xsrfCookieName: string; + xsrfHeaderName: string; + maxContentLength: number; + validateStatus: (status: number) => boolean; + responseType: "buffer" | "string" | "stream" | "json"; + responseEncoding: adone.util.iconv.I.SupportedEncoding; + method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS"; + headers: RequestHeaders; + data: Data; + formData: { + [formKey: string]: FormValue | FormValue[]; + }; + auth: { + username?: string; + password?: string; + }; + httpsAgent: object; + httpAgent: object; + params: object; + rejectUnauthorized: boolean; + proxy: string | ProxyObject | false; + transport: object; + maxRedirects: number; + cancelToken: CancelToken; + onUploadProgress(event: UploadProgressEvent): void; + baseURL: string; + paramsSerializer(params: object): string; + } + + type Options = Partial; + + type Data = string | Buffer | ArrayBuffer | nodestd.stream.Readable | ArrayBufferView | object | undefined; + + interface Request extends Client { + (config: I.Options, ...args: any[]): Promise; + } + } + + class Client { + constructor(options?: I.Options); + + request(config: I.Options & { responseType: "json" }, ...args: any[]): Promise>; + request(config: I.Options & { responseType: "string" }, ...args: any[]): Promise>; + request(config: I.Options & { responseType: "buffer" }, ...args: any[]): Promise>; + request(config: I.Options & { responseType: "stream" }, ...args: any[]): Promise>; + request(config: I.Options, ...args: any[]): Promise>; + + get(url: string, options: I.Options & { responseType: "string" }): Promise>; + get(url: string, options: I.Options & { responseType: "buffer" }): Promise>; + get(url: string, options: I.Options & { responseType: "stream" }): Promise>; + get(url: string, options?: I.Options): Promise>; + + post(url: string, data: I.Data, options: I.Options & { responseType: "string" }): Promise>; + post(url: string, data: I.Data, options: I.Options & { responseType: "buffer" }): Promise>; + post(url: string, data: I.Data, options: I.Options & { responseType: "stream" }): Promise>; + post(url: string, data?: I.Data, options?: I.Options): Promise>; + + put(url: string, data: I.Data, options: I.Options & { responseType: "string" }): Promise>; + put(url: string, data: I.Data, options: I.Options & { responseType: "buffer" }): Promise>; + put(url: string, data: I.Data, options: I.Options & { responseType: "stream" }): Promise>; + put(url: string, data?: I.Data, options?: I.Options): Promise>; + + patch(url: string, data: I.Data, options: I.Options & { responseType: "string" }): Promise>; + patch(url: string, data: I.Data, options: I.Options & { responseType: "buffer" }): Promise>; + patch(url: string, data: I.Data, options: I.Options & { responseType: "stream" }): Promise>; + patch(url: string, data?: I.Data, options?: I.Options): Promise>; + + delete(url: string, options: I.Options & { responseType: "string" }): Promise>; + delete(url: string, options: I.Options & { responseType: "buffer" }): Promise>; + delete(url: string, options: I.Options & { responseType: "stream" }): Promise>; + delete(url: string, options?: I.Options): Promise>; + + options(url: string, options: I.Options & { responseType: "string" }): Promise>; + options(url: string, options: I.Options & { responseType: "buffer" }): Promise>; + options(url: string, options: I.Options & { responseType: "stream" }): Promise>; + options(url: string, options?: I.Options): Promise>; + } + + class Cancel { + message: string; + + constructor(message: string); + } + + namespace I { + type Canceller = (message?: string) => void; + + interface CancelTokenSource { + token: CancelToken; + cancel: Canceller; + } + } + + class CancelToken { + promise: Promise; + reason?: Cancel; + + constructor(executor: I.Canceller); + + throwIfRequested(): void; + + static source(): I.CancelTokenSource; + } + + const request: I.Request; + + function create(options?: I.Options): I.Request; + + function isCancel(obj: any): obj is Cancel; + } +} diff --git a/types/adone/glosses/net/http/index.d.ts b/types/adone/glosses/net/http/index.d.ts new file mode 100644 index 0000000000..a4fbe478d8 --- /dev/null +++ b/types/adone/glosses/net/http/index.d.ts @@ -0,0 +1,7 @@ +/// + +declare namespace adone.net { + namespace http { + // + } +} diff --git a/types/adone/glosses/net/index.d.ts b/types/adone/glosses/net/index.d.ts new file mode 100644 index 0000000000..5e773e4601 --- /dev/null +++ b/types/adone/glosses/net/index.d.ts @@ -0,0 +1,7 @@ +/// + +declare namespace adone { + namespace net { + // + } +} diff --git a/types/adone/glosses/pretty/index.d.ts b/types/adone/glosses/pretty/index.d.ts new file mode 100644 index 0000000000..ca2bc125f6 --- /dev/null +++ b/types/adone/glosses/pretty/index.d.ts @@ -0,0 +1,10 @@ +/// +/// +/// +/// + +declare namespace adone { + namespace pretty { + // + } +} diff --git a/types/adone/glosses/pretty/json.d.ts b/types/adone/glosses/pretty/json.d.ts new file mode 100644 index 0000000000..0c86d4fa49 --- /dev/null +++ b/types/adone/glosses/pretty/json.d.ts @@ -0,0 +1,16 @@ +declare namespace adone.pretty { + namespace I { + interface JSONOptions { + emptyArrayMsg?: string; + keysColor?: string; + dashColor?: string; + numberColor?: string; + stringColor?: string; + defaultIndentation?: number; + noColor?: boolean; + noAlign?: boolean; + } + } + + function json(data: any, options?: I.JSONOptions, indentation?: number): string; +} diff --git a/types/adone/glosses/pretty/size.d.ts b/types/adone/glosses/pretty/size.d.ts new file mode 100644 index 0000000000..2ff1c1c4b5 --- /dev/null +++ b/types/adone/glosses/pretty/size.d.ts @@ -0,0 +1,3 @@ +declare namespace adone.pretty { + function size(num: number, space?: string): string; +} diff --git a/types/adone/glosses/pretty/table.d.ts b/types/adone/glosses/pretty/table.d.ts new file mode 100644 index 0000000000..b71ce18d2c --- /dev/null +++ b/types/adone/glosses/pretty/table.d.ts @@ -0,0 +1,38 @@ +declare namespace adone.pretty { + namespace I { + interface TableColumn { + id: string; + header?: string; + align?: "right" | "center" | "left"; + width?: string | number; + maxWidth?: number | string; + wordwrap?: "soft" | "hard" | adone.text.I.WordWrapOptions; + handle?: (item: object) => string; + format?: string | ((val: any, item: object) => string); + style?: string | ((val: any, str: string) => string); + } + + type TableModel = TableColumn[]; + + interface TableStyle { + "padding-left"?: number; + "padding-right"?: number; + head?: string[]; + broder?: string[]; + compact?: boolean; + } + + interface TableOptions { + model: TableModel; + noHeader?: boolean; + borderless?: boolean; + style?: TableStyle; + width?: number | string; + countAnsiEscapeCodes?: boolean; + } + + type TableData = Array<{ [id: string]: any }>; + } + + function table(data: I.TableData, options: I.TableOptions): string; +} diff --git a/types/adone/glosses/pretty/time.d.ts b/types/adone/glosses/pretty/time.d.ts new file mode 100644 index 0000000000..3732c16640 --- /dev/null +++ b/types/adone/glosses/pretty/time.d.ts @@ -0,0 +1,11 @@ +declare namespace adone.pretty { + namespace I { + interface TimeOptions { + msDecimalDigits?: number; + secDecimalDigits?: number; + verbose?: boolean; + compact?: boolean; + } + } + function time(ms: number, options?: I.TimeOptions): string; +} diff --git a/types/adone/glosses/promise.d.ts b/types/adone/glosses/promise.d.ts index cdfe0ec2f5..cc0eac9c73 100644 --- a/types/adone/glosses/promise.d.ts +++ b/types/adone/glosses/promise.d.ts @@ -125,5 +125,36 @@ declare namespace adone { */ function _finally(promise: Promise, onFinally?: (...args: any[]) => void): Promise; export { _finally as finally }; + + namespace I { + type ResolvableProps = object & {[K in keyof T]: PromiseLike | T[K]}; + } + + /** + * Returns a promise that is fulfilled when all the object's values are fulfilled + */ + export function props(obj: I.ResolvableProps): Promise; + + namespace I { + interface _RetryOptions { + max: number; + + timeout: number; + + match: (string | RegExp | Error) | Array; + + backOffBase: number; + + backOffExponent: number; + + report: (message: string, options: _RetryOptions, err: any) => void; + + name: string; + } + + type RetryOptions = Partial<_RetryOptions>; + } + + export function retry(fn: (info: { current: number }) => PromiseLike | T, options?: number | I.RetryOptions): Promise; } } diff --git a/types/adone/glosses/regex.d.ts b/types/adone/glosses/regex.d.ts new file mode 100644 index 0000000000..e5c3be642a --- /dev/null +++ b/types/adone/glosses/regex.d.ts @@ -0,0 +1,25 @@ +declare namespace adone { + namespace regex { + function filename(): RegExp; + + function ip4(): RegExp; + + function ip6(): RegExp; + + function protocol(): RegExp; + + function idn(): RegExp; + + function punycode(): RegExp; + + function uri(): RegExp; + + function uuid4(): RegExp; + + function uuid5(): RegExp; + + function ansi(): RegExp; + + function shebang(): RegExp; + } +} diff --git a/types/adone/glosses/semver.d.ts b/types/adone/glosses/semver.d.ts new file mode 100644 index 0000000000..6c78695600 --- /dev/null +++ b/types/adone/glosses/semver.d.ts @@ -0,0 +1,237 @@ +declare namespace adone { + namespace semver { + const SEMVER_SPEC_VERSION: "2.0.0"; + + namespace I { + type ReleaseType = "major" + | "premajor" + | "minor" + | "preminor" + | "patch" + | "prepatch" + | "prerelease"; + + type Operator = '===' + | "!==" + | "" + | "=" + | "==" + | "!=" + | ">" + | ">=" + | "<" + | "<="; + } + + /** + * Returns the parsed version as a SemVer object, or null if it's not valid. + */ + function parse(v: string | SemVer, loose?: boolean): SemVer | null; + + /** + * Returns the parsed version, or null if it's not valid. + */ + function valid(v: string | SemVer, loose?: boolean): string | null; + + /** + * Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) and parsed version, or null if version is invalid. + */ + function clean(version: string, loose?: boolean): string | null; + + /** + * Returns the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid. + */ + function inc(v: string | SemVer, release: I.ReleaseType, loose?: boolean, identifier?: string): string | null; + + /** + * Returns the major version number. + */ + function major(v: string | SemVer, loose?: boolean): number; + + /** + * Returns the minor version number. + */ + function minor(v: string | SemVer, loose?: boolean): number; + + /** + * Returns the patch version number. + */ + function patch(v: string | SemVer, loose?: boolean): number; + + /** + * Returns an array of prerelease components, or null if none exist. + */ + function prerelease(v: string | SemVer, loose?: boolean): string[] | null; + + // Comparison + + /** + * v1 > v2 + */ + function gt(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * v1 >= v2 + */ + function gte(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * v1 < v2 + */ + function lt(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * v1 <= v2 + */ + function lte(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings. + */ + function eq(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * v1 != v2 The opposite of eq. + */ + function neq(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * Pass in a comparison string, and it'll call the corresponding semver comparison function. + * "===" and "!==" do simple string comparison, but are included for completeness. + * Throws if an invalid comparison string is provided. + */ + function cmp(v1: string | SemVer, operator: I.Operator, v2: string | SemVer, loose?: boolean): boolean; + + /** + * Returns 0 if v1 == v2, or 1 if v1 is greater, or -1 if v2 is greater. Sorts in ascending order if passed to Array.sort(). + */ + function compare(v1: string | SemVer, v2: string | SemVer, loose?: boolean): 1 | 0 | -1; + + /** + * The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort(). + */ + function rcompare(v1: string | SemVer, v2: string | SemVer, loose?: boolean): 1 | 0 | -1; + + /** + * Compares two identifiers, must be numeric strings or truthy/falsy values. Sorts in ascending order if passed to Array.sort(). + */ + function compareIdentifiers(a: string | null, b: string | null): 1 | 0 | -1; + + /** + * The reverse of compareIdentifiers. Sorts in descending order when passed to Array.sort(). + */ + function rcompareIdentifiers(a: string | null, b: string | null): 1 | 0 | -1; + + /** + * Sorts an array of semver entries in ascending order. + */ + function sort(list: Array, loose?: boolean): Array; + + /** + * Sorts an array of semver entries in descending order. + */ + function rsort(list: Array, loose?: boolean): Array; + + /** + * Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same. + */ + function diff(v1: string, v2: string, loose?: boolean): I.ReleaseType | null; + + // Ranges + + /** + * Returns the valid range or null if it's not valid + */ + function validRange(range: string | Range, loose?: boolean): string; + + /** + * Returns true if the version satisfies the range. + */ + function satisfies(version: string | SemVer, range: string | Range, loose?: boolean): boolean; + + /** + * Returns the highest version in the list that satisfies the range, or null if none of them do. + */ + function maxSatisfying(versions: Array, range: string | Range, loose?: boolean): string; + + /** + * Returns the lowest version in the list that satisfies the range, or null if none of them do. + */ + function minSatisfying(versions: Array, range: string, loose?: boolean): string; + + /** + * Returns true if version is greater than all the versions possible in the range. + */ + function gtr(version: string | SemVer, range: string | Range, loose?: boolean): boolean; + + /** + * Returns true if version is less than all the versions possible in the range. + */ + function ltr(version: string | SemVer, range: string | Range, loose?: boolean): boolean; + + /** + * Returns true if the version is outside the bounds of the range in either the high or low direction. + * The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.) + */ + function outside(version: string | SemVer, range: string | Range, hilo: '>' | '<', loose?: boolean): boolean; + + /** + * Returns true if any of the ranges comparators intersect + */ + function intersects(range1: string | Range, range2: string | Range, loose?: boolean): boolean; + + // Coercion + + /** + * Coerces a string to semver if possible + */ + function coerce(version: string | SemVer): SemVer | null; + + class SemVer { + constructor(version: string | SemVer, loose?: boolean); + + raw: string; + loose: boolean; + format(): string; + inspect(): string; + + major: number; + minor: number; + patch: number; + version: string; + build: string[]; + prerelease: string[]; + + compare(other: string | SemVer): 1 | 0 | -1; + compareMain(other: string | SemVer): 1 | 0 | -1; + comparePre(other: string | SemVer): 1 | 0 | -1; + inc(release: I.ReleaseType, identifier?: string): SemVer; + } + + class Comparator { + constructor(comp: string | Comparator, loose?: boolean); + + semver: SemVer; + operator: string; + value: boolean; + parse(comp: string): void; + test(version: string | SemVer): boolean; + intersects(comp: Comparator, loose?: boolean): boolean; + } + + class Range { + constructor(range: string | Range, loose?: boolean); + + range: string; + raw: string; + loose: boolean; + format(): string; + inspect(): string; + + set: Comparator[][]; + parseRange(range: string): Comparator[]; + test(version: string | SemVer): boolean; + intersects(range: Range, loose?: boolean): boolean; + } + } +} diff --git a/types/adone/glosses/shani.d.ts b/types/adone/glosses/shani.d.ts index 0b79633f78..5bc2d0153f 100644 --- a/types/adone/glosses/shani.d.ts +++ b/types/adone/glosses/shani.d.ts @@ -94,6 +94,11 @@ declare namespace adone { * Mark this block as exclusive */ skip: DescribeFunction; + + /** + * Mark this block as todo + */ + todo: DescribeFunction; } interface TestOptions { @@ -146,6 +151,11 @@ declare namespace adone { * Mark this test as exclusive */ skip: TestFunction; + + /** + * Mark this test as todo + */ + todo: TestFunction; } interface HookRuntimeContext { @@ -172,7 +182,7 @@ declare namespace adone { | "end before each hook" | "end after each hook" | "end before test hook" | "end after test hook"; - interface Emitter extends event.EventEmitter { + interface Emitter extends event.Emitter { on(event: "enter block", listener: (event: { block: Block }) => void): this; on(event: "exit block", listener: (event: { block: Block }) => void): this; on(event: "start test", listener: (event: { block: Block, test: Test }) => void): this; @@ -267,6 +277,11 @@ declare namespace adone { */ only(): this; + /** + * Marks this test as todo + */ + todo(): this; + /** * Returns the timeout of the test */ @@ -355,6 +370,11 @@ declare namespace adone { */ only(): this; + /** + * Marks this block as todo + */ + todo(): this; + /** * Returns the timeout of the block */ @@ -1423,7 +1443,7 @@ declare namespace adone { /** * Requires the value to be of the given type */ - typeOf(type: adone.util.I.PossibleTypes): Matcher; + typeOf(type: adone.meta.I.PossibleTypes): Matcher; typeOf(type: string): Matcher; /** diff --git a/types/adone/glosses/std.d.ts b/types/adone/glosses/std.d.ts index ec4bc4c37a..376b814d3e 100644 --- a/types/adone/glosses/std.d.ts +++ b/types/adone/glosses/std.d.ts @@ -1,34 +1,37 @@ -import * as assert from "assert"; -import * as fs from "fs"; -import * as path from "path"; -import * as util from "util"; -import * as events from "events"; -import * as stream from "stream"; -import * as url from "url"; -import * as net from "net"; -import * as http from "http"; -import * as https from "https"; -import * as child_process from "child_process"; -import * as os from "os"; -import * as cluster from "cluster"; -import * as repl from "repl"; -import * as punycode from "punycode"; -import * as readline from "readline"; -import * as string_decoder from "string_decoder"; -import * as querystring from "querystring"; -import * as crypto from "crypto"; -import * as vm from "vm"; -import * as v8 from "v8"; -import * as domain from "domain"; -import * as tty from "tty"; -import * as buffer from "buffer"; -import * as constants from "constants"; -import * as zlib from "zlib"; -import * as tls from "tls"; -import * as console from "console"; -import * as dns from "dns"; -import * as timers from "timers"; -import * as dgram from "dgram"; +import assert = require("assert"); +import fs = require("fs"); +import path = require("path"); +import util = require("util"); +import events = require("events"); +import stream = require("stream"); +import url = require("url"); +import net = require("net"); +import http = require("http"); +import http2 = require("http2"); +import https = require("https"); +import child_process = require("child_process"); +import os = require("os"); +import cluster = require("cluster"); +import repl = require("repl"); +import punycode = require("punycode"); +import readline = require("readline"); +import string_decoder = require("string_decoder"); +import querystring = require("querystring"); +import crypto = require("crypto"); +import vm = require("vm"); +import v8 = require("v8"); +import domain = require("domain"); +import module = require("module"); +import tty = require("tty"); +import buffer = require("buffer"); +import constants = require("constants"); +import zlib = require("zlib"); +import tls = require("tls"); +import console = require("console"); +import dns = require("dns"); +import timers = require("timers"); +import dgram = require("dgram"); +import perf_hooks = require("perf_hooks"); export { assert, @@ -40,6 +43,7 @@ export { url, net, http, + http2, https, child_process, os, @@ -53,6 +57,7 @@ export { vm, v8, domain, + module, tty, buffer, constants, @@ -62,6 +67,7 @@ export { dns, timers, dgram, + perf_hooks }; export as namespace nodestd; diff --git a/types/adone/glosses/streams.d.ts b/types/adone/glosses/streams.d.ts index 012a6aadc3..e4d07065b6 100644 --- a/types/adone/glosses/streams.d.ts +++ b/types/adone/glosses/streams.d.ts @@ -1,223 +1,225 @@ declare namespace adone { namespace stream { - namespace I.CoreStream { - interface ConstructorOptions { - /** - * Whether the initial stream is asynchronous - */ - async?: boolean; + namespace core { + namespace I { + interface ConstructorOptions { + /** + * Whether the initial stream is asynchronous + */ + async?: boolean; - /** - * Whether the initial stream is synchronous - */ - sync?: boolean; + /** + * Whether the initial stream is synchronous + */ + sync?: boolean; - /** - * The initial transform (passthrough is default) - */ - transform?: TransformFunction; + /** + * The initial transform (passthrough is default) + */ + transform?: TransformFunction; - /** - * The initial flush function - */ - flush?: FlushFunction; + /** + * The initial flush function + */ + flush?: FlushFunction; + } + + type Source = S[] | Stream; + + interface TransformContext { + /** + * Pushes the given value into the stream + */ + push(value: T): boolean; + } + + type TransformFunction = (this: TransformContext, value: S) => void; + type FlushFunction = (this: TransformContext) => void; } - type Source = S[] | CoreStream; + /** + * Represents a chain of transform streams + */ + class Stream implements PromiseLike { + constructor(source?: I.Source, options?: I.ConstructorOptions); + + /** + * Writes the given value into the stream + */ + write(value: S): boolean; - interface TransformContext { /** * Pushes the given value into the stream */ push(value: T): boolean; + + /** + * Ends the stream + */ + end(): this; + + /** + * Destroys the stream + */ + destroy(): this; + + /** + * Pauses the stream + */ + pause(): this; + + /** + * Resumes the stream + */ + resume(): this; + + /** + * Whether the stream is paused + */ + isPaused(): boolean; + + /** + * Whether the stream is ended + */ + isEnded(): boolean; + + /** + * Pipes this stream to another + */ + pipe(stream: T, options?: { end?: boolean }): T; + + /** + * Adds a new synchronous transform stream into the chain + */ + throughSync(transform: I.TransformFunction, flush?: I.FlushFunction): Stream; + + /** + * Adds a new asynchronous transform stream into the chain + */ + throughAsync(transform: I.TransformFunction, flush?: I.FlushFunction): Stream; + + /** + * Adds a new transform stream into the chain + */ + through(transform: I.TransformFunction, flush?: I.FlushFunction): Stream; + + /** + * Adds a new map transform into the chain. + * + * Note: synchronous functions create a synchronous transform. + * If your function returns a promise use an asynchronous function if you don't want to pass a promise through the stream + */ + map(callback: (value: T) => R | Promise): Stream; + + /** + * Adds a new conditional map transform into the chain + */ + mapIf(condition: (value: T) => boolean | Promise, callback: (value: T) => R): Stream; + + /** + * Adds a new filter transform into the chain + */ + filter(callback: (value: T) => boolean | Promise): this; + + /** + * Adds a new transform that calls the given callback for each value from the stream. + * + * This method resumes the stream. + */ + forEach(callback: (value: T) => void, options?: { + /** + * Whethe to wait for asynchronous functions (await) + */ + wait?: boolean, + + /** + * Passthrough the read values, by default it eats everything + */ + passthrough?: boolean + }): this; + + /** + * Adds a new transform that calls the given callback when the underlying stream ends. + * + * This method resumes the stream. + */ + done(callback: () => void, options?: { + /** + * Passthrough the read values, by default it eats everything + */ + passthrough?: boolean + }): this; + + /** + * Adds a new transform that gather all the read values into an array and calls the given callback + * when the underlying stream ends. + * + * This method resumes the stream. + */ + toArray(callback: (result: T[]) => void, options?: { + /** + * Passthrough the read values, by default it eats everything + */ + passthrough?: boolean + }): this; + + /** + * Adds a new transform that filters the values by their uniqueness + * + * @param prop callback that calculates value's hash which is used in uniqueness checks + */ + unique(prop?: (value: T) => any): this; + + /** + * Adds a new transform that filters the values using the given given function with ability to restore the filtered values + */ + stash(name: string, filter: (value: T) => boolean): this; + stash(filter: (value: T) => boolean): this; + + /** + * Adds a new transform that restores the previous stashed values + */ + unstash(name?: string): Stream; // ?? + + /** + * Flattens all the read array values + */ + flatten(): Stream; // ?? + + /** + * Merges the given stream into a core stream + */ + static merge(streams: Array | nodestd.stream.Transform | nodestd.stream.Readable | nodestd.stream.Duplex>, options?: { + /** + * Whether to end the stream when all the given streams end + */ + end?: boolean, + + /** + * Options for the initial core stream + */ + sourceOptions?: I.ConstructorOptions + }): Stream; + + /** + * Creates a promise that will be fulfilled with an array of all the emitted values or the first occurred error. + * + * This method resumes the stream. + */ + then(onResolve?: (value: T[]) => T1 | PromiseLike, onReject?: (reason: any) => T2 | PromiseLike): Promise; + + /** + * Creates a promise that will be fulfilled with an array of all the emitted values or the first occurred error. + * + * This method resumes the stream. + */ + catch(onReject?: (reason: any) => T1 | PromiseLike): Promise; } - type TransformFunction = (this: TransformContext, value: S) => void; - type FlushFunction = (this: TransformContext) => void; + /** + * Creates a CoreStream instance + */ + function create(source?: I.Source, options?: I.ConstructorOptions): Stream; } - - /** - * Represents a chain of transform streams - */ - class CoreStream implements PromiseLike { - constructor(source?: I.CoreStream.Source, options?: I.CoreStream.ConstructorOptions); - - /** - * Writes the given value into the stream - */ - write(value: S): boolean; - - /** - * Pushes the given value into the stream - */ - push(value: T): boolean; - - /** - * Ends the stream - */ - end(): this; - - /** - * Destroys the stream - */ - destroy(): this; - - /** - * Pauses the stream - */ - pause(): this; - - /** - * Resumes the stream - */ - resume(): this; - - /** - * Whether the stream is paused - */ - isPaused(): boolean; - - /** - * Whether the stream is ended - */ - isEnded(): boolean; - - /** - * Pipes this stream to another - */ - pipe(stream: T, options?: { end?: boolean }): T; - - /** - * Adds a new synchronous transform stream into the chain - */ - throughSync(transform: I.CoreStream.TransformFunction, flush?: I.CoreStream.FlushFunction): CoreStream; - - /** - * Adds a new asynchronous transform stream into the chain - */ - throughAsync(transform: I.CoreStream.TransformFunction, flush?: I.CoreStream.FlushFunction): CoreStream; - - /** - * Adds a new transform stream into the chain - */ - through(transform: I.CoreStream.TransformFunction, flush?: I.CoreStream.FlushFunction): CoreStream; - - /** - * Adds a new map transform into the chain. - * - * Note: synchronous functions create a synchronous transform. - * If your function returns a promise use an asynchronous function if you don't want to pass a promise through the stream - */ - map(callback: (value: T) => R | Promise): CoreStream; - - /** - * Adds a new conditional map transform into the chain - */ - mapIf(condition: (value: T) => boolean | Promise, callback: (value: T) => R): CoreStream; - - /** - * Adds a new filter transform into the chain - */ - filter(callback: (value: T) => boolean | Promise): this; - - /** - * Adds a new transform that calls the given callback for each value from the stream. - * - * This method resumes the stream. - */ - forEach(callback: (value: T) => void, options?: { - /** - * Whethe to wait for asynchronous functions (await) - */ - wait?: boolean, - - /** - * Passthrough the read values, by default it eats everything - */ - passthrough?: boolean - }): this; - - /** - * Adds a new transform that calls the given callback when the underlying stream ends. - * - * This method resumes the stream. - */ - done(callback: () => void, options?: { - /** - * Passthrough the read values, by default it eats everything - */ - passthrough?: boolean - }): this; - - /** - * Adds a new transform that gather all the read values into an array and calls the given callback - * when the underlying stream ends. - * - * This method resumes the stream. - */ - toArray(callback: (result: T[]) => void, options?: { - /** - * Passthrough the read values, by default it eats everything - */ - passthrough?: boolean - }): this; - - /** - * Adds a new transform that filters the values by their uniqueness - * - * @param prop callback that calculates value's hash which is used in uniqueness checks - */ - unique(prop?: (value: T) => any): this; - - /** - * Adds a new transform that filters the values using the given given function with ability to restore the filtered values - */ - stash(name: string, filter: (value: T) => boolean): this; - stash(filter: (value: T) => boolean): this; - - /** - * Adds a new transform that restores the previous stashed values - */ - unstash(name?: string): CoreStream; // ?? - - /** - * Flattens all the read array values - */ - flatten(): CoreStream; // ?? - - /** - * Merges the given stream into a core stream - */ - static merge(streams: Array | nodestd.stream.Transform | nodestd.stream.Readable | nodestd.stream.Duplex>, options?: { - /** - * Whether to end the stream when all the given streams end - */ - end?: boolean, - - /** - * Options for the initial core stream - */ - sourceOptions?: I.CoreStream.ConstructorOptions - }): CoreStream; - - /** - * Creates a promise that will be fulfilled with an array of all the emitted values or the first occurred error. - * - * This method resumes the stream. - */ - then(onResolve?: (value: T[]) => T1 | PromiseLike, onReject?: (reason: any) => T2 | PromiseLike): Promise; - - /** - * Creates a promise that will be fulfilled with an array of all the emitted values or the first occurred error. - * - * This method resumes the stream. - */ - catch(onReject?: (reason: any) => T1 | PromiseLike): Promise; - } - - /** - * Creates a CoreStream instance - */ - function core(source?: I.CoreStream.Source, options?: I.CoreStream.ConstructorOptions): CoreStream; } } diff --git a/types/adone/glosses/system/env.d.ts b/types/adone/glosses/system/env.d.ts new file mode 100644 index 0000000000..3ad18ab041 --- /dev/null +++ b/types/adone/glosses/system/env.d.ts @@ -0,0 +1,19 @@ +declare namespace adone.system { + namespace env { + function user(): string; + + function prompt(): string; + + function hostname(): string; + + function tmpdir(): string; + + function home(): string; + + function path(): string; + + function editor(): string; + + function shell(): string; + } +} diff --git a/types/adone/glosses/system/index.d.ts b/types/adone/glosses/system/index.d.ts new file mode 100644 index 0000000000..7a3ceced9d --- /dev/null +++ b/types/adone/glosses/system/index.d.ts @@ -0,0 +1,9 @@ +/// +/// +/// + +declare namespace adone { + namespace system { + // + } +} diff --git a/types/adone/glosses/system/process.d.ts b/types/adone/glosses/system/process.d.ts new file mode 100644 index 0000000000..51d0c45ddc --- /dev/null +++ b/types/adone/glosses/system/process.d.ts @@ -0,0 +1,241 @@ +declare namespace adone.system.process { + function errname(code: number): string; + + function errnameFallback(uv: object, code: number): string; + + function stdio(opts: object): any[]; + + namespace I { + type StdIOOption = "pipe" | "ipc" | "ignore" | nodestd.stream.Stream | number | null | undefined; + + interface ExecCommonOptions { + /** + * Current working directory of the child process. + * @default `process.cwd()` + */ + cwd?: string; + + /** + * Environment key-value pairs. + * Extends automatically from `process.env`. + * Set `extendEnv` to `false` if you don"t want this. + * @default `process.env` + */ + env?: NodeJS.ProcessEnv; + + /** + * Set to `false` if you don't want to extend the environment variables when providing the `env` property. + * @default `true` + */ + extendEnv?: boolean; + + /** + * Explicitly set the value of `argv[0]` sent to the child process. + * This will be set to `command` or `file` if not specified. + */ + argv0?: string; + + /** + * The `stdio` option is used to configure the pipes that are established between the parent and child process. + * By default, the child's stdin, stdout, and stderr are redirected to corresponding `subprocess.stdin`, `subprocess.stdout`, and `subprocess.stderr` streams on the `ChildProcess` object. + * @default `'pipe'` + * + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stdio?: "pipe" | "ignore" | "inherit" | StdIOOption[]; + + /** + * Prepare child to run independently of its parent process. + * Specific behavior depends on the platform. + * @see https://nodejs.org/api/child_process.html#child_process_options_detached + */ + detached?: boolean; + + /** + * Sets the user identity of the process. + */ + uid?: number; + + /** + * Sets the group identity of the process. + */ + gid?: number; + + /** + * If `true`, runs `command` inside of a shell. + * Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. + * A different shell can be specified as a string. + * The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows. + * @default `false` + */ + shell?: boolean | string; + + /** + * If `true`, no quoting or escaping of arguments is done on Windows. + * Ignored on other platforms. + * This is set to `true` automatically when `shell` is specified. + * @default `false` + */ + windowsVerbatimArguments?: boolean; + + /** + * Strip EOF (last newline) from the output. + * @default `true` + * @see https://github.com/sindresorhus/strip-eof + */ + stripEof?: boolean; + + /** + * Prefer locally installed binaries when looking for a binary to execute. + * If you `$ npm install foo`, you can then `execa('foo')`. + * @default `true` + */ + preferLocal?: boolean; + + /** + * Preferred path to find locally installed binaries in (use with `preferLocal`). + * @default `process.cwd()` + */ + localDir?: string; + + /** + * Setting this to `false` resolves the promise with the error instead of rejecting it. + * @default `true` + */ + reject?: boolean; + + /** + * Keep track of the spawned process and `kill` it when the parent process exits. + * @default `true` + */ + cleanup?: boolean; + + /** + * Specify the character encoding used to decode the `stdout` and `stderr` output. + * @default `utf8` + */ + encoding?: string; + + /** + * If `timeout` is greater than `0`, the parent will send the signal identified by the `killSignal` property + * (the default is `SIGTERM`) if the child runs longer than `timeout` milliseconds. + * + * @default `0` + */ + timeout?: number; + + /** + * Largest amount of data in bytes allowed on `stdout` or `stderr`. + * @default `10000000` (10MB) + */ + maxBuffer?: number; + + /** + * Signal value to be used when the spawned process will be killed. + * @default `SIGTERM` + */ + killSignal?: string | number; + + /** + * Used to configure the stdin pipe that is established between the parent and child process. + * @default `'pipe'` + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stdin?: StdIOOption; + + /** + * Used to configure the stdout pipe that is established between the parent and child process. + * @default `'pipe'` + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stdout?: StdIOOption; + + /** + * Used to configure the stderr pipe that is established between the parent and child process. + * @default `'pipe'` + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stderr?: StdIOOption; + } + + interface ExecOptions extends ExecCommonOptions { + /** + * Write some input to the `stdin` of your binary. + */ + input?: string | Buffer | nodestd.stream.Stream; + } + + interface ExecSyncOptions extends ExecCommonOptions { + /** + * Write some input to the `stdin` of your binary. + * Streams are not allowed when using the synchronous methods. + */ + input?: string | Buffer; + } + + interface ExecReturns { + /** + * The command that was run. + */ + cmd: string; + + /** + * The exit code of the process that was run. + */ + code: number; + + /** + * Whether the process failed to run. + */ + failed: boolean; + + /** + * Whether the process was killed. + */ + killed: boolean; + + /** + * The signal that was used to terminate the process. + */ + signal: string | null; + + /** + * The output of the process on stderr. + */ + stderr: string; + + /** + * The output of the process on stdout. + */ + stdout: string; + + /** + * Whether the process timed out. + */ + timedOut: boolean; + } + + type ExecError = Error & ExecReturns; + + interface ExecChildPromise { + catch(onrejected?: ((reason: ExecError) => TResult | PromiseLike) | null): Promise; + } + + type ExecChildProcess = nodestd.child_process.ChildProcess & ExecChildPromise & Promise; + } + + function exec(cmd: string, args?: string[], opts?: I.ExecOptions): I.ExecChildProcess; + function exec(cmd: string, opts?: I.ExecOptions): I.ExecChildProcess; + + function execStdout(cmd: string, args?: string[], opts?: I.ExecOptions): Promise; + function execStdout(cmd: string, opts?: I.ExecOptions): Promise; + + function execStderr(cmd: string, args?: string[], opts?: I.ExecOptions): Promise; + function execStderr(cmd: string, opts?: I.ExecOptions): Promise; + + function shell(cmd: string, opts?: I.ExecOptions): I.ExecChildProcess; + + function execSync(cmd: string, args?: string[], opts?: I.ExecSyncOptions): I.ExecReturns; + + function shellSync(cmd: string, opts?: I.ExecSyncOptions): I.ExecReturns; +} diff --git a/types/adone/glosses/system/user.d.ts b/types/adone/glosses/system/user.d.ts new file mode 100644 index 0000000000..508f67e894 --- /dev/null +++ b/types/adone/glosses/system/user.d.ts @@ -0,0 +1,31 @@ +declare namespace adone.system { + /** + * Utils for uid/gid + */ + namespace user { + /** + * Returns uid by the given username + */ + function uid(username: string): { uid: number, gid: number }; + + /** + * Returns gid by the given groupname + */ + function gid(groupname: string): number; + + /** + * Returns gids the given user belongs + */ + function gids(username: string): number[]; + + /** + * Returns username by the given uid + */ + function username(uid: number): string; + + /** + * Returns groupname by the given gid + */ + function groupname(gid: number): string; + } +} diff --git a/types/adone/glosses/templating/dot.d.ts b/types/adone/glosses/templating/dot.d.ts new file mode 100644 index 0000000000..500efe8d35 --- /dev/null +++ b/types/adone/glosses/templating/dot.d.ts @@ -0,0 +1,41 @@ +declare namespace adone.templating { + namespace dot { + namespace I { + type RenderFunction = (...args: any[]) => string; + + interface TemplateSettings { + evaluate: RegExp; + interpolate: RegExp; + encode: RegExp; + use: RegExp; + useParams: RegExp; + define: RegExp; + defineParams: RegExp; + conditional: RegExp; + iterate: RegExp; + varname: string; + strip: boolean; + append: boolean; + selfcontained: boolean; + } + } + const version: string; + + let templateSettings: I.TemplateSettings; + + function template(tmpl: string, c?: I.TemplateSettings, def?: {}): I.RenderFunction; + + function compile(tmpl: string, def?: object): I.RenderFunction; + + namespace I { + interface ProcessOptions { + path?: string; + destination?: string; + global?: string; + templateSettings?: Partial; + } + } + + function process(options?: I.ProcessOptions): { [path: string]: I.RenderFunction }; + } +} diff --git a/types/adone/glosses/templating/index.d.ts b/types/adone/glosses/templating/index.d.ts new file mode 100644 index 0000000000..81f9964335 --- /dev/null +++ b/types/adone/glosses/templating/index.d.ts @@ -0,0 +1,8 @@ +/// +/// + +declare namespace adone { + namespace templating { + // + } +} diff --git a/types/adone/glosses/templating/nunjucks.d.ts b/types/adone/glosses/templating/nunjucks.d.ts new file mode 100644 index 0000000000..d0aed211cc --- /dev/null +++ b/types/adone/glosses/templating/nunjucks.d.ts @@ -0,0 +1,121 @@ +declare namespace adone.templating { + namespace nunjucks { + namespace I { + interface EnvironmentOptions { + dev?: boolean; + autoescape?: boolean; + throOnUndefined?: boolean; + trimBlocks?: boolean; + lstripBlocks?: boolean; + } + + interface FileSystemLoaderOptions { + watch?: boolean; + noCache?: boolean; + } + + type ConfigureOptions = EnvironmentOptions & FileSystemLoaderOptions & { + tags?: { + blockStart?: string, + blockEnd?: string, + variableStart?: string, + variableEnd?: string, + commentStart?: string, + commentEnd?: string + }; + }; + + interface PrecompileOptions { + name?: string; + asFunction?: boolean; + force?: boolean; + env?: Environment; + include?: string[]; + exclude?: string[]; + wrapper?(templates: { name: string, template: string }, opts: PrecompileOptions): string; + } + + interface Extension { + tags: string[]; + parse(parser: any, nodes: any, lexer: any): any; + } + + interface LoaderSource { + src: string; + path: string; + noCache: boolean; + } + + interface Loader { + async?: boolean; + getSource(name: string): LoaderSource; + extend?(extender: Loader): Loader; + } + } + + class Environment { + options: { + autoescape: boolean; + }; + + constructor(loader?: I.Loader | I.Loader[] | null, opts?: I.EnvironmentOptions); + render(name: string, context?: object): string; + render(name: string, context?: object, callback?: (err: any, res: string) => any): void; + + renderString(name: string, context?: object): string; + renderString(name: string, context?: object, callback?: (err: any, res: string) => any): void; + + addFilter(name: string, func: (...args: any[]) => any, async?: boolean): void; + getFilter(name: string): (...args: any[]) => any; + + addExtension(name: string, ext: I.Extension): void; + removeExtension(name: string): void; + getExtension(name: string): I.Extension; + hasExtension(name: string): boolean; + + addGlobal(name: string, value: any): this; + + getTemplate(name: string, eagerCompile?: boolean): Template; + getTemplate(name: string, eagerCompile?: boolean, callback?: (err: any, templ: Template) => Template): void; + + express(app: object): void; + } + + class Template { + constructor(src: string, env?: Environment, eagerCompile?: boolean); + render(context?: object): string; + render(context?: object, callback?: (err: any, res: string) => any): void; + } + + class Loader { + on(name: string, func: (...args: any[]) => any): void; + emit(name: string, ...args: any[]): void; + resolve(from: string, to: string): string; + isRelative(filename: string): boolean; + extend(toExtend: I.Loader): I.Loader; + } + + class FileSystemLoader extends Loader implements I.Loader { + constructor(searchPaths?: string | string[], opts?: I.FileSystemLoaderOptions); + + getSource(name: string): I.LoaderSource; + } + + class PrecompiledLoader extends Loader implements I.Loader { + getSource(name: string): I.LoaderSource; + } + + function renderSync(name: string, context?: object): string; + function render(name: string, context?: object): Promise; + + function renderString(src: string, context?: object): Promise; + function renderStringSync(src: string, context?: object): string; + + function compile(src: string, env?: Environment, path?: string, eagerCompile?: boolean): Template; + + function configure(options?: I.ConfigureOptions): Environment; + function configure(path: string | string[], options?: I.ConfigureOptions): Environment; + + function installJinjaCompat(): void; + } +} diff --git a/types/adone/glosses/text/index.d.ts b/types/adone/glosses/text/index.d.ts new file mode 100644 index 0000000000..57b0fb1867 --- /dev/null +++ b/types/adone/glosses/text/index.d.ts @@ -0,0 +1,76 @@ +/// +/// +/// + +declare namespace adone { + namespace text { + namespace escape { + function regExpPattern(str: string): string; + + function regExpReplacement(str: string): string; + + function format(str: string): string; + + function shellArg(str: string): string; + + function control(str: string): string; + + function htmlSpecialChars(str: string): string; + } + + namespace regexp { + function array2alternatives(array: string[]): string; + } + + function escapeStringRegexp(str: string): string; + + function toCamelCase(str: string): string; + + function camelCaseToDashed(str: string): string; + + const endLineRegExp: RegExp; + + function splitLines(str: string): string[]; + + function regExpIndexOf(str: string, regex: RegExp, index?: number): string; + + function stripAnsi(str: string): string; + + function hasAnsi(str: string): boolean; + + function random(len: number): string; + + function detectNewLine(str: string): "\r\n" | "\n"; + + namespace I { + interface WordWrapOptions { + join?: boolean; + mode?: "soft" | "hard"; + countAnsiEscapeCodes?: boolean; + } + } + + function wordwrap(str: string, stop: number, options: I.WordWrapOptions & { join: false}): string[]; + function wordwrap(str: string, stop: number, options?: I.WordWrapOptions): string; + + function stringDistance(strA: string, strB: string, memo?: number[][]): number; + + function stringDistanceCapped(strA: string, strB: string, cap: number): number; + + function capitalize(str: string): string; + + function capitalizeWords(str: string): string; + + function width(str: string): number; + + function indent(string: string, spaces: number): string; + + function stripEof(str: string): string; + + function stripLastCRLF(str: string): string; + + function stripBOM(str: string): string; + + function toUTF8Array(str: string): number[]; + } +} diff --git a/types/adone/glosses/text/spinners.d.ts b/types/adone/glosses/text/spinners.d.ts new file mode 100644 index 0000000000..962a6aebab --- /dev/null +++ b/types/adone/glosses/text/spinners.d.ts @@ -0,0 +1,468 @@ +declare namespace adone.text { + namespace spinner { + const dots: { + interval: 80, + frames: [ + "⠋", + "⠙", + "⠹", + "⠸", + "⠼", + "⠴", + "⠦", + "⠧", + "⠇", + "⠏" + ] + }; + const dots2: { + interval: 80, + frames: [ + "⣾", + "⣽", + "⣻", + "⢿", + "⡿", + "⣟", + "⣯", + "⣷" + ] + }; + const dots3: { + interval: 80, + frames: [ + "⠋", + "⠙", + "⠚", + "⠞", + "⠖", + "⠦", + "⠴", + "⠲", + "⠳", + "⠓" + ] + }; + const dots4: { + interval: 80, + frames: [ + "⠄", + "⠆", + "⠇", + "⠋", + "⠙", + "⠸", + "⠰", + "⠠", + "⠰", + "⠸", + "⠙", + "⠋", + "⠇", + "⠆" + ] + }; + const dots5: { + interval: 80, + frames: [ + "⠋", + "⠙", + "⠚", + "⠒", + "⠂", + "⠂", + "⠒", + "⠲", + "⠴", + "⠦", + "⠖", + "⠒", + "⠐", + "⠐", + "⠒", + "⠓", + "⠋" + ] + }; + const dots6: { + interval: 80, + frames: [ + "⠁", + "⠉", + "⠙", + "⠚", + "⠒", + "⠂", + "⠂", + "⠒", + "⠲", + "⠴", + "⠤", + "⠄", + "⠄", + "⠤", + "⠴", + "⠲", + "⠒", + "⠂", + "⠂", + "⠒", + "⠚", + "⠙", + "⠉", + "⠁" + ] + }; + const dots7: { + interval: 80, + frames: [ + "⠈", + "⠉", + "⠋", + "⠓", + "⠒", + "⠐", + "⠐", + "⠒", + "⠖", + "⠦", + "⠤", + "⠠", + "⠠", + "⠤", + "⠦", + "⠖", + "⠒", + "⠐", + "⠐", + "⠒", + "⠓", + "⠋", + "⠉", + "⠈" + ] + }; + const dots8: { + interval: 80, + frames: [ + "⠁", + "⠁", + "⠉", + "⠙", + "⠚", + "⠒", + "⠂", + "⠂", + "⠒", + "⠲", + "⠴", + "⠤", + "⠄", + "⠄", + "⠤", + "⠠", + "⠠", + "⠤", + "⠦", + "⠖", + "⠒", + "⠐", + "⠐", + "⠒", + "⠓", + "⠋", + "⠉", + "⠈", + "⠈" + ] + }; + const dots9: { + interval: 80, + frames: [ + "⢹", + "⢺", + "⢼", + "⣸", + "⣇", + "⡧", + "⡗", + "⡏" + ] + }; + const dots10: { + interval: 80, + frames: [ + "⢄", + "⢂", + "⢁", + "⡁", + "⡈", + "⡐", + "⡠" + ] + }; + const dots11: { + interval: 100, + frames: [ + "⠁", + "⠂", + "⠄", + "⡀", + "⢀", + "⠠", + "⠐", + "⠈" + ] + }; + const dots12: { + interval: 80, + frames: [ + "⢀⠀", + "⡀⠀", + "⠄⠀", + "⢂⠀", + "⡂⠀", + "⠅⠀", + "⢃⠀", + "⡃⠀", + "⠍⠀", + "⢋⠀", + "⡋⠀", + "⠍⠁", + "⢋⠁", + "⡋⠁", + "⠍⠉", + "⠋⠉", + "⠋⠉", + "⠉⠙", + "⠉⠙", + "⠉⠩", + "⠈⢙", + "⠈⡙", + "⢈⠩", + "⡀⢙", + "⠄⡙", + "⢂⠩", + "⡂⢘", + "⠅⡘", + "⢃⠨", + "⡃⢐", + "⠍⡐", + "⢋⠠", + "⡋⢀", + "⠍⡁", + "⢋⠁", + "⡋⠁", + "⠍⠉", + "⠋⠉", + "⠋⠉", + "⠉⠙", + "⠉⠙", + "⠉⠩", + "⠈⢙", + "⠈⡙", + "⠈⠩", + "⠀⢙", + "⠀⡙", + "⠀⠩", + "⠀⢘", + "⠀⡘", + "⠀⠨", + "⠀⢐", + "⠀⡐", + "⠀⠠", + "⠀⢀", + "⠀⡀" + ] + }; + const line: { + interval: 130, + frames: [ + "-", + "\\", + "|", + "/" + ] + }; + const pipe: { + interval: 100, + frames: [ + "┤", + "┘", + "┴", + "└", + "├", + "┌", + "┬", + "┐" + ] + }; + const simpleDots: { + interval: 200, + frames: [ + ". ", + ".. ", + "...", + " ..", + " .", + " " + ] + }; + const flip: { + interval: 70, + frames: [ + "_", + "_", + "_", + "-", + "`", + "`", + "'", + "´", + "-", + "_", + "_", + "_" + ] + }; + const growVertical: { + interval: 120, + frames: [ + "▁", + "▃", + "▄", + "▅", + "▆", + "▇", + "▆", + "▅", + "▄", + "▃" + ] + }; + const growHorizontal: { + interval: 120, + frames: [ + "▏", + "▎", + "▍", + "▌", + "▋", + "▊", + "▉", + "▊", + "▋", + "▌", + "▍", + "▎" + ] + }; + const boxBounce: { + interval: 120, + frames: [ + "▖", + "▘", + "▝", + "▗" + ] + }; + const boxBounce2: { + interval: 100, + frames: [ + "▌", + "▀", + "▐", + "▄" + ] + }; + const triangle: { + interval: 50, + frames: [ + "◢", + "◣", + "◤", + "◥" + ] + }; + const squareCorners: { + interval: 180, + frames: [ + "◰", + "◳", + "◲", + "◱" + ] + }; + const circleQuarters: { + interval: 120, + frames: [ + "◴", + "◷", + "◶", + "◵" + ] + }; + const circleHalves: { + interval: 80, + frames: [ + "◐", + "◓", + "◑", + "◒" + ] + }; + const arrow: { + interval: 80, + frames: [ + "⬆️ ", + "↗️ ", + "➡️ ", + "↘️ ", + "⬇️ ", + "↙️ ", + "⬅️ ", + "↖️ " + ] + }; + const arrow3: { + interval: 120, + frames: [ + "▹▹▹▹▹", + "▸▹▹▹▹", + "▹▸▹▹▹", + "▹▹▸▹▹", + "▹▹▹▸▹", + "▹▹▹▹▸" + ] + }; + const bouncingBar: { + interval: 80, + frames: [ + "[ ]", + "[ =]", + "[ ==]", + "[ ===]", + "[====]", + "[=== ]", + "[== ]", + "[= ]" + ] + }; + const clock: { + interval: 100, + frames: [ + "🕐 ", + "🕑 ", + "🕒 ", + "🕓 ", + "🕔 ", + "🕕 ", + "🕖 ", + "🕗 ", + "🕘 ", + "🕙 ", + "🕚 " + ] + }; + } +} diff --git a/types/adone/glosses/text/table.d.ts b/types/adone/glosses/text/table.d.ts new file mode 100644 index 0000000000..2bfaaa07fd --- /dev/null +++ b/types/adone/glosses/text/table.d.ts @@ -0,0 +1,73 @@ +declare namespace adone.text { + namespace table { + namespace I { + interface CharsOptions { + top: string; + "top-mid": string; + "top-left": string; + "top-right": string; + bottom: string; + "bottom-mid": string; + "bottom-left": string; + "bottom-right": string; + left: string; + "left-mid": string; + mid: string; + "mid-mid": string; + right: string; + "right-mid": string; + middle: string; + } + + interface StyleOptions { + "padding-left": number; + "padding-right": number; + head: string[]; + border: string[]; + compact: boolean; + } + + interface CommonOptions { + truncate: string; + colWidths: number[]; + rowHeights: number[]; + colAligns: Array<"left" | "center" | "right">; + rowAligns: Array<"top" | "center" | "bottom">; + head: string[]; + } + + interface Options extends CommonOptions { + style: StyleOptions; + chars: CharsOptions; + } + + interface ConstructorOptions extends Partial { + style?: Partial; + chars?: Partial; + } + } + + class Table extends Array { + constructor(options?: I.ConstructorOptions); + + toString(): string; + + readonly width: number; + + static readonly defaultOptions: I.Options; + } + + namespace I { + interface BorderlessConstructorOptions { + colWidths?: number[]; + head?: string[]; + colAligns?: Array<"left" | "center" | "right">; + style?: Partial; + } + } + + class BorderlessTable extends Table { + constructor(options?: I.BorderlessConstructorOptions); + } + } +} diff --git a/types/adone/glosses/text/unicode.d.ts b/types/adone/glosses/text/unicode.d.ts new file mode 100644 index 0000000000..98b449b9a3 --- /dev/null +++ b/types/adone/glosses/text/unicode.d.ts @@ -0,0 +1,137 @@ +declare namespace adone.text { + namespace unicode { + const symbol: { + tick: "✔", + cross: "✖", + star: "★", + square: "▇", + squareSmall: "◻", + squareSmallFilled: "◼", + play: "▶", + circle: "◯", + circleFilled: "◉", + circleDotted: "◌", + circleDouble: "◎", + circleCircle: "ⓞ", + circleCross: "ⓧ", + circlePipe: "Ⓘ", + circleQuestionMark: "?⃝", + bullet: "●", + dot: "․", + line: "─", + ellipsis: "…", + pointer: "❯", + pointerSmall: "›", + info: "ℹ", + warning: "⚠", + hamburger: "☰", + smiley: "㋡", + mustache: "෴", + heart: "♥", + arrowUp: "↑", + arrowDown: "↓", + arrowLeft: "←", + arrowRight: "→", + radioOn: "◉", + radioOff: "◯", + checkboxOn: "☒", + checkboxOff: "☐", + checkboxCircleOn: "ⓧ", + checkboxCircleOff: "Ⓘ", + questionMarkPrefix: "?" | "?⃝", + oneHalf: "½", + oneThird: "⅓", + oneQuarter: "¼", + oneFifth: "⅕", + oneSixth: "⅙", + oneSeventh: "⅐", + oneEighth: "⅛", + oneNinth: "⅑", + oneTenth: "⅒", + twoThirds: "⅔", + twoFifths: "⅖", + threeQuarters: "¾", + threeFifths: "⅗", + threeEighths: "⅜", + fourFifths: "⅘", + fiveSixths: "⅚", + fiveEighths: "⅝", + sevenEighths: "⅞", + minus: "−" + }; + + const symbolFallback: { + tick: "√", + cross: "×", + star: "*", + square: "█", + squareSmall: "[ ]", + squareSmallFilled: "[█]", + play: "►", + circle: "( )", + circleFilled: "(*)", + circleDotted: "( )", + circleDouble: "( )", + circleCircle: "(○)", + circleCross: "(×)", + circlePipe: "(│)", + circleQuestionMark: "(?)", + bullet: "*", + dot: ".", + line: "─", + ellipsis: "...", + pointer: ">", + pointerSmall: "»", + info: "i", + warning: "‼", + hamburger: "≡", + smiley: "☺", + mustache: "┌─┐", + heart: "♥", + arrowUp: "↑", + arrowDown: "↓", + arrowLeft: "←", + arrowRight: "→", + radioOn: "(*)", + radioOff: "( )", + checkboxOn: "[×]", + checkboxOff: "[ ]", + checkboxCircleOn: "(×)", + checkboxCircleOff: "( )", + questionMarkPrefix: "?", + oneHalf: "1/2", + oneThird: "1/3", + oneQuarter: "1/4", + oneFifth: "1/5", + oneSixth: "1/6", + oneSeventh: "1/7", + oneEighth: "1/8", + oneNinth: "1/9", + oneTenth: "1/10", + twoThirds: "2/3", + twoFifths: "2/5", + threeQuarters: "3/4", + threeFifths: "3/5", + threeEighths: "3/8", + fourFifths: "4/5", + fiveSixths: "5/6", + fiveEighths: "5/8", + sevenEighths: "7/8", + minus: "-" + }; + + function approx(str: string): string; + + function length(str: string): number; + + function toArray(str: string): string[]; + + function surrogatePair(char: string): number; + + function isFullWidthCodePoint(code: number): boolean; + + function isFullWidth(char: string): boolean; + + function toFullWidth(str: string): string; + } +} diff --git a/types/adone/glosses/utils.d.ts b/types/adone/glosses/utils.d.ts index 6a05273ffd..5d2eb5f198 100644 --- a/types/adone/glosses/utils.d.ts +++ b/types/adone/glosses/utils.d.ts @@ -16,10 +16,6 @@ declare namespace adone { function functionName(fn: (...args: any[]) => any): string; - function mapArguments(argmap: (...args: any[]) => any): (...args: any[]) => any; - function mapArguments(argmap: number): (...args: T[]) => T[]; - function mapArguments(...args: any[]): (x: T) => T; - namespace I { interface ParseMsResult { days: number; @@ -33,8 +29,6 @@ declare namespace adone { function pluralizeWord(str: string, plural?: string, count?: number): string; - function functionParams(func: (...args: any[]) => any): string[]; - function randomChoice(arrayLike: ArrayLike, from?: number, to?: number): T; function shuffleArray(array: T[]): T[]; @@ -70,19 +64,8 @@ declare namespace adone { function globParent(str: string): string; - namespace I { - interface ByResult { - (a: S, b: S): R; - compare(a: T, b: T): R; - by(a: S): T; - } - } - function by(by: (a: S) => T, compare?: (a: T, b: T) => R): I.ByResult; - function toFastProperties(object: object): object; - function stripBom(x: string): string; - namespace I { interface SortKeysOptions { deep?: boolean; @@ -103,27 +86,46 @@ declare namespace adone { function invertObject(source: object, options?: I.KeysOptions): object; - namespace I { - interface HumanizeTimeOptions { - msDecimalDigits?: number; - secDecimalDigits?: number; - verbose?: boolean; - compact?: boolean; - } - } - function humanizeTime(ms: number, options?: I.HumanizeTimeOptions): string; - function humanizeSize(num: number, space?: string): string; - function parseSize(str: string | number): number | null; namespace I { interface CloneOptions { + /** + * Clone recursively + * + * `true` by default + */ deep?: boolean; + + /** + * Clone non-plain object, they will be plain objects + * + * `false` by default + */ + nonPlainObjects?: boolean; + + /** + * Clone only enumerable properties + * + * `true` by default + */ + onlyEnumerable?: boolean; } } - function clone(object: object, options?: I.CloneOptions): object; - function toUTF8Array(str: string): number[]; + class Cloner { + /** + * Clones the given object + */ + clone(obj: any, options?: I.CloneOptions): any; + + /** + * Returns a clone function that is binded to this cloner + */ + binding(): (obj: any, options?: I.CloneOptions) => any; + } + + function clone(object: any, options?: I.CloneOptions): any; function asyncIter(array: T[], iter: (elem: T, index: number, cb: () => void) => any, cb: () => void): void; @@ -150,20 +152,31 @@ declare namespace adone { function assignDeep(target: T, ...sources: object[]): T; namespace I { - interface MatchOptions { + interface MatchPathOptions { index?: boolean; start?: number; end?: number; dot?: boolean; } } - function match(criteria: any, options?: I.MatchOptions): (value: any, options?: I.MatchOptions) => number | boolean; - function match(criteria: any, value: any, options?: I.MatchOptions): number | boolean; + function matchPath(criteria: any, options?: I.MatchPathOptions): (value: any, options?: I.MatchPathOptions) => number | boolean; + function matchPath(criteria: any, value: any, options?: I.MatchPathOptions): number | boolean; namespace I { + class Sorter { + edges: string[]; + + add(item: string, deps: string | string[]): void; + + sort(): string[]; + + clear(): void; + } + interface ToposortFunction { - (edges: Array<[T, T]>): T[]; - array(nodes: T[], edges: Array<[T, T]>): T[]; + (edges: Array<[string, string]>): string[]; + array(nodes: string[], edges: Array<[string, string]>): string[]; + Sorter: typeof Sorter; } } const toposort: I.ToposortFunction; @@ -188,16 +201,6 @@ declare namespace adone { } function jsesc(argument: any, options?: I.JSEscOptions): string; - namespace I { - type PossibleTypes = "object" | "class" | "null" | "global" | "Array" | "RegExp" | "Date" - | "Promise" | "Set" | "Map" | "WeakSet" | "DataView" | "Map Iterator" | "Set Iterator" - | "Array Iterator" | "String Iterator" | "Object" | "function" | "boolean" | "number" - | "undefined" | "string" | "symbol"; - } - - function typeOf(obj: any): I.PossibleTypes; - function typeOf(obj: any): string; - namespace memcpy { function utou(target: Buffer, targetOffset: number, source: Buffer, sourceStart: number, sourceEnd: number): number; function atoa(target: ArrayBuffer, targetOffset: number, source: ArrayBuffer, sourceStart: number, sourceEnd: number): number; @@ -217,12 +220,12 @@ declare namespace adone { function v1(options?: I.V1Options): string; function v1(options: I.V1Options, buf: any[], offset?: number): number[]; - function v4(options?: any): string; - function v4(options: any, buf: any[], offset?: number): number[]; - function v3(name: string | number[], namespace: string | number[]): string; function v3(name: string | number[], namespace: string | number[], buf: any[], offset?: number): number[]; + function v4(options?: any): string; + function v4(options: any, buf: any[], offset?: number): number[]; + function v5(name: string | number[], namespace: string | number[]): string; function v5(name: string | number[], namespace: string | number[], buf: any[], offset?: number): number[]; } @@ -237,50 +240,231 @@ declare namespace adone { } function delegate(object: object, property: string): I.Delegator; - namespace I { - interface GlobExpOptions { - nocomment?: boolean; - nonegate?: boolean; - nobrace?: boolean; - noglobstar?: boolean; - nocase?: boolean; - dot?: boolean; - noext?: boolean; - matchBase?: boolean; - flipNegate?: boolean; - } - } - - class GlobExp { - constructor(pattern: string, options?: I.GlobExpOptions); - - hasMagic(): boolean; - - static hasMagic(pattern: string, options?: I.GlobExpOptions): boolean; - - expandBraces(): string[]; - - static expandBraces(pattern: string, options?: I.GlobExpOptions): string[]; - - makeRe(): RegExp; - - static makeRe(pattern: string, options?: I.GlobExpOptions): RegExp; - - static test(p: string, pattern: string, options?: I.GlobExpOptions): boolean; - - test(p: string): boolean; - } - namespace iconv { - // TODO: need to normalize source code + namespace I { + namespace encoding { + type Native = "UTF-8" + | "UCS-2" + | "UTF-16LE" + | "ASCII" + | "Binary" + | "Base64" + | "Hex"; + + type Unicode = "UTF-16BE" | "UTF-16"; + + type Windows = "874" + | "1250" + | "1251" + | "1252" + | "1253" + | "1254" + | "1255" + | "1256" + | "1257" + | "1258" + | "CP874" + | "CP1251" + | "CP1252" + | "CP1253" + | "CP1254" + | "CP1255" + | "CP1256" + | "CP1257" + | "CP1258" + | "Win-1251" + | "Win-1252" + | "Win-1253" + | "Win-1254" + | "Win-1255" + | "Win-1256" + | "Win-1257" + | "Win-1258" + | "Windows-1251" + | "Windows-1252" + | "Windows-1253" + | "Windows-1254" + | "Windows-1255" + | "Windows-1256" + | "Windows-1257" + | "Windows-1258"; + + type ISO = "ISO-8829-1" + | "ISO-8859-2" + | "ISO-8859-3" + | "ISO-8859-4" + | "ISO-8859-5" + | "ISO-8859-6" + | "ISO-8859-7" + | "ISO-8859-8" + | "ISO-8859-9" + | "ISO-8859-10" + | "ISO-8859-11" + | "ISO-8859-12" + | "ISO-8859-13" + | "ISO-8859-14" + | "ISO-8859-15" + | "ISO-8859-16"; + + type IBM = "437" + | "737" + | "775" + | "808" + | "850" + | "852" + | "855" + | "856" + | "857" + | "858" + | "860" + | "861" + | "862" + | "863" + | "864" + | "865" + | "866" + | "869" + | "922" + | "1046" + | "1124" + | "1125" + | "1129" + | "1133" + | "1161" + | "1163" + | "CP437" + | "CP737" + | "CP775" + | "CP808" + | "CP850" + | "CP852" + | "CP855" + | "CP856" + | "CP857" + | "CP858" + | "CP860" + | "CP861" + | "CP862" + | "CP863" + | "CP864" + | "CP865" + | "CP866" + | "CP869" + | "CP922" + | "CP1046" + | "CP1124" + | "CP1125" + | "CP1129" + | "CP1133" + | "CP1161" + | "CP1163" + | "IBM437" + | "IBM737" + | "IBM775" + | "IBM808" + | "IBM850" + | "IBM852" + | "IBM855" + | "IBM856" + | "IBM857" + | "IBM858" + | "IBM860" + | "IBM861" + | "IBM862" + | "IBM863" + | "IBM864" + | "IBM865" + | "IBM866" + | "IBM869" + | "IBM922" + | "IBM1046" + | "IBM1124" + | "IBM1125" + | "IBM1129" + | "IBM1133" + | "IBM1161" + | "IBM1163"; + + type Mac = "MacCroatian" + | "MacCyrillic" + | "MacGreek" + | "MacIceland" + | "MacRoman" + | "MacThai" + | "MacTurkish" + | "MacUkraine" + | "MacCentEuro" + | "Macintosh"; + + type KOI8 = "KOI8-R" + | "KOI8-U" + | "KOI8-RU" + | "KOI8-T"; + + type Misc = "ArmSCII8" + | "RK1048" + | "TCVN" + | "GEORGIAN-ACADEMY" + | "GEORGIAN-PS" + | "PT154" + | "VISCII" + | "ISO-646-CN" + | "ISO-646-JP" + | "HP Roman-8" + | "TIS-620"; + + type Singlebyte = Windows + | ISO + | IBM + | Mac + | KOI8 + | Misc; + + type Japanese = "Shift_JIS" + | "Windows-31J" + | "windows-932" + | "EUC-JP"; + + type Chinese = "GB2312" + | "GBK" + | "GB18030" + | "Windows-936" + | "EUC-CN"; + + type Korean = "KS_C_5601" + | "Windows-949" + | "EUC-KR"; + + type TaiwanHongKong = "Big5" + | "Big5-HKSCS" + | "Windows-950"; + + type Multibyte = Japanese + | Chinese + | Korean + | TaiwanHongKong; + } + + type SupportedEncoding = encoding.Native + | encoding.Unicode + | encoding.Singlebyte + | encoding.Multibyte; + } + + const defaultCharUnicode: "�"; + + const defaultCharSingleByte: "?"; + + function encodingExists(encoding: string): boolean; + + function encode(buffer: string, encoding: I.SupportedEncoding, options?: object): Buffer; + + function decode(buffer: Buffer, encoding: I.SupportedEncoding, options?: object): string; } namespace sqlstring { function escapeId(val: string | string[], forbidQualified?: boolean): string; function dateToString(date: any, timeZone?: string): string; - function arrayToList(array: any[]): string; - function bufferToString(buffer: Buffer): string; - function objectToValues(object: object, timeZone?: string): string; function escape(value: any, stringifyObjects?: boolean, timeZone?: string): string; function format(sql: string, values?: any, stringifyObjects?: boolean, timeZone?: string): string; } @@ -316,49 +500,95 @@ declare namespace adone { } const binarySearch: I.BinarySearchFunction; + /** + * buffer tools + */ namespace buffer { - function concat(list: Buffer[], totalLength: number): Buffer; - function mask(buffer: Buffer, mask: Buffer, output: Buffer, offset: number, length: number): void; - function unmask(buffer: Buffer, mask: Buffer): void; + /** + * Converts the given Buffer to ArrayBuffer + */ + function toArrayBuffer(buf: Buffer): ArrayBuffer; + + /** + * Returns a new buffer that represents a^b + * + * If the lengths are not equal, it assumes missing bytes as 0x00 + * + * @param length length of the result buffer. max(a.length, b.length) by default + */ + function xor(a: Buffer, b: Buffer, length?: number): Buffer; } function shebang(str: string): string | null; - class ReInterval { - constructor(callback: (...args: any[]) => void, interval: number, args?: any[]); - - reschedule(interval: number): void; - - clear(): void; - - destroy(): void; - } - - class RateLimiter { - constructor(tokensPerInterval?: number, interval?: number, fireImmediately?: boolean); - - removeTokens(count: number): Promise; - - tryRemoveTokens(count: number): boolean; - - getTokensRemaining(): number; - } - namespace I { - interface ThrottleOptions { - max?: number; - interval?: number; - ordered?: boolean; - waitForReturn?: boolean; + interface ReInterval { + reschedule(interval: number): void; + + clear(): void; + + destroy(): void; } } - function throttle(fn: () => R, options?: I.ThrottleOptions): () => Promise; - function throttle(fn: (a: T1) => R, options?: I.ThrottleOptions): (a: T1) => Promise; - function throttle(fn: (a: T1, b: T2) => R, options?: I.ThrottleOptions): (a: T1, b: T2) => Promise; - function throttle(fn: (a: T1, b: T2, c: T3) => R, options?: I.ThrottleOptions): (a: T1, b: T2, c: T3) => Promise; - function throttle(fn: (a: T1, b: T2, c: T3, d: T4) => R, options?: I.ThrottleOptions): (a: T1, b: T2, c: T3, d: T4) => Promise; - function throttle(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => R, options?: I.ThrottleOptions): (a: T1, b: T2, c: T3, d: T4, e: T5) => Promise; - function throttle(fn: (...args: any[]) => R, options?: I.ThrottleOptions): (...args: any[]) => Promise; + + function reinterval(callback: (...args: any[]) => void, interval: number, args?: any[]): I.ReInterval; + + namespace throttle { + namespace I { + interface Options { + concurrency?: number; + interval?: number; + ordered?: boolean; + waitForReturn?: boolean; + onDone?: () => void; + drop?: boolean; + dropLast?: boolean; + } + + interface CreateFunction { + (fn: () => Promise): Promise; + (fn: () => R): Promise; + + (fn: (a: T1) => Promise, a: T1): Promise; + (fn: (a: T1) => R, a: T1): Promise; + + (fn: (a: T1, b: T2) => Promise, a: T1, b: T2): Promise; + (fn: (a: T1, b: T2) => R, a: T1, b: T2): Promise; + + (fn: (a: T1, b: T2, c: T3) => Promise, a: T1, b: T2, c: T3): Promise; + (fn: (a: T1, b: T2, c: T3) => R, a: T1, b: T2, c: T3): Promise; + + (fn: (a: T1, b: T2, c: T3, d: T4) => Promise, a: T1, b: T2, c: T3, d: T4): Promise; + (fn: (a: T1, b: T2, c: T3, d: T4) => R, a: T1, b: T2, c: T3, d: T4): Promise; + + (fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => Promise, a: T1, b: T2, c: T3, d: T4, e: T5): Promise; + (fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => R, a: T1, b: T2, c: T3, d: T4, e: T5): Promise; + + (fn: (...args: any[]) => Promise, ...args: any[]): Promise; + (fn: (...args: any[]) => R, ...args: any[]): Promise; + } + } + function create(options?: I.Options): I.CreateFunction; + function create(fn: () => R, options?: I.Options): () => Promise; + function create(fn: (a: T1) => R, options?: I.Options): (a: T1) => Promise; + function create(fn: (a: T1, b: T2) => R, options?: I.Options): (a: T1, b: T2) => Promise; + function create(fn: (a: T1, b: T2, c: T3) => R, options?: I.Options): (a: T1, b: T2, c: T3) => Promise; + function create(fn: (a: T1, b: T2, c: T3, d: T4) => R, options?: I.Options): (a: T1, b: T2, c: T3, d: T4) => Promise; + function create(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => R, options?: I.Options): (a: T1, b: T2, c: T3, d: T4, e: T5) => Promise; + function create(fn: (...args: any[]) => R, options?: I.Options): (...args: any[]) => Promise; + + class RateLimiter { + constructor(tokensPerInterval?: number, interval?: number, fireImmediately?: boolean); + + removeTokens(count: number): Promise; + + tryRemoveTokens(count: number): boolean; + + getTokensRemaining(): number; + } + + const DROPPED: symbol; + } namespace I.fakeClock { interface Timer { @@ -475,36 +705,6 @@ declare namespace adone { function lowerBoundKey(range: I.Range): T | undefined; } - /** - * Utils for uid/gid - */ - namespace userid { - /** - * Returns uid by the given username - */ - function uid(username: string): { uid: number, gid: number }; - - /** - * Returns gid by the given groupname - */ - function gid(groupname: string): number; - - /** - * Returns username by the given uid - */ - function username(uid: number): string; - - /** - * Returns groupname by the given gid - */ - function groupname(gid: number): string; - - /** - * Returns gids the given user belongs - */ - function gids(username: string): number[]; - } - /** * Represents a log file rotator */ @@ -572,5 +772,598 @@ declare namespace adone { function debounce(fn: (a: T1, b: T2, c: T3, d: T4) => R, timeout: number, options?: I.DebounceOptions): (a: T1, b: T2, c: T3, d: T4) => R; function debounce(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => R, timeout: number, options?: I.DebounceOptions): (a: T1, b: T2, c: T3, d: T4, e: T5) => R; function debounce(fn: (...args: any[]) => R, timeout: number, options?: I.DebounceOptions): (...args: any[]) => R; + + /** + * Finds difference between the given arrays + */ + function arrayDiff(...arrays: T[][]): T[]; + + namespace I { + type FillRangeTransform = () => void; + + interface FillRangeOptions { + /** + * The increment to use for the range. Can be used with letters or numbers + */ + step?: number; + + /** + * By default, null is returned when an invalid range is passed. + * Enable this option to throw a RangeError on invalid ranges + * + * false by default + */ + strictRanges?: boolean; + + /** + * Cast all returned values to strings. + * + * By default, integers are returned as numbers. + */ + stringify?: boolean; + + /** + * Create a regex-compatible source string, instead of expanding values to an array. + * + * false by default + */ + toRegex?: boolean; + + /** + * Customize each value in the returned array (or string) + */ + transform?: FillRangeTransform; + } + } + + /** + * Expands numbers and letters + */ + function fillRange(from: number, to: number, options: I.FillRangeOptions & { toRegex: true }): string; + function fillRange(from: number, to: number, options: I.FillRangeOptions & { stringify: true }): string[]; + function fillRange(from: number, to: number, options?: I.FillRangeOptions): number[]; + + function fillRange(from: string, to: string, options: I.FillRangeOptions & { toRegex: true }): string; + function fillRange(from: string, to: string, options?: I.FillRangeOptions): string[]; + + function fillRange(from: string | number, to: string | number, options: I.FillRangeOptions & { toRegex: true }): string; + function fillRange(from: string | number, to: string | number, options?: I.FillRangeOptions): Array; + + namespace inflection { + function singularizeWord(str: string, singular?: string): string; + function pluralizeWord(str: string, plural?: string): string; + function underscore(str: string, allUpperCase?: boolean): string; + } + + function machineId(original?: boolean): Promise; + + namespace I { + interface MergeOptions { + plainObjects?: boolean; + allowPrototypes?: boolean; + } + } + + function merge(target: any, source: any, options?: I.MergeOptions): any; + + function omit(obj: any, props: ((v: string) => boolean) | string[] | string): object; + + function parseTime(val: number): number; + function parseTime(val: any): number | null; + + function pick(obj: any, props: Iterable): object; + + // pool: TODO + + namespace querystring { + function escape(str: string): string; + + const formats: { + RFC1738: "RFC1738" + RFC3986: "RFC3986", + default: string, + formatters: { + RFC1738(val: string): string, + RFC3986(val: string): string + } + }; + + namespace I { + interface ParseOptions { + ignoreQueryPrefix?: boolean; + delimiter?: string; + depth?: number; + arrayLimit?: number; + parseArrays?: boolean; + decoder?: (str: string, defaultDecoder: (str: string) => string) => string; + allowDots?: boolean; + plainObjects?: boolean; + allowPrototypes?: boolean; + parameterLimit?: number; + strictNullHandling?: boolean; + } + + interface StringifyOptions { + delimiter?: string; + strictNullHandling?: boolean; + skipNulls?: boolean; + encode?: boolean; + encoder?: (str: string) => any; + filter?: Array | ((prefix: string, value: any) => any); + arrayFormat?: "indices" | "brackets" | "repeat"; + indices?: boolean; + sort?: (a: any, b: any) => number; + serializeDate?: (d: Date) => string; + format?: "RFC1738" | "RFC3986"; + encodeValuesOnly?: boolean; + addQueryPrefix?: boolean; + allowDots?: boolean; + } + } + + function parse(str: string, options?: I.ParseOptions): any; + + function stringify(obj: any, options?: I.StringifyOptions): string; + + function unescape(str: string): string; + } + + namespace I { + interface RegexNotOptions { + contains?: boolean; + } + } + + function regexNot(pattern: string, options?: I.RegexNotOptions): RegExp; + + function repeat(item: T, n: number): T[]; + + // retry: TODO + + function signalNameToCode(signame: string): number; + + function splitBuffer(buf: string | Buffer, splitBuf: string | Buffer, includeDelim?: boolean): Buffer[]; + + namespace I { + type SplitStringSplitFunction = (token: { + val: string; + idx: number; + arr: string[]; + str: string; + }) => void; + + interface SplitStringOptions { + braces?: object | boolean; + keepEscaping?: boolean; + keepQuotes?: boolean; + keepDoubleQuotes?: boolean; + keepSingleQuotes?: boolean; + separator?: string; + split?: SplitStringSplitFunction; + } + } + + function splitString(str: string): string[]; + function splitString(str: string, options: I.SplitStringOptions): string[]; + function splitString(str: string, splitter: I.SplitStringSplitFunction): string[]; + function splitString(str: string, options: I.SplitStringOptions, splitter: I.SplitStringSplitFunction): string[]; + + // terraformer: TODO + + namespace I { + interface ToRegexOptions { + contains?: boolean; + negate?: boolean; + nocase?: boolean; + flags?: string; + cache?: boolean; + } + } + + function toRegex(patterns: string | string[], options?: I.ToRegexOptions): RegExp; + + namespace I { + interface ToRegexRangeOptions { + capture?: boolean; + shorthand?: boolean; + relaxZeros?: boolean; + } + } + + function toRegexRange(min: string | number, max: string | number, options?: I.ToRegexRangeOptions): RegExp; + + namespace xorDistance { + function compare(a: Buffer, b: Buffer): boolean; + + function create(a: Buffer, b: Buffer): Buffer; + + function gt(a: Buffer, b: Buffer): boolean; + + function lt(a: Buffer, b: Buffer): boolean; + + function eq(a: Buffer, b: Buffer): boolean; + } + + namespace I { + interface BracesOptions { + /** + * Generate an "expanded" brace pattern (this option is unncessary with the `.expand` method, which does the same thing). + * + * @default undefined + */ + expand?: boolean; + + /** + * Enabled by default. + * + * @default true + */ + optimize?: boolean; + + /** + * Duplicates are removed by default. To keep duplicates, pass `{nodupes: false}` on the options + * + * @default true + */ + nodupes?: boolean; + + /** + * When `braces.expand()` is used, or `options.expand` is true, brace patterns will automatically be [optimized](#optionsoptimize) + * when the difference between the range minimum and range maximum exceeds the `rangeLimit`. + * This is to prevent huge ranges from freezing your application. + * + * You can set this to any number, or change `options.rangeLimit` to `Inifinity` to disable this altogether. + * + * @default 250 + */ + rangeLimit?: number; + + /** + * Customize range expansion. + * + * @default undefined + */ + transform?: (str: string) => string; + + /** + * In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times. + * + * Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists) + * + * The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) + * are defined in the given pattern, and not to try to expand them as lists. + * + * @default undefined + */ + quantifiers?: boolean; + + /** + * Strip backslashes that were used for escaping from the result. + * + * @default undefined + */ + unescape?: boolean; + } + interface BracesFunction { + (pattern: string, options?: BracesOptions): string[]; + expand(pattern: string, options?: BracesOptions): string[]; + MAX_LENGTH: number; + clearCache(): void; + resizeCache(newSize: number): void; + getCache(): object; // TODO + makeRe(pattern: string, options?: BracesOptions): RegExp; + } + } + + const braces: I.BracesFunction; + + namespace I { + interface MatchOptions { + /** + * Allow glob patterns without slashes to match a file path based on its basename. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `matchBase`. + * + * @default false + */ + basename?: boolean; + + /** + * Enabled by default, this option enforces bash-like behavior with stars immediately following a bracket expression. + * Bash bracket expressions are similar to regex character classes, but unlike regex, a star following a bracket expression **does not repeat the bracketed characters**. + * Instead, the star is treated the same as an other star. + * + * @default true + */ + bash?: boolean; + + /** + * Disable regex and function memoization. + * + * @default undefined + */ + cache?: boolean; + + /** + * Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `dot`. + * + * @default false + */ + dot?: boolean; + + /** + * Similar to the `--failglob` behavior in Bash, throws an error when no matches are found. + * + * @default undefined + */ + failglob?: boolean; + + /** + * String or array of glob patterns to match files to ignore. + * + * @default undefined + */ + ignore?: string | string[]; + + /** + * Alias for [options.basename](#options-basename). + */ + matchBase?: boolean; + + /** + * Disable expansion of brace patterns. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `nobrace`. + * + * @default undefined + */ + nobrace?: boolean; + + /** + * Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch). + * + * @default undefined + */ + nocase?: boolean; + + /** + * Remove duplicate elements from the result array. + * + * @default undefined + */ + nodupes?: boolean; + + /** + * Disable extglob support, so that extglobs are regarded as literal characters. + * + * @default undefined + */ + noext?: boolean; + + /** + * Disallow negation (`!`) patterns, and treat leading `!` as a literal character to match. + * + * @default undefined + */ + nonegate?: boolean; + + /** + * Disable matching with globstars (`**`). + * + * @default undefined + */ + noglobstar?: boolean; + + /** + * Alias for [options.nullglob](#options-nullglob). + */ + nonull?: boolean; + + /** + * If `true`, when no matches are found the actual (arrayified) glob pattern is returned instead of an empty array. + * Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `nonull`. + * + * @default undefined + */ + nullglob?: boolean; + + /** + * Pass your own instance of [snapdragon](https://github.com/jonschlinkert/snapdragon), to customize parsers or compilers. + * + * @default undefined + */ + snapdragon?: object; + + /** + * Generate a source map by enabling the `sourcemap` option with the `.parse`, `.compile`, or `.create` methods. + * + * _(Note that sourcemaps are currently not enabled for brace patterns)_ + */ + sourcemap?: boolean; + + /** + * Remove backslashes from returned matches. + * + * @default undefined + */ + unescape?: boolean; + + /** + * Convert path separators on returned files to posix/unix-style forward slashes. + * + * @default true + */ + unixify?: boolean; + } + + interface MatchFunction { + /** + * The main function takes a list of strings and one or more glob patterns to use for matching. + * + * @param list A list of strings to match + * @param patterns One or more glob patterns to use for matching. + * @param options See available options for changing how matches are performed + * @returns Returns an array of matches + */ + (list: string[], patterns: string | string[], options?: MatchOptions): string[]; + + /** + * Similar to the main function, but `pattern` must be a string. + * + * @param list Array of strings to match + * @param pattern Glob pattern to use for matching. + * @param options See available options for changing how matches are performed + * @returns Returns an array of matches + */ + match(list: string[], pattern: string, options?: MatchOptions): string[]; + + /** + * Returns true if the specified `string` matches the given glob `pattern`. + * + * @param string String to match + * @param pattern Glob pattern to use for matching. + * @param options See available options for changing how matches are performed + * @returns Returns true if the string matches the glob pattern. + */ + isMatch(string: string, pattern: string, options?: MatchOptions): boolean; + + /** + * Returns true if some of the strings in the given `list` match any of the given glob `patterns`. + * + * @param list The string or array of strings to test. Returns as soon as the first match is found. + * @param patterns One or more glob patterns to use for matching. + * @param options See available options for changing how matches are performed + * @returns Returns true if any patterns match `str` + */ + some(list: string | string[], patterns: string | string[], options?: MatchOptions): boolean; + + /** + * Returns true if every string in the given `list` matches any of the given glob `patterns`. + * + * @param list The string or array of strings to test. + * @param patterns One or more glob patterns to use for matching. + * @param options See available options for changing how matches are performed + * @returns Returns true if any patterns match `str` + */ + every(list: string | string[], patterns: string | string[], options?: MatchOptions): boolean; + + /** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * @param str The string to test. + * @param patterns One or more glob patterns to use for matching. + * @param options See available options for changing how matches are performed + * @returns Returns true if any patterns match `str` + */ + any(str: string | string[], patterns: string | string[], options?: MatchOptions): boolean; + + /** + * Returns true if **all** of the given `patterns` match the specified string. + * + * @param str The string to test. + * @param patterns One or more glob patterns to use for matching. + * @param options See available options for changing how matches are performed + * @returns Returns true if any patterns match `str` + */ + all(str: string | string[], patterns: string | string[], options?: MatchOptions): boolean; + + /** + * Returns a list of strings that _**do not match any**_ of the given `patterns`. + * + * @param list Array of strings to match. + * @param patterns One or more glob pattern to use for matching. + * @param options See available options for changing how matches are performed + * @returns Returns an array of strings that **do not match** the given patterns. + */ + not(list: string[], patterns: string | string[], options?: MatchOptions): string[]; + + /** + * Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string. + * + * @param str The string to match. + * @param patterns Glob pattern to use for matching. + * @param options See available options for changing how matches are performed + * @returns Returns true if the patter matches any part of `str`. + */ + contains(str: string, patterns: string | string[], options?: MatchOptions): boolean; + + /** + * Filter the keys of the given object with the given `glob` pattern and `options`. Does not attempt to match nested keys. + * If you need this feature, use [glob-object](https://github.com/jonschlinkert/glob-object) instead. + * + * @param object The object with keys to filter. + * @param patterns One or more glob patterns to use for matching. + * @param options See available options for changing how matches are performed + * @returns Returns an object with only keys that match the given patterns. + */ + matchKeys(object: T, patterns: string | string[], options?: MatchOptions): Partial; + + /** + * Returns a memoized matcher function from the given glob `pattern` and `options`. + * The returned function takes a string to match as its only argument and returns true if the string is a match. + * + * @param pattern Glob pattern + * @param options See available options for changing how matches are performed. + * @returns Returns a matcher function. + */ + matcher(pattern: string | string[], options?: MatchOptions): (str: string) => boolean; + + /** + * Returns an array of matches captured by `pattern` in `string, or`null` if the pattern did not match. + * + * @param pattern Glob pattern to use for matching. + * @param string String to match + * @param options See available options for changing how matches are performed + * @returns Returns an array of captures if the string matches the glob pattern, otherwise `null`. + */ + capture(pattern: string, string: string, options?: MatchOptions): string[] | null; + + /** + * Create a regular expression from the given glob `pattern`. + * + * @param pattern A glob pattern to convert to regex. + * @param options See available options for changing how matches are performed. + * @returns Returns a regex created from the given pattern. + */ + makeRe(pattern: string, options?: MatchOptions): RegExp; + + /** + * Expand the given brace `pattern`. + * + * @param pattern String with brace pattern to expand. + * @param options Any options to change how expansion is performed. See the [braces](https://github.com/micromatch/braces) library for all available options. + */ + braces(pattern: string, options?: MatchOptions): string[]; + + /** + * Parses the given glob `pattern` and returns an array of abstract syntax trees (ASTs), with the compiled `output` and optional source `map` on each AST. + * + * @param pattern Glob pattern to parse and compile. + * @param options Any options to change how parsing and compiling is performed. + * @returns Returns an object with the parsed AST, compiled string and optional source map. + */ + create(pattern: string, options?: MatchOptions): object; + + /** + * Parse the given `str` with the given `options`. + * + * @returns Returns an AST + */ + parse(str: string, options?: MatchOptions): object; + + /** + * Compile the given `ast` or string with the given `options`. + * + * @returns Returns an object that has an `output` property with the compiled string. + */ + compile(ast: object | string, options?: MatchOptions): object; + + MAX_LENGTH: number; + + clearCache(): void; + + resizeCache(newSize: number): void; + + getCache(): object; // TODO + } + } + + const match: I.MatchFunction; } } diff --git a/types/adone/glosses/vault.d.ts b/types/adone/glosses/vault.d.ts new file mode 100644 index 0000000000..2fc39c0c3b --- /dev/null +++ b/types/adone/glosses/vault.d.ts @@ -0,0 +1,204 @@ +declare namespace adone { + namespace vault { + namespace I { + interface VaultConstructorOptions { + // TODO: leveldb options + location: string; + ValuableClass?: object; + } + + interface VaultClearOptions { + hosts?: boolean; + tags?: boolean; + } + + interface VaultToJSONOptions { + valuable?: ValuableToJSONOptions; + includeStats?: boolean; + } + + interface ValuableToJSONOptions { + includeId?: boolean; + includeEntryId?: boolean; + entriesAsArray?: boolean; + tags?: "normal" | "onlyName" | "onlyId" | "none"; + } + + interface VaultJSONStats { + location: string; + created: number; + updated: number; + } + } + + class Vault { + constructor(options: I.VaultConstructorOptions); + + open(): Promise; + + close(): Promise; + + location(): string; + + create(name: string, tags?: string[]): Promise; + + get(name: string): Promise; + + release(name: string): void; + + delete(name: string): Promise; + + clear(options?: I.VaultClearOptions): Promise; + + has(name: string): boolean; + + keys(): string[]; + + values(): Promise; + + entries(): Promise<{ [key: string]: any }>; + + toJSON(options: I.VaultToJSONOptions & { valuable: object, includeStats: true }): Promise<{ + valuables: object[], + stats: I.VaultJSONStats + }>; + toJSON(options: I.VaultToJSONOptions & { valuable: object }): Promise<{ + valuables: object[] + }>; + toJSON(options: I.VaultToJSONOptions & { includeStats: true }): Promise<{ + stats: I.VaultJSONStats + }>; + toJSON(): {}; + + addTag(tag: string, vid?: number): Promise; + + deleteTag(tag: string): Promise; + + tags(ids?: number[], opts?: { privateProps?: boolean }): object[]; + + tagNames(ids?: number[]): string[]; + + getNotes(): string; + + setNotes(notes: string): Promise; + } + + namespace I { + interface ValueableEntriesOptions { + entriesAsArray?: boolean; + includeEntryId?: boolean; + } + + interface ValuableEntry { + name: string; + value: any; + type: string; + } + + interface ValuableClearOptions { + includeNotes?: boolean; + includeTags?: boolean; + } + + interface ValuableJSON { + name: string; + notes: string; + entries: I.ValuableEntry[]; + } + } + + class Valuable { + constructor(vaule: Vault, id: number, metaData: object, tags: object[]); + + name(): string; + + internalId(): number; + + getNotes(): string; + + setNotes(notes: string): Promise; + + set(name: string, value: any, type?: string): Promise; + + setMulti(entries: object): Promise; + + get(name: string): Promise; + + type(name: string): any; + + has(name: string): boolean; + + keys(): string[]; + + entries(opts: I.ValueableEntriesOptions & { entriesAsArray: true }): Promise; + entries(opts: I.ValueableEntriesOptions & { entriesAsArray: true, includeEntryId: true }): Promise>; + entries(opts?: I.ValueableEntriesOptions): Promise; + + delete(name: string): Promise; + + clear(opts?: I.ValuableClearOptions): Promise; + + toJSON(opts?: I.ValuableToJSONOptions): object; // TODO + + fromJSON(json: object): Promise; + + addTag(tag: string): Promise; + + hasTag(tag: string): boolean; + + deleteTag(tag: string): Promise; + + deleteAllTags(): Promise; + + tags(): object[]; + } + + function open(options?: I.VaultConstructorOptions): Promise; + + namespace I { + interface SlicedValuable { + name(): string; + + internalId(): number; + + getNotes(): string; + + setNotes(notes: string): Promise; + + set(name: string, value: any, type?: string): Promise; + + setMulti(entries: object): Promise; + + get(name: string): Promise; + + type(name: string): any; + + has(name: string): boolean; + + keys(): string[]; + + entries(opts: I.ValueableEntriesOptions & { entriesAsArray: true }): Promise; + entries(opts: I.ValueableEntriesOptions & { entriesAsArray: true, includeEntryId: true }): Promise>; + entries(opts?: I.ValueableEntriesOptions): Promise; + + delete(name: string): Promise; + + toJSON(opts?: I.ValuableToJSONOptions): object; + + fromJSON(json: object): Promise; + + addTag(tag: string): Promise; + + hasTag(tag: string): boolean; + + deleteTag(tag: string): Promise; + + deleteAllTags(): Promise; + + tags(): object[]; + } + } + + function slice(valuable: Valuable, prefix: string | string[], separator?: string): I.SlicedValuable; + } +} diff --git a/types/adone/index.d.ts b/types/adone/index.d.ts index 74883c2185..a74641c4df 100644 --- a/types/adone/index.d.ts +++ b/types/adone/index.d.ts @@ -8,22 +8,33 @@ /// /// /// -/// +/// /// +/// /// /// /// -/// +/// +/// /// /// /// /// +/// +/// +/// /// -/// +/// +/// /// +/// /// /// +/// +/// +/// /// +/// declare const _adone: typeof adone; diff --git a/types/adone/test/glosses/application.ts b/types/adone/test/glosses/application.ts new file mode 100644 index 0000000000..38c5b0c8ff --- /dev/null +++ b/types/adone/test/glosses/application.ts @@ -0,0 +1,1663 @@ +namespace applicationTests { + const { + CliApplication, + DApplication, + DSubsystem, + DCliCommand, + DMainCliCommand, + Subsystem, + runCli, + Application + } = adone.application; + + namespace DApplicationTests { + { + @DApplication() + class App extends CliApplication {} + } + { + @DApplication({}) + class App extends CliApplication {} + } + { + @DApplication({ + name: "hello" + }) + class App extends CliApplication {} + } + { + @DApplication({ + description: "hello" + }) + class App extends CliApplication {} + } + { + @DApplication({ + subsystems: [ + { + name: "hello", + subsystem: "a.js" + } + ] + }) + class App extends CliApplication {} + } + { + @DApplication({ + subsystems: [ + { + name: "hello", + subsystem: "a.js", + transpile: true + } + ] + }) + class App extends CliApplication {} + } + { + @DApplication({ + commandsGroups: [{ + name: "a", + description: "b" + }] + }) + class App extends CliApplication {} + } + } + + namespace DSubsystemTests { + { + @DSubsystem() + class App extends Subsystem {} + } + { + @DSubsystem({}) + class App extends Subsystem {} + } + { + @DSubsystem({ + name: "hello" + }) + class App extends Subsystem {} + } + { + @DSubsystem({ + description: "hello" + }) + class App extends Subsystem {} + } + { + @DSubsystem({ + subsystems: [ + { + name: "hello", + subsystem: "a.js" + } + ] + }) + class App extends Subsystem {} + } + { + @DSubsystem({ + subsystems: [ + { + name: "hello", + subsystem: "a.js", + transpile: true + } + ] + }) + class App extends Subsystem {} + } + { + @DSubsystem({ + commandsGroups: [{ + name: "a", + description: "b" + }] + }) + class App extends Subsystem {} + } + } + + namespace DMainCliCommandTests { + { + class App extends CliApplication { + @DMainCliCommand() + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({}) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({}) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + blindMode: true + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + description: "a" + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + match: (arg) => arg.startsWith("hello") + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + optionsGroups: [{ + description: "a", + name: "a" + }] + }) + main() {} + } + } + + namespace argumentsTests { + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: ["hello"] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: ["hello"] + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + action: "append" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + action: "count" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + action: "set" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + action: "store_const" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + action: "store_false" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + action: "store_true" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + action: "store" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + appendChoicesHelpMessage: true + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + appendDefaultMessage: false + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + default: null + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + description: "hello" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + enabled: false + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + help: "asd" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + holder: "a" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + holder: ["a"] + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + nargs: 1 + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + nargs: "*" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + nargs: "+" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + nargs: "?" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + required: false + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + type: String + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + type: (x: string, i: number) => { + return true; + } + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + type: [(x: string, i: number) => { + return true; + }] + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + type: [/^abc$/] + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + arguments: [{ + name: "hello", + verify: (args, opts) => { + return true; + } + }] + }) + main() {} + } + } + } + + namespace optionsTests { + { + class App extends CliApplication { + @DMainCliCommand({ + options: ["--hello"] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: ["hello"] + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + action: "append" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + action: "count" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + action: "set" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + action: "store_const" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + action: "store_false" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + action: "store_true" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + action: "store" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + appendChoicesHelpMessage: true + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + appendDefaultMessage: false + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + default: null + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + description: "hello" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + enabled: false + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + help: "asd" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + holder: "a" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + holder: ["a"] + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + nargs: 1 + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + nargs: "*" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + nargs: "+" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + nargs: "?" + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + required: false + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + type: String + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + type: (x: string, i: number) => { + return true; + } + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + type: [(x: string, i: number) => { + return true; + }] + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + type: [/^abc$/] + }] + }) + main() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + verify: (args, opts) => { + return true; + } + }] + }) + main() {} + } + } + } + } + + namespace DCliCommandTests { + { + class App extends CliApplication { + @DCliCommand() + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({}) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({}) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + blindMode: true + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + description: "a" + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + match: (arg) => arg.startsWith("hello") + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + optionsGroups: [{ + description: "a", + name: "a" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + name: "cmdd" + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + group: "asdasd" + }) + cmd() {} + } + } + + namespace argumentsTests { + { + class App extends CliApplication { + @DCliCommand({ + arguments: ["hello"] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: ["hello"] + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + action: "append" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + action: "count" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + action: "set" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + action: "store_const" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + action: "store_false" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + action: "store_true" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + action: "store" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + appendChoicesHelpMessage: true + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + appendDefaultMessage: false + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + default: null + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + description: "hello" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + enabled: false + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + help: "asd" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + holder: "a" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + holder: ["a"] + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + nargs: 1 + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + nargs: "*" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + nargs: "+" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + nargs: "?" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + required: false + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + type: String + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + type: (x: string, i: number) => { + return true; + } + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + type: [(x: string, i: number) => { + return true; + }] + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + type: [/^abc$/] + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + arguments: [{ + name: "hello", + verify: (args, opts) => { + return true; + } + }] + }) + cmd() {} + } + } + } + + namespace optionsTests { + { + class App extends CliApplication { + @DCliCommand({ + options: ["--hello"] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: ["hello"] + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + action: "append" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + action: "count" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + action: "set" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + action: "store_const" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + action: "store_false" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + action: "store_true" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + action: "store" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + appendChoicesHelpMessage: true + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + appendDefaultMessage: false + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + default: null + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + description: "hello" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + enabled: false + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + help: "asd" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + holder: "a" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + holder: ["a"] + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + nargs: 1 + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + nargs: "*" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + nargs: "+" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + nargs: "?" + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + required: false + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + type: String + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + type: (x: string, i: number) => { + return true; + } + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + type: [(x: string, i: number) => { + return true; + }] + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DCliCommand({ + options: [{ + name: "--hello", + type: [/^abc$/] + }] + }) + cmd() {} + } + } + { + class App extends CliApplication { + @DMainCliCommand({ + options: [{ + name: "--hello", + verify: (args, opts) => { + return true; + } + }] + }) + cmd() {} + } + } + } + } + + namespace subsystemTests { + new Subsystem().name; + new Subsystem().root; + new Subsystem().setRoot(new Subsystem()); + new Subsystem().parent; + new Subsystem().state + 2; + new Subsystem().isOwned === true; + new Subsystem().setState(1); + new Subsystem().waitForState(2).then(() => {}); + new Subsystem().waitForState(2, 100).then(() => {}); + new Subsystem().configure(); + new Subsystem().initialize(); + new Subsystem().uninitialize(); + new Subsystem().configureSubsystems().then(() => {}); + new Subsystem().uninitializeSubsystems().then(() => {}); + new Subsystem().reinitializeSubsystems().then(() => {}); + new Subsystem().configureSubsystem("a").then(() => {}); + new Subsystem().loadSubsystem("a").then(() => {}); + new Subsystem().loadSubsystem(new Subsystem()).then(() => {}); + new Subsystem().loadSubsystem(new Subsystem(), {}).then(() => {}); + new Subsystem().loadSubsystem(new Subsystem(), { description: "a" }).then(() => {}); + new Subsystem().loadSubsystem(new Subsystem(), { group: "a" }).then(() => {}); + new Subsystem().loadSubsystem(new Subsystem(), { name: "a" }).then(() => {}); + new Subsystem().loadSubsystem(new Subsystem(), { transpile: false }).then(() => {}); + new Subsystem().unloadSubsystem("a").then(() => {}); + new Subsystem().initializeSubsystem("a").then(() => {}); + new Subsystem().uninitializeSubsystem("a").then(() => {}); + new Subsystem().getSubsystem("a").waitForState(2).then(() => {}); + new Subsystem().hasSubsystem("a") === true; + new Subsystem().hasSubsystem("a") === true; + new Subsystem().hasSubsystems() === true; + new Subsystem().addSubsystem({ subsystem: "ppp" }); + new Subsystem().addSubsystem({ subsystem: "ppp", bind: true }); + new Subsystem().addSubsystem({ subsystem: "ppp", bind: "a" }); + new Subsystem().addSubsystem({ subsystem: "ppp", configureArgs: [1] }); + new Subsystem().addSubsystem({ subsystem: "ppp", description: "a" }); + new Subsystem().addSubsystem({ subsystem: "ppp", group: "a" }); + new Subsystem().addSubsystem({ subsystem: "ppp", name: "a" }); + new Subsystem().addSubsystem({ subsystem: "ppp", transpile: false }); + new Subsystem().addSubsystem({ subsystem: "ppp", useFilename: true }); + { + const sysInfo = new Subsystem().addSubsystem({ subsystem: "ppp" }); + sysInfo.configureArgs[0]; + sysInfo.description.charCodeAt(10); + sysInfo.group.charCodeAt(10); + sysInfo.instance.waitForState(2, 30).then(() => {}); + sysInfo.name.charCodeAt(100); + sysInfo.path.charCodeAt(100); + } + { + const sysInfo = new Subsystem().addSubsystem({ subsystem: new Subsystem() }); + sysInfo.configureArgs[0]; + sysInfo.description.charCodeAt(10); + sysInfo.group.charCodeAt(10); + sysInfo.instance.waitForState(2, 30).then(() => {}); + sysInfo.name.charCodeAt(100); + sysInfo.path === null; + } + new Subsystem().addSubsystemsFrom("asd", {}); + new Subsystem().addSubsystemsFrom("asd", { filter: ["a"] }); + new Subsystem().addSubsystemsFrom("asd", { filter: (file) => file.charCodeAt(100) === 100 }); + new Subsystem().addSubsystemsFrom("asd", { filter: async (file) => file.charCodeAt(100) === 100 }); + new Subsystem().addSubsystemsFrom("asd", { bind: "a" }); + new Subsystem().addSubsystemsFrom("asd", { bind: true }); + new Subsystem().addSubsystemsFrom("asd", { configureArgs: [1] }); + new Subsystem().addSubsystemsFrom("asd", { description: "a" }); + new Subsystem().addSubsystemsFrom("asd", { group: "a" }); + new Subsystem().addSubsystemsFrom("asd", { name: "a" }); + new Subsystem().addSubsystemsFrom("asd", { transpile: true }); + new Subsystem().addSubsystemsFrom("asd", { useFilename: true }); + + new Subsystem().instantiateSubsystem("asd").waitForState(2, 200).then(() => {}); + new Subsystem().instantiateSubsystem(new Subsystem()).waitForState(2, 200).then(() => {}); + new Subsystem().instantiateSubsystem(new Subsystem(), { transpile: false }).waitForState(2, 200).then(() => {}); + new Subsystem().deleteSubsystem("name"); + new Subsystem().deleteSubsystem("name", true); + new Subsystem().getSubsystemInfo("name").configureArgs[0]; + new Subsystem().getSubsystems()[0].configureArgs[0]; + } + + namespace applicationTests { + new Application().isMain === true; + new Application().main(); + new Application().enableReport(); + new Application().enableReport({}); + new Application().enableReport({ directory: "a" }); + new Application().enableReport({ events: "a" }); + new Application().enableReport({ filename: "a" }); + new Application().enableReport({ signal: "a" }); + new Application().run().then(() => {}); + new Application().exit().then(() => {}); + new Application().exit(1).then(() => {}); + new Application().exitOnSignal("SIGINT", "SIGUSR1"); + new Application().removeProcesshandlers(); + new Application()._uncaughtException; + new Application()._unhandledRejection; + new Application()._rejectionHandled; + new Application()._signalExit("asd"); + } + + namespace cliApplicationTests { + new CliApplication().run({ ignoreArgs: true }).then(() => {}); + new CliApplication().getVersion().then(() => {}); + new CliApplication().exposeCliInterface(); + new CliApplication().mainCommand; + new CliApplication().defineMainCommand({ + arguments: [{ + name: "a", + default: 100500, + nargs: 100, + required: false + }], + options: [{ + name: "--a", + default: 1000, + nargs: 101231 + }], + optionsGroups: [{ + name: "a", + description: "a" + }] + }); + new CliApplication().defineCommand({ + name: "a", + arguments: [{ + name: "a", + default: 100500, + nargs: 100, + required: false + }], + options: [{ + name: "--a", + default: 1000, + nargs: 101231 + }], + optionsGroups: [{ + name: "a", + description: "a" + }] + }); + new CliApplication().defineCommandFromSubsystem({ + configureArgs: [1], + description: "a", + lazily: true, + subsystem: "a", + group: "a", + name: "a", + transpile: false + }); + new CliApplication().defineOption({ + name: "--a", + action: "store" + }); + new CliApplication().defineOptionsGroup({ + name: "a", + description: "b" + }); + new CliApplication().defineCommandsGroup({ + name: "a", + description: "b" + }); + new CliApplication().option("a"); + new CliApplication().option("a", { value: true }); + } +} diff --git a/types/adone/test/glosses/assertion.ts b/types/adone/test/glosses/assertion.ts index 4d07c78182..292cfa190c 100644 --- a/types/adone/test/glosses/assertion.ts +++ b/types/adone/test/glosses/assertion.ts @@ -3,9 +3,9 @@ namespace assertionTests { namespace assertionInterface { namespace exception { - const a: adone.x.Exception = new assertion.AssertionError(); - const b: adone.x.Exception = new assertion.AssertionError("hello"); - const c: adone.x.Exception = new assertion.AssertionError("hello", { actual: 2, expected: 3 }, () => {}); + const a: adone.error.Exception = new assertion.AssertionError(); + const b: adone.error.Exception = new assertion.AssertionError("hello"); + const c: adone.error.Exception = new assertion.AssertionError("hello", { actual: 2, expected: 3 }, () => {}); } namespace config { @@ -38,11 +38,11 @@ namespace assertionTests { assert.fail(1, 2, "hello"); assert.fail(1, 2, "hello", "<"); - assert.isOk(1); - assert.isOk(1, "hello"); + assert.ok(1); + assert.ok(1, "hello"); - assert.isNotOk(1); - assert.isNotOk(1, "hello"); + assert.notOk(1); + assert.notOk(1, "hello"); assert.equal(1, 2); assert.equal(1, 2, "hello"); @@ -68,38 +68,38 @@ namespace assertionTests { assert.notDeepEqual(1, 2); assert.notDeepEqual(1, 2, "hello"); - assert.isAbove(1, 2); - assert.isAbove(1, 2, "hello"); + assert.above(1, 2); + assert.above(1, 2, "hello"); - assert.isAtLeast(1, 2); - assert.isAtLeast(1, 2, "hello"); + assert.atLeast(1, 2); + assert.atLeast(1, 2, "hello"); - assert.isBelow(1, 2); - assert.isBelow(1, 2, "hello"); + assert.below(1, 2); + assert.below(1, 2, "hello"); - assert.isAtMost(1, 2); - assert.isAtMost(1, 2, "hello"); + assert.atMost(1, 2); + assert.atMost(1, 2, "hello"); - assert.isTrue(1); - assert.isTrue(1, "hello"); + assert.true(1); + assert.true(1, "hello"); - assert.isNotTrue(1); - assert.isNotTrue(1, "hello"); + assert.notTrue(1); + assert.notTrue(1, "hello"); - assert.isFalse(1); - assert.isFalse(1, "hello"); + assert.false(1); + assert.false(1, "hello"); - assert.isNotFalse(1); - assert.isNotFalse(1, "hello"); + assert.notFalse(1); + assert.notFalse(1, "hello"); - assert.isNull(1); - assert.isNull(1, "hello"); + assert.null(1); + assert.null(1, "hello"); - assert.isNaN(1); - assert.isNaN(1, "hello"); + assert.NaN(1); + assert.NaN(1, "hello"); - assert.isNotNaN(1); - assert.isNotNaN(1, "hello"); + assert.NotNaN(1); + assert.NotNaN(1, "hello"); assert.exists(1); assert.exists(1, "hello"); @@ -107,49 +107,49 @@ namespace assertionTests { assert.notExists(1); assert.notExists(1, "hello"); - assert.isUndefined(1); - assert.isUndefined(1, "hello"); + assert.undefined(1); + assert.undefined(1, "hello"); - assert.isDefined(1); - assert.isDefined(1, "hello"); + assert.defined(1); + assert.defined(1, "hello"); - assert.isFunction(1); - assert.isFunction(1, "hello"); + assert.function(1); + assert.function(1, "hello"); - assert.isNotFunction(1); - assert.isNotFunction(1, "hello"); + assert.notFunction(1); + assert.notFunction(1, "hello"); - assert.isObject(1); - assert.isObject(1, "hello"); + assert.object(1); + assert.object(1, "hello"); - assert.isNotObject(1); - assert.isNotObject(1, "hello"); + assert.notObject(1); + assert.notObject(1, "hello"); - assert.isArray(1); - assert.isArray(1, "hello"); + assert.array(1); + assert.array(1, "hello"); - assert.isNotArray(1); - assert.isNotArray(1, "hello"); + assert.notArray(1); + assert.notArray(1, "hello"); - assert.isString(1, "hello"); + assert.string(1, "hello"); - assert.isNotString(1); - assert.isNotString(1, "hello"); + assert.notString(1); + assert.notString(1, "hello"); - assert.isNumber(1); - assert.isNumber(1, "hello"); + assert.number(1); + assert.number(1, "hello"); - assert.isNotNumber(1); - assert.isNotNumber(1, "hello"); + assert.notNumber(1); + assert.notNumber(1, "hello"); - assert.isFinite(1); - assert.isFinite(1, "hello"); + assert.finite(1); + assert.finite(1, "hello"); - assert.isBoolean(1); - assert.isBoolean(1, "hello"); + assert.boolean(1); + assert.boolean(1, "hello"); - assert.isNotBoolean(1); - assert.isNotBoolean(1, "hello"); + assert.notBoolean(1); + assert.notBoolean(1, "hello"); assert.typeOf(1, "string"); assert.typeOf(1, "number", "hello"); @@ -457,26 +457,26 @@ namespace assertionTests { assert.ifError(1); - assert.isExtensible({}); - assert.isExtensible({}, "hello"); + assert.extensible({}); + assert.extensible({}, "hello"); - assert.isNotExtensible({}); - assert.isNotExtensible({}, "hello"); + assert.notExtensible({}); + assert.notExtensible({}, "hello"); - assert.isSealed({}); - assert.isSealed({}, "hello"); + assert.sealed({}); + assert.sealed({}, "hello"); - assert.isNotSealed({}); - assert.isNotSealed({}, "hello"); + assert.notSealed({}); + assert.notSealed({}, "hello"); - assert.isFrozen({}); - assert.isFrozen({}, "hello"); + assert.frozen({}); + assert.frozen({}, "hello"); - assert.isNotFrozen({}); - assert.isNotFrozen({}, "hello"); + assert.notFrozen({}); + assert.notFrozen({}, "hello"); - assert.isEmpty({}); - assert.isEmpty({}, "hello"); + assert.empty({}); + assert.empty({}, "hello"); } const { expect } = assertion; @@ -499,16 +499,16 @@ namespace assertionTests { expect(1).to.contain(2, "hello").and; expect(1).but.contains(2).and; expect(1).but.contains(2, "hello").and; - expect(1).to.ok.not.ok; - expect(1).to.be.true.but.false; - expect(1).to.be.false.but.true; - expect(1).to.be.null.and.null; - expect(1).to.be.undefined.and.true; - expect(1).to.be.NaN.and.null; - expect(1).to.exist.and.be.null; - expect(1).to.be.empty.and.true; - expect(1).to.be.arguments.and.a("number"); - expect(1).to.be.Arguments.and.false; + expect(1).to.ok().and.a("string"); + expect(1).to.be.true().but.false(); + expect(1).to.be.false().but.true(); + expect(1).to.be.null().and.null(); + expect(1).to.be.undefined().and.true(); + expect(1).to.be.NaN().and.null(); + expect(1).to.exist().and.be.null(); + expect(1).to.be.empty().and.true(); + expect(1).to.be.arguments().and.a("number"); + expect(1).to.be.Arguments().and.false(); expect(1).to.be.equal(2).and; expect(1).to.be.equal(2, "hello").and; expect(1).but.equals(2).and; @@ -624,19 +624,19 @@ namespace assertionTests { expect(() => {}).but.decreases({}, "a", "hello").and; expect(() => {}).to.decreases({}).by(2).and; expect(() => {}).to.decreases({}).by(2, "hello").and; - expect({}).to.be.extensible.and; - expect({}).to.be.sealed.and; - expect({}).to.be.frozen.and; - expect({}).to.be.finite.and; + expect({}).to.be.extensible().and; + expect({}).to.be.sealed().and; + expect({}).to.be.frozen().and; + expect({}).to.be.finite().and; namespace mockTests { const s1 = adone.shani.util.spy(); const s2 = adone.shani.util.spy(); - expect(s1).to.have.been.called; - expect(s1).to.have.been.calledOnce; - expect(s1).to.have.been.calledTwice; - expect(s1).to.have.been.calledThrice; + expect(s1).to.have.been.called(); + expect(s1).to.have.been.calledOnce(); + expect(s1).to.have.been.calledTwice(); + expect(s1).to.have.been.calledThrice(); expect(s1).to.have.callCount(100); expect(s1).to.have.been.calledBefore(s2); expect(s1).to.have.been.calledAfter(s2); diff --git a/types/adone/test/glosses/collections.ts b/types/adone/test/glosses/collections.ts deleted file mode 100644 index ec227d4440..0000000000 --- a/types/adone/test/glosses/collections.ts +++ /dev/null @@ -1,1003 +0,0 @@ -namespace collectionTests { - const { collection } = adone; - - namespace linkedListTests { - const { LinkedList } = collection; - - namespace creation { - new LinkedList(); - new LinkedList(10); - } - - namespace properties { - { const a: boolean = new LinkedList().full; } - { const a: boolean = new LinkedList().empty; } - { const a: number = new LinkedList().maxLength; } - { const a: number = new LinkedList().length; } - { const a: boolean = new LinkedList().autoresize; } - } - - namespace resize { - { const a: boolean = new LinkedList().resize(100).full; } - } - - namespace push { - const a = new LinkedList().push(10); - a.next; - a.prev; - const b: number = a.value; - } - - namespace pop { - const a: number | undefined = new LinkedList().pop(); - } - - namespace shift { - const a: number | undefined = new LinkedList().shift(); - } - - namespace unshift { - const a = new LinkedList().unshift("hello"); - a.next; - a.prev; - const b: string = a.value; - } - - namespace pushNode { - const a = new LinkedList(); - const node = a.push("1230"); - a.pushNode(node); - } - - namespace unshiftNode { - const a = new LinkedList(); - const node = a.push(10); - a.unshiftNode(node); - } - - namespace removeNode { - const a = new LinkedList(); - const node = a.unshift("10"); - a.removeNode(node); - } - - namespace clear { - new LinkedList().clear(); - new LinkedList().clear(true); - } - - namespace toArray { - const a = new LinkedList(); - const b: number[] = a.toArray(); - } - - namespace front { - const a = new LinkedList(); - const b: number = a.front; - } - - namespace back { - const a = new LinkedList(); - const b: number = a.back; - } - - namespace iterating { - const a = new LinkedList(); - for (const b of a) { - const i: string = b; - } - const c = new LinkedList(); - for (const b of c) { - const i: number = b; - } - } - - namespace nextNode { - const a = new LinkedList(); - const n1 = a.push("h"); - const n2 = a.nextNode(n1); - n1.next; - n1.prev; - const t: string = n1.value; - } - - namespace map { - const a = new LinkedList(); - const f = (a: number, idx: number) => `${a}${idx}`; - const b = a.map(f); - const c: string = b.front; - } - - namespace forEach { - const a = new LinkedList(); - - a.forEach((a: number, b: number) => { - const c = a + b; - }); - } - - namespace static { - const a: number = LinkedList.DEFAULT_LENGTH; - } - } - - namespace ByteArrayTests { - const { ByteArray } = collection; - - new ByteArray(); - new ByteArray(10); - new ByteArray(10, true); - - const buffer = new ByteArray(); - - namespace readBitSet { - const a: boolean[] = buffer.readBitSet(); - const b: boolean[] = buffer.readBitSet(10); - } - - namespace read { - const a: adone.collection.ByteArray = buffer.read(1); - const b: adone.collection.ByteArray = buffer.read(1, 10); - } - - namespace readInt8 { - const a: number = buffer.readInt8(); - const b: number = buffer.readInt8(10); - } - - namespace readUInt8 { - const a: number = buffer.readUInt8(); - const b: number = buffer.readUInt8(10); - } - - namespace readInt16LE { - const a: number = buffer.readInt16LE(); - const b: number = buffer.readInt16LE(10); - } - - namespace readUInt16LE { - const a: number = buffer.readUInt16LE(); - const b: number = buffer.readUInt16LE(10); - } - - namespace readInt16BE { - const a: number = buffer.readInt16BE(); - const b: number = buffer.readInt16BE(10); - } - - namespace readUInt16BE { - const a: number = buffer.readUInt16BE(); - const b: number = buffer.readUInt16BE(10); - } - - namespace readInt32LE { - const a: number = buffer.readInt32LE(); - const b: number = buffer.readInt32LE(10); - } - - namespace readUInt32LE { - const a: number = buffer.readUInt32LE(); - const b: number = buffer.readUInt32LE(10); - } - - namespace readInt32BE { - const a: number = buffer.readInt32BE(); - const b: number = buffer.readInt32BE(10); - } - - namespace readUInt32BE { - const a: number = buffer.readUInt32BE(); - const b: number = buffer.readUInt32BE(10); - } - - namespace readInt64LE { - const a: adone.math.Long = buffer.readInt64LE(); - const b: adone.math.Long = buffer.readInt64LE(10); - } - - namespace readUInt64LE { - const a: adone.math.Long = buffer.readUInt64LE(); - const b: adone.math.Long = buffer.readUInt64LE(10); - } - - namespace readInt64BE { - const a: adone.math.Long = buffer.readInt64BE(); - const b: adone.math.Long = buffer.readInt64BE(10); - } - - namespace readUInt64BE { - const a: adone.math.Long = buffer.readUInt64BE(); - const b: adone.math.Long = buffer.readUInt64BE(10); - } - - namespace readFloatLE { - const a: number = buffer.readFloatLE(); - const b: number = buffer.readFloatLE(10); - } - - namespace readFloatBE { - const a: number = buffer.readFloatBE(); - const b: number = buffer.readFloatBE(10); - } - - namespace readDoubleLE { - const a: number = buffer.readDoubleLE(); - const b: number = buffer.readDoubleLE(10); - } - - namespace readDoubleBE { - const a: number = buffer.readDoubleBE(); - const b: number = buffer.readDoubleBE(10); - } - - namespace write { - const a: adone.collection.ByteArray = buffer.write("1"); - const b: adone.collection.ByteArray = buffer.write(new ByteArray()); - const c: adone.collection.ByteArray = buffer.write(Buffer.alloc(10)); - const d: adone.collection.ByteArray = buffer.write(new Uint8Array([1, 2, 3])); - const e: adone.collection.ByteArray = buffer.write(new ArrayBuffer(10)); - const f: adone.collection.ByteArray = buffer.write("1", 10); - const g: adone.collection.ByteArray = buffer.write("1", 10, 10); - const h: adone.collection.ByteArray = buffer.write("1", 10, 10, "utf8"); - } - - namespace writeBitSet { - const a: adone.collection.ByteArray = buffer.writeBitSet([1, 2, 3]); - const b: number = buffer.writeBitSet([1, 2, 3], 10); - } - - namespace writeInt8 { - const a: adone.collection.ByteArray = buffer.writeInt8(10); - const b: adone.collection.ByteArray = buffer.writeInt8(10, 10); - } - - namespace writeUInt8 { - const a: adone.collection.ByteArray = buffer.writeUInt8(10); - const b: adone.collection.ByteArray = buffer.writeUInt8(10, 10); - } - - namespace writeInt16LE { - const a: adone.collection.ByteArray = buffer.writeInt16LE(10); - const b: adone.collection.ByteArray = buffer.writeInt16LE(10, 10); - } - - namespace writeInt16BE { - const a: adone.collection.ByteArray = buffer.writeInt16BE(10); - const b: adone.collection.ByteArray = buffer.writeInt16BE(10, 10); - } - - namespace writeUInt16LE { - const a: adone.collection.ByteArray = buffer.writeUInt16LE(10); - const b: adone.collection.ByteArray = buffer.writeUInt16LE(10, 10); - } - - namespace writeUInt16BE { - const a: adone.collection.ByteArray = buffer.writeUInt16BE(10); - const b: adone.collection.ByteArray = buffer.writeUInt16BE(10, 10); - } - - namespace writeInt32LE { - const a: adone.collection.ByteArray = buffer.writeInt32LE(10); - const b: adone.collection.ByteArray = buffer.writeInt32LE(10, 10); - } - - namespace writeInt32BE { - const a: adone.collection.ByteArray = buffer.writeInt32BE(10); - const b: adone.collection.ByteArray = buffer.writeInt32BE(10, 10); - } - - namespace writeUInt32LE { - const a: adone.collection.ByteArray = buffer.writeUInt32LE(10); - const b: adone.collection.ByteArray = buffer.writeUInt32LE(10, 10); - } - - namespace writeUInt32BE { - const a: adone.collection.ByteArray = buffer.writeUInt32BE(10); - const b: adone.collection.ByteArray = buffer.writeUInt32BE(10, 10); - } - - namespace writeInt64LE { - const a: adone.collection.ByteArray = buffer.writeInt64LE(10); - const b: adone.collection.ByteArray = buffer.writeInt64LE(10, 10); - } - - namespace writeInt64BE { - const a: adone.collection.ByteArray = buffer.writeInt64BE(10); - const b: adone.collection.ByteArray = buffer.writeInt64BE(10, 10); - } - - namespace writeUInt64LE { - const a: adone.collection.ByteArray = buffer.writeUInt64LE(10); - const b: adone.collection.ByteArray = buffer.writeUInt64LE(10, 10); - } - - namespace writeUInt64BE { - const a: adone.collection.ByteArray = buffer.writeUInt64BE(10); - const b: adone.collection.ByteArray = buffer.writeUInt64BE(10, 10); - } - - namespace writeFloatLE { - const a: adone.collection.ByteArray = buffer.writeFloatLE(10); - const b: adone.collection.ByteArray = buffer.writeFloatLE(10, 10); - } - - namespace writeFloatBE { - const a: adone.collection.ByteArray = buffer.writeFloatBE(10); - const b: adone.collection.ByteArray = buffer.writeFloatBE(10, 10); - } - - namespace writeDoubleLE { - const a: adone.collection.ByteArray = buffer.writeDoubleLE(10); - const b: adone.collection.ByteArray = buffer.writeDoubleLE(10, 10); - } - - namespace writeDoubleBE { - const a: adone.collection.ByteArray = buffer.writeDoubleBE(10); - const b: adone.collection.ByteArray = buffer.writeDoubleBE(10, 10); - } - - namespace writeVarInt32 { - const a: adone.collection.ByteArray = buffer.writeVarint32(10); - const b: number = buffer.writeVarint32(10, 10); - } - - namespace writeVarInt32ZigZag { - const a: adone.collection.ByteArray = buffer.writeVarint32ZigZag(10); - const b: number = buffer.writeVarint32ZigZag(10, 10); - } - - namespace readVarint32 { - const a: number = buffer.readVarint32(); - const b: { value: number, length: number } = buffer.readVarint32(10); - } - - namespace readVarint32ZigZag { - const a: number = buffer.readVarint32ZigZag(); - const b: { value: number, length: number } = buffer.readVarint32ZigZag(10); - } - - namespace writeVarint64 { - const a: adone.collection.ByteArray = buffer.writeVarint64(10); - const b: number = buffer.writeVarint64(10, 10); - } - - namespace writeVarint64ZigZag { - const a: adone.collection.ByteArray = buffer.writeVarint64ZigZag(10); - const b: number = buffer.writeVarint64ZigZag(10, 10); - } - - namespace readVarint64 { - const a: adone.math.Long = buffer.readVarint64(); - const b: { value: adone.math.Long, length: number } = buffer.readVarint64(10); - } - - namespace readVarint64ZigZag { - const a: adone.math.Long = buffer.readVarint64ZigZag(); - const b: { value: adone.math.Long, length: number } = buffer.readVarint64ZigZag(10); - } - - namespace writeCString { - const a: adone.collection.ByteArray = buffer.writeCString("asd"); - const b: number = buffer.writeCString("123", 10); - } - - namespace readCString { - const a: string = buffer.readCString(); - const b: { string: string, length: number } = buffer.readCString(10); - } - - namespace writeString { - const a: adone.collection.ByteArray = buffer.writeString("abc"); - const b: number = buffer.writeString("abc", 10); - } - - namespace readString { - const a: string = buffer.readString(10); - const b: string = buffer.readString(10, "b"); - const c: string = buffer.readString(10, "c"); - const d: { string: string, length: number } = buffer.readString(10, "c", 10); - } - - namespace writeVString { - const a: adone.collection.ByteArray = buffer.writeVString("abc"); - const b: number = buffer.writeVString("abc", 10); - } - - namespace readVString { - const a: string = buffer.readVString(); - const b: { string: string, length: number } = buffer.readVString(10); - } - - namespace appendTo { - const a: adone.collection.ByteArray = buffer.appendTo(new ByteArray()); - const b: adone.collection.ByteArray = buffer.appendTo(new ByteArray(), 10); - } - - namespace assert { - const a: adone.collection.ByteArray = buffer.assert(); - const b: adone.collection.ByteArray = buffer.assert(true); - } - - namespace capacity { - const a: number = buffer.capacity(); - } - - namespace clear { - const a: adone.collection.ByteArray = buffer.clear(); - } - - namespace copy { - const a: adone.collection.ByteArray = buffer.clone(); - const c: adone.collection.ByteArray = buffer.clone(true); - } - - namespace compact { - const a: adone.collection.ByteArray = buffer.compact(); - const b: adone.collection.ByteArray = buffer.compact(1); - const c: adone.collection.ByteArray = buffer.compact(1, 10); - } - - namespace copyTo { - const a: adone.collection.ByteArray = buffer.copyTo(new ByteArray()); - const b: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0); - const c: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0, 0); - const d: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0, 0, 10); - } - - namespace ensureCapacity { - const a: adone.collection.ByteArray = buffer.ensureCapacity(10); - } - - namespace fill { - const a: adone.collection.ByteArray = buffer.fill("0"); - const b: adone.collection.ByteArray = buffer.fill(0); - const c: adone.collection.ByteArray = buffer.fill(0, 0); - const d: adone.collection.ByteArray = buffer.fill(0, 0, 10); - } - - namespace flip { - const a: adone.collection.ByteArray = buffer.flip(); - } - - namespace mark { - const a: adone.collection.ByteArray = buffer.mark(); - const b: adone.collection.ByteArray = buffer.mark(10); - } - - namespace prepend { - const a: adone.collection.ByteArray = buffer.prepend(""); - const b: adone.collection.ByteArray = buffer.prepend(new ByteArray()); - const c: adone.collection.ByteArray = buffer.prepend(Buffer.alloc(10)); - const d: adone.collection.ByteArray = buffer.prepend(new Uint8Array([1, 2, 3])); - const e: adone.collection.ByteArray = buffer.prepend(new ArrayBuffer(10)); - const f: adone.collection.ByteArray = buffer.prepend("", "utf8"); - const g: adone.collection.ByteArray = buffer.prepend("", "utf8", 10); - const h: adone.collection.ByteArray = buffer.prepend("", 10); - } - - namespace prependTo { - const a: adone.collection.ByteArray = buffer.prependTo(new ByteArray()); - const b: adone.collection.ByteArray = buffer.prependTo(new ByteArray(), 10); - } - - namespace remaining { - const a: number = buffer.remaining(); - } - - namespace reset { - const a: adone.collection.ByteArray = buffer.reset(); - } - - namespace resize { - const a: adone.collection.ByteArray = buffer.resize(10); - } - - namespace reverse { - const a: adone.collection.ByteArray = buffer.reverse(); - const b: adone.collection.ByteArray = buffer.reverse(1); - const c: adone.collection.ByteArray = buffer.reverse(1, 10); - } - - namespace skip { - const a: adone.collection.ByteArray = buffer.skip(10); - } - - namespace slice { - const a: adone.collection.ByteArray = buffer.slice(); - const b: adone.collection.ByteArray = buffer.slice(1); - const c: adone.collection.ByteArray = buffer.slice(1, 10); - } - - namespace toBuffer { - const a: Buffer = buffer.toBuffer(); - const b: Buffer = buffer.toBuffer(true); - const c: Buffer = buffer.toBuffer(true, 0); - const d: Buffer = buffer.toBuffer(true, 0, 10); - } - - namespace toArrayBuffer { - const a: ArrayBuffer = buffer.toArrayBuffer(); - } - - namespace toString { - const a: string = buffer.toString(); - const b: string = buffer.toString("utf8"); - const c: string = buffer.toString("utf8", 0); - const d: string = buffer.toString("utf8", 0, 10); - } - - namespace toBase64 { - const a: string = buffer.toBase64(); - const b: string = buffer.toBase64(0); - const c: string = buffer.toBase64(0, 10); - } - - namespace toBinary { - const a: string = buffer.toBinary(); - const b: string = buffer.toBinary(0); - const c: string = buffer.toBinary(0, 10); - } - - namespace toDebug { - const a: string = buffer.toDebug(); - const b: string = buffer.toDebug(true); - } - - namespace toUTF8 { - const a: string = buffer.toUTF8(); - const b: string = buffer.toUTF8(0); - const c: string = buffer.toUTF8(0, 10); - } - - namespace static { - namespace accessor { - const a: typeof Buffer = ByteArray.accessor(); - } - - namespace allocate { - const a: adone.collection.ByteArray = ByteArray.allocate(); - const b: adone.collection.ByteArray = ByteArray.allocate(10); - const c: adone.collection.ByteArray = ByteArray.allocate(10, true); - } - - namespace concat { - const a: adone.collection.ByteArray = ByteArray.concat([ - new ByteArray(), - Buffer.alloc(10), - new Uint8Array([1, 2, 3]), - new ArrayBuffer(10) - ]); - const b: adone.collection.ByteArray = ByteArray.concat([ - new ByteArray(), - Buffer.alloc(10), - new Uint8Array([1, 2, 3]), - new ArrayBuffer(10) - ], "utf8"); - const c: adone.collection.ByteArray = ByteArray.concat([ - new ByteArray(), - Buffer.alloc(10), - new Uint8Array([1, 2, 3]), - new ArrayBuffer(10) - ], "utf8", true); - } - - namespace type { - const a: typeof Buffer = ByteArray.type(); - } - - namespace wrap { - const a: adone.collection.ByteArray = ByteArray.wrap(""); - const b: adone.collection.ByteArray = ByteArray.wrap(new ByteArray()); - const c: adone.collection.ByteArray = ByteArray.wrap(Buffer.alloc(10)); - const d: adone.collection.ByteArray = ByteArray.wrap(new Uint8Array([1, 2, 3])); - const e: adone.collection.ByteArray = ByteArray.wrap(new ArrayBuffer(10)); - const f: adone.collection.ByteArray = ByteArray.wrap("", "utf8"); - const g: adone.collection.ByteArray = ByteArray.wrap("", "utf8", true); - } - - namespace calculateVarint32 { - const a: number = ByteArray.calculateVarint32(10); - } - - namespace zigZagEncode32 { - const a: number = ByteArray.zigZagEncode32(10); - } - - namespace zigZagDecode32 { - const a: number = ByteArray.zigZagDecode32(10); - } - - namespace calculateVarint64 { - const a: number = ByteArray.calculateVarint64(10); - const b: number = ByteArray.calculateVarint64("10"); - } - - namespace zigZagEncode64 { - const a: adone.math.Long = ByteArray.zigZagEncode64(10); - const b: adone.math.Long = ByteArray.zigZagEncode64("10"); - const c: adone.math.Long = ByteArray.zigZagEncode64(adone.math.Long.fromValue(10)); - } - - namespace zigZagDecode64 { - const a: adone.math.Long = ByteArray.zigZagDecode64(10); - const b: adone.math.Long = ByteArray.zigZagDecode64("10"); - const c: adone.math.Long = ByteArray.zigZagDecode64(adone.math.Long.fromValue(10)); - } - - namespace calculateUTF8Chars { - const a: number = ByteArray.calculateUTF8Chars("123"); - } - - namespace calculateString { - const a: number = ByteArray.calculateString("123"); - } - - namespace fromBase64 { - const a: adone.collection.ByteArray = ByteArray.fromBase64("123"); - } - - namespace btoa { - const a: string = ByteArray.btoa("123"); - } - - namespace atob { - const a: string = ByteArray.atob("123"); - } - - namespace fromBinary { - const a: adone.collection.ByteArray = ByteArray.fromBinary("123"); - } - - namespace fromDebug { - const a: adone.collection.ByteArray = ByteArray.fromDebug("12"); - const b: adone.collection.ByteArray = ByteArray.fromDebug("12", true); - } - - namespace fromHex { - const a: adone.collection.ByteArray = ByteArray.fromHex("192"); - const b: adone.collection.ByteArray = ByteArray.fromHex("192", true); - } - - namespace fromUTF8 { - const a: adone.collection.ByteArray = ByteArray.fromUTF8("123"); - const b: adone.collection.ByteArray = ByteArray.fromUTF8("123", true); - } - - namespace constants { - const a: number = ByteArray.DEFAULT_CAPACITY; - const b: boolean = ByteArray.DEFAULT_NOASSERT; - const c: number = ByteArray.MAX_VARINT32_BYTES; - const d: number = ByteArray.MAX_VARINT64_BYTES; - const e: string = ByteArray.METRICS_CHARS; - const f: string = ByteArray.METRICS_BYTES; - } - } - } - - namespace queueTests { - const { Queue } = collection; - type Queue = adone.collection.Queue; - - new Queue(); - { const a: Queue = new Queue().push(123).push(123); } - { const a: number | undefined = new Queue().push(123).pop(); } - { const a: string | undefined = new Queue().push(123).pop(); } - { const a: boolean = new Queue().full; } - { const a: number = new Queue().length; } - { const a: boolean = new Queue().empty; } - } - - namespace asyncQueueTests { - const { AsyncQueue } = collection; - type AsyncQueue = adone.collection.AsyncQueue; - - { const a: AsyncQueue = new AsyncQueue().push(123); } - { const a: Promise = new AsyncQueue().push(123).pop(); } - } - - namespace priorityQueueTests { - const { PriorityQueue } = collection; - type PriorityQueue = adone.collection.PriorityQueue; - - { const a: boolean = new PriorityQueue().empty; } - { const a: number = new PriorityQueue().length; } - new PriorityQueue(); - new PriorityQueue({}); - new PriorityQueue({ - compare(a: number, b: number) { - return a - b; - } - }); - new PriorityQueue({ - priority(a: string, b: string) { - return a.length - b.length; - } - }); - { const a: PriorityQueue = new PriorityQueue().clone(); } - { const a: PriorityQueue = new PriorityQueue().push("123"); } - { const a: string | undefined = new PriorityQueue().pop(); } - { const a: PriorityQueue = new PriorityQueue().delete("123"); } - { const a: PriorityQueue = new PriorityQueue().delete("123"); } - { const a: string = new PriorityQueue().replace("123"); } - { const a: string = new PriorityQueue().pushpop("123"); } - { const a: string[] = new PriorityQueue().toArray(); } - { const a: PriorityQueue = PriorityQueue.from(["1"]); } - { const a: PriorityQueue = PriorityQueue.from(["1"], {}); } - { const a: PriorityQueue = PriorityQueue.from(["1"], { compare: (a: string, b: string) => a.length - b.length }); } - { const a: PriorityQueue = PriorityQueue.from(["1"], { priority: (a: string, b: string) => a.length - b.length }); } - } - - namespace fastlruTests { - const { FastLRU } = collection; - - new FastLRU(); - new FastLRU(100); - new FastLRU(100, { dispose: (key: string, value: number) => null }); - { const a: number = new FastLRU().size; } - { const a: number | undefined = new FastLRU().get("key"); } - new FastLRU().set("key", 123); - { const a: boolean = new FastLRU().delete("key"); } - { const a: boolean = new FastLRU().has("key"); } - { const a: string[] = [...new FastLRU().keys()]; } - { const a: number[] = [...new FastLRU().values()]; } - { const a: number[] = [...new FastLRU().values()]; } - { const a: Array<[string, number]> = [...new FastLRU().entries()]; } - new FastLRU().clear(); - } - - namespace stackTests { - const { Stack } = collection; - type Stack = adone.collection.Stack; - - { const a: boolean = new Stack().empty; } - { const a: number = new Stack().top; } - { const a: Stack = new Stack().push(123); } - { const a: number | undefined = new Stack().pop(); } - { const a: number[] = [...new Stack()]; } - { const a: Stack = Stack.from([1, 2, 3]); } - } - - namespace binarySearchTreeTests { - const { BinarySearchTree } = collection; - type BinarySearchTree = adone.collection.BinarySearchTree; - - new BinarySearchTree(); - new BinarySearchTree({}); - new BinarySearchTree({ checkValueEquality: (a: number, b: number) => a === b }); - new BinarySearchTree({ compareKeys: (a: string, b: string) => a.length - b.length }); - new BinarySearchTree({ parent: new BinarySearchTree() }); - new BinarySearchTree({ unique: true }); - new BinarySearchTree({ value: 123 }); - { const a: BinarySearchTree = new BinarySearchTree().getMaxKeyDescendant(); } - { const a: string = new BinarySearchTree().getMaxKey(); } - { const a: BinarySearchTree = new BinarySearchTree().getMinKeyDescendant(); } - { const a: string = new BinarySearchTree().getMinKey(); } - new BinarySearchTree().checkAllNodesFullfillCondition((key: string, value: number) => null); - new BinarySearchTree().checkIsBST(); - { const a: number = new BinarySearchTree().getNumberOfKeys(); } - new BinarySearchTree().insert("asd", 123); - { const a: number[] = new BinarySearchTree().search("asd"); } - { const a: number[] = new BinarySearchTree().betweenBounds({ $gt: "" }); } - { const a: number[] = new BinarySearchTree().betweenBounds({ $lt: "" }); } - { const a: number[] = new BinarySearchTree().betweenBounds({ $lte: "" }); } - { const a: number[] = new BinarySearchTree().betweenBounds({ $gte: "" }); } - new BinarySearchTree().delete("key"); - new BinarySearchTree().delete("key", 123); - new BinarySearchTree().executeOnEveryNode((tree: BinarySearchTree) => null); - new BinarySearchTree().prettyPrint(); - new BinarySearchTree().prettyPrint(true); - new BinarySearchTree().prettyPrint(true, " "); - } - - namespace avlTreeTests { - const { AVLTree } = collection; - type AVLTree = adone.collection.AVLTree; - - new AVLTree(); - new AVLTree({ checkValueEquality: (a: number, b: number) => a === b }); - new AVLTree({ compareKeys: (a: string, b: string) => a.length - b.length }); - new AVLTree({ parent: new AVLTree() }); - new AVLTree({ unique: false }); - new AVLTree({ value: 123 }); - new AVLTree().checkIsAVLT(); - new AVLTree().insert("123", 123); - new AVLTree().delete("123"); - new AVLTree().delete("123", 123); - { const a: number = new AVLTree().getNumberOFKeys(); } - { const a: number[] = new AVLTree().search("key"); } - { const a: number[] = new AVLTree().betweenBounds({}); } - { const a: number[] = new AVLTree().betweenBounds({ $gt: "ads" }); } - { const a: number[] = new AVLTree().betweenBounds({ $lt: "ads" }); } - { const a: number[] = new AVLTree().betweenBounds({ $gte: "ads" }); } - { const a: number[] = new AVLTree().betweenBounds({ $lte: "ads" }); } - new AVLTree().executeOnEveryNode((tree: AVLTree) => null); - } - - namespace redBlackTreeTests { - const { RedBlackTree } = collection; - type RedBlackTree = adone.collection.RedBlackTree; - type RedBlackTreeIterator = adone.collection.I.RedBlackTree.Iterator; - type RedBlackTreeNode = adone.collection.I.RedBlackTree.Node; - - new RedBlackTree(); - new RedBlackTree((a: string, b: string) => a.length - b.length); - new RedBlackTree(undefined, new RedBlackTree()); - { const a: string[] = new RedBlackTree().keys; } - { const a: number[] = new RedBlackTree().values; } - { const a: number = new RedBlackTree().length; } - { - const a: RedBlackTreeIterator = new RedBlackTree().begin; - { const b: boolean = a.valid; } - { const b: RedBlackTreeNode | null = a.node; } - { const b: string | undefined = a.key; } - { const b: number | undefined = a.value; } - { const b: number = a.index; } - { const b: boolean = a.hasNext; } - { const b: boolean = a.hasPrev; } - { const b: RedBlackTree = a.tree; } - { const b: RedBlackTreeIterator = a.clone(); } - { const b: RedBlackTree = a.remove(); } - a.next(); - { const b: RedBlackTree = a.update(333); } - a.prev(); - } - { const a: RedBlackTreeIterator = new RedBlackTree().end; } - { const a: RedBlackTree = new RedBlackTree().insert("123", 456); } - { const a: number = new RedBlackTree().forEach((key: string, value: number) => value); } - { const a: number = new RedBlackTree().forEach((key: string, value: number) => value, "1"); } - { const a: number = new RedBlackTree().forEach((key: string, value: number) => value, "1", "2"); } - { const a: RedBlackTreeIterator = new RedBlackTree().at(1); } - { const a: RedBlackTreeIterator = new RedBlackTree().ge("1"); } - { const a: RedBlackTreeIterator = new RedBlackTree().gt("1"); } - { const a: RedBlackTreeIterator = new RedBlackTree().lt("1"); } - { const a: RedBlackTreeIterator = new RedBlackTree().le("1"); } - { const a: RedBlackTreeIterator | null = new RedBlackTree().find("1"); } - { const a: RedBlackTree = new RedBlackTree().remove("1"); } - { const a: RedBlackTree = new RedBlackTree().remove("1"); } - { const a: number | undefined = new RedBlackTree().get("1"); } - } - - namespace arraySetTests { - const { ArraySet } = collection; - type ArraySet = adone.collection.ArraySet; - - new ArraySet(); - { const a: number = new ArraySet().length; } - { const a: ArraySet = new ArraySet().add("hello"); } - { const a: ArraySet = new ArraySet().add("hello", true); } - { const a: boolean = new ArraySet().has("string"); } - { const a: number = new ArraySet().indexOf("hello"); } - { const a: string[] = new ArraySet().toArray(); } - { const a: ArraySet = ArraySet.from([1]); } - { const a: ArraySet = ArraySet.from([1], true); } - } - - namespace bufferListTests { - const { BufferList } = collection; - type BufferList = adone.collection.BufferList; - - new BufferList(); - new BufferList(Buffer.from("123")); - new BufferList("123"); - new BufferList(123); - new BufferList([Buffer.from("123"), "123", 123]); - new BufferList((err: any, data: Buffer) => null); - new BufferList().append(Buffer.from("123")); - new BufferList().append("123"); - new BufferList().append(123); - new BufferList().append([Buffer.from("123"), "123", 123]); - new BufferList().end(Buffer.from("123")); - new BufferList().end(); - { const a: number = new BufferList().get(123); } - { const a: Buffer = new BufferList().slice(); } - { const a: Buffer = new BufferList().slice(1); } - { const a: Buffer = new BufferList().slice(1, 2); } - { const a: Buffer = new BufferList().copy(Buffer.alloc(100)); } - { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0); } - { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0, 1); } - { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0, 1, 2); } - { const a: BufferList = new BufferList().shallowSlice(); } - { const a: BufferList = new BufferList().shallowSlice(1); } - { const a: BufferList = new BufferList().shallowSlice(1, 2); } - { const a: string = new BufferList().toString(); } - { const a: string = new BufferList().toString("utf8"); } - { const a: string = new BufferList().toString("utf8", 1); } - { const a: string = new BufferList().toString("utf8", 1, 2); } - { const a: BufferList = new BufferList().consume(10); } - { const a: BufferList = new BufferList().duplicate(); } - new BufferList().destroy(); - new BufferList().then((x: Buffer) => null); - new BufferList().catch((err: any) => null); - } - - namespace defaultMapTests { - const { DefaultMap } = collection; - type DefaultMap = adone.collection.DefaultMap; - - new DefaultMap(); - { const a: DefaultMap = new DefaultMap(undefined, [["1", 2]]); } - { const a: DefaultMap = new DefaultMap((key: string) => 123); } - { const a: DefaultMap = new DefaultMap({ a: 123 }); } - } - - namespace lruTests { - const { LRU } = collection; - type LRU = adone.collection.LRU; - - new LRU(); - new LRU(100); - new LRU({}); - new LRU({ max: 100 }); - new LRU({ dispose: (key: string, value: number) => null }); - new LRU({ maxAge: 100 }); - new LRU({ noDisposeOnSet: false }); - new LRU({ stale: true }); - { const a: number = new LRU().max; } - { new LRU().max = 100; } - { const a: boolean = new LRU().allowStale; } - { new LRU().allowStale = false; } - { const a: number = new LRU().maxAge; } - { new LRU().maxAge = 100; } - { const a: (v: number, k: string) => number = new LRU().lengthCalculator; } - { new LRU().lengthCalculator = () => 123; } - { const a: number = new LRU().length; } - { const a: number = new LRU().itemCount; } - new LRU().rforEach((value: number, key: string) => null); - new LRU().rforEach(function (value: number, key: string) { - const b: number = this.a; - }, { a: 1 }); - new LRU().forEach((value: number, key: string) => null); - new LRU().forEach(function (value: number, key: string) { - const b: number = this.a; - }, { a: 1 }); - { const a: string[] = new LRU().keys(); } - { const a: number[] = new LRU().values(); } - new LRU().reset(); - { - const a: Array> = new LRU().dump(); - const [b] = a; - { const c: number = b.e; } - { const c: string = b.key; } - { const c: number = b.value; } - } - { - const a: adone.collection.LinkedList> = new LRU().dumpLru(); - const b = a.shift(); - if (b !== undefined) { - { const a: string = b.key; } - { const a: number = b.value; } - { const a: number = b.now; } - { const a: number = b.maxAge; } - } - } - { const a: string = new LRU().inspect(); } - { const a: string = new LRU().inspect({}); } - { const a: boolean = new LRU().set("asd", 13); } - { const a: boolean = new LRU().set("asd", 13, 100500); } - { const a: boolean = new LRU().has("asd"); } - { const a: number | undefined = new LRU().get("asd"); } - { const a: number | undefined = new LRU().peek("asd"); } - { const a: adone.collection.I.LRU.Entry = new LRU().pop(); } - new LRU().del("asd"); - new LRU().load(new LRU().dump()); - new LRU().prune(); - } - - namespace timedoutMapTests { - const { TimedoutMap } = collection; - type TimedoutMap = adone.collection.TimedoutMap; - - new TimedoutMap(); - new TimedoutMap(1000); - new TimedoutMap(1000, (key: string) => null); - { - const a: TimedoutMap = new TimedoutMap().forEach((value: number, key: string) => null); - } - { - const a: TimedoutMap = new TimedoutMap().forEach(function (value: number, key: string) { - const a: number = this.a; - }, { a: 1 }); - } - { const a: boolean = new TimedoutMap().delete("123"); } - } -} diff --git a/types/adone/test/glosses/collections/array_set.ts b/types/adone/test/glosses/collections/array_set.ts new file mode 100644 index 0000000000..49fd8582ce --- /dev/null +++ b/types/adone/test/glosses/collections/array_set.ts @@ -0,0 +1,19 @@ +namespace adoneTests.collection.ArraySet { + const { + collection: { + ArraySet + } + } = adone; + + type ArraySet = adone.collection.ArraySet; + + new ArraySet(); + { const a: number = new ArraySet().length; } + { const a: ArraySet = new ArraySet().add("hello"); } + { const a: ArraySet = new ArraySet().add("hello", true); } + { const a: boolean = new ArraySet().has("string"); } + { const a: number = new ArraySet().indexOf("hello"); } + { const a: string[] = new ArraySet().toArray(); } + { const a: ArraySet = ArraySet.from([1]); } + { const a: ArraySet = ArraySet.from([1], true); } +} diff --git a/types/adone/test/glosses/collections/async_queue.ts b/types/adone/test/glosses/collections/async_queue.ts new file mode 100644 index 0000000000..43374e6d3a --- /dev/null +++ b/types/adone/test/glosses/collections/async_queue.ts @@ -0,0 +1,12 @@ +namespace adoneTests.collection.AsyncQueue { + const { + collection: { + AsyncQueue + } + } = adone; + + type AsyncQueue = adone.collection.AsyncQueue; + + { const a: AsyncQueue = new AsyncQueue().push(123); } + { const a: Promise = new AsyncQueue().push(123).pop(); } +} diff --git a/types/adone/test/glosses/collections/avl_tree.ts b/types/adone/test/glosses/collections/avl_tree.ts new file mode 100644 index 0000000000..9c032deb2d --- /dev/null +++ b/types/adone/test/glosses/collections/avl_tree.ts @@ -0,0 +1,28 @@ +namespace adoneTests.collection.AVLTree { + const { + collection: { + AVLTree + } + } = adone; + + type AVLTree = adone.collection.AVLTree; + + new AVLTree(); + new AVLTree({ checkValueEquality: (a: number, b: number) => a === b }); + new AVLTree({ compareKeys: (a: string, b: string) => a.length - b.length }); + new AVLTree({ parent: new AVLTree() }); + new AVLTree({ unique: false }); + new AVLTree({ value: 123 }); + new AVLTree().checkIsAVLT(); + new AVLTree().insert("123", 123); + new AVLTree().delete("123"); + new AVLTree().delete("123", 123); + { const a: number = new AVLTree().getNumberOFKeys(); } + { const a: number[] = new AVLTree().search("key"); } + { const a: number[] = new AVLTree().betweenBounds({}); } + { const a: number[] = new AVLTree().betweenBounds({ $gt: "ads" }); } + { const a: number[] = new AVLTree().betweenBounds({ $lt: "ads" }); } + { const a: number[] = new AVLTree().betweenBounds({ $gte: "ads" }); } + { const a: number[] = new AVLTree().betweenBounds({ $lte: "ads" }); } + new AVLTree().executeOnEveryNode((tree: AVLTree) => null); +} diff --git a/types/adone/test/glosses/collections/binary_search_tree.ts b/types/adone/test/glosses/collections/binary_search_tree.ts new file mode 100644 index 0000000000..56f9a28e72 --- /dev/null +++ b/types/adone/test/glosses/collections/binary_search_tree.ts @@ -0,0 +1,36 @@ +namespace adoneTests.collection.BinarySearchTree { + const { + collection: { + BinarySearchTree + } + } = adone; + + type BinarySearchTree = adone.collection.BinarySearchTree; + + new BinarySearchTree(); + new BinarySearchTree({}); + new BinarySearchTree({ checkValueEquality: (a: number, b: number) => a === b }); + new BinarySearchTree({ compareKeys: (a: string, b: string) => a.length - b.length }); + new BinarySearchTree({ parent: new BinarySearchTree() }); + new BinarySearchTree({ unique: true }); + new BinarySearchTree({ value: 123 }); + { const a: BinarySearchTree = new BinarySearchTree().getMaxKeyDescendant(); } + { const a: string = new BinarySearchTree().getMaxKey(); } + { const a: BinarySearchTree = new BinarySearchTree().getMinKeyDescendant(); } + { const a: string = new BinarySearchTree().getMinKey(); } + new BinarySearchTree().checkAllNodesFullfillCondition((key: string, value: number) => null); + new BinarySearchTree().checkIsBST(); + { const a: number = new BinarySearchTree().getNumberOfKeys(); } + new BinarySearchTree().insert("asd", 123); + { const a: number[] = new BinarySearchTree().search("asd"); } + { const a: number[] = new BinarySearchTree().betweenBounds({ $gt: "" }); } + { const a: number[] = new BinarySearchTree().betweenBounds({ $lt: "" }); } + { const a: number[] = new BinarySearchTree().betweenBounds({ $lte: "" }); } + { const a: number[] = new BinarySearchTree().betweenBounds({ $gte: "" }); } + new BinarySearchTree().delete("key"); + new BinarySearchTree().delete("key", 123); + new BinarySearchTree().executeOnEveryNode((tree: BinarySearchTree) => null); + new BinarySearchTree().prettyPrint(); + new BinarySearchTree().prettyPrint(true); + new BinarySearchTree().prettyPrint(true, " "); +} diff --git a/types/adone/test/glosses/collections/buffer_list.ts b/types/adone/test/glosses/collections/buffer_list.ts new file mode 100644 index 0000000000..265d54033f --- /dev/null +++ b/types/adone/test/glosses/collections/buffer_list.ts @@ -0,0 +1,42 @@ +namespace adoneTests.collection.BufferList { + const { + collection: { + BufferList + } + } = adone; + + type BufferList = adone.collection.BufferList; + + new BufferList(); + new BufferList(Buffer.from("123")); + new BufferList("123"); + new BufferList(123); + new BufferList([Buffer.from("123"), "123", 123]); + new BufferList((err: any, data: Buffer) => null); + new BufferList().append(Buffer.from("123")); + new BufferList().append("123"); + new BufferList().append(123); + new BufferList().append([Buffer.from("123"), "123", 123]); + new BufferList().end(Buffer.from("123")); + new BufferList().end(); + { const a: number = new BufferList().get(123); } + { const a: Buffer = new BufferList().slice(); } + { const a: Buffer = new BufferList().slice(1); } + { const a: Buffer = new BufferList().slice(1, 2); } + { const a: Buffer = new BufferList().copy(Buffer.alloc(100)); } + { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0); } + { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0, 1); } + { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0, 1, 2); } + { const a: BufferList = new BufferList().shallowSlice(); } + { const a: BufferList = new BufferList().shallowSlice(1); } + { const a: BufferList = new BufferList().shallowSlice(1, 2); } + { const a: string = new BufferList().toString(); } + { const a: string = new BufferList().toString("utf8"); } + { const a: string = new BufferList().toString("utf8", 1); } + { const a: string = new BufferList().toString("utf8", 1, 2); } + { const a: BufferList = new BufferList().consume(10); } + { const a: BufferList = new BufferList().duplicate(); } + new BufferList().destroy(); + new BufferList().then((x: Buffer) => null); + new BufferList().catch((err: any) => null); +} diff --git a/types/adone/test/glosses/collections/byte_array.ts b/types/adone/test/glosses/collections/byte_array.ts new file mode 100644 index 0000000000..7254008322 --- /dev/null +++ b/types/adone/test/glosses/collections/byte_array.ts @@ -0,0 +1,561 @@ +namespace adoneTests.collection.ByteArray { + const { + collection: { + ByteArray + } + } = adone; + + new ByteArray(); + new ByteArray(10); + new ByteArray(10, true); + + const buffer = new ByteArray(); + + buffer.woffset === 2; + buffer.roffset === 3; + buffer.noAssert === true; + buffer.buffer.writeUInt8(0, 0); + + namespace readBitSet { + const a: boolean[] = buffer.readBitSet(); + const b: boolean[] = buffer.readBitSet(10); + } + + namespace read { + const a: adone.collection.ByteArray = buffer.read(1); + const b: adone.collection.ByteArray = buffer.read(1, 10); + } + + namespace readInt8 { + const a: number = buffer.readInt8(); + const b: number = buffer.readInt8(10); + } + + namespace readUInt8 { + const a: number = buffer.readUInt8(); + const b: number = buffer.readUInt8(10); + } + + namespace readInt16LE { + const a: number = buffer.readInt16LE(); + const b: number = buffer.readInt16LE(10); + } + + namespace readUInt16LE { + const a: number = buffer.readUInt16LE(); + const b: number = buffer.readUInt16LE(10); + } + + namespace readInt16BE { + const a: number = buffer.readInt16BE(); + const b: number = buffer.readInt16BE(10); + } + + namespace readUInt16BE { + const a: number = buffer.readUInt16BE(); + const b: number = buffer.readUInt16BE(10); + } + + namespace readInt32LE { + const a: number = buffer.readInt32LE(); + const b: number = buffer.readInt32LE(10); + } + + namespace readUInt32LE { + const a: number = buffer.readUInt32LE(); + const b: number = buffer.readUInt32LE(10); + } + + namespace readInt32BE { + const a: number = buffer.readInt32BE(); + const b: number = buffer.readInt32BE(10); + } + + namespace readUInt32BE { + const a: number = buffer.readUInt32BE(); + const b: number = buffer.readUInt32BE(10); + } + + namespace readInt64LE { + const a: adone.math.Long = buffer.readInt64LE(); + const b: adone.math.Long = buffer.readInt64LE(10); + } + + namespace readUInt64LE { + const a: adone.math.Long = buffer.readUInt64LE(); + const b: adone.math.Long = buffer.readUInt64LE(10); + } + + namespace readInt64BE { + const a: adone.math.Long = buffer.readInt64BE(); + const b: adone.math.Long = buffer.readInt64BE(10); + } + + namespace readUInt64BE { + const a: adone.math.Long = buffer.readUInt64BE(); + const b: adone.math.Long = buffer.readUInt64BE(10); + } + + namespace readFloatLE { + const a: number = buffer.readFloatLE(); + const b: number = buffer.readFloatLE(10); + } + + namespace readFloatBE { + const a: number = buffer.readFloatBE(); + const b: number = buffer.readFloatBE(10); + } + + namespace readDoubleLE { + const a: number = buffer.readDoubleLE(); + const b: number = buffer.readDoubleLE(10); + } + + namespace readDoubleBE { + const a: number = buffer.readDoubleBE(); + const b: number = buffer.readDoubleBE(10); + } + + namespace write { + const a: adone.collection.ByteArray = buffer.write("1"); + const b: adone.collection.ByteArray = buffer.write(new ByteArray()); + const c: adone.collection.ByteArray = buffer.write(Buffer.alloc(10)); + const d: adone.collection.ByteArray = buffer.write(new Uint8Array([1, 2, 3])); + const e: adone.collection.ByteArray = buffer.write(new ArrayBuffer(10)); + const f: adone.collection.ByteArray = buffer.write("1", 10); + const g: adone.collection.ByteArray = buffer.write("1", 10, 10); + const h: adone.collection.ByteArray = buffer.write("1", 10, 10, "utf8"); + } + + namespace writeBitSet { + const a: adone.collection.ByteArray = buffer.writeBitSet([1, 2, 3]); + const b: number = buffer.writeBitSet([1, 2, 3], 10); + } + + namespace writeInt8 { + const a: adone.collection.ByteArray = buffer.writeInt8(10); + const b: adone.collection.ByteArray = buffer.writeInt8(10, 10); + } + + namespace writeUInt8 { + const a: adone.collection.ByteArray = buffer.writeUInt8(10); + const b: adone.collection.ByteArray = buffer.writeUInt8(10, 10); + } + + namespace writeInt16LE { + const a: adone.collection.ByteArray = buffer.writeInt16LE(10); + const b: adone.collection.ByteArray = buffer.writeInt16LE(10, 10); + } + + namespace writeInt16BE { + const a: adone.collection.ByteArray = buffer.writeInt16BE(10); + const b: adone.collection.ByteArray = buffer.writeInt16BE(10, 10); + } + + namespace writeUInt16LE { + const a: adone.collection.ByteArray = buffer.writeUInt16LE(10); + const b: adone.collection.ByteArray = buffer.writeUInt16LE(10, 10); + } + + namespace writeUInt16BE { + const a: adone.collection.ByteArray = buffer.writeUInt16BE(10); + const b: adone.collection.ByteArray = buffer.writeUInt16BE(10, 10); + } + + namespace writeInt32LE { + const a: adone.collection.ByteArray = buffer.writeInt32LE(10); + const b: adone.collection.ByteArray = buffer.writeInt32LE(10, 10); + } + + namespace writeInt32BE { + const a: adone.collection.ByteArray = buffer.writeInt32BE(10); + const b: adone.collection.ByteArray = buffer.writeInt32BE(10, 10); + } + + namespace writeUInt32LE { + const a: adone.collection.ByteArray = buffer.writeUInt32LE(10); + const b: adone.collection.ByteArray = buffer.writeUInt32LE(10, 10); + } + + namespace writeUInt32BE { + const a: adone.collection.ByteArray = buffer.writeUInt32BE(10); + const b: adone.collection.ByteArray = buffer.writeUInt32BE(10, 10); + } + + namespace writeInt64LE { + const a: adone.collection.ByteArray = buffer.writeInt64LE(10); + const b: adone.collection.ByteArray = buffer.writeInt64LE(10, 10); + } + + namespace writeInt64BE { + const a: adone.collection.ByteArray = buffer.writeInt64BE(10); + const b: adone.collection.ByteArray = buffer.writeInt64BE(10, 10); + } + + namespace writeUInt64LE { + const a: adone.collection.ByteArray = buffer.writeUInt64LE(10); + const b: adone.collection.ByteArray = buffer.writeUInt64LE(10, 10); + } + + namespace writeUInt64BE { + const a: adone.collection.ByteArray = buffer.writeUInt64BE(10); + const b: adone.collection.ByteArray = buffer.writeUInt64BE(10, 10); + } + + namespace writeFloatLE { + const a: adone.collection.ByteArray = buffer.writeFloatLE(10); + const b: adone.collection.ByteArray = buffer.writeFloatLE(10, 10); + } + + namespace writeFloatBE { + const a: adone.collection.ByteArray = buffer.writeFloatBE(10); + const b: adone.collection.ByteArray = buffer.writeFloatBE(10, 10); + } + + namespace writeDoubleLE { + const a: adone.collection.ByteArray = buffer.writeDoubleLE(10); + const b: adone.collection.ByteArray = buffer.writeDoubleLE(10, 10); + } + + namespace writeDoubleBE { + const a: adone.collection.ByteArray = buffer.writeDoubleBE(10); + const b: adone.collection.ByteArray = buffer.writeDoubleBE(10, 10); + } + + namespace writeVarInt32 { + const a: adone.collection.ByteArray = buffer.writeVarint32(10); + const b: number = buffer.writeVarint32(10, 10); + } + + namespace writeVarInt32ZigZag { + const a: adone.collection.ByteArray = buffer.writeVarint32ZigZag(10); + const b: number = buffer.writeVarint32ZigZag(10, 10); + } + + namespace readVarint32 { + const a: number = buffer.readVarint32(); + const b: { value: number, length: number } = buffer.readVarint32(10); + } + + namespace readVarint32ZigZag { + const a: number = buffer.readVarint32ZigZag(); + const b: { value: number, length: number } = buffer.readVarint32ZigZag(10); + } + + namespace writeVarint64 { + const a: adone.collection.ByteArray = buffer.writeVarint64(10); + const b: number = buffer.writeVarint64(10, 10); + } + + namespace writeVarint64ZigZag { + const a: adone.collection.ByteArray = buffer.writeVarint64ZigZag(10); + const b: number = buffer.writeVarint64ZigZag(10, 10); + } + + namespace readVarint64 { + const a: adone.math.Long = buffer.readVarint64(); + const b: { value: adone.math.Long, length: number } = buffer.readVarint64(10); + } + + namespace readVarint64ZigZag { + const a: adone.math.Long = buffer.readVarint64ZigZag(); + const b: { value: adone.math.Long, length: number } = buffer.readVarint64ZigZag(10); + } + + namespace writeCString { + const a: adone.collection.ByteArray = buffer.writeCString("asd"); + const b: number = buffer.writeCString("123", 10); + } + + namespace readCString { + const a: string = buffer.readCString(); + const b: { string: string, length: number } = buffer.readCString(10); + } + + namespace writeString { + const a: adone.collection.ByteArray = buffer.writeString("abc"); + const b: number = buffer.writeString("abc", 10); + } + + namespace readString { + const a: string = buffer.readString(10); + const b: string = buffer.readString(10, "b"); + const c: string = buffer.readString(10, "c"); + const d: { string: string, length: number } = buffer.readString(10, "c", 10); + } + + namespace writeVString { + const a: adone.collection.ByteArray = buffer.writeVString("abc"); + const b: number = buffer.writeVString("abc", 10); + } + + namespace readVString { + const a: string = buffer.readVString(); + const b: { string: string, length: number } = buffer.readVString(10); + } + + namespace appendTo { + const a: adone.collection.ByteArray = buffer.appendTo(new ByteArray()); + const b: adone.collection.ByteArray = buffer.appendTo(new ByteArray(), 10); + } + + namespace assert { + const a: adone.collection.ByteArray = buffer.assert(); + const b: adone.collection.ByteArray = buffer.assert(true); + } + + namespace capacity { + const a: number = buffer.capacity(); + } + + namespace clear { + const a: adone.collection.ByteArray = buffer.clear(); + } + + namespace copy { + const a: adone.collection.ByteArray = buffer.clone(); + const c: adone.collection.ByteArray = buffer.clone(true); + } + + namespace compact { + const a: adone.collection.ByteArray = buffer.compact(); + const b: adone.collection.ByteArray = buffer.compact(1); + const c: adone.collection.ByteArray = buffer.compact(1, 10); + } + + namespace copyTo { + const a: adone.collection.ByteArray = buffer.copyTo(new ByteArray()); + const b: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0); + const c: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0, 0); + const d: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0, 0, 10); + } + + namespace ensureCapacity { + const a: adone.collection.ByteArray = buffer.ensureCapacity(10); + } + + namespace fill { + const a: adone.collection.ByteArray = buffer.fill("0"); + const b: adone.collection.ByteArray = buffer.fill(0); + const c: adone.collection.ByteArray = buffer.fill(0, 0); + const d: adone.collection.ByteArray = buffer.fill(0, 0, 10); + } + + namespace flip { + const a: adone.collection.ByteArray = buffer.flip(); + } + + namespace mark { + const a: adone.collection.ByteArray = buffer.mark(); + const b: adone.collection.ByteArray = buffer.mark(10); + } + + namespace prepend { + const a: adone.collection.ByteArray = buffer.prepend(""); + const b: adone.collection.ByteArray = buffer.prepend(new ByteArray()); + const c: adone.collection.ByteArray = buffer.prepend(Buffer.alloc(10)); + const d: adone.collection.ByteArray = buffer.prepend(new Uint8Array([1, 2, 3])); + const e: adone.collection.ByteArray = buffer.prepend(new ArrayBuffer(10)); + const f: adone.collection.ByteArray = buffer.prepend("", "utf8"); + const g: adone.collection.ByteArray = buffer.prepend("", "utf8", 10); + const h: adone.collection.ByteArray = buffer.prepend("", 10); + } + + namespace prependTo { + const a: adone.collection.ByteArray = buffer.prependTo(new ByteArray()); + const b: adone.collection.ByteArray = buffer.prependTo(new ByteArray(), 10); + } + + namespace remaining { + const a: number = buffer.remaining(); + } + + namespace reset { + const a: adone.collection.ByteArray = buffer.reset(); + } + + namespace resize { + const a: adone.collection.ByteArray = buffer.resize(10); + } + + namespace reverse { + const a: adone.collection.ByteArray = buffer.reverse(); + const b: adone.collection.ByteArray = buffer.reverse(1); + const c: adone.collection.ByteArray = buffer.reverse(1, 10); + } + + namespace skip { + const a: adone.collection.ByteArray = buffer.skip(10); + } + + namespace slice { + const a: adone.collection.ByteArray = buffer.slice(); + const b: adone.collection.ByteArray = buffer.slice(1); + const c: adone.collection.ByteArray = buffer.slice(1, 10); + } + + namespace toBuffer { + const a: Buffer = buffer.toBuffer(); + const b: Buffer = buffer.toBuffer(true); + const c: Buffer = buffer.toBuffer(true, 0); + const d: Buffer = buffer.toBuffer(true, 0, 10); + } + + namespace toArrayBuffer { + const a: ArrayBuffer = buffer.toArrayBuffer(); + } + + namespace toString { + const a: string = buffer.toString(); + const b: string = buffer.toString("utf8"); + const c: string = buffer.toString("utf8", 0); + const d: string = buffer.toString("utf8", 0, 10); + } + + namespace toBase64 { + const a: string = buffer.toBase64(); + const b: string = buffer.toBase64(0); + const c: string = buffer.toBase64(0, 10); + } + + namespace toBinary { + const a: string = buffer.toBinary(); + const b: string = buffer.toBinary(0); + const c: string = buffer.toBinary(0, 10); + } + + namespace toDebug { + const a: string = buffer.toDebug(); + const b: string = buffer.toDebug(true); + } + + namespace toUTF8 { + const a: string = buffer.toUTF8(); + const b: string = buffer.toUTF8(0); + const c: string = buffer.toUTF8(0, 10); + } + + namespace static { + namespace accessor { + const a: typeof Buffer = ByteArray.accessor(); + } + + namespace allocate { + const a: adone.collection.ByteArray = ByteArray.allocate(); + const b: adone.collection.ByteArray = ByteArray.allocate(10); + const c: adone.collection.ByteArray = ByteArray.allocate(10, true); + } + + namespace concat { + const a: adone.collection.ByteArray = ByteArray.concat([ + new ByteArray(), + Buffer.alloc(10), + new Uint8Array([1, 2, 3]), + new ArrayBuffer(10) + ]); + const b: adone.collection.ByteArray = ByteArray.concat([ + new ByteArray(), + Buffer.alloc(10), + new Uint8Array([1, 2, 3]), + new ArrayBuffer(10) + ], "utf8"); + const c: adone.collection.ByteArray = ByteArray.concat([ + new ByteArray(), + Buffer.alloc(10), + new Uint8Array([1, 2, 3]), + new ArrayBuffer(10) + ], "utf8", true); + } + + namespace type { + const a: typeof Buffer = ByteArray.type(); + } + + namespace wrap { + const a: adone.collection.ByteArray = ByteArray.wrap(""); + const b: adone.collection.ByteArray = ByteArray.wrap(new ByteArray()); + const c: adone.collection.ByteArray = ByteArray.wrap(Buffer.alloc(10)); + const d: adone.collection.ByteArray = ByteArray.wrap(new Uint8Array([1, 2, 3])); + const e: adone.collection.ByteArray = ByteArray.wrap(new ArrayBuffer(10)); + const f: adone.collection.ByteArray = ByteArray.wrap("", "utf8"); + const g: adone.collection.ByteArray = ByteArray.wrap("", "utf8", true); + } + + namespace calculateVarint32 { + const a: number = ByteArray.calculateVarint32(10); + } + + namespace zigZagEncode32 { + const a: number = ByteArray.zigZagEncode32(10); + } + + namespace zigZagDecode32 { + const a: number = ByteArray.zigZagDecode32(10); + } + + namespace calculateVarint64 { + const a: number = ByteArray.calculateVarint64(10); + const b: number = ByteArray.calculateVarint64("10"); + } + + namespace zigZagEncode64 { + const a: adone.math.Long = ByteArray.zigZagEncode64(10); + const b: adone.math.Long = ByteArray.zigZagEncode64("10"); + const c: adone.math.Long = ByteArray.zigZagEncode64(adone.math.Long.fromValue(10)); + } + + namespace zigZagDecode64 { + const a: adone.math.Long = ByteArray.zigZagDecode64(10); + const b: adone.math.Long = ByteArray.zigZagDecode64("10"); + const c: adone.math.Long = ByteArray.zigZagDecode64(adone.math.Long.fromValue(10)); + } + + namespace calculateUTF8Chars { + const a: number = ByteArray.calculateUTF8Chars("123"); + } + + namespace calculateString { + const a: number = ByteArray.calculateString("123"); + } + + namespace fromBase64 { + const a: adone.collection.ByteArray = ByteArray.fromBase64("123"); + } + + namespace btoa { + const a: string = ByteArray.btoa("123"); + } + + namespace atob { + const a: string = ByteArray.atob("123"); + } + + namespace fromBinary { + const a: adone.collection.ByteArray = ByteArray.fromBinary("123"); + } + + namespace fromDebug { + const a: adone.collection.ByteArray = ByteArray.fromDebug("12"); + const b: adone.collection.ByteArray = ByteArray.fromDebug("12", true); + } + + namespace fromHex { + const a: adone.collection.ByteArray = ByteArray.fromHex("192"); + const b: adone.collection.ByteArray = ByteArray.fromHex("192", true); + } + + namespace fromUTF8 { + const a: adone.collection.ByteArray = ByteArray.fromUTF8("123"); + const b: adone.collection.ByteArray = ByteArray.fromUTF8("123", true); + } + + namespace constants { + const a: number = ByteArray.DEFAULT_CAPACITY; + const b: boolean = ByteArray.DEFAULT_NOASSERT; + const c: number = ByteArray.MAX_VARINT32_BYTES; + const d: number = ByteArray.MAX_VARINT64_BYTES; + const e: string = ByteArray.METRICS_CHARS; + const f: string = ByteArray.METRICS_BYTES; + } + } +} diff --git a/types/adone/test/glosses/collections/default_map.ts b/types/adone/test/glosses/collections/default_map.ts new file mode 100644 index 0000000000..1273b91982 --- /dev/null +++ b/types/adone/test/glosses/collections/default_map.ts @@ -0,0 +1,14 @@ +namespace adoneTests.collection.DefaultMap { + const { + collection: { + DefaultMap + } + } = adone; + + type DefaultMap = adone.collection.DefaultMap; + + new DefaultMap(); + { const a: DefaultMap = new DefaultMap(undefined, [["1", 2]]); } + { const a: DefaultMap = new DefaultMap((key: string) => 123); } + { const a: DefaultMap = new DefaultMap({ a: 123 }); } +} diff --git a/types/adone/test/glosses/collections/fast_lru.ts b/types/adone/test/glosses/collections/fast_lru.ts new file mode 100644 index 0000000000..0e61f51dc5 --- /dev/null +++ b/types/adone/test/glosses/collections/fast_lru.ts @@ -0,0 +1,21 @@ +namespace adoneTests.collection.FastLRU { + const { + collection: { + FastLRU + } + } = adone; + + new FastLRU(); + new FastLRU(100); + new FastLRU(100, { dispose: (key: string, value: number) => null }); + { const a: number = new FastLRU().size; } + { const a: number | undefined = new FastLRU().get("key"); } + new FastLRU().set("key", 123); + { const a: boolean = new FastLRU().delete("key"); } + { const a: boolean = new FastLRU().has("key"); } + { const a: string[] = [...new FastLRU().keys()]; } + { const a: number[] = [...new FastLRU().values()]; } + { const a: number[] = [...new FastLRU().values()]; } + { const a: Array<[string, number]> = [...new FastLRU().entries()]; } + new FastLRU().clear(); +} diff --git a/types/adone/test/glosses/collections/linked_list.ts b/types/adone/test/glosses/collections/linked_list.ts new file mode 100644 index 0000000000..f64a32c1aa --- /dev/null +++ b/types/adone/test/glosses/collections/linked_list.ts @@ -0,0 +1,123 @@ +namespace adoneTests.collection.LinkedList { + const { + collection: { + LinkedList + } + } = adone; + + namespace creation { + new LinkedList(); + new LinkedList(10); + } + + namespace properties { + { const a: boolean = new LinkedList().full; } + { const a: boolean = new LinkedList().empty; } + { const a: number = new LinkedList().maxLength; } + { const a: number = new LinkedList().length; } + { const a: boolean = new LinkedList().autoresize; } + } + + namespace resize { + { const a: boolean = new LinkedList().resize(100).full; } + } + + namespace push { + const a = new LinkedList().push(10); + a.next; + a.prev; + const b: number = a.value; + } + + namespace pop { + const a: number | undefined = new LinkedList().pop(); + } + + namespace shift { + const a: number | undefined = new LinkedList().shift(); + } + + namespace unshift { + const a = new LinkedList().unshift("hello"); + a.next; + a.prev; + const b: string = a.value; + } + + namespace pushNode { + const a = new LinkedList(); + const node = a.push("1230"); + a.pushNode(node); + } + + namespace unshiftNode { + const a = new LinkedList(); + const node = a.push(10); + a.unshiftNode(node); + } + + namespace removeNode { + const a = new LinkedList(); + const node = a.unshift("10"); + a.removeNode(node); + } + + namespace clear { + new LinkedList().clear(); + new LinkedList().clear(true); + } + + namespace toArray { + const a = new LinkedList(); + const b: number[] = a.toArray(); + } + + namespace front { + const a = new LinkedList(); + const b: number = a.front; + } + + namespace back { + const a = new LinkedList(); + const b: number = a.back; + } + + namespace iterating { + const a = new LinkedList(); + for (const b of a) { + const i: string = b; + } + const c = new LinkedList(); + for (const b of c) { + const i: number = b; + } + } + + namespace nextNode { + const a = new LinkedList(); + const n1 = a.push("h"); + const n2 = a.nextNode(n1); + n1.next; + n1.prev; + const t: string = n1.value; + } + + namespace map { + const a = new LinkedList(); + const f = (a: number, idx: number) => `${a}${idx}`; + const b = a.map(f); + const c: string = b.front; + } + + namespace forEach { + const a = new LinkedList(); + + a.forEach((a: number, b: number) => { + const c = a + b; + }); + } + + namespace static { + const a: number = LinkedList.DEFAULT_LENGTH; + } +} diff --git a/types/adone/test/glosses/collections/lru.ts b/types/adone/test/glosses/collections/lru.ts new file mode 100644 index 0000000000..934e5a1fbf --- /dev/null +++ b/types/adone/test/glosses/collections/lru.ts @@ -0,0 +1,67 @@ +namespace adoneTests.collection.LRU { + const { + collection: { + LRU + } + } = adone; + + type LRU = adone.collection.LRU; + + new LRU(); + new LRU(100); + new LRU({}); + new LRU({ max: 100 }); + new LRU({ dispose: (key: string, value: number) => null }); + new LRU({ maxAge: 100 }); + new LRU({ noDisposeOnSet: false }); + new LRU({ stale: true }); + { const a: number = new LRU().max; } + { new LRU().max = 100; } + { const a: boolean = new LRU().allowStale; } + { new LRU().allowStale = false; } + { const a: number = new LRU().maxAge; } + { new LRU().maxAge = 100; } + { const a: (v: number, k: string) => number = new LRU().lengthCalculator; } + { new LRU().lengthCalculator = () => 123; } + { const a: number = new LRU().length; } + { const a: number = new LRU().itemCount; } + new LRU().rforEach((value: number, key: string) => null); + new LRU().rforEach(function (value: number, key: string) { + const b: number = this.a; + }, { a: 1 }); + new LRU().forEach((value: number, key: string) => null); + new LRU().forEach(function (value: number, key: string) { + const b: number = this.a; + }, { a: 1 }); + { const a: string[] = new LRU().keys(); } + { const a: number[] = new LRU().values(); } + new LRU().reset(); + { + const a: Array> = new LRU().dump(); + const [b] = a; + { const c: number = b.e; } + { const c: string = b.key; } + { const c: number = b.value; } + } + { + const a: adone.collection.LinkedList> = new LRU().dumpLru(); + const b = a.shift(); + if (b !== undefined) { + { const a: string = b.key; } + { const a: number = b.value; } + { const a: number = b.now; } + { const a: number = b.maxAge; } + } + } + { const a: string = new LRU().inspect(); } + { const a: string = new LRU().inspect({}); } + { const a: boolean = new LRU().set("asd", 13); } + { const a: boolean = new LRU().set("asd", 13, 100500); } + { const a: boolean = new LRU().has("asd"); } + { const a: number | undefined = new LRU().get("asd"); } + { const a: number | undefined = new LRU().peek("asd"); } + { const a: adone.collection.I.LRU.Entry = new LRU().pop(); } + new LRU().del("asd"); + new LRU().load(new LRU().dump()); + new LRU().prune(); +} diff --git a/types/adone/test/glosses/collections/map_cache.ts b/types/adone/test/glosses/collections/map_cache.ts new file mode 100644 index 0000000000..bcd0ffb887 --- /dev/null +++ b/types/adone/test/glosses/collections/map_cache.ts @@ -0,0 +1,21 @@ +namespace adoneTests.collection.MapCache { + const { + collection: { + MapCache + } + } = adone; + + new MapCache(); + + new MapCache().has("hello"); + new MapCache().get("hello"); + new MapCache().set("hello", "world"); + new MapCache().delete("hello"); + new MapCache().clear(); + + { + const a = new MapCache(); + a.set("a", "b"); + a.get("a").charCodeAt(20); + } +} diff --git a/types/adone/test/glosses/collections/ns_cache.ts b/types/adone/test/glosses/collections/ns_cache.ts new file mode 100644 index 0000000000..a8e8c14397 --- /dev/null +++ b/types/adone/test/glosses/collections/ns_cache.ts @@ -0,0 +1,21 @@ +namespace adoneTests.collection.NSCache { + const { + collection: { + NSCache + } + } = adone; + + new NSCache(10, ["a", "b", "c"]); + new NSCache(10, ["a", "b", "c"]).resize(100); + new NSCache(10, ["a", "b", "c"]).set("a", "b", "c"); + new NSCache(10, ["a", "b", "c"]).get("a", "b"); + new NSCache(10, ["a", "b", "c"]).has("a", "b"); + new NSCache(10, ["a", "b", "c"]).delete("a", "b"); + new NSCache(10, ["a", "b", "c"]).clear(); + + { + const a = new NSCache(10, ["a", "b", "c"]); + a.set("a", "b", "c"); + a.get("a", "b").charCodeAt(100); + } +} diff --git a/types/adone/test/glosses/collections/priority_queue.ts b/types/adone/test/glosses/collections/priority_queue.ts new file mode 100644 index 0000000000..950e7394e7 --- /dev/null +++ b/types/adone/test/glosses/collections/priority_queue.ts @@ -0,0 +1,36 @@ +namespace adoneTests.collection.PriorityQueue { + const { + collection: { + PriorityQueue + } + } = adone; + + type PriorityQueue = adone.collection.PriorityQueue; + + { const a: boolean = new PriorityQueue().empty; } + { const a: number = new PriorityQueue().length; } + new PriorityQueue(); + new PriorityQueue({}); + new PriorityQueue({ + compare(a: number, b: number) { + return a - b; + } + }); + new PriorityQueue({ + priority(a: string, b: string) { + return a.length - b.length; + } + }); + { const a: PriorityQueue = new PriorityQueue().clone(); } + { const a: PriorityQueue = new PriorityQueue().push("123"); } + { const a: string | undefined = new PriorityQueue().pop(); } + { const a: PriorityQueue = new PriorityQueue().delete("123"); } + { const a: PriorityQueue = new PriorityQueue().delete("123"); } + { const a: string = new PriorityQueue().replace("123"); } + { const a: string = new PriorityQueue().pushpop("123"); } + { const a: string[] = new PriorityQueue().toArray(); } + { const a: PriorityQueue = PriorityQueue.from(["1"]); } + { const a: PriorityQueue = PriorityQueue.from(["1"], {}); } + { const a: PriorityQueue = PriorityQueue.from(["1"], { compare: (a: string, b: string) => a.length - b.length }); } + { const a: PriorityQueue = PriorityQueue.from(["1"], { priority: (a: string, b: string) => a.length - b.length }); } +} diff --git a/types/adone/test/glosses/collections/queue.ts b/types/adone/test/glosses/collections/queue.ts new file mode 100644 index 0000000000..2aefee9716 --- /dev/null +++ b/types/adone/test/glosses/collections/queue.ts @@ -0,0 +1,28 @@ +namespace adoneTests.collection.Queue { + const { + collection: { + Queue + } + } = adone; + + type Queue = adone.collection.Queue; + + new Queue(); + { const a: Queue = new Queue().push(123).push(123); } + { const a: number | undefined = new Queue().push(123).pop(); } + { const a: string | undefined = new Queue().push(123).pop(); } + { const a: boolean = new Queue().full; } + { const a: number = new Queue().length; } + { const a: boolean = new Queue().empty; } + + { + const q = Queue.from([1, 2, 3]); + const a: number | undefined = q.pop(); + } + { + const q = Queue.from((function*() { + yield 42; + })()); + const a: number | undefined = q.pop(); + } +} diff --git a/types/adone/test/glosses/collections/rb_tree.ts b/types/adone/test/glosses/collections/rb_tree.ts new file mode 100644 index 0000000000..1b624284f6 --- /dev/null +++ b/types/adone/test/glosses/collections/rb_tree.ts @@ -0,0 +1,48 @@ +namespace adoneTests.collection.RedBlackTree { + const { + collection: { + RedBlackTree + } + } = adone; + + type RedBlackTree = adone.collection.RedBlackTree; + type RedBlackTreeIterator = adone.collection.I.RedBlackTree.Iterator; + type RedBlackTreeNode = adone.collection.I.RedBlackTree.Node; + + new RedBlackTree(); + new RedBlackTree((a: string, b: string) => a.length - b.length); + new RedBlackTree(undefined, new RedBlackTree()); + { const a: string[] = new RedBlackTree().keys; } + { const a: number[] = new RedBlackTree().values; } + { const a: number = new RedBlackTree().length; } + { + const a: RedBlackTreeIterator = new RedBlackTree().begin; + { const b: boolean = a.valid; } + { const b: RedBlackTreeNode | null = a.node; } + { const b: string | undefined = a.key; } + { const b: number | undefined = a.value; } + { const b: number = a.index; } + { const b: boolean = a.hasNext; } + { const b: boolean = a.hasPrev; } + { const b: RedBlackTree = a.tree; } + { const b: RedBlackTreeIterator = a.clone(); } + { const b: RedBlackTree = a.remove(); } + a.next(); + { const b: RedBlackTree = a.update(333); } + a.prev(); + } + { const a: RedBlackTreeIterator = new RedBlackTree().end; } + { const a: RedBlackTree = new RedBlackTree().insert("123", 456); } + { const a: number = new RedBlackTree().forEach((key: string, value: number) => value); } + { const a: number = new RedBlackTree().forEach((key: string, value: number) => value, "1"); } + { const a: number = new RedBlackTree().forEach((key: string, value: number) => value, "1", "2"); } + { const a: RedBlackTreeIterator = new RedBlackTree().at(1); } + { const a: RedBlackTreeIterator = new RedBlackTree().ge("1"); } + { const a: RedBlackTreeIterator = new RedBlackTree().gt("1"); } + { const a: RedBlackTreeIterator = new RedBlackTree().lt("1"); } + { const a: RedBlackTreeIterator = new RedBlackTree().le("1"); } + { const a: RedBlackTreeIterator | null = new RedBlackTree().find("1"); } + { const a: RedBlackTree = new RedBlackTree().remove("1"); } + { const a: RedBlackTree = new RedBlackTree().remove("1"); } + { const a: number | undefined = new RedBlackTree().get("1"); } +} diff --git a/types/adone/test/glosses/collections/refcounted_cache.ts b/types/adone/test/glosses/collections/refcounted_cache.ts new file mode 100644 index 0000000000..6262d57d60 --- /dev/null +++ b/types/adone/test/glosses/collections/refcounted_cache.ts @@ -0,0 +1,17 @@ +namespace adoneTests.collection.RefcountedCache { + const { + collection: { + RefcountedCache + } + } = adone; + + new RefcountedCache(); + new RefcountedCache().ref("a"); + new RefcountedCache().unref("a"); + new RefcountedCache().references("a") === 5; + + { + const a = new RefcountedCache(); + a.get("b").charCodeAt(100); + } +} diff --git a/types/adone/test/glosses/collections/set.ts b/types/adone/test/glosses/collections/set.ts new file mode 100644 index 0000000000..2e2314956e --- /dev/null +++ b/types/adone/test/glosses/collections/set.ts @@ -0,0 +1,26 @@ +namespace adoneTests.collection.Set { + const { + collection: { + Set + } + } = adone; + + new Set().add("a"); + new Set().has("a"); + new Set().delete("a"); + new Set().get("a"); + new Set().has("a") === true; + new Set().only(); + new Set().size === 5; + + { + const a = new Set(); + + a.add(1); + a.has(2); + a.delete(2); + a.get(2); // ??? + a.only() === 5; + a.size === 5; + } +} diff --git a/types/adone/test/glosses/collections/stack.ts b/types/adone/test/glosses/collections/stack.ts new file mode 100644 index 0000000000..df13f82f8e --- /dev/null +++ b/types/adone/test/glosses/collections/stack.ts @@ -0,0 +1,16 @@ +namespace adoneTests.collection.Stack { + const { + collection: { + Stack + } + } = adone; + + type Stack = adone.collection.Stack; + + { const a: boolean = new Stack().empty; } + { const a: number = new Stack().top; } + { const a: Stack = new Stack().push(123); } + { const a: number | undefined = new Stack().pop(); } + { const a: number[] = [...new Stack()]; } + { const a: Stack = Stack.from([1, 2, 3]); } +} diff --git a/types/adone/test/glosses/collections/timedout_map.ts b/types/adone/test/glosses/collections/timedout_map.ts new file mode 100644 index 0000000000..ffca754e2a --- /dev/null +++ b/types/adone/test/glosses/collections/timedout_map.ts @@ -0,0 +1,22 @@ +namespace adoneTests.collection.TimedoutMap { + const { + collection: { + TimedoutMap + } + } = adone; + + type TimedoutMap = adone.collection.TimedoutMap; + + new TimedoutMap(); + new TimedoutMap(1000); + new TimedoutMap(1000, (key: string) => null); + { + const a: TimedoutMap = new TimedoutMap().forEach((value: number, key: string) => null); + } + { + const a: TimedoutMap = new TimedoutMap().forEach(function (value: number, key: string) { + const a: number = this.a; + }, { a: 1 }); + } + { const a: boolean = new TimedoutMap().delete("123"); } +} diff --git a/types/adone/test/glosses/crypto/asn1.ts b/types/adone/test/glosses/crypto/asn1.ts new file mode 100644 index 0000000000..447c71c34e --- /dev/null +++ b/types/adone/test/glosses/crypto/asn1.ts @@ -0,0 +1,3183 @@ +namespace adoneTests.crypto.asn1 { + const { + crypto: { + asn1 + } + } = adone; + + let arrBuf: ArrayBuffer; + let num: number; + let bool: boolean; + let str: string; + let date: Date; + + namespace BaseBlock { + const { + BaseBlock + } = asn1; + + new BaseBlock({ + blockLength: 10 + }); + new BaseBlock({ + error: "a" + }); + new BaseBlock({ + name: "a" + }); + new BaseBlock({ + optional: true + }); + new BaseBlock({ + primitiveSchema: {} + }); + new BaseBlock({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new BaseBlock({ + warnings: ["a"] + }); + + const b = new BaseBlock(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Primitive { + const { + Primitive + } = asn1; + + new Primitive({ + blockLength: 10 + }); + new Primitive({ + error: "a" + }); + new Primitive({ + name: "a" + }); + new Primitive({ + optional: true + }); + new Primitive({ + primitiveSchema: {} + }); + new Primitive({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new Primitive({ + warnings: ["a"] + }); + + const b = new Primitive(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Constructed { + const { + Constructed + } = asn1; + + new Constructed({ + blockLength: 10 + }); + new Constructed({ + error: "a" + }); + new Constructed({ + name: "a" + }); + new Constructed({ + optional: true + }); + new Constructed({ + primitiveSchema: {} + }); + new Constructed({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new Constructed({ + warnings: ["a"] + }); + + const b = new Constructed(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isIndefiniteForm; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace EndOfContent { + const { + EndOfContent + } = asn1; + + new EndOfContent({ + blockLength: 10 + }); + new EndOfContent({ + error: "a" + }); + new EndOfContent({ + name: "a" + }); + new EndOfContent({ + optional: true + }); + new EndOfContent({ + primitiveSchema: {} + }); + new EndOfContent({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new EndOfContent({ + warnings: ["a"] + }); + + const b = new EndOfContent(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Boolean { + const { + Boolean: _Boolean + } = asn1; + + new _Boolean({ + blockLength: 10 + }); + new _Boolean({ + error: "a" + }); + new _Boolean({ + name: "a" + }); + new _Boolean({ + optional: true + }); + new _Boolean({ + primitiveSchema: {} + }); + new _Boolean({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new _Boolean({ + warnings: ["a"] + }); + + const b = new _Boolean(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Sequence { + const { + Sequence + } = asn1; + + new Sequence({ + blockLength: 10 + }); + new Sequence({ + error: "a" + }); + new Sequence({ + name: "a" + }); + new Sequence({ + optional: true + }); + new Sequence({ + primitiveSchema: {} + }); + new Sequence({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new Sequence({ + warnings: ["a"] + }); + + const b = new Sequence(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isIndefiniteForm; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Set { + const { + Set + } = asn1; + + new Set({ + blockLength: 10 + }); + new Set({ + error: "a" + }); + new Set({ + name: "a" + }); + new Set({ + optional: true + }); + new Set({ + primitiveSchema: {} + }); + new Set({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new Set({ + warnings: ["a"] + }); + + const b = new Set(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isIndefiniteForm; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Null { + const { + Null: Null + } = asn1; + + new Null({ + blockLength: 10 + }); + new Null({ + error: "a" + }); + new Null({ + name: "a" + }); + new Null({ + optional: true + }); + new Null({ + primitiveSchema: {} + }); + new Null({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new Null({ + warnings: ["a"] + }); + + const b = new Null(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace OctetString { + const { + OctetString + } = asn1; + + new OctetString({ + blockLength: 10 + }); + new OctetString({ + error: "a" + }); + new OctetString({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new OctetString({ + warnings: ["a"] + }); + + const b = new OctetString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isConstructed; + bool = b.valueBlock.isHexOnly; + bool = b.valueBlock.isIndefiniteForm; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + const [v] = b.valueBlock.value; + num = v.blockLength; + str = v.error; + v.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = v.toBER(); + { + const j = v.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = v.valueBeforeDecode; + str = v.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace BitString { + const { + BitString + } = asn1; + + new BitString({ + blockLength: 10 + }); + new BitString({ + error: "a" + }); + new BitString({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new BitString({ + warnings: ["a"] + }); + + const b = new BitString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isConstructed; + bool = b.valueBlock.isHexOnly; + bool = b.valueBlock.isIndefiniteForm; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + const [v] = b.valueBlock.value; + num = v.blockLength; + str = v.error; + v.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = v.toBER(); + { + const j = v.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = v.valueBeforeDecode; + str = v.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace Integer { + const { + Integer + } = asn1; + + new Integer({ + value: 10 + }); + + const b = new Integer(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + num = b.valueBlock.valueDec; + } + + str = b.warnings[0]; + } + + namespace Enumerated { + const { + Enumerated + } = asn1; + + new Enumerated({ + value: 10 + }); + + const b = new Enumerated(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + num = b.valueBlock.valueDec; + } + + str = b.warnings[0]; + } + + namespace ObjectIdentifier { + const { + ObjectIdentifier + } = asn1; + + new ObjectIdentifier({ + blockLength: 10 + }); + new ObjectIdentifier({ + error: "a" + }); + new ObjectIdentifier({ + value: "ha" + }); + new ObjectIdentifier({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new ObjectIdentifier({ + warnings: ["a"] + }); + + const b = new ObjectIdentifier(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace Utf8String { + const { + Utf8String + } = asn1; + + new Utf8String({ + value: "ha" + }); + + const b = new Utf8String({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace BmpString { + const { + BmpString + } = asn1; + + new BmpString({ + value: "ha" + }); + + const b = new BmpString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.value; + } + + str = b.warnings[0]; + } + + namespace UniversalString { + const { + UniversalString + } = asn1; + + new UniversalString({ + value: "ha" + }); + + const b = new UniversalString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.value; + } + + str = b.warnings[0]; + } + + namespace NumericString { + const { + NumericString + } = asn1; + + new NumericString({ + value: "123" + }); + + const b = new NumericString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace PrintableString { + const { + PrintableString + } = asn1; + + new PrintableString({ + value: "123" + }); + + const b = new PrintableString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace TeletexString { + const { + TeletexString + } = asn1; + + new TeletexString({ + value: "123" + }); + + const b = new TeletexString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace VideotexString { + const { + VideotexString + } = asn1; + + new VideotexString({ + value: "123" + }); + + const b = new VideotexString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace IA5String { + const { + IA5String + } = asn1; + + new IA5String({ + value: "123" + }); + + const b = new IA5String(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace GraphicString { + const { + GraphicString + } = asn1; + + new GraphicString({ + value: "123" + }); + + const b = new GraphicString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace VisibleString { + const { + VisibleString + } = asn1; + + new VisibleString({ + value: "123" + }); + + const b = new VisibleString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace GeneralString { + const { + GeneralString + } = asn1; + + new GeneralString({ + value: "123" + }); + + const b = new GeneralString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace CharacterString { + const { + CharacterString + } = asn1; + + new CharacterString({ + value: "123" + }); + + const b = new CharacterString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace UTCTime { + const { + UTCTime + } = asn1; + + new UTCTime({ + value: "123" + }); + + new UTCTime({ + blockLength: 10 + }); + + new UTCTime({ + error: "a" + }); + + new UTCTime({ + isHexOnly: true + }); + + new UTCTime({ + valueBeforeDecode: new ArrayBuffer(10) + }); + + new UTCTime({ + valueDate: new Date() + }); + + new UTCTime({ + valueHex: new ArrayBuffer(10) + }); + + new UTCTime({ + warnings: ["a"] + }); + + const b = new UTCTime(); + + num = b.year; + num = b.month; + num = b.day; + num = b.hour; + num = b.minute; + num = b.second; + + arrBuf = b.toBuffer(); + + b.fromDate(new Date()); + + date = b.toDate(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace GeneralizedTime { + const { + GeneralizedTime + } = asn1; + + new GeneralizedTime({ + value: "123" + }); + + new GeneralizedTime({ + blockLength: 10 + }); + + new GeneralizedTime({ + error: "a" + }); + + new GeneralizedTime({ + isHexOnly: true + }); + + new GeneralizedTime({ + valueBeforeDecode: new ArrayBuffer(10) + }); + + new GeneralizedTime({ + valueDate: new Date() + }); + + new GeneralizedTime({ + valueHex: new ArrayBuffer(10) + }); + + new GeneralizedTime({ + warnings: ["a"] + }); + + const b = new GeneralizedTime(); + + num = b.year; + num = b.month; + num = b.day; + num = b.hour; + num = b.minute; + num = b.second; + num = b.millisecond; + + arrBuf = b.toBuffer(); + + b.fromDate(new Date()); + + date = b.toDate(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace DATE { + const { + DATE + } = asn1; + + new DATE({ + value: "ha" + }); + + const b = new DATE({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace TimeOfDay { + const { + TimeOfDay + } = asn1; + + new TimeOfDay({ + value: "ha" + }); + + const b = new TimeOfDay({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace DateTime { + const { + DateTime + } = asn1; + + new DateTime({ + value: "ha" + }); + + const b = new DateTime({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace Duration { + const { + Duration + } = asn1; + + new Duration({ + value: "ha" + }); + + const b = new Duration({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace TIME { + const { + TIME + } = asn1; + + new TIME({ + value: "ha" + }); + + const b = new TIME({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace Choice { + const { + Choice + } = asn1; + + new Choice({ + optional: true + }); + + const c = new Choice({ + value: [new asn1.Integer({ value: 10 })] + }); + + c.value[0].toBER(); + bool = c.optional; + } + + namespace Any { + const { + Any + } = asn1; + + const a = new Any({ + name: "A", + optional: true + }); + + str = a.name; + bool = a.optional; + } + + namespace Repeated { + const { + Repeated + } = asn1; + + new Repeated(); + new Repeated({ + local: true + }); + new Repeated({ + name: "a" + }); + new Repeated({ + optional: true + }); + const r = new Repeated({ + value: new asn1.Any() + }); + + str = r.name; + bool = r.optional; + str = r.value.name; + bool = r.value.optional; + bool = r.local; + } + + namespace RawData { + const { + RawData + } = asn1; + + const r = new RawData({ + data: new ArrayBuffer(10) + }); + arrBuf = r.data; + num = r.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = r.toBER(); + } + + namespace fromBER { + const r = asn1.fromBER(new ArrayBuffer(10)); + num = r.offset; + const { result } = r; + num = result.blockLength; + str = result.error; + { + const j = result.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = result.valueBeforeDecode; + str = result.warnings[0]; + } + + namespace compareSchema { + const res = asn1.compareSchema({}, {}, {}); + bool = res.verified; + res.result; + } + + namespace verifySchema { + const res = asn1.verifySchema(new ArrayBuffer(10), {}); + bool = res.verified; + res.result; + } +} diff --git a/types/adone/test/glosses/crypto/ed25519.ts b/types/adone/test/glosses/crypto/ed25519.ts new file mode 100644 index 0000000000..8c0326abf9 --- /dev/null +++ b/types/adone/test/glosses/crypto/ed25519.ts @@ -0,0 +1,28 @@ +namespace adoneTests.crypto.ed25519 { + const { + crypto: { + ed25519 + } + } = adone; + + let buf: Buffer; + let num: number; + let bool: boolean; + + num = ed25519.privateKeyLength; + num = ed25519.publicKeyLength; + + const pair = ed25519.generateKeyPair(Buffer.from("123")); + buf = pair.publicKey; + buf = pair.privateKey; + + buf = ed25519.sign(Buffer.from("hello"), Buffer.from("seed")); + buf = ed25519.sign(Buffer.from("hello"), { + publicKey: Buffer.from("hello"), + privateKey: Buffer.from("hello") + }); + + buf = ed25519.sign(Buffer.from("hello"), ed25519.generateKeyPair(Buffer.from("hello"))); + + bool = ed25519.verify(Buffer.from("hello"), Buffer.from("world"), Buffer.from("key")); +} diff --git a/types/adone/test/glosses/crypto/secp256k1.ts b/types/adone/test/glosses/crypto/secp256k1.ts new file mode 100644 index 0000000000..5f80b61537 --- /dev/null +++ b/types/adone/test/glosses/crypto/secp256k1.ts @@ -0,0 +1,97 @@ +namespace adoneTests.crypto.secp256k1 { + const { + crypto: { + secp256k1 + } + } = adone; + + let bool: boolean; + let buf: Buffer; + let num: number; + + const privateKey = Buffer.from("hello"); + const tweak = Buffer.from("world"); + const publicKey = Buffer.from("olleh"); + const signature = Buffer.from("dlrow"); + + bool = secp256k1.privateKeyVerify(privateKey); + + buf = secp256k1.privateKeyExport(privateKey); + buf = secp256k1.privateKeyExport(privateKey, true); + + buf = secp256k1.privateKeyImport(privateKey); + + buf = secp256k1.privateKeyNegate(privateKey); + + buf = secp256k1.privateKeyTweakAdd(privateKey, tweak); + + buf = secp256k1.privateKeyTweakMul(privateKey, tweak); + + buf = secp256k1.publicKeyConvert(publicKey); + buf = secp256k1.publicKeyConvert(publicKey, true); + + bool = secp256k1.publicKeyVerify(publicKey); + + buf = secp256k1.publicKeyTweakAdd(publicKey, tweak); + buf = secp256k1.publicKeyTweakAdd(publicKey, tweak, true); + + buf = secp256k1.publicKeyTweakMul(publicKey, tweak); + buf = secp256k1.publicKeyTweakMul(publicKey, tweak, true); + + buf = secp256k1.publicKeyCombine([publicKey, publicKey]); + buf = secp256k1.publicKeyCombine([publicKey, publicKey], true); + + buf = secp256k1.signatureNormalize(signature); + + buf = secp256k1.signatureExport(signature); + + buf = secp256k1.signatureImport(signature); + + buf = secp256k1.signatureImportLax(signature); + + const message = Buffer.from("msg"); + + { + const res = secp256k1.sign(message, privateKey); + buf = res.signature; + num = res.recovery; + } + { + const res = secp256k1.sign(message, privateKey, {}); + buf = res.signature; + num = res.recovery; + } + { + const res = secp256k1.sign(message, privateKey, { + data: null + }); + buf = res.signature; + num = res.recovery; + } + { + const res = secp256k1.sign(message, privateKey, { + data: Buffer.from("123") + }); + buf = res.signature; + num = res.recovery; + } + { + const res = secp256k1.sign(message, privateKey, { + noncefn(msg: Buffer, privateKey: Buffer, algo: Buffer, data: Buffer, attempt: number) { + return Buffer.from("hehe"); + } + }); + buf = res.signature; + num = res.recovery; + } + + bool = secp256k1.verify(message, signature, publicKey); + + buf = secp256k1.recover(message, signature, 1); + buf = secp256k1.recover(message, signature, 1, true); + + buf = secp256k1.ecdh(publicKey, privateKey); + + buf = secp256k1.ecdhUnsafe(publicKey, privateKey); + buf = secp256k1.ecdhUnsafe(publicKey, privateKey, true); +} diff --git a/types/adone/test/glosses/data.ts b/types/adone/test/glosses/data.ts index e8ccedddcc..00403a56da 100644 --- a/types/adone/test/glosses/data.ts +++ b/types/adone/test/glosses/data.ts @@ -11,6 +11,7 @@ namespace dataTests { { const a: Buffer = json.encode(1, { replacer: ["a", "b", "c"] }); } { const a: Buffer = json.encode(1, { replacer: (k: string, v: any) => null }); } { const a: Buffer = json.encode(1, { space: " " }); } + { const a: Buffer = json.encode(1, { newline: true }); } json.decode("123"); json.decode(Buffer.from("123")); @@ -52,6 +53,8 @@ namespace dataTests { mpak.decode(new Uint8Array(10)); mpak.decode(new ArrayBuffer(10)); + mpak.tryDecode(new adone.collection.ByteArray()); + new mpak.Encoder([]); new mpak.Encoder([{ type: 10, @@ -73,6 +76,9 @@ namespace dataTests { new mpak.Decoder([]).decode(new ArrayBuffer(10)); new mpak.Decoder([]).tryDecode(adone.collection.ByteArray.wrap("hello")); + new mpak.Serializer(); + new mpak.Serializer(100); + mpak.registerCommonTypesFor(new mpak.Serializer()); { const a: adone.data.mpak.Encoder = new mpak.Serializer().encoder; } { const a: adone.data.mpak.Decoder = new mpak.Serializer().decoder; } { const a: adone.data.mpak.Serializer = new mpak.Serializer().registerEncoder(10, (x) => true, (x) => new adone.collection.ByteArray(10)); } @@ -125,6 +131,7 @@ namespace dataTests { { const a: string = base64.decode("string", {}); } { const a: string = base64.decode("string", { buffer: false }); } { const a: Buffer = base64.decode("string", { buffer: true }); } + { const a: string = base64.decode("string", { encoding: "utf8" }); } { const a: string = base64.encodeVLQ(123); } { const a: number = base64.decodeVLQ("H"); } @@ -563,4 +570,277 @@ namespace dataTests { bson.decode(bson.encode({ a: 1 }), { promoteLongs: false }).a; bson.decode(bson.encode({ a: 1 }), { promoteValues: true }).a; } + + namespace protobuf { + const { + protobuf + } = data; + + protobuf.create("hello"); + protobuf.create(Buffer.from("hello")); + protobuf.create({}); + protobuf.create({}, {}); + + namespace schema { + const { + schema + } = protobuf; + + const s = schema.parse("hello"); + s.syntax; + s.package; + if (!adone.is.null(s.package)) { + const c: string = s.package; + } + s.imports[0].charCodeAt(100); + + namespace enums { + const [a] = s.enums; + a.name.charCodeAt(100); + a.values; + a.options; + } + + namespace message { + const [msg] = s.messages; + msg.name; + { + const [a] = msg.enums; + a.name; + a.options; + a.values; + } + { + const [a] = msg.extends; + a.name; + a.message; + } + { + const [a] = msg.messages; + a.name; + a.enums; + a.extends; + a.messages; + a.fields; + a.extensions; + } + { + const [a] = msg.fields; + if (!adone.is.null(a.name)) { + a.name.charCodeAt(100); + } + if (!adone.is.null(a.type)) { + a.type.charCodeAt(100); + } + a.tag === 3; + if (!adone.is.null(a.map)) { + a.map.from.charCodeAt(100); + a.map.to.charCodeAt(100); + } + if (!adone.is.null(a.oneof)) { + a.oneof.charCodeAt(100); + } + a.required === false; + a.repeated === true; + a.options; + } + if (!adone.is.null(msg.extensions)) { + msg.extensions.from === 2; + msg.extensions.to === 3; + } + } + + s.options; + + s.extends[0].message; + s.extends[0].name; + + if (!adone.is.nil(s.services)) { + const [svc] = s.services; + + svc.name.charCodeAt(100); + svc.options; + + const [m] = svc.methods; + + m.name.charCodeAt(100); + if (!adone.is.null(m.input_type)) { + m.input_type.charCodeAt(100); + } + if (!adone.is.null(m.output_type)) { + m.output_type.charCodeAt(100); + } + m.client_streaming === true; + m.server_streaming === true; + m.options; + } + } + } + + namespace base32 { + const { + base32 + } = data; + + base32.charmap("asd"); + base32.charmap("asd", {}); + + base32.rfc4648.alphabet.charCodeAt(0); + base32.rfc4648.charmap["X"] === 2; + + base32.crockford.alphabet.charCodeAt(0); + base32.crockford.charmap["X"] === 2; + + base32.base32hex.alphabet.charCodeAt(0); + base32.base32hex.charmap["X"] === 2; + + namespace decoder { + const { + Decoder + } = base32; + new Decoder(); + new Decoder({ + type: "base32hex" + }); + new Decoder({ + type: "crockford" + }); + new Decoder({ + type: "rfc4648" + }); + new Decoder({ + type: "rfc4648", + charmap: {} + }); + const d = new Decoder(); + d.write("asd").write("aa"); + { const a: Buffer = d.finalize(); } + { const a: Buffer = d.finalize("c"); } + } + + namespace encoder { + const { + Encoder + } = base32; + + new Encoder(); + new Encoder({ + type: "base32hex" + }); + new Encoder({ + type: "crockford" + }); + new Encoder({ + type: "rfc4648" + }); + new Encoder({ + type: "rfc4648", + alphabet: "a" + }); + + const e = new Encoder(); + e.write(Buffer.from("b")).write(Buffer.from("a")); + { const a: string = e.finalize(); } + { const a: string = e.finalize(Buffer.from("c")); } + } + + base32.encode(Buffer.from("hello")).charCodeAt(100); + base32.encode(Buffer.from("hello"), { + type: "rfc4648" + }).charCodeAt(100); + base32.encode(Buffer.from("hello"), { + type: "crockford" + }).charCodeAt(100); + base32.encode(Buffer.from("hello"), { + type: "base32hex" + }).charCodeAt(100); + base32.encode(Buffer.from("hello"), { + type: "base32hex", + alphabet: "asd" + }).charCodeAt(100); + + base32.decode("asd").writeUInt8(100, 0); + base32.decode("asd", { + type: "base32hex" + }).writeUInt8(100, 0); + base32.decode("asd", { + type: "crockford" + }).writeUInt8(100, 0); + base32.decode("asd", { + type: "rfc4648" + }).writeUInt8(100, 0); + base32.decode("asd", { + type: "rfc4648", + charmap: {} + }).writeUInt8(100, 0); + } + + namespace basex { + const { + basex + } = data; + + const d = basex("abc"); + const a: Buffer = d.decode("str"); + const b: string = d.encode(Buffer.from("hello")); + const c: Buffer = d.decodeUnsafe("hello"); + } + + namespace base58 { + const { + base58 + } = data; + + const a: Buffer = base58.decode("str"); + const b: string = base58.encode(Buffer.from("hello")); + const c: Buffer = base58.decodeUnsafe("hello"); + } + + namespace base64url { + const { + base64url + } = data; + + base64url.unescape("a").charCodeAt(100); + base64url.escape("a").charCodeAt(100); + + base64url.encode("a").charCodeAt(100); + base64url.encode(Buffer.from("a")).charCodeAt(100); + base64url.encode(Buffer.from("a"), {}).charCodeAt(100); + base64url.encode(Buffer.from("a"), { + encoding: "utf8" + }).charCodeAt(100); + + base64url.decode("a").charCodeAt(100); + base64url.decode("a", { buffer: true }).writeUInt8(0, 0); + base64url.decode("a", { encoding: "utf8" }).charCodeAt(100); + } + + namespace varint { + const { + varint + } = data; + + varint.encode(12)[0]; + varint.encode(12, [])[0]; + varint.encode(12, [], 1)[0]; + + varint.decode(Buffer.from("hello")) === 5; + varint.decode(Buffer.from("hello"), 2) === 5; + varint.encodingLength(100500) === 5; + } + + namespace varintSigned { + const { + varintSigned + } = data; + + varintSigned.encode(12)[0]; + varintSigned.encode(12, [])[0]; + varintSigned.encode(12, [], 1)[0]; + + varintSigned.decode(Buffer.from("hello")) === 5; + varintSigned.decode(Buffer.from("hello"), 2) === 5; + varintSigned.encodingLength(100500) === 5; + } } diff --git a/types/adone/test/glosses/errors.ts b/types/adone/test/glosses/errors.ts new file mode 100644 index 0000000000..d84a267b07 --- /dev/null +++ b/types/adone/test/glosses/errors.ts @@ -0,0 +1,36 @@ +namespace ErrorsTests { + { const a: Error = new adone.error.Exception(); } + { const a: Error = new adone.error.Exception("message"); } + { const a: Error = new adone.error.Exception(new Error()); } + { const a: Error = new adone.error.Exception(new Error(), true); } + { const a: adone.error.Exception = new adone.error.Runtime(); } + { const a: adone.error.Exception = new adone.error.IncompleteBufferError(); } + { const a: adone.error.Exception = new adone.error.NotImplemented(); } + { const a: adone.error.Exception = new adone.error.IllegalState(); } + { const a: adone.error.Exception = new adone.error.NotValid(); } + { const a: adone.error.Exception = new adone.error.Unknown(); } + { const a: adone.error.Exception = new adone.error.NotExists(); } + { const a: adone.error.Exception = new adone.error.Exists(); } + { const a: adone.error.Exception = new adone.error.Empty(); } + { const a: adone.error.Exception = new adone.error.InvalidAccess(); } + { const a: adone.error.Exception = new adone.error.NotSupported(); } + { const a: adone.error.Exception = new adone.error.InvalidArgument(); } + { const a: adone.error.Exception = new adone.error.InvalidNumberOfArguments(); } + { const a: adone.error.Exception = new adone.error.NotFound(); } + { const a: adone.error.Exception = new adone.error.Timeout(); } + { const a: adone.error.Exception = new adone.error.Incorrect(); } + { const a: adone.error.Exception = new adone.error.NotAllowed(); } + { const a: adone.error.Exception = new adone.error.LimitExceeded(); } + { const a: adone.error.Exception = new adone.error.Encoding(); } + { const a: adone.error.Exception = new adone.error.Network(); } + { const a: adone.error.Exception = new adone.error.Bind(); } + { const a: adone.error.Exception = new adone.error.Connect(); } + { const a: adone.error.Exception = new adone.error.Database(); } + { const a: adone.error.Exception = new adone.error.DatabaseInitialization(); } + { const a: adone.error.Exception = new adone.error.DatabaseOpen(); } + { const a: adone.error.Exception = new adone.error.DatabaseRead(); } + { const a: adone.error.Exception = new adone.error.DatabaseWrite(); } + { const a: adone.error.Exception = new adone.error.NetronIllegalState(); } + { const a: adone.error.Exception = new adone.error.NetronPeerDisconnected(); } + { const a: adone.error.Exception = new adone.error.NetronTimeout(); } +} diff --git a/types/adone/test/glosses/events.ts b/types/adone/test/glosses/events.ts index 7f31089b52..448867951e 100644 --- a/types/adone/test/glosses/events.ts +++ b/types/adone/test/glosses/events.ts @@ -1,76 +1,86 @@ namespace eventsTests { namespace EventEmitter { namespace static { - const a: number = adone.event.EventEmitter.listenerCount(new adone.event.EventEmitter(), "event"); - const b: number = adone.event.EventEmitter.defaultMaxListeners; + const a: number = adone.event.Emitter.listenerCount(new adone.event.Emitter(), "event"); + const b: number = adone.event.Emitter.defaultMaxListeners; } namespace addListener { - const a: adone.event.EventEmitter = new adone.event.EventEmitter().addListener("event", () => { }); - const b: adone.event.EventEmitter = new adone.event.EventEmitter().addListener(Symbol("event"), () => { }); + const a: adone.event.Emitter = new adone.event.Emitter().addListener("event", () => { }); + const b: adone.event.Emitter = new adone.event.Emitter().addListener(Symbol("event"), () => { }); } namespace on { - const a: adone.event.EventEmitter = new adone.event.EventEmitter().on("event", () => { }); - const b: adone.event.EventEmitter = new adone.event.EventEmitter().on(Symbol("event"), () => { }); + const a: adone.event.Emitter = new adone.event.Emitter().on("event", () => { }); + const b: adone.event.Emitter = new adone.event.Emitter().on(Symbol("event"), () => { }); } namespace once { - const a: adone.event.EventEmitter = new adone.event.EventEmitter().once("event", () => { }); - const b: adone.event.EventEmitter = new adone.event.EventEmitter().once(Symbol("event"), () => { }); + const a: adone.event.Emitter = new adone.event.Emitter().once("event", () => { }); + const b: adone.event.Emitter = new adone.event.Emitter().once(Symbol("event"), () => { }); } namespace prependListener { - const a: adone.event.EventEmitter = new adone.event.EventEmitter().prependListener("event", () => { }); - const b: adone.event.EventEmitter = new adone.event.EventEmitter().prependListener(Symbol("event"), () => { }); + const a: adone.event.Emitter = new adone.event.Emitter().prependListener("event", () => { }); + const b: adone.event.Emitter = new adone.event.Emitter().prependListener(Symbol("event"), () => { }); } namespace prependOnceListener { - const a: adone.event.EventEmitter = new adone.event.EventEmitter().prependOnceListener("event", () => { }); - const b: adone.event.EventEmitter = new adone.event.EventEmitter().prependOnceListener(Symbol("event"), () => { }); + const a: adone.event.Emitter = new adone.event.Emitter().prependOnceListener("event", () => { }); + const b: adone.event.Emitter = new adone.event.Emitter().prependOnceListener(Symbol("event"), () => { }); } namespace removeListener { - const a: adone.event.EventEmitter = new adone.event.EventEmitter().removeListener("event", () => { }); - const b: adone.event.EventEmitter = new adone.event.EventEmitter().removeListener(Symbol("event"), () => { }); + const a: adone.event.Emitter = new adone.event.Emitter().removeListener("event", () => { }); + const b: adone.event.Emitter = new adone.event.Emitter().removeListener(Symbol("event"), () => { }); } namespace removeAllListeners { - const a: adone.event.EventEmitter = new adone.event.EventEmitter().removeAllListeners("event"); - const b: adone.event.EventEmitter = new adone.event.EventEmitter().removeAllListeners(Symbol("event")); + const a: adone.event.Emitter = new adone.event.Emitter().removeAllListeners("event"); + const b: adone.event.Emitter = new adone.event.Emitter().removeAllListeners(Symbol("event")); } namespace setMaxListeners { - const a: adone.event.EventEmitter = new adone.event.EventEmitter().setMaxListeners(10); + const a: adone.event.Emitter = new adone.event.Emitter().setMaxListeners(10); } namespace getMaxListeners { - const a: number = new adone.event.EventEmitter().getMaxListeners(); + const a: number = new adone.event.Emitter().getMaxListeners(); } namespace listeners { - const a: Array<(...args: any[]) => any> = new adone.event.EventEmitter().listeners("event"); - const b: Array<(...args: any[]) => any> = new adone.event.EventEmitter().listeners(Symbol("event")); + const a: Array<(...args: any[]) => any> = new adone.event.Emitter().listeners("event"); + const b: Array<(...args: any[]) => any> = new adone.event.Emitter().listeners(Symbol("event")); } namespace emit { - const a: boolean = new adone.event.EventEmitter().emit("event", 1, 2, 3); - const b: boolean = new adone.event.EventEmitter().emit(Symbol("event"), 1, 2, 3); + const a: boolean = new adone.event.Emitter().emit("event", 1, 2, 3); + const b: boolean = new adone.event.Emitter().emit(Symbol("event"), 1, 2, 3); } namespace eventNames { - const a: Array = new adone.event.EventEmitter().eventNames(); - const b: Array = new adone.event.EventEmitter().eventNames(); + const a: Array = new adone.event.Emitter().eventNames(); + const b: Array = new adone.event.Emitter().eventNames(); } namespace listenerCount { - const a: number = new adone.event.EventEmitter().listenerCount("event"); - const b: number = new adone.event.EventEmitter().listenerCount(Symbol("event")); + const a: number = new adone.event.Emitter().listenerCount("event"); + const b: number = new adone.event.Emitter().listenerCount(Symbol("event")); + } + + namespace propagateEvents { + const e = new adone.event.Emitter().propagateEvents(new adone.event.Emitter(), ["a"]); + e.end(); + } + + namespace staticPropagateEvents { + const e = adone.event.Emitter.propagateEvents(new adone.event.Emitter(), new adone.event.Emitter(), ["a"]); + e.end(); } } namespace AsyncEmitter { - const a: adone.event.EventEmitter = new adone.event.AsyncEmitter(); + const a: adone.event.Emitter = new adone.event.AsyncEmitter(); new adone.event.AsyncEmitter(10); namespace setConcurrency { diff --git a/types/adone/test/glosses/exceptions.ts b/types/adone/test/glosses/exceptions.ts deleted file mode 100644 index e13dc3fff7..0000000000 --- a/types/adone/test/glosses/exceptions.ts +++ /dev/null @@ -1,36 +0,0 @@ -namespace ExcetpionsTests { - { const a: Error = new adone.x.Exception(); } - { const a: Error = new adone.x.Exception("message"); } - { const a: Error = new adone.x.Exception(new Error()); } - { const a: Error = new adone.x.Exception(new Error(), true); } - { const a: adone.x.Exception = new adone.x.Runtime(); } - { const a: adone.x.Exception = new adone.x.IncompleteBufferError(); } - { const a: adone.x.Exception = new adone.x.NotImplemented(); } - { const a: adone.x.Exception = new adone.x.IllegalState(); } - { const a: adone.x.Exception = new adone.x.NotValid(); } - { const a: adone.x.Exception = new adone.x.Unknown(); } - { const a: adone.x.Exception = new adone.x.NotExists(); } - { const a: adone.x.Exception = new adone.x.Exists(); } - { const a: adone.x.Exception = new adone.x.Empty(); } - { const a: adone.x.Exception = new adone.x.InvalidAccess(); } - { const a: adone.x.Exception = new adone.x.NotSupported(); } - { const a: adone.x.Exception = new adone.x.InvalidArgument(); } - { const a: adone.x.Exception = new adone.x.InvalidNumberOfArguments(); } - { const a: adone.x.Exception = new adone.x.NotFound(); } - { const a: adone.x.Exception = new adone.x.Timeout(); } - { const a: adone.x.Exception = new adone.x.Incorrect(); } - { const a: adone.x.Exception = new adone.x.NotAllowed(); } - { const a: adone.x.Exception = new adone.x.LimitExceeded(); } - { const a: adone.x.Exception = new adone.x.Encoding(); } - { const a: adone.x.Exception = new adone.x.Network(); } - { const a: adone.x.Exception = new adone.x.Bind(); } - { const a: adone.x.Exception = new adone.x.Connect(); } - { const a: adone.x.Exception = new adone.x.Database(); } - { const a: adone.x.Exception = new adone.x.DatabaseInitialization(); } - { const a: adone.x.Exception = new adone.x.DatabaseOpen(); } - { const a: adone.x.Exception = new adone.x.DatabaseRead(); } - { const a: adone.x.Exception = new adone.x.DatabaseWrite(); } - { const a: adone.x.Exception = new adone.x.NetronIllegalState(); } - { const a: adone.x.Exception = new adone.x.NetronPeerDisconnected(); } - { const a: adone.x.Exception = new adone.x.NetronTimeout(); } -} diff --git a/types/adone/test/glosses/fake.ts b/types/adone/test/glosses/fake.ts new file mode 100644 index 0000000000..016d7ba7b0 --- /dev/null +++ b/types/adone/test/glosses/fake.ts @@ -0,0 +1,206 @@ +namespace adoneTests.fake { + const { + fake + } = adone; + + { const a: string = fake.address.zipCode(); } + { const a: string = fake.address.zipCode('###'); } + { const a: string = fake.address.city(); } + { const a: string = fake.address.city(0); } + { const a: string = fake.address.cityPrefix(); } + { const a: string = fake.address.citySuffix(); } + { const a: string = fake.address.streetName(); } + { const a: string = fake.address.streetAddress(); } + { const a: string = fake.address.streetAddress(false); } + { const a: string = fake.address.streetSuffix(); } + { const a: string = fake.address.streetPrefix(); } + { const a: string = fake.address.secondaryAddress(); } + { const a: string = fake.address.county(); } + { const a: string = fake.address.country(); } + { const a: string = fake.address.countryCode(); } + { const a: string = fake.address.state(); } + { const a: string = fake.address.state(false); } + { const a: string = fake.address.stateAbbr(); } + { const a: string = fake.address.latitude(); } + { const a: string = fake.address.longitude(); } + + { const a: string = fake.commerce.color(); } + { const a: string = fake.commerce.department(); } + { const a: string = fake.commerce.productName(); } + { const a: string = fake.commerce.price(); } + { const a: string = fake.commerce.price(0, 0, 0, '#'); } + { const a: string = fake.commerce.productAdjective(); } + { const a: string = fake.commerce.productMaterial(); } + { const a: string = fake.commerce.product(); } + + { const a: string[] = fake.company.suffixes(); } + { const a: string = fake.company.companyName(); } + { const a: string = fake.company.companyName(0); } + { const a: string = fake.company.companySuffix(); } + { const a: string = fake.company.catchPhrase(); } + { const a: string = fake.company.bs(); } + { const a: string = fake.company.catchPhraseAdjective(); } + { const a: string = fake.company.catchPhraseDescriptor(); } + { const a: string = fake.company.catchPhraseNoun(); } + { const a: string = fake.company.bsAdjective(); } + { const a: string = fake.company.bsBuzz(); } + { const a: string = fake.company.bsNoun(); } + + { const a: string = fake.database.column(); } + { const a: string = fake.database.type(); } + { const a: string = fake.database.collation(); } + { const a: string = fake.database.engine(); } + + { const a: Date = fake.date.past(); } + { const a: Date = fake.date.future(); } + { const a: Date = fake.date.between('foo', 'bar'); } + { const a: Date = fake.date.between(new Date(), new Date()); } + { const a: Date = fake.date.recent(); } + { const a: Date = fake.date.recent(100); } + { const a: Date = fake.date.soon(); } + { const a: Date = fake.date.soon(30); } + { const a: string = fake.date.month(); } + { const a: string = fake.date.month({ + abbr: true, + context: true + }); } + { const a: string = fake.date.weekday(); } + { const a: string = fake.date.weekday({ + abbr: true, + context: true + }); } + + { const a: string = fake.finance.account(); } + { const a: string = fake.finance.account(0); } + { const a: string = fake.finance.accountName(); } + { const a: string = fake.finance.mask(); } + { const a: string = fake.finance.mask(0, false, false); } + { const a: string = fake.finance.amount(); } + { const a: string = fake.finance.amount(0, 0, 0, '#'); } + { const a: string = fake.finance.transactionType(); } + { const a: string = fake.finance.currencyCode(); } + { const a: string = fake.finance.currencyName(); } + { const a: string = fake.finance.currencySymbol(); } + { const a: string = fake.finance.bitcoinAddress(); } + { const a: string = fake.finance.ethereumAddress(); } + { const a: string = fake.finance.iban(); } + { const a: string = fake.finance.iban(true); } + { const a: string = fake.finance.bic(); } + + { const a: string = fake.hacker.abbreviation(); } + { const a: string = fake.hacker.adjective(); } + { const a: string = fake.hacker.noun(); } + { const a: string = fake.hacker.verb(); } + { const a: string = fake.hacker.ingverb(); } + { const a: string = fake.hacker.phrase(); } + + { const a: string = fake.helpers.randomize(); } + { const a: number = fake.helpers.randomize([1, 2, 3, 4]); } + { const a: string = fake.helpers.randomize(['foo', 'bar', 'quux']); } + { const a: string = fake.helpers.slugify('foo bar quux'); } + { const a: string = fake.helpers.replaceSymbolWithNumber('foo# bar#'); } + { const a: string = fake.helpers.replaceSymbols('foo# bar? quux#'); } + { const a: string[] = fake.helpers.shuffle(['foo', 'bar', 'quux']); } + { const a: string = fake.helpers.mustache('{{foo}}{{bar}}', {foo: 'x', bar: 'y'}); } + + const card = fake.helpers.createCard(); + { const a: string = card.name; } + { const a: string = card.address.streetA; } + const contextualCard = fake.helpers.contextualCard(); + { const a: string = contextualCard.name; } + { const a: string = contextualCard.address.suite; } + const userCard = fake.helpers.userCard(); + { const a: string = userCard.name; } + { const a: string = userCard.address.suite; } + + { const a: string = fake.internet.avatar(); } + { const a: string = fake.internet.email(); } + { const a: string = fake.internet.email('foo', 'bar', 'quux'); } + { const a: string = fake.internet.exampleEmail(); } + { const a: string = fake.internet.exampleEmail('foo', 'bar'); } + { const a: string = fake.internet.protocol(); } + { const a: string = fake.internet.url(); } + { const a: string = fake.internet.domainName(); } + { const a: string = fake.internet.domainSuffix(); } + { const a: string = fake.internet.domainWord(); } + { const a: string = fake.internet.ip(); } + { const a: string = fake.internet.userAgent(); } + { const a: string = fake.internet.color(); } + { const a: string = fake.internet.color(0, 0, 0); } + { const a: string = fake.internet.mac(); } + { const a: string = fake.internet.password(); } + { const a: string = fake.internet.password(0, false, '#', 'foo'); } + + { const a: string = fake.lorem.word(); } + { const a: string = fake.lorem.words(); } + { const a: string = fake.lorem.words(0); } + { const a: string = fake.lorem.sentence(); } + { const a: string = fake.lorem.sentence(0, 0); } + { const a: string = fake.lorem.slug(); } + { const a: string = fake.lorem.slug(0); } + { const a: string = fake.lorem.sentences(); } + { const a: string = fake.lorem.sentences(0); } + { const a: string = fake.lorem.paragraph(); } + { const a: string = fake.lorem.paragraph(0); } + { const a: string = fake.lorem.paragraphs(); } + { const a: string = fake.lorem.paragraphs(0, ''); } + { const a: string = fake.lorem.text(); } + { const a: string = fake.lorem.text(0); } + { const a: string = fake.lorem.lines(); } + { const a: string = fake.lorem.lines(0); } + + { const a: string = fake.name.firstName(); } + { const a: string = fake.name.firstName(0); } + { const a: string = fake.name.lastName(); } + { const a: string = fake.name.lastName(0); } + { const a: string = fake.name.findName(); } + { const a: string = fake.name.findName('', '', 0); } + { const a: string = fake.name.jobTitle(); } + { const a: string = fake.name.prefix(); } + { const a: string = fake.name.suffix(); } + { const a: string = fake.name.title(); } + { const a: string = fake.name.jobDescriptor(); } + { const a: string = fake.name.jobArea(); } + { const a: string = fake.name.jobType(); } + + { const a: string = fake.phone.phoneNumber(); } + { const a: string = fake.phone.phoneNumber('#'); } + { const a: string = fake.phone.phoneNumberFormat(); } + { const a: string = fake.phone.phoneNumberFormat(0); } + { const a: string = fake.phone.phoneFormats(); } + + { const a: number = fake.random.number(); } + { const a: number = fake.random.number(0); } + { const a: number = fake.random.number({ + min: 0, + max: 0, + precision: 0 + }); } + { const a: string = fake.random.arrayElement(); } + { const a: string = fake.random.arrayElement(['foo', 'bar', 'quux']); } + { const a: string = fake.random.objectElement(); } + { const a: string = fake.random.objectElement({foo: 'bar', field: 'foo'}); } + { const a: string = fake.random.uuid(); } + { const a: boolean = fake.random.boolean(); } + { const a: string = fake.random.word(); } + { const a: string = fake.random.word("noun"); } + { const a: string = fake.random.words(); } + { const a: string = fake.random.words(0); } + { const a: string = fake.random.image(); } + { const a: string = fake.random.locale(); } + { const a: string = fake.random.alphaNumeric(); } + { const a: string = fake.random.alphaNumeric(0); } + { const a: string = fake.random.hexaDecimal(); } + { const a: string = fake.random.hexaDecimal(3); } + + { const a: string = fake.system.fileName("foo", "bar"); } + { const a: string = fake.system.commonFileName("foo", "bar"); } + { const a: string = fake.system.mimeType(); } + { const a: string = fake.system.commonFileType(); } + { const a: string = fake.system.commonFileExt(); } + { const a: string = fake.system.fileType(); } + { const a: string = fake.system.fileExt("foo"); } + { const a: string = fake.system.directoryPath(); } + { const a: string = fake.system.filePath(); } + { const a: string = fake.system.semver(); } +} diff --git a/types/adone/test/glosses/fs.ts b/types/adone/test/glosses/fs.ts index 8b7e765c9f..e7c5333624 100644 --- a/types/adone/test/glosses/fs.ts +++ b/types/adone/test/glosses/fs.ts @@ -11,6 +11,15 @@ namespace fsTests { fs.readlink("file", null).then((x: Buffer) => x); fs.readlink("file", "hex").then((x: string) => x); fs.readlink("file").then((x: string) => x); + fs.readlinkSync("file"); + fs.readlinkSync(Buffer.from("file")); + fs.readlinkSync(new URL("file://file")); + { const a: string = fs.readlinkSync("file", {}); } + { const a: string = fs.readlinkSync("file", { encoding: "utf8" }); } + { const a: Buffer = fs.readlinkSync("file", { encoding: null }); } + { const a: Buffer = fs.readlinkSync("file", null); } + { const a: string = fs.readlinkSync("file", "hex"); } + { const a: string = fs.readlinkSync("file"); } } namespace unlinkTests { @@ -22,6 +31,24 @@ namespace fsTests { fs.unlinkSync(new URL("file://file")); } + namespace utimesTests { + fs.utimes("hello", 100, 100).then(() => {}); + fs.utimes(Buffer.from("hello"), 100, 100).then(() => {}); + fs.utimes(new URL("hello"), 100, 100).then(() => {}); + fs.utimes("hello", "100", "100").then(() => {}); + fs.utimes("hello", new Date(100), new Date(100)).then(() => {}); + + fs.utimesSync("hello", 100, 100); + fs.utimesSync(Buffer.from("hello"), 100, 100); + fs.utimesSync(new URL("hello"), 100, 100); + fs.utimesSync("hello", "100", "100"); + fs.utimesSync("hello", new Date(100), new Date(100)); + + fs.utimesMillis("hello", 100, 100); + fs.utimesMillis(Buffer.from("hello"), 100, 100); + fs.utimesMillis(new URL("hello"), 100, 100); + } + namespace chmodTests { fs.chmod("file", 0o333).then(() => {}); fs.chmod(Buffer.from("file"), 0o333).then(() => {}); @@ -60,6 +87,87 @@ namespace fsTests { const e: Buffer[] = fs.readdirSync("file", { encoding: null }); } + namespace readdirpTests { + fs.readdirp("hello").forEach((entry) => { + { const a: string = entry.fullParentDir; } + { const a: string = entry.fullPath; } + { const a: string = entry.name; } + { const a: string = entry.parentDir; } + { const a: string = entry.path; } + { const a: adone.fs.I.Stats = entry.stat; } + }); + + fs.readdirp(Buffer.from("hello")); + fs.readdirp(new URL("hello")); + fs.readdirp("hello", {}); + fs.readdirp("hello", { depth: 100 }); + fs.readdirp("hello", { directories: true }); + fs.readdirp("hello", { directoryFilter: () => true }); + fs.readdirp("hello", { + directoryFilter: (entry) => { + { const a: string = entry.fullParentDir; } + { const a: string = entry.fullPath; } + { const a: string = entry.name; } + { const a: string = entry.parentDir; } + { const a: string = entry.path; } + { const a: adone.fs.I.Stats = entry.stat; } + return true; + } + }); + fs.readdirp("hello", { + directoryFilter: [(entry) => { + { const a: string = entry.fullParentDir; } + { const a: string = entry.fullPath; } + { const a: string = entry.name; } + { const a: string = entry.parentDir; } + { const a: string = entry.path; } + { const a: adone.fs.I.Stats = entry.stat; } + return true; + }] + }); + fs.readdirp("hello", { + directoryFilter: ["*"] + }); + fs.readdirp("hello", { + directoryFilter: "*" + }); + fs.readdirp("hello", { fileFilter: () => true }); + fs.readdirp("hello", { + fileFilter: (entry) => { + { const a: string = entry.fullParentDir; } + { const a: string = entry.fullPath; } + { const a: string = entry.name; } + { const a: string = entry.parentDir; } + { const a: string = entry.path; } + { const a: adone.fs.I.Stats = entry.stat; } + return true; + } + }); + fs.readdirp("hello", { + fileFilter: [(entry) => { + { const a: string = entry.fullParentDir; } + { const a: string = entry.fullPath; } + { const a: string = entry.name; } + { const a: string = entry.parentDir; } + { const a: string = entry.path; } + { const a: adone.fs.I.Stats = entry.stat; } + return true; + }] + }); + fs.readdirp("hello", { + fileFilter: ["*"] + }); + fs.readdirp("hello", { + fileFilter: "*" + }); + fs.readdirp("hello", { + files: false + }); + fs.readdirp("hello", { + lstat: true + }); + } + namespace lstatTests { fs.lstat("file").then((x: nodestd.fs.Stats) => {}); fs.lstat(Buffer.from("file")).then((x: nodestd.fs.Stats) => {}); @@ -119,6 +227,15 @@ namespace fsTests { fs.appendFile("file", "hello", { encoding: "utf8" }).then(() => {}); fs.appendFile("file", "hello", { mode: 0o755 }).then(() => {}); fs.appendFile("file", "hello", { flag: "w" }).then(() => {}); + + fs.appendFileSync("file", "hello"); + fs.appendFileSync(Buffer.from("file"), "hello"); + fs.appendFileSync(10, "hello"); + fs.appendFileSync("file", Buffer.from("hello")); + fs.appendFileSync("file", "hello", {}); + fs.appendFileSync("file", "hello", { encoding: "utf8" }); + fs.appendFileSync("file", "hello", { mode: 0o755 }); + fs.appendFileSync("file", "hello", { flag: "w" }); } namespace accessTests { @@ -153,6 +270,12 @@ namespace fsTests { fs.rm("file", { cwd: __dirname }).then((x) => {}); } + namespace rmEmptyTests { + fs.rmEmpty("file").then(() => {}); + fs.rmEmpty("file", { cwd: "a" }).then(() => {}); + fs.rmEmpty("file", { filter: (filename) => filename.charCodeAt(0) === 100 }).then(() => {}); + } + namespace ModeTests { const stat = fs.statSync("file"); const mode = new fs.Mode(stat); @@ -513,37 +636,36 @@ namespace fsTests { } namespace fdTests { - const { fd } = fs; - fd.open("hello", "r+").then((x: number) => {}); - fd.open(Buffer.from("hello"), "r+").then((x: number) => {}); - fd.open(new URL("file://hello"), "r+").then((x: number) => {}); - { const a: number = fd.openSync("hello", "r+"); } - { const a: number = fd.openSync(Buffer.from("hello"), "r+"); } - { const a: number = fd.openSync(new URL("file://hello"), "r+"); } - fd.close(10).then(() => {}); - fd.closeSync(10); - fd.utimes(10, 100500, 100500).then(() => {}); - fd.utimesSync(10, 100500, 100500); - fd.stat(10).then((x: adone.fs.I.Stats) => {}); - { const a: adone.fs.I.Stats = fd.statSync(10); } - fd.truncate(10).then(() => {}); - fd.truncate(10, 10).then(() => {}); - fd.truncateSync(10); - fd.truncateSync(10, 10); - fd.read(10, Buffer.alloc(10), 0, 10, 10).then((x: number) => {}); - { const a: number = fd.readSync(10, Buffer.alloc(10), 0, 10, 10); } - fd.write(10, Buffer.alloc(10), 0, 10, 10).then((x: number) => {}); - { const a: number = fd.writeSync(10, Buffer.alloc(10), 0, 10, 10); } - fd.write(10, "hello", 10, "utf8").then((x: number) => {}); - { const a: number = fd.writeSync(10, "hello", 10, "utf8"); } - fd.sync(10).then(() => {}); - fd.syncSync(10); - fd.chown(10, 0, 0).then(() => {}); - fd.chownSync(10, 0, 0); - fd.chmod(10, 0o755).then(() => {}); - fd.chmodSync(10, 0o755); - fd.seek(10, 100, 0).then((x: number) => {}); - fd.lock(10, "sh").then(() => {}); + fs.open("hello", "r+").then((x: number) => {}); + fs.open(Buffer.from("hello"), "r+").then((x: number) => {}); + fs.open(new URL("file://hello"), "r+").then((x: number) => {}); + { const a: number = fs.openSync("hello", "r+"); } + { const a: number = fs.openSync(Buffer.from("hello"), "r+"); } + { const a: number = fs.openSync(new URL("file://hello"), "r+"); } + fs.close(10).then(() => {}); + fs.closeSync(10); + fs.futimes(10, 100500, 100500).then(() => {}); + fs.futimesSync(10, 100500, 100500); + fs.fstat(10).then((x: adone.fs.I.Stats) => {}); + { const a: adone.fs.I.Stats = fs.fstatSync(10); } + fs.ftruncate(10).then(() => {}); + fs.ftruncate(10, 10).then(() => {}); + fs.ftruncateSync(10); + fs.ftruncateSync(10, 10); + fs.read(10, Buffer.alloc(10), 0, 10, 10).then((x: number) => {}); + { const a: number = fs.readSync(10, Buffer.alloc(10), 0, 10, 10); } + fs.write(10, Buffer.alloc(10), 0, 10, 10).then((x: number) => {}); + { const a: number = fs.writeSync(10, Buffer.alloc(10), 0, 10, 10); } + fs.write(10, "hello", 10, "utf8").then((x: number) => {}); + { const a: number = fs.writeSync(10, "hello", 10, "utf8"); } + fs.fsync(10).then(() => {}); + fs.fsyncSync(10); + fs.fchown(10, 0, 0).then(() => {}); + fs.fchownSync(10, 0, 0); + fs.fchmod(10, 0o755).then(() => {}); + fs.fchmodSync(10, 0o755); + fs.seek(10, 100, 0).then((x: number) => {}); + fs.flock(10, "sh").then(() => {}); } namespace constantsTests { @@ -668,13 +790,44 @@ namespace fsTests { namespace mkdirTests { fs.mkdir("/path/to/some/dir").then(() => {}); fs.mkdir("/path/to/some/dir", 0o755).then(() => {}); + + fs.mkdirSync("/path/to/some/dir").then(() => {}); + fs.mkdirSync("/path/to/some/dir", 0o755).then(() => {}); + } + + namespace mkdirTests { + fs.mkdirp("/path/to/some/dir").then(() => {}); + fs.mkdirp("/path/to/some/dir", 0o755).then(() => {}); + + fs.mkdirpSync("/path/to/some/dir").then(() => {}); + fs.mkdirpSync("/path/to/some/dir", 0o755).then(() => {}); } namespace copyTests { fs.copy("a", "b").then(() => {}); - fs.copy("a", "b", {}).then(() => {}); - fs.copy("a", "b", { cwd: "/tmp" }).then(() => {}); - fs.copy("a", "b", { ignoreExisting: true }).then(() => {}); + fs.copy("a", "b", {}); + fs.copy("a", "b", { clobber: true }).then(() => {}); + fs.copy("a", "b", { overwrite: true }).then(() => {}); + fs.copy("a", "b", { filter: /asd/ }).then(() => {}); + fs.copy("a", "b", { filter: () => true }).then(() => {}); + fs.copy("a", "b", { filter: (a) => a.charCodeAt(0) === 100 }).then(() => {}); + fs.copy("a", "b", { + transform(r, w, file) { + file.atime.getDay(); + file.mtime.getDay(); + file.mode.toExponential(); + file.name.charCodeAt(0); + file.stats.atimeMs.toExponential(); + r.pipe(w); + } + }).then(() => {}); + } + + namespace copyTests { + fs.copyTo("a", "b").then(() => {}); + fs.copyTo("a", "b", {}); + fs.copyTo("a", "b", { cwd: "/tmp" }).then(() => {}); + fs.copyTo("a", "b", { ignoreExisting: true }).then(() => {}); } namespace renameTests { @@ -689,6 +842,7 @@ namespace fsTests { fs.tail("file", 10, {}).then((x: Buffer[]) => {}); fs.tail("file", 10, { separator: "\n" }).then((x: Buffer[]) => {}); fs.tail("file", 10, { chunkLength: 4096 }).then((x: Buffer[]) => {}); + fs.tail("file", 10, { pos: 10 }).then((x: Buffer[]) => {}); } namespace statVFSTests { diff --git a/types/adone/test/glosses/is.ts b/types/adone/test/glosses/is.ts index 2734824822..045818f0ec 100644 --- a/types/adone/test/glosses/is.ts +++ b/types/adone/test/glosses/is.ts @@ -1,115 +1,493 @@ namespace isTests { - { const a: boolean = adone.is.null({}); } - { const a: boolean = adone.is.undefined({}); } - { const a: boolean = adone.is.exist({}); } - { const a: boolean = adone.is.nil({}); } - { const a: boolean = adone.is.number({}); } - { const a: boolean = adone.is.numeral({}); } - { const a: boolean = adone.is.infinite({}); } - { const a: boolean = adone.is.odd({}); } - { const a: boolean = adone.is.even({}); } - { const a: boolean = adone.is.float({}); } - { const a: boolean = adone.is.negativeZero({}); } - { const a: boolean = adone.is.string({}); } - { const a: boolean = adone.is.emptyString({}); } - { const a: boolean = adone.is.substring("abc", "abcdef"); } - { const a: boolean = adone.is.substring("abc", "abcdef", 0); } - { const a: boolean = adone.is.prefix("abc", "abcdef"); } - { const a: boolean = adone.is.suffix("def", "abbdef"); } - { const a: boolean = adone.is.boolean({}); } - { const a: boolean = adone.is.json({}); } - { const a: boolean = adone.is.object({}); } - { const a: boolean = adone.is.plainObject({}); } - { const a: boolean = adone.is.class({}); } - { const a: boolean = adone.is.emptyObject({}); } - { const a: boolean = adone.is.propertyOwned({}, "a"); } - { const a: boolean = adone.is.propertyDefined({}, "a"); } - { const a: boolean = adone.is.conforms({}, {}); } - { const a: boolean = adone.is.conforms({}, {}, true); } - { const a: boolean = adone.is.arrayLikeObject({}); } - { const a: boolean = adone.is.inArray(1, [1, 2, 3]); } - { const a: boolean = adone.is.inArray(1, [1, 2, 3], 0); } - { const a: boolean = adone.is.inArray(1, [1, 2, 3], 0, (a, b) => a === b); } - { const a: boolean = adone.is.sameType({}, {}); } - { const a: boolean = adone.is.primitive({}); } - { const a: boolean = adone.is.equalArrays([], []); } - { const a: boolean = adone.is.deepEqual({}, {}); } - { const a: boolean = adone.is.shallowEqual({}, {}); } - { const a: boolean = adone.is.stream({}); } - { const a: boolean = adone.is.writableStream({}); } - { const a: boolean = adone.is.readableStream({}); } - { const a: boolean = adone.is.duplexStream({}); } - { const a: boolean = adone.is.transformStream({}); } - { const a: boolean = adone.is.utf8(Buffer.alloc(10)); } - { const a: boolean = adone.is.win32PathAbsolute("abc"); } - { const a: boolean = adone.is.posixPathAbsolute("abc"); } - { const a: boolean = adone.is.pathAbsolute("abc"); } - { const a: boolean = adone.is.glob("abc"); } - { const a: boolean = adone.is.dotfile("abc"); } - { const a: boolean = adone.is.function(() => { }); } - { const a: boolean = adone.is.asyncFunction(async () => { }); } - { const a: boolean = adone.is.promise({}); } - { const a: boolean = adone.is.validDate("07.08.2017"); } - { const a: boolean = adone.is.buffer({}); } - { const a: boolean = adone.is.callback({}); } - { const a: boolean = adone.is.generator({}); } - { const a: boolean = adone.is.nan({}); } - { const a: boolean = adone.is.finite({}); } - { const a: boolean = adone.is.integer({}); } - { const a: boolean = adone.is.safeInteger({}); } - { const a: boolean = adone.is.array({}); } - { const a: boolean = adone.is.uint8Array({}); } - { const a: boolean = adone.is.configuration({}); } - { const a: boolean = adone.is.long({}); } - { const a: boolean = adone.is.bigNumber({}); } - { const a: boolean = adone.is.byteArray({}); } - { const a: boolean = adone.is.datetime({}); } - { const a: boolean = adone.is.transform({}); } - { const a: boolean = adone.is.subsystem({}); } - { const a: boolean = adone.is.application({}); } - { const a: boolean = adone.is.logger({}); } - { const a: boolean = adone.is.coreStream({}); } - { const a: boolean = adone.is.fastStream({}); } - { const a: boolean = adone.is.fastLocalStream({}); } - { const a: boolean = adone.is.fastLocalMapStream({}); } - { const a: boolean = adone.is.genesisNetron({}); } - { const a: boolean = adone.is.genesisPeer({}); } - { const a: boolean = adone.is.netronAdapter({}); } - { const a: boolean = adone.is.netron({}); } - { const a: boolean = adone.is.netronPeer({}); } - { const a: boolean = adone.is.netronDefinition({}); } - { const a: boolean = adone.is.netronDefinitions({}); } - { const a: boolean = adone.is.netronReference({}); } - { const a: boolean = adone.is.netronInterface({}); } - { const a: boolean = adone.is.netronContext({}); } - { const a: boolean = adone.is.netronIMethod({}, "hello"); } - { const a: boolean = adone.is.netronIProperty({}, "hello"); } - { const a: boolean = adone.is.netronStub({}); } - { const a: boolean = adone.is.netronRemoteStub({}); } - { const a: boolean = adone.is.netronStream({}); } - { const a: boolean = adone.is.iterable({}); } - { const a: boolean = adone.is.windows; } - { const a: boolean = adone.is.linux; } - { const a: boolean = adone.is.freebsd; } - { const a: boolean = adone.is.darwin; } - { const a: boolean = adone.is.sunos; } - { const a: boolean = adone.is.uppercase("abc"); } - { const a: boolean = adone.is.lowercase("abc"); } - { const a: boolean = adone.is.digits("012"); } - { const a: boolean = adone.is.identifier("someMethod"); } - { const a: boolean = adone.is.binaryExtension("mp3"); } - { const a: boolean = adone.is.binaryPath("a.mp3"); } - { const a: boolean = adone.is.ip4("192.168.1.1"); } - { const a: boolean = adone.is.ip6("::192.168.1.1"); } - { const a: boolean = adone.is.arrayBuffer({}); } - { const a: boolean = adone.is.arrayBufferView({}); } - { const a: boolean = adone.is.date({}); } - { const a: boolean = adone.is.error({}); } - { const a: boolean = adone.is.map({}); } - { const a: boolean = adone.is.regexp({}); } - { const a: boolean = adone.is.set({}); } - { const a: boolean = adone.is.symbol({}); } - { const a: boolean = adone.is.validUTF8(Buffer.from("hello")); } - { const a: boolean = adone.is.vaultValuable({}); } - { const a: boolean = adone.is.task({}); } + const { + is + } = adone; + { + const a: boolean = is.null({}); + const b: any = 2; + if (is.null(b)) { + const c: null = b; + } + } + { + const a: boolean = is.undefined({}); + const b: any = 2; + if (is.undefined(b)) { + const c: undefined = b; + } + } + { const a: boolean = is.exist({}); } + { + const a: boolean = is.nil({}); + const b: any = 2; + if (is.nil(b)) { + const c: null | undefined = b; + } + } + { + const a: boolean = is.number({}); + const b: any = 2; + if (is.number(b)) { + b.toExponential(); + } + } + { + const a: boolean = is.numeral({}); + const b: any = 2; + if (is.numeral(b)) { + const c: string | number = b; + } + } + { + const a: boolean = is.infinite({}); + const b: any = 2; + if (is.infinite(b)) { + b.toPrecision(); + } + } + { + const a: boolean = is.odd({}); + const b: any = 2; + if (is.odd(b)) { + b.toFixed(2); + } + } + { + const a: boolean = is.even({}); + const b: any = 2; + if (is.even(b)) { + b.toFixed(2); + } + } + { + const a: boolean = is.float({}); + const b: any = 2; + if (is.float(b)) { + b.toFixed(); + } + } + { + const a: boolean = is.negativeZero({}); + const b: any = 2; + if (is.negativeZero(b)) { + b.toFixed(); + } + } + { + const a: boolean = is.string({}); + const b: any = 2; + if (is.string(b)) { + b.charCodeAt(0); + } + } + { + const a: boolean = is.emptyString({}); + const b: any = 2; + if (is.emptyString(b)) { + b.charCodeAt(0); + } + } + { const a: boolean = is.substring("abc", "abcdef"); } + { const a: boolean = is.substring("abc", "abcdef", 0); } + { const a: boolean = is.prefix("abc", "abcdef"); } + { const a: boolean = is.suffix("def", "abbdef"); } + { + const a: boolean = is.boolean({}); + const b: any = 2; + if (is.boolean(b)) { + b === true; + } + } + { const a: boolean = is.json({}); } + { + const a: boolean = is.object({}); + const b: any = 2; + if (is.object(b)) { + const c: object = b; + } + } + { + const a: boolean = is.plainObject({}); + const b: any = 2; + if (is.plainObject(b)) { + const c: object = b; + } + } + { const a: boolean = is.class({}); } + { const a: boolean = is.emptyObject({}); } + { const a: boolean = is.propertyOwned({}, "a"); } + { const a: boolean = is.propertyDefined({}, "a"); } + { const a: boolean = is.conforms({}, {}); } + { const a: boolean = is.conforms({}, {}, true); } + { + const a: boolean = is.arrayLikeObject({}); + const b: any = {}; + if (is.arrayLikeObject(b)) { + const c: number = b.length; + b[0]; + } + } + { const a: boolean = is.inArray(1, [1, 2, 3]); } + { const a: boolean = is.inArray(1, [1, 2, 3], 0); } + { const a: boolean = is.inArray(1, [1, 2, 3], 0, (a, b) => a === b); } + { const a: boolean = is.sameType({}, {}); } + { const a: boolean = is.primitive({}); } + { const a: boolean = is.equalArrays([], []); } + { const a: boolean = is.deepEqual({}, {}); } + { const a: boolean = is.shallowEqual({}, {}); } + { const a: boolean = is.stream({}); } + { const a: boolean = is.writableStream({}); } + { const a: boolean = is.readableStream({}); } + { const a: boolean = is.duplexStream({}); } + { const a: boolean = is.transformStream({}); } + { const a: boolean = is.utf8(Buffer.alloc(10)); } + { const a: boolean = is.win32PathAbsolute("abc"); } + { const a: boolean = is.posixPathAbsolute("abc"); } + { const a: boolean = is.pathAbsolute("abc"); } + { + const a: boolean = is.glob("abc"); + const b: any = 2; + if (is.glob(b)) { + b.charCodeAt(0); + } + } + { const a: boolean = is.dotfile("abc"); } + { + const a: boolean = is.function(() => { }); + const b: any = 2; + if (is.function(b)) { + b(); + } + } + { + const a: boolean = is.asyncFunction(async () => { }); + const b: any = 2; + if (is.asyncFunction(b)) { + b().then(() => {}); + } + } + { + const a: boolean = is.promise({}); + const b: any = 2; + if (is.promise(b)) { + b.then(() => {}); + } + const c = Promise.resolve(2); + if (is.promise(c)) { + c.then((x) => x.toFixed(2)); + } + } + { const a: boolean = is.validDate("07.08.2017"); } + { + const a: boolean = is.buffer({}); + const b: any = 2; + if (is.buffer(b)) { + b.writeDoubleBE(10, 10); + } + } + { const a: boolean = is.callback({}); } + { + const a: boolean = is.generator({}); + const b: any = 2; + if (is.generator(b)) { + b().next(); + } + } + { const a: boolean = is.nan({}); } + { + const a: boolean = is.finite({}); + const b: any = 2; + if (is.finite(b)) { + b.toFixed(); + } + } + { + const a: boolean = is.integer({}); + const b: any = 2; + if (is.integer(b)) { + b.toFixed(); + } + } + { + const a: boolean = is.safeInteger({}); + const b: any = 2; + if (is.safeInteger(b)) { + b.toFixed(); + } + } + { + const a: boolean = is.array({}); + const b: any = 2; + if (is.array(b)) { + b.length + b[0]; + } + const c = [1, 2, 3]; + if (is.array(c)) { + c[0].toFixed(0); + } + } + { + const a: boolean = is.uint8Array({}); + const b: any = 2; + if (is.uint8Array(b)) { + b.copyWithin(1, 2); + } + } + { const a: boolean = is.configuration({}); } + { + const a: boolean = is.long({}); + const b: any = 2; + if (is.long(b)) { + b.getHighBitsUnsigned(); + } + } + { + const a: boolean = is.bigNumber({}); + const b: any = 2; + if (is.bigNumber(b)) { + b.add(b).isBitSet(10); + } + } + { + const a: boolean = is.byteArray({}); + const b: any = 2; + if (is.byteArray(b)) { + b.toBuffer(); + } + } + { + const a: boolean = is.datetime({}); + const b: any = 2; + if (is.datetime(b)) { + b.add(2, "hours"); + } + } + { const a: boolean = is.transform({}); } + { + const a: boolean = is.subsystem({}); + const b: any = 2; + if (is.subsystem(b)) { + b.configureSubsystems().then(() => {}); + } + } + { + const a: boolean = is.application({}); + const b: any = 2; + if (is.application(b)) { + b.exitOnSignal("SIGINT"); + } + } + { const a: boolean = is.logger({}); } + { + const a: boolean = is.coreStream({}); + const b: any = 2; + if (is.coreStream(b)) { + b.map((x) => 2).forEach((t: number) => { + // + }); + } + } + { + const a: boolean = is.fastStream({}); + const b: any = 2; + if (is.fastStream(b)) { + b.compress("deflate"); + } + } + { + const a: boolean = is.fastLocalStream({}); + const b: any = 2; + if (is.fastLocalStream(b)) { + b.compress("gz"); + } + } + { + const a: boolean = is.fastLocalMapStream({}); + const b: any = 2; + if (is.fastLocalMapStream(b)) { + b.decompress("gz"); + } + } + { const a: boolean = is.genesisNetron({}); } + { const a: boolean = is.genesisPeer({}); } + { const a: boolean = is.netronAdapter({}); } + { const a: boolean = is.netron({}); } + { const a: boolean = is.netronPeer({}); } + { const a: boolean = is.netronDefinition({}); } + { const a: boolean = is.netronDefinitions({}); } + { const a: boolean = is.netronReference({}); } + { const a: boolean = is.netronInterface({}); } + { const a: boolean = is.netronContext({}); } + { const a: boolean = is.netronIMethod({}, "hello"); } + { const a: boolean = is.netronIProperty({}, "hello"); } + { const a: boolean = is.netronStub({}); } + { const a: boolean = is.netronRemoteStub({}); } + { const a: boolean = is.netronStream({}); } + { + const a: boolean = is.iterable({}); + const b: any = 2; + if (is.iterable(b)) { + const it = b[Symbol.iterator](); + it.next(); + } + } + { const a: boolean = is.windows; } + { const a: boolean = is.linux; } + { const a: boolean = is.freebsd; } + { const a: boolean = is.darwin; } + { const a: boolean = is.sunos; } + { const a: boolean = is.uppercase("abc"); } + { const a: boolean = is.lowercase("abc"); } + { const a: boolean = is.digits("012"); } + { const a: boolean = is.identifier("someMethod"); } + { const a: boolean = is.binaryExtension("mp3"); } + { const a: boolean = is.binaryPath("a.mp3"); } + { const a: boolean = is.ip4("192.168.1.1"); } + { const a: boolean = is.ip6("::192.168.1.1"); } + { + const a: boolean = is.arrayBuffer({}); + const b: any = 2; + if (is.arrayBuffer(b)) { + b.slice(10); + } + } + { + const a: boolean = is.arrayBufferView({}); + const b: any = 2; + if (is.arrayBufferView(b)) { + b.byteLength + b.byteOffset; + } + } + { + const a: boolean = is.date({}); + const b: any = 2; + if (is.date(b)) { + b.getMonth() + b.getDate(); + } + } + { const a: boolean = is.error({}); } + { + const a: boolean = is.map({}); + const b: any = 2; + if (is.map(b)) { + b.has("asd"); + b.set(1, 2); + b.set("1", 2); + } + } + { + const a: boolean = is.regexp({}); + const b: any = 2; + if (is.regexp(b)) { + b.test("hello"); + } + } + { + const a: boolean = is.set({}); + const b: any = 2; + if (is.set(b)) { + b.add("h"); + b.has(1); + } + } + { const a: boolean = is.symbol({}); } + { const a: boolean = is.vaultValuable({}); } + { const a: boolean = is.task({}); } + { + const a: boolean = is.fqdn(1); + const b: any = 2; + if (is.fqdn(b)) { + b.charCodeAt(0); + } + if (is.fqdn(b, {})) { + b.charCodeAt(0); + } + is.fqdn(1, { + allowTrailingDot: false + }); + is.fqdn(1, { + allowUnderscores: false + }); + is.fqdn(1, { + requireTld: true + }); + } + { + const a: boolean = is.email(1); + const b: any = 2; + if (is.email(b)) { + b.charCodeAt(0); + } + if (is.email(b, {})) { + b.charCodeAt(0); + } + is.email(1, { + allowDisplayName: false + }); + is.email(1, { + allowUtf8LocalPart: false + }); + is.email(1, { + requireDisplayName: false + }); + is.email(1, { + requireTld: false + }); + } + { + const a: boolean = is.uuid(2); + const b: any = 2; + if (is.uuid(b)) { + b.charCodeAt(0); + } + } + { + const a: boolean = is.uuid(2, "all"); + const b: any = 2; + if (is.uuid(b, "all")) { + b.charCodeAt(0); + } + } + { + const a: boolean = is.uuid(2, "all"); + const b: any = 2; + if (is.uuid(b, "all")) { + b.charCodeAt(0); + } + } + { + const a: boolean = is.uuid(2, 1); + const b: any = 2; + if (is.uuid(b, 1)) { + b.charCodeAt(0); + } + } + { + const a: boolean = is.uuid(2, 2); + const b: any = 2; + if (is.uuid(b, 2)) { + b.charCodeAt(0); + } + } + { + const a: boolean = is.uuid(2, 3); + const b: any = 2; + if (is.uuid(b, 2)) { + b.charCodeAt(0); + } + } + { + const a: boolean = is.uuid(2, 4); + const b: any = 2; + if (is.uuid(b, 2)) { + b.charCodeAt(0); + } + } + { + const a: boolean = is.uuid(2, 5); + const b: any = 2; + if (is.uuid(b, 2)) { + b.charCodeAt(0); + } + } } diff --git a/types/adone/test/glosses/meta.ts b/types/adone/test/glosses/meta.ts new file mode 100644 index 0000000000..fbcde09b1a --- /dev/null +++ b/types/adone/test/glosses/meta.ts @@ -0,0 +1,7 @@ +namespace metaTests { + const { meta } = adone; + + namespace typeOf { + const a: string = meta.typeOf(1); + } +} diff --git a/types/adone/test/glosses/net/http/client.ts b/types/adone/test/glosses/net/http/client.ts new file mode 100644 index 0000000000..0992c1576c --- /dev/null +++ b/types/adone/test/glosses/net/http/client.ts @@ -0,0 +1,499 @@ +namespace adoneTests.net.http.client { + const { + net: { + http: { + client + } + } + } = adone; + + let bool: boolean; + let num: number; + let str: string; + let buf: Buffer; + let stream: nodestd.stream.Readable; + + namespace Client { + const { + Client + } = client; + + new Client(); + new Client({}); + new Client({ + auth: { + username: "a" + } + }); + new Client({ + auth: { + password: "a" + } + }); + new Client({ + cancelToken: new client.CancelToken(() => {}) + }); + new Client({ + data: Buffer.from("hello") + }); + new Client({ + data: "hello" + }); + new Client({ + data: adone.fs.createReadStream(__filename) + }); + new Client({ + data: new ArrayBuffer(10) + }); + new Client({ + formData: { + a: "string" + } + }); + new Client({ + formData: { + a: ["string"] + } + }); + new Client({ + formData: { + a: [adone.fs.createReadStream(__filename)] + } + }); + new Client({ + formData: { + a: { + value: "string", + options: {} + } + } + }); + new Client({ + formData: { + a: { + value: "string", + options: { + contentType: "a" + } + } + } + }); + new Client({ + formData: { + a: { + value: "string", + options: { + filename: "a" + } + } + } + }); + new Client({ + formData: { + a: { + value: "string", + options: { + header: "a" + } + } + } + }); + new Client({ + formData: { + a: { + value: "string", + options: { + header: { + a: "a" + } + } + } + } + }); + new Client({ + formData: { + a: { + value: "string", + options: { + knownLength: 100500 + } + } + } + }); + new Client({ + formData: { + a: [{ + value: "string", + options: { + knownLength: 100500 + } + }] + } + }); + new Client({ + headers: { + "User-Agent": "true" + } + }); + new Client({ + httpAgent: {} + }); + new Client({ + httpsAgent: {} + }); + new Client({ + maxContentLength: 100500 + }); + new Client({ + maxRedirects: 100500 + }); + new Client({ + method: "GET" + }); + new Client({ + onUploadProgress(event) { + bool = event.lengthComputable; + num = event.loaded; + num = event.total; + } + }); + new Client({ + params: { + a: 1 + } + }); + new Client({ + paramsSerializer(params: object) { + return "asd"; + } + }); + new Client({ + proxy: "socks5://localhost" + }); + new Client({ + proxy: { + protocol: "socks5", + host: "127.0.0.1", + port: 9000, + auth: { + username: "hello", + password: "world" + } + } + }); + + new Client({ + rejectUnauthorized: true + }); + new Client({ + responseEncoding: "CP1251" + }); + new Client({ + responseType: "stream" + }); + new Client({ + timeout: 100 + }); + new Client({ + transformRequest: [(data, headers, config) => { + return data; + }] + }); + new Client({ + transformResponse: [(data, headers, config) => { + return data; + }] + }); + new Client({ + transport: adone.std.http + }); + new Client({ + validateStatus(status) { + return status > 100; + } + }); + new Client({ + xsrfCookieName: "a" + }); + new Client({ + xsrfHeaderName: "a" + }); + + const req = new Client(); + + namespace request { + req.request({ + method: "GET" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + const len = resp.headers["content-length"]; + if (!adone.is.undefined(len)) { + str = len; + } + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.request({ + method: "GET", + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.request({ + method: "GET", + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.request({ + method: "GET", + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace get { + req.get("url").then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.get("url", { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.get("url", { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.get("url", { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace post { + req.post("url", {}).then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.post("url", {}, { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.post("url", {}, { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.post("url", {}, { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace put { + req.put("url", {}).then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.put("url", {}, { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.put("url", {}, { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.put("url", {}, { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace patch { + req.patch("url", {}).then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.patch("url", {}, { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.patch("url", {}, { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.patch("url", {}, { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace _delete { + req.delete("url").then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.delete("url", { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.delete("url", { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.delete("url", { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace options { + req.options("url").then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.options("url", { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.options("url", { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.options("url", { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + } + + namespace request { + client.request.get("htllo").then((x) => { + num = x.status; + }); + } + + namespace create { + client.create(); + client.create({}); + const req = client.create({ + headers: { + "User-Agent": "Hello" + } + }); + req.get("hello world").then((x) => { + num = x.status; + }); + } + + namespace cancel { + const { + Cancel, + CancelToken, + isCancel + } = client; + + new CancelToken((s: string) => 123).promise.then((x) => { + str = x.message; + }); + new CancelToken((s: string) => 123).reason; + CancelToken.source().token.promise; + CancelToken.source().cancel("hello"); + + new Cancel("hello").message; + + const a: any = 2; + + if (isCancel(a)) { + str = a.message; + } + } +} diff --git a/types/adone/test/glosses/pretty/json.ts b/types/adone/test/glosses/pretty/json.ts new file mode 100644 index 0000000000..730447baba --- /dev/null +++ b/types/adone/test/glosses/pretty/json.ts @@ -0,0 +1,19 @@ +namespace adoneTests.pretty.json { + const { + json + } = adone.pretty; + + let str: string; + + str = json({}); + str = json({}, {}); + str = json({}, {}, 1); + str = json({}, { dashColor: "green" }); + str = json({}, { defaultIndentation: 10 }); + str = json({}, { emptyArrayMsg: "asdas" }); + str = json({}, { keysColor: "green" }); + str = json({}, { noAlign: true }); + str = json({}, { noColor: true }); + str = json({}, { numberColor: "green" }); + str = json({}, { stringColor: "green" }); +} diff --git a/types/adone/test/glosses/pretty/size.ts b/types/adone/test/glosses/pretty/size.ts new file mode 100644 index 0000000000..1ed5e904fe --- /dev/null +++ b/types/adone/test/glosses/pretty/size.ts @@ -0,0 +1,12 @@ +namespace adoneTests.pretty.size { + const { + pretty: { + size + } + } = adone; + + let str: string; + + str = size(12345); + str = size(12345, ""); +} diff --git a/types/adone/test/glosses/pretty/table.ts b/types/adone/test/glosses/pretty/table.ts new file mode 100644 index 0000000000..0ed4099bbc --- /dev/null +++ b/types/adone/test/glosses/pretty/table.ts @@ -0,0 +1,177 @@ +namespace adoneTests.pretty.table { + const { + table + } = adone.pretty; + + let str: string; + + str = table([], { + model: [] + }); + str = table([], { + borderless: true, + model: [] + }); + str = table([], { + countAnsiEscapeCodes: true, + model: [] + }); + str = table([], { + noHeader: true, + model: [] + }); + str = table([], { + style: { + "padding-left": 1 + }, + model: [] + }); + str = table([], { + style: { + "padding-right": 1 + }, + model: [] + }); + str = table([], { + style: { + broder: ["a"] + }, + model: [] + }); + str = table([], { + style: { + compact: true + }, + model: [] + }); + str = table([], { + style: { + head: ["a"] + }, + model: [] + }); + str = table([], { + width: 100, + model: [] + }); + str = table([], { + width: "100%", + model: [] + }); + str = table([], { + model: [{ + id: "ads", + align: "center" + }] + }); + str = table([], { + model: [{ + id: "ads", + format: "%s" + }] + }); + str = table([], { + model: [{ + id: "ads", + format(val: any, item: object) { + return "2"; + } + }] + }); + str = table([], { + model: [{ + id: "ads", + handle(item: object) { + return "a"; + } + }] + }); + str = table([], { + model: [{ + id: "ads", + header: "he" + }] + }); + str = table([], { + model: [{ + id: "ads", + maxWidth: "100%" + }] + }); + str = table([], { + model: [{ + id: "ads", + maxWidth: 100 + }] + }); + str = table([], { + model: [{ + id: "ads", + style: "asd" + }] + }); + str = table([], { + model: [{ + id: "ads", + style(val: any, str: string) { + return "1"; + } + }] + }); + str = table([], { + model: [{ + id: "ads", + width: 100 + }] + }); + str = table([], { + model: [{ + id: "ads", + width: "100%" + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: "soft" + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: "hard" + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: { + countAnsiEscapeCodes: true + } + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: { + join: true + } + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: { + mode: "soft" + } + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: { + mode: "hard" + } + }] + }); +} diff --git a/types/adone/test/glosses/pretty/time.ts b/types/adone/test/glosses/pretty/time.ts new file mode 100644 index 0000000000..79d1e6325f --- /dev/null +++ b/types/adone/test/glosses/pretty/time.ts @@ -0,0 +1,14 @@ +namespace adoneTests.pretty.time { + const { + time + } = adone.pretty; + + let str: string; + + str = time(12345); + str = time(12345, {}); + str = time(12345, { compact: true }); + str = time(12345, { msDecimalDigits: 2 }); + str = time(12345, { secDecimalDigits: 2 }); + str = time(12345, { verbose: true }); +} diff --git a/types/adone/test/glosses/promise.ts b/types/adone/test/glosses/promise.ts index a8866d95a1..9df672cae8 100644 --- a/types/adone/test/glosses/promise.ts +++ b/types/adone/test/glosses/promise.ts @@ -106,4 +106,34 @@ namespace promiseTests { namespace _finally { promise.finally(Promise.resolve(2), () => 2).then((x: number) => {}); } + + namespace props { + promise.props({ a: Promise.resolve(2) }).then((x) => x.a); + } + + namespace retry { + promise.retry((info) => { + { const a: number = info.current; } + }); + + promise.retry(() => {}, {}); + promise.retry(() => {}, { backOffBase: 1000 }); + promise.retry(() => {}, { backOffExponent: 2 }); + promise.retry(() => {}, { match: "a" }); + promise.retry(() => {}, { match: ["a"] }); + promise.retry(() => {}, { match: [/abc/] }); + promise.retry(() => {}, { match: /abc/ }); + promise.retry(() => {}, { match: [new Error()] }); + promise.retry(() => {}, { match: new Error() }); + promise.retry(() => {}, { max: 100 }); + promise.retry(() => {}, { name: "asd" }); + promise.retry(() => {}, { + report(msg: string, opts) { + opts.backOffBase < 100; + } + }); + promise.retry(() => {}, { + timeout: 100 + }); + } } diff --git a/types/adone/test/glosses/regex.ts b/types/adone/test/glosses/regex.ts new file mode 100644 index 0000000000..7aab1e0d8d --- /dev/null +++ b/types/adone/test/glosses/regex.ts @@ -0,0 +1,17 @@ +namespace adoneTests.regex { + const { + regex + } = adone; + + regex.ansi().test("a"); + regex.filename().test("a"); + regex.idn().test("a"); + regex.ip4().test("a"); + regex.ip6().test("a"); + regex.protocol().test("a"); + regex.punycode().test("a"); + regex.shebang().test("a"); + regex.uri().test("a"); + regex.uuid4().test("a"); + regex.uuid5().test("a"); +} diff --git a/types/adone/test/glosses/semver.ts b/types/adone/test/glosses/semver.ts new file mode 100644 index 0000000000..e6ac7a50b0 --- /dev/null +++ b/types/adone/test/glosses/semver.ts @@ -0,0 +1,131 @@ +namespace adoneTests.semver { + const { + semver + } = adone; + + type ReleaseType = adone.semver.I.ReleaseType; + type Operator = adone.semver.I.Operator; + type SemVer = adone.semver.SemVer; + type Comparator = adone.semver.Comparator; + + let bool: boolean; + let num: number; + let str = ''; + let strn: string | null = ''; + let diff: ReleaseType | null; + const op: Operator = ''; + declare const arr: any[]; + declare const exp: RegExp; + let strArr: string[] | null; + declare const numArr: string[]; + let comparatorResult: -1 | 0 | 1; + let versionsArr: Array; + + const v1 = ''; + const v2 = ''; + const version = ''; + const versions: string[] = []; + const loose = true; + let sem: SemVer | null; + + sem = semver.parse(str); + strn = semver.valid(str); + strn = semver.clean(str); + + strn = semver.valid(str, loose); + strn = semver.clean(str, loose); + strn = semver.inc(str, "major", loose); + strn = semver.inc(str, "premajor", loose); + strn = semver.inc(str, "minor", loose); + strn = semver.inc(str, "preminor", loose); + strn = semver.inc(str, "patch", loose); + strn = semver.inc(str, "prepatch", loose); + strn = semver.inc(str, "prerelease", loose); + strn = semver.inc(str, "prerelease", loose, "alpha"); + num = semver.major(str, loose); + num = semver.minor(str, loose); + num = semver.patch(str, loose); + strArr = semver.prerelease(str, loose); + + // Comparison + bool = semver.gt(v1, v2, loose); + bool = semver.gte(v1, v2, loose); + bool = semver.lt(v1, v2, loose); + bool = semver.lte(v1, v2, loose); + bool = semver.eq(v1, v2, loose); + bool = semver.neq(v1, v2, loose); + bool = semver.cmp(v1, op, v2, loose); + comparatorResult = semver.compare(v1, v2, loose); + comparatorResult = semver.rcompare(v1, v2, loose); + comparatorResult = semver.compareIdentifiers(str, str); + comparatorResult = semver.rcompareIdentifiers(str, str); + versionsArr = semver.sort(['', new semver.SemVer('')]); + versionsArr = semver.rsort(['', new semver.SemVer('')]); + diff = semver.diff(v1, v2, loose); + + // Ranges + str = semver.validRange(str, loose); + bool = semver.satisfies(version, str, loose); + str = semver.maxSatisfying(versions, str, loose); + str = semver.minSatisfying(versions, str, loose); + bool = semver.gtr(version, str, loose); + bool = semver.ltr(version, str, loose); + bool = semver.outside(version, str, '<', loose); + bool = semver.intersects(str, str, loose); + + // Coercion + sem = semver.coerce(str); + + let ver = new semver.SemVer(str, bool); + str = ver.raw; + bool = ver.loose; + str = ver.format(); + str = ver.inspect(); + str = ver.toString(); + + num = ver.major; + num = ver.minor; + num = ver.patch; + str = ver.version; + strArr = ver.build; + strArr = ver.prerelease; + + comparatorResult = ver.compare(ver); + comparatorResult = ver.compareMain(ver); + comparatorResult = ver.comparePre(ver); + ver = ver.inc("major"); + ver = ver.inc("premajor"); + ver = ver.inc("minor"); + ver = ver.inc("preminor"); + ver = ver.inc("patch"); + ver = ver.inc("prepatch"); + ver = ver.inc("prerelease"); + ver = ver.inc("prerelease", "alpha"); + + const comp = new semver.Comparator(str, bool); + str = comp.toString(); + + ver = comp.semver; + str = comp.operator; + bool = comp.value; + comp.parse(str); + bool = comp.test(ver); + bool = comp.intersects(new semver.Comparator(str)); + bool = comp.intersects(new semver.Comparator(str), bool); + + const range = new semver.Range(str, bool); + str = range.raw; + bool = range.loose; + str = range.format(); + str = range.inspect(); + str = range.toString(); + bool = range.test(ver); + bool = range.intersects(new semver.Range('')); + bool = range.intersects(new semver.Range(''), bool); + + let sets: Comparator[][]; + sets = range.set; + + let lims: Comparator[]; + lims = range.parseRange(str); +} diff --git a/types/adone/test/glosses/std.ts b/types/adone/test/glosses/std.ts index 9bcb6687d4..a84d9cc901 100644 --- a/types/adone/test/glosses/std.ts +++ b/types/adone/test/glosses/std.ts @@ -39,6 +39,12 @@ namespace stdTests { std.http.get("http://localhost").end(); } + namespace http2 { + std.http2.connect("somewhere").on("stream", (stream) => { + stream.pipe(process.stdout); + }); + } + namespace https { std.https.get("https://adone.io").end(); } @@ -91,6 +97,10 @@ namespace stdTests { std.domain.create().members; } + namespace module { + new std.module.Module("1").exports; + } + namespace tty { const a: boolean = std.tty.isatty(1); } @@ -126,4 +136,8 @@ namespace stdTests { namespace dgram { std.dgram.createSocket("udp4").bind(31337); } + + namespace perf_hooks { + std.perf_hooks.performance.measure("1", "2", "3"); + } } diff --git a/types/adone/test/glosses/streams.ts b/types/adone/test/glosses/streams.ts index bd090dc467..caa278955a 100644 --- a/types/adone/test/glosses/streams.ts +++ b/types/adone/test/glosses/streams.ts @@ -2,82 +2,82 @@ namespace streamsTests { const { stream } = adone; namespace CoreStreamTests { - const { CoreStream } = stream; + const { core: { Stream } } = stream; - new CoreStream(); - new CoreStream(undefined); - new CoreStream(undefined, {}); - new CoreStream(undefined, { async: true }); - new CoreStream(undefined, { sync: true }); - new CoreStream(undefined, { + new Stream(); + new Stream(undefined); + new Stream(undefined, {}); + new Stream(undefined, { async: true }); + new Stream(undefined, { sync: true }); + new Stream(undefined, { transform(x) { this.push(x); } }); - new CoreStream(undefined, { + new Stream(undefined, { flush() { this.push(1); } }); - new CoreStream([]); - new CoreStream(new CoreStream([])); + new Stream([]); + new Stream(new Stream([])); - { const a: boolean = new CoreStream().write(1); } - { const a: boolean = new CoreStream().push(1); } - { const a: adone.stream.CoreStream = new CoreStream().end(); } - { const a: adone.stream.CoreStream = new CoreStream().destroy(); } - { const a: adone.stream.CoreStream = new CoreStream().pause(); } - { const a: adone.stream.CoreStream = new CoreStream().resume(); } - { const a: boolean = new CoreStream().isPaused(); } - { const a: boolean = new CoreStream().isEnded(); } - { const a: nodestd.stream.Transform = new CoreStream().pipe(new adone.std.stream.Transform()); } - { const a: adone.stream.CoreStream = new CoreStream().throughSync(function () { this.push(1); }); } - { const a: adone.stream.CoreStream = new CoreStream().throughSync(function () { this.push(1); }, function () { this.push(1); }); } - { const a: adone.stream.CoreStream = new CoreStream().throughAsync(function () { this.push(1); }); } - { const a: adone.stream.CoreStream = new CoreStream().throughAsync(function () { this.push(1); }, function () { this.push(1); }); } - { const a: adone.stream.CoreStream = new CoreStream().through(function () { this.push(1); }, function () { this.push(1); }); } - { const a: adone.stream.CoreStream = new CoreStream([1, 2, 3]).map((x) => `${x}`); } - { const a: adone.stream.CoreStream = new CoreStream().mapIf((x) => x === "1", () => 1); } - { const a: adone.stream.CoreStream = new CoreStream().mapIf(async (x) => x === "1", () => 1); } - { const a: adone.stream.CoreStream = new CoreStream().filter((x) => x === 1); } - { const a: adone.stream.CoreStream = new CoreStream().filter(async (x) => x === 1); } - { const a: adone.stream.CoreStream = new CoreStream().forEach(async (x) => x === 1); } - { const a: adone.stream.CoreStream = new CoreStream().forEach(async (x) => x === 1, {}); } - { const a: adone.stream.CoreStream = new CoreStream().forEach(async (x) => x === 1, { passthrough: true }); } - { const a: adone.stream.CoreStream = new CoreStream().forEach(async (x) => x === 1, { wait: true }); } - { const a: adone.stream.CoreStream = new CoreStream().done(() => {}); } - { const a: adone.stream.CoreStream = new CoreStream().done(() => {}, {}); } - { const a: adone.stream.CoreStream = new CoreStream().done(() => {}, { passthrough: true }); } - { const a: adone.stream.CoreStream = new CoreStream().toArray((x: any[]) => {}); } - { const a: adone.stream.CoreStream = new CoreStream().toArray((x: any[]) => {}, {}); } - { const a: adone.stream.CoreStream = new CoreStream().toArray((x: any[]) => {}, { passthrough: true }); } - { const a: adone.stream.CoreStream = new CoreStream().unique(); } - { const a: adone.stream.CoreStream = new CoreStream().unique((x) => x + 1); } - { const a: adone.stream.CoreStream = new CoreStream().stash((x) => x === 1); } - { const a: adone.stream.CoreStream = new CoreStream().stash("hello", (x) => x === 1); } - { const a: adone.stream.CoreStream = new CoreStream().unstash("hello"); } - { const a: adone.stream.CoreStream = new CoreStream().unstash(); } - { const a: adone.stream.CoreStream = new CoreStream().flatten(); } - { const a: Promise = new CoreStream().then(); } - { const a: Promise = new CoreStream().then(() => "1"); } - { const a: Promise = new CoreStream().then(() => 1, () => 2); } - { const a: Promise = new CoreStream().catch(); } - { const a: Promise = new CoreStream().catch(() => 1); } - { const a: adone.stream.CoreStream = CoreStream.merge([new CoreStream()]); } - { const a: adone.stream.CoreStream = CoreStream.merge([new adone.std.stream.Readable()]); } - { const a: adone.stream.CoreStream = CoreStream.merge([new adone.std.stream.Transform()]); } - { const a: adone.stream.CoreStream = CoreStream.merge([new adone.std.stream.Transform()]); } - { const a: adone.stream.CoreStream = CoreStream.merge([new adone.std.stream.Duplex()]); } - { const a: adone.stream.CoreStream = CoreStream.merge([], {}); } - { const a: adone.stream.CoreStream = CoreStream.merge([], { end: true }); } - { const a: adone.stream.CoreStream = CoreStream.merge([], { sourceOptions: {} }); } - { const a: adone.stream.CoreStream = CoreStream.merge([], { sourceOptions: { async: true } }); } - { const a: adone.stream.CoreStream = CoreStream.merge([], { sourceOptions: { sync: false } }); } - { const a: adone.stream.CoreStream = CoreStream.merge([], { sourceOptions: { transform(x) { this.push(x); } } }); } - { const a: adone.stream.CoreStream = CoreStream.merge([], { sourceOptions: { flush() { this.push(1); } } }); } + { const a: boolean = new Stream().write(1); } + { const a: boolean = new Stream().push(1); } + { const a: adone.stream.core.Stream = new Stream().end(); } + { const a: adone.stream.core.Stream = new Stream().destroy(); } + { const a: adone.stream.core.Stream = new Stream().pause(); } + { const a: adone.stream.core.Stream = new Stream().resume(); } + { const a: boolean = new Stream().isPaused(); } + { const a: boolean = new Stream().isEnded(); } + { const a: nodestd.stream.Transform = new Stream().pipe(new adone.std.stream.Transform()); } + { const a: adone.stream.core.Stream = new Stream().throughSync(function () { this.push(1); }); } + { const a: adone.stream.core.Stream = new Stream().throughSync(function () { this.push(1); }, function () { this.push(1); }); } + { const a: adone.stream.core.Stream = new Stream().throughAsync(function () { this.push(1); }); } + { const a: adone.stream.core.Stream = new Stream().throughAsync(function () { this.push(1); }, function () { this.push(1); }); } + { const a: adone.stream.core.Stream = new Stream().through(function () { this.push(1); }, function () { this.push(1); }); } + { const a: adone.stream.core.Stream = new Stream([1, 2, 3]).map((x) => `${x}`); } + { const a: adone.stream.core.Stream = new Stream().mapIf((x) => x === "1", () => 1); } + { const a: adone.stream.core.Stream = new Stream().mapIf(async (x) => x === "1", () => 1); } + { const a: adone.stream.core.Stream = new Stream().filter((x) => x === 1); } + { const a: adone.stream.core.Stream = new Stream().filter(async (x) => x === 1); } + { const a: adone.stream.core.Stream = new Stream().forEach(async (x) => x === 1); } + { const a: adone.stream.core.Stream = new Stream().forEach(async (x) => x === 1, {}); } + { const a: adone.stream.core.Stream = new Stream().forEach(async (x) => x === 1, { passthrough: true }); } + { const a: adone.stream.core.Stream = new Stream().forEach(async (x) => x === 1, { wait: true }); } + { const a: adone.stream.core.Stream = new Stream().done(() => {}); } + { const a: adone.stream.core.Stream = new Stream().done(() => {}, {}); } + { const a: adone.stream.core.Stream = new Stream().done(() => {}, { passthrough: true }); } + { const a: adone.stream.core.Stream = new Stream().toArray((x: any[]) => {}); } + { const a: adone.stream.core.Stream = new Stream().toArray((x: any[]) => {}, {}); } + { const a: adone.stream.core.Stream = new Stream().toArray((x: any[]) => {}, { passthrough: true }); } + { const a: adone.stream.core.Stream = new Stream().unique(); } + { const a: adone.stream.core.Stream = new Stream().unique((x) => x + 1); } + { const a: adone.stream.core.Stream = new Stream().stash((x) => x === 1); } + { const a: adone.stream.core.Stream = new Stream().stash("hello", (x) => x === 1); } + { const a: adone.stream.core.Stream = new Stream().unstash("hello"); } + { const a: adone.stream.core.Stream = new Stream().unstash(); } + { const a: adone.stream.core.Stream = new Stream().flatten(); } + { const a: Promise = new Stream().then(); } + { const a: Promise = new Stream().then(() => "1"); } + { const a: Promise = new Stream().then(() => 1, () => 2); } + { const a: Promise = new Stream().catch(); } + { const a: Promise = new Stream().catch(() => 1); } + { const a: adone.stream.core.Stream = Stream.merge([new Stream()]); } + { const a: adone.stream.core.Stream = Stream.merge([new adone.std.stream.Readable()]); } + { const a: adone.stream.core.Stream = Stream.merge([new adone.std.stream.Transform()]); } + { const a: adone.stream.core.Stream = Stream.merge([new adone.std.stream.Transform()]); } + { const a: adone.stream.core.Stream = Stream.merge([new adone.std.stream.Duplex()]); } + { const a: adone.stream.core.Stream = Stream.merge([], {}); } + { const a: adone.stream.core.Stream = Stream.merge([], { end: true }); } + { const a: adone.stream.core.Stream = Stream.merge([], { sourceOptions: {} }); } + { const a: adone.stream.core.Stream = Stream.merge([], { sourceOptions: { async: true } }); } + { const a: adone.stream.core.Stream = Stream.merge([], { sourceOptions: { sync: false } }); } + { const a: adone.stream.core.Stream = Stream.merge([], { sourceOptions: { transform(x) { this.push(x); } } }); } + { const a: adone.stream.core.Stream = Stream.merge([], { sourceOptions: { flush() { this.push(1); } } }); } (async () => { - const res = await new CoreStream([1, 2, 3, 4, 5]) + const res = await new Stream([1, 2, 3, 4, 5]) .map((x: number) => `${x}`) .mapIf((x: string) => x[0] === "1", (x) => x.slice(1)) .map((x) => [x, x, x]) @@ -91,13 +91,13 @@ namespace streamsTests { } namespace coreTests { - { const a: adone.stream.CoreStream = stream.core(); } - { const a: adone.stream.CoreStream = stream.core([1, 2, 3]); } - { const a: adone.stream.CoreStream = stream.core(stream.core([])); } - { const a: adone.stream.CoreStream = stream.core(undefined, {}); } - { const a: adone.stream.CoreStream = stream.core(undefined, { async: true }); } - { const a: adone.stream.CoreStream = stream.core(undefined, { sync: false }); } - { const a: adone.stream.CoreStream = stream.core(undefined, { transform(x) { this.push(Number(x)); } }); } - { const a: adone.stream.CoreStream = stream.core(undefined, { flush() { this.push(1); } }); } + { const a: adone.stream.core.Stream = stream.core.create(); } + { const a: adone.stream.core.Stream = stream.core.create([1, 2, 3]); } + { const a: adone.stream.core.Stream = stream.core.create(stream.core.create([])); } + { const a: adone.stream.core.Stream = stream.core.create(undefined, {}); } + { const a: adone.stream.core.Stream = stream.core.create(undefined, { async: true }); } + { const a: adone.stream.core.Stream = stream.core.create(undefined, { sync: false }); } + { const a: adone.stream.core.Stream = stream.core.create(undefined, { transform(x) { this.push(Number(x)); } }); } + { const a: adone.stream.core.Stream = stream.core.create(undefined, { flush() { this.push(1); } }); } } } diff --git a/types/adone/test/glosses/system/env.ts b/types/adone/test/glosses/system/env.ts new file mode 100644 index 0000000000..6f77ede2fa --- /dev/null +++ b/types/adone/test/glosses/system/env.ts @@ -0,0 +1,25 @@ +namespace adoneTests.system.env { + const { + system: { + env + } + } = adone; + + let str: string; + + str = env.user(); + + str = env.prompt(); + + str = env.hostname(); + + str = env.tmpdir(); + + str = env.home(); + + str = env.path(); + + str = env.editor(); + + str = env.shell(); +} diff --git a/types/adone/test/glosses/system/process.ts b/types/adone/test/glosses/system/process.ts new file mode 100644 index 0000000000..9ffd3c33a5 --- /dev/null +++ b/types/adone/test/glosses/system/process.ts @@ -0,0 +1,1200 @@ +namespace adoneTests.system.process { + const { + system: { + process + } + } = adone; + + let str: string; + let num: number; + let bool: boolean; + let anyArr: any[]; + + str = process.errname(1); + + str = process.errnameFallback({}, 1); + + anyArr = process.stdio({}); + + namespace exec { + process.exec("node"); + process.exec("node", ["1.js"]); + process.exec("node", ["1.js"], {}); + process.exec("node", ["1.js"], { + cwd: "hello" + }); + process.exec("node", ["1.js"], { + env: { + a: "a" + } + }); + process.exec("node", ["1.js"], { + extendEnv: true + }); + process.exec("node", ["1.js"], { + argv0: "a" + }); + { + process.exec("node", ["1.js"], { + stdio: "pipe" + }); + process.exec("node", ["1.js"], { + stdio: "ignore" + }); + process.exec("node", ["1.js"], { + stdio: "inherit" + }); + process.exec("node", ["1.js"], { + stdio: ["pipe"] + }); + process.exec("node", ["1.js"], { + stdio: ["ipc"] + }); + process.exec("node", ["1.js"], { + stdio: ["ignore"] + }); + process.exec("node", ["1.js"], { + stdio: [new adone.std.stream.Stream()] + }); + process.exec("node", ["1.js"], { + stdio: [0] + }); + process.exec("node", ["1.js"], { + stdio: [null] + }); + process.exec("node", ["1.js"], { + stdio: [undefined] + }); + } + process.exec("node", ["1.js"], { + detached: true + }); + process.exec("node", ["1.js"], { + uid: 1000 + }); + process.exec("node", ["1.js"], { + gid: 1000 + }); + process.exec("node", ["1.js"], { + shell: true + }); + process.exec("node", ["1.js"], { + windowsVerbatimArguments: true + }); + process.exec("node", ["1.js"], { + stripEof: true + }); + process.exec("node", ["1.js"], { + preferLocal: true + }); + process.exec("node", ["1.js"], { + localDir: "a" + }); + process.exec("node", ["1.js"], { + reject: false + }); + process.exec("node", ["1.js"], { + cleanup: true + }); + process.exec("node", ["1.js"], { + encoding: "utf8" + }); + process.exec("node", ["1.js"], { + timeout: 100 + }); + process.exec("node", ["1.js"], { + maxBuffer: 1010101 + }); + process.exec("node", ["1.js"], { + killSignal: "SIGINT" + }); + { + process.exec("node", ["1.js"], { + stdin: "pipe" + }); + process.exec("node", ["1.js"], { + stdin: "ignore" + }); + process.exec("node", ["1.js"], { + stdin: "ipc" + }); + process.exec("node", ["1.js"], { + stdin: "ignore" + }); + process.exec("node", ["1.js"], { + stdin: new adone.std.stream.Stream() + }); + process.exec("node", ["1.js"], { + stdin: 0 + }); + process.exec("node", ["1.js"], { + stdin: null + }); + process.exec("node", ["1.js"], { + stdin: undefined + }); + } + { + process.exec("node", ["1.js"], { + stdout: "pipe" + }); + process.exec("node", ["1.js"], { + stdout: "ignore" + }); + process.exec("node", ["1.js"], { + stdout: "ipc" + }); + process.exec("node", ["1.js"], { + stdout: "ignore" + }); + process.exec("node", ["1.js"], { + stdout: new adone.std.stream.Stream() + }); + process.exec("node", ["1.js"], { + stdout: 0 + }); + process.exec("node", ["1.js"], { + stdout: null + }); + process.exec("node", ["1.js"], { + stdout: undefined + }); + } + { + process.exec("node", ["1.js"], { + stderr: "pipe" + }); + process.exec("node", ["1.js"], { + stderr: "ignore" + }); + process.exec("node", ["1.js"], { + stderr: "ipc" + }); + process.exec("node", ["1.js"], { + stderr: "ignore" + }); + process.exec("node", ["1.js"], { + stderr: new adone.std.stream.Stream() + }); + process.exec("node", ["1.js"], { + stderr: 0 + }); + process.exec("node", ["1.js"], { + stderr: null + }); + process.exec("node", ["1.js"], { + stderr: undefined + }); + } + { + process.exec("node", ["1.js"], { + input: "a" + }); + process.exec("node", ["1.js"], { + input: Buffer.from("a") + }); + process.exec("node", ["1.js"], { + input: adone.fs.createReadStream(__filename) + }); + } + { + const ret = process.exec("node", ["1.js"]); + ret.then((x) => { + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + }); + ret.catch((x) => { + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + }); + + ret.on("message", () => {}); + ret.stdout.pipe(adone.fs.createWriteStream(__filename)); + } + } + + namespace execStdout { + process.execStdout("node"); + process.execStdout("node", ["1.js"]); + process.execStdout("node", ["1.js"], {}); + process.execStdout("node", ["1.js"], { + cwd: "hello" + }); + process.execStdout("node", ["1.js"], { + env: { + a: "a" + } + }); + process.execStdout("node", ["1.js"], { + extendEnv: true + }); + process.execStdout("node", ["1.js"], { + argv0: "a" + }); + { + process.execStdout("node", ["1.js"], { + stdio: "pipe" + }); + process.execStdout("node", ["1.js"], { + stdio: "ignore" + }); + process.execStdout("node", ["1.js"], { + stdio: "inherit" + }); + process.execStdout("node", ["1.js"], { + stdio: ["pipe"] + }); + process.execStdout("node", ["1.js"], { + stdio: ["ipc"] + }); + process.execStdout("node", ["1.js"], { + stdio: ["ignore"] + }); + process.execStdout("node", ["1.js"], { + stdio: [new adone.std.stream.Stream()] + }); + process.execStdout("node", ["1.js"], { + stdio: [0] + }); + process.execStdout("node", ["1.js"], { + stdio: [null] + }); + process.execStdout("node", ["1.js"], { + stdio: [undefined] + }); + } + process.execStdout("node", ["1.js"], { + detached: true + }); + process.execStdout("node", ["1.js"], { + uid: 1000 + }); + process.execStdout("node", ["1.js"], { + gid: 1000 + }); + process.execStdout("node", ["1.js"], { + shell: true + }); + process.execStdout("node", ["1.js"], { + windowsVerbatimArguments: true + }); + process.execStdout("node", ["1.js"], { + stripEof: true + }); + process.execStdout("node", ["1.js"], { + preferLocal: true + }); + process.execStdout("node", ["1.js"], { + localDir: "a" + }); + process.execStdout("node", ["1.js"], { + reject: false + }); + process.execStdout("node", ["1.js"], { + cleanup: true + }); + process.execStdout("node", ["1.js"], { + encoding: "utf8" + }); + process.execStdout("node", ["1.js"], { + timeout: 100 + }); + process.execStdout("node", ["1.js"], { + maxBuffer: 1010101 + }); + process.execStdout("node", ["1.js"], { + killSignal: "SIGINT" + }); + { + process.execStdout("node", ["1.js"], { + stdin: "pipe" + }); + process.execStdout("node", ["1.js"], { + stdin: "ignore" + }); + process.execStdout("node", ["1.js"], { + stdin: "ipc" + }); + process.execStdout("node", ["1.js"], { + stdin: "ignore" + }); + process.execStdout("node", ["1.js"], { + stdin: new adone.std.stream.Stream() + }); + process.execStdout("node", ["1.js"], { + stdin: 0 + }); + process.execStdout("node", ["1.js"], { + stdin: null + }); + process.execStdout("node", ["1.js"], { + stdin: undefined + }); + } + { + process.execStdout("node", ["1.js"], { + stdout: "pipe" + }); + process.execStdout("node", ["1.js"], { + stdout: "ignore" + }); + process.execStdout("node", ["1.js"], { + stdout: "ipc" + }); + process.execStdout("node", ["1.js"], { + stdout: "ignore" + }); + process.execStdout("node", ["1.js"], { + stdout: new adone.std.stream.Stream() + }); + process.execStdout("node", ["1.js"], { + stdout: 0 + }); + process.execStdout("node", ["1.js"], { + stdout: null + }); + process.execStdout("node", ["1.js"], { + stdout: undefined + }); + } + { + process.execStdout("node", ["1.js"], { + stderr: "pipe" + }); + process.execStdout("node", ["1.js"], { + stderr: "ignore" + }); + process.execStdout("node", ["1.js"], { + stderr: "ipc" + }); + process.execStdout("node", ["1.js"], { + stderr: "ignore" + }); + process.execStdout("node", ["1.js"], { + stderr: new adone.std.stream.Stream() + }); + process.execStdout("node", ["1.js"], { + stderr: 0 + }); + process.execStdout("node", ["1.js"], { + stderr: null + }); + process.execStdout("node", ["1.js"], { + stderr: undefined + }); + } + { + process.execStdout("node", ["1.js"], { + input: "a" + }); + process.execStdout("node", ["1.js"], { + input: Buffer.from("a") + }); + process.execStdout("node", ["1.js"], { + input: adone.fs.createReadStream(__filename) + }); + } + { + const ret = process.execStdout("node", ["1.js"]); + ret.then((x) => { + str = x; + }); + } + } + + namespace execStderr { + process.execStderr("node"); + process.execStderr("node", ["1.js"]); + process.execStderr("node", ["1.js"], {}); + process.execStderr("node", ["1.js"], { + cwd: "hello" + }); + process.execStderr("node", ["1.js"], { + env: { + a: "a" + } + }); + process.execStderr("node", ["1.js"], { + extendEnv: true + }); + process.execStderr("node", ["1.js"], { + argv0: "a" + }); + { + process.execStderr("node", ["1.js"], { + stdio: "pipe" + }); + process.execStderr("node", ["1.js"], { + stdio: "ignore" + }); + process.execStderr("node", ["1.js"], { + stdio: "inherit" + }); + process.execStderr("node", ["1.js"], { + stdio: ["pipe"] + }); + process.execStderr("node", ["1.js"], { + stdio: ["ipc"] + }); + process.execStderr("node", ["1.js"], { + stdio: ["ignore"] + }); + process.execStderr("node", ["1.js"], { + stdio: [new adone.std.stream.Stream()] + }); + process.execStderr("node", ["1.js"], { + stdio: [0] + }); + process.execStderr("node", ["1.js"], { + stdio: [null] + }); + process.execStderr("node", ["1.js"], { + stdio: [undefined] + }); + } + process.execStderr("node", ["1.js"], { + detached: true + }); + process.execStderr("node", ["1.js"], { + uid: 1000 + }); + process.execStderr("node", ["1.js"], { + gid: 1000 + }); + process.execStderr("node", ["1.js"], { + shell: true + }); + process.execStderr("node", ["1.js"], { + windowsVerbatimArguments: true + }); + process.execStderr("node", ["1.js"], { + stripEof: true + }); + process.execStderr("node", ["1.js"], { + preferLocal: true + }); + process.execStderr("node", ["1.js"], { + localDir: "a" + }); + process.execStderr("node", ["1.js"], { + reject: false + }); + process.execStderr("node", ["1.js"], { + cleanup: true + }); + process.execStderr("node", ["1.js"], { + encoding: "utf8" + }); + process.execStderr("node", ["1.js"], { + timeout: 100 + }); + process.execStderr("node", ["1.js"], { + maxBuffer: 1010101 + }); + process.execStderr("node", ["1.js"], { + killSignal: "SIGINT" + }); + { + process.execStderr("node", ["1.js"], { + stdin: "pipe" + }); + process.execStderr("node", ["1.js"], { + stdin: "ignore" + }); + process.execStderr("node", ["1.js"], { + stdin: "ipc" + }); + process.execStderr("node", ["1.js"], { + stdin: "ignore" + }); + process.execStderr("node", ["1.js"], { + stdin: new adone.std.stream.Stream() + }); + process.execStderr("node", ["1.js"], { + stdin: 0 + }); + process.execStderr("node", ["1.js"], { + stdin: null + }); + process.execStderr("node", ["1.js"], { + stdin: undefined + }); + } + { + process.execStderr("node", ["1.js"], { + stdout: "pipe" + }); + process.execStderr("node", ["1.js"], { + stdout: "ignore" + }); + process.execStderr("node", ["1.js"], { + stdout: "ipc" + }); + process.execStderr("node", ["1.js"], { + stdout: "ignore" + }); + process.execStderr("node", ["1.js"], { + stdout: new adone.std.stream.Stream() + }); + process.execStderr("node", ["1.js"], { + stdout: 0 + }); + process.execStderr("node", ["1.js"], { + stdout: null + }); + process.execStderr("node", ["1.js"], { + stdout: undefined + }); + } + { + process.execStderr("node", ["1.js"], { + stderr: "pipe" + }); + process.execStderr("node", ["1.js"], { + stderr: "ignore" + }); + process.execStderr("node", ["1.js"], { + stderr: "ipc" + }); + process.execStderr("node", ["1.js"], { + stderr: "ignore" + }); + process.execStderr("node", ["1.js"], { + stderr: new adone.std.stream.Stream() + }); + process.execStderr("node", ["1.js"], { + stderr: 0 + }); + process.execStderr("node", ["1.js"], { + stderr: null + }); + process.execStderr("node", ["1.js"], { + stderr: undefined + }); + } + { + process.execStderr("node", ["1.js"], { + input: "a" + }); + process.execStderr("node", ["1.js"], { + input: Buffer.from("a") + }); + process.execStderr("node", ["1.js"], { + input: adone.fs.createReadStream(__filename) + }); + } + { + const ret = process.execStderr("node", ["1.js"]); + ret.then((x) => { + str = x; + }); + } + } + + namespace shell { + process.shell("node 1.js"); + process.shell("node 1.js", {}); + process.shell("node 1.js", { + cwd: "hello" + }); + process.shell("node 1.js", { + env: { + a: "a" + } + }); + process.shell("node 1.js", { + extendEnv: true + }); + process.shell("node 1.js", { + argv0: "a" + }); + { + process.shell("node 1.js", { + stdio: "pipe" + }); + process.shell("node 1.js", { + stdio: "ignore" + }); + process.shell("node 1.js", { + stdio: "inherit" + }); + process.shell("node 1.js", { + stdio: ["pipe"] + }); + process.shell("node 1.js", { + stdio: ["ipc"] + }); + process.shell("node 1.js", { + stdio: ["ignore"] + }); + process.shell("node 1.js", { + stdio: [new adone.std.stream.Stream()] + }); + process.shell("node 1.js", { + stdio: [0] + }); + process.shell("node 1.js", { + stdio: [null] + }); + process.shell("node 1.js", { + stdio: [undefined] + }); + } + process.shell("node 1.js", { + detached: true + }); + process.shell("node 1.js", { + uid: 1000 + }); + process.shell("node 1.js", { + gid: 1000 + }); + process.shell("node 1.js", { + shell: true + }); + process.shell("node 1.js", { + windowsVerbatimArguments: true + }); + process.shell("node 1.js", { + stripEof: true + }); + process.shell("node 1.js", { + preferLocal: true + }); + process.shell("node 1.js", { + localDir: "a" + }); + process.shell("node 1.js", { + reject: false + }); + process.shell("node 1.js", { + cleanup: true + }); + process.shell("node 1.js", { + encoding: "utf8" + }); + process.shell("node 1.js", { + timeout: 100 + }); + process.shell("node 1.js", { + maxBuffer: 1010101 + }); + process.shell("node 1.js", { + killSignal: "SIGINT" + }); + { + process.shell("node 1.js", { + stdin: "pipe" + }); + process.shell("node 1.js", { + stdin: "ignore" + }); + process.shell("node 1.js", { + stdin: "ipc" + }); + process.shell("node 1.js", { + stdin: "ignore" + }); + process.shell("node 1.js", { + stdin: new adone.std.stream.Stream() + }); + process.shell("node 1.js", { + stdin: 0 + }); + process.shell("node 1.js", { + stdin: null + }); + process.shell("node 1.js", { + stdin: undefined + }); + } + { + process.shell("node 1.js", { + stdout: "pipe" + }); + process.shell("node 1.js", { + stdout: "ignore" + }); + process.shell("node 1.js", { + stdout: "ipc" + }); + process.shell("node 1.js", { + stdout: "ignore" + }); + process.shell("node 1.js", { + stdout: new adone.std.stream.Stream() + }); + process.shell("node 1.js", { + stdout: 0 + }); + process.shell("node 1.js", { + stdout: null + }); + process.shell("node 1.js", { + stdout: undefined + }); + } + { + process.shell("node 1.js", { + stderr: "pipe" + }); + process.shell("node 1.js", { + stderr: "ignore" + }); + process.shell("node 1.js", { + stderr: "ipc" + }); + process.shell("node 1.js", { + stderr: "ignore" + }); + process.shell("node 1.js", { + stderr: new adone.std.stream.Stream() + }); + process.shell("node 1.js", { + stderr: 0 + }); + process.shell("node 1.js", { + stderr: null + }); + process.shell("node 1.js", { + stderr: undefined + }); + } + { + process.shell("node 1.js", { + input: "a" + }); + process.shell("node 1.js", { + input: Buffer.from("a") + }); + process.shell("node 1.js", { + input: adone.fs.createReadStream(__filename) + }); + } + { + const ret = process.shell("node 1.js"); + ret.then((x) => { + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + }); + ret.catch((x) => { + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + }); + + ret.on("message", () => {}); + ret.stdout.pipe(adone.fs.createWriteStream(__filename)); + } + } + + namespace execSync { + process.execSync("node"); + process.execSync("node", ["1.js"]); + process.execSync("node", ["1.js"], {}); + process.execSync("node", ["1.js"], { + cwd: "hello" + }); + process.execSync("node", ["1.js"], { + env: { + a: "a" + } + }); + process.execSync("node", ["1.js"], { + extendEnv: true + }); + process.execSync("node", ["1.js"], { + argv0: "a" + }); + { + process.execSync("node", ["1.js"], { + stdio: "pipe" + }); + process.execSync("node", ["1.js"], { + stdio: "ignore" + }); + process.execSync("node", ["1.js"], { + stdio: "inherit" + }); + process.execSync("node", ["1.js"], { + stdio: ["pipe"] + }); + process.execSync("node", ["1.js"], { + stdio: ["ipc"] + }); + process.execSync("node", ["1.js"], { + stdio: ["ignore"] + }); + process.execSync("node", ["1.js"], { + stdio: [new adone.std.stream.Stream()] + }); + process.execSync("node", ["1.js"], { + stdio: [0] + }); + process.execSync("node", ["1.js"], { + stdio: [null] + }); + process.execSync("node", ["1.js"], { + stdio: [undefined] + }); + } + process.execSync("node", ["1.js"], { + detached: true + }); + process.execSync("node", ["1.js"], { + uid: 1000 + }); + process.execSync("node", ["1.js"], { + gid: 1000 + }); + process.execSync("node", ["1.js"], { + shell: true + }); + process.execSync("node", ["1.js"], { + windowsVerbatimArguments: true + }); + process.execSync("node", ["1.js"], { + stripEof: true + }); + process.execSync("node", ["1.js"], { + preferLocal: true + }); + process.execSync("node", ["1.js"], { + localDir: "a" + }); + process.execSync("node", ["1.js"], { + reject: false + }); + process.execSync("node", ["1.js"], { + cleanup: true + }); + process.execSync("node", ["1.js"], { + encoding: "utf8" + }); + process.execSync("node", ["1.js"], { + timeout: 100 + }); + process.execSync("node", ["1.js"], { + maxBuffer: 1010101 + }); + process.execSync("node", ["1.js"], { + killSignal: "SIGINT" + }); + { + process.execSync("node", ["1.js"], { + stdin: "pipe" + }); + process.execSync("node", ["1.js"], { + stdin: "ignore" + }); + process.execSync("node", ["1.js"], { + stdin: "ipc" + }); + process.execSync("node", ["1.js"], { + stdin: "ignore" + }); + process.execSync("node", ["1.js"], { + stdin: new adone.std.stream.Stream() + }); + process.execSync("node", ["1.js"], { + stdin: 0 + }); + process.execSync("node", ["1.js"], { + stdin: null + }); + process.execSync("node", ["1.js"], { + stdin: undefined + }); + } + { + process.execSync("node", ["1.js"], { + stdout: "pipe" + }); + process.execSync("node", ["1.js"], { + stdout: "ignore" + }); + process.execSync("node", ["1.js"], { + stdout: "ipc" + }); + process.execSync("node", ["1.js"], { + stdout: "ignore" + }); + process.execSync("node", ["1.js"], { + stdout: new adone.std.stream.Stream() + }); + process.execSync("node", ["1.js"], { + stdout: 0 + }); + process.execSync("node", ["1.js"], { + stdout: null + }); + process.execSync("node", ["1.js"], { + stdout: undefined + }); + } + { + process.execSync("node", ["1.js"], { + stderr: "pipe" + }); + process.execSync("node", ["1.js"], { + stderr: "ignore" + }); + process.execSync("node", ["1.js"], { + stderr: "ipc" + }); + process.execSync("node", ["1.js"], { + stderr: "ignore" + }); + process.execSync("node", ["1.js"], { + stderr: new adone.std.stream.Stream() + }); + process.execSync("node", ["1.js"], { + stderr: 0 + }); + process.execSync("node", ["1.js"], { + stderr: null + }); + process.execSync("node", ["1.js"], { + stderr: undefined + }); + } + { + process.execSync("node", ["1.js"], { + input: "a" + }); + process.execSync("node", ["1.js"], { + input: Buffer.from("a") + }); + } + { + const x = process.execSync("node", ["1.js"]); + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + } + } + + namespace shell { + process.shellSync("node 1.js"); + process.shellSync("node 1.js", {}); + process.shellSync("node 1.js", { + cwd: "hello" + }); + process.shellSync("node 1.js", { + env: { + a: "a" + } + }); + process.shellSync("node 1.js", { + extendEnv: true + }); + process.shellSync("node 1.js", { + argv0: "a" + }); + { + process.shellSync("node 1.js", { + stdio: "pipe" + }); + process.shellSync("node 1.js", { + stdio: "ignore" + }); + process.shellSync("node 1.js", { + stdio: "inherit" + }); + process.shellSync("node 1.js", { + stdio: ["pipe"] + }); + process.shellSync("node 1.js", { + stdio: ["ipc"] + }); + process.shellSync("node 1.js", { + stdio: ["ignore"] + }); + process.shellSync("node 1.js", { + stdio: [new adone.std.stream.Stream()] + }); + process.shellSync("node 1.js", { + stdio: [0] + }); + process.shellSync("node 1.js", { + stdio: [null] + }); + process.shellSync("node 1.js", { + stdio: [undefined] + }); + } + process.shellSync("node 1.js", { + detached: true + }); + process.shellSync("node 1.js", { + uid: 1000 + }); + process.shellSync("node 1.js", { + gid: 1000 + }); + process.shellSync("node 1.js", { + shell: true + }); + process.shellSync("node 1.js", { + windowsVerbatimArguments: true + }); + process.shellSync("node 1.js", { + stripEof: true + }); + process.shellSync("node 1.js", { + preferLocal: true + }); + process.shellSync("node 1.js", { + localDir: "a" + }); + process.shellSync("node 1.js", { + reject: false + }); + process.shellSync("node 1.js", { + cleanup: true + }); + process.shellSync("node 1.js", { + encoding: "utf8" + }); + process.shellSync("node 1.js", { + timeout: 100 + }); + process.shellSync("node 1.js", { + maxBuffer: 1010101 + }); + process.shellSync("node 1.js", { + killSignal: "SIGINT" + }); + { + process.shellSync("node 1.js", { + stdin: "pipe" + }); + process.shellSync("node 1.js", { + stdin: "ignore" + }); + process.shellSync("node 1.js", { + stdin: "ipc" + }); + process.shellSync("node 1.js", { + stdin: "ignore" + }); + process.shellSync("node 1.js", { + stdin: new adone.std.stream.Stream() + }); + process.shellSync("node 1.js", { + stdin: 0 + }); + process.shellSync("node 1.js", { + stdin: null + }); + process.shellSync("node 1.js", { + stdin: undefined + }); + } + { + process.shellSync("node 1.js", { + stdout: "pipe" + }); + process.shellSync("node 1.js", { + stdout: "ignore" + }); + process.shellSync("node 1.js", { + stdout: "ipc" + }); + process.shellSync("node 1.js", { + stdout: "ignore" + }); + process.shellSync("node 1.js", { + stdout: new adone.std.stream.Stream() + }); + process.shellSync("node 1.js", { + stdout: 0 + }); + process.shellSync("node 1.js", { + stdout: null + }); + process.shellSync("node 1.js", { + stdout: undefined + }); + } + { + process.shellSync("node 1.js", { + stderr: "pipe" + }); + process.shellSync("node 1.js", { + stderr: "ignore" + }); + process.shellSync("node 1.js", { + stderr: "ipc" + }); + process.shellSync("node 1.js", { + stderr: "ignore" + }); + process.shellSync("node 1.js", { + stderr: new adone.std.stream.Stream() + }); + process.shellSync("node 1.js", { + stderr: 0 + }); + process.shellSync("node 1.js", { + stderr: null + }); + process.shellSync("node 1.js", { + stderr: undefined + }); + } + { + process.shellSync("node 1.js", { + input: "a" + }); + process.shellSync("node 1.js", { + input: Buffer.from("a") + }); + } + { + const x = process.shellSync("node 1.js"); + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + } + } +} diff --git a/types/adone/test/glosses/system/user.ts b/types/adone/test/glosses/system/user.ts new file mode 100644 index 0000000000..3e1b643d7d --- /dev/null +++ b/types/adone/test/glosses/system/user.ts @@ -0,0 +1,22 @@ +namespace adoneTests.system.process.user { + const { + system: { + user + } + } = adone; + + let str: string; + let num: number; + + const a = user.uid("hello"); + num = a.uid; + num = a.gid; + + num = user.gid("hello"); + + num = user.gids("hello")[0]; + + str = user.username(1000); + + str = user.groupname(1000); +} diff --git a/types/adone/test/glosses/templating/dot.ts b/types/adone/test/glosses/templating/dot.ts new file mode 100644 index 0000000000..69cd15d500 --- /dev/null +++ b/types/adone/test/glosses/templating/dot.ts @@ -0,0 +1,70 @@ +namespace adoneTests.templating.dot { + const { + templating: { + dot + } + } = adone; + + let str: string; + let bool; + let regexp: RegExp; + + str = dot.version; + + bool = dot.templateSettings.append; + regexp = dot.templateSettings.conditional; + regexp = dot.templateSettings.define; + regexp = dot.templateSettings.defineParams; + regexp = dot.templateSettings.encode; + regexp = dot.templateSettings.evaluate; + regexp = dot.templateSettings.interpolate; + regexp = dot.templateSettings.iterate; + bool = dot.templateSettings.selfcontained; + bool = dot.templateSettings.strip; + regexp = dot.templateSettings.use; + regexp = dot.templateSettings.useParams; + str = dot.templateSettings.varname; + + const r = dot.template("asd", { + append: true, + define: /a/, + encode: /a/, + evaluate: /a/, + conditional: /a/, + defineParams: /a/, + interpolate: /a/, + iterate: /a/, + selfcontained: true, + strip: false, + use: /a/, + useParams: /a/, + varname: "a" + }); + str = r("a"); + + str = dot.compile("asd")(); + str = dot.compile("asd", {})(); + + const a = dot.process(); + str = a["hello"](); + + dot.process({ + destination: "a" + }); + dot.process({ + global: "a" + }); + dot.process({ + path: "a" + }); + dot.process({ + templateSettings: { + append: true + } + }); + dot.process({ + templateSettings: { + useParams: /a/ + } + }); +} diff --git a/types/adone/test/glosses/templating/nunjucks.ts b/types/adone/test/glosses/templating/nunjucks.ts new file mode 100644 index 0000000000..85bd2e49e5 --- /dev/null +++ b/types/adone/test/glosses/templating/nunjucks.ts @@ -0,0 +1,139 @@ +namespace adoneTests.templating.nunjucks { + const { + templating: { + nunjucks + } + } = adone; + + let str: string; + let bool: boolean; + let pstr: Promise; + + namespace Environment { + const { + Environment + } = nunjucks; + + new Environment(); + new Environment(new nunjucks.FileSystemLoader()); + new Environment(new nunjucks.FileSystemLoader(), { autoescape: true }); + new Environment(new nunjucks.FileSystemLoader(), { dev: true }); + new Environment(new nunjucks.FileSystemLoader(), { lstripBlocks: true }); + new Environment(new nunjucks.FileSystemLoader(), { throOnUndefined: true }); + new Environment(new nunjucks.FileSystemLoader(), { trimBlocks: true }); + + const e = new Environment(); + str = e.render("a"); + e.render("a", {}, (e, r: string) => {}); + str = e.renderString("a"); + str = e.renderString("a", {}); + e.renderString("a", {}, (e, r: string) => {}); + + e.addFilter("name", () => 2); + e.addFilter("name", () => 2, true); + e.getFilter("name")(); + + e.addExtension("name", { parse() { return "a"; }, tags: ["a"] }); + e.removeExtension("name"); + e.getExtension("name").parse({}, {}, {}); + str = e.getExtension("name").tags[0]; + bool = e.hasExtension("name"); + e.addGlobal("a", "b"); + str = e.getTemplate("name", true).render(); + str = e.getTemplate("name").render(); + } + + namespace Template { + const { + Template + } = nunjucks; + + new Template("asd"); + new Template("asd", new nunjucks.Environment()); + new Template("asd", new nunjucks.Environment(), true); + str = new Template("asd").render(); + new Template("asd").render({}, (e: any, res: string) => {}); + } + + namespace Loader { + const { + Loader + } = nunjucks; + + new Loader(); + new Loader().on("asd", () => {}); + new Loader().emit("asd", 1, 2, 3); + str = new Loader().resolve("asd", "asd"); + bool = new Loader().isRelative("asd"); + new Loader().extend({ + async: true, + getSource(name: string) { + return { src: "a", path: "b", noCache: true }; + }, + extend(extender) { + extender.async; + extender.extend; + extender.getSource("a"); + return extender; + } + }); + } + + namespace FileSystemLoader { + const { + FileSystemLoader + } = nunjucks; + + new FileSystemLoader(); + new FileSystemLoader(["a"]); + new FileSystemLoader(["a"], { noCache: true }); + new FileSystemLoader(["a"], { watch: true }); + bool = new FileSystemLoader(["a"], { watch: true }).getSource("name").noCache; + str = new FileSystemLoader(["a"], { watch: true }).getSource("name").path; + str = new FileSystemLoader(["a"], { watch: true }).getSource("name").src; + } + + namespace PrecompiledLoader { + const { + PrecompiledLoader + } = nunjucks; + + new PrecompiledLoader(); + bool = new PrecompiledLoader().getSource("name").noCache; + str = new PrecompiledLoader().getSource("name").path; + str = new PrecompiledLoader().getSource("name").src; + } + + pstr = nunjucks.render("he"); + pstr = nunjucks.render("he", {}); + + str = nunjucks.renderSync("he"); + str = nunjucks.renderSync("he", {}); + + pstr = nunjucks.renderString("he"); + pstr = nunjucks.renderString("he", {}); + + str = nunjucks.renderStringSync("he"); + str = nunjucks.renderStringSync("he", {}); + + let t = nunjucks.compile("he"); + t = nunjucks.compile("he", new nunjucks.Environment()); + t = nunjucks.compile("he", new nunjucks.Environment(), "asd"); + t = nunjucks.compile("he", new nunjucks.Environment(), "asd", true); + str = t.render(); + + let e = nunjucks.configure(); + e = nunjucks.configure({}); + e = nunjucks.configure({ autoescape: true }); + e = nunjucks.configure({ dev: true }); + e = nunjucks.configure({ lstripBlocks: true }); + e = nunjucks.configure({ noCache: true }); + e = nunjucks.configure({ tags: { blockEnd: "{" } }); + e = nunjucks.configure({ throOnUndefined: true }); + e = nunjucks.configure({ trimBlocks: true }); + e = nunjucks.configure({ watch: true }); + e = nunjucks.configure("a", { watch: true }); + e.addFilter("name", () => true); + + nunjucks.installJinjaCompat(); +} diff --git a/types/adone/test/glosses/text/index.ts b/types/adone/test/glosses/text/index.ts new file mode 100644 index 0000000000..7f5fc88692 --- /dev/null +++ b/types/adone/test/glosses/text/index.ts @@ -0,0 +1,58 @@ +namespace adoneTests.text { + const { + text + } = adone; + + let str: string; + let regExp: RegExp; + let bool: boolean; + let num: number; + + namespace escape { + const { + escape + } = text; + + str = escape.regExpPattern("asd"); + str = escape.regExpReplacement("asd"); + str = escape.format("asd"); + str = escape.shellArg("asd"); + str = escape.control("sad"); + str = escape.htmlSpecialChars("asd"); + } + + namespace regexp { + const { + regexp + } = text; + + str = regexp.array2alternatives(["a"]); + } + + str = text.escapeStringRegexp("asd"); + str = text.toCamelCase("asd"); + str = text.camelCaseToDashed("asd"); + regExp = text.endLineRegExp; + str = text.splitLines("a")[0]; + str = text.regExpIndexOf("a", /ads/); + str = text.regExpIndexOf("a", /ads/, 1); + str = text.stripAnsi("ad"); + bool = text.hasAnsi("asd"); + str = text.random(100); + str = text.detectNewLine("asd"); + str = text.wordwrap("ads", 10)[0]; + str = text.wordwrap("ads", 10, { join: true }); + str = text.wordwrap("ads", 10, { countAnsiEscapeCodes: true }); + str = text.wordwrap("ads", 10, { mode: "hard" }); + num = text.stringDistance("as", "ds"); + num = text.stringDistance("as", "ds", [[1]]); + num = text.stringDistanceCapped("a", "b", 10); + str = text.capitalize("asd"); + str = text.capitalizeWords("asd"); + num = text.width("asd"); + str = text.indent("asd", 10); + str = text.stripEof("asd"); + str = text.stripLastCRLF("asd"); + str = text.stripBOM("ads"); + num = text.toUTF8Array("asd")[0]; +} diff --git a/types/adone/test/glosses/text/spinners.ts b/types/adone/test/glosses/text/spinners.ts new file mode 100644 index 0000000000..abd3627151 --- /dev/null +++ b/types/adone/test/glosses/text/spinners.ts @@ -0,0 +1,41 @@ +namespace adoneTests.text.spinners { + const { + text: { + spinner + } + } = adone; + + let sp: { + interval: number; + frames: string[] + }; + + sp = spinner.dots; + sp = spinner.dots2; + sp = spinner.dots3; + sp = spinner.dots4; + sp = spinner.dots5; + sp = spinner.dots6; + sp = spinner.dots7; + sp = spinner.dots8; + sp = spinner.dots9; + sp = spinner.dots10; + sp = spinner.dots11; + sp = spinner.dots12; + sp = spinner.line; + sp = spinner.pipe; + sp = spinner.simpleDots; + sp = spinner.flip; + sp = spinner.growVertical; + sp = spinner.growHorizontal; + sp = spinner.boxBounce; + sp = spinner.boxBounce2; + sp = spinner.triangle; + sp = spinner.squareCorners; + sp = spinner.circleQuarters; + sp = spinner.circleHalves; + sp = spinner.arrow; + sp = spinner.arrow3; + sp = spinner.bouncingBar; + sp = spinner.clock; +} diff --git a/types/adone/test/glosses/text/table.ts b/types/adone/test/glosses/text/table.ts new file mode 100644 index 0000000000..7670f6b1de --- /dev/null +++ b/types/adone/test/glosses/text/table.ts @@ -0,0 +1,65 @@ +namespace adoneTests.text.table { + const { + text: { + table + } + } = adone; + + let num: number; + let str: string; + + namespace Table { + const { + Table + } = table; + + new Table(); + new Table({ chars: {} }); + new Table({ chars: { "bottom-left": "a" } }); + new Table({ chars: { "bottom-mid": "a" } }); + new Table({ chars: { "bottom-right": "a" } }); + new Table({ chars: { "left-mid": "a" } }); + new Table({ chars: { "mid-mid": "a" } }); + new Table({ chars: { "right-mid": "a" } }); + new Table({ chars: { "top-left": "a" } }); + new Table({ chars: { "top-mid": "a" } }); + new Table({ chars: { "top-right": "a" } }); + new Table({ chars: { bottom: "a" } }); + new Table({ chars: { left: "a" } }); + new Table({ chars: { mid: "a" } }); + new Table({ chars: { middle: "a" } }); + new Table({ chars: { right: "a" } }); + new Table({ chars: { top: "a" } }); + new Table({ colAligns: ["left"] }); + new Table({ rowAligns: ["top"] }); + new Table({ head: ["a"] }); + new Table({ rowHeights: [10] }); + new Table({ style: { "padding-left": 1 } }); + new Table({ style: { "padding-right": 1 } }); + new Table({ style: { border: ["a"] } }); + new Table({ style: { compact: true } }); + new Table({ style: { head: ["a"] } }); + new Table({ truncate: "a" }); + new Table({ colWidths: [10] }); + + num = new Table().width; + str = new Table().toString(); + + const def = Table.defaultOptions; + str = def.chars["bottom-mid"]; + num = def.style["padding-right"]; + } + + namespace BorderlessTable { + const { + BorderlessTable + } = table; + + new BorderlessTable(); + new BorderlessTable({}); + new BorderlessTable({ colAligns: ["center"] }); + new BorderlessTable({ colWidths: [10] }); + new BorderlessTable({ head: ["a"] }); + new BorderlessTable({ style: { "padding-right": 1 } }); + } +} diff --git a/types/adone/test/glosses/text/unicode.ts b/types/adone/test/glosses/text/unicode.ts new file mode 100644 index 0000000000..9b331afa60 --- /dev/null +++ b/types/adone/test/glosses/text/unicode.ts @@ -0,0 +1,135 @@ +namespace adoneTests.text.unicode { + const { + text: { + unicode + } + } = adone; + + let str: string; + let num: number; + let bool: boolean; + + str = unicode.symbol.tick; + str = unicode.symbol.cross; + str = unicode.symbol.star; + str = unicode.symbol.square; + str = unicode.symbol.squareSmall; + str = unicode.symbol.squareSmallFilled; + str = unicode.symbol.play; + str = unicode.symbol.circle; + str = unicode.symbol.circleFilled; + str = unicode.symbol.circleDotted; + str = unicode.symbol.circleDouble; + str = unicode.symbol.circleCircle; + str = unicode.symbol.circleCross; + str = unicode.symbol.circlePipe; + str = unicode.symbol.circleQuestionMark; + str = unicode.symbol.bullet; + str = unicode.symbol.dot; + str = unicode.symbol.line; + str = unicode.symbol.ellipsis; + str = unicode.symbol.pointer; + str = unicode.symbol.pointerSmall; + str = unicode.symbol.info; + str = unicode.symbol.warning; + str = unicode.symbol.hamburger; + str = unicode.symbol.smiley; + str = unicode.symbol.mustache; + str = unicode.symbol.heart; + str = unicode.symbol.arrowUp; + str = unicode.symbol.arrowDown; + str = unicode.symbol.arrowLeft; + str = unicode.symbol.arrowRight; + str = unicode.symbol.radioOn; + str = unicode.symbol.radioOff; + str = unicode.symbol.checkboxOn; + str = unicode.symbol.checkboxOff; + str = unicode.symbol.checkboxCircleOn; + str = unicode.symbol.checkboxCircleOff; + str = unicode.symbol.questionMarkPrefix; + str = unicode.symbol.oneHalf; + str = unicode.symbol.oneThird; + str = unicode.symbol.oneQuarter; + str = unicode.symbol.oneFifth; + str = unicode.symbol.oneSixth; + str = unicode.symbol.oneSeventh; + str = unicode.symbol.oneEighth; + str = unicode.symbol.oneNinth; + str = unicode.symbol.oneTenth; + str = unicode.symbol.twoThirds; + str = unicode.symbol.twoFifths; + str = unicode.symbol.threeQuarters; + str = unicode.symbol.threeFifths; + str = unicode.symbol.threeEighths; + str = unicode.symbol.fourFifths; + str = unicode.symbol.fiveSixths; + str = unicode.symbol.fiveEighths; + str = unicode.symbol.sevenEighths; + str = unicode.symbol.minus; + + str = unicode.symbolFallback.tick; + str = unicode.symbolFallback.cross; + str = unicode.symbolFallback.star; + str = unicode.symbolFallback.square; + str = unicode.symbolFallback.squareSmall; + str = unicode.symbolFallback.squareSmallFilled; + str = unicode.symbolFallback.play; + str = unicode.symbolFallback.circle; + str = unicode.symbolFallback.circleFilled; + str = unicode.symbolFallback.circleDotted; + str = unicode.symbolFallback.circleDouble; + str = unicode.symbolFallback.circleCircle; + str = unicode.symbolFallback.circleCross; + str = unicode.symbolFallback.circlePipe; + str = unicode.symbolFallback.circleQuestionMark; + str = unicode.symbolFallback.bullet; + str = unicode.symbolFallback.dot; + str = unicode.symbolFallback.line; + str = unicode.symbolFallback.ellipsis; + str = unicode.symbolFallback.pointer; + str = unicode.symbolFallback.pointerSmall; + str = unicode.symbolFallback.info; + str = unicode.symbolFallback.warning; + str = unicode.symbolFallback.hamburger; + str = unicode.symbolFallback.smiley; + str = unicode.symbolFallback.mustache; + str = unicode.symbolFallback.heart; + str = unicode.symbolFallback.arrowUp; + str = unicode.symbolFallback.arrowDown; + str = unicode.symbolFallback.arrowLeft; + str = unicode.symbolFallback.arrowRight; + str = unicode.symbolFallback.radioOn; + str = unicode.symbolFallback.radioOff; + str = unicode.symbolFallback.checkboxOn; + str = unicode.symbolFallback.checkboxOff; + str = unicode.symbolFallback.checkboxCircleOn; + str = unicode.symbolFallback.checkboxCircleOff; + str = unicode.symbolFallback.questionMarkPrefix; + str = unicode.symbolFallback.oneHalf; + str = unicode.symbolFallback.oneThird; + str = unicode.symbolFallback.oneQuarter; + str = unicode.symbolFallback.oneFifth; + str = unicode.symbolFallback.oneSixth; + str = unicode.symbolFallback.oneSeventh; + str = unicode.symbolFallback.oneEighth; + str = unicode.symbolFallback.oneNinth; + str = unicode.symbolFallback.oneTenth; + str = unicode.symbolFallback.twoThirds; + str = unicode.symbolFallback.twoFifths; + str = unicode.symbolFallback.threeQuarters; + str = unicode.symbolFallback.threeFifths; + str = unicode.symbolFallback.threeEighths; + str = unicode.symbolFallback.fourFifths; + str = unicode.symbolFallback.fiveSixths; + str = unicode.symbolFallback.fiveEighths; + str = unicode.symbolFallback.sevenEighths; + str = unicode.symbolFallback.minus; + + str = unicode.approx("asd"); + num = unicode.length("ad"); + str = unicode.toArray("asd")[0]; + num = unicode.surrogatePair("a"); + bool = unicode.isFullWidthCodePoint(100); + bool = unicode.isFullWidth("a"); + str = unicode.toFullWidth("asd"); +} diff --git a/types/adone/test/glosses/utils.ts b/types/adone/test/glosses/utils.ts index 33698bfb29..a01d010608 100644 --- a/types/adone/test/glosses/utils.ts +++ b/types/adone/test/glosses/utils.ts @@ -34,13 +34,6 @@ namespace utilTests { const b: string = util.functionName((a, b, c) => { }); } - namespace mapArguments { - const a: (...args: any[]) => any = util.mapArguments(() => { }); - const b: (...args: T[]) => T[] = util.mapArguments(1); - const c: (...args: any[]) => any = util.mapArguments([1]); - const d: (x: T) => T = util.mapArguments(); - } - namespace parseMs { const result: { days: number; @@ -56,10 +49,6 @@ namespace utilTests { const c: string = util.pluralizeWord("day", "days", 1); } - namespace functionParams { - const a: string[] = util.functionParams((a: any, b: any, c: any) => { }); - } - namespace randomChoice { const a: number = util.randomChoice([1, 2, 3]); const b: string = util.randomChoice(["1", "2", "3"]); @@ -174,19 +163,10 @@ namespace utilTests { const a: string = util.globParent("a/b/c/**"); } - namespace by { - const a: (a: number, b: number) => any = util.by((x: number): number => x); - const b: (a: number, b: number) => number = util.by((x: number): string => `${x}`, (a: string, b: string) => a.length - b.length); - } - namespace toFastProperties { const a: object = util.toFastProperties({}); } - namespace stripBom { - const a: string = util.stripBom("123"); - } - namespace sortKeys { const a: object = util.sortKeys({}); const b: object = util.sortKeys({}, {}); @@ -215,35 +195,32 @@ namespace utilTests { const e: object = util.invertObject({}, { onlyEnumerable: true }); } - namespace humanizeTime { - const a: string = util.humanizeTime(12345); - const b: string = util.humanizeTime(12345, {}); - const c: string = util.humanizeTime(12345, { compact: true }); - const d: string = util.humanizeTime(12345, { msDecimalDigits: 2 }); - const e: string = util.humanizeTime(12345, { secDecimalDigits: 2 }); - const f: string = util.humanizeTime(12345, { verbose: true }); - } - - namespace humanizeSize { - const a: string = util.humanizeSize(12345); - const b: string = util.humanizeSize(12345, ""); - } - namespace parseSize { const a: number | null = util.parseSize(123); const b: number | null = util.parseSize("123Kb"); } + namespace Cloner { + const a = new util.Cloner(); + a.clone({}); + a.clone({}, {}); + a.clone({}, { deep: true }); + a.clone({}, { nonPlainObjects: false }); + a.clone({}, { onlyEnumerable: true }); + const c = a.binding(); + c({}); + c({}, {}); + c({}, { deep: true }); + c({}, { onlyEnumerable: false }); + c({}, { nonPlainObjects: true }); + } + namespace clone { const a: object = util.clone({}); const b: object = util.clone({}, {}); const c: object = util.clone({}, { deep: true }); } - namespace toUTF8Array { - const a: number[] = util.toUTF8Array("hello"); - } - namespace asyncIter { util.asyncIter([1, 2, 3], () => { }, () => { }); } @@ -298,28 +275,34 @@ namespace utilTests { const a: object = util.assignDeep({ a: 1 }, { a: 2 }); } - namespace match { - const a: number | boolean = util.match(["a", "b", "c"], "a"); - const b: (a: any, b: any) => number | boolean = util.match("a", { index: true }); - const c: number | boolean = util.match(["a", "b", "c"], "a", { dot: true }); - const d: (a: any, b: any) => number | boolean = util.match("a", { end: 2 }); - const e: (a: any, b: any) => number | boolean = util.match("a", { start: 2 }); - const f: (a: any, b: any) => number | boolean = util.match("a"); + namespace matchPath { + const a: number | boolean = util.matchPath(["a", "b", "c"], "a"); + const b: (a: any, b: any) => number | boolean = util.matchPath("a", { index: true }); + const c: number | boolean = util.matchPath(["a", "b", "c"], "a", { dot: true }); + const d: (a: any, b: any) => number | boolean = util.matchPath("a", { end: 2 }); + const e: (a: any, b: any) => number | boolean = util.matchPath("a", { start: 2 }); + const f: (a: any, b: any) => number | boolean = util.matchPath("a"); } namespace toposort { - const a: number[] = util.toposort([ - [0, 1], - [2, 3], - [4, 5], - [6, 7] + const a: string[] = util.toposort([ + ["0", "1"], + ["2", "3"], + ["4", "5"], + ["6", "7"] ]); - const b: number[] = util.toposort.array([0, 1, 2], [ - [0, 1], - [2, 3], - [4, 5], - [6, 7] + const b: string[] = util.toposort.array(["0", "1", "2"], [ + ["0", "1"], + ["2", "3"], + ["4", "5"], + ["6", "7"] ]); + const sorter = new util.toposort.Sorter(); + sorter.add("a", "b"); + sorter.add("a", ["c"]); + const c: string[] = sorter.sort(); + sorter.clear(); + sorter.edges[0][0].charCodeAt(100); } namespace jsesc { @@ -340,10 +323,6 @@ namespace utilTests { const o: string = util.jsesc({ a: 1 }, { __inline2__: true }); } - namespace typeOf { - const a: string = util.typeOf(1); - } - namespace memcpy { const a: number = util.memcpy.utou(Buffer.alloc(10), 0, Buffer.alloc(10), 0, 10); const b: number = util.memcpy.atoa(new ArrayBuffer(10), 0, new ArrayBuffer(10), 0, 10); @@ -394,73 +373,6 @@ namespace utilTests { a.getter("a").access("b").method("c").setter("d"); } - namespace GlobExp { - { - const glob = new util.GlobExp("*.js"); - const a: boolean = glob.hasMagic(); - const b: string[] = glob.expandBraces(); - const c: RegExp = glob.makeRe(); - const d: boolean = glob.test("a.js"); - } - { - const a: boolean = util.GlobExp.hasMagic("*.js"); - const b: string[] = util.GlobExp.expandBraces("*.js"); - const c: RegExp = util.GlobExp.makeRe("*.js"); - const d: boolean = util.GlobExp.test("*.js", "a.js"); - } - new util.GlobExp(""); - new util.GlobExp("", {}); - new util.GlobExp("", { dot: true }); - new util.GlobExp("", { flipNegate: true }); - new util.GlobExp("", { matchBase: true }); - new util.GlobExp("", { nobrace: true }); - new util.GlobExp("", { nocase: true }); - new util.GlobExp("", { nocomment: true }); - new util.GlobExp("", { noext: true }); - new util.GlobExp("", { noglobstar: true }); - new util.GlobExp("", { nonegate: true }); - util.GlobExp.hasMagic("", {}); - util.GlobExp.hasMagic("", { dot: true }); - util.GlobExp.hasMagic("", { flipNegate: true }); - util.GlobExp.hasMagic("", { matchBase: true }); - util.GlobExp.hasMagic("", { nobrace: true }); - util.GlobExp.hasMagic("", { nocase: true }); - util.GlobExp.hasMagic("", { nocomment: true }); - util.GlobExp.hasMagic("", { noext: true }); - util.GlobExp.hasMagic("", { noglobstar: true }); - util.GlobExp.hasMagic("", { nonegate: true }); - util.GlobExp.expandBraces("", {}); - util.GlobExp.expandBraces("", { dot: true }); - util.GlobExp.expandBraces("", { flipNegate: true }); - util.GlobExp.expandBraces("", { matchBase: true }); - util.GlobExp.expandBraces("", { nobrace: true }); - util.GlobExp.expandBraces("", { nocase: true }); - util.GlobExp.expandBraces("", { nocomment: true }); - util.GlobExp.expandBraces("", { noext: true }); - util.GlobExp.expandBraces("", { noglobstar: true }); - util.GlobExp.expandBraces("", { nonegate: true }); - util.GlobExp.makeRe("", {}); - util.GlobExp.makeRe("", { dot: true }); - util.GlobExp.makeRe("", { flipNegate: true }); - util.GlobExp.makeRe("", { matchBase: true }); - util.GlobExp.makeRe("", { nobrace: true }); - util.GlobExp.makeRe("", { nocase: true }); - util.GlobExp.makeRe("", { nocomment: true }); - util.GlobExp.makeRe("", { noext: true }); - util.GlobExp.makeRe("", { noglobstar: true }); - util.GlobExp.makeRe("", { nonegate: true }); - util.GlobExp.test("a", "b", {}); - util.GlobExp.test("a", "b", { dot: true }); - util.GlobExp.test("a", "b", { flipNegate: true }); - util.GlobExp.test("a", "b", { matchBase: true }); - util.GlobExp.test("a", "b", { nobrace: true }); - util.GlobExp.test("a", "b", { nocase: true }); - util.GlobExp.test("a", "b", { nocomment: true }); - util.GlobExp.test("a", "b", { noext: true }); - util.GlobExp.test("a", "b", { noglobstar: true }); - util.GlobExp.test("a", "b", { nonegate: true }); - } - namespace iconv { // TODO } @@ -477,19 +389,6 @@ namespace utilTests { const b: string = util.sqlstring.dateToString(123, "local"); } - namespace arrayToList { - const a: string = util.sqlstring.arrayToList(["1", "a"]); - } - - namespace bufferToString { - const a: string = util.sqlstring.bufferToString(Buffer.alloc(10)); - } - - namespace objectToValues { - const a: string = util.sqlstring.objectToValues({ a: 1 }); - const b: string = util.sqlstring.objectToValues({ a: 1 }, "local"); - } - namespace escape { const a: string = util.sqlstring.escape(1); const b: string = util.sqlstring.escape(1, true); @@ -532,44 +431,82 @@ namespace utilTests { } namespace buffer { - const a: Buffer = util.buffer.concat([Buffer.alloc(10), Buffer.alloc(20)], 30); - util.buffer.mask(Buffer.alloc(10), Buffer.alloc(10), Buffer.alloc(10), 0, 10); - util.buffer.unmask(Buffer.alloc(10), Buffer.alloc(10)); + namespace toArrayBuffer { + const a = util.buffer.toArrayBuffer(Buffer.from("hello")); + a.slice(10); + } + + namespace xor { + const a = util.buffer.xor(Buffer.from("hello"), Buffer.from("world")); + a.writeUInt32LE(20, 1); + } } namespace shebang { const a: string | null = util.shebang("#!/bin/sh"); } - namespace ReInterval { - new util.ReInterval(() => { }, 1000); - new util.ReInterval(() => { }, 1000, [1]); - const a = new util.ReInterval(() => { }, 1000); + namespace reinterval { + util.reinterval(() => { }, 1000); + util.reinterval(() => { }, 1000, [1]); + const a = util.reinterval(() => { }, 1000); a.reschedule(400); a.clear(); a.destroy(); } - namespace RateLimiter { - new util.RateLimiter(); - new util.RateLimiter(1); - new util.RateLimiter(1, 1000); - new util.RateLimiter(1, 1000, true); - const a = new util.RateLimiter(); - a.removeTokens(1).then((x: number) => { }); - const b: boolean = a.tryRemoveTokens(10); - const c: number = a.getTokensRemaining(); - } - namespace throttle { - const a: () => Promise = util.throttle(() => 42); - const b: (a: number) => Promise = util.throttle((a: number) => `${a}`); - const c: (a: number, b: string) => Promise = util.throttle((a: number, b: string) => String(a) + b); - const d = util.throttle(() => { }, {}); - const e = util.throttle(() => { }, { interval: 1000 }); - const f = util.throttle(() => { }, { max: 10 }); - const g = util.throttle(() => { }, { ordered: true }); - const h = util.throttle(() => { }, { waitForReturn: true }); + namespace RateLimiter { + new util.throttle.RateLimiter(); + new util.throttle.RateLimiter(1); + new util.throttle.RateLimiter(1, 1000); + new util.throttle.RateLimiter(1, 1000, true); + const a = new util.throttle.RateLimiter(); + a.removeTokens(1).then((x: number) => { }); + const b: boolean = a.tryRemoveTokens(10); + const c: number = a.getTokensRemaining(); + } + + const a: () => Promise = util.throttle.create(() => 42); + const b: (a: number) => Promise = util.throttle.create((a: number) => `${a}`); + const c: (a: number, b: string) => Promise = util.throttle.create((a: number, b: string) => String(a) + b); + const d = util.throttle.create(() => { }, {}); + const e = util.throttle.create(() => { }, { interval: 1000 }); + const f = util.throttle.create(() => { }, { concurrency: 10 }); + const g = util.throttle.create(() => { }, { ordered: true }); + const h = util.throttle.create(() => { }, { waitForReturn: true }); + const i = util.throttle.create(() => { }, { onDone() {} }); + const j = util.throttle.create(() => { }, { drop: true }); + const k = util.throttle.create(() => { }, { dropLast: true }); + + const l: symbol = util.throttle.DROPPED; + + { + const t = util.throttle.create(); + t(() => 2).then((x: number) => {}); + t(() => Promise.resolve(2)).then((x: number) => {}); + + t(() => "2").then((x: string) => {}); + t(() => Promise.resolve("2")).then((x: string) => {}); + + t((a) => a, 2).then((x: number) => {}); + t((a) => Promise.resolve(a), 2).then((x: number) => {}); + + t((a, b) => String(a) + b, 2, "3").then((x: string) => {}); + t(async (a, b) => String(a) + b, 2, "3").then((x: string) => x); + + t((a, b, c) => String(a) + b + c, 2, "3", "4").then((x: string) => {}); + t(async (a, b, c) => String(a) + b + c, 2, "3", "4").then((x: string) => x); + + t((a, b, c, d) => String(a) + b + c + String(d), 2, "3", "4", 5).then((x: string) => {}); + t(async (a, b, c, d) => String(a) + b + c + String(d), 2, "3", "4", 5).then((x: string) => x); + + t((a, b, c, d, e) => String(a) + b + c + String(d) + e.join(","), 2, "3", "4", 5, [1, 2, 3]).then((x: string) => {}); + t(async (a, b, c, d, e) => String(a) + b + c + String(d) + e.join(","), 2, "3", "4", 5, [1, 2, 3]).then((x: string) => x); + + t((a, b, c, d, e, f) => String(a) + b + c + String(d) + e.join(",") + f, 2, "3", "4", 5, [1, 2, 3], 6).then((x: any) => {}); + t(async (a, b, c, d, e, f) => String(a) + b + c + String(d) + e.join(",") + f, 2, "3", "4", 5, [1, 2, 3], 6).then((x: any) => x); + } } namespace fakeClock { @@ -741,17 +678,6 @@ namespace utilTests { } } - namespace userid { - const { userid } = util; - - { const a: number = userid.uid("someone").gid; } - { const a: number = userid.uid("someone").uid; } - { const a: number = userid.gid("someone"); } - { const a: string = userid.username(1000); } - { const a: string = userid.groupname(1000); } - { const gids: number[] = userid.gids("someone"); } - } - namespace LogRotator { const { LogRotator } = util; new LogRotator("file.log"); @@ -766,4 +692,697 @@ namespace utilTests { new LogRotator("file.log").start(); new LogRotator("file.log").stop(); } + + namespace arrayDiff { + const { arrayDiff } = util; + + arrayDiff([1, 2, 3], [4, 5, 6])[0].toFixed(); + arrayDiff(["1"])[0].charCodeAt(100); + } + + namespace fillRange { + const { fillRange } = util; + + { const a: number[] = fillRange(1, 2); } + { const a: string[] = fillRange(1, 2, { stringify: true }); } + { const a: string = fillRange(1, 2, { toRegex: true }); } + { const a: string[] = fillRange("1", "2"); } + { const a: string = fillRange("1", "2", { toRegex: true }); } + } + + namespace inflection { + const { inflection } = util; + + { const a: string = inflection.singularizeWord("hello"); } + { const a: string = inflection.singularizeWord("hello", "aaaa"); } + { const a: string = inflection.pluralizeWord("hello"); } + { const a: string = inflection.pluralizeWord("hello", "aaaa"); } + { const a: string = inflection.underscore("hello"); } + } + + namespace machineId { + const { machineId } = util; + + (async () => { + const a: string = await machineId(); + }); + } + + namespace merge { + const { merge } = util; + + merge({}, {}); + merge({}, {}, { allowPrototypes: true }); + merge({}, {}, { plainObjects: false }); + } + + namespace omit { + const { omit } = util; + + omit({}, ["a"]); + omit({}, "a"); + omit({}, (x) => x === "a"); + } + + namespace parseTime { + const { parseTime } = util; + + { const a: number = parseTime(123); } + { const a: number | null = parseTime("12"); } + } + + namespace pick { + const { pick } = util; + + pick({}, ["a", "b", "c"]); + pick({}, new Set(["a", "b", "c"])); + } + + namespace querystring { + const { querystring: qs } = util; + + { const a: string = qs.escape("asd"); } + { const a: string = qs.formats.default; } + { const a: string = qs.formats.RFC1738; } + { const a: string = qs.formats.RFC3986; } + { const a: string = qs.formats.formatters.RFC1738("ha"); } + { const a: string = qs.formats.formatters.RFC3986("ha"); } + { const a: object = qs.parse("asdasd"); } + { const a: object = qs.parse("asdasd", {}); } + { const a: object = qs.parse("asdasd", { allowDots: false }); } + { const a: object = qs.parse("asdasd", { allowPrototypes: false }); } + { const a: object = qs.parse("asdasd", { arrayLimit: 100 }); } + { const a: object = qs.parse("asdasd", { decoder: (s) => s }); } + { const a: object = qs.parse("asdasd", { decoder: (s, d) => d(s) }); } + { const a: object = qs.parse("asdasd", { delimiter: "a" }); } + { const a: object = qs.parse("asdasd", { depth: 100 }); } + { const a: object = qs.parse("asdasd", { ignoreQueryPrefix: false }); } + { const a: object = qs.parse("asdasd", { parameterLimit: 100 }); } + { const a: object = qs.parse("asdasd", { parseArrays: false }); } + { const a: object = qs.parse("asdasd", { plainObjects: true }); } + { const a: object = qs.parse("asdasd", { strictNullHandling: false }); } + { const a: string = qs.stringify({}); } + { const a: string = qs.stringify({}, {}); } + { const a: string = qs.stringify({}, { addQueryPrefix: false }); } + { const a: string = qs.stringify({}, { allowDots: false }); } + { const a: string = qs.stringify({}, { arrayFormat: "indices" }); } + { const a: string = qs.stringify({}, { arrayFormat: "brackets" }); } + { const a: string = qs.stringify({}, { arrayFormat: "repeat" }); } + { const a: string = qs.stringify({}, { delimiter: "1" }); } + { const a: string = qs.stringify({}, { encode: true }); } + { const a: string = qs.stringify({}, { encoder: (s) => s }); } + { const a: string = qs.stringify({}, { encodeValuesOnly: false }); } + { const a: string = qs.stringify({}, { filter: [1, 2, 3] }); } + { const a: string = qs.stringify({}, { filter: ["1", "2", "3"] }); } + { const a: string = qs.stringify({}, { filter: (prefix: string, value: any) => value === 1 }); } + { const a: string = qs.stringify({}, { indices: false }); } + { const a: string = qs.stringify({}, { serializeDate(d) { return String(d.getTime()); } }); } + { const a: string = qs.stringify({}, { skipNulls: false }); } + { const a: string = qs.stringify({}, { sort(a, b) { return a - b; } }); } + { const a: string = qs.stringify({}, { strictNullHandling: false }); } + } + + namespace regexNot { + const { regexNot } = util; + + { const a: RegExp = regexNot("a"); } + { const a: RegExp = regexNot("a", {}); } + { const a: RegExp = regexNot("a", { contains: false }); } + } + + namespace repeat { + const { repeat } = util; + { const a: number[] = repeat(1, 10); } + { const a: string[] = repeat("a", 10); } + { const a: number[][] = repeat([2], 10); } + } + + namespace signalNameToCode { + const { signalNameToCode } = util; + signalNameToCode("SIGINT").toFixed(2); + } + + namespace splitBuffer { + const { splitBuffer } = util; + + { const a: Buffer[] = splitBuffer(Buffer.from("asd"), Buffer.from("|")); } + { const a: Buffer[] = splitBuffer(Buffer.from("asd"), Buffer.from("|"), true); } + { const a: Buffer[] = splitBuffer("asd", Buffer.from("|"), true); } + { const a: Buffer[] = splitBuffer("asd", "|"); } + } + + namespace splitString { + const { splitString } = util; + + splitString("a"); + splitString("a", {}); + splitString("a", { braces: false }); + splitString("a", { keepDoubleQuotes: false }); + splitString("a", { keepEscaping: false }); + splitString("a", { keepQuotes: false }); + splitString("a", { keepSingleQuotes: false }); + splitString("a", { separator: "|" }); + splitString("a", { + split(token) { + { const a: string[] = token.arr; } + { const a: number = token.idx; } + { const a: string = token.str; } + { const a: string = token.val; } + } + }); + splitString("a", (token) => { + { const a: string[] = token.arr; } + { const a: number = token.idx; } + { const a: string = token.str; } + { const a: string = token.val; } + }); + splitString("a", {}, (token) => { + { const a: string[] = token.arr; } + { const a: number = token.idx; } + { const a: string = token.str; } + { const a: string = token.val; } + }); + } + + namespace toRegex { + const { toRegex } = util; + + { const a: RegExp = toRegex("a"); } + { const a: RegExp = toRegex(["a"]); } + { const a: RegExp = toRegex(["a"], {}); } + { const a: RegExp = toRegex(["a"], { cache: false }); } + { const a: RegExp = toRegex(["a"], { contains: false }); } + { const a: RegExp = toRegex(["a"], { flags: "i" }); } + { const a: RegExp = toRegex(["a"], { negate: false }); } + { const a: RegExp = toRegex(["a"], { nocase: false }); } + } + + namespace toRegexRange { + const { toRegexRange } = util; + + { const a: RegExp = toRegexRange(1, 10); } + { const a: RegExp = toRegexRange("1", "10"); } + { const a: RegExp = toRegexRange(1, 10, {}); } + { const a: RegExp = toRegexRange(1, 10, { capture: false }); } + { const a: RegExp = toRegexRange(1, 10, { relaxZeros: true }); } + { const a: RegExp = toRegexRange(1, 10, { shorthand: false }); } + } + + namespace xorDistance { + const { compare, create, eq, gt, lt } = util.xorDistance; + + { const a: boolean = compare(Buffer.from("1"), Buffer.from("2")); } + { const a: Buffer = create(Buffer.from("1"), Buffer.from("2")); } + { const a: boolean = gt(Buffer.from("1"), Buffer.from("2")); } + { const a: boolean = lt(Buffer.from("1"), Buffer.from("2")); } + { const a: boolean = eq(Buffer.from("1"), Buffer.from("2")); } + } + + namespace braces { + const { braces } = util; + + { const a: string[] = braces("a"); } + { const a: string[] = braces("a", {}); } + { const a: string[] = braces("a", { expand: false }); } + { const a: string[] = braces("a", { nodupes: false }); } + { const a: string[] = braces("a", { optimize: true }); } + { const a: string[] = braces("a", { quantifiers: false }); } + { const a: string[] = braces("a", { rangeLimit: 100 }); } + { const a: string[] = braces("a", { transform: (s: string) => s }); } + { const a: string[] = braces("a", { unescape: false }); } + + { const a: string[] = braces.expand("a"); } + { const a: string[] = braces.expand("a", {}); } + { const a: string[] = braces.expand("a", { expand: false }); } + { const a: string[] = braces.expand("a", { nodupes: false }); } + { const a: string[] = braces.expand("a", { optimize: true }); } + { const a: string[] = braces.expand("a", { quantifiers: false }); } + { const a: string[] = braces.expand("a", { rangeLimit: 100 }); } + { const a: string[] = braces.expand("a", { transform: (s: string) => s }); } + { const a: string[] = braces.expand("a", { unescape: false }); } + + { const a: RegExp = braces.makeRe("a"); } + { const a: RegExp = braces.makeRe("a", {}); } + { const a: RegExp = braces.makeRe("a", { expand: false }); } + { const a: RegExp = braces.makeRe("a", { nodupes: false }); } + { const a: RegExp = braces.makeRe("a", { optimize: true }); } + { const a: RegExp = braces.makeRe("a", { quantifiers: false }); } + { const a: RegExp = braces.makeRe("a", { rangeLimit: 100 }); } + { const a: RegExp = braces.makeRe("a", { transform: (s: string) => s }); } + { const a: RegExp = braces.makeRe("a", { unescape: false }); } + + { const a: number = braces.MAX_LENGTH; } + { const a: object = braces.getCache(); } + braces.clearCache(); + braces.resizeCache(100500); + } + + namespace match { + const { match } = util; + + { const a: string[] = match(["a"], "a"); } + { const a: string[] = match(["a"], ["a"]); } + { const a: string[] = match(["a"], ["a"], {}); } + { const a: string[] = match(["a"], ["a"], { basename: false }); } + { const a: string[] = match(["a"], ["a"], { bash: false }); } + { const a: string[] = match(["a"], ["a"], { cache: false }); } + { const a: string[] = match(["a"], ["a"], { dot: true }); } + { const a: string[] = match(["a"], ["a"], { failglob: false }); } + { const a: string[] = match(["a"], ["a"], { ignore: "a" }); } + { const a: string[] = match(["a"], ["a"], { ignore: ["a"] }); } + { const a: string[] = match(["a"], ["a"], { matchBase: false }); } + { const a: string[] = match(["a"], ["a"], { nobrace: true }); } + { const a: string[] = match(["a"], ["a"], { nocase: false }); } + { const a: string[] = match(["a"], ["a"], { nodupes: true }); } + { const a: string[] = match(["a"], ["a"], { noext: false }); } + { const a: string[] = match(["a"], ["a"], { noglobstar: true }); } + { const a: string[] = match(["a"], ["a"], { nonegate: false }); } + { const a: string[] = match(["a"], ["a"], { nonull: false }); } + { const a: string[] = match(["a"], ["a"], { nullglob: false }); } + { const a: string[] = match(["a"], ["a"], { snapdragon: {} }); } + { const a: string[] = match(["a"], ["a"], { sourcemap: false }); } + { const a: string[] = match(["a"], ["a"], { unescape: false }); } + { const a: string[] = match(["a"], ["a"], { unixify: false }); } + + { const a: string[] = match.match(["a"], "a"); } + { const a: string[] = match.match(["a"], "a", {}); } + { const a: string[] = match.match(["a"], "a", { basename: false }); } + { const a: string[] = match.match(["a"], "a", { bash: false }); } + { const a: string[] = match.match(["a"], "a", { cache: false }); } + { const a: string[] = match.match(["a"], "a", { dot: true }); } + { const a: string[] = match.match(["a"], "a", { failglob: false }); } + { const a: string[] = match.match(["a"], "a", { ignore: "a" }); } + { const a: string[] = match.match(["a"], "a", { ignore: ["a"] }); } + { const a: string[] = match.match(["a"], "a", { matchBase: false }); } + { const a: string[] = match.match(["a"], "a", { nobrace: true }); } + { const a: string[] = match.match(["a"], "a", { nocase: false }); } + { const a: string[] = match.match(["a"], "a", { nodupes: true }); } + { const a: string[] = match.match(["a"], "a", { noext: false }); } + { const a: string[] = match.match(["a"], "a", { noglobstar: true }); } + { const a: string[] = match.match(["a"], "a", { nonegate: false }); } + { const a: string[] = match.match(["a"], "a", { nonull: false }); } + { const a: string[] = match.match(["a"], "a", { nullglob: false }); } + { const a: string[] = match.match(["a"], "a", { snapdragon: {} }); } + { const a: string[] = match.match(["a"], "a", { sourcemap: false }); } + { const a: string[] = match.match(["a"], "a", { unescape: false }); } + { const a: string[] = match.match(["a"], "a", { unixify: false }); } + + { const a: boolean = match.isMatch("a", "a"); } + { const a: boolean = match.isMatch("a", "a", {}); } + { const a: boolean = match.isMatch("a", "a", { basename: false }); } + { const a: boolean = match.isMatch("a", "a", { bash: false }); } + { const a: boolean = match.isMatch("a", "a", { cache: false }); } + { const a: boolean = match.isMatch("a", "a", { dot: true }); } + { const a: boolean = match.isMatch("a", "a", { failglob: false }); } + { const a: boolean = match.isMatch("a", "a", { ignore: "a" }); } + { const a: boolean = match.isMatch("a", "a", { ignore: ["a"] }); } + { const a: boolean = match.isMatch("a", "a", { matchBase: false }); } + { const a: boolean = match.isMatch("a", "a", { nobrace: true }); } + { const a: boolean = match.isMatch("a", "a", { nocase: false }); } + { const a: boolean = match.isMatch("a", "a", { nodupes: true }); } + { const a: boolean = match.isMatch("a", "a", { noext: false }); } + { const a: boolean = match.isMatch("a", "a", { noglobstar: true }); } + { const a: boolean = match.isMatch("a", "a", { nonegate: false }); } + { const a: boolean = match.isMatch("a", "a", { nonull: false }); } + { const a: boolean = match.isMatch("a", "a", { nullglob: false }); } + { const a: boolean = match.isMatch("a", "a", { snapdragon: {} }); } + { const a: boolean = match.isMatch("a", "a", { sourcemap: false }); } + { const a: boolean = match.isMatch("a", "a", { unescape: false }); } + { const a: boolean = match.isMatch("a", "a", { unixify: false }); } + + { const a: boolean = match.some(["a"], ["a"]); } + { const a: boolean = match.some("a", "a"); } + { const a: boolean = match.some("a", "a", {}); } + { const a: boolean = match.some("a", "a", { basename: false }); } + { const a: boolean = match.some("a", "a", { bash: false }); } + { const a: boolean = match.some("a", "a", { cache: false }); } + { const a: boolean = match.some("a", "a", { dot: true }); } + { const a: boolean = match.some("a", "a", { failglob: false }); } + { const a: boolean = match.some("a", "a", { ignore: "a" }); } + { const a: boolean = match.some("a", "a", { ignore: ["a"] }); } + { const a: boolean = match.some("a", "a", { matchBase: false }); } + { const a: boolean = match.some("a", "a", { nobrace: true }); } + { const a: boolean = match.some("a", "a", { nocase: false }); } + { const a: boolean = match.some("a", "a", { nodupes: true }); } + { const a: boolean = match.some("a", "a", { noext: false }); } + { const a: boolean = match.some("a", "a", { noglobstar: true }); } + { const a: boolean = match.some("a", "a", { nonegate: false }); } + { const a: boolean = match.some("a", "a", { nonull: false }); } + { const a: boolean = match.some("a", "a", { nullglob: false }); } + { const a: boolean = match.some("a", "a", { snapdragon: {} }); } + { const a: boolean = match.some("a", "a", { sourcemap: false }); } + { const a: boolean = match.some("a", "a", { unescape: false }); } + { const a: boolean = match.some("a", "a", { unixify: false }); } + + { const a: boolean = match.every(["a"], ["a"]); } + { const a: boolean = match.every("a", "a"); } + { const a: boolean = match.every("a", "a", {}); } + { const a: boolean = match.every("a", "a", { basename: false }); } + { const a: boolean = match.every("a", "a", { bash: false }); } + { const a: boolean = match.every("a", "a", { cache: false }); } + { const a: boolean = match.every("a", "a", { dot: true }); } + { const a: boolean = match.every("a", "a", { failglob: false }); } + { const a: boolean = match.every("a", "a", { ignore: "a" }); } + { const a: boolean = match.every("a", "a", { ignore: ["a"] }); } + { const a: boolean = match.every("a", "a", { matchBase: false }); } + { const a: boolean = match.every("a", "a", { nobrace: true }); } + { const a: boolean = match.every("a", "a", { nocase: false }); } + { const a: boolean = match.every("a", "a", { nodupes: true }); } + { const a: boolean = match.every("a", "a", { noext: false }); } + { const a: boolean = match.every("a", "a", { noglobstar: true }); } + { const a: boolean = match.every("a", "a", { nonegate: false }); } + { const a: boolean = match.every("a", "a", { nonull: false }); } + { const a: boolean = match.every("a", "a", { nullglob: false }); } + { const a: boolean = match.every("a", "a", { snapdragon: {} }); } + { const a: boolean = match.every("a", "a", { sourcemap: false }); } + { const a: boolean = match.every("a", "a", { unescape: false }); } + { const a: boolean = match.every("a", "a", { unixify: false }); } + + { const a: boolean = match.any(["a"], ["a"]); } + { const a: boolean = match.any("a", "a"); } + { const a: boolean = match.any("a", "a", {}); } + { const a: boolean = match.any("a", "a", { basename: false }); } + { const a: boolean = match.any("a", "a", { bash: false }); } + { const a: boolean = match.any("a", "a", { cache: false }); } + { const a: boolean = match.any("a", "a", { dot: true }); } + { const a: boolean = match.any("a", "a", { failglob: false }); } + { const a: boolean = match.any("a", "a", { ignore: "a" }); } + { const a: boolean = match.any("a", "a", { ignore: ["a"] }); } + { const a: boolean = match.any("a", "a", { matchBase: false }); } + { const a: boolean = match.any("a", "a", { nobrace: true }); } + { const a: boolean = match.any("a", "a", { nocase: false }); } + { const a: boolean = match.any("a", "a", { nodupes: true }); } + { const a: boolean = match.any("a", "a", { noext: false }); } + { const a: boolean = match.any("a", "a", { noglobstar: true }); } + { const a: boolean = match.any("a", "a", { nonegate: false }); } + { const a: boolean = match.any("a", "a", { nonull: false }); } + { const a: boolean = match.any("a", "a", { nullglob: false }); } + { const a: boolean = match.any("a", "a", { snapdragon: {} }); } + { const a: boolean = match.any("a", "a", { sourcemap: false }); } + { const a: boolean = match.any("a", "a", { unescape: false }); } + { const a: boolean = match.any("a", "a", { unixify: false }); } + + { const a: boolean = match.all("a", "a"); } + { const a: boolean = match.all("a", ["a"]); } + { const a: boolean = match.all(["a"], "a"); } + { const a: boolean = match.all(["a"], "a", {}); } + { const a: boolean = match.all(["a"], ["a"], { basename: false }); } + { const a: boolean = match.all(["a"], ["a"], { bash: false }); } + { const a: boolean = match.all(["a"], ["a"], { cache: false }); } + { const a: boolean = match.all(["a"], ["a"], { dot: true }); } + { const a: boolean = match.all(["a"], ["a"], { failglob: false }); } + { const a: boolean = match.all(["a"], ["a"], { ignore: "a" }); } + { const a: boolean = match.all(["a"], ["a"], { ignore: ["a"] }); } + { const a: boolean = match.all(["a"], ["a"], { matchBase: false }); } + { const a: boolean = match.all(["a"], ["a"], { nobrace: true }); } + { const a: boolean = match.all(["a"], ["a"], { nocase: false }); } + { const a: boolean = match.all(["a"], ["a"], { nodupes: true }); } + { const a: boolean = match.all(["a"], ["a"], { noext: false }); } + { const a: boolean = match.all(["a"], ["a"], { noglobstar: true }); } + { const a: boolean = match.all(["a"], ["a"], { nonegate: false }); } + { const a: boolean = match.all(["a"], ["a"], { nonull: false }); } + { const a: boolean = match.all(["a"], ["a"], { nullglob: false }); } + { const a: boolean = match.all(["a"], ["a"], { snapdragon: {} }); } + { const a: boolean = match.all(["a"], ["a"], { sourcemap: false }); } + { const a: boolean = match.all(["a"], ["a"], { unescape: false }); } + { const a: boolean = match.all(["a"], ["a"], { unixify: false }); } + + { const a: string[] = match.not(["a"], ["a"]); } + { const a: string[] = match.not(["a"], "a"); } + { const a: string[] = match.not(["a"], "a", {}); } + { const a: string[] = match.not(["a"], "a", { basename: false }); } + { const a: string[] = match.not(["a"], "a", { bash: false }); } + { const a: string[] = match.not(["a"], "a", { cache: false }); } + { const a: string[] = match.not(["a"], "a", { dot: true }); } + { const a: string[] = match.not(["a"], "a", { failglob: false }); } + { const a: string[] = match.not(["a"], "a", { ignore: "a" }); } + { const a: string[] = match.not(["a"], "a", { ignore: ["a"] }); } + { const a: string[] = match.not(["a"], "a", { matchBase: false }); } + { const a: string[] = match.not(["a"], "a", { nobrace: true }); } + { const a: string[] = match.not(["a"], "a", { nocase: false }); } + { const a: string[] = match.not(["a"], "a", { nodupes: true }); } + { const a: string[] = match.not(["a"], "a", { noext: false }); } + { const a: string[] = match.not(["a"], "a", { noglobstar: true }); } + { const a: string[] = match.not(["a"], "a", { nonegate: false }); } + { const a: string[] = match.not(["a"], "a", { nonull: false }); } + { const a: string[] = match.not(["a"], "a", { nullglob: false }); } + { const a: string[] = match.not(["a"], "a", { snapdragon: {} }); } + { const a: string[] = match.not(["a"], "a", { sourcemap: false }); } + { const a: string[] = match.not(["a"], "a", { unescape: false }); } + { const a: string[] = match.not(["a"], "a", { unixify: false }); } + + { const a: boolean = match.contains("a", "a"); } + { const a: boolean = match.contains("a", ["a"]); } + { const a: boolean = match.contains("a", ["a"], {}); } + { const a: boolean = match.contains("a", ["a"], { basename: false }); } + { const a: boolean = match.contains("a", ["a"], { bash: false }); } + { const a: boolean = match.contains("a", ["a"], { cache: false }); } + { const a: boolean = match.contains("a", ["a"], { dot: true }); } + { const a: boolean = match.contains("a", ["a"], { failglob: false }); } + { const a: boolean = match.contains("a", ["a"], { ignore: "a" }); } + { const a: boolean = match.contains("a", ["a"], { ignore: ["a"] }); } + { const a: boolean = match.contains("a", ["a"], { matchBase: false }); } + { const a: boolean = match.contains("a", ["a"], { nobrace: true }); } + { const a: boolean = match.contains("a", ["a"], { nocase: false }); } + { const a: boolean = match.contains("a", ["a"], { nodupes: true }); } + { const a: boolean = match.contains("a", ["a"], { noext: false }); } + { const a: boolean = match.contains("a", ["a"], { noglobstar: true }); } + { const a: boolean = match.contains("a", ["a"], { nonegate: false }); } + { const a: boolean = match.contains("a", ["a"], { nonull: false }); } + { const a: boolean = match.contains("a", ["a"], { nullglob: false }); } + { const a: boolean = match.contains("a", ["a"], { snapdragon: {} }); } + { const a: boolean = match.contains("a", ["a"], { sourcemap: false }); } + { const a: boolean = match.contains("a", ["a"], { unescape: false }); } + { const a: boolean = match.contains("a", ["a"], { unixify: false }); } + + { const a: object = match.matchKeys({}, "a"); } + { const a: object = match.matchKeys({}, ["a"]); } + { const a: object = match.matchKeys({}, ["a"], {}); } + { const a: object = match.matchKeys({}, ["a"], { basename: false }); } + { const a: object = match.matchKeys({}, ["a"], { bash: false }); } + { const a: object = match.matchKeys({}, ["a"], { cache: false }); } + { const a: object = match.matchKeys({}, ["a"], { dot: true }); } + { const a: object = match.matchKeys({}, ["a"], { failglob: false }); } + { const a: object = match.matchKeys({}, ["a"], { ignore: "a" }); } + { const a: object = match.matchKeys({}, ["a"], { ignore: ["a"] }); } + { const a: object = match.matchKeys({}, ["a"], { matchBase: false }); } + { const a: object = match.matchKeys({}, ["a"], { nobrace: true }); } + { const a: object = match.matchKeys({}, ["a"], { nocase: false }); } + { const a: object = match.matchKeys({}, ["a"], { nodupes: true }); } + { const a: object = match.matchKeys({}, ["a"], { noext: false }); } + { const a: object = match.matchKeys({}, ["a"], { noglobstar: true }); } + { const a: object = match.matchKeys({}, ["a"], { nonegate: false }); } + { const a: object = match.matchKeys({}, ["a"], { nonull: false }); } + { const a: object = match.matchKeys({}, ["a"], { nullglob: false }); } + { const a: object = match.matchKeys({}, ["a"], { snapdragon: {} }); } + { const a: object = match.matchKeys({}, ["a"], { sourcemap: false }); } + { const a: object = match.matchKeys({}, ["a"], { unescape: false }); } + { const a: object = match.matchKeys({}, ["a"], { unixify: false }); } + + { const a: (s: string) => boolean = match.matcher("a"); } + { const a: (s: string) => boolean = match.matcher(["a"]); } + { const a: (s: string) => boolean = match.matcher(["a"], {}); } + { const a: (s: string) => boolean = match.matcher(["a"], { basename: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { bash: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { cache: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { dot: true }); } + { const a: (s: string) => boolean = match.matcher(["a"], { failglob: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { ignore: "a" }); } + { const a: (s: string) => boolean = match.matcher(["a"], { ignore: ["a"] }); } + { const a: (s: string) => boolean = match.matcher(["a"], { matchBase: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { nobrace: true }); } + { const a: (s: string) => boolean = match.matcher(["a"], { nocase: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { nodupes: true }); } + { const a: (s: string) => boolean = match.matcher(["a"], { noext: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { noglobstar: true }); } + { const a: (s: string) => boolean = match.matcher(["a"], { nonegate: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { nonull: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { nullglob: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { snapdragon: {} }); } + { const a: (s: string) => boolean = match.matcher(["a"], { sourcemap: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { unescape: false }); } + { const a: (s: string) => boolean = match.matcher(["a"], { unixify: false }); } + + { const a: string[] | null = match.capture("a", "a"); } + { const a: string[] | null = match.capture("a", "a", {}); } + { const a: string[] | null = match.capture("a", "a", { basename: false }); } + { const a: string[] | null = match.capture("a", "a", { bash: false }); } + { const a: string[] | null = match.capture("a", "a", { cache: false }); } + { const a: string[] | null = match.capture("a", "a", { dot: true }); } + { const a: string[] | null = match.capture("a", "a", { failglob: false }); } + { const a: string[] | null = match.capture("a", "a", { ignore: "a" }); } + { const a: string[] | null = match.capture("a", "a", { ignore: ["a"] }); } + { const a: string[] | null = match.capture("a", "a", { matchBase: false }); } + { const a: string[] | null = match.capture("a", "a", { nobrace: true }); } + { const a: string[] | null = match.capture("a", "a", { nocase: false }); } + { const a: string[] | null = match.capture("a", "a", { nodupes: true }); } + { const a: string[] | null = match.capture("a", "a", { noext: false }); } + { const a: string[] | null = match.capture("a", "a", { noglobstar: true }); } + { const a: string[] | null = match.capture("a", "a", { nonegate: false }); } + { const a: string[] | null = match.capture("a", "a", { nonull: false }); } + { const a: string[] | null = match.capture("a", "a", { nullglob: false }); } + { const a: string[] | null = match.capture("a", "a", { snapdragon: {} }); } + { const a: string[] | null = match.capture("a", "a", { sourcemap: false }); } + { const a: string[] | null = match.capture("a", "a", { unescape: false }); } + { const a: string[] | null = match.capture("a", "a", { unixify: false }); } + + { const a: RegExp = match.makeRe("a"); } + { const a: RegExp = match.makeRe("a", {}); } + { const a: RegExp = match.makeRe("a", { basename: false }); } + { const a: RegExp = match.makeRe("a", { bash: false }); } + { const a: RegExp = match.makeRe("a", { cache: false }); } + { const a: RegExp = match.makeRe("a", { dot: true }); } + { const a: RegExp = match.makeRe("a", { failglob: false }); } + { const a: RegExp = match.makeRe("a", { ignore: "a" }); } + { const a: RegExp = match.makeRe("a", { ignore: ["a"] }); } + { const a: RegExp = match.makeRe("a", { matchBase: false }); } + { const a: RegExp = match.makeRe("a", { nobrace: true }); } + { const a: RegExp = match.makeRe("a", { nocase: false }); } + { const a: RegExp = match.makeRe("a", { nodupes: true }); } + { const a: RegExp = match.makeRe("a", { noext: false }); } + { const a: RegExp = match.makeRe("a", { noglobstar: true }); } + { const a: RegExp = match.makeRe("a", { nonegate: false }); } + { const a: RegExp = match.makeRe("a", { nonull: false }); } + { const a: RegExp = match.makeRe("a", { nullglob: false }); } + { const a: RegExp = match.makeRe("a", { snapdragon: {} }); } + { const a: RegExp = match.makeRe("a", { sourcemap: false }); } + { const a: RegExp = match.makeRe("a", { unescape: false }); } + { const a: RegExp = match.makeRe("a", { unixify: false }); } + + { const a: string[] = match.braces("a"); } + { const a: string[] = match.braces("a", {}); } + { const a: string[] = match.braces("a", {}); } + { const a: string[] = match.braces("a", { basename: false }); } + { const a: string[] = match.braces("a", { bash: false }); } + { const a: string[] = match.braces("a", { cache: false }); } + { const a: string[] = match.braces("a", { dot: true }); } + { const a: string[] = match.braces("a", { failglob: false }); } + { const a: string[] = match.braces("a", { ignore: "a" }); } + { const a: string[] = match.braces("a", { ignore: ["a"] }); } + { const a: string[] = match.braces("a", { matchBase: false }); } + { const a: string[] = match.braces("a", { nobrace: true }); } + { const a: string[] = match.braces("a", { nocase: false }); } + { const a: string[] = match.braces("a", { nodupes: true }); } + { const a: string[] = match.braces("a", { noext: false }); } + { const a: string[] = match.braces("a", { noglobstar: true }); } + { const a: string[] = match.braces("a", { nonegate: false }); } + { const a: string[] = match.braces("a", { nonull: false }); } + { const a: string[] = match.braces("a", { nullglob: false }); } + { const a: string[] = match.braces("a", { snapdragon: {} }); } + { const a: string[] = match.braces("a", { sourcemap: false }); } + { const a: string[] = match.braces("a", { unescape: false }); } + { const a: string[] = match.braces("a", { unixify: false }); } + + { const a: object = match.create("a"); } + { const a: object = match.create("a", {}); } + { const a: object = match.create("a", { basename: false }); } + { const a: object = match.create("a", { bash: false }); } + { const a: object = match.create("a", { cache: false }); } + { const a: object = match.create("a", { dot: true }); } + { const a: object = match.create("a", { failglob: false }); } + { const a: object = match.create("a", { ignore: "a" }); } + { const a: object = match.create("a", { ignore: ["a"] }); } + { const a: object = match.create("a", { matchBase: false }); } + { const a: object = match.create("a", { nobrace: true }); } + { const a: object = match.create("a", { nocase: false }); } + { const a: object = match.create("a", { nodupes: true }); } + { const a: object = match.create("a", { noext: false }); } + { const a: object = match.create("a", { noglobstar: true }); } + { const a: object = match.create("a", { nonegate: false }); } + { const a: object = match.create("a", { nonull: false }); } + { const a: object = match.create("a", { nullglob: false }); } + { const a: object = match.create("a", { snapdragon: {} }); } + { const a: object = match.create("a", { sourcemap: false }); } + { const a: object = match.create("a", { unescape: false }); } + { const a: object = match.create("a", { unixify: false }); } + { const a: object = match.create("a"); } + + { const a: object = match.parse("a", {}); } + { const a: object = match.parse("a", { basename: false }); } + { const a: object = match.parse("a", { bash: false }); } + { const a: object = match.parse("a", { cache: false }); } + { const a: object = match.parse("a", { dot: true }); } + { const a: object = match.parse("a", { failglob: false }); } + { const a: object = match.parse("a", { ignore: "a" }); } + { const a: object = match.parse("a", { ignore: ["a"] }); } + { const a: object = match.parse("a", { matchBase: false }); } + { const a: object = match.parse("a", { nobrace: true }); } + { const a: object = match.parse("a", { nocase: false }); } + { const a: object = match.parse("a", { nodupes: true }); } + { const a: object = match.parse("a", { noext: false }); } + { const a: object = match.parse("a", { noglobstar: true }); } + { const a: object = match.parse("a", { nonegate: false }); } + { const a: object = match.parse("a", { nonull: false }); } + { const a: object = match.parse("a", { nullglob: false }); } + { const a: object = match.parse("a", { snapdragon: {} }); } + { const a: object = match.parse("a", { sourcemap: false }); } + { const a: object = match.parse("a", { unescape: false }); } + { const a: object = match.parse("a", { unixify: false }); } + + { const a: object = match.compile("a", {}); } + { const a: object = match.compile({}, {}); } + { const a: object = match.compile("a", { basename: false }); } + { const a: object = match.compile({}, { basename: false }); } + { const a: object = match.compile("a", { bash: false }); } + { const a: object = match.compile({}, { bash: false }); } + { const a: object = match.compile("a", { cache: false }); } + { const a: object = match.compile({}, { cache: false }); } + { const a: object = match.compile("a", { dot: true }); } + { const a: object = match.compile({}, { dot: true }); } + { const a: object = match.compile("a", { failglob: false }); } + { const a: object = match.compile({}, { failglob: false }); } + { const a: object = match.compile("a", { ignore: "a" }); } + { const a: object = match.compile({}, { ignore: "a" }); } + { const a: object = match.compile("a", { ignore: ["a"] }); } + { const a: object = match.compile({}, { ignore: ["a"] }); } + { const a: object = match.compile("a", { matchBase: false }); } + { const a: object = match.compile({}, { matchBase: false }); } + { const a: object = match.compile("a", { nobrace: true }); } + { const a: object = match.compile({}, { nobrace: true }); } + { const a: object = match.compile("a", { nocase: false }); } + { const a: object = match.compile({}, { nocase: false }); } + { const a: object = match.compile("a", { nodupes: true }); } + { const a: object = match.compile({}, { nodupes: true }); } + { const a: object = match.compile("a", { noext: false }); } + { const a: object = match.compile({}, { noext: false }); } + { const a: object = match.compile("a", { noglobstar: true }); } + { const a: object = match.compile({}, { noglobstar: true }); } + { const a: object = match.compile("a", { nonegate: false }); } + { const a: object = match.compile({}, { nonegate: false }); } + { const a: object = match.compile("a", { nonull: false }); } + { const a: object = match.compile({}, { nonull: false }); } + { const a: object = match.compile("a", { nullglob: false }); } + { const a: object = match.compile({}, { nullglob: false }); } + { const a: object = match.compile("a", { snapdragon: {} }); } + { const a: object = match.compile({}, { snapdragon: {} }); } + { const a: object = match.compile("a", { sourcemap: false }); } + { const a: object = match.compile({}, { sourcemap: false }); } + { const a: object = match.compile("a", { unescape: false }); } + { const a: object = match.compile({}, { unescape: false }); } + { const a: object = match.compile("a", { unixify: false }); } + { const a: object = match.compile({}, { unixify: false }); } + + { const a: number = match.MAX_LENGTH; } + match.clearCache(); + match.resizeCache(10050); + { const a: object = match.getCache(); } + } + + namespace iconv { + const { + iconv + } = util; + + let str: string; + let buf: Buffer; + let bool: boolean; + + str = iconv.decode(Buffer.from("hello"), "CP1251"); + str = iconv.decode(Buffer.from("hello"), "CP1251", {}); + + buf = iconv.encode("привет", "CP1251"); + buf = iconv.encode("привет", "CP1251", {}); + + bool = iconv.encodingExists("cp1251"); + } } diff --git a/types/adone/test/glosses/vault.ts b/types/adone/test/glosses/vault.ts new file mode 100644 index 0000000000..1423a46715 --- /dev/null +++ b/types/adone/test/glosses/vault.ts @@ -0,0 +1,203 @@ +namespace adoneTests.vault { + const { + is, + vault + } = adone; + + let num: number; + let bool: boolean; + let obj: object; + let str: string; + + namespace Vault { + const { + Vault + } = vault; + + new Vault({ + location: "a" + }); + new Vault({ + location: "a", + ValuableClass: vault.Valuable + }); + + const v = new Vault({ + location: "a" + }); + + v.addTag("hello").then((x) => { + if (!is.null(x)) { + num = x; + } + }); + v.clear().then((x) => { + num = x; + }); + v.close().then(); + v.create("hello").then((x) => { + x.set("a", "b"); + }); + v.create("hello", ["a", "b"]).then((x) => { + x.set("a", "b"); + }); + v.delete("a").then(); + v.deleteTag("a").then((x) => { + bool = x; + }); + v.entries().then((x) => { + obj = x; + }); + v.get("a").then((x) => { + x.set("a", "b"); + }); + str = v.getNotes(); + bool = v.has("a"); + str = v.keys()[0]; + str = v.location(); + v.open().then(() => {}); + v.release("name"); + v.setNotes("asd").then(); + str = v.tagNames()[0]; + str = v.tagNames([1])[0]; + obj = v.tags()[0]; + obj = v.toJSON(); + v.toJSON({ valuable: { includeId: true } }).then((x) => { + obj = x.valuables[0]; + }); + v.toJSON({ includeStats: true }).then((x) => { + num = x.stats.created; + num = x.stats.updated; + str = x.stats.location; + }); + v.values().then((x) => { + x[0]; + }); + } + + namespace Valuable { + new vault.Vault({ location: "a" }).get("a").then((v) => { + v.addTag("a").then(); + v.clear().then((x) => { + num = x; + }); + v.clear({ includeNotes: true }).then((x) => { + num = x; + }); + v.clear({ includeTags: true }).then((x) => { + num = x; + }); + v.delete("a").then((x) => { + num = x; + }); + v.deleteAllTags(); + v.entries().then((x) => { + obj = x; + }); + v.entries({ entriesAsArray: true }).then((x) => { + obj = x; + }); + v.entries({ includeEntryId: true }).then((x) => { + obj = x; + }); + v.fromJSON({}).then((x) => { + num = x; + }); + v.get("a").then(); + str = v.getNotes(); + bool = v.has("a"); + bool = v.hasTag("a"); + num = v.internalId(); + str = v.keys()[0]; + str = v.name(); + v.set("a", "b").then((x) => { + num = x; + }); + v.set("a", "b", "wtf").then((x) => { + num = x; + }); + v.setMulti({ a: "1", b: "2" }).then(); + v.setNotes("a").then(); + obj = v.tags(); + obj = v.toJSON(); + obj = v.toJSON({ entriesAsArray: true }); + obj = v.toJSON({ includeEntryId: true }); + obj = v.toJSON({ includeId: false }); + obj = v.toJSON({ tags: "normal" }); + obj = v.toJSON({ tags: "none" }); + obj = v.toJSON({ tags: "onlyId" }); + obj = v.toJSON({ tags: "onlyName" }); + v.type("a"); + }); + } + + namespace slice { + new vault.Vault({ location: "a" }).get("a").then((valuable) => { + vault.slice(valuable, "s"); + vault.slice(valuable, ["s"]); + vault.slice(valuable, ["s"], "a"); + vault.slice(valuable, ["s"], "a"); + const v = vault.slice(valuable, "s"); + v.addTag("a").then(); + v.delete("a").then((x) => { + num = x; + }); + v.deleteAllTags().then(); + v.deleteTag("a").then((x) => { + bool = x; + }); + v.entries().then((x) => { + obj = x; + }); + v.entries({}).then((x) => { + obj = x; + }); + v.entries({ entriesAsArray: true }).then((x) => { + obj = x; + }); + v.entries({ includeEntryId: true }).then((x) => { + obj = x; + }); + v.fromJSON({}).then((x) => { + num = x; + }); + v.get("a").then(); + str = v.getNotes(); + bool = v.has("a"); + bool = v.hasTag("a"); + num = v.internalId(); + str = v.keys()[0]; + str = v.name(); + v.set("a", "b").then((x) => { + num = x; + }); + v.set("a", "b", "wtf").then((x) => { + num = x; + }); + v.setMulti({}).then(); + v.setNotes("a").then((x) => { + num = x; + }); + obj = v.tags()[0]; + obj = v.toJSON(); + obj = v.toJSON({}); + obj = v.toJSON({ entriesAsArray: true }); + obj = v.toJSON({ includeEntryId: true }); + obj = v.toJSON({ includeId: true }); + obj = v.toJSON({ tags: "none" }); + obj = v.toJSON({ tags: "normal" }); + obj = v.toJSON({ tags: "onlyId" }); + obj = v.toJSON({ tags: "onlyName" }); + v.type("a"); + }); + } + + namespace open { + vault.open({ location: "a" }).then((x) => { + x.get("a").then((x) => x.setMulti({})); + }); + vault.open({ location: "a", ValuableClass: vault.Valuable }).then((x) => { + x.get("a").then((x) => x.setMulti({})); + }); + } +} diff --git a/types/adone/test/index.ts b/types/adone/test/index.ts index a9de1ab34b..ac012b9535 100644 --- a/types/adone/test/index.ts +++ b/types/adone/test/index.ts @@ -1,23 +1,32 @@ namespace AdoneRootTests { - { const a: symbol = adone.null; } + let num: number; + let sym: symbol; + let str: string; + let numarr: number[]; + let obj: object; + let bool: boolean; + + sym = adone.null; adone.noop(); - { const a: number = adone.identity(2); } - { const a: string = adone.identity("2"); } - { const a: number[] = adone.identity([1, 2]); } - { adone.truly() === true; } - { adone.falsely() === false; } - { const a: string = adone.ok; } - { const a: string = adone.bad; } - { const a: string[] = adone.exts; } + + num = adone.identity(2); + str = adone.identity("3"); + numarr = adone.identity([1, 2]); + + adone.truly() === true; + adone.falsely() === false; + + str = adone.ok; + str = adone.bad; adone.log(); - adone.fatal(); - adone.error(); - adone.warn(); - adone.info(); - adone.debug(); - adone.trace(); - { const a: object = adone.o(); } - { const a: object = adone.o({}); } + adone.logFatal(); + adone.logError(); + adone.logWarn(); + adone.logInfo(); + adone.logDebug(); + adone.logTrace(); + obj = adone.o(); + obj = adone.o({}); { const a: typeof Date = adone.Date; } { const a: typeof process.hrtime = adone.hrtime; } { const a: typeof global.setTimeout = adone.setTimeout; } @@ -26,6 +35,7 @@ namespace AdoneRootTests { { const a: typeof clearInterval = adone.clearInterval; } { const a: typeof global.setImmediate = adone.setImmediate; } { const a: typeof clearImmediate = adone.clearImmediate; } + adone.lazify({}); adone.lazify({}, {}); adone.lazify({}, {}, () => { }); @@ -33,40 +43,15 @@ namespace AdoneRootTests { adone.lazify({}, {}, () => { }, { configurable: true }); adone.lazify({}, {}, () => { }, { writable: false }); adone.lazify({}, {}, () => { }, { mapper: (key: string, obj: any) => null }); + adone.tag.set({}, "123"); - { const a: boolean = adone.tag.has({}, "123"); } + bool = adone.tag.has({}, "123"); adone.tag.define("12"); adone.tag.define("123", "456"); - { const a: symbol = adone.tag.SUBSYSTEM; } - { const a: symbol = adone.tag.APPLICATION; } - { const a: symbol = adone.tag.TRANSFORM; } - { const a: symbol = adone.tag.CORE_STREAM; } - { const a: symbol = adone.tag.LOGGER; } - { const a: symbol = adone.tag.LONG; } - { const a: symbol = adone.tag.BIGNUMBER; } - { const a: symbol = adone.tag.EXBUFFER; } - { const a: symbol = adone.tag.EXDATE; } - { const a: symbol = adone.tag.CONFIGURATION; } - { const a: symbol = adone.tag.GENESIS_NETRON; } - { const a: symbol = adone.tag.GENESIS_PEER; } - { const a: symbol = adone.tag.NETRON; } - { const a: symbol = adone.tag.NETRON_PEER; } - { const a: symbol = adone.tag.NETRON_ADAPTER; } - { const a: symbol = adone.tag.NETRON_DEFINITION; } - { const a: symbol = adone.tag.NETRON_DEFINITIONS; } - { const a: symbol = adone.tag.NETRON_REFERENCE; } - { const a: symbol = adone.tag.NETRON_INTERFACE; } - { const a: symbol = adone.tag.NETRON_STUB; } - { const a: symbol = adone.tag.NETRON_REMOTESTUB; } - { const a: symbol = adone.tag.NETRON_STREAM; } - { const a: symbol = adone.tag.FAST_STREAM; } - { const a: symbol = adone.tag.FAST_FS_STREAM; } - { const a: symbol = adone.tag.FAST_FS_MAP_STREAM; } - { const a: object = adone.bind("library"); } // hmm - { const a: string = adone.getAssetAbsolutePath("asset"); } + str = adone.getAssetAbsolutePath("asset"); { const a: Buffer | string = adone.loadAsset("asset"); } - { const a: object = adone.require("path"); } - { const a: object = adone.package; } + obj = adone.require("path"); + obj = adone.package; { const a: typeof adone.assertion.assert = adone.assert; } { const a: typeof adone.assertion.expect = adone.expect; } } diff --git a/types/adone/tsconfig.json b/types/adone/tsconfig.json index c23bf82155..6e6b3fe1c3 100644 --- a/types/adone/tsconfig.json +++ b/types/adone/tsconfig.json @@ -15,53 +15,142 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "experimentalDecorators": true, + "esModuleInterop": true }, "files": [ - "index.d.ts", + "adone-tests.ts", "adone.d.ts", + "glosses/archives.d.ts", + "glosses/assertion.d.ts", + "glosses/collections/array_set.d.ts", + "glosses/collections/async_queue.d.ts", + "glosses/collections/avl_tree.d.ts", + "glosses/collections/binary_search_tree.d.ts", + "glosses/collections/buffer_list.d.ts", + "glosses/collections/byte_array.d.ts", + "glosses/collections/default_map.d.ts", + "glosses/collections/fast_lru.d.ts", + "glosses/collections/index.d.ts", + "glosses/collections/linked_list.d.ts", + "glosses/collections/lru.d.ts", + "glosses/collections/map_cache.d.ts", + "glosses/collections/ns_cache.d.ts", + "glosses/collections/priority_queue.d.ts", + "glosses/collections/queue.d.ts", + "glosses/collections/rb_tree.d.ts", + "glosses/collections/refcounted_cache.d.ts", + "glosses/collections/set.d.ts", + "glosses/collections/stack.d.ts", + "glosses/collections/timedout_map.d.ts", + "glosses/compressors.d.ts", + "glosses/crypto/asn1.d.ts", + "glosses/crypto/ed25519.d.ts", + "glosses/crypto/index.d.ts", + "glosses/crypto/secp256k1.d.ts", + "glosses/data.d.ts", + "glosses/datetime.d.ts", + "glosses/events.d.ts", + "glosses/errors.d.ts", + "glosses/fake.d.ts", + "glosses/fast.d.ts", + "glosses/fs.d.ts", + "glosses/is.d.ts", "glosses/math/index.d.ts", "glosses/math/matrix.d.ts", "glosses/math/simd.d.ts", - "glosses/std.d.ts", - "glosses/utils.d.ts", - "glosses/assertion.d.ts", + "glosses/meta.d.ts", + "glosses/net/http/client.d.ts", + "glosses/net/http/index.d.ts", + "glosses/net/index.d.ts", + "glosses/pretty/json.d.ts", + "glosses/pretty/size.d.ts", + "glosses/pretty/table.d.ts", + "glosses/pretty/time.d.ts", "glosses/promise.d.ts", - "glosses/shani.d.ts", + "glosses/regex.d.ts", + "glosses/semver.d.ts", "glosses/shani-global.d.ts", - "glosses/collections.d.ts", - "glosses/events.d.ts", - "glosses/fs.d.ts", - "glosses/is.d.ts", - "glosses/exceptions.d.ts", + "glosses/shani.d.ts", + "glosses/std.d.ts", "glosses/streams.d.ts", - "glosses/fast.d.ts", - "glosses/data.d.ts", - "glosses/datetime.d.ts", - "glosses/compressors.d.ts", - "glosses/archives.d.ts", - "adone-tests.ts", - "test/index.ts", - "test/index-import.ts", + "glosses/system/env.d.ts", + "glosses/system/index.d.ts", + "glosses/system/process.d.ts", + "glosses/system/user.d.ts", + "glosses/templating/dot.d.ts", + "glosses/templating/index.d.ts", + "glosses/templating/nunjucks.d.ts", + "glosses/text/index.d.ts", + "glosses/text/spinners.d.ts", + "glosses/text/table.d.ts", + "glosses/text/unicode.d.ts", + "glosses/utils.d.ts", + "glosses/vault.d.ts", + "index.d.ts", + "test/glosses/application.ts", + "test/glosses/archives.ts", + "test/glosses/assertion.ts", + "test/glosses/collections/array_set.ts", + "test/glosses/collections/async_queue.ts", + "test/glosses/collections/avl_tree.ts", + "test/glosses/collections/binary_search_tree.ts", + "test/glosses/collections/buffer_list.ts", + "test/glosses/collections/byte_array.ts", + "test/glosses/collections/default_map.ts", + "test/glosses/collections/fast_lru.ts", + "test/glosses/collections/linked_list.ts", + "test/glosses/collections/lru.ts", + "test/glosses/collections/map_cache.ts", + "test/glosses/collections/ns_cache.ts", + "test/glosses/collections/priority_queue.ts", + "test/glosses/collections/queue.ts", + "test/glosses/collections/rb_tree.ts", + "test/glosses/collections/refcounted_cache.ts", + "test/glosses/collections/set.ts", + "test/glosses/collections/stack.ts", + "test/glosses/collections/timedout_map.ts", + "test/glosses/compressors.ts", + "test/glosses/crypto/asn1.ts", + "test/glosses/crypto/ed25519.ts", + "test/glosses/crypto/secp256k1.ts", + "test/glosses/data.ts", + "test/glosses/datetime.ts", + "test/glosses/events.ts", + "test/glosses/errors.ts", + "test/glosses/fake.ts", + "test/glosses/fast.ts", + "test/glosses/fs.ts", + "test/glosses/is.ts", "test/glosses/math/index.ts", "test/glosses/math/matrix.ts", "test/glosses/math/simd.ts", - "test/glosses/std.ts", - "test/glosses/utils.ts", - "test/glosses/assertion.ts", + "test/glosses/meta.ts", + "test/glosses/net/http/client.ts", + "test/glosses/pretty/json.ts", + "test/glosses/pretty/size.ts", + "test/glosses/pretty/table.ts", + "test/glosses/pretty/time.ts", "test/glosses/promise.ts", - "test/glosses/shani.ts", + "test/glosses/regex.ts", + "test/glosses/semver.ts", "test/glosses/shani-global.ts", - "test/glosses/collections.ts", - "test/glosses/events.ts", - "test/glosses/fs.ts", - "test/glosses/is.ts", - "test/glosses/exceptions.ts", + "test/glosses/shani.ts", + "test/glosses/std.ts", "test/glosses/streams.ts", - "test/glosses/fast.ts", - "test/glosses/data.ts", - "test/glosses/datetime.ts", - "test/glosses/compressors.ts", - "test/glosses/archives.ts" + "test/glosses/system/env.ts", + "test/glosses/system/process.ts", + "test/glosses/system/user.ts", + "test/glosses/templating/dot.ts", + "test/glosses/templating/nunjucks.ts", + "test/glosses/text/index.ts", + "test/glosses/text/spinners.ts", + "test/glosses/text/table.ts", + "test/glosses/text/unicode.ts", + "test/glosses/utils.ts", + "test/glosses/vault.ts", + "test/index-import.ts", + "test/index.ts" ] } \ No newline at end of file diff --git a/types/agenda/agenda-tests.ts b/types/agenda/agenda-tests.ts index 964eb1b836..bbf945bd62 100644 --- a/types/agenda/agenda-tests.ts +++ b/types/agenda/agenda-tests.ts @@ -1,10 +1,10 @@ -import * as Agenda from "agenda"; +import Agenda = require("agenda"); +import { Db, Server } from "mongodb"; var mongoConnectionString = "mongodb://127.0.0.1/agenda"; var agenda = new Agenda({ db: { address: mongoConnectionString } }); - agenda.define('delete old users', (job, done) => { }); @@ -102,4 +102,9 @@ job.remove(function(err) { if (!err) console.log("Successfully removed job from collection"); }) +class ExtendedAgenda extends Agenda { + async start() { } +} +const extendedAgenda: ExtendedAgenda = new ExtendedAgenda() + .mongo(new Db('some-database', new Server('host.name', 0))) diff --git a/types/agenda/index.d.ts b/types/agenda/index.d.ts index 426b187d7c..12b0b76c38 100644 --- a/types/agenda/index.d.ts +++ b/types/agenda/index.d.ts @@ -31,57 +31,57 @@ declare class Agenda extends EventEmitter { /** * Connect to the specified MongoDB server and database. */ - database(url: string, collection?: string, options?: any, cb?: ResultCallback): Agenda; + database(url: string, collection?: string, options?: any, cb?: ResultCallback): this; /** * Initialize agenda with an existing MongoDB connection. */ - mongo(db: Db, collection?: string, cb?: ResultCallback): Agenda; + mongo(db: Db, collection?: string, cb?: ResultCallback): this; /** * Sets the agenda name. */ - name(value: string): Agenda; + name(value: string): this; /** * Sets the interval with which the queue is checked. A number in milliseconds or a frequency string. */ - processEvery(interval: string | number): Agenda; + processEvery(interval: string | number): this; /** * Takes a number which specifies the max number of jobs that can be running at any given moment. By default it * is 20. * @param value The value to set. */ - maxConcurrency(value: number): Agenda; + maxConcurrency(value: number): this; /** * Takes a number which specifies the default number of a specific job that can be running at any given moment. * By default it is 5. * @param value The value to set. */ - defaultConcurrency(value: number): Agenda; + defaultConcurrency(value: number): this; /** * Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is * 0 for no max. * @param value The value to set. */ - lockLimit(value: number): Agenda; + lockLimit(value: number): this; /** * Takes a number which specifies the default number of a specific job that can be locked at any given moment. * By default it is 0 for no max. * @param value The value to set. */ - defaultLockLimit(value: number): Agenda; + defaultLockLimit(value: number): this; /** * Takes a number which specifies the default lock lifetime in milliseconds. By default it is 10 minutes. This * can be overridden by specifying the lockLifetime option to a defined job. * @param value The value to set. */ - defaultLockLifetime(value: number): Agenda; + defaultLockLifetime(value: number): this; /** * Returns an instance of a jobName with data. This does NOT save the job in the database. See below to learn diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 02def0b4d6..56278df11c 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,14 +1,15 @@ -// Type definitions for Alexa SDK for Node.js 1.0 +// Type definitions for Alexa SDK for Node.js 1.1 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs // Definitions by: Pete Beegle // Huw // pascalwhoop // Ben // rk-7 +// Alex Malcoci // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void): AlexaObject; +export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; export let StateString: string; export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; @@ -23,6 +24,8 @@ export type CardType = "Standard" | "Simple" | "LinkAccount" | "AskForPermission export type HintType = "PlainText"; export type DirectiveTypes = "AudioPlayer.Play" | "AudioPlayer.Stop" | "AudioPlayer.ClearQueue" | "Display.RenderTemplate" | "Hint" | "VideoApp.Launch"; export type TextContentType = "PlainText" | "RichText"; +export type MediaErrorType = "MEDIA_ERROR_UNKNOWN" | "MEDIA_ERROR_INVALID_REQUEST" | "MEDIA_ERROR_SERVICE_UNAVAILABLE" | "MEDIA_ERROR_INTERNAL_SERVER_ERROR" | "MEDIA_ERROR_INTERNAL_DEVICE_ERROR"; +export type SystemErrorType = "INVALID_RESPONSE" | "DEVICE_COMMUNICATION_ERROR" | "INTERNAL_ERROR"; //#region Types export interface CardImage { @@ -84,7 +87,7 @@ export interface Template { listItems?: ListItem[]; } -export interface AlexaObject extends Handler { +export interface AlexaObject extends Handler { _event: any; _context: any; _callback: any; @@ -98,11 +101,11 @@ export interface AlexaObject extends Handler { execute: () => void; } -export interface Handlers { +export interface Handlers { [intent: string]: (this: Handler) => void; } -export interface Handler { +export interface Handler { on: any; emit(event: string, ...args: any[]): boolean; emitWithState: any; @@ -141,7 +144,7 @@ export interface System { apiEndpoint: string; application: Application; device: any; - user: any; + user: SessionUser; } export interface AudioPlayer { token: string; @@ -151,10 +154,32 @@ export interface AudioPlayer { */ playerActivity: AudioPlayerActivity; } -export interface RequestBody { + +export interface Display { + token: string; +} + +export interface Device { + deviceId: string; + supportedInterfaces: DeviceInterfaces; +} + +export interface DeviceInterfaces { + AudioPlayer: any; + Display: any; +} + +export interface RequestContext { + AudioPlayer?: AudioPlayer; + Display?: Display; + System: System; +} + +export interface RequestBody { version: string; session: Session; request: T; + context: RequestContext; } export interface Session { @@ -187,8 +212,94 @@ export interface SessionEndedRequest extends Request { reason?: string; } +export interface AudioPlayerPlaybackRequest extends Request { + token: string; + offsetInMilliseconds: number; +} + +export interface AudioPlayerPlaybackFailedRequest extends Request { + token: string; + error: MediaError; + currentPlaybackState: AudioPlayer; +} + +export interface MediaError { + type: MediaErrorType; + message: string; +} + +export interface SystemExceptionEncounteredRequest extends Request { + error: SystemError; + cause: ErrorCause; +} + +export interface SystemError { + type: SystemErrorType; + message: string; +} + +export interface ErrorCause { + requestId: string; +} + +export interface SkillAccountRequest extends Request { + body: SkillAccountBody; +} + +export interface SkillAccountBody { + accessToken: string; +} + +export interface SkillPermissionRequest extends Request { + body: SkillPermissionBody; +} + +export interface SkillPermissionBody { + acceptedPermissions: PermissionScope[]; +} + +export interface PermissionScope { + scope: string; +} + +export interface ListEventRequest extends Request { + body: ListEventBody; +} + +export interface ListEventBody { + listId: string; + listItemIds?: string[]; +} + export interface Request { - type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest"; + type: "LaunchRequest" + | "IntentRequest" + | "SessionEndedRequest" + + | "System.ExceptionEncountered" + + | "AudioPlayer.PlaybackStarted" + | "AudioPlayer.PlaybackFinished" + | "AudioPlayer.PlaybackStopped" + | "AudioPlayer.PlaybackNearlyFinished" + + | "PlaybackController.NextCommandIssued" + | "PlaybackController.PauseCommandIssued" + | "PlaybackController.PlayCommandIssued" + | "PlaybackController.PreviousCommandIssued" + + | "AlexaSkillEvent.SkillAccountLinked" + | "AlexaSkillEvent.SkillEnabled" + | "AlexaSkillEvent.SkillDisabled" + | "AlexaSkillEvent.SkillPermissionAccepted" + | "AlexaSkillEvent.SkillPermissionChanged" + + | "AlexaHouseholdListEvent.ListCreated" + | "AlexaHouseholdListEvent.ListUpdated" + | "AlexaHouseholdListEvent.ListDeleted" + | "AlexaHouseholdListEvent.ItemsCreated" + | "AlexaHouseholdListEvent.ItemsUpdated" + | "AlexaHouseholdListEvent.ItemsDeleted"; requestId: string; timestamp: string; locale?: string; @@ -296,7 +407,7 @@ export interface ListItemObject { /** * item version (Positive integer) */ - version?: number | string; + version: number; /** * created time (ISO 8601 time format with time zone) */ @@ -348,6 +459,38 @@ export interface ListObject { * Items that belong to this list. */ items: ListItemObject[]; + + next?: ListLinks; +} + +export interface ListLinks { + next: string; +} + +export interface ListCollection { + lists: ListObject[]; +} + +export interface CreateListParams { + name: string; + state: "active"; +} + +export interface UpdateListParams { + name: string; + state: ListObjectState; + version: number; +} + +export interface CreateListItemParams { + value: string; + status: ListItemObjectStatus; +} + +export interface UpdateListItemParams { + value: string; + status: ListItemObjectStatus; + version: number; } //#endregion @@ -545,7 +688,7 @@ export namespace templateBuilders { //#region services export namespace services { - interface ApiClient { + class ApiClient { /** * Make a POST API call to the specified uri with headers and optional body * @param uri http(s?) endpoint to call @@ -582,7 +725,7 @@ export namespace services { * Create an instance of DeviceAddressService * @param [apiClient=new ApiClient()] ApiClient */ - constructor(apiClient: ApiClient); + constructor(apiClient?: ApiClient); /** * Get full address information from Alexa Device Address API @@ -607,7 +750,7 @@ export namespace services { * Creates an instance of DirectiveService. * @param [apiClient=new ApiClient()] ApiClient */ - constructor(apiClient: ApiClient); + constructor(apiClient?: ApiClient); /** * Send the specified directiveObj to Alexa directive service @@ -624,7 +767,7 @@ export namespace services { * Create an instance of ListManagementService * @param apiClient apiClient */ - constructor(apiClient: ApiClient); + constructor(apiClient?: ApiClient); /** * Set apiEndpoint address, default is "https://api.amazonalexa.com" @@ -642,80 +785,80 @@ export namespace services { /** * Retrieve the metadata for all customer lists, including the customer's default lists * @param token bearer token for list management permission - * @returns Promise + * @returns Promise */ - getListsMetadata(token: string): Promise; + getListsMetadata(token: string): Promise; /** * Create a custom list. The new list name must be different than any existing list name - * @param listObject listObject + * @param params params * @param token bearer token for list management permission - * @returns Promise + * @returns Promise */ - createList(listObject: ListObject, token: string): Promise; + createList(params: CreateListParams, token: string): Promise; /** * Retrieve list metadata including the items in the list with requested status * @param listId unique Id associated with the list * @param itemStatus itemsStatus can be either "active" or "completed" * @param token bearer token for list management permission - * @returns Promise + * @returns Promise */ - getList(listId: string, itemStatus: ListItemObjectStatus, token: string): Promise; + getList(listId: string, itemStatus: ListItemObjectStatus, token: string): Promise; /** * Update a custom list. Only the list name or state can be updated * @param listId unique Id associated with the list - * @param listObject listObject + * @param params params * @param token bearer token for list management permission * @returns Promise */ - updateList(listId: string, listObject: ListObject, token: string): Promise; + updateList(listId: string, params: UpdateListParams, token: string): Promise; /** * Delete a custom list * @param listId unique Id associated with the list * @param token bearer token for list management permission - * @returns Promise + * @returns Promise */ - deleteList(listId: string, token: string): Promise; + deleteList(listId: string, token: string): Promise; /** * Create an item in an active list or in a default list * @param listId unique Id associated with the list - * @param listItemObject listItemObject + * @param params params * @param token bearer token for list management permission - * @returns Promise + * @returns Promise */ - createListItem(listId: string, listItemObject: ListItemObject, token: string): Promise; + createListItem(listId: string, params: CreateListItemParams, token: string): Promise; /** * Retrieve single item within any list by listId and itemId * @param listId unique Id associated with the list * @param itemId unique Id associated with the item * @param token bearer token for list management permission - * @returns Promise + * @returns Promise */ - getListItem(listId: string, itemId: string, token: string): Promise; + getListItem(listId: string, itemId: string, token: string): Promise; /** * Update an item value or item status * @param listId unique Id associated with the list * @param itemId unique Id associated with the item - * @param listItemObject listItemObject + * @param params params * @param token bearer token for list management permission - * @returns Promise + * @returns Promise */ - updateListItem(listId: string, itemId: string, listItemObject: ListItemObject, token: string): Promise; + updateListItem(listId: string, itemId: string, params: UpdateListItemParams, token: string): Promise; /** * Delete an item in the specified list * @param listId unique Id associated with the list * @param itemId unique Id associated with the item * @param token bearer token for list management permission - * @returns Promise + * @returns Promise */ - deleteListItem(listId: string, itemId: string, token: string): Promise; + deleteListItem(listId: string, itemId: string, token: string): Promise; } } //#endregion diff --git a/types/alexa-sdk/tsconfig.json b/types/alexa-sdk/tsconfig.json index d1932fa469..acc11c8263 100644 --- a/types/alexa-sdk/tsconfig.json +++ b/types/alexa-sdk/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "alexa-sdk-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index c56b0f8a9f..5c7026d70e 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -376,7 +376,7 @@ declare namespace algoliasearch { * @param cb(err, res) * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects */ - addObjects(objects: [{}], cb: (err: Error, res: any) => void): void; + addObjects(objects: {}[], cb: (err: Error, res: any) => void): void; /** * Add or replace a specific object * @param object @@ -405,7 +405,7 @@ declare namespace algoliasearch { * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects */ partialUpdateObjects( - objects: [{}], + objects: {}[], cb: (err: Error, res: any) => void ): void; /** @@ -701,7 +701,7 @@ declare namespace algoliasearch { * return {Promise} * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects */ - addObjects(objects: [{}]): Promise; + addObjects(objects: {}[]): Promise; /** * Add or replace a specific object * @param object @@ -729,7 +729,7 @@ declare namespace algoliasearch { * return {Promise} * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects */ - partialUpdateObjects(objects: [{}]): Promise; + partialUpdateObjects(objects: {}[]): Promise; /** * Delete a specific object * @param objectID @@ -1387,6 +1387,12 @@ Interface describing options available for gettings the logs * https://github.com/algolia/algoliasearch-client-js#unretrievableattributes */ unretrievableAttributes?: string[]; + /** + * List of attributes you want to use for textual search + * default: [] + * https://github.com/algolia/algoliasearch-client-js#searchableattributes + */ + searchableAttributes?: string[]; /** * A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer * default: * @@ -1602,7 +1608,7 @@ Interface describing options available for gettings the logs * default: [] * https://github.com/algolia/algoliasearch-client-js#altcorrections */ - altCorrections?: [{}]; + altCorrections?: {}[]; /** * Configure the precision of the proximity ranking criterion * default: 1 diff --git a/types/algoliasearch/tsconfig.json b/types/algoliasearch/tsconfig.json index 4d7e52dd8b..3358732ba3 100644 --- a/types/algoliasearch/tsconfig.json +++ b/types/algoliasearch/tsconfig.json @@ -1,16 +1,23 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": ["es6"], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": ["../"], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": ["index.d.ts", "algoliasearch-tests.ts"] -} + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "algoliasearch-tests.ts" + ] +} \ No newline at end of file diff --git a/types/alt/index.d.ts b/types/alt/index.d.ts index 2d4c6e259f..0c69e4020a 100644 --- a/types/alt/index.d.ts +++ b/types/alt/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/goatslacker/alt // Definitions by: Michael Shearer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/amphtml-validator/amphtml-validator-tests.ts b/types/amphtml-validator/amphtml-validator-tests.ts new file mode 100644 index 0000000000..4160f7a451 --- /dev/null +++ b/types/amphtml-validator/amphtml-validator-tests.ts @@ -0,0 +1,28 @@ +import * as ampHtmlValidator from "amphtml-validator"; + +(async () => { + const validator = await ampHtmlValidator.getInstance(); + const result = validator.validateString(""); + const { status, errors } = result; + if (status === "FAIL" || status === "UNKNOWN") { + const errs = errors.map(err => { + const { + severity, + line, + col, + message, + specUrl, + category, + code, + params + } = err; + return err; + }); + } +})(); + +(() => { + const validator = ampHtmlValidator.newInstance(""); + const result = validator.validateString(""); + const { status, errors } = result; +})(); diff --git a/types/amphtml-validator/index.d.ts b/types/amphtml-validator/index.d.ts new file mode 100644 index 0000000000..bcf8e5d66e --- /dev/null +++ b/types/amphtml-validator/index.d.ts @@ -0,0 +1,156 @@ +// Type definitions for amphtml-validator 1.0 +// Project: https://github.com/ampproject/amphtml/tree/master/validator/nodejs +// Definitions by: Kevin Tjiam +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +import { Context, Script } from "vm"; + +export interface ValidationError { + severity: ValidationErrorSeverity; + line: number; + col: number; + message: string; + specUrl: string | null; + category: ErrorCategoryCode; + code: ValidationErrorCode; + params: string[]; +} + +export interface ValidationResult { + status: ValidationResultStatus; + errors: ValidationError[]; +} + +export class Validator extends Script { + sandbox: Context; + validateString(stringToValidate: string): ValidationResult; +} + +export function getInstance( + validatorJs?: string, + userAgent?: string +): Promise; +export function newInstance(validatorJsContents: string): Validator; + +/** + * Enums from protobufs + * https://github.com/ampproject/amphtml/blob/master/validator/validator.proto + */ +export type ValidationResultStatus = "UNKNOWN" | "PASS" | "FAIL"; + +export type ValidationErrorSeverity = "UNKNOWN_SEVERITY" | "ERROR" | "WARNING"; + +export type ErrorCategoryCode = + | "UNKNOWN" + | "GENERIC" + | "DISALLOWED_HTML_WITH_AMP_EQUIVALENT" + | "DISALLOWED_HTML" + | "AUTHOR_STYLESHEET_PROBLEM" + | "MANDATORY_AMP_TAG_MISSING_OR_INCORRECT" + | "AMP_TAG_PROBLEM" + | "CUSTOM_JAVASCRIPT_DISALLOWED" + | "AMP_LAYOUT_PROBLEM" + | "AMP_HTML_TEMPLATE_PROBLEM" + | "DEPRECATION"; + +export type ValidationErrorCode = + | "UNKNOWN_CODE" + | "MANDATORY_TAG_MISSING" + | "TAG_REQUIRED_BY_MISSING" + | "WARNING_TAG_REQUIRED_BY_MISSING" + | "WARNING_EXTENSION_UNUSED" + | "EXTENSION_UNUSED" + | "WARNING_EXTENSION_DEPRECATED_VERSION" + | "ATTR_REQUIRED_BUT_MISSING" + | "DISALLOWED_TAG" + | "GENERAL_DISALLOWED_TAG" + | "DISALLOWED_SCRIPT_TAG" + | "DISALLOWED_ATTR" + | "DISALLOWED_STYLE_ATTR" + | "INVALID_ATTR_VALUE" + | "DUPLICATE_ATTRIBUTE" + | "ATTR_VALUE_REQUIRED_BY_LAYOUT" + | "IMPLIED_LAYOUT_INVALID" + | "SPECIFIED_LAYOUT_INVALID" + | "MANDATORY_ATTR_MISSING" + | "MANDATORY_ONEOF_ATTR_MISSING" + | "DUPLICATE_DIMENSION" + | "DUPLICATE_UNIQUE_TAG" + | "DUPLICATE_UNIQUE_TAG_WARNING" + | "WRONG_PARENT_TAG" + | "STYLESHEET_TOO_LONG" + | "MANDATORY_CDATA_MISSING_OR_INCORRECT" + | "CDATA_VIOLATES_BLACKLIST" + | "NON_WHITESPACE_CDATA_ENCOUNTERED" + | "DEPRECATED_ATTR" + | "DEPRECATED_TAG" + | "MANDATORY_PROPERTY_MISSING_FROM_ATTR_VALUE" + | "INVALID_PROPERTY_VALUE_IN_ATTR_VALUE" + | "MISSING_URL" + | "INVALID_URL" + | "INVALID_URL_PROTOCOL" + | "DISALLOWED_DOMAIN" + | "DISALLOWED_RELATIVE_URL" + | "DISALLOWED_PROPERTY_IN_ATTR_VALUE" + | "MUTUALLY_EXCLUSIVE_ATTRS" + | "UNESCAPED_TEMPLATE_IN_ATTR_VALUE" + | "TEMPLATE_PARTIAL_IN_ATTR_VALUE" + | "TEMPLATE_IN_ATTR_NAME" + | "INCONSISTENT_UNITS_FOR_WIDTH_AND_HEIGHT" + | "DISALLOWED_TAG_ANCESTOR" + | "MANDATORY_LAST_CHILD_TAG" + | "MANDATORY_TAG_ANCESTOR" + | "MANDATORY_TAG_ANCESTOR_WITH_HINT" + | "ATTR_DISALLOWED_BY_IMPLIED_LAYOUT" + | "ATTR_DISALLOWED_BY_SPECIFIED_LAYOUT" + | "INCORRECT_NUM_CHILD_TAGS" + | "INCORRECT_MIN_NUM_CHILD_TAGS" + | "DISALLOWED_CHILD_TAG_NAME" + | "DISALLOWED_FIRST_CHILD_TAG_NAME" + | "DISALLOWED_MANUFACTURED_BODY" + | "CHILD_TAG_DOES_NOT_SATISFY_REFERENCE_POINT" + | "MANDATORY_REFERENCE_POINT_MISSING" + | "DUPLICATE_REFERENCE_POINT" + | "TAG_NOT_ALLOWED_TO_HAVE_SIBLINGS" + | "TAG_REFERENCE_POINT_CONFLICT" + | "CHILD_TAG_DOES_NOT_SATISFY_REFERENCE_POINT_SINGULAR" + | "BASE_TAG_MUST_PRECEED_ALL_URLS" + | "MISSING_REQUIRED_EXTENSION" + | "ATTR_MISSING_REQUIRED_EXTENSION" + | "DOCUMENT_TOO_COMPLEX" + | "INVALID_UTF8" + | "CSS_SYNTAX" + | "CSS_SYNTAX_INVALID_AT_RULE" + | "CSS_SYNTAX_STRAY_TRAILING_BACKSLASH" + | "CSS_SYNTAX_UNTERMINATED_COMMENT" + | "CSS_SYNTAX_UNTERMINATED_STRING" + | "CSS_SYNTAX_BAD_URL" + | "CSS_SYNTAX_EOF_IN_PRELUDE_OF_QUALIFIED_RULE" + | "CSS_SYNTAX_INVALID_DECLARATION" + | "CSS_SYNTAX_INCOMPLETE_DECLARATION" + | "CSS_SYNTAX_ERROR_IN_PSEUDO_SELECTOR" + | "CSS_SYNTAX_MISSING_SELECTOR" + | "CSS_SYNTAX_NOT_A_SELECTOR_START" + | "CSS_SYNTAX_UNPARSED_INPUT_REMAINS_IN_SELECTOR" + | "CSS_SYNTAX_MISSING_URL" + | "CSS_SYNTAX_INVALID_URL" + | "CSS_SYNTAX_INVALID_URL_PROTOCOL" + | "CSS_SYNTAX_DISALLOWED_DOMAIN" + | "CSS_SYNTAX_DISALLOWED_RELATIVE_URL" + | "CSS_SYNTAX_INVALID_ATTR_SELECTOR" + | "CSS_SYNTAX_INVALID_PROPERTY" + | "CSS_SYNTAX_INVALID_PROPERTY_NOLIST" + | "CSS_SYNTAX_QUALIFIED_RULE_HAS_NO_DECLARATIONS" + | "CSS_SYNTAX_DISALLOWED_QUALIFIED_RULE_MUST_BE_INSIDE_KEYFRAME" + | "CSS_SYNTAX_DISALLOWED_KEYFRAME_INSIDE_KEYFRAME" + | "CSS_SYNTAX_MALFORMED_MEDIA_QUERY" + | "CSS_SYNTAX_DISALLOWED_MEDIA_TYPE" + | "CSS_SYNTAX_DISALLOWED_MEDIA_FEATURE" + | "CSS_SYNTAX_DISALLOWED_PROPERTY_VALUE" + | "CSS_SYNTAX_DISALLOWED_PROPERTY_VALUE_WITH_HINT" + | "CSS_SYNTAX_PROPERTY_DISALLOWED_WITHIN_AT_RULE" + | "CSS_SYNTAX_PROPERTY_DISALLOWED_TOGETHER_WITH" + | "CSS_SYNTAX_PROPERTY_REQUIRES_QUALIFICATION"; diff --git a/types/amphtml-validator/tsconfig.json b/types/amphtml-validator/tsconfig.json new file mode 100644 index 0000000000..0c0c91b549 --- /dev/null +++ b/types/amphtml-validator/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", "amphtml-validator-tests.ts"] +} diff --git a/types/localforage-cordovasqlitedriver/tslint.json b/types/amphtml-validator/tslint.json similarity index 100% rename from types/localforage-cordovasqlitedriver/tslint.json rename to types/amphtml-validator/tslint.json diff --git a/types/amqp/index.d.ts b/types/amqp/index.d.ts index ca39ce4404..4e2cd4e288 100644 --- a/types/amqp/index.d.ts +++ b/types/amqp/index.d.ts @@ -96,6 +96,7 @@ export interface ConnectionOptions { authMechanism?: string; vhost?: string; noDelay?: boolean; + heartbeat?: number; ssl?: { enabled: boolean; keyFile?: string; diff --git a/types/analytics-node/analytics-node-tests.ts b/types/analytics-node/analytics-node-tests.ts index 5207fe560b..5dfabb426c 100644 --- a/types/analytics-node/analytics-node-tests.ts +++ b/types/analytics-node/analytics-node-tests.ts @@ -18,6 +18,22 @@ function testIdentify(): void { friends: 42 } }); + + analytics.identify({ + userId: '019mr8mf4r', + traits: { + name: 'Michael Bolton', + email: 'mbolton@initech.com', + plan: 'Enterprise', + friends: 42 + } + }, (err, data) => { + if (err) { + console.error(err); + } else { + data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`)) + } + }); } function testTrack(): void { @@ -29,6 +45,21 @@ function testTrack(): void { shippingMethod: '2-day' } }); + + analytics.track({ + userId: '019mr8mf4r', + event: 'Purchased an Item', + properties: { + revenue: 39.95, + shippingMethod: '2-day' + } + }, (err, data) => { + if (err) { + console.error(err); + } else { + data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`)) + } + }); } function testPage(): void { @@ -43,6 +74,24 @@ function testPage(): void { referrer: 'https://github.com/segmentio/analytics-node' } }); + + analytics.page({ + userId: '019mr8mf4r', + category: 'Docs', + name: 'Node.js Library', + properties: { + url: 'https://segment.com/docs/libraries/node', + path: '/docs/libraries/node/', + title: 'Node.js Library - Segment', + referrer: 'https://github.com/segmentio/analytics-node' + } + }, (err, data) => { + if (err) { + console.error(err); + } else { + data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`)) + } + }); } function testAlias(): void { @@ -65,6 +114,21 @@ function testGroup(): void { description: 'Accounting Software' } }); + + analytics.group({ + userId: '019mr8mf4r', + groupId: '56', + traits: { + name: 'Initech', + description: 'Accounting Software' + } + }, (err, data) => { + if (err) { + console.error(err); + } else { + data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`)) + } + }); } function testIntegrations(): void { @@ -77,11 +141,27 @@ function testIntegrations(): void { 'Google Analytics': false } }); + + analytics.track({ + event: 'Upgraded Membershipt', + userId: '97234974', + integrations: { + 'All': false, + 'Vero': true, + 'Google Analytics': false + } + }, (err, data) => { + if (err) { + console.error(err); + } else { + data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`)) + } + }); } function testFlush(): void { analytics.flush(); - analytics.flush(function(err, batch) { + analytics.flush((err, batch) => { if (err) { alert("Oh nos!"); } else { console.log(batch.batch[0].type); } }); diff --git a/types/analytics-node/index.d.ts b/types/analytics-node/index.d.ts index fa0b8d6426..a1de134195 100644 --- a/types/analytics-node/index.d.ts +++ b/types/analytics-node/index.d.ts @@ -1,11 +1,36 @@ // Type definitions for Segment's analytics.js for Node.js // Project: https://segment.com/docs/libraries/node/ // Definitions by: Andrew Fong +// Thomas Thiebaud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = AnalyticsNode.Analytics; declare namespace AnalyticsNode { + interface Message { + type: string; + context: { + library: { + name: string; + version: string; + }, + [key: string]: any + }; + _metadata: { + nodeVersion: string; + [key: string]: any; + }, + timestamp?: Date; + messageId?: string; + anonymousId: string | number; + userId: string | number; + } + + interface Data { + batch: Message[], + timestamp: Date; + sentAt: Date; + } interface Integrations { [index: string]: boolean; @@ -25,7 +50,7 @@ declare namespace AnalyticsNode { timestamp?: Date; context?: Object; integrations?: Integrations; - }): Analytics; + }, callback?: (err: Error, data: Data) => void): Analytics; /* The track method lets you record the actions your users perform. */ track(message: { @@ -35,7 +60,7 @@ declare namespace AnalyticsNode { timestamp?: Date; context?: Object; integrations?: Integrations; - }): Analytics; + }, callback?: (err: Error, data: Data) => void): Analytics; /* The page method lets you record page views on your website, along with optional extra information about the page being viewed. */ @@ -47,14 +72,14 @@ declare namespace AnalyticsNode { timestamp?: Date; context?: Object; integrations?: Integrations; - }): Analytics; + }, callback?: (err: Error, data: Data) => void): Analytics; /* alias is how you associate one identity with another. */ alias(message: { previousId: string | number; userId: string | number; integrations?: Integrations; - }): Analytics; + }, callback?: (err: Error, data: Data) => void): Analytics; /* Group calls can be used to associate individual users with shared accounts or companies. */ @@ -66,16 +91,9 @@ declare namespace AnalyticsNode { timestamp?: Date; anonymous_id?: string | number; integrations?: Integrations; - }): Analytics; + }, callback?: (err: Error, data: Data) => void): Analytics; /* Flush batched calls to make sure nothing is left in the queue */ - flush(fn?: (err: Error, batch: { - batch: Array<{ - type: string; - }>; - messageId: string; - sentAt: Date; - timestamp: Date; - }) => void): Analytics; + flush(callback?: (err: Error, data: Data) => void): Analytics; } } diff --git a/types/anchor-js/anchor-js-tests.ts b/types/anchor-js/anchor-js-tests.ts new file mode 100644 index 0000000000..a27e09605a --- /dev/null +++ b/types/anchor-js/anchor-js-tests.ts @@ -0,0 +1,16 @@ +anchors.add(); +anchors.add('h1'); +anchors.add().add('h2'); + +anchors.remove(); +anchors.remove('h1'); +anchors.remove().remove('h2'); + +anchors.removeAll(); + +const headerAnchors = new AnchorJS(); + +const footerAnchors = new AnchorJS({ + placement: 'right', +}); +footerAnchors.remove('.links'); diff --git a/types/anchor-js/index.d.ts b/types/anchor-js/index.d.ts new file mode 100644 index 0000000000..1f59c295e2 --- /dev/null +++ b/types/anchor-js/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for anchor-js 4.1 +// Project: https://github.com/bryanbraun/anchorjs +// Definitions by: Brian Surowiec +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace anchorjs { + interface Anchor { + options: AnchorOptions; + + add(selector?: string): Anchor; + remove(selector?: string): Anchor; + removeAll(): void; + } + + type AnchorPlacement = 'left' | 'right'; + type AnchorVisibility = 'always' | 'hover' | 'touch'; + + interface AnchorOptions { + arialabel?: string; + class?: string; + icons?: string; + placement?: AnchorPlacement; + truncate?: number; + visible?: AnchorVisibility; + } + + interface AnchorStatic { + new(options?: AnchorOptions): Anchor; + } +} + +declare const anchors: anchorjs.Anchor; +declare const AnchorJS: anchorjs.AnchorStatic; + +export = AnchorJS; + +export as namespace AnchorJS; + +declare global { + const anchors: anchorjs.Anchor; +} diff --git a/types/anchor-js/tsconfig.json b/types/anchor-js/tsconfig.json new file mode 100644 index 0000000000..19f6891217 --- /dev/null +++ b/types/anchor-js/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", + "anchor-js-tests.ts" + ] +} diff --git a/types/anchor-js/tslint.json b/types/anchor-js/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/anchor-js/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/angular-desktop-notification/angular-desktop-notification-tests.ts b/types/angular-desktop-notification/angular-desktop-notification-tests.ts new file mode 100644 index 0000000000..0cb41b2317 --- /dev/null +++ b/types/angular-desktop-notification/angular-desktop-notification-tests.ts @@ -0,0 +1,40 @@ +import * as angular from 'angular'; + +angular + .module('app', ['ngDesktopNotification']) + .config(['desktopNotificationProvider', (desktopNotificationProvider: angular.desktopNotification.IDesktopNotificationProvider) => { + desktopNotificationProvider.config({ + autoClose: true, + duration: 5, + showOnPageHidden: false, + }); + }]) + .controller('AppController', ['desktopNotification', (desktopNotification: angular.desktopNotification.IDesktopNotificationService) => { + // Check support and permission + const isNotificationSupported = desktopNotification.isSupported(); + const currentNotificationPermission = desktopNotification.currentPermission(); + + if (currentNotificationPermission === desktopNotification.permissions.granted) { + // Permission granted + } + + // Request permission + desktopNotification.requestPermission().then( + // Permission granted + (permission) => { + // Show notification + desktopNotification.show( + "Notification title", + { + tag: "tag", + body: "Notification body", + icon: "https://www.iconurl.com/icon-name.icon-extension", + onClick: () => { + // Notification clicked + } + }); + }, + () => { + // No permission granted + }); + }]); diff --git a/types/angular-desktop-notification/index.d.ts b/types/angular-desktop-notification/index.d.ts new file mode 100644 index 0000000000..a20d67cd21 --- /dev/null +++ b/types/angular-desktop-notification/index.d.ts @@ -0,0 +1,174 @@ +// Type definitions for angular-desktop-notification 1.1 +// Project: https://github.com/jmsanpascual/angular-desktop-notification#readme +// Definitions by: Davide Donadello +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as angular from 'angular'; + +declare var _: string; +export = _; + +declare module 'angular' { + namespace desktopNotification { + /** + * All options available during show notification according to https://developer.mozilla.org/en-US/docs/Web/API/notification + */ + interface AugmentedNotificationOptions extends NotificationOptions { + /** + * The badge property of the Notification interface returns the URL of the image used to represent the notification + * when there is not enough space to display the notification itself. + * + * This is an experimental technology + * Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/badge + */ + badge?: USVString; + + /** + * The data read-only property of the Notification interface returns a structured clone of the notification's data, + * as specified in the data option of the Notification() constructor + * + * Note: This feature is available in Web Workers. + * Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/data + */ + data?: any; + + /** + * The image read-only property of the Notification interface contains the URL of an image to be displayed as part of + * the notification, as specified in the image option of the Notification() constructor. + * + * Note: This feature is available in Web Workers. + * Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/image + */ + image?: USVString; + + /** + * The renotify read-only property of the Notification interface specifies whether the user should be notified after a + * new notification replaces an old one, as specified in the renotify option of the Notification() constructor + * + * Note: This property is not currently supported in any browser. + * Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/renotify + */ + renotify?: boolean; + + /** + * The requireInteraction read-only property of the Notification interface returns a Boolean indicating that a notification + * should remain active until the user clicks or dismisses it, rather than closing automatically. + * + * Note: This can be set when the notification is first created by setting the requireInteraction option to true in the + * options object of the Notification.Notification() constructor. + * Note: This feature is available in Web Workers. + * Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/requireInteraction + */ + requireInteraction?: boolean; + + /** + * The silent read-only property of the Notification interface specifies whether the notification should be silent, i.e. no + * sounds or vibrations should be issued, regardless of the device settings. This is specified in the renotify option of the + * Notification() constructor. + * + * Note: This feature is available in Web Workers. + * Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/silent + */ + silent?: boolean; + + /** + * The timestamp read-only property of the Notification interface returns a DOMTimeStamp, as specified in the timestamp option of the + * Notification() constructor. + * + * The notification's timestamp can represent the time, in milliseconds since 00:00:00 UTC on 1 January 1970, of the event for which + * the notification was created, or it can be an arbitrary timestamp that you want associated with the notification. For example, a + * timestamp for an upcoming meeting could be set in the future, whereas a timestamp for a missed message could be set in the past. + * + * Note: This feature is available in Web Workers + * Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/timestamp + */ + timestamp?: number; + + /** + * The title read-only property of the Notification interface indicates the title of the notification, as specified in the title parameter + * of the Notification() constructor. + * + * Note: This feature is available in Web Workers. + * Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/title + */ + title?: string; + + /** + * The vibrate read-only property of the Notification interface specifies a a vibration pattern for the device's vibration hardware to emit + * when the notification fires. This is specified in the vibrate option of the Notification() constructor. + * + * Note: This property is not currently supported in any browser. + * Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/vibrate + */ + vibrate?: boolean; + + /** + * The onclick property of the Notification interface specifies an event listener to receive click events. + * These events occur when the user clicks on a displayed Notification. + * + * The default behavior is to move the focus to the viewport of the notification's related browsing context. + * If you don't want that behaviour, call preventDefault() on the event object. + */ + onClick?: (event: MouseEvent) => void; + + /** + * The onerror property of the Notification interface specifies an event listener to receive error events. + * These events occur when something goes wrong with a Notification (in many cases an error preventing the notification from being displayed.) + * + * A function which serves as the event handler for the error event. When an error occurs, the specified function will be called. + * If null, no error handler is in effect. + */ + onError?: EventListener; + } + + // tslint:disable-next-line interface-name + interface IDesktopNotificationOptions { + autoClose?: boolean; + duration?: number; + showOnPageHidden?: boolean; + } + + // tslint:disable-next-line interface-name + interface IDesktopNotificationProvider { + /** + * Set the default app-wide configuration for desktopNotification + */ + config(options: IDesktopNotificationOptions): void; + } + + // tslint:disable-next-line interface-name + interface IDesktopNotificationService { + permissions: { + default: 'default', + denied: 'denied', + granted: 'granted', + }; + + /** + * This method returns true if the browser supports the Notification API, false otherwise + */ + isSupported(): boolean; + + /** + * This method will get the current permission set in the browser which could be one of the ff. + * - desktopNotification.permissions.default + * - desktopNotification.permissions.denied + * - desktopNotification.permissions.granted + */ + currentPermission(): NotificationPermission; + + /** + * This method returns a $q promise, if the user allowed the notification the successCallback will be executed, + * errorCallback will be executed otherwise + */ + requestPermission(): IPromise; + + /** + * This method will display the notification using the parameter values. + * See all available options here at https://developer.mozilla.org/en-US/docs/Web/API/notification#Instance_properties + */ + show(title: string, options?: NotificationOptions | AugmentedNotificationOptions): void; + } + } +} diff --git a/types/angular-desktop-notification/tsconfig.json b/types/angular-desktop-notification/tsconfig.json new file mode 100644 index 0000000000..4398df5f25 --- /dev/null +++ b/types/angular-desktop-notification/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "angular-desktop-notification-tests.ts" + ] +} diff --git a/types/angular-desktop-notification/tslint.json b/types/angular-desktop-notification/tslint.json new file mode 100644 index 0000000000..183bc723ef --- /dev/null +++ b/types/angular-desktop-notification/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/angular-hotkeys/tsconfig.json b/types/angular-hotkeys/tsconfig.json index acb11ff247..81fdf31b45 100644 --- a/types/angular-hotkeys/tsconfig.json +++ b/types/angular-hotkeys/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "angular-hotkeys-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/angular-material/angular-material-tests.ts b/types/angular-material/angular-material-tests.ts index 8d6955c697..ad79cff2db 100644 --- a/types/angular-material/angular-material-tests.ts +++ b/types/angular-material/angular-material-tests.ts @@ -164,8 +164,7 @@ myApp.controller('DialogController', ($scope: TestScope, $mdDialog: ng.material. .controller(function TestController(param) { }) .controller(class { }) .controller(['fakeService', function TestController(fake) { }]) - .controller(['fakeService', class { }]) - ; + .controller(['fakeService', class { }]); const dialogOptions: ng.material.IDialogOptions = {}; @@ -389,3 +388,11 @@ myApp.controller('PanelController', ($scope: TestScope, $mdPanel: ng.material.IP $mdPanel.newPanelAnimation().openFrom({ top: 0, left: 0 }); }; }); + +myApp.controller('StickyController', ($scope: TestScope, $mdSticky: ng.material.IStickyService) => { + const stickyElement = angular.element(new Element()); + const cloneStickyElement = stickyElement.clone(); + + $mdSticky($scope, stickyElement); + $mdSticky($scope, stickyElement, cloneStickyElement); +}); diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index 92f6d46751..d77f5ae7ce 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -494,5 +494,7 @@ declare module 'angular' { interface IProgressCircularProvider { configure(options: IProgressCircularConfig): void; } + + type IStickyService = (scope: IScope, element: JQuery, elementClone?: JQuery) => void; } } diff --git a/types/angular-touchspin/angular-touchspin-tests.ts b/types/angular-touchspin/angular-touchspin-tests.ts deleted file mode 100644 index 32396365d9..0000000000 --- a/types/angular-touchspin/angular-touchspin-tests.ts +++ /dev/null @@ -1,29 +0,0 @@ -import angularTouchSpin = require("angular-touchspin"); -import * as angular from 'angular'; - -angular - .module('touchspin-tests', ['nk.touchspin']) - .config(function(touchspinConfigProvider: angular.touchspin.ITouchSpinConfigProvider) { - touchspinConfigProvider.defaults({ - min: 0, - max: 0, - step: 0, - decimals: 0, - stepInterval: 0, - forceStepDivisibility: '', // none | floor | round | ceil - stepIntervalDelay: 0, - verticalButtons: true, - verticalUpClass: '', - verticalDownClass: '', - initVal: 0, - prefix: '', - postfix: '', - prefixExtraClass: '', - postfixExtraClass: '', - mousewheel: true, - buttonDownClass: '', - buttonUpClass: '', - buttonDownTxt: '', - buttonUpTxt: '' - }); - }); diff --git a/types/angular-touchspin/index.d.ts b/types/angular-touchspin/index.d.ts deleted file mode 100644 index 305a033275..0000000000 --- a/types/angular-touchspin/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Type definitions for Angular Touchspin v1.0.0 -// Project: https://github.com/nkovacic/angular-touchspin -// Definitions by: Niko Kovačič -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -declare let angularTouchSpin: string; -export = angularTouchSpin; - -declare module "angular" { - namespace touchspin { - interface ITouchSpinOptions { - min?: number; - max?: number; - step?: number; - decimals?: number; - stepInterval?: number; - forceStepDivisibility?: string; // none | floor | round | ceil - stepIntervalDelay?: number; - verticalButtons?: boolean; - verticalUpClass?: string; - verticalDownClass?: string; - initVal?: number; - prefix?: string; - postfix?: string; - prefixExtraClass?: string; - postfixExtraClass?: string; - mousewheel?: boolean; - buttonDownClass?: string; - buttonUpClass?: string; - buttonDownTxt?: string; - buttonUpTxt?: string; - } - - interface ITouchSpinConfig extends ITouchSpinOptions { } - - interface ITouchSpinConfigProvider { - defaults(touchSpinOptions: ITouchSpinOptions): void; - } - } -} diff --git a/types/angular-translate/index.d.ts b/types/angular-translate/index.d.ts index 55c74629a8..69b1f63d72 100644 --- a/types/angular-translate/index.d.ts +++ b/types/angular-translate/index.d.ts @@ -71,6 +71,7 @@ declare module 'angular' { isReady(): boolean; onReady(): angular.IPromise; resolveClientLocale(): string; + getAvailableLanguageKeys(): string[]; } interface ITranslateProvider extends angular.IServiceProvider { diff --git a/types/angular-websocket/tsconfig.json b/types/angular-websocket/tsconfig.json index 89d5cb9dc3..e4d648dbda 100644 --- a/types/angular-websocket/tsconfig.json +++ b/types/angular-websocket/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "angular-websocket-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 795e74a058..ca9d2c7568 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -289,25 +289,25 @@ foo.then((x) => { // $q signature tests namespace TestQ { - interface TResult { + interface AbcObject { a: number; b: string; c: boolean; } - interface TValue { + interface EfObject { e: number; f: boolean; } - interface TOther { + interface GhObject { g: string; h: number; } - const tResult: TResult = null; - const promiseTResult: angular.IPromise = null; - const tValue: TValue = null; - const promiseTValue: angular.IPromise = null; - const tOther: TOther = null; - const promiseTOther: angular.IPromise = null; + const abcObject: AbcObject = null; + const abcObjectPromise: angular.IPromise = null; + const efObject: EfObject = null; + const efObjectPromise: angular.IPromise = null; + const ghObject: GhObject = null; + const ghObjectPromise: angular.IPromise = null; const $q: angular.IQService = null; const promiseAny: angular.IPromise = null; @@ -316,11 +316,11 @@ namespace TestQ { // $q constructor { - let result: angular.IPromise; - result = new $q((resolve: (value: TResult) => any) => {}); - result = new $q((resolve: (value: TResult) => any, reject: (value: any) => any) => {}); - result = $q((resolve: (value: TResult) => any) => {}); - result = $q((resolve: (value: TResult) => any, reject: (value: any) => any) => {}); + let result: angular.IPromise; + result = new $q((resolve: (value: AbcObject) => any) => {}); + result = new $q((resolve: (value: AbcObject) => any, reject: (value: any) => any) => {}); + result = $q((resolve: (value: AbcObject) => any) => {}); + result = $q((resolve: (value: AbcObject) => any, reject: (value: any) => any) => {}); } // $q.all @@ -332,8 +332,8 @@ namespace TestQ { $q.all([1, $q.when(2), '3']).then(([ n1, n2, n3 ]) => n1.toFixed() + n2.toFixed() + n3.slice(1)); } { - let result: angular.IPromise; - result = $q.all([promiseAny, promiseAny]); + let result: angular.IPromise; + result = $q.all([promiseAny, promiseAny]); } { let result: angular.IPromise<{[id: string]: any; }>; @@ -356,13 +356,13 @@ namespace TestQ { // $q.defer { - let result: angular.IDeferred; - result = $q.defer(); - result.resolve(tResult); + let result: angular.IDeferred; + result = $q.defer(); + result.resolve(abcObject); const anyValue: any = null; result.reject(anyValue); result.promise.then(result => { - return $q.resolve(result); + return $q.resolve(result); }); } @@ -380,10 +380,10 @@ namespace TestQ { result = $q.resolve(); } { - let result: angular.IPromise; - result = $q.resolve(tResult); - result = $q.resolve(promiseTResult); - const result2: angular.IPromise = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther); + let result: angular.IPromise; + result = $q.resolve(abcObject); + result = $q.resolve(abcObjectPromise); + const result2: angular.IPromise = $q.resolve(Math.random() > 0.5 ? abcObject : ghObjectPromise); } // $q.when @@ -392,32 +392,32 @@ namespace TestQ { result = $q.when(); } { - let result: angular.IPromise; - let resultOther: angular.IPromise; + let result: angular.IPromise; + let resultOther: angular.IPromise; - result = $q.when(tResult); - result = $q.when(promiseTResult); + result = $q.when(abcObject); + result = $q.when(abcObjectPromise); - result = $q.when(tValue, (result: TValue) => tResult); - result = $q.when(tValue, (result: TValue) => tResult, (any) => any); - result = $q.when(tValue, (result: TValue) => tResult, (any) => any, (any) => any); + result = $q.when(efObject, (result: EfObject) => abcObject); + result = $q.when(efObject, (result: EfObject) => abcObject, (any) => any); + result = $q.when(efObject, (result: EfObject) => abcObject, (any) => any, (any) => any); - result = $q.when(promiseTValue, (result: TValue) => tResult); - resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => tOther); - resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => tOther); - resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => tOther, (any) => any); - resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther); - resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther, (any) => any); + result = $q.when(efObjectPromise, (result: EfObject) => abcObject); + resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObject); + resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObject); + resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObject, (any) => any); + resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObjectPromise); + resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObjectPromise, (any) => any); - result = $q.when(tValue, (result: TValue) => promiseTResult); - result = $q.when(tValue, (result: TValue) => promiseTResult, (any) => any); - result = $q.when(tValue, (result: TValue) => promiseTResult, (any) => any, (any) => any); + result = $q.when(efObject, (result: EfObject) => abcObjectPromise); + result = $q.when(efObject, (result: EfObject) => abcObjectPromise, (any) => any); + result = $q.when(efObject, (result: EfObject) => abcObjectPromise, (any) => any, (any) => any); - result = $q.when(promiseTValue, (result: TValue) => promiseTResult); - resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther); - resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther, (any) => any); - resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther); - resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther, (any) => any); + result = $q.when(efObjectPromise, (result: EfObject) => abcObjectPromise); + resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObjectPromise, (any) => ghObject); + resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObjectPromise, (any) => ghObject, (any) => any); + resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObjectPromise, (any) => ghObjectPromise); + resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObjectPromise, (any) => ghObjectPromise, (any) => any); } } @@ -440,41 +440,41 @@ httpFoo.then((response: ng.IHttpResponse) => { // Deferred signature tests namespace TestDeferred { - const any: any = null; + const anything: any = null; - interface TResult { + interface AbcObject { a: number; b: string; c: boolean; } - const tResult: TResult = null; + const abcObject: AbcObject = null; - const deferred: angular.IDeferred = null; + const deferred: angular.IDeferred = null; // deferred.resolve { let result: void; result = deferred.resolve(); - result = deferred.resolve(tResult); + result = deferred.resolve(abcObject); } // deferred.reject { let result: void; result = deferred.reject(); - result = deferred.reject(any); + result = deferred.reject(anything); } // deferred.notify { let result: void; result = deferred.notify(); - result = deferred.notify(any); + result = deferred.notify(anything); } // deferred.promise { - let result: angular.IPromise; + let result: angular.IPromise; result = deferred.promise; } } @@ -517,111 +517,189 @@ namespace TestInjector { // Promise signature tests namespace TestPromise { - const any: any = null; + const anything: any = null; - interface TResult { - kind: 'result'; + interface AbcObject { + kind: 'abc'; a: number; b: string; c: boolean; } - interface TOther { - kind: 'other'; + interface DefObject { + kind: 'def'; d: number; e: string; f: boolean; } - function isTResult(x: TResult | TOther): x is TResult { - return x.kind === 'result'; + function isAbcObject(x: AbcObject | DefObject): x is AbcObject { + return x.kind === 'abc'; } - const tresult: TResult = null; - const tresultPromise: ng.IPromise = null; - const tresultHttpPromise: ng.IHttpPromise = null; + const abcObject: AbcObject = null; + const abcObjectPromise: ng.IPromise = null; + const abcObjectHttpPromise: ng.IHttpPromise = null; - const tother: TOther = null; - const totherPromise: ng.IPromise = null; - const totherHttpPromise: ng.IHttpPromise = null; + const defObject: DefObject = null; + const defObjectPromise: ng.IPromise = null; + const defObjectHttpPromise: ng.IHttpPromise = null; - const promise: angular.IPromise = null; + const promise: angular.IPromise = null; const $q: angular.IQService = null; - const assertPromiseType = (arg: angular.IPromise) => arg; - const reject = $q.reject(); + const rejectedPromise = $q.reject(); // promise.then - assertPromiseType(promise.then((result) => any)); - assertPromiseType(promise.then((result) => any, (any) => any)); - assertPromiseType(promise.then((result) => any, (any) => any, (any) => any)); + // $ExpectType IPromise + promise.then(result => anything); + // $ExpectType IPromise + promise.then(result => anything, any => any); + // $ExpectType IPromise + promise.then(result => anything, any => any, any => any); - assertPromiseType(promise.then((result) => reject)); - assertPromiseType(promise.then((result) => reject, (any) => reject)); - assertPromiseType(promise.then((result) => reject, (any) => reject, (any) => any)); + // $ExpectType IPromise + promise.then(result => rejectedPromise); + // $ExpectType IPromise + promise.then(result => rejectedPromise, any => rejectedPromise); + // $ExpectType IPromise + promise.then(result => rejectedPromise, any => rejectedPromise, any => any); - assertPromiseType(promise.then((result) => result)); - assertPromiseType(promise.then((result) => tresult)); - assertPromiseType(promise.then((result) => tresultPromise)); - assertPromiseType(promise.then((result) => result, (any) => any)); - assertPromiseType(promise.then((result) => result, (any) => any, (any) => any)); - assertPromiseType(promise.then((result) => result, (any) => reject, (any) => any)); + // $ExpectType IPromise + promise.then(result => result); + // $ExpectType IPromise + promise.then(result => abcObject); + // $ExpectType IPromise + promise.then(result => abcObjectPromise); + // $ExpectType IPromise + promise.then(result => result, any => any); + // $ExpectType IPromise + promise.then(result => result, any => Math.random()); + // $ExpectType IPromise + promise.then(result => result, any => any, any => any); + // $ExpectType IPromise + promise.then(result => result, any => Math.random(), any => any); + // $ExpectType IPromise + promise.then(result => result, any => rejectedPromise, any => any); - assertPromiseType | TResult>(promise.then((result) => anyOf2(reject, result))); - assertPromiseType(promise.then((result) => anyOf3(result, tresultPromise, reject))); - assertPromiseType(promise.then( - (result) => anyOf3(reject, result, tresultPromise), - (reason) => anyOf3(reject, tresult, tresultPromise) - )); + // $ExpectType IPromise + promise.then(result => anyOf2(rejectedPromise, result)); + // $ExpectType IPromise + promise.then(result => anyOf3(result, abcObjectPromise, rejectedPromise)); + // $ExpectType IPromise + promise.then( + result => anyOf3(rejectedPromise, result, abcObjectPromise), + reason => anyOf3(rejectedPromise, abcObject, abcObjectPromise) + ); - assertPromiseType>(promise.then((result) => tresultHttpPromise)); + // $ExpectType IPromise> + promise.then(result => abcObjectHttpPromise); - assertPromiseType(promise.then((result) => result, (any) => tother)); - assertPromiseType | angular.IPromise | TOther | angular.IPromise>(promise.then( - (result) => anyOf3(reject, result, totherPromise), - (reason) => anyOf3(reject, tother, tresultPromise) - )); + // $ExpectType IPromise + promise.then(result => result, any => defObject); - assertPromiseType(promise.then( - (result) => anyOf3(tresultPromise, result, totherPromise) - )); + // These are broken and seemingly can't be made to work + // with the current limitations of TypeScript. - assertPromiseType(promise.then((result) => result, (any) => tother, (any) => any)); - assertPromiseType(promise.then((result) => tresultPromise, (any) => totherPromise)); - assertPromiseType(promise.then((result) => tresultPromise, (any) => totherPromise, (any) => any)); - assertPromiseType>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise)); - assertPromiseType>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise, (any) => any)); + // xExpectType IPromise + // promise.then(result => anyOf2(result, defObjectPromise)); + // xExpectType IPromise + // promise.then(result => anyOf3(rejectedPromise, result, defObjectPromise)); + // xExpectType IPromise + // const a4 = promise.then( + // result => anyOf3(rejectedPromise, result, defObjectPromise), + // reason => anyOf3(rejectedPromise, defObject, abcObjectPromise) + // ); - assertPromiseType(promise.then((result) => tother)); - assertPromiseType(promise.then((result) => tother, (any) => any)); - assertPromiseType(promise.then((result) => tother, (any) => any, (any) => any)); - assertPromiseType(promise.then((result) => totherPromise)); - assertPromiseType(promise.then((result) => totherPromise, (any) => any)); - assertPromiseType(promise.then((result) => totherPromise, (any) => any, (any) => any)); - assertPromiseType>(promise.then((result) => totherHttpPromise)); - assertPromiseType>(promise.then((result) => totherHttpPromise, (any) => any)); - assertPromiseType>(promise.then((result) => totherHttpPromise, (any) => any, (any) => any)); + // $ExpectType IPromise + promise.then(result => + anyOf3(abcObjectPromise, result, defObjectPromise) + ); - assertPromiseType(promise.then((result) => tresult, (any) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f)); + // $ExpectType IPromise + promise.then(result => result, any => defObject, any => any); + // $ExpectType IPromise + promise.then(result => abcObjectPromise, any => defObjectPromise); + // $ExpectType IPromise + promise.then(result => abcObjectPromise, any => defObjectPromise, any => any); + // $ExpectType IPromise | IHttpResponse> + promise.then(result => abcObjectHttpPromise, any => defObjectHttpPromise); + // $ExpectType IPromise | IHttpResponse> + promise.then(result => abcObjectHttpPromise, any => defObjectHttpPromise, any => any); + + // $ExpectType IPromise + promise.then(result => defObject); + // $ExpectType IPromise + promise.then(result => defObject, any => any); + // $ExpectType IPromise + promise.then(result => defObject, any => any, any => any); + // $ExpectType IPromise + promise.then(result => defObjectPromise); + // $ExpectType IPromise + promise.then(result => defObjectPromise, any => any); + // $ExpectType IPromise + promise.then(result => defObjectPromise, any => any, any => any); + // $ExpectType IPromise> + promise.then(result => defObjectHttpPromise); + // $ExpectType IPromise + promise.then(result => defObjectHttpPromise, any => any); + // $ExpectType IPromise + promise.then(result => defObjectHttpPromise, any => any, any => any); + + // $ExpectType IPromise + promise + .then(result => abcObject, any => defObject) + .then(ambiguous => (isAbcObject(ambiguous) ? ambiguous.c : ambiguous.f)); + + // promise.then + $q.reject: + + // $ExpectType IPromise + $q.resolve(true).then(result => Math.random() > 0.5 ? Math.random() : $q.reject()); + // $ExpectType IPromise + $q.resolve(true).then(result => Math.random() > 0.5 ? Math.random() : $q.reject('a')); + // $ExpectType IPromise + $q.resolve().then(() => $q.reject('a')); + // $ExpectType IPromise + $q.resolve().then(() => { + if (Math.random() > 0.5) $q.reject(); + }); // promise.catch - assertPromiseType(promise.catch((err) => err)); - assertPromiseType(promise.catch((err) => any)); - assertPromiseType(promise.catch((err) => tresult)); - assertPromiseType>(promise.catch((err) => anyOf2(tresult, reject))); - assertPromiseType(promise.catch((err) => anyOf3(tresult, tresultPromise, reject))); - assertPromiseType(promise.catch((err) => tresultPromise)); - assertPromiseType>(promise.catch((err) => tresultHttpPromise)); - assertPromiseType(promise.catch((err) => tother)); - assertPromiseType(promise.catch((err) => totherPromise)); - assertPromiseType>(promise.catch((err) => totherHttpPromise)); + // $ExpectType IPromise + promise.catch(err => err); + // $ExpectType IPromise + promise.catch(err => anything); + // $ExpectType IPromise + promise.catch(err => abcObject); + // $ExpectType IPromise + promise.catch(err => anyOf2(abcObject, rejectedPromise)); + // $ExpectType IPromise + promise.catch(err => anyOf3(abcObject, abcObjectPromise, rejectedPromise)); + // $ExpectType IPromise + promise.catch(err => abcObjectPromise); + // $ExpectType IPromise> + promise.catch(err => abcObjectHttpPromise); + // $ExpectType IPromise + promise.catch(err => defObject); + // $ExpectType IPromise + promise.catch(err => defObjectPromise); + // $ExpectType IPromise> + promise.catch(err => defObjectHttpPromise); - assertPromiseType(promise.catch((err) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f)); + // $ExpectType IPromise + promise + .catch(err => defObject) + .then( + ambiguous => (isAbcObject(ambiguous) ? ambiguous.c : ambiguous.f) + ); // promise.finally - assertPromiseType(promise.finally(() => any)); - assertPromiseType(promise.finally(() => tresult)); - assertPromiseType(promise.finally(() => tother)); + // $ExpectType IPromise + promise.finally(() => anything); + // $ExpectType IPromise + promise.finally(() => abcObject); + // $ExpectType IPromise + promise.finally(() => defObject); } function test_angular_forEach() { @@ -632,6 +710,24 @@ function test_angular_forEach() { this.push(`${key}: ${value}`); }, log); // expect(log).toEqual(['name: misko', 'gender: male']); + // $ExpectType NodeListOf + angular.forEach(document.getElementsByTagName('img'), (value, key, obj) => { + value; // $ExpectType HTMLImageElement + key; // $ExpectType number + obj; // $ExpectType NodeListOf + }); + // $ExpectType number[] + angular.forEach([1, 2, 3], (value, key, obj) => { + value; // $ExpectType number + key; // $ExpectType number + obj; // $ExpectType number[] + }); + // $ExpectType string + angular.forEach('123', (value, key, obj) => { + value; // $ExpectType string + key; // $ExpectType number + obj; // $ExpectType string + }); } // angular.element() tests @@ -648,12 +744,12 @@ let elementReadyFn = angular.element(() => { // $timeout signature tests namespace TestTimeout { - interface TResult { + interface AbcObject { a: number; b: string; c: boolean; } - const fnTResult: (...args: any[]) => TResult = null; + const abcObjectFn: (...args: any[]) => AbcObject = null; const promiseAny: angular.IPromise = null; const $timeout: angular.ITimeoutService = null; @@ -668,13 +764,13 @@ namespace TestTimeout { result = $timeout(1, true); } { - let result: angular.IPromise; - result = $timeout(fnTResult); - result = $timeout(fnTResult, 1); - result = $timeout(fnTResult, 1, true); - result = $timeout(fnTResult, 1, true, 1); - result = $timeout(fnTResult, 1, true, 1, ''); - result = $timeout(fnTResult, 1, true, 1, '', true); + let result: angular.IPromise; + result = $timeout(abcObjectFn); + result = $timeout(abcObjectFn, 1); + result = $timeout(abcObjectFn, 1, true); + result = $timeout(abcObjectFn, 1, true, 1); + result = $timeout(abcObjectFn, 1, true, 1, ''); + result = $timeout(abcObjectFn, 1, true, 1, '', true); } // $timeout.cancel @@ -1187,6 +1283,24 @@ function NgModelControllerTyping() { }; } +// FormController +angular.module('app').directive('formDebugChecker', () => { + return { + require: '^^form', + link: (scope, el, attrs, ctrl) => { + const form = ctrl as angular.IFormController; + el.on('click', () => { + const report = [] as string[]; + angular.forEach(form.$error, (controls, validationErrorKey) => { + const names = controls.map(control => control.$name); + report.push(`${validationErrorKey}: ${controls.length} control(s) (${names.join(', ')})`); + }); + console.log(`This form has ${report.length} error(s).\n${report.join('\n')}`); + }); + } + }; +}); + let $filter: angular.IFilterService; function testFilter() { diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index 5d8b6315b0..4c896eb430 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -100,7 +100,11 @@ declare namespace angular { * @param iterator Iterator function. * @param context Object to become context (this) for the iterator function. */ - forEach(obj: T[], iterator: (value: T, key: number, obj: T[]) => void, context?: any): T[]; + forEach = T[]>( + obj: U, + iterator: (value: U[number], key: number, obj: U) => void, + context?: any + ): U; /** * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. * @@ -357,9 +361,9 @@ declare namespace angular { $valid: boolean; $invalid: boolean; $submitted: boolean; - $error: any; - $name: string; - $pending: any; + $error: { [validationErrorKey: string]: Array }; + $name?: string; + $pending?: { [validationErrorKey: string]: Array }; $addControl(control: INgModelController | IFormController): void; $removeControl(control: INgModelController | IFormController): void; $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController | IFormController): void; @@ -388,6 +392,7 @@ declare namespace angular { $setUntouched(): void; $rollbackViewValue(): void; $commitViewValue(): void; + $processModelValue(): void; $isEmpty(value: any): boolean; $overrideModelOptions(options: INgModelOptions): void; @@ -398,8 +403,8 @@ declare namespace angular { $parsers: IModelParser[]; $formatters: IModelFormatter[]; $viewChangeListeners: IModelViewChangeListener[]; - $error: any; - $name: string; + $error: { [validationErrorKey: string]: boolean }; + $name?: string; $touched: boolean; $untouched: boolean; @@ -407,7 +412,7 @@ declare namespace angular { $validators: IModelValidators; $asyncValidators: IAsyncModelValidators; - $pending: any; + $pending?: { [validationErrorKey: string]: boolean }; $pristine: boolean; $dirty: boolean; $valid: boolean; @@ -1102,28 +1107,43 @@ declare namespace angular { interface IPromise { /** - * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. - * The successCallBack may return IPromise for when a $q.reject() needs to be returned - * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. + * Regardless of when the promise was or will be resolved or rejected, then calls one of + * the success or error callbacks asynchronously as soon as the result is available. The + * callbacks are called with a single argument: the result or rejection reason. + * Additionally, the notify callback may be called zero or more times to provide a + * progress indication, before the promise is resolved or rejected. + * The `successCallBack` may return `IPromise` for when a `$q.reject()` needs to + * be returned. + * This method returns a new promise which is resolved or rejected via the return value + * of the `successCallback`, `errorCallback`. It also notifies via the return value of + * the `notifyCallback` method. The promise can not be resolved or rejected from the + * `notifyCallback` method. */ - then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise; - then(successCallback: (promiseValue: T) => IPromise|TResult2, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise; - - then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback: (reason: any) => IPromise|TCatch, notifyCallback?: (state: any) => any): IPromise; - then(successCallback: (promiseValue: T) => IPromise|TResult2, errorCallback: (reason: any) => IPromise|TCatch2, notifyCallback?: (state: any) => any): IPromise; + then( + successCallback?: + | ((value: T) => IPromise | IPromise | TResult1) + | null, + errorCallback?: + | ((reason: any) => IPromise | IPromise | TResult2) + | null, + notifyCallback?: (state: any) => any + ): IPromise; /** * Shorthand for promise.then(null, errorCallback) */ - catch(onRejected: (reason: any) => IPromise|TCatch): IPromise; - catch(onRejected: (reason: any) => IPromise|TCatch2): IPromise; + catch( + onRejected?: + | ((reason: any) => IPromise | IPromise | TResult) + | null + ): IPromise; /** * Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information. * * Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible. */ - finally(finallyCallback: () => any): IPromise; + finally(finallyCallback: () => void): IPromise; } interface IDeferred { diff --git a/types/angular/tsconfig.json b/types/angular/tsconfig.json index 5ce810f938..46eeb69c7a 100644 --- a/types/angular/tsconfig.json +++ b/types/angular/tsconfig.json @@ -25,4 +25,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} +} \ No newline at end of file diff --git a/types/ansi-colors/tsconfig.json b/types/ansi-colors/tsconfig.json index 8a0f980cbc..ebd56021f9 100644 --- a/types/ansi-colors/tsconfig.json +++ b/types/ansi-colors/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "ansi-colors-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/ansi-regex/tsconfig.json b/types/ansi-regex/tsconfig.json index cf1ac84a5c..4d0c1ff787 100644 --- a/types/ansi-regex/tsconfig.json +++ b/types/ansi-regex/tsconfig.json @@ -7,7 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +20,4 @@ "index.d.ts", "ansi-regex-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/anybar/anybar-tests.ts b/types/anybar/anybar-tests.ts index 6b4ea8ef89..dbc7a5edd6 100644 --- a/types/anybar/anybar-tests.ts +++ b/types/anybar/anybar-tests.ts @@ -1,5 +1,5 @@ -import * as anybar from 'anybar' +import anybar = require('anybar'); -anybar('red', { port: 123 }) +anybar('red', { port: 123 }); -anybar('green') +anybar('green'); diff --git a/types/anybar/index.d.ts b/types/anybar/index.d.ts index 4972f29756..a9a2452b06 100644 --- a/types/anybar/index.d.ts +++ b/types/anybar/index.d.ts @@ -1,10 +1,9 @@ -// Type definitions for anybar 2.0.1 +// Type definitions for anybar 2.0 // Project: https://github.com/sindresorhus/anybar // Definitions by: Chris Khoo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 -declare namespace anybar { } +declare function anybar(color: string, options?: { port: number }): void; -declare function anybar(color: string, options?: { port: number }): void - -export = anybar +export = anybar; diff --git a/types/anybar/tsconfig.json b/types/anybar/tsconfig.json index 1dd62548e6..2f04506e12 100644 --- a/types/anybar/tsconfig.json +++ b/types/anybar/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "anybar-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/anybar/tslint.json b/types/anybar/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/anybar/tslint.json +++ b/types/anybar/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/apex.js/apex.js-tests.ts b/types/apex.js/apex.js-tests.ts index 0595ef43ea..f5d96e2c54 100644 --- a/types/apex.js/apex.js-tests.ts +++ b/types/apex.js/apex.js-tests.ts @@ -1,4 +1,4 @@ -import * as λ from "apex.js"; +import λ = require("apex.js"); const handler = λ((event, context) => { console.log("Event: " + JSON.stringify(event)); diff --git a/types/apex.js/index.d.ts b/types/apex.js/index.d.ts index 0998ce794c..20e05d2a5e 100644 --- a/types/apex.js/index.d.ts +++ b/types/apex.js/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/apex/node-apex // Definitions by: Yoriki Yamaguchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 /// diff --git a/types/aphrodite/index.d.ts b/types/aphrodite/index.d.ts index 0e04b07af7..00d1908d9f 100644 --- a/types/aphrodite/index.d.ts +++ b/types/aphrodite/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/Khan/aphrodite // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/api-error-handler/api-error-handler-tests.ts b/types/api-error-handler/api-error-handler-tests.ts index 67afbb0fce..aa72342d75 100644 --- a/types/api-error-handler/api-error-handler-tests.ts +++ b/types/api-error-handler/api-error-handler-tests.ts @@ -1,4 +1,4 @@ -import * as errorHandler from 'api-error-handler'; +import errorHandler = require('api-error-handler'); import * as express from 'express'; var api = express.Router(); diff --git a/types/app-root-dir/app-root-dir-tests.ts b/types/app-root-dir/app-root-dir-tests.ts new file mode 100644 index 0000000000..bff8969927 --- /dev/null +++ b/types/app-root-dir/app-root-dir-tests.ts @@ -0,0 +1,6 @@ +import * as rootDir from 'app-root-dir'; + +let appRootPath: string; + +rootDir.set('__dirname'); +appRootPath = rootDir.get(); diff --git a/types/app-root-dir/index.d.ts b/types/app-root-dir/index.d.ts new file mode 100644 index 0000000000..8b0bf5bc6a --- /dev/null +++ b/types/app-root-dir/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for app-root-dir 0.1 +// Project: https://github.com/philidem/node-app-root-dir +// Definitions by: shaochenyang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface AppRootDir { + // Get the application's root directory + get(): string; + /** + * Set the application's root directory + * this will set a global so that no matter + * how many instances of app-root-dir module are installed, + * they will all return the same directory + */ + set(dirname: string): void; +} + +declare const AppRootDir: AppRootDir; + +export = AppRootDir; diff --git a/types/app-root-dir/tsconfig.json b/types/app-root-dir/tsconfig.json new file mode 100644 index 0000000000..f378c094db --- /dev/null +++ b/types/app-root-dir/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", + "app-root-dir-tests.ts" + ] +} diff --git a/types/app-root-dir/tslint.json b/types/app-root-dir/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/app-root-dir/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/appdmg/tsconfig.json b/types/appdmg/tsconfig.json index f4ca0f95c5..452b9a4af3 100644 --- a/types/appdmg/tsconfig.json +++ b/types/appdmg/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "appdmg-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/aqb/aqb-tests.ts b/types/aqb/aqb-tests.ts new file mode 100644 index 0000000000..5e186126fe --- /dev/null +++ b/types/aqb/aqb-tests.ts @@ -0,0 +1,151 @@ +import QB = require("aqb"); + +/* + * Most of these tests are taken directly from the examples + * in the aqbjs Github documentation. + * + * https://github.com/arangodb/aqbjs + */ + +/* + * section aqb.js + * https://github.com/arangodb/aqbjs#auto-casting-raw-data + */ +const doc = { + aString: "hello", + aDate: new Date(), + aNumber: 23, + anArray: [1, 2, 3, "potato"] +}; + +QB(doc); +QB.for('x').in('1..5').return('x'); +QB.insert(QB(doc)).into('my_collection'); + +/* + * section aqb.js + * https://github.com/arangodb/aqbjs#aql-types + */ +QB.bool(true); +QB.num("12"); +QB.int("1"); +QB.str(23); +QB.list([ 1 , 2 , 3 , 4 , 5]); +QB.obj({'some.name': 'value'}); +QB.ref("users"); + +/* + * section aqb.js + * https://github.com/arangodb/aqbjs#aql-expressions + */ +QB.range(1 , 5); +QB.get("property"); +QB.ref("user").get("property"); +QB.expr(QB.for('x').in('1..5').return('x').toAQL()); + +/* + * section aqb.js + * https://github.com/arangodb/aqbjs#aql-operations + */ +QB.and("a", "b"); +QB.ref("a").and("b"); +QB.or("a" , "b"); +QB.ref("a").or("b"); +QB.add("a" , "b"); +QB.ref("a").add("b"); +QB.plus("a" , "b"); +QB.ref("a").plus("b"); +QB.sub("a" , "b"); +QB.ref("a").sub("b"); +QB.minus("a" , "b"); +QB.ref("a").minus("b"); +QB.mul("a" , "b"); +QB.ref("a").mul("b"); +QB.times("a" , "b"); +QB.ref("a").times("b"); +QB.div("a" , "b"); +QB.ref("a").div("b"); +QB.mod("a", "b"); +QB.ref("a").mod("b"); +QB.eq("a" , "b"); +QB.ref("a").eq("b"); +QB.neq("a", "b"); +QB.ref("a").neq("b"); +QB.gt("a" , "b"); +QB.ref("a").gt("b"); +QB.gte("a" , "b"); +QB.ref("a").gte("b"); +QB.lt("a" , "b"); +QB.ref("a").lt("b"); +QB.lte("a" , "b"); +QB.ref("a").lte("b"); +QB.in("a" , "b"); +QB.ref("a").in("b"); +QB.not("a"); +QB.ref("a").not(); +QB.notIn("a" , "b"); +QB.ref("a").notIn("b"); +QB.neg("a"); +QB.ref("a").neg(); +QB.if("x" , "y" , "z"); +QB.ref("x").then("y").else("z"); +QB.fn('MY::USER::FUNC')(1, 2, 3); +QB.fn('hello')(); + +/* + * section aqb.js + * https://github.com/arangodb/aqbjs#aql-statements + */ +QB.for('doc').in('my_collection'); +QB.for('doc').in('my_collection').let('foo' , 23); +QB.for('doc').in('my_collection').let('foo' , 23); +// QB.for('doc').in('my_collection').let({a: 1, b: 2, c: 3}); +QB.for('doc').in('my_collection').return('x'); +QB.for('doc').in('my_collection').return({x: 'x'}); +QB.for('doc').in('my_collection').returnDistinct('x'); +QB.for('doc').in('my_collection').filter(QB.eq('a', 'b')); +QB.for('doc').in('my_collection').collectWithCountInto('x'); +QB.for('doc').in('my_collection').collect('x', 'y'); +// QB.for('doc').in('my_collection').collect({x: 'a', y: 'b'}); +QB.for('doc').in('my_collection').collect('x' , 'y').withCountInto('z'); +QB.for('doc').in('my_collection').collect('x' , 'y').into('z').keep('a' , 'b'); +QB.for('doc').in('my_collection').collect('x' , 'y').into('z' , 'Z'); +QB.for('doc').in('my_collection').collect('x' , 'y').into('z'); +QB.for('doc').in('my_collection').collect('x' , 'y').into('z').options('opts'); +QB.for('doc').in('my_collection').collect('x' , 'y').options('opts'); +QB.for('doc').in('my_collection').collect('x' , 'y').keep('a' , 'b'); +QB.for('doc').in('my_collection').collect('x' , 'y').sort('x', 'DESC', 'y', 'ASC'); +QB.for('doc').in('my_collection').collect('x' , 'y').limit(20); +QB.for('doc').in('my_collection').collect('x' , 'y').limit(20 , 20); +QB.for('doc').in('my_collection').remove('x'); +QB.for('doc').in('my_collection').remove('x').in('y'); +QB.for('doc').in('my_collection').remove('x').in('y').returnOld('a'); +QB.for('doc').in('my_collection').remove('x').in('y').options('opts'); +QB.upsert('x').insert('y').replace('z').in('c'); +QB.upsert('x').insert('y').replace('z').in('c').options('opts'); +QB.upsert('x').insert('y').update('z').in('c'); +QB.upsert('x').insert('y').update('z').in('c').options('opts'); +QB.insert('x').into('y'); +QB.insert('x').into('y').options('opts'); +QB.insert('x').into('y').returnNew('z'); +QB.update('x').in('y'); +QB.update('x').into('y'); +QB.update('x').with('y').in('z'); +QB.update('x').with('y').into('z'); +QB.update('x').with('y').into('z').options('opts'); +QB.update('x').in('y').options('opts'); +QB.update('x').with('y').into('z').returnNew('v'); +QB.update('x').with('y').into('z').returnOld('v'); +QB.update('x').in('y').options('opts').returnNew('v'); +QB.update('x').in('y').options('opts').returnOld('v'); + +QB.replace('x').in('y'); +QB.replace('x').into('y'); +QB.replace('x').with('y').in('z'); +QB.replace('x').with('y').into('z'); +QB.replace('x').with('y').into('z').options('opts'); +QB.replace('x').in('y').options('opts'); +QB.replace('x').with('y').into('z').returnNew('v'); +QB.replace('x').with('y').into('z').returnOld('v'); +QB.replace('x').in('y').options('opts').returnNew('v'); +QB.replace('x').in('y').options('opts').returnOld('v'); diff --git a/types/aqb/index.d.ts b/types/aqb/index.d.ts new file mode 100644 index 0000000000..eb529e9c97 --- /dev/null +++ b/types/aqb/index.d.ts @@ -0,0 +1,1105 @@ +// Type definitions for aqbjs 2.1 +// Project: https://github.com/arangodb/aqbjs +// Definitions by: Athenkosi Mase +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 +interface AqlError extends Error { + new(message: string): Error; + name: string; +} +interface Operation extends Expression { + new(): Expression; +} +interface BinaryOperation extends Operation { + new(operator: string, value1: any, value2: any): Operation; + toAQL(): string; + _operator: string; +} +interface UnaryOperation extends Expression { + new(operator: string, value: any): Expression; + toAQL(): string; + _operator: string; +} +interface SimpleReference extends Expression { + new(value: string): Expression; + toAQL(): string; + re: RegExp; + _value: string; +} +interface RawExpression extends Expression { + new(value: any): Expression; + toAQL(): string; +} +interface BooleanLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; + _value: boolean; +} +interface NumberLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; + re: RegExp; +} +interface IntegerLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; + _value: number; +} +interface StringLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; +} +interface ListLiteral extends Expression { + new(...value: any[]): Expression; + toAQL(): string; +} +interface ObjectLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; + _value: object; +} +interface NAryOperation extends Operation { + new(operator: string, values: any[]): Operation; + toAQL(): string; + _operator: string; + _values: Expression[]; +} +interface RangeExpression extends Expression { + new(start: any, end?: any): Expression; + toAQL(): string; + _start: number; + _end: number; + re: RegExp; +} +interface PropertyAccess extends Expression { + new(obj: any, keys: any[]): Expression; + toAQL(): string; + _obj: Expression; + _keys: Expression[]; +} +interface TernaryOperation extends Operation { + new(operator1: string, operator2: string, value1: Expression, value2: any, value3: any): Operation; + toAQL(): string; + _operator1: string; + _operator2: string; +} +interface NullLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; +} +interface Keyword extends Expression { + new(value: any): Expression; + toAQL(): string; + _value: string; + re: RegExp; +} +interface Identifier extends Expression { + new(value: any): Expression; + toAQL(): string; + _value: string; +} +interface FunctionCall extends Expression { + new(functionName: string, ...args: any[]): Expression; + toAQL(): string; + _re: RegExp; + _functionName: string; + _args: any[]; +} +interface ForExpression extends PartialStatement { + new(prev: PartialStatement, varname: any, expr: any): PartialStatement; + toAQL(): string; + _varname: Identifier; +} +interface FilterExpression extends PartialStatement { + new(prev: PartialStatement, expr: any): PartialStatement; + toAQL(): string; +} +interface Definitions { + new(...dfns: any[]): any; + toAQL(): string; + _dfns: any[]; +} +interface LetExpression extends PartialStatement { + new(prev: PartialStatement, ...dfns: any[]): PartialStatement; + toAQL(): string; + _prev: PartialStatement; + _dfns: Definitions; +} +interface CollectExpression extends PartialStatement { + new(prev: PartialStatement, dfns: any[], varname: any, intoExpr: any, keepNames: any[], options: any): PartialStatement; + toAQL(): string; + into(...newVarname: any[]): CollectExpression; + keep(...x: any[]): any; + _keep: Identifier[]; + options(newOpts: any): any; + _options: ObjectLiteral; + withCountInto(newVarname: any): CollectWithCountIntoExpression; +} +interface CollectWithCountIntoExpression extends PartialStatement { + new(prev: PartialStatement, dfns: any[], varname: any, options: any): PartialStatement; + toAQL(): string; + options(newOpts: any): any; +} +interface SortExpression extends PartialStatement { + new(prev: PartialStatement, ...args: any[]): PartialStatement; + toAQL(): string; + keywords: string[]; + _args: Keyword[]; +} +interface LimitExpression extends PartialStatement { + new(prev: PartialStatement, offset: any, count?: any): PartialStatement; + toAQL(): string; +} +interface ReturnExpression extends Expression { + new(prev: LetExpression, value: any, distinct: boolean): Expression; + toAQL(): string; + _prev: LetExpression; + _distinct: boolean; +} +interface RemoveExpression extends PartialStatement { + new(prev: PartialStatement, expr: any, collection: any, options: any): PartialStatement; + returnOld(x: any): ReturnExpression; + toAQL(): string; + options(newOpts: any): RemoveExpression; +} +interface UpsertExpression extends PartialStatement { + new(prev: PartialStatement, upsertExpr: any, insertExpr: any, replace: boolean, updateOrReplaceExpr: any, collection: any, options: any): PartialStatement; + returnNew(x: any): ReturnExpression; + returnOld(x: any): ReturnExpression; + toAQL(): string; + _updateOrReplace: string; + options(newOpts: any): UpsertExpression; +} +interface InsertExpression extends PartialStatement { + new(prev: PartialStatement, expr: any, collection: any, options: any): PartialStatement; + returnNew(x: any): ReturnExpression; + toAQL(): string; + options(newOpts: any): InsertExpression; +} +interface UpdateExpression extends PartialStatement { + new(prev: PartialStatement, expr: any, withExpr: any, collection: any, options: any): PartialStatement; + returnNew(x: any): ReturnExpression; + returnOld(x: any): ReturnExpression; + toAQL(): string; + options(newOpts: any): UpdateExpression; +} +interface ReplaceExpression extends PartialStatement { + new(prev: PartialStatement, expr: any, withExpr: any, collection: any, options: any): PartialStatement; + returnNew(x: any): ReturnExpression; + returnOld(x: any): ReturnExpression; + toAQL(): string; + options(newOpts: any): ReplaceExpression; +} +interface Expression extends PartialStatement { + /** + * Equality + * + * Creates an equality comparison from the given values. + * + * qb.eq(a, b): (a == b) + * OR: + * qbValue.eq(b): (a == b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').eq('y'): (x == y) + * + * + */ + eq(x: any, y?: any): BinaryOperation; + /** + * Inequality + * + * Creates an inequality comparison from the given values. + * + * qb.neq(a, b): (a != b) + * OR: + * qbValue.neq(b): (a != b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').neq('y'): (x != y) + * + */ + neq(x: any, y?: any): BinaryOperation; + /** + * Greater Than + * + * Creates a greater-than comparison from the given values. + * + * qb.gt(a, b): (a > b) + * OR + * qbValue.gt(b): (a > b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').gt('y'): (x > y) + * + * + */ + gt(x: any, y?: any): BinaryOperation; + /** + * Greater Than Or Equal To + * + * Creates a greater-than-or-equal-to comparison from the given values. + * + * qb.gte(a, b): (a >= b) + * OR + * qbValue.gte(b): (a >= b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').gte('y'): (x >= y) + * + * + */ + gte(x: any, y?: any): BinaryOperation; + /** + * Less Than + * + * Creates a less-than comparison from the given values. + * + * qb.lt(a, b): (a < b) + * OR + * qbValue.lt(b): (a < b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').lt('y'): (x < y) + * + */ + lt(x: any, y?: any): BinaryOperation; + /** + * Less Than Or Equal To + * + * Creates a less-than-or-equal-to comparison from the given values. + * + * qb.lte(a, b): (a <= b) + * OR + * qbValue.lte(b): (a <= b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').lte('y'): (x <= y) + * + */ + lte(x: any, y?: any): BinaryOperation; + /** + * Contains + * + * Creates an "in" comparison from the given values. + * + * qb.in(a, b): (a in b) + * OR: + * qbValue.in(b): (a in b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * qb.ref('x').in('y'): (x in y) + */ + in(...x: any[]): BinaryOperation; + /** + * Negation + * + * Creates a negation from the given value. + * + * qb.not(a) => !(a) + * OR: + * qbValue.not() => !(a) + * + * If the value is not already an value, it will be converted automatically. + * + * Examples + * + * qb.not('x') => !(x) + */ + not(x?: any): UnaryOperation; + /** + * Negative Value + * + * Creates a negative value expression from the given value. + * + * qb.neg(a) => -(a) + * OR: + * qbValue.neg() => -(a) + * + * If the value is not already an AQL value, it will be converted automatically. + * + * Examples + * + * qb.neg('x') => -(x) + */ + neg(x?: any): UnaryOperation; + /** + * Negated Contains + * + * Creates a "not in" comparison from the given values. + * + * qb.notIn(a, b): (a not in b) + * OR: + * qbValue.notIn(b): (a not in b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').notIn('y'): (x not in y) + */ + notIn(...x: any[]): BinaryOperation; + /** + * Boolean And + * + * Creates an "and" operation from the given values. + * + * qb.and(a, b) =>(a && b) + * OR: + * aqlValue.and(b) =>(a && b) + * + * If the values are not already AQL values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Examples + * + * qb.ref('x').and('y') =>(x && y) + */ + and(...x: any[]): NAryOperation; + /** + * Boolean Or + * + * Creates an "or" operation from the given values. + * + * qb.or(a, b): (a || b) + * OR: + * Value.or(b): (a || b) + * + * If the values are not already values, they will be converted automatically. + * + * This declare function can take any number of arguments. + */ + or(...x: any[]): NAryOperation; + /** + * Addition + * + * Creates an addition operation from the given values. + * + * qb.add(a, b): (a + b) + * OR: + * Value.add(b): (a + b) + * + * If the values are not already values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Alias: qb.plus(a, b) + * + * Examples + * + * qb.ref('x').plus('y'): (x + y) + */ + add(...x: any[]): NAryOperation; + plus(...x: any[]): NAryOperation; + /** + * Subtraction + * + * Creates a subtraction operation from the given values. + * + * qb.sub(a, b): (a - b) + * OR: + * Value.sub(b): (a - b) + * + * If the values are not already values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Alias: qb.minus(a, b) + * + * Examples + * + * qb.ref('x').minus('y'): (x - y) + */ + sub(...x: any[]): NAryOperation; + minus(...x: any[]): NAryOperation; + /** + * Multiplication + * + * Creates a multiplication operation from the given values. + * + * qb.mul(a, b): (a * b) + * OR: + * Value.mul(b): (a * b) + * + * If the values are not already values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Alias: qb.times(a, b) + * + * Examples + * + * qb.ref('x').times('y'): (x * y) + */ + mul(...x: any[]): NAryOperation; + times(...x: any[]): NAryOperation; + /** + * Division + * + * Creates a division operation from the given values. + * + * qb.div(a, b): (a / b) + * OR: + * Value.div(b): (a / b) + * + * If the values are not already values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Examples + * qb.ref('x').div('y'): (x / y) + */ + div(...x: any[]): NAryOperation; + /** + * Modulus + * + * Creates a modulus operation from the given values. + * + * qb.mod(a, b): (a % b) + * OR: + * Value.mod(b): (a % b) + * + * If the values are not already values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Examples + * qb.ref('x').mod('y'): (x % y) + */ + mod(...x: any[]): NAryOperation; + /** + * Range + * + * Creates a range expression from the given values. + * + * qb.range(value1, value2): value1..value2 + * + * OR: + * + * Value.range(value2): value1..value2 + * + * If the values are not already values, they will be converted automatically. + * Alias: qb.to(value1, value2) + * + * Examples + * + * qb(2).to(5): 2..5 + * + */ + range(...value: number[]): RangeExpression; + /** + * Property Access + * + * Creates a property access expression from the given values. + * + * qb.get(obj, key): obj[key] + * OR: + * Obj.get(key): obj[key] + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * qb.ref('x').get('y'): x[y]` + * + */ + get(value: any): PropertyAccess; + /** + * Ternary(if / else) + * + * Creates a ternary expression from the given values. + * + * qb.if(condition, thenDo, elseDo): (condition ? thenDo: elseDo) + * OR: + * qbValue.then(thenDo).else(elseDo): (condition ? thenDo: elseDo) + * + * If the values are not already values, they will be converted automatically. + * + * Alias: qbValue.then(thenDo).otherwise(elseDo) + * + * Examples + * qb.ref('x').then('y').else('z'): (x ? y: z) + * + */ + then(value: any): ThenRet; +} +interface ThenRet { + else(y: any): TernaryOperation; + else_: TernaryOperation; + otherwise(y: any): TernaryOperation; +} +interface ForRet { + in(expr: any): ForExpression; + in_: ForRet["in"]; +} +/** + * PartialStatement + * + * In addition to the methods documented above, the query builder provides all methods of PartialStatement objects. + * Statement objects have a method toAQL() which returns their representation as a JavaScript string. + * + * Examples + * + * qb.for('doc').in('my_collection').return('doc._key').toAQL() + * // => FOR doc IN my_collection RETURN doc._key + */ +interface PartialStatement { + /** + * FOR expression IN collection + * + * PartialStatement::for(expression).in(collection): PartialStatement + * + * Examples + * + * _.for('doc').in('my_collection'): FOR doc IN my_collection + * + */ + for(varname: any): ForRet; + /** + * FILTER expression + * + * PartialStatement::filter(expression): PartialStatement + * + * Examples + * + * _.filter(qb.eq('a', 'b')): FILTER a == b + * + */ + filter(varname: any): FilterExpression; + /** + * LET varname = expression + * + * PartialStatement::let(varname, expression): PartialStatement + * + * Examples + * + * _.let('foo', 23): LET foo = 23 + * + * LET var1 = expr1, var2 = expr2, …, varn = exprn + * + * PartialStatement::let(definitions): PartialStatement + * + */ + let(varname: {}, expr: any): LetExpression; + /** + * COLLECT + * + * COLLECT WITH COUNT INTO varname + * PartialStatement::collectWithCountInto(varname): CollectExpression + * + * Examples + * + * _.collectWithCountInto('x'): COLLECT WITH COUNT INTO x COLLECT varname = expression + * PartialStatement::collect(varname, expression): CollectExpression + * + * _.collect('x', 'y'): COLLECT x = y COLLECT var1 = expr1, var2 = expr2, …, varn = exprn + * PartialStatement::collect(definitions): CollectExpression + * + * _.collect({x: 'a', y: 'b'}): COLLECT x = a, y = b WITH COUNT INTO varname + * CollectExpression::withCountInto(varname): CollectExpression + * + * _.withCountInto('x'): WITH COUNT INTO x INTO varname + * CollectExpression::into(varname): CollectExpression + * + * _.into('z'): INTO z KEEP ...vars + * CollectExpression::keep(...vars): CollectExpression + * + * _.into('z').keep('a', 'b'): INTO z KEEP a, b INTO varname = expression + * CollectExpression::into(varname, expression): CollectExpression + * + * _.into('x', 'y'): INTO x = y OPTIONS options + * CollectExpression::options(options): CollectExpression + * + * _.options('opts'): OPTIONS opts + * + */ + collect(varname: any, expr: any): CollectExpression; + /** + * COLLECT + * + * COLLECT WITH COUNT INTO varname + * PartialStatement::collectWithCountInto(varname): CollectExpression + * + * Examples + * + * _.collectWithCountInto('x'): COLLECT WITH COUNT INTO x COLLECT varname = expression + * PartialStatement::collect(varname, expression): CollectExpression + * + * _.collect('x', 'y'): COLLECT x = y COLLECT var1 = expr1, var2 = expr2, …, varn = exprn + * PartialStatement::collect(definitions): CollectExpression + * + * _.collect({x: 'a', y: 'b'}): COLLECT x = a, y = b WITH COUNT INTO varname + * CollectExpression::withCountInto(varname): CollectExpression + * + * _.withCountInto('x'): WITH COUNT INTO x INTO varname + * CollectExpression::into(varname): CollectExpression + * + * _.into('z'): INTO z KEEP ...vars + * CollectExpression::keep(...vars): CollectExpression + * + * _.into('z').keep('a', 'b'): INTO z KEEP a, b INTO varname = expression + * CollectExpression::into(varname, expression): CollectExpression + * + * _.into('x', 'y'): INTO x = y OPTIONS options + * CollectExpression::options(options): CollectExpression + * + * _.options('opts'): OPTIONS opts + * + */ + collectWithCountInto(varname: any): CollectWithCountIntoExpression; + /** + * SORT ...args + * + * PartialStatement::sort(...args): PartialStatement + * + * Examples + * + * _.sort('x', 'DESC', 'y', 'ASC'): SORT x DESC, y ASC + * + */ + sort(...args: any[]): SortExpression; + /** + * LIMIT offset, count + * + * PartialStatement::limit([offset,] count): PartialStatement + * + * Examples + * + * _.limit(20): LIMIT 20 + * + * _.limit(20, 20): LIMIT 20, 20 + * + */ + limit(offset: any, count?: any): LimitExpression; + /** + * RETURN expression + * + * PartialStatement::return(expression): ReturnExpression + * + * Examples + * + * _.return('x'): RETURN x + * _.return({x: 'x'}): RETURN {x: x} + * + */ + return(x: any): ReturnExpression; + /** + * RETURN DISTINCT expression + * + * PartialStatement::returnDistinct(expression): ReturnExpression + * + * Examples + * + * _.returnDistinct('x'): RETURN DISTINCT x + * + */ + returnDistinct(x: any): ReturnExpression; + /** + * REMOVE + * + * REMOVE expression IN collection + * PartialStatement::remove(expression).in(collection): RemoveExpression + * + * Alias: remove(expression).into(collection) + * + * Examples + * + * _.remove('x').in('y'): REMOVE x IN y LET varname = OLD RETURN varname + * RemoveExpression::returnOld(varname): ReturnExpression + * + * _.returnOld('z'): LET z = OLD RETURN z OPTIONS options + * RemoveExpression::options(options): RemoveExpression + * + * _.options('opts'): OPTIONS opts + * + */ + remove(expr: any): RemoveRet; + /** + * UPSERT + * + * UPSERT expression1 INSERT expression2 REPLACE expression3 IN collection + * PartialStatement::upsert(expression1).insert(expression2).replace(expression3).in(collection): UpsertExpression + * + * Alias: ….into(collection) + * + * Examples + * + * _.upsert('x').insert('y').replace('z').in('c'): UPSERT x INSERT y REPLACE z IN c + * + * UPSERT expression1 INSERT expression2 UPDATE expression3 IN collection + * PartialStatement::upsert(expression1).insert(expression2).update(expression3).in(collection): UpsertExpression + * + * Alias: ….into(collection) + * + * _.upsert('x').insert('y').update('z').in('c'): UPSERT x INSERT y UPDATE z IN c OPTIONS options + * UpsertExpression::options(options): UpsertExpression + * + * _.options('opts'): OPTIONS opts + * + */ + upsert(expr: any): UpsertRet; + /** + * INSERT + * + * INSERT expression INTO collection + * PartialStatement::insert(expression).into(collection): InsertExpression + * + * Alias: insert(expression).in(collection) + * + * Examples + * + * _.insert('x').into('y'): INSERT x INTO y OPTIONS options + * InsertExpression::options(options): InsertExpression + * + * _.options('opts'): OPTIONS opts LET varname = NEW RETURN varname + * InsertExpression::returnNew(varname): ReturnExpression + * + * _.returnNew('z'): LET z = NEW RETURN z + * + */ + insert(expr: any): InsertRet; + /** + * UPDATE + * + * UPDATE expression IN collection + * PartialStatement::update(expression).in(collection): UpdateExpression + * + * Alias: update(expression).into(collection) + * + * Examples + * + * _.update('x').in('y'): UPDATE x IN y + * + * UPDATE expression1 WITH expression2 IN collection + * PartialStatement::update(expression1).with(expression2).in(collection): UpdateExpression + * + * Alias: update(expression1).with(expression2).into(collection) + * + * _.update('x').with('y').in('z'): UPDATE x WITH y IN z OPTIONS options + * UpdateExpression::options(options): UpdateExpression + * + * _.options('opts'): OPTIONS opts LET varname = NEW RETURN varname + * UpdateExpression::returnNew(varname): ReturnExpression + * + * _.returnNew('z'): LET z = NEW RETURN z LET varname = OLD RETURN varname + * UpdateExpression::returnOld(varname): ReturnExpression + * + * _.returnOld('z'): LET z = OLD RETURN z + * + */ + update(expr: any): UpdateRetWithRet; + /** + * REPLACE + * + * REPLACE expression IN collection + * PartialStatement::replace(expression).in(collection): ReplaceExpression + * + * Alias: replace(expression).into(collection) + * + * Examples + * + * _.replace('x').in('y'): REPLACE x IN y REPLACE expression1 WITH expression2 IN collection + * PartialStatement::replace(expression1).with(expression2).in(collection): ReplaceExpression + * + * Alias: replace(expression1).with(expression2).into(collection) + * + * _.replace('x').with('y').in('z'): REPLACE x WITH y IN z OPTIONS options + * ReplaceExpression::options(options): ReplaceExpression + * + * _.options('opts'): OPTIONS opts LET varname = NEW RETURN varname + * ReplaceExpression::returnOld(varname): ReturnExpression + * + * _.returnNew('z'): LET z = NEW RETURN z LET varname = OLD RETURN varname + * ReplaceExpression::returnNew(varname): ReturnExpression + * + * _.returnOld('z'): LET z = OLD RETURN z + * + */ + replace(expr: any): ReplaceRetWithRet; +} +interface RemoveRet { + into(collection: any): RemoveExpression; + in: RemoveRet["into"]; + in_: RemoveRet["into"]; +} +interface UpsertRet { + insert(insertExpr: any): UpsertRetInsertRet; +} +interface UpsertRetInsertRet { + update(updateOrReplaceExpr: any): UpsertRetInsertRetUpdateRet; + replace: UpsertRetInsertRet["update"]; +} +interface UpsertRetInsertRetUpdateRet { + into(inCollection: any): UpsertExpression; + in: UpsertRetInsertRetUpdateRet["into"]; + in_: UpsertRetInsertRetUpdateRet["into"]; +} +interface InsertRet { + into(collection: any): InsertExpression; + in: InsertRet["into"]; + in_: InsertRet["into"]; +} +interface UpdateRetWithRet { + into(collection: any): UpdateExpression; + in: UpdateRetWithRet["into"]; + in_: UpdateRetWithRet["into"]; +} +interface ReplaceRetWithRet { + into(collection: any): ReplaceExpression; + in: ReplaceRetWithRet["into"]; + in_: ReplaceRetWithRet["into"]; +} +interface RemoveRet { + into(collection: any): RemoveExpression; + in: RemoveRet["into"]; + in_: RemoveRet["into"]; +} +interface UpsertRet { + insert(insertExpr: any): UpsertRetInsertRet; +} +interface UpsertRetInsertRet { + update(updateOrReplaceExpr: any): UpsertRetInsertRetUpdateRet; + replace: UpsertRetInsertRet["update"]; +} +interface UpsertRetInsertRetUpdateRet { + into(inCollection: any): UpsertExpression; + in: UpsertRetInsertRetUpdateRet["into"]; + in_: UpsertRetInsertRetUpdateRet["into"]; +} +interface InsertRet { + into(collection: any): InsertExpression; + in: InsertRet["into"]; + in_: InsertRet["into"]; +} +interface UpdateRetWithRet { + into(collection: any): UpdateExpression; + with(collection: any): UpdateRetWithRet; + in: UpdateRetWithRet["into"]; + in_: UpdateRetWithRet["into"]; +} +interface ReplaceRetWithRet { + into(collection: any): ReplaceExpression; + with(collection: any): ReplaceRetWithRet; + in: ReplaceRetWithRet["into"]; + in_: ReplaceRetWithRet["into"]; +} +declare function toArray(self: Expression, ...args: any[]): any[]; +declare function isQuotedString(str: string): boolean; +declare function wrapAQL(expr: Keyword): string; +declare function isValidNumber(number: number): boolean; +declare function castNumber(number: any): NumberLiteral; +declare function castBoolean(bool: any): BooleanLiteral; +declare function castString(str: any): SimpleReference | Identifier | RangeExpression | StringLiteral | Expression | PartialStatement | NullLiteral; +declare function castObject(obj: any): ObjectLiteral | ListLiteral | Identifier; +declare function autoCastToken(token: any): Expression | PartialStatement | NullLiteral; +/** + * AQLfunctions + * + * If raw JavaScript values are passed to statements, they will be wrapped in a matching declare function automatically. + * JavaScript strings wrapped in quotation marks will be wrapped in strings, all other JavaScript strings will be wrapped as simple references(see ref) + * and throw an Error if they are not well-formed. + */ +interface AQLfunctions extends Expression { + /** + * Boolean + * + * Wraps the given value as an Boolean literal. + * + * qb.bool(value) + * + * If the value is truthy, it will be converted to the Boolean true, otherwise it will be converted to the Boolean false. + * If the value is already an Boolean, its own value will be wrapped instead. + * + */ + bool(value: any): BooleanLiteral; + /** + * Number + * + * Wraps the given value as an Number literal. + * + * qb.num(value) + * + * If the value is not a JavaScript Number, it will be converted first. + * If the value does not represent a finite number, an Error will be thrown. + * If the value is already an Number or Integer, its own value will be wrapped instead. + * + */ + num(value: any): NumberLiteral; + /** + * Integer + * + * Wraps the given value as an Integer literal. + * + * qb.int(value) + * + * If the value is not a JavaScript Number, it will be converted first. + * If the value does not represent a finite integer, an Error will be thrown. + * If the value is already an Number or Integer, its own value will be wrapped instead. + * + */ + int(value: any): IntegerLiteral; + /** + * String + * + * Wraps the given value as an String literal. + * + * qb.str(value) + * + * If the value is not a JavaScript String, it will be converted first. + * If the value is a quoted string, it will be treated as a string literal. + * If the value is an object with a toAQL method, the result of calling that method will be wrapped instead. + * + * Examples + * + * 23 => "23" + * + * "some string" => "some string" + * + * '"some string"' => "\"some string\"" + * + */ + str(value: any): StringLiteral; + /** + * List + * + * Wraps the given value as an List(Array) literal. + * + * qb.list(value) + * + * If the value is not a JavaScript Array, an Error will be thrown. + * If the value is already an List, its own value will be wrapped instead. + * Any list elements that are not already values will be converted automatically. + * + */ + list(value: any[]): ListLiteral; + /** + * Object + * + * Wraps the given value as an Object literal. + * + * qb.obj(value) + * + * If the value is not a JavaScript Object, an Error will be thrown. + * If the value is already an Object, its own value will be wrapped instead. + * Any property values that are not already values will be converted automatically. + * Any keys that are quoted strings will be treated as string literals. + * Any keys that start with the character ":" will be treated as dynamic properties and must be well-formed simple references. + * Any other keys that need escaping will be quoted if necessary. + * If you need to pass in raw JavaScript objects that shouldn't be converted according to these rules, you can use the qb declare function directly instead. + * + * Examples + * + * qb.obj({'some.name': 'value'}): {"some.name": value} + * + * qb.obj({hello: world}): {hello: world} + * + * qb.obj({'"hello"': world}): {"hello": world} + * + * qb.obj({':dynamic': 'props'}): {[dynamic]: props} + * + * qb.obj({': invalid': 'key'}): throws an error(invalid is not a well-formed reference) + * + */ + obj(obj: object): ObjectLiteral; + /** + * Simple Reference + * + * Wraps a given value in an Simple Reference. + * + * qb.ref(value) + * + * If the value is not a JavaScript string or not a well-formed simple reference, an Error will be thrown. + * If the value is an ArangoCollection, its name property will be used instead. + * If the value is already an Simple Reference, its value is wrapped instead. + * + * Examples + * + * Valid values: + * + * foo + * + * foo.bar + * + * foo[*].bar + * + * foo.bar.QUX + * + * _foo._bar._qux + * + * foo1.bar2 + * + * `foo`.bar + * + * foo.`bar` + * + * Invalid values: + * + * 1foo + * + * föö + * + * foo bar + * + * foo[bar] + * + */ + ref(value: string): SimpleReference; + expr(value: any): RawExpression; + /** + * Ternary(if / else) + * + * Creates a ternary expression from the given values. + * + * qb.if(condition, thenDo, elseDo): (condition ? thenDo: elseDo) + * OR: + * qbValue.then(thenDo).else(elseDo): (condition ? thenDo: elseDo) + * + * If the values are not already values, they will be converted automatically. + * + * Alias: qbValue.then(thenDo).otherwise(elseDo) + * + * Examples + * qb.ref('x').then('y').else('z'): (x ? y: z) + * + */ + if(cond: any, then: any, otherwise: any): Expression | number; + /** + * declare Function Call + * + * Creates a functon call for the given name and arguments. + * + * qb.fn(name)(...args) + * + * If the values are not already values, they will be converted automatically. + * For built-in AQLfunctions, methods with the relevant declare function name are already provided by the query builder. + * + * Examples + * + * qb.fn('MY::USER::FUNC')(1, 2, 3): MY::USER::FUNC(1, 2, 3) + * + * qb.fn('hello')(): hello() + * + * qb.RANDOM(): RANDOM() + * + * qb.FLOOR(qb.div(5, 2)): FLOOR((5 / 2)) + * + */ + fn(functionName: string): (...arity: any[]) => FunctionCall; +} +type QBfunc = (obj: any) => AQLfunctions; +declare const QB: AQLfunctions & QBfunc; +export = QB; diff --git a/types/aqb/tsconfig.json b/types/aqb/tsconfig.json new file mode 100644 index 0000000000..44cb0d912f --- /dev/null +++ b/types/aqb/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "lib": [ + "es2015" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "aqb-tests.ts" + ] +} \ No newline at end of file diff --git a/types/aqb/tslint.json b/types/aqb/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/aqb/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/archiver/archiver-tests.ts b/types/archiver/archiver-tests.ts index 536afd68c9..752d9cc944 100644 --- a/types/archiver/archiver-tests.ts +++ b/types/archiver/archiver-tests.ts @@ -1,4 +1,4 @@ -import * as Archiver from 'archiver'; +import Archiver = require('archiver'); import * as fs from 'fs'; const options: Archiver.ArchiverOptions = { @@ -30,12 +30,16 @@ archiver.abort(); archiver.pipe(writeStream); archiver.append(readStream, { name: 'archiver.d.ts' }); +archiver.append(readStream, { date: '05/05/1991' }); +archiver.append(readStream, { date: new Date() }); +archiver.append(readStream, { mode: 1 }); +archiver.append(readStream, { mode: 1, stats: new fs.Stats() }); archiver.append(readStream, {name: 'archiver.d.ts'}) .append(readStream, {name: 'archiver.d.ts'}); archiver.directory('./path', './someOtherPath'); -archiver.directory('./', "", {}); +archiver.directory('./', '', {}); archiver.directory('./', false, { name: 'test' }); archiver.directory('./', false, (entry: Archiver.EntryData) => { entry.name = "foobar"; diff --git a/types/archiver/index.d.ts b/types/archiver/index.d.ts index 8cf6eb1e92..df15f9ff65 100644 --- a/types/archiver/index.d.ts +++ b/types/archiver/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for archiver 2.0 +// Type definitions for archiver 2.1 // Project: https://github.com/archiverjs/node-archiver // Definitions by: Esri , Dolan Miu , Crevil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import * as fs from 'fs'; import * as stream from 'stream'; import * as glob from 'glob'; import { ZlibOptions } from 'zlib'; @@ -18,7 +19,9 @@ declare namespace archiver { interface EntryData { name?: string; prefix?: string; - stats?: string; + stats?: fs.Stats; + date?: Date | string; + mode?: number; } /** A function that lets you either opt out of including an entry (by returning false), or modify the contents of an entry as it is added (by returning an EntryData) */ diff --git a/types/argon2-browser/tsconfig.json b/types/argon2-browser/tsconfig.json index a380778b29..c3e9586f3c 100644 --- a/types/argon2-browser/tsconfig.json +++ b/types/argon2-browser/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "argon2-browser-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/arr-union/tsconfig.json b/types/arr-union/tsconfig.json index 64a3b1efed..de2c9671e9 100644 --- a/types/arr-union/tsconfig.json +++ b/types/arr-union/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "arr-union-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/artillery/tsconfig.json b/types/artillery/tsconfig.json index 0ad4bae0ee..02b327a508 100644 --- a/types/artillery/tsconfig.json +++ b/types/artillery/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "artillery-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/assert-equal-jsx/index.d.ts b/types/assert-equal-jsx/index.d.ts index f571020ef8..e017fcf57c 100644 --- a/types/assert-equal-jsx/index.d.ts +++ b/types/assert-equal-jsx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/thejameskyle/assert-equal-jsx // Definitions by: Josh Toft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/assertion-error/assertion-error-tests.ts b/types/assertion-error/assertion-error-tests.ts deleted file mode 100644 index 96eb520f1c..0000000000 --- a/types/assertion-error/assertion-error-tests.ts +++ /dev/null @@ -1,14 +0,0 @@ - -import AssertionError = require('assertion-error'); - -var e: AssertionError; -var str: string; - -function foo () { - -} - -e = new AssertionError(str); -e = new AssertionError(str, {a:1, b:2}); -e = new AssertionError(str, {a:1, b:2}, foo); - diff --git a/types/assertion-error/index.d.ts b/types/assertion-error/index.d.ts deleted file mode 100644 index 8663df799d..0000000000 --- a/types/assertion-error/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Type definitions for assertion-error 1.0.0 -// Project: https://github.com/chaijs/assertion-error -// Definitions by: Bart van der Schoor -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare class AssertionError implements Error { - constructor(message: string, props?: any, ssf?: Function); - name: string; - message: string; - showDiff: boolean; - stack: string; -} -export = AssertionError; diff --git a/types/assets-webpack-plugin/assets-webpack-plugin-tests.ts b/types/assets-webpack-plugin/assets-webpack-plugin-tests.ts index 6851f853f2..b02c707d81 100644 --- a/types/assets-webpack-plugin/assets-webpack-plugin-tests.ts +++ b/types/assets-webpack-plugin/assets-webpack-plugin-tests.ts @@ -1,5 +1,5 @@ import * as webpack from 'webpack'; -import * as AssetsPlugin from 'assets-webpack-plugin'; +import AssetsPlugin = require('assets-webpack-plugin'); const config: webpack.Configuration = { plugins: [ diff --git a/types/async-lock/async-lock-tests.ts b/types/async-lock/async-lock-tests.ts index 259749d4f0..9e8920ca4b 100644 --- a/types/async-lock/async-lock-tests.ts +++ b/types/async-lock/async-lock-tests.ts @@ -1,4 +1,3 @@ - import * as AsyncLock from "async-lock"; const lock = new AsyncLock(); @@ -6,15 +5,24 @@ lock.acquire("key", (done) => { done(); }, (err, ret) => { /* ... */ }); -lock.acquire("key", (done) => { - done(); -}).then(() => { /* ... */ }); +lock.acquire("key", (done) => { done(); }) + .then(() => { /* ... */ }) + .catch(() => { /* ... */ }); + +lock.acquire("key", () => "stringValue") +// Check returned value's type is inherited properly + .then((str) => str.replace("s", "S")); + +lock.acquire("key", async () => "stringValue") +// Check returned value's type is inherited properly + .then((str) => str.replace("s", "S")); lock.acquire([ "key1", "key2" ], (done) => { done(); }, (err, ret) => { /* ... */ }); lock.isBusy(); +lock.isBusy('key'); const lock2 = new AsyncLock({ timeout : 5000 }); const lock3 = new AsyncLock({ maxPending : 5000 }); diff --git a/types/async-lock/index.d.ts b/types/async-lock/index.d.ts index 4a19590d73..cd2b1e4b40 100644 --- a/types/async-lock/index.d.ts +++ b/types/async-lock/index.d.ts @@ -1,12 +1,12 @@ -// Type definitions for async-lock +// Type definitions for async-lock 1.1 // Project: https://github.com/rain1017/async-lock // Definitions by: Elisée MAURER +// Alejandro +// Anatoly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 - -interface AsyncLockDoneCallback { - (err?: Error, ret?: any): void; -} +type AsyncLockDoneCallback = (err?: Error, ret?: T) => void; interface AsyncLockOptions { timeout?: number; @@ -18,10 +18,15 @@ interface AsyncLockOptions { declare class AsyncLock { constructor(options?: AsyncLockOptions); - acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, cb: AsyncLockDoneCallback, opts?: AsyncLockOptions): void; - acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, opts?: AsyncLockOptions): PromiseLike; + acquire(key: string | string[], + fn: (() => T | PromiseLike) | ((done: AsyncLockDoneCallback) => any), + opts?: AsyncLockOptions): Promise; + acquire(key: string | string[], + fn: (done: AsyncLockDoneCallback) => any, + cb: AsyncLockDoneCallback, + opts?: AsyncLockOptions): void; - isBusy(): boolean; + isBusy(key?: string): boolean; } declare namespace AsyncLock { } diff --git a/types/async-lock/tslint.json b/types/async-lock/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/async-lock/tslint.json +++ b/types/async-lock/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/async-retry/async-retry-tests.ts b/types/async-retry/async-retry-tests.ts new file mode 100644 index 0000000000..29c90b36c8 --- /dev/null +++ b/types/async-retry/async-retry-tests.ts @@ -0,0 +1,20 @@ +import { Options, RetryFunction, retry } from 'async-retry'; + +const o: Options = { + retries: 1, + factor: 2, + minTimeout: 3, + maxTimeout: 4, + randomize: true, + onRetry: (e: Error) => 42 +}; + +retry( + bail => 'hello', + { retries: 3 } +); + +retry( + bail => Promise.resolve(42), + { retries: 3 } +); diff --git a/types/async-retry/index.d.ts b/types/async-retry/index.d.ts new file mode 100644 index 0000000000..38d0d8aeec --- /dev/null +++ b/types/async-retry/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for async-retry 1.1 +// Project: https://github.com/zeit/async-retry#readme +// Definitions by: Albert Wu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function retry(fn: RetryFunction, opts: Options): Promise; + +export interface Options { + retries?: number; + factor?: number; + minTimeout?: number; + maxTimeout?: number; + randomize?: boolean; + onRetry?: (e: Error) => any; +} + +export type RetryFunction = (bail: (e: Error) => A, attempt: number) => A|Promise; diff --git a/types/async-retry/tsconfig.json b/types/async-retry/tsconfig.json new file mode 100644 index 0000000000..c010746fa3 --- /dev/null +++ b/types/async-retry/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "async-retry-tests.ts" + ] +} \ No newline at end of file diff --git a/types/node-waves/tslint.json b/types/async-retry/tslint.json similarity index 100% rename from types/node-waves/tslint.json rename to types/async-retry/tslint.json diff --git a/types/asynciterator/tsconfig.json b/types/asynciterator/tsconfig.json index 8b8b919abc..c50f09f902 100644 --- a/types/asynciterator/tsconfig.json +++ b/types/asynciterator/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "asynciterator-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/atlaskit__button/atlaskit__button-tests.tsx b/types/atlaskit__button/atlaskit__button-tests.tsx new file mode 100644 index 0000000000..dd592255e9 --- /dev/null +++ b/types/atlaskit__button/atlaskit__button-tests.tsx @@ -0,0 +1,38 @@ +import Button, { ButtonGroup, themeNamespace } from "@atlaskit/button"; + +import * as React from "react"; +import { render } from "react-dom"; + +declare const container: Element; + +render( + + + , + container +); diff --git a/types/atlaskit__button/index.d.ts b/types/atlaskit__button/index.d.ts new file mode 100644 index 0000000000..e9a613fabd --- /dev/null +++ b/types/atlaskit__button/index.d.ts @@ -0,0 +1,93 @@ +// Type definitions for @atlaskit/button 6.4 +// Project: https://bitbucket.org/atlassian/atlaskit-mk-2/ +// Definitions by: Jimmy Luong +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import { + Component, + ReactNode, + ReactElement, + ComponentClass, + MouseEventHandler +} from "react"; + +export type ButtonAppearances = + | "default" + | "danger" + | "link" + | "primary" + | "subtle" + | "subtle-link" + | "warning" + | "help"; + +export interface ButtonProps { + /** The base styling to apply to the button. */ + readonly appearance?: ButtonAppearances; + /** Pass aria-controls to underlying html button. */ + readonly ariaControls?: string; + /** Pass aria-expanded to underlying html button. */ + readonly ariaExpanded?: boolean; + /** Pass aria-haspopup to underlying html button. */ + readonly ariaHaspopup?: boolean; + /** This button's child nodes. */ + readonly children?: ReactNode; + /** Add a classname to the button. */ + readonly className?: string; + /** A custom component to use instead of the default button. */ + readonly component?: ComponentClass; + /** Name property of a linked form that the button submits when clicked. */ + readonly form?: string; + /** Provides a url for buttons being used as a link. */ + readonly href?: string; + /** Places an icon within the button, after the button's text. */ + readonly iconAfter?: ReactElement; + /** Places an icon within the button, before the button's text. */ + readonly iconBefore?: ReactElement; + /** Pass a reference on to the styled component */ + readonly innerRef?: (instance: any) => void; + /** Provide a unique id to the button. */ + readonly id?: string; + /** Set if the button is disabled. */ + readonly isDisabled?: boolean; + /** Change the style to indicate the button is selected. */ + readonly isSelected?: boolean; + /** Handler to be called on click. */ + readonly onClick?: MouseEventHandler; + /** Set the amount of padding in the button. */ + readonly spacing?: ButtonSpacing; + /** Assign specific tabIndex order to the underlying html button. */ + readonly tabIndex?: number; + /** Pass target down to a link within the button component, if a href is provided. */ + readonly target?: string; + /** Set whether it is a button or a form submission. */ + readonly type?: ButtonType; + /** Option to fit button width to its parent width */ + readonly shouldFitContainer?: boolean; +} + +export type ButtonType = "button" | "submit"; + +export type ButtonSpacing = "compact" | "default" | "none"; + +export interface ButtonState { + readonly isActive: boolean; + readonly isFocus: boolean; + readonly isHover: boolean; +} + +declare class Button extends Component {} + +export interface ButtonGroupProps { + /** The appearance to apply to all buttons. */ + readonly appearance?: ButtonAppearances; + /** The buttons to render. */ + readonly children: ReactNode; +} + +export class ButtonGroup extends Component {} + +export const themeNamespace: string; + +export default Button; diff --git a/types/atlaskit__button/tsconfig.json b/types/atlaskit__button/tsconfig.json new file mode 100644 index 0000000000..3f374a6b3e --- /dev/null +++ b/types/atlaskit__button/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "paths": { + "@atlaskit/button": ["atlaskit__button"] + } + }, + "files": ["index.d.ts", "atlaskit__button-tests.tsx"] +} diff --git a/types/xhr-mock/tslint.json b/types/atlaskit__button/tslint.json similarity index 100% rename from types/xhr-mock/tslint.json rename to types/atlaskit__button/tslint.json diff --git a/types/atom-keymap/tsconfig.json b/types/atom-keymap/tsconfig.json index 8a17cc061c..14797a013b 100644 --- a/types/atom-keymap/tsconfig.json +++ b/types/atom-keymap/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "atom-keymap-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/atom-mocha-test-runner/tsconfig.json b/types/atom-mocha-test-runner/tsconfig.json index c6e9fb20c0..40639f83aa 100644 --- a/types/atom-mocha-test-runner/tsconfig.json +++ b/types/atom-mocha-test-runner/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "atom-mocha-test-runner-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 5fc92880f4..e53e29b176 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -1459,6 +1459,14 @@ function testPackageManager() { bool = atom.packages.isPackageDisabled("Test"); + // Activating and deactivating packages + atom.packages.activatePackage("Test").then((activePack) => { + pack = activePack; + }); + atom.packages.deactivatePackage("Test", true).then(() => { + // package is deactivated + }); + // Accessing active packages packs = atom.packages.getActivePackages(); @@ -2889,7 +2897,6 @@ function testTextEditor() { // Grammars grammar = editor.getGrammar(); - editor.setGrammar(grammar); // Managing Syntax Scopes scopeDescriptor = editor.getRootScopeDescriptor(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 53fa8d5749..9b0d194976 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Atom 1.23 +// Type definitions for Atom 1.24 // Project: https://github.com/atom/atom // Definitions by: GlenCFL // smhxx @@ -7,7 +7,7 @@ // TypeScript Version: 2.3 // NOTE: only those classes exported within this file should be retain that status below. -// https://github.com/atom/atom/blob/v1.23.0/exports/atom.js +// https://github.com/atom/atom/blob/v1.24.0/exports/atom.js /// /// @@ -1312,6 +1312,12 @@ export class TextEditor { /** Retrieves the current TextBuffer. */ getBuffer(): TextBuffer; + /** Sets the read-only state for the editor. */ + setReadOnly(readonly: boolean): void; + + /** Whether or not this editor is in read-only mode. */ + isReadOnly(): boolean; + /** * Calls your callback when a Gutter is added to the editor. Immediately calls * your callback for each existing gutter. @@ -1911,7 +1917,7 @@ export class TextEditor { getCursors(): Cursor[]; /** - * Get all Cursorss, ordered by their position in the buffer instead of the + * Get all Cursors, ordered by their position in the buffer instead of the * order in which they were added. */ getCursorsOrderedByBufferPosition(): Cursor[]; @@ -2260,12 +2266,6 @@ export class TextEditor { /** Get the current Grammar of this editor. */ getGrammar(): Grammar; - /** - * Set the current Grammar of this editor. - * Assigning a grammar will cause the editor to re-tokenize based on the new grammar. - */ - setGrammar(grammar: Grammar): void; - // Managing Syntax Scopes /** * Returns a ScopeDescriptor that includes this editor's language. @@ -3341,7 +3341,7 @@ export class Directory { getEntriesSync(): Array; /** Reads file entries in this directory from disk asynchronously. */ - getEntries(callback: (error: Error, entries: Array) => void): void; + getEntries(callback: (error: Error|null, entries: Array) => void): void; /** * Determines if the given path (real or symbolic) is inside this directory. This @@ -3847,6 +3847,51 @@ export interface GrammarRegistry { * @return An array of Token instances decoded from the given tags. */ decodeTokens(lineText: string, tags: Array): GrammarToken[]; + + /** + * Set a TextBuffer's language mode based on its path and content, and continue + * to update its language mode as grammars are added or updated, or the buffer's + * file path changes. + * @param buffer The buffer whose language mode will be maintained. + * @return A Disposable that can be used to stop updating the buffer's + * language mode. + */ + maintainLanguageMode(buffer: TextBuffer): Disposable; + + /** + * Force a TextBuffer to use a different grammar than the one that would otherwise + * be selected for it. + * @param buffer The buffer whose grammar will be set. + * @param languageId The identifier of the desired language. + * @return Returns a boolean that indicates whether the language was successfully + * found. + */ + assignLanguageMode(buffer: TextBuffer, languageId: string): boolean; + + /** + * Remove any language mode override that has been set for the given TextBuffer. + * This will assign to the buffer the best language mode available. + */ + autoAssignLanguageMode(buffer: TextBuffer): void; + + /** + * Select a grammar for the given file path and file contents. + * + * This picks the best match by checking the file path and contents against + * each grammar. + * @param filePath A string file path. + * @param fileContents A string of text for that file path. + */ + selectGrammar(filePath: string, fileContents: string): Grammar; + + /** + * Returns a number representing how well the grammar matches the + * `filePath` and `contents`. + * @param grammar The grammar to score. + * @param filePath A string file path. + * @param contents A string of text for that file path. + */ + getGrammarScore(grammar: Grammar, filePath: string, contents: string): number; } /** Represents a gutter within a TextEditor. */ @@ -4111,6 +4156,9 @@ export interface PackageManager { /** Activate a single package by name or path. */ activatePackage(nameOrPath: string): Promise; + /** Deactivate a single package by name or path. */ + deactivatePackage(nameOrPath: string, suppressSerialization?: boolean): Promise; + /** Triggers the given package activation hook. */ triggerActivationHook(hook: string): void; @@ -4363,7 +4411,7 @@ export interface PathWatcher extends DisposableLike { /** * Unsubscribe all subscribers from filesystem events. Native resources will be - * release asynchronously, but this watcher will stop broadcasting events + * released asynchronously, but this watcher will stop broadcasting events * immediately. */ dispose(): void; @@ -4388,7 +4436,11 @@ export interface Project { onDidChangeFiles(callback: (events: FilesystemChangeEvent) => void): Disposable; // Accessing the Git Repository - /** Get an Array of GitRepositorys associated with the project's directories. */ + /** + * Get an Array of GitRepositorys associated with the project's directories. + * + * This method will be removed in 2.0 because it does synchronous I/O. + */ getRepositories(): GitRepository[]; /** Get the repository for a given directory asynchronously. */ @@ -4810,7 +4862,8 @@ export class Task { * Throws an error if this task has already been terminated or if sending a * message to the child process fails. */ - send(message: string): void; + // tslint:disable-next-line:no-any + send(message: string | number | boolean | object | null | any[]): void; /** Call a function when an event is emitted by the child process. */ // tslint:disable-next-line:no-any @@ -5071,7 +5124,7 @@ export class TextBuffer { /** * Get a MarkerLayer by id. - * Returns a MarkerLayer or `` if no layer exists with the given id. + * Returns a MarkerLayer or undefined if no layer exists with the given id. */ getMarkerLayer(id: string): MarkerLayer|undefined; @@ -5309,7 +5362,7 @@ export interface ThemeManager { /** Returns an Array of all the loaded themes. */ getLoadedThemes(): Package[]|undefined; - // Accessing Active Themes + // Managing Enabled Themes /** Returns an Array of strings all the active theme names. */ getActiveThemeNames(): string[]|undefined; @@ -5691,7 +5744,7 @@ export interface TextEditorObservedEvent { // information under certain contexts. // NOTE: the config schema with these defaults can be found here: -// https://github.com/atom/atom/blob/v1.23.0/src/config-schema.js +// https://github.com/atom/atom/blob/v1.24.0/src/config-schema.js /** * Allows you to strongly type Atom configuration variables. Additional key:value * pairings merged into this interface will result in configuration values under diff --git a/types/atom/linter/index.d.ts b/types/atom/linter/index.d.ts index bf085d9859..72f378af26 100644 --- a/types/atom/linter/index.d.ts +++ b/types/atom/linter/index.d.ts @@ -5,6 +5,10 @@ import { Disposable, Point, Range, TextEditor } from "../index"; +export interface Config { + name: string; +} + export interface ReplacementSolution { title?: string; position: Range; @@ -60,6 +64,9 @@ export interface Message { * do things like HTTP requests. */ description?: string|(() => Promise|string); + + /** Optionally override the displayed linter name. Defaults to provider name. */ + linterName?: string; } export interface IndieDelegate { @@ -73,10 +80,14 @@ export interface IndieDelegate { dispose(): void; } +export type LintResult = Message[] | null; + export interface LinterProvider { name: string; scope: "file"|"project"; lintsOnChange: boolean; grammarScopes: string[]; - lint(textEditor: TextEditor): Message[]|void|Promise; + lint(editor: TextEditor): LintResult | Promise; } + +export type IndieProvider = (register: (config: Config) => IndieDelegate) => void; diff --git a/types/atom/tsconfig.json b/types/atom/tsconfig.json index a58ec7b74c..35ece9c1dd 100644 --- a/types/atom/tsconfig.json +++ b/types/atom/tsconfig.json @@ -24,4 +24,4 @@ "linter/index.d.ts", "status-bar/index.d.ts" ] -} +} \ No newline at end of file diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index 6110f2fe52..c7224599bd 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -590,7 +590,7 @@ export interface Auth0UserProfile { given_name?: string; family_name?: string; email?: string; - email_verified?: string; + email_verified?: boolean; clientID: string; gender?: string; locale?: string; diff --git a/types/auth0-lock/auth0-lock-tests.ts b/types/auth0-lock/auth0-lock-tests.ts index c2107b11e4..119bbb3c37 100644 --- a/types/auth0-lock/auth0-lock-tests.ts +++ b/types/auth0-lock/auth0-lock-tests.ts @@ -204,6 +204,19 @@ const selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = { new Auth0Lock(CLIENT_ID, DOMAIN, selectFieldOptionsWithCallbacks); +// test checkbox-field additional sign up field + +const checkboxFieldOptions : Auth0LockConstructorOptions = { + additionalSignUpFields: [{ + type: "checkbox", + name: "remember", + placeholder: "Remember Me", + prefill: "false" + }] + }; + + new Auth0Lock(CLIENT_ID, DOMAIN, checkboxFieldOptions); + // test Avatar options const avatarOptions : Auth0LockConstructorOptions = { diff --git a/types/auth0-lock/index.d.ts b/types/auth0-lock/index.d.ts index 8ed6b50c87..352d9c71a9 100644 --- a/types/auth0-lock/index.d.ts +++ b/types/auth0-lock/index.d.ts @@ -2,6 +2,7 @@ // Project: http://auth0.com // Definitions by: Brian Caruso // Dan Caddigan +// Larry Faudree // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -23,16 +24,37 @@ type Auth0LockAdditionalSignUpFieldPrefillCallback = type Auth0LockAdditionalSignUpFieldPrefillFunction = (callback: Auth0LockAdditionalSignUpFieldPrefillCallback) => void; -interface Auth0LockAdditionalSignUpField { +interface Auth0LockAdditionalTextSignUpField { + type?: "text"; icon?: string; name: string; options?: Auth0LockAdditionalSignUpFieldOption[] | Auth0LockAdditionalSignUpFieldOptionsFunction; placeholder: string; prefill?: string | Auth0LockAdditionalSignUpFieldPrefillFunction; - type?: "select" | "text"; validator?: (input: string) => { valid: boolean; hint?: string }; } +interface Auth0LockAdditionalSelectSignUpField { + type?: "select"; + icon?: string; + name: string; + options?: Auth0LockAdditionalSignUpFieldOption[] | Auth0LockAdditionalSignUpFieldOptionsFunction; + placeholder: string; + prefill?: string | Auth0LockAdditionalSignUpFieldPrefillFunction; + validator?: (input: string) => { valid: boolean; hint?: string }; +} + +interface Auth0LockAdditionalCheckboxSignUpField { + type?: "checkbox"; + icon?: string; + name: string; + placeholder: string; + prefill: "true" | "false"; + validator?: (input: string) => { valid: boolean, hint?: string }; +} + +type Auth0LockAdditionalSignUpField = Auth0LockAdditionalSelectSignUpField |Auth0LockAdditionalTextSignUpField |Auth0LockAdditionalCheckboxSignUpField; + type Auth0LockAvatarUrlCallback = (error: auth0.Auth0Error, url: string) => void; type Auth0LockAvatarDisplayNameCallback = (error: auth0.Auth0Error, displayName: string) => void; diff --git a/types/auth0/auth0-tests.ts b/types/auth0/auth0-tests.ts index e9e347cc69..0572c2b0e7 100644 --- a/types/auth0/auth0-tests.ts +++ b/types/auth0/auth0-tests.ts @@ -131,3 +131,13 @@ const retryableManagementClient = new auth0.ManagementClient({ enabled : true } }); + +management.createPasswordChangeTicket({ + connection_id: 'con_id', + email: 'test@me.co', + new_password: 'password', + result_url: 'https://www.google.com/', + ttl_sec: 86400, +}, (err: Error, data) => { + console.log(data.ticket); +}); diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index 479bf70c03..58013848f8 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for auth0 2.6 +// Type definitions for auth0 2.7 // Project: https://github.com/auth0/node-auth0 // Definitions by: Wilson Hobbs , Seth Westphal , Amiram Korach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -99,7 +99,6 @@ export interface Rule { order?: number; } - export interface Client { /** * The name of the client. @@ -257,6 +256,66 @@ export interface CreateClientGrant { scope: string[]; } +export type Strategy = + 'ad' | 'adfs' | 'amazon' | 'dropbox' | 'bitbucket' | 'aol' | 'auth0-adldap' | 'auth0-oidc' | + 'auth0' | 'baidu' | 'bitly' | 'box' | 'custom' | 'daccount' | 'dwolla' | 'email' | + 'evernote-sandbox' | 'evernote' | 'exact' | 'facebook' | 'fitbit' | 'flickr' | 'github' | + 'google-apps' | 'google-oauth2' | 'guardian' | 'instagram' | 'ip' | 'linkedin' | 'miicard' | + 'oauth1' | 'oauth2' | 'office365' | 'paypal' | 'paypal-sandbox' | 'pingfederate' | + 'planningcenter' | 'renren' | 'salesforce-community' | 'salesforce-sandbox' | 'salesforce' | + 'samlp' | 'sharepoint' | 'shopify' | 'sms' | 'soundcloud' | 'thecity-sandbox' | 'thecity' | + 'thirtysevensignals' | 'twitter' | 'untappd' | 'vkontakte' | 'waad' | 'weibo' | 'windowslive' | + 'wordpress' | 'yahoo' | 'yammer' | 'yandex'; + +export interface UpdateConnection { + options?: any; + /** + * The identifiers of the clients for which the connection is to + * be enabled. If the array is empty or the property is not + * specified, no clients are enabled. + */ + enabled_clients?: string[]; + /** + * Defines the realms for which the connection will be used + * (ie: email domains). If the array is empty or the property is + * not specified, the connection name will be added as realm. + */ + realms?: string[]; + metadata?: any; + /** + * True if the connection is domain level. + */ + is_domain_connection?: boolean; +} + +export interface Connection extends UpdateConnection { + /** + * The connection's identifier. + */ + id?: string; + /** + * The name of the connection. + */ + name?: string; + /** + * The type of the connection, related to the identity provider. + */ + strategy?: Strategy; +} + +export interface CreateConnection extends UpdateConnection { + /** + * The name of the connection. Must start and end with an + * alphanumeric character and can only contain alphanumeric + * characters and '-'. Max length 128. + */ + name: string; + /** + * The identity provider identifier for the connection. + */ + strategy: Strategy; +} + export interface User { email?: string; email_verified?: boolean; @@ -429,10 +488,16 @@ export interface UserIdParams { } export interface PasswordChangeTicketParams { - result_url: string; - user_id: string; - email: string; - new_password: string; + result_url?: string; + user_id?: string; + new_password?: string; + connection_id?: string; + email?: string; + ttl_sec?: number; +} + +export interface PasswordChangeTicketResponse { + ticket: string; } export interface EmailVerificationTicketOptions { @@ -488,23 +553,20 @@ export class ManagementClient { getClientInfo(): ClientInfo; // Connections - getConnections(): Promise; - getConnections(cb: (err: Error, data: any) => void): void; + getConnections(): Promise; + getConnections(cb: (err: Error, connections: Connection[]) => void): void; - createConnection(data: ObjectWithId): Promise; - createConnection(data: ObjectWithId, cb: (err: Error, data: any) => void): void; + createConnection(data: CreateConnection): Promise; + createConnection(data: CreateConnection, cb: (err: Error, connection: Connection) => void): void; - getConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void; - getConnection(params: ObjectWithId): Promise; + getConnection(params: ObjectWithId, cb: (err: Error, connection: Connection) => void): void; + getConnection(params: ObjectWithId): Promise; - deleteConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void; - deleteConnection(params: ObjectWithId): Promise; + deleteConnection(params: ObjectWithId, cb: (err: Error) => void): void; + deleteConnection(params: ObjectWithId): Promise; - deleteConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void; - deleteConnection(params: ObjectWithId): Promise; - - updateConnection(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void; - updateConnection(params: ObjectWithId, data: Data): Promise; + updateConnection(params: ObjectWithId, data: UpdateConnection, cb: (err: Error, connection: Connection) => void): void; + updateConnection(params: ObjectWithId, data: UpdateConnection): Promise; // Clients @@ -655,8 +717,8 @@ export class ManagementClient { sendEmailVerification(data: UserIdParams, cb?: (err: Error, data: any) => void): void; // Tickets - createPasswordChangeTicket(params: PasswordChangeTicketParams): Promise; - createPasswordChangeTicket(params: PasswordChangeTicketParams, cb?: (err: Error, data: any) => void): void; + createPasswordChangeTicket(params: PasswordChangeTicketParams): Promise; + createPasswordChangeTicket(params: PasswordChangeTicketParams, cb?: (err: Error, data: PasswordChangeTicketResponse) => void): void; createEmailVerificationTicket(data: EmailVerificationTicketOptions): Promise; createEmailVerificationTicket(data: EmailVerificationTicketOptions, cb?: (err: Error, data: any) => void): void; diff --git a/types/auto-sni/auto-sni-tests.ts b/types/auto-sni/auto-sni-tests.ts index 6be54148fb..8cd17af850 100644 --- a/types/auto-sni/auto-sni-tests.ts +++ b/types/auto-sni/auto-sni-tests.ts @@ -1,4 +1,4 @@ -import * as autosni from "auto-sni"; +import autosni = require("auto-sni"); const a = autosni({ agreeTos: true, email: '', diff --git a/types/autosuggest-highlight/autosuggest-highlight-tests.ts b/types/autosuggest-highlight/autosuggest-highlight-tests.ts new file mode 100644 index 0000000000..50283a24bd --- /dev/null +++ b/types/autosuggest-highlight/autosuggest-highlight-tests.ts @@ -0,0 +1,11 @@ +import match = require('autosuggest-highlight/match'); +import parse = require('autosuggest-highlight/parse'); + +function matchTest() { + let matches = match('some text', 'te'); // $ExpectType number[] | number[][] + matches = match('some sweet text', 's s'); // $ExpectType number[] | number[][] +} + +function parseTest() { + const parts = parse('Pretty cool text', [[7, 9], [12, 13]]); // $ExpectType { text: string; highlight: boolean; }[] +} diff --git a/types/autosuggest-highlight/index.d.ts b/types/autosuggest-highlight/index.d.ts new file mode 100644 index 0000000000..e05c30d608 --- /dev/null +++ b/types/autosuggest-highlight/index.d.ts @@ -0,0 +1,5 @@ +// Type definitions for autosuggest-highlight 3.1 +// Project: https://github.com/moroshko/autosuggest-highlight#readme +// Definitions by: Artur Sianiuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 diff --git a/types/autosuggest-highlight/match/index.d.ts b/types/autosuggest-highlight/match/index.d.ts new file mode 100644 index 0000000000..19d18c48b3 --- /dev/null +++ b/types/autosuggest-highlight/match/index.d.ts @@ -0,0 +1,3 @@ +declare function match(text: string, query: string): number[] | number[][]; + +export = match; diff --git a/types/autosuggest-highlight/parse/index.d.ts b/types/autosuggest-highlight/parse/index.d.ts new file mode 100644 index 0000000000..01038cd116 --- /dev/null +++ b/types/autosuggest-highlight/parse/index.d.ts @@ -0,0 +1,3 @@ +declare function parse(text: string, matches: number[] | number[][]): Array<{ text: string; highlight: boolean; }>; + +export = parse; diff --git a/types/autosuggest-highlight/tsconfig.json b/types/autosuggest-highlight/tsconfig.json new file mode 100644 index 0000000000..8201d360ec --- /dev/null +++ b/types/autosuggest-highlight/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "autosuggest-highlight-tests.ts", + "match/index.d.ts", + "parse/index.d.ts" + ] +} diff --git a/types/rollup/tslint.json b/types/autosuggest-highlight/tslint.json similarity index 61% rename from types/rollup/tslint.json rename to types/autosuggest-highlight/tslint.json index ba7f6bc7ae..946997cb87 100644 --- a/types/rollup/tslint.json +++ b/types/autosuggest-highlight/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "semicolon": [true, "never"] + "no-useless-files": false } } diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 1d756f21e0..2b7b375576 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -1,29 +1,35 @@ -var str: string = "any string"; -var date: Date = new Date(); -var anyObj: any = { abc: 123 }; -var num: number = 5; -var error: Error = new Error(); -var b: boolean = true; -var apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext; -var apiGwEvt: AWSLambda.APIGatewayEvent; -var customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent; -var clientCtx: AWSLambda.ClientContext; -var clientContextEnv: AWSLambda.ClientContextEnv; -var clientContextClient: AWSLambda.ClientContextClient; -var context: AWSLambda.Context; -var identity: AWSLambda.CognitoIdentity; -var proxyResult: AWSLambda.ProxyResult; -var authResponse: AWSLambda.AuthResponse; -var policyDocument: AWSLambda.PolicyDocument; -var statement: AWSLambda.Statement; -var authResponseContext: AWSLambda.AuthResponseContext; -var snsEvt: AWSLambda.SNSEvent; -var snsEvtRecs: AWSLambda.SNSEventRecord[]; -var snsEvtRec: AWSLambda.SNSEventRecord; -var snsMsg: AWSLambda.SNSMessage; -var snsMsgAttr: AWSLambda.SNSMessageAttribute; -var snsMsgAttrs: AWSLambda.SNSMessageAttributes; -var S3EvtRec: AWSLambda.S3EventRecord = { +declare let str: string; +declare let strOrNull: string | null; +declare let strOrUndefined: string | undefined; +declare let date: Date; +declare let anyObj: any; +declare let num: number; +declare let error: Error; +declare let bool: boolean; +declare let boolOrUndefined: boolean | undefined; +declare let apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext; +declare let apiGwEvt: AWSLambda.APIGatewayEvent; +declare let customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent; +declare let clientCtx: AWSLambda.ClientContext; +declare let clientCtxOrUndefined: AWSLambda.ClientContext | undefined; +declare let clientContextEnv: AWSLambda.ClientContextEnv; +declare let clientContextClient: AWSLambda.ClientContextClient; +declare let context: AWSLambda.Context; +declare let identity: AWSLambda.CognitoIdentity; +declare let identityOrUndefined: AWSLambda.CognitoIdentity | undefined; +declare let proxyResult: AWSLambda.ProxyResult; +declare let authResponse: AWSLambda.AuthResponse; +declare let policyDocument: AWSLambda.PolicyDocument; +declare let statement: AWSLambda.Statement; +declare let authResponseContext: AWSLambda.AuthResponseContext; +declare let authResponseContextOpt: AWSLambda.AuthResponseContext | null | undefined; +declare let snsEvt: AWSLambda.SNSEvent; +declare let snsEvtRecs: AWSLambda.SNSEventRecord[]; +declare let snsEvtRec: AWSLambda.SNSEventRecord; +declare let snsMsg: AWSLambda.SNSMessage; +declare let snsMsgAttr: AWSLambda.SNSMessageAttribute; +declare let snsMsgAttrs: AWSLambda.SNSMessageAttributes; +const S3EvtRec: AWSLambda.S3EventRecord = { eventVersion: '2.0', eventSource: 'aws:s3', awsRegion: 'us-east-1', @@ -32,7 +38,7 @@ var S3EvtRec: AWSLambda.S3EventRecord = { userIdentity: { principalId: 'AIDAJDPLRKLG7UEXAMPLE' }, - requestParameters:{ + requestParameters: { sourceIPAddress: '127.0.0.1' }, responseElements: { @@ -59,60 +65,61 @@ var S3EvtRec: AWSLambda.S3EventRecord = { } }; -var S3CreateEvent: AWSLambda.S3CreateEvent = { +const S3CreateEvent: AWSLambda.S3CreateEvent = { Records: [S3EvtRec] }; -var cognitoUserPoolEvent: AWSLambda.CognitoUserPoolEvent; -var cloudformationCustomResourceEvent: AWSLambda.CloudFormationCustomResourceEvent; -var cloudformationCustomResourceResponse: AWSLambda.CloudFormationCustomResourceResponse; -var cloudwatchLogsEvent: AWSLambda.CloudWatchLogsEvent; -var cloudwatchLogsDecodedData: AWSLambda.CloudWatchLogsDecodedData; +declare const cognitoUserPoolEvent: AWSLambda.CognitoUserPoolEvent; +declare const cloudformationCustomResourceEvent: AWSLambda.CloudFormationCustomResourceEvent; +declare const cloudformationCustomResourceResponse: AWSLambda.CloudFormationCustomResourceResponse; +declare const cloudwatchLogsEvent: AWSLambda.CloudWatchLogsEvent; +declare const cloudwatchLogsDecodedData: AWSLambda.CloudWatchLogsDecodedData; +declare const scheduledEvent: AWSLambda.ScheduledEvent; /* API Gateway Event request context */ str = apiGwEvtReqCtx.accountId; str = apiGwEvtReqCtx.apiId; -authResponseContext = apiGwEvtReqCtx.authorizer; +authResponseContextOpt = apiGwEvtReqCtx.authorizer; str = apiGwEvtReqCtx.httpMethod; -str = apiGwEvtReqCtx.identity.accessKey; -str = apiGwEvtReqCtx.identity.accountId; -str = apiGwEvtReqCtx.identity.apiKey; -str = apiGwEvtReqCtx.identity.caller; -str = apiGwEvtReqCtx.identity.cognitoAuthenticationProvider; -str = apiGwEvtReqCtx.identity.cognitoAuthenticationType; -str = apiGwEvtReqCtx.identity.cognitoIdentityId; -str = apiGwEvtReqCtx.identity.cognitoIdentityPoolId; +strOrNull = apiGwEvtReqCtx.identity.accessKey; +strOrNull = apiGwEvtReqCtx.identity.accountId; +strOrNull = apiGwEvtReqCtx.identity.apiKey; +strOrNull = apiGwEvtReqCtx.identity.caller; +strOrNull = apiGwEvtReqCtx.identity.cognitoAuthenticationProvider; +strOrNull = apiGwEvtReqCtx.identity.cognitoAuthenticationType; +strOrNull = apiGwEvtReqCtx.identity.cognitoIdentityId; +strOrNull = apiGwEvtReqCtx.identity.cognitoIdentityPoolId; str = apiGwEvtReqCtx.identity.sourceIp; -str = apiGwEvtReqCtx.identity.user; -str = apiGwEvtReqCtx.identity.userAgent; -str = apiGwEvtReqCtx.identity.userArn; +strOrNull = apiGwEvtReqCtx.identity.user; +strOrNull = apiGwEvtReqCtx.identity.userAgent; +strOrNull = apiGwEvtReqCtx.identity.userArn; str = apiGwEvtReqCtx.stage; str = apiGwEvtReqCtx.requestId; str = apiGwEvtReqCtx.resourceId; str = apiGwEvtReqCtx.resourcePath; /* API Gateway Event */ -str = apiGwEvt.body; +strOrNull = apiGwEvt.body; str = apiGwEvt.headers["example"]; str = apiGwEvt.httpMethod; -b = apiGwEvt.isBase64Encoded; +bool = apiGwEvt.isBase64Encoded; str = apiGwEvt.path; -str = apiGwEvt.pathParameters["example"]; -str = apiGwEvt.queryStringParameters["example"]; -str = apiGwEvt.stageVariables["example"]; +str = apiGwEvt.pathParameters!["example"]; +str = apiGwEvt.queryStringParameters!["example"]; +str = apiGwEvt.stageVariables!["example"]; apiGwEvtReqCtx = apiGwEvt.requestContext; str = apiGwEvt.resource; /* API Gateway CustomAuthorizer Event */ str = customAuthorizerEvt.type; str = customAuthorizerEvt.methodArn; -str = customAuthorizerEvt.authorizationToken; -str = apiGwEvt.pathParameters["example"]; -str = apiGwEvt.queryStringParameters["example"]; -str = apiGwEvt.stageVariables["example"]; +strOrUndefined = customAuthorizerEvt.authorizationToken; +str = apiGwEvt.pathParameters!["example"]; +str = apiGwEvt.queryStringParameters!["example"]; +str = apiGwEvt.stageVariables!["example"]; apiGwEvtReqCtx = apiGwEvt.requestContext; /* DynamoDB Stream Event */ -var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { +const dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { Records: [ { eventID: '1', @@ -233,17 +240,17 @@ str = snsMsgAttr.Value; /* Lambda Proxy Result */ num = proxyResult.statusCode; -proxyResult.headers["example"] = str; -proxyResult.headers["example"] = b; -proxyResult.headers["example"] = num; -b = proxyResult.isBase64Encoded; +proxyResult.headers!["example"] = str; +proxyResult.headers!["example"] = bool; +proxyResult.headers!["example"] = num; +boolOrUndefined = proxyResult.isBase64Encoded; str = proxyResult.body; /* API Gateway CustomAuthorizer AuthResponse */ authResponseContext = { stringKey: str, numberKey: num, - booleanKey: b + booleanKey: bool }; statement = { @@ -265,13 +272,13 @@ policyDocument = { authResponse = { principalId: str, - policyDocument: policyDocument, + policyDocument, context: authResponseContext }; authResponse = { principalId: str, - policyDocument: policyDocument + policyDocument, }; // CognitoUserPoolEvent @@ -290,38 +297,45 @@ cognitoUserPoolEvent.triggerSource === "CustomMessage_Authentication"; cognitoUserPoolEvent.triggerSource === "DefineAuthChallenge_Authentication"; cognitoUserPoolEvent.triggerSource === "CreateAuthChallenge_Authentication"; cognitoUserPoolEvent.triggerSource === "VerifyAuthChallengeResponse_Authentication"; +cognitoUserPoolEvent.triggerSource === "PreSignUp_AdminCreateUser"; +cognitoUserPoolEvent.triggerSource === "PostConfirmation_ConfirmForgotPassword"; +cognitoUserPoolEvent.triggerSource === "TokenGeneration_HostedAuth"; +cognitoUserPoolEvent.triggerSource === "TokenGeneration_Authentication"; +cognitoUserPoolEvent.triggerSource === "TokenGeneration_NewPasswordChallenge"; +cognitoUserPoolEvent.triggerSource === "TokenGeneration_AuthenticateDevice"; +cognitoUserPoolEvent.triggerSource === "TokenGeneration_RefreshTokens"; str = cognitoUserPoolEvent.region; str = cognitoUserPoolEvent.userPoolId; -str = cognitoUserPoolEvent.userName; +strOrUndefined = cognitoUserPoolEvent.userName; str = cognitoUserPoolEvent.callerContext.awsSdkVersion; str = cognitoUserPoolEvent.callerContext.clientId; str = cognitoUserPoolEvent.request.userAttributes["email"]; -str = cognitoUserPoolEvent.request.validationData["k1"]; -str = cognitoUserPoolEvent.request.codeParameter; -str = cognitoUserPoolEvent.request.usernameParameter; -b = cognitoUserPoolEvent.request.newDeviceUsed; -cognitoUserPoolEvent.request.session[0].challengeName === "CUSTOM_CHALLENGE"; -cognitoUserPoolEvent.request.session[0].challengeName === "PASSWORD_VERIFIER"; -cognitoUserPoolEvent.request.session[0].challengeName === "SMS_MFA"; -cognitoUserPoolEvent.request.session[0].challengeName === "DEVICE_SRP_AUTH"; -cognitoUserPoolEvent.request.session[0].challengeName === "DEVICE_PASSWORD_VERIFIER"; -cognitoUserPoolEvent.request.session[0].challengeName === "ADMIN_NO_SRP_AUTH"; -b = cognitoUserPoolEvent.request.session[0].challengeResult; -str = cognitoUserPoolEvent.request.session[0].challengeMetaData; -str = cognitoUserPoolEvent.request.challengeName; -str = cognitoUserPoolEvent.request.privateChallengeParameters["answer"]; -str = cognitoUserPoolEvent.request.challengeAnswer["answer"]; -b = cognitoUserPoolEvent.response.answerCorrect; -str = cognitoUserPoolEvent.response.smsMessage; -str = cognitoUserPoolEvent.response.emailMessage; -str = cognitoUserPoolEvent.response.emailSubject; -str = cognitoUserPoolEvent.response.challengeName; -b = cognitoUserPoolEvent.response.issueTokens; -b = cognitoUserPoolEvent.response.failAuthentication; -str = cognitoUserPoolEvent.response.publicChallengeParameters["captchaUrl"]; -str = cognitoUserPoolEvent.response.privateChallengeParameters["answer"]; -str = cognitoUserPoolEvent.response.challengeMetaData; -b = cognitoUserPoolEvent.response.answerCorrect; +str = cognitoUserPoolEvent.request.validationData!["k1"]; +strOrUndefined = cognitoUserPoolEvent.request.codeParameter; +strOrUndefined = cognitoUserPoolEvent.request.usernameParameter; +boolOrUndefined = cognitoUserPoolEvent.request.newDeviceUsed; +cognitoUserPoolEvent.request.session![0].challengeName === "CUSTOM_CHALLENGE"; +cognitoUserPoolEvent.request.session![0].challengeName === "PASSWORD_VERIFIER"; +cognitoUserPoolEvent.request.session![0].challengeName === "SMS_MFA"; +cognitoUserPoolEvent.request.session![0].challengeName === "DEVICE_SRP_AUTH"; +cognitoUserPoolEvent.request.session![0].challengeName === "DEVICE_PASSWORD_VERIFIER"; +cognitoUserPoolEvent.request.session![0].challengeName === "ADMIN_NO_SRP_AUTH"; +bool = cognitoUserPoolEvent.request.session![0].challengeResult; +strOrUndefined = cognitoUserPoolEvent.request.session![0].challengeMetaData; +strOrUndefined = cognitoUserPoolEvent.request.challengeName; +str = cognitoUserPoolEvent.request.privateChallengeParameters!["answer"]; +str = cognitoUserPoolEvent.request.challengeAnswer!["answer"]; +boolOrUndefined = cognitoUserPoolEvent.response.answerCorrect; +strOrUndefined = cognitoUserPoolEvent.response.smsMessage; +strOrUndefined = cognitoUserPoolEvent.response.emailMessage; +strOrUndefined = cognitoUserPoolEvent.response.emailSubject; +strOrUndefined = cognitoUserPoolEvent.response.challengeName; +boolOrUndefined = cognitoUserPoolEvent.response.issueTokens; +boolOrUndefined = cognitoUserPoolEvent.response.failAuthentication; +str = cognitoUserPoolEvent.response.publicChallengeParameters!["captchaUrl"]; +str = cognitoUserPoolEvent.response.privateChallengeParameters!["answer"]; +strOrUndefined = cognitoUserPoolEvent.response.challengeMetaData; +boolOrUndefined = cognitoUserPoolEvent.response.answerCorrect; // CloudFormation Custom Resource switch (cloudformationCustomResourceEvent.RequestType) { @@ -345,13 +359,22 @@ switch (cloudformationCustomResourceEvent.RequestType) { anyObj = cloudformationCustomResourceResponse.Data; str = cloudformationCustomResourceResponse.LogicalResourceId; str = cloudformationCustomResourceResponse.PhysicalResourceId; -str = cloudformationCustomResourceResponse.Reason; +strOrUndefined = cloudformationCustomResourceResponse.Reason; str = cloudformationCustomResourceResponse.RequestId; str = cloudformationCustomResourceResponse.StackId; str = cloudformationCustomResourceResponse.Status; +/* ScheduledEvent */ +str = scheduledEvent.account; +anyObj = scheduledEvent.detail; +str = scheduledEvent.id; +str = scheduledEvent.region; +str = scheduledEvent.resources[0]; +str = scheduledEvent.source; +str = scheduledEvent.time; + /* Context */ -b = context.callbackWaitsForEmptyEventLoop; +bool = context.callbackWaitsForEmptyEventLoop; str = context.functionName; str = context.functionVersion; str = context.invokedFunctionArn; @@ -359,8 +382,8 @@ num = context.memoryLimitInMB; str = context.awsRequestId; str = context.logGroupName; str = context.logStreamName; -identity = context.identity; -clientCtx = context.clientContext; +identityOrUndefined = context.identity; +clientCtxOrUndefined = context.clientContext; /* CognitoIdentity */ str = identity.cognitoIdentityId; @@ -403,7 +426,7 @@ function callback(cb: AWSLambda.Callback) { cb(null); cb(error); cb(null, anyObj); - cb(null, b); + cb(null, bool); cb(null, str); cb(null, num); } @@ -425,67 +448,67 @@ function customAuthorizerCallback(cb: AWSLambda.CustomAuthorizerCallback) { } /* CloudFront events, see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */ -var CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = { - "Records": [ +const CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = { + Records: [ { - "cf": { - "config": { - "distributionId": "EDFDVBD6EXAMPLE", - "requestId": "MRVMF7KydIvxMWfJIglgwHQwZsbG2IhRJ07sn9AkKUFSHS9EXAMPLE==" + cf: { + config: { + distributionId: "EDFDVBD6EXAMPLE", + requestId: "MRVMF7KydIvxMWfJIglgwHQwZsbG2IhRJ07sn9AkKUFSHS9EXAMPLE==" }, - "request": { - "clientIp": "2001:0db8:85a3:0:0:8a2e:0370:7334", - "method": "GET", - "uri": "/picture.jpg", - "querystring": "size=large", - "headers": { - "host": [ + request: { + clientIp: "2001:0db8:85a3:0:0:8a2e:0370:7334", + method: "GET", + uri: "/picture.jpg", + querystring: "size=large", + headers: { + host: [ { - "key": "Host", - "value": "d111111abcdef8.cloudfront.net" + key: "Host", + value: "d111111abcdef8.cloudfront.net" } ], "user-agent": [ { - "key": "User-Agent", - "value": "curl/7.51.0" + key: "User-Agent", + value: "curl/7.51.0" } ] }, - "origin": { - "custom": { - "customHeaders": { + origin: { + custom: { + customHeaders: { "my-origin-custom-header": [ { - "key": "My-Origin-Custom-Header", - "value": "Test" + key: "My-Origin-Custom-Header", + value: "Test" } ] }, - "domainName": "example.com", - "keepaliveTimeout": 5, - "path": "/custom_path", - "port": 443, - "protocol": "https", - "readTimeout": 5, - "sslProtocols": [ + domainName: "example.com", + keepaliveTimeout: 5, + path: "/custom_path", + port: 443, + protocol: "https", + readTimeout: 5, + sslProtocols: [ "TLSv1", "TLSv1.1" ] }, - "s3": { - "authMethod": "origin-access-identity", - "customHeaders": { + s3: { + authMethod: "origin-access-identity", + customHeaders: { "my-origin-custom-header": [ { - "key": "My-Origin-Custom-Header", - "value": "Test" + key: "My-Origin-Custom-Header", + value: "Test" } ] }, - "domainName": "my-bucket.s3.amazonaws.com", - "path": "/s3_path", - "region": "us-east-1" + domainName: "my-bucket.s3.amazonaws.com", + path: "/s3_path", + region: "us-east-1" } } } @@ -494,52 +517,52 @@ var CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = { ] }; -var CloudFrontResponseEvent: AWSLambda.CloudFrontResponseEvent = { - "Records": [ +const CloudFrontResponseEvent: AWSLambda.CloudFrontResponseEvent = { + Records: [ { - "cf": { - "config": { - "distributionId": "EDFDVBD6EXAMPLE", - "requestId": "xGN7KWpVEmB9Dp7ctcVFQC4E-nrcOcEKS3QyAez--06dV7TEXAMPLE==" + cf: { + config: { + distributionId: "EDFDVBD6EXAMPLE", + requestId: "xGN7KWpVEmB9Dp7ctcVFQC4E-nrcOcEKS3QyAez--06dV7TEXAMPLE==" }, - "request": { - "clientIp": "2001:0db8:85a3:0:0:8a2e:0370:7334", - "method": "GET", - "uri": "/picture.jpg", - "querystring": "size=large", - "headers": { - "host": [ + request: { + clientIp: "2001:0db8:85a3:0:0:8a2e:0370:7334", + method: "GET", + uri: "/picture.jpg", + querystring: "size=large", + headers: { + host: [ { - "key": "Host", - "value": "d111111abcdef8.cloudfront.net" + key: "Host", + value: "d111111abcdef8.cloudfront.net" } ], "user-agent": [ { - "key": "User-Agent", - "value": "curl/7.18.1" + key: "User-Agent", + value: "curl/7.18.1" } ] } }, - "response": { - "status": "200", - "statusDescription": "OK", - "headers": { - "server": [ + response: { + status: "200", + statusDescription: "OK", + headers: { + server: [ { - "key": "Server", - "value": "MyCustomOrigin" + key: "Server", + value: "MyCustomOrigin" } ], "set-cookie": [ { - "key": "Set-Cookie", - "value": "theme=light" + key: "Set-Cookie", + value: "theme=light" }, { - "key": "Set-Cookie", - "value": "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT" + key: "Set-Cookie", + value: "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT" } ] } @@ -561,8 +584,80 @@ context.fail(str); /* Handler */ let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { }; + +// async methods return Promise, test assignability let asyncHandler: AWSLambda.Handler = async (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { }; + +let inferredHandler: AWSLambda.S3Handler = (event, context, cb) => { + // $ExpectType S3Event + event; + str = event.Records[0].eventName; + // $ExpectType Context + context; + str = context.functionName; + // $ExpectType Callback + cb; + cb(); + cb(null); + cb(new Error()); + // $ExpectError + cb(null, { }); +}; + +// Test using default Callback type still works. +let defaultCallbackHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => { }; + +// Specific types +let s3Handler: AWSLambda.S3Handler = (event: AWSLambda.S3Event, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; +// Test old name +let s3CreateHandler: AWSLambda.S3Handler = (event: AWSLambda.S3CreateEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; +s3Handler = s3CreateHandler; + +let dynamoDBStreamHandler: AWSLambda.DynamoDBStreamHandler = (event: AWSLambda.DynamoDBStreamEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let snsHandler: AWSLambda.SNSHandler = (event: AWSLambda.SNSEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let cognitoUserPoolHandler: AWSLambda.CognitoUserPoolTriggerHandler = (event: AWSLambda.CognitoUserPoolEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let cloudFormationCustomResourceHandler: AWSLambda.CloudFormationCustomResourceHandler = + (event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let cloudWatchLogsHandler: AWSLambda.CloudWatchLogsHandler = (event: AWSLambda.CloudWatchLogsEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let scheduledHandler: AWSLambda.ScheduledHandler = (event: AWSLambda.ScheduledEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let apiGtwProxyHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.APIGatewayProxyEvent, context: AWSLambda.Context, cb: AWSLambda.APIGatewayProxyCallback) => { }; +// Test old names let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { }; -let asyncProxyHandler: AWSLambda.ProxyHandler = async (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { }; +apiGtwProxyHandler = proxyHandler; + +let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => { + cb(); + cb(null); + cb(new Error('')); + cb(null, { clientIp: str, method: str, uri: str, querystring: str, headers: { } }); + cb(null, { status: str }); + // $ExpectError + cb(null, { }); +}; + +let cloudFrontResponseHandler: AWSLambda.CloudFrontResponseHandler = (event: AWSLambda.CloudFrontResponseEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontResponseCallback) => { }; + let customAuthorizerHandler: AWSLambda.CustomAuthorizerHandler = (event: AWSLambda.CustomAuthorizerEvent, context: AWSLambda.Context, cb: AWSLambda.CustomAuthorizerCallback) => { }; -let asyncCustomAuthorizerHandler: AWSLambda.CustomAuthorizerHandler = async (event: AWSLambda.CustomAuthorizerEvent, context: AWSLambda.Context, cb: AWSLambda.CustomAuthorizerCallback) => { }; + +interface CustomEvent { eventString: string; eventBool: boolean; } +interface CustomResult { resultString: string; resultBool?: boolean; } +type CustomCallback = AWSLambda.Callback; +let customHandler: AWSLambda.Handler = (event, context, cb) => { + // $ExpectType CustomEvent + event; + str = event.eventString; + bool = event.eventBool; + // $ExpectType Context + context; + // $ExpectType Callback + cb; + cb(null, { resultString: str, resultBool: bool }); + // $ExpectError + cb(null, { resultString: bool }); +}; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 320cf562f8..eccc96ba3e 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -12,14 +12,18 @@ // Daniel Cottone // Kostya Misura // Markus Tacker +// Palmi Valgeirsson +// Danilo Raisi +// Simon Buchan +// David Hayden // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 // API Gateway "event" request context -interface APIGatewayEventRequestContext { +export interface APIGatewayEventRequestContext { accountId: string; apiId: string; - authorizer?: AuthResponseContext | null | undefined; + authorizer?: AuthResponseContext | null; httpMethod: string; identity: { accessKey: string | null; @@ -34,15 +38,16 @@ interface APIGatewayEventRequestContext { user: string | null; userAgent: string | null; userArn: string | null; - }, + }; stage: string; requestId: string; + requestTimeEpoch: number; resourceId: string; resourcePath: string; } // API Gateway "event" -interface APIGatewayEvent { +export interface APIGatewayProxyEvent { body: string | null; headers: { [name: string]: string }; httpMethod: string; @@ -54,9 +59,10 @@ interface APIGatewayEvent { requestContext: APIGatewayEventRequestContext; resource: string; } +export type APIGatewayEvent = APIGatewayProxyEvent; // Old name // API Gateway CustomAuthorizer "event" -interface CustomAuthorizerEvent { +export interface CustomAuthorizerEvent { type: string; methodArn: string; authorizationToken?: string; @@ -68,22 +74,22 @@ interface CustomAuthorizerEvent { // Context // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_AttributeValue.html -interface AttributeValue { +export interface AttributeValue { B?: string; - BS?: Array; + BS?: string[]; BOOL?: boolean; - L?: Array; + L?: AttributeValue[]; M?: { [id: string]: AttributeValue }; N?: string; - NS?: Array; + NS?: string[]; NULL?: boolean; S?: string; - SS?: Array; + SS?: string[]; } // Context // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_StreamRecord.html -interface StreamRecord { +export interface StreamRecord { ApproximateCreationTime?: number; Keys?: { [key: string]: AttributeValue }; NewImage?: { [key: string]: AttributeValue }; @@ -95,7 +101,7 @@ interface StreamRecord { // Context // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_Record.html -interface DynamoDBRecord { +export interface DynamoDBRecord { awsRegion?: string; dynamodb?: StreamRecord; eventID?: string; @@ -109,21 +115,21 @@ interface DynamoDBRecord { // AWS Lambda Stream event // Context // http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-ddb-update -interface DynamoDBStreamEvent { - Records: Array; +export interface DynamoDBStreamEvent { + Records: DynamoDBRecord[]; } // SNS "event" -interface SNSMessageAttribute { +export interface SNSMessageAttribute { Type: string; Value: string; } -interface SNSMessageAttributes { +export interface SNSMessageAttributes { [name: string]: SNSMessageAttribute; } -interface SNSMessage { +export interface SNSMessage { SignatureVersion: string; Timestamp: string; Signature: string; @@ -137,37 +143,37 @@ interface SNSMessage { Subject: string; } -interface SNSEventRecord { +export interface SNSEventRecord { EventVersion: string; EventSubscriptionArn: string; EventSource: string; Sns: SNSMessage; } -interface SNSEvent { - Records: Array; +export interface SNSEvent { + Records: SNSEventRecord[]; } /** * S3Create event * https://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html */ -interface S3EventRecord { +export interface S3EventRecord { eventVersion: string; eventSource: string; - awsRegion: string + awsRegion: string; eventTime: string; eventName: string; userIdentity: { principalId: string; - }, + }; requestParameters: { sourceIPAddress: string; - }, + }; responseElements: { 'x-amz-request-id': string; 'x-amz-id-2': string; - }, + }; s3: { s3SchemaVersion: string; configurationId: string; @@ -185,20 +191,42 @@ interface S3EventRecord { versionId: string; sequencer: string; } - } + }; } -interface S3CreateEvent { - Records: Array; +export interface S3Event { + Records: S3EventRecord[]; } +export type S3CreateEvent = S3Event; // old name /** * Cognito User Pool event * http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html */ -interface CognitoUserPoolEvent { +export interface CognitoUserPoolTriggerEvent { version: number; - triggerSource: "PreSignUp_SignUp" | "PostConfirmation_ConfirmSignUp" | "PreAuthentication_Authentication" | "PostAuthentication_Authentication" | "CustomMessage_SignUp" | "CustomMessage_AdminCreateUser" | "CustomMessage_ResendCode" | "CustomMessage_ForgotPassword" | "CustomMessage_UpdateUserAttribute" | "CustomMessage_VerifyUserAttribute" | "CustomMessage_Authentication" | "DefineAuthChallenge_Authentication" | "CreateAuthChallenge_Authentication" | "VerifyAuthChallengeResponse_Authentication"; + triggerSource: + | "PreSignUp_SignUp" + | "PostConfirmation_ConfirmSignUp" + | "PreAuthentication_Authentication" + | "PostAuthentication_Authentication" + | "CustomMessage_SignUp" + | "CustomMessage_AdminCreateUser" + | "CustomMessage_ResendCode" + | "CustomMessage_ForgotPassword" + | "CustomMessage_UpdateUserAttribute" + | "CustomMessage_VerifyUserAttribute" + | "CustomMessage_Authentication" + | "DefineAuthChallenge_Authentication" + | "CreateAuthChallenge_Authentication" + | "VerifyAuthChallengeResponse_Authentication" + | "PreSignUp_AdminCreateUser" + | "PostConfirmation_ConfirmForgotPassword" + | "TokenGeneration_HostedAuth" + | "TokenGeneration_Authentication" + | "TokenGeneration_NewPasswordChallenge" + | "TokenGeneration_AuthenticateDevice" + | "TokenGeneration_RefreshTokens"; region: string; userPoolId: string; userName?: string; @@ -212,11 +240,11 @@ interface CognitoUserPoolEvent { codeParameter?: string; usernameParameter?: string; newDeviceUsed?: boolean; - session?: { + session?: Array<{ challengeName: "CUSTOM_CHALLENGE" | "PASSWORD_VERIFIER" | "SMS_MFA" | "DEVICE_SRP_AUTH" | "DEVICE_PASSWORD_VERIFIER" | "ADMIN_NO_SRP_AUTH"; challengeResult: boolean; challengeMetaData?: string; - }[]; + }>; challengeName?: string; privateChallengeParameters?: {[key: string]: string}; challengeAnswer?: {[key: string]: string}; @@ -235,12 +263,13 @@ interface CognitoUserPoolEvent { answerCorrect?: boolean; }; } +export type CognitoUserPoolEvent = CognitoUserPoolTriggerEvent; /** * CloudFormation Custom Resource event and response * http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref.html */ -type CloudFormationCustomResourceEventCommon = { +export interface CloudFormationCustomResourceEventCommon { ServiceToken: string; ResponseURL: string; StackId: string; @@ -250,14 +279,14 @@ type CloudFormationCustomResourceEventCommon = { ResourceProperties: { ServiceToken: string; [Key: string]: any; - } + }; } -type CloudFormationCustomResourceCreateEvent = CloudFormationCustomResourceEventCommon & { +export interface CloudFormationCustomResourceCreateEvent extends CloudFormationCustomResourceEventCommon { RequestType: "Create"; } -type CloudFormationCustomResourceUpdateEvent = CloudFormationCustomResourceEventCommon & { +export interface CloudFormationCustomResourceUpdateEvent extends CloudFormationCustomResourceEventCommon { RequestType: "Update"; PhysicalResourceId: string; OldResourceProperties: { @@ -265,47 +294,61 @@ type CloudFormationCustomResourceUpdateEvent = CloudFormationCustomResourceEvent }; } -type CloudFormationCustomResourceDeleteEvent = CloudFormationCustomResourceEventCommon & { +export interface CloudFormationCustomResourceDeleteEvent extends CloudFormationCustomResourceEventCommon { RequestType: "Delete"; PhysicalResourceId: string; } export type CloudFormationCustomResourceEvent = CloudFormationCustomResourceCreateEvent | CloudFormationCustomResourceUpdateEvent | CloudFormationCustomResourceDeleteEvent; -type CloudFormationCustomResourceResponseCommon = { +export interface CloudFormationCustomResourceResponseCommon { PhysicalResourceId: string; StackId: string; RequestId: string; LogicalResourceId: string; Data?: { [Key: string]: any; - } + }; } -type CloudFormationCustomResourceSuccessResponse = CloudFormationCustomResourceResponseCommon & { +export interface CloudFormationCustomResourceSuccessResponse extends CloudFormationCustomResourceResponseCommon { Status: "SUCCESS"; Reason?: string; } -type CloudFormationCustomResourceFailedResponse = CloudFormationCustomResourceResponseCommon & { +export interface CloudFormationCustomResourceFailedResponse extends CloudFormationCustomResourceResponseCommon { Status: "FAILED"; Reason: string; } export type CloudFormationCustomResourceResponse = CloudFormationCustomResourceSuccessResponse | CloudFormationCustomResourceFailedResponse; +/** + * See https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-scheduled-event + */ +export interface ScheduledEvent { + account: string; + region: string; + detail: any; + "detail-type": string; + source: string; + time: string; + id: string; + resources: string[]; +} + /** * See http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-cloudwatch-logs */ -interface CloudWatchLogsEvent { +export interface CloudWatchLogsEvent { awslogs: CloudWatchLogsEventData; } -interface CloudWatchLogsEventData { +export interface CloudWatchLogsEventData { data: string; } -interface CloudWatchLogsDecodedData { +export interface CloudWatchLogsDecodedData { owner: string; logGroup: string; logStream: string; @@ -317,17 +360,15 @@ interface CloudWatchLogsDecodedData { /** * See http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html#LambdaFunctionExample */ -interface CloudWatchLogsLogEvent { +export interface CloudWatchLogsLogEvent { id: string; timestamp: number; message: string; } - - // Context // http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html -interface Context { +export interface Context { // Properties callbackWaitsForEmptyEventLoop: boolean; functionName: string; @@ -346,25 +387,23 @@ interface Context { // Functions for compatibility with earlier Node.js Runtime v0.10.42 // For more details see http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html#nodejs-prog-model-oldruntime-context-methods done(error?: Error, result?: any): void; - fail(error: Error): void; - fail(message: string): void; - succeed(message: string): void; - succeed(object: any): void; + fail(error: Error | string): void; + succeed(messageOrObject: any): void; succeed(message: string, object: any): void; } -interface CognitoIdentity { +export interface CognitoIdentity { cognitoIdentityId: string; cognitoIdentityPoolId: string; } -interface ClientContext { +export interface ClientContext { client: ClientContextClient; Custom?: any; env: ClientContextEnv; } -interface ClientContextClient { +export interface ClientContextClient { installationId: string; appTitle: string; appVersionName: string; @@ -372,7 +411,7 @@ interface ClientContextClient { appPackageName: string; } -interface ClientContextEnv { +export interface ClientContextEnv { platformVersion: string; platform: string; make: string; @@ -380,30 +419,32 @@ interface ClientContextEnv { locale: string; } -interface ProxyResult { +export interface APIGatewayProxyResult { statusCode: number; headers?: { [header: string]: boolean | number | string; - }, + }; body: string; isBase64Encoded?: boolean; } +export type ProxyResult = APIGatewayProxyResult; // Old name /** * API Gateway CustomAuthorizer AuthResponse. * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output */ -interface AuthResponse { +export interface CustomAuthorizerResult { principalId: string; policyDocument: PolicyDocument; context?: AuthResponseContext; } +export type AuthResponse = CustomAuthorizerResult; /** * API Gateway CustomAuthorizer AuthResponse.PolicyDocument. * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output */ -interface PolicyDocument { +export interface PolicyDocument { Version: string; Statement: [Statement]; } @@ -412,7 +453,7 @@ interface PolicyDocument { * API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement. * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output */ -interface Statement { +export interface Statement { Action: string | string[]; Effect: string; Resource: string | string[]; @@ -422,58 +463,71 @@ interface Statement { * API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement. * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output */ -interface AuthResponseContext { - [name: string]: string | number | boolean; +export interface AuthResponseContext { + [name: string]: any; } /** * CloudFront events * http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */ -type CloudFrontHeaders = { - [name: string]: { - key: string; - value: string; - }[] -}; +export interface CloudFrontHeaders { + [name: string]: Array<{ + key: string; + value: string; + }>; +} -type CloudFrontResponse = { +export interface CloudFrontResponse { status: string; statusDescription: string; headers: CloudFrontHeaders; -}; +} -type CloudFrontRequest = { +export interface CloudFrontRequest { clientIp: string; method: string; uri: string; querystring: string; headers: CloudFrontHeaders; -}; +} -type CloudFrontEvent = { +export interface CloudFrontEvent { config: { distributionId: string; requestId: string; - } + }; } -export type CloudFrontResponseEvent = { - Records: { +// https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-generating-http-responses.html#lambda-generating-http-responses-object +export interface CloudFrontResultResponse { + status: string; + statusDescription?: string; + headers?: CloudFrontHeaders; + bodyEncoding?: 'text' | 'base64'; + body?: string; +} + +export interface CloudFrontResponseEvent { + Records: Array<{ cf: CloudFrontEvent & { request: CloudFrontRequest; response: CloudFrontResponse; } - }[] -}; + }>; +} -export type CloudFrontRequestEvent = { - Records: { +export type CloudFrontRequestResult = undefined | null | CloudFrontResultResponse | CloudFrontRequest; + +export interface CloudFrontRequestEvent { + Records: Array<{ cf: CloudFrontEvent & { request: CloudFrontRequest; } - }[] -}; + }>; +} + +export type CloudFrontResponseResult = undefined | null | CloudFrontResultResponse; /** * AWS Lambda handler function. @@ -483,9 +537,7 @@ export type CloudFrontRequestEvent = { * @param context – runtime information of the Lambda function that is executing. * @param callback – optional callback to return information to the caller, otherwise return value is null. */ -export type Handler = (event: any, context: Context, callback?: Callback) => Promise | void; -export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => Promise | void; -export type CustomAuthorizerHandler = (event: CustomAuthorizerEvent, context: Context, callback?: CustomAuthorizerCallback) => Promise | void; +export type Handler = (event: TEvent, context: Context, callback: Callback) => void; /** * Optional callback parameter. @@ -494,8 +546,58 @@ export type CustomAuthorizerHandler = (event: CustomAuthorizerEvent, context: Co * @param error – an optional parameter that you can use to provide results of the failed Lambda function execution. * @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible. */ -export type Callback = (error?: Error | null, result?: object | boolean | number | string) => void; -export type ProxyCallback = (error?: Error | null, result?: ProxyResult) => void; -export type CustomAuthorizerCallback = (error?: Error | null, result?: AuthResponse) => void; +export type Callback = (error?: Error | null, result?: TResult) => void; + +// Begin defining Handler and Callback types for each API trigger type. +// Ordered by https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html +// though that list is incomplete. + +export type S3Handler = Handler; + +export type DynamoDBStreamHandler = Handler; + +export type SNSHandler = Handler; + +// No SESHandler: SES event source is delivered as SNS notifications +// https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html#supported-event-source-ses + +// Result type is weird: docs and samples say to return the mutated event, but it only requires an object +// with a "response" field, the type of which is specific to the event.triggerType. Leave as any for now. +export type CognitoUserPoolTriggerHandler = Handler; +// TODO: Different event/handler types for each event trigger so we can type the result? + +// TODO: CognitoSync + +export type CloudFormationCustomResourceHandler = Handler; + +// TODO: CloudWatchEvents + +export type CloudWatchLogsHandler = Handler; + +// TODO: CodeCommit + +export type ScheduledHandler = Handler; + +// TODO: AWS Config + +// TODO: Alexa + +export type APIGatewayProxyHandler = Handler; +export type APIGatewayProxyCallback = Callback; +export type ProxyHandler = APIGatewayProxyHandler; // Old name +export type ProxyCallback = APIGatewayProxyCallback; // Old name + +// TODO: IoT + +export type CloudFrontRequestHandler = Handler; +export type CloudFrontRequestCallback = Callback; + +export type CloudFrontResponseHandler = Handler; +export type CloudFrontResponseCallback = Callback; + +// TODO: Kinesis (should be very close to DynamoDB stream?) + +export type CustomAuthorizerHandler = Handler; +export type CustomAuthorizerCallback = Callback; export as namespace AWSLambda; diff --git a/types/aws-lambda/tsconfig.json b/types/aws-lambda/tsconfig.json index f4f2cc28f6..79e058b7ab 100644 --- a/types/aws-lambda/tsconfig.json +++ b/types/aws-lambda/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/aws-lambda/tslint.json b/types/aws-lambda/tslint.json index a41bf5d19a..bafaae7817 100644 --- a/types/aws-lambda/tslint.json +++ b/types/aws-lambda/tslint.json @@ -1,79 +1,7 @@ { "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 + // TODO + "dt-header": false } } diff --git a/types/aws-serverless-express/aws-serverless-express-tests.ts b/types/aws-serverless-express/aws-serverless-express-tests.ts index 4770163b3b..9bfd1b0e99 100644 --- a/types/aws-serverless-express/aws-serverless-express-tests.ts +++ b/types/aws-serverless-express/aws-serverless-express-tests.ts @@ -1,5 +1,5 @@ import * as awsServerlessExpress from 'aws-serverless-express'; -import * as express from 'express'; +import express = require('express'); import { eventContext } from 'aws-serverless-express/middleware'; const app = express(); diff --git a/types/azure-sb/tsconfig.json b/types/azure-sb/tsconfig.json index 09c9a2a9e4..6e015480dc 100644 --- a/types/azure-sb/tsconfig.json +++ b/types/azure-sb/tsconfig.json @@ -38,5 +38,4 @@ "azure-sb-tests.ts", "index.d.ts" ] -} - +} \ No newline at end of file diff --git a/types/babel-types/index.d.ts b/types/babel-types/index.d.ts index cbed3e076c..b1de338923 100644 --- a/types/babel-types/index.d.ts +++ b/types/babel-types/index.d.ts @@ -422,7 +422,7 @@ export interface ExportNamedDeclaration extends Node { type: "ExportNamedDeclaration"; declaration: Declaration; specifiers: ExportSpecifier[]; - source: StringLiteral; + source: StringLiteral | null; } export interface ExportSpecifier extends Node { diff --git a/types/babel-webpack-plugin/tsconfig.json b/types/babel-webpack-plugin/tsconfig.json index 3e73343283..b7aadac43d 100644 --- a/types/babel-webpack-plugin/tsconfig.json +++ b/types/babel-webpack-plugin/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "babel-webpack-plugin-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/babel__code-frame/babel__code-frame-tests.ts b/types/babel__code-frame/babel__code-frame-tests.ts new file mode 100644 index 0000000000..380134532e --- /dev/null +++ b/types/babel__code-frame/babel__code-frame-tests.ts @@ -0,0 +1,26 @@ +import codeFrame, { codeFrameColumns } from "@babel/code-frame"; + +const code = ` + const number = 1; + var string = 'foo'; + + function print(name: string) { + console.log(string + name); + } +`; + +codeFrame(code, 5, 22); +codeFrame(code, 5, 22, { forceColor: true }); +codeFrame(code, 2, 2, { highlightCode: true }); + +codeFrameColumns(code, { start: { line: 5, column: 22 } }); +codeFrameColumns( + code, + { start: { line: 5, column: 22 } }, + { forceColor: true } +); +codeFrameColumns( + code, + { start: { line: 2, column: 2 } }, + { highlightCode: true } +); diff --git a/types/babel__code-frame/index.d.ts b/types/babel__code-frame/index.d.ts new file mode 100644 index 0000000000..5a32040bb2 --- /dev/null +++ b/types/babel__code-frame/index.d.ts @@ -0,0 +1,54 @@ +// Type definitions for @babel/code-frame 7.0 +// Project: https://github.com/babel/babel/tree/master/packages/babel-code-frame +// Definitions by: Mohsen Azimi +// Forbes Lindesay +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface SourceLocation { + start: { line: number; column?: number }; + end?: { line: number; column?: number }; +} +export function codeFrameColumns( + rawLines: string, + location: SourceLocation, + options?: BabelCodeFrameOptions +): string; + +export interface BabelCodeFrameOptions { + /** Syntax highlight the code as JavaScript for terminals. default: false */ + highlightCode?: boolean; + /** The number of lines to show above the error. default: 2 */ + linesAbove?: number; + /** The number of lines to show below the error. default: 3 */ + linesBelow?: number; + /** + * Forcibly syntax highlight the code as JavaScript (for non-terminals); + * overrides highlightCode. + * default: false + */ + forceColor?: boolean; + /** + * Pass in a string to be displayed inline (if possible) next to the + * highlighted location in the code. If it can't be positioned inline, + * it will be placed above the code frame. + * default: nothing + */ + message?: string; +} + +/** + * Generate errors that contain a code frame that point to source locations. + * + * @param rawLines Raw lines to frame + * @param lineNumber Line number (1 indexed) + * @param colNumber Column number + * @param options Additional options + * + * @returns Framed code + */ +export default function codeFrame( + rawLines: string, + lineNumber: number, + colNumber: number, + options?: BabelCodeFrameOptions +): string; diff --git a/types/babel__code-frame/tsconfig.json b/types/babel__code-frame/tsconfig.json new file mode 100644 index 0000000000..49bd833b58 --- /dev/null +++ b/types/babel__code-frame/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "@babel/code-frame": ["babel__code-frame"] + } + }, + "files": ["index.d.ts", "babel__code-frame-tests.ts"] +} diff --git a/types/babel__code-frame/tslint.json b/types/babel__code-frame/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/babel__code-frame/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/base64topdf/base64topdf-tests.ts b/types/base64topdf/base64topdf-tests.ts new file mode 100644 index 0000000000..109ec5fbff --- /dev/null +++ b/types/base64topdf/base64topdf-tests.ts @@ -0,0 +1,8 @@ +import * as base64topdf from 'base64topdf'; + +base64topdf.base64Encode('index.ts'); // $ExpectType void +base64topdf.base64Decode('decodethis', 'test.b64'); // $ExpectType void +base64topdf.rtfToText('rtf'); // $ExpectType string +base64topdf.textToRtf('text'); // $ExpectType string +base64topdf.strToBase64('str'); // $ExpectType string +base64topdf.base64ToStr('base64'); // $ExpectType string diff --git a/types/base64topdf/index.d.ts b/types/base64topdf/index.d.ts new file mode 100644 index 0000000000..97f9af7077 --- /dev/null +++ b/types/base64topdf/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for base64topdf 1.1 +// Project: https://github.com/rpsankar001 +// Definitions by: Lucas Riondel +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace base64topdf; + +export function base64Encode(file: string): void; +export function base64Decode(base64str: string, file: string): void; +export function rtfToText(rtfStr: string): string; +export function textToRtf(textStr: string): string; +export function strToBase64(str: string): string; +export function base64ToStr(base64Str: string): string; diff --git a/types/base64topdf/tsconfig.json b/types/base64topdf/tsconfig.json new file mode 100644 index 0000000000..29fb459eb9 --- /dev/null +++ b/types/base64topdf/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", + "base64topdf-tests.ts" + ] +} diff --git a/types/base64topdf/tslint.json b/types/base64topdf/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/base64topdf/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/bash-glob/tsconfig.json b/types/bash-glob/tsconfig.json index 6a45a2d74d..d62dc6e114 100644 --- a/types/bash-glob/tsconfig.json +++ b/types/bash-glob/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "bash-glob-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/beats/tsconfig.json b/types/beats/tsconfig.json index 89bd0b5995..7b360083c1 100644 --- a/types/beats/tsconfig.json +++ b/types/beats/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "beats-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bech32/tsconfig.json b/types/bech32/tsconfig.json index 886ec79796..501b2438b2 100644 --- a/types/bech32/tsconfig.json +++ b/types/bech32/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "bech32-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/better-sqlite3/better-sqlite3-tests.ts b/types/better-sqlite3/better-sqlite3-tests.ts index 43d78e1503..34ee6808c3 100644 --- a/types/better-sqlite3/better-sqlite3-tests.ts +++ b/types/better-sqlite3/better-sqlite3-tests.ts @@ -1,4 +1,4 @@ -import * as Database from 'better-sqlite3'; +import Database = require('better-sqlite3'); const integer = Database.Integer(1); const err = new Database.SqliteError('ok', 'ok'); diff --git a/types/better-sqlite3/index.d.ts b/types/better-sqlite3/index.d.ts index 530f5c3e53..899a85a2e2 100644 --- a/types/better-sqlite3/index.d.ts +++ b/types/better-sqlite3/index.d.ts @@ -4,9 +4,7 @@ // Mathew Rumsey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - -import * as Integer from 'integer'; +import Integer = require('integer'); interface RunResult { changes: number; diff --git a/types/big.js/index.d.ts b/types/big.js/index.d.ts index 37f51a54bd..405622f7ee 100644 --- a/types/big.js/index.d.ts +++ b/types/big.js/index.d.ts @@ -295,6 +295,7 @@ export const Big: BigConstructor; export type Big_ = Big; export type BigConstructor_ = BigConstructor; export type BigSource_ = BigSource; +export default Big; declare global { namespace BigJs { diff --git a/types/big.js/test/big.js-import-default-tests.ts b/types/big.js/test/big.js-import-default-tests.ts new file mode 100644 index 0000000000..52841986be --- /dev/null +++ b/types/big.js/test/big.js-import-default-tests.ts @@ -0,0 +1,12 @@ +/* + + This file contains tests for the named export definitions of big.js. + Import the default Big constructor from 'big.js' + +*/ + +import Big from 'big.js'; + +function constructorTests() { + const x = new Big(9); // '9' +} diff --git a/types/big.js/tsconfig.json b/types/big.js/tsconfig.json index 950e8b410f..20fae3a55f 100644 --- a/types/big.js/tsconfig.json +++ b/types/big.js/tsconfig.json @@ -19,6 +19,7 @@ "files": [ "index.d.ts", "test/big.js-module-tests.ts", - "test/big.js-global-tests.ts" + "test/big.js-global-tests.ts", + "test/big.js-import-default-tests.ts" ] } \ No newline at end of file diff --git a/types/big.js/tslint.json b/types/big.js/tslint.json index f93cf8562a..3224b40b8b 100644 --- a/types/big.js/tslint.json +++ b/types/big.js/tslint.json @@ -1,3 +1,6 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + "no-const-enum": false + } } diff --git a/types/binary-parser/tsconfig.json b/types/binary-parser/tsconfig.json index cb361f52c5..5e720245df 100644 --- a/types/binary-parser/tsconfig.json +++ b/types/binary-parser/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "binary-parser-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bindings/tsconfig.json b/types/bindings/tsconfig.json index fb9350642a..787b28c3d0 100644 --- a/types/bindings/tsconfig.json +++ b/types/bindings/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "bindings-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bip38/tsconfig.json b/types/bip38/tsconfig.json index 6ce875b1d1..74baba8f90 100644 --- a/types/bip38/tsconfig.json +++ b/types/bip38/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "bip38-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bip39/tsconfig.json b/types/bip39/tsconfig.json index d44c1197ad..bb95bb90d0 100644 --- a/types/bip39/tsconfig.json +++ b/types/bip39/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "bip39-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bitcore-lib/bitcore-lib-tests.ts b/types/bitcore-lib/bitcore-lib-tests.ts new file mode 100644 index 0000000000..fb39c85fc1 --- /dev/null +++ b/types/bitcore-lib/bitcore-lib-tests.ts @@ -0,0 +1,27 @@ +import * as bitcore from 'bitcore-lib'; + +const transaction = new bitcore.Transaction({}); + +const output: bitcore.Output = transaction.outputs[0]; + +const privateKey: bitcore.PrivateKey = new bitcore.PrivateKey('privateKey'); +const publicKey: bitcore.PublicKey = privateKey.publicKey; +const publicKeyAsString: string = publicKey.toString(); + +const signature = bitcore.crypto.ECDSA.sign(Buffer.from('sign this message', 'hex'), new bitcore.PrivateKey('privateKey')); + +bitcore.crypto.ECDSA.verify( + Buffer.from('buffer', 'hex'), + bitcore.crypto.Signature.fromString('signature'), + new bitcore.PublicKey('publicKey') +); + +const utxo: bitcore.Transaction.UnspentOutput[] = [new bitcore.Transaction.UnspentOutput({})]; + +new bitcore.Block(Buffer.from('123', 'hex')); + +const tx = new bitcore.Transaction() + .from(utxo) + .change('bitcoinAddress') + .addData(Buffer.from('')) + .sign('bitcoinAddressPrivateKey'); diff --git a/types/bitcore-lib/index.d.ts b/types/bitcore-lib/index.d.ts new file mode 100644 index 0000000000..0846b85c0d --- /dev/null +++ b/types/bitcore-lib/index.d.ts @@ -0,0 +1,130 @@ +// Type definitions for bitcore-lib 0.15 +// Project: https://github.com/bitpay/bitcore-lib +// Definitions by: Lautaro Dragan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 2.2 + +/// + +export namespace crypto { + class BN { } + namespace ECDSA { + function sign(message: Buffer, key: PrivateKey): Signature; + function verify(hashbuf: Buffer, sig: Signature, pubkey: PublicKey, endian?: 'little'): boolean; + } + namespace Hash { + function sha256(buffer: Buffer): Uint8Array; + } + namespace Random { + function getRandomBuffer(size: number): Buffer; + } + namespace Point {} + class Signature { + static fromDER(sig: Buffer): Signature; + static fromString(data: string): Signature; + SIGHASH_ALL: number; + toString(): string; + } +} + +export class Transaction { + inputs: Input[]; + outputs: Output[]; + readonly id: string; + readonly hash: string; + nid: string; + + constructor(serialized?: any); + + from(utxos: Transaction.UnspentOutput[]): Transaction; + to(address: Address | string, amount: number): Transaction; + change(address: Address | string): Transaction; + sign(privateKey: PrivateKey | string): Transaction; + applySignature(sig: crypto.Signature): Transaction; + addData(data: Buffer): this; + serialize(): string; +} + +export namespace Transaction { + class UnspentOutput { + static fromObject(o: object): UnspentOutput; + + readonly address: Address; + readonly txId: string; + readonly outputIndex: number; + readonly script: Script; + readonly satoshis: number; + + constructor(data: object); + + inspect(): string; + toObject(): this; + toString(): string; + } +} + +export class Block { + hash: string; + height: number; + transactions: Transaction[]; + header: { + time: number; + prevHash: string; + }; + + constructor(data: Buffer | object); +} + +export class PrivateKey { + readonly publicKey: PublicKey; + + constructor(key: string); +} + +export class PublicKey { + constructor(source: string); + + static fromPrivateKey(privateKey: PrivateKey): PublicKey; + + toBuffer(): Buffer; + toDER(): Buffer; +} + +export interface Output { + readonly script: any; +} + +export namespace Script { + const types: { + DATA_OUT: string; + }; + function buildPublicKeyHashOut(address: Address): Script; +} + +export class Script { } + +export interface Util { + readonly buffer: { + reverse(a: any): any; + }; +} + +export namespace Networks { + interface Network { + readonly name: string; + readonly alias: string; + } + + const livenet: Network; + const mainnet: Network; + const testnet: Network; + + function add(data: any): Network; + function remove(network: Network): void; + function get(args: string | number | Network, keys: string | string[]): Network; +} + +export class Address {} + +export class Input {} diff --git a/types/rollup/tsconfig.json b/types/bitcore-lib/tsconfig.json similarity index 93% rename from types/rollup/tsconfig.json rename to types/bitcore-lib/tsconfig.json index 2fad31b1b1..30334d3846 100644 --- a/types/rollup/tsconfig.json +++ b/types/bitcore-lib/tsconfig.json @@ -1,10 +1,10 @@ { "compilerOptions": { "module": "commonjs", - "target": "es6", "lib": [ "es6" ], + "target": "es6", "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, @@ -19,6 +19,6 @@ }, "files": [ "index.d.ts", - "rollup-tests.ts" + "bitcore-lib-tests.ts" ] } \ No newline at end of file diff --git a/types/bitcore-lib/tslint.json b/types/bitcore-lib/tslint.json new file mode 100644 index 0000000000..dae7fb7540 --- /dev/null +++ b/types/bitcore-lib/tslint.json @@ -0,0 +1,4 @@ +{ + "extends": "dtslint/dt.json", + "rules": {} +} \ No newline at end of file diff --git a/types/bittorrent-protocol/bittorrent-protocol-tests.ts b/types/bittorrent-protocol/bittorrent-protocol-tests.ts index c32b2af368..2faca76a5e 100644 --- a/types/bittorrent-protocol/bittorrent-protocol-tests.ts +++ b/types/bittorrent-protocol/bittorrent-protocol-tests.ts @@ -1,4 +1,4 @@ -import * as Protocol from 'bittorrent-protocol'; +import Protocol = require('bittorrent-protocol'); import * as net from 'net'; class TestExtension implements Protocol.Extension { diff --git a/types/blessed/blessed-tests.ts b/types/blessed/blessed-tests.ts index c5f857146f..aa38af8985 100644 --- a/types/blessed/blessed-tests.ts +++ b/types/blessed/blessed-tests.ts @@ -1,5 +1,6 @@ import * as blessed from "blessed"; import { readFileSync } from "fs"; +import { inspect } from "util"; let screen: blessed.Widgets.Screen = null; @@ -743,3 +744,71 @@ setTimeout(() => { table.setData(data1); screen.render(); }, 3000); + +// https://github.com/chjj/blessed/blob/master/test/program-mouse.js + +const program = blessed.program({ + dump: __dirname + '/logs/mouse.log' +}); + +// program.setMouse({ +// allMotion: true, +// //utfMouse: true +// urxvtMouse: true +// }, true); + +program.alternateBuffer(); +program.enableMouse(); +program.hideCursor(); + +program.setMouse({ sendFocus: true }, true); + +program.on('mouse', function(data) { + program.cup(data.y, data.x); + program.write(' '); + program.cup(0, 0); + program.write(inspect(data)); +}); + +program.on('resize', function(data) { + setTimeout(function() { + program.clear(); + program.cup(0, 0); + program.write(inspect({ cols: program.cols, rows: program.rows })); + }, 200); +}); + +process.on('SIGWINCH', function(data) { + setTimeout(function() { + program.cup(1, 0); + program.write(inspect({ winch: true, cols: program.cols, rows: program.rows })); + }, 200); +}); + +program.on('focus', function(data) { + program.clear(); + program.cup(0, 0); + program.write('FOCUSIN'); +}); + +program.on('blur', function(data) { + program.clear(); + program.cup(0, 0); + program.write('FOCUSOUT'); +}); + +program.key(['q', 'escape', 'C-c'], function() { + program.showCursor(); + program.disableMouse(); + program.normalBuffer(); + process.exit(0); +}); + +program.on('keypress', function(ch, data) { + if (data.name === 'mouse') return; + program.clear(); + program.cup(0, 0); + program.write(inspect(data)); +}); + +program.clear(); diff --git a/types/blessed/index.d.ts b/types/blessed/index.d.ts index 9098648240..7dae1709d2 100644 --- a/types/blessed/index.d.ts +++ b/types/blessed/index.d.ts @@ -7,13 +7,433 @@ /// import { EventEmitter } from "events"; +import { Writable, Readable } from "stream"; import * as stream from "stream"; import * as child_process from "child_process"; -export class BlessedProgram { - hideCursor: () => void; - move: any; - showCursor: any; +export interface IBlessedProgramOptions { + input?: Readable; + output?: Writable; + log?: string; + dump?: boolean; + zero?: boolean; + buffer?: boolean; + terminal?: string; + term?: string; + tput?: string; + debug?: boolean; + resizeTimeout?: boolean; +} + +export class BlessedProgram extends EventEmitter { + type: string; + options: IBlessedProgramOptions; + input: Readable; + output: Writable; + zero: boolean; + useBuffer: boolean; + x: number; + y: number; + savedX: number; + savedY: number; + cols: number; + rows: number; + scrollTop: number; + scrollBottom: number; + isOSXTerm: boolean; + isiTerm2: boolean; + isXFCE: boolean; + isTerminator: boolean; + isLXDE: boolean; + isVTE: boolean; + isRxvt: boolean; + isXterm: boolean; + tmux: boolean; + tmuxVersion: number; + + constructor(options?: IBlessedProgramOptions); + + log(): boolean; + debug(): boolean; + setupDump(): void; + setupTput(): void; + setTerminal(terminal: string): void; + has(name: string): boolean; + term(is: string): boolean; + + listen(): void; + destroy(): void; + + key(key: string|string[], listener: Function): void; + onceKey(key: string|string[], listener: Function): void; + + unKey(key: string|string[], listener: Function): void; + removeKey(key: string|string[], listener: Function): void; + + bindMouse(): void; + enableGpm(): void; + disableGpm(): void; + bindResponse(): void; + + response(name: string, text: string, callback: Function, noBypass?: boolean): boolean; + response(name: string, callback?: Function): boolean; + + write(text: string): boolean; + flush(): void; + print(text: string, attr?: boolean): boolean; + echo(text: string, attr?: boolean): boolean; + + setx(x: number): boolean; + sety(y: number): boolean; + move(x: number, y: number): boolean; + omove(x: number, y: number): void; + rsetx(x: number): boolean; + rsety(y: number): boolean; + rmove(x: number, y: number): void; + + simpleInsert(ch: string, i?: number, attr?: boolean): boolean; + repeat(ch: string, i?: number): string; + copyToClipboard(text: string): boolean; + + cursorShape(shape: string, blink?: boolean): boolean; + cursorColor(color: string): boolean; + cursorReset(): boolean; + resetCursor(): boolean; + + getTextParams(param: string, callback: Function): boolean; + getCursorColor(callback: Function): boolean; + + nul(): boolean; + + bell(): boolean; + bel(): boolean; + + vtab(): boolean; + + form(): boolean; + ff(): boolean; + + backspace(): boolean; + kbs(): boolean; + + tab(): boolean; + ht(): boolean; + + shiftOut(): boolean; + shiftIn(): boolean; + + return(): boolean; + cr(): boolean; + + feed(): boolean; + newline(): boolean; + nl(): boolean; + + index(): boolean; + ind(): boolean; + + reverseIndex(): boolean; + reverse(): boolean; + ri(): boolean; + + nextLine(): boolean; + reset(): boolean; + tabSet(): boolean; + + saveCursor(key: string): boolean; + sc(key: string): boolean; + + restoreCursor(key?: string, hide?: boolean): boolean; + rc(key?: string, hide?: boolean): boolean; + + lsaveCursor(key?: string): void; + lrestoreCursor(key?: string, hide?: boolean): void; + + lineHeight(): boolean; + + charset(val?: string, level?: number): boolean; + + enter_alt_charset_mode(): boolean; + as(): boolean; + smacs(): boolean; + + exit_alt_charset_mode(): boolean; + ae(): boolean; + rmacs(): boolean; + + setG(val: number): boolean; + + setTitle(title: string): boolean; + + resetColors(param?: string): boolean; + + dynamicColors(param?: string): boolean; + + selData(a: string, b: string): boolean; + + cursorUp(param?: number): boolean; + cuu(param?: number): boolean; + up(param?: number): boolean; + + cursorDown(param?: number): boolean; + cud(param?: number): boolean; + down(param?: number): boolean; + + cursorForward(param?: number): boolean; + cuf(param?: number): boolean; + right(param?: number): boolean; + forward(param?: number): boolean; + + cursorBackward(param?: number): boolean; + cub(param?: number): boolean; + left(param?: number): boolean; + back(param?: number): boolean; + + cursorPos(row?: number, col?: number): boolean; + cup(row?: number, col?: number): boolean; + pos(row?: number, col?: number): boolean; + + eraseInDisplay(param?: string): boolean; + ed(param?: string): boolean; + + clear(): boolean; + + eraseInLine(param?: string): boolean; + el(param?: string): boolean; + + charAttributes(param: string, val?: boolean): boolean; + charAttributes(param: string[], val?: boolean): boolean; + + setForeground(color: string, val?: boolean): boolean; + fg(color: string, val?: boolean): boolean; + + setBackground(color: string, val?: boolean): boolean; + bg(color: string, val?: boolean): boolean; + + deviceStatuses(param?: string, callback?: Function, dec?: boolean, noBypass?: boolean): boolean; + dsr(param?: string, callback?: Function, dec?: boolean, noBypass?: boolean): boolean; + + getCursor(callback: Function): boolean; + saveReportedCursor(callback: Function): void; + + restoreReportedCursor: () => boolean; + + insertChars(param?: number): boolean; + ich(param?: number): boolean; + + cursorNextLine(param?: number): boolean; + cnl(param?: number): boolean; + + cursorPrecedingLine(param?: number): boolean; + cpl(param?: number): boolean; + + cursorCharAbsolute(param?: number): boolean; + cha(param?: number): boolean; + + insertLines(param?: number): boolean; + il(param?: number): boolean; + + deleteLines(param?: number): boolean; + dl(param?: number): boolean; + + deleteChars(param?: number): boolean; + dch(param?: number): boolean; + + eraseChars(param?: number): boolean; + ech(param?: number): boolean; + + charPosAbsolute(param?: number): boolean; + hpa(param?: number): boolean; + + HPositionRelative(param?: number): boolean; + + sendDeviceAttributes(param?: number, callback?: Function): boolean; + da(param?: number, callback?: Function): boolean; + + linePosAbsolute(param?: number): boolean; + vpa(param?: number): boolean; + + VPositionRelative(param?: number): boolean; + vpr(param?: number): boolean; + + HVPosition(row?: number, col?: number): boolean; + hvp(row?: number, col?: number): boolean; + + setMode(...args: string[]): boolean; + sm(...args: string[]): boolean; + + decset(...args: string[]): boolean; + + showCursor(): boolean; + + alternateBuffer(): boolean; + smcup(): boolean; + alternate(): boolean; + + resetMode(...args: string[]): boolean; + rm(...args: string[]): boolean; + + decrst(...args: string[]): boolean; + + hideCursor(): boolean; + civis(): boolean; + vi(): boolean; + cursor_invisible(): boolean; + dectcemh(): boolean; + + normalBuffer(): boolean; + rmcup(): boolean; + + enableMouse(): void; + disableMouse(): void; + + setMouse(opt?: {}, enable?: boolean): void; + + setScrollRegion(top: number, bottom: number): boolean; + csr(top: number, bottom: number): boolean; + decstbm(top: number, bottom: number): boolean; + + saveCursorA(): boolean; + scA(): boolean; + + restoreCursorA(): boolean; + rcA(): boolean; + + cursorForwardTab(param?: number): boolean; + cht(param?: number): boolean; + + scrollUp(param?: number): boolean; + su(param?: number): boolean; + + scrollDown(param?: number): boolean; + sd(param?: number): boolean; + + initMouseTracking(...args: string[]): boolean; + + resetTitleModes(...args: string[]): boolean; + + cursorBackwardTab(param?: number): boolean; + cbt(param?: number): boolean; + + repeatPrecedingCharacter(param?: number): boolean; + rep(param?: number): boolean; + + tabClear(param?: number): boolean; + tbc(param?: number): boolean; + + mediaCopy(...args: string[]): boolean; + mc(...args: string[]): boolean; + + mc0(): boolean; + print_screen(): boolean; + ps(): boolean; + + mc5(): boolean; + prtr_on(): boolean; + po(): boolean; + + mc4(): boolean; + prtr_off(): boolean; + pf(): boolean; + + mc5p(): boolean; + prtr_non(): boolean; + p0(): boolean; + + setResources(...args: string[]): boolean; + + disableModifieres(...args: string[]): boolean; + + setPointerMode(...args: string[]): boolean; + + softReset(): boolean; + rs2(): boolean; + decstr(): boolean; + + requestAnsiMode(param?: number): boolean; + decrqm(param?: number): boolean; + + requestPrivateMode(param?: number): boolean; + decrqmp(param?: number): boolean; + + setConformanceLevel(...args: string[]): boolean; + decscl(...args: string[]): boolean; + + loadLEDs(param?: number): boolean; + decll(param?: number): boolean; + + setCursorStyle(param?: string): boolean; + decscursr(param?: string): boolean; + + setCharProtectionAttr(param?: number): boolean; + decsca(param?: number): boolean; + + restorePrivateValues(...args: string[]): boolean; + + setAttrInRectangle(...args: string[]): boolean; + deccara(...args: string[]): boolean; + + savePrivateValues(...args: string[]): boolean; + + manipulateWindow(...args: any[]): boolean; + + getWindowSize(callback?: Function): boolean; + + reverseAttrInRectangle(...args: string[]): boolean; + decrara(...args: string[]): boolean; + + setTitleModeFeature(...args: string[]): boolean; + + setWarningBellVolume(param?: number): boolean; + decswbv(param?: number): boolean; + + setMarginBellVolume(param?: number): boolean; + + copyRectangle(...args: string[]): boolean; + deccra(...args: string[]): boolean; + + enableFilterRectangle(...args: string[]): boolean; + decefr(...args: string[]): boolean; + + requestParameters(param?: number): boolean; + decreqtparm(param: number): boolean; + + selectChangeExtent(param?: number): boolean; + decsace(param?: number): boolean; + + fillRectangle(...args: string[]): boolean; + decfra(...args: string[]): boolean; + + enableLocatorReporting(...args: string[]): boolean; + decelr(...args: string[]): boolean; + + eraseRectangle(...args: string[]): boolean; + decera(...args: string[]): boolean; + + setLocatorEvents(...args: string[]): boolean; + decsle(...args: string[]): boolean; + + selectiveEraseRectangle(...args: string[]): boolean; + decsera(...args: string[]): boolean; + + requestLocatorPosition(param?: string, callback?: Function): boolean; + reqmp(param?: string, callback?: Function): boolean; + req_mouse_pos(param?: string, callback?: Function): boolean; + decrqlp(param?: string, callback?: Function): boolean; + + insertColumns(...args: string[]): boolean; + decic(...args: string[]): boolean; + + deleteColumns(...args: string[]): boolean; + decdc(...args: string[]): boolean; + + out(param: string, ...args: any[]): boolean; + + sigtstp(callback?: Function): boolean; + + pause(callback?: Function): Function; + + resume: () => void; } export namespace Widgets { @@ -516,7 +936,7 @@ export namespace Widgets { * Debug mode. Enables usage of the debug method. Also creates a debug console which will display when * pressing F12. It will display all log and debug messages. */ - debug?(...msg: string[]): void; + debug?: boolean; /** * Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful @@ -963,7 +1383,7 @@ export namespace Widgets { /** * Spawn a process in the foreground, return to blessed app after exit. */ - spawn(file: string, args: string[], options: NodeChildProcessExecOptions): child_process.ChildProcess; + spawn(file: string, args?: string[], options?: NodeChildProcessExecOptions): child_process.ChildProcess; /** * Spawn a process in the foreground, return to blessed app after exit. Executes callback on error or exit. @@ -3024,6 +3444,7 @@ export function message(options?: Widgets.MessageOptions): Widgets.MessageElemen export function loading(options?: Widgets.LoadingOptions): Widgets.LoadingElement; export function log(options?: Widgets.LogOptions): Widgets.Log; export function progressbar(options?: Widgets.ProgressBarOptions): Widgets.ProgressBarElement; +export function program(options?: Widgets.IScreenOptions): BlessedProgram; export function terminal(options?: Widgets.TerminalOptions): Widgets.TerminalElement; export function layout(options?: Widgets.LayoutOptions): Widgets.LayoutElement; export function escape(item: any): any; diff --git a/types/blob-to-buffer/tsconfig.json b/types/blob-to-buffer/tsconfig.json index 2421ce2493..37848b0516 100644 --- a/types/blob-to-buffer/tsconfig.json +++ b/types/blob-to-buffer/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "blob-to-buffer-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bluebird-global/index.d.ts b/types/bluebird-global/index.d.ts index c0e220ce07..6b22cb7114 100644 --- a/types/bluebird-global/index.d.ts +++ b/types/bluebird-global/index.d.ts @@ -31,6 +31,22 @@ * in the runtime. Do this by either importing bluebird.js via a ` header necessary for Browser Monitoring. + * + * This script must be manually injected into your templates, as high as possible + * in the header, but _after_ any X-UA-COMPATIBLE HTTP-EQUIV meta tags. + * Otherwise you may hurt IE! + * + * This method must be called _during_ a transaction, and must be called every + * time you want to generate the headers. + * + * Do *not* reuse the headers between users, or even between requests. + */ + getBrowserTimingHeader(): string; + + /** + * Instrument a particular callback to improve visibility into a transaction. + * + * Use this API call to improve instrumentation of a particular method, or to track work across asynchronous + * boundaries by calling createTracer() in both the target function and its parent asynchronous function. + * + * The name will be visible in transaction traces and as a new metric in the New Relic UI. + * + * The agent begins timing the segment when createTracer is called, and ends the segment when the callback + * defined by the callback argument finishes executing. + */ + createTracer any>(name: string, handle: T): T; + + /** + * Creates and starts a web transaction to record work done in the handle supplied. + * + * This transaction will run until the handle + * synchronously returns UNLESS: + * 1. The handle function returns a promise, where the end of the + * transaction will be tied to the end of the promise returned. + * 2. `getTransaction` is called in the handle, flagging the + * transaction as externally handled. In this case the transaction + * will be ended when `TransactionHandle#end` is called in the user's code. + * + * @example + * var newrelic = require('newrelic') + * newrelic.startWebTransaction('/some/url/path', function() { + * var transaction = newrelic.getTransaction() + * setTimeout(function() { + * // do some work + * transaction.end() + * }, 100) + * }) + * + * The `url` is used to name and group related transactions in APM, + * so it should be a generic name and not include any variable parameters. + */ + startWebTransaction(url: string, handle: (...args: any[]) => any): any; + + /** + * Creates and starts a background transaction to record work done in the handle supplied. + * + * This transaction will run until the handle + * synchronously returns UNLESS: + * 1. The handle function returns a promise, where the end of the + * transaction will be tied to the end of the promise returned. + * 2. `API#getTransaction` is called in the handle, flagging the + * transaction as externally handled. In this case the transaction + * will be ended when `TransactionHandle#end` is called in the user's code. + * + * @example + * var newrelic = require('newrelic') + * newrelic.startBackgroundTransaction('Red October', 'Subs', function() { + * var transaction = newrelic.getTransaction() + * setTimeout(function() { + * // do some work + * transaction.end() + * }, 100) + * }) + * + * The `url` is used to name and group related transactions in APM, + * so it should be a generic name and not include any variable parameters. + * + * The optional `group can be used for grouping background transactions in APM. + * For more information see: + * https://docs.newrelic.com/docs/apm/applications-menu/monitoring/transactions-page#txn-type-dropdown + */ + startBackgroundTransaction(name: string, handle: (...args: any[]) => any): any; + startBackgroundTransaction(name: string, group: string, handle: (...args: any[]) => any): any; + + /** + * End the current web or background custom transaction. + * + * This method requires being in the correct transaction context when called. + */ + endTransaction(): void; + + /** + * Record an event-based metric, usually associated with a particular duration. + * + * The `name` must be a string following standard metric naming rules. The `value` will + * usually be a number, but it can also be an object. + * * When `value` is a numeric value, it should represent the magnitude of a measurement + * associated with an event; for example, the duration for a particular method call. + * * When `value` is an object, it must contain count, total, min, max, and sumOfSquares + * keys, all with number values. This form is useful to aggregate metrics on your own + * and report them periodically; for example, from a setInterval. These values will + * be aggregated with any previously collected values for the same metric. The names + * of these keys match the names of the keys used by the platform API. + */ + recordMetric(name: string, value: number | Metric): void; + + /** + * Update a metric that acts as a simple counter. + * + * The count of the selected metric will be incremented by the specified amount, defaulting to 1. + */ + incrementMetric(name: string, value?: number): void; + + /** + * Record an event-based metric, usually associated with a particular duration. + * + * `eventType` must be an alphanumeric string less than 255 characters. + * The keys of `attributes` must be shorter than 255 characters. + */ + recordCustomEvent(eventType: string, attributes: { [keys: string]: boolean | number | string }): void; + + /** + * Registers an instrumentation function. + * + * The provided onRequire callback will be fired when the given module is loaded with require. + * The moduleName parameter should be the string that will be passed to require; + * for example, 'express' or 'amqplib/callback_api'. + * + * The optional onError callback is called if the onRequire parameters throws an error. + * This is useful for debugging your instrumentation. + * + * Use this method to: + * - Add instrumentation for modules not currently instrumented by New Relic. + * - Instrument your own code. + * - Replace the Node.js agent's built-in instrumentation with your own. + */ + instrument: Instrument; + + /** + * Sets an instrumentation callback for a datastore module. + * + * This method is just like `instrument`, except it provides a datastore-service-specialized shim. + */ + instrumentDatastore: Instrument; + + /** + * Sets an instrumentation callback for a web framework module. + * + * This method is just like `instrument`, except it provides a web-framework-specialized shim. + */ + instrumentWebframework: Instrument; + + /** + * Sets an instrumentation callback for a message service client module. + * + * This method is just like `instrument`, except it provides a message-service-specialized shim. + */ + instrumentMessages: Instrument; + + /** + * Gracefully shuts down the agent. + * + * If `collectPendingData` is true, the agent will send any pending data to the collector + * before shutting down. Defaults to `false`. + */ + shutdown(cb?: (error?: Error) => void): void; + shutdown(options?: { collectPendingData?: boolean, timeout?: number }, cb?: (error?: Error) => void): void; + } + + interface Instrument { + (opts: { moduleName: string, onRequire: () => void, onError?: (err: Error) => void }): void; + (moduleName: string, onRequire: () => void, onError?: (err: Error) => void): void; + } + + interface Metric { + count: number; + total: number; + min: number; + max: number; + sumOfSquares: number; + } + + interface TransactionHandle { + /** + * End the transaction. + */ + end(callback?: () => any): void; + + /** + * Mark the transaction to be ignored. + */ + ignore(): void; + } +} +declare const api: newrelic.NewRelicAPI; +export = api; diff --git a/types/newrelic/newrelic-tests.ts b/types/newrelic/newrelic-tests.ts new file mode 100644 index 0000000000..73cd53cc78 --- /dev/null +++ b/types/newrelic/newrelic-tests.ts @@ -0,0 +1,98 @@ +/// +import * as newrelic from "newrelic"; + +newrelic.setTransactionName("foo"); // $ExpectType void + +const trans = newrelic.getTransaction(); +trans.ignore(); // $ExpectType void +trans.end(); // $ExpectType void +trans.end(() => { }); // $ExpectType void + +newrelic.setDispatcher("foo"); // $ExpectType void +newrelic.setDispatcher("foo", "42"); // $ExpectType void + +newrelic.setControllerName("foo", "GET"); // $ExpectType void + +newrelic.addCustomAttribute("foo", "bar"); // $ExpectType void +newrelic.addCustomAttributes({ foo: "bar", baz: "bang" }); // $ExpectType void + +newrelic.setIgnoreTransaction(true); // $ExpectType void + +newrelic.noticeError(Error("Oh no!")); // $ExpectType void +newrelic.noticeError(Error("Oh no!"), { foo: "bar" }); // $ExpectType void + +newrelic.addNamingRule("/user/customers/all/.*", "/user/customers/all"); // $ExpectType void +newrelic.addNamingRule(/\/user\/customers\/.*/, "/user/customers/:customer"); // $ExpectType void + +newrelic.addIgnoringRule("^/items/[0-9]+$"); // $ExpectType void +newrelic.addIgnoringRule(/^[0-9]+$/); // $ExpectType void + +newrelic.getBrowserTimingHeader(); // $ExpectType string + +const wrappedFn = newrelic.createTracer("foo", (x: number) => { + return x * x; +}); +const wrappedResult: number = wrappedFn(42); + +newrelic.startWebTransaction('/some/url/path', () => { + const transaction = newrelic.getTransaction(); + Promise.all([]); + setTimeout(() => { + // do some work + transaction.end(); + }, 100); +}); + +newrelic.startBackgroundTransaction('Red October', (foo) => foo); // $ExpectType any +newrelic.startBackgroundTransaction('Red October', 'Subs', () => { + const transaction = newrelic.getTransaction(); + setTimeout(() => { + // do some work + transaction.end(); + }, 100); +}); + +newrelic.endTransaction(); // $ExpectType void + +newrelic.recordMetric("foo", 42); // $ExpectType void +newrelic.recordMetric("foo", { + count: 10, + total: 42, + min: 1, + max: 17, + sumOfSquares: 60, +}); + +newrelic.incrementMetric("foo"); // $ExpectType void +newrelic.incrementMetric("foo", 42); // $ExpectType void + +newrelic.recordCustomEvent("my_event", { + foo: true, + bar: 42, + baz: "don't panic", +}); + +newrelic.instrument("foo", () => { }); // $ExpectType void +newrelic.instrumentDatastore("foo", () => { }, (err: Error) => { }); +newrelic.instrumentWebframework({ + moduleName: "foo", + onRequire: () => { }, +}); +newrelic.instrumentMessages({ + moduleName: "foo", + onRequire: () => { }, + onError: (err) => { + const error: Error = err; + }, +}); + +newrelic.shutdown(); // $ExpectType void +newrelic.shutdown({ collectPendingData: true }); +newrelic.shutdown({ timeout: 3000 }); +newrelic.shutdown({ collectPendingData: true, timeout: 3000 }); +newrelic.shutdown({ collectPendingData: true, timeout: 3000 }, (err) => { + const error: Error | undefined = err; +}); +newrelic.shutdown((err) => { + const error: Error | undefined = err; +}); diff --git a/types/newrelic/tsconfig.json b/types/newrelic/tsconfig.json new file mode 100644 index 0000000000..479dde054f --- /dev/null +++ b/types/newrelic/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", + "newrelic-tests.ts" + ] +} \ No newline at end of file diff --git a/types/newrelic/tslint.json b/types/newrelic/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/newrelic/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/next-redux-wrapper/index.d.ts b/types/next-redux-wrapper/index.d.ts index a6b1da550e..38e20f608a 100644 --- a/types/next-redux-wrapper/index.d.ts +++ b/types/next-redux-wrapper/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/kirill-konshin/next-redux-wrapper // Definitions by: Steve // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 /// /*~ Note that ES6 modules cannot directly export callable functions. diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 70bc8ef049..036e9f58ce 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Drew Hays // Brice BERNARD // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/ngreact/index.d.ts b/types/ngreact/index.d.ts index cb39e45ee1..6db92506ce 100644 --- a/types/ngreact/index.d.ts +++ b/types/ngreact/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ngReact/ngReact // Definitions by: Vicky Lai // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// /// diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index 737137f22e..061f22bd10 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/segmentio/nightmare // Definitions by: horiuchi // Sam Yang +// Bleser // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -132,6 +133,10 @@ declare class Nightmare { declare namespace Nightmare { export interface IConstructorOptions { timeout?: any; // number | string; + waitTimeout?:number //in ms + gotoTimeout?:number + pollInterval?:number + executionTimeout?:number interval?: any; // number | string; port?: number; weak?: boolean; diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index 1dfe655c94..7eb376b996 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -4,27 +4,27 @@ import Nightmare = require("nightmare"); new Nightmare() .goto('http://yahoo.com') - .type('input[title="Search"]', 'github nightmare') - .click('.searchsubmit') - .run((err: any, nightmare: Nightmare) => { - if (err) return console.log(err); - console.log('Done!'); - }); + .type('input[title="Search"]', 'github nightmare') + .click('.searchsubmit') + .run((err: any, nightmare: Nightmare) => { + if (err) return console.log(err); + console.log('Done!'); + }); new Nightmare() .goto('http://yahoo.com') - .type('input[title="Search"]', 'github nightmare') - .click('.searchsubmit') - .wait('.url.breadcrumb') - .evaluate(() => { - return (document.querySelector('.url.breadcrumb')).innerText; - }, (breadcrumb: string) => { - // expect(breadcrumb).to.equal('github.com'); - }) - .run((err: any, nightmare: Nightmare) => {}); + .type('input[title="Search"]', 'github nightmare') + .click('.searchsubmit') + .wait('.url.breadcrumb') + .evaluate(() => { + return (document.querySelector('.url.breadcrumb')).innerText; + }, (breadcrumb: string) => { + // expect(breadcrumb).to.equal('github.com'); + }) + .run((err: any, nightmare: Nightmare) => { }); -var done = (err: any) => {}; +var done = (err: any) => { }; new Nightmare() .goto('http://www.google.com/') @@ -141,7 +141,7 @@ new Nightmare() }; }, function (coordinates) { }) - .scrollTo(100,50) + .scrollTo(100, 50) .evaluate(function () { return { top: document.body.scrollTop, @@ -174,12 +174,12 @@ new Nightmare() new Nightmare() .goto('http://yahoo.com') - .screenshot('test/test.png', { x: 10, y: 5, width: 10, height: 10}) + .screenshot('test/test.png', { x: 10, y: 5, width: 10, height: 10 }) .run(done); new Nightmare() .goto('http://yahoo.com') - .screenshot({ x: 10, y: 5, width: 10, height: 10}, (err, buffer) => { + .screenshot({ x: 10, y: 5, width: 10, height: 10 }, (err, buffer) => { console.log(Buffer.isBuffer(buffer)); }) .run(done); @@ -197,7 +197,7 @@ new Nightmare() var seconds = function () { var gifs = document.querySelectorAll('img'); - var split = (gifs[gifs.length-2]).src.split('.gif')[0]; + var split = (gifs[gifs.length - 2]).src.split('.gif')[0]; var seconds = split.split('.com/c')[1]; return parseInt(seconds, 10); }; @@ -209,8 +209,8 @@ new Nightmare() var seconds = function () { var text = document.querySelectorAll('b')[0].textContent; var splits = text.split(/\s/); - var seconds = splits[splits.length-2].split(':')[2]; - return parseInt(seconds, 10)%10; + var seconds = splits[splits.length - 2].split(':')[2]; + return parseInt(seconds, 10) % 10; }; new Nightmare() .goto('http://www.whattimeisit.com/') @@ -218,8 +218,8 @@ new Nightmare() .run(done); new Nightmare({ - timeout: 1000 - }) + timeout: 1000 +}) .on('timeout', function (msg) { }) .goto('http://www.google.com/') @@ -262,15 +262,15 @@ new Nightmare() .run(done); new Nightmare() - .authentication('my','auth') + .authentication('my', 'auth') .goto('http://httpbin.org/basic-auth/my/auth') .evaluate(function () { return document.body.innerHTML; - }, function (data){ + }, function (data) { }) .run(done); -var size = { width : 400, height: 1000 }; +var size = { width: 400, height: 1000 }; new Nightmare() .viewport(size.width, size.height) .goto('http://www.wikipedia.org/') @@ -316,8 +316,8 @@ function search(term: string) { return function (nightmare: Nightmare) { nightmare .goto('http://yahoo.com') - .type('.input-query', term) - .click('.searchsubmit') + .type('.input-query', term) + .click('.searchsubmit') .wait(); }; } @@ -335,7 +335,7 @@ new Nightmare() .use(testTitle('test term')) .run(done); -new Nightmare({show: true}); +new Nightmare({ show: true }); new Nightmare() .goto('http://google.com', { bogus: 'foo' }) @@ -366,4 +366,28 @@ new Nightmare() .click('a[href="/segmentio/nightmare/archive/master.zip"]') .download('/some/other/path/master.zip'); -new Nightmare({show: true, openDevTools: {mode: 'detach'}}); +new Nightmare({ show: true, openDevTools: { mode: 'detach' } }); + + +new Nightmare({ waitTimeout: 1000 }) + .goto("https//google.com") + .wait(".really-not-real") + + +new Nightmare({ gotoTimeout: 10000 }) + .goto("https://45.56.178.93/") + + +new Nightmare({ executionTimeout: 1000 }) + .goto("https//google.com") + .evaluate(() => { + new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, 2000) + }) + }) + + + + diff --git a/types/nock/index.d.ts b/types/nock/index.d.ts index 8c6e4f2faf..91037b8e54 100644 --- a/types/nock/index.d.ts +++ b/types/nock/index.d.ts @@ -4,6 +4,7 @@ // Horiuchi_H // afharo // Matt R. Wilson +// Garanzha Dmitriy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -34,7 +35,7 @@ declare namespace nock { export var back: NockBack; - type HttpHeaders = { [key: string]: string | { (req: any, res: any, body: string): any; }; }; + type HttpHeaders = { [key: string]: string | string[] | { (req: any, res: any, body: string): any; }; }; type InterceptFunction = ( uri: string | RegExp | { (uri: string): boolean; }, requestBody?: string | RegExp | { (body: any): boolean; } | any, diff --git a/types/nock/nock-tests.ts b/types/nock/nock-tests.ts index 180c7a9c63..44397db941 100644 --- a/types/nock/nock-tests.ts +++ b/types/nock/nock-tests.ts @@ -1,6 +1,4 @@ - - -import * as nock from 'nock'; +import nock = require('nock'); import * as fs from 'fs'; var scope: nock.Scope; @@ -368,6 +366,12 @@ var scope = nock('http://www.headdy.com') 'X-My-Headers': 'My Header value' }); +var scope = nock('http://www.headdy.com') + .get('/') + .reply(200, 'Hello World!', { + 'X-My-Headers': ['My Header value 1', 'My Header value 2'] + }); + var scope = nock('http://www.headdy.com') .get('/') .reply(200, 'Hello World!', { diff --git a/types/node-cron/index.d.ts b/types/node-cron/index.d.ts new file mode 100644 index 0000000000..75ddaefdde --- /dev/null +++ b/types/node-cron/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for node-cron 1.2 +// Project: http://merencia.com/node-cron/ +// Definitions by: morsic +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// immediateStart - default true +export function schedule(a: string, func: () => void, immediateStart?: boolean): ScheduledTask; + +export function validate(a: string): boolean; + +export interface ScheduledTask { + start: () => this; + stop: () => this; + destroy: () => void; +} diff --git a/types/node-cron/node-cron-tests.ts b/types/node-cron/node-cron-tests.ts new file mode 100644 index 0000000000..c670924d27 --- /dev/null +++ b/types/node-cron/node-cron-tests.ts @@ -0,0 +1,47 @@ +/// + +import cron = require('node-cron'); + +// tslint:disable-next-line no-console +const log = console.log; + +cron.schedule('* * * * *', () => { + log('running a task every minute'); +}); + +cron.schedule('1-5 * * * *', () => { + log('running every minute to 1 from 5'); +}); + +// tslint:disable-next-line rule +const task = cron.schedule('* * * * *', () => { + log('immediately started'); + // because of manual call start method +}, false); + +task.start(); + +const task1 = cron.schedule('* * * * *', () => { + log('will execute every minute until stopped'); +}); + +task1.start(); + +const task2 = cron.schedule('* * * * *', () => { + log('will execute every minute until stopped'); +}); + +task2.stop(); + +const task3 = cron.schedule('* * * * *', () => { + log('will execute every minute until stopped'); +}); + +task3.destroy(); + +const valid = cron.validate('59 * * * *'); +const invalid = cron.validate('60 * * * *'); + +if (valid && !invalid) { + log('validator works'); +} diff --git a/types/node-cron/tsconfig.json b/types/node-cron/tsconfig.json new file mode 100644 index 0000000000..9fb50ab907 --- /dev/null +++ b/types/node-cron/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "strictNullChecks": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "strictFunctionTypes": true, + "noUnusedParameters": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "node-cron-tests.ts" + ] +} \ No newline at end of file diff --git a/types/node-cron/tslint.json b/types/node-cron/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/node-cron/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index a5d3f078fe..2784d95fa3 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -14,7 +14,7 @@ declare module "node-forge" { type Utf8 = string; type OID = string; - namespace pem { + namespace pem { interface EncodeOptions { maxline?: number; @@ -32,7 +32,7 @@ declare module "node-forge" { function encode(msg: ObjectPEM, options?: EncodeOptions): string; function decode(str: string): ObjectPEM[]; } - + namespace pki { type PEM = string; @@ -79,10 +79,11 @@ declare module "node-forge" { interface CertificateField extends CertificateFieldOptions { valueConstructed?: boolean; valueTagClass?: asn1.Class; - value?: any[]; + value?: any[] | string; extensions?: any[]; } + interface Certificate { version: number; serialNumber: string; @@ -107,11 +108,61 @@ declare module "node-forge" { extensions: any[]; publicKey: any; md: any; + /** + * Sets the subject of this certificate. + * + * @param attrs the array of subject attributes to use. + * @param uniqueId an optional a unique ID to use. + */ + setSubject(attrs: CertificateField[], uniqueId?: string): void; + /** + * Sets the subject of this certificate. + * + * @param attrs the array of subject attributes to use. + * @param uniqueId an optional a unique ID to use. + */ + setIssuer(attrs: CertificateField[], uniqueId?: string): void; + /** + * Sets the extensions of this certificate. + * + * @param exts the array of extensions to use. + */ + setExtensions(exts: any[]): void; + /** + * Gets an extension by its name or id. + * + * @param options the name to use or an object with: + * name the name to use. + * id the id to use. + * + * @return the extension or null if not found. + */ + getExtension(options: string | {name: string;} | {id: number;}): {} | undefined; + + /** + * Signs this certificate using the given private key. + * + * @param key the private key to sign with. + * @param md the message digest object to use (defaults to forge.md.sha1). + */ + sign(key: pki.Key, md: md.MessageDigest): void; + /** + * Attempts verify the signature on the passed certificate using this + * certificate's public key. + * + * @param child the certificate to verify. + * + * @return true if verified, false if not. + */ + verify(child: Certificate): boolean; + } function certificateFromAsn1(obj: asn1.Asn1, computeHash?: boolean): Certificate; function decryptRsaPrivateKey(pem: PEM, passphrase?: string): Key; + + function createCertificate(): Certificate; } namespace ssh { diff --git a/types/node-forge/node-forge-tests.ts b/types/node-forge/node-forge-tests.ts index 63ccca6c70..29b8267714 100644 --- a/types/node-forge/node-forge-tests.ts +++ b/types/node-forge/node-forge-tests.ts @@ -1,4 +1,4 @@ -import * as forge from "node-forge"; +import * as forge from 'node-forge'; let keypair = forge.pki.rsa.generateKeyPair({ bits: 512 }); let privateKeyPem = forge.pki.privateKeyToPem(keypair.privateKey); @@ -8,19 +8,23 @@ let x: string = forge.ssh.privateKeyToOpenSSH(key); let pemKey: forge.pki.PEM = publicKeyPem; let publicKeyRsa = forge.pki.publicKeyFromPem(pemKey); let privateKeyRsa = forge.pki.privateKeyFromPem(privateKeyPem); +let cert = forge.pki.createCertificate(); { let subjectPublicKeyInfo = forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.SEQUENCE, true, [ forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.SEQUENCE, true, [ - forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.OID, false, - forge.asn1.oidToDer(forge.pki.oids['rsaEncryption']).getBytes(), + forge.asn1.create( + forge.asn1.Class.UNIVERSAL, + forge.asn1.Type.OID, + false, + forge.asn1.oidToDer(forge.pki.oids['rsaEncryption']).getBytes() ), - forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.NULL, false, ''), + forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.NULL, false, '') ]), forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.BITSTRING, false, [ forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.SEQUENCE, true, [ forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.INTEGER, false, []), - forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.INTEGER, false, []), + forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.INTEGER, false, []) ]) ]) ]); @@ -52,12 +56,14 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin src = new Uint8Array(2); encode = forge.util.binary.hex.encode(src); decode = forge.util.binary.hex.decode(encode); - if (encode !== '0000' || src.byteLength !== decode.byteLength) throw Error('forge.util.binary.hex.encode / decode fail'); + if (encode !== '0000' || src.byteLength !== decode.byteLength) + throw Error('forge.util.binary.hex.encode / decode fail'); src = new Uint8Array(2); encode = forge.util.binary.base64.encode(src); decode = forge.util.binary.base64.decode(encode); - if (encode !== 'AAA=' || src.byteLength !== decode.byteLength) throw Error('forge.util.binary.base64.encode / decode fail'); + if (encode !== 'AAA=' || src.byteLength !== decode.byteLength) + throw Error('forge.util.binary.base64.encode / decode fail'); src = new Uint8Array(10); encode = forge.util.binary.raw.encode(src); @@ -97,7 +103,6 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin if (hex.length !== 40) throw Error('forge.md.MessageDigest.update / digest fail'); } - { let md: forge.md.MessageDigest; let hex: string; @@ -110,26 +115,74 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin } { - let payload = { "asd": "asd" } - let cipher = forge.cipher.createCipher( - "3DES-ECB", - forge.util.createBuffer(key, "raw") - ); + let payload = { asd: 'asd' }; + let cipher = forge.cipher.createCipher('3DES-ECB', forge.util.createBuffer(key, 'raw')); cipher.start(); - cipher.update(forge.util.createBuffer(JSON.stringify(payload), "raw")); + cipher.update(forge.util.createBuffer(JSON.stringify(payload), 'raw')); cipher.finish(); let encrypted = cipher.output; let token = forge.util.encode64(encrypted.getBytes()); - let decipher = forge.cipher.createDecipher( - "3DES-ECB", - forge.util.createBuffer(key, "raw") - ); + let decipher = forge.cipher.createDecipher('3DES-ECB', forge.util.createBuffer(key, 'raw')); decipher.start(); - decipher.update(forge.util.createBuffer(forge.util.decode64(token), "raw")); + decipher.update(forge.util.createBuffer(forge.util.decode64(token), 'raw')); decipher.finish(); let decrypted = decipher.output as forge.util.ByteStringBuffer; let content = JSON.parse(forge.util.encodeUtf8(decrypted.getBytes())); if (content.asd == payload.asd) throw Error('forge.cipher.createCipher failed'); -} \ No newline at end of file +} + +{ + cert.publicKey = keypair.publicKey; + cert.serialNumber = new Date().getTime() + ''; + cert.validity.notBefore = new Date(); + cert.validity.notAfter = new Date(); + cert.validity.notAfter.setFullYear(cert.validity.notAfter.getFullYear() + 20); + const attrs = [ + { + name: 'commonName', + value: 'x22x22' + }, + { + name: 'countryName', + value: 'GitHub' + }, + { + shortName: 'ST', + value: 'GitHub' + }, + { + name: 'localityName', + value: 'GitHub' + }, + { + name: 'organizationName', + value: 'x22x22' + }, + { + shortName: 'OU', + value: 'https://github.com/x22x22' + } + ]; + cert.setSubject(attrs); + cert.setIssuer(attrs); + cert.setExtensions([ + { + name: 'basicConstraints', + critical: true, + cA: true + }, + { + name: 'keyUsage', + critical: true, + keyCertSign: true + }, + { + name: 'subjectKeyIdentifier' + } + ]); + + // self-sign certificate + cert.sign(keypair.privateKey, forge.md.sha256.create()); +} diff --git a/types/node-geocoder/node-geocoder-tests.ts b/types/node-geocoder/node-geocoder-tests.ts index 33ed4b3036..bb554d03ba 100644 --- a/types/node-geocoder/node-geocoder-tests.ts +++ b/types/node-geocoder/node-geocoder-tests.ts @@ -1,4 +1,4 @@ -import * as NodeGeocoder from 'node-geocoder'; +import NodeGeocoder = require('node-geocoder'); const geocoder = NodeGeocoder({ provider: 'google', diff --git a/types/node-horseman/tsconfig.json b/types/node-horseman/tsconfig.json index 5490648512..8ac7d67c3e 100644 --- a/types/node-horseman/tsconfig.json +++ b/types/node-horseman/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "node-horseman-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/node-powershell/node-powershell-tests.ts b/types/node-powershell/node-powershell-tests.ts index a60f9db331..186d0bd68e 100644 --- a/types/node-powershell/node-powershell-tests.ts +++ b/types/node-powershell/node-powershell-tests.ts @@ -1,4 +1,4 @@ -import * as nodePowershell from 'node-powershell'; +import nodePowershell = require('node-powershell'); var options: nodePowershell.ShellOptions = { debugMsg: true diff --git a/types/node-rsa/node-rsa-tests.ts b/types/node-rsa/node-rsa-tests.ts index e210d5b68d..0f8defacbd 100644 --- a/types/node-rsa/node-rsa-tests.ts +++ b/types/node-rsa/node-rsa-tests.ts @@ -1,4 +1,4 @@ -import * as NodeRSA from 'node-rsa'; +import NodeRSA = require('node-rsa'); const key = new NodeRSA({ b: 512 }); diff --git a/types/node-sass-middleware/node-sass-middleware-tests.ts b/types/node-sass-middleware/node-sass-middleware-tests.ts index bfc755a424..34820155ed 100644 --- a/types/node-sass-middleware/node-sass-middleware-tests.ts +++ b/types/node-sass-middleware/node-sass-middleware-tests.ts @@ -1,6 +1,5 @@ - -import * as express from "express"; -import * as sassMiddleware from "node-sass-middleware"; +import express = require("express"); +import sassMiddleware = require("node-sass-middleware"); import * as path from "path"; var app = express(); app.use(sassMiddleware({ diff --git a/types/node-sprite-generator/node-sprite-generator-tests.ts b/types/node-sprite-generator/node-sprite-generator-tests.ts index 23309cea6d..7490d84865 100644 --- a/types/node-sprite-generator/node-sprite-generator-tests.ts +++ b/types/node-sprite-generator/node-sprite-generator-tests.ts @@ -1,5 +1,5 @@ -import * as nsg from 'node-sprite-generator'; -import * as express from 'express'; +import nsg = require('node-sprite-generator'); +import express = require('express'); const app = express(); app.use(nsg.middleware({ diff --git a/types/node-vault/index.d.ts b/types/node-vault/index.d.ts index 653db37e85..835e364ae7 100644 --- a/types/node-vault/index.d.ts +++ b/types/node-vault/index.d.ts @@ -122,7 +122,5 @@ declare namespace NodeVault { } } -type GetClient = (options?: NodeVault.VaultOptions) => NodeVault.client; - -declare const getClient: GetClient; -export = getClient; +declare function NodeVault(options?: NodeVault.VaultOptions): NodeVault.client; +export = NodeVault; diff --git a/types/node-vault/node-vault-tests.ts b/types/node-vault/node-vault-tests.ts index d6d85980a1..506514cc92 100644 --- a/types/node-vault/node-vault-tests.ts +++ b/types/node-vault/node-vault-tests.ts @@ -1,7 +1,7 @@ -import * as nv from "node-vault"; +import nv = require("node-vault"); // Test code came from the sample code in README of the module. -const options = { +const options: nv.VaultOptions = { apiVersion: 'v1', // default endpoint: 'http://127.0.0.1:8200', // default token: '1234', // optional client token; can be fetched after valid initialization of the server diff --git a/types/node-waves/index.d.ts b/types/node-waves/index.d.ts deleted file mode 100644 index fd2cb4937c..0000000000 --- a/types/node-waves/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Type definitions for node-waves 0.7 -// Project: http://fian.my.id/Waves -// Definitions by: Stephen Lautier -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export type ElementTarget = string | Element | Element[]; - -export interface WavesConfig { - /** - * Determines how long the waves effect duration (in milliseconds). - * - */ - duration?: number; - - /** - * Delay amount to show waves effect on touch and hide the effect if user scrolls. - * Set to 0 to disable delay (in milliseconds). - * - */ - delay?: number; -} - -export interface RippleOptions { - /** - * Specify how long to wait between starting and stopping the ripple. - * - */ - wait?: number | null; - - /** - * Specify the position inside the element. - * - */ - position?: { - x: number; - y: number; - } | null; -} - -/** - * Initializes waves with an optional config. - */ -export function init(config?: WavesConfig): void; - -/** - * Attach ripple effect by adding `.waves-effect` to HTML element. - * Make sure you call `init` to activate the ripple. - * - * @param elements elements to target. - * @param classes classes to add. - */ -export function attach(elements: ElementTarget, classes?: string | string[]): void; - -/** - * Creates a ripple effect in HTML element programmatically. - * @param elements elements to target (must have `.waves-effect` already applied, ideally via `attach`). - * @param options specify how long to wait between starting and stopping the ripple, and it's position inside the element. - */ -export function ripple(elements: ElementTarget, options?: RippleOptions): void; - -/** - * Removes all ripples from inside an element immediately. - * - * @param elements elements to remove ripples from. - */ -export function calm(elements: ElementTarget): void; diff --git a/types/node-waves/node-waves-tests.ts b/types/node-waves/node-waves-tests.ts deleted file mode 100644 index b9eac6682e..0000000000 --- a/types/node-waves/node-waves-tests.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { init, ripple, attach, calm } from "node-waves"; - -init({ delay: 300 }); - -attach("button", "waves-light"); - -ripple(".box", { wait: null }); - -calm(".box"); diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 8f4e6cf636..717b906b28 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Node.js 9.3.x +// Type definitions for Node.js 9.4.x // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -18,6 +18,7 @@ // Hannes Magnusson // Alberto Schiabel // Klaus Meinhardt +// Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -113,17 +114,22 @@ declare function clearImmediate(immediateId: any): void; // TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version. interface NodeRequireFunction { -/* tslint:disable-next-line:callable-types */ + /* tslint:disable-next-line:callable-types */ (id: string): any; } interface NodeRequire extends NodeRequireFunction { - resolve(id: string): string; + resolve: RequireResolve; cache: any; extensions: NodeExtensions; main: NodeModule | undefined; } +interface RequireResolve { + (id: string, options?: { paths?: string[]; }): string; + paths(request: string): string[] | null; +} + interface NodeExtensions { '.js': (m: NodeModule, filename: string) => any; '.json': (m: NodeModule, filename: string) => any; @@ -410,6 +416,7 @@ declare namespace NodeJS { setMaxListeners(n: number): this; getMaxListeners(): number; listeners(event: string | symbol): Function[]; + rawListeners(event: string | symbol): Function[]; emit(event: string | symbol, ...args: any[]): boolean; listenerCount(type: string | symbol): number; // Added in Node 6... @@ -520,6 +527,7 @@ declare namespace NodeJS { export interface WriteStream extends Socket { readonly writableHighWaterMark: number; + readonly writableLength: number; columns?: number; rows?: number; _write(chunk: any, encoding: string, callback: Function): void; @@ -532,6 +540,7 @@ declare namespace NodeJS { } export interface ReadStream extends Socket { readonly readableHighWaterMark: number; + readonly readableLength: number; isRaw?: boolean; setRawMode?(mode: boolean): void; _read(size: number): void; @@ -916,6 +925,7 @@ declare module "events" { setMaxListeners(n: number): this; getMaxListeners(): number; listeners(event: string | symbol): Function[]; + rawListeners(event: string | symbol): Function[]; emit(event: string | symbol, ...args: any[]): boolean; eventNames(): Array; listenerCount(type: string | symbol): number; @@ -1466,27 +1476,28 @@ declare module "zlib" { export function createInflateRaw(options?: ZlibOptions): InflateRaw; export function createUnzip(options?: ZlibOptions): Unzip; - export function deflate(buf: Buffer | string, callback: (error: Error | null, result: Buffer) => void): void; - export function deflate(buf: Buffer | string, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; - export function deflateSync(buf: Buffer | string, options?: ZlibOptions): Buffer; - export function deflateRaw(buf: Buffer | string, callback: (error: Error | null, result: Buffer) => void): void; - export function deflateRaw(buf: Buffer | string, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; - export function deflateRawSync(buf: Buffer | string, options?: ZlibOptions): Buffer; - export function gzip(buf: Buffer | string, callback: (error: Error | null, result: Buffer) => void): void; - export function gzip(buf: Buffer | string, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; - export function gzipSync(buf: Buffer | string, options?: ZlibOptions): Buffer; - export function gunzip(buf: Buffer | string, callback: (error: Error | null, result: Buffer) => void): void; - export function gunzip(buf: Buffer | string, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; - export function gunzipSync(buf: Buffer | string, options?: ZlibOptions): Buffer; - export function inflate(buf: Buffer | string, callback: (error: Error | null, result: Buffer) => void): void; - export function inflate(buf: Buffer | string, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; - export function inflateSync(buf: Buffer | string, options?: ZlibOptions): Buffer; - export function inflateRaw(buf: Buffer | string, callback: (error: Error | null, result: Buffer) => void): void; - export function inflateRaw(buf: Buffer | string, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; - export function inflateRawSync(buf: Buffer | string, options?: ZlibOptions): Buffer; - export function unzip(buf: Buffer | string, callback: (error: Error | null, result: Buffer) => void): void; - export function unzip(buf: Buffer | string, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; - export function unzipSync(buf: Buffer | string, options?: ZlibOptions): Buffer; + type InputType = string | Buffer | DataView | ArrayBuffer /* | TypedArray */; + export function deflate(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void; + export function deflate(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; + export function deflateSync(buf: InputType, options?: ZlibOptions): Buffer; + export function deflateRaw(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void; + export function deflateRaw(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; + export function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer; + export function gzip(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void; + export function gzip(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; + export function gzipSync(buf: InputType, options?: ZlibOptions): Buffer; + export function gunzip(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void; + export function gunzip(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; + export function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer; + export function inflate(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void; + export function inflate(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; + export function inflateSync(buf: InputType, options?: ZlibOptions): Buffer; + export function inflateRaw(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void; + export function inflateRaw(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; + export function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer; + export function unzip(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void; + export function unzip(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void; + export function unzipSync(buf: InputType, options?: ZlibOptions): Buffer; export namespace constants { // Allowed flush values. @@ -1735,33 +1746,20 @@ declare module "https" { import * as http from "http"; import { URL } from "url"; - export interface ServerOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - crl?: any; - ciphers?: string; - honorCipherOrder?: boolean; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; - SNICallback?: (servername: string, cb: (err: Error | null, ctx: tls.SecureContext) => void) => void; - secureProtocol?: string; - } + export type ServerOptions = tls.SecureContextOptions & tls.TlsOptions; - export interface RequestOptions extends http.RequestOptions { - pfx?: any; - key?: any; + export type RequestOptions = http.RequestOptions & { + rejectUnauthorized?: boolean; // Defaults to true + servername?: string; // SNI TLS Extension + pfx?: string | Buffer | Array; + key?: string | Buffer | Array; passphrase?: string; - cert?: any; - ca?: any; + cert?: string | Buffer | Array; + ca?: string | Buffer | Array; ciphers?: string; - rejectUnauthorized?: boolean; - secureProtocol?: string; - servername?: string; - } + clientCertEngine?: string; + secureProtocol?: string; // SSL Method, e.g. SSLv23_method + }; export interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { rejectUnauthorized?: boolean; @@ -2616,9 +2614,9 @@ declare module "net" { destroy(err?: any): void; pause(): this; resume(): this; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; + setTimeout(timeout: number, callback?: Function): this; + setNoDelay(noDelay?: boolean): this; + setKeepAlive(enable?: boolean, initialDelay?: number): this; address(): { port: number; family: string; address: string; }; unref(): void; ref(): void; @@ -3711,7 +3709,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdir(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: Array) => void): void; + export function readdir(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[] | Buffer[]) => void): void; /** * Asynchronous readdir(3) - read a directory. @@ -3740,7 +3738,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise>; + export function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; } /** @@ -3762,7 +3760,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdirSync(path: PathLike, options?: { encoding?: string | null } | string | null): Array; + export function readdirSync(path: PathLike, options?: { encoding?: string | null } | string | null): string[] | Buffer[]; /** * Asynchronous close(2) - close a file descriptor. @@ -4834,7 +4832,7 @@ declare module "tls" { * An array of strings or a Buffer naming possible NPN protocols. * (Protocols should be ordered by their priority.) */ - NPNProtocols?: string[] | Buffer, + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * An array of strings or a Buffer naming possible ALPN protocols. * (Protocols should be ordered by their priority.) When the server @@ -4842,7 +4840,7 @@ declare module "tls" { * precedence over NPN and the server does not send an NPN extension * to the client. */ - ALPNProtocols?: string[] | Buffer, + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * SNICallback(servername, cb) A function that will be * called if the client supports SNI TLS extension. Two arguments @@ -4918,7 +4916,7 @@ declare module "tls" { * @param callback - callback(err) will be executed with null as err, once the renegotiation * is successfully completed. */ - renegotiate(options: TlsOptions, callback: (err: Error | null) => void): any; + renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): any; /** * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by @@ -4961,30 +4959,16 @@ declare module "tls" { prependOnceListener(event: "secureConnect", listener: () => void): this; } - export interface TlsOptions { - host?: string; - port?: number; - pfx?: string | Buffer[]; - key?: string | string[] | Buffer | any[]; - passphrase?: string; - cert?: string | string[] | Buffer | Buffer[]; - ca?: string | string[] | Buffer | Buffer[]; - crl?: string | string[]; - ciphers?: string; - honorCipherOrder?: boolean; + export interface TlsOptions extends SecureContextOptions { + clientCertEngine?: string; + handshakeTimeout?: number; requestCert?: boolean; rejectUnauthorized?: boolean; - NPNProtocols?: string[] | Buffer; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void; - ecdhCurve?: string; - dhparam?: string | Buffer; - handshakeTimeout?: number; - ALPNProtocols?: string[] | Buffer; sessionTimeout?: number; ticketKeys?: Buffer; - sessionIdContext?: string; - secureProtocol?: string; - secureOptions?: number; } export interface ConnectionOptions extends SecureContextOptions { @@ -4993,8 +4977,8 @@ declare module "tls" { path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket rejectUnauthorized?: boolean; // Defaults to true - NPNProtocols?: Array; - ALPNProtocols?: Array; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; checkServerIdentity?: typeof checkServerIdentity; servername?: string; // SNI TLS Extension session?: Buffer; @@ -5092,6 +5076,7 @@ declare module "tls" { ciphers?: string; honorCipherOrder?: boolean; ecdhCurve?: string; + clientCertEngine?: string; crl?: string | Buffer | Array; dhparam?: string | Buffer; secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options @@ -5304,7 +5289,8 @@ declare module "stream" { export class Readable extends Stream implements NodeJS.ReadableStream { readable: boolean; - readableHighWaterMark: number; + readonly readableHighWaterMark: number; + readonly readableLength: number; constructor(opts?: ReadableOptions); _read(size: number): void; read(size?: number): any; @@ -5329,7 +5315,6 @@ declare module "stream" { * 5. error */ addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: string, listener: (...args: any[]) => void): this; addListener(event: "close", listener: () => void): this; addListener(event: "data", listener: (chunk: Buffer | string) => void): this; addListener(event: "end", listener: () => void): this; @@ -5392,9 +5377,10 @@ declare module "stream" { export class Writable extends Stream implements NodeJS.WritableStream { writable: boolean; readonly writableHighWaterMark: number; + readonly writableLength: number; constructor(opts?: WritableOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5484,9 +5470,10 @@ declare module "stream" { export class Duplex extends Readable implements Writable { writable: boolean; readonly writableHighWaterMark: number; + readonly writableLength: number; constructor(opts?: DuplexOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5566,9 +5553,9 @@ declare module "util" { export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; @@ -5642,12 +5629,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; @@ -6161,7 +6148,7 @@ declare module "http2" { } export interface ServerStreamFileResponseOptions { - statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void|boolean; + statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void | boolean; getTrailers?: (trailers: OutgoingHttpHeaders) => void; offset?: number; length?: number; @@ -6173,15 +6160,12 @@ declare module "http2" { export interface Http2Stream extends stream.Duplex { readonly aborted: boolean; + close(code: number, callback?: () => void): void; + readonly closed: boolean; readonly destroyed: boolean; + readonly pending: boolean; priority(options: StreamPriorityOptions): void; readonly rstCode: number; - rstStream(code: number): void; - rstWithNoError(): void; - rstWithProtocolError(): void; - rstWithCancel(): void; - rstWithRefuse(): void; - rstWithInternalError(): void; readonly session: Http2Session; setTimeout(msecs: number, callback?: () => void): void; readonly state: StreamState; @@ -6313,8 +6297,8 @@ declare module "http2" { additionalHeaders(headers: OutgoingHttpHeaders): void; readonly headersSent: boolean; readonly pushAllowed: boolean; - pushStream(headers: OutgoingHttpHeaders, callback?: (pushStream: ServerHttp2Stream) => void): void; - pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (pushStream: ServerHttp2Stream) => void): void; + pushStream(headers: OutgoingHttpHeaders, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; + pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; respondWithFD(fd: number, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void; respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptionsWithError): void; @@ -6339,13 +6323,6 @@ declare module "http2" { getTrailers?: (trailers: OutgoingHttpHeaders, flags: number) => void; } - export interface SessionShutdownOptions { - graceful?: boolean; - errorCode?: number; - lastStreamID?: number; - opaqueData?: Buffer | Uint8Array; - } - export interface SessionState { effectiveLocalWindowSize?: number; effectiveRecvDataLength?: number; @@ -6359,20 +6336,26 @@ declare module "http2" { } export interface Http2Session extends events.EventEmitter { - destroy(): void; + readonly alpnProtocol?: string; + close(callback?: () => void): void; + readonly closed: boolean; + destroy(error?: Error, code?: number): void; readonly destroyed: boolean; + readonly encrypted?: boolean; + goaway(code?: number, lastStreamID?: number, opaqueData?: Buffer | DataView /*| TypedArray*/): void; readonly localSettings: Settings; + readonly originSet?: string[]; readonly pendingSettingsAck: boolean; + ref(): void; readonly remoteSettings: Settings; rstStream(stream: Http2Stream, code?: number): void; setTimeout(msecs: number, callback?: () => void): void; - shutdown(callback?: () => void): void; - shutdown(options: SessionShutdownOptions, callback?: () => void): void; readonly socket: net.Socket | tls.TLSSocket; readonly state: SessionState; priority(stream: Http2Stream, options: StreamPriorityOptions): void; settings(settings: Settings): void; readonly type: number; + unref(): void; addListener(event: string, listener: (...args: any[]) => void): this; addListener(event: "close", listener: () => void): this; @@ -6381,7 +6364,6 @@ declare module "http2" { addListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; addListener(event: "localSettings", listener: (settings: Settings) => void): this; addListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - addListener(event: "socketError", listener: (err: Error) => void): this; addListener(event: "timeout", listener: () => void): this; emit(event: string | symbol, ...args: any[]): boolean; @@ -6391,7 +6373,6 @@ declare module "http2" { emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData: Buffer): boolean; emit(event: "localSettings", settings: Settings): boolean; emit(event: "remoteSettings", settings: Settings): boolean; - emit(event: "socketError", err: Error): boolean; emit(event: "timeout"): boolean; on(event: string, listener: (...args: any[]) => void): this; @@ -6401,7 +6382,6 @@ declare module "http2" { on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; on(event: "localSettings", listener: (settings: Settings) => void): this; on(event: "remoteSettings", listener: (settings: Settings) => void): this; - on(event: "socketError", listener: (err: Error) => void): this; on(event: "timeout", listener: () => void): this; once(event: string, listener: (...args: any[]) => void): this; @@ -6411,7 +6391,6 @@ declare module "http2" { once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; once(event: "localSettings", listener: (settings: Settings) => void): this; once(event: "remoteSettings", listener: (settings: Settings) => void): this; - once(event: "socketError", listener: (err: Error) => void): this; once(event: "timeout", listener: () => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; @@ -6421,7 +6400,6 @@ declare module "http2" { prependListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; prependListener(event: "localSettings", listener: (settings: Settings) => void): this; prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependListener(event: "socketError", listener: (err: Error) => void): this; prependListener(event: "timeout", listener: () => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; @@ -6431,7 +6409,6 @@ declare module "http2" { prependOnceListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "socketError", listener: (err: Error) => void): this; prependOnceListener(event: "timeout", listener: () => void): this; } @@ -6439,31 +6416,42 @@ declare module "http2" { request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; addListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "altsvc", alt: string, origin: string, stream: number): boolean; emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; on(event: string, listener: (...args: any[]) => void): this; + on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; once(event: string, listener: (...args: any[]) => void): this; + once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; once(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; prependListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; prependOnceListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; } + export interface AlternativeServiceOptions { + origin: number | string | url.URL; + } + export interface ServerHttp2Session extends Http2Session { + altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void; readonly server: Http2Server | Http2SecureServer; addListener(event: string, listener: (...args: any[]) => void): this; @@ -6519,93 +6507,93 @@ declare module "http2" { export interface Http2Server extends net.Server { addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener(event: "socketError", listener: (err: Error) => void): this; addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; addListener(event: "timeout", listener: () => void): this; emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; emit(event: "sessionError", err: Error): boolean; - emit(event: "socketError", err: Error): boolean; emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; emit(event: "timeout"): boolean; on(event: string, listener: (...args: any[]) => void): this; + on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; on(event: "sessionError", listener: (err: Error) => void): this; - on(event: "socketError", listener: (err: Error) => void): this; on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; on(event: "timeout", listener: () => void): this; once(event: string, listener: (...args: any[]) => void): this; + once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; once(event: "sessionError", listener: (err: Error) => void): this; - once(event: "socketError", listener: (err: Error) => void): this; once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; once(event: "timeout", listener: () => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener(event: "socketError", listener: (err: Error) => void): this; prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependListener(event: "timeout", listener: () => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener(event: "socketError", listener: (err: Error) => void): this; prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependOnceListener(event: "timeout", listener: () => void): this; } export interface Http2SecureServer extends tls.Server { addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener(event: "socketError", listener: (err: Error) => void): this; addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; addListener(event: "timeout", listener: () => void): this; addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; emit(event: "sessionError", err: Error): boolean; - emit(event: "socketError", err: Error): boolean; emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; emit(event: "timeout"): boolean; emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean; on(event: string, listener: (...args: any[]) => void): this; + on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; on(event: "sessionError", listener: (err: Error) => void): this; - on(event: "socketError", listener: (err: Error) => void): this; on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; on(event: "timeout", listener: () => void): this; on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; once(event: string, listener: (...args: any[]) => void): this; + once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; once(event: "sessionError", listener: (err: Error) => void): this; - once(event: "socketError", listener: (err: Error) => void): this; once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; once(event: "timeout", listener: () => void): this; once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener(event: "socketError", listener: (err: Error) => void): this; prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependListener(event: "timeout", listener: () => void): this; prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener(event: "socketError", listener: (err: Error) => void): this; prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependOnceListener(event: "timeout", listener: () => void): this; prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index dccde2db47..0572c58fea 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import events2 = require("events"); @@ -235,6 +235,25 @@ namespace fs_tests { }); } + { + let listS: string[]; + listS = fs.readdirSync('path'); + listS = fs.readdirSync('path', { encoding: 'utf8' }); + listS = fs.readdirSync('path', { encoding: null }); + listS = fs.readdirSync('path', { encoding: undefined }); + listS = fs.readdirSync('path', 'utf8'); + listS = fs.readdirSync('path', null); + listS = fs.readdirSync('path', undefined); + + let listB: Buffer[]; + listB = fs.readdirSync('path', { encoding: 'buffer' }); + listB = fs.readdirSync("path", 'buffer'); + + let enc = 'buffer'; + fs.readdirSync('path', { encoding: enc }); // $ExpectType string[] | Buffer[] + fs.readdirSync('path', { }); // $ExpectType string[] | Buffer[] + } + { fs.mkdtemp('/tmp/foo-', (err, folder) => { console.log(folder); @@ -3373,16 +3392,22 @@ namespace http2_tests { http2Session.on('localSettings', (settings: http2.Settings) => {}); http2Session.on('remoteSettings', (settings: http2.Settings) => {}); http2Session.on('stream', (stream: http2.Http2Stream, headers: http2.IncomingHttpHeaders, flags: number) => {}); - http2Session.on('socketError', (err: Error) => {}); http2Session.on('timeout', () => {}); http2Session.destroy(); + let alpnProtocol: string = http2Session.alpnProtocol; let destroyed: boolean = http2Session.destroyed; + let encrypted: boolean = http2Session.encrypted; + let originSet: string[] = http2Session.originSet; let pendingSettingsAck: boolean = http2Session.pendingSettingsAck; let settings: http2.Settings = http2Session.localSettings; + let closed: boolean = http2Session.closed; settings = http2Session.remoteSettings; + http2Session.ref(); + http2Session.unref(); + let headers: http2.OutgoingHttpHeaders; let options: http2.ClientSessionRequestOptions = { endStream: true, @@ -3400,16 +3425,7 @@ namespace http2_tests { http2Session.rstStream(stream, 0); http2Session.setTimeout(100, () => {}); - - let shutdownOptions: http2.SessionShutdownOptions = { - graceful: true, - errorCode: 0, - lastStreamID: 0, - opaqueData: Buffer.from([]) - }; - shutdownOptions.opaqueData = Uint8Array.from([]); - http2Session.shutdown(shutdownOptions); - http2Session.shutdown(shutdownOptions, () => {}); + http2Session.close(() => {}); let socket: net.Socket | tls.TLSSocket = http2Session.socket; let state: http2.SessionState = http2Session.state; @@ -3448,7 +3464,9 @@ namespace http2_tests { http2Stream.on('trailers', (trailers: http2.IncomingHttpHeaders, flags: number) => {}); let aborted: boolean = http2Stream.aborted; + let closed: boolean = http2Stream.closed; let destroyed: boolean = http2Stream.destroyed; + let pending: boolean = http2Stream.pending; http2Stream.priority({ exclusive: true, @@ -3457,14 +3475,6 @@ namespace http2_tests { silent: true }); - let rstCode: number = http2Stream.rstCode; - http2Stream.rstStream(rstCode); - http2Stream.rstWithNoError(); - http2Stream.rstWithProtocolError(); - http2Stream.rstWithCancel(); - http2Stream.rstWithRefuse(); - http2Stream.rstWithInternalError(); - let sesh: http2.Http2Session = http2Stream.session; http2Stream.setTimeout(100, () => {}); @@ -3492,7 +3502,7 @@ namespace http2_tests { serverHttp2Stream.additionalHeaders(headers); let headerSent: boolean = serverHttp2Stream.headersSent; let pushAllowed: boolean = serverHttp2Stream.pushAllowed; - serverHttp2Stream.pushStream(headers, (pushStream: http2.ServerHttp2Stream) => {}); + serverHttp2Stream.pushStream(headers, (err: Error | null, pushStream: http2.ServerHttp2Stream, headers: http2.OutgoingHttpHeaders) => {}); let options: http2.ServerStreamResponseOptions = { endStream: true, @@ -3533,7 +3543,7 @@ namespace http2_tests { let s2: tls.Server = http2SecureServer; [http2Server, http2SecureServer].forEach((server) => { server.on('sessionError', (err: Error) => {}); - server.on('socketError', (err: Error) => {}); + server.on('checkContinue', (stream: http2.ServerHttp2Stream, headers: http2.IncomingHttpHeaders, flags: number) => {}); server.on('stream', (stream: http2.ServerHttp2Stream, headers: http2.IncomingHttpHeaders, flags: number) => {}); server.on('request', (request: http2.Http2ServerRequest, response: http2.Http2ServerResponse) => {}); server.on('timeout', () => {}); @@ -3658,6 +3668,15 @@ namespace http2_tests { secureClientSessionOptions.ca = ''; let onConnectHandler = (session: http2.Http2Session, socket: net.Socket) => {}; + let serverHttp2Session: http2.ServerHttp2Session; + + serverHttp2Session.altsvc('', ''); + serverHttp2Session.altsvc('', 0); + serverHttp2Session.altsvc('', new url.URL('')); + serverHttp2Session.altsvc('', { origin: '' }); + serverHttp2Session.altsvc('', { origin: 0 }); + serverHttp2Session.altsvc('', { origin: new url.URL('') }); + let clientHttp2Session: http2.ClientHttp2Session; clientHttp2Session = http2.connect(''); @@ -3666,6 +3685,7 @@ namespace http2_tests { clientHttp2Session = http2.connect('', clientSessionOptions, onConnectHandler); clientHttp2Session = http2.connect('', secureClientSessionOptions); clientHttp2Session = http2.connect('', secureClientSessionOptions, onConnectHandler); + clientHttp2Session.on('altsvc', (alt: string, origin: string, number: number) => {}); settings = http2.getDefaultSettings(); settings = http2.getPackedSettings(settings); diff --git a/types/node/v0/index.d.ts b/types/node/v0/index.d.ts index 814bbe793e..800a909c49 100644 --- a/types/node/v0/index.d.ts +++ b/types/node/v0/index.d.ts @@ -1902,11 +1902,11 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; } diff --git a/types/node/v0/node-tests.ts b/types/node/v0/node-tests.ts index 8e2443b360..d8e0a40699 100644 --- a/types/node/v0/node-tests.ts +++ b/types/node/v0/node-tests.ts @@ -1,5 +1,4 @@ - -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import * as zlib from "zlib"; diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index b2db9f80ee..09cbd8bb43 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1549,9 +1549,9 @@ declare module "net" { destroy(): void; pause(): void; resume(): void; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; + setTimeout(timeout: number, callback?: Function): this; + setNoDelay(noDelay?: boolean): this; + setKeepAlive(enable?: boolean, initialDelay?: number): this; address(): { port: number; family: string; address: string; }; unref(): void; ref(): void; @@ -2477,12 +2477,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; diff --git a/types/node/v4/node-tests.ts b/types/node/v4/node-tests.ts index 2bb28ce779..e60b578ccf 100644 --- a/types/node/v4/node-tests.ts +++ b/types/node/v4/node-tests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import * as zlib from "zlib"; diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 5cbe7ab3dc..3c81e212b7 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -5,6 +5,7 @@ // Wilco Bakker // Thomas Bouldin // Sebastian Silbermann +// Alorel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /************************************************ @@ -2093,9 +2094,9 @@ declare module "net" { setEncoding(encoding?: string): void; write(data: any, encoding?: string, callback?: Function): void; destroy(): void; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; + setTimeout(timeout: number, callback?: Function): this; + setNoDelay(noDelay?: boolean): this; + setKeepAlive(enable?: boolean, initialDelay?: number): this; address(): { port: number; family: string; address: string; }; unref(): void; ref(): void; @@ -2595,8 +2596,51 @@ declare module "fs" { * @returns Returns the created folder path. */ export function mkdtempSync(prefix: string): string; - export function readdir(path: string | Buffer, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; - export function readdirSync(path: string | Buffer): string[]; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir(path: string | Buffer, options: { encoding: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir(path: string | Buffer, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, files: Buffer[]) => void): void; + + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir(path: string | Buffer, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[] | Buffer[]) => void): void; + + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. + */ + export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync(path: string | Buffer, options?: { encoding: BufferEncoding | null } | BufferEncoding | null): string[]; + + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync(path: string | Buffer, options: { encoding: "buffer" } | "buffer"): Buffer[]; + + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync(path: string | Buffer, options?: { encoding?: string | null } | string | null): string[] | Buffer[]; export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; export function closeSync(fd: number): void; export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; @@ -3605,7 +3649,6 @@ declare module "stream" { * 5. error **/ addListener(event: string, listener: Function): this; - addListener(event: string, listener: Function): this; addListener(event: "close", listener: () => void): this; addListener(event: "data", listener: (chunk: Buffer | string) => void): this; addListener(event: "end", listener: () => void): this; @@ -3854,12 +3897,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index 34a62bf88d..cd363c708c 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import events2 = require("events"); @@ -218,6 +218,25 @@ namespace fs_tests { fs.readFile('testfile', { flag: 'r' }, (err, data) => buffer = data); } + { + fs.readdir('foo', (err: any, files: string[]) => {}) + fs.readdir('foo', 'utf8', (err: any, files: string[]) => {}); + fs.readdir('foo', {encoding: 'utf8'}, (err: any, files: string[]) => {}); + fs.readdir('foo', 'buffer', (err: any, files: Buffer[]) => {}); + fs.readdir('foo', {encoding: 'buffer'}, (err: any, files: Buffer[]) => {}); + + let fsStringOut: string[] = fs.readdirSync('utf8'); + fsStringOut = fs.readdirSync('foo', 'utf8'); + fsStringOut = fs.readdirSync('foo', {encoding: 'utf8'}); + + let fsBufferOut: Buffer[] = fs.readdirSync('utf8', 'buffer'); + fsBufferOut = fs.readdirSync('foo', {encoding: 'buffer'}); + + let enc = 'buffer'; + fs.readdirSync('path', { encoding: enc }); // $ExpectType string[] | Buffer[] + fs.readdirSync('path', { }); // $ExpectType string[] | Buffer[] + } + { var errno: number; fs.readFile('testfile', (err, data) => { diff --git a/types/node/v6/tslint.json b/types/node/v6/tslint.json index 518f58df03..82d575f726 100644 --- a/types/node/v6/tslint.json +++ b/types/node/v6/tslint.json @@ -14,6 +14,7 @@ "jsdoc-format": false, "max-line-length": false, "no-any-union": false, + "no-const-enum": false, "no-consecutive-blank-lines": false, "no-duplicate-imports": false, "no-duplicate-variable": false, diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index 038c4a6f58..de69dc94c3 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -2219,9 +2219,9 @@ declare module "net" { destroy(err?: any): void; pause(): this; resume(): this; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; + setTimeout(timeout: number, callback?: Function): this; + setNoDelay(noDelay?: boolean): this; + setKeepAlive(enable?: boolean, initialDelay?: number): this; address(): { port: number; family: string; address: string; }; unref(): void; ref(): void; @@ -3754,7 +3754,6 @@ declare module "stream" { * 5. error **/ addListener(event: string, listener: Function): this; - addListener(event: string, listener: Function): this; addListener(event: "close", listener: () => void): this; addListener(event: "data", listener: (chunk: Buffer | string) => void): this; addListener(event: "end", listener: () => void): this; @@ -4003,12 +4002,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; diff --git a/types/node/v7/node-tests.ts b/types/node/v7/node-tests.ts index a2f25db8ec..0240dcc120 100644 --- a/types/node/v7/node-tests.ts +++ b/types/node/v7/node-tests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import events2 = require("events"); diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 3fbd9f9253..5d672296f2 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Node.js 8.5.x +// Type definitions for Node.js 8.9.x // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -17,13 +17,9 @@ // Sebastian Silbermann // Hannes Magnusson // Alberto Schiabel +// Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/************************************************ -* * -* Node.js v8.5.x API * -* * -************************************************/ +// TypeScript Version: 2.1 /** inspector module types */ /// @@ -117,17 +113,22 @@ declare function clearImmediate(immediateId: any): void; // TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version. interface NodeRequireFunction { -/* tslint:disable-next-line:callable-types */ + /* tslint:disable-next-line:callable-types */ (id: string): any; } interface NodeRequire extends NodeRequireFunction { - resolve(id: string): string; + resolve: RequireResolve; cache: any; extensions: NodeExtensions; main: NodeModule | undefined; } +interface RequireResolve { + (id: string, options?: { paths?: string[]; }): string; + paths(request: string): string[] | null; +} + interface NodeExtensions { '.js': (m: NodeModule, filename: string) => any; '.json': (m: NodeModule, filename: string) => any; @@ -145,6 +146,7 @@ interface NodeModule { loaded: boolean; parent: NodeModule | null; children: NodeModule[]; + paths: string[]; } declare var module: NodeModule; @@ -1176,13 +1178,7 @@ declare module "cluster" { stdio?: any[]; uid?: number; gid?: number; - } - - export interface ClusterSetupMasterSettings { - exec?: string; // default: process.argv[1] - args?: string[]; // default: process.argv.slice(2) - silent?: boolean; // default: false - stdio?: any[]; + inspectPort?: number | (() => number); } export interface Address { @@ -1269,7 +1265,7 @@ declare module "cluster" { isWorker: boolean; // TODO: cluster.schedulingPolicy settings: ClusterSettings; - setupMaster(settings?: ClusterSetupMasterSettings): void; + setupMaster(settings?: ClusterSettings): void; worker?: Worker; workers?: { [index: string]: Worker | undefined @@ -1346,7 +1342,7 @@ declare module "cluster" { export var isWorker: boolean; // TODO: cluster.schedulingPolicy export var settings: ClusterSettings; - export function setupMaster(settings?: ClusterSetupMasterSettings): void; + export function setupMaster(settings?: ClusterSettings): void; export var worker: Worker; export var workers: { [index: string]: Worker | undefined @@ -1729,7 +1725,7 @@ declare module "os" { export function arch(): string; export function platform(): NodeJS.Platform; export function tmpdir(): string; - export var EOL: string; + export const EOL: string; export function endianness(): "BE" | "LE"; } @@ -1739,32 +1735,20 @@ declare module "https" { import * as http from "http"; import { URL } from "url"; - export interface ServerOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - crl?: any; - ciphers?: string; - honorCipherOrder?: boolean; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; - SNICallback?: (servername: string, cb: (err: Error | null, ctx: tls.SecureContext) => void) => void; - } + export type ServerOptions = tls.SecureContextOptions & tls.TlsOptions; - export interface RequestOptions extends http.RequestOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - ciphers?: string; - rejectUnauthorized?: boolean; - secureProtocol?: string; - servername?: string; - } + // see https://nodejs.org/docs/latest-v8.x/api/https.html#https_https_request_options_callback + type extendedRequestKeys = "pfx" | + "key" | + "passphrase" | + "cert" | + "ca" | + "ciphers" | + "rejectUnauthorized" | + "secureProtocol" | + "servername"; + + export type RequestOptions = http.RequestOptions & Pick; export interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { rejectUnauthorized?: boolean; @@ -2342,7 +2326,19 @@ declare module "url" { query?: string | null | ParsedUrlQuery; } - export function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): Url; + export interface UrlWithParsedQuery extends Url { + query: ParsedUrlQuery; + } + + export interface UrlWithStringQuery extends Url { + query: string | null; + } + + export function parse(urlStr: string): UrlWithStringQuery; + export function parse(urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery; + export function parse(urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; + export function parse(urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url; + export function format(URL: URL, options?: URLFormatOptions): string; export function format(urlObject: UrlObject | string): string; export function resolve(from: string, to: string): string; @@ -2607,9 +2603,9 @@ declare module "net" { destroy(err?: any): void; pause(): this; resume(): this; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; + setTimeout(timeout: number, callback?: Function): this; + setNoDelay(noDelay?: boolean): this; + setKeepAlive(enable?: boolean, initialDelay?: number): this; address(): { port: number; family: string; address: string; }; unref(): void; ref(): void; @@ -3691,7 +3687,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdir(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: Array) => void): void; + export function readdir(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[] | Buffer[]) => void): void; /** * Asynchronous readdir(3) - read a directory. @@ -3720,7 +3716,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise>; + export function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; } /** @@ -3742,7 +3738,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdirSync(path: PathLike, options?: { encoding?: string | null } | string | null): Array; + export function readdirSync(path: PathLike, options?: { encoding?: string | null } | string | null): string[] | Buffer[]; /** * Asynchronous close(2) - close a file descriptor. @@ -4573,7 +4569,6 @@ declare module "path" { */ name: string; } - export interface FormatInputPathObject { /** * The root of the path such as '/' or 'c:\' @@ -4620,7 +4615,7 @@ declare module "path" { * * @param pathSegments string paths to join. Non-string arguments are ignored. */ - export function resolve(...pathSegments: any[]): string; + export function resolve(...pathSegments: string[]): string; /** * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. * @@ -4686,7 +4681,7 @@ declare module "path" { export var sep: string; export var delimiter: string; export function parse(p: string): ParsedPath; - export function format(pP: ParsedPath): string; + export function format(pP: FormatInputPathObject): string; } export module win32 { @@ -4701,7 +4696,7 @@ declare module "path" { export var sep: string; export var delimiter: string; export function parse(p: string): ParsedPath; - export function format(pP: ParsedPath): string; + export function format(pP: FormatInputPathObject): string; } } @@ -4815,7 +4810,7 @@ declare module "tls" { * An array of strings or a Buffer naming possible NPN protocols. * (Protocols should be ordered by their priority.) */ - NPNProtocols?: string[] | Buffer, + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * An array of strings or a Buffer naming possible ALPN protocols. * (Protocols should be ordered by their priority.) When the server @@ -4823,7 +4818,7 @@ declare module "tls" { * precedence over NPN and the server does not send an NPN extension * to the client. */ - ALPNProtocols?: string[] | Buffer, + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * SNICallback(servername, cb) A function that will be * called if the client supports SNI TLS extension. Two arguments @@ -4899,7 +4894,7 @@ declare module "tls" { * @param callback - callback(err) will be executed with null as err, once the renegotiation * is successfully completed. */ - renegotiate(options: TlsOptions, callback: (err: Error | null) => void): any; + renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): any; /** * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by @@ -4942,30 +4937,15 @@ declare module "tls" { prependOnceListener(event: "secureConnect", listener: () => void): this; } - export interface TlsOptions { - host?: string; - port?: number; - pfx?: string | Buffer[]; - key?: string | string[] | Buffer | any[]; - passphrase?: string; - cert?: string | string[] | Buffer | Buffer[]; - ca?: string | string[] | Buffer | Buffer[]; - crl?: string | string[]; - ciphers?: string; - honorCipherOrder?: boolean; + export interface TlsOptions extends SecureContextOptions { + handshakeTimeout?: number; requestCert?: boolean; rejectUnauthorized?: boolean; - NPNProtocols?: string[] | Buffer; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void; - ecdhCurve?: string; - dhparam?: string | Buffer; - handshakeTimeout?: number; - ALPNProtocols?: string[] | Buffer; sessionTimeout?: number; ticketKeys?: Buffer; - sessionIdContext?: string; - secureProtocol?: string; - secureOptions?: number; } export interface ConnectionOptions extends SecureContextOptions { @@ -4974,8 +4954,8 @@ declare module "tls" { path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket rejectUnauthorized?: boolean; // Defaults to true - NPNProtocols?: Array; - ALPNProtocols?: Array; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; checkServerIdentity?: typeof checkServerIdentity; servername?: string; // SNI TLS Extension session?: Buffer; @@ -5309,7 +5289,6 @@ declare module "stream" { * 5. error */ addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: string, listener: (...args: any[]) => void): this; addListener(event: "close", listener: () => void): this; addListener(event: "data", listener: (chunk: Buffer | string) => void): this; addListener(event: "end", listener: () => void): this; @@ -5373,7 +5352,7 @@ declare module "stream" { writable: boolean; constructor(opts?: WritableOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5464,7 +5443,7 @@ declare module "stream" { writable: boolean; constructor(opts?: DuplexOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5544,9 +5523,9 @@ declare module "util" { export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; @@ -5620,12 +5599,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; @@ -6141,7 +6120,7 @@ declare module "http2" { } export interface ServerStreamFileResponseOptions { - statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void|boolean; + statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void | boolean; getTrailers?: (trailers: OutgoingHttpHeaders) => void; offset?: number; length?: number; @@ -6920,195 +6899,195 @@ declare module "http2" { } declare module "perf_hooks" { - export interface PerformanceEntry { - /** - * The total number of milliseconds elapsed for this entry. - * This value will not be meaningful for all Performance Entry types. - */ - readonly duration: number; + export interface PerformanceEntry { + /** + * The total number of milliseconds elapsed for this entry. + * This value will not be meaningful for all Performance Entry types. + */ + readonly duration: number; - /** - * The name of the performance entry. - */ - readonly name: string; + /** + * The name of the performance entry. + */ + readonly name: string; - /** - * The high resolution millisecond timestamp marking the starting time of the Performance Entry. - */ - readonly startTime: number; + /** + * The high resolution millisecond timestamp marking the starting time of the Performance Entry. + */ + readonly startTime: number; - /** - * The type of the performance entry. - * Currently it may be one of: 'node', 'mark', 'measure', 'gc', or 'function'. - */ - readonly entryType: string; + /** + * The type of the performance entry. + * Currently it may be one of: 'node', 'mark', 'measure', 'gc', or 'function'. + */ + readonly entryType: string; - /** - * When performanceEntry.entryType is equal to 'gc', the performance.kind property identifies - * the type of garbage collection operation that occurred. - * The value may be one of perf_hooks.constants. - */ - readonly kind?: number; - } - - export interface PerformanceNodeTiming extends PerformanceEntry { - /** - * The high resolution millisecond timestamp at which the Node.js process completed bootstrap. - */ - readonly bootstrapComplete: number; - - /** - * The high resolution millisecond timestamp at which cluster processing ended. - */ - readonly clusterSetupEnd: number; - - /** - * The high resolution millisecond timestamp at which cluster processing started. - */ - readonly clusterSetupStart: number; - - /** - * The high resolution millisecond timestamp at which the Node.js event loop exited. - */ - readonly loopExit: number; - - /** - * The high resolution millisecond timestamp at which the Node.js event loop started. - */ - readonly loopStart: number; - - /** - * The high resolution millisecond timestamp at which main module load ended. - */ - readonly moduleLoadEnd: number; - - /** - * The high resolution millisecond timestamp at which main module load started. - */ - readonly moduleLoadStart: number; - - /** - * The high resolution millisecond timestamp at which the Node.js process was initialized. - */ - readonly nodeStart: number; - - /** - * The high resolution millisecond timestamp at which preload module load ended. - */ - readonly preloadModuleLoadEnd: number; - - /** - * The high resolution millisecond timestamp at which preload module load started. - */ - readonly preloadModuleLoadStart: number; - - /** - * The high resolution millisecond timestamp at which third_party_main processing ended. - */ - readonly thirdPartyMainEnd: number; - - /** - * The high resolution millisecond timestamp at which third_party_main processing started. - */ - readonly thirdPartyMainStart: number; - - /** - * The high resolution millisecond timestamp at which the V8 platform was initialized. - */ - readonly v8Start: number; + /** + * When performanceEntry.entryType is equal to 'gc', the performance.kind property identifies + * the type of garbage collection operation that occurred. + * The value may be one of perf_hooks.constants. + */ + readonly kind?: number; } - export interface Performance { - /** - * If name is not provided, removes all PerformanceFunction objects from the Performance Timeline. - * If name is provided, removes entries with name. - * @param name - */ - clearFunctions(name?: string): void; + export interface PerformanceNodeTiming extends PerformanceEntry { + /** + * The high resolution millisecond timestamp at which the Node.js process completed bootstrap. + */ + readonly bootstrapComplete: number; - /** - * If name is not provided, removes all PerformanceMark objects from the Performance Timeline. - * If name is provided, removes only the named mark. - * @param name - */ - clearMarks(name?: string): void; + /** + * The high resolution millisecond timestamp at which cluster processing ended. + */ + readonly clusterSetupEnd: number; - /** - * If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline. - * If name is provided, removes only objects whose performanceEntry.name matches name. - */ - clearMeasures(name?: string): void; + /** + * The high resolution millisecond timestamp at which cluster processing started. + */ + readonly clusterSetupStart: number; - /** - * Returns a list of all PerformanceEntry objects in chronological order with respect to performanceEntry.startTime. - * @return list of all PerformanceEntry objects - */ - getEntries(): PerformanceEntry[]; + /** + * The high resolution millisecond timestamp at which the Node.js event loop exited. + */ + readonly loopExit: number; - /** - * Returns a list of all PerformanceEntry objects in chronological order with respect to performanceEntry.startTime - * whose performanceEntry.name is equal to name, and optionally, whose performanceEntry.entryType is equal to type. - * @param name - * @param type - * @return list of all PerformanceEntry objects - */ - getEntriesByName(name: string, type?: string): PerformanceEntry[]; + /** + * The high resolution millisecond timestamp at which the Node.js event loop started. + */ + readonly loopStart: number; - /** - * Returns a list of all PerformanceEntry objects in chronological order with respect to performanceEntry.startTime - * whose performanceEntry.entryType is equal to type. - * @param type - * @return list of all PerformanceEntry objects - */ - getEntriesByType(type: string): PerformanceEntry[]; + /** + * The high resolution millisecond timestamp at which main module load ended. + */ + readonly moduleLoadEnd: number; - /** - * Creates a new PerformanceMark entry in the Performance Timeline. - * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark', - * and whose performanceEntry.duration is always 0. - * Performance marks are used to mark specific significant moments in the Performance Timeline. - * @param name - */ - mark(name?: string): void; + /** + * The high resolution millisecond timestamp at which main module load started. + */ + readonly moduleLoadStart: number; - /** - * Creates a new PerformanceMeasure entry in the Performance Timeline. - * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', - * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark. - * - * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify - * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, - * then startMark is set to timeOrigin by default. - * - * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp - * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown. - * @param name - * @param startMark - * @param endMark - */ - measure(name: string, startMark: string, endMark: string): void; + /** + * The high resolution millisecond timestamp at which the Node.js process was initialized. + */ + readonly nodeStart: number; - /** - * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones. - */ - readonly nodeTiming: PerformanceNodeTiming; + /** + * The high resolution millisecond timestamp at which preload module load ended. + */ + readonly preloadModuleLoadEnd: number; - /** - * @return the current high resolution millisecond timestamp - */ - now(): number; + /** + * The high resolution millisecond timestamp at which preload module load started. + */ + readonly preloadModuleLoadStart: number; - /** - * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured. - */ - readonly timeOrigin: number; + /** + * The high resolution millisecond timestamp at which third_party_main processing ended. + */ + readonly thirdPartyMainEnd: number; - /** - * Wraps a function within a new function that measures the running time of the wrapped function. - * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed. - * @param fn - */ - timerify any>(fn: T): T; + /** + * The high resolution millisecond timestamp at which third_party_main processing started. + */ + readonly thirdPartyMainStart: number; + + /** + * The high resolution millisecond timestamp at which the V8 platform was initialized. + */ + readonly v8Start: number; + } + + export interface Performance { + /** + * If name is not provided, removes all PerformanceFunction objects from the Performance Timeline. + * If name is provided, removes entries with name. + * @param name + */ + clearFunctions(name?: string): void; + + /** + * If name is not provided, removes all PerformanceMark objects from the Performance Timeline. + * If name is provided, removes only the named mark. + * @param name + */ + clearMarks(name?: string): void; + + /** + * If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline. + * If name is provided, removes only objects whose performanceEntry.name matches name. + */ + clearMeasures(name?: string): void; + + /** + * Returns a list of all PerformanceEntry objects in chronological order with respect to performanceEntry.startTime. + * @return list of all PerformanceEntry objects + */ + getEntries(): PerformanceEntry[]; + + /** + * Returns a list of all PerformanceEntry objects in chronological order with respect to performanceEntry.startTime + * whose performanceEntry.name is equal to name, and optionally, whose performanceEntry.entryType is equal to type. + * @param name + * @param type + * @return list of all PerformanceEntry objects + */ + getEntriesByName(name: string, type?: string): PerformanceEntry[]; + + /** + * Returns a list of all PerformanceEntry objects in chronological order with respect to performanceEntry.startTime + * whose performanceEntry.entryType is equal to type. + * @param type + * @return list of all PerformanceEntry objects + */ + getEntriesByType(type: string): PerformanceEntry[]; + + /** + * Creates a new PerformanceMark entry in the Performance Timeline. + * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark', + * and whose performanceEntry.duration is always 0. + * Performance marks are used to mark specific significant moments in the Performance Timeline. + * @param name + */ + mark(name?: string): void; + + /** + * Creates a new PerformanceMeasure entry in the Performance Timeline. + * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', + * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark. + * + * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify + * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, + * then startMark is set to timeOrigin by default. + * + * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp + * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown. + * @param name + * @param startMark + * @param endMark + */ + measure(name: string, startMark: string, endMark: string): void; + + /** + * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones. + */ + readonly nodeTiming: PerformanceNodeTiming; + + /** + * @return the current high resolution millisecond timestamp + */ + now(): number; + + /** + * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured. + */ + readonly timeOrigin: number; + + /** + * Wraps a function within a new function that measures the running time of the wrapped function. + * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed. + * @param fn + */ + timerify any>(fn: T): T; } export interface PerformanceObserverEntryList { @@ -7156,5 +7135,5 @@ declare module "perf_hooks" { export const NODE_PERFORMANCE_GC_WEAKCB: number; } - const performance: Performance; + const performance: Performance; } diff --git a/types/node/v8/node-tests.ts b/types/node/v8/node-tests.ts index 6bb7f28495..74d4c5c222 100644 --- a/types/node/v8/node-tests.ts +++ b/types/node/v8/node-tests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import events2 = require("events"); @@ -235,6 +235,25 @@ namespace fs_tests { }); } + { + let listS: string[]; + listS = fs.readdirSync('path'); + listS = fs.readdirSync('path', { encoding: 'utf8' }); + listS = fs.readdirSync('path', { encoding: null }); + listS = fs.readdirSync('path', { encoding: undefined }); + listS = fs.readdirSync('path', 'utf8'); + listS = fs.readdirSync('path', null); + listS = fs.readdirSync('path', undefined); + + let listB: Buffer[]; + listB = fs.readdirSync('path', { encoding: 'buffer' }); + listB = fs.readdirSync("path", 'buffer'); + + let enc = 'buffer'; + fs.readdirSync('path', { encoding: enc }); // $ExpectType string[] | Buffer[] + fs.readdirSync('path', { }); // $ExpectType string[] | Buffer[] + } + { fs.mkdtemp('/tmp/foo-', (err, folder) => { console.log(folder); @@ -571,9 +590,22 @@ namespace url_tests { } { - var helloUrl = url.parse('http://example.com/?hello=world', true); - if (typeof helloUrl.query !== 'string') { - assert.equal(helloUrl.query['hello'], 'world'); + const helloUrl = url.parse('http://example.com/?hello=world', true); + let helloQuery = helloUrl.query['hello']; + assert.equal(helloUrl.query['hello'], 'world'); + + let strUrl = url.parse('http://example.com/?hello=world'); + let queryStr: string = strUrl.query; + + strUrl = url.parse('http://example.com/?hello=world', false); + queryStr = strUrl.query; + + function getBoolean(): boolean { return false; } + const urlUrl = url.parse('http://example.com/?hello=world', getBoolean()); + if (typeof(urlUrl.query) === 'string') { + queryStr = urlUrl.query; + } else if (urlUrl.query) { + helloQuery = urlUrl.query['hello']; } } @@ -1746,6 +1778,46 @@ namespace path_tests { }); // returns // '/home/user/dir/file.txt' + + path.format({ + dir: "/home/user/dir", + base: "file.txt" + }); + // returns + // '/home/user/dir/file.txt' + + path.posix.format({ + root: "/", + dir: "/home/user/dir", + base: "file.txt", + ext: ".txt", + name: "file" + }); + // returns + // '/home/user/dir/file.txt' + + path.posix.format({ + dir: "/home/user/dir", + base: "file.txt" + }); + // returns + // '/home/user/dir/file.txt' + + path.win32.format({ + root: "C:\\", + dir: "C:\\home\\user\\dir", + ext: ".txt", + name: "file" + }); + // returns + // 'C:\home\user\dir\file.txt' + + path.win32.format({ + dir: "C:\\home\\user\\dir", + base: "file.txt" + }); + // returns + // 'C:\home\user\dir\file.txt' } //////////////////////////////////////////////////// @@ -3860,6 +3932,8 @@ namespace module_tests { const m1: Module = new Module("moduleId"); const m2: Module = new Module.Module("moduleId"); + let paths: string[] = module.paths; + paths = m1.paths; } //////////////////////////////////////////////////// diff --git a/types/node/v8/tsconfig.json b/types/node/v8/tsconfig.json index 3f4614bef4..8deb391829 100644 --- a/types/node/v8/tsconfig.json +++ b/types/node/v8/tsconfig.json @@ -26,4 +26,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} +} \ No newline at end of file diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index e097a77133..5d80518149 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -119,4 +119,4 @@ "tree-update.d.ts", "tree.d.ts" ] -} +} \ No newline at end of file diff --git a/types/nodegit/tslint.json b/types/nodegit/tslint.json index 0ec275bd05..4ce3d76bf7 100644 --- a/types/nodegit/tslint.json +++ b/types/nodegit/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "ban-types": false, + "no-const-enum": false, "no-unnecessary-class": false } } diff --git a/types/nodemailer-ses-transport/nodemailer-ses-transport-tests.ts b/types/nodemailer-ses-transport/nodemailer-ses-transport-tests.ts index 393091816d..271dc6cf41 100644 --- a/types/nodemailer-ses-transport/nodemailer-ses-transport-tests.ts +++ b/types/nodemailer-ses-transport/nodemailer-ses-transport-tests.ts @@ -1,6 +1,6 @@ import * as AWS from "aws-sdk"; import * as nodemailer from "nodemailer"; -import * as sesTransport from 'nodemailer-ses-transport'; +import sesTransport = require('nodemailer-ses-transport'); const opts: sesTransport.SesOptions = { SES: new AWS.SES(), diff --git a/types/nodemailer/lib/mailer/index.d.ts b/types/nodemailer/lib/mailer/index.d.ts index f08c2d085d..bd9dd7ba8d 100644 --- a/types/nodemailer/lib/mailer/index.d.ts +++ b/types/nodemailer/lib/mailer/index.d.ts @@ -3,7 +3,7 @@ import { EventEmitter } from 'events'; import { Socket } from 'net'; import { Readable } from 'stream'; -import { URL } from 'url'; +import { Url } from 'url'; import { SentMessageInfo, Transport, TransportOptions } from '../..'; import * as shared from '../shared'; @@ -34,7 +34,7 @@ declare namespace Mail { /** String, Buffer or a Stream contents for the attachmentent */ content?: string | Buffer | Readable; /** path to a file or an URL (data uris are allowed as well) if you want to stream the file instead of including it (better for larger attachments) */ - path?: string | URL; + path?: string | Url; } interface Attachment extends AttachmentLike { @@ -175,11 +175,11 @@ declare class Mail extends EventEmitter { setupProxy(proxyUrl: string): void; set(key: 'oauth2_provision_cb', value: (user: string, renew: boolean, callback: (err: Error | null, accessToken?: string, expires?: number) => void) => void): Map; - set(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a', value: (proxy: URL, options: TransportOptions, callback: (err: Error | null, socketOptions?: { connection: Socket }) => void) => void): Map; + set(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a', value: (proxy: Url, options: TransportOptions, callback: (err: Error | null, socketOptions?: { connection: Socket }) => void) => void): Map; set(key: string, value: any): Map; get(key: 'oauth2_provision_cb'): (user: string, renew: boolean, callback: (err: Error | null, accessToken: string, expires: number) => void) => void; - get(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a'): (proxy: URL, options: TransportOptions, callback: (err: Error | null, socketOptions: { connection: Socket }) => void) => void; + get(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a'): (proxy: Url, options: TransportOptions, callback: (err: Error | null, socketOptions: { connection: Socket }) => void) => void; get(key: string): any; addListener(event: 'error', listener: (err: Error) => void): this; diff --git a/types/normalize-package-data/tsconfig.json b/types/normalize-package-data/tsconfig.json index 0e79738d04..3105673d24 100644 --- a/types/normalize-package-data/tsconfig.json +++ b/types/normalize-package-data/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "normalize-package-data-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/notyf/tsconfig.json b/types/notyf/tsconfig.json index 9cf78d162a..18fb007211 100644 --- a/types/notyf/tsconfig.json +++ b/types/notyf/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "notyf-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/nouislider/index.d.ts b/types/nouislider/index.d.ts index 0e070e89c7..76b62371fe 100644 --- a/types/nouislider/index.d.ts +++ b/types/nouislider/index.d.ts @@ -179,7 +179,7 @@ declare namespace noUiSlider { * To get the current slider value. For one-handle sliders, calling .get() will return the value. * For two-handle sliders, an array[value, value] will be returned. */ - get(): number | number[]; + get(): string | string[]; /** * noUiSlider will keep your values within the slider range, which saves you a bunch of validation. * If you have configured the slider to use one handle, you can change the current value by passing diff --git a/types/nouislider/tslint.json b/types/nouislider/tslint.json index a41bf5d19a..b6afb8acee 100644 --- a/types/nouislider/tslint.json +++ b/types/nouislider/tslint.json @@ -21,6 +21,7 @@ "no-boolean-literal-compare": false, "no-conditional-assignment": false, "no-consecutive-blank-lines": false, + "no-const-enum": false, "no-construct": false, "no-declare-current-package": false, "no-duplicate-imports": false, diff --git a/types/nouislider/v8/tslint.json b/types/nouislider/v8/tslint.json index a41bf5d19a..b6afb8acee 100644 --- a/types/nouislider/v8/tslint.json +++ b/types/nouislider/v8/tslint.json @@ -21,6 +21,7 @@ "no-boolean-literal-compare": false, "no-conditional-assignment": false, "no-consecutive-blank-lines": false, + "no-const-enum": false, "no-construct": false, "no-declare-current-package": false, "no-duplicate-imports": false, diff --git a/types/novnc-core/tslint.json b/types/novnc-core/tslint.json index 3db14f85ea..3224b40b8b 100644 --- a/types/novnc-core/tslint.json +++ b/types/novnc-core/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-const-enum": false + } +} diff --git a/types/npm-package-arg/npm-package-arg-tests.ts b/types/npm-package-arg/npm-package-arg-tests.ts index ed95eb5243..d7f08c6c10 100644 --- a/types/npm-package-arg/npm-package-arg-tests.ts +++ b/types/npm-package-arg/npm-package-arg-tests.ts @@ -1,4 +1,4 @@ -import * as npa from "npm-package-arg"; +import npa = require("npm-package-arg"); const result1 = npa("npm-package-arg@5.1"); const result2 = npa("npm-package-arg@5.1", ".."); diff --git a/types/npm-packlist/index.d.ts b/types/npm-packlist/index.d.ts new file mode 100644 index 0000000000..934d2f8967 --- /dev/null +++ b/types/npm-packlist/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for npm-packlist 1.1 +// Project: https://github.com/npm/npm-packlist +// Definitions by: Klaus Meinhardt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +declare function packlist(options?: packlist.Options): Promise; +declare function packlist(options: packlist.Options | undefined, callback: (result: string[]) => T): Promise; +declare namespace packlist { + interface Options { + /** Directory to walk recusively. Defaults to `process.cwd()`. */ + path?: string; + } + function sync(options?: Options): string[]; +} +export = packlist; diff --git a/types/npm-packlist/npm-packlist-tests.ts b/types/npm-packlist/npm-packlist-tests.ts new file mode 100644 index 0000000000..162a7d86f5 --- /dev/null +++ b/types/npm-packlist/npm-packlist-tests.ts @@ -0,0 +1,14 @@ +import packlist = require('npm-packlist'); + +let result: string[] = packlist.sync(); +result = packlist.sync({}); +result = packlist.sync({path: 'foo'}); + +(async () => { + result = await packlist(); + result = await packlist({}); + result = await packlist({path: 'foo'}); + + packlist(undefined, (r) => result = r); + packlist({path: 'foo'}, (r) => result = r); +})(); diff --git a/types/npm-packlist/tsconfig.json b/types/npm-packlist/tsconfig.json new file mode 100644 index 0000000000..2c60fe863a --- /dev/null +++ b/types/npm-packlist/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", + "npm-packlist-tests.ts" + ] +} \ No newline at end of file diff --git a/types/npm-packlist/tslint.json b/types/npm-packlist/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/npm-packlist/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/ns-api/ns-api-tests.ts b/types/ns-api/ns-api-tests.ts index 5063a97e48..ab8c7e343d 100644 --- a/types/ns-api/ns-api-tests.ts +++ b/types/ns-api/ns-api-tests.ts @@ -1,4 +1,4 @@ -import * as NsApi from "ns-api"; +import NsApi = require("ns-api"); declare var console: { log(msg: any): string }; diff --git a/types/nsqjs/tsconfig.json b/types/nsqjs/tsconfig.json index 6681afbdb9..2e65f5637c 100644 --- a/types/nsqjs/tsconfig.json +++ b/types/nsqjs/tsconfig.json @@ -14,11 +14,10 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "strictFunctionTypes": true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", "nsqjs-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/nunjucks/tsconfig.json b/types/nunjucks/tsconfig.json index 5824ce2f1f..4324f01fa8 100644 --- a/types/nunjucks/tsconfig.json +++ b/types/nunjucks/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "nunjucks-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/o.js/o.js-tests.ts b/types/o.js/o.js-tests.ts index 26cc187723..be3e5c824a 100644 --- a/types/o.js/o.js-tests.ts +++ b/types/o.js/o.js-tests.ts @@ -1,4 +1,4 @@ -import * as o from 'o.js'; +import o = require('o.js'); import * as Q from "q"; interface Product { diff --git a/types/oauth2-server/index.d.ts b/types/oauth2-server/index.d.ts index a423f48a58..06b6fbadb0 100644 --- a/types/oauth2-server/index.d.ts +++ b/types/oauth2-server/index.d.ts @@ -5,7 +5,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -import { Request, RequestHandler } from "express"; +import Express = require("express"); /** * Represents an OAuth2 server instance. diff --git a/types/oauth2-server/oauth2-server-tests.ts b/types/oauth2-server/oauth2-server-tests.ts index be8fa83705..faf9976873 100644 --- a/types/oauth2-server/oauth2-server-tests.ts +++ b/types/oauth2-server/oauth2-server-tests.ts @@ -1,5 +1,5 @@ -import * as express from "express"; -import * as OAuth2Server from "oauth2-server"; +import express = require("express"); +import OAuth2Server = require("oauth2-server"); const oauth2Model: OAuth2Server.AuthorizationCodeModel = { getClient: async (clientId: string, clientSecret: string): Promise => { diff --git a/types/object-assign/object-assign-tests.ts b/types/object-assign/object-assign-tests.ts index e7c58cf5fb..dc8db6ba07 100644 --- a/types/object-assign/object-assign-tests.ts +++ b/types/object-assign/object-assign-tests.ts @@ -1,4 +1,4 @@ -import * as objectAssign from 'object-assign'; +import objectAssign = require('object-assign'); interface Target { hellow: string; @@ -9,7 +9,7 @@ interface Source1 { } interface Result extends Target, Source1 { - + } interface Source2 { @@ -17,7 +17,7 @@ interface Source2 { } interface Result2 extends Result, Source2 { - + } interface Source3 { @@ -25,7 +25,7 @@ interface Source3 { } interface Result3 extends Result2, Source3 { - + } interface Source4 { @@ -33,7 +33,7 @@ interface Source4 { } interface Result4 extends Result3, Source4 { - + } interface Source5 { @@ -41,7 +41,7 @@ interface Source5 { } interface Result5 extends Result4, Source5 { - + } function assign1(): Result { diff --git a/types/object-hash/index.d.ts b/types/object-hash/index.d.ts index c6b16df950..4da49c262c 100644 --- a/types/object-hash/index.d.ts +++ b/types/object-hash/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for object-hash v1.1.8 +// Type definitions for object-hash v1.2.0 // Project: https://github.com/puleos/object-hash // Definitions by: Michael Zabka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -18,6 +18,7 @@ declare namespace ObjectHash { respectFunctionNames?: boolean; unorderedArrays?: boolean; unorderedSets?: boolean; + excludeKeys?: (key: string) => boolean; } interface HashTableItem { diff --git a/types/object-inspect/tsconfig.json b/types/object-inspect/tsconfig.json index 1f167ba039..295f490d24 100644 --- a/types/object-inspect/tsconfig.json +++ b/types/object-inspect/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "object-inspect-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/object-merge/index.d.ts b/types/object-merge/index.d.ts new file mode 100644 index 0000000000..bd9f0ce8ee --- /dev/null +++ b/types/object-merge/index.d.ts @@ -0,0 +1,164 @@ +// Type definitions for object-merge 2.5 +// Project: https://github.com/matthewkastor/object-merge +// Definitions by: OpenByteDev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 2.2 + +interface ObjectMergeOptions { + depth: number|boolean; + throwOnCircularRef: boolean; +} + +interface ObjectMerge { + /** + * Merges JavaScript objects recursively without altering the objects merged. + * @author Matthew Kastor + * @param [opts] An options object created by + * objectMerge.createOptions. Options must be specified as the first argument + * and must be an object created with createOptions or else the object will + * not be recognized as an options object and will be merged instead. + * @param shadows [[shadows]...] One or more objects to merge. Each + * argument given will be treated as an object to merge. Each object + * overwrites the previous objects descendant properties if the property name + * matches. If objects properties are objects they will be merged recursively + * as well. + * @returns Returns a single merged object composed from clones of the + * input objects. + * @example + * var objectMerge = require('object-merge'); + * var x = { + * a : 'a', + * b : 'b', + * c : { + * d : 'd', + * e : 'e', + * f : { + * g : 'g' + * } + * } + * }; + * var y = { + * a : '`a', + * b : '`b', + * c : { + * d : '`d' + * } + * }; + * var z = { + * a : { + * b : '``b' + * }, + * fun : function foo () { + * return 'foo'; + * }, + * aps : Array.prototype.slice + * }; + * var out = objectMerge(x, y, z); + * // out.a will be { + * // b : '``b' + * // } + * // out.b will be '`b' + * // out.c will be { + * // d : '`d', + * // e : 'e', + * // f : { + * // g : 'g' + * // } + * // } + * // out.fun will be a clone of z.fun + * // out.aps will be equal to z.aps + */ + (opts: ObjectMergeOptions, ...shadows: object[]): object; + /** + * Merges JavaScript objects recursively without altering the objects merged. + * @author Matthew Kastor + * @param shadows [[shadows]...] One or more objects to merge. Each + * argument given will be treated as an object to merge. Each object + * overwrites the previous objects descendant properties if the property name + * matches. If objects properties are objects they will be merged recursively + * as well. + * @returns Returns a single merged object composed from clones of the + * input objects. + * @example + * var objectMerge = require('object-merge'); + * var x = { + * a : 'a', + * b : 'b', + * c : { + * d : 'd', + * e : 'e', + * f : { + * g : 'g' + * } + * } + * }; + * var y = { + * a : '`a', + * b : '`b', + * c : { + * d : '`d' + * } + * }; + * var z = { + * a : { + * b : '``b' + * }, + * fun : function foo () { + * return 'foo'; + * }, + * aps : Array.prototype.slice + * }; + * var out = objectMerge(x, y, z); + * // out.a will be { + * // b : '``b' + * // } + * // out.b will be '`b' + * // out.c will be { + * // d : '`d', + * // e : 'e', + * // f : { + * // g : 'g' + * // } + * // } + * // out.fun will be a clone of z.fun + * // out.aps will be equal to z.aps + */ + (...shadows: object[]): object; + /** + * Creates a new options object suitable for use with objectMerge. + * @param [opts] An object specifying the options. + * @param [opts.depth = false] Specifies the depth to traverse objects + * during merging. If this is set to false then there will be no depth limit. + * @param [opts.throwOnCircularRef = true] Set to false to suppress + * errors on circular references. + * @returns Returns an instance of ObjectMergeOptions + * to be used with objectMerge. + * @example + * var opts = objectMerge.createOptions({ + * depth : 2, + * throwOnCircularRef : false + * }); + * var obj1 = { + * a1 : { + * a2 : { + * a3 : {} + * } + * } + * }; + * var obj2 = { + * a1 : { + * a2 : { + * a3 : 'will not be in output' + * }, + * a22 : {} + * } + * }; + * objectMerge(opts, obj1, obj2); + */ + createOptions: (options: object) => ObjectMergeOptions; +} + +declare const objectMerge: ObjectMerge; + +export = objectMerge; diff --git a/types/object-merge/object-merge-tests.ts b/types/object-merge/object-merge-tests.ts new file mode 100644 index 0000000000..edaf9885ba --- /dev/null +++ b/types/object-merge/object-merge-tests.ts @@ -0,0 +1,47 @@ +import objectMerge = require('object-merge'); + +const x = { + a : 'a', + b : 'b', + c : { + d : 'd', + e : 'e', + f : { + g : 'g' + } + } +}; +const y = { + a : '`a', + b : '`b', + c : { + d : '`d' + } +}; +const z = { + a : { + b : '``b' + }, + fun : function foo() { + return 'foo'; + }, + aps : Array.prototype.slice +}; +const out = objectMerge(x, y, z); + +const a = { + a1 : { + a2 : { + a3 : {} + } + } +}; +const b = { + b1 : { + b2 : { + b3 : {} + } + } +}; +const opts = objectMerge.createOptions({depth : 2}); +const res = objectMerge(opts, a, b); diff --git a/types/object-merge/tsconfig.json b/types/object-merge/tsconfig.json new file mode 100644 index 0000000000..c098631639 --- /dev/null +++ b/types/object-merge/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "object-merge-tests.ts" + ] +} \ No newline at end of file diff --git a/types/object-merge/tslint.json b/types/object-merge/tslint.json new file mode 100644 index 0000000000..4e88071852 --- /dev/null +++ b/types/object-merge/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} diff --git a/types/object-refs/object-refs-tests.ts b/types/object-refs/object-refs-tests.ts index 9b602aea0d..ba71756c3c 100644 --- a/types/object-refs/object-refs-tests.ts +++ b/types/object-refs/object-refs-tests.ts @@ -1,4 +1,4 @@ -import * as Refs from 'object-refs'; +import Refs = require('object-refs'); let refs = new Refs({ name: 'wheels', collection: true, enumerable: true }, { name: 'car' }); diff --git a/types/odata/index.d.ts b/types/odata/index.d.ts index 349d48763b..e56ac4296c 100644 --- a/types/odata/index.d.ts +++ b/types/odata/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for odata v0.3.4 +// Type definitions for odata v0.3 // Project: https://github.com/janhommes/odata // Definitions by: Jan Hommes , Jean-Christophe Chalte // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -26,14 +26,16 @@ declare module 'odata' { } interface OHandler { - inlinecount : number - data : T + inlinecount: number; // if inlinecount is set, here the counting is gold + data: T; // holds the data after an callback + param: {}; // this object holds all parameter for a route config(options ?: Options) : OHandler progress(callback : () => any) : OHandler - get(callback ?: (data : T) => void) : Q.Promise> - save(callback ?: (data : T) => void) : Q.Promise> + get(callback ?: (data : T) => void, errorCallback?: (status: number) => void) : Q.Promise> + save(callback ?: (data : T) => void, errorCallback?: (status: number) => void) : Q.Promise> + query: () => string; post(params : any) : OHandler patch(params : any) : OHandler @@ -78,11 +80,14 @@ declare module 'odata' { deleteRef(resource : string, id : string | number) : OHandler } - interface OFn extends OHandler { - (options ?: string | Options) : OHandler + interface OHandlerStatic { + (): OHandlerStatic; + (options?: string | Options): OHandler<{}>; + config: (config: Options) => OHandlerStatic; + isEndpoint: () => boolean; } - var o : OFn<{}>; + var o : OHandlerStatic; export = o } \ No newline at end of file diff --git a/types/odata/odata-tests.ts b/types/odata/odata-tests.ts index 522dc3d529..743c5cd906 100644 --- a/types/odata/odata-tests.ts +++ b/types/odata/odata-tests.ts @@ -1,4 +1,4 @@ -import * as o from 'odata'; +import o = require('odata'); import * as Q from "q"; interface Product { @@ -20,6 +20,8 @@ interface Category { o('http://services.odata.org/V4/OData/OData.svc/Products') .get(function(data) { console.log(data); //returns an array of Product data + }, function(status) { + console.error(status); // error with status }); @@ -70,7 +72,8 @@ o('http://services.odata.org/V4/OData/OData.svc/Products(2)') .get() .then(function(oHandler) { console.log(oHandler.data); - }).fail(function(ex) { + }) + .fail(function(ex) { console.log(ex); }); @@ -114,10 +117,12 @@ o('http://services.odata.org/V4/OData/OData.svc/Products') .get() .then(function(oHandler) { oHandler.data.Name="NewName"; - return(o.save()); - }).then(function(oHandler) { + return(oHandler.save()); + }) + .then(function(oHandler) { console.log(oHandler.data.Name); //NewName - }).fail(function(ex) { + }) + .fail(function(ex) { console.log("error"); }); @@ -132,7 +137,12 @@ o('Products').get(function(data) { //same result like the first example on this page }); - +const oEequest = o('http://services.odata.org/V4/OData/OData.svc/Products') + .find(2); +const queryString = oEequest.query(); +if (queryString !== 'http://services.odata.org/V4/OData/OData.svc/Products(2)') { + throw new Error('assert error'); +} //basic config o().config({ diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index e24b6c4a2c..159293057e 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Office.js // Project: http://dev.office.com -// Definitions by: OfficeDev , Lance Austin +// Definitions by: OfficeDev , Lance Austin , Michael Zlatkovsky , Kim Brandl , Ricky Kirkham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* @@ -134,17 +134,14 @@ declare namespace Office { export interface Error { /** * Gets the numeric code of the error. - * @since 1.0 */ code: number; /** * Gets the name of the error. - * @since 1.0 */ message: string; /** * Gets a detailed description of the error. - * @since 1.0 */ name: string; } @@ -244,7 +241,7 @@ declare namespace Office { bodyBackgroundColor: string; bodyForegroundColor: string; controlBackgroundColor: string; - controlForgroundColor: string; + controlForegroundColor: string; } /** * Dialog object returned as part of the displayDialogAsync callback. The object exposes methods for registering event handlers and closing the dialog @@ -2610,7 +2607,22 @@ declare namespace OfficeExtension { /** Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context and retrieving properties of loaded Office objects for use in your code.�This method returns a promise, which is resolved when the synchronization is complete. */ sync(passThroughValue?: T): IPromise; } + + export interface EmbeddedOptions { + sessionKey?: string, + container?: HTMLElement, + id?: string; + timeoutInMilliseconds?: number; + height?: string; + width?: string; + } + + class EmbeddedSession { + constructor(url: string, options?: EmbeddedOptions); + public init(): IPromise; + } } + declare namespace OfficeExtension { /** Contains the result for methods that return primitive types. The object's value property is retrieved from the document after "context.sync()" is invoked. */ class ClientResult { @@ -22314,3 +22326,2256 @@ declare namespace OneNote { //////////////////////////////////////////////////////////////// /////////////////////// End OneNote APIs /////////////////////// //////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////// +/////////////////////// Begin Visio APIs /////////////////////// +//////////////////////////////////////////////////////////////// + + + +declare namespace Visio { + /** + * + * Provides information about the shape that raised the ShapeMouseEnter event. + * + * [Api set: 1.1] + */ + interface ShapeMouseEnterEventArgs { + /** + * + * Gets the name of the page which has the shape object that raised the ShapeMouseEnter event. + * + * [Api set: 1.1] + */ + pageName: string; + /** + * + * Gets the shape object that raised the ShapeMouseEnter event. + * + * [Api set: 1.1] + */ + shapeName: string; + } + /** + * + * Provides information about the shape that raised the ShapeMouseLeave event. + * + * [Api set: 1.1] + */ + interface ShapeMouseLeaveEventArgs { + /** + * + * Gets the name of the page which has the shape object that raised the ShapeMouseLeave event. + * + * [Api set: 1.1] + */ + pageName: string; + /** + * + * Gets the shape object that raised the ShapeMouseLeave event. + * + * [Api set: 1.1] + */ + shapeName: string; + } + /** + * + * Provides information about the page that raised the PageLoadComplete event. + * + * [Api set: 1.1] + */ + interface PageLoadCompleteEventArgs { + /** + * + * Gets the name of the page that raised the PageLoad event. + * + * [Api set: 1.1] + */ + pageName: string; + /** + * + * Gets the success/failure of the PageLoadComplete event. + * + * [Api set: 1.1] + */ + success: boolean; + } + /** + * + * Provides information about the document that raised the DataRefreshComplete event. + * + * [Api set: 1.1] + */ + interface DataRefreshCompleteEventArgs { + /** + * + * Gets the document object that raised the DataRefreshComplete event. + * + * [Api set: 1.1] + */ + document: Visio.Document; + /** + * + * Gets the success/failure of the DataRefreshComplete event. + * + * [Api set: 1.1] + */ + success: boolean; + } + /** + * + * Provides information about the shape collection that raised the SelectionChanged event. + * + * [Api set: 1.1] + */ + interface SelectionChangedEventArgs { + /** + * + * Gets the name of the page which has the ShapeCollection object that raised the SelectionChanged event. + * + * [Api set: 1.1] + */ + pageName: string; + /** + * + * Gets the ShapeCollection object that raised the SelectionChanged event. + * + * [Api set: 1.1] + */ + shapeNames: Array; + } + /** + * + * Provides information about the drawing that raised the DiagramLoadComplete event. + * + * [Api set: 1.1] + */ + interface DocumentLoadCompleteEventArgs { + /** + * + * Gets the success/failure of the DocumentLoadComplete event. + * + * [Api set: 1.1] + */ + success: boolean; + } + /** + * + * Represents the Application. + * + * [Api set: 1.1] + */ + class Application extends OfficeExtension.ClientObject { + /** + * + * Show/Hide the application borders. + * + * [Api set: 1.1] + */ + showBorders: boolean; + /** + * + * Show or Hide the standard toolbars. + * + * [Api set: 1.1] + */ + showToolbars: boolean; + /** Sets multiple properties on the object at the same time, based on JSON input. */ + set(properties: Interfaces.ApplicationUpdateData, options?: { + /** + * Throw an error if the passed-in property list includes read-only properties (default = true). + */ + throwOnReadOnly?: boolean; + }): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Application): void; + /** + * + * Show or Hide a particular toolbar. + * + * [Api set: 1.1] + */ + showToolbar(id: string, show: boolean): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.ApplicationLoadOptions): Visio.Application; + load(option?: string | string[]): Visio.Application; + load(option?: { + select?: string; + expand?: string; + }): Visio.Application; + toJSON(): Visio.Interfaces.ApplicationData; + } + /** + * + * Represents the Document class. + * + * [Api set: 1.1] + */ + class Document extends OfficeExtension.ClientObject { + /** + * + * Represents a Visio application instance that contains this document. Read-only. + * + * [Api set: 1.1] + */ + readonly application: Visio.Application; + /** + * + * Represents a collection of pages associated with the document. Read-only. + * + * [Api set: 1.1] + */ + readonly pages: Visio.PageCollection; + /** + * + * Returns the DocumentView object. + * + * [Api set: 1.1] + */ + readonly view: Visio.DocumentView; + /** Sets multiple properties on the object at the same time, based on JSON input. */ + set(properties: Interfaces.DocumentUpdateData, options?: { + /** + * Throw an error if the passed-in property list includes read-only properties (default = true). + */ + throwOnReadOnly?: boolean; + }): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Document): void; + /** + * + * Returns the Active Page of the document. + * + * [Api set: 1.1] + */ + getActivePage(): Visio.Page; + /** + * + * Set the Active Page of the document. + * + * [Api set: 1.1] + * + * @param PageName Name of the page + */ + setActivePage(PageName: string): void; + /** + * + * Triggers the refresh of the data in the Diagram, for all pages. + * + * [Api set: 1.1] + */ + startDataRefresh(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.DocumentLoadOptions): Visio.Document; + load(option?: string | string[]): Visio.Document; + load(option?: { + select?: string; + expand?: string; + }): Visio.Document; + /** + * + * Occurs when the data is refreshed in the diagram. + * + * [Api set: 1.1] + */ + readonly onDataRefreshComplete: OfficeExtension.EventHandlers; + /** + * + * Occurs when the Document is loaded, refreshed, or changed. + * + * [Api set: 1.1] + */ + readonly onDocumentLoadComplete: OfficeExtension.EventHandlers; + /** + * + * Occurs when the page is finished loading. + * + * [Api set: 1.1] + */ + readonly onPageLoadComplete: OfficeExtension.EventHandlers; + /** + * + * Occurs when the current selection of shapes changes. + * + * [Api set: 1.1] + */ + readonly onSelectionChanged: OfficeExtension.EventHandlers; + /** + * + * Occurs when the user moves the mouse pointer into the bounding box of a shape. + * + * [Api set: 1.1] + */ + readonly onShapeMouseEnter: OfficeExtension.EventHandlers; + /** + * + * Occurs when the user moves the mouse out of the bounding box of a shape. + * + * [Api set: 1.1] + */ + readonly onShapeMouseLeave: OfficeExtension.EventHandlers; + toJSON(): Visio.Interfaces.DocumentData; + } + /** + * + * Represents the DocumentView class. + * + * [Api set: 1.1] + */ + class DocumentView extends OfficeExtension.ClientObject { + /** + * + * Disable Hyperlinks. + * + * [Api set: 1.1] + */ + disableHyperlinks: boolean; + /** + * + * Disable Pan. + * + * [Api set: 1.1] + */ + disablePan: boolean; + /** + * + * Disable Zoom. + * + * [Api set: 1.1] + */ + disableZoom: boolean; + /** + * + * Disable Hyperlinks. + * + * [Api set: 1.1] + */ + hideDiagramBoundary: boolean; + /** Sets multiple properties on the object at the same time, based on JSON input. */ + set(properties: Interfaces.DocumentViewUpdateData, options?: { + /** + * Throw an error if the passed-in property list includes read-only properties (default = true). + */ + throwOnReadOnly?: boolean; + }): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: DocumentView): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.DocumentViewLoadOptions): Visio.DocumentView; + load(option?: string | string[]): Visio.DocumentView; + load(option?: { + select?: string; + expand?: string; + }): Visio.DocumentView; + toJSON(): Visio.Interfaces.DocumentViewData; + } + /** + * + * Represents the Page class. + * + * [Api set: 1.1] + */ + class Page extends OfficeExtension.ClientObject { + /** + * + * All shapes in the page. Read-only. + * + * [Api set: 1.1] + */ + readonly allShapes: Visio.ShapeCollection; + /** + * + * Returns the Comments Collection + * + * [Api set: 1.1] + */ + readonly comments: Visio.CommentCollection; + /** + * + * Shapes at root level, in the page. Read-only. + * + * [Api set: 1.1] + */ + readonly shapes: Visio.ShapeCollection; + /** + * + * Returns the view of the page. Read-only. + * + * [Api set: 1.1] + */ + readonly view: Visio.PageView; + /** + * + * Returns the height of the page. Read-only. + * + * [Api set: 1.1] + */ + readonly height: number; + /** + * + * Index of the Page. + * + * [Api set: 1.1] + */ + readonly index: number; + /** + * + * Whether the page is a background page or not. Read-only. + * + * [Api set: 1.1] + */ + readonly isBackground: boolean; + /** + * + * Page name. Read-only. + * + * [Api set: 1.1] + */ + readonly name: string; + /** + * + * Returns the width of the page. Read-only. + * + * [Api set: 1.1] + */ + readonly width: number; + /** Sets multiple properties on the object at the same time, based on JSON input. */ + set(properties: Interfaces.PageUpdateData, options?: { + /** + * Throw an error if the passed-in property list includes read-only properties (default = true). + */ + throwOnReadOnly?: boolean; + }): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Page): void; + /** + * + * Set the page as Active Page of the document. + * + * [Api set: 1.1] + */ + activate(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.PageLoadOptions): Visio.Page; + load(option?: string | string[]): Visio.Page; + load(option?: { + select?: string; + expand?: string; + }): Visio.Page; + toJSON(): Visio.Interfaces.PageData; + } + /** + * + * Represents the PageView class. + * + * [Api set: 1.1] + */ + class PageView extends OfficeExtension.ClientObject { + /** + * + * Get/Set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. + * + * [Api set: 1.1] + */ + zoom: number; + /** Sets multiple properties on the object at the same time, based on JSON input. */ + set(properties: Interfaces.PageViewUpdateData, options?: { + /** + * Throw an error if the passed-in property list includes read-only properties (default = true). + */ + throwOnReadOnly?: boolean; + }): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: PageView): void; + /** + * + * Pans the Visio drawing to place the specified shape in the center of the view. + * + * [Api set: 1.1] + * + * @param ShapeId ShapeId to be seen in the center. + */ + centerViewportOnShape(ShapeId: number): void; + /** + * + * Fit Page to current window. + * + * [Api set: 1.1] + */ + fitToWindow(): void; + /** + * + * Returns the position object that specifies the position of the page in the view. + * + * [Api set: 1.1] + */ + getPosition(): OfficeExtension.ClientResult; + /** + * + * Represents the Selection in the page. + * + * [Api set: 1.1] + */ + getSelection(): Visio.Selection; + /** + * + * To check if the shape is in view of the page or not. + * + * [Api set: 1.1] + * + * @param Shape Shape to be checked. + */ + isShapeInViewport(Shape: Visio.Shape): OfficeExtension.ClientResult; + /** + * + * Sets the position of the page in the view. + * + * [Api set: 1.1] + * + * @param Position Position object that specifies the new position of the page in the view. + */ + setPosition(Position: Visio.Position): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.PageViewLoadOptions): Visio.PageView; + load(option?: string | string[]): Visio.PageView; + load(option?: { + select?: string; + expand?: string; + }): Visio.PageView; + toJSON(): Visio.Interfaces.PageViewData; + } + /** + * + * Represents a collection of Page objects that are part of the document. + * + * [Api set: 1.1] + */ + class PageCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Array; + /** + * + * Gets the number of pages in the collection. + * + * [Api set: 1.1] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a page using its key (name or Id). + * + * [Api set: 1.1] + * + * @param key Key is the name or Id of the page to be retrieved. + */ + getItem(key: number | string): Visio.Page; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.PageCollectionLoadOptions & Visio.Interfaces.CollectionLoadOptions): Visio.PageCollection; + load(option?: string | string[]): Visio.PageCollection; + load(option?: OfficeExtension.LoadOption): Visio.PageCollection; + toJSON(): Visio.Interfaces.PageCollectionData; + } + /** + * + * Represents the Shape Collection. + * + * [Api set: 1.1] + */ + class ShapeCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Array; + /** + * + * Gets the number of Shapes in the collection. + * + * [Api set: 1.1] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a Shape using its key (name or Index). + * + * [Api set: 1.1] + * + * @param key Key is the Name or Index of the shape to be retrieved. + */ + getItem(key: number | string): Visio.Shape; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.ShapeCollectionLoadOptions & Visio.Interfaces.CollectionLoadOptions): Visio.ShapeCollection; + load(option?: string | string[]): Visio.ShapeCollection; + load(option?: OfficeExtension.LoadOption): Visio.ShapeCollection; + toJSON(): Visio.Interfaces.ShapeCollectionData; + } + /** + * + * Represents the Shape class. + * + * [Api set: 1.1] + */ + class Shape extends OfficeExtension.ClientObject { + /** + * + * Returns the Comments Collection + * + * [Api set: 1.1] + */ + readonly comments: Visio.CommentCollection; + /** + * + * Returns the Hyperlinks collection for a Shape object. Read-only. + * + * [Api set: 1.1] + */ + readonly hyperlinks: Visio.HyperlinkCollection; + /** + * + * Returns the Shape's Data Section. Read-only. + * + * [Api set: 1.1] + */ + readonly shapeDataItems: Visio.ShapeDataItemCollection; + /** + * + * Gets SubShape Collection. + * + * [Api set: 1.1] + */ + readonly subShapes: Visio.ShapeCollection; + /** + * + * Returns the view of the shape. Read-only. + * + * [Api set: 1.1] + */ + readonly view: Visio.ShapeView; + /** + * + * Shape's Identifier. + * + * [Api set: 1.1] + */ + readonly id: number; + /** + * + * Shape's name. + * + * [Api set: 1.1] + */ + readonly name: string; + /** + * + * Returns true, if shape is selected. User can set true to select the shape explicitly. + * + * [Api set: 1.1] + */ + select: boolean; + /** + * + * Shape's Text. + * + * [Api set: 1.1] + */ + readonly text: string; + /** Sets multiple properties on the object at the same time, based on JSON input. */ + set(properties: Interfaces.ShapeUpdateData, options?: { + /** + * Throw an error if the passed-in property list includes read-only properties (default = true). + */ + throwOnReadOnly?: boolean; + }): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Shape): void; + /** + * + * Returns the BoundingBox object that specifies bounding box of the shape. + * + * [Api set: 1.1] + */ + getBounds(): OfficeExtension.ClientResult; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.ShapeLoadOptions): Visio.Shape; + load(option?: string | string[]): Visio.Shape; + load(option?: { + select?: string; + expand?: string; + }): Visio.Shape; + toJSON(): Visio.Interfaces.ShapeData; + } + /** + * + * Represents the ShapeView class. + * + * [Api set: 1.1] + */ + class ShapeView extends OfficeExtension.ClientObject { + /** + * + * Represents the highlight around the shape. + * + * [Api set: 1.1] + */ + highlight: Visio.Highlight; + /** Sets multiple properties on the object at the same time, based on JSON input. */ + set(properties: Interfaces.ShapeViewUpdateData, options?: { + /** + * Throw an error if the passed-in property list includes read-only properties (default = true). + */ + throwOnReadOnly?: boolean; + }): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: ShapeView): void; + /** + * + * Adds an overlay on top of the shape. + * + * [Api set: 1.1] + * + * @param OverlayType An Overlay Type -Text, Image. + * @param Content Content of Overlay. + * @param OverlayHorizontalAlignment Horizontal Alignment of Overlay - Left, Center, Right + * @param OverlayVerticalAlignment Vertical Alignment of Overlay - Top, Middle, Bottom + * @param Width Overlay Width. + * @param Height Overlay Height. + */ + addOverlay(OverlayType: string, Content: string, OverlayHorizontalAlignment: string, OverlayVerticalAlignment: string, Width: number, Height: number): OfficeExtension.ClientResult; + /** + * + * Removes particular overlay or all overlays on the Shape. + * + * [Api set: 1.1] + * + * @param OverlayId An Overlay Id. Removes the specific overlay id from the shape. + */ + removeOverlay(OverlayId: number): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.ShapeViewLoadOptions): Visio.ShapeView; + load(option?: string | string[]): Visio.ShapeView; + load(option?: { + select?: string; + expand?: string; + }): Visio.ShapeView; + toJSON(): Visio.Interfaces.ShapeViewData; + } + /** + * + * Represents the Position of the object in the view. + * + * [Api set: 1.1] + */ + interface Position { + /** + * + * An integer that specifies the x-coordinate of the object, which is the signed value of the distance in pixels from the viewport's center to the left boundary of the page. + * + * [Api set: 1.1] + */ + x: number; + /** + * + * An integer that specifies the y-coordinate of the object, which is the signed value of the distance in pixels from the viewport's center to the top boundary of the page. + * + * [Api set: 1.1] + */ + y: number; + } + /** + * + * Represents the BoundingBox of the shape. + * + * [Api set: 1.1] + */ + interface BoundingBox { + /** + * + * The distance between the top and bottom edges of the bounding box of the shape, excluding any data graphics associated with the shape. + * + * [Api set: 1.1] + */ + height: number; + /** + * + * The distance between the left and right edges of the bounding box of the shape, excluding any data graphics associated with the shape. + * + * [Api set: 1.1] + */ + width: number; + /** + * + * An integer that specifies the x-coordinate of the bounding box. + * + * [Api set: 1.1] + */ + x: number; + /** + * + * An integer that specifies the y-coordinate of the bounding box. + * + * [Api set: 1.1] + */ + y: number; + } + /** + * + * Represents the highlight data added to the shape. + * + * [Api set: 1.1] + */ + interface Highlight { + /** + * + * A string that specifies the color of the highlight. It must have the form "#RRGGBB", where each letter represents a hexadecimal digit between 0 and F, and where RR is the red value between 0 and 0xFF (255), GG the green value between 0 and 0xFF (255), and BB is the blue value between 0 and 0xFF (255). + * + * [Api set: 1.1] + */ + color: string; + /** + * + * A positive integer that specifies the width of the highlight's stroke in pixels. + * + * [Api set: 1.1] + */ + width: number; + } + /** + * + * Represents the ShapeDataItemCollection for a given Shape. + * + * [Api set: 1.1] + */ + class ShapeDataItemCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Array; + /** + * + * Gets the number of Shape Data Items. + * + * [Api set: 1.1] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets the ShapeDataItem using its name. + * + * [Api set: 1.1] + * + * @param key Key is the name of the ShapeDataItem to be retrieved. + */ + getItem(key: string): Visio.ShapeDataItem; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.ShapeDataItemCollectionLoadOptions & Visio.Interfaces.CollectionLoadOptions): Visio.ShapeDataItemCollection; + load(option?: string | string[]): Visio.ShapeDataItemCollection; + load(option?: OfficeExtension.LoadOption): Visio.ShapeDataItemCollection; + toJSON(): Visio.Interfaces.ShapeDataItemCollectionData; + } + /** + * + * Represents the ShapeDataItem. + * + * [Api set: 1.1] + */ + class ShapeDataItem extends OfficeExtension.ClientObject { + /** + * + * A string that specifies the format of the shape data item. + * + * [Api set: 1.1] + */ + readonly format: string; + /** + * + * A string that specifies the formatted value of the shape data item. + * + * [Api set: 1.1] + */ + readonly formattedValue: string; + /** + * + * A string that specifies the label of the shape data item. + * + * [Api set: 1.1] + */ + readonly label: string; + /** + * + * A string that specifies the value of the shape data item. + * + * [Api set: 1.1] + */ + readonly value: string; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.ShapeDataItemLoadOptions): Visio.ShapeDataItem; + load(option?: string | string[]): Visio.ShapeDataItem; + load(option?: { + select?: string; + expand?: string; + }): Visio.ShapeDataItem; + toJSON(): Visio.Interfaces.ShapeDataItemData; + } + /** + * + * Represents the Hyperlink Collection. + * + * [Api set: 1.1] + */ + class HyperlinkCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Array; + /** + * + * Gets the number of hyperlinks. + * + * [Api set: 1.1] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a Hyperlink using its key (name or Id). + * + * [Api set: 1.1] + * + * @param Key Key is the name or index of the Hyperlink to be retrieved. + */ + getItem(Key: number | string): Visio.Hyperlink; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.HyperlinkCollectionLoadOptions & Visio.Interfaces.CollectionLoadOptions): Visio.HyperlinkCollection; + load(option?: string | string[]): Visio.HyperlinkCollection; + load(option?: OfficeExtension.LoadOption): Visio.HyperlinkCollection; + toJSON(): Visio.Interfaces.HyperlinkCollectionData; + } + /** + * + * Represents the Hyperlink. + * + * [Api set: 1.1] + */ + class Hyperlink extends OfficeExtension.ClientObject { + /** + * + * Gets the address of the Hyperlink object. + * + * [Api set: 1.1] + */ + readonly address: string; + /** + * + * Gets the description of a hyperlink. + * + * [Api set: 1.1] + */ + readonly description: string; + /** + * + * Gets the extra info of a hyperlink. + * + * [Api set: 1.1] + */ + readonly extraInfo: string; + /** + * + * Gets the sub-address of the Hyperlink object. + * + * [Api set: 1.1] + */ + readonly subAddress: string; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.HyperlinkLoadOptions): Visio.Hyperlink; + load(option?: string | string[]): Visio.Hyperlink; + load(option?: { + select?: string; + expand?: string; + }): Visio.Hyperlink; + toJSON(): Visio.Interfaces.HyperlinkData; + } + /** + * + * Represents the CommentCollection for a given Shape. + * + * [Api set: 1.1] + */ + class CommentCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Array; + /** + * + * Gets the number of Shape Data Items. + * + * [Api set: 1.1] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets the Comment using its name. + * + * [Api set: 1.1] + * + * @param key Key is the name of the Comment to be retrieved. + */ + getItem(key: string): Visio.Comment; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.CommentCollectionLoadOptions & Visio.Interfaces.CollectionLoadOptions): Visio.CommentCollection; + load(option?: string | string[]): Visio.CommentCollection; + load(option?: OfficeExtension.LoadOption): Visio.CommentCollection; + toJSON(): Visio.Interfaces.CommentCollectionData; + } + /** + * + * Represents the Comment. + * + * [Api set: 1.1] + */ + class Comment extends OfficeExtension.ClientObject { + /** + * + * A string that specifies the label of the shape data item. + * + * [Api set: 1.1] + */ + author: string; + /** + * + * A string that specifies the format of the shape data item. + * + * [Api set: 1.1] + */ + date: string; + /** + * + * A string that specifies the value of the shape data item. + * + * [Api set: 1.1] + */ + text: string; + /** Sets multiple properties on the object at the same time, based on JSON input. */ + set(properties: Interfaces.CommentUpdateData, options?: { + /** + * Throw an error if the passed-in property list includes read-only properties (default = true). + */ + throwOnReadOnly?: boolean; + }): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Comment): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: Visio.Interfaces.CommentLoadOptions): Visio.Comment; + load(option?: string | string[]): Visio.Comment; + load(option?: { + select?: string; + expand?: string; + }): Visio.Comment; + toJSON(): Visio.Interfaces.CommentData; + } + /** + * + * Represents the Selection in the page. + * + * [Api set: 1.1] + */ + class Selection extends OfficeExtension.ClientObject { + /** + * + * Gets the Shapes of the Selection + * + * [Api set: 1.1] + */ + readonly shapes: Visio.ShapeCollection; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: string | string[]): Visio.Selection; + load(option?: { + select?: string; + expand?: string; + }): Visio.Selection; + toJSON(): Visio.Interfaces.SelectionData; + } + /** + * + * Represents the Horizontal Alignment of the Overlay relative to the shape. + * + * [Api set: 1.1] + */ + namespace OverlayHorizontalAlignment { + /** + * + * left + * + */ + var left: string; + /** + * + * center + * + */ + var center: string; + /** + * + * right + * + */ + var right: string; + } + /** + * + * Represents the Vertical Alignment of the Overlay relative to the shape. + * + * [Api set: 1.1] + */ + namespace OverlayVerticalAlignment { + /** + * + * top + * + */ + var top: string; + /** + * + * middle + * + */ + var middle: string; + /** + * + * bottom + * + */ + var bottom: string; + } + /** + * + * Represents the type of the overlay. + * + * [Api set: 1.1] + */ + namespace OverlayType { + /** + * + * text + * + */ + var text: string; + /** + * + * image + * + */ + var image: string; + } + /** + * + * Toolbar IDs of the app + * + * [Api set: 1.1] + */ + namespace ToolBarType { + /** + * + * CommandBar + * + */ + var commandBar: string; + /** + * + * PageNavigationBar + * + */ + var pageNavigationBar: string; + /** + * + * StatusBar + * + */ + var statusBar: string; + } + namespace ErrorCodes { + var accessDenied: string; + var generalException: string; + var invalidArgument: string; + var itemNotFound: string; + var notImplemented: string; + var unsupportedOperation: string; + } + module Interfaces { + interface CollectionLoadOptions { + $top?: number; + $skip?: number; + } + /** An interface for updating data on the Application object, for use in "application.set({ ... })". */ + interface ApplicationUpdateData { + /** + * + * Show/Hide the application borders. + * + * [Api set: 1.1] + */ + showBorders?: boolean; + /** + * + * Show or Hide the standard toolbars. + * + * [Api set: 1.1] + */ + showToolbars?: boolean; + } + /** An interface for updating data on the Document object, for use in "document.set({ ... })". */ + interface DocumentUpdateData { + /** + * + * Represents a Visio application instance that contains this document. + * + * [Api set: 1.1] + */ + application?: Visio.Interfaces.ApplicationUpdateData; + /** + * + * Returns the DocumentView object. + * + * [Api set: 1.1] + */ + view?: Visio.Interfaces.DocumentViewUpdateData; + } + /** An interface for updating data on the DocumentView object, for use in "documentView.set({ ... })". */ + interface DocumentViewUpdateData { + /** + * + * Disable Hyperlinks. + * + * [Api set: 1.1] + */ + disableHyperlinks?: boolean; + /** + * + * Disable Pan. + * + * [Api set: 1.1] + */ + disablePan?: boolean; + /** + * + * Disable Zoom. + * + * [Api set: 1.1] + */ + disableZoom?: boolean; + /** + * + * Disable Hyperlinks. + * + * [Api set: 1.1] + */ + hideDiagramBoundary?: boolean; + } + /** An interface for updating data on the Page object, for use in "page.set({ ... })". */ + interface PageUpdateData { + /** + * + * Returns the view of the page. + * + * [Api set: 1.1] + */ + view?: Visio.Interfaces.PageViewUpdateData; + } + /** An interface for updating data on the PageView object, for use in "pageView.set({ ... })". */ + interface PageViewUpdateData { + /** + * + * Get/Set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. + * + * [Api set: 1.1] + */ + zoom?: number; + } + /** An interface for updating data on the PageCollection object, for use in "pageCollection.set({ ... })". */ + interface PageCollectionUpdateData { + items?: Visio.Interfaces.PageData[]; + } + /** An interface for updating data on the ShapeCollection object, for use in "shapeCollection.set({ ... })". */ + interface ShapeCollectionUpdateData { + items?: Visio.Interfaces.ShapeData[]; + } + /** An interface for updating data on the Shape object, for use in "shape.set({ ... })". */ + interface ShapeUpdateData { + /** + * + * Returns the view of the shape. + * + * [Api set: 1.1] + */ + view?: Visio.Interfaces.ShapeViewUpdateData; + /** + * + * Returns true, if shape is selected. User can set true to select the shape explicitly. + * + * [Api set: 1.1] + */ + select?: boolean; + } + /** An interface for updating data on the ShapeView object, for use in "shapeView.set({ ... })". */ + interface ShapeViewUpdateData { + /** + * + * Represents the highlight around the shape. + * + * [Api set: 1.1] + */ + highlight?: Visio.Highlight; + } + /** An interface for updating data on the ShapeDataItemCollection object, for use in "shapeDataItemCollection.set({ ... })". */ + interface ShapeDataItemCollectionUpdateData { + items?: Visio.Interfaces.ShapeDataItemData[]; + } + /** An interface for updating data on the HyperlinkCollection object, for use in "hyperlinkCollection.set({ ... })". */ + interface HyperlinkCollectionUpdateData { + items?: Visio.Interfaces.HyperlinkData[]; + } + /** An interface for updating data on the CommentCollection object, for use in "commentCollection.set({ ... })". */ + interface CommentCollectionUpdateData { + items?: Visio.Interfaces.CommentData[]; + } + /** An interface for updating data on the Comment object, for use in "comment.set({ ... })". */ + interface CommentUpdateData { + /** + * + * A string that specifies the label of the shape data item. + * + * [Api set: 1.1] + */ + author?: string; + /** + * + * A string that specifies the format of the shape data item. + * + * [Api set: 1.1] + */ + date?: string; + /** + * + * A string that specifies the value of the shape data item. + * + * [Api set: 1.1] + */ + text?: string; + } + /** An interface describing the data returned by calling "application.toJSON()". */ + interface ApplicationData { + /** + * + * Show/Hide the application borders. + * + * [Api set: 1.1] + */ + showBorders?: boolean; + /** + * + * Show or Hide the standard toolbars. + * + * [Api set: 1.1] + */ + showToolbars?: boolean; + } + /** An interface describing the data returned by calling "document.toJSON()". */ + interface DocumentData { + /** + * + * Represents a Visio application instance that contains this document. Read-only. + * + * [Api set: 1.1] + */ + application?: Visio.Interfaces.ApplicationData; + /** + * + * Represents a collection of pages associated with the document. Read-only. + * + * [Api set: 1.1] + */ + pages?: Visio.Interfaces.PageData[]; + /** + * + * Returns the DocumentView object. + * + * [Api set: 1.1] + */ + view?: Visio.Interfaces.DocumentViewData; + } + /** An interface describing the data returned by calling "documentView.toJSON()". */ + interface DocumentViewData { + /** + * + * Disable Hyperlinks. + * + * [Api set: 1.1] + */ + disableHyperlinks?: boolean; + /** + * + * Disable Pan. + * + * [Api set: 1.1] + */ + disablePan?: boolean; + /** + * + * Disable Zoom. + * + * [Api set: 1.1] + */ + disableZoom?: boolean; + /** + * + * Disable Hyperlinks. + * + * [Api set: 1.1] + */ + hideDiagramBoundary?: boolean; + } + /** An interface describing the data returned by calling "page.toJSON()". */ + interface PageData { + /** + * + * All shapes in the page. Read-only. + * + * [Api set: 1.1] + */ + allShapes?: Visio.Interfaces.ShapeData[]; + /** + * + * Returns the Comments Collection + * + * [Api set: 1.1] + */ + comments?: Visio.Interfaces.CommentData[]; + /** + * + * Shapes at root level, in the page. Read-only. + * + * [Api set: 1.1] + */ + shapes?: Visio.Interfaces.ShapeData[]; + /** + * + * Returns the view of the page. Read-only. + * + * [Api set: 1.1] + */ + view?: Visio.Interfaces.PageViewData; + /** + * + * Returns the height of the page. Read-only. + * + * [Api set: 1.1] + */ + height?: number; + /** + * + * Index of the Page. + * + * [Api set: 1.1] + */ + index?: number; + /** + * + * Whether the page is a background page or not. Read-only. + * + * [Api set: 1.1] + */ + isBackground?: boolean; + /** + * + * Page name. Read-only. + * + * [Api set: 1.1] + */ + name?: string; + /** + * + * Returns the width of the page. Read-only. + * + * [Api set: 1.1] + */ + width?: number; + } + /** An interface describing the data returned by calling "pageView.toJSON()". */ + interface PageViewData { + /** + * + * Get/Set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. + * + * [Api set: 1.1] + */ + zoom?: number; + } + /** An interface describing the data returned by calling "pageCollection.toJSON()". */ + interface PageCollectionData { + items?: Visio.Interfaces.PageData[]; + } + /** An interface describing the data returned by calling "shapeCollection.toJSON()". */ + interface ShapeCollectionData { + items?: Visio.Interfaces.ShapeData[]; + } + /** An interface describing the data returned by calling "shape.toJSON()". */ + interface ShapeData { + /** + * + * Returns the Comments Collection + * + * [Api set: 1.1] + */ + comments?: Visio.Interfaces.CommentData[]; + /** + * + * Returns the Hyperlinks collection for a Shape object. Read-only. + * + * [Api set: 1.1] + */ + hyperlinks?: Visio.Interfaces.HyperlinkData[]; + /** + * + * Returns the Shape's Data Section. Read-only. + * + * [Api set: 1.1] + */ + shapeDataItems?: Visio.Interfaces.ShapeDataItemData[]; + /** + * + * Gets SubShape Collection. + * + * [Api set: 1.1] + */ + subShapes?: Visio.Interfaces.ShapeData[]; + /** + * + * Returns the view of the shape. Read-only. + * + * [Api set: 1.1] + */ + view?: Visio.Interfaces.ShapeViewData; + /** + * + * Shape's Identifier. + * + * [Api set: 1.1] + */ + id?: number; + /** + * + * Shape's name. + * + * [Api set: 1.1] + */ + name?: string; + /** + * + * Returns true, if shape is selected. User can set true to select the shape explicitly. + * + * [Api set: 1.1] + */ + select?: boolean; + /** + * + * Shape's Text. + * + * [Api set: 1.1] + */ + text?: string; + } + /** An interface describing the data returned by calling "shapeView.toJSON()". */ + interface ShapeViewData { + /** + * + * Represents the highlight around the shape. + * + * [Api set: 1.1] + */ + highlight?: Visio.Highlight; + } + /** An interface describing the data returned by calling "shapeDataItemCollection.toJSON()". */ + interface ShapeDataItemCollectionData { + items?: Visio.Interfaces.ShapeDataItemData[]; + } + /** An interface describing the data returned by calling "shapeDataItem.toJSON()". */ + interface ShapeDataItemData { + /** + * + * A string that specifies the format of the shape data item. + * + * [Api set: 1.1] + */ + format?: string; + /** + * + * A string that specifies the formatted value of the shape data item. + * + * [Api set: 1.1] + */ + formattedValue?: string; + /** + * + * A string that specifies the label of the shape data item. + * + * [Api set: 1.1] + */ + label?: string; + /** + * + * A string that specifies the value of the shape data item. + * + * [Api set: 1.1] + */ + value?: string; + } + /** An interface describing the data returned by calling "hyperlinkCollection.toJSON()". */ + interface HyperlinkCollectionData { + items?: Visio.Interfaces.HyperlinkData[]; + } + /** An interface describing the data returned by calling "hyperlink.toJSON()". */ + interface HyperlinkData { + /** + * + * Gets the address of the Hyperlink object. + * + * [Api set: 1.1] + */ + address?: string; + /** + * + * Gets the description of a hyperlink. + * + * [Api set: 1.1] + */ + description?: string; + /** + * + * Gets the extra info of a hyperlink. + * + * [Api set: 1.1] + */ + extraInfo?: string; + /** + * + * Gets the sub-address of the Hyperlink object. + * + * [Api set: 1.1] + */ + subAddress?: string; + } + /** An interface describing the data returned by calling "commentCollection.toJSON()". */ + interface CommentCollectionData { + items?: Visio.Interfaces.CommentData[]; + } + /** An interface describing the data returned by calling "comment.toJSON()". */ + interface CommentData { + /** + * + * A string that specifies the label of the shape data item. + * + * [Api set: 1.1] + */ + author?: string; + /** + * + * A string that specifies the format of the shape data item. + * + * [Api set: 1.1] + */ + date?: string; + /** + * + * A string that specifies the value of the shape data item. + * + * [Api set: 1.1] + */ + text?: string; + } + /** An interface describing the data returned by calling "selection.toJSON()". */ + interface SelectionData { + /** + * + * Gets the Shapes of the Selection + * + * [Api set: 1.1] + */ + shapes?: Visio.Interfaces.ShapeData[]; + } + /** + * + * Represents the Application. + * + * [Api set: 1.1] + */ + interface ApplicationLoadOptions { + $all?: boolean; + /** + * + * Show/Hide the application borders. + * + * [Api set: 1.1] + */ + showBorders?: boolean; + /** + * + * Show or Hide the standard toolbars. + * + * [Api set: 1.1] + */ + showToolbars?: boolean; + } + /** + * + * Represents the Document class. + * + * [Api set: 1.1] + */ + interface DocumentLoadOptions { + $all?: boolean; + /** + * + * Represents a Visio application instance that contains this document. + * + * [Api set: 1.1] + */ + application?: Visio.Interfaces.ApplicationLoadOptions; + /** + * + * Returns the DocumentView object. + * + * [Api set: 1.1] + */ + view?: Visio.Interfaces.DocumentViewLoadOptions; + } + /** + * + * Represents the DocumentView class. + * + * [Api set: 1.1] + */ + interface DocumentViewLoadOptions { + $all?: boolean; + /** + * + * Disable Hyperlinks. + * + * [Api set: 1.1] + */ + disableHyperlinks?: boolean; + /** + * + * Disable Pan. + * + * [Api set: 1.1] + */ + disablePan?: boolean; + /** + * + * Disable Zoom. + * + * [Api set: 1.1] + */ + disableZoom?: boolean; + /** + * + * Disable Hyperlinks. + * + * [Api set: 1.1] + */ + hideDiagramBoundary?: boolean; + } + /** + * + * Represents the Page class. + * + * [Api set: 1.1] + */ + interface PageLoadOptions { + $all?: boolean; + /** + * + * Returns the view of the page. + * + * [Api set: 1.1] + */ + view?: Visio.Interfaces.PageViewLoadOptions; + /** + * + * Returns the height of the page. Read-only. + * + * [Api set: 1.1] + */ + height?: boolean; + /** + * + * Index of the Page. + * + * [Api set: 1.1] + */ + index?: boolean; + /** + * + * Whether the page is a background page or not. Read-only. + * + * [Api set: 1.1] + */ + isBackground?: boolean; + /** + * + * Page name. Read-only. + * + * [Api set: 1.1] + */ + name?: boolean; + /** + * + * Returns the width of the page. Read-only. + * + * [Api set: 1.1] + */ + width?: boolean; + } + /** + * + * Represents the PageView class. + * + * [Api set: 1.1] + */ + interface PageViewLoadOptions { + $all?: boolean; + /** + * + * Get/Set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. + * + * [Api set: 1.1] + */ + zoom?: boolean; + } + /** + * + * Represents a collection of Page objects that are part of the document. + * + * [Api set: 1.1] + */ + interface PageCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Returns the view of the page. + * + * [Api set: 1.1] + */ + view?: Visio.Interfaces.PageViewLoadOptions; + /** + * + * For EACH ITEM in the collection: Returns the height of the page. Read-only. + * + * [Api set: 1.1] + */ + height?: boolean; + /** + * + * For EACH ITEM in the collection: Index of the Page. + * + * [Api set: 1.1] + */ + index?: boolean; + /** + * + * For EACH ITEM in the collection: Whether the page is a background page or not. Read-only. + * + * [Api set: 1.1] + */ + isBackground?: boolean; + /** + * + * For EACH ITEM in the collection: Page name. Read-only. + * + * [Api set: 1.1] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Returns the width of the page. Read-only. + * + * [Api set: 1.1] + */ + width?: boolean; + } + /** + * + * Represents the Shape Collection. + * + * [Api set: 1.1] + */ + interface ShapeCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Returns the view of the shape. + * + * [Api set: 1.1] + */ + view?: Visio.Interfaces.ShapeViewLoadOptions; + /** + * + * For EACH ITEM in the collection: Shape's Identifier. + * + * [Api set: 1.1] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Shape's name. + * + * [Api set: 1.1] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Returns true, if shape is selected. User can set true to select the shape explicitly. + * + * [Api set: 1.1] + */ + select?: boolean; + /** + * + * For EACH ITEM in the collection: Shape's Text. + * + * [Api set: 1.1] + */ + text?: boolean; + } + /** + * + * Represents the Shape class. + * + * [Api set: 1.1] + */ + interface ShapeLoadOptions { + $all?: boolean; + /** + * + * Returns the view of the shape. + * + * [Api set: 1.1] + */ + view?: Visio.Interfaces.ShapeViewLoadOptions; + /** + * + * Shape's Identifier. + * + * [Api set: 1.1] + */ + id?: boolean; + /** + * + * Shape's name. + * + * [Api set: 1.1] + */ + name?: boolean; + /** + * + * Returns true, if shape is selected. User can set true to select the shape explicitly. + * + * [Api set: 1.1] + */ + select?: boolean; + /** + * + * Shape's Text. + * + * [Api set: 1.1] + */ + text?: boolean; + } + /** + * + * Represents the ShapeView class. + * + * [Api set: 1.1] + */ + interface ShapeViewLoadOptions { + $all?: boolean; + /** + * + * Represents the highlight around the shape. + * + * [Api set: 1.1] + */ + highlight?: boolean; + } + /** + * + * Represents the ShapeDataItemCollection for a given Shape. + * + * [Api set: 1.1] + */ + interface ShapeDataItemCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: A string that specifies the format of the shape data item. + * + * [Api set: 1.1] + */ + format?: boolean; + /** + * + * For EACH ITEM in the collection: A string that specifies the formatted value of the shape data item. + * + * [Api set: 1.1] + */ + formattedValue?: boolean; + /** + * + * For EACH ITEM in the collection: A string that specifies the label of the shape data item. + * + * [Api set: 1.1] + */ + label?: boolean; + /** + * + * For EACH ITEM in the collection: A string that specifies the value of the shape data item. + * + * [Api set: 1.1] + */ + value?: boolean; + } + /** + * + * Represents the ShapeDataItem. + * + * [Api set: 1.1] + */ + interface ShapeDataItemLoadOptions { + $all?: boolean; + /** + * + * A string that specifies the format of the shape data item. + * + * [Api set: 1.1] + */ + format?: boolean; + /** + * + * A string that specifies the formatted value of the shape data item. + * + * [Api set: 1.1] + */ + formattedValue?: boolean; + /** + * + * A string that specifies the label of the shape data item. + * + * [Api set: 1.1] + */ + label?: boolean; + /** + * + * A string that specifies the value of the shape data item. + * + * [Api set: 1.1] + */ + value?: boolean; + } + /** + * + * Represents the Hyperlink Collection. + * + * [Api set: 1.1] + */ + interface HyperlinkCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the address of the Hyperlink object. + * + * [Api set: 1.1] + */ + address?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the description of a hyperlink. + * + * [Api set: 1.1] + */ + description?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the extra info of a hyperlink. + * + * [Api set: 1.1] + */ + extraInfo?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the sub-address of the Hyperlink object. + * + * [Api set: 1.1] + */ + subAddress?: boolean; + } + /** + * + * Represents the Hyperlink. + * + * [Api set: 1.1] + */ + interface HyperlinkLoadOptions { + $all?: boolean; + /** + * + * Gets the address of the Hyperlink object. + * + * [Api set: 1.1] + */ + address?: boolean; + /** + * + * Gets the description of a hyperlink. + * + * [Api set: 1.1] + */ + description?: boolean; + /** + * + * Gets the extra info of a hyperlink. + * + * [Api set: 1.1] + */ + extraInfo?: boolean; + /** + * + * Gets the sub-address of the Hyperlink object. + * + * [Api set: 1.1] + */ + subAddress?: boolean; + } + /** + * + * Represents the CommentCollection for a given Shape. + * + * [Api set: 1.1] + */ + interface CommentCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: A string that specifies the label of the shape data item. + * + * [Api set: 1.1] + */ + author?: boolean; + /** + * + * For EACH ITEM in the collection: A string that specifies the format of the shape data item. + * + * [Api set: 1.1] + */ + date?: boolean; + /** + * + * For EACH ITEM in the collection: A string that specifies the value of the shape data item. + * + * [Api set: 1.1] + */ + text?: boolean; + } + /** + * + * Represents the Comment. + * + * [Api set: 1.1] + */ + interface CommentLoadOptions { + $all?: boolean; + /** + * + * A string that specifies the label of the shape data item. + * + * [Api set: 1.1] + */ + author?: boolean; + /** + * + * A string that specifies the format of the shape data item. + * + * [Api set: 1.1] + */ + date?: boolean; + /** + * + * A string that specifies the value of the shape data item. + * + * [Api set: 1.1] + */ + text?: boolean; + } + } +} +declare module Visio { + /** + * The RequestContext object facilitates requests to the Visio application. Since the Office add-in and the Visio application run in two different processes, the request context is required to get access to the Visio object model from the add-in. + */ + class RequestContext extends OfficeExtension.ClientRequestContext { + constructor(url?: string | OfficeExtension.EmbeddedSession); + readonly document: Document; + } + /** + * Executes a batch script that performs actions on the Visio object model, using a new request context. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + * @param batch - A function that takes in an Visio.RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Visio application. Since the Office add-in and the Visio application run in two different processes, the request context is required to get access to the Visio object model from the add-in. + */ + function run(batch: (context: Visio.RequestContext) => OfficeExtension.IPromise): OfficeExtension.IPromise; + /** + * Executes a batch script that performs actions on the Visio object model, using the request context of a previously-created API object. + * @param object - A previously-created API object. The batch will use the same request context as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". + * @param batch - A function that takes in an Visio.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + */ + function run(object: OfficeExtension.ClientObject | OfficeExtension.EmbeddedSession, batch: (context: Visio.RequestContext) => OfficeExtension.IPromise): OfficeExtension.IPromise; + /** + * Executes a batch script that performs actions on the Visio object model, using the RequestContext of a previously-created object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + * @param contextObject - A previously-created Visio.RequestContext. This context will get re-used by the batch function (instead of having a new context created). This means that the batch will be able to pick up changes made to existing API objects, if those objects were derived from this same context. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Visio application. Since the Office add-in and the Visio application run in two different processes, the RequestContext is required to get access to the Visio object model from the add-in. + */ + function run(contextObject: OfficeExtension.ClientRequestContext, batch: (context: Visio.RequestContext) => OfficeExtension.IPromise): OfficeExtension.IPromise; + /** + * Executes a batch script that performs actions on the Visio object model, using the request context of previously-created API objects. + * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared request context, which means that any changes applied to these objects will be picked up by "context.sync()". + * @param batch - A function that takes in a Visio.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + */ + function run(objects: OfficeExtension.ClientObject[], batch: (context: Visio.RequestContext) => OfficeExtension.IPromise): OfficeExtension.IPromise; +} + + + +//////////////////////////////////////////////////////////////// +//////////////////////// End Visio APIs //////////////////////// +//////////////////////////////////////////////////////////////// diff --git a/types/ol/assertionerror/index.d.ts b/types/ol/assertionerror/index.d.ts new file mode 100644 index 0000000000..3585cd64da --- /dev/null +++ b/types/ol/assertionerror/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.AssertionError; diff --git a/types/ol/attribution/index.d.ts b/types/ol/attribution/index.d.ts new file mode 100644 index 0000000000..71eb87ff73 --- /dev/null +++ b/types/ol/attribution/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Attribution; diff --git a/types/ol/collection/index.d.ts b/types/ol/collection/index.d.ts new file mode 100644 index 0000000000..5943115188 --- /dev/null +++ b/types/ol/collection/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Collection; diff --git a/types/ol/color/index.d.ts b/types/ol/color/index.d.ts new file mode 100644 index 0000000000..92407b2fa4 --- /dev/null +++ b/types/ol/color/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.color; diff --git a/types/ol/colorlike/index.d.ts b/types/ol/colorlike/index.d.ts new file mode 100644 index 0000000000..5cf7ed88a8 --- /dev/null +++ b/types/ol/colorlike/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.colorlike; diff --git a/types/ol/control/attribution.d.ts b/types/ol/control/attribution.d.ts new file mode 100644 index 0000000000..9157d3ea5e --- /dev/null +++ b/types/ol/control/attribution.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.control.Attribution; diff --git a/types/ol/control/control.d.ts b/types/ol/control/control.d.ts new file mode 100644 index 0000000000..221bc895aa --- /dev/null +++ b/types/ol/control/control.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.control.Control; diff --git a/types/ol/control/fullscreen.d.ts b/types/ol/control/fullscreen.d.ts new file mode 100644 index 0000000000..5f0112dd06 --- /dev/null +++ b/types/ol/control/fullscreen.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.control.FullScreen; diff --git a/types/ol/control/index.d.ts b/types/ol/control/index.d.ts new file mode 100644 index 0000000000..551c3303d8 --- /dev/null +++ b/types/ol/control/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.control; diff --git a/types/ol/control/mouseposition.d.ts b/types/ol/control/mouseposition.d.ts new file mode 100644 index 0000000000..f8d89d4dff --- /dev/null +++ b/types/ol/control/mouseposition.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.control.MousePosition; diff --git a/types/ol/control/overviewmap.d.ts b/types/ol/control/overviewmap.d.ts new file mode 100644 index 0000000000..60dd9b8900 --- /dev/null +++ b/types/ol/control/overviewmap.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.control.OverviewMap; diff --git a/types/ol/control/rotate.d.ts b/types/ol/control/rotate.d.ts new file mode 100644 index 0000000000..136db4ddeb --- /dev/null +++ b/types/ol/control/rotate.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.control.Rotate; diff --git a/types/ol/control/scaleline.d.ts b/types/ol/control/scaleline.d.ts new file mode 100644 index 0000000000..bbcad827f3 --- /dev/null +++ b/types/ol/control/scaleline.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.control.ScaleLine; diff --git a/types/ol/control/zoom.d.ts b/types/ol/control/zoom.d.ts new file mode 100644 index 0000000000..550d98c300 --- /dev/null +++ b/types/ol/control/zoom.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.control.Zoom; diff --git a/types/ol/control/zoomslider.d.ts b/types/ol/control/zoomslider.d.ts new file mode 100644 index 0000000000..4f5845939c --- /dev/null +++ b/types/ol/control/zoomslider.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.control.ZoomSlider; diff --git a/types/ol/control/zoomtoextent.d.ts b/types/ol/control/zoomtoextent.d.ts new file mode 100644 index 0000000000..d536325932 --- /dev/null +++ b/types/ol/control/zoomtoextent.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.control.ZoomToExtent; diff --git a/types/ol/coordinate/index.d.ts b/types/ol/coordinate/index.d.ts new file mode 100644 index 0000000000..9d95bc2f5b --- /dev/null +++ b/types/ol/coordinate/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.coordinate; diff --git a/types/ol/deviceorientation/index.d.ts b/types/ol/deviceorientation/index.d.ts new file mode 100644 index 0000000000..53ce703660 --- /dev/null +++ b/types/ol/deviceorientation/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.DeviceOrientation; diff --git a/types/ol/disposable/index.d.ts b/types/ol/disposable/index.d.ts new file mode 100644 index 0000000000..dd3aca2bff --- /dev/null +++ b/types/ol/disposable/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Disposable; diff --git a/types/ol/easing/index.d.ts b/types/ol/easing/index.d.ts new file mode 100644 index 0000000000..28e1552f42 --- /dev/null +++ b/types/ol/easing/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.easing; diff --git a/types/ol/events/condition.d.ts b/types/ol/events/condition.d.ts new file mode 100644 index 0000000000..bb43999775 --- /dev/null +++ b/types/ol/events/condition.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.events.condition; diff --git a/types/ol/events/event.d.ts b/types/ol/events/event.d.ts new file mode 100644 index 0000000000..5aefb9f530 --- /dev/null +++ b/types/ol/events/event.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.events.Event; diff --git a/types/ol/events/eventtarget.d.ts b/types/ol/events/eventtarget.d.ts new file mode 100644 index 0000000000..898b74ee65 --- /dev/null +++ b/types/ol/events/eventtarget.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.events.EventTarget; diff --git a/types/ol/events/index.d.ts b/types/ol/events/index.d.ts new file mode 100644 index 0000000000..defc980e5a --- /dev/null +++ b/types/ol/events/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.events; diff --git a/types/ol/extent/index.d.ts b/types/ol/extent/index.d.ts new file mode 100644 index 0000000000..a4c284b29e --- /dev/null +++ b/types/ol/extent/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.extent; diff --git a/types/ol/feature/index.d.ts b/types/ol/feature/index.d.ts new file mode 100644 index 0000000000..ba86ca0ad0 --- /dev/null +++ b/types/ol/feature/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Feature; diff --git a/types/ol/featureloader/index.d.ts b/types/ol/featureloader/index.d.ts new file mode 100644 index 0000000000..3d3d4a1105 --- /dev/null +++ b/types/ol/featureloader/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.featureloader; diff --git a/types/ol/format/esrijson.d.ts b/types/ol/format/esrijson.d.ts new file mode 100644 index 0000000000..5145422ade --- /dev/null +++ b/types/ol/format/esrijson.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.EsriJSON; diff --git a/types/ol/format/feature.d.ts b/types/ol/format/feature.d.ts new file mode 100644 index 0000000000..dc53e6709a --- /dev/null +++ b/types/ol/format/feature.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.Feature; diff --git a/types/ol/format/filter.d.ts b/types/ol/format/filter.d.ts new file mode 100644 index 0000000000..1fb2086477 --- /dev/null +++ b/types/ol/format/filter.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.filter; diff --git a/types/ol/format/geojson.d.ts b/types/ol/format/geojson.d.ts new file mode 100644 index 0000000000..d954287590 --- /dev/null +++ b/types/ol/format/geojson.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.GeoJSON; diff --git a/types/ol/format/gml2.d.ts b/types/ol/format/gml2.d.ts new file mode 100644 index 0000000000..95cdee80b7 --- /dev/null +++ b/types/ol/format/gml2.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.GML2; diff --git a/types/ol/format/gml3.d.ts b/types/ol/format/gml3.d.ts new file mode 100644 index 0000000000..416fc64c24 --- /dev/null +++ b/types/ol/format/gml3.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.GML3; diff --git a/types/ol/format/gmlbase.d.ts b/types/ol/format/gmlbase.d.ts new file mode 100644 index 0000000000..5d495bc5c0 --- /dev/null +++ b/types/ol/format/gmlbase.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.GMLBase; diff --git a/types/ol/format/gpx.d.ts b/types/ol/format/gpx.d.ts new file mode 100644 index 0000000000..3094e44275 --- /dev/null +++ b/types/ol/format/gpx.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.GPX; diff --git a/types/ol/format/igc.d.ts b/types/ol/format/igc.d.ts new file mode 100644 index 0000000000..d358419696 --- /dev/null +++ b/types/ol/format/igc.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.IGC; diff --git a/types/ol/format/jsonfeature.d.ts b/types/ol/format/jsonfeature.d.ts new file mode 100644 index 0000000000..cf76949b70 --- /dev/null +++ b/types/ol/format/jsonfeature.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.JSONFeature; diff --git a/types/ol/format/kml.d.ts b/types/ol/format/kml.d.ts new file mode 100644 index 0000000000..6f45f45005 --- /dev/null +++ b/types/ol/format/kml.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.KML; diff --git a/types/ol/format/mvt.d.ts b/types/ol/format/mvt.d.ts new file mode 100644 index 0000000000..857aaea5e7 --- /dev/null +++ b/types/ol/format/mvt.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.MVT; diff --git a/types/ol/format/osmxml.d.ts b/types/ol/format/osmxml.d.ts new file mode 100644 index 0000000000..67029aa020 --- /dev/null +++ b/types/ol/format/osmxml.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.OSMXML; diff --git a/types/ol/format/polyline.d.ts b/types/ol/format/polyline.d.ts new file mode 100644 index 0000000000..6c60d844c3 --- /dev/null +++ b/types/ol/format/polyline.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.Polyline; diff --git a/types/ol/format/textfeature.d.ts b/types/ol/format/textfeature.d.ts new file mode 100644 index 0000000000..13c50b8f80 --- /dev/null +++ b/types/ol/format/textfeature.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.TextFeature; diff --git a/types/ol/format/topojson.d.ts b/types/ol/format/topojson.d.ts new file mode 100644 index 0000000000..af1258d5a2 --- /dev/null +++ b/types/ol/format/topojson.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.TopoJSON; diff --git a/types/ol/format/wfs.d.ts b/types/ol/format/wfs.d.ts new file mode 100644 index 0000000000..b2ee31971a --- /dev/null +++ b/types/ol/format/wfs.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.WFS; diff --git a/types/ol/format/wkt.d.ts b/types/ol/format/wkt.d.ts new file mode 100644 index 0000000000..68bfbee10f --- /dev/null +++ b/types/ol/format/wkt.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.WKT; diff --git a/types/ol/format/wmscapabilities.d.ts b/types/ol/format/wmscapabilities.d.ts new file mode 100644 index 0000000000..c727c689c6 --- /dev/null +++ b/types/ol/format/wmscapabilities.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.WMSCapabilities; diff --git a/types/ol/format/wmsgetfeatureinfo.d.ts b/types/ol/format/wmsgetfeatureinfo.d.ts new file mode 100644 index 0000000000..6aaffa7b5e --- /dev/null +++ b/types/ol/format/wmsgetfeatureinfo.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.WMSGetFeatureInfo; diff --git a/types/ol/format/wmtscapabilities.d.ts b/types/ol/format/wmtscapabilities.d.ts new file mode 100644 index 0000000000..c17cdf8f2d --- /dev/null +++ b/types/ol/format/wmtscapabilities.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.WMTSCapabilities; diff --git a/types/ol/format/xml.d.ts b/types/ol/format/xml.d.ts new file mode 100644 index 0000000000..4032d4758e --- /dev/null +++ b/types/ol/format/xml.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.XML; diff --git a/types/ol/format/xmlfeature.d.ts b/types/ol/format/xmlfeature.d.ts new file mode 100644 index 0000000000..28b544565b --- /dev/null +++ b/types/ol/format/xmlfeature.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.format.XMLFeature; diff --git a/types/ol/geolocation/index.d.ts b/types/ol/geolocation/index.d.ts new file mode 100644 index 0000000000..a08c095e0c --- /dev/null +++ b/types/ol/geolocation/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Geolocation; diff --git a/types/ol/geom/circle.d.ts b/types/ol/geom/circle.d.ts new file mode 100644 index 0000000000..48abeeed8e --- /dev/null +++ b/types/ol/geom/circle.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.geom.Circle; diff --git a/types/ol/geom/geometry.d.ts b/types/ol/geom/geometry.d.ts new file mode 100644 index 0000000000..59f0ba50d9 --- /dev/null +++ b/types/ol/geom/geometry.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.geom.Geometry; diff --git a/types/ol/geom/geometrycollection.d.ts b/types/ol/geom/geometrycollection.d.ts new file mode 100644 index 0000000000..d8aaddefbf --- /dev/null +++ b/types/ol/geom/geometrycollection.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.geom.GeometryCollection; diff --git a/types/ol/geom/linearring.d.ts b/types/ol/geom/linearring.d.ts new file mode 100644 index 0000000000..4341aa8780 --- /dev/null +++ b/types/ol/geom/linearring.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.geom.LinearRing; diff --git a/types/ol/geom/linestring.d.ts b/types/ol/geom/linestring.d.ts new file mode 100644 index 0000000000..8f58f85ff4 --- /dev/null +++ b/types/ol/geom/linestring.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.geom.LineString; diff --git a/types/ol/geom/multilinestring.d.ts b/types/ol/geom/multilinestring.d.ts new file mode 100644 index 0000000000..b9c3de266e --- /dev/null +++ b/types/ol/geom/multilinestring.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.geom.MultiLineString; diff --git a/types/ol/geom/multipoint.d.ts b/types/ol/geom/multipoint.d.ts new file mode 100644 index 0000000000..1846edddb5 --- /dev/null +++ b/types/ol/geom/multipoint.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.geom.MultiPoint; diff --git a/types/ol/geom/multipolygon.d.ts b/types/ol/geom/multipolygon.d.ts new file mode 100644 index 0000000000..9a058fac0f --- /dev/null +++ b/types/ol/geom/multipolygon.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.geom.MultiPolygon; diff --git a/types/ol/geom/point.d.ts b/types/ol/geom/point.d.ts new file mode 100644 index 0000000000..0c8bf8e7d8 --- /dev/null +++ b/types/ol/geom/point.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.geom.Point; diff --git a/types/ol/geom/polygon.d.ts b/types/ol/geom/polygon.d.ts new file mode 100644 index 0000000000..67351267ed --- /dev/null +++ b/types/ol/geom/polygon.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.geom.Polygon; diff --git a/types/ol/geom/simplegeometry.d.ts b/types/ol/geom/simplegeometry.d.ts new file mode 100644 index 0000000000..20695d2bb1 --- /dev/null +++ b/types/ol/geom/simplegeometry.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.geom.SimpleGeometry; diff --git a/types/ol/graticule/index.d.ts b/types/ol/graticule/index.d.ts new file mode 100644 index 0000000000..97bd1e8e2d --- /dev/null +++ b/types/ol/graticule/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Graticule; diff --git a/types/ol/image/index.d.ts b/types/ol/image/index.d.ts new file mode 100644 index 0000000000..5a4c9a304b --- /dev/null +++ b/types/ol/image/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Image; diff --git a/types/ol/imagebase/index.d.ts b/types/ol/imagebase/index.d.ts new file mode 100644 index 0000000000..91e7971e27 --- /dev/null +++ b/types/ol/imagebase/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.ImageBase; diff --git a/types/ol/imagetile/index.d.ts b/types/ol/imagetile/index.d.ts new file mode 100644 index 0000000000..57b9b1c9fa --- /dev/null +++ b/types/ol/imagetile/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.ImageTile; diff --git a/types/ol/index.d.ts b/types/ol/index.d.ts new file mode 100644 index 0000000000..947423f2aa --- /dev/null +++ b/types/ol/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for ol 4.6 +// Project: https://github.com/openlayers/openlayers/tree/master/package#readme +// Definitions by: Yair Tawil +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import * as ol from 'openlayers'; + +export default ol; diff --git a/types/ol/interaction/doubleclickzoom.d.ts b/types/ol/interaction/doubleclickzoom.d.ts new file mode 100644 index 0000000000..3982ba3b7f --- /dev/null +++ b/types/ol/interaction/doubleclickzoom.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.DoubleClickZoom; diff --git a/types/ol/interaction/draganddrop.d.ts b/types/ol/interaction/draganddrop.d.ts new file mode 100644 index 0000000000..bbfbbeb727 --- /dev/null +++ b/types/ol/interaction/draganddrop.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.DragAndDrop; diff --git a/types/ol/interaction/dragbox.d.ts b/types/ol/interaction/dragbox.d.ts new file mode 100644 index 0000000000..dbb06b7a18 --- /dev/null +++ b/types/ol/interaction/dragbox.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.DragBox; diff --git a/types/ol/interaction/dragpan.d.ts b/types/ol/interaction/dragpan.d.ts new file mode 100644 index 0000000000..e9c14d7b5d --- /dev/null +++ b/types/ol/interaction/dragpan.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.DragPan; diff --git a/types/ol/interaction/dragrotate.d.ts b/types/ol/interaction/dragrotate.d.ts new file mode 100644 index 0000000000..31ebec3772 --- /dev/null +++ b/types/ol/interaction/dragrotate.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.DragRotate; diff --git a/types/ol/interaction/dragrotateandzoom.d.ts b/types/ol/interaction/dragrotateandzoom.d.ts new file mode 100644 index 0000000000..6b8a2979e1 --- /dev/null +++ b/types/ol/interaction/dragrotateandzoom.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.DragRotateAndZoom; diff --git a/types/ol/interaction/dragzoom.d.ts b/types/ol/interaction/dragzoom.d.ts new file mode 100644 index 0000000000..c0e0413b21 --- /dev/null +++ b/types/ol/interaction/dragzoom.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.DragZoom; diff --git a/types/ol/interaction/draw.d.ts b/types/ol/interaction/draw.d.ts new file mode 100644 index 0000000000..d7e1318f69 --- /dev/null +++ b/types/ol/interaction/draw.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.Draw; diff --git a/types/ol/interaction/index.d.ts b/types/ol/interaction/index.d.ts new file mode 100644 index 0000000000..6ef5898695 --- /dev/null +++ b/types/ol/interaction/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction; diff --git a/types/ol/interaction/interaction.d.ts b/types/ol/interaction/interaction.d.ts new file mode 100644 index 0000000000..9eb1c46525 --- /dev/null +++ b/types/ol/interaction/interaction.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.Interaction; diff --git a/types/ol/interaction/keyboardpan.d.ts b/types/ol/interaction/keyboardpan.d.ts new file mode 100644 index 0000000000..5c32c8dfa3 --- /dev/null +++ b/types/ol/interaction/keyboardpan.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.KeyboardPan; diff --git a/types/ol/interaction/keyboardzoom.d.ts b/types/ol/interaction/keyboardzoom.d.ts new file mode 100644 index 0000000000..e52bf705eb --- /dev/null +++ b/types/ol/interaction/keyboardzoom.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.KeyboardZoom; diff --git a/types/ol/interaction/modify.d.ts b/types/ol/interaction/modify.d.ts new file mode 100644 index 0000000000..8079ab0ba5 --- /dev/null +++ b/types/ol/interaction/modify.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.Modify; diff --git a/types/ol/interaction/mousewheelzoom.d.ts b/types/ol/interaction/mousewheelzoom.d.ts new file mode 100644 index 0000000000..d8a5223153 --- /dev/null +++ b/types/ol/interaction/mousewheelzoom.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.MouseWheelZoom; diff --git a/types/ol/interaction/pinchrotate.d.ts b/types/ol/interaction/pinchrotate.d.ts new file mode 100644 index 0000000000..b10400ce30 --- /dev/null +++ b/types/ol/interaction/pinchrotate.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.PinchRotate; diff --git a/types/ol/interaction/pinchzoom.d.ts b/types/ol/interaction/pinchzoom.d.ts new file mode 100644 index 0000000000..0d666096c2 --- /dev/null +++ b/types/ol/interaction/pinchzoom.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.PinchZoom; diff --git a/types/ol/interaction/pointer.d.ts b/types/ol/interaction/pointer.d.ts new file mode 100644 index 0000000000..22936f602a --- /dev/null +++ b/types/ol/interaction/pointer.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.Pointer; diff --git a/types/ol/interaction/select.d.ts b/types/ol/interaction/select.d.ts new file mode 100644 index 0000000000..fe8c16b4b9 --- /dev/null +++ b/types/ol/interaction/select.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.Select; diff --git a/types/ol/interaction/snap.d.ts b/types/ol/interaction/snap.d.ts new file mode 100644 index 0000000000..90a7fee1bb --- /dev/null +++ b/types/ol/interaction/snap.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.Snap; diff --git a/types/ol/interaction/translate.d.ts b/types/ol/interaction/translate.d.ts new file mode 100644 index 0000000000..b035bae021 --- /dev/null +++ b/types/ol/interaction/translate.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.Translate; diff --git a/types/ol/kinetic/index.d.ts b/types/ol/kinetic/index.d.ts new file mode 100644 index 0000000000..ba283fca68 --- /dev/null +++ b/types/ol/kinetic/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Kinetic; diff --git a/types/ol/layer/base.d.ts b/types/ol/layer/base.d.ts new file mode 100644 index 0000000000..25c11c8edd --- /dev/null +++ b/types/ol/layer/base.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.layer.Base; diff --git a/types/ol/layer/group.d.ts b/types/ol/layer/group.d.ts new file mode 100644 index 0000000000..b3669bc387 --- /dev/null +++ b/types/ol/layer/group.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.layer.Group; diff --git a/types/ol/layer/heatmap.d.ts b/types/ol/layer/heatmap.d.ts new file mode 100644 index 0000000000..4b4f112642 --- /dev/null +++ b/types/ol/layer/heatmap.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.layer.Heatmap; diff --git a/types/ol/layer/image.d.ts b/types/ol/layer/image.d.ts new file mode 100644 index 0000000000..34a862498e --- /dev/null +++ b/types/ol/layer/image.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.layer.Image; diff --git a/types/ol/layer/layer.d.ts b/types/ol/layer/layer.d.ts new file mode 100644 index 0000000000..38c31c927f --- /dev/null +++ b/types/ol/layer/layer.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.layer.Layer; diff --git a/types/ol/layer/tile.d.ts b/types/ol/layer/tile.d.ts new file mode 100644 index 0000000000..bbd95be84d --- /dev/null +++ b/types/ol/layer/tile.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.layer.Tile; diff --git a/types/ol/layer/vector.d.ts b/types/ol/layer/vector.d.ts new file mode 100644 index 0000000000..f26e2a3bf5 --- /dev/null +++ b/types/ol/layer/vector.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.layer.Vector; diff --git a/types/ol/layer/vectortile.d.ts b/types/ol/layer/vectortile.d.ts new file mode 100644 index 0000000000..27ac70d8c3 --- /dev/null +++ b/types/ol/layer/vectortile.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.layer.VectorTile; diff --git a/types/ol/loadingstrategy/index.d.ts b/types/ol/loadingstrategy/index.d.ts new file mode 100644 index 0000000000..9b3d8bff3b --- /dev/null +++ b/types/ol/loadingstrategy/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.loadingstrategy; diff --git a/types/ol/map/index.d.ts b/types/ol/map/index.d.ts new file mode 100644 index 0000000000..58f635d45a --- /dev/null +++ b/types/ol/map/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Map; diff --git a/types/ol/mapbrowserevent/index.d.ts b/types/ol/mapbrowserevent/index.d.ts new file mode 100644 index 0000000000..048fc22481 --- /dev/null +++ b/types/ol/mapbrowserevent/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.MapBrowserEvent; diff --git a/types/ol/mapbrowserpointerevent/index.d.ts b/types/ol/mapbrowserpointerevent/index.d.ts new file mode 100644 index 0000000000..616325e218 --- /dev/null +++ b/types/ol/mapbrowserpointerevent/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.MapBrowserPointerEvent; diff --git a/types/ol/mapevent/index.d.ts b/types/ol/mapevent/index.d.ts new file mode 100644 index 0000000000..6e7487ec29 --- /dev/null +++ b/types/ol/mapevent/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.MapEvent; diff --git a/types/ol/object/index.d.ts b/types/ol/object/index.d.ts new file mode 100644 index 0000000000..e4580cd0ce --- /dev/null +++ b/types/ol/object/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Object; diff --git a/types/ol/observable/index.d.ts b/types/ol/observable/index.d.ts new file mode 100644 index 0000000000..09489e7382 --- /dev/null +++ b/types/ol/observable/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Observable; diff --git a/types/ol/ol-tests.ts b/types/ol/ol-tests.ts new file mode 100644 index 0000000000..13a36df6f3 --- /dev/null +++ b/types/ol/ol-tests.ts @@ -0,0 +1,323 @@ +import ControlAttribution from 'ol/control/attribution'; + +import ControlControl from 'ol/control/control'; + +import ControlFullScreen from 'ol/control/fullscreen'; + +import ControlMousePosition from 'ol/control/mouseposition'; + +import ControlOverviewMap from 'ol/control/overviewmap'; + +import ControlRotate from 'ol/control/rotate'; + +import ControlScaleLine from 'ol/control/scaleline'; + +import ControlZoom from 'ol/control/zoom'; + +import ControlZoomSlider from 'ol/control/zoomslider'; + +import ControlZoomToExtent from 'ol/control/zoomtoextent'; + +import Eventscondition from 'ol/events/condition'; + +import EventsEvent from 'ol/events/event'; + +import EventsEventTarget from 'ol/events/eventtarget'; + +import FormatEsriJSON from 'ol/format/esrijson'; + +import FormatFeature from 'ol/format/feature'; + +import Formatfilter from 'ol/format/filter'; + +import FormatGeoJSON from 'ol/format/geojson'; + +import FormatGML2 from 'ol/format/gml2'; + +import FormatGML3 from 'ol/format/gml3'; + +import FormatGMLBase from 'ol/format/gmlbase'; + +import FormatGPX from 'ol/format/gpx'; + +import FormatIGC from 'ol/format/igc'; + +import FormatJSONFeature from 'ol/format/jsonfeature'; + +import FormatKML from 'ol/format/kml'; + +import FormatMVT from 'ol/format/mvt'; + +import FormatOSMXML from 'ol/format/osmxml'; + +import FormatPolyline from 'ol/format/polyline'; + +import FormatTextFeature from 'ol/format/textfeature'; + +import FormatTopoJSON from 'ol/format/topojson'; + +import FormatWFS from 'ol/format/wfs'; + +import FormatWKT from 'ol/format/wkt'; + +import FormatWMSCapabilities from 'ol/format/wmscapabilities'; + +import FormatWMSGetFeatureInfo from 'ol/format/wmsgetfeatureinfo'; + +import FormatWMTSCapabilities from 'ol/format/wmtscapabilities'; + +import FormatXML from 'ol/format/xml'; + +import FormatXMLFeature from 'ol/format/xmlfeature'; + +import GeomCircle from 'ol/geom/circle'; + +import GeomGeometry from 'ol/geom/geometry'; + +import GeomGeometryCollection from 'ol/geom/geometrycollection'; + +import GeomLinearRing from 'ol/geom/linearring'; + +import GeomLineString from 'ol/geom/linestring'; + +import GeomMultiLineString from 'ol/geom/multilinestring'; + +import GeomMultiPoint from 'ol/geom/multipoint'; + +import GeomMultiPolygon from 'ol/geom/multipolygon'; + +import GeomPoint from 'ol/geom/point'; + +import GeomPolygon from 'ol/geom/polygon'; + +import GeomSimpleGeometry from 'ol/geom/simplegeometry'; + +import InteractionDoubleClickZoom from 'ol/interaction/doubleclickzoom'; + +import InteractionDragAndDrop from 'ol/interaction/draganddrop'; + +import InteractionDragBox from 'ol/interaction/dragbox'; + +import InteractionDragPan from 'ol/interaction/dragpan'; + +import InteractionDragRotate from 'ol/interaction/dragrotate'; + +import InteractionDragRotateAndZoom from 'ol/interaction/dragrotateandzoom'; + +import InteractionDragZoom from 'ol/interaction/dragzoom'; + +import InteractionDraw from 'ol/interaction/draw'; + +import InteractionInteraction from 'ol/interaction/interaction'; + +import InteractionKeyboardPan from 'ol/interaction/keyboardpan'; + +import InteractionKeyboardZoom from 'ol/interaction/keyboardzoom'; + +import InteractionModify from 'ol/interaction/modify'; + +import InteractionMouseWheelZoom from 'ol/interaction/mousewheelzoom'; + +import InteractionPinchRotate from 'ol/interaction/pinchrotate'; + +import InteractionPinchZoom from 'ol/interaction/pinchzoom'; + +import InteractionPointer from 'ol/interaction/pointer'; + +import InteractionSelect from 'ol/interaction/select'; + +import InteractionSnap from 'ol/interaction/snap'; + +import InteractionTranslate from 'ol/interaction/translate'; + +import LayerBase from 'ol/layer/base'; + +import LayerGroup from 'ol/layer/group'; + +import LayerHeatmap from 'ol/layer/heatmap'; + +import LayerImage from 'ol/layer/image'; + +import LayerLayer from 'ol/layer/layer'; + +import LayerTile from 'ol/layer/tile'; + +import LayerVector from 'ol/layer/vector'; + +import LayerVectorTile from 'ol/layer/vectortile'; + +import PointerPointerEvent from 'ol/pointer/pointerevent'; + +import ProjProjection from 'ol/proj/projection'; + +import Rendercanvas from 'ol/render/canvas'; + +import RenderEvent from 'ol/render/event'; + +import RenderFeature from 'ol/render/feature'; + +import RenderVectorContext from 'ol/render/vectorcontext'; + +import SourceBingMaps from 'ol/source/bingmaps'; + +import SourceCartoDB from 'ol/source/cartodb'; + +import SourceCluster from 'ol/source/cluster'; + +import SourceImage from 'ol/source/image'; + +import SourceImageArcGISRest from 'ol/source/imagearcgisrest'; + +import SourceImageCanvas from 'ol/source/imagecanvas'; + +import SourceImageMapGuide from 'ol/source/imagemapguide'; + +import SourceImageStatic from 'ol/source/imagestatic'; + +import SourceImageVector from 'ol/source/imagevector'; + +import SourceImageWMS from 'ol/source/imagewms'; + +import SourceOSM from 'ol/source/osm'; + +import SourceRaster from 'ol/source/raster'; + +import SourceSource from 'ol/source/source'; + +import SourceStamen from 'ol/source/stamen'; + +import SourceTile from 'ol/source/tile'; + +import SourceTileArcGISRest from 'ol/source/tilearcgisrest'; + +import SourceTileDebug from 'ol/source/tiledebug'; + +import SourceTileImage from 'ol/source/tileimage'; + +import SourceTileJSON from 'ol/source/tilejson'; + +import SourceTileUTFGrid from 'ol/source/tileutfgrid'; + +import SourceTileWMS from 'ol/source/tilewms'; + +import SourceUrlTile from 'ol/source/urltile'; + +import SourceVector from 'ol/source/vector'; + +import SourceVectorTile from 'ol/source/vectortile'; + +import SourceWMTS from 'ol/source/wmts'; + +import SourceXYZ from 'ol/source/xyz'; + +import SourceZoomify from 'ol/source/zoomify'; + +import StyleAtlasManager from 'ol/style/atlasmanager'; + +import StyleCircle from 'ol/style/circle'; + +import StyleFill from 'ol/style/fill'; + +import StyleIcon from 'ol/style/icon'; + +import StyleImage from 'ol/style/image'; + +import StyleRegularShape from 'ol/style/regularshape'; + +import StyleStroke from 'ol/style/stroke'; + +import StyleStyle from 'ol/style/style'; + +import StyleText from 'ol/style/text'; + +import TilegridTileGrid from 'ol/tilegrid/tilegrid'; + +import TilegridWMTS from 'ol/tilegrid/wmts'; + +import AssertionError from 'ol/assertionerror'; + +import Attribution from 'ol/attribution'; + +import Collection from 'ol/collection'; + +import Color from 'ol/color'; + +import Colorlike from 'ol/colorlike'; + +import Control from 'ol/control'; + +import DeviceOrientation from 'ol/deviceorientation'; + +import Disposable from 'ol/disposable'; + +import Easing from 'ol/easing'; + +import Events from 'ol/events'; + +import Extent from 'ol/extent'; + +import Feature from 'ol/feature'; + +import FeatureLoader from 'ol/featureloader'; + +import Geolocation from 'ol/geolocation'; + +import Graticule from 'ol/graticule'; + +import Image from 'ol/image'; + +import ImageBase from 'ol/imagebase'; + +import ImageTile from 'ol/imagetile'; + +import Interaction from 'ol/interaction'; + +import Kinetic from 'ol/kinetic'; + +import Loadingstrategy from 'ol/loadingstrategy'; + +import Map from 'ol/map'; + +import MapBrowserEvent from 'ol/mapbrowserevent'; + +import MapBrowserPointerEvent from 'ol/mapbrowserpointerevent'; + +import MapEvent from 'ol/mapevent'; + +import Object from 'ol/object'; + +import Observable from 'ol/observable'; + +import Overlay from 'ol/overlay'; + +import Sphere from 'ol/sphere'; + +import Tile from 'ol/tile'; + +import Tilegrid from 'ol/tilegrid'; + +import VectorTile from 'ol/vectortile'; + +import View from 'ol/view'; + +// Map +const map: ol.Map = new Map( {}); +const mapView: View = {}; +const layerBase: LayerBase = {}; +const control: ControlControl = {}; +const interaction: InteractionInteraction = {}; +map.setView(mapView); +map.addLayer(layerBase); +map.addControl(control); +map.addInteraction(interaction); + +// View +let view: View; +const coordinate: ol.Coordinate = {}; +const size: ol.Size = {}; +const position: ol.Pixel = {}; +view = map.getView(); +view.getProjection(); +view.animate( {}); +view.calculateExtent( 'size'); +view.centerOn(coordinate, size, position); diff --git a/types/ol/overlay/index.d.ts b/types/ol/overlay/index.d.ts new file mode 100644 index 0000000000..d350f1c828 --- /dev/null +++ b/types/ol/overlay/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Overlay; diff --git a/types/ol/pointer/pointerevent.d.ts b/types/ol/pointer/pointerevent.d.ts new file mode 100644 index 0000000000..62e84e6207 --- /dev/null +++ b/types/ol/pointer/pointerevent.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.pointer.PointerEvent; diff --git a/types/ol/proj/projection.d.ts b/types/ol/proj/projection.d.ts new file mode 100644 index 0000000000..26050bb377 --- /dev/null +++ b/types/ol/proj/projection.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.proj.Projection; diff --git a/types/ol/render/canvas.d.ts b/types/ol/render/canvas.d.ts new file mode 100644 index 0000000000..9e6d06eca6 --- /dev/null +++ b/types/ol/render/canvas.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.render.canvas; diff --git a/types/ol/render/event.d.ts b/types/ol/render/event.d.ts new file mode 100644 index 0000000000..981b821b5e --- /dev/null +++ b/types/ol/render/event.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.render.Event; diff --git a/types/ol/render/feature.d.ts b/types/ol/render/feature.d.ts new file mode 100644 index 0000000000..95e4831fba --- /dev/null +++ b/types/ol/render/feature.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.render.Feature; diff --git a/types/ol/render/vectorcontext.d.ts b/types/ol/render/vectorcontext.d.ts new file mode 100644 index 0000000000..b3e287c91b --- /dev/null +++ b/types/ol/render/vectorcontext.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.render.VectorContext; diff --git a/types/ol/source/bingmaps.d.ts b/types/ol/source/bingmaps.d.ts new file mode 100644 index 0000000000..963623bc7e --- /dev/null +++ b/types/ol/source/bingmaps.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.BingMaps; diff --git a/types/ol/source/cartodb.d.ts b/types/ol/source/cartodb.d.ts new file mode 100644 index 0000000000..28b44ebc4c --- /dev/null +++ b/types/ol/source/cartodb.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.CartoDB; diff --git a/types/ol/source/cluster.d.ts b/types/ol/source/cluster.d.ts new file mode 100644 index 0000000000..0a793ed0b2 --- /dev/null +++ b/types/ol/source/cluster.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.Cluster; diff --git a/types/ol/source/image.d.ts b/types/ol/source/image.d.ts new file mode 100644 index 0000000000..82071b1636 --- /dev/null +++ b/types/ol/source/image.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.Image; diff --git a/types/ol/source/imagearcgisrest.d.ts b/types/ol/source/imagearcgisrest.d.ts new file mode 100644 index 0000000000..ae296156cd --- /dev/null +++ b/types/ol/source/imagearcgisrest.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.ImageArcGISRest; diff --git a/types/ol/source/imagecanvas.d.ts b/types/ol/source/imagecanvas.d.ts new file mode 100644 index 0000000000..cbfee5d9d5 --- /dev/null +++ b/types/ol/source/imagecanvas.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.ImageCanvas; diff --git a/types/ol/source/imagemapguide.d.ts b/types/ol/source/imagemapguide.d.ts new file mode 100644 index 0000000000..42877b1052 --- /dev/null +++ b/types/ol/source/imagemapguide.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.ImageMapGuide; diff --git a/types/ol/source/imagestatic.d.ts b/types/ol/source/imagestatic.d.ts new file mode 100644 index 0000000000..02a6d37e50 --- /dev/null +++ b/types/ol/source/imagestatic.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.ImageStatic; diff --git a/types/ol/source/imagevector.d.ts b/types/ol/source/imagevector.d.ts new file mode 100644 index 0000000000..2f1ae17a2d --- /dev/null +++ b/types/ol/source/imagevector.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.ImageVector; diff --git a/types/ol/source/imagewms.d.ts b/types/ol/source/imagewms.d.ts new file mode 100644 index 0000000000..0aeb5fb39c --- /dev/null +++ b/types/ol/source/imagewms.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.ImageWMS; diff --git a/types/ol/source/osm.d.ts b/types/ol/source/osm.d.ts new file mode 100644 index 0000000000..68b03db843 --- /dev/null +++ b/types/ol/source/osm.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.OSM; diff --git a/types/ol/source/raster.d.ts b/types/ol/source/raster.d.ts new file mode 100644 index 0000000000..de39ec8fce --- /dev/null +++ b/types/ol/source/raster.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.Raster; diff --git a/types/ol/source/source.d.ts b/types/ol/source/source.d.ts new file mode 100644 index 0000000000..379f73e579 --- /dev/null +++ b/types/ol/source/source.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.Source; diff --git a/types/ol/source/stamen.d.ts b/types/ol/source/stamen.d.ts new file mode 100644 index 0000000000..51d6d42006 --- /dev/null +++ b/types/ol/source/stamen.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.Stamen; diff --git a/types/ol/source/tile.d.ts b/types/ol/source/tile.d.ts new file mode 100644 index 0000000000..7c7cb3d874 --- /dev/null +++ b/types/ol/source/tile.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.Tile; diff --git a/types/ol/source/tilearcgisrest.d.ts b/types/ol/source/tilearcgisrest.d.ts new file mode 100644 index 0000000000..45f7f529ff --- /dev/null +++ b/types/ol/source/tilearcgisrest.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.TileArcGISRest; diff --git a/types/ol/source/tiledebug.d.ts b/types/ol/source/tiledebug.d.ts new file mode 100644 index 0000000000..f09371a620 --- /dev/null +++ b/types/ol/source/tiledebug.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.TileDebug; diff --git a/types/ol/source/tileimage.d.ts b/types/ol/source/tileimage.d.ts new file mode 100644 index 0000000000..bd3bf922b4 --- /dev/null +++ b/types/ol/source/tileimage.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.TileImage; diff --git a/types/ol/source/tilejson.d.ts b/types/ol/source/tilejson.d.ts new file mode 100644 index 0000000000..c9d52d2903 --- /dev/null +++ b/types/ol/source/tilejson.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.TileJSON; diff --git a/types/ol/source/tileutfgrid.d.ts b/types/ol/source/tileutfgrid.d.ts new file mode 100644 index 0000000000..17ae2022a2 --- /dev/null +++ b/types/ol/source/tileutfgrid.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.TileUTFGrid; diff --git a/types/ol/source/tilewms.d.ts b/types/ol/source/tilewms.d.ts new file mode 100644 index 0000000000..7ae163f2c5 --- /dev/null +++ b/types/ol/source/tilewms.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.TileWMS; diff --git a/types/ol/source/urltile.d.ts b/types/ol/source/urltile.d.ts new file mode 100644 index 0000000000..606583cac4 --- /dev/null +++ b/types/ol/source/urltile.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.UrlTile; diff --git a/types/ol/source/vector.d.ts b/types/ol/source/vector.d.ts new file mode 100644 index 0000000000..ee2d968d28 --- /dev/null +++ b/types/ol/source/vector.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.Vector; diff --git a/types/ol/source/vectortile.d.ts b/types/ol/source/vectortile.d.ts new file mode 100644 index 0000000000..1aa59678d3 --- /dev/null +++ b/types/ol/source/vectortile.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.VectorTile; diff --git a/types/ol/source/wmts.d.ts b/types/ol/source/wmts.d.ts new file mode 100644 index 0000000000..afdc2c352b --- /dev/null +++ b/types/ol/source/wmts.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.WMTS; diff --git a/types/ol/source/xyz.d.ts b/types/ol/source/xyz.d.ts new file mode 100644 index 0000000000..d29b5f9e06 --- /dev/null +++ b/types/ol/source/xyz.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.XYZ; diff --git a/types/ol/source/zoomify.d.ts b/types/ol/source/zoomify.d.ts new file mode 100644 index 0000000000..a48e675012 --- /dev/null +++ b/types/ol/source/zoomify.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.source.Zoomify; diff --git a/types/ol/sphere/index.d.ts b/types/ol/sphere/index.d.ts new file mode 100644 index 0000000000..a3481e4339 --- /dev/null +++ b/types/ol/sphere/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Sphere; diff --git a/types/ol/style/atlasmanager.d.ts b/types/ol/style/atlasmanager.d.ts new file mode 100644 index 0000000000..0be77a6621 --- /dev/null +++ b/types/ol/style/atlasmanager.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.style.AtlasManager; diff --git a/types/ol/style/circle.d.ts b/types/ol/style/circle.d.ts new file mode 100644 index 0000000000..ff593230b5 --- /dev/null +++ b/types/ol/style/circle.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.style.Circle; diff --git a/types/ol/style/fill.d.ts b/types/ol/style/fill.d.ts new file mode 100644 index 0000000000..ef6b246ad5 --- /dev/null +++ b/types/ol/style/fill.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.style.Fill; diff --git a/types/ol/style/icon.d.ts b/types/ol/style/icon.d.ts new file mode 100644 index 0000000000..4100f3fbf8 --- /dev/null +++ b/types/ol/style/icon.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.style.Icon; diff --git a/types/ol/style/image.d.ts b/types/ol/style/image.d.ts new file mode 100644 index 0000000000..bdfb4319e3 --- /dev/null +++ b/types/ol/style/image.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.style.Image; diff --git a/types/ol/style/regularshape.d.ts b/types/ol/style/regularshape.d.ts new file mode 100644 index 0000000000..fb4a227d1d --- /dev/null +++ b/types/ol/style/regularshape.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.style.RegularShape; diff --git a/types/ol/style/stroke.d.ts b/types/ol/style/stroke.d.ts new file mode 100644 index 0000000000..af7a49d6b5 --- /dev/null +++ b/types/ol/style/stroke.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.style.Stroke; diff --git a/types/ol/style/style.d.ts b/types/ol/style/style.d.ts new file mode 100644 index 0000000000..839583e313 --- /dev/null +++ b/types/ol/style/style.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.style.Style; diff --git a/types/ol/style/text.d.ts b/types/ol/style/text.d.ts new file mode 100644 index 0000000000..33d1b50962 --- /dev/null +++ b/types/ol/style/text.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.style.Text; diff --git a/types/ol/tile/index.d.ts b/types/ol/tile/index.d.ts new file mode 100644 index 0000000000..61e802d921 --- /dev/null +++ b/types/ol/tile/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.Tile; diff --git a/types/ol/tilegrid/index.d.ts b/types/ol/tilegrid/index.d.ts new file mode 100644 index 0000000000..467e92480f --- /dev/null +++ b/types/ol/tilegrid/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.tilegrid; diff --git a/types/ol/tilegrid/tilegrid.d.ts b/types/ol/tilegrid/tilegrid.d.ts new file mode 100644 index 0000000000..b6edeba4aa --- /dev/null +++ b/types/ol/tilegrid/tilegrid.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.tilegrid.TileGrid; diff --git a/types/ol/tilegrid/wmts.d.ts b/types/ol/tilegrid/wmts.d.ts new file mode 100644 index 0000000000..3f1f33e647 --- /dev/null +++ b/types/ol/tilegrid/wmts.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.tilegrid.WMTS; diff --git a/types/ol/tsconfig.json b/types/ol/tsconfig.json new file mode 100644 index 0000000000..6402adb0f7 --- /dev/null +++ b/types/ol/tsconfig.json @@ -0,0 +1,176 @@ +{ + "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", + "ol-tests.ts", + "control/attribution.d.ts", + "control/control.d.ts", + "control/fullscreen.d.ts", + "control/mouseposition.d.ts", + "control/overviewmap.d.ts", + "control/rotate.d.ts", + "control/scaleline.d.ts", + "control/zoom.d.ts", + "control/zoomslider.d.ts", + "control/zoomtoextent.d.ts", + "events/condition.d.ts", + "events/event.d.ts", + "events/eventtarget.d.ts", + "format/esrijson.d.ts", + "format/feature.d.ts", + "format/filter.d.ts", + "format/geojson.d.ts", + "format/gml2.d.ts", + "format/gml3.d.ts", + "format/gmlbase.d.ts", + "format/gpx.d.ts", + "format/igc.d.ts", + "format/jsonfeature.d.ts", + "format/kml.d.ts", + "format/mvt.d.ts", + "format/osmxml.d.ts", + "format/polyline.d.ts", + "format/textfeature.d.ts", + "format/topojson.d.ts", + "format/wfs.d.ts", + "format/wkt.d.ts", + "format/wmscapabilities.d.ts", + "format/wmsgetfeatureinfo.d.ts", + "format/wmtscapabilities.d.ts", + "format/xml.d.ts", + "format/xmlfeature.d.ts", + "geom/circle.d.ts", + "geom/geometry.d.ts", + "geom/geometrycollection.d.ts", + "geom/linearring.d.ts", + "geom/linestring.d.ts", + "geom/multilinestring.d.ts", + "geom/multipoint.d.ts", + "geom/multipolygon.d.ts", + "geom/point.d.ts", + "geom/polygon.d.ts", + "geom/simplegeometry.d.ts", + "interaction/doubleclickzoom.d.ts", + "interaction/draganddrop.d.ts", + "interaction/dragbox.d.ts", + "interaction/dragpan.d.ts", + "interaction/dragrotate.d.ts", + "interaction/dragrotateandzoom.d.ts", + "interaction/dragzoom.d.ts", + "interaction/draw.d.ts", + "interaction/interaction.d.ts", + "interaction/keyboardpan.d.ts", + "interaction/keyboardzoom.d.ts", + "interaction/modify.d.ts", + "interaction/mousewheelzoom.d.ts", + "interaction/pinchrotate.d.ts", + "interaction/pinchzoom.d.ts", + "interaction/pointer.d.ts", + "interaction/select.d.ts", + "interaction/snap.d.ts", + "interaction/translate.d.ts", + "layer/base.d.ts", + "layer/group.d.ts", + "layer/heatmap.d.ts", + "layer/image.d.ts", + "layer/layer.d.ts", + "layer/tile.d.ts", + "layer/vector.d.ts", + "layer/vectortile.d.ts", + "pointer/pointerevent.d.ts", + "proj/projection.d.ts", + "render/canvas.d.ts", + "render/event.d.ts", + "render/feature.d.ts", + "render/vectorcontext.d.ts", + "source/bingmaps.d.ts", + "source/cartodb.d.ts", + "source/cluster.d.ts", + "source/image.d.ts", + "source/imagearcgisrest.d.ts", + "source/imagecanvas.d.ts", + "source/imagemapguide.d.ts", + "source/imagestatic.d.ts", + "source/imagevector.d.ts", + "source/imagewms.d.ts", + "source/osm.d.ts", + "source/raster.d.ts", + "source/source.d.ts", + "source/stamen.d.ts", + "source/tile.d.ts", + "source/tilearcgisrest.d.ts", + "source/tiledebug.d.ts", + "source/tileimage.d.ts", + "source/tilejson.d.ts", + "source/tileutfgrid.d.ts", + "source/tilewms.d.ts", + "source/urltile.d.ts", + "source/vector.d.ts", + "source/vectortile.d.ts", + "source/wmts.d.ts", + "source/xyz.d.ts", + "source/zoomify.d.ts", + "style/atlasmanager.d.ts", + "style/circle.d.ts", + "style/fill.d.ts", + "style/icon.d.ts", + "style/image.d.ts", + "style/regularshape.d.ts", + "style/stroke.d.ts", + "style/style.d.ts", + "style/text.d.ts", + "tilegrid/tilegrid.d.ts", + "tilegrid/wmts.d.ts", + "assertionerror/index.d.ts", + "attribution/index.d.ts", + "collection/index.d.ts", + "color/index.d.ts", + "colorlike/index.d.ts", + "control/index.d.ts", + "coordinate/index.d.ts", + "deviceorientation/index.d.ts", + "disposable/index.d.ts", + "easing/index.d.ts", + "events/index.d.ts", + "extent/index.d.ts", + "feature/index.d.ts", + "featureloader/index.d.ts", + "geolocation/index.d.ts", + "graticule/index.d.ts", + "image/index.d.ts", + "imagebase/index.d.ts", + "imagetile/index.d.ts", + "interaction/index.d.ts", + "kinetic/index.d.ts", + "loadingstrategy/index.d.ts", + "map/index.d.ts", + "mapbrowserevent/index.d.ts", + "mapbrowserpointerevent/index.d.ts", + "mapevent/index.d.ts", + "object/index.d.ts", + "observable/index.d.ts", + "overlay/index.d.ts", + "sphere/index.d.ts", + "tile/index.d.ts", + "tilegrid/index.d.ts", + "vectortile/index.d.ts", + "view/index.d.ts" + ] +} \ No newline at end of file diff --git a/types/ol/tslint.json b/types/ol/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ol/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/ol/vectortile/index.d.ts b/types/ol/vectortile/index.d.ts new file mode 100644 index 0000000000..21b2ed9297 --- /dev/null +++ b/types/ol/vectortile/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.VectorTile; diff --git a/types/ol/view/index.d.ts b/types/ol/view/index.d.ts new file mode 100644 index 0000000000..6df86cd89d --- /dev/null +++ b/types/ol/view/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.View; diff --git a/types/onesignal-cordova-plugin/tsconfig.json b/types/onesignal-cordova-plugin/tsconfig.json index bcee47426f..a256428f0e 100644 --- a/types/onesignal-cordova-plugin/tsconfig.json +++ b/types/onesignal-cordova-plugin/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "onesignal-cordova-plugin-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/onesignal-cordova-plugin/tslint.json b/types/onesignal-cordova-plugin/tslint.json index 3db14f85ea..3224b40b8b 100644 --- a/types/onesignal-cordova-plugin/tslint.json +++ b/types/onesignal-cordova-plugin/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-const-enum": false + } +} diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index c2e7ab1530..8a711771fa 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for OpenLayers v4.3.4 +// Type definitions for OpenLayers 4.6 // Project: http://openlayers.org/ // Definitions by: Olivier Sechet // Bin Wang @@ -6,6 +6,8 @@ // Alexandre Melard // Chad Johnston // Dan Manastireanu +// Yair Tawil +// Pierre Marchand // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions partially generated using tsd-jsdoc (https://github.com/englercj/tsd-jsdoc) @@ -2796,7 +2798,7 @@ declare module ol { * @returns {!ol.format.filter.EqualTo} `` operator. * @api */ - function equalTo(propertyName: string, expression: string|number, opt_matchCase?: boolean): ol.format.filter.EqualTo; + function equalTo(propertyName: string, expression: string | number, opt_matchCase?: boolean): ol.format.filter.EqualTo; /** * Creates a `` comparison operator. @@ -2807,7 +2809,7 @@ declare module ol { * @returns {!ol.format.filter.NotEqualTo} `` operator. * @api */ - function notEqualTo(propertyName: string, expression: string|number, opt_matchCase?: boolean): ol.format.filter.NotEqualTo; + function notEqualTo(propertyName: string, expression: string | number, opt_matchCase?: boolean): ol.format.filter.NotEqualTo; /** * Creates a `` comparison operator. @@ -3027,7 +3029,7 @@ declare module ol { * Abstract class; normally only used for creating subclasses and not instantiated in apps. * Base class for WFS GetFeature n-ary logical filters. */ - class LogicalNary extends ol.format.filter.Filter {} + class LogicalNary extends ol.format.filter.Filter { } /** * @classdesc @@ -3061,16 +3063,16 @@ declare module ol { * @api */ class Or extends ol.format.filter.LogicalNary { - /** - * @classdesc - * Represents a logical operator between two or more filter conditions. - * - * @constructor - * @param {!ol.format.filter.Filter} conditions Conditions - * @extends {ol.format.filter.LogicalNary} - * @api - */ - constructor(...conditions: ol.format.filter.Filter[]); + /** + * @classdesc + * Represents a logical operator between two or more filter conditions. + * + * @constructor + * @param {!ol.format.filter.Filter} conditions Conditions + * @extends {ol.format.filter.LogicalNary} + * @api + */ + constructor(...conditions: ol.format.filter.Filter[]); } /** @@ -3138,7 +3140,7 @@ declare module ol { * @extends {ol.format.filter.Comparison} * @api */ - constructor(tagName: string, propertyName: string, expression: string|number, opt_matchCase?: boolean); + constructor(tagName: string, propertyName: string, expression: string | number, opt_matchCase?: boolean); } /** @@ -3164,7 +3166,7 @@ declare module ol { * @extends {ol.format.filter.ComparisonBinary} * @api */ - constructor(propertyName: string, expression: string|number, opt_matchCase?: boolean); + constructor(propertyName: string, expression: string | number, opt_matchCase?: boolean); } /** @@ -3286,7 +3288,7 @@ declare module ol { * @extends {ol.format.filter.ComparisonBinary} * @api */ - constructor(propertyName: string, expression: string|number, opt_matchCase?: boolean); + constructor(propertyName: string, expression: string | number, opt_matchCase?: boolean); } /** @@ -7413,7 +7415,7 @@ declare module ol { getFeaturesAtPixel( pixel: ol.Pixel, opt_options?: olx.AtPixelOptions - ): (Array|null); + ): (Array | null); /** * Detect layers that have a color value at a pixel on the viewport, and @@ -12343,13 +12345,42 @@ declare module ol { */ constructor(opt_options?: olx.ViewOptions); + /** + * Animate the view. The view's center, zoom (or resolution), and + * rotation can be animated for smooth transitions between view states. + * @param {olx.AnimateOptions} var_args Animation options. + * @param {olx.AnimateOptions | (completed: boolean) => void } restArgs + * @api experimental + */ + animate(...var_args: Array): void; + + /** + * Determine if the view is being animated. + * @return {boolean} The view is being animated. + * @api + */ + getAnimating(): boolean; + + /** + * Determine if the user is interacting with the view, such as panning or zooming. + * @return {boolean} The view is being interacted with. + * @api + */ + getInteracting(): boolean; + + /** + * Cancel any ongoing animations. + * @api + */ + cancelAnimations(): void; + /** * Get the constrained center of this view. * @param {ol.Coordinate|undefined} center Center. * @return {ol.Coordinate|undefined} Constrained center. * @api */ - constrainCenter(center: (ol.Coordinate)): (ol.Coordinate); + constrainCenter(center?: ol.Coordinate): ol.Coordinate; /** * Get the constrained resolution of this view. @@ -12359,7 +12390,7 @@ declare module ol { * @return {number|undefined} Constrained resolution. * @api */ - constrainResolution(resolution: (number), opt_delta?: number, opt_direction?: number): (number); + constrainResolution(resolution?: number, opt_delta?: number, opt_direction?: number): number; /** * Get the constrained rotation of this view. @@ -12368,7 +12399,7 @@ declare module ol { * @return {number|undefined} Constrained rotation. * @api */ - constrainRotation(rotation: (number), opt_delta?: number): (number); + constrainRotation(rotation?: number, opt_delta?: number): number; /** * Get the view center. @@ -12376,18 +12407,18 @@ declare module ol { * @observable * @api stable */ - getCenter(): (ol.Coordinate); + getCenter(): ol.Coordinate; /** * Calculate the extent for the current view state and the passed size. * The size is the pixel dimensions of the box into which the calculated extent * should fit. In most cases you want to get the extent of the entire map, * that is `map.getSize()`. - * @param {ol.Size} size Box pixel size. + * @param {ol.Size=} size Box pixel size. * @return {ol.Extent} Extent. * @api stable */ - calculateExtent(size: ol.Size): ol.Extent; + calculateExtent(size?: ol.Size): ol.Extent; /** * Get the maximum resolution of the view. @@ -12403,6 +12434,34 @@ declare module ol { */ getMinResolution(): number; + /** + * Get the maximum zoom level for the view. + * @return {number} The maximum zoom level. + * @api + */ + getMaxZoom(): number; + + /** + * Set a new maximum zoom level for the view. + * @param {number} zoom The maximum zoom level. + * @api stable + */ + setMaxZoom(zoom: number): void; + + /** + * Get the minimum zoom level for the view. + * @return {number} The minimum zoom level. + * @api + */ + getMinZoom(): number; + + /** + * Set a new minimum zoom level for the view. + * @param {number} zoom The minimum zoom level. + * @api stable + */ + setMinZoom(zoom: number): void; + /** * Get the view projection. * @return {ol.proj.Projection} The projection of the view. @@ -12416,7 +12475,7 @@ declare module ol { * @observable * @api stable */ - getResolution(): (number); + getResolution(): number; /** * Get the resolutions for the view. This returns the array of resolutions @@ -12424,7 +12483,17 @@ declare module ol { * @return {Array.|undefined} The resolutions of the view. * @api stable */ - getResolutions(): (number[]); + getResolutions(): number[]; + + /** + * Get the resolution for a provided extent (in map units) and size (in pixels). + * @param {ol.Extent} extent Extent. + * @param {ol.Size=} opt_size Box pixel size. + * @return {number} The resolution at which the provided extent will render at + * the given size. + * @api + */ + getResolutionForExtent(extent: ol.Extent, opt_size?: ol.Size): number; /** * Get the view rotation. @@ -12435,12 +12504,29 @@ declare module ol { getRotation(): number; /** - * Get the current zoom level. Return undefined if the current - * resolution is undefined or not within the "resolution constraints". + * Get the current zoom level. If you configured your view with a resolutions + * array (this is rare), this method may return non-integer zoom levels (so + * the zoom level is not safe to use as an index into a resolutions array). * @return {number|undefined} Zoom. - * @api stable + * @api */ - getZoom(): (number); + getZoom(): number; + + /** + * Get the zoom level for a resolution. + * @param {number} resolution The resolution. + * @return {number|undefined} The zoom level for the provided resolution. + * @api + */ + getZoomForResolution(resolution: number): number; + + /** + * Get the resolution for a zoom level. + * @param {number} zoom Zoom level. + * @return {number} The view resolution for the provided zoom level. + * @api + */ + getResolutionForZoom(zoom: number): number; /** * Fit the given geometry or extent based on the given map size and border. @@ -12451,7 +12537,7 @@ declare module ol { * @param {olx.view.FitOptions=} opt_options Options. * @api */ - fit(geometry: (ol.geom.SimpleGeometry | ol.Extent), opt_options?: olx.view.FitOptions): void; + fit(geometryOrExtent: (ol.geom.SimpleGeometry | ol.Extent), opt_options?: olx.view.FitOptions): void; /** * Center on coordinate and view position. @@ -12476,7 +12562,7 @@ declare module ol { * @observable * @api stable */ - setCenter(center: (ol.Coordinate)): void; + setCenter(center: ol.Coordinate): void; /** * Set the resolution for this view. @@ -12484,7 +12570,7 @@ declare module ol { * @observable * @api stable */ - setResolution(resolution: (number)): void; + setResolution(resolution?: number): void; /** * Set the rotation for this view. @@ -12494,20 +12580,6 @@ declare module ol { */ setRotation(rotation: number): void; - /** - * Set a new maximum zoom level for the view. - * @param {number} zoom The maximum zoom level. - * @api stable - */ - setMaxZoom(zoom: number): void; - - /** - * Set a new minimum zoom level for the view. - * @param {number} zoom The minimum zoom level. - * @api stable - */ - setMinZoom(zoom: number): void; - /** * Zoom to a specific zoom level. * @param {number} zoom Zoom level. @@ -12515,15 +12587,6 @@ declare module ol { */ setZoom(zoom: number): void; - /** - * Animate the view. The view's center, zoom (or resolution), and - * rotation can be animated for smooth transitions between view states. - * @param {olx.AnimateOptions} var_args Animation options. - * @param {olx.AnimateOptions | (completed: boolean) => void } restArgs - * @api experimental - */ - animate(...var_args: Array): void; - } } @@ -12606,7 +12669,7 @@ declare module olx { zoom?: number | undefined; resolution?: number | undefined; rotation?: number | undefined; - anchor?: number | undefined; + anchor?: ol.Coordinate | undefined; duration?: number | undefined; easing?: ((t: number) => number) | undefined; } @@ -13325,7 +13388,8 @@ declare module olx { * multi: (boolean|undefined), * features: (ol.Collection.|undefined), * filter: (ol.SelectFilterFunction|undefined), - * wrapX: (boolean|undefined)}} + * wrapX: (boolean|undefined), + * hitTolerance: (number|undefined)}} */ interface SelectOptions { addCondition?: ol.EventsConditionType; @@ -13338,6 +13402,7 @@ declare module olx { features?: ol.Collection; filter?: ol.SelectFilterFunction; wrapX?: boolean; + hitTolerance?: number; } @@ -13502,6 +13567,21 @@ declare module olx { } + /** + * @enum {string} + * Render mode for vector layers: + * * `'image'`: Vector layers are rendered as images. Great performance, but + * point symbols and texts are always rotated with the view and pixels are + * scaled during zoom animations. + * * `'vector'`: Vector layers are rendered as vectors. Most accurate rendering + * even during animations, but slower performance. + * Default is `vector`. + * @type {ol.layer.VectorRenderType|string|undefined} + * @api + */ + type VectorRenderType = "image" | "vector"; + + /** * @typedef {{renderOrder: (function(ol.Feature, ol.Feature):number|null|undefined), * minResolution: (number|undefined), @@ -13517,6 +13597,7 @@ declare module olx { * zIndex: (number|undefined)}} */ interface VectorOptions { + renderMode?: (olx.layer.VectorRenderType | string); renderOrder?: (feature1: ol.Feature, feature2: ol.Feature) => number; map?: ol.Map; extent?: ol.Extent; @@ -13525,6 +13606,7 @@ declare module olx { opacity?: number; renderBuffer?: number; source: ol.source.Vector; + declutter?: boolean; style?: (ol.style.Style | ol.style.Style[] | ol.StyleFunction); updateWhileAnimating?: boolean; updateWhileInteracting?: boolean; @@ -14310,6 +14392,7 @@ declare module olx { angle?: number; snapToPixel?: boolean; stroke?: ol.style.Stroke; + rotation?: number; } @@ -14330,11 +14413,24 @@ declare module olx { width?: number; } + /** + * Text placement. One of `'point'`, `'line'`. Default is `'point'`. Note that + * `'line'` requires the underlying geometry to be a {@link ol.geom.LineString}, + * {@link ol.geom.Polygon}, {@link ol.geom.MultiLineString} or + * {@link ol.geom.MultiPolygon}. + * @enum {string} + */ + type TextPlacement = 'point' | 'line'; + + /** * @typedef {{font: (string|undefined), + * maxAngle: (number|undefined), * offsetX: (number|undefined), * offsetY: (number|undefined), + * overflow: (boolean|undefined), + * placement: (ol.style.TextPlacement|string|undefined), * scale: (number|undefined), * rotateWithView: (boolean|undefined), * rotation: (number|undefined), @@ -14342,12 +14438,18 @@ declare module olx { * textAlign: (string|undefined), * textBaseline: (string|undefined), * fill: (ol.style.Fill|undefined), - * stroke: (ol.style.Stroke|undefined)}} + * stroke: (ol.style.Stroke|undefined), + * backgroundFill: (ol.style.Fill|undefined), + * backgroundStroke: (ol.style.Stroke|undefined), + * padding: (Array.|undefined)}} */ interface TextOptions { font?: string; + maxAngle?: boolean; offsetX?: number; offsetY?: number; + overflow?: boolean; + placement?: olx.style.TextPlacement, scale?: number; rotateWithView?: boolean; rotation?: number; @@ -14356,6 +14458,9 @@ declare module olx { textBaseline?: string; fill?: ol.style.Fill; stroke?: ol.style.Stroke; + backgroundFill?: ol.style.Fill; + backgroundStroke?: ol.style.Stroke; + padding?: number[]; } @@ -14615,6 +14720,7 @@ declare module olx { maxZoom?: number; duration?: number; easing?: ((t: number) => number); + callback?: olx.animation.AnimateCallback; } } diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index 666b7b746f..d2d708c168 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -19,8 +19,8 @@ let featureStyleFunction: ol.FeatureStyleFunction; let featureLoader: ol.FeatureLoader; let easingFunction: (t: number) => number; let drawGeometryFunction: ol.DrawGeometryFunctionType; -drawGeometryFunction([0,0], new ol.geom.Point([0,0])); -drawGeometryFunction([0,0]); +drawGeometryFunction([0, 0], new ol.geom.Point([0, 0])); +drawGeometryFunction([0, 0]); // Type variables for OpenLayers let attribution: ol.Attribution; @@ -55,6 +55,7 @@ let mapBrowserEvent: ol.MapBrowserEvent; let multiLineString: ol.geom.MultiLineString; let multiPoint: ol.geom.MultiPoint; let multiPolygon: ol.geom.MultiPolygon; +let pixel: ol.Pixel; let point: ol.geom.Point; let polygon: ol.geom.Polygon; let projection: ol.proj.Projection; @@ -392,13 +393,97 @@ voidValue = feature.setProperties(object); // ol.View // -let view: ol.View = new ol.View({ - center: [0, 0], +let view: ol.View; +view = new ol.View(); +view = new ol.View({}); +view = new ol.View({ + center: coordinate, + constrainRotation: numberValue, + enableRotation: booleanValue, + extent: extent, + maxResolution: numberValue, + minResolution: numberValue, + maxZoom: numberValue, + minZoom: numberValue, + projection: projectionLike, + resolution: numberValue, + resolutions: [numberValue, numberValue, numberValue, numberValue, numberValue], + rotation: numberValue, zoom: numberValue, + zoomFactor: numberValue, +}); +view = new ol.View({ + constrainRotation: booleanValue, }); +voidValue = view.animate(); +voidValue = view.animate({}); +voidValue = view.animate({ zoom: view.getZoom() + 1 }); +voidValue = view.animate({ zoom: 10 }, { center: [0, 0] }); +voidValue = view.animate({ + center: coordinate, + zoom: numberValue, + resolution: numberValue, + rotation: numberValue, + anchor: coordinate, + duration: numberValue, + easing: easingFunction, +}); +extent = view.calculateExtent(); +extent = view.calculateExtent(size); +voidValue = view.cancelAnimations(); +voidValue = view.centerOn(coordinate, size, pixel); +coordinate = view.constrainCenter(); +coordinate = view.constrainCenter(coordinate); +numberValue = view.constrainResolution(); +numberValue = view.constrainResolution(numberValue); +numberValue = view.constrainResolution(numberValue, numberValue); +numberValue = view.constrainResolution(numberValue, numberValue, numberValue); +numberValue = view.constrainRotation(); +numberValue = view.constrainRotation(numberValue); +numberValue = view.constrainRotation(numberValue, numberValue); +voidValue = view.fit(simpleGeometry); +voidValue = view.fit(simpleGeometry, {}); +voidValue = view.fit(extent); +voidValue = view.fit(extent, {}); +voidValue = view.fit(extent, { callback: () => { } }); +voidValue = view.fit(extent, { callback: (animationCompleted: boolean) => { } }); +voidValue = view.fit(extent, { + size: size, + padding: [numberValue, numberValue, numberValue, numberValue], + constrainResolution: booleanValue, + nearest: booleanValue, + minResolution: numberValue, + maxZoom: numberValue, + duration: numberValue, + easing: easingFunction, + callback: (animationCompleted: boolean) => { } +}); +booleanValue = view.getAnimating(); +coordinate = view.getCenter(); +booleanValue = view.getInteracting(); +numberValue = view.getMaxResolution(); +numberValue = view.getMaxZoom(); +numberValue = view.getMinResolution(); +numberValue = view.getMinZoom(); +projection = view.getProjection(); +numberValue = view.getResolution(); +numberValue = view.getResolutionForExtent(extent); +numberValue = view.getResolutionForExtent(extent, size); +numberValue = view.getResolutionForZoom(numberValue); +[numberValue, numberValue, numberValue, numberValue, numberValue] = view.getResolutions(); +numberValue = view.getRotation(); +numberValue = view.getZoom(); +numberValue = view.getZoomForResolution(numberValue); +voidValue = view.rotate(numberValue); +voidValue = view.rotate(numberValue, coordinate); +voidValue = view.setCenter(coordinate); voidValue = view.setMaxZoom(numberValue); voidValue = view.setMinZoom(numberValue); +voidValue = view.setResolution(); +voidValue = view.setResolution(numberValue); +voidValue = view.setRotation(numberValue); +voidValue = view.setZoom(numberValue); // // ol.layer.Base @@ -451,7 +536,9 @@ let tileLayer: ol.layer.Tile = new ol.layer.Tile({ // // ol.layer.Vector // +let vectorLayerRenderMode: olx.layer.VectorRenderType = 'image'; let vectorLayer: ol.layer.Vector = new ol.layer.Vector({ + renderMode: vectorLayerRenderMode, source: new ol.source.Vector(), zIndex: -1 }); @@ -464,6 +551,7 @@ let vectorTileLayer: ol.layer.VectorTile = new ol.layer.VectorTile({ zIndex: 2 }); + // // ol.Object // diff --git a/types/opentok/opentok-tests.ts b/types/opentok/opentok-tests.ts index c0f93f333f..28553463b4 100644 --- a/types/opentok/opentok-tests.ts +++ b/types/opentok/opentok-tests.ts @@ -1,4 +1,4 @@ -import * as OpenTok from 'opentok'; +import OpenTok = require('opentok'); const client = new OpenTok('API_KEY', 'API_SECRET'); diff --git a/types/opentype.js/index.d.ts b/types/opentype.js/index.d.ts index 24df752461..8dc449784d 100644 --- a/types/opentype.js/index.d.ts +++ b/types/opentype.js/index.d.ts @@ -1,66 +1,152 @@ -// Type definitions for opentype.js +// Type definitions for opentype.js 0.7 // Project: https://github.com/nodebox/opentype.js // Definitions by: Dan Marshall +// Edgar Simson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 export as namespace opentype; -interface Contour extends Array { -} - -export class Encoding { - charset: string; - charToGlyphIndex(c: string): number; - font: Font; -} - -interface Field { - name: string; - type: string; - value: any; -} +/****************************************** + * FONT + ******************************************/ export class Font { - private nametoGlyphIndex; - private supported; - constructor(options: FontOptions); + names: FontNames; + unitsPerEm: number; ascender: number; - cffEncoding: Encoding; + descender: number; + createdTimestamp: number; + tables: { [tableName: string]: Table }; + supported: boolean; + glyphs: GlyphSet; + encoding: Encoding; + substitution: Substitution; + + readonly defaultRenderOptions: RenderOptions; + + constructor(options: FontConstructorOptions); + charToGlyph(c: string): Glyph; charToGlyphIndex(s: string): number; - descender: number; - download(): void; - draw(ctx: CanvasRenderingContext2D, text: string, x: number, y: number, fontSize: number, options?: RenderOptions): void; - drawMetrics(ctx: CanvasRenderingContext2D, text: string, x: number, y: number, fontSize: number, options?: RenderOptions): void; - drawPoints(ctx: CanvasRenderingContext2D, text: string, x: number, y: number, fontSize: number, options?: RenderOptions): void; - encoding: Encoding; - forEachGlyph(text: string, x: number, y: number, fontSize: number, options: RenderOptions, callback: { (glyph: Glyph, x: number, y: number, fontSize: number, options?: RenderOptions): void; }): void; + download(fileName?: string): void; + draw( + ctx: CanvasRenderingContext2D, + text: string, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + drawMetrics( + ctx: CanvasRenderingContext2D, + text: string, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + drawPoints( + ctx: CanvasRenderingContext2D, + text: string, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + forEachGlyph( + text: string, + x: number | undefined, + y: number | undefined, + fontSize: number | undefined, + options: RenderOptions | undefined, + callback: ( + glyph: Glyph, + x: number, + y: number, + fontSize: number, + options?: RenderOptions + ) => void + ): number; + getAdvanceWidth( + text: string, + fontSize?: number, + options?: RenderOptions + ): number; getEnglishName(name: string): string; - getGposKerningValue: { (leftGlyph: Glyph | number, rightGlyph: Glyph | number): number; }; - getKerningValue(leftGlyph: Glyph | number, rightGlyph: Glyph | number): number; - getPath(text: string, x: number, y: number, fontSize: number, options?: RenderOptions): Path; - getPaths(text: string, x: number, y: number, fontSize: number, options?: RenderOptions): Path[]; - glyphs: GlyphSet; + getKerningValue( + leftGlyph: Glyph | number, + rightGlyph: Glyph | number + ): number; + getPath( + text: string, + x: number, + y: number, + fontSize: number, + options?: RenderOptions + ): Path; + getPaths( + text: string, + x: number, + y: number, + fontSize: number, + options?: RenderOptions + ): Path[]; glyphIndexToName(gid: number): string; glyphNames: GlyphNames; hasChar(c: string): boolean; kerningPairs: KerningPairs; - names: FontNames; nameToGlyph(name: string): Glyph; nameToGlyphIndex(name: string): number; numberOfHMetrics: number; numGlyphs: number; outlinesFormat: string; stringToGlyphs(s: string): Glyph[]; - tables: { [tableName: string]: Table; }; toArrayBuffer(): ArrayBuffer; toBuffer(): ArrayBuffer; toTables(): Table; - unitsPerEm: number; validate(): void; } -interface FontNames { +export type FontConstructorOptions = FontConstructorOptionsBase & + Partial & { + glyphs: Glyph[]; + }; + +export interface FontOptions { + empty?: boolean; + familyName: string; + styleName: string; + fullName?: string; + postScriptName?: string; + designer?: string; + designerURL?: string; + manufacturer?: string; + manufacturerURL?: string; + license?: string; + licenseURL?: string; + version?: string; + description?: string; + copyright?: string; + trademark?: string; + unitsPerEm: number; + ascender: number; + descender: number; + createdTimestamp: number; + weightClass?: string; + widthClass?: string; + fsSelection?: string; +} + +export interface FontConstructorOptionsBase { + familyName: string; + styleName: string; + unitsPerEm: number; + ascender: number; + descender: number; +} + +export interface FontNames { copyright: LocalizedName; description: LocalizedName; designer: LocalizedName; @@ -77,28 +163,33 @@ interface FontNames { version: LocalizedName; } -interface FontOptions { - copyright?: string; - ascender?: number; - descender?: number; - description?: string; - designer?: string; - designerURL?: string; - empty?: boolean; - familyName?: string; - fullName?: string; - glyphs?: Glyph[] | GlyphSet; - license?: string; - licenseURL?: string; - manufacturer?: string; - manufacturerURL?: string; - postScriptName?: string; - styleName?: string; - unitsPerEm?: number; - trademark?: string; - version?: string; +export interface Table { + [propName: string]: any; + encode(): number[]; + fields: Field[]; + sizeOf(): number; + tables: Table[]; + tableName: string; } +export interface KerningPairs { + [pair: string]: number; +} + +export interface LocalizedName { + [lang: string]: string; +} + +export interface Field { + name: string; + type: string; + value: any; +} + +/****************************************** + * GLYPH + ******************************************/ + export class Glyph { private index; private xMin; @@ -106,23 +197,50 @@ export class Glyph { private yMin; private yMax; private points; - constructor(options: GlyphOptions); - addUnicode(unicode: number): void; - advanceWidth: number; - bindConstructorValues(options: GlyphOptions): void; - draw(ctx: CanvasRenderingContext2D, x: number, y: number, fontSize: number): void; - drawMetrics(ctx: CanvasRenderingContext2D, x: number, y: number, fontSize: number): void; - drawPoints(ctx: CanvasRenderingContext2D, x: number, y: number, fontSize: number): void; - getContours(): Contour[]; - getMetrics(): Metrics; - getPath(x: number, y: number, fontSize: number): Path; + name: string; - path: Path | { (): Path; }; + path: Path | (() => Path); unicode: number; unicodes: number[]; -} + advanceWidth: number; -interface GlyphOptions { + constructor(options: GlyphOptions); + + addUnicode(unicode: number): void; + bindConstructorValues(options: GlyphOptions): void; + draw( + ctx: CanvasRenderingContext2D, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + drawMetrics( + ctx: CanvasRenderingContext2D, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + drawPoints( + ctx: CanvasRenderingContext2D, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + getBoundingBox(): BoundingBox; + getContours(): Contour; + getMetrics(): Metrics; + getPath( + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions, + font?: Font + ): Path; +} +export interface GlyphOptions { advanceWidth?: number; index?: number; font?: Font; @@ -146,71 +264,13 @@ export class GlyphNames { export class GlyphSet { private font; private glyphs; - constructor(font: Font, glyphs: Glyph[] | { (): Glyph; }[]); + constructor(font: Font, glyphs: Glyph[] | Array<(() => Glyph)>); get(index: number): Glyph; length: number; - push(index: number, loader: { (): Glyph; }): void; + push(index: number, loader: () => Glyph): void; } -interface KerningPairs { - [pair: string]: number; -} - -export function load(url: string, callback: { (error: any, font?: Font): void; }): void; - -export function loadSync(url: string): Font; - -interface LocalizedName { - [lang: string]: string; -} - -interface Metrics { - leftSideBearing: number; - rightSideBearing?: number; - xMax: number; - xMin: number; - yMax: number; - yMin: number; -} - -export function parse(buffer: any): Font; - -export class Path { - private fill; - private stroke; - private strokeWidth; - constructor(); - bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): void; - close: () => void; - closePath(): void; - commands: PathCommand[]; - curveTo: (x1: number, y1: number, x2: number, y2: number, x: number, y: number) => void; - draw(ctx: CanvasRenderingContext2D): void; - extend(pathOrCommands: Path | PathCommand[]): void; - lineTo(x: number, y: number): void; - moveTo(x: number, y: number): void; - quadraticCurveTo(x1: number, y1: number, x: number, y: number): void; - quadTo: (x1: number, y1: number, x: number, y: number) => void; - toPathData(decimalPlaces: number): string; - toSVG(decimalPlaces: number): string; - unitsPerEm: number; -} - -interface PathCommand { - type: string; - x?: number; - y?: number; - x1?: number; - y1?: number; - x2?: number; - y2?: number; -} - -interface Point { - lastPointOfContour?: boolean; -} - -interface Post { +export interface Post { glyphNameIndex?: number[]; isFixedPitch: number; italicAngle: number; @@ -226,15 +286,108 @@ interface Post { version: number; } -interface RenderOptions { - kerning: boolean; +export interface RenderOptions { + script?: string; + language?: string; + kerning?: boolean; + xScale?: number; + yScale?: number; + features?: { + [key: string]: boolean; + }; } -interface Table { - [propName: string]: any; - encode(): number[]; - fields: Field[]; - sizeOf(): number; - tables: Table[]; - tableName: string; +export interface Metrics { + leftSideBearing: number; + rightSideBearing?: number; + xMax: number; + xMin: number; + yMax: number; + yMin: number; } + +export interface Contour extends Array {} + +export interface Point { + lastPointOfContour?: boolean; +} + +/****************************************** + * PATH + ******************************************/ + +export class Path { + private fill; + private stroke; + private strokeWidth; + constructor(); + bezierCurveTo( + x1: number, + y1: number, + x2: number, + y2: number, + x: number, + y: number + ): void; + close: () => void; + closePath(): void; + commands: PathCommand[]; + curveTo: ( + x1: number, + y1: number, + x2: number, + y2: number, + x: number, + y: number + ) => void; + draw(ctx: CanvasRenderingContext2D): void; + extend(pathOrCommands: Path | PathCommand[] | BoundingBox): void; + getBoundingBox(): BoundingBox; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(x1: number, y1: number, x: number, y: number): void; + quadTo: (x1: number, y1: number, x: number, y: number) => void; + toDOMElement(decimalPlaces: number): SVGPathElement; + toPathData(decimalPlaces: number): string; + toSVG(decimalPlaces: number): string; + unitsPerEm: number; +} + +export interface PathCommand { + type: string; + x?: number; + y?: number; + x1?: number; + y1?: number; + x2?: number; + y2?: number; +} + +/****************************************** + * UTIL CLASSES + ******************************************/ + +export type BoundingBox = () => any; +// TODO add methods + +export interface Encoding { + charset: string; + charToGlyphIndex(c: string): number; + font: Font; +} + +export type Substitution = (font: Font) => any; +// TODO add methods + +/****************************************** + * STATIC + ******************************************/ + +export function load( + url: string, + callback: (error: any, font?: Font) => void +): void; + +export function loadSync(url: string): Font; + +export function parse(buffer: any): Font; diff --git a/types/opentype.js/opentype.js-tests.ts b/types/opentype.js/opentype.js-tests.ts index e4b9942bd9..04781d5415 100644 --- a/types/opentype.js/opentype.js-tests.ts +++ b/types/opentype.js/opentype.js-tests.ts @@ -1,63 +1,119 @@ -var x = 0; -var y = 0; -var fontSize = 72; -var ctx: CanvasRenderingContext2D; +const x = 0; +const y = 0; +const fontSize = 72; +let ctx: CanvasRenderingContext2D; -opentype.load('fonts/Roboto-Black.ttf', function(err, font) { +opentype.load('fonts/Roboto-Black.ttf', (err, font) => { if (err) { - alert('Font could not be loaded: ' + err); + alert('Font could not be loaded: ' + err); } else { - var path = font.getPath('Hello, World!', 0, 150, 72); + const path = font.getPath('Hello, World!', 0, 150, 72); // If you just want to draw the text you can also use font.draw(ctx, text, x, y, fontSize). path.draw(ctx); } }); -var myBuffer: ArrayBuffer; -var font = opentype.parse(myBuffer); +let myBuffer: ArrayBuffer; +let font = opentype.parse(myBuffer); font = opentype.loadSync('fonts/Roboto-Black.ttf'); -var notdefGlyph = new opentype.Glyph({ +const notdefGlyph = new opentype.Glyph({ name: '.notdef', unicode: 0, advanceWidth: 650, path: new opentype.Path() }); -var aPath = new opentype.Path(); -aPath.moveTo(100, 0); -aPath.lineTo(100, 700); +const aPath = new opentype.Path(); // more drawing instructions... -var aGlyph = new opentype.Glyph({ +const aGlyph = new opentype.Glyph({ name: 'A', unicode: 65, advanceWidth: 650, path: aPath }); -var glyphs = [notdefGlyph, aGlyph]; -var font = new opentype.Font({ +const glyphs = [notdefGlyph, aGlyph]; +const fontGenerated = new opentype.Font({ familyName: 'OpenTypeSans', styleName: 'Medium', unitsPerEm: 1000, ascender: 800, descender: -200, - glyphs: glyphs}); + + glyphs +}); font.download(); -font.getPath('text', x, y, fontSize); -font.draw(ctx, 'text', x, y, fontSize); -font.drawPoints(ctx, 'text', x, y, fontSize); -font.drawMetrics(ctx, 'text', x, y, fontSize); -font.stringToGlyphs('string'); -font.charToGlyph('c'); -font.getKerningValue(notdefGlyph, aGlyph); +const hasChar: boolean = font.hasChar('a'); +const charIndex: number = font.charToGlyphIndex('a'); +const charGlyph: opentype.Glyph = font.charToGlyph('a'); +const charGlyphs: opentype.Glyph[] = font.stringToGlyphs('abc'); +const nameIndex: number = font.nameToGlyphIndex('a'); +const nameGlyph: opentype.Glyph = font.nameToGlyph('a'); +const indexName: string = font.glyphIndexToName(1); +const kerning: number = font.getKerningValue(notdefGlyph, aGlyph); +font.defaultRenderOptions.kerning = false; +const forEachWidth: number = font.forEachGlyph( + 'text', + x, + y, + fontSize, + { + kerning: true + }, + (glyph: opentype.Glyph, x: number, y: number, fontSize: number) => { + console.log({ + glyph, + x, + y, + fontSize + }); + } +); +const fontPath: opentype.Path = font.getPath('text', x, y, fontSize, {}); +const fontPaths: opentype.Path[] = font.getPaths('text', x, y, fontSize, {}); +const fontWidth: number = font.getAdvanceWidth('text', fontSize, { yScale: 0.5 }); +font.draw(ctx, 'text'); +font.drawPoints(ctx, 'text', x, y, fontSize, { yScale: 0.5 }); +font.drawMetrics(ctx, 'text', x, y, fontSize, { xScale: 1.1, yScale: 0.5 }); +const engName: string = font.getEnglishName('a'); +font.validate(); +const tables: opentype.Table = font.toTables(); +const ab: ArrayBuffer = font.toArrayBuffer(); +font.download(); +font.download('fileName.ttf'); -aGlyph.getPath(x, y, fontSize); -aGlyph.draw(ctx, x, y, fontSize); +aGlyph.bindConstructorValues({ advanceWidth: 1 }); +aGlyph.addUnicode(42); +const glyphBBox: opentype.BoundingBox = aGlyph.getBoundingBox(); +const glyphPathBasic: opentype.Path = aGlyph.getPath(); +const glyphPathFull: opentype.Path = aGlyph.getPath( + x, + y, + fontSize, + { xScale: 1, yScale: 2 }, + font +); +const glyphContours: opentype.Contour = aGlyph.getContours(); +const glyphMetrics: opentype.Metrics = aGlyph.getMetrics(); +aGlyph.draw(ctx, x, y, fontSize, {}); aGlyph.drawPoints(ctx, x, y, fontSize); aGlyph.drawMetrics(ctx, x, y, fontSize); +aPath.moveTo(100, 0); +aPath.lineTo(100, 700); +aPath.curveTo(100, 700, 200, 800, 150, 750); +aPath.bezierCurveTo(100, 700, 200, 800, 150, 750); +aPath.quadTo(100, 700, 200, 800); +aPath.quadraticCurveTo(100, 700, 200, 800); +aPath.close(); +aPath.closePath(); +aPath.extend(aPath); +aPath.extend(aPath.commands); +aPath.extend(aPath.getBoundingBox()); +const pathBBox: opentype.BoundingBox = aPath.getBoundingBox(); aPath.draw(ctx); -aPath.toPathData(7); -aPath.toSVG(7); +const pathData: string = aPath.toPathData(7); +const pathSvg: string = aPath.toSVG(7); +const pathDom: SVGPathElement = aPath.toDOMElement(7); diff --git a/types/opentype.js/tslint.json b/types/opentype.js/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/opentype.js/tslint.json +++ b/types/opentype.js/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/opn/tsconfig.json b/types/opn/tsconfig.json index 2a51fff8ca..7551867ee1 100644 --- a/types/opn/tsconfig.json +++ b/types/opn/tsconfig.json @@ -1,16 +1,23 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": [ + "es6" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": ["index.d.ts", "opn-tests.ts"] -} + "files": [ + "index.d.ts", + "opn-tests.ts" + ] +} \ No newline at end of file diff --git a/types/optics-agent/optics-agent-tests.ts b/types/optics-agent/optics-agent-tests.ts index 2135c810d4..22b9b479e9 100644 --- a/types/optics-agent/optics-agent-tests.ts +++ b/types/optics-agent/optics-agent-tests.ts @@ -9,9 +9,9 @@ import OpticsAgent, { Agent, } from 'optics-agent'; import { GraphQLSchema } from 'graphql'; -import * as express from 'express'; +import express = require('express'); import * as hapi from 'hapi'; -import * as KoaServer from 'koa'; +import KoaServer = require('koa'); const configOptions: Options = { apiKey: "", diff --git a/types/optics-agent/tsconfig.json b/types/optics-agent/tsconfig.json index e7dbc8958b..046bfaad81 100644 --- a/types/optics-agent/tsconfig.json +++ b/types/optics-agent/tsconfig.json @@ -13,9 +13,6 @@ "../" ], "types": [], - "paths": { - "boom": ["boom/v4"] - }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -23,4 +20,4 @@ "index.d.ts", "optics-agent-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/optimize-css-assets-webpack-plugin/index.d.ts b/types/optimize-css-assets-webpack-plugin/index.d.ts index b16d384d72..788b2e6a1f 100644 --- a/types/optimize-css-assets-webpack-plugin/index.d.ts +++ b/types/optimize-css-assets-webpack-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/NMFR/optimize-css-assets-webpack-plugin // Definitions by: Armando Meziat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack'; diff --git a/types/optimize-css-assets-webpack-plugin/optimize-css-assets-webpack-plugin-tests.ts b/types/optimize-css-assets-webpack-plugin/optimize-css-assets-webpack-plugin-tests.ts index 74cf685649..0dd1531313 100644 --- a/types/optimize-css-assets-webpack-plugin/optimize-css-assets-webpack-plugin-tests.ts +++ b/types/optimize-css-assets-webpack-plugin/optimize-css-assets-webpack-plugin-tests.ts @@ -1,4 +1,4 @@ -import * as OptimizeCssAssets from 'optimize-css-assets-webpack-plugin'; +import OptimizeCssAssets = require('optimize-css-assets-webpack-plugin'); const ocap: OptimizeCssAssets = new OptimizeCssAssets({ assetNameRegExp: /\.min\.css$/, diff --git a/types/ora/index.d.ts b/types/ora/index.d.ts index 05c4c9b460..f5dd605073 100644 --- a/types/ora/index.d.ts +++ b/types/ora/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Basarat Ali Syed // Christian Rackerseder // BendingBender +// Aleh Zasypkin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -118,14 +119,14 @@ declare class Ora { text: string; color: Color; - - promise(action: PromiseLike, options?: Options | string): Ora; } interface oraFactory { (options?: Options | string): Ora; new (options?: Options | string): Ora; + + promise(action: PromiseLike, options?: Options | string): Ora; } declare const ora: oraFactory; diff --git a/types/ora/ora-tests.ts b/types/ora/ora-tests.ts index ca5db9d70d..56a0d498c3 100644 --- a/types/ora/ora-tests.ts +++ b/types/ora/ora-tests.ts @@ -41,7 +41,7 @@ spinner.stopAndPersist({text: 'all done'}); spinner.stopAndPersist({symbol: '@', text: 'all done'}); const resolves = Promise.resolve(1); -spinner.promise(resolves, { +Ora.promise(resolves, { stream: new PassThrough(), text: 'foo', color: 'blue', diff --git a/types/orientjs/orientjs-tests.ts b/types/orientjs/orientjs-tests.ts index ec083b84e3..9b11968058 100644 --- a/types/orientjs/orientjs-tests.ts +++ b/types/orientjs/orientjs-tests.ts @@ -1,4 +1,4 @@ -import * as orientjs from 'orientjs'; +import orientjs = require('orientjs'); const dbserver = orientjs({ host: 'localhost', diff --git a/types/osrm/osrm-tests.ts b/types/osrm/osrm-tests.ts index fd53363dd7..513e8c1fd2 100644 --- a/types/osrm/osrm-tests.ts +++ b/types/osrm/osrm-tests.ts @@ -1,5 +1,5 @@ import * as fs from 'fs'; -import * as OSRM from 'osrm'; +import OSRM = require('osrm'); // Access to Types from namespace const tile: OSRM.Tile = [0, 0, 0]; diff --git a/types/otplib/tsconfig.json b/types/otplib/tsconfig.json index cfb2b07081..4aa529c51c 100644 --- a/types/otplib/tsconfig.json +++ b/types/otplib/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "otplib-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/owasp-password-strength-test/tsconfig.json b/types/owasp-password-strength-test/tsconfig.json index 0206d30034..926835b3e5 100644 --- a/types/owasp-password-strength-test/tsconfig.json +++ b/types/owasp-password-strength-test/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "owasp-password-strength-test-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/p-limit/index.d.ts b/types/p-limit/index.d.ts index a10fd05e1e..416622298b 100644 --- a/types/p-limit/index.d.ts +++ b/types/p-limit/index.d.ts @@ -7,4 +7,4 @@ declare namespace pLimit {} export = pLimit; -declare function pLimit(concurrency: number): (fn: () => PromiseLike) => Promise; +declare function pLimit(concurrency: number): (fn: () => PromiseLike) => Promise; diff --git a/types/p-limit/p-limit-tests.ts b/types/p-limit/p-limit-tests.ts index 6e50894802..e04b895e87 100644 --- a/types/p-limit/p-limit-tests.ts +++ b/types/p-limit/p-limit-tests.ts @@ -1,6 +1,6 @@ import pLimit = require('p-limit'); -const limit = pLimit(1); +const limit = pLimit(1); const input = [ limit(() => Promise.resolve('foo')), diff --git a/types/p-loading/index.d.ts b/types/p-loading/index.d.ts new file mode 100644 index 0000000000..a7c2425b68 --- /dev/null +++ b/types/p-loading/index.d.ts @@ -0,0 +1,50 @@ +// Type definitions for p-loading 1.2 +// Project: http://joseshiru.github.io/p-loading/ +// Definitions by: Soner Köksal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +interface PLoadingOptions { + action?: "show" | "hide" | "destroy"; + maskColor?: string; + containerHTML?: string; + containerAttrs?: object; + containerClass?: string; + spinnerHTML?: string; + spinnerAttrs?: object; + spinnerClass?: string; + /** + * @deprecated + */ + onShowContainer?: ($pluginElement: JQuery, $container: JQuery) => void; + /** + * @deprecated + */ + onHideContainer?: ($pluginElement: JQuery, $container: JQuery) => void; + /** + * @deprecated + */ + onDestroyContainer?: ($container: JQuery) => void; + hideAnimation?: ($container: JQuery) => void; + showAnimation?: ($container: JQuery) => void; + destroyAfterHide?: boolean; + idPrefix?: string; + pluginNameSpace?: string; + useAddOns?: string []; +} + +interface PLoading { + (options: PLoadingOptions): void; + + defaults: PLoadingOptions; +} + +interface JQuery { + ploading: PLoading; +} + +interface JQueryStatic { + ploading: PLoading; +} diff --git a/types/p-loading/p-loading-tests.ts b/types/p-loading/p-loading-tests.ts new file mode 100644 index 0000000000..6aeef649a9 --- /dev/null +++ b/types/p-loading/p-loading-tests.ts @@ -0,0 +1,21 @@ +$('#test').ploading({action: 'show'}); + +$('#test').ploading({action: 'hide'}); + +$('#test').ploading({action: 'destroy'}); + +$('#test').ploading({action: 'hide', useAddOns: ['addOnName']}); + +$.fn.ploading.defaults = { + // ploading static settings + useAddOns: ['addOnName'] +}; + +$.fn.ploading.defaults = { + spinnerClass: 'your-spinner-class' +}; + +$.fn.ploading.defaults = { + spinnerHTML: '', + spinnerClass: 'fa fa-spinner fa-spin p-loading-fontawesome' +}; diff --git a/types/p-loading/tsconfig.json b/types/p-loading/tsconfig.json new file mode 100644 index 0000000000..09fd52fdda --- /dev/null +++ b/types/p-loading/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", + "p-loading-tests.ts" + ] +} \ No newline at end of file diff --git a/types/p-loading/tslint.json b/types/p-loading/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/p-loading/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/p-queue/index.d.ts b/types/p-queue/index.d.ts index 3cc6acef53..568de0ca1d 100644 --- a/types/p-queue/index.d.ts +++ b/types/p-queue/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for p-queue 1.1 +// Type definitions for p-queue 2.3 // Project: https://github.com/sindresorhus/p-queue#readme // Definitions by: BendingBender // Evan Shortiss @@ -8,16 +8,68 @@ export = PQueue; declare class PQueue { + /** + * Size of the queue. + */ size: number; + + /** + * Number of pending promises. + */ pending: number; + /** + * Whether the queue is currently paused. + */ + isPaused: boolean; + constructor(opts?: PQueue.Options); + /** + * Returns the promise returned by calling fn. + * @param fn Promise-returning/async function. + */ add(fn: PQueue.Task, opts?: O): Promise; + /** + * Same as .add(), but accepts an array of async functions and + * returns a promise that resolves when all async functions are resolved. + * @param fn Array of Promise-returning/async functions. + */ + addAll(fns: Array>, opts?: O): Promise; + + /** + * Returns a promise that settles when the queue becomes empty. + * Can be called multiple times. Useful if you for example add + * additional items at a later time. + */ onEmpty(): Promise; + /** + * Returns a promise that settles when the queue becomes empty, and all + * promises have completed; queue.size === 0 && queue.pending === 0. + * The difference with .onEmpty is that .onIdle guarantees that all work + * from the queue has finished. .onEmpty merely signals that the queue is + * empty, but it could mean that some promises haven't completed yet. + */ + onIdle(): Promise; + + /** + * Start (or resume) executing enqueued tasks within concurrency limit. + * No need to call this if queue is not paused (via options.autoStart = false + * or by .pause() method.) + */ + start(): void; + + /** + * Clear the queue. + */ clear(): void; + + /** + * Put queue execution on hold. + */ + pause(): void; } declare namespace PQueue { @@ -38,8 +90,9 @@ declare namespace PQueue { } interface Options { - queueClass?: QueueClassConstructor; concurrency?: number; + autoStart?: boolean; + queueClass?: QueueClassConstructor; } interface DefaultAddOptions { diff --git a/types/p-queue/p-queue-tests.ts b/types/p-queue/p-queue-tests.ts index 8c54953a73..e12723a7d4 100644 --- a/types/p-queue/p-queue-tests.ts +++ b/types/p-queue/p-queue-tests.ts @@ -6,19 +6,26 @@ queue.add(() => Promise.resolve('sindresorhus.com')).then((sindre) => { const str: string = sindre; }); +queue.addAll([() => Promise.resolve('oh'), () => Promise.resolve('hi')]).then(r => { + r.indexOf('h'); +}); + Promise.resolve((): Promise => Promise.resolve('unicorn')) .then(task => queue.add(task, {priority: 5})) .then(unicorn => { const str: string = unicorn; }); -queue.onEmpty().then(() => { -}); +queue.onEmpty().then(() => {}); +queue.onIdle().then(() => {}); +queue.start(); +queue.pause(); queue.clear(); let num: number; num = queue.size; num = queue.pending; +const paused = queue.isPaused; class QueueClass implements PQueue.QueueClass<{ any: string }> { private readonly queue: Array<() => void>; diff --git a/types/package-json/tsconfig.json b/types/package-json/tsconfig.json index 52c1adb7d3..7bca217f58 100644 --- a/types/package-json/tsconfig.json +++ b/types/package-json/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "package-json-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/page-icon/page-icon-tests.ts b/types/page-icon/page-icon-tests.ts index 4a6bc8c2b6..2b2873dae1 100644 --- a/types/page-icon/page-icon-tests.ts +++ b/types/page-icon/page-icon-tests.ts @@ -1,4 +1,4 @@ -import * as pageIcon from "page-icon"; +import pageIcon = require("page-icon"); const siteUrl = "https://www.facebook.com/"; pageIcon(siteUrl) diff --git a/types/pangu/tsconfig.json b/types/pangu/tsconfig.json index a1084b5b06..91b1b9f43a 100644 --- a/types/pangu/tsconfig.json +++ b/types/pangu/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pangu-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index 64d961ed10..3f57526a19 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -290,7 +290,7 @@ declare module paper { * Transforms a point and returns the result. * @param point - the point to be transformed */ - transform(point: Point): Matrix; + transform(point: Point): Point; /** * Transforms an array of coordinates by this matrix and stores the results into the destination array, which is also returned. @@ -304,7 +304,7 @@ declare module paper { * Inverse transforms a point and returns the result. * @param point - the point to be transformed */ - inverseTransform(point: Point): Matrix; + inverseTransform(point: Point): Point; /** * Attempts to decompose the affine transformation described by this matrix into scaling, rotation and shearing, and returns an object with these properties if it succeeded, null otherwise. @@ -1308,12 +1308,12 @@ declare module paper { * The function to be called when the mouse button is pushed down on the item. The function receives a MouseEvent object which contains information about the mouse event. */ onMouseDown: (event: MouseEvent) => void; - + /** * The function to be called when the mouse position changes while the mouse is being dragged. The function receives a MouseEvent object which contains information about the mouse event. */ onMouseDrag: (event: MouseEvent) => void; - + /** * The function to be called when the mouse button is released over the item. * The function receives a MouseEvent object which contains information about the mouse event. @@ -1353,9 +1353,11 @@ declare module paper { /** * Clones the item within the same project and places the copy above the item. - * @param insert [optional] - specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options [optional] - object with 2 parameters + * insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * deep: specifies whether the item’s children should also be cloned — default: true */ - clone(insert?: boolean): Item; + clone(options?: { insert?: boolean, deep?: boolean }): Item; /** * When passed a project, copies the item to the project, or duplicates it within the same project. When passed an item, copies the item into the specified item. @@ -3235,6 +3237,16 @@ declare module paper { * Deselects all selected items in the project. */ deselectAll(): void; + + /** + * Adds the specified layer at the end of the this project’s layers list. + */ + addLayer(layer: Layer): Layer; + + /** + * Inserts the specified layer at the specified index in this project’s layers list. + */ + insertLayer(index: number, layer: Layer): Layer; /** * Perform a hit-test on the items contained within the project at the location of the specified point. @@ -3535,7 +3547,7 @@ declare module paper { * @param highlight [optional] - */ constructor(color: Gradient, origin: Point, destination: Point, highlight?: Point); - + /** * Creates a RGB Color object. * @param hex - the RGB color in hex, i.e. #000000 @@ -3769,6 +3781,48 @@ declare module paper { */ onResize: (event: Event) => void; + /** + * The function to be called when the mouse button is pushed down on the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseDown: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse position changes while the mouse is being dragged. The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseDrag: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse button is released over the item. + * The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseUp: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse clicks on the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onClick: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse double clicks on the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onDoubleClick: (event: MouseEvent) => void; + + /** + * The function to be called repeatedly when the mouse moves on top of the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseMove: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse moves over the item. This function will only be called again, once the mouse moved outside of the item first. The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseEnter: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse moves out of the item. + * The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseLeave: (event: MouseEvent) => void; + /** * Removes this view from the project and frees the associated element. */ diff --git a/types/parent-package-json/parent-package-json-tests.ts b/types/parent-package-json/parent-package-json-tests.ts index 41a5a7bdd0..50091ff376 100644 --- a/types/parent-package-json/parent-package-json-tests.ts +++ b/types/parent-package-json/parent-package-json-tests.ts @@ -1,4 +1,4 @@ -import * as parent from 'parent-package-json'; +import parent = require('parent-package-json'); const hasParent = parent('/optional/path/', 1); diff --git a/types/parent-package-json/tsconfig.json b/types/parent-package-json/tsconfig.json index 33d474c851..c3c9be507a 100644 --- a/types/parent-package-json/tsconfig.json +++ b/types/parent-package-json/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "parent-package-json-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/parity-pmd/index.d.ts b/types/parity-pmd/index.d.ts new file mode 100644 index 0000000000..30b02d72ef --- /dev/null +++ b/types/parity-pmd/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for parity-pmd 0.4 +// Project: https://github.com/paritytrading/node-parity-pmd#readme +// Definitions by: Leonard Vujanić +// Vilim Stubičan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// + +/** + * Declares Parity PMD message structure + * Full reference can be found here https://github.com/paritytrading/parity/blob/master/libraries/net/doc/PMD.md + */ +export interface PMDMessage { + messageType: string; + version?: string; + timestamp?: number; + orderNumber?: number; + side?: string; + instrument?: string; + quantity?: number; + price?: number; +} + +export function format(message: PMDMessage): Buffer; + +export function parse(buffer: Buffer): PMDMessage; diff --git a/types/parity-pmd/parity-pmd-tests.ts b/types/parity-pmd/parity-pmd-tests.ts new file mode 100644 index 0000000000..3645e7598c --- /dev/null +++ b/types/parity-pmd/parity-pmd-tests.ts @@ -0,0 +1,27 @@ +import { format, parse, PMDMessage } from 'parity-pmd'; + +// Arrange +const buffer = new Buffer(5); +buffer.writeUInt8(0x56, 0); +buffer.writeUInt32BE(70, 1); +const parsedContent: PMDMessage = parse(buffer); + +// Act & Assert +// $ExpectType PMDMessage +parse(buffer); + +// $ExpectType Buffer +format(parsedContent); + +// Invalid type +// $ExpectError +parse(''); + +// $ExpectError +format({}); + +// Invalid sub type +// $ExpectError +format({ + messageType: 1 +}); diff --git a/types/parity-pmd/tsconfig.json b/types/parity-pmd/tsconfig.json new file mode 100644 index 0000000000..92345f62fb --- /dev/null +++ b/types/parity-pmd/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", + "parity-pmd-tests.ts" + ] +} diff --git a/types/parity-pmd/tslint.json b/types/parity-pmd/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parity-pmd/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/parity-pmr/index.d.ts b/types/parity-pmr/index.d.ts new file mode 100644 index 0000000000..0e05da1d6e --- /dev/null +++ b/types/parity-pmr/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for parity-pmr 0.1 +// Project: https://github.com/paritytrading/node-parity-pmr#readme +// Definitions by: Leo Vujanić +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * Declares Parity PMR message structure + * Full reference can be found here https://github.com/paritytrading/parity/blob/master/libraries/net/doc/PMR.md + */ +export interface PMRMessage { + messageType: string; + version?: number; + timestamp?: number; + username?: string; + orderNumber?: string; + side?: string; + instrument?: string; + quantity?: number; + price?: number; + canceledQuantity?: number; + matchNumber?: number; + restingOrderNumber?: number; + incomingOrderNumber?: number; +} + +export function format(message: PMRMessage): Buffer; + +export function parse(buffer: Buffer): PMRMessage; diff --git a/types/parity-pmr/parity-pmr-tests.ts b/types/parity-pmr/parity-pmr-tests.ts new file mode 100644 index 0000000000..03bcc3534d --- /dev/null +++ b/types/parity-pmr/parity-pmr-tests.ts @@ -0,0 +1,29 @@ +import { format, parse, PMRMessage } from "parity-pmr"; + +const buffer = new Buffer("test"); +const message: PMRMessage = { + messageType: 'E' +}; + +// $ExpectType Buffer +format(message); + +// Invalid type +// $ExpectError +format(''); + +// $ExpectError +format({}); + +// Invalid sub type +// $ExpectError +format({ + messageType: 1 +}); + +// $ExpectType PMRMessage +parse(buffer); + +// Invalid type +// $ExpectError +parse(''); diff --git a/types/parity-pmr/tsconfig.json b/types/parity-pmr/tsconfig.json new file mode 100644 index 0000000000..e73825b582 --- /dev/null +++ b/types/parity-pmr/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", + "parity-pmr-tests.ts" + ] +} diff --git a/types/parity-pmr/tslint.json b/types/parity-pmr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parity-pmr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/parity-poe/index.d.ts b/types/parity-poe/index.d.ts new file mode 100644 index 0000000000..46ccf3291a --- /dev/null +++ b/types/parity-poe/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for Parity POE 0.3 +// Project: https://github.com/paritytrading/node-parity-poe +// Definitions by: Leo Vujanić +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// + +/** + * Declares Parity POE message structure + * Full reference can be found here https://github.com/paritytrading/parity/blob/master/libraries/net/doc/POE.md + */ +export interface POEMessage { + messageType: string; + orderId?: string; + timestamp?: number; + canceledQuantity?: number; + reason?: string; + liquidityFlag?: string; + matchNumber?: number; + side?: string; + instrument?: string; + quantity?: number; + price?: number; +} + +export function formatInbound(message: POEMessage): Buffer; + +export function parseInbound(buffer: Buffer): POEMessage; + +export function formatOutbound(message: POEMessage): Buffer; + +export function parseOutbound(buffer: Buffer): POEMessage; diff --git a/types/parity-poe/parity-poe-tests.ts b/types/parity-poe/parity-poe-tests.ts new file mode 100644 index 0000000000..c5b50d5189 --- /dev/null +++ b/types/parity-poe/parity-poe-tests.ts @@ -0,0 +1,68 @@ +import { formatInbound, parseInbound, formatOutbound, parseOutbound, POEMessage } from "parity-poe"; + +const buffer = new Buffer("test"); +const message: POEMessage = { + messageType: 'A' +}; + +/** + * formatInbound tests + */ + +// $ExpectType Buffer +formatInbound(message); + +// Invalid type +// $ExpectError +formatInbound(''); + +// $ExpectError +formatInbound({}); + +// Invalid sub type +// $ExpectError +formatInbound({ + messageType: 1 +}); + +/** + * parseInbound tests + */ + +// $ExpectType POEMessage +parseInbound(buffer); + +// Invalid type +// $ExpectError +parseInbound(''); + +/** + * formatOutbound tests + */ + +// $ExpectType Buffer +formatOutbound(message); + +// Invalid type +// $ExpectError +formatOutbound(''); + +// $ExpectError +formatOutbound({}); + +// Invalid sub type +// $ExpectError +formatOutbound({ + messageType: 1 +}); + +/** + * parseOutbound tests + */ + +// $ExpectType POEMessage +parseOutbound(buffer); + +// Invalid type +// $ExpectError +parseOutbound(''); diff --git a/types/parity-poe/tsconfig.json b/types/parity-poe/tsconfig.json new file mode 100644 index 0000000000..9dc0748761 --- /dev/null +++ b/types/parity-poe/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", + "parity-poe-tests.ts" + ] +} diff --git a/types/parity-poe/tslint.json b/types/parity-poe/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parity-poe/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/parse-json/tsconfig.json b/types/parse-json/tsconfig.json index 448f6787ba..d163b65cda 100644 --- a/types/parse-json/tsconfig.json +++ b/types/parse-json/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "parse-json-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/parse-link-header/parse-link-header-tests.ts b/types/parse-link-header/parse-link-header-tests.ts index 01a4de8a8f..ce32e1a1cd 100644 --- a/types/parse-link-header/parse-link-header-tests.ts +++ b/types/parse-link-header/parse-link-header-tests.ts @@ -1,4 +1,4 @@ -import * as parse from "parse-link-header"; +import parse = require("parse-link-header"); const linkHeader = '; rel="next", ' + diff --git a/types/parse-mockdb/index.d.ts b/types/parse-mockdb/index.d.ts index bff2e81935..94a1f63bb1 100644 --- a/types/parse-mockdb/index.d.ts +++ b/types/parse-mockdb/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/HustleInc/parse-mockdb // Definitions by: David Poetzsch-Heffter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 /// diff --git a/types/parse-ms/tsconfig.json b/types/parse-ms/tsconfig.json index 3fecf7615f..a4d7591291 100644 --- a/types/parse-ms/tsconfig.json +++ b/types/parse-ms/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "parse-ms-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/parse-torrent-file/parse-torrent-file-tests.ts b/types/parse-torrent-file/parse-torrent-file-tests.ts index a981c0bc81..43b8c7d0fd 100644 --- a/types/parse-torrent-file/parse-torrent-file-tests.ts +++ b/types/parse-torrent-file/parse-torrent-file-tests.ts @@ -1,4 +1,4 @@ -import * as parseTorrentFile from 'parse-torrent-file'; +import parseTorrentFile = require('parse-torrent-file'); import * as fs from 'fs'; const torrent = fs.readFileSync(__filename); diff --git a/types/parse-torrent/index.d.ts b/types/parse-torrent/index.d.ts index c6bd901976..9b410759a3 100644 --- a/types/parse-torrent/index.d.ts +++ b/types/parse-torrent/index.d.ts @@ -5,7 +5,7 @@ /// -import * as MagnetUri from 'magnet-uri'; +import MagnetUri = require('magnet-uri'); import * as ParseTorrentFile from 'parse-torrent-file'; declare const ParseTorrent: ParseTorrent.ParseTorrent; diff --git a/types/parse-torrent/parse-torrent-tests.ts b/types/parse-torrent/parse-torrent-tests.ts index 24d00dbe98..c2676ff080 100644 --- a/types/parse-torrent/parse-torrent-tests.ts +++ b/types/parse-torrent/parse-torrent-tests.ts @@ -1,4 +1,4 @@ -import * as parseTorrent from 'parse-torrent'; +import parseTorrent = require('parse-torrent'); import * as fs from 'fs'; // info hash (as a hex string) diff --git a/types/parse/index.d.ts b/types/parse/index.d.ts index 5b4ff9a0bf..15d653a791 100644 --- a/types/parse/index.d.ts +++ b/types/parse/index.d.ts @@ -4,8 +4,9 @@ // David Poetzsch-Heffter // Cedric Kemp // Flavio Negrão +// Wes Grimes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 /// /// @@ -31,6 +32,11 @@ declare namespace Parse { interface SuccessFailureOptions extends SuccessOption, ErrorOption { } + interface SignUpOptions { + useMasterKey?: boolean; + installationId?: string; + } + interface SessionTokenOption { sessionToken?: string; } @@ -98,11 +104,11 @@ declare namespace Parse { reject(error: any): void; resolve(result: any): void; then(resolvedCallback: (...values: T[]) => IPromise, - rejectedCallback?: (reason: any) => IPromise): IPromise; + rejectedCallback?: (reason: any) => IPromise): IPromise; then(resolvedCallback: (...values: T[]) => U, - rejectedCallback?: (reason: any) => IPromise): IPromise; + rejectedCallback?: (reason: any) => IPromise): IPromise; then(resolvedCallback: (...values: T[]) => U, - rejectedCallback?: (reason: any) => U): IPromise; + rejectedCallback?: (reason: any) => U): IPromise; } interface Pointer { @@ -287,13 +293,13 @@ declare namespace Parse { constructor(parent?: S, key?: string); //Adds a Parse.Object or an array of Parse.Objects to the relation. - add(object: T): void; + add(object: T | Array): void; // Returns a Parse.Query that is limited to objects in this relation. query(): Query; // Removes a Parse.Object or an array of Parse.Objects from this relation. - remove(object: T): void; + remove(object: T | Array): void; } /** @@ -371,9 +377,12 @@ declare namespace Parse { previousAttributes(): any; relation(attr: string): Relation; remove(attr: string, item: any): any; + revert(): void; save(attrs?: { [key: string]: any } | null, options?: Object.SaveOptions): Promise; save(key: string, value: any, options?: Object.SaveOptions): Promise; + save(attrs: object, options?: Object.SaveOptions): Promise; set(key: string, value: any, options?: Object.SetOptions): boolean; + set(attrs: object, options?: Object.SetOptions): boolean; setACL(acl: ACL, options?: SuccessFailureOptions): boolean; toPointer(): Pointer; unset(attr: string, options?: any): any; @@ -637,6 +646,7 @@ declare namespace Parse { select(...keys: string[]): Query; skip(n: number): Query; startsWith(key: string, prefix: string): Query; + subscribe(): Events; withinGeoBox(key: string, southwest: GeoPoint, northeast: GeoPoint): Query; withinKilometers(key: string, point: GeoPoint, maxDistance: number): Query; withinMiles(key: string, point: GeoPoint, maxDistance: number): Query; @@ -739,7 +749,7 @@ declare namespace Parse { class User extends Object { static current(): User | undefined; - static signUp(username: string, password: string, attrs: any, options?: SuccessFailureOptions): Promise; + static signUp(username: string, password: string, attrs: any, options?: SignUpOptions): Promise; static logIn(username: string, password: string, options?: SuccessFailureOptions): Promise; static logOut(): Promise; static allowCustomUserClass(isAllowed: boolean): void; @@ -747,7 +757,7 @@ declare namespace Parse { static requestPasswordReset(email: string, options?: SuccessFailureOptions): Promise; static extend(protoProps?: any, classProps?: any): any; - signUp(attrs: any, options?: SuccessFailureOptions): Promise; + signUp(attrs: any, options?: SignUpOptions): Promise; logIn(options?: SuccessFailureOptions): Promise; authenticated(): boolean; isCurrent(): boolean; @@ -882,7 +892,8 @@ declare namespace Parse { interface FunctionResponse { success: (response: any) => void; - error: (response: any) => void; + error (code: number, response: any): void; + error (response: any): void; } interface Cookie { @@ -898,22 +909,32 @@ declare namespace Parse { object: Object; } - interface BeforeFindTriggerRequest extends TriggerRequest { - query?: Query - count?: boolean - } interface AfterSaveRequest extends TriggerRequest { } interface AfterDeleteRequest extends TriggerRequest { } interface BeforeDeleteRequest extends TriggerRequest { } interface BeforeDeleteResponse extends FunctionResponse { } - interface BeforeSaveRequest extends TriggerRequest { } - interface BeforeFindRequest extends BeforeFindTriggerRequest { } + interface BeforeSaveRequest extends TriggerRequest { + original?: Parse.Object; + } interface BeforeSaveResponse extends FunctionResponse { success: () => void; } + + // Read preference describes how MongoDB driver route read operations to the members of a replica set. + enum ReadPreferenceOption { + Primary = 'PRIMARY', + PrimaryPreferred = 'PRIMARY_PREFERRED', + Secondary = 'SECONDARY', + SecondaryPreferred = 'SECONDARY_PREFERRED', + Nearest = 'NEAREST' + } + interface BeforeFindRequest extends TriggerRequest { - query: Query; + query: Query + count: boolean + isGet: boolean + readPreference?: ReadPreferenceOption } function afterDelete(arg1: any, func?: (request: AfterDeleteRequest) => void): void; @@ -1130,4 +1151,4 @@ declare module "parse/node" { declare module "parse" { import * as parse from "parse/node"; export = parse -} +} \ No newline at end of file diff --git a/types/parse/parse-tests.ts b/types/parse/parse-tests.ts index 1a2d5dcdee..ceb5693087 100644 --- a/types/parse/parse-tests.ts +++ b/types/parse/parse-tests.ts @@ -57,6 +57,12 @@ function test_object() { gameScore.set("cheatMode", false); + // Setting attrs using object + gameScore.set({ + level: '10', + difficult: 15 + }); + const score = gameScore.get("score"); const playerName = gameScore.get("playerName"); const cheatMode = gameScore.get("cheatMode"); @@ -235,7 +241,23 @@ function test_analytics() { } function test_relation() { + var game1 = new Game(); + var game2 = new Game(); + new Parse.User().relation("games").query().find().then((g: Game[]) => { }); + new Parse.User().relation("games").add(game1) + new Parse.User().relation("games").add([game1, game2]) + + new Parse.User().relation("games").remove(game1) + new Parse.User().relation("games").remove([game1, game2]) +} + +function test_user() { + const user = new Parse.User(); + user.set("username", "my name"); + user.set("password", "my pass"); + user.set("email", "email@example.com"); + user.signUp(null, { useMasterKey: true }); } function test_user_acl_roles() { @@ -266,6 +288,13 @@ function test_user_acl_roles() { game.setACL(new Parse.ACL(Parse.User.current())); game.save().then((game: Game) => { }); game.save(null, { useMasterKey: true }); + game.save({ score: '10' }, { useMasterKey: true }).then(function (game) { + // Update game then revert it to the last saved state. + game.set("score", '20'); + game.revert(); + }, function (error) { + // The save failed + }); const groupACL = new Parse.ACL(); @@ -358,15 +387,44 @@ function test_cloud_functions() { }); Parse.Cloud.beforeDelete('MyCustomClass', (request: Parse.Cloud.BeforeDeleteRequest, - response: Parse.Cloud.BeforeDeleteResponse) => { + response: Parse.Cloud.BeforeDeleteResponse) => { // result }); + const CUSTOM_ERROR_INVALID_CONDITION = 1001 + const CUSTOM_ERROR_IMMUTABLE_FIELD = 1002 + + Parse.Cloud.beforeSave('MyCustomClass', (request: Parse.Cloud.BeforeSaveRequest, + response: Parse.Cloud.BeforeSaveResponse) => { + + if (request.object.isNew()) { + if (!request.object.has('immutable')) return response.error('Field immutable is required') + } else { + const original = request.original; + if (original == null) { // When the object is not new, request.original must be defined + return response.error(CUSTOM_ERROR_INVALID_CONDITION, 'Original must me defined for an existing object') + } + + if (original.get('immutable') !== request.object.get('immutable')) { + return response.error(CUSTOM_ERROR_IMMUTABLE_FIELD, 'This field cannot be changed') + } + } + response.success() + }); + Parse.Cloud.beforeFind('MyCustomClass', (request: Parse.Cloud.BeforeFindRequest) => { let query = request.query; // the Parse.Query let user = request.user; // the user let isMaster = request.master; // if the query is run with masterKey let isCount = request.count; // if the query is a count operation (available on parse-server 2.4.0 or up) + let isGet = request.isGet; // if the query is a get operation + + // All possible read preferences + request.readPreference = Parse.Cloud.ReadPreferenceOption.Primary + request.readPreference = Parse.Cloud.ReadPreferenceOption.PrimaryPreferred + request.readPreference = Parse.Cloud.ReadPreferenceOption.Secondary + request.readPreference = Parse.Cloud.ReadPreferenceOption.SecondaryPreferred + request.readPreference = Parse.Cloud.ReadPreferenceOption.Nearest }); } @@ -468,3 +526,16 @@ function test_batch_operations() { Parse.Object.fetchAllIfNeeded(games, { sessionToken: '' }) } +function test_query_subscribe() { + // create new query from Game object type + const query = new Parse.Query(Game); + + // create subscription to Game object + const subscription = query.subscribe(); + + // listen for new Game objects created on Parse server + subscription.on('create', (game: any) => { + console.log(game); + }); +} + diff --git a/types/parse/tslint.json b/types/parse/tslint.json index e3610fefae..e2172b7f24 100644 --- a/types/parse/tslint.json +++ b/types/parse/tslint.json @@ -21,6 +21,7 @@ "no-boolean-literal-compare": false, "no-conditional-assignment": false, "no-consecutive-blank-lines": false, + "no-const-enum": false, "no-construct": false, "no-declare-current-package": false, "no-duplicate-imports": false, diff --git a/types/parsimmon/tsconfig.json b/types/parsimmon/tsconfig.json index 676b349a37..7fec29b8cc 100644 --- a/types/parsimmon/tsconfig.json +++ b/types/parsimmon/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "parsimmon-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/passport-facebook-token/passport-facebook-token-tests.ts b/types/passport-facebook-token/passport-facebook-token-tests.ts index c926748286..1539118879 100644 --- a/types/passport-facebook-token/passport-facebook-token-tests.ts +++ b/types/passport-facebook-token/passport-facebook-token-tests.ts @@ -1,6 +1,6 @@ import * as express from 'express'; import * as passport from 'passport'; -import * as PassportFacebookToken from 'passport-facebook-token'; +import PassportFacebookToken = require('passport-facebook-token'); const User = { findOrCreate(id: string, provider: string, callback: (err: any, user: any) => void): void { diff --git a/types/passport-google-oauth/tsconfig.json b/types/passport-google-oauth/tsconfig.json index 7f3b315c07..adde576621 100644 --- a/types/passport-google-oauth/tsconfig.json +++ b/types/passport-google-oauth/tsconfig.json @@ -1,16 +1,23 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": [ + "es6" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": ["index.d.ts", "passport-google-oauth-tests.ts"] -} + "files": [ + "index.d.ts", + "passport-google-oauth-tests.ts" + ] +} \ No newline at end of file diff --git a/types/passport-http/index.d.ts b/types/passport-http/index.d.ts index e9a66964ea..fa3f968e7e 100644 --- a/types/passport-http/index.d.ts +++ b/types/passport-http/index.d.ts @@ -1,60 +1,70 @@ -// Type definitions for passport-http 0.3.0 +// Type definitions for passport-http 0.3 // Project: https://github.com/jaredhanson/passport-http // Definitions by: Christophe Vidal +// Tomek Łaziuk +// Chris Barth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import passport = require("passport"); import express = require("express"); -interface BasicStrategyOptions { +export interface BasicStrategyOptions { realm?: string; passReqToCallback?: boolean; } -interface DigestStrategyOptions { +export interface DigestStrategyOptions { realm?: string; - domain?: string | Array; + domain?: string | string[]; opaque?: string; algorithm?: string; - qop?: string | Array; + qop?: string | string[]; } -interface DigestValidateOptions { +export interface DigestValidateOptions { nonce: string; cnonce: string; nc: number; opaque: string; } -interface BasicVerifyFunction { - (username: string, password: string, done: (error: any, user?: any) => void): void; -} +export type BasicVerifyFunction = ( + username: string, + password: string, + done: (error: any, user?: any) => void, +) => any; -interface BasicVerifyFunctionWithRequest { - (req: express.Request, username: string, password: string, done: (error: any, user?: any) => void): void; -} +export type BasicVerifyFunctionWithRequest = ( + req: express.Request, + username: string, + password: string, + done: (error: any, user?: any) => void, +) => any; -interface DigestSecretFunction { - (username: string, done: (error: any, user?: any, password?: any) => void): void; -} +export type DigestSecretFunction = ( + username: string, + done: (error: any, user?: any, password?: any) => void, +) => any; -interface DigestValidateFunction { - (params: DigestValidateOptions, done: (error: any, valid: boolean) => void): void; -} +export type DigestValidateFunction = ( + params: DigestValidateOptions, + done: (error: any, valid: boolean) => void, +) => any; -declare class BasicStrategy implements passport.Strategy { +export class BasicStrategy implements passport.Strategy { constructor(verify: BasicVerifyFunction); - constructor(options: BasicStrategyOptions, verify: BasicVerifyFunction); + constructor(options: BasicStrategyOptions, verify: BasicVerifyFunction); + constructor(options: BasicStrategyOptions, verify: BasicVerifyFunctionWithRequest); name: string; - authenticate: (req: express.Request, options?: Object) => void; + authenticate: (req: express.Request, options?: object) => void; } -declare class DigestStrategy implements passport.Strategy { +export class DigestStrategy implements passport.Strategy { constructor(secret: DigestSecretFunction, validate?: DigestValidateFunction); constructor(options: DigestStrategyOptions, secret: DigestSecretFunction, validate?: DigestValidateFunction); name: string; - authenticate: (req: express.Request, options?: Object) => void; + authenticate: (req: express.Request, options?: object) => void; } diff --git a/types/passport-http/passport-http-tests.ts b/types/passport-http/passport-http-tests.ts index 4a70d30b89..ee728b2d47 100644 --- a/types/passport-http/passport-http-tests.ts +++ b/types/passport-http/passport-http-tests.ts @@ -4,16 +4,17 @@ import passport = require("passport"); import http = require("passport-http"); +import express = require("express"); -interface IUser { +interface UserInterface { username: string; password?: string; } class User { - public password: string; + password: string; - static findOne(user: IUser, callback: (error: Error, user: User) => void): void { + static findOne(user: UserInterface, callback: (error: Error, user: User) => void): void { callback(null, new User()); } } @@ -24,17 +25,19 @@ function validateNonce(nonce: string) { function validateParams(nonce: string, cnonce: string, nc: number, opaque: string) { } -passport.use(new http.BasicStrategy((username: string, password: string, done: any) => { +passport.use(new http.BasicStrategy((username, password, done) => { User.findOne({ - username: username, - password: password, + username, + password, }, (error, user) => { if (error) { - return done(error); + done(error); + return; } if (!user) { - return done(null, false); + done(null, false); + return; } done(null, user); @@ -44,25 +47,25 @@ passport.use(new http.BasicStrategy((username: string, password: string, done: a passport.use(new http.BasicStrategy({ realm: "User", passReqToCallback: true, -}, (username: string, password: string, done: any) => { - User.findOne({ - username: username, - password: password, - }, (error, user) => { - if (error) { - return done(error); - } +}, (req: express.Request, username: string, password: string, done: (error: any, user?: any) => void) => { + // with req when needed +})); - if (!user) { - return done(null, false); - } +passport.use(new http.BasicStrategy({ + realm: "User", +}, (username, password, done) => { + // without req by default +})); - done(null, user); - }); +passport.use(new http.BasicStrategy({ + realm: "User", + passReqToCallback: false, +}, (username, password, done) => { + // without req })); passport.use(new http.DigestStrategy((username: string, done: any) => { - User.findOne({username: username}, (error, user) => { + User.findOne({ username }, (error, user) => { if (error) { return done(error); } @@ -76,7 +79,7 @@ passport.use(new http.DigestStrategy((username: string, done: any) => { })); passport.use(new http.DigestStrategy((username: string, done: any) => { - User.findOne({username: username}, (error, user) => { + User.findOne({ username }, (error, user) => { if (error) { return done(error); } @@ -99,7 +102,7 @@ passport.use(new http.DigestStrategy({ algorithm: "MD5", qop: "auth", }, (username: string, done: any) => { - User.findOne({username: username}, (error, user) => { + User.findOne({ username }, (error, user) => { if (error) { return done(error); } @@ -119,7 +122,7 @@ passport.use(new http.DigestStrategy({ algorithm: "MD5", qop: "auth", }, (username: string, done: any) => { - User.findOne({username: username}, (error, user) => { + User.findOne({ username }, (error, user) => { if (error) { return done(error); } diff --git a/types/passport-http/tslint.json b/types/passport-http/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/passport-http/tslint.json +++ b/types/passport-http/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/passport-jwt/index.d.ts b/types/passport-jwt/index.d.ts index c300276fe2..0a71c4b725 100644 --- a/types/passport-jwt/index.d.ts +++ b/types/passport-jwt/index.d.ts @@ -4,11 +4,13 @@ // Alex Young // David Ng // Carlos Eduardo Scheffer +// Byungjin Kim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import { Strategy as PassportStrategy } from 'passport-strategy'; import {Request} from 'express'; +import { VerifyOptions } from 'jsonwebtoken' export declare class Strategy extends PassportStrategy { constructor(opt: StrategyOptions, verify: VerifyCallback); @@ -24,6 +26,7 @@ export interface StrategyOptions { algorithms?: string[]; ignoreExpiration?: boolean; passReqToCallback?: boolean; + jsonWebTokenOptions?: VerifyOptions; } export interface VerifyCallback { diff --git a/types/passport-kakao/tsconfig.json b/types/passport-kakao/tsconfig.json index 784cbe32e8..6240d3f149 100644 --- a/types/passport-kakao/tsconfig.json +++ b/types/passport-kakao/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "passport-kakao-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/passport-local-mongoose/passport-local-mongoose-tests.ts b/types/passport-local-mongoose/passport-local-mongoose-tests.ts index 63c82a9913..5058cb88ef 100644 --- a/types/passport-local-mongoose/passport-local-mongoose-tests.ts +++ b/types/passport-local-mongoose/passport-local-mongoose-tests.ts @@ -1,5 +1,3 @@ -/// - /** * Created by Linus Brolin . */ @@ -14,7 +12,7 @@ import { PassportLocalOptions, PassportLocalErrorMessages } from 'mongoose'; -import * as passportLocalMongoose from 'passport-local-mongoose'; +import passportLocalMongoose = require('passport-local-mongoose'); import { Router, Request, Response } from 'express'; import * as passport from 'passport'; diff --git a/types/passport-naver/tsconfig.json b/types/passport-naver/tsconfig.json index 1a8826dcfd..3412d6be4a 100644 --- a/types/passport-naver/tsconfig.json +++ b/types/passport-naver/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "passport-naver-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/passport/index.d.ts b/types/passport/index.d.ts index 0e612810d4..06c7f0b9db 100644 --- a/types/passport/index.d.ts +++ b/types/passport/index.d.ts @@ -4,6 +4,7 @@ // Eric Naeseth // Igor Belagorudsky // Tomek Łaziuk +// Daniel Perez Alvarez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -11,7 +12,7 @@ declare global { namespace Express { interface Request { authInfo?: any; - user?: any; + user?: User; // These declarations are merged into express's Request type login(user: any, done: (err: any) => void): void; @@ -25,6 +26,9 @@ declare global { isAuthenticated(): boolean; isUnauthenticated(): boolean; } + interface User { + [_: string]: any; + } } } diff --git a/types/passport/passport-tests.ts b/types/passport/passport-tests.ts index b6c033b907..630091afc7 100644 --- a/types/passport/passport-tests.ts +++ b/types/passport/passport-tests.ts @@ -1,5 +1,5 @@ import * as passport from 'passport'; -import * as express from 'express'; +import express = require('express'); import 'express-session'; class TestStrategy implements passport.Strategy { @@ -137,3 +137,23 @@ passportInstance.use(new TestStrategy()); const authenticator = new passport.Authenticator(); authenticator.use(new TestStrategy()); + +declare global { + namespace Express { + interface User { + username: string; + } + } +} + +app.use((req: express.Request, res: express.Response, next: (err?: any) => void) => { + if (req.user) { + if (req.user.username) { + req.user.username = "hello user"; + } + if (req.user.id) { + req.user.id = "123"; + } + } + next(); +}); diff --git a/types/password-hash-and-salt/password-hash-and-salt-tests.ts b/types/password-hash-and-salt/password-hash-and-salt-tests.ts index 4865cf0eed..f224074555 100644 --- a/types/password-hash-and-salt/password-hash-and-salt-tests.ts +++ b/types/password-hash-and-salt/password-hash-and-salt-tests.ts @@ -1,4 +1,4 @@ -import * as password from 'password-hash-and-salt'; +import password = require('password-hash-and-salt'); const myuser: { hash: string } = { hash: '' }; diff --git a/types/path-parse/path-parse-tests.ts b/types/path-parse/path-parse-tests.ts index da2b63f6b4..a632d768f1 100644 --- a/types/path-parse/path-parse-tests.ts +++ b/types/path-parse/path-parse-tests.ts @@ -1,4 +1,4 @@ -import * as parse from "path-parse"; +import parse = require("path-parse"); const parsed = parse("/foo/bar.img"); const { root, dir, base, ext, name } = parsed; diff --git a/types/pathwatcher/tsconfig.json b/types/pathwatcher/tsconfig.json index 41bb35a03c..f63edaf188 100644 --- a/types/pathwatcher/tsconfig.json +++ b/types/pathwatcher/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pathwatcher-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/pdfjs-dist/index.d.ts b/types/pdfjs-dist/index.d.ts index f72d70f44e..81de4624f9 100644 --- a/types/pdfjs-dist/index.d.ts +++ b/types/pdfjs-dist/index.d.ts @@ -26,466 +26,462 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -declare module "pdfjs-dist" { - export = PDF; + +interface PDFPromise { + isResolved(): boolean; + isRejected(): boolean; + resolve(value: T): void; + reject(reason: string): void; + then(onResolve: (promise: T) => U, onReject?: (reason: string) => void): PDFPromise; } -declare namespace PDF { - interface PDFPromise { - isResolved(): boolean; - isRejected(): boolean; - resolve(value: T): void; - reject(reason: string): void; - then(onResolve: (promise: T) => U, onReject?: (reason: string) => void): PDFPromise; - } - - interface PDFTreeNode { - title: string; - bold: boolean; - italic: boolean; - color: number[]; // [r,g,b] - dest: any; - items: PDFTreeNode[]; - } - - interface PDFInfo { - PDFFormatVersion: string; - IsAcroFormPresent: boolean; - IsXFAPresent: boolean; - [key: string]: any; // return type is string, typescript chokes - } - - interface PDFMetadata { - parse(): void; - get(name: string): string; - has(name: string): boolean; - } - - interface PDFSource { - url?: string; - data?: Uint8Array; - httpHeaders?: any; - password?: string; - } - - interface PDFProgressData { - loaded: number; - total: number; - } - - interface PDFDocumentProxy { - - /** - * Total number of pages the PDF contains. - **/ - numPages: number; - - /** - * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what] - **/ - fingerprint: string; - - /** - * True if embedded document fonts are in use. Will be set during rendering of the pages. - **/ - embeddedFontsUsed(): boolean; - - /** - * @param number The page number to get. The first page is 1. - * @return A promise that is resolved with a PDFPageProxy. - **/ - getPage(number: number): PDFPromise; - - /** - * TODO: return type of Promise - * A promise that is resolved with a lookup table for mapping named destinations to reference numbers. - **/ - getDestinations(): PDFPromise; - - /** - * A promise that is resolved with an array of all the JavaScript strings in the name tree. - **/ - getJavaScript(): PDFPromise; - - /** - * A promise that is resolved with an array that is a tree outline (if it has one) of the PDF. @see PDFTreeNode - **/ - getOutline(): PDFPromise; - - /** - * A promise that is resolved with the info and metadata of the PDF. - **/ - getMetadata(): PDFPromise<{ info: PDFInfo; metadata: PDFMetadata }>; - - /** - * Is the PDF encrypted? - **/ - isEncrypted(): PDFPromise; - - /** - * A promise that is resolved with Uint8Array that has the raw PDF data. - **/ - getData(): PDFPromise; - - /** - * TODO: return type of Promise - * A promise that is resolved when the document's data is loaded. - **/ - dataLoaded(): PDFPromise; - - /** - * - **/ - destroy(): void; - } - - interface PDFRef { - num: number; - gen: any; // todo - } - - interface PDFPageViewportOptions { - viewBox: any; - scale: number; - rotation: number; - offsetX: number; - offsetY: number; - dontFlip: boolean; - } - - interface PDFPageViewport { - width: number; - height: number; - fontScale: number; - transforms: number[]; - - clone(options: PDFPageViewportOptions): PDFPageViewport; - convertToViewportPoint(x: number, y: number): number[]; // [x, y] - convertToViewportRectangle(rect: number[]): number[]; // [x1, y1, x2, y2] - convertToPdfPoint(x: number, y: number): number[]; // [x, y] - } - - interface PDFAnnotationData { - subtype: string; - rect: number[]; // [x1, y1, x2, y2] - annotationFlags: any; // todo - color: number[]; // [r,g,b] - borderWidth: number; - hasAppearance: boolean; - } - - interface PDFAnnotations { - getData(): PDFAnnotationData; - hasHtml(): boolean; // always false - getHtmlElement(commonOjbs: any): HTMLElement; // throw new NotImplementedException() - getEmptyContainer(tagName: string, rect: number[]): HTMLElement; // deprecated - isViewable(): boolean; - loadResources(keys: any): PDFPromise; - getOperatorList(evaluator: any): PDFPromise; - // ... todo - } - - interface PDFRenderTextLayer { - beginLayout(): void; - endLayout(): void; - appendText(): void; - } - - interface PDFRenderImageLayer { - beginLayout(): void; - endLayout(): void; - appendImage(): void; - } - - interface PDFRenderParams { - canvasContext: CanvasRenderingContext2D; - viewport?: PDFPageViewport; - textLayer?: PDFRenderTextLayer; - imageLayer?: PDFRenderImageLayer; - continueCallback?: (_continue: () => void) => void; - } - - interface PDFViewerParams { - container: HTMLElement; - viewer?: HTMLElement; - } - - /** - * RenderTask is basically a promise but adds a cancel function to termiate it. +interface PDFTreeNode { + title: string; + bold: boolean; + italic: boolean; + color: number[]; // [r,g,b] + dest: any; + items: PDFTreeNode[]; +} + +interface PDFInfo { + PDFFormatVersion: string; + IsAcroFormPresent: boolean; + IsXFAPresent: boolean; + [key: string]: any; // return type is string, typescript chokes +} + +interface PDFMetadata { + parse(): void; + get(name: string): string; + has(name: string): boolean; +} + +interface PDFSource { + url?: string; + data?: Uint8Array; + httpHeaders?: any; + password?: string; +} + +interface PDFProgressData { + loaded: number; + total: number; +} + +interface PDFDocumentProxy { + + /** + * Total number of pages the PDF contains. + **/ + numPages: number; + + /** + * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what] + **/ + fingerprint: string; + + /** + * True if embedded document fonts are in use. Will be set during rendering of the pages. + **/ + embeddedFontsUsed(): boolean; + + /** + * @param number The page number to get. The first page is 1. + * @return A promise that is resolved with a PDFPageProxy. + **/ + getPage(number: number): PDFPromise; + + /** + * TODO: return type of Promise + * A promise that is resolved with a lookup table for mapping named destinations to reference numbers. + **/ + getDestinations(): PDFPromise; + + /** + * A promise that is resolved with an array of all the JavaScript strings in the name tree. + **/ + getJavaScript(): PDFPromise; + + /** + * A promise that is resolved with an array that is a tree outline (if it has one) of the PDF. @see PDFTreeNode + **/ + getOutline(): PDFPromise; + + /** + * A promise that is resolved with the info and metadata of the PDF. + **/ + getMetadata(): PDFPromise<{ info: PDFInfo; metadata: PDFMetadata }>; + + /** + * Is the PDF encrypted? + **/ + isEncrypted(): PDFPromise; + + /** + * A promise that is resolved with Uint8Array that has the raw PDF data. + **/ + getData(): PDFPromise; + + /** + * TODO: return type of Promise + * A promise that is resolved when the document's data is loaded. + **/ + dataLoaded(): PDFPromise; + + /** + * + **/ + destroy(): void; +} + +interface PDFRef { + num: number; + gen: any; // todo +} + +interface PDFPageViewportOptions { + viewBox: any; + scale: number; + rotation: number; + offsetX: number; + offsetY: number; + dontFlip: boolean; +} + +interface PDFPageViewport { + width: number; + height: number; + fontScale: number; + transforms: number[]; + + clone(options: PDFPageViewportOptions): PDFPageViewport; + convertToViewportPoint(x: number, y: number): number[]; // [x, y] + convertToViewportRectangle(rect: number[]): number[]; // [x1, y1, x2, y2] + convertToPdfPoint(x: number, y: number): number[]; // [x, y] +} + +interface PDFAnnotationData { + subtype: string; + rect: number[]; // [x1, y1, x2, y2] + annotationFlags: any; // todo + color: number[]; // [r,g,b] + borderWidth: number; + hasAppearance: boolean; +} + +interface PDFAnnotations { + getData(): PDFAnnotationData; + hasHtml(): boolean; // always false + getHtmlElement(commonOjbs: any): HTMLElement; // throw new NotImplementedException() + getEmptyContainer(tagName: string, rect: number[]): HTMLElement; // deprecated + isViewable(): boolean; + loadResources(keys: any): PDFPromise; + getOperatorList(evaluator: any): PDFPromise; + // ... todo +} + +interface PDFRenderTextLayer { + beginLayout(): void; + endLayout(): void; + appendText(): void; +} + +interface PDFRenderImageLayer { + beginLayout(): void; + endLayout(): void; + appendImage(): void; +} + +interface PDFRenderParams { + canvasContext: CanvasRenderingContext2D; + viewport?: PDFPageViewport; + textLayer?: PDFRenderTextLayer; + imageLayer?: PDFRenderImageLayer; + continueCallback?: (_continue: () => void) => void; +} + +interface PDFViewerParams { + container: HTMLElement; + viewer?: HTMLElement; +} + +/** + * RenderTask is basically a promise but adds a cancel function to termiate it. + **/ +interface PDFRenderTask extends PDFPromise { + + /** + * Cancel the rendering task. If the task is currently rendering it will not be cancelled until graphics pauses with a timeout. The promise that this object extends will resolve when cancelled. + **/ + cancel(): void; +} + +interface PDFPageProxy { + + /** + * Page number of the page. First page is 1. + **/ + pageNumber: number; + + /** + * The number of degrees the page is rotated clockwise. + **/ + rotate: number; + + /** + * The reference that points to this page. + **/ + ref: PDFRef; + + /** + * @return An array of the visible portion of the PDF page in the user space units - [x1, y1, x2, y2]. + **/ + view: number[]; + + /** + * @param scale The desired scale of the viewport. + * @param rotate Degrees to rotate the viewport. If omitted this defaults to the page rotation. + * @return + **/ + getViewport(scale: number, rotate?: number): PDFPageViewport; + + /** + * A promise that is resolved with an array of the annotation objects. + **/ + getAnnotations(): PDFPromise; + + /** + * Begins the process of rendering a page to the desired context. + * @param params Rendering options. + * @return An extended promise that is resolved when the page finishes rendering. **/ - interface PDFRenderTask extends PDFPromise { - - /** - * Cancel the rendering task. If the task is currently rendering it will not be cancelled until graphics pauses with a timeout. The promise that this object extends will resolve when cancelled. - **/ - cancel(): void; - } - - interface PDFPageProxy { - - /** - * Page number of the page. First page is 1. - **/ - pageNumber: number; - - /** - * The number of degrees the page is rotated clockwise. - **/ - rotate: number; - - /** - * The reference that points to this page. - **/ - ref: PDFRef; - - /** - * @return An array of the visible portion of the PDF page in the user space units - [x1, y1, x2, y2]. - **/ - view: number[]; - - /** - * @param scale The desired scale of the viewport. - * @param rotate Degrees to rotate the viewport. If omitted this defaults to the page rotation. - * @return - **/ - getViewport(scale: number, rotate?: number): PDFPageViewport; - - /** - * A promise that is resolved with an array of the annotation objects. - **/ - getAnnotations(): PDFPromise; - - /** - * Begins the process of rendering a page to the desired context. - * @param params Rendering options. - * @return An extended promise that is resolved when the page finishes rendering. - **/ - render(params: PDFRenderParams): PDFRenderTask; - - /** - * A promise that is resolved with the string that is the text content frm the page. - **/ - getTextContent(): PDFPromise; - - /** - * marked as future feature - **/ - //getOperationList(): PDFPromise<>; - - /** - * Destroyes resources allocated by the page. - **/ - destroy(): void; - } - - interface TextContentItem { - str: string; - transform: number[]; // [0..5] 4=x, 5=y - width: number; - height: number; - dir: string; // Left-to-right (ltr), etc - fontName: string; // A lookup into the styles map of the owning TextContent - } - - interface TextContent { - items: TextContentItem[]; - styles: any; - } - - /** - * A PDF document and page is built of many objects. E.g. there are objects for fonts, images, rendering code and such. These objects might get processed inside of a worker. The `PDFObjects` implements some basic functions to manage these objects. + render(params: PDFRenderParams): PDFRenderTask; + + /** + * A promise that is resolved with the string that is the text content frm the page. + **/ + getTextContent(): PDFPromise; + + /** + * marked as future feature + **/ + //getOperationList(): PDFPromise<>; + + /** + * Destroyes resources allocated by the page. + **/ + destroy(): void; +} + +interface TextContentItem { + str: string; + transform: number[]; // [0..5] 4=x, 5=y + width: number; + height: number; + dir: string; // Left-to-right (ltr), etc + fontName: string; // A lookup into the styles map of the owning TextContent +} + +interface TextContent { + items: TextContentItem[]; + styles: any; +} + +/** + * A PDF document and page is built of many objects. E.g. there are objects for fonts, images, rendering code and such. These objects might get processed inside of a worker. The `PDFObjects` implements some basic functions to manage these objects. + **/ +interface PDFObjects { + get(objId: number, callback?: any): any; + resolve(objId: number, data: any): any; + isResolved(objId: number): boolean; + hasData(objId: number): boolean; + getData(objId: number): any; + clear(): void; +} + +interface PDFJSUtilStatic { + /** + * Normalize rectangle so that (x1,y1) < (x2,y2) + * @param {number[]} rect - the rectangle with [x1,y1,x2,y2] + * + * For coordinate systems whose origin lies in the bottom-left, this + * means normalization to (BL,TR) ordering. For systems with origin in the + * top-left, this means (TL,BR) ordering. + **/ + normalizeRect(rect:number[]): number[]; +} + +export const PDFJS: PDFJSStatic; + +interface PDFJSStatic { + /** + * The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit. + **/ + maxImageSize: number; + + /** + * The url of where the predefined Adobe CMaps are located. Include trailing + * slash. + */ + cMapUrl: string; + + /** + * Specifies if CMaps are binary packed. + */ + cMapPacked: boolean; + + /** + * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. + **/ + disableFontFace: boolean; + + /** + * Path for image resources, mainly for annotation icons. Include trailing + * slash. + */ + imageResourcesPath: string; + + /** + * Disable the web worker and run all code on the main thread. This will happen + * automatically if the browser doesn't support workers or sending typed arrays + * to workers. + */ + disableWorker: boolean; + + /** + * Path and filename of the worker file. Required when the worker is enabled in + * development mode. If unspecified in the production build, the worker will be + * loaded based on the location of the pdf.js file. + */ + workerSrc: string; + + /** + * Disable range request loading of PDF files. When enabled and if the server + * supports partial content requests then the PDF will be fetched in chunks. + * Enabled (false) by default. + */ + disableRange: boolean; + + /** + * Disable streaming of PDF file data. By default PDF.js attempts to load PDF + * in chunks. This default behavior can be disabled. + */ + disableStream: boolean; + + /** + * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js + * will automatically keep fetching more data even if it isn't needed to display + * the current page. This default behavior can be disabled. + * + * NOTE: It is also necessary to disable streaming, see above, + * in order for disabling of pre-fetching to work correctly. + */ + disableAutoFetch: boolean; + + /** + * Enables special hooks for debugging PDF.js. + */ + pdfBug: boolean; + + /** + * Enables transfer usage in postMessage for ArrayBuffers. + */ + postMessageTransfers: boolean; + + /** + * Disables URL.createObjectURL usage. + */ + disableCreateObjectURL: boolean; + + /** + * Disables WebGL usage. + */ + disableWebGL: boolean; + + /** + * Disables fullscreen support, and by extension Presentation Mode, + * in browsers which support the fullscreen API. + */ + disableFullscreen: boolean; + + /** + * Disable the text layer of PDF when used PDF.js renders a canvas instead of div elements + * + */ + disableTextLayer: boolean; + + /** + * Enables CSS only zooming. + */ + useOnlyCssZoom: boolean; + + /** + * Controls the logging level. + * The constants from PDFJS.VERBOSITY_LEVELS should be used: + * - errors + * - warnings [default] + * - infos + */ + verbosity: number; + + /** + * The maximum supported canvas size in total pixels e.g. width * height. + * The default value is 4096 * 4096. Use -1 for no limit. + */ + maxCanvasPixels: number; + + /** + * Opens external links in a new window if enabled. The default behavior opens + * external links in the PDF.js window. + */ + openExternalLinksInNewWindow: boolean; + + /** + * Determines if we can eval strings as JS. Primarily used to improve + * performance for font rendering. + */ + isEvalSupported: boolean; + + Util: PDFJSUtilStatic; + + /** + * This is the main entry point for loading a PDF and interacting with it. + * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) + * is used, which means it must follow the same origin rules that any XHR does + * e.g. No corss domain requests without CORS. + * @param source + * @param pdfDataRangeTransport Used if you want to manually server range requests for data in the PDF. @ee viewer.js for an example of pdfDataRangeTransport's interface. + * @param passwordCallback Used to request a password if wrong or no password was provided. The callback receives two parameters: function that needs to be called with new password and the reason. + * @param progressCallback Progress callback. + * @return A promise that is resolved with PDFDocumentProxy object. **/ - interface PDFObjects { - get(objId: number, callback?: any): any; - resolve(objId: number, data: any): any; - isResolved(objId: number): boolean; - hasData(objId: number): boolean; - getData(objId: number): any; - clear(): void; - } - - interface PDFJSUtilStatic { - /** - * Normalize rectangle so that (x1,y1) < (x2,y2) - * @param {number[]} rect - the rectangle with [x1,y1,x2,y2] - * - * For coordinate systems whose origin lies in the bottom-left, this - * means normalization to (BL,TR) ordering. For systems with origin in the - * top-left, this means (TL,BR) ordering. - **/ - normalizeRect(rect:number[]): number[]; - } - - interface PDFJSStatic { - - /** - * The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit. - **/ - maxImageSize: number; - - /** - * The url of where the predefined Adobe CMaps are located. Include trailing - * slash. - */ - cMapUrl: string; - - /** - * Specifies if CMaps are binary packed. - */ - cMapPacked: boolean; - - /** - * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. - **/ - disableFontFace: boolean; - - /** - * Path for image resources, mainly for annotation icons. Include trailing - * slash. - */ - imageResourcesPath: string; - - /** - * Disable the web worker and run all code on the main thread. This will happen - * automatically if the browser doesn't support workers or sending typed arrays - * to workers. - */ - disableWorker: boolean; - - /** - * Path and filename of the worker file. Required when the worker is enabled in - * development mode. If unspecified in the production build, the worker will be - * loaded based on the location of the pdf.js file. - */ - workerSrc: string; - - /** - * Disable range request loading of PDF files. When enabled and if the server - * supports partial content requests then the PDF will be fetched in chunks. - * Enabled (false) by default. - */ - disableRange: boolean; - - /** - * Disable streaming of PDF file data. By default PDF.js attempts to load PDF - * in chunks. This default behavior can be disabled. - */ - disableStream: boolean; - - /** - * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js - * will automatically keep fetching more data even if it isn't needed to display - * the current page. This default behavior can be disabled. - * - * NOTE: It is also necessary to disable streaming, see above, - * in order for disabling of pre-fetching to work correctly. - */ - disableAutoFetch: boolean; - - /** - * Enables special hooks for debugging PDF.js. - */ - pdfBug: boolean; - - /** - * Enables transfer usage in postMessage for ArrayBuffers. - */ - postMessageTransfers: boolean; - - /** - * Disables URL.createObjectURL usage. - */ - disableCreateObjectURL: boolean; - - /** - * Disables WebGL usage. - */ - disableWebGL: boolean; - - /** - * Disables fullscreen support, and by extension Presentation Mode, - * in browsers which support the fullscreen API. - */ - disableFullscreen: boolean; - - /** - * Disable the text layer of PDF when used PDF.js renders a canvas instead of div elements - * - */ - disableTextLayer: boolean; - - /** - * Enables CSS only zooming. - */ - useOnlyCssZoom: boolean; - - /** - * Controls the logging level. - * The constants from PDFJS.VERBOSITY_LEVELS should be used: - * - errors - * - warnings [default] - * - infos - */ - verbosity: number; - - /** - * The maximum supported canvas size in total pixels e.g. width * height. - * The default value is 4096 * 4096. Use -1 for no limit. - */ - maxCanvasPixels: number; - - /** - * Opens external links in a new window if enabled. The default behavior opens - * external links in the PDF.js window. - */ - openExternalLinksInNewWindow: boolean; - - /** - * Determines if we can eval strings as JS. Primarily used to improve - * performance for font rendering. - */ - isEvalSupported: boolean; - - Util: PDFJSUtilStatic; - - /** - * This is the main entry point for loading a PDF and interacting with it. - * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) - * is used, which means it must follow the same origin rules that any XHR does - * e.g. No corss domain requests without CORS. - * @param source - * @param pdfDataRangeTransport Used if you want to manually server range requests for data in the PDF. @ee viewer.js for an example of pdfDataRangeTransport's interface. - * @param passwordCallback Used to request a password if wrong or no password was provided. The callback receives two parameters: function that needs to be called with new password and the reason. - * @param progressCallback Progress callback. - * @return A promise that is resolved with PDFDocumentProxy object. - **/ - getDocument( - source: string, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - getDocument( - source: Uint8Array, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - getDocument( - source: PDFSource, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - PDFViewer(params: PDFViewerParams): void; - /** - * yet another viewer, this will render only one page at the time, reducing rendering time - * very important for mobile development - * @params {PDFViewerParams} - */ - PDFSinglePageViewer(params: PDFViewerParams): void; - } + getDocument( + source: string, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void) + : PDFPromise; + + getDocument( + source: Uint8Array, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void) + : PDFPromise; + + getDocument( + source: PDFSource, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void) + : PDFPromise; + + PDFViewer(params: PDFViewerParams): void; + /** + * yet another viewer, this will render only one page at the time, reducing rendering time + * very important for mobile development + * @params {PDFViewerParams} + */ + PDFSinglePageViewer(params: PDFViewerParams): void; } diff --git a/types/pdfjs-dist/pdfjs-dist-tests.ts b/types/pdfjs-dist/pdfjs-dist-tests.ts index cd2325975a..ef569b2fda 100644 --- a/types/pdfjs-dist/pdfjs-dist-tests.ts +++ b/types/pdfjs-dist/pdfjs-dist-tests.ts @@ -1,11 +1,10 @@ -import { PDFJSStatic, PDFDocumentProxy, PDFPromise } from 'pdfjs-dist'; +import { PDFJS, PDFDocumentProxy, PDFPromise } from 'pdfjs-dist'; // // Fetch the PDF document from the URL using promises // var pdfDoc: PDFDocumentProxy; var pageNum: number; -var PDFJS: PDFJSStatic; PDFJS.getDocument('helloworld.pdf').then(function (pdf) { // Using promise to fetch the page @@ -26,7 +25,7 @@ function renderPage(pageNum: number) { var context = canvas.getContext('2d'); canvas.height = viewport.height; canvas.width = viewport.width; - + // // test viewport conversion methods // convertToViewportRectangle and normalizeRect are used in the acroforms example: diff --git a/types/peer-dial/peer-dial-tests.ts b/types/peer-dial/peer-dial-tests.ts index cb4238da62..6cc4376458 100644 --- a/types/peer-dial/peer-dial-tests.ts +++ b/types/peer-dial/peer-dial-tests.ts @@ -1,5 +1,5 @@ import { Server, Client, App, AppInfo, CorsOptions, ServerOptions, Delegate, DialDevice, DeviceInfo } from 'peer-dial'; -import * as express from 'express'; +import express = require('express'); class AppImpl implements App { name: string; diff --git a/types/pg-escape/pg-escape-tests.ts b/types/pg-escape/pg-escape-tests.ts index 36636cf0c2..87d70dbd9f 100644 --- a/types/pg-escape/pg-escape-tests.ts +++ b/types/pg-escape/pg-escape-tests.ts @@ -1,4 +1,4 @@ -import * as escape from 'pg-escape'; +import escape = require('pg-escape'); escape('INSERT INTO %I VALUES(%L)', 'books', "O'Reilly"); escape.string("ab'cd"); diff --git a/types/pg-query-stream/pg-query-stream-tests.ts b/types/pg-query-stream/pg-query-stream-tests.ts index 1df78ea648..49a2f41b0b 100644 --- a/types/pg-query-stream/pg-query-stream-tests.ts +++ b/types/pg-query-stream/pg-query-stream-tests.ts @@ -1,4 +1,4 @@ -import * as QueryStream from 'pg-query-stream'; +import QueryStream = require('pg-query-stream'); import * as pg from 'pg'; const options: QueryStream.Options = { @@ -12,7 +12,7 @@ const pool = new pg.Pool(); pool.connect((err, client, done) => { const stream = client.query(query); stream.on('end', () => { - client.end(); + client.release(); }); stream.on('data', (data: any) => { console.log(data); diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 9f945082cd..a0efbb1555 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -33,30 +33,51 @@ export interface ClientConfig extends ConnectionConfig { } export interface PoolConfig extends ClientConfig { - // properties from module 'node-pool' - max?: number; - min?: number; - connectionTimeoutMillis?: number; - idleTimeoutMillis?: number; + // properties from module 'node-pool' + max?: number; + min?: number; + connectionTimeoutMillis?: number; + idleTimeoutMillis?: number; - application_name?: string; - Promise?: PromiseConstructorLike; + application_name?: string; + Promise?: PromiseConstructorLike; } export interface QueryConfig { name?: string; text: string; values?: any[]; - rowMode?: string; } -export interface QueryResult { +export interface QueryArrayConfig extends QueryConfig { + rowMode: 'array'; +} + +export interface FieldDef { + name: string; + tableID: number; + columnID: number; + dataTypeID: number; + dataTypeSize: number; + dataTypeModifier: number; + format: string; +} + +export interface QueryResultBase { command: string; rowCount: number; oid: number; + fields: FieldDef[]; +} + +export interface QueryResult extends QueryResultBase { rows: any[]; } +export interface QueryArrayResult extends QueryResultBase { + rows: any[][]; +} + export interface Notification { processId: number; channel: string; @@ -77,36 +98,35 @@ export class Pool extends events.EventEmitter { readonly idleCount: number; readonly waitingCount: number; - connect(): Promise; - connect(callback: (err: Error, client: Client, done: () => void) => void): void; + connect(): Promise; + connect(callback: (err: Error, client: PoolClient, done: () => void) => void): void; end(): Promise; end(callback: () => void): void; query(queryStream: QueryConfig & stream.Readable): stream.Readable; + query(queryConfig: QueryArrayConfig): Promise; query(queryConfig: QueryConfig): Promise; query(queryText: string, values?: any[]): Promise; + query(queryConfig: QueryArrayConfig, callback: (err: Error, result: QueryArrayResult) => void): Query; query(queryTextOrConfig: string | QueryConfig, callback: (err: Error, result: QueryResult) => void): Query; query(queryText: string, values: any[], callback: (err: Error, result: QueryResult) => void): Query; - on(event: "error", listener: (err: Error, client: Client) => void): this; - on(event: "connect" | "acquire", listener: (client: Client) => void): this; + on(event: "error", listener: (err: Error, client: PoolClient) => void): this; + on(event: "connect" | "acquire" | "remove", listener: (client: PoolClient) => void): this; } -export class Client extends events.EventEmitter { +export class ClientBase extends events.EventEmitter { constructor(config: string | ClientConfig); connect(): Promise; connect(callback: (err: Error) => void): void; - end(): Promise; - end(callback: (err: Error) => void): void; - - release(err?: Error): void; - query(queryStream: QueryConfig & stream.Readable): stream.Readable; + query(queryConfig: QueryArrayConfig): Promise; query(queryConfig: QueryConfig): Promise; query(queryText: string, values?: any[]): Promise; + query(queryConfig: QueryArrayConfig, callback: (err: Error, result: QueryArrayResult) => void): Query; query(queryTextOrConfig: string | QueryConfig, callback: (err: Error, result: QueryResult) => void): Query; query(queryText: string, values: any[], callback: (err: Error, result: QueryResult) => void): Query; @@ -126,6 +146,17 @@ export class Client extends events.EventEmitter { on(event: "end", listener: () => void): this; } +export class Client extends ClientBase { + constructor(config: string | ClientConfig); + + end(): Promise; + end(callback: (err: Error) => void): void; +} + +export interface PoolClient extends ClientBase { + release(err?: Error): void; +} + export class Query extends events.EventEmitter { on(event: "row", listener: (row: any, result?: ResultBuilder) => void): this; on(event: "error", listener: (err: Error) => void): this; diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index 1f1e312544..f0defa0fb2 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -1,10 +1,10 @@ -import * as pg from "pg"; +import { types, Client, QueryArrayConfig, Pool } from "pg"; // https://github.com/brianc/node-pg-types // tslint:disable-next-line no-unnecessary-callback-wrapper -pg.types.setTypeParser(20, val => Number(val)); +types.setTypeParser(20, val => Number(val)); -const client = new pg.Client({ +const client = new Client({ host: 'my.database-server.com', port: 5334, user: 'database-user', @@ -48,24 +48,52 @@ client.query('SELECT $1::text as name', ['brianc'], (err, res) => { const query = { name: 'get-name', text: 'SELECT $1::text', - values: ['brianc'], - rowMode: 'array' + values: ['brianc'] }; client.query(query, (err, res) => { if (err) { console.error(err.stack); } else { console.log(res.rows); + console.log(res.fields.map(f => f.name)); } }); client.query(query) .then(res => { console.log(res.rows); + console.log(res.fields.map(f => f.name)); }) .catch(e => { console.error(e.stack); }); +const queryArrMode: QueryArrayConfig = { + name: 'get-name-array', + text: 'SELECT $1::text', + values: ['brianc'], + rowMode: 'array' +}; +client.query(queryArrMode, (err, res) => { + if (err) { + console.error(err.stack); + } else { + console.log(res.rows); + console.log(res.fields.map(f => f.name)); + } +}); +client.query(queryArrMode) + .then(res => { + console.log(res.rows); + console.log(res.fields.map(f => f.name)); + }) + .catch(e => { + console.error(e.stack); + }); +client.query({ + text: 'select 1', + rowMode: 'array', +}).then(res => console.log(res.fields[0])); + client.end((err) => { console.log('client has disconnected'); if (err) { @@ -77,11 +105,11 @@ client.end() .then(() => console.log('client has disconnected')) .catch(err => console.error('error during disconnection', err.stack)); -const poolOne = new pg.Pool({ +const poolOne = new Pool({ connectionString: 'postgresql://dbuser:secretpassword@database.server.com:3211/mydb' }); -const pool = new pg.Pool({ +const pool = new Pool({ host: 'localhost', port: 5432, user: 'database-user', @@ -107,6 +135,12 @@ pool.connect((err, client, done) => { }); }); +pool.connect().then(client => { + client.query({ text: 'SELECT $1::int AS number', values: ['1'], rowMode: 'array' }).then(result => { + console.log(result.rowCount, result.rows[0][0], result.fields[0].name); + }).then(() => client.release(), e => client.release(e)); +}); + pool.on('error', (err, client) => { console.error('idle client error', err.message, err.stack); }); diff --git a/types/pg/v6/index.d.ts b/types/pg/v6/index.d.ts index 5624989ac7..150dad74fa 100644 --- a/types/pg/v6/index.d.ts +++ b/types/pg/v6/index.d.ts @@ -36,15 +36,15 @@ export interface ClientConfig extends ConnectionConfig { } export interface PoolConfig extends ClientConfig { - // properties from module 'node-pool' - max?: number; - min?: number; - refreshIdle?: boolean; - idleTimeoutMillis?: number; - reapIntervalMillis?: number; - returnToHead?: boolean; - application_name?: string; - Promise?: PromiseConstructorLike; + // properties from module 'node-pool' + max?: number; + min?: number; + refreshIdle?: boolean; + idleTimeoutMillis?: number; + reapIntervalMillis?: number; + returnToHead?: boolean; + application_name?: string; + Promise?: PromiseConstructorLike; } export interface QueryConfig { diff --git a/types/photoswipe/photoswipe-tests.ts b/types/photoswipe/photoswipe-tests.ts index 05cdb5db53..48add333c5 100644 --- a/types/photoswipe/photoswipe-tests.ts +++ b/types/photoswipe/photoswipe-tests.ts @@ -1,5 +1,5 @@ -import * as PhotoSwipeUI_Default from './dist/photoswipe-ui-default/index'; -import * as PhotoSwipe from './index'; +import PhotoSwipeUI_Default = require('./dist/photoswipe-ui-default/index'); +import PhotoSwipe = require('./index'); function test_defaultUI() { var items: PhotoSwipeUI_Default.Item[] = [ diff --git a/types/pick-weight/pick-weight-tests.ts b/types/pick-weight/pick-weight-tests.ts index 5707b1c598..a7b35e7e37 100644 --- a/types/pick-weight/pick-weight-tests.ts +++ b/types/pick-weight/pick-weight-tests.ts @@ -1,4 +1,4 @@ -import * as weight from "pick-weight"; +import weight = require("pick-weight"); const x = weight(["a", "b", "c"], [1, 2, 3]); diff --git a/types/pify/pify-tests.ts b/types/pify/pify-tests.ts index f77eb9f10d..27022b7390 100644 --- a/types/pify/pify-tests.ts +++ b/types/pify/pify-tests.ts @@ -1,4 +1,4 @@ -import * as pify from 'pify'; +import pify = require('pify'); function assert(actual: string, expected: string): void { if (actual !== expected) { diff --git a/types/pikaday-time/pikaday-time-tests.ts b/types/pikaday-time/pikaday-time-tests.ts index fec72dc553..6ae7f82406 100644 --- a/types/pikaday-time/pikaday-time-tests.ts +++ b/types/pikaday-time/pikaday-time-tests.ts @@ -1,7 +1,7 @@ /// -import * as Pikaday from "pikaday-time"; -import * as moment from "moment"; +import Pikaday = require("pikaday-time"); +import moment = require("moment"); new Pikaday({field: document.getElementById('datepicker')}); new Pikaday({field: $('#datepicker')[0]}); diff --git a/types/pikaday/pikaday-tests.ts b/types/pikaday/pikaday-tests.ts index 9084455622..e61cb635e3 100644 --- a/types/pikaday/pikaday-tests.ts +++ b/types/pikaday/pikaday-tests.ts @@ -1,7 +1,7 @@ /// -import * as Pikaday from "pikaday"; -import * as moment from "moment"; +import Pikaday = require("pikaday"); +import moment = require("moment"); new Pikaday({field: document.getElementById('datepicker')}); new Pikaday({field: $('#datepicker')[0]}); diff --git a/types/pino-multi-stream/pino-multi-stream-tests.ts b/types/pino-multi-stream/pino-multi-stream-tests.ts index d9d0899256..dc48ed3bd4 100644 --- a/types/pino-multi-stream/pino-multi-stream-tests.ts +++ b/types/pino-multi-stream/pino-multi-stream-tests.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; -import * as pino from 'pino'; -import * as pinoms from 'pino-multi-stream'; +import pino = require('pino'); +import pinoms = require('pino-multi-stream'); const streams: pinoms.Streams = [ { stream: process.stdout }, // an "info" level destination stream diff --git a/types/pino-multi-stream/tsconfig.json b/types/pino-multi-stream/tsconfig.json index 7a060abb2e..df16842f19 100644 --- a/types/pino-multi-stream/tsconfig.json +++ b/types/pino-multi-stream/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pino-multi-stream-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/pino/index.d.ts b/types/pino/index.d.ts index d8f37c6414..02b66cc745 100644 --- a/types/pino/index.d.ts +++ b/types/pino/index.d.ts @@ -1,8 +1,8 @@ // Type definitions for pino 4.7 -// Project: https://github.com/mcollina/pino.git +// Project: https://github.com/pinojs/pino.git // Definitions by: Peter Snider // BendingBender -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// diff --git a/types/pixelmatch/tsconfig.json b/types/pixelmatch/tsconfig.json index 02115e3fdc..ef11da582a 100644 --- a/types/pixelmatch/tsconfig.json +++ b/types/pixelmatch/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pixelmatch-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/pixi.js/index.d.ts b/types/pixi.js/index.d.ts index b053b46790..f75bb4a1ca 100644 --- a/types/pixi.js/index.d.ts +++ b/types/pixi.js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Pixi.js 4.6 +// Type definitions for Pixi.js 4.7 // Project: https://github.com/pixijs/pixi.js/tree/dev // Definitions by: clark-stevenson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -63,6 +63,7 @@ declare namespace PIXI { let PRECISION: string; let UPLOADS_PER_FRAME: number; let CAN_UPLOAD_SAME_BUFFER: boolean; + let MESH_CANVAS_PADDING: number; } ////////////////////////////////////////////////////////////////////////////// @@ -208,6 +209,7 @@ declare namespace PIXI { renderer: PIXI.WebGLRenderer | PIXI.CanvasRenderer; stage: Container; ticker: ticker.Ticker; + loader: loaders.Loader; readonly screen: Rectangle; stop(): void; @@ -327,7 +329,7 @@ declare namespace PIXI { renderable: boolean; parent: Container; worldAlpha: number; - filterArea: Rectangle; + filterArea: Rectangle | null; protected _filters: Array> | null; protected _enabledFilters: Array> | null; protected _bounds: Bounds; @@ -335,7 +337,7 @@ declare namespace PIXI { protected _lastBoundsID: number; protected _boundsRect: Rectangle; protected _localBoundsRect: Rectangle; - protected _mask: PIXI.Graphics | PIXI.Sprite; + protected _mask: PIXI.Graphics | PIXI.Sprite | null; protected readonly _destroyed: boolean; x: number; y: number; @@ -347,7 +349,7 @@ declare namespace PIXI { skew: ObservablePoint; rotation: number; worldVisible: boolean; - mask: PIXI.Graphics | PIXI.Sprite; + mask: PIXI.Graphics | PIXI.Sprite | null; filters: Array> | null; updateTransform(): void; @@ -497,6 +499,7 @@ declare namespace PIXI { drawCircle(x: number, y: number, radius: number): Graphics; drawEllipse(x: number, y: number, width: number, height: number): Graphics; drawPolygon(path: number[] | Point[] | Polygon): Graphics; + drawStar(x: number, y: number, points: number, radius: number, innerRadius: number, rotation?: number): Graphics; clear(): Graphics; isFastRect(): boolean; protected _renderCanvas(renderer: CanvasRenderer): void; @@ -506,8 +509,8 @@ declare namespace PIXI { updateLocalBounds(): void; drawShape(shape: Circle | Rectangle | Ellipse | Polygon | RoundedRectangle | any): GraphicsData; generateCanvasTexture(scaleMode?: number, resolution?: number): Texture; - protected closePath(): Graphics; - protected addHole(): Graphics; + closePath(): Graphics; + addHole(): Graphics; destroy(options?: DestroyOptions | boolean): void; } class CanvasGraphicsRenderer { @@ -1737,7 +1740,9 @@ declare namespace PIXI { // shader - class Shader extends glCore.GLShader { } + class Shader extends glCore.GLShader { + constructor(gl: WebGLRenderingContext, vertexSrc: string | string[], fragmentSrc: string | string[], attributeLocations?: { [key: string]: number }, precision?: string); + } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////EXTRACT/////////////////////////////////////////// @@ -2163,7 +2168,7 @@ declare namespace PIXI { // pixi loader extends // https://github.com/englercj/resource-loader/ - // 2.0.9 + // 2.1.1 class MiniSignalBinding { //tslint:disable-next-line:ban-types forbidden-types @@ -2251,6 +2256,8 @@ declare namespace PIXI { onStart: MiniSignal; onComplete: MiniSignal; + concurrency: number; + add(...params: any[]): this; //tslint:disable-next-line:ban-types forbidden-types add(name: string, url: string, options?: LoaderOptions, cb?: Function): this; @@ -2268,6 +2275,7 @@ declare namespace PIXI { protected _prepareUrl(url: string): string; //tslint:disable-next-line:ban-types forbidden-types protected _loadResource(resource: Resource, dequeue: Function): void; + protected _onStart(): void; protected _onComplete(): void; protected _onLoad(resource: Resource): void; @@ -2523,7 +2531,11 @@ declare namespace PIXI { ////////////////////////////////////////////////////////////////////////////// namespace particles { interface ParticleContainerProperties { + /** + * DEPRECIATED - Use `vertices` + */ scale?: boolean; + vertices?: boolean; position?: boolean; rotation?: boolean; uvs?: boolean; @@ -2531,7 +2543,7 @@ declare namespace PIXI { alpha?: boolean; } class ParticleContainer extends Container { - constructor(maxSize?: number, properties?: ParticleContainerProperties, batchSize?: number, autoSize?: boolean); + constructor(maxSize?: number, properties?: ParticleContainerProperties, batchSize?: number, autoResize?: boolean); protected _tint: number; protected tintRgb: number | any[]; tint: number; diff --git a/types/pkg-dir/tsconfig.json b/types/pkg-dir/tsconfig.json index 2701860736..a5647ed0eb 100644 --- a/types/pkg-dir/tsconfig.json +++ b/types/pkg-dir/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pkg-dir-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/playcanvas/engine/asset/asset-registry.d.ts b/types/playcanvas/engine/asset/asset-registry.d.ts index 7e03744ef2..f4722ee490 100644 --- a/types/playcanvas/engine/asset/asset-registry.d.ts +++ b/types/playcanvas/engine/asset/asset-registry.d.ts @@ -11,6 +11,8 @@ declare namespace pc { class AssetRegistry { constructor(loader: pc.ResourceLoader) + prefix: string; + /** * @function * @name pc.AssetRegistry#list diff --git a/types/playcanvas/engine/asset/asset.d.ts b/types/playcanvas/engine/asset/asset.d.ts index 3a5e514a6c..bfc51ff99f 100644 --- a/types/playcanvas/engine/asset/asset.d.ts +++ b/types/playcanvas/engine/asset/asset.d.ts @@ -1,5 +1,19 @@ declare namespace pc { + const ASSET_ANIMATION = 'animation'; + const ASSET_AUDIO = 'audio'; + const ASSET_IMAGE = 'image'; + const ASSET_JSON = 'json'; + const ASSET_MODEL = 'model'; + const ASSET_MATERIAL = 'material'; + const ASSET_TEXT = 'text'; + const ASSET_TEXTURE = 'texture'; + const ASSET_CUBEMAP = 'cubemap'; + const ASSET_SHADER = 'shader'; + const ASSET_CSS = 'css'; + const ASSET_HTML = 'html'; + const ASSET_SCRIPT = 'script'; + /** * @name pc.Asset * @class An asset record of a file or data resource that can be loaded by the engine. @@ -77,7 +91,7 @@ declare namespace pc { * }); * app.assets.load(asset); */ - ready(callback: (...args: any[]) => {}, scope: any): void; + ready(callback: (...args: any[]) => void, scope?: any): void; /** * @function @@ -106,7 +120,7 @@ declare namespace pc { * }); * obj.fire('test', 1, 2); // prints 3 to the console */ - on(name: string, callback: (...args: any[]) => void, scope: any): any; + on(name: string, callback: (...args: any[]) => void, scope?: any): any; /** * @function @@ -126,7 +140,7 @@ declare namespace pc { * obj.off('test', handler); // Removes all handler functions, called 'test' * obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this */ - off(name: string, callback: (...args: any[]) => void, scope: any): any; + off(name: string, callback: (...args: any[]) => void, scope?: any): any; /** * @function @@ -137,7 +151,7 @@ declare namespace pc { * @example * obj.fire('test', 'This is the message'); */ - fire(name: string, arg1: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; + fire(name: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; /** * @function @@ -153,7 +167,7 @@ declare namespace pc { * obj.fire('test', 1, 2); // prints 3 to the console * obj.fire('test', 1, 2); // not going to get handled */ - once(name: string, callback: (...args: any[]) => void, scope: any): any; + once(name: string, callback: (...args: any[]) => void, scope?: any): any; /** * @function diff --git a/types/playcanvas/engine/core/events.d.ts b/types/playcanvas/engine/core/events.d.ts index 21fc207840..7bf4f8b567 100644 --- a/types/playcanvas/engine/core/events.d.ts +++ b/types/playcanvas/engine/core/events.d.ts @@ -43,7 +43,7 @@ declare namespace pc { * }); * obj.fire('test', 1, 2); // prints 3 to the console */ - function on(name: string, callback: (...args: any[]) => void, scope: any): any; + function on(name: string, callback: (...args: any[]) => void, scope?: any): void; /** * @function @@ -63,7 +63,7 @@ declare namespace pc { * obj.off('test', handler); // Removes all handler functions, called 'test' * obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this */ - function off(name: string, callback: (...args: any[]) => void, scope: any): any; + function off(name: string, callback?: (...args: any[]) => void, scope?: any): void; /** * @function @@ -74,7 +74,7 @@ declare namespace pc { * @example * obj.fire('test', 'This is the message'); */ - function fire(name: string, arg1: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; + function fire(name: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): void; /** * @function @@ -90,7 +90,7 @@ declare namespace pc { * obj.fire('test', 1, 2); // prints 3 to the console * obj.fire('test', 1, 2); // not going to get handled */ - function once(name: string, callback: (...args: any[]) => void, scope: any): any; + function once(name: string, callback: (...args: any[]) => void, scope?: any): void; /** * @function diff --git a/types/playcanvas/engine/core/path.d.ts b/types/playcanvas/engine/core/path.d.ts index d6fa94abad..e94d8c7133 100644 --- a/types/playcanvas/engine/core/path.d.ts +++ b/types/playcanvas/engine/core/path.d.ts @@ -10,7 +10,7 @@ declare namespace pc { * The character that separates path segments * @name pc.path.delimiter */ - const delimiter = "/", + const delimiter = "/"; /** * Join two sections of file path together, insert a delimiter if needed. * @param {String} one First part of path to join diff --git a/types/playcanvas/engine/core/platform.d.ts b/types/playcanvas/engine/core/platform.d.ts index 15d1995415..f1522c2b90 100644 --- a/types/playcanvas/engine/core/platform.d.ts +++ b/types/playcanvas/engine/core/platform.d.ts @@ -1,5 +1,3 @@ -import { platform } from "os"; - declare namespace pc { /** diff --git a/types/playcanvas/engine/framework/application.d.ts b/types/playcanvas/engine/framework/application.d.ts index ae52a6cea3..6ef4d996d1 100644 --- a/types/playcanvas/engine/framework/application.d.ts +++ b/types/playcanvas/engine/framework/application.d.ts @@ -32,6 +32,8 @@ declare namespace pc { class Application { constructor(canvas: HTMLCanvasElement, options?: pc.ApplicationOptions) + static getApplication(id?: string): Application; + // PROPERTIES /** @@ -206,6 +208,25 @@ declare namespace pc { */ loadSceneSettings(url: string, callback: (...args: any[]) => {}): void; + /** + * @function + * @name pc.Application#loadScene + * @description Load a scene file. + * @param {String} url The URL of the scene file. Usually this will be "scene_id.json" + * @param {Function} callback The function to call after loading, passed (err, entity) where err is null if no errors occurred. + * @example + * + * app.loadScene("1000.json", function (err, entity) { + * if (!err) { + * var e = app.root.find("My New Entity"); + * } else { + * // error + * } + * } + * }); + */ + loadScene(url: string, callback: (...args: any[]) => {}): void; + /** * @function * @name pc.Application#start @@ -478,7 +499,7 @@ declare namespace pc { * @example * obj.fire('test', 'This is the message'); */ - fire(name: string, arg1: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; + fire(name: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; /** * @function diff --git a/types/playcanvas/engine/framework/components/animation/component.d.ts b/types/playcanvas/engine/framework/components/animation/component.d.ts index 5060499b3d..ca0547b6fe 100644 --- a/types/playcanvas/engine/framework/components/animation/component.d.ts +++ b/types/playcanvas/engine/framework/components/animation/component.d.ts @@ -20,9 +20,14 @@ declare namespace pc { speed: number; loop: boolean; activate: boolean; - assets: pc.Asset[]; + assets: number[]; currentTime: number; duration: number; + playing: boolean; + currAnim: string; + + animations: any; + animationsIndex: any; /** * @function @@ -32,7 +37,7 @@ declare namespace pc { * @param {Number} [blendTime] The time in seconds to blend from the current * animation state to the start of the animation being set. */ - play(name: string, blendTime: number): void; + play(name: string, blendTime?: number): void; /** * @function diff --git a/types/playcanvas/engine/framework/components/component.d.ts b/types/playcanvas/engine/framework/components/component.d.ts index 5b47908106..113c5e6e80 100644 --- a/types/playcanvas/engine/framework/components/component.d.ts +++ b/types/playcanvas/engine/framework/components/component.d.ts @@ -41,7 +41,7 @@ declare namespace pc { * }); * obj.fire('test', 1, 2); // prints 3 to the console */ - on(name: string, callback: (...args: any[]) => void, scope: any): any; + on(name: string, callback: (...args: any[]) => void, scope?: any): void; /** * @function @@ -61,7 +61,7 @@ declare namespace pc { * obj.off('test', handler); // Removes all handler functions, called 'test' * obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this */ - off(name: string, callback: (...args: any[]) => void, scope: any): any; + off(name: string, callback?: (...args: any[]) => void, scope?: any): void; /** * @function @@ -72,7 +72,7 @@ declare namespace pc { * @example * obj.fire('test', 'This is the message'); */ - fire(name: string, arg1: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; + fire(name: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): void; /** * @function @@ -88,7 +88,7 @@ declare namespace pc { * obj.fire('test', 1, 2); // prints 3 to the console * obj.fire('test', 1, 2); // not going to get handled */ - once(name: string, callback: (...args: any[]) => void, scope: any): any; + once(name: string, callback: (...args: any[]) => void, scope?: any): void; /** * @function diff --git a/types/playcanvas/engine/framework/components/model/component.d.ts b/types/playcanvas/engine/framework/components/model/component.d.ts index b89d52721c..c6f5679dd3 100644 --- a/types/playcanvas/engine/framework/components/model/component.d.ts +++ b/types/playcanvas/engine/framework/components/model/component.d.ts @@ -34,7 +34,7 @@ declare namespace pc { constructor(system: pc.ModelComponentSystem, entity: pc.Entity) type: string; - asset: pc.Asset; + asset: pc.Asset | number; castShadows: boolean; receiveShadows: boolean; materialAsset: number; diff --git a/types/playcanvas/engine/framework/components/script/component.d.ts b/types/playcanvas/engine/framework/components/script/component.d.ts index dbaf70b569..1084b904ef 100644 --- a/types/playcanvas/engine/framework/components/script/component.d.ts +++ b/types/playcanvas/engine/framework/components/script/component.d.ts @@ -70,5 +70,7 @@ declare namespace pc { * entity.script.move('playerController', 0); */ move(name: string, ind: number): boolean; + + [prop: string]: any; } } diff --git a/types/playcanvas/engine/framework/components/sound/component.d.ts b/types/playcanvas/engine/framework/components/sound/component.d.ts index 0363d61a8f..d5be560773 100644 --- a/types/playcanvas/engine/framework/components/sound/component.d.ts +++ b/types/playcanvas/engine/framework/components/sound/component.d.ts @@ -87,7 +87,7 @@ declare namespace pc { * this.entity.sound.slot('beep').volume = 0.5; * */ - slot(name: string): pc.Slot; + slot(name: string): pc.SoundSlot; /** * @function diff --git a/types/playcanvas/engine/framework/entity.d.ts b/types/playcanvas/engine/framework/entity.d.ts index 0b1f12ae55..4fd31d0013 100644 --- a/types/playcanvas/engine/framework/entity.d.ts +++ b/types/playcanvas/engine/framework/entity.d.ts @@ -54,6 +54,8 @@ declare namespace pc { constructor(name?: string, app?: pc.Application) constructor(app?: pc.Application) + private _app: pc.Application; + /** * @function * @name pc.Entity#addComponent @@ -102,13 +104,12 @@ declare namespace pc { removeComponent(type: pc.ComponentTypes): void; /** - * @private * @function * @name pc.Entity#getGuid * @description Get the GUID value for this Entity * @returns {String} The GUID of the Entity */ - private getGuid(): string; + public getGuid(): string; /** * @private diff --git a/types/playcanvas/engine/graphics/device.d.ts b/types/playcanvas/engine/graphics/device.d.ts index 188de0b1a3..fc0be6df09 100644 --- a/types/playcanvas/engine/graphics/device.d.ts +++ b/types/playcanvas/engine/graphics/device.d.ts @@ -45,6 +45,10 @@ declare namespace pc { */ readonly maxVolumeSize: number; + readonly canvas: HTMLCanvasElement; + + maxPixelRatio: number; + /** * @function * @name pc.GraphicsDevice#setViewport @@ -68,13 +72,13 @@ declare namespace pc { setScissor(x: number, y: number, w: number, h: number): void; /** - * @private + * @public * @function * @name pc.GraphicsDevice#getProgramLibrary * @description Retrieves the program library assigned to the specified graphics device. * @returns {pc.ProgramLibrary} The program library assigned to the device. */ - private getProgramLibrary(): pc.ProgramLibrary; + getProgramLibrary(): pc.ProgramLibrary; /** * @private diff --git a/types/playcanvas/engine/graphics/texture.d.ts b/types/playcanvas/engine/graphics/texture.d.ts index ac637117bf..ed468ba5e6 100644 --- a/types/playcanvas/engine/graphics/texture.d.ts +++ b/types/playcanvas/engine/graphics/texture.d.ts @@ -85,7 +85,7 @@ declare namespace pc { * @author Will Eastcott */ class Texture { - constructor(graphicsDevice: pc.GraphicsDevice, options: { + constructor(graphicsDevice: pc.GraphicsDevice, options?: { width: number, height: number, depth: number, @@ -95,6 +95,7 @@ declare namespace pc { anisotropy: number, addressU: number, addressV: number, + addressW: number, mipmaps: boolean, cubemap: boolean, volume: boolean, diff --git a/types/playcanvas/engine/graphics/vertex-format.d.ts b/types/playcanvas/engine/graphics/vertex-format.d.ts index 13052e2a8a..f787f3a448 100644 --- a/types/playcanvas/engine/graphics/vertex-format.d.ts +++ b/types/playcanvas/engine/graphics/vertex-format.d.ts @@ -58,10 +58,10 @@ declare namespace pc { */ class VertexFormat { constructor(graphicsDevice: pc.GraphicsDevice, description: { - semantic: number, + semantic: string, components: number, type: number, - normalize: boolean + normalize?: boolean }[]) } } \ No newline at end of file diff --git a/types/playcanvas/engine/graphics/vertex-iterator.d.ts b/types/playcanvas/engine/graphics/vertex-iterator.d.ts index bc9b23d59b..8f56ff6b87 100644 --- a/types/playcanvas/engine/graphics/vertex-iterator.d.ts +++ b/types/playcanvas/engine/graphics/vertex-iterator.d.ts @@ -10,6 +10,8 @@ declare namespace pc { class VertexIterator { constructor(vertexBuffer: pc.VertexBuffer) + element: any; + /** * @function * @name pc.VertexIterator#next diff --git a/types/playcanvas/engine/input/input.d.ts b/types/playcanvas/engine/input/input.d.ts index d132539b36..97f51d4158 100644 --- a/types/playcanvas/engine/input/input.d.ts +++ b/types/playcanvas/engine/input/input.d.ts @@ -41,19 +41,19 @@ declare namespace pc { * @name pc.EVENT_TOUCHSTART * @description Name of event fired when a new touch occurs. For example, a finger is placed on the device. */ - const VENT_TOUCHSTART = 'touchstart'; + const EVENT_TOUCHSTART = 'touchstart'; /** * @enum pc.EVENT * @name pc.EVENT_TOUCHEND * @description Name of event fired when touch ends. For example, a finger is lifted off the device. */ - const VENT_TOUCHEND = 'touchend'; + const EVENT_TOUCHEND = 'touchend'; /** * @enum pc.EVENT * @name pc.EVENT_TOUCHMOVE * @description Name of event fired when a touch moves. */ - const VENT_TOUCHMOVE = 'touchmove'; + const EVENT_TOUCHMOVE = 'touchmove'; /** * @enum pc.EVENT * @name pc.EVENT_TOUCHCANCEL @@ -62,18 +62,18 @@ declare namespace pc { * For example, a modal alert pops up during the interaction; the touch point leaves the document area; * or there are more touch points than the device supports, in which case the earliest touch point is canceled. */ - const VENT_TOUCHCANCEL = 'touchcancel'; + const EVENT_TOUCHCANCEL = 'touchcancel'; /** * @enum pc.KEY * @name pc.KEY_BACKSPACE */ - const EY_BACKSPACE = 8; + const KEY_BACKSPACE = 8; /** * @enum pc.KEY * @name pc.KEY_TAB */ - const EY_TAB = 9; + const KEY_TAB = 9; /** * @enum pc.KEY * @name pc.KEY_RETURN diff --git a/types/playcanvas/engine/input/mouse.d.ts b/types/playcanvas/engine/input/mouse.d.ts index 524e2c40c6..a614d57d15 100644 --- a/types/playcanvas/engine/input/mouse.d.ts +++ b/types/playcanvas/engine/input/mouse.d.ts @@ -1,4 +1,4 @@ -type BrowserMouseEvent = typeof MouseEvent; +type BrowserMouseEvent = MouseEvent; declare namespace pc { /** @@ -45,16 +45,15 @@ declare namespace pc { * @param {Element} [element] The Element that the mouse events are attached to */ class Mouse { - constructor(element?: Element) - /** * @function * @name pc.Mouse.isPointerLocked * @description Check if the mouse pointer has been locked, using {@link pc.Mouse#enabledPointerLock} * @returns {Boolean} True if locked */ - isPointerLocked(): void; + static isPointerLocked(): void; + constructor(element?: Element) /** * @function diff --git a/types/playcanvas/engine/input/touch.d.ts b/types/playcanvas/engine/input/touch.d.ts index d94f8167b7..bc56e87894 100644 --- a/types/playcanvas/engine/input/touch.d.ts +++ b/types/playcanvas/engine/input/touch.d.ts @@ -1,5 +1,5 @@ -type BrowserTouchEvent = typeof TouchEvent; -type BrowserTouch = typeof Touch; +type BrowserTouchEvent = TouchEvent; +type BrowserTouch = Touch; declare namespace pc { @@ -18,6 +18,7 @@ declare namespace pc { constructor(device: pc.TouchDevice, event: BrowserTouchEvent) element: Element; + event: BrowserTouchEvent; touches: pc.Touch[]; changedTouches: pc.Touch[]; @@ -166,4 +167,4 @@ declare namespace pc { */ hasEvent(name: string): boolean; } -} \ No newline at end of file +} diff --git a/types/playcanvas/engine/math/mat3.d.ts b/types/playcanvas/engine/math/mat3.d.ts index d84f39d124..1ed5afed3e 100644 --- a/types/playcanvas/engine/math/mat3.d.ts +++ b/types/playcanvas/engine/math/mat3.d.ts @@ -15,6 +15,8 @@ declare namespace pc { * @param {Number} [v8] The value in row 2, column 2. */ class Mat3 { + data: Float32Array; + constructor(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number) constructor(v0: [number, number, number, number, number, number, number, number, number]) diff --git a/types/playcanvas/engine/math/mat4.d.ts b/types/playcanvas/engine/math/mat4.d.ts index 73306d52c7..d6fb0e75e9 100644 --- a/types/playcanvas/engine/math/mat4.d.ts +++ b/types/playcanvas/engine/math/mat4.d.ts @@ -22,6 +22,8 @@ declare namespace pc { * @param {Number} [v15] The value in row 3, column 3. */ class Mat4 { + data: Float32Array; + constructor( v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number diff --git a/types/playcanvas/engine/math/vec2.d.ts b/types/playcanvas/engine/math/vec2.d.ts index ec02347f46..2fc8bef234 100644 --- a/types/playcanvas/engine/math/vec2.d.ts +++ b/types/playcanvas/engine/math/vec2.d.ts @@ -8,7 +8,10 @@ declare namespace pc { * @param {Number} [y] The y value */ class Vec2 { - constructor(x: number, y: number) + data: Float32Array; + + constructor(x: number, y: number); + constructor(); /** * @function diff --git a/types/playcanvas/engine/math/vec3.d.ts b/types/playcanvas/engine/math/vec3.d.ts index cc298d6a4e..30ea7a5758 100644 --- a/types/playcanvas/engine/math/vec3.d.ts +++ b/types/playcanvas/engine/math/vec3.d.ts @@ -10,6 +10,7 @@ declare namespace pc { * var v = new pc.Vec3(1,2,3); */ class Vec3 { + data: Float32Array; constructor(x: number, y: number, z: number) constructor(x: [number, number, number]) diff --git a/types/playcanvas/engine/math/vec4.d.ts b/types/playcanvas/engine/math/vec4.d.ts index f562eeb6bc..919c65f56c 100644 --- a/types/playcanvas/engine/math/vec4.d.ts +++ b/types/playcanvas/engine/math/vec4.d.ts @@ -10,6 +10,8 @@ declare namespace pc { * @param {Number} [w] The w value */ class Vec4 { + data: Float32Array; + constructor(x: number, y: number, z: number, w: number) constructor(x: [number, number, number, number]) constructor(); diff --git a/types/playcanvas/engine/resources/animation.d.ts b/types/playcanvas/engine/resources/animation.d.ts new file mode 100644 index 0000000000..18a51950c4 --- /dev/null +++ b/types/playcanvas/engine/resources/animation.d.ts @@ -0,0 +1,7 @@ +declare namespace pc { + class AnimationHandler { + load(url: string, callback: Function): void; + open(url: string, data: any): any; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; + } +} diff --git a/types/playcanvas/engine/resources/cubemap.d.ts b/types/playcanvas/engine/resources/cubemap.d.ts new file mode 100644 index 0000000000..157f62c456 --- /dev/null +++ b/types/playcanvas/engine/resources/cubemap.d.ts @@ -0,0 +1,7 @@ +declare namespace pc { + class CubemapHandler { + load(url: string, callback: Function): void; + open(url: string, data: any): any; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; + } +} diff --git a/types/playcanvas/engine/resources/loader.d.ts b/types/playcanvas/engine/resources/loader.d.ts index 61e99b179a..632886242f 100644 --- a/types/playcanvas/engine/resources/loader.d.ts +++ b/types/playcanvas/engine/resources/loader.d.ts @@ -1,8 +1,9 @@ declare namespace pc { interface ResourceHandler { - load: (url: 'string', callback: (...args: any[]) => {}) => {}; - open: (url: 'string', date: any) => {}; + load(url: 'string', callback: (...args: any[]) => {}): void; + open(url: 'string', data: any): any; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; } /** @@ -25,6 +26,11 @@ declare namespace pc { */ addHandler(type: string, handler: pc.ResourceHandler): void; + getHandler(type: string): any; + + removeHandler(type: string): void; + + /** * @function * @name pc.ResourceLoader#load diff --git a/types/playcanvas/engine/resources/material.d.ts b/types/playcanvas/engine/resources/material.d.ts new file mode 100644 index 0000000000..7259655759 --- /dev/null +++ b/types/playcanvas/engine/resources/material.d.ts @@ -0,0 +1,10 @@ +declare namespace pc { + + function getMaterialParamType(name: string): string; + + class MaterialHandler { + load(url: string, callback: Function): void; + open(url: string, data: any): void; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; + } +} diff --git a/types/playcanvas/engine/resources/model.d.ts b/types/playcanvas/engine/resources/model.d.ts index a5d7dbd8e7..116c83c6ac 100644 --- a/types/playcanvas/engine/resources/model.d.ts +++ b/types/playcanvas/engine/resources/model.d.ts @@ -7,6 +7,9 @@ declare namespace pc { * @param {pc.GraphicsDevice} device The graphics device that will be rendering */ class ModelHandler { + + static DEFAULT_MATERIAL: pc.StandardMaterial; + constructor(device: pc.GraphicsDevice) /** diff --git a/types/playcanvas/engine/resources/script.d.ts b/types/playcanvas/engine/resources/script.d.ts index 3f7fd26292..2299dfc3e9 100644 --- a/types/playcanvas/engine/resources/script.d.ts +++ b/types/playcanvas/engine/resources/script.d.ts @@ -8,7 +8,11 @@ declare namespace pc { * @param {pc.Application} app The running {pc.Application} */ class ScriptHandler { - constructor(app: pc.Application) + static _push(Type: ScriptType): void; + constructor(app: pc.Application) + load(url: string, callback: Function): void; + open(url: string, data: any): any; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; } } diff --git a/types/playcanvas/engine/resources/texture.d.ts b/types/playcanvas/engine/resources/texture.d.ts new file mode 100644 index 0000000000..d5073290e6 --- /dev/null +++ b/types/playcanvas/engine/resources/texture.d.ts @@ -0,0 +1,9 @@ +declare namespace pc { + class TextureHandler { + crossOrigin: boolean | string; + + load(url: string, callback: Function): void; + open(url: string, data: any): any; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; + } +} diff --git a/types/playcanvas/engine/scene/basic-material.d.ts b/types/playcanvas/engine/scene/basic-material.d.ts index 6bca34dfd5..f6c4404b39 100644 --- a/types/playcanvas/engine/scene/basic-material.d.ts +++ b/types/playcanvas/engine/scene/basic-material.d.ts @@ -23,6 +23,9 @@ declare namespace pc { */ class BasicMaterial extends pc.Material { + color: pc.Color; + colorMap: pc.Texture; + /** * @function * @name pc.BasicMaterial#clone diff --git a/types/playcanvas/engine/scene/graph-node.d.ts b/types/playcanvas/engine/scene/graph-node.d.ts index f9d587f8af..b5baf6579b 100644 --- a/types/playcanvas/engine/scene/graph-node.d.ts +++ b/types/playcanvas/engine/scene/graph-node.d.ts @@ -8,6 +8,8 @@ declare namespace pc { */ class GraphNode { constructor(name?: string) + name: string; + tags: pc.Tags; /** * @readonly @@ -64,7 +66,7 @@ declare namespace pc { * @type pc.GraphNode[] * @description A read-only property to get the children of this graph node. */ - readonly children: pc.GraphNode; + readonly children: pc.GraphNode[]; /** * @function @@ -378,6 +380,7 @@ declare namespace pc { * this.entity.setLocalEulerAngles(0, 90, 0); // Set rotation of 90 degrees around y-axis. */ setLocalEulerAngles(x: number, y: number, z: number): void; + setLocalEulerAngles(...args: number[]): void; /** * @function @@ -402,6 +405,7 @@ declare namespace pc { * this.entity.setLocalPosition(0, 10, 0); */ setLocalPosition(x: number, y: number, z: number): void; + setLocalPosition(...args: number[]): void; /** * @function @@ -437,6 +441,7 @@ declare namespace pc { * this.entity.setLocalRotation(0, 0, 0, 1); */ setLocalRotation(x: number, y: number, z: number, w: number): void; + setLocalRotation(...args: number[]): void; /** * @function @@ -449,6 +454,7 @@ declare namespace pc { * this.entity.setLocalScale(10, 10, 10); */ setLocalScale(x: number, y: number, z: number): void; + setLocalScale(...args: number[]): void; /** * @function @@ -484,6 +490,7 @@ declare namespace pc { * this.entity.setPosition(0, 10, 0); */ setPosition(x: number, y: number, z: number): void; + setPosition(...args: number[]): void; /** * @function @@ -521,6 +528,7 @@ declare namespace pc { * this.entity.setRotation(0, 0, 0, 1); */ setRotation(x: number, y: number, z: number, w: number): void; + setRotation(...args: number[]): void; /** * @function @@ -534,6 +542,7 @@ declare namespace pc { * this.entity.setEulerAngles(0, 90, 0); */ setEulerAngles(x: number, y: number, z: number): void; + setEulerAngles(...args: number[]): void; /** * @function diff --git a/types/playcanvas/engine/scene/material.d.ts b/types/playcanvas/engine/scene/material.d.ts index 1cb8d487f7..7d387cc0a0 100644 --- a/types/playcanvas/engine/scene/material.d.ts +++ b/types/playcanvas/engine/scene/material.d.ts @@ -57,6 +57,9 @@ declare namespace pc { alphaTest: number; alphaToCoverage: boolean; alphaWrite: boolean; + blend: boolean; + blendSrc: number; + blendDst: number; blendType: number; blueWrite: boolean; cull: number; diff --git a/types/playcanvas/engine/scene/mesh.d.ts b/types/playcanvas/engine/scene/mesh.d.ts index 6a0dca71e6..b9ecd12591 100644 --- a/types/playcanvas/engine/scene/mesh.d.ts +++ b/types/playcanvas/engine/scene/mesh.d.ts @@ -1,5 +1,12 @@ declare namespace pc { + type MeshPrimitive = { + type: number; + base: number; + count: number; + indexed?: boolean; + } + /** * @name pc.Mesh * @class A graphical primitive. The mesh is defined by a {@link pc.VertexBuffer} and an optional @@ -19,8 +26,10 @@ declare namespace pc { class Mesh { vertexBuffer: pc.VertexBuffer; indexBuffer: pc.IndexBuffer; - primitive: {}[]; + primitive: MeshPrimitive[]; aabb: pc.BoundingBox; + skin: pc.Skin; + morph: pc.Morph; } /** @@ -65,11 +74,8 @@ declare namespace pc { class MeshInstance { constructor(node: pc.GraphNode, mesh: pc.Mesh, material: pc.Material) - aabb: pc.BoundingBox; castShadow: boolean; visible: boolean; - layer: number; - material: pc.Material; renderStyle: number; cull: boolean; @@ -80,7 +86,21 @@ declare namespace pc { * To ignore all dynamic lights, set mask to 0. Defaults to 1. */ mask: number; + node: pc.GraphNode; + mesh: pc.Mesh; + aabb: pc.BoundingBox; + material: pc.Material; + layer: number; + receiveShadow: boolean; + skinInstance: pc.SkinInstance; + screenSpace: boolean; + key: number; + } + class Command { + constructor(layer: number, blendType: number, command: Function); + key: number; + conmand: Function; } } \ No newline at end of file diff --git a/types/playcanvas/engine/scene/model.d.ts b/types/playcanvas/engine/scene/model.d.ts index 0961d443af..f11ebf80fa 100644 --- a/types/playcanvas/engine/scene/model.d.ts +++ b/types/playcanvas/engine/scene/model.d.ts @@ -38,6 +38,8 @@ declare namespace pc { */ destroy(): void; + getMaterials(): pc.StandardMaterial[]; + /** * @function * @name pc.Model#generateWireframe diff --git a/types/playcanvas/engine/scene/morph.d.ts b/types/playcanvas/engine/scene/morph.d.ts new file mode 100644 index 0000000000..58e971ebec --- /dev/null +++ b/types/playcanvas/engine/scene/morph.d.ts @@ -0,0 +1,131 @@ +declare namespace pc { + + interface MorphTargetOptions { + deltaPositions: number[]; + deltaNormals?: number[]; + deltaTangents?: number[]; + indices?: number[]; + name?: string; + aabb?: pc.BoundingBox; + } + + /** + * @private + * @name pc.MorphTarget + * @class A Morph Target (also known as Blend Shape) contains deformation data to apply to existing mesh. + * Multiple morph targets can be blended together on a mesh. This is useful for effects that are hard to achieve with conventional animation and skinning. + * @param {Object} options Object for passing optional arguments. + * @param {Number[]} deltaPositions An array of 3-dimensional vertex position offsets. + * @param {Number[]} [deltaNormals] An array of 3-dimensional vertex normal offsets. + * @param {Number[]} [deltaTangents] An array of 4-dimensional vertex normal tangents. + * @param {Number[]} [options.indices] A morph target doesn't have to contain a full copy of the original mesh with added deformations. + * Instead, only deformed vertices can be stored. This array contains indices to the original mesh's vertices and must be of the same size + * as other arrays. + * @param {String} [name] Name + * @param {pc.BoundingBox} [aabb] Bounding box. Will be automatically generated, if undefined. + */ + class MorphTarget { + constructor(optionsi: MorphTargetOptions); + deltaPositions: number[]; + deltaNormals: number[]; + deltaTangents: number[]; + indices: number[]; + name: string; + aabb: pc.BoundingBox; + } + + /** + * @private + * @name pc.Morph + * @class Contains a list of pc.MorphTarget, a combined AABB and some associated data. + * @param {pc.MoprhTarget[]} targets A list of morph targets + */ + class Morph { + constructor(targets: pc.MorphTarget[]); + + aabb: pc.BoundingBox; + + /** + * @private + * @function + * @name pc.Morph#addTarget + * @description Adds a new morph target to the list + * @param {pc.MoprhTarget} target A new morph target + */ + addTarget(target: pc.MorphTarget): void; + + /** + * @private + * @function + * @name pc.Morph#removeTarget + * @description Remove the specified morph target from the list + * @param {pc.MoprhTarget} target A morph target to delete + */ + removeTarget(target: pc.MorphTarget): void; + + /** + * @private + * @function + * @name pc.Morph#getTarget + * @description Gets the morph target by index + * @param {Number} index An index of morph target. + * @returns {pc.MorphTarget} A morph target object + */ + getTarget(index: number): pc.MorphTarget; + } + + /** + * @private + * @name pc.MorphInstance + * @class An instance of pc.Morph. Contains weights to assign to every pc.MorphTarget, holds morphed buffer and associated data. + * @param {pc.Morph} morph The pc.Morph to instance. + */ + class MorphInstance { + constructor(morph: pc.Morph); + + morph: pc.Morph; + + /** + * @function + * @name pc.MorphInstance#destroy + * @description Frees video memory allocated by this object. + */ + destroy(): void; + + /** + * @private + * @function + * @name pc.MorphInstance#getWeight + * @description Gets current weight of the specified morph target. + * @param {Number} index An index of morph target. + * @returns {Number} Weight + */ + getWeight(index: number): number; + + /** + * @private + * @function + * @name pc.MorphInstance#setWeight + * @description Sets weight of the specified morph target. + * @param {Number} index An index of morph target. + * @param {Number} weight Weight + */ + setWeight(index: number, weight: number): void; + + /** + * @private + * @function + * @name pc.MorphInstance#updateBounds + * @description Calculates AABB for this morph instance. Called automatically by renderer. + */ + updateBounds(): void; + + /** + * @private + * @function + * @name pc.MorphInstance#update + * @description Performs morphing. Called automatically by renderer. + */ + update(mesh: pc.Mesh): void; + } +} \ No newline at end of file diff --git a/types/playcanvas/engine/scene/procedural.d.ts b/types/playcanvas/engine/scene/procedural.d.ts index 9b1f3e66d6..8254952918 100644 --- a/types/playcanvas/engine/scene/procedural.d.ts +++ b/types/playcanvas/engine/scene/procedural.d.ts @@ -59,7 +59,7 @@ declare namespace pc { * }); * @author Will Eastcott */ - function createMesh(device: pc.GraphicsDevice, positions: number[], opts: { + function createMesh(device: pc.GraphicsDevice, positions: number[], opts?: { normals: number[], tangents: number[], colors: number[], @@ -86,7 +86,7 @@ declare namespace pc { * @returns {pc.Mesh} A new torus-shaped mesh. * @author Will Eastcott */ - function createTorus(device: pc.GraphicsDevice, opts: { + function createTorus(device: pc.GraphicsDevice, opts?: { tubeRadius: number, ringRadius: number, segments: number, @@ -111,7 +111,7 @@ declare namespace pc { * @returns {pc.Mesh} A new cylinder-shaped mesh. * @author Will Eastcott */ - function createCylinder(device: pc.GraphicsDevice, opts: { + function createCylinder(device: pc.GraphicsDevice, opts?: { radius: number, height: number, heightSegments: number, @@ -136,7 +136,7 @@ declare namespace pc { * @returns {pc.Mesh} A new cylinder-shaped mesh. * @author Will Eastcott */ - function createCapsule(device: pc.GraphicsDevice, opts: { + function createCapsule(device: pc.GraphicsDevice, opts?: { radius: number, height: number, heightSegments: number, @@ -162,7 +162,7 @@ declare namespace pc { * @returns {pc.Mesh} A new cone-shaped mesh. * @author Will Eastcott */ - function createCone(device: pc.GraphicsDevice, opts: { + function createCone(device: pc.GraphicsDevice, opts?: { baseRadius: number, peakRadius: number, height: number, @@ -186,7 +186,7 @@ declare namespace pc { * @returns {pc.Mesh} A new sphere-shaped mesh. * @author Will Eastcott */ - function createSphere(device: pc.GraphicsDevice, opts: { + function createSphere(device: pc.GraphicsDevice, opts?: { radius: number, segments: number }): pc.Mesh; @@ -209,7 +209,7 @@ declare namespace pc { * @returns {pc.Mesh} A new plane-shaped mesh. * @author Will Eastcott */ - function createPlane(device: pc.GraphicsDevice, opts: { + function createPlane(device: pc.GraphicsDevice, opts?: { halfExtents: pc.Vec2, widthSegments: number, lenghtSegments: number @@ -233,7 +233,7 @@ declare namespace pc { * @return {pc.Mesh} A new box-shaped mesh. * @author Will Eastcott */ - function createBox(device: pc.GraphicsDevice, opts: { + function createBox(device: pc.GraphicsDevice, opts?: { halfExtents: pc.Vec3, widthSegments: number, lengthSegments: number, diff --git a/types/playcanvas/engine/scene/scene.d.ts b/types/playcanvas/engine/scene/scene.d.ts index 87bf620a9e..c73e3c61ee 100644 --- a/types/playcanvas/engine/scene/scene.d.ts +++ b/types/playcanvas/engine/scene/scene.d.ts @@ -326,5 +326,7 @@ declare namespace pc { * @author Will Eastcott */ update(): void; + + setSkybox(cubemaps: pc.Texture[]): void; } -} \ No newline at end of file +} diff --git a/types/playcanvas/engine/script/script.d.ts b/types/playcanvas/engine/script/script.d.ts index 21cd5540d9..f1565d1c47 100644 --- a/types/playcanvas/engine/script/script.d.ts +++ b/types/playcanvas/engine/script/script.d.ts @@ -144,6 +144,9 @@ declare namespace pc { * }; */ function createScript>(name: string, app?: pc.Application): Class; + namespace createScript { + export let reservedAttributes: any; + } /** * @name ScriptType @@ -172,7 +175,7 @@ declare namespace pc { * @type String * @description Name of a Script Type. */ - _name: string; + __name: string; /** * @field @@ -220,9 +223,6 @@ declare namespace pc { interface ScriptType { [key: string]: any; - app: pc.Application; - entity: pc.Entity; - enabled: boolean; /** * initialize is called if defined when script is about to run for the first time. @@ -231,7 +231,7 @@ declare namespace pc { initialize?(): void; /** - * postInitialize will run after all initialize methods are executed in the + * postInitialize will run after all initialize methods are executed in the * same tick or enabling chain of actions. * @memberof ScriptType */ @@ -239,22 +239,22 @@ declare namespace pc { /** * update is called if defined for enabled (running state) scripts on each tick. - * @param {number} dt + * @param {number} dt * @memberof ScriptType */ update?(dt: number): void; /** - * postUpdate is called if defined for enabled (running state) scripts on each tick, + * postUpdate is called if defined for enabled (running state) scripts on each tick, * after update. * @memberof ScriptType */ postUpdate?(): void; /** - * This method will be called when a ScriptType that already exists in the registry - * gets redefined. If the new ScriptType has a `swap` method in its prototype, - * then it will be executed to perform hot-reload at runtime. + * This method will be called when a ScriptType that already exists in the registry + * gets redefined. If the new ScriptType has a `swap` method in its prototype, + * then it will be executed to perform hot-reload at runtime. * @memberof ScriptType */ swap?(): void; @@ -274,7 +274,7 @@ declare namespace pc { * }); * obj.fire('test', 1, 2); // prints 3 to the console */ - on(name: string, callback: (...args: any[]) => void, scope: any): any; + on?(name: string, callback: (...args: any[]) => void, scope: any): any; /** * @function @@ -294,7 +294,7 @@ declare namespace pc { * obj.off('test', handler); // Removes all handler functions, called 'test' * obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this */ - off(name: string, callback: (...args: any[]) => void, scope: any): any; + off?(name: string, callback: (...args: any[]) => void, scope: any): any; /** * @function @@ -305,7 +305,7 @@ declare namespace pc { * @example * obj.fire('test', 'This is the message'); */ - fire(name: string, arg1: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; + fire?(name: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; /** * @function @@ -321,7 +321,7 @@ declare namespace pc { * obj.fire('test', 1, 2); // prints 3 to the console * obj.fire('test', 1, 2); // not going to get handled */ - once(name: string, callback: (...args: any[]) => void, scope: any): any; + once?(name: string, callback: (...args: any[]) => void, scope: any): any; /** * @function @@ -332,7 +332,7 @@ declare namespace pc { * obj.on('test', function () { }); // bind an event to 'test' * obj.hasEvent('test'); // returns true */ - hasEvent(name: string): boolean; + hasEvent?(name: string): boolean; } -} \ No newline at end of file +} diff --git a/types/playcanvas/engine/scriptype.d.ts b/types/playcanvas/engine/scriptype.d.ts index 89fb94c5c4..bd9dc5dfc0 100644 --- a/types/playcanvas/engine/scriptype.d.ts +++ b/types/playcanvas/engine/scriptype.d.ts @@ -1,5 +1,5 @@ interface ScriptType { - name: string; + name?: string; /** * Interface to define public script attributes available in the editor. @@ -13,7 +13,7 @@ interface ScriptType { * @memberof ScriptType */ initialize?(): void; - + /** * postInitialize will run after all initialize methods are executed in the * same tick or enabling chain of actions. @@ -42,4 +42,4 @@ interface ScriptType { * @memberof ScriptType */ swap?(): void; -} \ No newline at end of file +} diff --git a/types/playcanvas/engine/shape/bounding-box.d.ts b/types/playcanvas/engine/shape/bounding-box.d.ts index 67340a2246..b91183b607 100644 --- a/types/playcanvas/engine/shape/bounding-box.d.ts +++ b/types/playcanvas/engine/shape/bounding-box.d.ts @@ -21,6 +21,10 @@ declare namespace pc { */ add(other: pc.BoundingBox): void; + copy(src: pc.BoundingBox): void; + + clone(): pc.BoundingBox; + /** * @function * @name pc.BoundingBox#intersects @@ -38,7 +42,7 @@ declare namespace pc { * @param {pc.Vec3} [point] If there is an intersection, the intersection point will be copied into here. * @returns {Boolean} True if there is an intersection. */ - intersectsRay(ray: pc.Ray, point: pc.Vec3): boolean; + intersectsRay(ray: pc.Ray, point?: pc.Vec3): boolean; /** * @function diff --git a/types/playcanvas/engine/shape/bounding-sphere.d.ts b/types/playcanvas/engine/shape/bounding-sphere.d.ts index 5fd1c3503f..f25c92072b 100644 --- a/types/playcanvas/engine/shape/bounding-sphere.d.ts +++ b/types/playcanvas/engine/shape/bounding-sphere.d.ts @@ -24,7 +24,7 @@ declare namespace pc { * @param {pc.Vec3} [point] If there is an intersection, the intersection point will be copied into here. * @returns {Boolean} True if there is an intersection. */ - intersectsRay(ray: pc.Ray, point: pc.Vec3): boolean; + intersectsRay(ray: pc.Ray, point?: pc.Vec3): boolean; /** * @function diff --git a/types/playcanvas/engine/shape/oriented-box.d.ts b/types/playcanvas/engine/shape/oriented-box.d.ts index 47ca9df330..aeff67f2e8 100644 --- a/types/playcanvas/engine/shape/oriented-box.d.ts +++ b/types/playcanvas/engine/shape/oriented-box.d.ts @@ -21,7 +21,7 @@ declare namespace pc { * @param {pc.Vec3} [point] If there is an intersection, the intersection point will be copied into here. * @returns {Boolean} True if there is an intersection. */ - intersectsRay(ray: pc.Ray, point: pc.Vec3): boolean; + intersectsRay(ray: pc.Ray, point?: pc.Vec3): boolean; /** * @function diff --git a/types/playcanvas/engine/shape/plane.d.ts b/types/playcanvas/engine/shape/plane.d.ts index a7ce142fd6..fcb8a557dc 100644 --- a/types/playcanvas/engine/shape/plane.d.ts +++ b/types/playcanvas/engine/shape/plane.d.ts @@ -9,7 +9,10 @@ declare namespace pc { * @param {pc.Vec3} [normal] Normal of the plane. The constructor takes a reference of this parameter. */ class Plane { - constructor(point: pc.Vec3, normal: pc.Vec3) + constructor(point?: pc.Vec3, normal?: pc.Vec3) + + point: pc.Vec3; + normal: pc.Vec3; /** * @function @@ -30,6 +33,6 @@ declare namespace pc { * @param {pc.Vec3} [point] If there is an intersection, the intersection point will be copied into here * @returns {Boolean} True if there is an intersection */ - intersectsRay(ray: pc.Ray, point: pc.Vec3): boolean; + intersectsRay(ray: pc.Ray, point?: pc.Vec3): boolean; } } diff --git a/types/playcanvas/engine/vr/vr-display.d.ts b/types/playcanvas/engine/vr/vr-display.d.ts index a39562c143..c0d23fc944 100644 --- a/types/playcanvas/engine/vr/vr-display.d.ts +++ b/types/playcanvas/engine/vr/vr-display.d.ts @@ -1,5 +1,5 @@ -type NativeVRDisplay = typeof VRDisplay; -type NativeVRDisplayCapabilities = typeof VRDisplayCapabilities; +type NativeVRDisplay = VRDisplay; +type NativeVRDisplayCapabilities = VRDisplayCapabilities; declare namespace pc { @@ -96,6 +96,6 @@ declare namespace pc { * @description Return the current frame data that is updated during polling. * @returns {VRFrameData} The frame data object */ - getFrameData(): void; + getFrameData(): void; } } diff --git a/types/playcanvas/index.d.ts b/types/playcanvas/index.d.ts index 03899cd1b9..24fe7ec6ee 100644 --- a/types/playcanvas/index.d.ts +++ b/types/playcanvas/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Philippe Vaillancourt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// /// /// /// @@ -52,10 +53,14 @@ /// /// /// +/// /// +/// /// -/// +/// /// +/// +/// /// /// /// @@ -72,6 +77,7 @@ /// /// /// +/// /// /// /// diff --git a/types/playcanvas/tsconfig.json b/types/playcanvas/tsconfig.json index a2a2c895a0..ef89113006 100644 --- a/types/playcanvas/tsconfig.json +++ b/types/playcanvas/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "playcanvas-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/playmusic/index.d.ts b/types/playmusic/index.d.ts new file mode 100644 index 0000000000..fda4a582c5 --- /dev/null +++ b/types/playmusic/index.d.ts @@ -0,0 +1,325 @@ +// Type definitions for playmusic 2.3 +// Project: https://www.github.com/jamon/playmusic +// Definitions by: Nick Paddock +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export interface InitOptions { + androidId?: string; + email?: string; + password?: string; + masterToken?: string; +} + +export interface LoginOptions { + androidId?: string; + email?: string; + password?: string; +} + +export interface LoginResponse { + androidId: string; + masterToken: string; +} + +export interface LibraryOptions { + limit?: number; + nextPageToken?: string; +} + +export interface LibraryResponse { + data?: LibraryData; + kind?: string; + nextPageToken?: string; +} + +export interface LibraryData { + items?: LibraryItem[]; +} + +export interface LibraryItem { + album?: string; + albumArtist?: string; + albumArtRef?: ArtRef[]; + artist?: string; + artistArtRef?: ArtRef[]; + artistId?: string[]; + beatsPerMinute?: number; + clientId?: string; + comment?: string; + composer?: string; + creationTimestamp?: string; + deleted?: boolean; + discNumber?: number; + durationMillis?: string; + estimatedSize?: string; + genre?: string; + id?: string; + kind?: string; + lastModifiedTimestamp?: string; + nid?: string; + playCount?: number; + rating?: string; + recentTimestamp?: string; + storeId?: string; + title?: string; + totalDiscCount?: number; + totalTrackCount?: number; + trackNumber?: number; + year?: number; +} + +export interface ArtRef { + url?: string; +} + +export interface PlaylistListResponse { + data?: PlaylistListData; + kind?: string; +} + +export interface PlaylistListData { + items?: PlaylistListItem[]; +} + +export interface PlaylistListItem { + accessControlled?: boolean; + creationTimestamp?: string; + deleted?: boolean; + description?: string; + id?: string; + kind?: string; + lastModifiedTimestamp?: string; + name?: string; + ownerName?: string; + ownerProfilePhotoUrl?: string; + recentTimestamp?: string; + shareToken?: string; + type?: string; +} + +export interface PlaylistOptions { + limit?: number; + nextPageToken?: string; +} + +export interface PlaylistResponse { + data?: PlaylistData; + kind?: string; + nextPageToken?: string; +} + +export interface PlaylistData { + items?: PlaylistItem[]; +} + +export interface PlaylistItem { + absolutePosition?: string; + clientId?: string; + creationTimestamp?: string; + deleted?: boolean; + id?: string; + kind?: string; + lastModifiedTimestamp?: string; + playlistId?: string; + source?: string; + track?: PlaylistTrack; + trackId?: string; +} + +export interface PlaylistTrack { + album?: string; + albumArtist?: string; + albumArtRef?: ArtRef[]; + albumAvailableForPurchase?: boolean; + albumId?: string; + artist?: string; + artistArtRef?: ArtRef[]; + artistId?: string[]; + composer?: string; + contentType?: string; + discNumber?: number; + durationMillis?: string; + estimatedSize?: string; + genre?: string; + kind?: string; + nid?: string; + playCount?: number; + storeId?: string; + title?: string; + trackAvailableForPurchase?: boolean; + trackAvailableForSubscription?: boolean; + trackNumber?: number; + trackType?: string; + year?: number; +} + +export interface PlaylistMeta { + name?: string; + description?: string; + shareState?: string; +} + +export interface MutateResponses { + mutate_response?: MutateResponse[]; +} + +export interface MutateResponse { + client_id?: string; + id?: string; + response_code?: string; +} + +export default class PlayMusic { + constructor(); + init(options: InitOptions, callback: (error: Error) => void): void; + login(options: LoginOptions, callback: (error: Error, response: LoginResponse) => void): void; + + /** + * Returns settings / device ids authorized for account. + * + * @param callback function(error, response) - success callback + */ + getSettings(callback: (error: Error, response: any) => void): void; + + /** + * Returns list of all tracks. + * + * @param callback function(error, response) - success callback + */ + getLibrary(callback: (error: Error, response: LibraryResponse) => void): void; + + /** + * Returns list of all tracks. + * + * @param options object - parameters + * @param callback function(error, response) - success callback + */ + getLibrary(options: LibraryOptions, callback: (error: Error, response: LibraryResponse) => void): void; + + /** + * Returns stream URL for a track. + * + * @param id string - track id, hyphenated is preferred, but "nid" will work for all access tracks (not uploaded ones) + * @param callback function(err, streamUrl) - success callback + */ + getStreamUrl(id: string, callback: (error: Error, streamUrl: string) => void): void; + + /** + * Opens and returns a stream object + * + * @param id string - track id, hyphenated is preferred, but "nid" will work for all access tracks (not uploaded ones) + * @param callback function(stream) - success callback + */ + getStream(id: string, callback: (error: Error, stream: any) => void): void; + + /** + * Searches for All Access tracks. + * + * @param text string - search text + * @param maxResults int - max number of results to return + * @param callback function(err, searchResults) - success callback + */ + search(text: string, maxResults: number, callback: (error: Error, searchResults: any) => void): void; + + /** + * Returns list of all playlists. + * + * @param callback function(error, playlists) - success callback + */ + getPlayLists(callback: (error: Error, response: PlaylistListResponse) => void): void; + + /** + * Creates a new playlist. + * + * @param playlistName string - the playlist name + * @param callback function(error, mutateResponses) - success callback + */ + addPlayList(playlistName: string, callback: (error: Error, mutateResponses: MutateResponses) => void): void; + + /** + * Deletes a playlist + * + * @param playlistId string - the playlist id + * @param callback function(err, mutationStatus) - success callback + */ + deletePlaylist(playlistId: string, callback: (error: Error, mutationStatus: MutateResponses) => void): void; + + /** + * Updates a playlist's metadata + * + * @param playlistId string - the playlist id + * @param updates object - data to update the playlist with + * @param callback function(err, mutationStatus) - success callback + */ + updatePlayListMeta(playlistId: string, updates: PlaylistMeta, callback: (error: Error, mutationStatus: MutateResponses) => void): void; + + /** + * Adds a track to end of a playlist. + * + * @param songId string or array of string - the song id(s) + * @param playlistId string - the playlist id + * @param callback function(error, mutateResponses) - success callback + * @param entryBeforeClientId - optional clientId of playlist entry where to add song after + * @param entryAfterClientId - optional clientId of playlist entry where to add song before + */ + addTrackToPlayList( + songIds: string | string[], + playlistId: string, + callback: (error: Error, mutateResponses: MutateResponses) => void, + entryBeforeClientId?: string, + entryAfterClientId?: string): void; + + /** + * Move the specified entry inbetween two specified entries (identified by their clientIds) + * + * @param entryToMove string - the song id to move + * @param entryBeforeClientId - optional clientId of playlist entry where to move song after + * @param entryAfterClientId - optional clientId of playlist entry where to move song before + * @param callback function(err, playlistEntries) - success callback + */ + movePlayListEntry(entryToMove: string, entryBeforeClientId: string, entryAfterClientId: string, callback: (error: Error, mutateResponses: MutateResponses) => void): void; + + /** + * Increments track's playcount + * + * @param songId int - the song id. See http://bit.ly/1L4U6oK for id requirements. + * @param callback function(err, mutationStatus) - success callback + */ + incrementTrackPlaycount(songId: string, callback: (error: Error, mutationStatus: MutateResponses) => void): void; + + /** + * Change metadata of a track a library + * Currently only support changing rating + * You need to change a song object with a different rating value: + * 5 = thumb up, 1 = thumb down, 0 = no thumb + * + * @param song object - the track dictionary. You can get from getAllAccessTrack or from getLibrary + * @param callback function(err, success) - success callback + */ + changeTrackMetadata(song: any, callback: (error: Error, success: MutateResponses) => void): void; + + /** + * Removes given entry ids from playlist entries. + * + * @param playlistItemIds string or array of string - the entry id(s). You can get this from getPlayListEntries or PlaylistItem#id. + * @param callback function(error, mutateResponses) - success callback + */ + removePlayListEntry(playlistItemIds: string | string[], callback: (error: Error, mutateResponses: MutateResponses) => void): void; + + /** + * Returns tracks on all playlists. + * + * @param callback function(error, response) - success callback + */ + getPlayListEntries(callback: (error: Error, response: PlaylistResponse) => void): void; + + /** + * Returns tracks on all playlists. + * + * @param options object - parameters + * @param callback function(error, response) - success callback + */ + getPlayListEntries(options: PlaylistOptions, callback: (error: Error, response: PlaylistResponse) => void): void; +} diff --git a/types/playmusic/playmusic-tests.ts b/types/playmusic/playmusic-tests.ts new file mode 100644 index 0000000000..1f8e49e0ab --- /dev/null +++ b/types/playmusic/playmusic-tests.ts @@ -0,0 +1,357 @@ +import PlayMusic, * as pm from "playmusic"; + +const instance = new PlayMusic(); + +instance.init({ + androidId: "androidId", + email: "email", + password: "password", + masterToken: "masterToken" +}, (error: Error) => { + console.log(error.message); + console.log(error.name); +}); + +instance.login({ + androidId: "androidId", + email: "email", + password: "password" +}, (error: Error, loginResponse: pm.LoginResponse) => { + console.log(error.message); + console.log(error.name); + console.log(loginResponse.androidId); + console.log(loginResponse.masterToken); +}); + +instance.getSettings((error: Error, response: any) => { + console.log(error.message); + console.log(error.name); +}); + +instance.getLibrary((error: Error, response: pm.LibraryResponse) => { + console.log(error.message); + console.log(error.name); +}); + +instance.getLibrary({ + limit: 123, + nextPageToken: "nextPageToken" +}, (error: Error, response: pm.LibraryResponse) => { + console.log(error.message); + console.log(error.name); + if (response && response.data && response.data.items) { + response.data.items.forEach((item: pm.LibraryItem) => { + console.log(item.album); + console.log(item.albumArtist); + if (item.albumArtRef) { + console.log(item.albumArtRef[0].url); + } + console.log(item.artist); + if (item.artistArtRef) { + console.log(item.artistArtRef[0].url); + } + if (item.artistId) { + console.log(item.artistId.length); + } + console.log(item.beatsPerMinute); + console.log(item.clientId); + console.log(item.comment); + console.log(item.composer); + console.log(item.creationTimestamp); + console.log(item.deleted); + console.log(item.discNumber); + console.log(item.durationMillis); + console.log(item.estimatedSize); + console.log(item.genre); + console.log(item.id); + console.log(item.kind); + console.log(item.lastModifiedTimestamp); + console.log(item.nid); + console.log(item.playCount); + console.log(item.rating); + console.log(item.recentTimestamp); + console.log(item.storeId); + console.log(item.title); + console.log(item.totalDiscCount); + console.log(item.totalTrackCount); + console.log(item.trackNumber); + console.log(item.year); + }); + } + console.log(response.kind); + console.log(response.nextPageToken); +}); + +instance.getStreamUrl("id", (error: Error, streamUrl: string) => { + console.log(error.message); + console.log(error.name); + console.log(streamUrl); +}); + +instance.getStream("id", (error: Error, stream: any) => { + console.log(error.message); + console.log(error.name); + console.log(stream); +}); + +instance.search("text", 123, (error: Error, searchResults: any) => { + console.log(error.message); + console.log(error.name); + console.log(searchResults); +}); + +instance.getPlayLists((error: Error, response: pm.PlaylistListResponse) => { + console.log(error.message); + console.log(error.name); + if (response && response.data && response.data.items) { + response.data.items.forEach((item: pm.PlaylistListItem) => { + console.log(item.accessControlled); + console.log(item.creationTimestamp); + console.log(item.deleted); + console.log(item.description); + console.log(item.id); + console.log(item.kind); + console.log(item.lastModifiedTimestamp); + console.log(item.name); + console.log(item.ownerName); + console.log(item.ownerProfilePhotoUrl); + console.log(item.recentTimestamp); + console.log(item.shareToken); + console.log(item.type); + }); + } + console.log(response.kind); +}); + +instance.addPlayList("playlistName", (error: Error, mutateResponses: pm.MutateResponses) => { + console.log(error.message); + console.log(error.name); + if (mutateResponses && mutateResponses.mutate_response) { + mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => { + console.log(mutateResponse.client_id); + console.log(mutateResponse.id); + console.log(mutateResponse.response_code); + }); + } +}); + +instance.deletePlaylist("playlistId", (error: Error, mutateResponses: pm.MutateResponses) => { + console.log(error.message); + console.log(error.name); + if (mutateResponses && mutateResponses.mutate_response) { + mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => { + console.log(mutateResponse.client_id); + console.log(mutateResponse.id); + console.log(mutateResponse.response_code); + }); + } +}); + +instance.updatePlayListMeta("playlistId", { + name: "name", + description: "description", + shareState: "shareState" +}, (error: Error, mutateResponses: pm.MutateResponses) => { + console.log(error.message); + console.log(error.name); + if (mutateResponses && mutateResponses.mutate_response) { + mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => { + console.log(mutateResponse.client_id); + console.log(mutateResponse.id); + console.log(mutateResponse.response_code); + }); + } +}); + +instance.addTrackToPlayList("songId", "playlistId", (error: Error, mutateResponses: pm.MutateResponses) => { + console.log(error.message); + console.log(error.name); + if (mutateResponses && mutateResponses.mutate_response) { + mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => { + console.log(mutateResponse.client_id); + console.log(mutateResponse.id); + console.log(mutateResponse.response_code); + }); + } +}, "entryBeforeClientId", "entryAfterClientId"); + +instance.addTrackToPlayList(["songId1", "songId2"], "playlistId", (error: Error, mutateResponses: pm.MutateResponses) => { + console.log(error.message); + console.log(error.name); + if (mutateResponses && mutateResponses.mutate_response) { + mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => { + console.log(mutateResponse.client_id); + console.log(mutateResponse.id); + console.log(mutateResponse.response_code); + }); + } +}, "entryBeforeClientId", "entryAfterClientId"); + +instance.movePlayListEntry("entryToMove", "entryBeforeClientId", "entryAfterClientId", (error: Error, mutateResponses: pm.MutateResponses) => { + console.log(error.message); + console.log(error.name); + if (mutateResponses && mutateResponses.mutate_response) { + mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => { + console.log(mutateResponse.client_id); + console.log(mutateResponse.id); + console.log(mutateResponse.response_code); + }); + } +}); + +instance.incrementTrackPlaycount("songId", (error: Error, mutateResponses: pm.MutateResponses) => { + console.log(error.message); + console.log(error.name); + if (mutateResponses && mutateResponses.mutate_response) { + mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => { + console.log(mutateResponse.client_id); + console.log(mutateResponse.id); + console.log(mutateResponse.response_code); + }); + } +}); + +instance.changeTrackMetadata({ }, (error: Error, mutateResponses: pm.MutateResponses) => { + console.log(error.message); + console.log(error.name); + if (mutateResponses && mutateResponses.mutate_response) { + mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => { + console.log(mutateResponse.client_id); + console.log(mutateResponse.id); + console.log(mutateResponse.response_code); + }); + } +}); + +instance.removePlayListEntry("playlistItemId", (error: Error, mutateResponses: pm.MutateResponses) => { + console.log(error.message); + console.log(error.name); + if (mutateResponses && mutateResponses.mutate_response) { + mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => { + console.log(mutateResponse.client_id); + console.log(mutateResponse.id); + console.log(mutateResponse.response_code); + }); + } +}); + +instance.removePlayListEntry(["playlistItemId1", "playlistItemId2"], (error: Error, mutateResponses: pm.MutateResponses) => { + console.log(error.message); + console.log(error.name); + if (mutateResponses && mutateResponses.mutate_response) { + mutateResponses.mutate_response.forEach((mutateResponse: pm.MutateResponse) => { + console.log(mutateResponse.client_id); + console.log(mutateResponse.id); + console.log(mutateResponse.response_code); + }); + } +}); + +instance.getPlayListEntries((error: Error, response: pm.PlaylistResponse) => { + console.log(error.message); + console.log(error.name); + if (response && response.data && response.data.items) { + response.data.items.forEach((item: pm.PlaylistItem) => { + console.log(item.absolutePosition); + console.log(item.clientId); + console.log(item.creationTimestamp); + console.log(item.deleted); + console.log(item.id); + console.log(item.kind); + console.log(item.lastModifiedTimestamp); + console.log(item.playlistId); + console.log(item.source); + if (item.track) { + console.log(item.track.album); + console.log(item.track.albumArtist); + if (item.track.albumArtRef) { + console.log(item.track.albumArtRef[0].url); + } + console.log(item.track.albumAvailableForPurchase); + console.log(item.track.albumId); + console.log(item.track.artist); + if (item.track.artistArtRef) { + console.log(item.track.artistArtRef[0].url); + } + if (item.track.artistId) { + console.log(item.track.artistId.length); + } + console.log(item.track.composer); + console.log(item.track.contentType); + console.log(item.track.discNumber); + console.log(item.track.durationMillis); + console.log(item.track.estimatedSize); + console.log(item.track.genre); + console.log(item.track.kind); + console.log(item.track.nid); + console.log(item.track.playCount); + console.log(item.track.storeId); + console.log(item.track.title); + console.log(item.track.trackAvailableForPurchase); + console.log(item.track.trackAvailableForSubscription); + console.log(item.track.trackNumber); + console.log(item.track.trackType); + console.log(item.track.year); + } + console.log(item.trackId); + }); + } + console.log(response.kind); + console.log(response.nextPageToken); +}); + +instance.getPlayListEntries({ + limit: 123, + nextPageToken: "nextPageToken" +}, (error: Error, response: pm.PlaylistResponse) => { + console.log(error.message); + console.log(error.name); + if (response && response.data && response.data.items) { + response.data.items.forEach((item: pm.PlaylistItem) => { + console.log(item.absolutePosition); + console.log(item.clientId); + console.log(item.creationTimestamp); + console.log(item.deleted); + console.log(item.id); + console.log(item.kind); + console.log(item.lastModifiedTimestamp); + console.log(item.playlistId); + console.log(item.source); + if (item.track) { + console.log(item.track.album); + console.log(item.track.albumArtist); + if (item.track.albumArtRef) { + console.log(item.track.albumArtRef[0].url); + } + console.log(item.track.albumAvailableForPurchase); + console.log(item.track.albumId); + console.log(item.track.artist); + if (item.track.artistArtRef) { + console.log(item.track.artistArtRef[0].url); + } + if (item.track.artistId) { + console.log(item.track.artistId.length); + } + console.log(item.track.composer); + console.log(item.track.contentType); + console.log(item.track.discNumber); + console.log(item.track.durationMillis); + console.log(item.track.estimatedSize); + console.log(item.track.genre); + console.log(item.track.kind); + console.log(item.track.nid); + console.log(item.track.playCount); + console.log(item.track.storeId); + console.log(item.track.title); + console.log(item.track.trackAvailableForPurchase); + console.log(item.track.trackAvailableForSubscription); + console.log(item.track.trackNumber); + console.log(item.track.trackType); + console.log(item.track.year); + } + console.log(item.trackId); + }); + } + console.log(response.kind); + console.log(response.nextPageToken); +}); diff --git a/types/linq4js/tsconfig.json b/types/playmusic/tsconfig.json similarity index 91% rename from types/linq4js/tsconfig.json rename to types/playmusic/tsconfig.json index 3479566f16..7ea1bb4321 100644 --- a/types/linq4js/tsconfig.json +++ b/types/playmusic/tsconfig.json @@ -1,24 +1,24 @@ { - "files": [ - "index.d.ts", - "linq4js-tests.ts" - ], "compilerOptions": { "module": "commonjs", + "lib": [ + "es6" + ], + "target": "es6", "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, "strictFunctionTypes": true, - "target": "es6", + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" ], "types": [], - "lib": [ - "es6" - ], "noEmit": true, "forceConsistentCasingInFileNames": true - } -} \ No newline at end of file + }, + "files": [ + "index.d.ts", + "playmusic-tests.ts" + ] +} diff --git a/types/playmusic/tslint.json b/types/playmusic/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/playmusic/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 81286fe0a4..6e7c9a67bc 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -4,6 +4,7 @@ // Martin Duparc // Frederik Aalund // taoqf +// Dadstart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -22,40 +23,54 @@ export interface Point { z: number; } +export interface PlotScatterDataPoint { + pointNumber: number; + curveNumber: number; + data: ScatterData; +} + +export interface PlotMouseEvent { + points: PlotScatterDataPoint[]; + event: MouseEvent; +} + +export interface PlotCoordinate { + x: number; + y: number; + pointNumber: number; +} + +export interface PlotSelectionEvent { + points: PlotCoordinate[]; +} + +export type PlotRestyleEvent = [ + any, // update object -- attribute updated: new value + number[] // array of traces updated +]; + +export interface PlotAxis { + range: [number, number]; + autorange: boolean; +} + +export interface PlotScene { + center: Point; + eye: Point; + up: Point; +} + +export interface PlotRelayoutEvent { + xaxis: PlotAxis; + yaxis: PlotAxis; + scene: PlotScene; +} + export interface PlotlyHTMLElement extends HTMLElement { - on(event: 'plotly_click' | 'plotly_hover' | 'plotly_unhover', callback: (data: { - points: Array<{ - pointNumber: number; - curveNumber: number; - data: ScatterData; - }>; - }) => void): void; - on(event: 'plotly_selecting' | 'plotly_selected', callback: (data: { - points: Array<{ - x: number; - y: number; - pointNumber: number; - }>; - }) => void): void; - on(event: 'plotly_restyle', callback: (data: [ - any, // update object -- attribute updated: new value - number[] // array of traces updated - ]) => void): void; - on(event: 'plotly_relayout', callback: (data: { - xaxis: { - range: [number, number]; - autorange: boolean; - }; - yaxis: { - range: [number, number]; - autorange: boolean; - }; - scene: { - center: Point; - eye: Point; - up: Point; - }; - }) => void): void; + on(event: 'plotly_click' | 'plotly_hover' | 'plotly_unhover', callback: (event: PlotMouseEvent) => void): void; + on(event: 'plotly_selecting' | 'plotly_selected', callback: (event: PlotSelectionEvent) => void): void; + on(event: 'plotly_restyle', callback: (data: PlotRestyleEvent) => void): void; + on(event: 'plotly_relayout', callback: (event: PlotRelayoutEvent) => void): void; // on(event: 'plotly_event', callback: (data: any) => void): void; on(event: 'plotly_afterplot' | 'plotly_autosize' | 'plotly_deselect' | 'plotly_doubleclick' | 'plotly_redraw' | 'plotly_animated', callback: () => void): void; } diff --git a/types/plugin-error/tsconfig.json b/types/plugin-error/tsconfig.json index ee9cd8e61f..9c57996e49 100644 --- a/types/plugin-error/tsconfig.json +++ b/types/plugin-error/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "plugin-error-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts b/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts index bacd6c4b7a..a966a3edb8 100644 --- a/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts +++ b/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts @@ -1,6 +1,6 @@ import * as redux from 'redux'; import makePouchMiddleware, { Document, Path } from 'pouch-redux-middleware'; -import * as PouchDB from 'pouchdb'; +import PouchDB = require('pouchdb'); const types = { DELETE_TODO: 'delete-todo', diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index 59e5650e62..e636c3e7c1 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -581,6 +581,9 @@ declare namespace PouchDB { } interface Database { + /** The name passed to the PouchDB constructor and unique identifier of the database. */ + name: string; + /** Fetch all documents matching the given options. */ allDocs(options?: Core.AllDocsWithKeyOptions | Core.AllDocsWithKeysOptions | Core.AllDocsWithinRangeOptions | Core.AllDocsOptions): Promise>; @@ -594,7 +597,7 @@ declare namespace PouchDB { */ bulkDocs(docs: Array>, options: Core.BulkDocsOptions | null, - callback: Core.Callback): void; + callback: Core.Callback>): void; /** * Create, update or delete multiple documents. The docs argument is an array of documents. @@ -604,7 +607,7 @@ declare namespace PouchDB { * Finally, to delete a document, include a _deleted parameter with the value true. */ bulkDocs(docs: Array>, - options?: Core.BulkDocsOptions): Promise; + options?: Core.BulkDocsOptions): Promise>; /** Compact the database */ compact(options?: Core.CompactOptions): Promise; diff --git a/types/pouchdb-core/pouchdb-core-tests.ts b/types/pouchdb-core/pouchdb-core-tests.ts index d050b4c6a6..fe79997461 100644 --- a/types/pouchdb-core/pouchdb-core-tests.ts +++ b/types/pouchdb-core/pouchdb-core-tests.ts @@ -1,4 +1,4 @@ -import * as PouchDB from 'pouchdb-core'; +import PouchDB = require('pouchdb-core'); function isString(someString: string) { } @@ -47,10 +47,19 @@ function testBulkDocs() { const model = { property: 'test' }; const model2 = { property: 'test' }; + const isError = ( + result: PouchDB.Core.Response | PouchDB.Core.Error + ): result is PouchDB.Core.Error => { + return !!( result).error; + }; + db.bulkDocs([model, model2]).then((result) => { - result.forEach(({ ok, id, rev }) => { + result.forEach(result => { + if (!isError(result)) { + const { ok, id, rev } = result; isString(id); isString(rev); + } }); }); diff --git a/types/pouchdb/pouchdb-tests.ts b/types/pouchdb/pouchdb-tests.ts index c4b3d6870b..e5b9c356d4 100644 --- a/types/pouchdb/pouchdb-tests.ts +++ b/types/pouchdb/pouchdb-tests.ts @@ -1,4 +1,4 @@ -import * as PouchDB from 'pouchdb'; +import PouchDB = require('pouchdb'); function isString(someString: string) { } diff --git a/types/prettier/index.d.ts b/types/prettier/index.d.ts index 32c541fda6..b323a0979b 100644 --- a/types/prettier/index.d.ts +++ b/types/prettier/index.d.ts @@ -1,12 +1,12 @@ -// Type definitions for prettier 1.9 +// Type definitions for prettier 1.10 // Project: https://github.com/prettier/prettier // Definitions by: Ika // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import { File } from 'babel-types'; - -export type AST = File; +export type AST = any; +export type Doc = any; // https://github.com/prettier/prettier/blob/master/commands.md +export type FastPath = any; // https://github.com/prettier/prettier/blob/master/src/common/fast-path.js export type BuiltInParser = (text: string, options?: any) => AST; export type BuiltInParserName = @@ -19,7 +19,8 @@ export type BuiltInParserName = | 'scss' | 'json' | 'graphql' - | 'markdown'; + | 'markdown' + | 'vue'; export type CustomParser = (text: string, parsers: Record, options: Options) => AST; @@ -97,6 +98,35 @@ export interface Options { * Include parentheses around a sole arrow function parameter. */ arrowParens?: 'avoid' | 'always'; + /** + * The plugin API is in a beta state. + */ + plugins?: Array; +} + +export interface Plugin { + languages: SupportLanguage; + parsers: { [parserName: string]: Parser }; + printers: { [astFormat: string]: Printer }; +} + +export interface Parser { + parse: (text: string, parsers: { [parserName: string]: Parser }, options: object) => AST; + astFormat: string; +} + +export interface Printer { + print( + path: FastPath, + options: object, + print: (path: FastPath) => Doc, + ): Doc; + embed( + path: FastPath, + print: (path: FastPath) => Doc, + textToDoc: (text: string, options: object) => Doc, + options: object, + ): Doc | null; } export interface CursorOptions extends Options { @@ -193,8 +223,42 @@ export interface SupportLanguage { vscodeLanguageIds: string[]; } +export interface SupportOption { + since: string; + type: 'int' | 'boolean' | 'choice' | 'path'; + deprecated?: string; + redirect?: SupportOptionRedirect; + description: string; + oppositeDescription?: string; + default: SupportOptionValue; + range?: SupportOptionRange; + choices?: SupportOptionChoice; +} + +export interface SupportOptionRedirect { + options: string; + value: SupportOptionValue; +} + +export interface SupportOptionRange { + start: number; + end: number; + step: number; +} + +export interface SupportOptionChoice { + value: boolean | string; + description?: string; + since?: string; + deprecated?: string; + redirect?: SupportOptionValue; +} + +export type SupportOptionValue = number | boolean | string; + export interface SupportInfo { languages: SupportLanguage[]; + options: SupportOption[]; } /** diff --git a/types/priorityqueuejs/priorityqueuejs-tests.ts b/types/priorityqueuejs/priorityqueuejs-tests.ts index 15e9211ea8..711e1faedf 100644 --- a/types/priorityqueuejs/priorityqueuejs-tests.ts +++ b/types/priorityqueuejs/priorityqueuejs-tests.ts @@ -1,4 +1,4 @@ -import * as PriorityQueue from 'priorityqueuejs'; +import PriorityQueue = require('priorityqueuejs'); var queue = new PriorityQueue<{ cash: number, name: string }>(function(a, b) { return a.cash - b.cash; diff --git a/types/proj4/proj4-tests.ts b/types/proj4/proj4-tests.ts index c5d549efe7..3d1ab1ab9b 100644 --- a/types/proj4/proj4-tests.ts +++ b/types/proj4/proj4-tests.ts @@ -1,4 +1,4 @@ -import * as proj4 from 'proj4'; +import proj4 = require('proj4'); /////////////////////////////////////////// // Tests data initialisation diff --git a/types/promise-queue/index.d.ts b/types/promise-queue/index.d.ts new file mode 100644 index 0000000000..efeaf04909 --- /dev/null +++ b/types/promise-queue/index.d.ts @@ -0,0 +1,55 @@ +// Type definitions for promise-queue 2.2 +// Project: https://github.com/azproduction/promise-queue +// Definitions by: Lachlan Stuart +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = PromiseQueue; + +declare class PromiseQueue { + /** + * + * @param maxPendingPromises [Infinity] Number of promises that can run at once. + * @param maxQueuedPromises [Infinity] Number of promises generators that can be in the queue at once. + * `add()` will return a rejected promise if this limit would be exceeded. + * @param options [{}] See QueueOptions + */ + constructor(maxPendingPromises?: number, maxQueuedPromises?: number, options?: PromiseQueue.QueueOptions); + + /** + * Enqueue a promise generator. When the number of running promises is less than `maxPendingPromises`, + * this function will be called and the returned promise will be held as a running promise until it + * rejects or resolves. + * + * @throws If the global `Promise` is undefined and `Queue.configure` hasn't been called. + * @param promiseGenerator A function that returns a promise when called. + * @returns A promise that forwards the resolution/rejection of the promise returned by `promiseGenerator`, + * or immediately rejects if `maxQueuedPromise` is exceeded. + */ + add(promiseGenerator: () => Promise): Promise; + + /** + * Returns the number of promiseGenerators waiting in queue. + */ + getPendingLength(): number; + + /** + * Returns the number of in-flight promises + */ + getQueueLength(): number; + + /** + * Set which promise constructor to use for the value returned by PromiseQueue#add. + * If this isn't called, the global `Promise` constructor is used. + * @param GlobalPromise A constructor for Promises + */ + static configure(GlobalPromise: PromiseConstructor): void; +} + +declare namespace PromiseQueue { + interface QueueOptions { + /** + * Callback that is called when the queue is empty and all pending promises have resolved + */ + onEmpty(): void; + } +} diff --git a/types/promise-queue/promise-queue-tests.ts b/types/promise-queue/promise-queue-tests.ts new file mode 100644 index 0000000000..b221fddc38 --- /dev/null +++ b/types/promise-queue/promise-queue-tests.ts @@ -0,0 +1,11 @@ +import PromiseQueue = require('promise-queue'); + +PromiseQueue.configure(Promise); + +const queue1 = new PromiseQueue(); +const queue2 = new PromiseQueue(1, 1, {onEmpty: () => null}); + +const queuedPromise: Promise = queue1.add(() => Promise.resolve(123)); + +const running: number = queue1.getPendingLength(); +const inQueue: number = queue1.getQueueLength(); diff --git a/types/promise-queue/tsconfig.json b/types/promise-queue/tsconfig.json new file mode 100644 index 0000000000..e1f2e1fada --- /dev/null +++ b/types/promise-queue/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", + "promise-queue-tests.ts" + ] +} \ No newline at end of file diff --git a/types/promise-queue/tslint.json b/types/promise-queue/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/promise-queue/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/promise-retry/tsconfig.json b/types/promise-retry/tsconfig.json index cd598fc1f4..660e112726 100644 --- a/types/promise-retry/tsconfig.json +++ b/types/promise-retry/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "promise-retry-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/promisify-supertest/promisify-supertest-tests.ts b/types/promisify-supertest/promisify-supertest-tests.ts index 7fa6de147d..84f4205534 100644 --- a/types/promisify-supertest/promisify-supertest-tests.ts +++ b/types/promisify-supertest/promisify-supertest-tests.ts @@ -1,6 +1,5 @@ - -import * as request from 'promisify-supertest'; -import * as express from 'express'; +import request = require('promisify-supertest'); +import express = require('express'); let app = express(); diff --git a/types/prompt-sync-history/prompt-sync-history-tests.ts b/types/prompt-sync-history/prompt-sync-history-tests.ts index 40b00f2270..427d42a465 100644 --- a/types/prompt-sync-history/prompt-sync-history-tests.ts +++ b/types/prompt-sync-history/prompt-sync-history-tests.ts @@ -1,4 +1,4 @@ -import * as promptHistory from 'prompt-sync-history'; +import promptHistory = require('prompt-sync-history'); import * as PromptSync from 'prompt-sync'; let history:PromptSync.History; diff --git a/types/prompt-sync/prompt-sync-tests.ts b/types/prompt-sync/prompt-sync-tests.ts index 2c803e0a49..0d1f4f18ed 100644 --- a/types/prompt-sync/prompt-sync-tests.ts +++ b/types/prompt-sync/prompt-sync-tests.ts @@ -1,4 +1,4 @@ -import * as promptSync from 'prompt-sync'; +import promptSync = require('prompt-sync'); declare const history: promptSync.History; diff --git a/types/prosemirror-model/index.d.ts b/types/prosemirror-model/index.d.ts index 47741b200e..153358e3c6 100644 --- a/types/prosemirror-model/index.d.ts +++ b/types/prosemirror-model/index.d.ts @@ -832,7 +832,7 @@ export class ResolvedPos { * its parent node or its parent node isn't a textblock (in which * case no marks should be preserved). */ - marksAcross(): Mark[] | null | void; + marksAcross($end: ResolvedPos): Mark[] | null | void; /** * The depth up to which this position and the given (non-resolved) * position share the same parent nodes. diff --git a/types/prosemirror-tables/index.d.ts b/types/prosemirror-tables/index.d.ts index 59f54b697b..53df9fc220 100644 --- a/types/prosemirror-tables/index.d.ts +++ b/types/prosemirror-tables/index.d.ts @@ -4,8 +4,9 @@ // Eduard Shvedai // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import { EditorState, Plugin, SelectionRange, Transaction } from 'prosemirror-state'; +import { EditorState, Plugin, SelectionRange, Transaction, PluginKey } from 'prosemirror-state'; import { Node as ProsemirrorNode, NodeSpec, Slice, ResolvedPos } from 'prosemirror-model'; +import { NodeView } from 'prosemirror-view'; export interface TableNodesOptions { tableGroup?: string; @@ -122,3 +123,25 @@ export function deleteColumn(state: EditorState, dispatch?: (tr: Transaction) => export function addColumnAfter(state: EditorState, dispatch?: (tr: Transaction) => void): boolean; export function addColumnBefore(state: EditorState, dispatch?: (tr: Transaction) => void): boolean; + +export function columnResizing(props: { handleWidth?: number, cellMinWidth?: number, View?: NodeView }): Plugin; + +export const columnResizingPluginKey: PluginKey; + +export function updateColumnsOnResize(node: ProsemirrorNode, colgroup: Element, table: Element, cellMinWidth: number, overrideCol?: number, overrideValue?: number): void; + +export function cellAround(pos: ResolvedPos): ResolvedPos | null; + +export function isInTable(state: EditorState): boolean; + +export function selectionCell(state: EditorState): ResolvedPos | null | undefined; + +export function moveCellForward(pos: ResolvedPos): ResolvedPos; + +export function inSameTable($a: ResolvedPos, $b: ResolvedPos): boolean; + +export function findCell(pos: ResolvedPos): {top: number, left: number, right: number, buttom: number}; + +export function colCount(pos: ResolvedPos): number; + +export function nextCell(pos: ResolvedPos, axis: string, dir: number): null | ResolvedPos; diff --git a/types/provinces/tsconfig.json b/types/provinces/tsconfig.json index d08b599b71..20f56bbafd 100644 --- a/types/provinces/tsconfig.json +++ b/types/provinces/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "provinces-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/pty.js/index.d.ts b/types/pty.js/index.d.ts index 5a58f4b9fb..88c2615a82 100644 --- a/types/pty.js/index.d.ts +++ b/types/pty.js/index.d.ts @@ -18,10 +18,9 @@ interface TerminalOptions { gid?: number; } -import stream = require('stream'); import net = require('net'); -export declare class Terminal implements stream.Stream { +export declare class Terminal { /** Read-only name of the terminal. */ name: string; /** Read-only number of columns in the terminal. */ @@ -69,9 +68,9 @@ export declare class Terminal implements stream.Stream { resume(): void; setEncoding(encoding: string): void; /** - * Closes the master end of the pseudo-terminal, and attempts to kill the spawned process - * associated with the slave end of the pseudo-terminal (but only if [[pid]] is not null). - */ + * Closes the master end of the pseudo-terminal, and attempts to kill the spawned process + * associated with the slave end of the pseudo-terminal (but only if [[pid]] is not null). + */ destroy(): void; // NodeJS Stream interface @@ -85,21 +84,15 @@ export declare class Terminal implements stream.Stream { once(event: string, listener: Function): this; removeListener(event: string, listener: Function): this; removeAllListeners(event?: string): this; - // NOTE: this method is not actually defined in pty.js - setMaxListeners(n: number): this; - getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; - listenerCount(type: string): number; - prependListener(event: string, listener: Function): this; - prependOnceListener(event: string, listener: Function): this; eventNames(): string[]; } /** * Creates a new pseudo-terminal, spawns a child process, and associates it with the slave -* end of the pseudo-terminal. -*/ + * end of the pseudo-terminal. + */ export declare function createTerminal(file?: string, args?: string[], opt?: TerminalOptions): Terminal; /** Alias for [[createTerminal]]. */ export declare function fork(file?: string, args?: string[], opt?: TerminalOptions): Terminal; diff --git a/types/pubnub/index.d.ts b/types/pubnub/index.d.ts index 3ad70755a0..8337acfbe4 100644 --- a/types/pubnub/index.d.ts +++ b/types/pubnub/index.d.ts @@ -1,12 +1,22 @@ // Type definitions for pubnub 4.0 // Project: https://github.com/pubnub/javascript -// Definitions by: bitbankinc , rollymaduk +// Definitions by: bitbankinc , rollymaduk , vitosamson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // @see https://www.pubnub.com/docs/web-javascript/api-reference-configuration declare class Pubnub { constructor(config: Pubnub.PubnubConfig); + static CATEGORIES: Pubnub.Categories; + + static OPERATIONS: Pubnub.Operations; + + static generateUUID(): string; + + setUUID(uuid: string): void; + + getUUID(): string; + setAuthKey(authKey: string): void; setFilterExpression(filterExpression: string): void; @@ -15,7 +25,7 @@ declare class Pubnub { publish( params: Pubnub.PublishParameters, - callback: (status: any, response: Pubnub.PublishResponse) => void + callback: (status: Pubnub.PublishStatus, response: Pubnub.PublishResponse) => void ): void; publish( @@ -24,7 +34,7 @@ declare class Pubnub { fire( params: Pubnub.FireParameters, - callback: (status: any, response: Pubnub.PublishResponse) => void + callback: (status: Pubnub.PublishStatus, response: Pubnub.PublishResponse) => void ): void; fire( @@ -45,7 +55,7 @@ declare class Pubnub { hereNow( params: Pubnub.HereNowParameters, - callback: (status: any, response: Pubnub.HereNowResponse) => void + callback: (status: Pubnub.HereNowStatus, response: Pubnub.HereNowResponse) => void ): void; hereNow( @@ -53,9 +63,31 @@ declare class Pubnub { ): Promise; whereNow( - params: {uuid: string}, + params: Pubnub.WhereNowParameters, callback: (status: Pubnub.WhereNowStatus, response: Pubnub.WhereNowResponse) => void ): void; + + whereNow( + params: Pubnub.WhereNowParameters + ): Promise; + + getState( + params: Pubnub.GetStateParameters, + callback: (status: Pubnub.GetStateStatus, state: Pubnub.GetStateResponse) => void + ): void; + + getState( + params: Pubnub.GetStateParameters + ): Promise; + + setState( + params: Pubnub.SetStateParameters, + callback: (status: Pubnub.SetStateStatus, state: Pubnub.SetStateResponse) => void + ): void; + + setState( + params: Pubnub.SetStateParameters + ): Promise; } declare namespace Pubnub { @@ -83,15 +115,30 @@ declare namespace Pubnub { secretKey?: string; } - interface PubnubData { - actualChannel: string; + interface MessageEvent { channel: string; + subscription: string; + timetoken: string; message: any; + publisher: string; + + /** + * @deprecated + */ + actualChannel: string; + + /** + * @deprecated + */ + subscribedChannel: string; } + // PubnubData was renamed to MessageEvent, keep old name for backwards compatibility + type PubnubData = MessageEvent; + interface StatusEvent { - category: string; - operation: string; + category: string; // see Pubnub.Categories + operation: string; // see Pubnub.Operations affectedChannels: string[]; subscribedChannels: string[]; affectedChannelGroups: string[]; @@ -99,6 +146,26 @@ declare namespace Pubnub { currentTimetoken: number | string; } + interface PresenceEvent { + action: 'join' | 'leave' | 'state-change' | 'timeout'; + channel: string; + occupancy: number; + state?: any; + subscription: string; + timestamp: number; + timetoken: string; + uuid: string; + + /** + * @deprecated + */ + actualChannel: string; + /** + * @deprecated + */ + subscribedChannel: string; + } + // publish interface PublishParameters { message: any; @@ -113,6 +180,13 @@ declare namespace Pubnub { timetoken: number; } + interface PublishStatus { + operation: string; // see Pubnub.Operations + category: string; // see Pubnub.Categories; + error: boolean; + errorData: Error; + } + // fire interface FireParameters { message: any; @@ -137,9 +211,9 @@ declare namespace Pubnub { // addListener interface ListenerParameters { - status?: (statusEvent: StatusEvent) => void; - message?: (data: PubnubData) => void; - presence?: (presenceEvent: any) => void; + status?(statusEvent: StatusEvent): void; + message?(messageEvent: MessageEvent): void; + presence?(presenceEvent: PresenceEvent): void; } // hereNow @@ -153,10 +227,29 @@ declare namespace Pubnub { interface HereNowResponse { totalChannels: number; totalOccupancy: number; - channels: {[channel: string]: any}; + channels: { + [channel: string]: { + name: string; + occupancy: number; + occupants: Array<{ + uuid: string; + state?: any; + }>; + }; + }; + } + + interface HereNowStatus { + error: boolean; + operation: string; // see Pubnub.Operations; + statusCode: number; } // whereNow + interface WhereNowParameters { + uuid?: string; + } + interface WhereNowStatus { error: boolean; operation: string; @@ -174,12 +267,71 @@ declare namespace Pubnub { state?: any; } + interface SetStateStatus { + error: boolean; + operation: string; + statusCode: number; + } + + interface SetStateResponse { + state: any; + } + // getState interface GetStateParameters { uuid?: string; channels?: string[]; channelGroups?: string[]; } + + interface GetStateStatus { + error: boolean; + operation: string; + statusCode: number; + } + + interface GetStateResponse { + channels: { + [channel: string]: any; + }; + } + + interface Categories { + PNNetworkUpCategory: string; + PNNetworkDownCategory: string; + PNNetworkIssuesCategory: string; + PNTimeoutCategory: string; + PNBadRequestCategory: string; + PNAccessDeniedCategory: string; + PNUnknownCategory: string; + PNReconnectedCategory: string; + PNConnectedCategory: string; + PNRequestMessageCountExceededCategory: string; + } + + interface Operations { + PNTimeOperation: string; + PNHistoryOperation: string; + PNDeleteMessagesOperation: string; + PNFetchMessagesOperation: string; + PNSubscribeOperation: string; + PNUnsubscribeOperation: string; + PNPublishOperation: string; + PNPushNotificationEnabledChannelsOperation: string; + PNRemoveAllPushNotificationsOperation: string; + PNWhereNowOperation: string; + PNSetStateOperation: string; + PNHereNowOperation: string; + PNGetStateOperation: string; + PNHeartbeatOperation: string; + PNChannelGroupsOperation: string; + PNRemoveGroupOperation: string; + PNChannelsForGroupOperation: string; + PNAddChannelsToGroupOperation: string; + PNRemoveChannelsFromGroupOperation: string; + PNAccessManagerGrant: string; + PNAccessManagerAudit: string; + } } -export default Pubnub; +export = Pubnub; diff --git a/types/pubnub/pubnub-tests.ts b/types/pubnub/pubnub-tests.ts index 291fc035fe..1d8b2bb1ca 100644 --- a/types/pubnub/pubnub-tests.ts +++ b/types/pubnub/pubnub-tests.ts @@ -1,4 +1,4 @@ -import Pubnub from 'pubnub'; +import Pubnub = require('pubnub'); const console = { log: (params: any) => {} @@ -36,8 +36,10 @@ pubnub.subscribe({channels: ['channel-1']}); pubnub.addListener({ status: statusEvent => { - if (statusEvent.category === "PNConnectedCategory") { + if (statusEvent.category === Pubnub.CATEGORIES.PNConnectedCategory) { console.log(statusEvent.category); + } else if (statusEvent.operation === Pubnub.OPERATIONS.PNAccessManagerAudit) { + console.log(statusEvent.operation); } }, message: message => { @@ -49,3 +51,38 @@ pubnub.addListener({ }); pubnub.unsubscribe({channels: ['channel-1']}); + +pubnub.unsubscribeAll(); + +pubnub.setUUID(Pubnub.generateUUID()); +const uuid = pubnub.getUUID(); + +pubnub.whereNow({ uuid: '' }, (status, res) => { + if (!status.error) { + console.log(res.channels[0]); + } +}); + +pubnub.whereNow({ uuid: '' }).then(res => { + console.log(res.channels[1]); +}); + +pubnub.getState({ uuid: '' }, (status, res) => { + if (!status.error) { + console.log(res.channels[0]); + } +}); + +pubnub.getState({ uuid: '' }).then(res => { + console.log(res.channels[1]); +}); + +pubnub.setState({ channels: [] }, (status, res) => { + if (!status.error) { + console.log(res.state); + } +}); + +pubnub.setState({ channels: [] }).then(res => { + console.log(res.state); +}); diff --git a/types/pubnub/tsconfig.json b/types/pubnub/tsconfig.json index fab1a92335..17bf98f558 100644 --- a/types/pubnub/tsconfig.json +++ b/types/pubnub/tsconfig.json @@ -1,23 +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", - "pubnub-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pubnub-tests.ts" + ] +} \ No newline at end of file diff --git a/types/pulltorefreshjs/index.d.ts b/types/pulltorefreshjs/index.d.ts index 2eab5b6741..b28d840d7b 100644 --- a/types/pulltorefreshjs/index.d.ts +++ b/types/pulltorefreshjs/index.d.ts @@ -1,10 +1,15 @@ // Type definitions for pulltorefreshjs 0.1 // Project: https://github.com/BoxFactura/pulltorefresh.js // Definitions by: Daniel Rosenwasser +// Tamas Kinsztler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export function init(options?: Options): void; +export function destroyAll(): void; + +export function setPassiveMode(isPassive: boolean): void; + export interface Options { /** * Minimum distance required to trigger the refresh. @@ -108,6 +113,21 @@ export interface Options { * Defaults to `t => Math.min(1, t / 2.5)` */ resistanceFunction?(input: number): number; + + /** + * Which condition should be met for pullToRefresh to trigger? + * + * Defaults to `!window.scrollY` + */ + shouldPullToRefresh?(): boolean; + + /** + * This value will be passed as `{ passive: true|false }` to `touchmove` + * listeners if passive-handlers are supported. + * + * Defaults to `false` + */ + passive?: boolean; } /** diff --git a/types/pulltorefreshjs/pulltorefreshjs-tests.ts b/types/pulltorefreshjs/pulltorefreshjs-tests.ts index 47ca43a2e9..aa95cc3380 100644 --- a/types/pulltorefreshjs/pulltorefreshjs-tests.ts +++ b/types/pulltorefreshjs/pulltorefreshjs-tests.ts @@ -17,3 +17,9 @@ PullToRefresh.init({ mainElement: "body", onRefresh: () => Promise.resolve(), }); + +PullToRefresh.destroyAll(); + +PullToRefresh.setPassiveMode(true); + +PullToRefresh.setPassiveMode(false); diff --git a/types/pump/pump-tests.ts b/types/pump/pump-tests.ts index 0c8e91b2c0..cf3393de21 100644 --- a/types/pump/pump-tests.ts +++ b/types/pump/pump-tests.ts @@ -1,4 +1,4 @@ -import * as pump from 'pump'; +import pump = require('pump'); import { createReadStream, createWriteStream } from 'fs'; import { Transform } from 'stream'; diff --git a/types/pupa/tsconfig.json b/types/pupa/tsconfig.json index 3800bab180..9f7e0652f6 100644 --- a/types/pupa/tsconfig.json +++ b/types/pupa/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pupa-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index d0958706e9..0cce35fc95 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -1,13 +1,15 @@ -// Type definitions for puppeteer 0.13 +// Type definitions for puppeteer 1.0 // Project: https://github.com/GoogleChrome/puppeteer#readme // Definitions by: Marvin Hagemeister // Christopher Deutsch +// jwbay // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// import { EventEmitter } from "events"; +import { ChildProcess } from "child_process"; /** Keyboard provides an api for managing a virtual keyboard. */ export interface Keyboard { @@ -91,10 +93,16 @@ export interface Touchscreen { * You can use `tracing.start` and `tracing.stop` to create a trace file which can be opened in Chrome DevTools or timeline viewer. */ export interface Tracing { - start(options: { path: string; screenshots?: boolean }): Promise; + start(options: TracingStartOptions): Promise; stop(): Promise; } +export interface TracingStartOptions { + path: string; + screenshots?: boolean; + categories?: string[]; +} + /** Dialog objects are dispatched by page via the 'dialog' event. */ export interface Dialog { /** @@ -113,16 +121,16 @@ export interface Dialog { message(): string; /** The dialog type. Dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`. */ - type: "alert" | "beforeunload" | "confirm" | "prompt"; + type(): "alert" | "beforeunload" | "confirm" | "prompt"; } /** ConsoleMessage objects are dispatched by page via the 'console' event. */ export interface ConsoleMessage { /** The message arguments. */ - args: JSHandle[]; + args(): JSHandle[]; /** The message text. */ - text: string; - type: 'log' | 'debug' | 'info' | 'error' | 'warning' | 'dir' | 'dirxml' | 'table' | + text(): string; + type(): 'log' | 'debug' | 'info' | 'error' | 'warning' | 'dir' | 'dirxml' | 'table' | 'trace' | 'clear' | 'startGroup' | 'startGroupCollapsed' | 'endGroup' | 'assert' | 'profile' | 'profileEnd' | 'count' | 'timeEnd'; } @@ -302,6 +310,24 @@ export interface PDFOptions { * @default false */ displayHeaderFooter?: boolean; + /** + * HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: + * - `date` formatted print date + * - `title` document title + * - `url` document location + * - `pageNumber` current page number + * - `totalPages` total pages in the document + */ + headerTemplate?: string; + /** + * HTML template for the print footer. Should be valid HTML markup with following classes used to inject printing values into them: + * - `date` formatted print date + * - `title` document title + * - `url` document location + * - `pageNumber` current page number + * - `totalPages` total pages in the document + */ + footerTemplate?: string; /** * Print background graphics. * @default false @@ -418,6 +444,10 @@ export interface ElementHandle extends JSHandle { * @since 0.13.0 */ $$(selector: string): Promise; + /** + * @param selector XPath expression to evaluate. + */ + $x(expression: string): Promise; /** * This method returns the value resolve to the bounding box of the element (relative to the main frame), or null if the element is not visible. */ @@ -590,20 +620,25 @@ export interface Request { */ continue(overrides?: Overrides): Promise; + /** + * @returns The `Frame` object that initiated the request, or `null` if navigating to error pages + */ + frame(): Promise; + /** * An object with HTTP headers associated with the request. * All header names are lower-case. */ - headers: Headers; + headers(): Headers; /** Returns the request's method (GET, POST, etc.) */ - method: HttpMethod; + method(): HttpMethod; /** Contains the request's post body, if any. */ - postData: string | undefined; + postData(): string | undefined; /** Contains the request's resource type as it was perceived by the rendering engine. */ - resourceType: ResourceType; + resourceType(): ResourceType; /** * Fulfills request with given response. @@ -617,7 +652,7 @@ export interface Request { response(): Response | null; /** Contains the URL of the request. */ - url: string; + url(): string; } /** Options for `Request.respond` method */ export interface RespondOptions { @@ -639,22 +674,22 @@ export interface Response { /** Promise which resolves to a buffer with response body. */ buffer(): Promise; /** An object with HTTP headers associated with the response. All header names are lower-case. */ - headers: Headers; + headers(): Headers; /** * Promise which resolves to a JSON representation of response body. * @throws This method will throw if the response body is not parsable via `JSON.parse`. */ json(): Promise; /** Contains a boolean stating whether the response was successful (status in the range 200-299) or not. */ - ok: boolean; + ok(): boolean; /** A matching Request object. */ request(): Request; /** Contains the status code of the response (e.g., 200 for a success). */ - status: number; + status(): number; /** Promise which resolves to a text representation of response body. */ text(): Promise; /** Contains the URL of the response. */ - url: string; + url(): string; } export interface FrameBase { @@ -667,6 +702,10 @@ export interface FrameBase { * The method runs document.querySelectorAll within the page. If no elements match the selector, the return value resolve to []. */ $$(selector: string): Promise; + /** + * @param expression XPath expression to evaluate. + */ + $x(expression: string): Promise; /** * This method runs document.querySelector within the page and passes it as the first argument to `fn`. @@ -699,6 +738,9 @@ export interface FrameBase { /** Adds a `` tag into the page with the desired url or a ` + + `; + } +} + +customElements.define('with-context', WithContextRoot); +customElements.define('with-context-descendant', WithContextDescendant); + +// showcase of full component With context + +class WithContextRootFull extends Component<{}, {}, Context> { + context = { + background: 'white', + color: 'black', + margin: '10px 0', + padding: '10px' + }; + connectedCallback() { + this.attachShadow({ mode: 'open' }).innerHTML = ` + + + ...and shadow DOM! + + `; + } +} + +class WithContextDescendantFull extends Component<{}, {}, Context> { + connected() { + const { background, color, margin, padding } = this.context; + this.attachShadow({ mode: 'open' }).innerHTML = ` + + + `; + } +} diff --git a/types/skatejs/test/mixins/with-lifecycle.ts b/types/skatejs/test/mixins/with-lifecycle.ts new file mode 100644 index 0000000000..53dc7ed056 --- /dev/null +++ b/types/skatejs/test/mixins/with-lifecycle.ts @@ -0,0 +1,19 @@ +import { withLifecycle, WithLifecycle } from 'skatejs'; + +class Base extends HTMLElement { + protected _isConnected = false; + connectedCallback() { + this._isConnected = true; + } +} + +class WithLifecycleComponent extends withLifecycle(Base) { + connecting() { + this.innerHTML += this._isConnected ? 'ray!' : 'Hoo'; + } + connected() { + this.innerHTML += this._isConnected ? 'ray!' : 'Hoo'; + } +} + +customElements.define('with-lifecycle', WithLifecycleComponent); diff --git a/types/skatejs/test/mixins/with-renderer.ts b/types/skatejs/test/mixins/with-renderer.ts new file mode 100644 index 0000000000..fb74b0141a --- /dev/null +++ b/types/skatejs/test/mixins/with-renderer.ts @@ -0,0 +1,20 @@ +import { withRenderer, Renderer } from 'skatejs'; + +const myRenderer = (Base = HTMLElement) => + class extends Base implements Renderer { + renderer(root: Element | ShadowRoot, render: (props?: {}) => string) { + root.innerHTML = render(); + } + }; + +class WithRenderer extends withRenderer(myRenderer()) { + static observedAttributes = ['name']; + attributeChangedCallback() { + this.updated(); + } + render() { + return `Hello, ${this.getAttribute('name')}!`; + } +} + +customElements.define('with-renderer', WithRenderer); diff --git a/types/skatejs/test/mixins/with-update.ts b/types/skatejs/test/mixins/with-update.ts new file mode 100644 index 0000000000..2da35cffaa --- /dev/null +++ b/types/skatejs/test/mixins/with-update.ts @@ -0,0 +1,37 @@ +import { props, withUpdate } from 'skatejs'; + +// tslint:disable-next-line interface-over-type-literal +type Props = { name: string }; +// tslint:disable-next-line interface-over-type-literal +type State = undefined; + +class WithProps extends withUpdate() { + // This is where you declare your props. + static props = { + // This will define a handler for the name attribute that will set the name + // prop. When the name prop is set, it will trigger an update allowing you + // to react to the changes in shouldUpdate. + name: props.string + }; + + constructor() { + super(); + this.attachShadow({ mode: 'open' }); + } + + // Called when props have been set regardless of if they've changed. + updating(props: Props) {} + + // Called to check whether or not the component should call + // updated(), much like React's shouldComponentUpdate(). + shouldUpdate(props: Props, state: State) { + return true; + } + + // Called if shouldUpdate returned true. + updated() { + this.shadowRoot!.innerHTML = `Hey, ${this.props.name}!`; + } +} + +customElements.define('with-update', WithProps); diff --git a/types/skatejs/test/renderers/custom.ts b/types/skatejs/test/renderers/custom.ts new file mode 100644 index 0000000000..3704076616 --- /dev/null +++ b/types/skatejs/test/renderers/custom.ts @@ -0,0 +1,21 @@ +import { withComponent, Renderer, define } from 'skatejs'; + +const withRenderer = () => + class extends HTMLElement implements Renderer { + renderer(root: HTMLElement, html: () => Element): void { + root.innerHTML = ''; + root.appendChild(html()); + } + }; + +const Component = withComponent(withRenderer()); + +class MyComponent extends Component { + render() { + const el = document.createElement('div'); + el.innerHTML = 'Hello, !'; + return el; + } +} + +define(MyComponent); diff --git a/types/skatejs/test/renderers/default.ts b/types/skatejs/test/renderers/default.ts new file mode 100644 index 0000000000..3ec9828852 --- /dev/null +++ b/types/skatejs/test/renderers/default.ts @@ -0,0 +1,16 @@ +import { props, withComponent } from 'skatejs'; + +// tslint:disable-next-line interface-over-type-literal +type Props = { + name: string; +}; +class WithDefault extends withComponent() { + static props = { + name: props.string + }; + render({ name }: Props) { + return `Hello, ${name}!`; + } +} + +customElements.define('with-default', WithDefault); diff --git a/types/skatejs/test/utils/define.ts b/types/skatejs/test/utils/define.ts new file mode 100644 index 0000000000..038c25b231 --- /dev/null +++ b/types/skatejs/test/utils/define.ts @@ -0,0 +1,12 @@ +import { define } from 'skatejs'; + +export const MyComponent = define( + class extends HTMLElement { + static is = 'my-element'; + } +); + +@define +export default class extends HTMLElement { + static is = 'my-element'; +} diff --git a/types/skatejs/test/utils/emit.ts b/types/skatejs/test/utils/emit.ts new file mode 100644 index 0000000000..73c07a39c8 --- /dev/null +++ b/types/skatejs/test/utils/emit.ts @@ -0,0 +1,18 @@ +import { emit } from 'skatejs'; + +class Test extends HTMLElement { + constructor() { + super(); + this.attachShadow({ mode: 'open' }); + } + connectedCallback() { + emit(this, 'myevent', { + detail: {} + }); + + emit(this.shadowRoot!, 'myeventfromshadow', { + // Does not propagate through shadow boundaries by default, need to explicitly override to true + composed: true + }); + } +} diff --git a/types/skatejs/test/utils/link.ts b/types/skatejs/test/utils/link.ts new file mode 100644 index 0000000000..bf912b4d7a --- /dev/null +++ b/types/skatejs/test/utils/link.ts @@ -0,0 +1,34 @@ +import { link, withComponent } from 'skatejs'; + +// artificial definitions for 3rd party imports +// import { html } from 'lit-html/lib/lit-extended'; +declare const html: (...args: any[]) => string; +// import withLitHtml from '@skatejs/renderer-lit-html'; +declare const withLitHtml: () => any; + +// tslint:disable-next-line interface-over-type-literal +type Props = { + state: State; +}; +// tslint:disable-next-line interface-over-type-literal +type State = { + email: string; +}; +export default class extends withComponent(withLitHtml()) { + // this may look strange, but state is under the hood property of props :) + render({ state }: Props) { + return html` + + `; + } + private otherLinkUsage() { + link(this, 'state.customName'); + link(this, 'someProp'); + link(this, 'props.someProp'); + } +} diff --git a/types/skatejs/test/utils/name.ts b/types/skatejs/test/utils/name.ts new file mode 100644 index 0000000000..c85217b355 --- /dev/null +++ b/types/skatejs/test/utils/name.ts @@ -0,0 +1,16 @@ +import { name } from 'skatejs'; + +// x-element +name(); + +// x-element-1 +name(); + +// x-tabs +name('tabs'); + +// my-tabs +name('my-tabs'); + +// my-tabs-1 +name('my-tabs'); diff --git a/types/skatejs/test/utils/shadow.ts b/types/skatejs/test/utils/shadow.ts new file mode 100644 index 0000000000..e608b86225 --- /dev/null +++ b/types/skatejs/test/utils/shadow.ts @@ -0,0 +1,7 @@ +import { shadow } from 'skatejs'; + +class CustomElement extends HTMLElement { + connectedCallback() { + shadow(this).innerHTML = 'Hello, World!'; + } +} diff --git a/types/skatejs/tsconfig.json b/types/skatejs/tsconfig.json new file mode 100644 index 0000000000..9f4db47554 --- /dev/null +++ b/types/skatejs/tsconfig.json @@ -0,0 +1,42 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "strictNullChecks": true, + "strictFunctionTypes": false, + "noImplicitAny": true, + "noImplicitThis": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "experimentalDecorators": true + }, + "files": [ + "index.d.ts", + "test/components/custom-base.ts", + "test/components/no-shadow-root.ts", + "test/components/props-set-get.ts", + "test/components/with-custom-base.ts", + "test/mixins/with-children.ts", + "test/mixins/with-component.ts", + "test/mixins/with-context.ts", + "test/mixins/with-lifecycle.ts", + "test/mixins/with-renderer.ts", + "test/mixins/with-update.ts", + "test/renderers/custom.ts", + "test/renderers/default.ts", + "test/utils/define.ts", + "test/utils/emit.ts", + "test/utils/link.ts", + "test/utils/name.ts", + "test/utils/shadow.ts" + ] +} \ No newline at end of file diff --git a/types/skatejs/tslint.json b/types/skatejs/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/skatejs/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/skatejs/types.d.ts b/types/skatejs/types.d.ts new file mode 100644 index 0000000000..3c368bd67f --- /dev/null +++ b/types/skatejs/types.d.ts @@ -0,0 +1,112 @@ +export type Mixed = {}; +export type Maybe = T | null | undefined; +export type Constructor = new (...args: any[]) => T; +export type HTMLElementClass = typeof HTMLElement; + +export type ComponentProps = { [P in keyof T]: PropOptions }; + +// NOTE: +// - all classes are just ambient definitions (opaque types like), so consumer cannot use them directly +// - inferring generics work only on instances, not on implementation type. So this will not give you type safety, you still have to manually annotate those props in your code +/** + * Implement this interface for any @skatejs/renderer-* + */ +export interface Renderer { + renderer(root: Node | Element | ShadowRoot, html: (props?: Mixed, state?: Mixed) => O): void; +} + +export interface WithComponent

+ extends CustomElement, + WithChildren, + WithLifecycle, + WithRenderer, + WithUpdate, + WithContext {} + +export declare class WithComponent

extends HTMLElement { + static readonly observedAttributes: string[]; +} + +// Custom Elements v1 +export class CustomElement extends HTMLElement { + static readonly observedAttributes: string[]; + connectedCallback(): void; + disconnectedCallback(): void; + attributeChangedCallback(name: string, oldValue: null | string, newValue: null | string): void; + adoptedCallback?(): void; +} + +export declare class WithChildren extends HTMLElement { + childrenUpdated(): void; +} +export declare class WithLifecycle extends HTMLElement { + connecting(): void; + connected(): void; + disconnecting(): void; + disconnected(): void; +} + +export declare class WithContext extends HTMLElement { + context: C; +} + +export declare class WithRenderer extends HTMLElement implements Renderer { + // getter for turning of ShadowDOM + readonly renderRoot?: this | Mixed; + + updated(props?: Mixed, state?: Mixed): void; + // called before render + rendering?(): void; + render(props?: Mixed, state?: Mixed): O; + + // Default renderer, returns string returned from render and adds it to root via innerHTML + // -> override to get own renderer + renderer(root: Element | Node | ShadowRoot, html: (props?: Mixed | undefined) => O): void; + + // called after render + rendered?(): void; +} + +export declare class WithUpdate

extends HTMLElement { + // Special hack for own components type checking. + // It works in combination with ElementAttributesProperty. It placed in jsx.d.ts. + // more detail, see: https://www.typescriptlang.org/docs/handbook/jsx.html + // and https://github.com/skatejs/skatejs/pull/952#issuecomment-264500153 + readonly props: Readonly

; + state: S; + + // Called when props have been set regardless of if they've changed. much like React's componentWillReceiveProps(). + updating(props?: P, state?: S): void; + + // Called to check whether or not the component should call updated(), much like React's shouldComponentUpdate(). + shouldUpdate(props?: P, state?: S): boolean; + + // Called if shouldUpdate returned true, much like React's componentWillUpdate() + updated(props?: Mixed, state?: Mixed): void; + + // manually force update + triggerUpdate(): void; +} + +export interface PropOptions { + attribute?: PropOptionsAttribute; + coerce?: (value: any) => Maybe; + default?: T; + deserialize?: (value: string | null) => Maybe; + serialize?: (value: Maybe) => string | null; +} + +export type PropOptionsAttribute = PropOptionsAttributeIdentifier | PropOptionsAttributeIdentifierMap; +export type PropOptionsAttributeIdentifier = boolean | string; +export type PropOptionsAttributeIdentifierMap = { + source?: PropOptionsAttributeIdentifier; + target?: PropOptionsAttributeIdentifier; +}; + +export interface EventOptions extends CustomEventInit { + composed?: boolean; +} +export interface ComposedCustomEvent extends CustomEvent { + composed?: boolean; + composedPath?: () => Array; +} diff --git a/types/slack-node/slack-node-tests.ts b/types/slack-node/slack-node-tests.ts index b14029af19..d2dfc0541d 100644 --- a/types/slack-node/slack-node-tests.ts +++ b/types/slack-node/slack-node-tests.ts @@ -1,4 +1,4 @@ -import * as Slack from "slack-node"; +import Slack = require("slack-node"); let webhookUri = "__uri___"; diff --git a/types/slackdown/index.d.ts b/types/slackdown/index.d.ts new file mode 100644 index 0000000000..4086de7bf9 --- /dev/null +++ b/types/slackdown/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for slackdown 0.1 +// Project: https://github.com/blockmar/slackdown +// Definitions by: nju33 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function parse(text: string): string; diff --git a/types/slackdown/slackdown-tests.ts b/types/slackdown/slackdown-tests.ts new file mode 100644 index 0000000000..f04e88a218 --- /dev/null +++ b/types/slackdown/slackdown-tests.ts @@ -0,0 +1,3 @@ +import * as slackdown from 'slackdown'; + +slackdown.parse('xxx '); diff --git a/types/slackdown/tsconfig.json b/types/slackdown/tsconfig.json new file mode 100644 index 0000000000..0e630d9279 --- /dev/null +++ b/types/slackdown/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", + "slackdown-tests.ts" + ] +} diff --git a/types/slackdown/tslint.json b/types/slackdown/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/slackdown/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/slate-irc/slate-irc-tests.ts b/types/slate-irc/slate-irc-tests.ts index 3b1dd6bd3f..ce344ffa75 100644 --- a/types/slate-irc/slate-irc-tests.ts +++ b/types/slate-irc/slate-irc-tests.ts @@ -1,6 +1,5 @@ - import * as net from "net"; -import * as SlateIRC from "slate-irc"; +import SlateIRC = require("slate-irc"); let socket: net.Socket; const client = SlateIRC(socket); diff --git a/types/smtp-server/index.d.ts b/types/smtp-server/index.d.ts index 6e71373260..bbcee547e6 100644 --- a/types/smtp-server/index.d.ts +++ b/types/smtp-server/index.d.ts @@ -74,7 +74,11 @@ export interface SMTPServerSession { /** * the IP address for the connected client */ - remoteAddress: SMTPServerAddress; + remoteAddress: string; + /** + * port number the connected client + */ + remotePort: number; /** * reverse resolved hostname for remoteAddress */ @@ -91,6 +95,11 @@ export interface SMTPServerSession { * Envelope Object */ envelope: SMTPServerEnvelope; + /** + * If true, then the connection is using TLS + */ + secure: boolean; + transmissionType: string; tlsOptions: tls.TlsOptions; @@ -100,7 +109,7 @@ export interface SMTPServerEnvelope { /** * includes an address object or is set to false */ - mailFrom: SMTPServerAddress; + mailFrom: SMTPServerAddress | false; /** * includes an array of address objects */ diff --git a/types/smtp-server/smtp-server-tests.ts b/types/smtp-server/smtp-server-tests.ts index 29c05c942e..5be0634ebb 100644 --- a/types/smtp-server/smtp-server-tests.ts +++ b/types/smtp-server/smtp-server-tests.ts @@ -8,9 +8,10 @@ const options: SMTPServerOptions = { onRcptTo, onData, onClose, - port: 2525 }; +const port = 2525; + function onConnect(session: SMTPServerSession, callback: (err?: Error) => void): void { console.log(`[${session.id}] onConnect`); callback(); @@ -69,7 +70,7 @@ server.on('close', () => { console.log('Server closed'); }); -server.listen(options.port, () => { +server.listen(port, () => { const address = server.server.address(); console.log(`Listening on [${address.address}]:${address.port}`); }); diff --git a/types/snapsvg/index.d.ts b/types/snapsvg/index.d.ts index ff0e9d09a9..a3397cedaa 100644 --- a/types/snapsvg/index.d.ts +++ b/types/snapsvg/index.d.ts @@ -278,7 +278,7 @@ declare namespace Snap { ellipse(x:number,y:number,rx:number,ry:number):Snap.Element; image(src:string,x:number,y:number,width:number,height:number):Snap.Element; line(x1:number,y1:number,x2:number,y2:number):Snap.Element; - path(pathString?:string):Snap.Element; + path(pathSpec: string | (string | number)[][]): Snap.Element; polygon(varargs:any[]):Snap.Element; polyline(varargs:any[]):Snap.Element; rect(x:number,y:number,width:number,height:number,rx?:number,ry?:number):Snap.Element; diff --git a/types/snapsvg/test/3.ts b/types/snapsvg/test/3.ts index 70381001ca..a97caefa45 100644 --- a/types/snapsvg/test/3.ts +++ b/types/snapsvg/test/3.ts @@ -193,9 +193,9 @@ window.onload=()=>{ var myPathString = "M 60 0 L 120 0 L 180 60 L 180 120 L 120 180 L 60 180 L 0 120 L 0 60 Z"; var p = s.path( myPathString ); + s.path([["M", 5, 10], ["l", 15, 2], ["Z"]]); var p2 = s.path( myPathString ).transform("t" + myTranslateX + "," + myTranslateY); - for( var count = 0; count < 500; count++ ) { x = Math.random() * 800; y = Math.random() * 400; diff --git a/types/snekfetch/snekfetch-tests.ts b/types/snekfetch/snekfetch-tests.ts index 69e9743f83..211ef5bd80 100644 --- a/types/snekfetch/snekfetch-tests.ts +++ b/types/snekfetch/snekfetch-tests.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as util from 'util'; -import * as snekfetch from 'snekfetch'; +import snekfetch = require('snekfetch'); const writeFile = util.promisify(fs.writeFile); diff --git a/types/snoowrap/snoowrap-tests.ts b/types/snoowrap/snoowrap-tests.ts index dfea881a8b..afa9a46fa2 100644 --- a/types/snoowrap/snoowrap-tests.ts +++ b/types/snoowrap/snoowrap-tests.ts @@ -1,4 +1,4 @@ -import * as Snoowrap from 'snoowrap'; +import Snoowrap = require('snoowrap'); import { Comment, Listing, diff --git a/types/socket.io-redis/index.d.ts b/types/socket.io-redis/index.d.ts index d6e5edf92b..3de732084b 100644 --- a/types/socket.io-redis/index.d.ts +++ b/types/socket.io-redis/index.d.ts @@ -1,13 +1,14 @@ // Type definitions for socket.io-redis 1.0.0 // Project: https://github.com/socketio/socket.io-redis // Definitions by: Philipp Holzer +// seeLuck // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// declare module 'socket.io-redis' { - var redis: SocketIORedisStatic; + let redis: SocketIORedisStatic; export = redis; } @@ -60,6 +61,11 @@ declare namespace SocketIORedis { */ port?: number; + /** + * The optional password to connect to redis on + */ + auth_pass?: number | string; + /** * The optional redis client to publish events on */ @@ -131,16 +137,16 @@ declare namespace SocketIORedis { clients(callback: (err: any, clients: string[]) => void) : void; /** - * clientRooms returns the list of rooms the client with the given ID has joined + * clientRooms returns the list of rooms the client with the given ID has joined * (even on another node). - * @param {string} id - * @param {(err: any, rooms: string[]) => void} callback + * @param {string} id + * @param {(err: any, rooms: string[]) => void} callback */ clientRooms(id: string, callback: (err: any, rooms: string[]) => void) : void; /** * allRooms returns the list of all rooms. - * @param {(err: any, rooms: string[]) => void} callback + * @param {(err: any, rooms: string[]) => void} callback */ allRooms(callback: (err: any, rooms: string[]) => void) : void; @@ -150,7 +156,7 @@ declare namespace SocketIORedis { * err argument if the socket was not found. * @param {string} id the socket Id. * @param {string} room the room Id. - * @param {(err: any) => void} callback + * @param {(err: any) => void} callback */ remoteJoin(id: string, room: string, callback: (err: any) => void) : void; @@ -160,26 +166,26 @@ declare namespace SocketIORedis { * err argument if the socket was not found. * @param {string} id the socket Id. * @param {string} room the room Id. - * @param {(err: any) => void} callback + * @param {(err: any) => void} callback */ remoteLeave(id: string, room: string, callback: (err: any) => void) : void; /** - * remoteDisconnect makes the socket with the given id to get disconnected. - * If close is set to true, it also closes the underlying socket. - * The callback will be called once the socket was disconnected, or with an + * remoteDisconnect makes the socket with the given id to get disconnected. + * If close is set to true, it also closes the underlying socket. + * The callback will be called once the socket was disconnected, or with an * err argument if the socket was not found. * @param {string} id the socket Id. * @param {boolean} close close the underlying socket - * @param {(err: any) => void} callback + * @param {(err: any) => void} callback */ remoteDisconnect(id: string, close: boolean, callback: (err: any) => void) : void; /** - * customRequest sends a request to every nodes, that will respond through the + * customRequest sends a request to every nodes, that will respond through the * customHook method. * @param {any} data - * @param {(err: any, replies: any[]) => void} callback + * @param {(err: any, replies: any[]) => void} callback */ customRequest(data: any, callback: (err: any, replies: any[]) => void) : void; } diff --git a/types/socketio-jwt-auth/index.d.ts b/types/socketio-jwt-auth/index.d.ts new file mode 100644 index 0000000000..7898f67454 --- /dev/null +++ b/types/socketio-jwt-auth/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for socketio-jwt-auth 0.0 +// Project: https://github.com/adcentury/socketio-jwt-auth#readme +// Definitions by: Peter Harris +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import SocketIO = require("socket.io"); + +/** + * This function returns a middleware function for use with Socket.IO that authenticates a new connection. + * + * @param options is an object literal that contains options. + * @param verify is a function with two args payload, and done. + */ +export function authenticate(options: authOptions, verify: verifyFunc): (socket: SocketIO.Socket, fn: (err?: any) => void) => void; + +/** + * This is an object literal that contains options. + */ +export interface authOptions { + secret: string; + algorithm?: string; + succeedWithoutToken?: boolean; +} + +/** + * This is a function with two args payload, and done. + * + * `payload` is the decoded JWT payload + * `done` is an error-first callback with three args: done(err, user, message). + */ +export type verifyFunc = (payload: any, done: (err?: Error | null, user?: any, message?: string) => void) => void; diff --git a/types/socketio-jwt-auth/socketio-jwt-auth-tests.ts b/types/socketio-jwt-auth/socketio-jwt-auth-tests.ts new file mode 100644 index 0000000000..b88020e85f --- /dev/null +++ b/types/socketio-jwt-auth/socketio-jwt-auth-tests.ts @@ -0,0 +1,41 @@ +import SocketIo = require('socket.io'); +import jwtAuth = require('socketio-jwt-auth'); + +const io = SocketIo(); +const User: { + findOne: (options: { id: number }, callback: (err: Error, user: any) => void) => void +} = {}; + +// using middleware +io.use(jwtAuth.authenticate({ + secret: 'Your Secret', // required, used to verify the token's signature + algorithm: 'HS256', // optional, default to be HS256 + succeedWithoutToken: true +}, (payload: any, done) => { + // you done callback will not include any payload data now + // if no token was supplied + if (payload && payload.sub) { + User.findOne({id: payload.sub}, (err, user) => { + if (err) { + // return error + done(err); + + return; + } + if (!user) { + // return fail with an error message + done(null, false, 'user does not exist'); + + return; + } + // return success with a user info + done(null, user); + + return; + }); + } else { + done(); // in your connection handler user.logged_in will be false + + return; + } +})); diff --git a/types/socketio-jwt-auth/tsconfig.json b/types/socketio-jwt-auth/tsconfig.json new file mode 100644 index 0000000000..d9d832b68e --- /dev/null +++ b/types/socketio-jwt-auth/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "socketio-jwt-auth-tests.ts" + ] +} \ No newline at end of file diff --git a/types/socketio-jwt-auth/tslint.json b/types/socketio-jwt-auth/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/socketio-jwt-auth/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/sort-array/tsconfig.json b/types/sort-array/tsconfig.json index 935747c5e6..dcd496828f 100644 --- a/types/sort-array/tsconfig.json +++ b/types/sort-array/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "sort-array-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/soupbintcp/index.d.ts b/types/soupbintcp/index.d.ts new file mode 100644 index 0000000000..d5ca4146c7 --- /dev/null +++ b/types/soupbintcp/index.d.ts @@ -0,0 +1,110 @@ +// Type definitions for soupbintcp 0.2 +// Project: https://github.com/jvirtanen/node-soupbintcp#readme +// Definitions by: Vilim Stubičan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// + +export as namespace soupbintcp; + +import { EventEmitter } from 'events'; +import { Socket } from "net"; + +export class Client extends EventEmitter { + constructor(options: { port: number, host: string }, callback?: () => void); + + login(payload: LoginRequestPayload, callback?: (data?: any) => void): void; + + logout(callback?: (data?: any) => void): void; + + send(payload: any, callback?: (data?: any) => void): void; + + end(): void; +} + +export interface ConnectionOptions { + rxTimeoutMillis?: number; + txIntervalMillis?: number; + heartbeatPacketType: PacketType; + keepAliveMillis?: number; +} + +export class Connection extends EventEmitter { + constructor(socket: Socket, options: ConnectionOptions); + + send(packetType: PacketType, payload: any, callback?: (data?: any) => void): void; + + end(): void; +} + +export enum PacketType { + DEBUG = 0x2b, // + + + LOGIN_ACCEPTED = 0x41, // A + LOGIN_REJECTED = 0x4a, // J + SEQUENCED_DATA = 0x53, // S + SERVER_HEARTBEAT = 0x48, // H + END_OF_SESSION = 0x5a, // Z + + LOGIN_REQUEST = 0x4c, // L + UNSEQUENCED_DATA = 0x55, // U + CLIENT_HEARTBEAT = 0x52, // R + LOGOUT_REQUEST = 0x4f // O +} + +export interface LoginRequestPayload { + username: string; + password: string; + requestedSession: string; + requestedSequenceNumber: number; +} + +export function formatLoginRequest(payload: LoginRequestPayload): Buffer; + +export function parseLoginRequest(payload: Buffer): LoginRequestPayload; + +export interface LoginAcceptedPayload { + username: string; + sequenceNumber: number; +} + +export function formatLoginAccepted(payload: LoginAcceptedPayload): Buffer; + +export function parseLoginAccepted(payload: Buffer): LoginAcceptedPayload; + +export interface LoginRejectedPayload { + rejectReasonCode: string; +} + +export function formatLoginRejected(payload: LoginRejectedPayload): Buffer; + +export function parseLoginRejected(payload: Buffer): LoginRejectedPayload; + +export class Parser { + constructor(callback: (packetType: PacketType, payload: Buffer) => void); + + parse(data: Buffer): void; +} + +export class Server extends EventEmitter { + constructor(options: { port: number, host: string }, callback?: (data?: any) => void); + + address(): { port: number; family: string; address: string; }; + + close(callback: () => void): void; +} + +export class Session extends EventEmitter { + constructor(socket: Socket); + + accept(payload: LoginAcceptedPayload, callback?: (data?: any) => void): void; + + reject(payload: LoginRejectedPayload, callback?: (data?: any) => void): void; + + send(payload: any, callback?: (data?: any) => void): void; + + ending(callback?: (data?: any) => void): void; + + end(): void; +} diff --git a/types/soupbintcp/soupbintcp-tests.ts b/types/soupbintcp/soupbintcp-tests.ts new file mode 100644 index 0000000000..1ad62a8d11 --- /dev/null +++ b/types/soupbintcp/soupbintcp-tests.ts @@ -0,0 +1,77 @@ +import { Client, Server } from 'soupbintcp'; + +// Arrange +const client = new Client({port: 8000, host: ''}); +const server = new Server({port: 8000, host: ''}); + +// Act & Assert +// $ExpectType Client +new Client({port: 8000, host: ''}); + +// $ExpectType Server +new Server({port: 8000, host: ''}); + +// Invalid type +// $ExpectError +new Client({host: ''}); +// Invalid type + +// $ExpectError +new Client({host: 8000}); + +// $ExpectError +new Client({port: ''}); + +// $ExpectError +new Client({port: 8000}); + +// $ExpectError +new Client(); + +// Invalid type +// $ExpectError +new Server({host: ''}); +// Invalid type + +// $ExpectError +new Server({host: 8000}); + +// $ExpectError +new Server({port: ''}); + +// $ExpectError +new Server({port: 8000}); + +// $ExpectError +new Server(); + +// $ExpectError +client.login({ + password: '', + requestedSession: '', + requestedSequenceNumber: 8000 +}); + +// $ExpectError +client.login({ + username: '', + requestedSession: '', + requestedSequenceNumber: 8000 +}); + +// $ExpectError +client.login({ + username: '', + password: '', + requestedSequenceNumber: 8000 +}); + +// $ExpectError +client.login({ + username: '', + password: '', + requestedSession: '', +}); + +// $ExpectError +client.login(); diff --git a/types/soupbintcp/tsconfig.json b/types/soupbintcp/tsconfig.json new file mode 100644 index 0000000000..e934988e2b --- /dev/null +++ b/types/soupbintcp/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", + "soupbintcp-tests.ts" + ] +} \ No newline at end of file diff --git a/types/soupbintcp/tslint.json b/types/soupbintcp/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/soupbintcp/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/spark-md5/spark-md5-tests.ts b/types/spark-md5/spark-md5-tests.ts index bc81f715f1..0a6c929a29 100644 --- a/types/spark-md5/spark-md5-tests.ts +++ b/types/spark-md5/spark-md5-tests.ts @@ -1,4 +1,4 @@ -import * as SparkMD5 from "spark-md5"; +import SparkMD5 = require("spark-md5"); SparkMD5.hash('Hi there'); SparkMD5.hash('Hi there', true); diff --git a/types/sparkpost/sparkpost-tests.ts b/types/sparkpost/sparkpost-tests.ts index d15208bcb5..26a2ebda3a 100644 --- a/types/sparkpost/sparkpost-tests.ts +++ b/types/sparkpost/sparkpost-tests.ts @@ -1,4 +1,4 @@ -import * as SparkPost from "sparkpost"; +import SparkPost = require("sparkpost"); const key = "YOURAPIKEY"; const client = new SparkPost(key); diff --git a/types/sparkpost/v1/sparkpost-tests.ts b/types/sparkpost/v1/sparkpost-tests.ts index 0b8a41ab0a..6a2ac71acc 100644 --- a/types/sparkpost/v1/sparkpost-tests.ts +++ b/types/sparkpost/v1/sparkpost-tests.ts @@ -1,4 +1,4 @@ -import * as SparkPost from "sparkpost"; +import SparkPost = require("sparkpost"); let key = "YOURAPIKEY"; let client = new SparkPost(key); diff --git a/types/spdx-correct/tsconfig.json b/types/spdx-correct/tsconfig.json index a7c8604db7..4daa583e23 100644 --- a/types/spdx-correct/tsconfig.json +++ b/types/spdx-correct/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "spdx-correct-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/spdx-satisfies/tsconfig.json b/types/spdx-satisfies/tsconfig.json index 7aff811650..d1d82811e2 100644 --- a/types/spdx-satisfies/tsconfig.json +++ b/types/spdx-satisfies/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "spdx-satisfies-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/spectacle/index.d.ts b/types/spectacle/index.d.ts index 41f0d1df79..cabd6cf5a1 100644 --- a/types/spectacle/index.d.ts +++ b/types/spectacle/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/FormidableLabs/victory // Definitions by: Zachary Maybury // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/split2/split2-tests.ts b/types/split2/split2-tests.ts index 35d0b58684..0d4052742b 100644 --- a/types/split2/split2-tests.ts +++ b/types/split2/split2-tests.ts @@ -1,4 +1,4 @@ -import * as split from 'split2'; +import split = require('split2'); import * as fs from 'fs'; import { Transform, TransformOptions } from 'stream'; diff --git a/types/spotify-web-playback-sdk/index.d.ts b/types/spotify-web-playback-sdk/index.d.ts index 95d8375b56..ee3086e40e 100644 --- a/types/spotify-web-playback-sdk/index.d.ts +++ b/types/spotify-web-playback-sdk/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for spotify-web-playback-sdk 0.1 // Project: https://beta.developer.spotify.com/documentation/web-playback-sdk/reference/ // Definitions by: Festify Dev Team +// Marcus Weiner +// Moritz Gunz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface Window { @@ -86,6 +88,10 @@ declare namespace Spotify { FULL_REPEAT = 2, } + type ErrorListener = (err: Error) => void; + type PlaybackInstanceListener = (inst: WebPlaybackInstance) => void; + type PlaybackStateListener = (s: PlaybackState) => void; + class SpotifyPlayer { constructor(options: PlayerInit); @@ -95,9 +101,17 @@ declare namespace Spotify { getVolume(): Promise; nextTrack(): Promise; - on(event: 'ready', cb: (pb: WebPlaybackInstance) => void): void; - on(event: 'player_state_changed', cb: (pb: PlaybackState) => void): void; - on(event: ErrorTypes, cb: (err: Error) => void): void; + addListener(event: 'ready', cb: PlaybackInstanceListener): void; + addListener(event: 'player_state_changed', cb: PlaybackStateListener): void; + addListener(event: ErrorTypes, cb: ErrorListener): void; + on(event: 'ready', cb: PlaybackInstanceListener): void; + on(event: 'player_state_changed', cb: PlaybackStateListener): void; + on(event: ErrorTypes, cb: ErrorListener): void; + + removeListener( + event: 'ready' | 'player_state_changed' | ErrorTypes, + cb?: ErrorListener | PlaybackInstanceListener | PlaybackStateListener, + ): void; pause(): Promise; previousTrack(): Promise; diff --git a/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts b/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts index afb82ef994..8f2c27f33d 100644 --- a/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts +++ b/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts @@ -5,14 +5,14 @@ const player = new Spotify.Player({ name: "Carly Rae Jepsen Player", - getOAuthToken: (callback) => { + getOAuthToken: (callback: (t: string) => void) => { // Run code to get a fresh access token callback("access token here"); }, volume: 0.5 }); -player.connect().then((success) => { +player.connect().then((success: boolean) => { if (success) { console.log("The Web Playback SDK successfully connected to Spotify!"); } @@ -20,11 +20,11 @@ player.connect().then((success) => { player.disconnect(); -player.on("ready", (data) => { +player.addListener("ready", (data) => { console.log("The Web Playback SDK is ready to play music!"); }); -player.getCurrentState().then((playbackState) => { +player.getCurrentState().then((playbackState: Spotify.PlaybackState | null) => { if (playbackState) { const { current_track, next_tracks } = playbackState.track_window; @@ -35,7 +35,7 @@ player.getCurrentState().then((playbackState) => { } }); -player.getVolume().then((volume) => { +player.getVolume().then((volume: number) => { const volume_percentage = (volume * 100); console.log(`The volume of the player is ${volume_percentage}%`); }); @@ -68,12 +68,12 @@ player.nextTrack().then(() => { console.log("Skipped to next track!"); }); -player.on("ready", (data) => { +player.on("ready", (data: Spotify.WebPlaybackInstance) => { const { device_id } = data; console.log("Connected with Device ID", device_id); }); -player.on("player_state_changed", (playbackState) => { +player.on("player_state_changed", (playbackState: Spotify.PlaybackState) => { const { position, duration } = playbackState; const { current_track } = playbackState.track_window; @@ -82,18 +82,24 @@ player.on("player_state_changed", (playbackState) => { console.log("Duration of Song", duration); }); -player.on('initialization_error', (e) => { +player.addListener('initialization_error', (e: Spotify.Error) => { console.error("Failed to initialize", e.message); }); -player.on('authentication_error', (e) => { +player.addListener('authentication_error', (e: Spotify.Error) => { console.error("Failed to authenticate", e.message); }); -player.on('account_error', (e) => { +player.addListener('account_error', (e: Spotify.Error) => { console.error("Failed to validate Spotify account", e.message); }); -player.on('playback_error', (e) => { +const listener = (e: Spotify.Error) => { console.error("Failed to perform playback", e.message); -}); +}; +player.addListener('playback_error', listener); +player.addListener('playback_error', () => {}); +player.removeListener('playback_error', () => {}); + +player.removeListener('playback_error'); +player.removeListener('playback_error', listener); diff --git a/types/spotify-web-playback-sdk/tsconfig.json b/types/spotify-web-playback-sdk/tsconfig.json index c6b3dd1448..b742fcb876 100644 --- a/types/spotify-web-playback-sdk/tsconfig.json +++ b/types/spotify-web-playback-sdk/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "spotify-web-playback-sdk-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/sqs-consumer/index.d.ts b/types/sqs-consumer/index.d.ts index 73da1ff980..d333ed5fca 100644 --- a/types/sqs-consumer/index.d.ts +++ b/types/sqs-consumer/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for sqs-consumer 3.7 +// Type definitions for sqs-consumer 3.8 // Project: https://github.com/BBC/sqs-consumer // Definitions by: Daniel Chao // Eric Byers @@ -19,6 +19,7 @@ declare namespace Consumer { messageAttributeNames?: string[]; batchSize?: number; visibilityTimeout?: number; + terminateVisibilityTimeout?: boolean; waitTimeSeconds?: number; authenticationErrorTimeout?: number; sqs?: SQS; diff --git a/types/sqs-consumer/sqs-consumer-tests.ts b/types/sqs-consumer/sqs-consumer-tests.ts index f22e75b523..c097ce5644 100644 --- a/types/sqs-consumer/sqs-consumer-tests.ts +++ b/types/sqs-consumer/sqs-consumer-tests.ts @@ -17,7 +17,8 @@ const app2 = Consumer.create({ region: "us-west-1", batchSize: 15, visibilityTimeout: 50, - waitTimeSeconds: 50 + waitTimeSeconds: 50, + terminateVisibilityTimeout: true }); // Test message handler. diff --git a/types/ssh2-sftp-client/index.d.ts b/types/ssh2-sftp-client/index.d.ts index a91725d7a4..a0133961d8 100644 --- a/types/ssh2-sftp-client/index.d.ts +++ b/types/ssh2-sftp-client/index.d.ts @@ -10,7 +10,7 @@ export = sftp; declare class sftp { connect(options: ssh2.ConnectConfig): Promise; list(remoteFilePath: string): Promise; - get(remoteFilePath: string, useCompression?: boolean, encoding?: string): Promise; + get(remoteFilePath: string, useCompression?: boolean, encoding?: string | null): Promise; put(input: string | Buffer | NodeJS.ReadableStream, remoteFilePath: string, useCompression?: boolean, encoding?: string): Promise; mkdir(remoteFilePath: string, recursive?: boolean): Promise; rmdir(remoteFilePath: string, recursive?: boolean): Promise; diff --git a/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts b/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts index ec64afe698..67d2d35826 100644 --- a/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts +++ b/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts @@ -1,4 +1,4 @@ -import * as Client from 'ssh2-sftp-client'; +import Client = require('ssh2-sftp-client'); import * as fs from 'fs'; const client = new Client(); @@ -12,7 +12,8 @@ client.connect({ client.list('/remote/path').then(() => null); client.get('/remote/path').then(stream => stream.read(0)); -client.get('/remote/path', true, 'binary').then(stream => stream.read(0)); +client.get('/remote/path', true, 'utf8').then(stream => stream.read(0)); +client.get('/remote/path', true, null).then(stream => stream.read(0)); client.put('/local/path', '/remote/path').then(() => null); client.put(new Buffer('content'), '/remote/path').then(() => null); diff --git a/types/ssh2-sftp-client/tsconfig.json b/types/ssh2-sftp-client/tsconfig.json index 809639cd51..d714a8d1b4 100644 --- a/types/ssh2-sftp-client/tsconfig.json +++ b/types/ssh2-sftp-client/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/stale-lru-cache/stale-lru-cache-tests.ts b/types/stale-lru-cache/stale-lru-cache-tests.ts index 8d3c47562f..4b597f545d 100644 --- a/types/stale-lru-cache/stale-lru-cache-tests.ts +++ b/types/stale-lru-cache/stale-lru-cache-tests.ts @@ -1,4 +1,4 @@ -import * as Cache from 'stale-lru-cache'; +import Cache = require('stale-lru-cache'); const cache = new Cache({ maxSize: 100, diff --git a/types/std-mocks/index.d.ts b/types/std-mocks/index.d.ts new file mode 100644 index 0000000000..2c9a25e8c2 --- /dev/null +++ b/types/std-mocks/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for std-mocks 1.0 +// Project: https://github.com/neoziro/std-mocks#readme +// Definitions by: Jeff Dickey +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface Options { + stdout?: boolean; + stderr?: boolean; +} + +/** + * Start mocking std output + */ +export function use(opts?: Options & {print?: boolean}): void; + +/** + * Restore std output + */ +export function restore(opts?: Options): void; + +/** + * Flush collected output + */ +export function flush(opts: Options & {stdout: false, stderr: false}): {}; +export function flush(opts: Options & {stderr: false}): {stdout: string[]}; +export function flush(opts: Options & {stdout: false}): {stderr: string[]}; +export function flush(opts?: Options): {stdout: string[], stderr: string[]}; diff --git a/types/std-mocks/std-mocks-tests.ts b/types/std-mocks/std-mocks-tests.ts new file mode 100644 index 0000000000..72b39ebc41 --- /dev/null +++ b/types/std-mocks/std-mocks-tests.ts @@ -0,0 +1,14 @@ +import * as stdMocks from 'std-mocks'; + +stdMocks.use(); +stdMocks.use({print: false}); +stdMocks.use({stdout: false}); +stdMocks.use({stderr: false}); + +stdMocks.restore(); +stdMocks.restore({stdout: false}); +stdMocks.restore({stderr: false}); + +stdMocks.flush(); +stdMocks.flush({stdout: false}).stderr; +stdMocks.flush({stdout: false}).stdout; // $ExpectError diff --git a/types/std-mocks/tsconfig.json b/types/std-mocks/tsconfig.json new file mode 100644 index 0000000000..73ed32806c --- /dev/null +++ b/types/std-mocks/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", + "std-mocks-tests.ts" + ] +} \ No newline at end of file diff --git a/types/std-mocks/tslint.json b/types/std-mocks/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/std-mocks/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/stemmer/index.d.ts b/types/stemmer/index.d.ts index 60bcf6ae22..b42026cac1 100644 --- a/types/stemmer/index.d.ts +++ b/types/stemmer/index.d.ts @@ -5,4 +5,6 @@ declare function stemmer(value: string): string; +declare namespace stemmer {} + export = stemmer; diff --git a/types/stemmer/tsconfig.json b/types/stemmer/tsconfig.json index 7224a39eb8..f6a1494f12 100644 --- a/types/stemmer/tsconfig.json +++ b/types/stemmer/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "stemmer-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/sticky-cluster/sticky-cluster-tests.ts b/types/sticky-cluster/sticky-cluster-tests.ts index e730275d78..720e8d001a 100644 --- a/types/sticky-cluster/sticky-cluster-tests.ts +++ b/types/sticky-cluster/sticky-cluster-tests.ts @@ -1,5 +1,5 @@ import stickyCluster = require('sticky-cluster'); -import * as express from 'express'; +import express = require('express'); import * as http from 'http'; /** test with all params */ diff --git a/types/sticky-cluster/tsconfig.json b/types/sticky-cluster/tsconfig.json index dcfc338f93..189e887431 100644 --- a/types/sticky-cluster/tsconfig.json +++ b/types/sticky-cluster/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "sticky-cluster-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/stompjs/index.d.ts b/types/stompjs/index.d.ts index 008b99b511..91d5277fba 100644 --- a/types/stompjs/index.d.ts +++ b/types/stompjs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for stompjs 2.3 // Project: https://github.com/jmesnil/stomp-websocket -// Definitions by: Jimi Charalampidis +// Definitions by: Jimi Charalampidis , Stefan Erichsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -13,7 +13,6 @@ export const VERSIONS: { }; export class Client { - connected: boolean; counter: number; heartbeat: { @@ -27,6 +26,7 @@ export class Client { debug(...args: string[]): any; connect(headers: { login: string, passcode: string, host?: string }, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any): any; + connect(headers: { }, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any): any; connect(login: string, passcode: string, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any, host?: string): any; disconnect(disconnectCallback: () => any, headers?: {}): any; @@ -51,13 +51,18 @@ export interface Message { nack(headers?: {}): any; } -export class Frame { +export class Frame implements Message { + command: string; + headers: {}; + body: string; constructor(command: string, headers?: {}, body?: string); + ack(headers?: {}): any; + nack(headers?: {}): any; toString(): string; - sizeOfUTF8(s: string): number; - unmarshall(datas: any): any; - marshall(command: string, headers?: {}, body?: string): any; + static sizeOfUTF8(s: string): number; + static unmarshall(datas: any): any; + static marshall(command: string, headers?: {}, body?: string): any; } export function client(url: string, protocols?: string | Array): Client; diff --git a/types/stompjs/stompjs-tests.ts b/types/stompjs/stompjs-tests.ts index 15331fc81f..fcc0c46ff5 100644 --- a/types/stompjs/stompjs-tests.ts +++ b/types/stompjs/stompjs-tests.ts @@ -43,6 +43,16 @@ client.connect('user', 'pass', () => { }, (error) => { }); client.connect('user', 'pass', () => { }, (error) => { }, 'host'); client.connect('user', 'pass', (frame) => { }, (error) => { }); client.connect('user', 'pass', (frame) => { }, (error) => { }, 'host'); +client.connect('user', 'pass', (frame) => { + if (!!frame) { + frame.command; + } + }, (error) => { }, 'host'); + +client.connect({}, () => { }); +client.connect({}, () => { }, () => { }); +client.connect({}, () => { }, (error) => { }); +client.connect({}, (frame) => { }, (error) => { }); client.disconnect(() => { }); client.disconnect(() => { }, {}); @@ -88,13 +98,13 @@ frame = new Stomp.Frame('command', {}, 'body'); frame.toString(); -frame.sizeOfUTF8('abc'); +Stomp.Frame.sizeOfUTF8('abc'); -frame.unmarshall(0); -frame.unmarshall('data'); -frame.unmarshall({}); -frame.unmarshall([{}, {}]); +Stomp.Frame.unmarshall(0); +Stomp.Frame.unmarshall('data'); +Stomp.Frame.unmarshall({}); +Stomp.Frame.unmarshall([{}, {}]); -frame.marshall('command'); -frame.marshall('command', {}); -frame.marshall('command', {}, 'body'); +Stomp.Frame.marshall('command'); +Stomp.Frame.marshall('command', {}); +Stomp.Frame.marshall('command', {}, 'body'); diff --git a/types/storejs/index.d.ts b/types/storejs/index.d.ts index bc41120c60..0a677c0ecf 100644 --- a/types/storejs/index.d.ts +++ b/types/storejs/index.d.ts @@ -8,7 +8,7 @@ interface StoreJsAPI { readonly version: string; - readonly enabled: string; + readonly enabled: boolean; get(key: string, optionalDefaultValue?: any): any; set(key: string, value: any): any; remove(key: string): void; diff --git a/types/storejs/storejs-tests.ts b/types/storejs/storejs-tests.ts index 03c3769f9b..802f3dd40e 100644 --- a/types/storejs/storejs-tests.ts +++ b/types/storejs/storejs-tests.ts @@ -2,6 +2,9 @@ import * as store from 'store'; import * as engine from 'store/src/store-engine'; +// https://github.com/marcuswestin/store.js/blob/master/README-More.md#storeenabled-flag +console.log('storage is supported: ', store.enabled === true); + // https://github.com/marcuswestin/store.js/#api // Store current user diff --git a/types/storybook__addon-a11y/index.d.ts b/types/storybook__addon-a11y/index.d.ts new file mode 100644 index 0000000000..c29f546b6f --- /dev/null +++ b/types/storybook__addon-a11y/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for @storybook/addon-a11y 3.3 +// Project: https://github.com/storybooks/storybook +// Definitions by: HyunSeob +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import { StoryDecorator } from '@storybook/react'; + +export const checkA11y: StoryDecorator; diff --git a/types/storybook__addon-a11y/storybook__addon-a11y-tests.tsx b/types/storybook__addon-a11y/storybook__addon-a11y-tests.tsx new file mode 100644 index 0000000000..4e60455618 --- /dev/null +++ b/types/storybook__addon-a11y/storybook__addon-a11y-tests.tsx @@ -0,0 +1,11 @@ +import * as React from 'react'; +import { storiesOf } from '@storybook/react'; +import { checkA11y } from '@storybook/addon-a11y'; + +storiesOf('button', module) + .addDecorator(checkA11y) + .add('Accessible', () => ( + + )); diff --git a/types/storybook__addon-a11y/tsconfig.json b/types/storybook__addon-a11y/tsconfig.json new file mode 100644 index 0000000000..c37bd5436c --- /dev/null +++ b/types/storybook__addon-a11y/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "paths": { + "@storybook/addon-a11y": [ + "storybook__addon-a11y" + ], + "@storybook/react": [ + "storybook__react" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "storybook__addon-a11y-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/storybook__addon-a11y/tslint.json b/types/storybook__addon-a11y/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/storybook__addon-a11y/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/storybook__addon-actions/index.d.ts b/types/storybook__addon-actions/index.d.ts index 01c3b4837d..9b7009fbad 100644 --- a/types/storybook__addon-actions/index.d.ts +++ b/types/storybook__addon-actions/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/storybooks/storybook // Definitions by: Joscha Feth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 export type HandlerFunction = (...args: any[]) => undefined; export type DecoratorFunction = (args: any[]) => any[]; diff --git a/types/storybook__addon-info/index.d.ts b/types/storybook__addon-info/index.d.ts index c42c8d359a..f694ad3eb4 100644 --- a/types/storybook__addon-info/index.d.ts +++ b/types/storybook__addon-info/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Mark Kornblum // Mattias Wikstrom // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from 'react'; import { RenderFunction } from '@storybook/react'; diff --git a/types/storybook__addon-info/tsconfig.json b/types/storybook__addon-info/tsconfig.json index 87d702ce2b..ad08c9163b 100644 --- a/types/storybook__addon-info/tsconfig.json +++ b/types/storybook__addon-info/tsconfig.json @@ -29,4 +29,4 @@ "index.d.ts", "storybook__addon-info-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/storybook__addon-knobs/index.d.ts b/types/storybook__addon-knobs/index.d.ts index c2f8c954ec..4125f10b84 100644 --- a/types/storybook__addon-knobs/index.d.ts +++ b/types/storybook__addon-knobs/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Joscha Feth // Martynas Kadisa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { RenderFunction } from '@storybook/react'; @@ -46,6 +46,8 @@ export function date(name: string, value?: Date): Date; export function array(name: string, value: T[], separator?: string): T[]; +export function button(name: string, handler: () => any): void; + export interface WrapStoryProps { context?: object; storyFn?: RenderFunction; diff --git a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx index 9e1c1dbd6b..18d8d0a29e 100644 --- a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx +++ b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx @@ -11,6 +11,7 @@ import { select, date, array, + button, knob, } from '@storybook/addon-knobs'; @@ -58,6 +59,8 @@ stories.add('with all knobs', () => { const genericKnob: X = knob('Some generic knob', { value: 'a', type: 'text' }); + button('Some button', () => console.log('Button knob clicked')); + const style = { ...customStyle, fontWeight: bold ? 800 as 800 : 400 as 400, // tslint:disable-line no-unnecessary-type-assertion diff --git a/types/storybook__addon-links/index.d.ts b/types/storybook__addon-links/index.d.ts index 08f3648855..72ec6aa296 100644 --- a/types/storybook__addon-links/index.d.ts +++ b/types/storybook__addon-links/index.d.ts @@ -1,11 +1,14 @@ -// Type definitions for @storybook/addon-links 3.0 +// Type definitions for @storybook/addon-links 3.3 // Project: https://github.com/storybooks/storybook -// Definitions by: Joscha Feth +// Definitions by: Joscha Feth , +// Jesse Pinho // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; export type LinkToFunction = (...args: any[]) => string; export function linkTo(book: string | LinkToFunction, kind?: string | LinkToFunction): React.MouseEventHandler; + +export function hrefTo(kind: string, story: string): Promise; diff --git a/types/storybook__addon-links/storybook__addon-links-tests.tsx b/types/storybook__addon-links/storybook__addon-links-tests.tsx index 2f138daf20..e922b0fc00 100644 --- a/types/storybook__addon-links/storybook__addon-links-tests.tsx +++ b/types/storybook__addon-links/storybook__addon-links-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; -import { linkTo } from '@storybook/addon-links'; +import { hrefTo, linkTo } from '@storybook/addon-links'; storiesOf('Button', module) .add('First', () => ( @@ -12,3 +12,5 @@ storiesOf('Button', module) .add('With function', () => ( )); + +hrefTo('Button', 'First').then(link => link); diff --git a/types/storybook__addon-notes/index.d.ts b/types/storybook__addon-notes/index.d.ts index 7e9e94746e..e8b6f5934a 100644 --- a/types/storybook__addon-notes/index.d.ts +++ b/types/storybook__addon-notes/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/storybooks/storybook // Definitions by: Joscha Feth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { RenderFunction } from '@storybook/react'; diff --git a/types/storybook__react/index.d.ts b/types/storybook__react/index.d.ts index dd93b9459b..d31ea08af2 100644 --- a/types/storybook__react/index.d.ts +++ b/types/storybook__react/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Joscha Feth // Anton Izmailov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/storybook__vue/index.d.ts b/types/storybook__vue/index.d.ts new file mode 100644 index 0000000000..13e6099724 --- /dev/null +++ b/types/storybook__vue/index.d.ts @@ -0,0 +1,39 @@ +// Type definitions for @storybook/vue 3.3 +// Project: https://github.com/storybooks/storybook +// Definitions by: Punit Gupta +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 +// Created with the help of storybook__react types + +/// + +import Vue, { ComponentOptions } from 'vue'; + +// Story can be used as template or component +export type StoryFunction = () => ComponentOptions | string; +export type StoryDecorator = (story: () => ComponentOptions, context: { kind: string, story: string }) => ComponentOptions | null; + +export interface Story { + readonly kind: string; + add(storyName: string, getStory: StoryFunction): this; + addDecorator(decorator: StoryDecorator): this; +} + +export interface Addon { + [addonName: string]: (storyName: string, storyFn: StoryFunction) => void; +} +export interface StoryStore { + fileName: string | undefined; + kind: string; + stories: StoryObject[]; +} +export interface StoryObject { + name: string; + render: StoryFunction; +} + +export function addDecorator(decorator: StoryDecorator): void; +export function configure(loaders: () => void, module: NodeModule): void; +export function getStorybook(): StoryStore[]; +export function setAddon(addon: Addon): void; +export function storiesOf(kind: string, module: NodeModule): Story; diff --git a/types/storybook__vue/package.json b/types/storybook__vue/package.json new file mode 100644 index 0000000000..667aabc813 --- /dev/null +++ b/types/storybook__vue/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "vue": "^2.0.0" + } +} \ No newline at end of file diff --git a/types/storybook__vue/storybook__vue-tests.ts b/types/storybook__vue/storybook__vue-tests.ts new file mode 100644 index 0000000000..7c5c786ab7 --- /dev/null +++ b/types/storybook__vue/storybook__vue-tests.ts @@ -0,0 +1,50 @@ +import Vue, { ComponentOptions } from 'vue'; +import { addDecorator, configure, getStorybook, setAddon, storiesOf, StoryFunction, Story } from '@storybook/vue'; + +interface CustomStory extends Story { + addCentered(storyName: string, storyFn: StoryFunction): this; +} + +const addCenteredAddon = { + addCentered(this: Story, storyName: string, storyFn: StoryFunction): void { + console.log(this.kind); + this.add(storyName, storyFn); + } +}; + +const Decorator = (story: () => ComponentOptions) => { + const wrapper = story(); + return { + components: { wrapper }, + template: '

', + data() { + return { borderStyle: 'medium solid red' }; + } + }; +}; + +addDecorator(Decorator); +configure(() => undefined, module); +getStorybook().forEach(({ fileName, kind, stories }) => stories.forEach(({ name, render }) => render())); +setAddon(addCenteredAddon); + +storiesOf('Storybook__vue', module) + .addDecorator(Decorator) + .add('story as a template', () => '
') + .add('story as a component', () => ({ + components: {}, + template: '
' + })); + +(storiesOf('Custom_Story', module) as CustomStory) + .addCentered('custom story', () => ({ + template: '
' + })) + .add('story as a template', () => '
') + .add('story as a component', () => ({ + components: {}, + template: '
' + })) + .addCentered('custom story', () => ({ + template: '
' + })); diff --git a/types/storybook__vue/tsconfig.json b/types/storybook__vue/tsconfig.json new file mode 100644 index 0000000000..a472ebed8a --- /dev/null +++ b/types/storybook__vue/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "paths": { + "@storybook/vue": [ + "storybook__vue" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "storybook__vue-tests.ts" + ] +} \ No newline at end of file diff --git a/types/storybook__vue/tslint.json b/types/storybook__vue/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/storybook__vue/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/stream-meter/stream-meter-tests.ts b/types/stream-meter/stream-meter-tests.ts index 396f8aa6b1..d7adf74ce8 100644 --- a/types/stream-meter/stream-meter-tests.ts +++ b/types/stream-meter/stream-meter-tests.ts @@ -1,5 +1,4 @@ - -import * as meter from 'stream-meter'; +import meter = require('stream-meter'); var m:meter.StreamMeter = meter(); process.stdin.pipe(m).pipe(process.stdout); diff --git a/types/strftime/strftime-tests.ts b/types/strftime/strftime-tests.ts index 2c07e8ad5f..7ecbfaf2fe 100644 --- a/types/strftime/strftime-tests.ts +++ b/types/strftime/strftime-tests.ts @@ -1,4 +1,4 @@ -import * as strftime from "strftime"; +import strftime = require("strftime"); strftime('%B %d, %Y %H:%M:%S'); strftime('%F %T', new Date(1307472705067)); diff --git a/types/string-template/string-template-tests.ts b/types/string-template/string-template-tests.ts index 8ac76014c1..226f042287 100644 --- a/types/string-template/string-template-tests.ts +++ b/types/string-template/string-template-tests.ts @@ -1,5 +1,5 @@ -import * as format from "string-template"; -import * as compile from "string-template/compile"; +import format = require("string-template"); +import compile = require("string-template/compile"); // Format tests { diff --git a/types/stringify-object/index.d.ts b/types/stringify-object/index.d.ts index 3380fc3672..575e650064 100644 --- a/types/stringify-object/index.d.ts +++ b/types/stringify-object/index.d.ts @@ -1,15 +1,17 @@ -// Type definitions for stringify-object 3.1 +// Type definitions for stringify-object 3.2 // Project: https://github.com/yeoman/stringify-object // Definitions by: Chris Khoo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 declare namespace stringifyObject { } declare function stringifyObject(o: any, options?: { - indent?: string, - singleQuotes?: boolean, - filter?(o: any, prop: string): boolean, - inlineCharacterLimit?: number + indent?: string, + singleQuotes?: boolean, + filter?(o: any, prop: string | symbol): boolean, + inlineCharacterLimit?: number, + transform?: (val: any[] | object, i: number | string | symbol, value: string) => string, }): string; export = stringifyObject; diff --git a/types/stringify-object/stringify-object-tests.ts b/types/stringify-object/stringify-object-tests.ts index a00be6f1c0..f011930fda 100644 --- a/types/stringify-object/stringify-object-tests.ts +++ b/types/stringify-object/stringify-object-tests.ts @@ -1,4 +1,4 @@ -import * as stringifyObject from 'stringify-object'; +import stringifyObject = require('stringify-object'); stringifyObject({ a: 1, b: 2, c: 3 }); @@ -22,5 +22,9 @@ stringifyObject([1, 2, 3], { }); stringifyObject([1, 2, 3], { - filter: (o, prop) => prop !== '_hidden_' + filter: (o, prop) => prop !== '_hidden_' +}); + +stringifyObject([1, 2, 3], { + transform: (val, key, value) => value }); diff --git a/types/strip-json-comments/strip-json-comments-tests.ts b/types/strip-json-comments/strip-json-comments-tests.ts index f71f62cf0f..188248a285 100644 --- a/types/strip-json-comments/strip-json-comments-tests.ts +++ b/types/strip-json-comments/strip-json-comments-tests.ts @@ -1,9 +1,4 @@ -// Type definitions for strip-json-comments -// Project: https://github.com/sindresorhus/strip-json-comments -// Definitions by: Dylan R. E. Moonfire -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import * as stripJsonComments from "strip-json-comments"; +import stripJsonComments = require("strip-json-comments"); const json = '{/*rainbows*/"unicorn":"cake"}'; diff --git a/types/stripe-v3/index.d.ts b/types/stripe-v3/index.d.ts index 76666e747a..55cc5962df 100644 --- a/types/stripe-v3/index.d.ts +++ b/types/stripe-v3/index.d.ts @@ -12,18 +12,23 @@ declare var Stripe: stripe.StripeStatic; declare namespace stripe { interface StripeStatic { - (publicKey: string): Stripe; + (publicKey: string, options?: StripeOptions): Stripe; version: number; } interface Stripe { elements(options?: elements.ElementsCreateOptions): elements.Elements; createToken(element: elements.Element, options?: TokenOptions): Promise; + createToken(name: 'bank_account', options: BankAccountTokenOptions): Promise; + createToken(name: 'pii', options: PiiTokenOptions): Promise; + createSource(element: elements.Element, options?: {owner?: OwnerInfo}): Promise; createSource(options: SourceOptions): Promise; + retrieveSource(options: RetrieveSourceOptions): Promise; + paymentRequest(options: paymentRequest.StripePaymentRequestOptions): paymentRequest.StripePaymentRequest; } interface StripeOptions { - stripeAccount: string; + stripeAccount?: string; } interface TokenOptions { @@ -37,6 +42,33 @@ declare namespace stripe { currency?: string; } + interface BankAccountTokenOptions { + country: string; + currency: string; + routing_number: string; + account_number: string; + account_holder_name: string; + account_holder_type: string; + } + + interface PiiTokenOptions { + personal_id_number: string; + } + + interface OwnerInfo { + address?: { + city?: string; + country?: string; + line1?: string; + line2?: string; + postal_code?: string; + state?: string; + }; + name?: string; + email?: string; + phone?: string; + } + interface SourceOptions { type: string; flow?: 'redirect' | 'receiver' | 'code_verification' | 'none'; @@ -45,19 +77,7 @@ declare namespace stripe { }; currency?: string; amount?: number; - owner?: { - address?: { - city?: string; - country?: string; - line1?: string; - line2?: string; - postal_code?: string; - state?: string; - }; - name?: string; - email?: string; - phone?: string; - }; + owner?: OwnerInfo; metadata?: {}; statement_descriptor?: string; redirect?: { @@ -65,6 +85,9 @@ declare namespace stripe { }; token?: string; usage?: 'reusable' | 'single_use'; + three_d_secure?: { + card: string; + }; } interface Token { @@ -106,6 +129,15 @@ declare namespace stripe { last4: string; mandate_reference: string; }; + card?: Card; + status?: string; + redirect?: { + status: string; + url: string; + }; + three_d_secure?: { + authenticated: boolean; + }; } interface SourceResponse { @@ -165,6 +197,84 @@ declare namespace stripe { metadata: any; name?: string; tokenization_method?: tokenizationType; + three_d_secure?: 'required' | 'recommended' | 'optional' | 'not_supported'; + } + + interface RetrieveSourceOptions { + id: string; + client_secret: string; + } + + // Container for all payment request related types + namespace paymentRequest { + interface DisplayItem { + amount: number; + label: string; + pending?: boolean; + } + + interface StripePaymentRequestUpdateOptions { + currency: string; + total: DisplayItem; + displayItems?: DisplayItem[]; + shippingOptions?: ShippingOption[]; + } + + interface StripePaymentRequestOptions extends StripePaymentRequestUpdateOptions { + country: string; + requestPayerName?: boolean; + requestPayerEmail?: boolean; + requestPayerPhone?: boolean; + requestShipping?: boolean; + } + + interface UpdateDetails { + status: 'success' | 'fail' | 'invalid_shipping_address'; + total?: DisplayItem; + displayItems?: DisplayItem[]; + shippingOptions?: ShippingOption[]; + } + + interface ShippingOption { + id: string; + label: string; + detail?: string; + amount: number; + } + + interface ShippingAddress { + country: string; + addressLine: string[]; + region: string; + city: string; + postalCode: string; + recipient: string; + phone: string; + sortingCode?: string; + dependentLocality?: string; + } + + interface StripePaymentResponse { + token?: Token; + source?: Source; + complete: (status: string) => void; + payerName?: string; + payerEmail?: string; + payerPhone?: string; + shippingAddress?: ShippingAddress; + shippingOption?: ShippingOption; + methodName: string; + } + + interface StripePaymentRequest { + canMakePayment(): Promise<{applePay?: boolean} | null>; + show(): void; + update(options: StripePaymentRequestUpdateOptions): void; + on(event: 'token' | 'source', handler: (response: StripePaymentResponse) => void): void; + on(event: 'cancel', handler: () => void): void; + on(event: 'shippingaddresschange', handler: (response: {updateWith: (options: UpdateDetails) => void, shippingAddress: ShippingAddress}) => void): void; + on(event: 'shippingoptionchange', handler: (response: {updateWith: (options: UpdateDetails) => void, shippingOption: ShippingOption}) => void): void; + } } // Container for all elements related types @@ -181,6 +291,7 @@ declare namespace stripe { // Cannot find name 'HTMLElement' mount(domElement: any): void; on(event: eventTypes, handler: handler): void; + on(event: 'click', handler: (response: {preventDefault: () => void}) => void): void; focus(): void; blur(): void; clear(): void; @@ -202,9 +313,9 @@ declare namespace stripe { locale?: string; } - type elementsType = 'card' | 'cardNumber' | 'cardExpiry' | 'cardCvc' | 'postalCode'; + type elementsType = 'card' | 'cardNumber' | 'cardExpiry' | 'cardCvc' | 'postalCode' | 'paymentRequestButton'; interface Elements { - create(type: elementsType, options: ElementsOptions): Element; + create(type: elementsType, options?: ElementsOptions): Element; } interface ElementsOptions { @@ -219,13 +330,16 @@ declare namespace stripe { hidePostalCode?: boolean; hideIcon?: boolean; iconStyle?: 'solid' | 'default'; + placeholder?: string; style?: { base?: Style; complete?: Style; empty?: Style; invalid?: Style; + paymentRequestButton?: PaymentRequestButtonStyleOptions; }; value?: string | { [objectKey: string]: string; }; + paymentRequest?: paymentRequest.StripePaymentRequest; } interface Style extends StyleOptions { @@ -234,11 +348,13 @@ declare namespace stripe { '::placeholder'?: StyleOptions; '::selection'?: StyleOptions; ':-webkit-autofill'?: StyleOptions; + '::-ms-clear'?: StyleOptions; } interface Font { family?: string; src?: string; + display?: string; style?: string; unicodeRange?: string; weight?: string; @@ -255,9 +371,16 @@ declare namespace stripe { iconColor?: string; lineHeight?: string; letterSpacing?: string; + textAlign?: string; textDecoration?: string; textShadow?: string; textTransform?: string; } + + interface PaymentRequestButtonStyleOptions { + type?: 'default' | 'donate' | 'buy'; + theme: 'dark' | 'light' | 'light-outline'; + height: string; + } } } diff --git a/types/stripe-v3/stripe-v3-tests.ts b/types/stripe-v3/stripe-v3-tests.ts index ccf86e5215..201bad8678 100644 --- a/types/stripe-v3/stripe-v3-tests.ts +++ b/types/stripe-v3/stripe-v3-tests.ts @@ -42,7 +42,93 @@ describe("Stripe", () => { (error: stripe.Error) => { console.error(error); }); + // test 3D secure + const threeDSecureFrame = document.getElementById('3d-secure-frame'); + const ownerInfo = { + name: 'Jimmy', + address: { + line1: '1 High Street', + postal_code: 'XYZ' + } + }; + stripe.createSource(card, { owner: ownerInfo }).then(result => { + if (result.error) { + // handle error + return Promise.resolve(null); + } + if (!result.source) { + // handle error + return Promise.resolve(null); + } + if (!result.source.card || result.source.card.three_d_secure === 'not_supported') { + // make regular payment... + return Promise.resolve(null); + } + return stripe.createSource({ + type: 'three_d_secure', + amount: 100, + currency: 'usd', + three_d_secure: { + card: result.source.id + }, + redirect: { + return_url: location.origin + '/3d-secure-processing-page' + } + }); + }).then(threeDSource => { + if (!threeDSource) { + return Promise.resolve(null); + } + if (threeDSource.error) { + if (threeDSource.error.code === 'payment_method_not_available') { + // make regular payment... + return Promise.resolve(null); + } + // handle error + return Promise.resolve(null); + } + if (!threeDSource.source || threeDSource.source.status === 'failed' || !threeDSource.source.redirect) { + // make regular payment... + return Promise.resolve(null); + } + if (threeDSource.source.status === 'chargeable') { + // make charge... + return Promise.resolve(null); + } + threeDSecureFrame.setAttribute('src', threeDSource.source.redirect.url); + // now wait until chargeable then make the charge + return Promise.resolve(null); + }); card.destroy(); + // test payment request + const paymentRequest = stripe.paymentRequest({ + country: 'US', + currency: 'usd', + total: { + label: 'Demo total', + amount: 1000, + } + }); + const prButton = elements.create('paymentRequestButton', { paymentRequest }); + paymentRequest.canMakePayment().then(result => { + if (result) { + prButton.mount('#payment-request-button'); + } else { + document.getElementById('payment-request-button')!.style.display = 'none'; + } + }); + paymentRequest.on('token', ev => { + const body = JSON.stringify({token: ev.token!.id}); + // post to server... + Promise.resolve({ok: true}) + .then(response => { + if (response.ok) { + ev.complete('success'); + } else { + ev.complete('fail'); + } + }); + }); }); }); diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 49ba212f95..f7003cc638 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -8,6 +8,7 @@ // Kyle Kamperschroer // Kensuke Hoshikawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// @@ -53,6 +54,7 @@ declare class Stripe { */ recipients: Stripe.resources.Recipients; subscriptions: Stripe.resources.Subscriptions; + subscriptionItems: Stripe.resources.SubscriptionItems; tokens: Stripe.resources.Tokens; transfers: Stripe.resources.Transfers; applicationFees: Stripe.resources.ApplicationFees; @@ -120,7 +122,7 @@ declare namespace Stripe { * is only false when Stripe is waiting for additional information from the * account holder. */ - transfers_enabled: boolean; + payouts_enabled: boolean; /** * The state of the account’s information requests, including what @@ -159,7 +161,7 @@ declare namespace Stripe { * established in. For example, if you are in the United States and the * business you’re creating an account for is legally represented in Canada, * you would use “CA” as the country for the account being created. - * + * * optional, default is your own country */ country?: string; @@ -169,7 +171,7 @@ declare namespace Stripe { * will email your user with instructions for how to set up their account. For * managed accounts, this is only to make the account easier to identify to * you: Stripe will never directly reach out to your users. - * + * * required if type is "standard" */ email?: string; @@ -314,11 +316,11 @@ declare namespace Stripe { }; /** - * Details on when this account will make funds from charges available, and - * when they will be paid out to the account holder’s bank account. See our - * managed account bank transfer guide for more information + * Details on when funds from charges are available, + * and when they are paid out to an external account. + * See our Setting Bank and Debit Card Payouts documentation for details. */ - transfer_schedule?: { + payout_schedule?: { /** * The number of days charges for the account will be held before being * paid out. May also be the string “minimum” for the lowest available @@ -331,7 +333,7 @@ declare namespace Stripe { * How frequently funds will be paid out. One of "manual" (for only * triggered via API call), "daily", "weekly", or "monthly". Default is "daily". */ - interval?: string; + interval?: "manual" | "daily" | "weekly" | "monthly"; /** * The day of the month funds will be paid out. Required and available @@ -343,8 +345,14 @@ declare namespace Stripe { * The day of the week funds will be paid out, of the style ‘monday’, * ‘tuesday’, etc. Required and available only if interval is weekly. */ - weekly_anchor?: string; + weekly_anchor?: "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday"; } + + /** + * The text that appears on the bank account statement for payouts. + * If not set, this defaults to the platform’s bank descriptor as set in the Dashboard. + */ + payout_statement_descriptor?: string; } interface IAccountUpdateOptions extends IDataOptions, IAccountShared { @@ -556,7 +564,7 @@ declare namespace Stripe { interface IApplicationFeeRefunds extends IList, resources.ApplicationFeeRefunds { } - interface IApplicationFeeRefundCreationOptions extends IDataOptions { + interface IApplicationFeeRefundCreationOptions extends IDataOptionsWithMetadata { /** * A positive integer in pence representing how much of this fee to refund. * Can only refund up to the unrefunded amount remaining of the fee. @@ -564,14 +572,6 @@ declare namespace Stripe { * default is entire application fee */ amount?: number; - - /** - * A set of key/value pairs that you can attach to a refund object. It can be - * useful for storing additional information about the refund in a structured - * format. You can unset an individual key by setting its value to null and - * then saving. To clear all keys, set metadata to null, then save. - */ - metadata?: IMetadata; } } @@ -877,7 +877,7 @@ declare namespace Stripe { transfer: string | transfers.ITransfer; } - interface IChargeCreationOptions extends IDataOptions { + interface IChargeCreationOptions extends IDataOptionsWithMetadata { /** * A positive integer in the smallest currency unit (e.g 100 cents to charge * $1.00, or 1 to charge ¥1, a 0-decimal currency) representing how much to @@ -946,14 +946,6 @@ declare namespace Stripe { */ on_behalf_of?: string; - /** - * A set of key/value pairs that you can attach to a charge object. It can be - * useful for storing additional information about the customer in a - * structured format. It's often a good idea to store an email address in - * metadata for tracking later. - */ - metadata?: IMetadata; - /** * The email address to send this charge's receipt to. The receipt will not be * sent until the charge is paid. If this charge is for a customer, the email @@ -1344,7 +1336,7 @@ declare namespace Stripe { * override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to * end the customer's trial immediately. Only applies when the plan parameter is also provided. */ - trial_end?: number; + trial_end?: number | "now"; } interface ICustomerUpdateOptions extends IDataOptionsWithMetadata { @@ -2087,6 +2079,14 @@ declare namespace Stripe { tax_percent?: number; } + interface IInvoicePayOptions extends IDataOptionsWithMetadata { + /** + * A payment source to be charged. The source must be the ID of a source + * belonging to the customer associated with the invoice being paid. + */ + source?: sources.ISourceCreationOptions; + } + interface IInvoiceListOptions extends IListOptions { /** * The identifier of the customer whose invoices to return. If none is provided, all invoices will be returned. @@ -2826,27 +2826,23 @@ declare namespace Stripe { metadata: IMetadata; /** - * Display name of the plan + * A brief description of the plan, hidden from customers. */ - name: string; + nickname?: string; /** - * Extra information about a charge for the customer's credit card statement. + * The product whose pricing this plan determines. [Expandable] */ - statement_descriptor: string; - - /** - * Number of trial period days granted when subscribing a customer to this plan. Null if the plan has no trial period. - */ - trial_period_days: number; + product?: string | products.IProduct; } interface IPlanCreationOptions extends IDataOptionsWithMetadata { /** - * Unique string of your choice that will be used to identify this plan when subscribing a customer. This could be an identifier - * like "gold" or a primary key from your own database. + * An identifier randomly generated by Stripe. Used to identify this plan when subscribing a customer. You can optionally override this + * ID, but the ID must be unique across all plans in your Stripe account. You can, however, use the same plan ID in both live and test + * modes. */ - id: string; + id?: string; /** * A positive integer in cents/pence (or 0 for a free plan) representing how much to charge (on a recurring basis). @@ -2864,9 +2860,10 @@ declare namespace Stripe { interval: IntervalUnit; /** - * Name of the plan, to be displayed on invoices and in the web interface. + * The product whose pricing the created plan will represent. This can either be the ID of an existing product, or a dictionary containing + * fields used to create a service product. */ - name: string; + product: string | IPlanCreationOptionsProductHash; /** * The number of intervals between each subscription billing. For example, interval=month and interval_count=3 bills every 3 months. @@ -2875,31 +2872,45 @@ declare namespace Stripe { interval_count?: number; /** - * An arbitrary string to be displayed on your customer’s credit card statement. This may be up to 22 characters. As an example, if your website - * is RunClub and the item you’re charging for is your Silver Plan, you may want to specify a statement_descriptor of RunClub Silver Plan. - * The statement description may not include <>"' characters, and will appear on your customer’s statement in capital letters. Non-ASCII - * characters are automatically stripped. While most banks display this information consistently, some may display it incorrectly or not at all. + * A brief description of the plan, hidden from customers. */ - statement_descriptor?: string; - - /** - * Specifies a trial period in (an integer number of) days. If you include a trial period, the customer won't be billed for the first time - * until the trial period ends. If the customer cancels before the trial period is over, she'll never be billed at all. - */ - trial_period_days?: number; + nickname?: string; } interface IPlanUpdateOptions extends IDataOptionsWithMetadata { /** - * Name of the plan, to be displayed on invoices and in the web interface. + * A brief description of the plan, hidden from customers. This can be unset by updating the value to null and then saving. */ - name?: string; + nickname?: string; /** - * An arbitrary string to be displayed on your customer’s credit card statement. This may be up to 22 characters. As an example, if your website - * is RunClub and the item you’re charging for is your Silver Plan, you may want to specify a statement_descriptor of RunClub Silver Plan. - * The statement description may not include <>"' characters, and will appear on your customer’s statement in capital letters. Non-ASCII - * characters are automatically stripped. While most banks display this information consistently, some may display it incorrectly or not at all. + * The product the plan belongs to. Note that after updating, statement descriptors and line items of the plan in active subscriptions will + * be affected. + */ + product?: string; + } + + interface IPlanCreationOptionsProductHash { + /** + * The identifier for the product. Must be unique. If not provided, an identifier will be randomly generated. + */ + id?: string; + + /** + * The product’s name, meant to be displayable to the customer. + */ + name: string; + + /** + * Set of key/value pairs that you can attach to an object. It can be useful for storing additional information about the object in a structured + * format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata. + */ + metadata?: IOptionsMetadata; + + /** + * An arbitrary string to be displayed on your customer’s credit card statement. This may be up to 22 characters. The statement description may not + * include <>”’ characters, and will appear on your customer’s statement in capital letters. Non-ASCII characters are automatically stripped. While + * most banks display this information consistently, some may display it incorrectly or not at all. */ statement_descriptor?: string; } @@ -2929,6 +2940,9 @@ declare namespace Stripe { */ caption: string; + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ created: number; /** @@ -2968,6 +2982,18 @@ declare namespace Stripe { updated: number; + /** + * Extra information about a product which will appear on your customer’s credit card statement. In the case that multiple products are billed + * at once, the first statement descriptor will be used. Only available on products of type=service. + */ + statement_descriptor: string; + + /** + * The type of the product. The product is either of type good, which is eligible for use with Orders and SKUs, or service, which is eligible for + * use with Subscriptions and Plans. + */ + type: ProductType; + /** * A URL of a publicly-accessible webpage for this product. */ @@ -2977,55 +3003,77 @@ declare namespace Stripe { interface IProductCreationOptions extends IDataOptionsWithMetadata { /** * The identifier for the product. Must be unique. If not provided, an identifier will be randomly generated. + * Applicable to both service and good types. */ id?: string; /** * The product’s name, meant to be displayable to the customer. + * Applicable to both service and good types. */ name: string; /** - * Whether or not the product is currently available for purchase. Defaults to true. + * The type of the product. The product is either of type service, which is eligible for use with Subscriptions + * and Plans or good, which is eligible for use with Orders and SKUs. + */ + type: ProductType; + + /** + * Whether or not the product is currently available for purchase. Defaults to true. May only be set if type=good. */ active?: boolean; /** * A list of up to 5 alphanumeric attributes that each SKU can provide values for (e.g. ["color", "size"]). + * Applicable to both service and good types. */ attribute?: Array; /** - * A short one-line description of the product, meant to be displayable to the customer. + * A short one-line description of the product, meant to be displayable to the customer. May only be set if type=good. */ caption?: string; /** * An array of Connect application names or identifiers that should not be able to order the SKUs for this product. + * May only be set if type=good. */ deactivate_on?: Array; /** - * The product’s description, meant to be displayable to the customer. + * The product’s description, meant to be displayable to the customer. May only be set if type=good. */ description?: string; /** - * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. + * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. May only be set if type=good. */ images?: Array; + /** + * The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own + * package_dimensions. May only be set if type=good. + */ package_dimensions?: IPackageDimensions; /** - * Whether this product is shipped (i.e. physical goods). Defaults to true. + * Whether this product is shipped (i.e. physical goods). Defaults to true. May only be set if type=good. */ shippable?: boolean; /** - * A URL of a publicly-accessible webpage for this product. + * A URL of a publicly-accessible webpage for this product. May only be set if type=good. */ url?: string; + + /** + * An arbitrary string to be displayed on your customer’s credit card statement. This may be up to 22 characters. The statement description + * may not include <>”’ characters, and will appear on your customer’s statement in capital letters. Non-ASCII characters are automatically + * stripped. While most banks display this information consistently, some may display it incorrectly or not at all. + * May only be set if type=service. + */ + statement_descriptor?: string; } interface IProductUpdateOptions extends IDataOptionsWithMetadata { @@ -3062,6 +3110,10 @@ declare namespace Stripe { */ name?: string; + /** + * The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own + * package_dimensions. + */ package_dimensions?: IPackageDimensions; /** @@ -3073,6 +3125,14 @@ declare namespace Stripe { * A URL of a publicly-accessible webpage for this product. */ url?: string; + + /** + * An arbitrary string to be displayed on your customer’s credit card statement. This may be up to 22 characters. The statement description + * may not include <>”’ characters, and will appear on your customer’s statement in capital letters. Non-ASCII characters are automatically + * stripped. While most banks display this information consistently, some may display it incorrectly or not at all. + * May only be set if type=service. + */ + statement_descriptor?: string; } interface IProductListOptions extends IListOptions { @@ -3119,6 +3179,8 @@ declare namespace Stripe { */ width: number; } + + type ProductType = "service" | "good"; } namespace recipientCards { } @@ -4023,7 +4085,7 @@ declare namespace Stripe { * in the card object if the card belongs to an account or recipient * instead. */ - customer?: customers.ICustomer; + customer?: string | customers.ICustomer; /** * Only applicable on accounts (not customers or recipients). This @@ -4057,7 +4119,7 @@ declare namespace Stripe { /** * The card number */ - number: number; + number: string; /** * Card brand. Can be Visa, American Express, MasterCard, Discover, JCB, Diners Club, or Unknown. @@ -4156,7 +4218,7 @@ declare namespace Stripe { interface ISourceCreationOptions { /** - * he type of payment source. Should be "card". + * The type of payment source. Should be "card". */ object: "card"; @@ -4173,7 +4235,7 @@ declare namespace Stripe { /** * The card number, as a string without any separators. */ - number: number; + number: string; /** * Card security code. Required unless your account is registered in @@ -4194,7 +4256,7 @@ declare namespace Stripe { address_state?: string; address_zip?: string; - metadata?: IMetadata; + metadata?: IOptionsMetadata; } interface ISourceCreationOptionsExtended extends ISourceCreationOptions { @@ -4222,6 +4284,7 @@ declare namespace Stripe { namespace subscriptions { type SubscriptionStatus = "trialing" | "active" | "past_due" | "canceled" | "unpaid"; + type SubscriptionBilling = "charge_automatically" | "send_invoice"; /** * Subscriptions allow you to charge a customer's card on a recurring basis. A subscription ties a customer to * a particular plan you've created: https://stripe.com/docs/api#create_plan @@ -4283,6 +4346,8 @@ declare namespace Stripe { metadata: IMetadata; + items: IList; + /** * Hash describing the plan the customer is subscribed to */ @@ -4323,13 +4388,20 @@ declare namespace Stripe { * If the subscription has a trial, the beginning of that trial. */ trial_start: number; + + /** + * Either "charge_automatically", or "send_invoice". When charging automatically, Stripe will attempt to pay this subscription at the + * end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an + * invoice with payment instructions. + */ + billing: SubscriptionBilling; } interface ISubscriptionCustCreationOptions extends IDataOptionsWithMetadata { /** - * The identifier of the plan to subscribe the customer to. + * @deprecated Use items property instead. */ - plan: string; + plan?: string; /** * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage of the subscription invoice @@ -4367,7 +4439,36 @@ declare namespace Stripe { * will override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to end the * customer's trial immediately. */ - trial_end?: number; + trial_end?: number | "now"; + + /** + * Integer representing the number of trial period days before the customer is charged for the first time. + */ + trial_period_days?: number; + + /** + * List of subscription items, each with an attached plan. + */ + items?: ISubscriptionCreationItem[]; + + /** + * Either "charge_automatically", or "send_invoice". When charging automatically, Stripe will attempt to pay this subscription at the end of the + * cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment + * instructions. Defaults to "charge_automatically". + */ + billing?: SubscriptionBilling; + + /** + * Number of days a customer has to pay invoices generated by this subscription. + * Only valid for subscriptions where billing=send_invoice. + */ + days_until_due?: number; + + /** + * A future timestamp to anchor the subscription’s billing cycle. This is used to determine the date of the first full invoice, and, for plans + * with month or year intervals, the day of the month for subsequent invoices. + */ + billing_cycle_anchor?: number; } interface ISubscriptionCreationOptions extends ISubscriptionCustCreationOptions { @@ -4392,7 +4493,7 @@ declare namespace Stripe { coupon?: string; /** - * The identifier of the plan to update the subscription to. If omitted, the subscription will not change plans. + * @deprecated Use items property instead. */ plan?: string; @@ -4431,7 +4532,29 @@ declare namespace Stripe { * will override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to end the * customer's trial immediately. */ - trial_end?: number; + trial_end?: number | "now"; + + /** + * Either "charge_automatically", or "send_invoice". When charging automatically, Stripe will attempt to pay this subscription at the end of the + * cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment + * instructions. + */ + billing?: SubscriptionBilling; + + /** + * Number of days a customer has to pay invoices generated by this subscription. Only valid for subscriptions where billing=send_invoice. + */ + days_until_due?: number; + + /** + * List of subscription items, each with an attached plan. + */ + items?: ISubscriptionUpdateItem[]; + + /** + * String, unchanged (default) or now. This allows you to reset the billing cycle of a subscription. + */ + billing_cycle_anchor?: "unchanged" | "now"; } interface ISubscriptionCancellationOptions extends IDataOptions { @@ -4443,9 +4566,9 @@ declare namespace Stripe { interface ISubscriptionListOptions extends IListOptionsCreated { /** - * The billing mode of the subscriptions to retrieve. + * The billing mode of the subscriptions to retrieve. Either "charge_automatically" or "send_invoice". */ - billing?: "charge_automatically" | "send_invoice"; + billing?: SubscriptionBilling; /** * The ID of the customer whose subscriptions will be retrieved @@ -4462,6 +4585,154 @@ declare namespace Stripe { */ status?: SubscriptionStatus | "all"; } + + interface ISubscriptionCreationItem { + /** + * Plan ID for this item. + */ + plan: string; + + /** + * Quantity for this item. + */ + quantity?: number + } + + interface ISubscriptionUpdateItem { + /** + * SubscriptionItem to update. + */ + id?: string; + + /** + * Delete all usage for a given subscription item. Only allowed when deleted is set to true and the current plan’s + * usage_type is metered. + */ + clear_usage?: boolean; + + /** + * Delete the specified item if set to true. + */ + deleted?: boolean; + + /** + * Set of key/value pairs that you can attach to an object. It can be useful for storing additional information about + * the object in a structured format. + */ + metadata?: IOptionsMetadata; + + /** + * Plan ID for this item. + */ + plan?: string; + + /** + * Quantity for this item. + */ + quantity?: number + } + } + + namespace subscriptionItems { + /** + * Subscription items allow you to create customer subscriptions with more than one plan, making it easy to represent + * complex billing relationships. + */ + interface ISubscriptionItem extends IResourceObject { + /** + * Value is "subscription_item" + */ + object: "subscription_item"; + + created: number; + + /** + * Set of key/value pairs that you can attach to an object. It can be useful for storing additional information + * about the object in a structured format. + */ + metadata: IMetadata; + + /** + * Hash describing the plan the customer is subscribed to + */ + plan: plans.IPlan; + + /** + * The quantity of the plan to which the customer should be subscribed. + */ + quantity: number; + } + + interface ISubscriptionItemCreationOptions extends IDataOptionsWithMetadata { + /** + * The identifier of the plan to add to the subscription. + */ + plan: string; + + /** + * The identifier of the subscription to modify. + */ + subscription: string; + + /** + * The quantity you’d like to apply to the subscription item you’re creating. + */ + quantity?: number; + + /** + * Flag indicating whether to prorate switching plans during a billing cycle. + */ + prorate?: boolean; + + /** + * If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same + * proration that was previewed with the upcoming invoice endpoint. + */ + proration_date?: number; + } + + interface ISubscriptionItemUpdateOptions extends IDataOptionsWithMetadata { + /** + * The identifier of the new plan for this subscription item. + */ + plan?: string; + + /** + * Flag indicating whether to prorate switching plans during a billing cycle. + */ + prorate?: boolean; + + /** + * If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same + * proration that was previewed with the upcoming invoice endpoint. + */ + proration_date?: number; + + /** + * The quantity you’d like to apply to the subscription item you’re creating. + */ + quantity?: number; + } + + interface ISubscriptionItemDeleteOptions extends IDataOptions { + /** + * Flag indicating whether to prorate switching plans during a billing cycle. + */ + prorate?: boolean; + + /** + * If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same + * proration that was previewed with the upcoming invoice endpoint. + */ + proration_date?: number; + } + + interface ISubscriptionItemListOptions extends IListOptionsCreated { + /** + * The ID of the subscription whose items will be retrieved. + */ + subscription: string; + } } namespace refunds { @@ -4514,7 +4785,7 @@ declare namespace Stripe { receipt_number: string; } - interface IRefundCreationOptions extends IDataOptions { + interface IRefundCreationOptions extends IDataOptionsWithMetadata { /** * A positive integer in cents/pence representing how much of this charge to * refund. Can only refund up to the unrefunded amount remaining of the @@ -4524,14 +4795,6 @@ declare namespace Stripe { */ amount?: number; - /** - * A set of key/value pairs that you can attach to a refund object. It can be - * useful for storing additional information about the refund in a structured - * format. You can unset an individual key by setting its value to null and - * then saving. To clear all keys, set metadata to null, then save. - */ - metadata?: IMetadata; - /** * String indicating the reason for the refund. If set, possible values are * "duplicate", "fraudulent", and "requested_by_customer". Specifying @@ -4848,8 +5111,8 @@ declare namespace Stripe { * * This request only accepts metadata as an argument. */ - updateRefund(feeId: string, refundId: string, data: { metadata?: IMetadata }, options: HeaderOptions, response?: IResponseFn): Promise; - updateRefund(feeId: string, refundId: string, data: { metadata?: IMetadata }, response?: IResponseFn): Promise; + updateRefund(feeId: string, refundId: string, data: { metadata?: IOptionsMetadata }, options: HeaderOptions, response?: IResponseFn): Promise; + updateRefund(feeId: string, refundId: string, data: { metadata?: IOptionsMetadata }, response?: IResponseFn): Promise; /** * You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available @@ -4893,8 +5156,8 @@ declare namespace Stripe { * * This request only accepts metadata as an argument. */ - update(refundId: string, data: { metadata?: IMetadata }, options: HeaderOptions, response?: IResponseFn): Promise; - update(refundId: string, data: { metadata?: IMetadata }, response?: IResponseFn): Promise; + update(refundId: string, data: { metadata?: IOptionsMetadata }, options: HeaderOptions, response?: IResponseFn): Promise; + update(refundId: string, data: { metadata?: IOptionsMetadata }, response?: IResponseFn): Promise; /** * You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available @@ -5783,6 +6046,61 @@ declare namespace Stripe { create(data: subscriptions.ISubscriptionCustCreationOptions, response?: IResponseFn): Promise; } + class SubscriptionItems extends StripeResource { + /** + * Adds a new item to an existing subscription. No existing items will be changed or replaced. + * + * @returns The created subscription item object is returned if successful. Otherwise, this call throws an error. + * + * @param options The options for the new subscription item. + */ + create(data: subscriptionItems.ISubscriptionItemCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; + create(data: subscriptionItems.ISubscriptionItemCreationOptions, response?: IResponseFn): Promise; + + /** + * Retrieves the subscription item with the given ID. + * + * @returns Returns a subscription item if a valid subscription item ID was provided. Throws an error otherwise. + * + * @param subscriptionItemId The identifier of the subscription item to retrieve. + */ + retrieve(subscriptionItemId: string, options: HeaderOptions, response?: IResponseFn): Promise; + retrieve(subscriptionItemId: string, response?: IResponseFn): Promise; + + /** + * Updates the plan or quantity of an item on a current subscription. + * + * @param subscriptionItemId The identifier of the subscription item to modify. + * @param data The fields to update + */ + update(subscriptionItemId: string, data: subscriptionItems.ISubscriptionItemUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; + update(subscriptionItemId: string, data: subscriptionItems.ISubscriptionItemUpdateOptions, response?: IResponseFn): Promise; + + /** + * Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription. + * + * @returns An subscription item object with a deleted flag upon success. Otherwise, this call throws an error, such as if the + * subscription item has already been deleted. + * + * @param subscriptionItemId The identifier of the subscription item to delete. + * @param data Specify whether to prorate and from when. + */ + del(subscriptionItemId: string, data: subscriptionItems.ISubscriptionItemDeleteOptions, options: HeaderOptions, response?: IResponseFn): Promise; + del(subscriptionItemId: string, data: subscriptionItems.ISubscriptionItemDeleteOptions, response?: IResponseFn): Promise; + del(subscriptionItemId: string, options: HeaderOptions, response?: IResponseFn): Promise; + del(subscriptionItemId: string, response?: IResponseFn): Promise; + + /** + * Returns a list of your subscription items for a given subscription. + * + * @returns Returns a list of your subscription items for a given subscription. + * + * @param data Filtering options + */ + list(data: subscriptionItems.ISubscriptionItemListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; + list(data: subscriptionItems.ISubscriptionItemListOptions, response?: IResponseFn>): Promise>; + } + class Disputes extends StripeResource { /** * Retrieves the dispute with the given ID. @@ -5968,6 +6286,9 @@ declare namespace Stripe { * * @param id The ID of the invoice to pay. */ + pay(id: string, data: invoices.IInvoicePayOptions, options: HeaderOptions, response?: IResponseFn): Promise; + pay(id: string, data: invoices.IInvoicePayOptions, response: IResponseFn): Promise; + pay(id: string, data: invoices.IInvoicePayOptions): Promise; pay(id: string, options: HeaderOptions, response?: IResponseFn): Promise; pay(id: string, response?: IResponseFn): Promise; @@ -6333,9 +6654,9 @@ declare namespace Stripe { * Once entirely reversed, a transfer can't be reversed again. This method will return an error when called on an already-reversed transfer, * or when trying to reverse more money than is left on a transfer. */ - createReverse(transferId: string, data: transferReversals.IReversalCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; - createReverse(transferId: string, options: HeaderOptions, response?: IResponseFn): Promise; - createReverse(transferId: string, response?: IResponseFn): Promise; + createReversal(transferId: string, data: transferReversals.IReversalCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; + createReversal(transferId: string, options: HeaderOptions, response?: IResponseFn): Promise; + createReversal(transferId: string, response?: IResponseFn): Promise; /** * By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a @@ -6603,7 +6924,17 @@ declare namespace Stripe { * A set of key/value pairs that you can attach to an object. It can be useful for storing * additional information about the object in a structured format. */ - interface IMetadata { } + interface IOptionsMetadata { + [x: string]: string | number; + } + + /** + * A set of key/value pairs that you can attach to an object. It can be useful for storing + * additional information about the object in a structured format. + */ + interface IMetadata { + [x: string]: string; + } interface IShippingInformation { /** @@ -6732,7 +7063,7 @@ declare namespace Stripe { * format. You can unset an individual key by setting its value to null and * then saving. To clear all keys, set metadata to null, then save. */ - metadata?: IMetadata; + metadata?: IOptionsMetadata; } interface IHeaderOptions { @@ -6750,6 +7081,18 @@ declare namespace Stripe { stripe_account?: string; api_key?: string; + + /** + * Many objects contain the ID of a related object in their response properties. For example, a Charge may have an associated Customer ID. + * Those objects can be expanded inline with the expand request parameter. Objects that can be expanded are noted in this documentation. + * This parameter is available on all API requests, and applies to the response of that request only. + * + * You can nest expand requests with the dot property. For example, requesting invoice.customer on a charge will expand the invoice property + * into a full Invoice object, and will then expand the customer property on that invoice into a full Customer object. + * + * You can expand multiple objects at once by identifying multiple items in the expand array. + */ + expand?: string[]; } /** diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 03f9baeb9a..cbc7ccfcb5 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -1,8 +1,9 @@ import Stripe = require('stripe'); +import { customers } from 'stripe'; var stripe = new Stripe("sk_test_BF573NobVn98OiIsPAv7A04K") -stripe.setApiVersion('2016-03-07'); +stripe.setApiVersion('2017-04-06'); //#region Balance tests // ################################################################################## @@ -230,27 +231,61 @@ stripe.charges.markAsFraudulent('ch_15fvyXEe31JkLCeQOo0SwFk9').then(function (re stripe.customers.create({ description: 'Customer for test@example.com', - source: "tok_15V2YhEe31JkLCeQy9iUgsJX" // obtained with Stripe.js + source: "tok_15V2YhEe31JkLCeQy9iUgsJX", // obtained with Stripe.js + metadata: { test: "123", test2: 123 } // IOptionsMetadata test }, function (err, customer) { // asynchronously called }); stripe.customers.create({ description: 'Customer for test@example.com', - source: "tok_15V2YhEe31JkLCeQy9iUgsJX" // obtained with Stripe.js + source: "tok_15V2YhEe31JkLCeQy9iUgsJX", // obtained with Stripe.js + metadata: null // IOptionsMetadata test }).then( function (customer) { // asynchronously called customer.cards.create({ card: "tok_17wV94BoqMA9o2xkhlAd3ALf"}).then(function (customer) {}); - customer.cards.retrieve("card_17xMvXBoqMA9o2xkq6W5gamx").then(function (card) {}); + customer.cards.retrieve("card_17xMvXBoqMA9o2xkq6W5gamx").then(function (card) { + let strCustomer: string = card.customer; + let objCustomer: customers.ICustomer = card.customer; + }); customer.cards.update("card_17xMvXBoqMA9o2xkq6W5gamx", { name: "Test" }).then(function (card) {}); customer.cards.list().then(function (cards) {}); customer.cards.del("card_17xMvXBoqMA9o2xkq6W5gamx").then(function (confirmation) {}); - customer.subscriptions.create({ plan: "gold" }).then(function (subscription) { }); - customer.subscriptions.retrieve("sub_8Eluur5KoIKxuy").then(function (subscription) { }); - customer.subscriptions.update("sub_8Eluur5KoIKxuy", { plan: "silver" }).then(function (subscription) { }); + customer.subscriptions.create({ items: [{ plan: "gold" }], trial_period_days: 7 }).then(function (subscription) { }); + customer.subscriptions.create({ items: [{ plan: "gold" }], trial_end: "now", billing_cycle_anchor: 1516881177 }).then(function (subscription) { }); + customer.subscriptions.create({ items: [{ plan: "gold" }], trial_end: 1516881177, billing: "send_invoice", days_until_due: 7 }).then(function (subscription) { }); + customer.subscriptions.create({ items: [{ plan: "gold" }], billing: "charge_automatically" }).then(function (subscription) { }); + customer.subscriptions.retrieve("sub_8Eluur5KoIKxuy").then(function (subscription) { + customer.subscriptions.update("sub_8Eluur5KoIKxuy", { items: [{ id: subscription.items.data[0].id, plan: "silver" }] }).then(function (subscription) { }); + }); + customer.subscriptions.update("sub_8Eluur5KoIKxuy", { trial_end: "now", billing_cycle_anchor: "now" }); + customer.subscriptions.update("sub_8Eluur5KoIKxuy", { trial_end: 1516881177, billing: "send_invoice", days_until_due: 7, billing_cycle_anchor: "unchanged" }); customer.subscriptions.list().then(function (subscriptions) { }); customer.subscriptions.del("sub_8Eluur5KoIKxuy").then(function (subscription) { }); customer.subscriptions.deleteDiscount("sub_8Eluur5KoIKxuy").then(function (confirmation) { }); + + // IMetadata tests: + let str: string; + customer.metadata["test"] == str; + customer.metadata.test1 == str; + + //IOptionsMetadata tests: + let metadata: Stripe.IOptionsMetadata; + let num: number; + metadata["test"] = str; + metadata["test"] = num; + metadata["test"] == str; + metadata["test"] == num; + metadata.testStr = str; + metadata.testNum = num; + metadata.test1 == str; + metadata.test2 == num; + metadata = { + test1: str, + test2: num + } + metadata = {}; + metadata = null; }); @@ -267,6 +302,22 @@ stripe.customers.create({ }); +// {"now"} for trial_end +stripe.customers.create({ + description: "Customer for test@example.com", + source: "tok_15V2YhEe31JkLCeQy9iUgsJX", // obtained with Stripe.js + plan: "platypi-dev", + trial_end: "now" +}); + +// {number} for trial_end +stripe.customers.create({ + description: "Customer for test@example.com", + source: "tok_15V2YhEe31JkLCeQy9iUgsJX", // obtained with Stripe.js + plan: "platypi-dev", + trial_end: 1516881177 +}); + stripe.customers.retrieve( "cus_5rfJKDJkuxzh5Q", function (err, customer) { @@ -344,7 +395,7 @@ stripe.customers.createSource( object: "card", exp_month: 1, exp_year: 16, - number: 4242424242424242 + number: '4242424242424242' } }, function (err, card) { @@ -359,7 +410,7 @@ stripe.customers.createSource( object: "card", exp_month: 1, exp_year: 16, - number: 4242424242424242 + number: '4242424242424242' } }).then( function (card) { @@ -455,12 +506,12 @@ stripe.customers.retrieveSubscription("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp" // asynchronously called }); -stripe.customers.updateSubscription("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", { plan: "platypi-dev" }, +stripe.customers.updateSubscription("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", { items: [{ id: "si_62U5U5BoqBA2o2xp6Eqcl6J7", plan: "platypi-dev" }] }, function (err, subscription) { // asynchronously called } ); -stripe.customers.updateSubscription("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", { plan: "platypi-dev" }).then(function (subscription) { +stripe.customers.updateSubscription("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", { items: [{ id: "si_62U5U5BoqBA2o2xp6Eqcl6J7", plan: "platypi-dev" }] }).then(function (subscription) { // asynchronously called }); @@ -551,6 +602,15 @@ stripe.customers.deleteSubscriptionDiscount("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLG //#region Transfers Reversals tests // ################################################################################## +stripe.transfers.createReversal("tr_17F2JBFuhr4V1legrq97JrFE", function (err, reversal) { + // asynchronously called +}); + +stripe.transfers.createReversal("tr_17F2JBFuhr4V1legrq97JrFE").then(function (reversal) { + // asynchronously called +}); + + //#endregion //#region Accounts test @@ -600,6 +660,29 @@ stripe.accounts.update("acct_17wV8KBoqMA9o2xk", } ); +stripe.accounts.update("acct_17wV8KBoqMA9o2xk", + { + payout_statement_descriptor: "From Stripe" + }).then( + function (account) { + // asynchronously called + } +); + +stripe.accounts.update("acct_17wV8KBoqMA9o2xk", + { + payout_schedule: { + delay_days: 5, + interval: "monthly", + monthly_anchor: 4, + weekly_anchor: "monday" + } + }).then( + function (account) { + // asynchronously called + } +); + stripe.accounts.del("acct_17wV8KBoqMA9o2xk", function (err, confirmation) { }); stripe.accounts.del("acct_17wV8KBoqMA9o2xk").then(function (confirmation) { }); @@ -622,6 +705,11 @@ stripe.accounts.list( // asynchronously called } ); +stripe.accounts.retrieve("acct_17wV8KBoqMA9o2xk").then( + function (accounts) { + var payouts_enabled: boolean = accounts.payouts_enabled; + } +); //#endregion //#region Application Fee Refunds tests @@ -706,7 +794,19 @@ stripe.accounts.createExternalAccount("", { external_account: "tok_15V2YhEe31JkL //#region Products tests // ################################################################################## - +stripe.products.create({ + name: "My amazing product", + type: "service" +}, function (err, coupon) { + // asynchronously called +}); +stripe.products.create({ + name: "My amazing product", + type: "service" +}).then(function (product) { + // asynchronously called + const prodType: "service" | "good" = product.type; +}); //#endregion @@ -880,6 +980,10 @@ stripe.invoices.pay("in_15fvyXEe31JkLCeQH7QbgZZb").then(function (invoice) { // asynchronously called }); +stripe.invoices.pay("in_15fvyXEe31JkLCeQH7QbgZZb", { source: "source_id" }).then(function (invoice) { + // asynchronously called +}); + stripe.invoices.list( { customer: "cus_5rfJKDJkuxzh5Q", limit: 3 }, function (err, invoices) { @@ -1014,51 +1118,77 @@ stripe.payouts.cancel( //#region Plans tests // ################################################################################## +// all product hash options stripe.plans.create({ amount: 2000, interval: "month", - name: "Amazing Gold Plan", + product: { + name: "Amazing Gold Plan", + statement_descriptor: "Gold Plan", + metadata: { + plan_id: "goldplan123" + } + }, + nickname: "Something to remember me by", currency: "usd", - id: "gold" + id: "gold-plan" }, function (err, plan) { // asynchronously called - }); +}); + +// minimum options with product hash stripe.plans.create({ amount: 2000, - interval: "month", - name: "Amazing Gold Plan", currency: "usd", - id: "gold" + interval: "month", + product: { + name: "Amazing Gold Plan" + } }).then(function (plan) { // asynchronously called }); +// minimum options with product id +stripe.plans.create({ + amount: 2000, + currency: "usd", + interval: "month", + product: "prod_UT1t06yZ3iBEHi" +}).then(function (plan) { + // asynchronously called + const productId = plan.product as string; +}); + stripe.plans.retrieve( - "platypi-dev", + "gold-plan", + { + expand: ["product"] + }, function (err, plan) { // asynchronously called + const product = plan.product as Stripe.products.IProduct; } ); -stripe.plans.retrieve("platypi-dev").then(function (plan) { +stripe.plans.retrieve("gold-plan").then(function (plan) { // asynchronously called }); -stripe.plans.update("platypi-dev", { - name: "New plan name" +stripe.plans.update("gold-plan", { + product: "prod_UT1t06yZ3iBEHi" }, function (err, plan) { // asynchronously called }); -stripe.plans.update("platypi-dev", { name: "New plan name" }).then(function (plan) { +stripe.plans.update("gold-plan", { nickname: "New gold plan nickname" }).then(function (plan) { // asynchronously called }); stripe.plans.del( - "platypi-dev", + "gold-plan", function (err, confirmation) { // asynchronously called } ); -stripe.plans.del("platypi-dev").then(function (confirmation) { +stripe.plans.del("gold-plan").then(function (confirmation) { // asynchronously called }); @@ -1081,11 +1211,18 @@ stripe.plans.list().then(function (plans) { //#region Subscriptions tests // ################################################################################## -stripe.subscriptions.create({ plan: "platypi-dev", customer: "cus_5rfJKDJkuxzh5Q" }, function(err, subscription) { +stripe.subscriptions.create({ items: [{ plan: "platypi-dev" }], customer: "cus_5rfJKDJkuxzh5Q" }, function(err, subscription) { // asynchronously called }); -stripe.subscriptions.create({ plan: "platypi-dev", customer: "cus_5rfJKDJkuxzh5Q" }).then(function(subscription) { +stripe.subscriptions.create({ items: [{ plan: "platypi-dev" }], customer: "cus_5rfJKDJkuxzh5Q" }).then(function(subscription) { // asynchronously called + + stripe.subscriptions.update("sub_8QwCiwZ9tmMSpt", { items: [{ id: subscription.items.data[0].id, plan: "platypi" }] }, function(err, subscription) { + // asynchronously called + }); + stripe.subscriptions.update("sub_8QwCiwZ9tmMSpt", { items: [{ id: subscription.items.data[0].id, plan: "platypi" }] }).then(function(subscription) { + // asynchronously called + }); }); stripe.subscriptions.retrieve("sub_8QwCiwZ9tmMSpt", function(err, subscription) { @@ -1101,13 +1238,6 @@ stripe.subscriptions.retrieve("sub_8QwCiwZ9tmMSpt").then(function(subscription) } }); -stripe.subscriptions.update("sub_8QwCiwZ9tmMSpt", { plan: "platypi" }, function(err, subscription) { - // asynchronously called -}); -stripe.subscriptions.update("sub_8QwCiwZ9tmMSpt", { plan: "platypi" }).then(function(subscription) { - // asynchronously called -}); - stripe.subscriptions.del("sub_8QwCiwZ9tmMSpt", function(err, subscription) { // asynchronously called }); @@ -1124,6 +1254,50 @@ stripe.subscriptions.list({ customer: "cus_5rfJKDJkuxzh5Q", plan: "platypi-dev" //#endregion +//#region Subscription Items tests +// ################################################################################## + +stripe.subscriptionItems.create({ subscription: "sub_C9giwDfCeN8fwt", plan: "platypi-dev" }, function(err, subscriptionItem) { + // asynchronously called +}); +stripe.subscriptionItems.create({ subscription: "sub_C9giwDfCeN8fwt", plan: "platypi-dev" }).then(function(subscriptionItem) { + // asynchronously called +}); + +stripe.subscriptionItems.create({ subscription: "sub_C9giwDfCeN8fwt", plan: "platypi-dev", prorate: true, proration_date: Math.round(new Date().valueOf() / 1000) }).then(function(subscriptionItem) { + // asynchronously called +}); + +stripe.subscriptionItems.retrieve("si_C9gimdd2l9qvCU", function(err, subscriptionItem) { + // asynchronously called +}); +stripe.subscriptionItems.retrieve("si_C9gimdd2l9qvCU").then(function(subscriptionItem) { + // asynchronously called +}); + +stripe.subscriptionItems.update("si_C9gimdd2l9qvCU", { plan: "platypi" }, function(err, subscriptionItem) { + // asynchronously called +}); +stripe.subscriptionItems.update("si_C9gimdd2l9qvCU", { plan: "platypi" }).then(function(subscriptionItem) { + // asynchronously called +}); + +stripe.subscriptionItems.del("si_C9gimdd2l9qvCU", function(err, subscriptionItem) { + // asynchronously called +}); +stripe.subscriptionItems.del("si_C9gimdd2l9qvCU").then(function(subscriptionItem) { + // asynchronously called +}); + +stripe.subscriptionItems.list({ subscription: "si_C9gimdd2l9qvCU" }, function(err, subscriptionItems) { + // asynchronously called +}); +stripe.subscriptionItems.list({ subscription: "si_C9gimdd2l9qvCU" }).then(function(subscriptionItems) { + // asynchronously called +}); + +//#endregion + //#region Ephemeral keys tests // ################################################################################## diff --git a/types/strong-log-transformer/index.d.ts b/types/strong-log-transformer/index.d.ts new file mode 100644 index 0000000000..1893ae7d2b --- /dev/null +++ b/types/strong-log-transformer/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for strong-log-transformer 1.0 +// Project: https://github.com/strongloop/strong-log-transformer +// Definitions by: Aleh Zasypkin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +interface Options { + format: string; + tag: string; + mergeMultiline: boolean; + timeStamp: boolean; +} + +interface StrongLogTransformer { + (options?: Partial): NodeJS.ReadWriteStream; + DEFAULTS: Options; + cli(args: string[]): void; +} + +declare const strongLogTransformer: StrongLogTransformer; + +export = strongLogTransformer; diff --git a/types/strong-log-transformer/strong-log-transformer-tests.ts b/types/strong-log-transformer/strong-log-transformer-tests.ts new file mode 100644 index 0000000000..6e1ea28527 --- /dev/null +++ b/types/strong-log-transformer/strong-log-transformer-tests.ts @@ -0,0 +1,15 @@ +import transformer = require('strong-log-transformer'); + +transformer.DEFAULTS; // $ExpectType Options + +transformer.cli([]); // $ExpectType void +transformer.cli(['one', 'two']); // $ExpectType void + +transformer(); // $ExpectType ReadWriteStream +transformer({ format: 'format' }); // $ExpectType ReadWriteStream +transformer({ tag: 'tag' }); // $ExpectType ReadWriteStream +transformer({ mergeMultiline: true }); // $ExpectType ReadWriteStream +transformer({ mergeMultiline: false }); // $ExpectType ReadWriteStream +transformer({ timeStamp: true }); // $ExpectType ReadWriteStream +transformer({ timeStamp : false }); // $ExpectType ReadWriteStream +transformer(transformer.DEFAULTS); // $ExpectType ReadWriteStream diff --git a/types/strong-log-transformer/tsconfig.json b/types/strong-log-transformer/tsconfig.json new file mode 100644 index 0000000000..f0c082fc55 --- /dev/null +++ b/types/strong-log-transformer/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", + "strong-log-transformer-tests.ts" + ] +} diff --git a/types/strong-log-transformer/tslint.json b/types/strong-log-transformer/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/strong-log-transformer/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/structured-source/index.d.ts b/types/structured-source/index.d.ts new file mode 100644 index 0000000000..ce7325cf9d --- /dev/null +++ b/types/structured-source/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for structured-source 3.0 +// Project: https://github.com/Constellation/structured-source +// Definitions by: azu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace StructuredSource { + interface SourcePosition { + // Line number starts with 1. + line: number; + // Column number starts with 0. + column: number; + } + interface SourceLocation { + start: SourcePosition; + end: SourcePosition; + } +} + +declare class StructuredSource { + /** + * @param source - source code text. + */ + constructor(source: string); + locationToRange(loc: StructuredSource.SourceLocation): [number, number]; + rangeToLocation(range: [number, number]): StructuredSource.SourceLocation; + positionToIndex(pos: StructuredSource.SourcePosition): number; + indexToPosition(index: number): StructuredSource.SourcePosition; +} +export = StructuredSource; diff --git a/types/structured-source/structured-source-tests.ts b/types/structured-source/structured-source-tests.ts new file mode 100644 index 0000000000..cda6e99af2 --- /dev/null +++ b/types/structured-source/structured-source-tests.ts @@ -0,0 +1,15 @@ +import StructuredSource = require('structured-source'); + +const src = new StructuredSource('aaa\u2028aaaa\u2029aaaaa\n'); + +// $ExpectType: number +src.positionToIndex({ line: 1, column: 2 }); +// $ExpectType: { line: number, column: number } +src.indexToPosition(2); +// $ExpectType: { start: { line: number, column: number}, end: { line: number, column: number } } +src.rangeToLocation([0, 2]); +// $ExpectType: [ number, number ] +src.locationToRange({ + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } +}); diff --git a/types/structured-source/tsconfig.json b/types/structured-source/tsconfig.json new file mode 100644 index 0000000000..f0d949503e --- /dev/null +++ b/types/structured-source/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", + "structured-source-tests.ts" + ] +} diff --git a/types/structured-source/tslint.json b/types/structured-source/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/structured-source/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/styled-jsx/index.d.ts b/types/styled-jsx/index.d.ts index 5072cdc7b9..5e15388837 100644 --- a/types/styled-jsx/index.d.ts +++ b/types/styled-jsx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/zeit/styled-jsx // Definitions by: R1ZZU // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import "react"; diff --git a/types/styled-jsx/tsconfig.json b/types/styled-jsx/tsconfig.json index 494ed25a0a..6e599795bf 100644 --- a/types/styled-jsx/tsconfig.json +++ b/types/styled-jsx/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "styled-jsx-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/stylelint-webpack-plugin/index.d.ts b/types/stylelint-webpack-plugin/index.d.ts index 580fc4325f..dfaf0a4f05 100644 --- a/types/stylelint-webpack-plugin/index.d.ts +++ b/types/stylelint-webpack-plugin/index.d.ts @@ -2,8 +2,9 @@ // Project: https://github.com/JaKXz/stylelint-webpack-plugin // Definitions by: Arne Bahlo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import { Plugin } from "webpack"; +import { Plugin } from 'webpack'; export = StylelintWebpackPlugin; diff --git a/types/stylelint-webpack-plugin/stylelint-webpack-plugin-tests.ts b/types/stylelint-webpack-plugin/stylelint-webpack-plugin-tests.ts index 924a41ee6d..ee9002ec40 100644 --- a/types/stylelint-webpack-plugin/stylelint-webpack-plugin-tests.ts +++ b/types/stylelint-webpack-plugin/stylelint-webpack-plugin-tests.ts @@ -1,5 +1,5 @@ -import * as webpack from "webpack"; -import * as StylelintWebpackPlugin from "stylelint-webpack-plugin"; +import webpack = require("webpack"); +import StylelintWebpackPlugin = require("stylelint-webpack-plugin"); const compiler = webpack({ plugins: [ diff --git a/types/sumo-logger/sumo-logger-tests.ts b/types/sumo-logger/sumo-logger-tests.ts index 03efdfc95d..2a0066a4e4 100644 --- a/types/sumo-logger/sumo-logger-tests.ts +++ b/types/sumo-logger/sumo-logger-tests.ts @@ -1,5 +1,5 @@ -import * as SumoLogger from 'sumo-logger'; -import * as expect from 'expect'; +import SumoLogger = require('sumo-logger'); +import expect = require('expect'); const onErrorSpy = expect.createSpy(); const onSuccessSpy = expect.createSpy(); diff --git a/types/superagent-no-cache/superagent-no-cache-tests.ts b/types/superagent-no-cache/superagent-no-cache-tests.ts index 68e4e961a2..717fee80e3 100644 --- a/types/superagent-no-cache/superagent-no-cache-tests.ts +++ b/types/superagent-no-cache/superagent-no-cache-tests.ts @@ -1,5 +1,5 @@ import * as request from 'superagent'; -import * as plugin from 'superagent-no-cache'; +import plugin = require('superagent-no-cache'); request .get('/some-url') diff --git a/types/superagent-prefix/superagent-prefix-tests.ts b/types/superagent-prefix/superagent-prefix-tests.ts index 01e4b52905..6b0bbf0820 100644 --- a/types/superagent-prefix/superagent-prefix-tests.ts +++ b/types/superagent-prefix/superagent-prefix-tests.ts @@ -1,5 +1,5 @@ import * as request from 'superagent'; -import * as plugin from 'superagent-prefix'; +import plugin = require('superagent-prefix'); request .get('/some-url') diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index fdf23891cb..200046d439 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Nico Zelaya // Michael Ledin // Pap Lőrinc +// Shrey Jain // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -16,6 +17,12 @@ type CallbackHandler = (err: any, res: request.Response) => void; type Serializer = (obj: any) => string; +type BrowserParser = (str: string) => any; + +type NodeParser = (res: request.Response, callback: (err: Error | null, body: any) => void) => void; + +type Parser = BrowserParser | NodeParser; + type MultipartValueSingle = Blob | Buffer | fs.ReadStream | string | boolean | number; type MultipartValue = MultipartValueSingle | MultipartValueSingle[]; @@ -37,6 +44,7 @@ declare namespace request { agent(): SuperAgent; serialize: { [type: string]: Serializer }; + parse: { [type: string]: Parser }; } interface SuperAgent extends stream.Stream { @@ -55,7 +63,6 @@ declare namespace request { move(url: string, callback?: CallbackHandler): Req; notify(url: string, callback?: CallbackHandler): Req; options(url: string, callback?: CallbackHandler): Req; - parse(fn: (res: Response, callback: (err: Error | null, body: any) => void) => void): this; patch(url: string, callback?: CallbackHandler): Req; post(url: string, callback?: CallbackHandler): Req; propfind(url: string, callback?: CallbackHandler): Req; @@ -122,7 +129,7 @@ declare namespace request { on(name: 'error', handler: (err: any) => void): this; on(name: 'progress', handler: (event: ProgressEvent) => void): this; on(name: string, handler: (event: any) => void): this; - parse(fn: (res: Response, callback: (err: Error | null, body: any) => void) => void): this; + parse(parser: Parser): this; part(): this; pfx(cert: Buffer | string): this; pipe(stream: NodeJS.WritableStream, options?: object): stream.Writable; diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 5978b37206..bbea2d617c 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -1,8 +1,7 @@ // via: http://visionmedia.github.io/superagent/ - -import * as request from 'superagent'; +import request = require('superagent'); import * as fs from 'fs'; -import * as assert from 'assert'; +import assert = require('assert'); import { Agent } from 'https'; // Examples taken from https://github.com/visionmedia/superagent/blob/gh-pages/docs/index.md diff --git a/types/superagent/v2/superagent-tests.ts b/types/superagent/v2/superagent-tests.ts index 02074043fc..e0f0fcc592 100644 --- a/types/superagent/v2/superagent-tests.ts +++ b/types/superagent/v2/superagent-tests.ts @@ -1,8 +1,8 @@ // via: http://visionmedia.github.io/superagent/ -import * as request from 'superagent'; +import request = require('superagent'); import * as fs from 'fs'; -import * as assert from 'assert'; +import assert = require('assert'); import { Agent } from 'https'; // Examples taken from https://github.com/visionmedia/superagent/blob/gh-pages/docs/index.md diff --git a/types/supertest-as-promised/supertest-as-promised-tests.ts b/types/supertest-as-promised/supertest-as-promised-tests.ts index b86bdafbc9..fbf8be995b 100644 --- a/types/supertest-as-promised/supertest-as-promised-tests.ts +++ b/types/supertest-as-promised/supertest-as-promised-tests.ts @@ -1,5 +1,5 @@ -import * as request from 'supertest-as-promised'; -import * as express from 'express'; +import request = require('supertest-as-promised'); +import express = require('express'); declare function describe(desc: string, f: () => void): void; declare function it(desc: string, f: () => void): void; diff --git a/types/supertest/supertest-tests.ts b/types/supertest/supertest-tests.ts index 868aa8fdce..24bbd4bd56 100644 --- a/types/supertest/supertest-tests.ts +++ b/types/supertest/supertest-tests.ts @@ -1,6 +1,5 @@ - -import * as supertest from 'supertest'; -import * as express from 'express'; +import supertest = require('supertest'); +import express = require('express'); const app = express(); const request: supertest.SuperTest = supertest(app); diff --git a/types/svg-parser/tsconfig.json b/types/svg-parser/tsconfig.json index c24afbd999..c5497750f7 100644 --- a/types/svg-parser/tsconfig.json +++ b/types/svg-parser/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "svg-parser-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/svgo/index.d.ts b/types/svgo/index.d.ts index f585f54658..5642a33cd1 100644 --- a/types/svgo/index.d.ts +++ b/types/svgo/index.d.ts @@ -1,179 +1,180 @@ -// Type definitions for svgo 0.7 +// Type definitions for svgo 1.0 // Project: https://github.com/svg/svgo // Definitions by: Bradley Ayers +// Gilad Gray // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 interface PluginCleanupAttrs { - cleanupAttrs: object; + cleanupAttrs: boolean | object; } interface PluginRemoveDoctype { - removeDoctype: object; + removeDoctype: boolean | object; } interface PluginRemoveXMLProcInst { - removeXMLProcInst: object; + removeXMLProcInst: boolean | object; } interface PluginRemoveComments { - removeComments: object; + removeComments: boolean | object; } interface PluginRemoveMetadata { - removeMetadata: object; + removeMetadata: boolean | object; } interface PluginRemoveTitle { - removeTitle: object; + removeTitle: boolean | object; } interface PluginRemoveDesc { - removeDesc: object; + removeDesc: boolean | object; } interface PluginRemoveUselessDefs { - removeUselessDefs: object; + removeUselessDefs: boolean | object; } interface PluginRemoveXMLNS { - removeXMLNS: object; + removeXMLNS: boolean | object; } interface PluginRemoveEditorsNSData { - removeEditorsNSData: object; + removeEditorsNSData: boolean | object; } interface PluginRemoveEmptyAttrs { - removeEmptyAttrs: object; + removeEmptyAttrs: boolean | object; } interface PluginRemoveHiddenElems { - removeHiddenElems: object; + removeHiddenElems: boolean | object; } interface PluginRemoveEmptyText { - removeEmptyText: object; + removeEmptyText: boolean | object; } interface PluginRemoveEmptyContainers { - removeEmptyContainers: object; + removeEmptyContainers: boolean | object; } interface PluginRemoveViewBox { - removeViewBox: object; + removeViewBox: boolean | object; } interface PluginCleanupEnableBackground { - cleanupEnableBackground: object; + cleanupEnableBackground: boolean | object; } interface PluginMinifyStyles { - minifyStyles: object; + minifyStyles: boolean | object; } interface PluginConvertStyleToAttrs { - convertStyleToAttrs: object; + convertStyleToAttrs: boolean | object; } interface PluginConvertColors { - convertColors: object; + convertColors: boolean | object; } interface PluginConvertPathData { - convertPathData: object; + convertPathData: boolean | object; } interface PluginConvertTransform { - convertTransform: object; + convertTransform: boolean | object; } interface PluginRemoveUnknownsAndDefaults { - removeUnknownsAndDefaults: object; + removeUnknownsAndDefaults: boolean | object; } interface PluginRemoveNonInheritableGroupAttrs { - removeNonInheritableGroupAttrs: object; + removeNonInheritableGroupAttrs: boolean | object; } interface PluginRemoveUselessStrokeAndFill { - removeUselessStrokeAndFill: object; + removeUselessStrokeAndFill: boolean | object; } interface PluginRemoveUnusedNS { - removeUnusedNS: object; + removeUnusedNS: boolean | object; } interface PluginCleanupIDs { - cleanupIDs: object; + cleanupIDs: boolean | object; } interface PluginCleanupNumericValues { - cleanupNumericValues: object; + cleanupNumericValues: boolean | object; } interface PluginCleanupListOfValues { - cleanupListOfValues: object; + cleanupListOfValues: boolean | object; } interface PluginMoveElemsAttrsToGroup { - moveElemsAttrsToGroup: object; + moveElemsAttrsToGroup: boolean | object; } interface PluginMoveGroupAttrsToElems { - moveGroupAttrsToElems: object; + moveGroupAttrsToElems: boolean | object; } interface PluginCollapseGroups { - collapseGroups: object; + collapseGroups: boolean | object; } interface PluginRemoveRasterImages { - removeRasterImages: object; + removeRasterImages: boolean | object; } interface PluginMergePaths { - mergePaths: object; + mergePaths: boolean | object; } interface PluginConvertShapeToPath { - convertShapeToPath: object; + convertShapeToPath: boolean | object; } interface PluginSortAttrs { - sortAttrs: object; + sortAttrs: boolean | object; } interface PluginTransformsWithOnePath { - transformsWithOnePath: object; + transformsWithOnePath: boolean | object; } interface PluginRemoveDimensions { - removeDimensions: object; + removeDimensions: boolean | object; } interface PluginRemoveAttrs { - removeAttrs: object; + removeAttrs: boolean | object; } interface PluginRemoveElementsByAttr { - removeElementsByAttr: object; + removeElementsByAttr: boolean | object; } interface PluginAddClassesToSVGElement { - addClassesToSVGElement: object; + addClassesToSVGElement: boolean | object; } interface PluginAddAttributesToSVGElement { - addAttributesToSVGElement: object; + addAttributesToSVGElement: boolean | object; } interface PluginRemoveStyleElement { - removeStyleElement: object; + removeStyleElement: boolean | object; } interface PluginRemoveScriptElement { - removeScriptElement: object; + removeScriptElement: boolean | object; } type PluginConfig = @@ -221,16 +222,107 @@ type PluginConfig = | PluginRemoveStyleElement | PluginRemoveScriptElement; +interface Js2SvgOptions { + /** @default '' */ + doctypeEnd?: string; + /** @default '' */ + procInstEnd?: string; + /** @default '<' */ + tagOpenStart?: string; + /** @default '>' */ + tagOpenEnd?: string; + /** @default '' */ + tagCloseEnd?: string; + /** @default '<' */ + tagShortStart?: string; + /** @default '/>' */ + tagShortEnd?: string; + /** @default '="' */ + attrStart?: string; + /** @default '"' */ + attrEnd?: string; + /** @default '' */ + commentEnd?: string; + /** @default '' */ + cdataEnd?: string; + /** @default '' */ + textStart?: string; + /** @default '' */ + textEnd?: string; + /** @default 4 */ + indent?: number; + /** @default /[&'"<>]/g */ + regEntities?: RegExp; + /** @default /[&"<>]/g */ + regValEntities?: RegExp; + /** @default encodeEntity */ + encodeEntity?: (char?: string) => string; + /** @default false */ + pretty?: boolean; + /** @default true */ + useShortTags?: boolean; +} + +interface Svg2JsOptions { + /** @default true */ + strict?: boolean; + /** @default false */ + trim?: boolean; + /** @default true */ + normalize?: boolean; + /** @default true */ + lowercase?: boolean; + /** @default true */ + xmlns?: boolean; + /** @default true */ + position?: boolean; +} + interface Options { - datauri?: string; + /** Output as Data URI string. */ + datauri?: "base64" | "enc" | "unenc"; + + /** Precision of floating point numbers. Will be passed to each plugin that suppors this param. */ floatPrecision?: number; + + /** Use full set of plugins. */ full?: boolean; + + /** Options for rendering optimized SVG from AST. */ + js2svg?: Js2SvgOptions; + + /** + * Individual plugin configurations. + * For specific options, see plugin source in https://github.com/svg/svgo/tree/master/plugins. + */ plugins?: PluginConfig[]; + + /** Options for parsing original SVG into AST. */ + svg2js?: Svg2JsOptions; +} + +interface SvgInfo { + path?: string; +} + +interface OptimizedSvg { + data: string; + info: object; } declare class SVGO { constructor(options?: Options); - optimize(code: string, callback: (result: any) => void): void; + optimize(svgString: string, info?: SvgInfo): Promise; } export = SVGO; diff --git a/types/svgo/svgo-tests.ts b/types/svgo/svgo-tests.ts index 9761316bf0..fae53a127d 100644 --- a/types/svgo/svgo-tests.ts +++ b/types/svgo/svgo-tests.ts @@ -5,21 +5,23 @@ let svgo = new SVGO(); svgo = new SVGO({}); svgo = new SVGO({ plugins: [] }); svgo = new SVGO({ plugins: [{ cleanupAttrs: {} }] }); -svgo = new SVGO({ datauri: "datauri:" }); +svgo = new SVGO({ datauri: "base64" }); svgo = new SVGO({ floatPrecision: 2 }); svgo = new SVGO({ full: true }); svgo = new SVGO({ plugins: [], - datauri: "datauri:", + datauri: "enc", floatPrecision: 2, - full: true + full: true, + js2svg: { + indent: 2, + pretty: true, + }, + svg2js: { + trim: true, + } }); // SVGO instance methods -svgo.optimize(``, result => { - if (result.error) { - result.error; - } else { - result.data; - } -}); +svgo.optimize(``, { path: "filepath" }) + .then(result => result.data, error => error); diff --git a/types/svgo/tsconfig.json b/types/svgo/tsconfig.json index e2cdf41913..ec4687a1d9 100644 --- a/types/svgo/tsconfig.json +++ b/types/svgo/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "svgo-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/swagger-express-middleware/swagger-express-middleware-tests.ts b/types/swagger-express-middleware/swagger-express-middleware-tests.ts index 6ba847fe3f..1a01d8475d 100644 --- a/types/swagger-express-middleware/swagger-express-middleware-tests.ts +++ b/types/swagger-express-middleware/swagger-express-middleware-tests.ts @@ -1,5 +1,5 @@ -import * as express from "express"; -import * as SwaggerExpressMiddleware from "swagger-express-middleware"; +import express = require("express"); +import SwaggerExpressMiddleware = require("swagger-express-middleware"); let app = express(); let router = express.Router(); diff --git a/types/swagger-express-mw/swagger-express-mw-tests.ts b/types/swagger-express-mw/swagger-express-mw-tests.ts index 617e331e1c..9f81cf8a2d 100644 --- a/types/swagger-express-mw/swagger-express-mw-tests.ts +++ b/types/swagger-express-mw/swagger-express-mw-tests.ts @@ -1,5 +1,5 @@ import * as SwaggerExpress from "swagger-express-mw"; -import * as express from "express"; +import express = require("express"); const app = express(); const config: SwaggerExpress.Config = { diff --git a/types/swagger-express-mw/tsconfig.json b/types/swagger-express-mw/tsconfig.json index c529b14c27..de623e0eca 100644 --- a/types/swagger-express-mw/tsconfig.json +++ b/types/swagger-express-mw/tsconfig.json @@ -14,7 +14,18 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ], + "catbox": [ + "catbox/v7" + ], + "hapi": [ + "hapi/v16" + ], + "inert": [ + "inert/v4" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/swagger-hapi/tsconfig.json b/types/swagger-hapi/tsconfig.json index ea5343eb59..0b6f0cf5ed 100644 --- a/types/swagger-hapi/tsconfig.json +++ b/types/swagger-hapi/tsconfig.json @@ -14,7 +14,18 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ], + "catbox": [ + "catbox/v7" + ], + "hapi": [ + "hapi/v16" + ], + "inert": [ + "inert/v4" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/swagger-jsdoc/swagger-jsdoc-tests.ts b/types/swagger-jsdoc/swagger-jsdoc-tests.ts index 2a87ae2dab..4cf386e48a 100644 --- a/types/swagger-jsdoc/swagger-jsdoc-tests.ts +++ b/types/swagger-jsdoc/swagger-jsdoc-tests.ts @@ -1,6 +1,4 @@ -/// - -import * as express from 'express'; +import express = require('express'); import swaggerJSDoc = require('swagger-jsdoc'); const app = express(); diff --git a/types/swagger-node-runner/swagger-node-runner-tests.ts b/types/swagger-node-runner/swagger-node-runner-tests.ts index 9890bed290..1deae28f23 100644 --- a/types/swagger-node-runner/swagger-node-runner-tests.ts +++ b/types/swagger-node-runner/swagger-node-runner-tests.ts @@ -1,6 +1,6 @@ import * as SwaggerNodeRunner from "swagger-node-runner"; -import * as express from "express"; -import * as connect from "connect"; +import express = require("express"); +import connect = require("connect"); import * as Hapi from "hapi"; import * as restify from "restify"; import * as sails from "sails.io.js"; diff --git a/types/swagger-node-runner/tsconfig.json b/types/swagger-node-runner/tsconfig.json index 1d3ae44a1a..43f153e823 100644 --- a/types/swagger-node-runner/tsconfig.json +++ b/types/swagger-node-runner/tsconfig.json @@ -14,7 +14,18 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ], + "catbox": [ + "catbox/v7" + ], + "hapi": [ + "hapi/v16" + ], + "inert": [ + "inert/v4" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/swagger-restify-mw/tsconfig.json b/types/swagger-restify-mw/tsconfig.json index a9dcb8c0da..89ba456bbf 100644 --- a/types/swagger-restify-mw/tsconfig.json +++ b/types/swagger-restify-mw/tsconfig.json @@ -14,7 +14,18 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ], + "catbox": [ + "catbox/v7" + ], + "hapi": [ + "hapi/v16" + ], + "inert": [ + "inert/v4" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/swagger-sails-hook/tsconfig.json b/types/swagger-sails-hook/tsconfig.json index 44a316b98b..0fd1188f61 100644 --- a/types/swagger-sails-hook/tsconfig.json +++ b/types/swagger-sails-hook/tsconfig.json @@ -14,7 +14,18 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ], + "catbox": [ + "catbox/v7" + ], + "hapi": [ + "hapi/v16" + ], + "inert": [ + "inert/v4" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/swagger-schema-official/index.d.ts b/types/swagger-schema-official/index.d.ts index 48173c0883..dc184d3e91 100644 --- a/types/swagger-schema-official/index.d.ts +++ b/types/swagger-schema-official/index.d.ts @@ -87,7 +87,7 @@ export interface Path { options?: Operation; head?: Operation; patch?: Operation; - parameters?: [Parameter]; + parameters?: Parameter[]; } // ----------------------------- Operation ----------------------------------- diff --git a/types/swagger-tools/swagger-tools-tests.ts b/types/swagger-tools/swagger-tools-tests.ts index 7b05595269..58e978a0e4 100644 --- a/types/swagger-tools/swagger-tools-tests.ts +++ b/types/swagger-tools/swagger-tools-tests.ts @@ -1,6 +1,6 @@ // 2.0 examples from https://github.com/apigee-127/swagger-tools/blob/master/examples/2.0/index.js -import * as connect from 'connect'; +import connect = require('connect'); import { createServer } from 'http'; import * as swaggerTools from 'swagger-tools'; diff --git a/types/swig-email-templates/tsconfig.json b/types/swig-email-templates/tsconfig.json index 987a6f629a..b25f125136 100644 --- a/types/swig-email-templates/tsconfig.json +++ b/types/swig-email-templates/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "swig-email-templates-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/swiper/index.d.ts b/types/swiper/index.d.ts index 5f4cf01298..65872facd2 100644 --- a/types/swiper/index.d.ts +++ b/types/swiper/index.d.ts @@ -320,8 +320,8 @@ declare class Swiper { enableMousewheelControl(): void; disableKeyboardControl(): void; enableKeyboardControl(): void; - disableTouchContro(): void; - enableTouchContro(): void; + disableTouchControl(): void; + enableTouchControl(): void; unsetGrabCursor(): void; setGrabCursor(): void; diff --git a/types/tabris-plugin-firebase/tsconfig.json b/types/tabris-plugin-firebase/tsconfig.json index 118339f812..cac6477844 100644 --- a/types/tabris-plugin-firebase/tsconfig.json +++ b/types/tabris-plugin-firebase/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "tabris-plugin-firebase-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/tar-fs/index.d.ts b/types/tar-fs/index.d.ts new file mode 100644 index 0000000000..07c02bab4b --- /dev/null +++ b/types/tar-fs/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for tar-fs 1.16 +// Project: https://github.com/mafintosh/tar-fs +// Definitions by: Umoxfo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +// Imported from: https://github.com/soywiz/typescript-node-definitions/d.ts + +/// + +import fs = require("fs"); + +export function pack(cwd: string, opts?: PackOptions): any; +export function extract(cwd: string, opts?: ExtractOptions): any; + +export interface Options { + ignore?: (name: string) => boolean; + filter?: (name: string) => boolean; + map?: (header: Headers) => Headers; + mapStream?: (fileStream: fs.ReadStream, header: Headers) => fs.ReadStream; + strict?: boolean; +} + +export interface PackOptions extends Options { + entries?: string[]; + dereference?: boolean; + finalize?: boolean; + finish?: (pack: any) => void; +} + +export interface ExtractOptions extends Options { + ignore?: (name: string, header?: Headers) => boolean; + filter?: (name: string, header?: Headers) => boolean; + dmode?: number; + fmode?: number; + readable?: boolean; + writable?: boolean; +} + +export interface Headers { + name: string; + mode: number; + mtime: Date; + size: number; + type: "file" | "directory" | "symlink"; + uid: number; + gid: number; +} diff --git a/types/tar-fs/tar-fs-tests.ts b/types/tar-fs/tar-fs-tests.ts new file mode 100644 index 0000000000..a419f907cb --- /dev/null +++ b/types/tar-fs/tar-fs-tests.ts @@ -0,0 +1,98 @@ +import tar = require("tar-fs"); +import fs = require("fs"); +import path = require("path"); +import stream = require("stream"); + +/* + * Default test + */ +// packing a directory +tar.pack('./my-directory').pipe(fs.createWriteStream('my-tarball.tar')); + +// extracting a directory +fs.createReadStream('my-other-tarball.tar').pipe(tar.extract('./my-other-directory')); + +/* + * Ignore various files + */ +tar.pack('./my-directory', { + ignore: (name) => { + return path.extname(name) === '.bin'; // ignore .bin files when packing + } +}); + +tar.extract('./my-other-directory', { + ignore: (name) => { + return path.extname(name) === '.bin'; // ignore .bin files inside the tarball when extracing + } +}); + +tar.extract('./my-other-other-directory', { + ignore: (_, header) => { + // pass files & directories, ignore e.g. symlinks + return header.type !== 'file' && header.type !== 'directory'; + } +}); + +/* + * Specify which entries to pack + */ +tar.pack('./my-directory', { + entries: ['file1', 'subdir/file2'], // only the specific entries will be packed +}); + +/* + * Modify the headers by map + */ +tar.pack('./my-directory', { + map: (header) => { + header.name = 'prefixed/' + header.name; + return header; + } +}); + +tar.extract('./my-directory', { + map: (header) => { + header.name = 'another-prefix/' + header.name; + return header; + } +}); + +/* + * Modify the headers by mapStream + */ +tar.pack('./my-directory', { + mapStream: (fileStream, header) => { + if (path.extname(header.name) === '.js') { + return fileStream; + } + return fileStream; + } +}); + +tar.extract('./my-directory', { + mapStream: (fileStream, header) => { + if (path.extname(header.name) === '.js') { + return fileStream; + } + return fileStream; + } +}); + +/* + * The corresponding modes + */ +tar.extract('./my-directory', { + dmode: parseInt("555", 8), + fmode: parseInt("444", 8), + readable: true, + writable: true, +}); + +/* + * The other options + */ +tar.pack('./my-directory', { + strict: false, + dereference: true, +}); diff --git a/types/fuse/tsconfig.json b/types/tar-fs/tsconfig.json similarity index 94% rename from types/fuse/tsconfig.json rename to types/tar-fs/tsconfig.json index 8f6b34f5d3..83965ab819 100644 --- a/types/fuse/tsconfig.json +++ b/types/tar-fs/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "fuse-tests.ts" + "tar-fs-tests.ts" ] } \ No newline at end of file diff --git a/types/tar-fs/tslint.json b/types/tar-fs/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/tar-fs/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/tcp-ping/tsconfig.json b/types/tcp-ping/tsconfig.json index 20d82ad303..f070f6f798 100644 --- a/types/tcp-ping/tsconfig.json +++ b/types/tcp-ping/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "tcp-ping-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/tedious/index.d.ts b/types/tedious/index.d.ts index 2f3fe528d7..409ff67878 100644 --- a/types/tedious/index.d.ts +++ b/types/tedious/index.d.ts @@ -481,7 +481,7 @@ export declare class Connection extends events.EventEmitter { * @param name A string representing a name to associate with the transaction. Optional, and defaults to an empty string. In case of a nested transaction, naming the transaction name has no effect. * @param isolationLevel The isolation level that the transaction is to be run with. */ - transaction(callback: (error: Error, done: (error?: Error) => void) => void, name?: string, isolationLevel?: ISOLATION_LEVEL): void; + transaction(callback: (error: Error, done: (error?: Error, doneCallback?: (error?: Error, ...args: any[]) => void, ...args: any[]) => void) => void, name?: string, isolationLevel?: ISOLATION_LEVEL): void; /** * Prepare the SQL represented by the request. The request can then be used in subsequent calls to execute and unprepare diff --git a/types/telebot/telebot-tests.ts b/types/telebot/telebot-tests.ts index 3bb9677b5d..ea4851c27b 100644 --- a/types/telebot/telebot-tests.ts +++ b/types/telebot/telebot-tests.ts @@ -1,4 +1,4 @@ -import * as TeleBot from "telebot"; +import TeleBot = require("telebot"); let bot = new TeleBot('token'); bot = new TeleBot({ diff --git a/types/testingbot-api/testingbot-api-tests.ts b/types/testingbot-api/testingbot-api-tests.ts index 2b8cd1f655..39ac0d8f81 100644 --- a/types/testingbot-api/testingbot-api-tests.ts +++ b/types/testingbot-api/testingbot-api-tests.ts @@ -1,4 +1,4 @@ -import * as TestingBot from 'testingbot-api'; +import TestingBot = require('testingbot-api'); const sessionId = '123'; diff --git a/types/text-buffer/tsconfig.json b/types/text-buffer/tsconfig.json index dd4d1eeb3e..c11c286ff7 100644 --- a/types/text-buffer/tsconfig.json +++ b/types/text-buffer/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "text-buffer-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/three/index.d.ts b/types/three/index.d.ts index 2cea550034..e553853293 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for three.js 0.89 // Project: https://threejs.org -// Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot , HouChunlei , Ivo , David Asmuth , Brandon Roberge, Qinsi ZHU , Toshiya Nakakura , Poul Kjeldager Sørensen , Stefan Profanter , Edmund Fokschaner , Roelof Jooste , Daniel Hritzkiv +// Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot , HouChunlei , Ivo , David Asmuth , Brandon Roberge, Qinsi ZHU , Toshiya Nakakura , Poul Kjeldager Sørensen , Stefan Profanter , Edmund Fokschaner , Roelof Jooste , Daniel Hritzkiv , Apurva Ojas // Definitions: https://github.com//DefinitelyTyped export * from "./three-core"; @@ -27,6 +27,7 @@ export * from "./three-projector"; export * from "./three-renderpass"; export * from "./three-shaderpass"; export * from "./three-smaapass"; +export * from "./three-filmpass"; export * from "./three-trackballcontrols"; export * from "./three-transformcontrols"; export * from "./three-vrcontrols"; diff --git a/types/three/test/references.ts b/types/three/test/references.ts index c5d3c66909..e2068d68a5 100644 --- a/types/three/test/references.ts +++ b/types/three/test/references.ts @@ -1,5 +1,4 @@ // References used by tests -/// /// /// diff --git a/types/three/test/webgl/webgl_animation_skinning_morph.ts b/types/three/test/webgl/webgl_animation_skinning_morph.ts index fcea4bba08..835d7a6ea5 100644 --- a/types/three/test/webgl/webgl_animation_skinning_morph.ts +++ b/types/three/test/webgl/webgl_animation_skinning_morph.ts @@ -186,18 +186,8 @@ } function initGUI() { - - var API = { - 'show model' : true, - 'show skeleton' : false - }; - - var gui = new dat.GUI(); - - gui.add( API, 'show model' ).onChange( function() { mesh.visible = API[ 'show model' ]; } ); - - gui.add( API, 'show skeleton' ).onChange( function() { helper.visible = API[ 'show skeleton' ]; } ); - + mesh.visible = true; + helper.visible = true; } function onDocumentMouseMove( event: MouseEvent ) { diff --git a/types/three/test/webgl/webgl_geometries.ts b/types/three/test/webgl/webgl_geometries.ts index 89e0af480c..d09b865c6d 100644 --- a/types/three/test/webgl/webgl_geometries.ts +++ b/types/three/test/webgl/webgl_geometries.ts @@ -20,7 +20,7 @@ scene = new THREE.Scene(); - var light: THREE.DirectionalLight, object: THREE.Mesh | THREE.AxisHelper | THREE.ArrowHelper; + var light: THREE.DirectionalLight, object: THREE.Mesh | THREE.AxesHelper | THREE.ArrowHelper; scene.add(new THREE.AmbientLight(0x404040)); @@ -76,11 +76,11 @@ // - var points: THREE.Vector3[] = []; + var points: THREE.Vector2[] = []; for (var i = 0; i < 50; i++) { - points.push(new THREE.Vector3(Math.sin(i * 0.2) * Math.sin(i * 0.1) * 15 + 50, 0, (i - 5) * 2)); + points.push(new THREE.Vector2(Math.sin(i * 0.2) * Math.sin(i * 0.1) * 15 + 50, 0)); } @@ -96,7 +96,7 @@ object.position.set(0, 0, -200); scene.add(object); - object = new THREE.AxisHelper(50); + object = new THREE.AxesHelper(50); object.position.set(200, 0, -200); scene.add(object); @@ -165,4 +165,4 @@ } -} \ No newline at end of file +} diff --git a/types/three/test/webgl/webgl_interactive_raycasting_points.ts b/types/three/test/webgl/webgl_interactive_raycasting_points.ts index ced8feb6c6..7f6f163a28 100644 --- a/types/three/test/webgl/webgl_interactive_raycasting_points.ts +++ b/types/three/test/webgl/webgl_interactive_raycasting_points.ts @@ -215,7 +215,7 @@ // var sphereGeometry = new THREE.SphereGeometry(0.1, 32, 32); - var sphereMaterial = new THREE.MeshBasicMaterial({color: 0xff0000, shading: THREE.FlatShading}); + var sphereMaterial = new THREE.MeshBasicMaterial({color: 0xff0000, flatShading: true}); for (var i = 0; i < 40; i++) { @@ -313,4 +313,4 @@ renderer.render(scene, camera); } -} \ No newline at end of file +} diff --git a/types/three/test/webgl/webgl_lights_hemisphere.ts b/types/three/test/webgl/webgl_lights_hemisphere.ts index 108419f4ad..c0daf3773f 100644 --- a/types/three/test/webgl/webgl_lights_hemisphere.ts +++ b/types/three/test/webgl/webgl_lights_hemisphere.ts @@ -113,7 +113,7 @@ loader.load( "models/animated/flamingo.js", function( geometry ) { - var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0xffffff, shininess: 20, morphTargets: true, vertexColors: THREE.FaceColors, shading: THREE.FlatShading } ); + var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0xffffff, shininess: 20, morphTargets: true, vertexColors: THREE.FaceColors, flatShading: true } ); var mesh = new THREE.Mesh( geometry, material ); var s = 0.35; diff --git a/types/three/test/webgl/webgl_materials.ts b/types/three/test/webgl/webgl_materials.ts index 23d2d98a23..68235c5e5c 100644 --- a/types/three/test/webgl/webgl_materials.ts +++ b/types/three/test/webgl/webgl_materials.ts @@ -56,20 +56,20 @@ materials.push(new THREE.MeshLambertMaterial({ map: texture, transparent: true })); materials.push(new THREE.MeshLambertMaterial({ color: 0xdddddd })); - materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.FlatShading })); + materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, flatShading: true })); materials.push(new THREE.MeshNormalMaterial()); materials.push(new THREE.MeshBasicMaterial({ color: 0xffaa00, transparent: true, blending: THREE.AdditiveBlending })); //materials.push( new THREE.MeshBasicMaterial( { color: 0xff0000, blending: THREE.SubtractiveBlending } ) ); materials.push(new THREE.MeshLambertMaterial({ color: 0xdddddd })); - materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.SmoothShading, map: texture, transparent: true })); + materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, flatShading: false, map: texture, transparent: true })); materials.push(new THREE.MeshNormalMaterial({})); materials.push(new THREE.MeshBasicMaterial({ color: 0xffaa00, wireframe: true })); materials.push(new THREE.MeshDepthMaterial()); materials.push(new THREE.MeshLambertMaterial({ color: 0x666666, emissive: 0xff0000 })); - materials.push(new THREE.MeshPhongMaterial({ color: 0x000000, specular: 0x666666, emissive: 0xff0000, shininess: 10, shading: THREE.SmoothShading, opacity: 0.9, transparent: true })); + materials.push(new THREE.MeshPhongMaterial({ color: 0x000000, specular: 0x666666, emissive: 0xff0000, shininess: 10, flatShading: false, opacity: 0.9, transparent: true })); materials.push(new THREE.MeshBasicMaterial({ map: texture, transparent: true })); @@ -100,7 +100,7 @@ let material = materials[i]; geometry = material instanceof THREE.MeshFaceMaterial ? geometry_pieces : - (material.shading == THREE.FlatShading ? geometry_flat : geometry_smooth); + (material.flatShading ? geometry_flat : geometry_smooth); sphere = new THREE.Mesh(geometry, material); diff --git a/types/three/test/webgl/webgl_postprocessing.ts b/types/three/test/webgl/webgl_postprocessing.ts index 0c768eccea..dff5ec5592 100644 --- a/types/three/test/webgl/webgl_postprocessing.ts +++ b/types/three/test/webgl/webgl_postprocessing.ts @@ -26,7 +26,7 @@ scene.add(object); var geometry = new THREE.SphereGeometry(1, 4, 4); - var material = new THREE.MeshPhongMaterial({ color: 0xffffff, shading: THREE.FlatShading }); + var material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); for (var i = 0; i < 100; i++) { @@ -84,4 +84,4 @@ composer.render(); } -} \ No newline at end of file +} diff --git a/types/three/test/webvr/webvr.ts b/types/three/test/webvr/webvr.ts new file mode 100644 index 0000000000..e831e493ee --- /dev/null +++ b/types/three/test/webvr/webvr.ts @@ -0,0 +1,13 @@ +// WebVRManager support + +() => { + const renderer = new THREE.WebGLRenderer(); + renderer.vr.enabled = true; + const camera = new THREE.PerspectiveCamera(); + const vrCamera = renderer.vr.getCamera(camera); + const display: VRDisplay = renderer.vr.getDevice(); + renderer.vr.setDevice(display); + const obj = new THREE.Object3D(); + renderer.vr.setPoseTarget(obj); + renderer.vr.dispose(); +} diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 880a150a06..a5e2b6486c 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -271,7 +271,7 @@ export class AnimationClip { optimize(): AnimationClip; static CreateFromMorphTargetSequence( name: string, morphTargetSequence: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip; - static findByName( clipArray: AnimationClip, name: string ): AnimationClip; + static findByName( clipArray: AnimationClip[], name: string ): AnimationClip; static CreateClipsFromMorphTargetSequences( morphTargets: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip[]; static parse( json: any ): AnimationClip; static parseAnimation( animation: any, bones: Bone[], nodeName: string ): AnimationClip; @@ -286,7 +286,7 @@ export class AnimationMixer extends EventDispatcher { clipAction(clip: AnimationClip, root?: any): AnimationAction; existingAction(clip: AnimationClip, root?: any): AnimationAction; - stopAllAction(clip: AnimationClip, root?: any): AnimationMixer; + stopAllAction(): AnimationMixer; update(deltaTime: number): AnimationMixer; getRoot(): any; uncacheClip(clip: AnimationClip): void; @@ -450,11 +450,6 @@ export class Camera extends Object3D { getWorldDirection(optionalTarget?: Vector3): Vector3; - /** - * This make the camera look at the vector position in local space. - * @param vector point to look at - */ - lookAt(vector: Vector3): void; } export class CubeCamera extends Object3D { @@ -462,6 +457,9 @@ export class CubeCamera extends Object3D { renderTarget: WebGLRenderTargetCube; + /** + * @deprecated Use {@link CubeCamera#update .update()} instead + */ updateCubeMap(renderer: Renderer, scene: Scene): void; update(renderer: Renderer, scene: Scene): void; @@ -640,7 +638,7 @@ export class PerspectiveCamera extends Camera { toJSON(meta?: any): any; /** - * @deprecated + * @deprecated Use {@link PerspectiveCamera#setFocalLength .setFocalLength()} and {@link PerspectiveCamera#filmGauge .filmGauge} instead. */ setLens(focalLength: number, frameHeight?: number): void; } @@ -656,6 +654,13 @@ export class StereoCamera extends Camera { update(camera: PerspectiveCamera): void; } +export class ArrayCamera extends PerspectiveCamera { + constructor(cameras?: PerspectiveCamera[]); + + cameras: PerspectiveCamera[]; + isArrayCamera: true; +} + // Core /////////////////////////////////////////////////////////////////////////////////////////////// /** @@ -699,7 +704,7 @@ export class BufferAttribute { setXYZ(index: number, x: number, y: number, z: number): BufferAttribute; setXYZW(index: number, x: number, y: number, z: number, w: number): BufferAttribute; /** - * @deprecated Use count instead. + * @deprecated Use {@link BufferAttribute#count .count} instead. */ length: number; } @@ -804,7 +809,7 @@ export class Float64BufferAttribute extends BufferAttribute { } /** - * @deprecated, use new THREE.BufferAttribute().setDynamic( true ). + * @deprecated Use {@link BufferAttribute#setDynamic THREE.BufferAttribute().setDynamic( true )} instead. */ export class DynamicBufferAttribute extends BufferAttribute {} @@ -906,14 +911,30 @@ export class BufferGeometry extends EventDispatcher { dispose(): void; /** - * @deprecated + * @deprecated Use {@link BufferGeometry#groups .groups} instead. */ drawcalls: any; + + /** + * @deprecated Use {@link BufferGeometry#groups .groups} instead. + */ offsets: any; + /** + * @deprecated Use {@link BufferGeometry#setIndex .setIndex()} instead. + */ addIndex(index: any): void; + + /** + * @deprecated Use {@link BufferGeometry#addGroup .addGroup()} instead. + */ addDrawCall(start: any, count: any, indexOffset?: any): void; + + /** + * @deprecated Use {@link BufferGeometry#clearGroups .clearGroups()} instead. + */ clearDrawCalls(): void; + addAttribute(name: any, array: any, itemSize: any): any; } @@ -1152,7 +1173,7 @@ export class Face3 { } /** - * @deprecated Use Face3 instead. + * @deprecated Use {@link Face3} instead. */ export class Face4 extends Face3 {} @@ -1407,11 +1428,11 @@ export class Geometry extends EventDispatcher { */ export namespace GeometryUtils { /** - * @deprecated Use geometry.merge( geometry2, matrix, materialIndexOffset ). + * @deprecated Use {@link Geometry#merge geometry.merge( geometry2, matrix, materialIndexOffset )} instead. */ export function merge(geometry1: any, geometry2: any, materialIndexOffset?: any): any; /** - * @deprecated Use geometry.center(). + * @deprecated Use {@link Geometry#center geometry.center()} instead. */ export function center(geometry: any): any; } @@ -1496,7 +1517,7 @@ export class InterleavedBufferAttribute { setXYZ(index: number, x: number, y: number, z: number): InterleavedBufferAttribute; setXYZW(index: number, x: number, y: number, z: number, w: number): InterleavedBufferAttribute; /** - * @deprecated Use count instead. + * @deprecated Use {@link InterleavedBufferAttribute#count .count} instead. */ length: number; } @@ -1613,6 +1634,12 @@ export class Object3D extends EventDispatcher { */ userData: any; + /** + * Used to check whether this or derived classes are Object3Ds. Default is true. + * You should not change this, as it is used internally for optimisation. + */ + isObject3D: boolean; + /** * Calls before rendering object */ @@ -1663,6 +1690,13 @@ export class Object3D extends EventDispatcher { */ rotateOnAxis(axis: Vector3, angle: number): Object3D; + /** + * Rotate an object along an axis in world space. The axis is assumed to be normalized. Method Assumes no rotated parent. + * @param axis A normalized vector in object space. + * @param angle The angle in radians. + */ + rotateOnWorldAxis(axis: Vector3, angle: number): Object3D; + /** * * @param angle @@ -1722,6 +1756,7 @@ export class Object3D extends EventDispatcher { * @param vector A world vector to look at. */ lookAt(vector: Vector3): void; + lookAt(x: number, y: number, z: number): void; /** * Adds object as child of this object. @@ -1731,7 +1766,7 @@ export class Object3D extends EventDispatcher { /** * Removes object as child of this object. */ - remove(object: Object3D): void; + remove(...object: Object3D[]): void; /** * Searches through the object's children and returns the first with a matching id, optionally recursive. @@ -1781,13 +1816,6 @@ export class Object3D extends EventDispatcher { * @param recursive */ copy(source: this, recursive?: boolean): this; - - /** - * @deprecated - */ - eulerOrder: string; - getChildByName(name: string): Object3D; - translate(distance: number, axis: Vector3): Object3D; } export interface Intersection { @@ -2047,6 +2075,7 @@ export class SpotLight extends Light { } export class SpotLightShadow extends LightShadow { + camera: PerspectiveCamera; update(light: Light): void; } @@ -2092,6 +2121,9 @@ export class Loader { */ crossOrigin: string; + /** + * @deprecated Use THREE.LoaderUtils.extractUrlBase() instead. + */ extractUrlBase(url: string): string; initMaterials(materials: Material[], texturePath: string): Material[]; createMaterial(m: Material, texturePath: string, crossOrigin?: string): boolean; @@ -2292,7 +2324,7 @@ export class DataTextureLoader { } /** - * @deprecated since 0.84.0. Use DataTextureLoader (renamed) + * @deprecated since 0.84.0. Use {@link DataTextureLoader} (renamed) */ export class BinaryTextureLoader extends DataTextureLoader {} @@ -2357,8 +2389,6 @@ export interface MaterialParameters { transparent?: boolean; vertexColors?: Colors; visible?: boolean; - - shading?: Shading; } /** @@ -2591,15 +2621,6 @@ export class Material extends EventDispatcher { */ update(): void; - /** - * @deprecated - */ - warpRGB: Color; - - /** - * @deprecated Removed, use .flatShading instead. - */ - shading: Shading; } export interface LineBasicMaterialParameters extends MaterialParameters { @@ -2655,7 +2676,6 @@ export interface MeshBasicMaterialParameters extends MaterialParameters { combine?: Combine; reflectivity?: number; refractionRatio?: number; - shading?: Shading; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; @@ -2677,7 +2697,6 @@ export class MeshBasicMaterial extends Material { combine: Combine; reflectivity: number; refractionRatio: number; - shading: Shading; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; @@ -2914,7 +2933,7 @@ export class MeshPhongMaterial extends Material { morphTargets: boolean; morphNormals: boolean; /** - * @deprecated + * @deprecated Use {@link MeshStandardMaterial THREE.MeshStandardMaterial} instead. */ metal: boolean; @@ -2938,6 +2957,9 @@ export class MeshPhysicalMaterial extends MeshStandardMaterial { // MultiMaterial does not inherit the Material class in the original code. However, it should treat as Material class. // See tests/canvas/canvas_materials.ts. +/** + * @deprecated Use an Array instead. + */ export class MultiMaterial extends Material { constructor(materials?: Material[]); @@ -2950,7 +2972,7 @@ export class MultiMaterial extends Material { } /** - * @deprecated Use MultiMaterial instead. + * @deprecated Use {@link MultiMaterial} instead. */ export class MeshFaceMaterial extends MultiMaterial {} @@ -2973,15 +2995,15 @@ export class PointsMaterial extends Material { } /** - * @deprecated + * @deprecated Use {@link PointsMaterial THREE.PointsMaterial} instead */ export class PointCloudMaterial extends PointsMaterial {} /** - * @deprecated + * @deprecated Use {@link PointsMaterial THREE.PointsMaterial} instead */ export class ParticleBasicMaterial extends PointsMaterial {} /** - * @deprecated + * @deprecated Use {@link PointsMaterial THREE.PointsMaterial} instead */ export class ParticleSystemMaterial extends PointsMaterial {} @@ -3016,7 +3038,7 @@ export class ShaderMaterial extends Material { morphTargets: boolean; morphNormals: boolean; /** - * @deprecated Use extensions.derivatives instead. + * @deprecated Use {@link ShaderMaterial#extensions.derivatives extensions.derivatives} instead. */ derivatives: any; extensions: { derivatives: boolean; fragDepth: boolean; drawBuffers: boolean; shaderTextureLOD: boolean }; @@ -3082,11 +3104,11 @@ export class Box2 { translate(offset: Vector2): Box2; equals(box: Box2): boolean; /** - * @deprecated Use isEmpty() instead. + * @deprecated Use {@link Box2#isEmpty .isEmpty()} instead. */ empty(): any; /** - * @deprecated Use intersectsBox() instead. + * @deprecated Use {@link Box2#intersectsBox .intersectsBox()} instead. */ isIntersectionBox(b: any): any; } @@ -3127,15 +3149,15 @@ export class Box3 { translate(offset: Vector3): Box3; equals(box: Box3): boolean; /** - * @deprecated Use isEmpty() instead. + * @deprecated Use {@link Box3#isEmpty .isEmpty()} instead. */ empty(): any; /** - * @deprecated Use intersectsBox() instead. + * @deprecated Use {@link Box3#intersectsBox .intersectsBox()} instead. */ isIntersectionBox(b: any): any; /** - * @deprecated Use intersectsSphere() instead. + * @deprecated Use {@link Box3#intersectsSphere .intersectsSphere()} instead. */ isIntersectionSphere(s: any): any; } @@ -3526,7 +3548,8 @@ export namespace Math { /** * Random float from 0 to 1 with 16 bits of randomness. * Standard Math.random() creates repetitive patterns when applied over larger space. - * @deprecated Use Math.random() + * + * @deprecated Use {@link Math#random Math.random()} */ export function random16(): number; @@ -3551,9 +3574,20 @@ export namespace Math { export function isPowerOfTwo(value: number): boolean; + /** + * @deprecated Use {@link Math#floorPowerOfTwo .floorPowerOfTwo()} + */ export function nearestPowerOfTwo(value: number): number; + /** + * @deprecated Use {@link Math#ceilPowerOfTwo .ceilPowerOfTwo()} + */ export function nextPowerOfTwo(value: number): number; + + export function floorPowerOfTwo(value: number): number; + + export function ceilPowerOfTwo(value: number): number; + } /** @@ -3617,7 +3651,14 @@ export class Matrix3 implements Matrix { clone(): this; copy(m: this): this; setFromMatrix4(m: Matrix4): Matrix3; + + /** + * @deprecated Use {@link Matrix3#applyToBufferAttribute matrix3.applyToBufferAttribute( attribute )} instead. + */ applyToBuffer(buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; + + applyToBufferAttribute(attribute: BufferAttribute): BufferAttribute; + multiplyScalar(s: number): Matrix3; determinant(): number; getInverse(matrix: Matrix3, throwOnDegenerate?: boolean): Matrix3; @@ -3648,11 +3689,19 @@ export class Matrix3 implements Matrix { multiplyMatrices(a: Matrix3, b: Matrix3): Matrix3; /** - * @deprecated + * @deprecated Use {@link Vector3.applyMatrix3 vector.applyMatrix3( matrix )} instead. */ multiplyVector3(vector: Vector3): any; + + /** + * @deprecated This method has been removed completely. + */ multiplyVector3Array(a: any): any; getInverse(matrix: Matrix4, throwOnDegenerate?: boolean): Matrix3; + + /** + * @deprecated Use {@link Matrix3#toArray .toArray()} instead. + */ flattenToArrayOffset(array: number[], offset: number): number[]; } @@ -3723,6 +3772,8 @@ export class Matrix4 implements Matrix { /** * Sets this matrix to a x b and stores the result into the flat array r. * r can be either a regular Array or a TypedArray. + * + * @deprecated This method has been removed completely. */ multiplyToArray(a: Matrix4, b: Matrix4, r: number[]): Matrix4; @@ -3730,7 +3781,14 @@ export class Matrix4 implements Matrix { * Multiplies this matrix by s. */ multiplyScalar(s: number): Matrix4; + + /** + * @deprecated Use {@link Matrix4#applyToBufferAttribute matrix4.applyToBufferAttribute( attribute )} instead. + */ applyToBuffer( buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; + + applyToBufferAttribute(attribute: BufferAttribute): BufferAttribute; + /** * Computes determinant of this matrix. * Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm @@ -3742,14 +3800,11 @@ export class Matrix4 implements Matrix { */ transpose(): Matrix4; - - /** * Sets the position component for this matrix from vector v. */ setPosition(v: Vector3): Matrix4; - /** * Sets this matrix to the inverse of matrix m. * Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm. @@ -3832,15 +3887,43 @@ export class Matrix4 implements Matrix { toArray(): number[]; /** - * @deprecated + * @deprecated Use {@link Matrix4#copyPosition .copyPosition()} instead. */ extractPosition(m: Matrix4): Matrix4; + + /** + * @deprecated Use {@link Matrix4#makeRotationFromQuaternion .makeRotationFromQuaternion()} instead. + */ setRotationFromQuaternion(q: Quaternion): Matrix4; + + /** + * @deprecated Use {@link Vector3#applyMatrix4 vector.applyMatrix4( matrix )} instead. + */ multiplyVector3(v: any): any; + + /** + * @deprecated Use {@link Vector4#applyMatrix4 vector.applyMatrix4( matrix )} instead. + */ multiplyVector4(v: any): any; + + /** + * @deprecated This method has been removed completely. + */ multiplyVector3Array(array: number[]): number[]; + + /** + * @deprecated Use {@link Vector3#transformDirection Vector3.transformDirection( matrix )} instead. + */ rotateAxis(v: any): void; + + /** + * @deprecated Use {@link Vector3#applyMatrix4 vector.applyMatrix4( matrix )} instead. + */ crossVector(v: any): void; + + /** + * @deprecated Use {@link Matrix4#toArray .toArray()} instead. + */ flattenToArrayOffset(array: number[], offset: number): number[]; } @@ -3871,7 +3954,7 @@ export class Plane { equals(plane: Plane): boolean; /** - * @deprecated + * @deprecated Use {@link Plane#intersectsLine .intersectsLine()} instead. */ isIntersectionLine(l: any): any; } @@ -4009,7 +4092,7 @@ export class Quaternion { static slerpFlat(dst: number[], dstOffset: number, src0: number[], srcOffset: number, src1: number[], stcOffset1: number, t: number): Quaternion; /** - * @deprecated + * @deprecated Use {@link Vector#applyQuaternion vector.applyQuaternion( quaternion )} instead. */ multiplyVector3(v: any): any; } @@ -4042,10 +4125,18 @@ export class Ray { equals(ray: Ray): boolean; /** - * @deprecated + * @deprecated Use {@link Ray#intersectsBox .intersectsBox()} instead. */ isIntersectionBox(b: any): any; + + /** + * @deprecated Use {@link Ray#intersectsPlane .intersectsPlane()} instead. + */ isIntersectionPlane(p: any): any; + + /** + * @deprecated Use {@link Ray#intersectsSphere .intersectsSphere()} instead. + */ isIntersectionSphere(s: any): any; } @@ -4326,6 +4417,10 @@ export class Vector2 implements Vector { * Computes length of this vector. */ length(): number; + + /** + * @deprecated Use {@link Vector2#manhattanLength .manhattanLength()} instead. + */ lengthManhattan(): number; /** @@ -4347,6 +4442,10 @@ export class Vector2 implements Vector { * Computes squared distance of this vector to v. */ distanceToSquared(v: Vector2): number; + + /** + * @deprecated Use {@link Vector2#manhattanDistanceTo .manhattanDistanceTo()} instead. + */ distanceToManhattan(v: Vector2): number; /** @@ -4370,6 +4469,26 @@ export class Vector2 implements Vector { fromBufferAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector2; rotateAround( center: Vector2, angle: number ): Vector2; + + /** + * Computes the Manhattan length of this vector. + * + * @return {number} + * + * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry} + */ + manhattanLength(): number; + + /** + * Computes the Manhattan length (distance) from this vector to the given vector v + * + * @param {Vector2} v + * + * @return {number} + * + * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry} + */ + manhattanDistanceTo(v: Vector2): number; } /** @@ -4506,9 +4625,30 @@ export class Vector3 implements Vector { /** * Computes Manhattan length of this vector. * http://en.wikipedia.org/wiki/Taxicab_geometry + * + * @deprecated Use {@link Vector3#manhattanLength .manhattanLength()} instead. */ lengthManhattan(): number; - manhattanDistanceTo(v:Vector3):number; + + /** + * Computes the Manhattan length of this vector. + * + * @return {number} + * + * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry} + */ + manhattanLength(): number; + + /** + * Computes the Manhattan length (distance) from this vector to the given vector v + * + * @param {Vector3} v + * + * @return {number} + * + * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry} + */ + manhattanDistanceTo(v: Vector3): number; /** * Normalizes this vector. @@ -4546,6 +4686,10 @@ export class Vector3 implements Vector { * Computes squared distance of this vector to v. */ distanceToSquared(v: Vector3): number; + + /** + * @deprecated Use {@link Vector3#manhattanDistanceTo .manhattanDistanceTo()} instead. + */ distanceToManhattan(v: Vector3): number; setFromSpherical(s: Spherical): Vector3; @@ -4563,15 +4707,23 @@ export class Vector3 implements Vector { fromBufferAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector3; /** - * @deprecated + * @deprecated Use {@link Vector3#setFromMatrixPosition .setFromMatrixPosition()} instead. */ getPositionFromMatrix(m: Matrix4): Vector3; + + /** + * @deprecated Use {@link Vector3#setFromMatrixScale .setFromMatrixScale()} instead. + */ getScaleFromMatrix(m: Matrix4): Vector3; + + /** + * @deprecated Use {@link Vector3#setFromMatrixColumn .setFromMatrixColumn()} instead. + */ getColumnFromMatrix(index: number, matrix: Matrix4): Vector3; } /** - * @deprecated use THREE.Vector3 instead. + * @deprecated use {@link Vector3 THREE.Vector3} instead. */ export class Vertex extends Vector3 {} @@ -4704,8 +4856,21 @@ export class Vector4 implements Vector { * Computes length of this vector. */ length(): number; + + /** + * @deprecated Use {@link Vector4#manhattanLength .manhattanLength()} instead. + */ lengthManhattan(): number; + /** + * Computes the Manhattan length of this vector. + * + * @return {number} + * + * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry} + */ + manhattanLength(): number; + /** * Normalizes this vector. */ @@ -4793,7 +4958,7 @@ export class LOD extends Object3D { toJSON(meta: any): any; /** - * @deprecated + * @deprecated Use {@link LOD#levels .levels} instead. */ objects: any[]; } @@ -4855,10 +5020,10 @@ export class LineSegments extends Line { } export class Mesh extends Object3D { - constructor(geometry?: Geometry | BufferGeometry, material?: Material | Material []); + constructor(geometry?: Geometry | BufferGeometry, material?: Material); geometry: Geometry|BufferGeometry; - material: Material | Material[]; + material: Material; drawMode: TrianglesDrawModes; morphTargetInfluences?: number[]; morphTargetDictionary?: { [key: string]: number; }; @@ -4899,17 +5064,20 @@ export class Points extends Object3D { } /** - * @deprecated + * @deprecated Use {@link Points THREE.Points} instead. */ export class PointCloud extends Points {} /** - * @deprecated + * @deprecated Use {@link Points THREE.Points} instead. */ export class ParticleSystem extends Points {} export class Skeleton { - constructor(bones: Bone[], boneInverses?: Matrix4[], useVertexTexture?: boolean); + constructor(bones: Bone[], boneInverses?: Matrix4[]); + /** + * @deprecated This property has been removed completely. + */ useVertexTexture: boolean; identityMatrix: Matrix4; bones: Bone[]; @@ -4955,7 +5123,7 @@ export class Sprite extends Object3D { } /** - * @deprecated Use Sprite instead. + * @deprecated Use {@link Sprite Sprite} instead. */ export class Particle extends Sprite {} @@ -5134,6 +5302,8 @@ export class WebGLRenderer implements Renderer { state: WebGLState; allocTextureUnit: any; + vr: WebVRManager; + /** * Return the WebGL context. */ @@ -5141,8 +5311,16 @@ export class WebGLRenderer implements Renderer { getContextAttributes(): any; forceContextLoss(): void; + /** + * @deprecated Use {@link WebGLCapabilities#getMaxAnisotropy .capabilities.getMaxAnisotropy()} instead. + */ getMaxAnisotropy(): number; + + /** + * @deprecated Use {@link WebGLCapabilities#precision .capabilities.precision} instead. + */ getPrecision(): string; + getPixelRatio(): number; setPixelRatio(value: number): void; @@ -5197,6 +5375,10 @@ export class WebGLRenderer implements Renderer { clearDepth(): void; clearStencil(): void; clearTarget(renderTarget: WebGLRenderTarget, color: boolean, depth: boolean, stencil: boolean): void; + + /** + * @deprecated Use {@link WebGLState#reset .state.reset()} instead. + */ resetGLState(): void; dispose(): void; @@ -5232,7 +5414,7 @@ export class WebGLRenderer implements Renderer { setTextureCube(texture: Texture, slot: number): void; getRenderTarget(): RenderTarget; /** - * @deprecated Use getRenderTarget instead. + * @deprecated Use {@link WebGLRenderer#getRenderTarget .getRenderTarget()} instead. */ getCurrentRenderTarget(): RenderTarget; setRenderTarget(renderTarget: RenderTarget): void; @@ -5242,18 +5424,65 @@ export class WebGLRenderer implements Renderer { * @deprecated */ gammaFactor: number; + + /** + * @deprecated Use {@link WebGLShadowMap#enabled .shadowMap.enabled} instead. + */ shadowMapEnabled: boolean; + + /** + * @deprecated Use {@link WebGLShadowMap#type .shadowMap.type} instead. + */ shadowMapType: ShadowMapType; + + /** + * @deprecated Use {@link WebGLShadowMap#cullFace .shadowMap.cullFace} instead. + */ shadowMapCullFace: CullFace; + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'OES_texture_float' )} instead. + */ supportsFloatTextures(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'OES_texture_half_float' )} instead. + */ supportsHalfFloatTextures(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'OES_standard_derivatives' )} instead. + */ supportsStandardDerivatives(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'WEBGL_compressed_texture_s3tc' )} instead. + */ supportsCompressedTextureS3TC(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'WEBGL_compressed_texture_pvrtc' )} instead. + */ supportsCompressedTexturePVRTC(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'EXT_blend_minmax' )} instead. + */ supportsBlendMinMax(): any; + + /** + * @deprecated Use {@link WebGLCapabilities#vertexTextures .capabilities.vertexTextures} instead. + */ supportsVertexTextures(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'ANGLE_instanced_arrays' )} instead. + */ supportsInstancedArrays(): any; + + /** + * @deprecated Use {@link WebGLRenderer#setScissorTest .setScissorTest()} instead. + */ enableScissorTest(boolean: any): any; } @@ -5317,43 +5546,43 @@ export class WebGLRenderTarget extends EventDispatcher { stencilBuffer: boolean; depthTexture: Texture; /** - * @deprecated Use texture.wrapS instead. + * @deprecated Use {@link Texture#wrapS texture.wrapS} instead. */ wrapS: any; /** - * @deprecated Use texture.wrapT instead. + * @deprecated Use {@link Texture#wrapT texture.wrapT} instead. */ wrapT: any; /** - * @deprecated Use texture.magFilter instead. + * @deprecated Use {@link Texture#magFilter texture.magFilter} instead. */ magFilter: any; /** - * @deprecated Use texture.minFilter instead. + * @deprecated Use {@link Texture#minFilter texture.minFilter} instead. */ minFilter: any; /** - * @deprecated Use texture.anisotropy instead. + * @deprecated Use {@link Texture#anisotropy texture.anisotropy} instead. */ anisotropy: any; /** - * @deprecated Use texture.offset instead. + * @deprecated Use {@link Texture#offset texture.offset} instead. */ offset: any; /** - * @deprecated Use texture.repeat instead. + * @deprecated Use {@link Texture#repeat texture.repeat} instead. */ repeat: any; /** - * @deprecated Use texture.format instead. + * @deprecated Use {@link Texture#format texture.format} instead. */ format: any; /** - * @deprecated Use texture.type instead. + * @deprecated Use {@link Texture#type texture.type} instead. */ type: any; /** - * @deprecated Use texture.generateMipmaps instead. + * @deprecated Use {@link Texture#generateMipmaps texture.generateMipmaps} instead. */ generateMipmaps: any; @@ -5627,17 +5856,23 @@ export namespace UniformsUtils { export class Uniform { constructor(value: any); /** - * @deprecated + * @deprecated */ constructor(type: string, value: any); /** - * @deprecated + * @deprecated */ type: string; value: any; + /** + * @deprecated Use {@link Object3D#onBeforeRender object.onBeforeRender()} instead. + */ dynamic: boolean; onUpdateCallback: Function; + /** + * @deprecated Use {@link Object3D#onBeforeRender object.onBeforeRender()} instead. + */ onUpdate(callback: Function): Uniform; } @@ -5731,11 +5966,11 @@ export class WebGLProgram { vertexShader: WebGLShader; fragmentShader: WebGLShader; /** - * @deprecated Use getUniforms() instead. + * @deprecated Use {@link WebGLProgram#getUniforms getUniforms()} instead. */ uniforms: any; /** - * @deprecated Use getAttributes() instead. + * @deprecated Use {@link WebGLProgram#getAttributes getAttributes()} instead. */ attributes: any; @@ -5805,7 +6040,7 @@ export class WebGLShadowMap { render(scene: Scene, camera: Camera): void; /** - * @deprecated + * @deprecated Use {@link WebGLShadowMap#renderReverseSided .shadowMap.renderReverseSided} instead. */ cullFace: any; } @@ -6131,12 +6366,22 @@ export class VideoTexture extends Texture { // Extras ///////////////////////////////////////////////////////////////////// /** - * @deprecated Use TextureLoader instead. + * @deprecated Use {@link TextureLoader} instead. */ export namespace ImageUtils { + /** + * @deprecated + */ export let crossOrigin: string; + /** + * @deprecated Use {@link TextureLoader THREE.TextureLoader()} instead. + */ export function loadTexture(url: string, mapping?: Mapping, onLoad?: (texture: Texture) => void, onError?: (message: string) => void): Texture; + + /** + * @deprecated Use {@link CubeTextureLoader THREE.CubeTextureLoader()} instead. + */ export function loadTextureCube(array: string[], mapping?: Mapping, onLoad?: (texture: Texture) => void , onError?: (message: string) => void ): Texture; } @@ -6190,7 +6435,7 @@ export class Audio extends Object3D { getVolume(): number; setVolume(value: number): Audio; /** - * @deprecated Use AudioLoader instead. + * @deprecated Use {@link AudioLoader} instead. */ load(file: string): Audio; } @@ -6205,7 +6450,7 @@ export class AudioAnalyser { getAverageFrequency(): number; /** - * @deprecated + * @deprecated Use {@link AudioAnalyser#getFrequencyData .getFrequencyData()} instead. */ getData(file: any): any; } @@ -6337,8 +6582,18 @@ export class CurvePath extends Curve { getCurveLengths(): number[]; getSpacedPoints(divisions?: number): T[]; getPoints(divisions?: number): T[]; + + /** + * @deprecated Use {@link Geometry#setFromPoints new THREE.Geometry().setFromPoints( points )} instead. + */ createPointsGeometry(divisions: number): Geometry; + /** + * @deprecated Use {@link Geometry#setFromPoints new THREE.Geometry().setFromPoints( points )} instead. + */ createSpacedPointsGeometry(divisions: number): Geometry; + /** + * @deprecated Use {@link Geometry#setFromPoints new THREE.Geometry().setFromPoints( points )} instead. + */ createGeometry(points: T[]): Geometry; } @@ -6365,7 +6620,11 @@ export class Path extends CurvePath { currentPoint: Vector2; + /** + * @deprecated Use {@link Path#setFromPoints .setFromPoints()} instead. + */ fromPoints(vectors: Vector2[]): void; + setFromPoints(vectors: Vector2[]): void; moveTo(x: number, y: number): void; lineTo(x: number, y: number): void; quadraticCurveTo(aCPx: number, aCPy: number, aX: number, aY: number): void; @@ -6399,9 +6658,20 @@ export class Shape extends Path { holes: Path[]; + /** + * @deprecated Use {@link ExtrudeGeometry ExtrudeGeometry()} instead. + */ extrude(options?: any): ExtrudeGeometry; + + /** + * @deprecated Use {@link ShapeGeometry ShapeGeometry()} instead. + */ makeGeometry(options?: any): ShapeGeometry; getPointsHoles(divisions: number): Vector2[][]; + + /** + * @deprecated Use {@link Shape#extractPoints .extractPoints()} instead. + */ extractAllPoints(divisions: number): { shape: Vector2[]; holes: Vector2[][]; @@ -6541,7 +6811,7 @@ export class BoxGeometry extends Geometry { } /** - * @deprecated Use BoxGeometry instead. + * @deprecated Use {@link BoxGeometry} instead. */ export class CubeGeometry extends BoxGeometry {} @@ -6613,8 +6883,12 @@ export class ConeGeometry extends CylinderGeometry { constructor(radius?: number, height?: number, radialSegment?: number, heightSegment?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); } +export class DodecahedronBufferGeometry extends PolyhedronBufferGeometry { + constructor(radius?: number, detail?: number); +} + export class DodecahedronGeometry extends Geometry { - constructor(radius: number, detail: number); + constructor(radius?: number, detail?: number); parameters: { radius: number; @@ -6639,15 +6913,19 @@ export class ExtrudeGeometry extends Geometry { addShape(shape: Shape, options?: any): void; } +export class IcosahedronBufferGeometry extends PolyhedronBufferGeometry { + constructor(radius?: number, detail?: number); +} + export class IcosahedronGeometry extends PolyhedronGeometry { - constructor(radius: number, detail: number); + constructor(radius?: number, detail?: number); } export class LatheBufferGeometry extends BufferGeometry { - constructor(points: Vector3[], segments?: number, phiStart?: number, phiLength?: number); + constructor(points: Vector2[], segments?: number, phiStart?: number, phiLength?: number); parameters: { - points: Vector3[]; + points: Vector2[]; segments: number; phiStart: number; phiLength: number; @@ -6655,18 +6933,22 @@ export class LatheBufferGeometry extends BufferGeometry { } export class LatheGeometry extends Geometry { - constructor(points: Vector3[], segments?: number, phiStart?: number, phiLength?: number); + constructor(points: Vector2[], segments?: number, phiStart?: number, phiLength?: number); parameters: { - points: Vector3[]; + points: Vector2[]; segments: number; phiStart: number; phiLength: number; }; } +export class OctahedronBufferGeometry extends PolyhedronBufferGeometry { + constructor(radius?: number, detail?: number); +} + export class OctahedronGeometry extends PolyhedronGeometry { - constructor(radius: number, detail: number); + constructor(radius?: number, detail?: number); } export class ParametricGeometry extends Geometry { @@ -6701,6 +6983,17 @@ export class PlaneGeometry extends Geometry { }; } +export class PolyhedronBufferGeometry extends BufferGeometry { + constructor(vertices: number[], indices: number[], radius: number, detail: number); + + parameters: { + vertices: number[]; + indices: number[]; + radius: number; + detail: number; + } +} + export class PolyhedronGeometry extends Geometry { constructor(vertices: number[], indices: number[], radius?: number, detail?: number); @@ -6747,6 +7040,11 @@ export class ShapeGeometry extends Geometry { addShape(shape: Shape, options?: any): void; } +export class ShapeBufferGeometry extends BufferGeometry +{ + constructor(shapes: Shape | Shape[], curveSegments?: number); +} + export class SphereBufferGeometry extends BufferGeometry { constructor(radius: number, widthSegments?: number, heightSegments?: number, phiStart?: number, phiLength?: number, thetaStart?: number, thetaLength?: number); @@ -6789,6 +7087,10 @@ export class SphereGeometry extends Geometry { }; } +export class TetrahedronBufferGeometry extends PolyhedronBufferGeometry { + constructor(radius?: number, detail?: number); +} + export class TetrahedronGeometry extends PolyhedronGeometry { constructor(radius?: number, detail?: number); } @@ -6921,10 +7223,13 @@ export class ArrowHelper extends Object3D { setColor(hex: number): void; } -export class AxisHelper extends LineSegments { +export class AxesHelper extends LineSegments { constructor(size?: number); } +/** + * @deprecated Use {@link BoxHelper THREE.BoxHelper} instead. + */ export class BoundingBoxHelper extends Mesh { constructor(object?: Object3D, hex?: number); @@ -6959,6 +7264,9 @@ export class DirectionalLightHelper extends Object3D { update(): void; } +/** + * @deprecated Use {@link EdgesGeometry THREE.EdgesGeometry} + */ export class EdgesHelper extends LineSegments { constructor(object: Object3D, hex?: number, thresholdAngle?: number); } @@ -6975,7 +7283,7 @@ export class FaceNormalsHelper extends LineSegments { export class GridHelper extends LineSegments { constructor(size: number, divisions: number, color1?: Color|number, color2?: Color|number); /** - * @deprecated + * @deprecated Colors should be specified in the constructor. */ setColors(color1?: Color|number, color2?: Color|number): void; } @@ -7028,6 +7336,9 @@ export class VertexNormalsHelper extends LineSegments { update(object?: Object3D): void; } +/** + * @deprecated Use {@link WireframeGeometry THREE.WireframeGeometry} instead. + */ export class WireframeHelper extends LineSegments { constructor(object: Object3D, hex?: number); } @@ -7077,3 +7388,13 @@ export class MorphBlendMesh extends Mesh { stopAnimation(name: string): void; update(delta: number): void; } + +export interface WebVRManager { + enabled: boolean; + getDevice(): VRDisplay | null; + setDevice(device: VRDisplay | null): void; + setPoseTarget(object: Object3D | null): void; + getCamera(camera: PerspectiveCamera): PerspectiveCamera | ArrayCamera; + submitFrame(): void; + dispose(): void; +} diff --git a/types/three/three-effectcomposer.d.ts b/types/three/three-effectcomposer.d.ts index 3680a43658..0f30d45d04 100644 --- a/types/three/three-effectcomposer.d.ts +++ b/types/three/three-effectcomposer.d.ts @@ -23,3 +23,23 @@ export class EffectComposer { setSize(width: number, height: number): void; } + + +export class Pass{ + // if set to true, the pass is processed by the composer + enabled: boolean; + + // if set to true, the pass indicates to swap read and write buffer after rendering + needsSwap: boolean; + + // if set to true, the pass clears its buffer before rendering + clear: boolean; + + // if set to true, the result of the pass is rendered to screen + renderToScreen: boolean; + + setSize(width: number, height:number ): void; + + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, delta: number, maskActive?: boolean): void; + +} \ No newline at end of file diff --git a/types/three/three-filmpass.d.ts b/types/three/three-filmpass.d.ts new file mode 100644 index 0000000000..0890ac8507 --- /dev/null +++ b/types/three/three-filmpass.d.ts @@ -0,0 +1,13 @@ +import { Camera, Scene, WebGLRenderTarget, WebGLRenderer, Material, Mesh, IUniform } from "./three-core"; +import {Pass} from "./three-effectcomposer"; + +export class FilmPass extends Pass { + constructor(noiseIntensity: number, scanlinesIntensity: number, scanlinesCount: number, grayscale: boolean); + + scene: Scene; + camera: Camera; + uniforms: IUniform; + material: Material; + quad: Mesh; + +} diff --git a/types/three/tsconfig.json b/types/three/tsconfig.json index 1e615b65b1..2c62dbad6b 100644 --- a/types/three/tsconfig.json +++ b/types/three/tsconfig.json @@ -54,6 +54,7 @@ "test/examples/controls/vrcontrols.ts", "test/examples/ctm/ctmloader.ts", "test/examples/octree.ts", - "test/examples/loaders/webgl_loader_obj_mtl.ts" + "test/examples/loaders/webgl_loader_obj_mtl.ts", + "test/webvr/webvr.ts" ] } \ No newline at end of file diff --git a/types/thrift/index.d.ts b/types/thrift/index.d.ts index c5cb6f20a3..e4f0e3c1f9 100644 --- a/types/thrift/index.d.ts +++ b/types/thrift/index.d.ts @@ -227,7 +227,7 @@ export interface ServiceMap { export interface ServiceOptions { transport?: TTransportConstructor; protocol?: TProtocolConstructor; - processor?: { new (handler: THandler): TProcessor }; + processor?: { new(handler: THandler): TProcessor }; handler?: THandler; } @@ -263,12 +263,12 @@ export interface WSConnectOptions { } export type TClientConstructor = - { new (output: TTransport, pClass: { new (trans: TTransport): TProtocol }): TClient; } | - { Client: { new (output: TTransport, pClass: { new (trans: TTransport): TProtocol }): TClient; } }; + { new(output: TTransport, pClass: { new(trans: TTransport): TProtocol }): TClient; } | + { Client: { new(output: TTransport, pClass: { new(trans: TTransport): TProtocol }): TClient; } }; export type TProcessorConstructor = - { new (handler: THandler): TProcessor } | - { Processor: { new (handler: THandler): TProcessor }}; + { new(handler: THandler): TProcessor } | + { Processor: { new(handler: THandler): TProcessor } }; export interface WebServerOptions { services: { @@ -361,7 +361,7 @@ export class TFramedTransport implements TTransport { } export interface TTransportConstructor { - new (buffer?: Buffer, callback?: TTransportCallback): TTransport; + new(buffer?: Buffer, callback?: TTransportCallback): TTransport; } export class TBinaryProtocol implements TProtocol { @@ -509,7 +509,7 @@ export class TCompactProtocol implements TProtocol { } export interface TProtocolConstructor { - new (trans: TTransport, strictRead?: boolean, strictWrite?: boolean): TProtocol; + new(trans: TTransport, strictRead?: boolean, strictWrite?: boolean): TProtocol; } // thrift.js diff --git a/types/tile-reduce/tile-reduce-tests.ts b/types/tile-reduce/tile-reduce-tests.ts index f8f22adfac..38e6cfcf17 100644 --- a/types/tile-reduce/tile-reduce-tests.ts +++ b/types/tile-reduce/tile-reduce-tests.ts @@ -1,4 +1,4 @@ -import * as tilereduce from 'tile-reduce' +import tilereduce = require('tile-reduce'); import { BBox, Tile, Source, Types } from 'tile-reduce' global.mapOptions diff --git a/types/timer-machine/timer-machine-tests.ts b/types/timer-machine/timer-machine-tests.ts index 5163fd9af8..e062634367 100644 --- a/types/timer-machine/timer-machine-tests.ts +++ b/types/timer-machine/timer-machine-tests.ts @@ -1,4 +1,4 @@ -import * as Timer from "timer-machine"; +import Timer = require("timer-machine"); let myTimer = new Timer(); diff --git a/types/tinymce/index.d.ts b/types/tinymce/index.d.ts index 3719b35784..d342e13647 100644 --- a/types/tinymce/index.d.ts +++ b/types/tinymce/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for TinyMCE 4.5 // Project: https://github.com/tinymce/tinymce -// Definitions by: Martin Duparc , Poul Poulsen +// Definitions by: Martin Duparc +// Poul Poulsen +// Nico Hartto // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -53,7 +55,31 @@ export function walk(o: {}, f: () => void, n?: string, s?: string): void; export function init(settings: Settings): void; export interface Settings { - table_toolbar?: boolean; + table_toolbar?: string; + + table_appearance_options?: boolean; + + table_clone_elements?: string; + + table_grid?: boolean; + + table_tab_navigation?: boolean; + + table_default_attributes?: object | string; + + table_default_styles?: object | string; + + table_class_list?: object[]; + + table_cell_class_list?: object[]; + + table_row_class_list?: object[]; + + table_advtab?: boolean; + + table_cell_advtab?: boolean; + + table_row_advtab?: boolean; auto_focus?: string; diff --git a/types/tinymce/tinymce-tests.ts b/types/tinymce/tinymce-tests.ts index 2b32824349..d6bda504cd 100644 --- a/types/tinymce/tinymce-tests.ts +++ b/types/tinymce/tinymce-tests.ts @@ -1,14 +1,14 @@ import * as tinymce from 'tinymce'; -tinymce.init({ +const settings: tinymce.Settings = { selector: 'textarea', height: 500, menubar: false, plugins: [ - 'advlist autolink lists link image charmap print preview anchor', - 'searchreplace visualblocks code fullscreen', - 'insertdatetime media table contextmenu paste code', - 'autosave imagetools' + 'advlist autolink lists link image charmap print preview anchor', + 'searchreplace visualblocks code fullscreen', + 'insertdatetime media table contextmenu paste code', + 'autosave imagetools' ], autosave_ask_before_unload: false, autosave_interval: "20s", @@ -18,7 +18,38 @@ tinymce.init({ toolbar: 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', content_css: '//www.tinymce.com/css/codepen.min.css', imagetools_cors_hosts: ['mydomain.com', 'otherdomain.com'], - imagetools_proxy: "proxy.php" -}); + imagetools_proxy: "proxy.php", + table_toolbar: "tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol", + table_appearance_options: false, + table_clone_elements: "strong em a", + table_grid: false, + table_tab_navigation: false, + table_default_attributes: { + title: 'My table' + }, + table_default_styles: { + fontWeight: 'bold' + }, + table_class_list: [ + {title: 'None', value: ''}, + {title: 'Dog', value: 'dog'}, + {title: 'Cat', value: 'cat'} + ], + table_cell_class_list: [ + {title: 'None', value: ''}, + {title: 'Dog', value: 'dog'}, + {title: 'Cat', value: 'cat'} + ], + table_row_class_list: [ + {title: 'None', value: ''}, + {title: 'Dog', value: 'dog'}, + {title: 'Cat', value: 'cat'} + ], + table_advtab: false, + table_cell_advtab: false, + table_row_advtab: false, +}; + +tinymce.init(settings); const t = new tinymce.util.Color('#FFFFFF'); diff --git a/types/to-absolute-glob/tsconfig.json b/types/to-absolute-glob/tsconfig.json index a143fec271..52294f500d 100644 --- a/types/to-absolute-glob/tsconfig.json +++ b/types/to-absolute-glob/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "to-absolute-glob-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/to-markdown/to-markdown-tests.ts b/types/to-markdown/to-markdown-tests.ts index 6c21bf1740..f50f348bc8 100644 --- a/types/to-markdown/to-markdown-tests.ts +++ b/types/to-markdown/to-markdown-tests.ts @@ -1,4 +1,4 @@ -import * as toMarkdown from 'to-markdown'; +import toMarkdown = require('to-markdown'); // toMarkdown() toMarkdown(` diff --git a/types/tocktimer/tocktimer-tests.ts b/types/tocktimer/tocktimer-tests.ts index 85f911b8a9..e2d7cb0bf5 100644 --- a/types/tocktimer/tocktimer-tests.ts +++ b/types/tocktimer/tocktimer-tests.ts @@ -1,4 +1,4 @@ -import * as tock from 'tocktimer'; +import tock = require('tocktimer'); let timer: tock.Tock; diff --git a/types/torrent-stream/torrent-stream-tests.ts b/types/torrent-stream/torrent-stream-tests.ts index 2b41b2e744..a8286da683 100644 --- a/types/torrent-stream/torrent-stream-tests.ts +++ b/types/torrent-stream/torrent-stream-tests.ts @@ -1,4 +1,4 @@ -import * as torrentStream from "torrent-stream"; +import torrentStream = require("torrent-stream"); let engine: TorrentStream.TorrentEngine = torrentStream("magnet"); console.log(engine.swarm.downloaded) diff --git a/types/touch/touch-tests.ts b/types/touch/touch-tests.ts index d41ad7b6b9..f843b4c465 100644 --- a/types/touch/touch-tests.ts +++ b/types/touch/touch-tests.ts @@ -1,4 +1,4 @@ -import * as touch from 'touch'; +import touch = require('touch'); // type value definitions const boolVal = true; diff --git a/types/trash/tsconfig.json b/types/trash/tsconfig.json index 92b58c4679..98e9a458d1 100644 --- a/types/trash/tsconfig.json +++ b/types/trash/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "trash-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/traverse/index.d.ts b/types/traverse/index.d.ts index aaec2544e7..b06abe35dc 100644 --- a/types/traverse/index.d.ts +++ b/types/traverse/index.d.ts @@ -1,199 +1,198 @@ -// Type definitions for traverse 0.6.6 +// Type definitions for traverse 0.6.7 // Project: https://github.com/substack/js-traverse -// Definitions by: Bazyli Brzóska , newclear +// Definitions by: Bazyli Brzóska , newclear , Guten Ye // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface Traverse { +declare function traverse(obj: T): traverse.Traverse; + +declare namespace traverse { /** * Get the element at the array `path`. */ - get(path: string[]): any; - - /** - * Return whether the element at the array `path` exists. - */ - has(path: string[]): boolean; - - /** - * Set the element at the array `path` to `value`. - */ - set(path: string[], value: any): any; - - /** - * Execute `fn` for each node in the object and return a new object with the results of the walk. To update nodes in the result use `this.update(value)`. - */ - map(cb: (this: TraverseContext, v: any) => void): any; - - /** - * Execute `fn` for each node in the object but unlike `.map()`, when `this.update()` is called it updates the object in-place. - */ - forEach(cb: (this: TraverseContext, v: any) => void): any; - - /** - * For each node in the object, perform a [left-fold](http://en.wikipedia.org/wiki/Fold_(higher-order_function)) with the return value of `fn(acc, node)`. - * - * If `init` isn't specified, `init` is set to the root object for the first step and the root element is skipped. - */ - reduce(cb: (this: TraverseContext, acc: any, v: any) => void, init?: any): any; - - /** - * Return an `Array` of every possible non-cyclic path in the object. - * Paths are `Array`s of string keys. - */ - paths(): string[]; - - /** - * Return an `Array` of every node in the object. - */ - nodes(): any[]; - - /** - * Create a deep clone of the object. - */ - clone(): T; -} - -interface StaticTraverse { - /** - * Get the element at the array `path`. - */ - get(obj: any, path: string[]): any; + function get(obj: any, path: string[]): any; /** * Return whether the element at the array `path` exists. */ - has(obj: any, path: string[]): boolean; + function has(obj: any, path: string[]): boolean; /** * Set the element at the array `path` to `value`. */ - set(obj: any, path: string[], value: any): any; + function set(obj: any, path: string[], value: any): any; /** * Execute `fn` for each node in the object and return a new object with the results of the walk. To update nodes in the result use `this.update(value)`. */ - map(obj: any, cb: (this: TraverseContext, v: any) => void): any; + function map(obj: any, cb: (this: TraverseContext, v: any) => void): any; /** * Execute `fn` for each node in the object but unlike `.map()`, when `this.update()` is called it updates the object in-place. */ - forEach(obj: any, cb: (this: TraverseContext, v: any) => void): any; + function forEach(obj: any, cb: (this: TraverseContext, v: any) => void): any; /** * For each node in the object, perform a [left-fold](http://en.wikipedia.org/wiki/Fold_(higher-order_function)) with the return value of `fn(acc, node)`. * * If `init` isn't specified, `init` is set to the root object for the first step and the root element is skipped. */ - reduce(obj: any, cb: (this: TraverseContext, acc: any, v: any) => void, init?: any): any; + function reduce(obj: any, cb: (this: TraverseContext, acc: any, v: any) => void, init?: any): any; /** * Return an `Array` of every possible non-cyclic path in the object. * Paths are `Array`s of string keys. */ - paths(obj: any): string[]; + function paths(obj: any): string[]; /** * Return an `Array` of every node in the object. */ - nodes(obj: any): any[]; + function nodes(obj: any): any[]; /** * Create a deep clone of the object. */ - clone(obj: T): T; + function clone(obj: T): T; + + interface Traverse { + /** + * Get the element at the array `path`. + */ + get(path: string[]): any; + + /** + * Return whether the element at the array `path` exists. + */ + has(path: string[]): boolean; + + /** + * Set the element at the array `path` to `value`. + */ + set(path: string[], value: any): any; + + /** + * Execute `fn` for each node in the object and return a new object with the results of the walk. To update nodes in the result use `this.update(value)`. + */ + map(cb: (this: TraverseContext, v: any) => void): any; + + /** + * Execute `fn` for each node in the object but unlike `.map()`, when `this.update()` is called it updates the object in-place. + */ + forEach(cb: (this: TraverseContext, v: any) => void): any; + + /** + * For each node in the object, perform a [left-fold](http://en.wikipedia.org/wiki/Fold_(higher-order_function)) with the return value of `fn(acc, node)`. + * + * If `init` isn't specified, `init` is set to the root object for the first step and the root element is skipped. + */ + reduce(cb: (this: TraverseContext, acc: any, v: any) => void, init?: any): any; + + /** + * Return an `Array` of every possible non-cyclic path in the object. + * Paths are `Array`s of string keys. + */ + paths(): string[]; + + /** + * Return an `Array` of every node in the object. + */ + nodes(): any[]; + + /** + * Create a deep clone of the object. + */ + clone(): T; + } + + interface TraverseContext { + /** + * The present node on the recursive walk + */ + node: any; + + /** + * An array of string keys from the root to the present node + */ + path: string[] + + /** + * The context of the node's parent. + * This is `undefined` for the root node. + */ + parent: TraverseContext | undefined; + + /** + * The name of the key of the present node in its parent. + * This is `undefined` for the root node. + */ + key: string | undefined; + + /** + * Whether the present node is the root node + */ + isRoot: boolean; + /** + * Whether the present node is not the root node + */ + notRoot: boolean; + + /** + * Whether or not the present node is a leaf node (has no children) + */ + isLeaf: boolean; + /** + * Whether or not the present node is not a leaf node (has children) + */ + notLeaf: boolean; + + /** + * Depth of the node within the traversal + */ + level: number; + + /** + * If the node equals one of its parents, the `circular` attribute is set to the context of that parent and the traversal progresses no deeper. + */ + circular: TraverseContext | undefined; + + /** + * Set a new value for the present node. + * + * All the elements in `value` will be recursively traversed unless `stopHere` is true (false by default). + */ + update(value: any, stopHere?: boolean): void; + + /** + * Remove the current element from the output. If the node is in an Array it will be spliced off. Otherwise it will be deleted from its parent. + */ + remove(stopHere?: boolean): void; + + /** + * Delete the current element from its parent in the output. Calls `delete` even on Arrays. + */ + delete(stopHere?: boolean): void; + + /** + * Call this function before all of the children are traversed. + * You can assign into `this.keys` here to traverse in a custom order. + */ + before(callback: (this: TraverseContext, value: any) => void): void; + + /** + * Call this function after all of the children are traversed. + */ + after(callback: (this: TraverseContext, value: any) => void): void; + + /** + * Call this function before each of the children are traversed. + */ + pre(callback: (this: TraverseContext, child: any) => void): void; + + /** + * Call this function after each of the children are traversed. + */ + post(callback: (this: TraverseContext, child: any) => void): void; + } } -interface TraverseContext { - /** - * The present node on the recursive walk - */ - node: any; - - /** - * An array of string keys from the root to the present node - */ - path: string[] - - /** - * The context of the node's parent. - * This is `undefined` for the root node. - */ - parent: TraverseContext | undefined; - - /** - * The name of the key of the present node in its parent. - * This is `undefined` for the root node. - */ - key: string | undefined; - - /** - * Whether the present node is the root node - */ - isRoot: boolean; - /** - * Whether the present node is not the root node - */ - notRoot: boolean; - - /** - * Whether or not the present node is a leaf node (has no children) - */ - isLeaf: boolean; - /** - * Whether or not the present node is not a leaf node (has children) - */ - notLeaf: boolean; - - /** - * Depth of the node within the traversal - */ - level: number; - - /** - * If the node equals one of its parents, the `circular` attribute is set to the context of that parent and the traversal progresses no deeper. - */ - circular: TraverseContext | undefined; - - /** - * Set a new value for the present node. - * - * All the elements in `value` will be recursively traversed unless `stopHere` is true (false by default). - */ - update(value: any, stopHere?: boolean): void; - - /** - * Remove the current element from the output. If the node is in an Array it will be spliced off. Otherwise it will be deleted from its parent. - */ - remove(stopHere?: boolean): void; - - /** - * Delete the current element from its parent in the output. Calls `delete` even on Arrays. - */ - delete(stopHere?: boolean): void; - - /** - * Call this function before all of the children are traversed. - * You can assign into `this.keys` here to traverse in a custom order. - */ - before(callback: (this: TraverseContext, value: any) => void): void; - - /** - * Call this function after all of the children are traversed. - */ - after(callback: (this: TraverseContext, value: any) => void): void; - - /** - * Call this function before each of the children are traversed. - */ - pre(callback: (this: TraverseContext, child: any) => void): void; - - /** - * Call this function after each of the children are traversed. - */ - post(callback: (this: TraverseContext, child: any) => void): void; -} - -declare function traverseFunction(obj: T): Traverse; -declare const traverse: typeof traverseFunction & StaticTraverse; - export = traverse; diff --git a/types/tryer/index.d.ts b/types/tryer/index.d.ts new file mode 100644 index 0000000000..44835dc2b2 --- /dev/null +++ b/types/tryer/index.d.ts @@ -0,0 +1,66 @@ +// Type definitions for tryer 1.0 +// Project: https://github.com/philbooth/tryer +// Definitions by: Ben Grynhaus +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare const tryer: tryer.TryerStatic; +export = tryer; +export as namespace tryer; + +declare namespace tryer { + interface Options { + /** + * The function that you want to invoke. + * If action returns a promise, iterations will not end until the promise is resolved or rejected. + * Alternatively, action may take a callback argument, done, to signal that it is asynchronous. In that case, you are responsible for calling done when the action is finished. + * + * If action is not set, it defaults to an empty function. + */ + action?: (() => Promise) | ((done: () => void) => any); + + /** + * when: A predicate that tests the pre-condition for invoking action. + * Until when returns true (or a truthy value), action will not be called. + * Defaults to a function that immediately returns true. + */ + when?: () => boolean; + + /** + * until: A predicate that tests the post-condition for invoking action. + * After until returns true (or a truthy value), action will no longer be called. + * Defaults to a function that immediately returns true. + */ + until?: () => boolean; + + /** + * fail: The error handler. + * A function that will be called if limit falsey values are returned by when or until. + * Defaults to an empty function. + */ + fail?: (err: Error) => void; + + /** + * pass: Success handler. + * A function that will be called after until has returned truthily. + * Defaults to an empty function. + */ + pass?: () => void; + + /** + * limit: Failure limit, representing the maximum number of falsey returns from when or until that will be permitted before invocation is deemed to have failed. + * A negative number indicates that the attempt should never fail, instead continuing for as long as when and until have returned truthy values. + * Defaults to -1. + */ + limit?: number; + + /** + * interval: The retry interval, in milliseconds. + * A negative number indicates that each subsequent retry should wait for twice the interval from the preceding iteration (i.e. exponential backoff). + * The default value is -1000, signifying that the initial retry interval should be one second and that each subsequent attempt should wait for double the length of the previous interval. + */ + interval?: number; + } + + type TryerStatic = (options: Readonly) => void; +} diff --git a/types/tryer/tryer-tests.ts b/types/tryer/tryer-tests.ts new file mode 100644 index 0000000000..4be432d3c7 --- /dev/null +++ b/types/tryer/tryer-tests.ts @@ -0,0 +1,80 @@ +import * as tryer from "tryer"; + +tryer(); // $ExpectError + +// $ExpectError +tryer({ + action: null +}); + +// $ExpectError +tryer({ + fail: null +}); + +// $ExpectError +tryer({ + fail: null +}); + +// $ExpectError +tryer({ + interval: null +}); + +// $ExpectError +tryer({ + limit: null +}); + +// $ExpectError +tryer({ + pass: null +}); + +// $ExpectError +tryer({ + until: null +}); + +// $ExpectError +tryer({ + when: null +}); + +// $ExpectError +tryer({ + when: () => 1 +}); + +// $ExpectError +tryer({ + until: () => 1 +}); + +// $ExpectError +tryer({ + limit: "notNumber" +}); + +// $ExpectError +tryer({ + interval: "notNumber" +}); + +tryer({}); + +tryer({ + action: done => { + done(); + }, + fail: error => { + error.message; + error.name; + }, + interval: 1, + until: () => true, + when: () => false, + limit: 1, + pass: () => {} +}); diff --git a/types/tryer/tsconfig.json b/types/tryer/tsconfig.json new file mode 100644 index 0000000000..260613aabf --- /dev/null +++ b/types/tryer/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", "tryer-tests.ts"] +} diff --git a/types/tryer/tslint.json b/types/tryer/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/tryer/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/twilio/twilio-tests.ts b/types/twilio/twilio-tests.ts index 2a653af584..33a691eac0 100644 --- a/types/twilio/twilio-tests.ts +++ b/types/twilio/twilio-tests.ts @@ -1,4 +1,4 @@ -import * as twilio from 'twilio'; +import twilio = require('twilio'); import * as Express from "express"; // Examples taken from https://twilio.github.io/twilio-node/ (v2.1.0) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 0392ad5526..3fbd57283a 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ttezel/twit // Definitions by: Volox // lostfictions +// sapphiredev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -31,7 +32,7 @@ declare module 'twit' { * @see https://dev.twitter.com/overview/api/entities */ export interface HashtagEntity { - indices: number[], + indices: [number, number], text: string, } export interface Size { @@ -48,7 +49,7 @@ declare module 'twit' { export interface MediaEntity { id: number, id_str: string, - indices: number[], + indices: [number, number], url: string, display_url: string, expanded_url: string, @@ -63,12 +64,12 @@ declare module 'twit' { url: string, display_url: string, expanded_url: string, - indices: number[], + indices: [number, number], } export interface UserMentionEntity { id: number, id_str: string, - indices: number[], + indices: [number, number], name: string, screen_name: string, } diff --git a/types/twit/twit-tests.ts b/types/twit/twit-tests.ts index c74f5d6855..1029bda13c 100644 --- a/types/twit/twit-tests.ts +++ b/types/twit/twit-tests.ts @@ -1,4 +1,4 @@ -import * as Twit from 'twit'; +import Twit = require('twit'); const t = new Twit( { consumer_key: '', diff --git a/types/twitter-stream-channels/twitter-stream-channels-tests.ts b/types/twitter-stream-channels/twitter-stream-channels-tests.ts index 6943356cf7..88810aa0cc 100644 --- a/types/twitter-stream-channels/twitter-stream-channels-tests.ts +++ b/types/twitter-stream-channels/twitter-stream-channels-tests.ts @@ -1,4 +1,4 @@ -import * as TwitterStreamChannels from "twitter-stream-channels"; +import TwitterStreamChannels = require("twitter-stream-channels"); const tsc = new TwitterStreamChannels({ consumer_key: '', diff --git a/types/twix/twix-tests.ts b/types/twix/twix-tests.ts index e45d706635..dc4ba2c878 100644 --- a/types/twix/twix-tests.ts +++ b/types/twix/twix-tests.ts @@ -1,6 +1,4 @@ - - -import * as moment from 'moment'; +import moment = require('moment'); var someMoment = moment("20111031", "YYYYMMDD"); var otherMoment = moment("20120620", "YYYYMMDD"); diff --git a/types/type-detect/index.d.ts b/types/type-detect/index.d.ts index 8dbf9018aa..7844361f61 100644 --- a/types/type-detect/index.d.ts +++ b/types/type-detect/index.d.ts @@ -1,17 +1,7 @@ -// Type definitions for type-detect v0.1.2 +// Type definitions for type-detect v4.0.x // Project: https://github.com/chaijs/type-detect // Definitions by: Bart van der Schoor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare function type(val: any): string; - -declare namespace type { - export class Library { - of(val: any): string; - define(type: string, test: RegExp): void; - define(type: string, test: (val: any) => boolean): void; - test(val: any, type: string): boolean; - } -} -export = type; +declare function typeDetect(obj: any): string; +export = typeDetect; diff --git a/types/type-detect/type-detect-tests.ts b/types/type-detect/type-detect-tests.ts index 2fbbfca0d2..4f6e3af706 100644 --- a/types/type-detect/type-detect-tests.ts +++ b/types/type-detect/type-detect-tests.ts @@ -1,19 +1,26 @@ +import type = require('type-detect'); -import td = require('type-detect'); +// $ExpectType string +type(123); -var str: string; -var bool: boolean; -var x: any; +// $ExpectType string +type('foo'); -str = td(123); +// $ExpectType string +type({}); -var lib: td.Library = new td.Library(); +// $ExpectType string +type([]); -lib.define(str, /aa/); -lib.define(str, (val) => { - return bool; -}); -str = lib.of(x); -bool = lib.test(x, str); +// $ExpectType string +type(null); +// $ExpectType string +type(undefined); + +// $ExpectType string +type(new Map()); + +// $ExpectType string +type(new Set()); diff --git a/types/type-detect/v0/index.d.ts b/types/type-detect/v0/index.d.ts new file mode 100644 index 0000000000..8dbf9018aa --- /dev/null +++ b/types/type-detect/v0/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for type-detect v0.1.2 +// Project: https://github.com/chaijs/type-detect +// Definitions by: Bart van der Schoor +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare function type(val: any): string; + +declare namespace type { + export class Library { + of(val: any): string; + define(type: string, test: RegExp): void; + define(type: string, test: (val: any) => boolean): void; + test(val: any, type: string): boolean; + } +} +export = type; diff --git a/types/assertion-error/tsconfig.json b/types/type-detect/v0/tsconfig.json similarity index 69% rename from types/assertion-error/tsconfig.json rename to types/type-detect/v0/tsconfig.json index ebe9144d0b..bae202904b 100644 --- a/types/assertion-error/tsconfig.json +++ b/types/type-detect/v0/tsconfig.json @@ -8,16 +8,21 @@ "noImplicitThis": true, "strictNullChecks": false, "strictFunctionTypes": true, - "baseUrl": "../", + "baseUrl": "../../", "typeRoots": [ - "../" + "../../" ], + "paths": { + "type-detect": [ + "type-detect/v0" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "assertion-error-tests.ts" + "type-detect-tests.ts" ] } \ No newline at end of file diff --git a/types/xterm/tslint.json b/types/type-detect/v0/tslint.json similarity index 100% rename from types/xterm/tslint.json rename to types/type-detect/v0/tslint.json diff --git a/types/type-detect/v0/type-detect-tests.ts b/types/type-detect/v0/type-detect-tests.ts new file mode 100644 index 0000000000..2fbbfca0d2 --- /dev/null +++ b/types/type-detect/v0/type-detect-tests.ts @@ -0,0 +1,19 @@ + +import td = require('type-detect'); + +var str: string; +var bool: boolean; +var x: any; + +str = td(123); + +var lib: td.Library = new td.Library(); + +lib.define(str, /aa/); +lib.define(str, (val) => { + return bool; +}); +str = lib.of(x); +bool = lib.test(x, str); + + diff --git a/types/typeahead/index.d.ts b/types/typeahead/index.d.ts index 715db1d126..a000bc8f99 100644 --- a/types/typeahead/index.d.ts +++ b/types/typeahead/index.d.ts @@ -1186,7 +1186,7 @@ declare class Bloodhound { * @param async Async callback. * @returns The data that matches query. */ - public search(query: string, sync: (datums: T[]) => void, async: (datums: T[]) => void): T[]; + public search(query: string, sync: (datums: T[]) => void, async?: (datums: T[]) => void): T[]; /** * Returns all items from the internal search index. diff --git a/types/typeahead/typeahead-tests.ts b/types/typeahead/typeahead-tests.ts index fb40040dac..0123d3c70c 100644 --- a/types/typeahead/typeahead-tests.ts +++ b/types/typeahead/typeahead-tests.ts @@ -213,10 +213,11 @@ function test_bloodhout() { // search var sync: (datums: string[]) => {}; var async: (datums: string[]) => {}; - var data2: string[] = engine.search("query", sync, async); + var data2: string[] = engine.search("query", sync); + var data3: string[] = engine.search("query", sync, async); // all - var data3: string[] = engine.all(); + var data4: string[] = engine.all(); // clear var engine1: Bloodhound = engine.clear(); @@ -463,4 +464,4 @@ function test_bloodhout() { } }; } -} \ No newline at end of file +} diff --git a/types/typedarray-pool/typedarray-pool-tests.ts b/types/typedarray-pool/typedarray-pool-tests.ts index de33cacb75..871bfdc72e 100644 --- a/types/typedarray-pool/typedarray-pool-tests.ts +++ b/types/typedarray-pool/typedarray-pool-tests.ts @@ -1,5 +1,5 @@ import * as pool from 'typedarray-pool'; -import * as tape from 'tape'; +import tape = require('tape'); tape("typedarray-pool", function(t) { diff --git a/types/typeof/index.d.ts b/types/typeof/index.d.ts new file mode 100644 index 0000000000..4fa8edfb9d --- /dev/null +++ b/types/typeof/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for typeof 1.0 +// Project: https://github.com/CodingFu/typeof +// Definitions by: OpenByteDev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function typeOf(object: any): string; + +export = typeOf; diff --git a/types/typeof/tsconfig.json b/types/typeof/tsconfig.json new file mode 100644 index 0000000000..6a621c9881 --- /dev/null +++ b/types/typeof/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "typeof-tests.ts" + ] +} \ No newline at end of file diff --git a/types/typeof/tslint.json b/types/typeof/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/typeof/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/typeof/typeof-tests.ts b/types/typeof/typeof-tests.ts new file mode 100644 index 0000000000..9b401442f6 --- /dev/null +++ b/types/typeof/typeof-tests.ts @@ -0,0 +1,8 @@ +import typeOf = require('typeof'); + +typeOf(undefined); +typeOf(null); +typeOf(1); +typeOf('string'); +typeOf(() => {}); +typeOf({}); diff --git a/types/tz-format/tz-format-tests.ts b/types/tz-format/tz-format-tests.ts index 729505ab57..7049fbd7f6 100644 --- a/types/tz-format/tz-format-tests.ts +++ b/types/tz-format/tz-format-tests.ts @@ -1,4 +1,4 @@ -import * as format from 'tz-format'; +import format = require('tz-format'); format(); format(1); diff --git a/types/uid-safe/uid-safe-tests.ts b/types/uid-safe/uid-safe-tests.ts index 6af969ce60..6eb4bc274a 100644 --- a/types/uid-safe/uid-safe-tests.ts +++ b/types/uid-safe/uid-safe-tests.ts @@ -1,12 +1,12 @@ -import * as uid from 'uid-safe'; +import uid = require('uid-safe'); uid(18, function (err, string) { if (err) throw err - // do something with the string + // do something with the string }); uid(18).then(function (string) { - // do something with the string + // do something with the string }) var string = uid.sync(18); diff --git a/types/uinput/tsconfig.json b/types/uinput/tsconfig.json index 3114301619..8caa0180e4 100644 --- a/types/uinput/tsconfig.json +++ b/types/uinput/tsconfig.json @@ -1,23 +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", - "uinput-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "uinput-tests.ts" + ] +} \ No newline at end of file diff --git a/types/ultra-strftime/ultra-strftime-tests.ts b/types/ultra-strftime/ultra-strftime-tests.ts index 4439425663..b45cfb7fd8 100644 --- a/types/ultra-strftime/ultra-strftime-tests.ts +++ b/types/ultra-strftime/ultra-strftime-tests.ts @@ -1,4 +1,4 @@ -import * as strftime from "ultra-strftime"; +import strftime = require("ultra-strftime"); const it_IT = { days: ['domenica', 'lunedi', 'martedi', 'mercoledi', 'giovedi', 'venerdi', 'sabato'], diff --git a/types/umzug/umzug-tests.ts b/types/umzug/umzug-tests.ts index fad7b11427..95ccf15665 100644 --- a/types/umzug/umzug-tests.ts +++ b/types/umzug/umzug-tests.ts @@ -1,5 +1,5 @@ -import * as Umzug from 'umzug'; -import * as Sequelize from 'sequelize'; +import Umzug = require('umzug'); +import Sequelize = require('sequelize'); let someVar: Umzug.Umzug; const umzug = new Umzug({}); diff --git a/types/underscore/tsconfig.json b/types/underscore/tsconfig.json index 806e81d1ad..4bbbc86417 100644 --- a/types/underscore/tsconfig.json +++ b/types/underscore/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "underscore-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/undertaker-registry/undertaker-registry-tests.ts b/types/undertaker-registry/undertaker-registry-tests.ts index 4a6201c14f..6c1e58948a 100644 --- a/types/undertaker-registry/undertaker-registry-tests.ts +++ b/types/undertaker-registry/undertaker-registry-tests.ts @@ -1,4 +1,4 @@ -import * as UndertakerRegistry from "undertaker-registry"; +import UndertakerRegistry = require("undertaker-registry"); const ArgTask = (firstArg: string, secondArg: number) => { // Task diff --git a/types/undertaker/index.d.ts b/types/undertaker/index.d.ts index f7775ce28b..5dc0cc0563 100644 --- a/types/undertaker/index.d.ts +++ b/types/undertaker/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for undertaker 1.1 +// Type definitions for undertaker 1.2 // Project: https://github.com/phated/undertaker // Definitions by: Qubo , Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -57,14 +57,6 @@ declare class Undertaker extends EventEmitter { */ task(taskName: string, fn: Undertaker.TaskFunction): void; - /** - * Register the task by the taskName. - * @param taskName - Task name. - * @param dependencies - Task dependencies. - * @param fn - Task function. - */ - task(taskName: string, dependencies: string[], fn: Undertaker.TaskFunction): void; - /** * Register the task by the name property of the function. * @param fn - Task function. diff --git a/types/undertaker/undertaker-tests.ts b/types/undertaker/undertaker-tests.ts index d9ec56255e..224732b720 100644 --- a/types/undertaker/undertaker-tests.ts +++ b/types/undertaker/undertaker-tests.ts @@ -1,7 +1,7 @@ /// import * as fs from "fs"; -import * as Undertaker from "undertaker"; -import * as Registry from "undertaker-registry"; +import Undertaker = require("undertaker"); +import Registry = require("undertaker-registry"); const taker = new Undertaker(); @@ -22,13 +22,6 @@ taker.task("task3", () => { }); }); -taker.task("task3", ["task1"], () => { - return new Promise((resolve, reject) => { - // do things depending on "task1" - resolve(); // when everything is done - }); -}); - taker.task("combined", taker.series("task1", "task2")); taker.task("all", taker.parallel("combined", "task3")); diff --git a/types/uniqid/uniqid-tests.ts b/types/uniqid/uniqid-tests.ts index f0f56aa2fd..b2a195ea79 100644 --- a/types/uniqid/uniqid-tests.ts +++ b/types/uniqid/uniqid-tests.ts @@ -1,4 +1,4 @@ -import * as uniqid from "uniqid"; +import uniqid = require("uniqid"); const uniqueID = uniqid("123"); const processString = uniqid.process("123"); diff --git a/types/universal-analytics/universal-analytics-tests.ts b/types/universal-analytics/universal-analytics-tests.ts index a81f728179..1d2e2426c6 100644 --- a/types/universal-analytics/universal-analytics-tests.ts +++ b/types/universal-analytics/universal-analytics-tests.ts @@ -1,6 +1,5 @@ -import * as ua from 'universal-analytics'; - -import * as express from 'express'; +import ua = require('universal-analytics'); +import express = require('express'); const app = express(); let visitor = ua('UA-XXXX-XX'); diff --git a/types/unzipper/index.d.ts b/types/unzipper/index.d.ts new file mode 100644 index 0000000000..99ece81913 --- /dev/null +++ b/types/unzipper/index.d.ts @@ -0,0 +1,110 @@ +// Type definitions for unzipper 0.8 +// Project: https://github.com/ZJONSSON/node-unzipper#readme +// Definitions by: s73obrien +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + +import { Readable, Stream, PassThrough, Duplex } from "stream"; +import { ClientRequest, RequestOptions } from "http"; + +export interface PullStream extends Duplex { + stream(eof: number | string, includeEof: boolean): PassThrough; + pull(eof: number | string, includeEof: boolean): Promise; +} + +export interface Entry extends PassThrough { + autodrain(): Promise; + buffer: Promise; + path: string; + + props: { + path: string; + }; + + type: string; + vars: { + signature?: number; + versionsNeededToExtract: number; + flags: number; + compressionMethod: number; + lastModifiedTime: number; + crc32: number; + compressedSize: number; + fileNameLength: number; + extraFieldLength: number; + }; + + extra: { + signature: number; + partsize: number; + uncompressedSize: number; + compressedSize: number; + offset: number; + disknum: number; + }; +} + +export function unzip( + source: { + stream: Readable; + size: Promise + }, + offset: number, + _password: string): Entry; + +export namespace Open { + function file(filename: string): CentralDirectory; + function url(request: ClientRequest, opt: string | RequestOptions): CentralDirectory; + function s3(client: any, params: any): CentralDirectory; +} + +export function BufferStream(entry: Entry): Promise; + +export interface CentralDirectory { + signature: number; + diskNumber: number; + diskStart: number; + numberOfRecordsOnDisk: number; + numberOfRecords: number; + sizeOfCentralDirectory: number; + offsetToStartOfCentralDirectory: number; + commentLength: number; + files: [ + { + signature: number; + versionMadeBy: number; + versionsNeededToExtract: number; + flags: number; + compressionMethod: number; + lastModifiedTime: number; + lastModifiedDate: number; + crc32: number; + compressedSize: number; + uncompressedSize: number; + fileNameLength: number; + extraFieldLength: number; + fileCommentLength: number; + diskNumber: number; + internalFileAttributes: number; + externalFileAttributes: number; + offsetToLocalFileHeader: number; + path: string; + comment: string; + stream: Entry; + buffer: Promise; + } + ]; +} + +export class ParseOptions { + verbose: boolean; + // more options? +} + +export type ParseStream = PullStream & { + promise: Promise +}; + +export function Parse(opts?: ParseOptions): ParseStream; +export function ParseOne(match: RegExp, opts: ParseOptions): Duplex; +export function Extract(opts?: ParseOptions): ParseStream; diff --git a/types/unzipper/tsconfig.json b/types/unzipper/tsconfig.json new file mode 100644 index 0000000000..a41980ad8f --- /dev/null +++ b/types/unzipper/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", + "unzipper-tests.ts" + ] +} \ No newline at end of file diff --git a/types/unzipper/tslint.json b/types/unzipper/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/unzipper/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/unzipper/unzipper-tests.ts b/types/unzipper/unzipper-tests.ts new file mode 100644 index 0000000000..295b5541db --- /dev/null +++ b/types/unzipper/unzipper-tests.ts @@ -0,0 +1,44 @@ +import { + Parse, + Open, + Entry, + CentralDirectory +} from 'unzipper'; + +import { createReadStream } from 'fs'; + +import { get } from 'http'; + +createReadStream( + 'http://example.org/path/to/archive.zip' +).pipe( + Parse() +).on('entry', (entry: Entry) => { + entry.buffer.then((b1: Buffer) => {}); + const s1: string = entry.path; + const s2: string = entry.type; + const o1: { + signature?: number; + versionsNeededToExtract: number; + flags: number; + compressionMethod: number; + lastModifiedTime: number; + crc32: number; + compressedSize: number; + fileNameLength: number; + extraFieldLength: number; + } = entry.vars; + + const o2: { + signature: number; + partsize: number; + uncompressedSize: number; + compressedSize: number; + offset: number; + disknum: number; + } = entry.extra; +}); + +const dir1: CentralDirectory = Open.file('Z:\\path\\to\\archive.zip'); +const dir2: CentralDirectory = Open.url(get('url/to/archive.zip'), {}); +const dir3: CentralDirectory = Open.s3('any', 'any'); diff --git a/types/update-notifier/index.d.ts b/types/update-notifier/index.d.ts index cc39be7a5a..11f6e5616e 100644 --- a/types/update-notifier/index.d.ts +++ b/types/update-notifier/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for update-notifier 1.0 +// Type definitions for update-notifier 2.0 // Project: https://github.com/yeoman/update-notifier // Definitions by: vvakame , Noah Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -26,16 +26,17 @@ declare namespace UpdateNotifier { } interface BoxenOptions { - padding: number; - margin: number; - align: string; - borderColor: string; - borderStyle: string; + padding?: number; + margin?: number; + align?: string; + borderColor?: string; + borderStyle?: string; } interface NotifyOptions { - message: string; + message?: string; defer?: boolean; + isGlobal?: boolean; boxenOpts?: BoxenOptions; } diff --git a/types/update-notifier/update-notifier-tests.ts b/types/update-notifier/update-notifier-tests.ts index 49f16a3dc3..fc55c3286a 100644 --- a/types/update-notifier/update-notifier-tests.ts +++ b/types/update-notifier/update-notifier-tests.ts @@ -14,5 +14,20 @@ notifier = new UpdateNotifier.UpdateNotifier({ }); if (notifier.update) { - notifier.notify({ message: 'Update available: ' + notifier.update.latest }); + notifier.notify(); // test no options + notifier.notify({}); // test empty object + + // test all options + notifier.notify({ + message: 'Update available: ' + notifier.update.latest, + defer: false, + isGlobal: true, + boxenOpts: { + padding: 1, + margin: 1, + align: 'center', + borderColor: 'yellow', + borderStyle: 'round', + }, + }); } diff --git a/types/update-notifier/v1/index.d.ts b/types/update-notifier/v1/index.d.ts new file mode 100644 index 0000000000..6cdd5c9d20 --- /dev/null +++ b/types/update-notifier/v1/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for update-notifier 1.0 +// Project: https://github.com/yeoman/update-notifier +// Definitions by: vvakame , Noah Chen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = UpdateNotifier; + +declare function UpdateNotifier(settings?: UpdateNotifier.Settings): UpdateNotifier.UpdateNotifier; + +declare namespace UpdateNotifier { + class UpdateNotifier { + constructor(settings?: Settings); + + update: UpdateInfo; + check(): void; + checkNpm(): void; + notify(customMessage?: NotifyOptions): void; + } + + interface Settings { + pkg?: Package; + callback?(update?: UpdateInfo): any; + packageName?: string; + packageVersion?: string; + updateCheckInterval?: number; // in milliseconds, default 1000 * 60 * 60 * 24 (1 day) + } + + interface BoxenOptions { + padding?: number; + margin?: number; + align?: string; + borderColor?: string; + borderStyle?: string; + } + + interface NotifyOptions { + message?: string; + defer?: boolean; + boxenOpts?: BoxenOptions; + } + + interface Package { + name: string; + version: string; + } + + interface UpdateInfo { + latest: string; + current: string; + type: string; + name: string; + } +} diff --git a/types/update-notifier/v1/tsconfig.json b/types/update-notifier/v1/tsconfig.json new file mode 100644 index 0000000000..9f2a8e1504 --- /dev/null +++ b/types/update-notifier/v1/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "update-notifier": [ + "update-notifier/v1" + ] + } + }, + "files": [ + "index.d.ts", + "update-notifier-tests.ts" + ] +} \ No newline at end of file diff --git a/types/update-notifier/v1/tslint.json b/types/update-notifier/v1/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/update-notifier/v1/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/update-notifier/v1/update-notifier-tests.ts b/types/update-notifier/v1/update-notifier-tests.ts new file mode 100644 index 0000000000..1f26558689 --- /dev/null +++ b/types/update-notifier/v1/update-notifier-tests.ts @@ -0,0 +1,32 @@ +import UpdateNotifier = require("update-notifier"); + +let notifier = UpdateNotifier(); + +if (notifier.update) { + notifier.notify(); +} + +console.log(notifier.update); + +// Also exposed as a class +notifier = new UpdateNotifier.UpdateNotifier({ + updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week +}); + +if (notifier.update) { + notifier.notify(); // test no options + notifier.notify({}); // test empty object + + // test all options + notifier.notify({ + message: 'Update available: ' + notifier.update.latest, + defer: false, + boxenOpts: { + padding: 1, + margin: 1, + align: 'center', + borderColor: 'yellow', + borderStyle: 'round', + }, + }); +} diff --git a/types/upng-js/index.d.ts b/types/upng-js/index.d.ts new file mode 100644 index 0000000000..a6b31f54a6 --- /dev/null +++ b/types/upng-js/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for upng-js 2.1 +// Project: https://github.com/photopea/UPNG.js +// Definitions by: York Yao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function decode(buff: ArrayBuffer): PngData; + +export function encode(bufs: ArrayBuffer, width: number, height: number, ps?: number, dels?: any[]): ArrayBuffer; + +export function toRGBA8(out: PngData): ArrayBuffer; + +export interface PngData { + width: number; + height: number; + depth: number; + ctype: any; + frames: any; + tabs: any; + data: ArrayBuffer; +} diff --git a/types/upng-js/tsconfig.json b/types/upng-js/tsconfig.json new file mode 100644 index 0000000000..d038a0bfc4 --- /dev/null +++ b/types/upng-js/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "upng-js-tests.ts" + ] +} \ No newline at end of file diff --git a/types/upng-js/tslint.json b/types/upng-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/upng-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/upng-js/upng-js-tests.ts b/types/upng-js/upng-js-tests.ts new file mode 100644 index 0000000000..4b0823baa0 --- /dev/null +++ b/types/upng-js/upng-js-tests.ts @@ -0,0 +1,5 @@ +import * as UPNG from 'upng-js'; + +declare const buff: ArrayBuffer; +const img = UPNG.decode(buff); +const rgba = UPNG.toRGBA8(img); diff --git a/types/uppercamelcase/uppercamelcase-tests.ts b/types/uppercamelcase/uppercamelcase-tests.ts index fbb178c2fa..9af952ccda 100644 --- a/types/uppercamelcase/uppercamelcase-tests.ts +++ b/types/uppercamelcase/uppercamelcase-tests.ts @@ -1,4 +1,4 @@ -import * as upperCamelCase from 'uppercamelcase'; +import upperCamelCase = require('uppercamelcase'); upperCamelCase('foo-bar'); upperCamelCase('foo_bar'); diff --git a/types/urijs/index.d.ts b/types/urijs/index.d.ts index 64d048a6a7..61f1887948 100644 --- a/types/urijs/index.d.ts +++ b/types/urijs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for URI.js 1.15.1 // Project: https://github.com/medialize/URI.js -// Definitions by: RodneyJT , Brian Surowiec +// Definitions by: RodneyJT , Brian Surowiec , Pete Johanson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -234,6 +234,19 @@ declare namespace uri { withinString(source: string, func: (url: string) => string): string; } + type URITemplateValue = string | ReadonlyArray | { [key: string] : string } | undefined | null; + type URITemplateCallback = (keyName: string) => URITemplateValue; + type URITemplateInput = { [key: string]: URITemplateValue | URITemplateCallback } | URITemplateCallback; + + interface URITemplate { + expand(data: URITemplateInput, opts?: Object) : URI; + } + + interface URITemplateStatic { + (template: string) : URITemplate; + + new (template: string) : URITemplate; + } } interface JQuery { @@ -241,6 +254,7 @@ interface JQuery { } declare var URI: uri.URIStatic; +declare var URITemplate : uri.URITemplateStatic; declare module 'URI' { export = URI; @@ -251,5 +265,5 @@ declare module 'urijs' { } declare module 'urijs/src/URITemplate' { - export = URI; + export = URITemplate; } diff --git a/types/urijs/urijs-tests.ts b/types/urijs/urijs-tests.ts index f520f0eaca..231879b94d 100644 --- a/types/urijs/urijs-tests.ts +++ b/types/urijs/urijs-tests.ts @@ -65,6 +65,44 @@ URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag').equals( }) ); +// Basic URITemplate type usage +URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag').equals( + URITemplate('http://user:pass@example.org:80{/p*}{?q*}{#h}').expand({ + p: ["foo", "bar.html"], + q: {foo: "bar", bar: "baz"}, + h: "frag" + }) +); + +// Using a callback for a specific key value. +URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag').equals( + URITemplate('http://user:pass@example.org:80{/p*}{?q*}{#h}').expand({ + p: (key) => ["foo", "bar.html"], + q: {foo: "bar", bar: "baz"}, + h: "frag" + }) +); + +// Using a callback for entire data parameter. +URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag').equals( + URITemplate('http://user:pass@example.org:80{/p*}{?q*}{#h}').expand((key) => { + switch(key) { + case 'p': return ["foo", "bar.html"]; + case '1': return {foo: "bar", bar: "baz"}; + case 'h': return "frag"; + } + }) +); + +// Supports null/undefined values for certain keys +URI('http://user:pass@example.org:80/foo/bar.html').equals( + URITemplate('http://user:pass@example.org:80{/p*}{?q*}{#h}').expand({ + p: ["foo", "bar.html"], + q: null, + h: undefined + }) +); + /* Tests for hasSearch(), hasQuery() From: http://medialize.github.io/URI.js/docs.html#search-has diff --git a/types/url-join/url-join-tests.ts b/types/url-join/url-join-tests.ts index 2b512bc6d4..5a4afd6b80 100644 --- a/types/url-join/url-join-tests.ts +++ b/types/url-join/url-join-tests.ts @@ -1,5 +1,5 @@ import urljoin = require("url-join"); -import * as urljoin2 from "url-join"; +import urljoin2 = require("url-join"); const s: string = urljoin("foo", "bar", "baz"); const s2: string = urljoin2("foo", "bar", "baz"); diff --git a/types/url-metadata/tsconfig.json b/types/url-metadata/tsconfig.json index e12ebe2932..60f06925f1 100644 --- a/types/url-metadata/tsconfig.json +++ b/types/url-metadata/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "url-metadata-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/url-metadata/url-metadata-tests.ts b/types/url-metadata/url-metadata-tests.ts index ab45090783..6024c5a0e7 100644 --- a/types/url-metadata/url-metadata-tests.ts +++ b/types/url-metadata/url-metadata-tests.ts @@ -1,4 +1,4 @@ -import * as urlMetadata from "url-metadata"; +import urlMetadata = require("url-metadata"); const opts: urlMetadata.Options = { userAgent: "url-metadata-test", diff --git a/types/url-search-params/index.d.ts b/types/url-search-params/index.d.ts index 144c7ba48b..42cca9ca21 100644 --- a/types/url-search-params/index.d.ts +++ b/types/url-search-params/index.d.ts @@ -1,19 +1,20 @@ // Type definitions for url-search-params 0.10 // Project: https://github.com/WebReflection/url-search-params // Definitions by: Nick +// Neha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare class URLSearchParams { constructor(init?: string | URLSearchParams | any); append(name: string, value: any): void; delete(name: string): void; - entries(pointer: string): Iterator; + entries(): Iterator; get(name: string): string; - getAll(): string[]; + getAll(name: string): string[]; has(name: string): boolean; keys(): Iterator; set(name: string, value: any): void; - values(pointer: string): Iterator; + values(): Iterator; } export = URLSearchParams; diff --git a/types/url-search-params/url-search-params-tests.ts b/types/url-search-params/url-search-params-tests.ts index 1f2c7a0644..94664f5a5c 100644 --- a/types/url-search-params/url-search-params-tests.ts +++ b/types/url-search-params/url-search-params-tests.ts @@ -1,15 +1,25 @@ import URLSearchParams = require("url-search-params"); -const params = new URLSearchParams(); +const params = new URLSearchParams('a=1&b=2'); -params.append("a", "1"); +params.append("b", 3); params.delete("a"); +params.delete("c"); -params.get("a"); +params.entries(); -params.has("a"); +params.get("b"); -params.getAll(); +params.getAll("b"); + +params.has("b"); + +params.keys(); + +params.set("b", 4); +params.set("c", 5); params.toString(); + +params.values(); diff --git a/types/urllib/README.md b/types/urllib/README.md new file mode 100644 index 0000000000..36acda5c50 --- /dev/null +++ b/types/urllib/README.md @@ -0,0 +1,29 @@ +# DefinitelyTyped for Urllib + +## Current Urllib Version +`v2.25.4` +## Usage + +```bash +npm install --save-dev @types/urllib +``` + +example: +```ts +import * as urllib from "."; + +urllib.curl('https://example.test.com', { + method: "GET", + data: { + test: 'test', + } +}) +``` +## License +MIT + +## dependencies +`@types/node` + +## Author +[SoraYama](https://github.com/sorayama) diff --git a/types/urllib/index.d.ts b/types/urllib/index.d.ts new file mode 100644 index 0000000000..c6a6f6a46e --- /dev/null +++ b/types/urllib/index.d.ts @@ -0,0 +1,236 @@ +// Type definitions for urllib 2.25 +// Project: http://github.com/node-modules/urllib +// Definitions by: SoraYama +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import 'node'; +import * as https from 'https'; +import * as http from 'http'; +import * as url from 'url'; +import { Readable, Writable } from 'stream'; +import { EventEmitter } from 'events'; + +export as namespace urllib; +export interface RequestOptions { + /** Request method, defaults to GET. Could be GET, POST, DELETE or PUT. Alias 'type'. */ + method?: "GET" | "POST" | "DELETE" | "PUT"; + /** Data to be sent. Will be stringify automatically. */ + data?: any; + /** Force convert data to query string. */ + dataAsQueryString?: boolean; + /** Manually set the content of payload. If set, data will be ignored. */ + content?: string | Buffer; + /** Stream to be pipe to the remote.If set, data and content will be ignored. */ + stream?: Readable; + /** + * A writable stream to be piped by the response stream. + * Responding data will be write to this stream and callback + * will be called with data set null after finished writing. + */ + writeStream?: Writable; + /** consume the writeStream, invoke the callback after writeStream close. */ + consumeWriteStream?: boolean; + /** Type of request data.Could be json.If it's json, will auto set Content-Type: application/json header. */ + contentType?: string; + /** + * urllib default use querystring to stringify form data which don't support nested object, + * will use qs instead of querystring to support nested object by set this option to true. + */ + nestedQuerystring?: boolean; + /** + * Type of response data. Could be text or json. + * If it's text, the callbacked data would be a String. + * If it's json, the data of callback would be a parsed JSON Object + * and will auto set Accept: application/json header. Default callbacked data would be a Buffer. + */ + dataType?: string; + /** Fix the control characters (U+0000 through U+001F) before JSON parse response. Default is false. */ + fixJSONCtlChars?: boolean; + /** Request headers. */ + headers?: { [key: string]: any }; + /** + * Request timeout in milliseconds for connecting phase and response receiving phase. + * Defaults to exports. + * TIMEOUT, both are 5s.You can use timeout: 5000 to tell urllib use same timeout on two phase or set them seperately such as + * timeout: [3000, 5000], which will set connecting timeout to 3s and response 5s. + */ + timeout?: number | number[]; + /** username:password used in HTTP Basic Authorization. */ + auth?: string; + /** username:password used in HTTP Digest Authorization. */ + digestAuth?: string; + /** HTTP Agent object.Set false if you does not use agent. */ + agent?: http.Agent; + /** HTTPS Agent object. Set false if you does not use agent. */ + httpsAgent?: https.Agent; + /** + * An array of strings or Buffers of trusted certificates. + * If this is omitted several well known "root" CAs will be used, like VeriSign. + * These are used to authorize connections. + * Notes: This is necessary only if the server uses the self - signed certificate + */ + ca?: string | Buffer | string[] | Buffer[]; + /** + * If true, the server certificate is verified against the list of supplied CAs. + * An 'error' event is emitted if verification fails.Default: true. + */ + rejectUnauthorized?: boolean; + /** A string or Buffer containing the private key, certificate and CA certs of the server in PFX or PKCS12 format. */ + pfx?: string | Buffer; + /** + * A string or Buffer containing the private key of the client in PEM format. + * Notes: This is necessary only if using the client certificate authentication + */ + key?: string | Buffer; + /** + * A string or Buffer containing the certificate key of the client in PEM format. + * Notes: This is necessary only if using the client certificate authentication + */ + cert?: string | Buffer; + /** A string of passphrase for the private key or pfx. */ + passphrase?: string; + /** A string describing the ciphers to use or exclude. */ + ciphers?: string; + /** The SSL method to use, e.g.SSLv3_method to force SSL version 3. */ + secureProtocol?: string; + /** follow HTTP 3xx responses as redirects. defaults to false. */ + followRedirect?: boolean; + /** The maximum number of redirects to follow, defaults to 10. */ + maxRedirects?: number; + /** Format the redirect url by your self. Default is url.resolve(from, to). */ + formatRedirectUrl?: (a: any, b: any) => void; + /** Before request hook, you can change every thing here. */ + beforeRequest?: (...args: any[]) => void; + /** let you get the res object when request connected, default false. alias customResponse */ + streaming?: boolean; + /** Accept gzip response content and auto decode it, default is false. */ + gzip?: boolean; + /** Enable timing or not, default is false. */ + timing?: boolean; + /** Enable proxy request, default is false. */ + enableProxy?: boolean; + /** proxy agent uri or options, default is null. */ + proxy?: string | { [key: string]: any }; +} + +/** + * @param data Outgoing message + * @param res http response + */ +export type Callback = (err: Error, data: any, res: http.IncomingMessage) => void; + +/** + * Handle all http request, both http and https support well. + * + * @example + * // GET http://httptest.cnodejs.net + * urllib.request('http://httptest.cnodejs.net/test/get', function(err, data, res) {}); + * // POST http://httptest.cnodejs.net + * var args = { type: 'post', data: { foo: 'bar' } }; + * urllib.request('http://httptest.cnodejs.net/test/post', args, function(err, data, res) {}); + * + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function request(url: string | url.URL, options?: RequestOptions): Promise; +/** + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function request(url: string | url.URL, callback: Callback): void; +/** + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function request(url: string | url.URL, options: RequestOptions, callback: Callback): void; + +/** + * Handle request with a callback. + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function requestWithCallback(url: string | url.URL, callback: Callback): void; +/** + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function requestWithCallback(url: string | url.URL, options: RequestOptions, callback: Callback): void; + +/** + * yield urllib.requestThunk(url, args) + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function requestThunk(url: string | url.URL, options?: RequestOptions): (callback: (...args: any[]) => void) => void; + +/** + * alias to request. + * Handle all http request, both http and https support well. + * + * @example + * // GET http://httptest.cnodejs.net + * urllib.request('http://httptest.cnodejs.net/test/get', function(err, data, res) {}); + * // POST http://httptest.cnodejs.net + * var args = { type: 'post', data: { foo: 'bar' } }; + * urllib.request('http://httptest.cnodejs.net/test/post', args, function(err, data, res) {}); + * + * @param url The URL to request, either a String or a Object that return by url.parse. + * @param options Optional, @see RequestOptions. + */ +export function curl(url: string | url.URL, options?: RequestOptions): Promise; +/** + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function curl(url: string | url.URL, callback: Callback): void; +/** + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function curl(url: string | url.URL, options: RequestOptions, callback: Callback): void; +/** + * The default request timeout(in milliseconds). + */ +export const TIMEOUT: number; +/** + * The default request & response timeout(in milliseconds). + */ +export const TIMEOUTS: [number, number]; + +/** + * Request user agent. + */ +export const USER_AGENT: string; + +/** + * Request http agent. + */ +export const agent: http.Agent; + +/** + * Request https agent. + */ +export const httpsAgent: https.Agent; + +export class HttpClient extends EventEmitter { + constructor(options?: RequestOptions); + + request(url: string | url.URL, callback: Callback): void; + request(url: string | url.URL, options: RequestOptions, callback: Callback): void; + + curl(url: string | url.URL, callback: Callback): void; + curl(url: string | url.URL, options: RequestOptions, callback: Callback): void; + + requestThunk(url: string | url.URL, options?: RequestOptions): (callback: (...args: any[]) => void) => void; +} + +/** + * request method only return a promise, + * compatible with async/await and generator in co. + */ +export class HttpClient2 extends EventEmitter { + constructor(options?: RequestOptions); + + request(url: string | url.URL, options?: RequestOptions): Promise; + + curl(url: string | url.URL, options?: RequestOptions): Promise; + + requestThunk(url: string | url.URL, options?: RequestOptions): (callback: (...args: any[]) => void) => void; +} + +/** + * Create a HttpClient instance. + */ +export function create(options?: RequestOptions): HttpClient; diff --git a/types/urllib/tsconfig.json b/types/urllib/tsconfig.json new file mode 100644 index 0000000000..2787b1459e --- /dev/null +++ b/types/urllib/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "esModuleInterop": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "urllib-tests.ts" + ] +} diff --git a/types/urllib/tslint.json b/types/urllib/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/urllib/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/urllib/urllib-tests.ts b/types/urllib/urllib-tests.ts new file mode 100644 index 0000000000..cd15b42c8f --- /dev/null +++ b/types/urllib/urllib-tests.ts @@ -0,0 +1,8 @@ +import * as urllib from "urllib"; + +urllib.curl('https://example.test.com', { + method: "GET", + data: { + test: 'test', + } +}); diff --git a/types/urlparser/index.d.ts b/types/urlparser/index.d.ts new file mode 100644 index 0000000000..4c63a74d4a --- /dev/null +++ b/types/urlparser/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for urlparser 0.2 +// Project: https://github.com/kaerus-component/urlparser +// Definitions by: OpenByteDev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 2.2 + +interface UrlData { + host: { + protocol: string; + username: string; + password: string; + hostname: string; + port: string|number; + }; + path: { + base: string; + name: string; + hash: string; + }; + query: { + parts: string[]; + params: object; + }; + toString: () => string; +} + +interface UrlParser { + url: (o: UrlData|undefined) => string; + host: (o: UrlData|undefined) => string; + path: (o: UrlData|undefined) => string; + query: (o: UrlData|undefined) => string; + parse: (parse: string) => UrlData; +} + +declare const urlParser: UrlParser; + +export = urlParser; diff --git a/types/urlparser/tsconfig.json b/types/urlparser/tsconfig.json new file mode 100644 index 0000000000..6822cfc4f8 --- /dev/null +++ b/types/urlparser/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "urlparser-tests.ts" + ] +} \ No newline at end of file diff --git a/types/urlparser/tslint.json b/types/urlparser/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/urlparser/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/urlparser/urlparser-tests.ts b/types/urlparser/urlparser-tests.ts new file mode 100644 index 0000000000..9f632f5207 --- /dev/null +++ b/types/urlparser/urlparser-tests.ts @@ -0,0 +1,8 @@ +import url = require('urlparser'); + +const u = url.parse('http://user:pass@kaerus.com/login?x=42'); +u.host.hostname = 'database.kaerus.com'; +u.host.password = 'secret'; +u.host.port = 8529; +u.query.parts.push('a=13'); +u.toString(); diff --git a/types/usb/index.d.ts b/types/usb/index.d.ts index 5e24e16bac..7d3a5d8c89 100644 --- a/types/usb/index.d.ts +++ b/types/usb/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for node-usb 1.1 // Project: https://github.com/tessel/node-usb // Definitions by: Eric Brody +// Rob Moran // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -14,6 +15,8 @@ export class Device { portNumbers: number[]; deviceDescriptor: DeviceDescriptor; configDescriptor: ConfigDescriptor; + allConfigDescriptors: ConfigDescriptor[]; + parent: Device; interfaces: Interface[]; __open(): void; @@ -35,7 +38,7 @@ export class DeviceDescriptor { bDeviceClass: number; bDeviceSubClass: number; bDeviceProtocol: number; - bMaxPacketSize: number; + bMaxPacketSize0: number; idVendor: number; idProduct: number; bcdDevice: number; @@ -55,14 +58,18 @@ export class ConfigDescriptor { bmAttributes: number; bMaxPower: number; extra: Buffer; + interfaces: InterfaceDescriptor[][]; } export class Interface { + interface: number; + altSetting: number; descriptor: InterfaceDescriptor; endpoints: Endpoint[]; constructor(device: Device, id: number); claim(): void; - release(closeEndpoints?: (err?: string) => void, cb?: (err?: string) => void): void; + release(cb?: (err?: string) => void): void; + release(closeEndpoints?: boolean, cb?: (err?: string) => void): void; isKernelDriverActive(): boolean; detachKernelDriver(): number; attachKernelDriver(): number; @@ -81,6 +88,7 @@ export class InterfaceDescriptor { bInterfaceProtocol: number; iInterface: number; extra: Buffer; + endpoints: EndpointDescriptor[]; } export interface Endpoint extends EventEmitter { @@ -120,6 +128,7 @@ export class EndpointDescriptor { bInterval: number; bRefresh: number; bSynchAddress: number; + extra: Buffer; } export function findByIds(vid: number, pid: number): Device; diff --git a/types/usb/usb-tests.ts b/types/usb/usb-tests.ts index 53b214460e..44701c655b 100644 --- a/types/usb/usb-tests.ts +++ b/types/usb/usb-tests.ts @@ -25,7 +25,7 @@ deviceDesc.bcdUSB = 1; deviceDesc.bDeviceClass = 1; deviceDesc.bDeviceSubClass = 1; deviceDesc.bDeviceProtocol = 1; -deviceDesc.bMaxPacketSize = 1; +deviceDesc.bMaxPacketSize0 = 1; deviceDesc.idVendor = 1; deviceDesc.idProduct = 1; deviceDesc.bcdDevice = 1; @@ -51,16 +51,37 @@ configDesc.extra = new Buffer([]); const deviceInterface: usb.Interface = device.interface(1); device.interfaces = [deviceInterface]; +device.parent = device; +device.configDescriptor = configDesc; +device.allConfigDescriptors = [configDesc]; const iface = new usb.Interface(device, 1); +iface.interface = 1; +iface.altSetting = 0; iface.claim(); -iface.release((error: string) => null, (error: string) => null); +iface.release((error: string) => null); +iface.release(false, (error: string) => null); const kernelActive: boolean = iface.isKernelDriverActive(); const detachKernel: number = iface.detachKernelDriver(); const attachKernel: number = iface.attachKernelDriver(); iface.setAltSetting(1, (error: string) => null); +const ifaceDesc: usb.InterfaceDescriptor = new usb.InterfaceDescriptor(); + +ifaceDesc.bLength = 1; +ifaceDesc.bDescriptorType = 1; +ifaceDesc.bInterfaceNumber = 1; +ifaceDesc.bAlternateSetting = 1; +ifaceDesc.bNumEndpoints = 1; +ifaceDesc.bInterfaceClass = 1; +ifaceDesc.bInterfaceSubClass = 1; +ifaceDesc.bInterfaceProtocol = 1; +ifaceDesc.iInterface = 1; +ifaceDesc.extra = new Buffer([]); + +iface.descriptor = ifaceDesc; + const endpointDesc: usb.EndpointDescriptor = new usb.EndpointDescriptor(); endpointDesc.bLength = 1; @@ -71,6 +92,7 @@ endpointDesc.wMaxPacketSize = 1; endpointDesc.bInterval = 1; endpointDesc.bRefresh = 1; endpointDesc.bSynchAddress = 1; +endpointDesc.extra = new Buffer([]); const ifaceInEndpoint: usb.Endpoint = iface.endpoint(1) as usb.InEndpoint; const ifaceOutEndpoint: usb.Endpoint = iface.endpoint(1) as usb.OutEndpoint; @@ -98,6 +120,8 @@ inEndpoint.on("error", (err) => null); const xferOutEndpoint: usb.OutEndpoint = outEndpoint.transfer(new Buffer([]), (error: string) => null); outEndpoint.transferWithZLP(new Buffer([]), (error: string) => null); +iface.endpoints = [inEndpoint, outEndpoint]; + const findByDevice: usb.Device = usb.findByIds(1, 1); usb.on("hey", (device: usb.Device) => null); const deviceList: usb.Device[] = usb.getDeviceList(); diff --git a/types/username/index.d.ts b/types/username/index.d.ts index e0bceed481..4d8c34ee10 100644 --- a/types/username/index.d.ts +++ b/types/username/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for username v1.0.1 +// Type definitions for username v3.0.0 // Project: https://www.npmjs.com/package/username // Definitions by: Klaus Reimer +// Akos Krivachy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -9,9 +10,9 @@ * Falls back to `id -un` on OS X / Linux and `whoami` on Windows in the rare case none of the environment * variables are set. The result is cached. * - * @param callback The callback function to call asynchronously with the result. + * @return Promise A promise containing the username or empty string if not found. */ -declare function username(callback: (err: Error, result: string) => void): void; +declare function username(): Promise; declare namespace username { /** diff --git a/types/username/username-tests.ts b/types/username/username-tests.ts index c6e739c14f..a5bbe51aca 100644 --- a/types/username/username-tests.ts +++ b/types/username/username-tests.ts @@ -1,9 +1,12 @@ import username = require("username"); -username(function(err, username) { - err === new Error(); - username === "string"; -}); +username() + .then((username) => { + username === "string"; + }) + .catch((err) => { + err === new Error(); + }); username.sync() === "string"; diff --git a/types/vali-date/tsconfig.json b/types/vali-date/tsconfig.json index 8e27969380..b3097ec0ab 100644 --- a/types/vali-date/tsconfig.json +++ b/types/vali-date/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "vali-date-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/vali-date/vali-date-tests.ts b/types/vali-date/vali-date-tests.ts index 85a3e39bc5..53fd102a15 100644 --- a/types/vali-date/vali-date-tests.ts +++ b/types/vali-date/vali-date-tests.ts @@ -1,4 +1,4 @@ -import * as valiDate from 'vali-date'; +import valiDate = require('vali-date'); valiDate('foo'); valiDate('bar'); diff --git a/types/validator/index.d.ts b/types/validator/index.d.ts index e27b1e70c0..e91bd36ce2 100644 --- a/types/validator/index.d.ts +++ b/types/validator/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for validator.js v6.3 +// Type definitions for validator.js v9.4 // Project: https://github.com/chriso/validator.js // Definitions by: tgfjt // Ilya Mochalov @@ -6,13 +6,17 @@ // Louy Alakkad // Kacper Polak // Bonggyun Lee +// Naoto Yokoyama // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace ValidatorJS { - type AlphaLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; - type AlphanumericLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "fr-BE" | "hu-HU" | "nl-BE" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; - type MobilePhoneLocale = "ar-DZ" | "ar-SA" | "ar-SY" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fi-FI" | "fr-FR" | "hu-HU" | "it-IT" | "ja-JP" | "ko-KR" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ru-RU" | "sr-RS" | "tr-TR" | "vi-VN" | "zh-CN" | "zh-TW" | "any"; - type PostalCodeLocale = "AT" | "AU" | "BE" | "CA" | "CH" | "CZ" | "DE" | "DK" | "DZ" | "ES" | "FI" | "FR" | "GB" | "GR" | "IL" | "IN" | "IS" | "IT" | "JP" | "KE" | "LI" | "MX" | "NL" | "NO" | "PL" | "PT" | "RO" | "RU" | "SA" | "SE" | "TW" | "US" | "ZA" | "ZM" | "any" + type AlphaLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "bg-BG" | "cs-CZ" | "da-DK" | "de-DE" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "it-IT" | "nb-NO" | "nl-NL" | "nn-NO" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sk-SK" | "sr-RS" | "sr-RS@latin" | "sv-SE" | "tr-TR" | "uk-UA"; + type AlphanumericLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "bg-BG"| "cs-CZ" | "da-DK" | "de-DE" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "it-IT" | "nb-NO" | "nl-NL" | "nn-NO" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sk-SK" | "sr-RS" | "sr-RS@latin" | "sv-SE" | "tr-TR" | "uk-UA"; + type DecimalLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "bg-BG" | "cs-CZ" | "da-DK" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "it-IT" | "nb-NO" | "nl-NL" | "nn-NO" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "sv-SE" | "tr-TR" | "uk-UA"; + type FloatLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "bg-BG" | "cs-CZ" | "da-DK" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "it-IT" | "nb-NO" | "nl-NL" | "nn-NO" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "sv-SE" | "tr-TR" | "uk-UA"; + type MobilePhoneLocale = "ar-AE" | "ar-DZ" | "ar-EG" | "ar-JO" | "ar-SA" | "ar-SY" | "be-BY" | "bg-BG" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-KE" | "en-NG" | "en-NZ" | "en-UG" | "en-RW" | "en-SG" | "en-TZ" | "en-PK" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fa-IR" | "fi-FI" | "fo-FO" | "fr-FR" | "he-IL" | "hu-HU" | "id-ID" | "it-IT" | "ja-JP" | "kk-KZ" | "kl-GL" | "ko-KR" | "lt-LT" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ro-RO" | "ru-RU" | "sk-SK" | "sr-RS" | "th-TH" | "tr-TR" | "uk-UA" | "vi-VN" | "zh-CN" | "zh-HK" | "zh-TW" | "any"; + type PostalCodeLocale = "AT" | "AU" | "BE" | "BG" | "CA" | "CH" | "CZ" | "DE" | "DK" | "DZ" | "ES" | "FI" | "FR" | "GB" | "GR" | "IL" | "IN" | "IS" | "IT" | "JP" | "KE" | "LI" | "MX" | "NL" | "NO" | "PL" | "PT" | "RO" | "RU" | "SA" | "SE" | "TW" | "US" | "ZA" | "ZM" | "any" + type HashAlgorithm = "md4" | "md5" | "sha1" | "sha256" | "sha384" | "sha512" | "ripemd128" | "ripemd160" | "tiger128" | "tiger160" | "tiger192" | "crc32" | "crc32b"; interface ValidatorStatic { @@ -31,14 +35,16 @@ declare namespace ValidatorJS { // check if the string contains only letters (a-zA-Z). Locale is one of ['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', // 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', - // 'cs-CZ', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'hu-HU', - // 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sr-RS', 'sr-RS@latin', 'tr-TR']) and defaults to en-US + // 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', + // 'es-ES', 'fr-FR', 'hu-HU', 'it-IT', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sk-SK', 'sr-RS', + // 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']) and defaults to en-US isAlpha(str: string, locale?: AlphaLocale): boolean; // check if the string contains only letters and numbers. Locale is one of ['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', // 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', - // 'cs-CZ', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'hu-HU', - // 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sr-RS', 'sr-RS@latin', 'tr-TR']) and defaults to en-US + // 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', + // 'es-ES', 'fr-FR', 'hu-HU', 'it-IT', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sk-SK', 'sr-RS', + // 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']) and defaults to en-US isAlphanumeric(str: string, locale?: AlphanumericLocale): boolean; // check if the string contains ASCII chars only. @@ -66,11 +72,8 @@ declare namespace ValidatorJS { // check if the string is a data uri format (https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs) isDataURI(str: string): boolean; - // check if the string is a date. - isDate(str: string): boolean; - // check if the string represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0, etc. - isDecimal(str: string): boolean; + isDecimal(str: string, options?: IsDecimalOptions): boolean; // check if the string is a number that's divisible by another. isDivisibleBy(str: string, number: number): boolean; @@ -93,6 +96,11 @@ declare namespace ValidatorJS { // check if the string contains any half-width chars. isHalfWidth(str: string): boolean; + // check if the string is a hash of type algorithm. + // Algorithm is one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', + // 'tiger160', 'tiger192', 'crc32', 'crc32b'] + isHash(str: string, algorithm: HashAlgorithm): boolean; + // check if the string is a hexadecimal color. isHexColor(str: string): boolean; @@ -105,6 +113,9 @@ declare namespace ValidatorJS { // check if the string is an ISBN (version 10 or 13). isISBN(str: string, version?: number): boolean; + // check if the string is an ISSN (https://en.wikipedia.org/wiki/International_Standard_Serial_Number). + isISSN(str: string, options?: IsISSNOptions): boolean; + // check if the string is an ISIN (https://en.wikipedia.org/wiki/International_Securities_Identification_Number) // (stock/security identifier). isISIN(str: string): boolean; @@ -112,6 +123,13 @@ declare namespace ValidatorJS { // check if the string is a valid ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601) date. isISO8601(str: string): boolean; + // check if the string is a valid ISO 3166-1 alpha-2 (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) officially assigned + // country code. + isISO31661Alpha2(str: string): boolean; + + // check if the string is a ISRC (https://en.wikipedia.org/wiki/International_Standard_Recording_Code). + isISRC(str: string): boolean; + // check if the string is in a array of allowed values. isIn(str: string, values: any[]): boolean; @@ -121,6 +139,9 @@ declare namespace ValidatorJS { // check if the string is valid JSON (note: uses JSON.parse). isJSON(str: string): boolean; + // check if the string is a valid latitude-longitude coordinate in the format lat,long or lat, long. + isLatLong(str: string): boolean; + // check if the string's length falls in a range. // Note: this function takes into account surrogate pairs. isLength(str: string, options: IsLengthOptions): boolean; @@ -135,12 +156,17 @@ declare namespace ValidatorJS { // check if the string is a MD5 hash. isMD5(str: string): boolean; + // check if the string matches to a valid MIME type (https://en.wikipedia.org/wiki/Media_type) format + isMimeType(str: string): boolean; + // check if the string is a mobile phone number, (locale is one of - // ['ar-DZ', 'ar-SA', 'ar-SY', 'cs-CZ', 'de-DE', 'da-DK', 'el-GR', 'en-AU', 'en-GB', 'en-HK', - // 'en-IN', 'en-NZ', 'en-US', 'en-CA', 'en-ZA', 'en-ZM', 'es-ES', 'fi-FI', 'fr-FR', 'hu-HU', - // 'it-IT', 'ja-JP', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS', 'tr-TR', - // 'vi-VN', 'zh-CN', 'zh-TW']). - isMobilePhone(str: string, locale: MobilePhoneLocale): boolean; + // ['ar-AE', ar-DZ', 'ar-EG', 'ar-JO', 'ar-SA', 'ar-SY', 'be-BY', 'bg-BG', 'cs-CZ', 'de-DE', + // 'da-DK', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-KE', 'en-NG', 'en-NZ', 'en-UG', + // 'en-RW', 'en-SG', 'en-TZ', 'en-PK', 'en-US', 'en-CA', 'en-ZA', 'en-ZM', 'es-ES', 'fa-IR', + // 'fi-FI', 'fo-FO', 'fr-FR', 'he-IL', 'hu-HU', 'id-ID', 'it-IT', 'ja-JP', 'kk-KZ', 'kl-GL', + // 'ko-KR', 'lt-LT', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'ro-RO', 'ru-RU', 'sk-SK', + // 'sr-RS', 'th-TH', 'tr-TR', 'uk-UA', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-TW']). + isMobilePhone(str: string, locale: MobilePhoneLocale, options?: IsMobilePhoneOptions): boolean; // check if the string is a valid hex-encoded representation of a MongoDB ObjectId // (http://docs.mongodb.org/manual/reference/object-id/). @@ -149,16 +175,16 @@ declare namespace ValidatorJS { // check if the string contains one or more multibyte chars. isMultibyte(str: string): boolean; - // check if the string is null. - isNull(str: string): boolean; - // check if the string contains only numbers. isNumeric(str: string): boolean; + // check if the string is a valid port number. + isPort(str: string): boolean; + // check if the string is a postal code, (locale is one of - // [ 'AT', 'AU', 'BE', 'CA', 'CH', 'CZ', 'DE', 'DK', 'DZ', 'ES', 'FI', 'FR', 'GB', 'GR', 'IL', - // 'IN', 'IS', 'IT', 'JP', 'KE', 'LI', 'MX', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'SA', 'SE', - // 'TW', 'US', 'ZA', 'ZM' ]) OR 'any'. If 'any' is used, function will check if any of the + // [ 'AT', 'AU', 'BE', 'BG', 'CA', 'CH', 'CZ', 'DE', 'DK', 'DZ', 'ES', 'FI', 'FR', 'GB', 'GR', + // 'IL', 'IN', 'IS', 'IT', 'JP', 'KE', 'LI', 'MX', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'SA', + // 'SE', 'TW', 'US', 'ZA', 'ZM' ]) OR 'any'. If 'any' is used, function will check if any of the // locales match). isPostalCode(str: string, locale: PostalCodeLocale): boolean; @@ -262,12 +288,23 @@ declare namespace ValidatorJS { allow_negative_sign_placeholder?: boolean; thousands_separator?: string; decimal_separator?: string; + allow_decimal?: boolean; + require_decimal?: boolean; + digits_after_decimal?: number[]; allow_space_after_digits?: boolean; } + // options for isDecimal + interface IsDecimalOptions { + force_decimal?: boolean; + decimal_digits?: string; + locale?: DecimalLocale; + } + // options for isEmail interface IsEmailOptions { allow_display_name?: boolean; + require_display_name?: boolean; allow_utf8_local_part?: boolean; require_tld?: boolean; } @@ -283,6 +320,15 @@ declare namespace ValidatorJS { interface IsFloatOptions { min?: number; max?: number; + gt?: number; + lt?: number; + locale?: FloatLocale; + } + + // options for isISSN + interface IsISSNOptions { + case_sensitive?: boolean; + require_hyphen?: boolean; } // options for IsInt @@ -300,6 +346,11 @@ declare namespace ValidatorJS { max?: number; } + // options for isMobilePhone + interface IsMobilePhoneOptions { + strictMode?: boolean; + } + // options for isURL interface IsURLOptions { protocols?: string[]; @@ -316,9 +367,17 @@ declare namespace ValidatorJS { // options for normalizeEmail interface NormalizeEmailOptions { - lowercase?: boolean; - remove_dots?: boolean; - remove_extension?: boolean; + all_lowercase?: boolean; + gmail_lowercase?: boolean; + gmail_remove_dots?: boolean; + gmail_remove_subaddress?: boolean; + gmail_convert_googlemaildotcom?: boolean; + outlookdotcom_lowercase?: boolean; + outlookdotcom_remove_subaddress?: boolean; + yahoo_lowercase?: boolean; + yahoo_remove_subaddress?: boolean; + icloud_lowercase?: boolean; + icloud_remove_subaddress?: boolean; } } @@ -406,11 +465,6 @@ declare module "validator/lib/isDataURI" { export = isDataURI; } -declare module "validator/lib/isDate" { - const isDate: typeof validator.isDate; - export = isDate; -} - declare module "validator/lib/isDecimal" { const isDecimal: typeof validator.isDecimal; export = isDecimal; @@ -451,6 +505,11 @@ declare module "validator/lib/isHalfWidth" { export = isHalfWidth; } +declare module "validator/lib/isHash" { + const isHash: typeof validator.isHash; + export = isHash; +} + declare module "validator/lib/isHexColor" { const isHexColor: typeof validator.isHexColor; export = isHexColor; @@ -471,6 +530,11 @@ declare module "validator/lib/isISBN" { export = isISBN; } +declare module "validator/lib/isISSN" { + const isISSN: typeof validator.isISSN; + export = isISSN; +} + declare module "validator/lib/isISIN" { const isISIN: typeof validator.isISIN; export = isISIN; @@ -481,6 +545,16 @@ declare module "validator/lib/isISO8601" { export = isISO8601; } +declare module "validator/lib/isISO31661Alpha2" { + const isISO31661Alpha2: typeof validator.isISO31661Alpha2; + export = isISO31661Alpha2; +} + +declare module "validator/lib/isISRC" { + const isISRC: typeof validator.isISRC; + export = isISRC; +} + declare module "validator/lib/isIn" { const isIn: typeof validator.isIn; export = isIn; @@ -496,6 +570,11 @@ declare module "validator/lib/isJSON" { export = isJSON; } +declare module "validator/lib/isLatLong" { + const isLatLong: typeof validator.isLatLong; + export = isLatLong; +} + declare module "validator/lib/isLength" { const isLength: typeof validator.isLength; export = isLength; @@ -516,6 +595,11 @@ declare module "validator/lib/isMD5" { export = isMD5; } +declare module "validator/lib/isMimeType" { + const isMimeType: typeof validator.isMimeType; + export = isMimeType; +} + declare module "validator/lib/isMobilePhone" { const isMobilePhone: typeof validator.isMobilePhone; export = isMobilePhone; @@ -536,16 +620,16 @@ declare module "validator/lib/isMultibyte" { export = isMultibyte; } -declare module "validator/lib/isNull" { - const isNull: typeof validator.isNull; - export = isNull; -} - declare module "validator/lib/isNumeric" { const isNumeric: typeof validator.isNumeric; export = isNumeric; } +declare module "validator/lib/isPort" { + const isPort: typeof validator.isPort; + export = isPort; +} + declare module "validator/lib/isSurrogatePair" { const isSurrogatePair: typeof validator.isSurrogatePair; export = isSurrogatePair; diff --git a/types/validator/validator-tests.ts b/types/validator/validator-tests.ts index 2bda229ea6..c3d4327d84 100644 --- a/types/validator/validator-tests.ts +++ b/types/validator/validator-tests.ts @@ -20,7 +20,6 @@ import isByteLengthFunc = require('validator/lib/isByteLength'); import isCreditCardFunc = require('validator/lib/isCreditCard'); import isCurrencyFunc = require('validator/lib/isCurrency'); import isDataURIFunc = require('validator/lib/isDataURI'); -import isDateFunc = require('validator/lib/isDate'); import isDecimalFunc = require('validator/lib/isDecimal'); import isDivisibleByFunc = require('validator/lib/isDivisibleBy'); import isEmailFunc = require('validator/lib/isEmail'); @@ -29,24 +28,30 @@ import isFQDNFunc = require('validator/lib/isFQDN'); import isFloatFunc = require('validator/lib/isFloat'); import isFullWidthFunc = require('validator/lib/isFullWidth'); import isHalfWidthFunc = require('validator/lib/isHalfWidth'); +import isHashFunc = require('validator/lib/isHash'); import isHexColorFunc = require('validator/lib/isHexColor'); import isHexadecimalFunc = require('validator/lib/isHexadecimal'); import isIPFunc = require('validator/lib/isIP'); import isISBNFunc = require('validator/lib/isISBN'); +import isISSNFunc = require('validator/lib/isISSN'); import isISINFunc = require('validator/lib/isISIN'); import isISO8601Func = require('validator/lib/isISO8601'); +import isISO31661Alpha2Func = require('validator/lib/isISO31661Alpha2'); +import isISRCFunc = require('validator/lib/isISRC'); import isInFunc = require('validator/lib/isIn'); import isIntFunc = require('validator/lib/isInt'); import isJSONFunc = require('validator/lib/isJSON'); +import isLatLongFunc = require('validator/lib/isLatLong'); import isLengthFunc = require('validator/lib/isLength'); import isLowercaseFunc = require('validator/lib/isLowercase'); import isMACAddressFunc = require('validator/lib/isMACAddress'); import isMD5Func = require('validator/lib/isMD5'); +import isMimeTypeFunc = require('validator/lib/isMimeType'); import isMobilePhoneFunc = require('validator/lib/isMobilePhone'); import isMongoIdFunc = require('validator/lib/isMongoId'); import isMultibyteFunc = require('validator/lib/isMultibyte'); -import isNullFunc = require('validator/lib/isNull'); import isNumericFunc = require('validator/lib/isNumeric'); +import isPortFunc = require('validator/lib/isPort'); import isPostalCodeFunc = require('validator/lib/isPostalCode'); import isSurrogatePairFunc = require('validator/lib/isSurrogatePair'); import isURLFunc = require('validator/lib/isURL'); @@ -113,9 +118,6 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isDataURI = validator.isDataURI; _isDataURI = isDataURIFunc; - let _isDate = validator.isDate; - _isDate = isDateFunc; - let _isDecimal = validator.isDecimal; _isDecimal = isDecimalFunc; @@ -140,6 +142,9 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isHalfWidth = validator.isHalfWidth; _isHalfWidth = isHalfWidthFunc; + let _isHash = validator.isHash; + _isHash = isHashFunc; + let _isHexColor = validator.isHexColor; _isHexColor = isHexColorFunc; @@ -152,12 +157,21 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isISBN = validator.isISBN; _isISBN = isISBNFunc; + let _isISSN = validator.isISSN; + _isISSN = isISSNFunc; + let _isISIN = validator.isISIN; _isISIN = isISINFunc; let _isISO8601 = validator.isISO8601; _isISO8601 = isISO8601Func; + let _isISO31661Alpha2 = validator.isISO31661Alpha2; + _isISO31661Alpha2 = isISO31661Alpha2Func; + + let _isISRC = validator.isISRC; + _isISRC = isISRCFunc; + let _isIn = validator.isIn; _isIn = isInFunc; @@ -167,6 +181,9 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isJSON = validator.isJSON; _isJSON = isJSONFunc; + let _isLatLong = validator.isLatLong; + _isLatLong = isLatLongFunc; + let _isLength = validator.isLength; _isLength = isLengthFunc; @@ -179,6 +196,9 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isMD5 = validator.isMD5; _isMD5 = isMD5Func; + let _isMimeType = validator.isMimeType; + _isMimeType = isMimeTypeFunc; + let _isMobilePhone = validator.isMobilePhone; _isMobilePhone = isMobilePhoneFunc; @@ -188,12 +208,12 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isMultibyte = validator.isMultibyte; _isMultibyte = isMultibyteFunc; - let _isNull = validator.isNull; - _isNull = isNullFunc; - let _isNumeric = validator.isNumeric; _isNumeric = isNumericFunc; + let _isPort = validator.isPort; + _isPort = isPortFunc; + let _isPostalCode = validator.isPostalCode; _isPostalCode = isPostalCodeFunc; @@ -292,8 +312,11 @@ let any: any; result = validator.isAlpha('sample', 'ar-SY'); result = validator.isAlpha('sample', 'ar-TN'); result = validator.isAlpha('sample', 'ar-YE'); + result = validator.isAlpha('sample', 'bg-BG'); result = validator.isAlpha('sample', 'cs-CZ'); + result = validator.isAlpha('sample', 'da-DK'); result = validator.isAlpha('sample', 'de-DE'); + result = validator.isAlpha('sample', 'el-GR'); result = validator.isAlpha('sample', 'en-AU'); result = validator.isAlpha('sample', 'en-GB'); result = validator.isAlpha('sample', 'en-HK'); @@ -305,15 +328,22 @@ let any: any; result = validator.isAlpha('sample', 'es-ES'); result = validator.isAlpha('sample', 'fr-FR'); result = validator.isAlpha('sample', 'hu-HU'); + result = validator.isAlpha('sample', 'it-IT'); + result = validator.isAlpha('sample', 'nb-NO'); result = validator.isAlpha('sample', 'nl-NL'); + result = validator.isAlpha('sample', 'nn-NO'); result = validator.isAlpha('sample', 'pl-PL'); result = validator.isAlpha('sample', 'pt-BR'); result = validator.isAlpha('sample', 'pt-PT'); result = validator.isAlpha('sample', 'ru-RU'); + result = validator.isAlpha('sample', 'sk-SK'); result = validator.isAlpha('sample', 'sr-RS'); result = validator.isAlpha('sample', 'sr-RS@latin'); + result = validator.isAlpha('sample', 'sv-SE'); result = validator.isAlpha('sample', 'tr-TR'); + result = validator.isAlpha('sample', 'uk-UA'); + result = validator.isAlphanumeric('sample'); result = validator.isAlphanumeric('sample', 'ar'); result = validator.isAlphanumeric('sample', 'ar-AE'); result = validator.isAlphanumeric('sample', 'ar-BH'); @@ -332,8 +362,11 @@ let any: any; result = validator.isAlphanumeric('sample', 'ar-SY'); result = validator.isAlphanumeric('sample', 'ar-TN'); result = validator.isAlphanumeric('sample', 'ar-YE'); + result = validator.isAlphanumeric('sample', 'bg-BG'); result = validator.isAlphanumeric('sample', 'cs-CZ'); + result = validator.isAlphanumeric('sample', 'da-DK'); result = validator.isAlphanumeric('sample', 'de-DE'); + result = validator.isAlphanumeric('sample', 'el-GR'); result = validator.isAlphanumeric('sample', 'en-AU'); result = validator.isAlphanumeric('sample', 'en-GB'); result = validator.isAlphanumeric('sample', 'en-HK'); @@ -344,17 +377,21 @@ let any: any; result = validator.isAlphanumeric('sample', 'en-ZM'); result = validator.isAlphanumeric('sample', 'es-ES'); result = validator.isAlphanumeric('sample', 'fr-FR'); - result = validator.isAlphanumeric('sample', 'fr-BE'); result = validator.isAlphanumeric('sample', 'hu-HU'); - result = validator.isAlphanumeric('sample', 'nl-BE'); + result = validator.isAlphanumeric('sample', 'it-IT'); + result = validator.isAlphanumeric('sample', 'nb-NO'); result = validator.isAlphanumeric('sample', 'nl-NL'); + result = validator.isAlphanumeric('sample', 'nn-NO'); result = validator.isAlphanumeric('sample', 'pl-PL'); result = validator.isAlphanumeric('sample', 'pt-BR'); result = validator.isAlphanumeric('sample', 'pt-PT'); result = validator.isAlphanumeric('sample', 'ru-RU'); + result = validator.isAlphanumeric('sample', 'sk-SK'); result = validator.isAlphanumeric('sample', 'sr-RS'); result = validator.isAlphanumeric('sample', 'sr-RS@latin'); + result = validator.isAlphanumeric('sample', 'sv-SE'); result = validator.isAlphanumeric('sample', 'tr-TR'); + result = validator.isAlphanumeric('sample', 'uk-UA'); result = validator.isAscii('sample'); @@ -378,9 +415,9 @@ let any: any; result = validator.isDataURI('sample'); - result = validator.isDate('sample'); - + let isDecimalOptions: ValidatorJS.IsDecimalOptions; result = validator.isDecimal('sample'); + result = validator.isDecimal('sample', isDecimalOptions); result = validator.isDivisibleBy('sample', 2); @@ -388,6 +425,8 @@ let any: any; result = validator.isEmail('sample'); result = validator.isEmail('sample', isEmailOptions); + result = validator.isEmpty('sample'); + let isFQDNOptions: ValidatorJS.IsFQDNOptions; result = validator.isFQDN('sample'); result = validator.isFQDN('sample', isFQDNOptions); @@ -400,6 +439,20 @@ let any: any; result = validator.isHalfWidth('sample'); + result = validator.isHash('sample', 'md4'); + result = validator.isHash('sample', 'md5'); + result = validator.isHash('sample', 'sha1'); + result = validator.isHash('sample', 'sha256'); + result = validator.isHash('sample', 'sha384'); + result = validator.isHash('sample', 'sha512'); + result = validator.isHash('sample', 'ripemd128'); + result = validator.isHash('sample', 'ripemd160'); + result = validator.isHash('sample', 'tiger128'); + result = validator.isHash('sample', 'tiger160'); + result = validator.isHash('sample', 'tiger192'); + result = validator.isHash('sample', 'crc32'); + result = validator.isHash('sample', 'crc32b'); + result = validator.isHexColor('sample'); result = validator.isHexadecimal('sample'); @@ -410,10 +463,18 @@ let any: any; result = validator.isISBN('sample'); result = validator.isISBN('sample', 13); + let isISSNOptions: ValidatorJS.IsISSNOptions; + result = validator.isISSN('sample'); + result = validator.isISSN('sample', isISSNOptions); + result = validator.isISIN('sample'); result = validator.isISO8601('sample'); + result = validator.isISO31661Alpha2('sample'); + + result = validator.isISRC('sample'); + result = validator.isIn('sample', []); let isIntOptions: ValidatorJS.IsIntOptions; @@ -422,6 +483,8 @@ let any: any; result = validator.isJSON('sample'); + result = validator.isLatLong('sample'); + let isLengthOptions: ValidatorJS.IsLengthOptions; result = validator.isLength('sample', isLengthOptions); result = validator.isLength('sample', 3); @@ -433,9 +496,18 @@ let any: any; result = validator.isMD5('sample'); + result = validator.isMimeType('sample'); + + let isMobilePhoneOptions: ValidatorJS.IsMobilePhoneOptions; + result = validator.isMobilePhone('sample', 'any', isMobilePhoneOptions); + result = validator.isMobilePhone('sample', 'ar-AE'); result = validator.isMobilePhone('sample', 'ar-DZ'); + result = validator.isMobilePhone('sample', 'ar-EG'); + result = validator.isMobilePhone('sample', 'ar-JO'); result = validator.isMobilePhone('sample', 'ar-SA'); result = validator.isMobilePhone('sample', 'ar-SY'); + result = validator.isMobilePhone('sample', 'be-BY'); + result = validator.isMobilePhone('sample', 'bg-BG'); result = validator.isMobilePhone('sample', 'cs-CZ'); result = validator.isMobilePhone('sample', 'de-DE'); result = validator.isMobilePhone('sample', 'da-DK'); @@ -444,41 +516,62 @@ let any: any; result = validator.isMobilePhone('sample', 'en-GB'); result = validator.isMobilePhone('sample', 'en-HK'); result = validator.isMobilePhone('sample', 'en-IN'); + result = validator.isMobilePhone('sample', 'en-KE'); + result = validator.isMobilePhone('sample', 'en-NG'); result = validator.isMobilePhone('sample', 'en-NZ'); + result = validator.isMobilePhone('sample', 'en-UG'); + result = validator.isMobilePhone('sample', 'en-RW'); + result = validator.isMobilePhone('sample', 'en-SG'); + result = validator.isMobilePhone('sample', 'en-TZ'); + result = validator.isMobilePhone('sample', 'en-PK'); result = validator.isMobilePhone('sample', 'en-US'); result = validator.isMobilePhone('sample', 'en-CA'); result = validator.isMobilePhone('sample', 'en-ZA'); result = validator.isMobilePhone('sample', 'en-ZM'); result = validator.isMobilePhone('sample', 'es-ES'); + result = validator.isMobilePhone('sample', 'fa-IR'); result = validator.isMobilePhone('sample', 'fi-FI'); + result = validator.isMobilePhone('sample', 'fo-FO'); result = validator.isMobilePhone('sample', 'fr-FR'); + result = validator.isMobilePhone('sample', 'he-IL'); result = validator.isMobilePhone('sample', 'hu-HU'); + result = validator.isMobilePhone('sample', 'id-ID'); result = validator.isMobilePhone('sample', 'it-IT'); result = validator.isMobilePhone('sample', 'ja-JP'); + result = validator.isMobilePhone('sample', 'kk-KZ'); + result = validator.isMobilePhone('sample', 'kl-GL'); result = validator.isMobilePhone('sample', 'ko-KR'); + result = validator.isMobilePhone('sample', 'lt-LT'); result = validator.isMobilePhone('sample', 'ms-MY'); result = validator.isMobilePhone('sample', 'nb-NO'); result = validator.isMobilePhone('sample', 'nn-NO'); result = validator.isMobilePhone('sample', 'pl-PL'); result = validator.isMobilePhone('sample', 'pt-PT'); + result = validator.isMobilePhone('sample', 'ro-RO'); result = validator.isMobilePhone('sample', 'ru-RU'); result = validator.isMobilePhone('sample', 'sr-RS'); + result = validator.isMobilePhone('sample', 'sk-SK'); + result = validator.isMobilePhone('sample', 'th-TH'); result = validator.isMobilePhone('sample', 'tr-TR'); + result = validator.isMobilePhone('sample', 'uk-UA'); result = validator.isMobilePhone('sample', 'vi-VN'); result = validator.isMobilePhone('sample', 'zh-CN'); + result = validator.isMobilePhone('sample', 'zh-HK'); result = validator.isMobilePhone('sample', 'zh-TW'); + result = validator.isMobilePhone('sample', 'any'); result = validator.isMongoId('sample'); result = validator.isMultibyte('sample'); - result = validator.isNull('sample'); - result = validator.isNumeric('sample'); + result = validator.isPort('sample'); + result = validator.isPostalCode('sample', 'AT'); result = validator.isPostalCode('sample', 'AU'); result = validator.isPostalCode('sample', 'BE'); + result = validator.isPostalCode('sample', 'BG'); result = validator.isPostalCode('sample', 'CA'); result = validator.isPostalCode('sample', 'CH'); result = validator.isPostalCode('sample', 'CZ'); diff --git a/types/validatorjs/validatorjs-tests.ts b/types/validatorjs/validatorjs-tests.ts index c8094936b7..4eb24ed6bd 100644 --- a/types/validatorjs/validatorjs-tests.ts +++ b/types/validatorjs/validatorjs-tests.ts @@ -1,4 +1,4 @@ -import * as Validator from "validatorjs" +import Validator = require("validatorjs"); var rules: any = { foo: "required" diff --git a/types/vanilla-modal/tsconfig.json b/types/vanilla-modal/tsconfig.json index f6d7663c4f..72925ecc29 100644 --- a/types/vanilla-modal/tsconfig.json +++ b/types/vanilla-modal/tsconfig.json @@ -15,10 +15,10 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames" : true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", "vanilla-modal-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/vanilla-tilt/index.d.ts b/types/vanilla-tilt/index.d.ts index e24208f563..5f4c80a783 100644 --- a/types/vanilla-tilt/index.d.ts +++ b/types/vanilla-tilt/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for vanilla-tilt 1.3 +// Type definitions for vanilla-tilt 1.4 // Project: https://github.com/micku7zu/vanilla-tilt.js // Definitions by: Livio Brunner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -47,6 +47,19 @@ export namespace VanillaTilt { * Easing on enter/exit. */ easing?: string; + /** + * if it should have a "glare" effect + */ + glare?: boolean; + /** + * the maximum "glare" opacity + */ + "max-glare"?: number; + /** + * false = VanillaTilt creates the glare elements for you, otherwise + * you need to add .js-tilt-glare>.js-tilt-glare-inner by yourself + */ + "glare-prerender"?: boolean; } interface TiltValues { diff --git a/types/vanilla-tilt/vanilla-tilt-tests.ts b/types/vanilla-tilt/vanilla-tilt-tests.ts index c40bd56f75..52520dcfcc 100644 --- a/types/vanilla-tilt/vanilla-tilt-tests.ts +++ b/types/vanilla-tilt/vanilla-tilt-tests.ts @@ -8,7 +8,10 @@ const element: VanillaTilt = new VanillaTilt(document.createElement('a'), { reset: true, reverse: true, scale: 2, - speed: 200 + speed: 200, + glare: true, + "max-glare": 1, + "glare-prerender": true, }); VanillaTilt.init(document.createElement('a'), { diff --git a/types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts b/types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts index e4b7ed7e67..377c075879 100644 --- a/types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts +++ b/types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts @@ -1,3 +1,3 @@ -import * as EventBus from "vertx3-eventbus-client"; +import EventBus = require("vertx3-eventbus-client"); const eb = new EventBus("http://localhost:9999"); diff --git a/types/vexflow/tslint.json b/types/vexflow/tslint.json index a41bf5d19a..b6afb8acee 100644 --- a/types/vexflow/tslint.json +++ b/types/vexflow/tslint.json @@ -21,6 +21,7 @@ "no-boolean-literal-compare": false, "no-conditional-assignment": false, "no-consecutive-blank-lines": false, + "no-const-enum": false, "no-construct": false, "no-declare-current-package": false, "no-duplicate-imports": false, diff --git a/types/vfile-location/index.d.ts b/types/vfile-location/index.d.ts new file mode 100644 index 0000000000..e8ad37bc32 --- /dev/null +++ b/types/vfile-location/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for vfile-location 2.0 +// Project: https://github.com/vfile/vfile-location +// Definitions by: Ika +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import * as VFile from "vfile"; + +declare function vfileLocation(vfile: string | VFile.VFile<{}>): vfileLocation.Location; + +declare namespace vfileLocation { + interface Location { + /** + * Get the `offset` (`number`) for a line and column-based `position` in the bound file. + * Returns `-1` when given invalid or out of bounds input. + */ + toOffset(position: { line: number; column: number }): number; + /** + * Get the line and column-based `position` for `offset` in the bound file. + */ + toPosition(offset: number): { line: number; column: number; offset: number }; + } +} + +export = vfileLocation; diff --git a/types/vfile-location/tsconfig.json b/types/vfile-location/tsconfig.json new file mode 100644 index 0000000000..4b6325d09e --- /dev/null +++ b/types/vfile-location/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", + "vfile-location-tests.ts" + ] +} \ No newline at end of file diff --git a/types/vfile-location/tslint.json b/types/vfile-location/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/vfile-location/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/vfile-location/vfile-location-tests.ts b/types/vfile-location/vfile-location-tests.ts new file mode 100644 index 0000000000..7419cbf069 --- /dev/null +++ b/types/vfile-location/vfile-location-tests.ts @@ -0,0 +1,7 @@ +import vfile = require("vfile"); +import vfileLocation = require("vfile-location"); + +const location = vfileLocation(vfile("foo\nbar\nbaz")); + +const position = location.toPosition(10); +const offset: number = location.toOffset(position); diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index b41fb96068..0c7f756b26 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -4,7 +4,7 @@ // snerks // Krzysztof Cebula // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/video.js/index.d.ts b/types/video.js/index.d.ts index cde81fbe46..eaf49a1833 100644 --- a/types/video.js/index.d.ts +++ b/types/video.js/index.d.ts @@ -71,5 +71,10 @@ declare namespace videojs { removeRemoteTextTrack(track: HTMLTrackElement): void; poster(val?: string): string | Player; playbackRate(rate?: number): number; + controls(bool?: boolean): boolean; + muted(muted?: boolean): boolean; + preload(value?: boolean): string; + autoplay(value?: boolean): string; + loop(value?: boolean): string; } } diff --git a/types/video.js/video.js-tests.ts b/types/video.js/video.js-tests.ts index 145be6c711..287b804e14 100644 --- a/types/video.js/video.js-tests.ts +++ b/types/video.js/video.js-tests.ts @@ -1,6 +1,4 @@ -// Tests for Video.js API - -import * as videojs from 'video.js'; +import videojs = require('video.js'); videojs("example_video_1").ready(function() { // EXAMPLE: Start playing the video. diff --git a/types/vimeo__player/index.d.ts b/types/vimeo__player/index.d.ts index 3712e20cf7..c2699d15d2 100755 --- a/types/vimeo__player/index.d.ts +++ b/types/vimeo__player/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for @vimeo/player 2.0 // Project: https://github.com/vimeo/player.js -// Definitions by: Denis Yılmaz , Felix Albert +// Definitions by: Denis Yılmaz +// Felix Albert +// Tim Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export function myMethod(a: string): string; @@ -23,7 +25,7 @@ export interface TypeError extends Error {name: "TypeError"; message: string; me export type EventName = "play" | "pause" | "ended" | "timeupdate" | "progress" | "seeked" | "texttrackchange" | "cuechange" | "cuepoint" | "volumechange" | "error" | "loaded" | string; export type EventCallback = (data: any) => any; -export class Player { +export default class Player { constructor(element: HTMLIFrameElement|HTMLElement|string, options: Options); on(event: EventName, callback: EventCallback): void; diff --git a/types/vimeo__player/vimeo__player-tests.ts b/types/vimeo__player/vimeo__player-tests.ts index 622d5ca339..bf5a637762 100644 --- a/types/vimeo__player/vimeo__player-tests.ts +++ b/types/vimeo__player/vimeo__player-tests.ts @@ -1,4 +1,4 @@ -import { Player } from '@vimeo/player'; +import Player from '@vimeo/player'; // based on README.md of @vimeo/player >> https://github.com/vimeo/player.js diff --git a/types/vinyl/vinyl-tests.ts b/types/vinyl/vinyl-tests.ts index 3a73249b60..77ef5d6d1b 100644 --- a/types/vinyl/vinyl-tests.ts +++ b/types/vinyl/vinyl-tests.ts @@ -2,7 +2,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as expect from 'expect'; +import expect = require('expect'); const miss = require('mississippi'); const cloneable = require('cloneable-readable'); diff --git a/types/virtual-keyboard/virtual-keyboard-tests.ts b/types/virtual-keyboard/virtual-keyboard-tests.ts index 84e3c9ed3c..91deb9a7c9 100644 --- a/types/virtual-keyboard/virtual-keyboard-tests.ts +++ b/types/virtual-keyboard/virtual-keyboard-tests.ts @@ -1,4 +1,4 @@ -import * as jQuery from "jquery"; +import jQuery = require("jquery"); import { KeyboardOptions, NavigateOptions } from "virtual-keyboard"; const kbOptions: KeyboardOptions = { diff --git a/types/vis/index.d.ts b/types/vis/index.d.ts index 9c0adb0a97..e7ca718dab 100644 --- a/types/vis/index.d.ts +++ b/types/vis/index.d.ts @@ -290,7 +290,7 @@ export interface TimelineEventPropertiesResult { /** * The id of the clicked item. */ - item?: number | null; + item?: IdType | null; /** * Absolute horizontal position of the click event. diff --git a/types/vision/index.d.ts b/types/vision/index.d.ts index 5539ad07c2..757d2a5383 100644 --- a/types/vision/index.d.ts +++ b/types/vision/index.d.ts @@ -1,10 +1,199 @@ -// Type definitions for vision 4.1 +// Type definitions for vision 5.3 // Project: https://github.com/hapijs/vision -// Definitions by: Jason Swearingen , AJP +// Definitions by: Jason Swearingen +// Alexander James Phillips +// Silas Rech // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import * as Hapi from 'hapi'; +import { + Plugin, + Request, + ResponseObject, +} from 'hapi'; + +declare namespace vision { + interface EnginesConfiguration { + /** + * Required object where each key is a file extension (e.g. 'html', 'hbr'), mapped to the npm module used for rendering the templates. + * Alternatively, the extension can be mapped to an object + */ + engines: {[fileExtension: string]: NpmModule} | ServerViewsEnginesOptions; + /** defines the default filename extension to append to template names when multiple engines are configured and no explicit extension is provided for a given template. No default value. */ + defaultExtension?: string; + } + + /** + * Includes `module` and any of the views options listed below (@see ServerViewsAdditionalOptions) (except defaultExtension) to override the defaults for a specific engine. + */ + interface ServerViewsEnginesOptions extends ServerViewsConfiguration { + /** + * The npm module used for rendering the templates. The module object must contain the compile() function + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverviewsoptions} > options > engines > module + */ + module: NpmModule; + } + interface ServerViewsConfiguration extends ViewHandlerOrReplyOptions, EnginesConfiguration { + /** + * The root file path, or array of file paths, where partials are located. + * Partials are small segments of template code that can be nested and reused throughout other templates. + * Defaults to no partials support (empty path). + */ + partialsPath?: string | string[]; + /** + * The directory path, or array of directory paths, where helpers are located. + * Helpers are functions used within templates to perform transformations and other data manipulations using the template context or other inputs. + * Each '.js' file in the helpers directory is loaded and the file name is used as the helper name. + * The files must export a single method with the signature function(context) and return a string. + * Sub-folders are not supported and are ignored. Defaults to no helpers support (empty path). + * Note that jade does not support loading helpers this way. + */ + helpersPath?: string | string[]; + /** if set to false, templates will not be cached (thus will be read from file on every use). Defaults to true. */ + isCached?: boolean; + } + + /** + * + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#the-view-handler} > options for the list of attributes it can not have (isCached, partialsPath, helpersPath) + */ + interface ViewHandlerOrReplyOptions { + /** the root file path, or array of file paths, used to resolve and load the templates identified when calling reply.view(). Defaults to current working directory. */ + path?: string | string[]; + /** + * a base path used as prefix for path and partialsPath. No default. + */ + relativeTo?: string; + /** + * If set to true or a layout filename, layout support is enabled. + * A layout is a single template file used as the parent template for other view templates in the same engine. + * If true, the layout template name must be 'layout.ext' where 'ext' is the engine's extension. + * Otherwise, the provided filename is suffixed with the engine's extension and loaded. + * Disable layout when using Jade as it will handle including any layout files independently. + * Defaults to false. + */ + layout?: boolean; + /** the root file path, or array of file paths, where layout templates are located (using the relativeTo prefix if present). Defaults to path. */ + layoutPath?: string | string[]; + /** the key used by the template engine to denote where primary template content should go. Defaults to 'content'. */ + layoutKeyword?: string; + /** the text encoding used by the templates when reading the files and outputting the result. Defaults to 'utf8'. */ + encoding?: string; + /** if set to true, allows absolute template paths passed to reply.view(). Defaults to false. */ + allowAbsolutePaths?: boolean; + /** if set to true, allows template paths passed to reply.view() to contain '../'. Defaults to false. */ + allowInsecureAccess?: boolean; + /** options object passed to the engine's compile function. Defaults to empty options {}. */ + compileOptions?: CompileOptions; + /** options object passed to the returned function from the compile operation. Defaults to empty options {}. */ + runtimeOptions?: RuntimeOptions; + /** the content type of the engine results. Defaults to 'text/html'. */ + contentType?: string; + /** specify whether the engine compile() method is 'sync' or 'async'. Defaults to 'sync'. */ + compileMode?: 'sync' | 'async'; + /** + * A global context used with all templates. + * The global context option can be either an object or a function that takes the request as its only argument and returns a context object. + * The request object is only provided when using the view handler or reply.view(). + * When using server.render() or request.render(), the request argument will be null. + * When rendering views, the global context will be merged with any context object specified on the handler or using reply.view(). + * When multiple context objects are used, values from the global context always have lowest precedence. + */ + context?: object | ((request: Request) => object); + } + + /** + * Options passed to module when compiling template. + * Cast your options to this interface or extend it with: + * declare module 'hapi' { + * interface CompileOptions { + * noEscape: boolean; + * } + * } + */ + type CompileOptions = object; + type RuntimeOptions = object; + + /** + * The rendering function. The required function signature depends on the compileMode settings (see below). + * + * If compileMode is 'sync', the signature is compile(template, options), + * the return value is a function with signature function(context, options) (the compiled sync template), + * and the method is allowed to throw errors. + * + * If compileMode is 'async', + * the signature is compile(template, options, next) where next has the signature function(err, compiled), + * compiled is a function with signature function(context, options, callback) (the compiled async template) + * and callback has the signature function(err, rendered). + */ + type ServerViewCompileSync = (template: string, options: any) => (context: any, options: any) => void; + type ServerViewCompileAsync = (template: string, options: any, next: ServerViewCompileNext) => void; + + type ServerViewCompile = ServerViewCompileSync | ServerViewCompileAsync; + + type ServerViewCompileNext = (err: Error | null, compiled: (context: any, options: any, callback: (err: null | Error, rendered: string | null) => void) => void) => void; + + /** + * The npm module used for rendering the templates. The module object must contain the compile() function + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverviewsoptions} > options > engines > module + */ + interface NpmModule { + /** + * The rendering function. The required function signature depends on the compileMode settings + */ + compile: ServerViewCompile; + /** + * Initializes additional engine state.The config object is the engine configuration object allowing updates to be made. + * This is useful for engines like Nunjucks that rely on additional state for rendering. next has the signature function(err). + */ + prepare?(config: EngineConfigurationObject, next: (err?: Error) => void): void; + /** + * Registers a partial for use during template rendering. + * The name is the partial path that templates should use to reference the partial and src is the uncompiled template string for the partial. + */ + registerPartial?(name: string, src: string): void; + /** + * Registers a helper for use during template rendering. + * The name is the name that templates should use to reference the helper and helper is the function that will be invoked when the helper is called. + */ + registerHelper?(name: string, helper: (...args: any[]) => any): void; + } + + type EngineConfigurationObject = object; + + /** + * Renders a template + * @param template - the template filename and path, relative to the views manager templates path (path or relativeTo). + * @param context - optional object used by the template to render context-specific result. Defaults to no context ({}). + * @param options - optional object used to override the views manager configuration. + */ + type RenderMethod = (template: string, context?: any, options?: ServerViewsConfiguration) => Promise; + + /** + * View Manager + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#view-manager} + */ + interface ViewManager { + /** + * Registers a helper, on all configured engines that have a registerHelper() method, for use during template rendering. + * Engines without a registerHelper() method will be skipped. + * The name is the name that templates should use to reference the helper and helper is the function that will be invoked when the helper is called. + * @param name + * @param helper + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#managerregisterhelpername-helper} + */ + registerHelper(name: string, helper: (...args: any[]) => any): void; + /** + * Renders a template. This is typically not needed and it is usually more convenient to use server.render(). + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#managerrendertemplate-context-options-callback} + */ + render: RenderMethod; + } +} + +declare const vision: Plugin; + +export = vision; declare module 'hapi' { interface Server { @@ -12,201 +201,68 @@ declare module 'hapi' { * Initializes the server views manager * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverviewsoptions} */ - views(options: ServerViewsConfiguration): ViewManager; + views(options: vision.ServerViewsConfiguration): vision.ViewManager; /** * Utilizes the server views manager to render a template * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverrendertemplate-context-options-callback} */ - render: RenderMethod; + render: vision.RenderMethod; } +} +declare module 'hapi' { interface Request { /** - * request.render() works the same way as server.render() but is for use inside of request handlers. server.render() does not work inside request handlers when called via request.server.render() if the view manager was created by a plugin. This is because the request.server object does not have access to the plugin realm where the view manager was configured. request.render() gets its realm from the route that the request was bound to. - * Note that this will not work in onRequest extensions added by the plugin because the route isn't yet set at this point in the request lifecycle and the request.render() method will produce the same limited results server.render() can. + * request.render() works the same way as server.render() but is for use inside of request handlers. + * server.render() does not work inside request handlers when called via request.server.render() if the view manager was created by a plugin. + * This is because the request.server object does not have access to the plugin realm where the view manager was configured. + * request.render() gets its realm from the route that the request was bound to. + * Note that this will not work in onRequest extensions added by the plugin because the route isn't yet set at this point in the request + * lifecycle and the request.render() method will produce the same limited results server.render() can. * @see {@link https://github.com/hapijs/vision/blob/master/API.md#requestrendertemplate-context-options-callback} */ - render: RenderMethod; + render: vision.RenderMethod; } +} - interface RouteHandlerPlugins { - /** - * The view handler can be used with routes registered in the same realm as the view manager. The handler takes an options parameter that can be either a string or an object. When the options parameter is a string, it should be the filename and path of the template relative to the templates path configured via the views manager. When the options parameter is an object, it may have the following keys: - * The rendering context contains the `params`, `payload`, `query`, and `pre` values from the request by default (these can be overriden by values explicitly set via the options). - * @see {@link https://github.com/hapijs/vision/blob/master/API.md#the-view-handler} - */ - view?: string | { - /** the template filename and path, relative to the templates path configured via the server views manager. */ - template: string; - /** optional object used by the template to render context-specific result. Defaults to no context {}. */ - context?: Object; - /** - * optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. - * TODO check if it can have `defaultExtension`. - */ - options?: ViewHandlerOrReplyOptions; - } - } - - interface Base_Reply { +declare module 'hapi' { + interface ResponseToolkit { /** * Concludes the handler activity by returning control over to the router with a templatized view response * Returns a response object. The generated response will have the variety property set to view. * The response flow control rules apply. * @param template the template filename and path, relative to the templates path configured via the server views manager. * @param context optional object used by the template to render context-specific result. Defaults to no context {}. - * @param options optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. + * @param options optional object used to override the server's views manager configuration for this response. + * Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. * @see {@link https://github.com/hapijs/vision/blob/master/API.md#replyviewtemplate-context-options} */ - view(templatePath: string, context?: any, options?: ViewHandlerOrReplyOptions): Response; + view(templatePath: string, context?: any, options?: vision.ViewHandlerOrReplyOptions): ResponseObject; } } -/** - * Options for initialising server views manager - * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverviewsoptions} - */ -export interface ServerViewsConfiguration extends ServerViewsAdditionalOptions { - /** required object where each key is a file extension (e.g. 'html', 'hbr'), mapped to the npm module used for rendering the templates. Alternatively, the extension can be mapped to an object */ - engines: {[fileExtension: string]: NpmModule} | ServerViewsEnginesOptions; - /** defines the default filename extension to append to template names when multiple engines are configured and no explicit extension is provided for a given template. No default value. */ - defaultExtension?: string; +declare module 'hapi' { + interface RouteOptions { + /** + * The view handler can be used with routes registered in the same realm as the view manager. + * The handler takes an options parameter that can be either a string or an object. + * When the options parameter is a string, it should be the filename and path of the template relative + * to the templates path configured via the views manager. When the options parameter is an object, it may have the following keys: + * The rendering context contains the `params`, `payload`, `query`, and `pre` values from the request by default + * (these can be overriden by values explicitly set via the options). + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#the-view-handler} + */ + view?: string | { + /** the template filename and path, relative to the templates path configured via the server views manager. */ + template: string; + /** optional object used by the template to render context-specific result. Defaults to no context {}. */ + context?: object; + /** + * optional object used to override the server's views manager configuration for this response. + * Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. + * TODO check if it can have `defaultExtension`. + */ + options?: vision.ViewHandlerOrReplyOptions; + }; + } } - -/** - * Includes `module` and any of the views options listed below (@see ServerViewsAdditionalOptions) (except defaultExtension) to override the defaults for a specific engine. - */ -export interface ServerViewsEnginesOptions extends ServerViewsAdditionalOptions { - /** - * The npm module used for rendering the templates. The module object must contain the compile() function - * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverviewsoptions} > options > engines > module - */ - module: NpmModule -} -export interface ServerViewsAdditionalOptions extends ViewHandlerOrReplyOptions { - /** the root file path, or array of file paths, where partials are located. Partials are small segments of template code that can be nested and reused throughout other templates. Defaults to no partials support (empty path). */ - partialsPath?: string | string[]; - /** the directory path, or array of directory paths, where helpers are located. Helpers are functions used within templates to perform transformations and other data manipulations using the template context or other inputs. Each '.js' file in the helpers directory is loaded and the file name is used as the helper name. The files must export a single method with the signature function(context) and return a string. Sub-folders are not supported and are ignored. Defaults to no helpers support (empty path). Note that jade does not support loading helpers this way. */ - helpersPath?: string | string[]; - /** if set to false, templates will not be cached (thus will be read from file on every use). Defaults to true. */ - isCached?: boolean; -} - -/** - * - * @see {@link https://github.com/hapijs/vision/blob/master/API.md#the-view-handler} > options for the list of attributes it can not have (isCached, partialsPath, helpersPath) - */ -export interface ViewHandlerOrReplyOptions { - /** the root file path, or array of file paths, used to resolve and load the templates identified when calling reply.view(). Defaults to current working directory. */ - path?: string | string[]; - /** - * a base path used as prefix for path and partialsPath. No default. - * TODO update if PR for updating docs is accepted. - */ - relativeTo?: string; - /** if set to true or a layout filename, layout support is enabled. A layout is a single template file used as the parent template for other view templates in the same engine. If true, the layout template name must be 'layout.ext' where 'ext' is the engine's extension. Otherwise, the provided filename is suffixed with the engine's extension and loaded. Disable layout when using Jade as it will handle including any layout files independently. Defaults to false. */ - layout?: boolean; - /** the root file path, or array of file paths, where layout templates are located (using the relativeTo prefix if present). Defaults to path. */ - layoutPath?: string | string[]; - /** the key used by the template engine to denote where primary template content should go. Defaults to 'content'. */ - layoutKeyword?: string; - /** the text encoding used by the templates when reading the files and outputting the result. Defaults to 'utf8'. */ - encoding?: string; - /** if set to true, allows absolute template paths passed to reply.view(). Defaults to false. */ - allowAbsolutePaths?: boolean; - /** if set to true, allows template paths passed to reply.view() to contain '../'. Defaults to false. */ - allowInsecureAccess?: boolean; - /** options object passed to the engine's compile function. Defaults to empty options {}. */ - compileOptions?: CompileOptions; - /** options object passed to the returned function from the compile operation. Defaults to empty options {}. */ - runtimeOptions?: RuntimeOptions; - /** the content type of the engine results. Defaults to 'text/html'. */ - contentType?: string; - /** specify whether the engine compile() method is 'sync' or 'async'. Defaults to 'sync'. */ - compileMode?: 'sync' | 'async'; - /** a global context used with all templates. The global context option can be either an object or a function that takes the request as its only argument and returns a context object. The request object is only provided when using the view handler or reply.view(). When using server.render() or request.render(), the request argument will be null. When rendering views, the global context will be merged with any context object specified on the handler or using reply.view(). When multiple context objects are used, values from the global context always have lowest precedence. */ - context?: Object | ((request: Hapi.Request) => Object); -} - -/** - * Options passed to module when compiling template. - * Cast your options to this interface or extend it with: - * declare module 'hapi' { - * interface CompileOptions { - * noEscape: boolean; - * } - * } - */ -export interface CompileOptions {} -export interface RuntimeOptions {} - -/** - * the rendering function. The required function signature depends on the compileMode settings (see below). - * If compileMode is 'sync', the signature is compile(template, options), the return value is a function with signature function(context, options) (the compiled sync template), and the method is allowed to throw errors. - * If compileMode is 'async', the signature is compile(template, options, next) where next has the signature function(err, compiled), compiled is a function with signature function(context, options, callback) (the compiled async template) and callback has the signature function(err, rendered). - */ -export interface ServerViewCompile { - (template: string, options: any): (context: any, options: any) => void; - (template: string, options: any, next: (err: Error | null, compiled: (context: any, options: any, callback: (err: null | Error, rendered: string | null) => void) => void) => void): void; -} - -/** - * The npm module used for rendering the templates. The module object must contain the compile() function - * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverviewsoptions} > options > engines > module - */ -interface NpmModule { - /** the rendering function. The required function signature depends on the compileMode settings */ - compile: ServerViewCompile - /** initializes additional engine state. The config object is the engine configuration object allowing updates to be made. This is useful for engines like Nunjucks that rely on additional state for rendering. next has the signature function(err). */ - prepare(config: EngineConfigurationObject, next: (err?: Error) => void): void; - /** registers a partial for use during template rendering. The name is the partial path that templates should use to reference the partial and src is the uncompiled template string for the partial. */ - registerPartial(name: string, src: string): void; - /** registers a helper for use during template rendering. The name is the name that templates should use to reference the helper and helper is the function that will be invoked when the helper is called. */ - registerHelper(name: string, helper: Function): void; -} -export interface EngineConfigurationObject {} - -/** - * Renders a template - * @param template - the template filename and path, relative to the views manager templates path (path or relativeTo). - * @param context - optional object used by the template to render context-specific result. Defaults to no context ({}). - * @param options - optional object used to override the views manager configuration. - * @param callback - the callback function with signature function (err, rendered, config) where: - * * err - the rendering error if any. - * * rendered - the result view string or undefined if error. - * * config - the configuration used to render the template or undefined if error. - * If no `callback` is provided, a `Promise` object is returned. The returned promise is resolved with only the rendered content and not the configuration object. - * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverrendertemplate-context-options-callback} - * @see {@link https://github.com/hapijs/vision/blob/master/API.md#managerrendertemplate-context-options-callback} - */ -interface RenderMethod { - (template: string, context?: any, options?: ServerViewsAdditionalOptions, callback?: RenderCallBack): void; - (template: string, context?: any, options?: ServerViewsAdditionalOptions): Promise; -} -export interface RenderCallBack { - (err: null | Error, rendered?: string, options?: ServerViewsAdditionalOptions): void; -} - -/** - * View Manager - * @see {@link https://github.com/hapijs/vision/blob/master/API.md#view-manager} - */ -export interface ViewManager { - /** - * Registers a helper, on all configured engines that have a registerHelper() method, for use during template rendering. Engines without a registerHelper() method will be skipped. The name is the name that templates should use to reference the helper and helper is the function that will be invoked when the helper is called. - * @param name - * @param helper - * @see {@link https://github.com/hapijs/vision/blob/master/API.md#managerregisterhelpername-helper} - */ - registerHelper(name: string, helper: Function): void; - /** - * Renders a template. This is typically not needed and it is usually more convenient to use server.render(). - * @see {@link https://github.com/hapijs/vision/blob/master/API.md#managerrendertemplate-context-options-callback} - */ - render: RenderMethod; -} - -// Has no plugin registration options -declare var visionPlugin: Hapi.PluginFunction<{}>; - -export default visionPlugin; diff --git a/types/vision/tsconfig.json b/types/vision/tsconfig.json index d00003dd52..3c6377bfea 100644 --- a/types/vision/tsconfig.json +++ b/types/vision/tsconfig.json @@ -13,9 +13,6 @@ "../" ], "types": [], - "paths": { - "boom": ["boom/v4"] - }, "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/types/vision/tslint.json b/types/vision/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/vision/tslint.json +++ b/types/vision/tslint.json @@ -1,79 +1 @@ -{ - "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/vision/v4/index.d.ts b/types/vision/v4/index.d.ts new file mode 100644 index 0000000000..5539ad07c2 --- /dev/null +++ b/types/vision/v4/index.d.ts @@ -0,0 +1,212 @@ +// Type definitions for vision 4.1 +// Project: https://github.com/hapijs/vision +// Definitions by: Jason Swearingen , AJP +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import * as Hapi from 'hapi'; + +declare module 'hapi' { + interface Server { + /** + * Initializes the server views manager + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverviewsoptions} + */ + views(options: ServerViewsConfiguration): ViewManager; + /** + * Utilizes the server views manager to render a template + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverrendertemplate-context-options-callback} + */ + render: RenderMethod; + } + + interface Request { + /** + * request.render() works the same way as server.render() but is for use inside of request handlers. server.render() does not work inside request handlers when called via request.server.render() if the view manager was created by a plugin. This is because the request.server object does not have access to the plugin realm where the view manager was configured. request.render() gets its realm from the route that the request was bound to. + * Note that this will not work in onRequest extensions added by the plugin because the route isn't yet set at this point in the request lifecycle and the request.render() method will produce the same limited results server.render() can. + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#requestrendertemplate-context-options-callback} + */ + render: RenderMethod; + } + + interface RouteHandlerPlugins { + /** + * The view handler can be used with routes registered in the same realm as the view manager. The handler takes an options parameter that can be either a string or an object. When the options parameter is a string, it should be the filename and path of the template relative to the templates path configured via the views manager. When the options parameter is an object, it may have the following keys: + * The rendering context contains the `params`, `payload`, `query`, and `pre` values from the request by default (these can be overriden by values explicitly set via the options). + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#the-view-handler} + */ + view?: string | { + /** the template filename and path, relative to the templates path configured via the server views manager. */ + template: string; + /** optional object used by the template to render context-specific result. Defaults to no context {}. */ + context?: Object; + /** + * optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. + * TODO check if it can have `defaultExtension`. + */ + options?: ViewHandlerOrReplyOptions; + } + } + + interface Base_Reply { + /** + * Concludes the handler activity by returning control over to the router with a templatized view response + * Returns a response object. The generated response will have the variety property set to view. + * The response flow control rules apply. + * @param template the template filename and path, relative to the templates path configured via the server views manager. + * @param context optional object used by the template to render context-specific result. Defaults to no context {}. + * @param options optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#replyviewtemplate-context-options} + */ + view(templatePath: string, context?: any, options?: ViewHandlerOrReplyOptions): Response; + } +} + +/** + * Options for initialising server views manager + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverviewsoptions} + */ +export interface ServerViewsConfiguration extends ServerViewsAdditionalOptions { + /** required object where each key is a file extension (e.g. 'html', 'hbr'), mapped to the npm module used for rendering the templates. Alternatively, the extension can be mapped to an object */ + engines: {[fileExtension: string]: NpmModule} | ServerViewsEnginesOptions; + /** defines the default filename extension to append to template names when multiple engines are configured and no explicit extension is provided for a given template. No default value. */ + defaultExtension?: string; +} + +/** + * Includes `module` and any of the views options listed below (@see ServerViewsAdditionalOptions) (except defaultExtension) to override the defaults for a specific engine. + */ +export interface ServerViewsEnginesOptions extends ServerViewsAdditionalOptions { + /** + * The npm module used for rendering the templates. The module object must contain the compile() function + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverviewsoptions} > options > engines > module + */ + module: NpmModule +} +export interface ServerViewsAdditionalOptions extends ViewHandlerOrReplyOptions { + /** the root file path, or array of file paths, where partials are located. Partials are small segments of template code that can be nested and reused throughout other templates. Defaults to no partials support (empty path). */ + partialsPath?: string | string[]; + /** the directory path, or array of directory paths, where helpers are located. Helpers are functions used within templates to perform transformations and other data manipulations using the template context or other inputs. Each '.js' file in the helpers directory is loaded and the file name is used as the helper name. The files must export a single method with the signature function(context) and return a string. Sub-folders are not supported and are ignored. Defaults to no helpers support (empty path). Note that jade does not support loading helpers this way. */ + helpersPath?: string | string[]; + /** if set to false, templates will not be cached (thus will be read from file on every use). Defaults to true. */ + isCached?: boolean; +} + +/** + * + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#the-view-handler} > options for the list of attributes it can not have (isCached, partialsPath, helpersPath) + */ +export interface ViewHandlerOrReplyOptions { + /** the root file path, or array of file paths, used to resolve and load the templates identified when calling reply.view(). Defaults to current working directory. */ + path?: string | string[]; + /** + * a base path used as prefix for path and partialsPath. No default. + * TODO update if PR for updating docs is accepted. + */ + relativeTo?: string; + /** if set to true or a layout filename, layout support is enabled. A layout is a single template file used as the parent template for other view templates in the same engine. If true, the layout template name must be 'layout.ext' where 'ext' is the engine's extension. Otherwise, the provided filename is suffixed with the engine's extension and loaded. Disable layout when using Jade as it will handle including any layout files independently. Defaults to false. */ + layout?: boolean; + /** the root file path, or array of file paths, where layout templates are located (using the relativeTo prefix if present). Defaults to path. */ + layoutPath?: string | string[]; + /** the key used by the template engine to denote where primary template content should go. Defaults to 'content'. */ + layoutKeyword?: string; + /** the text encoding used by the templates when reading the files and outputting the result. Defaults to 'utf8'. */ + encoding?: string; + /** if set to true, allows absolute template paths passed to reply.view(). Defaults to false. */ + allowAbsolutePaths?: boolean; + /** if set to true, allows template paths passed to reply.view() to contain '../'. Defaults to false. */ + allowInsecureAccess?: boolean; + /** options object passed to the engine's compile function. Defaults to empty options {}. */ + compileOptions?: CompileOptions; + /** options object passed to the returned function from the compile operation. Defaults to empty options {}. */ + runtimeOptions?: RuntimeOptions; + /** the content type of the engine results. Defaults to 'text/html'. */ + contentType?: string; + /** specify whether the engine compile() method is 'sync' or 'async'. Defaults to 'sync'. */ + compileMode?: 'sync' | 'async'; + /** a global context used with all templates. The global context option can be either an object or a function that takes the request as its only argument and returns a context object. The request object is only provided when using the view handler or reply.view(). When using server.render() or request.render(), the request argument will be null. When rendering views, the global context will be merged with any context object specified on the handler or using reply.view(). When multiple context objects are used, values from the global context always have lowest precedence. */ + context?: Object | ((request: Hapi.Request) => Object); +} + +/** + * Options passed to module when compiling template. + * Cast your options to this interface or extend it with: + * declare module 'hapi' { + * interface CompileOptions { + * noEscape: boolean; + * } + * } + */ +export interface CompileOptions {} +export interface RuntimeOptions {} + +/** + * the rendering function. The required function signature depends on the compileMode settings (see below). + * If compileMode is 'sync', the signature is compile(template, options), the return value is a function with signature function(context, options) (the compiled sync template), and the method is allowed to throw errors. + * If compileMode is 'async', the signature is compile(template, options, next) where next has the signature function(err, compiled), compiled is a function with signature function(context, options, callback) (the compiled async template) and callback has the signature function(err, rendered). + */ +export interface ServerViewCompile { + (template: string, options: any): (context: any, options: any) => void; + (template: string, options: any, next: (err: Error | null, compiled: (context: any, options: any, callback: (err: null | Error, rendered: string | null) => void) => void) => void): void; +} + +/** + * The npm module used for rendering the templates. The module object must contain the compile() function + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverviewsoptions} > options > engines > module + */ +interface NpmModule { + /** the rendering function. The required function signature depends on the compileMode settings */ + compile: ServerViewCompile + /** initializes additional engine state. The config object is the engine configuration object allowing updates to be made. This is useful for engines like Nunjucks that rely on additional state for rendering. next has the signature function(err). */ + prepare(config: EngineConfigurationObject, next: (err?: Error) => void): void; + /** registers a partial for use during template rendering. The name is the partial path that templates should use to reference the partial and src is the uncompiled template string for the partial. */ + registerPartial(name: string, src: string): void; + /** registers a helper for use during template rendering. The name is the name that templates should use to reference the helper and helper is the function that will be invoked when the helper is called. */ + registerHelper(name: string, helper: Function): void; +} +export interface EngineConfigurationObject {} + +/** + * Renders a template + * @param template - the template filename and path, relative to the views manager templates path (path or relativeTo). + * @param context - optional object used by the template to render context-specific result. Defaults to no context ({}). + * @param options - optional object used to override the views manager configuration. + * @param callback - the callback function with signature function (err, rendered, config) where: + * * err - the rendering error if any. + * * rendered - the result view string or undefined if error. + * * config - the configuration used to render the template or undefined if error. + * If no `callback` is provided, a `Promise` object is returned. The returned promise is resolved with only the rendered content and not the configuration object. + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#serverrendertemplate-context-options-callback} + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#managerrendertemplate-context-options-callback} + */ +interface RenderMethod { + (template: string, context?: any, options?: ServerViewsAdditionalOptions, callback?: RenderCallBack): void; + (template: string, context?: any, options?: ServerViewsAdditionalOptions): Promise; +} +export interface RenderCallBack { + (err: null | Error, rendered?: string, options?: ServerViewsAdditionalOptions): void; +} + +/** + * View Manager + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#view-manager} + */ +export interface ViewManager { + /** + * Registers a helper, on all configured engines that have a registerHelper() method, for use during template rendering. Engines without a registerHelper() method will be skipped. The name is the name that templates should use to reference the helper and helper is the function that will be invoked when the helper is called. + * @param name + * @param helper + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#managerregisterhelpername-helper} + */ + registerHelper(name: string, helper: Function): void; + /** + * Renders a template. This is typically not needed and it is usually more convenient to use server.render(). + * @see {@link https://github.com/hapijs/vision/blob/master/API.md#managerrendertemplate-context-options-callback} + */ + render: RenderMethod; +} + +// Has no plugin registration options +declare var visionPlugin: Hapi.PluginFunction<{}>; + +export default visionPlugin; diff --git a/types/vision/v4/tsconfig.json b/types/vision/v4/tsconfig.json new file mode 100644 index 0000000000..832edc4057 --- /dev/null +++ b/types/vision/v4/tsconfig.json @@ -0,0 +1,40 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "boom": [ + "boom/v4" + ], + "catbox": [ + "catbox/v7" + ], + "hapi": [ + "hapi/v16" + ], + "inert": [ + "inert/v4" + ], + "vision": [ + "vision/v4" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "vision-tests.ts" + ] +} diff --git a/types/yfiles/tslint.json b/types/vision/v4/tslint.json similarity index 100% rename from types/yfiles/tslint.json rename to types/vision/v4/tslint.json diff --git a/types/vision/v4/vision-tests.ts b/types/vision/v4/vision-tests.ts new file mode 100644 index 0000000000..c31dc6661b --- /dev/null +++ b/types/vision/v4/vision-tests.ts @@ -0,0 +1,125 @@ +import * as Hapi from 'hapi'; +import Vision from 'vision'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +// https://github.com/hapijs/vision/blob/master/API.md#serverrendertemplate-context-options-callback + +server.register(Vision, (err) => { + + if (err) { + throw err; + } + + server.views({ + engines: { html: require('handlebars') }, + path: __dirname + '/templates' + }); + + const context = { + title: 'Views Example', + message: 'Hello, World' + }; + + server.render('hello', context, {}, (err, rendered, config) => { + + console.log(rendered); + }); + + // https://github.com/hapijs/vision/blob/master/API.md#requestrendertemplate-context-options-callback + + server.views({ + engines: { html: require('handlebars') }, + path: __dirname + '/templates' + }); + + server.route({ + method: 'GET', + path: '/view', + handler: function (request, reply) { + + request.render('test', { message: 'hello' }, {}, (err, rendered, config) => { + + return reply(rendered); + }); + } + }); + + // https://github.com/hapijs/vision/blob/master/API.md#the-view-handler + + server.views({ + engines: { html: require('handlebars') }, + path: __dirname + '/templates' + }); + + server.route({ + method: 'GET', + path: '/', + handler: { + view: { + template: 'hello', + context: { + title: 'Views Example', + message: 'Hello, World' + } + } + } + }); + + // https://github.com/hapijs/vision/blob/master/API.md#replyviewtemplate-context-options + + server.views({ + engines: { html: require('handlebars') }, + path: __dirname + '/templates' + }); + + const handler: Hapi.RouteHandler = function (request, reply) { + + const context = { + title: 'Views Example', + message: 'Hello, World' + }; + + return reply.view('hello', context); + }; + + server.route({ method: 'GET', path: '/', handler: handler }); + +}); + +// Extending CompileOptions or RuntimeOptions interfaces + +server.register(Vision, (err) => { + + if (err) { + throw err; + } + + server.views({ + engines: { html: require('handlebars') }, + path: __dirname + '/templates' + }); + + var opts: Hapi.CompileOptions = { + noEscape: true + }; + + server.route({ + method: 'GET', + path: '/temp1', + handler: { + view: { + template: 'temp1', + options: { + compileOptions: opts + } + } + } + }); +}); + +declare module 'hapi' { + interface CompileOptions { + noEscape: boolean; + } +} diff --git a/types/vision/vision-tests.ts b/types/vision/vision-tests.ts index c31dc6661b..7ca9629e72 100644 --- a/types/vision/vision-tests.ts +++ b/types/vision/vision-tests.ts @@ -1,55 +1,43 @@ -import * as Hapi from 'hapi'; -import Vision from 'vision'; -const server = new Hapi.Server(); -server.connection({ port: 80 }); +import { + Server, + Request, + ResponseToolkit, +} from 'hapi'; -// https://github.com/hapijs/vision/blob/master/API.md#serverrendertemplate-context-options-callback +import * as Vision from 'vision'; +import * as Handlebars from 'handlebars'; -server.register(Vision, (err) => { +const server = new Server({ + port: 80, +}); - if (err) { - throw err; - } +const provision = async () => { + await server.register({ + plugin: Vision, + options: { + engines: { hbs: Handlebars }, + path: __dirname + '/templates', + } + }); server.views({ - engines: { html: require('handlebars') }, - path: __dirname + '/templates' + engines: { hbs: Handlebars }, + path: __dirname + '/templates', }); const context = { title: 'Views Example', - message: 'Hello, World' + message: 'Hello, World', }; - server.render('hello', context, {}, (err, rendered, config) => { - - console.log(rendered); - }); - - // https://github.com/hapijs/vision/blob/master/API.md#requestrendertemplate-context-options-callback - - server.views({ - engines: { html: require('handlebars') }, - path: __dirname + '/templates' - }); + console.log(await server.render('hello', context)); server.route({ method: 'GET', path: '/view', - handler: function (request, reply) { - - request.render('test', { message: 'hello' }, {}, (err, rendered, config) => { - - return reply(rendered); - }); - } - }); - - // https://github.com/hapijs/vision/blob/master/API.md#the-view-handler - - server.views({ - engines: { html: require('handlebars') }, - path: __dirname + '/templates' + handler: async (request: Request, h: ResponseToolkit) => { + return request.render('test', { message: 'hello' }); + }, }); server.route({ @@ -60,49 +48,21 @@ server.register(Vision, (err) => { template: 'hello', context: { title: 'Views Example', - message: 'Hello, World' - } - } - } + message: 'Hello, World', + }, + }, + }, }); - // https://github.com/hapijs/vision/blob/master/API.md#replyviewtemplate-context-options - - server.views({ - engines: { html: require('handlebars') }, - path: __dirname + '/templates' - }); - - const handler: Hapi.RouteHandler = function (request, reply) { - + const handler = (request: Request, h: ResponseToolkit) => { const context = { title: 'Views Example', - message: 'Hello, World' + message: 'Hello, World', }; - - return reply.view('hello', context); + return h.view('hello', context); }; - server.route({ method: 'GET', path: '/', handler: handler }); - -}); - -// Extending CompileOptions or RuntimeOptions interfaces - -server.register(Vision, (err) => { - - if (err) { - throw err; - } - - server.views({ - engines: { html: require('handlebars') }, - path: __dirname + '/templates' - }); - - var opts: Hapi.CompileOptions = { - noEscape: true - }; + server.route({ method: 'GET', path: '/', handler }); server.route({ method: 'GET', @@ -111,15 +71,11 @@ server.register(Vision, (err) => { view: { template: 'temp1', options: { - compileOptions: opts - } - } - } + compileOptions: { + noEscape: true, + }, + }, + }, + }, }); -}); - -declare module 'hapi' { - interface CompileOptions { - noEscape: boolean; - } -} +}; diff --git a/types/vitalsigns/vitalsigns-tests.ts b/types/vitalsigns/vitalsigns-tests.ts index 62cc2e5676..757b7099c5 100644 --- a/types/vitalsigns/vitalsigns-tests.ts +++ b/types/vitalsigns/vitalsigns-tests.ts @@ -1,4 +1,4 @@ -import * as express from "express"; +import express = require("express"); import VitalSigns = require("vitalsigns"); var vitals = new VitalSigns(); diff --git a/types/vnu-jar/index.d.ts b/types/vnu-jar/index.d.ts new file mode 100644 index 0000000000..2e2e2a1ac9 --- /dev/null +++ b/types/vnu-jar/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for vnu-jar 17.11 +// Project: https://github.com/validator/validator#readme +// Definitions by: Umoxfo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = vnu_jar; + +declare const vnu_jar: string; diff --git a/types/vnu-jar/tsconfig.json b/types/vnu-jar/tsconfig.json new file mode 100644 index 0000000000..8468e98846 --- /dev/null +++ b/types/vnu-jar/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "vnu-jar-tests.ts" + ] +} diff --git a/types/vnu-jar/tslint.json b/types/vnu-jar/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/vnu-jar/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vnu-jar/vnu-jar-tests.ts b/types/vnu-jar/vnu-jar-tests.ts new file mode 100644 index 0000000000..776ccd9d4a --- /dev/null +++ b/types/vnu-jar/vnu-jar-tests.ts @@ -0,0 +1,15 @@ +// Imported from: https://github.com/soywiz/typescript-node-definitions/d.ts + +/// + +import { exec } from "child_process"; +import vnu = require("vnu-jar"); + +exec(`java -jar ${vnu} --version`, (error, stdout) => { + if (error) { + console.error(`exec error: ${error}`); + return; + } + + console.log(stdout); +}); diff --git a/types/void-elements/index.d.ts b/types/void-elements/index.d.ts new file mode 100644 index 0000000000..855ac9d093 --- /dev/null +++ b/types/void-elements/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for void-elements 3.1 +// Project: https://github.com/jadejs/void-elements +// Definitions by: Klaus Meinhardt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare const voidElements: Partial>; +export = voidElements; diff --git a/types/void-elements/tsconfig.json b/types/void-elements/tsconfig.json new file mode 100644 index 0000000000..469052dfe7 --- /dev/null +++ b/types/void-elements/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", + "void-elements-tests.ts" + ] +} \ No newline at end of file diff --git a/types/void-elements/tslint.json b/types/void-elements/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/void-elements/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/void-elements/void-elements-tests.ts b/types/void-elements/void-elements-tests.ts new file mode 100644 index 0000000000..74a462ada5 --- /dev/null +++ b/types/void-elements/void-elements-tests.ts @@ -0,0 +1,4 @@ +import * as voidElements from 'void-elements'; + +let isVoid: boolean | undefined = voidElements.span; +isVoid = voidElements.input; diff --git a/types/vue-scrollto/tsconfig.json b/types/vue-scrollto/tsconfig.json index fd030de5e6..720520bdac 100644 --- a/types/vue-scrollto/tsconfig.json +++ b/types/vue-scrollto/tsconfig.json @@ -3,7 +3,7 @@ "module": "commonjs", "lib": [ "es6", - "dom" + "dom" ], "noImplicitAny": true, "noImplicitThis": true, @@ -21,4 +21,4 @@ "index.d.ts", "vue-scrollto-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/w3c-image-capture/tsconfig.json b/types/w3c-image-capture/tsconfig.json index 1dc1d0ce51..d9d2c4b574 100644 --- a/types/w3c-image-capture/tsconfig.json +++ b/types/w3c-image-capture/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "w3c-image-capture-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/wampy/wampy-tests.ts b/types/wampy/wampy-tests.ts index 27dd90ed73..1d999fc7c6 100644 --- a/types/wampy/wampy-tests.ts +++ b/types/wampy/wampy-tests.ts @@ -1,4 +1,4 @@ -import * as Wampy from 'wampy'; +import Wampy = require('wampy'); declare var console: { log(...args: any[]): void }; let ws = new Wampy('http://wamp.router.url', {realm: 'WAMPRealm'}); diff --git a/types/warning/warning-tests.ts b/types/warning/warning-tests.ts index 7079e127f2..f85e3159c5 100644 --- a/types/warning/warning-tests.ts +++ b/types/warning/warning-tests.ts @@ -1,4 +1,4 @@ -import * as warning from "warning"; +import warning = require("warning"); // this will pass without warning. warning(true, 'Warning, read all about it'); diff --git a/types/waypoints/index.d.ts b/types/waypoints/index.d.ts index 97ad8d3488..0bf0c488d8 100644 --- a/types/waypoints/index.d.ts +++ b/types/waypoints/index.d.ts @@ -1,18 +1,21 @@ // Type definitions for waypoints 4.x // Project: https://github.com/imakewebthings/waypoints -// Definitions by: Dominik Bułaj , Alexey Kolotovchenkov +// Definitions by: Dominik Bułaj , Alexey Kolotovchenkov , Sergei Dorogin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -interface WaypointOptions { - element: HTMLElement; - handler: (this: Waypoint, direction?: string) => void; +interface WaypointOptionsBase { offset?: string|number|(() => number); - context?: HTMLElement; continuous?: boolean; enabled?: boolean; group?: string; horizontal?: boolean; } +interface WaypointOptions extends WaypointOptionsBase { + element: HTMLElement; + handler: (this: Waypoint, direction?: string) => void; + context?: HTMLElement; +} declare class WaypointGroup { first: () => Waypoint; diff --git a/types/waypoints/jquery.d.ts b/types/waypoints/jquery.d.ts new file mode 100644 index 0000000000..d93b0ac18e --- /dev/null +++ b/types/waypoints/jquery.d.ts @@ -0,0 +1,13 @@ +/* Type definitions for jQuery Adapter for waypoints 4.0 */ + +/// + +interface JQuery { + waypoint(handler: (this: Waypoint, direction?: string) => void, options?: WaypointOptionsJQuery): JQuery; + waypoint(options?: WaypointOptionsJQuery): JQuery; +} + +interface WaypointOptionsJQuery extends WaypointOptionsBase { + handler?: (this: Waypoint, direction?: string) => void; + context?: HTMLElement|string; +} diff --git a/types/waypoints/tsconfig.json b/types/waypoints/tsconfig.json index c457df62f8..4acd5d77b4 100644 --- a/types/waypoints/tsconfig.json +++ b/types/waypoints/tsconfig.json @@ -19,6 +19,7 @@ }, "files": [ "index.d.ts", + "jquery.d.ts", "waypoints-tests.ts" ] } \ No newline at end of file diff --git a/types/waypoints/waypoints-tests.ts b/types/waypoints/waypoints-tests.ts index 658412f953..4ea425fbf8 100644 --- a/types/waypoints/waypoints-tests.ts +++ b/types/waypoints/waypoints-tests.ts @@ -4,7 +4,7 @@ declare function notify(text: string): void; // A Basic Waypoint // -------------------------------------------------------------------------------------------------------------------- -let waypoint1 = new Waypoint({ +const waypoint1 = new Waypoint({ element: document.getElementById('basic-waypoint')!, handler() { notify('Basic waypoint triggered'); @@ -13,7 +13,7 @@ let waypoint1 = new Waypoint({ // Directions // -------------------------------------------------------------------------------------------------------------------- -let waypoint2 = new Waypoint({ +const waypoint2 = new Waypoint({ element: document.getElementById('direction-waypoint')!, handler(direction) { notify('Direction: ' + direction); @@ -22,7 +22,7 @@ let waypoint2 = new Waypoint({ // Offsets // -------------------------------------------------------------------------------------------------------------------- -let waypoint3 = new Waypoint({ +const waypoint3 = new Waypoint({ element: document.getElementById('px-offset-waypoint')!, handler(direction) { notify('I am 20px from the top of the window'); @@ -32,10 +32,45 @@ let waypoint3 = new Waypoint({ // this? // -------------------------------------------------------------------------------------------------------------------- -let waypoint4 = new Waypoint({ +const waypoint4 = new Waypoint({ element: document.getElementById('element-waypoint')!, handler(direction) { notify(`${this.element.id} triggers at ${this.triggerPoint}`); }, offset: '75%' }); + +// JQuery adapter +// All code examples below taken from http://imakewebthings.com/waypoints/guides/jquery-zepto/ + +import $ = require('jquery'); + +// $.fn.waypoint +// -------------------------------------------------------------------------------------------------------------------- + +const waypoints10 = $('#options-only').waypoint({ + handler: function fn(this: Waypoint, direction?: string) { + notify(this.element.id + ' hit'); + } +}); + +const waypoints11 = $('#handler-first').waypoint(function() { + notify(this.element.id + ' hit 25% from top of window'); +}, { + offset: '25%' +}); + +const waypoints12 = $('#handler-only').waypoint(function() { + notify(this.element.id + ' hit'); +}); + +// Context Option +// -------------------------------------------------------------------------------------------------------------------- + +const waypoints13 = $('#context-example-offset').waypoint({ + handler: function fn(this: Waypoint, direction?: string) { + notify('Hit midpoint of my context'); + }, + context: '#overflow-scroll-offset', + offset: '50%' +}); diff --git a/types/weak/tsconfig.json b/types/weak/tsconfig.json index 33d1a4cdf3..1e75cff1e1 100644 --- a/types/weak/tsconfig.json +++ b/types/weak/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "weak-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/web-animations-js/index.d.ts b/types/web-animations-js/index.d.ts index 2424e93e92..54c0b8c01b 100644 --- a/types/web-animations-js/index.d.ts +++ b/types/web-animations-js/index.d.ts @@ -5,13 +5,12 @@ type AnimationEffectTimingFillMode = "none" | "forwards" | "backwards" | "both" | "auto"; type AnimationEffectTimingPlaybackDirection = "normal" | "reverse" | "alternate" | "alternate-reverse"; -type AnimationPlayState = "idle" | "pending" | "running" | "paused" | "finished"; +type AnimationPlayState = "idle" | "running" | "paused" | "finished"; -declare class AnimationPlaybackEvent { - constructor(target: Animation, currentTime: number, timelineTime: number); +interface AnimationPlaybackEvent { target: Animation; - currentTime: number; - timelineTime: number; + readonly currentTime: number | null; + readonly timelineTime: number | null; type: string; bubbles: boolean; cancelable: boolean; @@ -21,14 +20,26 @@ declare class AnimationPlaybackEvent { timeStamp: number; } +interface AnimationPlaybackEventInit extends EventInit { + currentTime?: number | null; + timelineTime?: number | null; +} + +declare var AnimationPlaybackEvent: { + prototype: AnimationPlaybackEvent; + new(type: string, eventInitDict?: AnimationPlaybackEventInit): AnimationPlaybackEvent; +}; + interface AnimationKeyFrame { - easing?: string; - offset?: number; - [key: string]: string | number | [string | number, string | number] | undefined; + easing?: string | string[]; + offset?: number | Array | null; + opacity?: number | number[]; + transform?: string | string[]; + // [key: string]: string | number | [string | number, string | number] | undefined; (duplicate string indexer in TypeScript 2.7+) } interface AnimationTimeline { - currentTime: number; + readonly currentTime: number | null; getAnimations(): Animation[]; play(effect: KeyframeEffect): Animation; } @@ -43,21 +54,35 @@ interface AnimationEffectTiming { iterations?: number; playbackRate?: number; } -declare class KeyframeEffect { + +interface AnimationEffectReadOnly { + readonly timing: number; + getComputedTiming(): ComputedTimingProperties; +} + +interface ComputedTimingProperties { + endTime: number; + activeDuration: number; + localTime: number | null; + progress: number | null; + currentIteration: number | null; +} + +declare class KeyframeEffect implements AnimationEffectReadOnly { constructor(target: HTMLElement, effect: AnimationKeyFrame | AnimationKeyFrame[], timing: number | AnimationEffectTiming, id?: string); activeDuration: number; onsample: (timeFraction: number | null, effect: KeyframeEffect, animation: Animation) => void | undefined; parent: KeyframeEffect | null; target: HTMLElement; - timing: AnimationEffectTiming; + timing: number; + getComputedTiming(): ComputedTimingProperties; getFrames(): AnimationKeyFrame[]; remove(): void; } -type AnimationEventListener = (evt: AnimationPlaybackEvent) => void; +type AnimationEventListener = (this: Animation, evt: AnimationPlaybackEvent) => any; -declare class Animation { - constructor(effect: KeyframeEffect, timeline?: AnimationTimeline); - currentTime: number; +interface Animation extends EventTarget { + currentTime: number | null; id: string; oncancel: AnimationEventListener; onfinish: AnimationEventListener; @@ -69,14 +94,19 @@ declare class Animation { pause(): void; play(): void; reverse(): void; - addEventListener(type: "finish" | "cancel", handler: AnimationEventListener): void; - removeEventListener(type: "finish" | "cancel", handler: AnimationEventListener): void; - effect: KeyframeEffect; + addEventListener(type: "finish" | "cancel", handler: EventListener): void; + removeEventListener(type: "finish" | "cancel", handler: EventListener): void; + effect: AnimationEffectReadOnly; readonly finished: Promise; readonly ready: Promise; timeline: AnimationTimeline; } +declare var Animation: { + prototype: Animation; + new(effect?: AnimationEffectReadOnly, timeline?: AnimationTimeline): Animation; +}; + declare class SequenceEffect extends KeyframeEffect { constructor(effects: KeyframeEffect[]); } diff --git a/types/webcl/tslint.json b/types/webcl/tslint.json index 7f51cc6e38..067a495dc9 100644 --- a/types/webcl/tslint.json +++ b/types/webcl/tslint.json @@ -21,6 +21,7 @@ "no-boolean-literal-compare": false, "no-conditional-assignment": false, "no-consecutive-blank-lines": false, + "no-const-enum": false, "no-construct": false, "no-declare-current-package": false, "no-duplicate-imports": false, diff --git a/types/webdriverio/index.d.ts b/types/webdriverio/index.d.ts index 47d1e8320d..8020be7957 100644 --- a/types/webdriverio/index.d.ts +++ b/types/webdriverio/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for WebdriverIO 4.8 +// Type definitions for WebdriverIO 4.10 // Project: http://www.webdriver.io/ // Definitions by: Nick Malaguti // Tim Brust // Fredrik Smedberg // Tanvir ul Islam +// Phil Leger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -333,70 +334,72 @@ declare namespace WebdriverIO { } interface Hooks { - onError(error: Error): Promise & undefined; + onError?(error: Error): Promise & undefined; - onPrepare( + onPrepare?( config: Options, capabilities: DesiredCapabilities ): Promise & undefined; - onComplete(exitCode: number): Promise & undefined; + onComplete?(exitCode: number): Promise & undefined; - before( + before?( capabilities: DesiredCapabilities, specs: string[] ): Promise & undefined; - beforeCommand( + beforeCommand?( commandName: string, args: any[] ): Promise & undefined; - beforeFeature(feature: string): Promise & undefined; - beforeHook(): Promise & undefined; - beforeScenario(scenario: string): Promise & undefined; + beforeFeature?(feature: string): Promise & undefined; + beforeHook?(): Promise & undefined; + beforeScenario?(scenario: string): Promise & undefined; - beforeSession( + beforeSession?( config: Options, capabilities: DesiredCapabilities, specs: string[] ): Promise & undefined; - beforeStep(step: string): Promise & undefined; - beforeSuite(suite: Suite): Promise & undefined; - beforeTest(test: Test): Promise & undefined; - afterHook(): Promise & undefined; + beforeStep?(step: string): Promise & undefined; + beforeSuite?(suite: Suite): Promise & undefined; + beforeTest?(test: Test): Promise & undefined; + afterHook?(): Promise & undefined; - after( + after?( result: number, capabilities: DesiredCapabilities, specs: string[] ): Promise & undefined; - afterCommand( + afterCommand?( commandName: string, args: any[], result: any, error?: Error ): Promise & undefined; - afterScenario(scenario: any): Promise & undefined; + afterScenario?(scenario: any): Promise & undefined; - afterSession( + afterSession?( config: Options, capabilities: DesiredCapabilities, specs: string[] ): Promise & undefined; - afterStep(stepResult: any): Promise & undefined; - afterSuite(suite: Suite): Promise & undefined; - afterTest(test: Test): Promise & undefined; - afterFeature(feature: string): Promise & undefined; + afterStep?(stepResult: any): Promise & undefined; + afterSuite?(suite: Suite): Promise & undefined; + afterTest?(test: Test): Promise & undefined; + afterFeature?(feature: string): Promise & undefined; } interface Options { baseUrl?: string; bail?: number; + deprecationWarnings?: boolean; + browserstackLocal?: boolean; coloredLogs?: boolean; capabilities?: DesiredCapabilities[]; connectionRetryTimeout?: number; @@ -413,7 +416,7 @@ declare namespace WebdriverIO { path?: string; plugins?: { [name: string]: any; }; reporters?: string[] | ((...args: any[]) => void); - reporterOptions?: { outputDir?: string; }; + reporterOptions?: { outputDir?: string, [reporterName: string]: any }; logLevel?: string; maxInstances?: number; maxInstancesPerCapability?: number; @@ -1892,6 +1895,12 @@ declare namespace WebdriverIO { 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/webdriverio-tests.ts b/types/webdriverio/webdriverio-tests.ts index 1765029a32..4a078ef6e9 100644 --- a/types/webdriverio/webdriverio-tests.ts +++ b/types/webdriverio/webdriverio-tests.ts @@ -26,7 +26,7 @@ describe.only("my webdriverio tests", () => { let client: webdriverio.Client; before(async () => { - client = webdriverio.remote({ desiredCapabilities: { browserName: "phantomjs" } }); + client = webdriverio.remote({ deprecationWarnings: true, desiredCapabilities: { browserName: "phantomjs" } }); await client.init(); }); diff --git a/types/webix/index.d.ts b/types/webix/index.d.ts deleted file mode 100755 index 27082c52e0..0000000000 --- a/types/webix/index.d.ts +++ /dev/null @@ -1,10187 +0,0 @@ -// Type definitions for Webix UI 4.3 -// Project: http://webix.com -// Definitions by: Maksim Kozhukh -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -declare namespace webix { - -type WebixTemplate = (...args: any[])=>string; -type WebixCallback = (...args: any[])=>any; -type EventHash = { [id: string] : WebixCallback }; - -interface PromisedData { - then(handler:(data:any)=>any):PromisedData; - fail(handler:(error:any)=>any):PromisedData; -} - -function ajax():webix._ajax; -function $$(id: string|Event|HTMLElement):webix.ui.baseview; - - -interface _ajax{ - bind(master:any):webix._ajax; - del(url:string, params?:any, callback?:WebixCallback):PromisedData; - get(url:string, params?:any, callback?:WebixCallback):PromisedData; - getXHR():any; - headers(values:any):webix._ajax; - post(url:string, params?:any, callback?:WebixCallback):PromisedData; - put(url:string, params?:any, callback?:WebixCallback):PromisedData; - response(type:string):void; - stringify(data:any):string; - sync():webix._ajax; - master: any; -} -interface clipbuffer{ - destructor():void; - focus():void; - init():void; - set(text:string):void; -} -interface color{ - hexToDec(hex:string):number; - hsvToRgb(h:number, s:number, v:number):any[]; - rgbToHsv(r:number, g:number, b:number):any[]; - toHex(number:number, length?:number):string; - toRgb(rgb:string):any[]; -} -interface csv{ - parse(text:string, delimiter?:any):any[]; - stringify(data:any[], delimiter?:any):string; - delimiter: any; - escape: boolean; -} -interface editors{ - $popup: any; - checkbox: string; - color: string; - combo: string; - date: string; - "inline-checkbox": string; - "inline-text": string; - multiselect: string; - password: string; - popup: string; - richselect: string; - select: string; - text: string; -} -interface env{ - cssPrefix: string; - isFF: boolean; - isIE: boolean; - isSafari: boolean; - isWebKit: boolean; - jsPrefix: string; - mouse: any; - strict: boolean; - svg: boolean; - transform: boolean; - transition: boolean; - transitionDuration: string; - transitionEnd: string; - translate: string; -} -interface history{ - push(view:string, url:string, value:any):void; - track(view:string, url:string):void; -} -interface html{ - addCss(node:HTMLElement, name:string):void; - addMeta(name:string, value:string):void; - addStyle(css:string):void; - allowSelect():void; - create(name:string, attrs:any, html?:string):HTMLElement; - createCss(data:any):string; - denySelect():void; - getValue(node:HTMLElement):string; - index(node:HTMLElement):number; - insertBefore(node:HTMLElement, before:HTMLElement, rescue?:HTMLElement):void; - locate(ev:Event|HTMLElement, name:string):string; - offset(node:HTMLElement):any; - pos(ev:Event):any; - posRelative(ev:Event):any; - preventEvent(ev:Event):boolean; - remove(node:HTMLElement|HTMLElement[]):void; - removeCss(node:HTMLElement, name:string):void; - stopEvent(ev:Event):boolean; - getTextSize(text:(string|string[]), css?:string, width?:number):number; -} -interface i18n{ - dateFormatDate(date:string):any; - dateFormatStr(date:any):string; - fullDateFormatDate(date:string):any; - fullDateFormatStr(date:Date):string; - intFormat(num:number):string; - longDateFormatDate(date:string):any; - longDateFormatStr(date:any):string; - numberFormat(number:number):string; - parseFormatDate(date:string):any; - parseFormatStr(date:any):string; - parseTimeFormatDate(date:string):any; - parseTimeFormatStr(date:any):string; - priceFormat(number:number):string; - setLocale(name:string):void; - timeFormatDate(time:string):any; - timeFormatStr(date:any):string; - calendar: any; - controls: any; - dateFormat: string; - decimalDelimiter: string; - decimalSize: number; - fileSize: any[]; - fullDateFormat: string; - groupDelimiter: string; - groupSize: number; - locales: any; - longDateFormat: string; - parseFormat: string; - parseTimeFormat: string; - price: string; - priceSettings: any; - timeFormat: string; -} -interface locale{ - pager: any; -} -interface markup{ - init(node:string, target:string):webix.ui.baseview; - parse(data:any, datatype:string):void; - attribute: any; - dataTag: any; - namespace: any; -} -interface promise{ - all(promise:PromisedData, morepromises?:PromisedData):void; - defer():PromisedData; - fcall():PromisedData; - nfcall():PromisedData; -} -interface rules{ - isChecked():boolean; - isEmail():boolean; - isNotEmpty():boolean; - isNumber():boolean; -} -interface cookie{ - clear():void; - get(name:string):any; - put(name:string, value:any):void; - remove(name:string):void; -} -interface local{ - clear():void; - get(name:string):any; - put(name:string, value:any):void; - remove(name:string):void; -} -interface session{ - clear():void; - get(name:string):any; - put(name:string, value:any):void; - remove(name:string):void; -} -interface storage{ - cookie:webix.cookie; - local:webix.local; - session:webix.session; -} - -function alert(text:string, callback:WebixCallback):HTMLElement; -function animate(html_element:HTMLElement, animation:any):void; -function attachEvent(type:string, functor:WebixCallback, id?:string):string|number; -function bind(code:WebixCallback, master:any):WebixCallback; -function blockEvent():void; -function callEvent(name:string, params:any[]):boolean; -function clone(source:any):any; -function confirm(text:string, callback:WebixCallback):HTMLElement; -function copy(source:any):any; -function delay(code:WebixCallback, owner?:any, params?:any[], delay?:number):number; -function detachEvent(id:string):void; -function dp(name:string):any; -function editStop():void; -function event(node:HTMLElement|Window|string, event:string, handler:WebixCallback, context?:any):string|number; -function eventRemove(id:string|number):void; -function exec(code:string):void; -function extend(target:any, source:any, overwrite?:boolean):any; -function hasEvent(name:string):boolean; -function isArray(check:any):boolean; -function isDate(check:any):boolean; -function isUndefined(check:any):boolean; -function jsonp(url:string, params?:any, callback?:WebixCallback, master?:any):void; -function mapEvent(map:any):void; -function message(content:any):void; -function modalbox(text:string, callback:WebixCallback):HTMLElement; -function once(code:WebixCallback):void; -function proto(target:any, ...mixins:any[]):any; -function protoUI(target:any, ...mixins: any[]):any; -function proxy(type:string, source:string):any; -function ready(code:WebixCallback):void; -function remote():void; -function require(url:string):void; -function send(url:string, values:any, method:string, target:string):void; -function single(source:WebixCallback):WebixCallback; -function stringify(obj:any):string; -function template(template:string):WebixCallback; -function toArray(array:any[]):any[]; -function toCSV(id:any, options:any):void; -function toExcel(id:any, options:any):void; -function toFunctor(name:string):WebixCallback; -function toNode(id:string):HTMLElement; -function toPDF(id:string, name:string):void; -function toPNG(id:string, name:string):void; -function type(config:any):void; -function ui(config:any, parent?:any, replacement?:any):webix.ui.baseview; -function uid():number; -function unblockEvent():void; -function wrap(target:WebixCallback, source:WebixCallback):WebixCallback; - -var codebase: string; -var name: string; -var version: string; -var clipbuffer:webix.clipbuffer; -var color:webix.color; -var csv:webix.csv; -var editors:webix.editors; -var env:webix.env; -var history:webix.history; -var html:webix.html; -var i18n:webix.i18n; -var locale:webix.locale; -var markup:webix.markup; -var promise:webix.promise; -var rules:webix.rules; -var storage:webix.storage; - -interface ActiveContent{ -} -var ActiveContent:ActiveContent; -interface AtomDataLoader{ - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - parse(data:any, type:string):void; -} -var AtomDataLoader:AtomDataLoader; -interface AtomRender{ - render(id:string|number, data:any, type:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; -} -var AtomRender:AtomRender; -interface AutoScroll{ -} -var AutoScroll:AutoScroll; -interface AutoTooltip{ -} -var AutoTooltip:AutoTooltip; -interface BaseBind{ - bind(target:any, rule?:WebixCallback, format?:string):void; - unbind():void; -} -var BaseBind:BaseBind; -interface BindSource{ - addBind(source:any, rule:string, format:string):void; - getBindData(key:string|number, update:boolean):void; - removeBind(source:any):void; - saveBatch(handler:WebixCallback):void; - setBindData(data:any, key:string|number):void; -} -var BindSource:BindSource; -interface Canvas{ - clearCanvas():void; - getCanvas(context:string):any; - hideCanvas():void; - renderText(x:number, y:number, text:string, css:string, w:number):void; - renderTextAt(valign:string, align:string, x:number, y:number, t:string, c:string, w:number):void; - showCanvas():void; - toggleCanvas():void; -} -var Canvas:Canvas; -interface CodeParser{ - collapseNames(obj:any):{ [key: string]: any; }; - expandNames(obj:{ [key: string]: any; }):any; -} -var CodeParser:CodeParser; -interface CollectionBind{ - getCursor():number; - refreshCursor():void; - setCursor(cursor:string|number):void; -} -var CollectionBind:CollectionBind; -interface ContextHelper{ - attachTo(view:any):void; - getContext():any; - setContext(context:any):void; -} -var ContextHelper:ContextHelper; -interface CopyPaste{ -} -var CopyPaste:CopyPaste; -interface CustomScroll{ - enable(html_node:HTMLElement|webix.ui.baseview):void; - init():void; - resize():void; - scrollStep: number; -} -var CustomScroll:CustomScroll; -interface DataCollection{ - add(obj:any, index?:number):string|number; - addBind(source:any, rule:string, format:string):void; - attachEvent(type:string, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearValidation():void; - copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - count():number; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getBindData(key:string|number, update:boolean):void; - getCursor():number; - getFirstId():string|number; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getPrevId(id:string|number, step:number):string|number; - hasEvent(name:string):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - mapEvent(map:any):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveBottom(id:string|number):void; - moveDown(id:string|number, step:number):void; - moveTop(id:string|number):void; - moveUp(id:string|number, step:number):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - refreshCursor():void; - remove(id:string|number):void; - removeBind(source:any):void; - saveBatch(handler:WebixCallback):void; - serialize():any; - setBindData(data:any, key:string|number):void; - setCursor(cursor:string|number):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - config: { [key: string]: any; }; - name: string; - data:DataStore; - waitData: webix.promise; -} - -interface DataDriver{ - csv: any; - excel: string; - html: any; - htmltable: any; - jsarray: any; - json: any; - xml: any; -} -var DataDriver:DataDriver; -interface DataLoader{ - add(obj:any, index?:number):string|number; - clearAll():void; - count():number; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getFirstId():string|number; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getPrevId(id:string|number, step:number):string|number; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - serialize():any; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - updateItem(id:string|number, data:any):void; - waitData: webix.promise; -} -var DataLoader:DataLoader; -interface DataMarks{ - addCss(id:string|number, css:string, silent?:boolean):void; - clearCss(css:string, silent?:boolean):void; - hasCss(id:string|number, css:string):boolean; - removeCss(id:string|number, css:string, silent?:boolean):void; -} -var DataMarks:DataMarks; -interface DataMove{ - copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveBottom(id:string|number):void; - moveDown(id:string|number, step:number):void; - moveTop(id:string|number):void; - moveUp(id:string|number, step:number):void; -} -var DataMove:DataMove; -interface DataProcessor{ - attachEvent(type:string, functor:WebixCallback, id?:string):string|number; - attachProgress(start:WebixCallback, end:WebixCallback, error:WebixCallback):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearValidation():void; - define(property:string, value:any):void; - detachEvent(id:string):void; - escape(value:string):string; - getItemState(itemId:string|number):any; - getState():string|boolean; - hasEvent(name:string):boolean; - ignore(code:WebixCallback, master:any):void; - mapEvent(map:any):void; - off():void; - on():void; - processResult(data:any):void; - reset():void; - save(id:string|number, operation:string):void; - send():void; - setItemState(itemId:string|number, state:boolean):void; - unblockEvent():void; - validate(mode?:any):boolean; - config: { [key: string]: any; }; - name: string; -} -var DataProcessor:DataProcessor; -interface DataRecord{ - attachEvent(type:string, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - detachEvent(id:string):void; - getValues():any; - hasEvent(name:string):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - mapEvent(map:any):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - setValues(values:any, update?:boolean):void; - unbind():void; - unblockEvent():void; - config: { [key: string]: any; }; - name: string; -} -var DataRecord:DataRecord; -interface DataState{ - getState():any; - setState(state:any):void; -} -var DataState:DataState; -interface DataStore{ - add(obj:any, index?:number):string|number; - addMark(id:string, name:string, css?:boolean, value?:any):any; - attachEvent(type:string, functor:WebixCallback, id?:string):string|number; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - changeId(old:string|number, newid:string|number):void; - clearAll():void; - clearMark(name:string):void; - count():number; - destructor():void; - detachEvent(id:string):void; - each(method:WebixCallback, master?:any, all?:boolean):void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getFirstId():string|number; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getIndexRange(from:string|number, to:string|number):any[]; - getItem(id:string|number):any; - getLastId():string|number; - getMark(id:string, mark_name:string):any; - getNextId(id:string|number, step:number):string|number; - getPrevId(id:string|number, step:number):string|number; - getRange(from:string|number, to:string|number):any[]; - hasEvent(name:string):boolean; - id(item:any):string|number; - importData(source:webix.ui.baseview):void; - mapEvent(map:any):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - provideApi(target:any, eventable:boolean):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeMark(id:string, name:string, css:boolean):void; - scheme(config:any):void; - serialize():any; - setDriver(type:string):void; - silent(code:WebixCallback):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unblockEvent():void; - unsync():void; - updateItem(id:string|number, data:any):void; - driver: any; - name: string; - order: any[]; - pull: any; - sorting: any; -} -var DataStore:DataStore; -interface DataValue{ - attachEvent(type:string, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - detachEvent(id:string):void; - getValue():string; - hasEvent(name:string):boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - setValue(value:string):void; - unbind():void; - unblockEvent():void; - name: string; -} -var DataValue:DataValue; -interface Date{ - add(date:any, inc:number, mode:string):any; - copy(date:any):any; - datePart(date:any):any; - dateToStr(format:string, utc:boolean):WebixCallback; - dayStart(date:any):any; - equal(datea:any, dateb:any):boolean; - getISOWeek(date:any):number; - getUTCISOWeek(data:any):number; - isHoliday(date:any):boolean; - monthStart(date:any):any; - strToDate(format:string, utc:boolean):WebixCallback; - timePart(date:any):number; - toFixed(num:number):number; - weekStart(date:any):any; - yearStart(date:any):any; - startOnMonday: boolean; -} -var Date:Date; -interface Destruction{ - destructor():void; -} -var Destruction:Destruction; -interface DragControl{ - addDrag(node:string|number|HTMLElement, ctrl:any):void; - addDrop(node:string|number|HTMLElement, ctrl:any, master_mode:boolean):void; - createDrag(event:Event):void; - destroyDrag():void; - getContext():any; - getMaster(target:any):any; - getNode():HTMLElement; - sendSignal(signal:string):void; - $drag(source:HTMLElement, ev:Event):HTMLElement; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dragOut(s:any, t:any, n:any, e:Event):void; - $dragPos: WebixCallback; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - left: number; - top: number; -} -var DragControl:DragControl; -interface DragItem{ - $drag(source:HTMLElement, ev:Event):string; - $dragHTML: WebixCallback; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragMark(context:any, ev:Event):boolean; - $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dropAllow: WebixCallback; -} -var DragItem:DragItem; -interface DragOrder{ - $drag(source:HTMLElement, ev:Event):string; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragPos: WebixCallback; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; -} -var DragOrder:DragOrder; -interface EditAbility{ - edit(id:any):void; - editCancel():void; - editNext():boolean; - editStop():void; - focusEditor():void; - getEditState():any; - getEditor(id?:string):any; - getEditorValue():string; - validateEditor(id?:string|number):boolean; -} -var EditAbility:EditAbility; -interface EventSystem{ - attachEvent(type:string, functor:WebixCallback, id?:string):string|number; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - detachEvent(id:string):void; - hasEvent(name:string):boolean; - mapEvent(map:any):void; - unblockEvent():void; -} -var EventSystem:EventSystem; -interface FlexLayout{ - $getSize: any[]; -} -var FlexLayout:FlexLayout; -interface Group{ - group(config:any, mode:boolean):void; - ungroup(mode:boolean):void; -} -var Group:Group; -interface GroupMethods{ - any(property:string, data:any):void; - count(property:string, data:any):void; - max(property:string, data:any):void; - min(property:string, data:any):void; - string(property:string, data:any):void; - sum(property:string, data:any):void; -} -var GroupMethods:GroupMethods; -interface GroupStore{ - group(stats:any):void; - ungroup():void; -} -var GroupStore:GroupStore; -interface HTMLOptions{ -} -var HTMLOptions:HTMLOptions; -interface HtmlMap{ - addPoly(id:string|number, points:any[]):void; - addRect(id:string|number, points:any[], userdata?:string):void; - addSector(id:string|number, aplha0:number, aplha1:number, x:number, y:number, R:number, ky:number):void; - render(html:HTMLElement):void; -} -var HtmlMap:HtmlMap; -interface IdSpace{ - innerId(id:number|string):number|string; - ui(view:any):webix.ui.baseview; - $$: any; -} -var IdSpace:IdSpace; -interface KeysNavigation{ - moveSelection(direction:string):void; -} -var KeysNavigation:KeysNavigation; -interface MapCollection{ -} -var MapCollection:MapCollection; -interface Modality{ -} -var Modality:Modality; -interface MouseEvents{ - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; -} -var MouseEvents:MouseEvents; -interface Movable{ -} -var Movable:Movable; -interface NavigationButtons{ -} -var NavigationButtons:NavigationButtons; -interface Number{ - format(value:number, config:any):string; - numToStr(config:any):WebixCallback; -} -var Number:Number; -interface OverlayBox{ - hideOverlay():void; - showOverlay():void; -} -var OverlayBox:OverlayBox; -interface PagingAbility{ - getPage():number; - getPager():any; - setPage(page:number):void; -} -var PagingAbility:PagingAbility; -interface PowerArray{ - each(functor:WebixCallback, master:any):void; - filter(functor:WebixCallback, master:any):any[]; - find(data:any):number; - insertAt(data:any, pos:number):void; - map(functor:WebixCallback, master:any):any[]; - remove(value:any):void; - removeAt(pos:number, len:number):void; -} -var PowerArray:PowerArray; -interface ProgressBar{ - hideProgress():void; - showProgress(config?:any):void; -} -var ProgressBar:ProgressBar; -interface RecordBind{ -} -var RecordBind:RecordBind; -interface RenderStack{ - customize(obj:any):void; - getItemNode(id:string|number):HTMLElement; - locate(e:Event):string|number; - render(id:string|number, data:any, type:string):void; - showItem(id:string|number):void; - type: { [key: string]: any; }; - types: { [key: string]: any; }; -} -var RenderStack:RenderStack; -interface Scrollable{ - getScrollState():any; - scrollTo(x:number, y:number):void; -} -var Scrollable:Scrollable; -interface SelectionModel{ - getSelectedId(as_array:boolean):string|any[]; - getSelectedItem(as_array:boolean):any; - isSelected(id:string|number):boolean; - select(id:string|any[], preserve:boolean):void; - selectAll(from?:string, to?:string):void; - unselect(id?:string):void; - unselectAll():void; -} -var SelectionModel:SelectionModel; -interface Settings{ - define(property:string, value:any):void; - config: { [key: string]: any; }; - name: string; -} -var Settings:Settings; -interface SingleRender{ - customize(obj:any):void; - render(id:string|number, data:any, type:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - type: { [key: string]: any; }; -} -var SingleRender:SingleRender; -interface Sparklines{ - template(item:any, common:string, data:any[], column:any, index:number):string; - paddingX: number; - paddingY: number; - radius: number; -} -var Sparklines:Sparklines; -interface TablePaste{ -} -var TablePaste:TablePaste; -interface Touch{ - disable():void; - enable():void; - limit(mode:boolean):void; - scrollTo(node:HTMLElement, x:number, y:number, speed:string):void; - config: any; -} -var Touch:Touch; -interface TreeAPI{ - close(id:string|number):void; - closeAll():void; - getOpenItems():any[]; - getState():any; - isBranchOpen(id:string|number):boolean; - open(id:string|number, show?:boolean):void; - openAll():void; - setState(state:any):void; -} -var TreeAPI:TreeAPI; -interface TreeClick{ - webix_tree_checkbox(obj:any, common:{ [key: string]: any; }):string; - webix_tree_close(obj:any, common:{ [key: string]: any; }):string; - webix_tree_open(obj:any, common:{ [key: string]: any; }):string; -} -var TreeClick:TreeClick; -interface TreeCollection{ - add(obj:any, index?:number, parentId?:string):string; - addBind(source:any, rule:string, format:string):void; - attachEvent(type:string, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearValidation():void; - copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - count():number; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getBindData(key:string|number, update:boolean):void; - getBranchIndex(id:string|number, parent?:string|number):number; - getCursor():number; - getFirstChildId(id:string|number):string; - getFirstId():string|number; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNextSiblingId(id:string|number):string|number; - getParentId(id:string|number):string|number; - getPrevId(id:string|number, step:number):string|number; - getPrevSiblingId(id:string|number):string|number; - hasEvent(name:string):boolean; - isBranch(id:string|number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadBranch(id:string|number, callback:WebixCallback, url:string):void; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - mapEvent(map:any):void; - move(sid:string|number, tindex:number, tobj?:webix.ui.baseview, details?:any):string|number; - moveBottom(id:string|number):void; - moveTop(id:string|number):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - refreshCursor():void; - remove(id:string|number):void; - removeBind(source:any):void; - saveBatch(handler:WebixCallback):void; - serialize():any; - setBindData(data:any, key:string|number):void; - setCursor(cursor:string|number):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - config: { [key: string]: any; }; - name: string; - data:DataStore; - waitData: webix.promise; -} -var TreeCollection:TreeCollection; -interface TreeDataLoader{ - loadBranch(id:string|number, callback:WebixCallback, url:string):void; -} -var TreeDataLoader:TreeDataLoader; -interface TreeDataMove{ - copy(sid:string|number, tindex:number, tobj?:webix.ui.baseview, details?:any):string|number; - move(sid:string|number, tindex:number, tobj?:webix.ui.baseview, details?:any):string|number; - $dropAllow: WebixCallback; -} -var TreeDataMove:TreeDataMove; -interface TreeRenderStack{ - getItemNode(id:string|number):HTMLElement; - render(id:string|number, data:any, type:string):void; -} -var TreeRenderStack:TreeRenderStack; -interface TreeStateCheckbox{ - checkAll(id?:string|number):void; - checkItem(id:string):void; - getChecked():any[]; - isChecked(id:string|number):boolean; - uncheckAll(id?:string|number):void; - uncheckItem(id:string):void; -} -var TreeStateCheckbox:TreeStateCheckbox; -interface TreeStore{ - add(obj:any, index?:number, parentId?:string):string; - changeId(old:string|number, newid:string|number):void; - clearAll():void; - count():number; - each(code:WebixCallback, master:any, all:boolean, pid:string):void; - eachChild(pid:string, code:WebixCallback, master?:any, all?:boolean):void; - eachLeaf(pid:string, code:WebixCallback):void; - eachOpen(code:WebixCallback, master?:any, pid?:string):void; - eachSubItem(pid:string, code:WebixCallback):void; - getBranch(id:string):any[]; - getBranchIndex(id:string|number, parent?:string|number):number; - getFirstChildId(id:string|number):string; - getNextSiblingId(id:string|number):string|number; - getParentId(id:string|number):string|number; - getPrevSiblingId(id:string|number):string|number; - getTopRange():any[]; - isBranch(id:string|number):boolean; - provideApi(target:any, eventable:boolean):void; - remove(id:string|number):void; - serialize():any; - name: string; -} -var TreeStore:TreeStore; -interface TreeTableClick{ -} -var TreeTableClick:TreeTableClick; -interface TreeTablePaste{ - insert(data:any[]):void; -} -var TreeTablePaste:TreeTablePaste; -interface TreeType{ - checkbox(obj:any, common:any):string; - folder(obj:any, common:any):string; - icon(obj:any, common:any):string; - space(obj:any, common:any):string; -} -var TreeType:TreeType; -interface UIExtension{ -} -var UIExtension:UIExtension; -interface UIManager{ - addHotKey(key:string, handler:WebixCallback, obj?:any):void; - applyChanges():void; - canFocus(id:string|number):boolean; - destructor():void; - getFocus():webix.ui.baseview; - getNext(view:any):any; - getPrev(view:any):any; - getState(id:string, childs:boolean):any; - getTop(id:string|number):any; - hasFocus(id:string|number):boolean; - removeHotKey(key:string, handler?:WebixCallback, obj?:any):void; - setFocus(id:string|number):void; - setState(state:any):void; -} -var UIManager:UIManager; -interface Undo{ - ignoreUndo(functor:WebixCallback):void; - removeUndo(id:string):void; - undo(id:string):void; -} -var Undo:Undo; -interface UploadDriver{ - flash: any; - html5: any; -} -var UploadDriver:UploadDriver; -interface ValidateCollection{ - clearValidation():void; - validate(id?:string):boolean; -} -var ValidateCollection:ValidateCollection; -interface ValidateData{ - clearValidation():void; - validate(mode?:any):boolean; -} -var ValidateData:ValidateData; -interface ValueBind{ -} -var ValueBind:ValueBind; -interface Values{ - clear():void; - focus(item:string):void; - getCleanValues():any; - getDirtyValues():any; - getValues(details?:any):{ [key: string]: any; }; - isDirty():boolean; - markInvalid(name:string, state?:boolean|string):void; - setDirty(mark?:boolean):void; - setValues(values:any, update?:boolean):void; -} -var Values:Values; -interface VirtualRenderStack{ - getItemNode(id:string|number):HTMLElement; - render(id:string|number, data:any, type:string):void; - showItem(id:string|number):void; -} -var VirtualRenderStack:VirtualRenderStack; - - -interface DataCollectionFactory { - new (): DataCollection; -} -var DataCollection: DataCollectionFactory; - - -namespace ui { - -interface WebixFilter { - getValue(node:HTMLElement):any; - setValue(node:HTMLElement, value:any):any; - refresh(master: webix.ui.baseview, node:HTMLElement, value: any):void; - render(master: webix.ui.baseview, config: {[name:string]:any}):string; -} - -namespace datafilter{ - class textFilter implements WebixFilter{ - getValue(node:HTMLElement):any; - setValue(node:HTMLElement, value:any):any; - refresh(master: webix.ui.baseview, node:HTMLElement, value: any):void; - render(master: webix.ui.baseview, config: {[name:string]:any}):string; - getInputNode(node:HTMLElement):HTMLElement; - } - - class selectFilter extends textFilter{} - class serverFilter extends textFilter{} - class serverSelectFilter extends textFilter{} - class numberFilter extends textFilter{} - class dateFilter extends textFilter{} - class multiSelectFilter extends textFilter{} - class serverMultiSelectFilter extends textFilter{} - class multiComboFilter extends textFilter{} - class datepickerFilter extends textFilter{} - class dateRangeFilter extends textFilter{} - - class summColumn extends textFilter{} - class masterCheckbox extends textFilter{} - class columnGroup extends textFilter{} -} - -function delay(config:any):void; -function fullScreen():void; -function hasMethod(name:string, method_name:string):boolean; -function resize():void; -function zIndex():number; -var scrollSize: number; -var zIndexBase: number; - -interface baselayoutConfig{ - view?: string; - animate?: any; - borderless?: boolean; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - responsive?: string; - rows?: any[]; - visibleBatch?: string; - width?: number; -} -type baselayoutEventName ='onBindRequest'|'onDestruct'; -class baselayout implements webix.ui.baseview{ - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:baselayoutEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - reconstruct():void; - removeView(id:string|number):void; - resize():void; - resizeChildren():void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: baselayoutConfig; - name: string; -} -interface baseviewConfig{ - view?: string; - animate?: any; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - width?: number; -} -type baseviewEventName ='onBindRequest'|'onDestruct'; -interface baseview{ - adjust():void; - bind(target:any, rule?:WebixCallback, format?:string):void; - define(property:string, value:any):void; - destructor():void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hide():void; - isEnabled():boolean; - isVisible():boolean; - resize():void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: baseviewConfig; - name: string; -} -interface protoConfig{ - view?: string; - animate?: any; - borderless?: boolean; - click?: string|WebixCallback; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - pager?: any; - ready?: WebixCallback; - removeMissed?: boolean; - rules?: any; - save?: string; - scheme?: any; - template?: string|WebixCallback; - tooltip?: string|boolean; - type?: any; - url?: string; - width?: number; -} -type protoEventName ='onAfterAdd'|'onAfterDelete'|'onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onAfterSort'|'onBeforeAdd'|'onBeforeDelete'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onFocus'|'onItemRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; -class proto implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addCss(id:string|number, css:string, silent?:boolean):void; - adjust():void; - attachEvent(type:protoEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearValidation():void; - count():number; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getChildViews():any[]; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getPage():number; - getPager():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getTopParentView():webix.ui.baseview; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - render(id:string|number, data:any, type:string):void; - resize():void; - serialize():any; - setPage(page:number):void; - show(force?:boolean, animation?:boolean):void; - showItem(id:string|number):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: protoConfig; - name: string; - type: { [key: string]: any; }; - types: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface resizeareaConfig{ - view?: string; - border?: boolean; - container?: string|HTMLElement; - cursor?: string; - dir?: string; - eventPos?: number; - height?: number; - id?: string|number; - on?: EventHash; - start?: number; - width?: number; -} -type resizeareaEventName ='onResize'|'onResizeEnd'; -class resizearea{ - attachEvent(type:resizeareaEventName, functor:WebixCallback, id?:string):string|number; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - detachEvent(id:string):void; - hasEvent(name:string):boolean; - mapEvent(map:any):void; - unblockEvent():void; - - config: resizeareaConfig; - name: string; -} -interface viewConfig{ - view?: string; - animate?: any; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - width?: number; -} -type viewEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class view implements webix.ui.baseview{ - adjust():void; - bind(target:any, rule?:WebixCallback, format?:string):void; - define(property:string, value:any):void; - destructor():void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hide():void; - isEnabled():boolean; - isVisible():boolean; - resize():void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: viewConfig; - name: string; -} -interface vscrollConfig{ - view?: string; - container?: string|HTMLElement; - id?: string|number; - on?: EventHash; - scroll?: string; - scrollHeight?: number; - scrollPos?: number; - scrollSize?: number; - scrollStep?: number; - scrollVisible?: boolean; - scrollWidth?: number; - zoom?: number; -} -type vscrollEventName ='onScroll'; -class vscroll{ - activeArea(node:HTMLElement):void; - attachEvent(type:vscrollEventName, functor:WebixCallback, id?:string):string|number; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - detachEvent(id:string):void; - getScroll():number; - getSize():number; - hasEvent(name:string):boolean; - mapEvent(map:any):void; - scrollTo(pos:number):void; - sizeTo(size:number):void; - unblockEvent():void; - - config: vscrollConfig; - name: string; -} -interface accordionConfig{ - view?: string; - animate?: any; - borderless?: boolean; - collapsed?: boolean; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - isolate?: boolean; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - multi?: boolean|string; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - panelClass?: string; - responsive?: string; - rows?: any[]; - type?: string; - visibleBatch?: string; - width?: number; -} -type accordionEventName ='onAfterCollapse'|'onAfterExpand'|'onBindRequest'|'onDestruct'; -class accordion implements webix.ui.baseview{ - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:accordionEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - reconstruct():void; - removeView(id:string|number):void; - resize():void; - resizeChildren():void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: accordionConfig; - name: string; -} -interface accordionitemConfig{ - view?: string; - animate?: any; - body?: any; - borderless?: boolean; - collapsed?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - header?: boolean|string|WebixCallback; - headerAlt?: string|WebixCallback; - headerAltHeight?: number; - headerHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - width?: number; -} -type accordionitemEventName ='onAfterContextMenu'|'onAfterScroll'|'onBeforeContextMenu'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onItemClick'|'onItemDblClick'|'onKeyPress'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class accordionitem implements webix.ui.baseview{ - adjust():void; - attachEvent(type:accordionitemEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - collapse():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - expand():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - resize():void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: accordionitemConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; -} -interface barcodeConfig{ - view?: string; - animate?: any; - ariaLabel?: string; - borderless?: boolean; - color?: string; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - paddingX?: number; - paddingY?: number; - textHeight?: number; - type?: string; - value?: string; - width?: number; -} -type barcodeEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class barcode implements webix.ui.baseview{ - adjust():void; - bind(target:any, rule?:WebixCallback, format?:string):void; - define(property:string, value:any):void; - destructor():void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hide():void; - isEnabled():boolean; - isVisible():boolean; - render():void; - resize():void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: barcodeConfig; - name: string; - types: any[]; -} -interface bulletConfig{ - view?: string; - animate?: any; - bands?: any[]; - barWidth?: number; - borderless?: boolean; - color?: string; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - flowTime?: number; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - label?: string; - labelHeight?: number; - labelWidth?: number; - layout?: string; - marker?: number|boolean; - maxHeight?: number; - maxRange?: number; - maxWidth?: number; - minHeight?: number; - minRange?: number; - minWidth?: number; - on?: EventHash; - placeholder?: string; - scale?: any; - smoothFlow?: boolean; - stroke?: number; - value?: number; - width?: number; -} -type bulletEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class bullet implements webix.ui.baseview{ - adjust():void; - attachEvent(type:bulletEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():number; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - resize():void; - setValue(new_value:number):void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: bulletConfig; - name: string; -} -interface buttonConfig{ - view?: string; - align?: string; - animate?: any; - autowidth?: boolean; - badge?: number|string; - borderless?: boolean; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - image?: string; - inputHeight?: number; - inputWidth?: number; - label?: string; - labelPosition?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - placeholder?: string; - popup?: string; - tooltip?: string; - type?: string; - value?: string|number; - width?: number; -} -type buttonEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class button implements webix.ui.baseview{ - adjust():void; - attachEvent(type:buttonEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $renderInput(config:any):HTMLElement; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: buttonConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface calendarConfig{ - view?: string; - animate?: any; - blockDates?: WebixCallback; - borderless?: boolean; - calendarHeader?: string; - calendarTime?: string; - calendarWeekHeader?: string; - cellHeight?: number|string; - container?: string|HTMLElement; - css?: string; - date?: Date|string; - dayTemplate?: WebixCallback; - disabled?: boolean; - events?: WebixCallback; - gravity?: number; - headerHeight?: number; - height?: number; - hidden?: boolean; - icons?: any; - id?: string|number; - maxDate?: Date|string; - maxHeight?: number; - maxTime?: string; - maxWidth?: number; - minDate?: Date|string; - minHeight?: number; - minTime?: string; - minWidth?: number; - minuteStep?: number; - monthSelect?: boolean; - mouseEventDelay?: number; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - select?: boolean; - skipEmptyWeeks?: boolean; - timepicker?: boolean; - timepickerHeight?: number; - type?: string; - weekHeader?: boolean; - weekNumber?: boolean; - width?: number; -} -type calendarEventName ='onAfterContextMenu'|'onAfterDateSelect'|'onAfterMonthChange'|'onAfterRender'|'onAfterScroll'|'onAfterZoom'|'onBeforeContextMenu'|'onBeforeDateSelect'|'onBeforeMonthChange'|'onBeforeRender'|'onBeforeZoom'|'onBindRequest'|'onBlur'|'onChange'|'onDateClear'|'onDateSelect'|'onDestruct'|'onFocus'|'onItemClick'|'onItemDblClick'|'onKeyPress'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTodaySet'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class calendar implements webix.ui.baseview{ - adjust():void; - attachEvent(type:calendarEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getSelectedDate():any; - getTopParentView():webix.ui.baseview; - getValue():any; - getVisibleDate():any; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - locate(e:Event):string|number; - mapEvent(map:any):void; - moveSelection(direction:string):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - selectDate(date:string|Date, mode:boolean):void; - setValue(date:string|Date):void; - show(force?:boolean, animation?:boolean):void; - showCalendar(date:string|Date):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: calendarConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; -} -interface carouselConfig{ - view?: string; - animate?: any; - borderless?: boolean; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - navigation?: any; - on?: EventHash; - rows?: any[]; - scrollSpeed?: string; - type?: string; - width?: number; -} -type carouselEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class carousel implements webix.ui.baseview{ - adjust():void; - adjustScroll():void; - attachEvent(type:carouselEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getActiveId():string; - getActiveIndex():number; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getLayout():any; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - resize():void; - scrollTo(x:number, y:number):void; - setActive(id:string):void; - setActiveIndex(index:number):void; - show(force?:boolean, animation?:boolean):void; - showNext():void; - showPrev():void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: carouselConfig; - name: string; -} -interface chartConfig{ - view?: string; - alpha?: number; - animate?: any; - animateDuration?: number; - ariaLabel?: string; - barWidth?: number; - border?: boolean; - borderColor?: string; - borderless?: boolean; - cant?: number; - cellWidth?: number; - color?: string|WebixCallback; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - datathrottle?: number; - datatype?: string; - disableLines?: boolean; - disabled?: boolean; - dynamic?: boolean; - eventRadius?: number; - fill?: string; - fixOverflow?: boolean; - gradient?: boolean|string|WebixCallback; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - label?: string|WebixCallback; - labelOffset?: number; - legend?: any; - line?: any; - lineColor?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - offset?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - origin?: number; - padding?: any; - pieHeight?: number; - pieInnerText?: string|WebixCallback; - preset?: string; - radius?: number; - ready?: WebixCallback; - removeMissed?: boolean; - save?: string; - scale?: string; - scheme?: any; - series?: any; - shadow?: boolean; - tooltip?: string|boolean; - type?: string; - url?: string; - value?: string|WebixTemplate; - width?: number; - x?: number; - xAxis?: any; - xValue?: string; - y?: number; - yAxis?: any; - yValue?: string; -} -type chartEventName ='onAfterAdd'|'onAfterContextMenu'|'onAfterDelete'|'onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onAfterSort'|'onBeforeAdd'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onFocus'|'onItemClick'|'onItemDblClick'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class chart implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addSeries(obj:any):void; - adjust():void; - attachEvent(type:chartEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCanvas():void; - count():number; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getChildViews():any[]; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getTopParentView():webix.ui.baseview; - group(config:any, mode:boolean):void; - hasEvent(name:string):boolean; - hide():void; - hideSeries(series:string):void; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeAllSeries():void; - render(id:string|number, data:any, type:string):void; - resize():void; - serialize():any; - show(force?:boolean, animation?:boolean):void; - showSeries(series:string):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - ungroup(mode:boolean):void; - updateItem(id:string|number, data:any):void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - colormap: { [key: string]: any; }; - config: chartConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - presets: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface checkboxConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - checkValue?: string; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - customCheckbox?: boolean; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelRight?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - popup?: string; - relatedAction?: string; - relatedView?: string; - required?: boolean; - suggest?: any; - tooltip?: string; - uncheckValue?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type checkboxEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class checkbox implements webix.ui.baseview{ - adjust():void; - attachEvent(type:checkboxEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - toggle():void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: checkboxConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface checksuggestConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - button?: boolean; - buttonText?: string; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - disabled?: boolean; - filter?: WebixCallback; - fitMaster?: boolean; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - input?: HTMLElement|string; - keyPressTimeout?: number; - left?: number; - master?: webix.ui.baseview; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - move?: boolean; - on?: EventHash; - padding?: any; - position?: string|WebixCallback; - relative?: string; - resize?: boolean; - separator?: string; - template?: string|WebixTemplate; - textValue?: string; - toFront?: boolean; - top?: number; - type?: string; - url?: string; - value?: string|number; - width?: number; - zIndex?: number; -} -type checksuggestEventName ='onAfterScroll'|'onBeforeShow'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onHide'|'onKeyPress'|'onLongTouch'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValueSuggest'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class checksuggest implements webix.ui.baseview{ - adjust():void; - attachEvent(type:checksuggestEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - close():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getBody():any; - getButton():webix.ui.baseview; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getHead():any; - getItemText(id:string|number):string; - getList():webix.ui.list; - getMasterValue():any; - getNode():any; - getParentView():any; - getSuggestion():string; - getTopParentView():webix.ui.baseview; - getValue():string|number; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - linkInput(input:HTMLElement):void; - mapEvent(map:any):void; - resize():void; - resizeChildren():void; - setMasterValue(value:any):void; - setPosition(x:number, y:number):void; - setValue(value:string|number):void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - unblockEvent():void; - - $enterKey: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: checksuggestConfig; - name: string; -} -interface colorboardConfig{ - view?: string; - animate?: any; - borderless?: boolean; - cols?: number; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxLightness?: number; - maxWidth?: number; - minHeight?: number; - minLightness?: number; - minWidth?: number; - navigation?: boolean; - on?: EventHash; - palette?: any[]; - rows?: number; - template?: WebixCallback; - value?: string; - width?: number; -} -type colorboardEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSelect'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class colorboard implements webix.ui.baseview{ - adjust():void; - attachEvent(type:colorboardEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - moveSelection(direction:string):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setValue(value:string):string; - show(force?:boolean, animation?:boolean):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: colorboardConfig; - name: string; -} -interface colorpickerConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - editable?: boolean; - format?: string; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - icons?: boolean; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - placeholder?: string; - popup?: string; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - stringResult?: boolean; - suggest?: any; - timeIcon?: string; - timepicker?: boolean; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type colorpickerEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class colorpicker implements webix.ui.baseview{ - adjust():void; - attachEvent(type:colorpickerEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getPopup():webix.ui.baseview; - getText():string; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: colorpickerConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface comboConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - editable?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - icon?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - options?: any; - placeholder?: string; - popup?: string; - popupWidth?: number; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - suggest?: any; - tooltip?: string; - type?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type comboEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class combo implements webix.ui.baseview{ - adjust():void; - attachEvent(type:comboEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getList():webix.ui.list; - getNode():any; - getParentView():any; - getPopup():webix.ui.baseview; - getText():string; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: comboConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface contextConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - left?: number; - master?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - move?: boolean; - on?: EventHash; - padding?: any; - position?: string|WebixCallback; - relative?: string; - resize?: boolean; - toFront?: boolean; - top?: number; - width?: number; - zIndex?: number; -} -type contextEventName ='onAfterScroll'|'onBeforeShow'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onHide'|'onKeyPress'|'onLongTouch'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class context implements webix.ui.baseview{ - adjust():void; - attachEvent(type:contextEventName, functor:WebixCallback, id?:string):string|number; - attachTo(view:any):void; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - close():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getBody():any; - getChildViews():any[]; - getContext():any; - getFormView():webix.ui.baseview; - getHead():any; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - resize():void; - resizeChildren():void; - setContext(context:any):void; - setPosition(x:number, y:number):void; - show(node?:HTMLElement, position?:any, point?:string):void; - unbind():void; - unblockEvent():void; - show(force:boolean,animation:boolean):void; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: contextConfig; - name: string; -} -interface contextmenuConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - autoheight?: boolean; - autowidth?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - click?: string|WebixCallback; - clipboard?: boolean|string; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - drag?: boolean|string; - dragscroll?: boolean|string; - externalData?: WebixCallback; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - layout?: string; - left?: number; - master?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - mouseEventDelay?: number; - move?: boolean; - multiselect?: boolean; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - openAction?: string; - padding?: any; - pager?: any; - position?: string|WebixCallback; - ready?: WebixCallback; - relative?: string; - removeMissed?: boolean; - resize?: boolean; - rules?: any; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollSpeed?: string; - select?: boolean|string; - subMenuPos?: string; - submenuConfig?: any; - template?: string|WebixCallback; - templateCopy?: WebixCallback; - toFront?: boolean; - tooltip?: string|boolean; - top?: number; - type?: any; - url?: string; - width?: number; - xCount?: number; - yCount?: number; - zIndex?: number; -} -type contextmenuEventName ='onAfterAdd'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|'onAfterDropOrder'|'onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onBeforeAdd'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDropOrder'|'onBeforeDropOut'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSelect'|'onBeforeShow'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onFocus'|'onHide'|'onItemClick'|'onItemDblClick'|'onItemRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMenuItemClick'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onPaste'|'onSelectChange'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class contextmenu implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addCss(id:string|number, css:string, silent?:boolean):void; - adjust():void; - attachEvent(type:contextmenuEventName, functor:WebixCallback, id?:string):string|number; - attachTo(view:any):void; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearValidation():void; - close():void; - copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - count():number; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - disableItem(id:string|number):void; - enable():void; - enableItem(id:string|number):void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getBody():any; - getChildViews():any[]; - getContext():any; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getHead():any; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getMenu(id:string|number):any; - getMenuItem(id:string|number):any; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getPage():number; - getPager():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getScrollState():any; - getSelectedId(as_array:boolean):string|any[]; - getSelectedItem(as_array:boolean):any; - getSubMenu(id:string|number):any; - getTopMenu():any; - getTopParentView():webix.ui.baseview; - getVisibleCount():number; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - hideItem(id:string|number):void; - isEnabled():boolean; - isSelected(id:string|number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveBottom(id:string|number):void; - moveDown(id:string|number, step:number):void; - moveSelection(direction:string):void; - moveTop(id:string|number):void; - moveUp(id:string|number, step:number):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - render(id:string|number, data:any, type:string):void; - resize():void; - resizeChildren():void; - scrollTo(x:number, y:number):void; - select(id:string|any[], preserve:boolean):void; - selectAll(from?:string, to?:string):void; - serialize():any; - setContext(context:any):void; - setPage(page:number):void; - setPosition(x:number, y:number):void; - show(node?:HTMLElement, position?:any, point?:string):void; - showItem(id:string|number):void; - sizeToContent():void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - unselect(id?:string):void; - unselectAll():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - show(force:boolean,animation:boolean):void; - $drag(source:HTMLElement, ev:Event):string; - $dragHTML: WebixCallback; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragMark(context:any, ev:Event):boolean; - $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dropAllow: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: contextmenuConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - type: { [key: string]: any; }; - types: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface counterConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - max?: number; - maxHeight?: number; - maxWidth?: number; - min?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - popup?: string; - relatedAction?: string; - relatedView?: string; - required?: boolean; - step?: number; - suggest?: any; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type counterEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class counter implements webix.ui.baseview{ - adjust():void; - attachEvent(type:counterEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():number; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - next(step?:number):void; - prev(step?:number):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:number):void; - shift(value?:number):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: counterConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface datasuggestConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - disabled?: boolean; - filter?: WebixCallback; - fitMaster?: boolean; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - input?: HTMLElement|string; - keyPressTimeout?: number; - left?: number; - master?: webix.ui.baseview; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - move?: boolean; - on?: EventHash; - padding?: any; - position?: string|WebixCallback; - relative?: string; - resize?: boolean; - template?: string|WebixTemplate; - textValue?: string; - toFront?: boolean; - top?: number; - type?: string; - url?: string; - width?: number; - zIndex?: number; -} -type datasuggestEventName ='onAfterScroll'|'onBeforeShow'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onHide'|'onKeyPress'|'onLongTouch'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValueSuggest'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class datasuggest implements webix.ui.baseview{ - adjust():void; - attachEvent(type:datasuggestEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - close():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getBody():any; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getHead():any; - getItemText(id:string|number):string; - getList():webix.ui.list; - getMasterValue():any; - getNode():any; - getParentView():any; - getSuggestion():string; - getTopParentView():webix.ui.baseview; - getValue():string|number; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - linkInput(input:HTMLElement):void; - mapEvent(map:any):void; - resize():void; - resizeChildren():void; - setMasterValue(value:any):void; - setPosition(x:number, y:number):void; - setValue(value:string|number):void; - show(node:HTMLElement, position?:any, point?:string):void; - unbind():void; - unblockEvent():void; - show(force:boolean,animation:boolean):void; - $enterKey: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: datasuggestConfig; - name: string; -} -interface datatableConfig{ - view?: string; - animate?: any; - areaselect?: boolean; - autoConfig?: boolean; - autoheight?: boolean; - autowidth?: boolean; - blockselect?: boolean|string; - borderless?: boolean; - checkboxRefresh?: boolean; - clipboard?: boolean|string; - columnWidth?: number; - columns?: any[]; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datafetch?: number; - datathrottle?: number; - datatype?: string; - delimiter?: any; - disabled?: boolean; - drag?: boolean|string; - dragColumn?: boolean|string; - dragscroll?: boolean|string; - editMath?: boolean; - editValue?: string; - editable?: boolean; - editaction?: string; - externalData?: WebixCallback; - filterMode?: any; - fixedRowHeight?: boolean; - footer?: boolean; - form?: string; - gravity?: number; - header?: boolean; - headerRowHeight?: number; - headermenu?: any; - height?: number; - hidden?: boolean; - hover?: string; - id?: string|number; - leftSplit?: number; - liveValidation?: boolean; - loadahead?: number; - map?: any; - math?: boolean; - maxHeight?: number; - maxWidth?: number; - minColumnHeight?: number; - minColumnWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - multiselect?: boolean; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - pager?: any; - prerender?: boolean; - ready?: WebixCallback; - removeMissed?: boolean; - resizeColumn?: any; - resizeRow?: boolean; - rightSplit?: number; - rowHeight?: number; - rowLineHeight?: number; - rules?: any; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollAlignY?: boolean; - scrollX?: boolean; - scrollY?: boolean; - select?: boolean|string; - spans?: any[]; - subRowHeight?: string; - subrow?: string; - subview?: webix.ui.baseview; - tooltip?: boolean; - topSplit?: number; - type?: any; - url?: string; - width?: number; - yCount?: number; -} -type datatableEventName ='onAfterAdd'|'onAfterAreaAdd'|'onAfterAreaRemove'|'onAfterBlockSelect'|'onAfterColumnDrop'|'onAfterColumnDropOrder'|'onAfterColumnHide'|'onAfterColumnShow'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|'onAfterDropOrder'|'onAfterEditStart'|'onAfterEditStop'|'onAfterFilter'|'onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onAfterUnSelect'|'onAreaDrag'|'onBeforeAdd'|'onBeforeAreaAdd'|'onBeforeAreaRemove'|'onBeforeBlockSelect'|'onBeforeColumnDrag'|'onBeforeColumnDrop'|'onBeforeColumnDropOrder'|'onBeforeColumnHide'|'onBeforeColumnShow'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDropOrder'|'onBeforeDropOut'|'onBeforeEditStart'|'onBeforeEditStop'|'onBeforeFilter'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBeforeUnSelect'|'onBindRequest'|'onBlur'|'onCheck'|'onCollectValues'|'onColumnResize'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onEditorChange'|'onFocus'|'onHeaderClick'|'onItemClick'|'onItemDblClick'|'onKeyPress'|'onLiveEdit'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onResize'|'onRowResize'|'onScrollX'|'onScrollY'|'onSelectChange'|'onStructureLoad'|'onStructureUpdate'|'onSubViewClose'|'onSubViewCreate'|'onSubViewOpen'|'onSubViewRender'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; -class datatable implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addCellCss(id:string, name:string, css:string):void; - addCss(id:string|number, css:string, silent?:boolean):void; - addRowCss(id:string, css:string):void; - addSelectArea(start:any, end:any, preserve:boolean, area_name?:string, css?:string, handle?:boolean):void; - addSpan(id:any, column:string, width:number, height:number, value?:string, css?:string):void; - adjust():void; - adjustColumn(id:string|number, header?:string):void; - adjustRowHeight(columnId:string, silent:boolean):void; - attachEvent(type:datatableEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearSelection():void; - clearValidation():void; - closeSub(id:string|number):void; - collectValues(id:string|number):any[]; - columnId(index:number):string|number; - copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - count():number; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - eachColumn(handler:WebixCallback, all?:boolean):void; - eachRow(handler:WebixCallback, all?:boolean):void; - edit(id:any):void; - editCancel():void; - editCell(row:string|number, col:string|number, preserve?:boolean, show?:boolean):void; - editColumn(id:string):void; - editNext():boolean; - editRow(id:string):void; - editStop():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - filterByAll():void; - find(criterion:WebixCallback, first?:boolean):any; - focusEditor():void; - freezeRow(id:number|string, state:boolean):void; - getAllSelectAreas():any; - getChildViews():any[]; - getColumnConfig(id:string):any; - getColumnIndex(id:string|number):number; - getCss(rowId:string|number, columnId:string|number):string; - getEditState():any; - getEditor(row?:any, column?:string|number):any; - getEditorValue():string; - getFilter(columnID:string|number):any; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getHeaderContent(id:string|number):{ [key: string]: any; }; - getHeaderNode(columnId:string, rowIndex?:number):HTMLElement; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getPage():number; - getPager():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getScrollState():any; - getSelectArea(area_name:string):any; - getSelectedId(asArray:boolean, asString:boolean):any; - getSelectedItem(as_array?:boolean):any; - getSpan():any[]; - getState():any; - getSubView(id:string|number):any; - getText(rowid:string|number, colid:string|number):string; - getTopParentView():webix.ui.baseview; - getVisibleCount():number; - group(config:any, mode:boolean):void; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - hideColumn(id:string|number):void; - hideOverlay():void; - isColumnVisible(id:string|number):boolean; - isEnabled():boolean; - isSelected(id:string|number):void; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(node:HTMLElement|Event):any; - mapCells(startrow:number, startcol:string, numrows:number, numcols:number, callback:WebixCallback):void; - mapEvent(map:any):void; - mapSelection(callback:WebixCallback):void; - markSorting(column_id:string, direction:string):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveBottom(id:string|number):void; - moveColumn(id:string, index:number):void; - moveDown(id:string|number, step:number):void; - moveSelection(direction:string):void; - moveTop(id:string|number):void; - moveUp(id:string|number, step:number):void; - openSub(id:string|number):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - refreshColumns(config?:any[], reset?:boolean):void; - refreshFilter(id:string|number):void; - refreshHeaderContent():void; - refreshSelectArea():void; - registerFilter(object:any, config:any, controller:any):void; - remove(id:string|number):void; - removeCellCss(id:string, name:string, css_name:string):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - removeRowCss(id:string, css_name:string):void; - removeSelectArea(area_name:string):void; - removeSpan(id:string|number, column:string):void; - render(id:string|number, data:any, operation:string):void; - resize():void; - resizeSubView(id:string|number):void; - scrollTo(x:number, y:number):void; - select(row_id:string|number, preserve:boolean):void; - selectAll():void; - selectRange(row_id:string|number, end_row_id:string|number, preserve?:boolean):void; - serialize():any; - setColumnWidth(id:string|number, width:number):void; - setPage(page:number):void; - setRowHeight(id:string|number, height:number):void; - setState(state:any):void; - show(force?:boolean, animation?:boolean):void; - showCell(row:string, column:string):void; - showColumn(id:string|number):void; - showColumnBatch(batch:string|number, preserve:boolean):void; - showItem(id:string|number):void; - showItemByIndex(index:number):void; - showOverlay(message:string):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - ungroup(mode:boolean):void; - unselect(row_id:string|number):void; - unselectAll():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - validateEditor(id?:string|number):boolean; - - $drag(source:HTMLElement, ev:Event):string; - $dragHTML: WebixCallback; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragMark(context:any, ev:Event):boolean; - $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dropAllow: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: datatableConfig; - headerContent: any; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - data:DataStore; - waitData: webix.promise; -} -interface dataviewConfig{ - view?: string; - animate?: any; - autoheight?: boolean; - borderless?: boolean; - click?: string|WebixCallback; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - datafetch?: number; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - drag?: boolean|string; - dragscroll?: boolean|string; - externalData?: WebixCallback; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - loadahead?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - multiselect?: boolean; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - pager?: any; - ready?: WebixCallback; - removeMissed?: boolean; - rules?: any; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollSpeed?: string; - select?: boolean|string; - template?: string|WebixCallback; - tooltip?: string|boolean; - type?: any; - url?: string; - width?: number; - xCount?: number; - yCount?: number; -} -type dataviewEventName ='onAfterAdd'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|'onAfterDropOrder'|'onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onBeforeAdd'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDropOrder'|'onBeforeDropOut'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onFocus'|'onItemClick'|'onItemDblClick'|'onItemRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onSelectChange'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; -class dataview implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addCss(id:string|number, css:string, silent?:boolean):void; - adjust():void; - attachEvent(type:dataviewEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearValidation():void; - copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - count():number; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getChildViews():any[]; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getPage():number; - getPager():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getScrollState():any; - getSelectedId(as_array:boolean):string|any[]; - getSelectedItem(as_array:boolean):any; - getTopParentView():webix.ui.baseview; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isSelected(id:string|number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveBottom(id:string|number):void; - moveDown(id:string|number, step:number):void; - moveSelection(direction:string):void; - moveTop(id:string|number):void; - moveUp(id:string|number, step:number):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - render(id:string|number, data:any, type:string):void; - resize():void; - scrollTo(x:number, y:number):void; - select(id:string|any[], preserve:boolean):void; - selectAll(from?:string, to?:string):void; - serialize():any; - setPage(page:number):void; - show(force?:boolean, animation?:boolean):void; - showItem(id:string|number):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - unselect(id?:string):void; - unselectAll():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - - $drag(source:HTMLElement, ev:Event):string; - $dragHTML: WebixCallback; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragMark(context:any, ev:Event):boolean; - $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dropAllow: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: dataviewConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - type: { [key: string]: any; }; - types: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface daterangeConfig{ - view?: string; - animate?: any; - borderless?: boolean; - button?: boolean; - calendarCount?: number; - calendarHeight?: number; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - icons?: boolean|object; - id?: string|number; - isolate?: boolean; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - responsive?: string; - rows?: any[]; - timepicker?: boolean; - type?: string; - value?: any; - visibleBatch?: string; - width?: number; -} -type daterangeEventName ='onAfterDateSelect'|'onBeforeDateSelect'|'onBindRequest'|'onAfterDateSelect'|'onDateClear'|'onDestruct'|'onTodaySet'; -class daterange implements webix.ui.baseview{ - addToRange():void; - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:daterangeEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():any; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - reconstruct():void; - refresh():void; - removeView(id:string|number):void; - resize():void; - resizeChildren():void; - setValue(range:any):void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: daterangeConfig; - name: string; -} -interface daterangepickerConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - editable?: boolean; - format?: string; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - icon?: string; - icons?: boolean; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - pattern?: any; - placeholder?: string; - popup?: string; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - stringResult?: boolean; - suggest?: any; - timeIcon?: string; - timepicker?: boolean; - tooltip?: string; - type?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type daterangepickerEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class daterangepicker implements webix.ui.baseview{ - adjust():void; - attachEvent(type:daterangepickerEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getPopup():webix.ui.baseview; - getText():string; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $cssName: string; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(config:any):HTMLElement; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: daterangepickerConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface daterangesuggestConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - disabled?: boolean; - filter?: WebixCallback; - fitMaster?: boolean; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - input?: HTMLElement|string; - keyPressTimeout?: number; - left?: number; - master?: webix.ui.baseview; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - move?: boolean; - on?: EventHash; - padding?: any; - position?: string|WebixCallback; - relative?: string; - resize?: boolean; - template?: string|WebixTemplate; - textValue?: string; - toFront?: boolean; - top?: number; - type?: string; - url?: string; - width?: number; - zIndex?: number; -} -type daterangesuggestEventName ='onAfterScroll'|'onBeforeShow'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onHide'|'onKeyPress'|'onLongTouch'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValueSuggest'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class daterangesuggest implements webix.ui.baseview{ - adjust():void; - attachEvent(type:daterangesuggestEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - close():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getBody():any; - getButton():webix.ui.baseview; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getHead():any; - getItemText(id:string|number):string; - getList():webix.ui.list; - getMasterValue():any; - getNode():any; - getParentView():any; - getRange():webix.ui.baseview; - getSuggestion():string; - getTopParentView():webix.ui.baseview; - getValue():string|number; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - linkInput(input:HTMLElement):void; - mapEvent(map:any):void; - resize():void; - resizeChildren():void; - setMasterValue(value:any):void; - setPosition(x:number, y:number):void; - setValue(value:string|number):void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - unblockEvent():void; - - $enterKey: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: daterangesuggestConfig; - name: string; -} -interface datepickerConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - editable?: boolean; - format?: string; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - icon?: string; - icons?: boolean; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - placeholder?: string; - popup?: string; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - stringResult?: boolean; - suggest?: any; - timeIcon?: string; - timepicker?: boolean; - tooltip?: string; - type?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: Date|string; - width?: number; -} -type datepickerEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class datepicker implements webix.ui.baseview{ - adjust():void; - attachEvent(type:datepickerEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getPopup():webix.ui.baseview; - getText():string; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: datepickerConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface dbllistConfig{ - view?: string; - animate?: any; - borderless?: boolean; - buttons?: string|boolean; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datatype?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - isolate?: boolean; - labelBottomLeft?: string; - labelBottomRight?: string; - labelLeft?: string; - labelRight?: string; - list?: any; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - responsive?: string; - rows?: any[]; - type?: string; - url?: string; - value?: string|any[]; - visibleBatch?: string; - width?: number; -} -type dbllistEventName ='onAfterLoad'|'onBeforeLoad'|'onBindRequest'|'onChange'|'onDestruct'|'onLoadError'; -class dbllist implements webix.ui.baseview{ - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:dbllistEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - innerId(id:number|string):number|string; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - mapEvent(map:any):void; - parse(data:any, type:string):void; - reconstruct():void; - removeView(id:string|number):void; - resize():void; - resizeChildren():void; - select(id:string|any[], mode:boolean):void; - setValue(ids:string|any[]):void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - ui(view:any):webix.ui.baseview; - unbind():void; - unblockEvent():void; - - $$: any; - $getSize():any[]; - $height: number; - $onLoad: WebixCallback; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: dbllistConfig; - name: string; -} -interface fieldsetConfig{ - view?: string; - $cssName?: string; - animate?: any; - body?: webix.ui.baseview; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - label?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - paddingX?: number; - paddingY?: number; - width?: number; -} -type fieldsetEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class fieldset implements webix.ui.baseview{ - adjust():void; - bind(target:any, rule?:WebixCallback, format?:string):void; - define(property:string, value:any):void; - destructor():void; - disable():void; - enable():void; - getBody():any; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hide():void; - isEnabled():boolean; - isVisible():boolean; - resize():void; - resizeChildren():void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: fieldsetConfig; - name: string; -} -interface filemanagerConfig{ - view?: string; - animate?: any; - borderless?: boolean; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - disabledHistory?: boolean; - filterMode?: any; - gravity?: number; - handlers?: any; - height?: number; - hidden?: boolean; - icons?: any; - id?: string|number; - isolate?: boolean; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mode?: string; - modes?: any[]; - noFileCache?: boolean; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - readonly?: boolean; - ready?: WebixCallback; - removeMissed?: boolean; - responsive?: string; - rows?: any[]; - save?: string; - scheme?: any; - structure?: any; - templateCreate?: WebixCallback; - templateDate?: WebixCallback; - templateIcon?: WebixCallback; - templateName?: WebixCallback; - templateSize?: WebixCallback; - templateType?: WebixCallback; - type?: string; - uploadProgress?: any; - url?: string; - visibleBatch?: string; - width?: number; -} -type filemanagerEventName ='onAfterAdd'|'onAfterBack'|'onAfterCreateFolder'|'onAfterDelete'|'onAfterDeleteFile'|'onAfterDrop'|'onAfterDynParse'|'onAfterEditFile'|'onAfterEditStop'|'onAfterFileUpload'|'onAfterHideTree'|'onAfterLevelDown'|'onAfterLevelUp'|'onAfterLoad'|'onAfterMarkCopy'|'onAfterMarkCut'|'onAfterMenu'|'onAfterModeChange'|'onAfterPasteFile'|'onAfterPathClick'|'onAfterRun'|'onAfterSearch'|'onAfterShowTree'|'onAfterSort'|'onAfterUploadDialog'|'onBeforeAdd'|'onBeforeBack'|'onBeforeCreateFolder'|'onBeforeDelete'|'onBeforeDeleteFile'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDynLoad'|'onBeforeDynParse'|'onBeforeEditFile'|'onBeforeEditStop'|'onBeforeFileUpload'|'onBeforeHideTree'|'onBeforeLevelDown'|'onBeforeLevelUp'|'onBeforeLoad'|'onBeforeMarkCopy'|'onBeforeMarkCut'|'onBeforeMenu'|'onBeforeModeChange'|'onBeforePasteFile'|'onBeforeRequest'|'onBeforeRun'|'onBeforeSearch'|'onBeforeSearchRequest'|'onBeforeShowTree'|'onBeforeSort'|'onBeforeUploadDialog'|'onBindRequest'|'onComponentInit'|'onCopyError'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDynLoadError'|'onErrorResponse'|'onFolderSelect'|'onHideSearchResults'|'onHistoryChange'|'onItemRename'|'onItemSelect'|'onLoadError'|'onMoveError'|'onPathComplete'|'onPathLevel'|'onShowSearchResults'|'onSuccessResponse'|'onViewInit'; -class filemanager implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:filemanagerEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - copy(sid:string|number, tindex:number, tobj?:webix.ui.baseview, details?:any):string|number; - copyFile(source:string|any[], target:string):void; - count():number; - createFolder(targetId:string):void; - define(property:string, value:any):void; - deleteFile(ids:string|any[]):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - download(id:string):void; - editFile(id:string):void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getActive():string; - getActiveView():any; - getBranchIndex(id:string|number, parent?:string|number):number; - getChildViews():any[]; - getCurrentFolder():string; - getFirstChildId(id:string|number):string; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getLastId():string|number; - getMenu():any; - getNextId(id:string|number, step:number):string|number; - getNextSiblingId(id:string|number):string|number; - getNode():any; - getParentId(id:string|number):string|number; - getParentView():any; - getPath(id:string):any[]; - getPathNames(id:string):any[]; - getPrevId(id:string|number, step:number):string|number; - getPrevSiblingId(id:string|number):string|number; - getSearchData(id:string, text:string):any[]; - getSelectedFile():string|any[]; - getTopParentView():webix.ui.baseview; - getUploader():any; - goBack(step:number):void; - goForward(step:number):void; - hasEvent(name:string):boolean; - hide():void; - hideProgress():void; - hideSearchResults():void; - hideTree():void; - index(obj:any):number; - innerId(id:number|string):number|string; - isBranch(id:string|number):boolean; - isEnabled():boolean; - isVisible():boolean; - levelUp(id:string):void; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadBranch(id:string|number, callback:WebixCallback, url:string):void; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - mapEvent(map:any):void; - markCopy(id:string|any[]):void; - markCut(id:string|any[]):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveFile(source:string, target:string):void; - openFolders(folders:any[]):void; - parse(data:any, type:string):void; - pasteFile(id:string):void; - reconstruct():void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeView(id:string|number):void; - renameFile(id:string, name:string, property:string):void; - resize():void; - resizeChildren():void; - serialize():any; - setPath(id:string):void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - showProgress(config?:any):void; - showSearchResults(text:string):void; - showTree():void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - ui(view:any):webix.ui.baseview; - unbind():void; - unblockEvent():void; - updateItem(id:string|number, data:any):void; - uploadFile(target:string):void; - - $$: any; - $dropAllow: WebixCallback; - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: filemanagerConfig; - name: string; - data:DataStore; - waitData: webix.promise; -} -interface formConfig{ - view?: string; - animate?: any; - autoheight?: boolean; - borderless?: boolean; - cols?: any[]; - complexData?: boolean; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datatype?: string; - disabled?: boolean; - elements?: any[]; - elementsConfig?: { [key: string]: any; }; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - isolate?: boolean; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - responsive?: string; - rows?: any[]; - rules?: any; - scroll?: boolean|string; - scrollSpeed?: string; - type?: string; - url?: string; - visibleBatch?: string; - width?: number; -} -type formEventName ='onAfterLoad'|'onAfterScroll'|'onAfterValidation'|'onBeforeLoad'|'onBeforeValidate'|'onBindRequest'|'onChange'|'onDestruct'|'onLoadError'|'onSubmit'|'onValidationError'|'onValidationSuccess'|'onValues'; -class form implements webix.ui.baseview{ - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:formEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clear():void; - clearValidation():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus(item:string):void; - getChildViews():any[]; - getCleanValues():any; - getDirtyValues():any; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getScrollState():any; - getTopParentView():webix.ui.baseview; - getValues(details?:any):{ [key: string]: any; }; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - isDirty():boolean; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - mapEvent(map:any):void; - markInvalid(name:string, state?:boolean|string):void; - parse(data:any, type:string):void; - reconstruct():void; - refresh():void; - removeView(id:string|number):void; - render(id:string|number, data:any, type:string):void; - resize():void; - resizeChildren():void; - scrollTo(x:number, y:number):void; - setDirty(mark?:boolean):void; - setValues(values:any, update?:boolean):void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - unbind():void; - unblockEvent():void; - validate(mode?:any):boolean; - - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: formConfig; - name: string; -} -interface forminputConfig{ - view?: string; - $cssName?: string; - animate?: any; - body?: webix.ui.baseview; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - label?: string; - labelAlign?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - value?: any; - width?: number; -} -type forminputEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class forminput implements webix.ui.baseview{ - adjust():void; - bind(target:any, rule?:WebixCallback, format?:string):void; - define(property:string, value:any):void; - destructor():void; - disable():void; - enable():void; - focus():void; - getBody():any; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hide():void; - isEnabled():boolean; - isVisible():boolean; - resize():void; - resizeChildren():void; - setValue(value:any):void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: forminputConfig; - name: string; -} -interface gageConfig{ - view?: string; - animate?: any; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - label?: string; - maxHeight?: number; - maxRange?: number; - maxWidth?: number; - minHeight?: number; - minRange?: number; - minWidth?: number; - on?: EventHash; - placeholder?: string; - scale?: number; - smoothFlow?: boolean; - stroke?: number; - value?: number; - width?: number; -} -type gageEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class gage implements webix.ui.baseview{ - adjust():void; - attachEvent(type:gageEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():number; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - resize():void; - setValue(new_value:number):void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: gageConfig; - name: string; -} -interface googleMapConfig{ - view?: string; - animate?: any; - borderless?: boolean; - center?: any[]; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - gravity?: number; - heatmapConfig?: any; - height?: number; - hidden?: boolean; - id?: string|number; - layerType?: string; - mapType?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - ready?: WebixCallback; - removeMissed?: boolean; - save?: string; - scheme?: any; - url?: string; - width?: number; - zoom?: number; -} -type googleMapEventName ='onAfterAdd'|'onAfterDelete'|'onAfterLoad'|'onAfterScroll'|'onAfterSort'|'onBeforeAdd'|'onBeforeDelete'|'onBeforeLoad'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onFocus'|'onHeatMapRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class googleMap implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - adjust():void; - attachEvent(type:googleMapEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - count():number; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getChildViews():any[]; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getLastId():string|number; - getMap():any; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - mapEvent(map:any):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - render():void; - resize():void; - serialize():any; - show(force?:boolean, animation?:boolean):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - updateItem(id:string|number, data:any):void; - - $getSize():any[]; - $height: number; - $onLoad: WebixCallback; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: googleMapConfig; - name: string; - data:DataStore; - waitData: webix.promise; -} -interface gridsuggestConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - disabled?: boolean; - filter?: WebixCallback; - fitMaster?: boolean; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - input?: HTMLElement|string; - keyPressTimeout?: number; - left?: number; - master?: webix.ui.baseview; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - move?: boolean; - on?: EventHash; - padding?: any; - position?: string|WebixCallback; - relative?: string; - resize?: boolean; - template?: string|WebixTemplate; - textValue?: string; - toFront?: boolean; - top?: number; - type?: string; - url?: string; - width?: number; - zIndex?: number; -} -type gridsuggestEventName ='onAfterScroll'|'onBeforeShow'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onHide'|'onKeyPress'|'onLongTouch'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValueSuggest'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class gridsuggest implements webix.ui.baseview{ - adjust():void; - attachEvent(type:gridsuggestEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - close():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getBody():any; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getHead():any; - getItemText(id:string|number):string; - getList():webix.ui.list; - getMasterValue():any; - getNode():any; - getParentView():any; - getSuggestion():string; - getTopParentView():webix.ui.baseview; - getValue():string|number; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - linkInput(input:HTMLElement):void; - mapEvent(map:any):void; - resize():void; - resizeChildren():void; - setMasterValue(value:any):void; - setPosition(x:number, y:number):void; - setValue(value:string|number):void; - show(node:HTMLElement, position?:any, point?:string):void; - unbind():void; - unblockEvent():void; - show(force:boolean,animation:boolean):void; - $enterKey: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: gridsuggestConfig; - name: string; -} -interface grouplistConfig{ - view?: string; - animate?: any; - autoheight?: boolean; - autowidth?: boolean; - borderless?: boolean; - click?: string|WebixCallback; - clipboard?: boolean|string; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - drag?: boolean|string; - dragscroll?: boolean|string; - externalData?: WebixCallback; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - layout?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - multiselect?: boolean; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - pager?: any; - ready?: WebixCallback; - removeMissed?: boolean; - rules?: any; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollSpeed?: string; - select?: boolean|string; - template?: string|WebixCallback; - templateBack?: string|string|WebixTemplate; - templateCopy?: WebixCallback; - templateGroup?: string|WebixCallback; - templateItem?: string|WebixCallback; - tooltip?: string|boolean; - type?: any; - url?: string; - width?: number; - xCount?: number; - yCount?: number; -} -type grouplistEventName ='onAfterAdd'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|'onAfterDropOrder'|'onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onBeforeAdd'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDropOrder'|'onBeforeDropOut'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onFocus'|'onItemClick'|'onItemDblClick'|'onItemRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onPaste'|'onSelectChange'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; -class grouplist implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addCss(id:string|number, css:string, silent?:boolean):void; - adjust():void; - attachEvent(type:grouplistEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearValidation():void; - copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - count():number; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getChildViews():any[]; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getOpenState():any; - getPage():number; - getPager():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getScrollState():any; - getSelectedId(as_array:boolean):string|any[]; - getSelectedItem(as_array:boolean):any; - getTopParentView():webix.ui.baseview; - getVisibleCount():number; - group(config:any, mode:boolean):void; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isSelected(id:string|number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveBottom(id:string|number):void; - moveDown(id:string|number, step:number):void; - moveSelection(direction:string):void; - moveTop(id:string|number):void; - moveUp(id:string|number, step:number):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - render(id:string|number, data:any, type:string):void; - resize():void; - scrollTo(x:number, y:number):void; - select(id:string|any[], preserve:boolean):void; - selectAll(from?:string, to?:string):void; - serialize():any; - setPage(page:number):void; - show(force?:boolean, animation?:boolean):void; - showItem(id:string|number):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - ungroup(mode:boolean):void; - unselect(id?:string):void; - unselectAll():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - - $drag(source:HTMLElement, ev:Event):string; - $dragHTML: WebixCallback; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragMark(context:any, ev:Event):boolean; - $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dropAllow: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: grouplistConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - type: { [key: string]: any; }; - types: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface headerlayoutConfig{ - view?: string; - animate?: any; - borderless?: boolean; - collapsed?: boolean; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - isolate?: boolean; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - multi?: boolean|string; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - panelClass?: string; - responsive?: string; - rows?: any[]; - type?: string; - visibleBatch?: string; - width?: number; -} -type headerlayoutEventName ='onAfterCollapse'|'onAfterExpand'|'onBindRequest'|'onDestruct'; -class headerlayout implements webix.ui.baseview{ - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:headerlayoutEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - reconstruct():void; - removeView(id:string|number):void; - resize():void; - resizeChildren():void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: headerlayoutConfig; - name: string; -} -interface htmlformConfig{ - view?: string; - animate?: any; - autoheight?: boolean; - borderless?: boolean; - complexData?: boolean; - container?: string|HTMLElement; - content?: string|number|HTMLElement; - css?: string; - data?: string|any[]; - datatype?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - onClick?: { [key: string]: any; }; - scroll?: boolean|string; - scrollSpeed?: string; - src?: string; - template?: string|WebixCallback; - url?: string; - width?: number; -} -type htmlformEventName ='onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onBeforeLoad'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValues'|'onViewResize'; -class htmlform implements webix.ui.baseview{ - adjust():void; - attachEvent(type:htmlformEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - clear(all?:boolean):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus(item:string):void; - getChildViews():any[]; - getCleanValues():any; - getDirtyValues():any; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getScrollState():any; - getTopParentView():webix.ui.baseview; - getValues(details?:any):{ [key: string]: any; }; - hasEvent(name:string):boolean; - hide():void; - isDirty():boolean; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - mapEvent(map:any):void; - markInvalid(name:string, state?:boolean|string):void; - parse(data:any, type:string):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - scrollTo(x:number, y:number):void; - setContent(node:any):void; - setDirty(mark?:boolean):void; - setHTML(html:string):void; - setValues(values:any, update?:boolean):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: htmlformConfig; - name: string; -} -interface iconConfig{ - view?: string; - align?: string; - animate?: any; - autowidth?: boolean; - borderless?: boolean; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - icon?: string; - id?: string|number; - inputHeight?: number; - inputWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - popup?: string; - tooltip?: string; - value?: string|number; - width?: number; -} -type iconEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class icon implements webix.ui.baseview{ - adjust():void; - attachEvent(type:iconEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $renderInput(config:any):HTMLElement; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: iconConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface iframeConfig{ - view?: string; - animate?: any; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - src?: string; - width?: number; -} -type iframeEventName ='onAfterLoad'|'onAfterScroll'|'onBeforeLoad'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class iframe implements webix.ui.baseview{ - adjust():void; - attachEvent(type:iframeEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getIframe():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getWindow():HTMLElement; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - load(value:string):void; - mapEvent(map:any):void; - resize():void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: iframeConfig; - name: string; -} -interface kanbanConfig{ - view?: string; - animate?: any; - borderless?: boolean; - collapsed?: boolean; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - isolate?: boolean; - listFilter?: WebixCallback; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - multi?: boolean|string; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - panelClass?: string; - ready?: WebixCallback; - removeMissed?: boolean; - responsive?: string; - rows?: any[]; - save?: string; - scheme?: any; - type?: string; - url?: string; - visibleBatch?: string; - width?: number; -} -type kanbanEventName ='onAfterAdd'|'onAfterCollapse'|'onAfterDelete'|'onAfterExpand'|'onAfterLoad'|'onAfterSort'|'onAfterStatusChange'|'onAvatarClick'|'onBeforeAdd'|'onBeforeDelete'|'onBeforeLoad'|'onBeforeSort'|'onBeforeStatusChange'|'onBindRequest'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onListAfterContextMenu'|'onListAfterDrop'|'onListAfterSelect'|'onListBeforeContextMenu'|'onListBeforeDrag'|'onListBeforeDragIn'|'onListBeforeDrop'|'onListBeforeSelect'|'onListIconClick'|'onListItemClick'|'onListItemDblClick'|'onLoadError'; -class kanban implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:kanbanEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - count():number; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - eachList(func:WebixCallback):void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getChildViews():any[]; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getOwnerList(itemId:string|number):any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getSelectedId():string|number; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - mapEvent(map:any):void; - parse(data:any, type:string):void; - reconstruct():void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeView(id:string|number):void; - resize():void; - resizeChildren():void; - select(id:string|number):void; - serialize():any; - setIndex(id:string|number, index:number):void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - updateItem(id:string|number, data:any):void; - - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: kanbanConfig; - name: string; - data:DataStore; - waitData: webix.promise; -} -interface labelConfig{ - view?: string; - align?: string; - animate?: any; - autowidth?: boolean; - borderless?: boolean; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputHeight?: number; - inputWidth?: number; - label?: string; - labelPosition?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - popup?: string; - tooltip?: string; - value?: string|number; - width?: number; -} -type labelEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class label implements webix.ui.baseview{ - adjust():void; - attachEvent(type:labelEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setHTML(html:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $renderInput(config:any):HTMLElement; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: labelConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface layoutConfig{ - view?: string; - animate?: any; - borderless?: boolean; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - isolate?: boolean; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - responsive?: string; - rows?: any[]; - type?: string; - visibleBatch?: string; - width?: number; -} -type layoutEventName ='onBindRequest'|'onDestruct'; -class layout implements webix.ui.baseview{ - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:layoutEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - reconstruct():void; - removeView(id:string|number):void; - resize():void; - resizeChildren():void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: layoutConfig; - name: string; -} -interface listConfig{ - view?: string; - animate?: any; - autoheight?: boolean; - autowidth?: boolean; - borderless?: boolean; - click?: string|WebixCallback; - clipboard?: boolean|string; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - drag?: boolean|string; - dragscroll?: boolean|string; - externalData?: WebixCallback; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - layout?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - multiselect?: boolean; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - pager?: any; - ready?: WebixCallback; - removeMissed?: boolean; - rules?: any; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollSpeed?: string; - select?: boolean|string; - template?: string|WebixCallback; - templateCopy?: WebixCallback; - tooltip?: string|boolean; - type?: any; - url?: string; - width?: number; - xCount?: number; - yCount?: number; -} -type listEventName ='onAfterAdd'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|'onAfterDropOrder'|'onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onBeforeAdd'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDropOrder'|'onBeforeDropOut'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onFocus'|'onItemClick'|'onItemDblClick'|'onItemRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onPaste'|'onSelectChange'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; -class list implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addCss(id:string|number, css:string, silent?:boolean):void; - adjust():void; - attachEvent(type:listEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearValidation():void; - copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - count():number; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getChildViews():any[]; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getPage():number; - getPager():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getScrollState():any; - getSelectedId(as_array:boolean):string|any[]; - getSelectedItem(as_array:boolean):any; - getTopParentView():webix.ui.baseview; - getVisibleCount():number; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isSelected(id:string|number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveBottom(id:string|number):void; - moveDown(id:string|number, step:number):void; - moveSelection(direction:string):void; - moveTop(id:string|number):void; - moveUp(id:string|number, step:number):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - render(id:string|number, data:any, type:string):void; - resize():void; - scrollTo(x:number, y:number):void; - select(id:string|any[], preserve:boolean):void; - selectAll(from?:string, to?:string):void; - serialize():any; - setPage(page:number):void; - show(force?:boolean, animation?:boolean):void; - showItem(id:string|number):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - unselect(id?:string):void; - unselectAll():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - - $drag(source:HTMLElement, ev:Event):string; - $dragHTML: WebixCallback; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragMark(context:any, ev:Event):boolean; - $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dropAllow: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: listConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - type: { [key: string]: any; }; - types: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface menuConfig{ - view?: string; - animate?: any; - autoheight?: boolean; - autowidth?: boolean; - borderless?: boolean; - click?: string|WebixCallback; - clipboard?: boolean|string; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - drag?: boolean|string; - dragscroll?: boolean|string; - externalData?: WebixCallback; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - layout?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - multiselect?: boolean; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - openAction?: string; - pager?: any; - ready?: WebixCallback; - removeMissed?: boolean; - rules?: any; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollSpeed?: string; - select?: boolean|string; - subMenuPos?: string; - submenuConfig?: any; - template?: string|WebixCallback; - templateCopy?: WebixCallback; - tooltip?: string|boolean; - type?: any; - url?: string; - width?: number; - xCount?: number; - yCount?: number; -} -type menuEventName ='onAfterAdd'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|'onAfterDropOrder'|'onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onBeforeAdd'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDropOrder'|'onBeforeDropOut'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onFocus'|'onItemClick'|'onItemDblClick'|'onItemRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMenuItemClick'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onPaste'|'onSelectChange'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; -class menu implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addCss(id:string|number, css:string, silent?:boolean):void; - adjust():void; - attachEvent(type:menuEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearValidation():void; - copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - count():number; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - disableItem(id:string|number):void; - enable():void; - enableItem(id:string|number):void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getChildViews():any[]; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getMenu(id:string|number):any; - getMenuItem(id:string|number):any; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getPage():number; - getPager():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getScrollState():any; - getSelectedId(as_array:boolean):string|any[]; - getSelectedItem(as_array:boolean):any; - getSubMenu(id:string|number):any; - getTopMenu():any; - getTopParentView():webix.ui.baseview; - getVisibleCount():number; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - hideItem(id:string|number):void; - isEnabled():boolean; - isSelected(id:string|number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveBottom(id:string|number):void; - moveDown(id:string|number, step:number):void; - moveSelection(direction:string):void; - moveTop(id:string|number):void; - moveUp(id:string|number, step:number):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - render(id:string|number, data:any, type:string):void; - resize():void; - scrollTo(x:number, y:number):void; - select(id:string|any[], preserve:boolean):void; - selectAll(from?:string, to?:string):void; - serialize():any; - setPage(page:number):void; - show(force?:boolean, animation?:boolean):void; - showItem(id:string|number):void; - sizeToContent():void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - unselect(id?:string):void; - unselectAll():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - - $drag(source:HTMLElement, ev:Event):string; - $dragHTML: WebixCallback; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragMark(context:any, ev:Event):boolean; - $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dropAllow: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: menuConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - type: { [key: string]: any; }; - types: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface multicomboConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - button?: boolean; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - keepText?: boolean; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - newValues?: boolean; - on?: EventHash; - optionWidth?: number; - options?: any; - placeholder?: string; - popup?: string; - popupWidth?: number; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - separator?: string; - suggest?: any; - tagMode?: boolean; - tagTemplate?: WebixCallback; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type multicomboEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class multicombo implements webix.ui.baseview{ - adjust():void; - attachEvent(type:multicomboEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getList():webix.ui.list; - getNode():any; - getParentView():any; - getPopup():webix.ui.baseview; - getText():string; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $cssName: string; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: multicomboConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface multiselectConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - icon?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - optionWidth?: number; - options?: any; - placeholder?: string; - popup?: string; - popupWidth?: number; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - separator?: string; - suggest?: any; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type multiselectEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class multiselect implements webix.ui.baseview{ - adjust():void; - attachEvent(type:multiselectEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getList():webix.ui.list; - getNode():any; - getParentView():any; - getPopup():webix.ui.baseview; - getText():string; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $cssName: string; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: multiselectConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface multisuggestConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - button?: boolean; - buttonText?: string; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - disabled?: boolean; - filter?: WebixCallback; - fitMaster?: boolean; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - input?: HTMLElement|string; - keyPressTimeout?: number; - left?: number; - master?: webix.ui.baseview; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - move?: boolean; - on?: EventHash; - padding?: any; - position?: string|WebixCallback; - relative?: string; - resize?: boolean; - separator?: string; - template?: string|WebixTemplate; - textValue?: string; - toFront?: boolean; - top?: number; - type?: string; - url?: string; - value?: string|number; - width?: number; - zIndex?: number; -} -type multisuggestEventName ='onAfterScroll'|'onBeforeShow'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onHide'|'onKeyPress'|'onLongTouch'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValueSuggest'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class multisuggest implements webix.ui.baseview{ - adjust():void; - attachEvent(type:multisuggestEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - close():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getBody():any; - getButton():webix.ui.baseview; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getHead():any; - getItemText(id:string|number):string; - getList():webix.ui.list; - getMasterValue():any; - getNode():any; - getParentView():any; - getSuggestion():string; - getTopParentView():webix.ui.baseview; - getValue():string|number; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - linkInput(input:HTMLElement):void; - mapEvent(map:any):void; - resize():void; - resizeChildren():void; - setMasterValue(value:any):void; - setPosition(x:number, y:number):void; - setValue(value:string|number):void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - unblockEvent():void; - - $enterKey: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: multisuggestConfig; - name: string; -} -interface multitextConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - icon?: string; - iconWidth?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - placeholder?: string; - popup?: string; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - separator?: string; - subConfig?: any; - suggest?: any; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type multitextEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class multitext implements webix.ui.baseview{ - addSection():string|number; - adjust():void; - attachEvent(type:multitextEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - getValueHere():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - removeSection(id?:string|number):void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - setValueHere(value:string|number):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $cssName: string; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: multitextConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface multiviewConfig{ - view?: string; - animate?: any; - borderless?: boolean; - cells?: any; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - fitBiggest?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - keepViews?: boolean; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - responsive?: string; - rows?: any[]; - visibleBatch?: string; - width?: number; -} -type multiviewEventName ='onBeforeBack'|'onBindRequest'|'onDestruct'|'onViewChange'; -class multiview implements webix.ui.baseview{ - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:multiviewEventName, functor:WebixCallback, id?:string):string|number; - back(step:number):void; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getActiveId():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string|number; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - reconstruct():void; - removeView(id:string|number):void; - resize():void; - resizeChildren():void; - setValue(toshow:string|number):void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: multiviewConfig; - name: string; -} -interface organogramConfig{ - view?: string; - animate?: any; - ariaLabel?: string; - autoheight?: boolean; - autowidth?: boolean; - borderless?: boolean; - click?: string|WebixCallback; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - filterMode?: any; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - multiselect?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - ready?: WebixCallback; - removeMissed?: boolean; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollSpeed?: string; - select?: boolean|string; - template?: string|WebixCallback; - threeState?: boolean; - tooltip?: string|boolean; - type?: any; - url?: string; - width?: number; -} -type organogramEventName ='onAfterAdd'|'onAfterClose'|'onAfterContextMenu'|'onAfterDelete'|'onAfterLoad'|'onAfterOpen'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onBeforeAdd'|'onBeforeClose'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeLoad'|'onBeforeOpen'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onFocus'|'onItemCheck'|'onItemClick'|'onItemDblClick'|'onItemRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onSelectChange'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class organogram implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addCss(id:string|number, css:string, silent?:boolean):void; - adjust():void; - attachEvent(type:organogramEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - close(id:string|number):void; - closeAll():void; - count():number; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getBranchIndex(id:string|number, parent?:string|number):number; - getChildViews():any[]; - getFirstChildId(id:string|number):string; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNextSiblingId(id:string|number):string|number; - getNode():any; - getOpenItems():any[]; - getParentId(id:string|number):string|number; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getPrevSiblingId(id:string|number):string|number; - getScrollState():any; - getSelectedId(as_array:boolean):string|any[]; - getSelectedItem(as_array:boolean):any; - getState():any; - getTopParentView():webix.ui.baseview; - group(config:any, mode:boolean):void; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - isBranch(id:string|number):boolean; - isBranchOpen(id:string|number):boolean; - isEnabled():boolean; - isSelected(id:string|number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadBranch(id:string|number, callback:WebixCallback, url:string):void; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - open(id:string|number, show?:boolean):void; - openAll():void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - render(id:string|number, data:any, type:string):void; - resize():void; - scrollTo(x:number, y:number):void; - select(id:string|any[], preserve:boolean):void; - selectAll(from?:string, to?:string):void; - serialize():any; - setState(state:any):void; - show(force?:boolean, animation?:boolean):void; - showItem(id:string|number):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - ungroup(mode:boolean):void; - unselect(id?:string):void; - unselectAll():void; - updateItem(id:string|number, data:any):void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: organogramConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - type: { [key: string]: any; }; - types: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface pagerConfig{ - view?: string; - animate?: any; - apiOnly?: boolean; - borderless?: boolean; - container?: string|HTMLElement; - count?: number; - css?: string; - disabled?: boolean; - gravity?: number; - group?: number; - height?: number; - hidden?: boolean; - id?: string|number; - limit?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - page?: number; - size?: number; - template?: string|WebixCallback; - width?: number; -} -type pagerEventName ='onAfterContextMenu'|'onAfterPageChange'|'onAfterRender'|'onAfterScroll'|'onBeforeContextMenu'|'onBeforePageChange'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onItemClick'|'onItemDblClick'|'onKeyPress'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class pager implements webix.ui.baseview{ - adjust():void; - attachEvent(type:pagerEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clone(config:any):any; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh(id?:string|number):void; - render(id:string|number, data:any, type:string):void; - resize():void; - select(page:number):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: pagerConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - type: { [key: string]: any; }; -} -interface pdfviewerConfig{ - view?: string; - animate?: any; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datatype?: string; - disabled?: boolean; - downloadName?: string; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - scale?: string|number; - toolbar?: string; - url?: string; - width?: number; -} -type pdfviewerEventName ='onAfterLoad'|'onAfterScroll'|'onBeforeLoad'|'onBindRequest'|'onBlur'|'onDestruct'|'onDocumentReady'|'onFocus'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onPageRender'|'onScaleChange'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class pdfviewer implements webix.ui.baseview{ - adjust():void; - attachEvent(type:pdfviewerEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clear():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - download():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - mapEvent(map:any):void; - nextPage():void; - parse(data:any, type:string):void; - prevPage():void; - renderPage(page:number):void; - resize():void; - setScale(scale:string|number, update:boolean):void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - unblockEvent():void; - zoomIn():void; - zoomOut():void; - - $getSize():any[]; - $height: number; - $numPages: number; - $onLoad: WebixCallback; - $pageNum: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: pdfviewerConfig; - name: string; -} -interface pivotConfig{ - view?: string; - animate?: any; - borderless?: boolean; - cols?: any[]; - columnWidth?: number; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - datatype?: string; - disabled?: boolean; - externalProcessing?: boolean; - fieldMap?: any; - filterLabelAlign?: string; - filterLabelWidth?: number; - filterMap?: any; - filterMinWidth?: number; - filterPlaceholder?: boolean|string; - filterWidth?: number; - footer?: string; - format?: WebixCallback; - gravity?: number; - headerTemplate?: WebixCallback; - height?: number; - hidden?: boolean; - id?: string|number; - margin?: number; - max?: boolean; - maxHeight?: number; - maxWidth?: number; - min?: boolean; - minHeight?: number; - minWidth?: number; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - ping?: WebixCallback; - popup?: any; - profile?: boolean; - readonly?: boolean; - readonlyTitle?: string; - ready?: WebixCallback; - removeMissed?: boolean; - responsive?: string; - rows?: any[]; - scheme?: any; - stableRowId?: boolean; - structure?: any; - totalColumn?: string; - type?: string; - url?: string; - visibleBatch?: string; - webWorker?: string; - width?: number; - yScaleWidth?: number; -} -type pivotEventName ='onAfterAdd'|'onAfterDelete'|'onAfterLoad'|'onAfterSort'|'onApply'|'onBeforeAdd'|'onBeforeApply'|'onBeforeCancel'|'onBeforeDelete'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSort'|'onBindRequest'|'onCancel'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onFilterChange'|'onFilterCreate'|'onHeaderInit'|'onItemClick'|'onLoadError'|'onPopup'|'onViewInit'|'onWebWorkerEnd'|'onWebWorkerStart'; -class pivot implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addOperation(name:string, functor:WebixCallback, options:any):void; - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:pivotEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - configure():void; - count():number; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getChildViews():any[]; - getConfigWindow():any; - getFields():any; - getFilterView():any; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getStructure():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - innerId(id:number|string):number|string; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - mapEvent(map:any):void; - parse(data:any, type:string):void; - reconstruct():void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeView(id:string|number):void; - render():void; - resize():void; - resizeChildren():void; - serialize():any; - setStructure(config:any):void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - ui(view:any):webix.ui.baseview; - unbind():void; - unblockEvent():void; - updateItem(id:string|number, data:any):void; - - $$: any; - $divider: string; - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: pivotConfig; - name: string; - operations: any; - data:DataStore; - waitData: webix.promise; -} -interface popupConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - left?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - move?: boolean; - on?: EventHash; - padding?: any; - position?: string|WebixCallback; - relative?: string; - resize?: boolean; - toFront?: boolean; - top?: number; - width?: number; - zIndex?: number; -} -type popupEventName ='onAfterScroll'|'onBeforeShow'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onHide'|'onKeyPress'|'onLongTouch'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class popup implements webix.ui.baseview{ - adjust():void; - attachEvent(type:popupEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - close():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getBody():any; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getHead():any; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - resize():void; - resizeChildren():void; - setPosition(x:number, y:number):void; - show(node?:HTMLElement, position?:any, point?:string):void; - unbind():void; - unblockEvent():void; - show(force:boolean,animation:boolean):void; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: popupConfig; - name: string; -} -interface portletConfig{ - view?: string; - animate?: any; - body?: string|webix.ui.baseview; - borderless?: boolean; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - isolate?: boolean; - layoutType?: string; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mode?: string; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - responsive?: string; - rows?: any[]; - type?: string; - visibleBatch?: string; - width?: number; -} -type portletEventName ='onAfterPortletMove'|'onBeforePortletMove'|'onBindRequest'|'onDestruct'; -class portlet implements webix.ui.baseview{ - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:portletEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - markDropArea(target:string, mode:string):void; - movePortlet(target:string, mode:string):void; - reconstruct():void; - removeView(id:string|number):void; - resize():void; - resizeChildren():void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - unbind():void; - unblockEvent():void; - - $drag(source:HTMLElement, ev:Event):string; - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: portletConfig; - name: string; -} -interface propertyConfig{ - view?: string; - animate?: any; - autoheight?: boolean; - borderless?: boolean; - complexData?: boolean; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - datatype?: string; - disabled?: boolean; - editValue?: string; - editable?: boolean; - editaction?: string; - elements?: any; - form?: string; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - map?: any; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - nameWidth?: number; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - scroll?: boolean|string; - scrollSpeed?: string; - template?: string|WebixCallback; - tooltip?: string|boolean; - url?: string; - width?: number; -} -type propertyEventName ='onAfterContextMenu'|'onAfterEditStart'|'onAfterEditStop'|'onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onBeforeContextMenu'|'onBeforeEditStart'|'onBeforeEditStop'|'onBeforeLoad'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onItemClick'|'onItemDblClick'|'onKeyPress'|'onLiveEdit'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class property implements webix.ui.baseview{ - adjust():void; - attachEvent(type:propertyEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - edit(id:any):void; - editCancel():void; - editNext():boolean; - editStop():void; - enable():void; - focusEditor():void; - getChildViews():any[]; - getEditState():any; - getEditor(id?:string):any; - getEditorValue():string; - getFormView():webix.ui.baseview; - getItem(id:string):any; - getItemNode(id:string|number):HTMLElement; - getNode():any; - getParentView():any; - getScrollState():any; - getTopParentView():webix.ui.baseview; - getValues():{ [key: string]: any; }; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - locate(e:Event):string|number; - mapEvent(map:any):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - registerType(name:string, data:any):void; - render(id:string|number, data:any, type:string):void; - resize():void; - scrollTo(x:number, y:number):void; - setValues(values:any, update?:boolean):void; - show(force?:boolean, animation?:boolean):void; - showItem(id:string|number):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - updateItem():void; - validateEditor(id?:string|number):boolean; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: propertyConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_edit: { [key: string]: any; }; - on_mouse_move: WebixCallback; - on_render: { [key: string]: any; }; - type: { [key: string]: any; }; -} -interface radioConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - customRadio?: boolean; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - newline?: boolean; - on?: EventHash; - optionHeight?: number; - options?: any[]; - popup?: string; - relatedAction?: string; - relatedView?: string; - required?: boolean; - suggest?: any; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - vertical?: boolean; - width?: number; -} -type radioEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class radio implements webix.ui.baseview{ - adjust():void; - attachEvent(type:radioEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: radioConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface rangechartConfig{ - view?: string; - alpha?: number; - animate?: any; - ariaLabel?: string; - barWidth?: number; - border?: boolean; - borderColor?: string; - borderless?: boolean; - cant?: number; - color?: string|WebixCallback; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - datathrottle?: number; - datatype?: string; - disableLines?: boolean; - disabled?: boolean; - eventRadius?: number; - fill?: string; - fixOverflow?: boolean; - frameId?: string; - gradient?: boolean|string|WebixCallback; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - label?: string|WebixCallback; - labelOffset?: number; - legend?: any; - line?: any; - lineColor?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - offset?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - origin?: number; - padding?: any; - pieHeight?: number; - pieInnerText?: string|WebixCallback; - preset?: string; - radius?: number; - range?: any; - ready?: WebixCallback; - removeMissed?: boolean; - save?: string; - scale?: string; - scheme?: any; - series?: any; - shadow?: boolean; - tooltip?: string|boolean; - type?: string; - url?: string; - value?: string|WebixTemplate; - width?: number; - x?: number; - xAxis?: any; - xValue?: string; - y?: number; - yAxis?: any; - yValue?: string; -} -type rangechartEventName ='onAfterAdd'|'onAfterContextMenu'|'onAfterDelete'|'onAfterLoad'|'onAfterRangeChange'|'onAfterRender'|'onAfterScroll'|'onAfterSort'|'onBeforeAdd'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onFocus'|'onItemClick'|'onItemDblClick'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class rangechart implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addSeries(obj:any):void; - adjust():void; - attachEvent(type:rangechartEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCanvas():void; - count():number; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getChildViews():any[]; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getFrameData():any[]; - getFrameRange():any; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getTopParentView():webix.ui.baseview; - group(config:any, mode:boolean):void; - hasEvent(name:string):boolean; - hide():void; - hideSeries(series:string):void; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeAllSeries():void; - render(id:string|number, data:any, type:string):void; - resize():void; - serialize():any; - setFrameRange(range:any):void; - show(force?:boolean, animation?:boolean):void; - showSeries(series:string):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - ungroup(mode:boolean):void; - updateItem(id:string|number, data:any):void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - colormap: { [key: string]: any; }; - config: rangechartConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - presets: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface rangesliderConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - max?: number; - maxHeight?: number; - maxWidth?: number; - min?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - popup?: string; - relatedAction?: string; - relatedView?: string; - required?: boolean; - separator?: string; - step?: number; - stringResult?: boolean; - suggest?: any; - title?: string|WebixCallback; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type rangesliderEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSliderDrag'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class rangeslider implements webix.ui.baseview{ - adjust():void; - attachEvent(type:rangesliderEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $cssName: string; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $touchCapture: boolean; - $view: HTMLElement; - $width: number; - config: rangesliderConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface resizerConfig{ - view?: string; - animate?: any; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - onContext?: { [key: string]: any; }; - width?: number; -} -type resizerEventName ='onAfterContextMenu'|'onAfterScroll'|'onBeforeContextMenu'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onItemClick'|'onItemDblClick'|'onKeyPress'|'onLongTouch'|'onMouseMoving'|'onMouseOut'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class resizer implements webix.ui.baseview{ - adjust():void; - bind(target:any, rule?:WebixCallback, format?:string):void; - define(property:string, value:any):void; - destructor():void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hide():void; - isEnabled():boolean; - isVisible():boolean; - resize():void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: resizerConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; -} -interface richselectConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - icon?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - options?: any; - placeholder?: string; - popup?: string; - popupWidth?: number; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - suggest?: any; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type richselectEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class richselect implements webix.ui.baseview{ - adjust():void; - attachEvent(type:richselectEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getList():webix.ui.list; - getNode():any; - getParentView():any; - getPopup():webix.ui.baseview; - getText():string; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: richselectConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface richtextConfig{ - view?: string; - animate?: any; - borderless?: boolean; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - isolate?: boolean; - label?: string; - labelPosition?: string; - labelWidth?: number; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - responsive?: string; - rows?: any[]; - type?: string; - value?: string|number; - visibleBatch?: string; - width?: number; -} -type richtextEventName ='onBindRequest'|'onChange'|'onDestruct'; -class richtext implements webix.ui.baseview{ - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:richtextEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - innerId(id:number|string):number|string; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - reconstruct():void; - refresh():void; - removeView(id:string|number):void; - resize():void; - resizeChildren():void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - ui(view:any):webix.ui.baseview; - unbind():void; - unblockEvent():void; - - $$: any; - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: richtextConfig; - name: string; -} -interface scrollviewConfig{ - view?: string; - animate?: any; - body?: any; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - scroll?: boolean|string; - scrollSpeed?: string; - width?: number; -} -type scrollviewEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class scrollview implements webix.ui.baseview{ - adjust():void; - attachEvent(type:scrollviewEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getBody():any; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getScrollState():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - resize():void; - resizeChildren():void; - scrollTo(x:number, y:number):void; - show(force?:boolean, animation?:boolean):void; - showView(id:string|number):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: scrollviewConfig; - name: string; -} -interface searchConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - icon?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - pattern?: any; - placeholder?: string; - popup?: string; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - suggest?: any; - tooltip?: string; - type?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type searchEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSearchIconClick'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class search implements webix.ui.baseview{ - adjust():void; - attachEvent(type:searchEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: searchConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface segmentedConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - multiview?: boolean; - name?: string; - on?: EventHash; - optionWidth?: number; - options?: any; - popup?: string; - relatedAction?: string; - relatedView?: string; - required?: boolean; - suggest?: any; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type segmentedEventName ='onAfterRender'|'onAfterScroll'|'onAfterTabClick'|'onBeforeRender'|'onBeforeTabClick'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onOptionRemove'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class segmented implements webix.ui.baseview{ - addOption(id:string|number, value:any, show?:boolean, index?:number):void; - adjust():void; - attachEvent(type:segmentedEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - hideOption(id:string|number):void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - optionIndex(ID:string|number):number; - refresh():void; - removeOption(id:string|number):void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - showOption(id:string|number):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: segmentedConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface selectConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - options?: any[]|string; - placeholder?: string; - popup?: string; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - suggest?: any; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type selectEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class select implements webix.ui.baseview{ - adjust():void; - attachEvent(type:selectEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: selectConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface sidemenuConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - left?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - move?: boolean; - on?: EventHash; - padding?: any; - position?: string|WebixCallback; - relative?: string; - resize?: boolean; - state?: WebixCallback; - toFront?: boolean; - top?: number; - width?: number; - zIndex?: number; -} -type sidemenuEventName ='onAfterScroll'|'onBeforeShow'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onHide'|'onKeyPress'|'onLongTouch'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class sidemenu implements webix.ui.baseview{ - adjust():void; - attachEvent(type:sidemenuEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - close():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getBody():any; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getHead():any; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - resize():void; - resizeChildren():void; - setPosition(x:number, y:number):void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: sidemenuConfig; - name: string; -} -interface sliderConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - max?: number; - maxHeight?: number; - maxWidth?: number; - min?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - placeholder?: string; - popup?: string; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - step?: number; - suggest?: any; - title?: string|WebixCallback; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type sliderEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSliderDrag'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class slider implements webix.ui.baseview{ - adjust():void; - attachEvent(type:sliderEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $touchCapture: boolean; - $view: HTMLElement; - $width: number; - config: sliderConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface spacerConfig{ - view?: string; - animate?: any; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - width?: number; -} -type spacerEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class spacer implements webix.ui.baseview{ - adjust():void; - bind(target:any, rule?:WebixCallback, format?:string):void; - define(property:string, value:any):void; - destructor():void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hide():void; - isEnabled():boolean; - isVisible():boolean; - resize():void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: spacerConfig; - name: string; -} -interface spreadsheetConfig{ - view?: string; - animate?: any; - borderless?: boolean; - bottombar?: boolean; - buttons?: any; - cols?: any[]; - columnCount?: number; - conditionStyle?: any[]; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - datatype?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - isolate?: boolean; - liveEditor?: boolean; - margin?: number; - maxHeight?: number; - maxWidth?: number; - menu?: boolean; - minHeight?: number; - minWidth?: number; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - readonly?: boolean; - resizeCell?: boolean; - responsive?: string; - rowCount?: number; - rows?: any[]; - sheetTabWidth?: number; - subbar?: any; - toolbar?: string; - type?: string; - url?: string; - visibleBatch?: string; - width?: number; -} -type spreadsheetEventName ='onAfterLoad'|'onAfterSelect'|'onAfterSheetShow'|'onBeforeLoad'|'onBeforeSheetShow'|'onBeforeSpan'|'onBeforeSplit'|'onBeforeValueChange'|'onBindRequest'|'onCellChange'|'onComponentInit'|'onDataParse'|'onDataSerialize'|'onDestruct'|'onLoadError'|'onMathRefresh'|'onReset'|'onStyleSet'; -class spreadsheet implements webix.ui.baseview{ - addFilter(rowId:number, columnId:number):void; - addImage(rowId:number, columnId:number, url:string):void; - addSheet(content:any):void; - addSparkline(rowId:number, columnId:number, config:any):void; - addStyle(styleProps:any, baseStyle:any):void; - addView(view:any, index?:number):string|number; - adjust():void; - alert(config:any):HTMLElement; - attachEvent(type:spreadsheetEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearRange(rangeStr:string, type:any):void; - clearSheet():void; - combineCells(range:any):void; - compactStyles():void; - confirm(config:any):void; - define(property:string, value:any):void; - deleteColumn(columnId:number):void; - deleteRow(rowId:number):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - eachSelectedCell(handler:WebixCallback):void; - editSheet(name:string):void; - enable():void; - filterSpreadSheet():void; - freezeColumns(columns:number):void; - freezeRows(rows:number):void; - getActiveSheet():string; - getCellEditor(row:number, column:number):any; - getCellValue(row:number, column:number):string; - getChildViews():any[]; - getColumn(id:string):any; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getRow(id:string):any; - getSelectedId():any[]; - getSelectedRange():string; - getStyle(row:number, column:number):any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - hideColumn(columnId:number, state:boolean):void; - hideGridlines(state:boolean):void; - hideHeaders(state:boolean):void; - hideRow(rowId:number, state:boolean):void; - index(obj:any):number; - innerId(id:number|string):number|string; - insertColumn(columnId:number):void; - insertRow(rowId:number):void; - isCellLocked(rowId:number, columnId:number):boolean; - isColumnVisible(columnId:number):boolean; - isEnabled():boolean; - isRowVisible(rowId:number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - lockCell(rowId:number, columnId:number, state:boolean):void; - mapEvent(map:any):void; - parse(data:any, type:string):void; - recalculate():void; - reconstruct():void; - redo():void; - refresh():void; - registerMathMethod(name:string, handler:WebixCallback):void; - removeFilter():void; - removeSheet(name:string):void; - removeView(id:string|number):void; - renameSheet(name:string, newName:string):void; - reset():void; - resetUndo():void; - resize():void; - resizeChildren():void; - saveCell(row:number, column:number):void; - serialize():any; - setCellEditor(rowId:number, columnId:number, editorObject:any):void; - setCellFilter(rowId:number, columnId:number, options:string|any[]):void; - setCellValue(row:number, column:any, value:string):void; - setFormat(rowId:number, columnId:number, format:string):void; - setRangeStyle(rangeStr:string, style:any):void; - setRangeValue(range:string):void; - setStyle(row:number, column:number, style:any):void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - showSheet(name:string):void; - sortRange(range:string, dir:string):void; - splitCell(row:number, column:number):void; - ui(view:any):webix.ui.baseview; - unbind():void; - unblockEvent():void; - undo(id:string):void; - - $$: any; - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: spreadsheetConfig; - name: string; -} -interface submenuConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - autoheight?: boolean; - autowidth?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - click?: string|WebixCallback; - clipboard?: boolean|string; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - drag?: boolean|string; - dragscroll?: boolean|string; - externalData?: WebixCallback; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - layout?: string; - left?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - mouseEventDelay?: number; - move?: boolean; - multiselect?: boolean; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - openAction?: string; - padding?: any; - pager?: any; - position?: string|WebixCallback; - ready?: WebixCallback; - relative?: string; - removeMissed?: boolean; - resize?: boolean; - rules?: any; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollSpeed?: string; - select?: boolean|string; - subMenuPos?: string; - submenuConfig?: any; - template?: string|WebixCallback; - templateCopy?: WebixCallback; - toFront?: boolean; - tooltip?: string|boolean; - top?: number; - type?: any; - url?: string; - width?: number; - xCount?: number; - yCount?: number; - zIndex?: number; -} -type submenuEventName ='onAfterAdd'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|'onAfterDropOrder'|'onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onBeforeAdd'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDropOrder'|'onBeforeDropOut'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSelect'|'onBeforeShow'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onFocus'|'onHide'|'onItemClick'|'onItemDblClick'|'onItemRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMenuItemClick'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onPaste'|'onSelectChange'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class submenu implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addCss(id:string|number, css:string, silent?:boolean):void; - adjust():void; - attachEvent(type:submenuEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearValidation():void; - close():void; - copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - count():number; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - disableItem(id:string|number):void; - enable():void; - enableItem(id:string|number):void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getBody():any; - getChildViews():any[]; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getHead():any; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getMenu(id:string|number):any; - getMenuItem(id:string|number):any; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getPage():number; - getPager():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getScrollState():any; - getSelectedId(as_array:boolean):string|any[]; - getSelectedItem(as_array:boolean):any; - getSubMenu(id:string|number):any; - getTopMenu():any; - getTopParentView():webix.ui.baseview; - getVisibleCount():number; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - hideItem(id:string|number):void; - isEnabled():boolean; - isSelected(id:string|number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveBottom(id:string|number):void; - moveDown(id:string|number, step:number):void; - moveSelection(direction:string):void; - moveTop(id:string|number):void; - moveUp(id:string|number, step:number):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - render(id:string|number, data:any, type:string):void; - resize():void; - resizeChildren():void; - scrollTo(x:number, y:number):void; - select(id:string|any[], preserve:boolean):void; - selectAll(from?:string, to?:string):void; - serialize():any; - setPage(page:number):void; - setPosition(x:number, y:number):void; - show(node?:HTMLElement, position?:any, point?:string):void; - showItem(id:string|number):void; - sizeToContent():void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - unselect(id?:string):void; - unselectAll():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - show(force:boolean,animation:boolean):void; - $drag(source:HTMLElement, ev:Event):string; - $dragHTML: WebixCallback; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragMark(context:any, ev:Event):boolean; - $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dropAllow: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: submenuConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - type: { [key: string]: any; }; - types: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface suggestConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - disabled?: boolean; - filter?: WebixCallback; - fitMaster?: boolean; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - input?: HTMLElement|string; - keyPressTimeout?: number; - left?: number; - master?: webix.ui.baseview; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - move?: boolean; - on?: EventHash; - padding?: any; - position?: string|WebixCallback; - relative?: string; - resize?: boolean; - template?: string|WebixTemplate; - textValue?: string; - toFront?: boolean; - top?: number; - type?: string; - url?: string; - width?: number; - zIndex?: number; -} -type suggestEventName ='onAfterScroll'|'onBeforeShow'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onHide'|'onKeyPress'|'onLongTouch'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValueSuggest'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class suggest implements webix.ui.baseview{ - adjust():void; - attachEvent(type:suggestEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - close():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getBody():any; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getHead():any; - getItemText(id:string|number):string; - getList():webix.ui.list; - getMasterValue():any; - getNode():any; - getParentView():any; - getSuggestion():string; - getTopParentView():webix.ui.baseview; - getValue():string|number; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - linkInput(input:HTMLElement):void; - mapEvent(map:any):void; - resize():void; - resizeChildren():void; - setMasterValue(value:any):void; - setPosition(x:number, y:number):void; - setValue(value:string|number):void; - show(node:HTMLElement, position?:any, point?:string):void; - unbind():void; - unblockEvent():void; - show(force:boolean,animation:boolean):void; - $enterKey: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: suggestConfig; - name: string; -} -interface tabbarConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomOffset?: number; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - moreTemplate?: WebixCallback; - multiview?: boolean; - name?: string; - on?: EventHash; - optionWidth?: number; - options?: any; - placeholder?: string; - popup?: string; - popupTemplate?: WebixCallback; - popupWidth?: number; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - suggest?: any; - tabMargin?: number; - tabMinWidth?: number; - tabMoreWidth?: number; - tabOffset?: number; - tabbarPopup?: webix.ui.baseview; - topOffset?: number; - type?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; - yCount?: number; -} -type tabbarEventName ='onAfterRender'|'onAfterScroll'|'onAfterTabClick'|'onBeforeRender'|'onBeforeTabClick'|'onBeforeTabClose'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onOptionRemove'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class tabbar implements webix.ui.baseview{ - addOption(id:string|number, value:any, show?:boolean, index?:number):void; - adjust():void; - attachEvent(type:tabbarEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getPopup():webix.ui.baseview; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - hideOption(id:string|number):void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - optionIndex(ID:string|number):number; - refresh():void; - removeOption(id:string|number):void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - showOption(id:string|number):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: tabbarConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface tabviewConfig{ - view?: string; - animate?: any; - borderless?: boolean; - cells?: any[]; - cols?: any[]; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - isolate?: boolean; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - multiview?: any; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - responsive?: string; - rows?: any[]; - tabbar?: any; - type?: string; - visibleBatch?: string; - width?: number; -} -type tabviewEventName ='onBindRequest'|'onDestruct'; -class tabview implements webix.ui.baseview{ - addView(view:any):string|number; - adjust():void; - attachEvent(type:tabviewEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getMultiview():any; - getNode():any; - getParentView():any; - getTabbar():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - reconstruct():void; - removeView(id:string|number):void; - resize():void; - resizeChildren():void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: tabviewConfig; - name: string; -} -interface templateConfig{ - view?: string; - animate?: any; - autoheight?: boolean; - borderless?: boolean; - container?: string|HTMLElement; - content?: string|number|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datatype?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - onClick?: { [key: string]: any; }; - scroll?: boolean|string; - scrollSpeed?: string; - src?: string; - template?: string|WebixCallback; - type?: string; - url?: string; - width?: number; -} -type templateEventName ='onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onBeforeLoad'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class template implements webix.ui.baseview{ - adjust():void; - attachEvent(type:templateEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getScrollState():any; - getTopParentView():webix.ui.baseview; - getValues():void; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - mapEvent(map:any):void; - parse(data:any, type:string):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - scrollTo(x:number, y:number):void; - setContent(node:any):void; - setHTML(html:string):void; - setValues(obj:any, update?:boolean):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: templateConfig; - name: string; -} -interface textConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - icon?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - pattern?: any; - placeholder?: string; - popup?: string; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - suggest?: any; - tooltip?: string; - type?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type textEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class text implements webix.ui.baseview{ - adjust():void; - attachEvent(type:textEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(config:any):HTMLElement; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: textConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface textareaConfig{ - view?: string; - align?: string; - animate?: any; - attributes?: any; - autowidth?: boolean; - borderless?: boolean; - bottomLabel?: string; - bottomPadding?: number; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputAlign?: string; - inputHeight?: number; - inputPadding?: number; - inputWidth?: number; - invalid?: boolean; - invalidMessage?: string; - label?: string; - labelAlign?: string; - labelPosition?: string; - labelWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - on?: EventHash; - pattern?: any; - placeholder?: string; - popup?: string; - readonly?: boolean; - relatedAction?: string; - relatedView?: string; - required?: boolean; - suggest?: any; - tooltip?: string; - validate?: WebixCallback; - validateEvent?: string; - value?: string|number; - width?: number; -} -type textareaEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class textarea implements webix.ui.baseview{ - adjust():void; - attachEvent(type:textareaEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setBottomText(text:string):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - validate():boolean; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $render: WebixCallback; - $renderIcon: WebixCallback; - $renderInput(obj:any, html:string, id:string|number):string; - $renderLabel(config:any, id:string|number):string; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: textareaConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface toggleConfig{ - view?: string; - align?: string; - animate?: any; - autowidth?: boolean; - borderless?: boolean; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - icon?: string; - id?: string|number; - inputHeight?: number; - inputWidth?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - name?: string; - offIcon?: string; - offLabel?: string; - on?: EventHash; - onIcon?: string; - onLabel?: string; - popup?: string; - tooltip?: string; - type?: string; - value?: string|number; - width?: number; -} -type toggleEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onChange'|'onDestruct'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class toggle implements webix.ui.baseview{ - adjust():void; - attachEvent(type:toggleEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - toggle():void; - unbind():void; - unblockEvent():void; - - $compareValue: WebixCallback; - $getSize():any[]; - $getValue():string; - $height: number; - $prepareValue: WebixCallback; - $renderInput(config:any):HTMLElement; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $view: HTMLElement; - $width: number; - config: toggleConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface toolbarConfig{ - view?: string; - animate?: any; - borderless?: boolean; - cols?: any[]; - complexData?: boolean; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datatype?: string; - disabled?: boolean; - elements?: any[]; - elementsConfig?: { [key: string]: any; }; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - isolate?: boolean; - margin?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - padding?: number; - paddingX?: number; - paddingY?: number; - responsive?: string; - rows?: any[]; - rules?: any; - scroll?: boolean|string; - scrollSpeed?: string; - type?: string; - url?: string; - visibleBatch?: string; - width?: number; -} -type toolbarEventName ='onAfterLoad'|'onAfterScroll'|'onAfterValidation'|'onBeforeLoad'|'onBeforeValidate'|'onBindRequest'|'onChange'|'onDestruct'|'onLoadError'|'onValidationError'|'onValidationSuccess'|'onValues'; -class toolbar implements webix.ui.baseview{ - addView(view:any, index?:number):string|number; - adjust():void; - attachEvent(type:toolbarEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clear():void; - clearValidation():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - focus(item:string):void; - getChildViews():any[]; - getCleanValues():any; - getDirtyValues():any; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getScrollState():any; - getTopParentView():webix.ui.baseview; - getValues(details?:any):{ [key: string]: any; }; - hasEvent(name:string):boolean; - hide():void; - index(obj:any):number; - isDirty():boolean; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - mapEvent(map:any):void; - markInvalid(name:string, state?:boolean|string):void; - parse(data:any, type:string):void; - reconstruct():void; - refresh():void; - removeView(id:string|number):void; - render(id:string|number, data:any, type:string):void; - resize():void; - resizeChildren():void; - scrollTo(x:number, y:number):void; - setDirty(mark?:boolean):void; - setValues(values:any, update?:boolean):void; - show(force?:boolean, animation?:boolean):void; - showBatch(name:string):void; - unbind():void; - unblockEvent():void; - validate(mode?:any):boolean; - - $getSize():any[]; - $height: number; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: toolbarConfig; - name: string; -} -interface tooltipConfig{ - view?: string; - animate?: any; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - dx?: number; - dy?: number; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - on?: EventHash; - template?: string|WebixCallback; - width?: number; -} -type tooltipEventName ='onAfterRender'|'onAfterScroll'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class tooltip{ - adjust():void; - attachEvent(type:tooltipEventName, functor:WebixCallback, id?:string):string|number; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - render(id:string|number, data:any, type:string):void; - resize():void; - show(data:any, position:any):void; - unblockEvent():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: tooltipConfig; - name: string; - type: { [key: string]: any; }; -} -interface treeConfig{ - view?: string; - animate?: any; - borderless?: boolean; - click?: string|WebixCallback; - clipboard?: boolean|string; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - drag?: boolean; - dragscroll?: boolean|string; - filterMode?: any; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - multiselect?: boolean|string; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - ready?: WebixCallback; - removeMissed?: boolean; - rules?: any; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollSpeed?: string; - select?: boolean; - template?: string|WebixCallback; - templateCopy?: WebixCallback; - threeState?: boolean; - tooltip?: string|boolean; - type?: any; - url?: string; - width?: number; -} -type treeEventName ='onAfterAdd'|'onAfterClose'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|'onAfterDropOrder'|'onAfterLoad'|'onAfterOpen'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onBeforeAdd'|'onBeforeClose'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDropOrder'|'onBeforeDropOut'|'onBeforeLoad'|'onBeforeOpen'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onFocus'|'onItemCheck'|'onItemClick'|'onItemDblClick'|'onItemRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onPartialRender'|'onPaste'|'onSelectChange'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; -class tree implements webix.ui.baseview{ - add(obj:any, index?:number, parentId?:string):string; - addCss(id:string|number, css:string, silent?:boolean):void; - adjust():void; - attachEvent(type:treeEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - checkAll(id?:string|number):void; - checkItem(id:string):void; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearValidation():void; - close(id:string|number):void; - closeAll():void; - copy(sid:string|number, tindex:number, tobj?:webix.ui.baseview, details?:any):string|number; - count():number; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getBranchIndex(id:string|number, parent?:string|number):number; - getChecked():any[]; - getChildViews():any[]; - getFirstChildId(id:string|number):string; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNextSiblingId(id:string|number):string|number; - getNode():any; - getOpenItems():any[]; - getParentId(id:string|number):string|number; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getPrevSiblingId(id:string|number):string|number; - getScrollState():any; - getSelectedId(as_array:boolean):string|any[]; - getSelectedItem(as_array:boolean):any; - getState():any; - getTopParentView():webix.ui.baseview; - group(config:any, mode:boolean):void; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - isBranch(id:string|number):boolean; - isBranchOpen(id:string|number):boolean; - isChecked(id:string|number):boolean; - isEnabled():boolean; - isSelected(id:string|number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadBranch(id:string|number, callback:WebixCallback, url:string):void; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveSelection(direction:string):void; - open(id:string|number, show?:boolean):void; - openAll():void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - render(id:string|number, data:any, type:string):void; - resize():void; - scrollTo(x:number, y:number):void; - select(id:string|any[], preserve:boolean):void; - selectAll(from?:string, to?:string):void; - serialize():any; - setState(state:any):void; - show(force?:boolean, animation?:boolean):void; - showItem(id:string|number):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - uncheckAll(id?:string|number):void; - uncheckItem(id:string):void; - ungroup(mode:boolean):void; - unselect(id?:string):void; - unselectAll():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - - $drag(source:HTMLElement, ev:Event):string; - $dragHTML: WebixCallback; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragMark(context:any, ev:Event):boolean; - $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dropAllow: WebixCallback; - $fixEditor: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: treeConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - type: { [key: string]: any; }; - types: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface treemapConfig{ - view?: string; - activeItem?: boolean; - animate?: any; - borderless?: boolean; - branch?: string; - click?: string|WebixCallback; - clipboard?: boolean|string; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - dataFeed?: string|WebixCallback; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - filterMode?: any; - gravity?: number; - header?: boolean; - headerHeight?: number; - headerTemplate?: string; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - multiselect?: boolean; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - pager?: any; - ready?: WebixCallback; - removeMissed?: boolean; - rules?: any; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollSpeed?: string; - select?: boolean|string; - subRender?: boolean; - template?: string|WebixCallback; - templateCopy?: WebixCallback; - threeState?: boolean; - tooltip?: string|boolean; - type?: any; - url?: string; - value?: string|WebixCallback; - width?: number; -} -type treemapEventName ='onAfterAdd'|'onAfterClose'|'onAfterContextMenu'|'onAfterDelete'|'onAfterLoad'|'onAfterOpen'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onBeforeAdd'|'onBeforeClose'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeLoad'|'onBeforeOpen'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onFocus'|'onItemCheck'|'onItemClick'|'onItemDblClick'|'onItemRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onPartialRender'|'onPaste'|'onSelectChange'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; -class treemap implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addCss(id:string|number, css:string, silent?:boolean):void; - adjust():void; - attachEvent(type:treemapEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearValidation():void; - close(id:string|number):void; - closeAll():void; - count():number; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getBranchIndex(id:string|number, parent?:string|number):number; - getChildViews():any[]; - getFirstChildId(id:string|number):string; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNextSiblingId(id:string|number):string|number; - getNode():any; - getOpenItems():any[]; - getPage():number; - getPager():any; - getParentId(id:string|number):string|number; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getPrevSiblingId(id:string|number):string|number; - getScrollState():any; - getSelectedId(as_array:boolean):string|any[]; - getSelectedItem(as_array:boolean):any; - getState():any; - getTopParentView():webix.ui.baseview; - group(config:any, mode:boolean):void; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - isBranch(id:string|number):boolean; - isBranchOpen(id:string|number):boolean; - isEnabled():boolean; - isSelected(id:string|number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadBranch(id:string|number, callback:WebixCallback, url:string):void; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - moveSelection(direction:string):void; - open(id:string|number, show?:boolean):void; - openAll():void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - render(id:string|number, data:any, type:string):void; - resize():void; - scrollTo(x:number, y:number):void; - select(id:string|any[], preserve:boolean):void; - selectAll(from?:string, to?:string):void; - serialize():any; - setPage(page:number):void; - setState(state:any):void; - show(force?:boolean, animation?:boolean):void; - showBranch(branchId:string|number):void; - showItem(id:string|number):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - ungroup(mode:boolean):void; - unselect(id?:string):void; - unselectAll():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: treemapConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - type: { [key: string]: any; }; - types: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface treetableConfig{ - view?: string; - animate?: any; - areaselect?: boolean; - autoConfig?: boolean; - autoheight?: boolean; - autowidth?: boolean; - blockselect?: boolean|string; - borderless?: boolean; - checkboxRefresh?: boolean; - clipboard?: boolean|string; - columnWidth?: number; - columns?: any[]; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - datafetch?: number; - datathrottle?: number; - datatype?: string; - delimiter?: any; - disabled?: boolean; - drag?: boolean|string; - dragColumn?: boolean|string; - dragscroll?: boolean|string; - editMath?: boolean; - editValue?: string; - editable?: boolean; - editaction?: string; - externalData?: WebixCallback; - filterMode?: any; - fixedRowHeight?: boolean; - footer?: boolean; - form?: string; - gravity?: number; - header?: boolean; - headerRowHeight?: number; - headermenu?: any; - height?: number; - hidden?: boolean; - hover?: string; - id?: string|number; - leftSplit?: number; - liveValidation?: boolean; - loadahead?: number; - map?: any; - math?: boolean; - maxHeight?: number; - maxWidth?: number; - minColumnHeight?: number; - minColumnWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - multiselect?: boolean; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - pager?: any; - prerender?: boolean; - ready?: WebixCallback; - removeMissed?: boolean; - resizeColumn?: any; - resizeRow?: boolean; - rightSplit?: number; - rowHeight?: number; - rowLineHeight?: number; - rules?: any; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollAlignY?: boolean; - scrollX?: boolean; - scrollY?: boolean; - select?: boolean|string; - spans?: any[]; - subRowHeight?: string; - subrow?: string; - subview?: webix.ui.baseview; - threeState?: boolean; - tooltip?: boolean; - topSplit?: number; - type?: any; - url?: string; - width?: number; - yCount?: number; -} -type treetableEventName ='onAfterAdd'|'onAfterAreaAdd'|'onAfterAreaRemove'|'onAfterBlockSelect'|'onAfterClose'|'onAfterColumnDrop'|'onAfterColumnDropOrder'|'onAfterColumnHide'|'onAfterColumnShow'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|'onAfterDropOrder'|'onAfterEditStart'|'onAfterEditStop'|'onAfterFilter'|'onAfterLoad'|'onAfterOpen'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onAfterUnSelect'|'onAreaDrag'|'onBeforeAdd'|'onBeforeAreaAdd'|'onBeforeAreaRemove'|'onBeforeBlockSelect'|'onBeforeClose'|'onBeforeColumnDrag'|'onBeforeColumnDrop'|'onBeforeColumnDropOrder'|'onBeforeColumnHide'|'onBeforeColumnShow'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDropOrder'|'onBeforeDropOut'|'onBeforeEditStart'|'onBeforeEditStop'|'onBeforeFilter'|'onBeforeLoad'|'onBeforeOpen'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBeforeUnSelect'|'onBindRequest'|'onBlur'|'onCheck'|'onCollectValues'|'onColumnResize'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onEditorChange'|'onFocus'|'onHeaderClick'|'onItemCheck'|'onItemClick'|'onItemDblClick'|'onKeyPress'|'onLiveEdit'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onResize'|'onRowResize'|'onScrollX'|'onScrollY'|'onSelectChange'|'onStructureLoad'|'onStructureUpdate'|'onSubViewClose'|'onSubViewCreate'|'onSubViewOpen'|'onSubViewRender'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; -class treetable implements webix.ui.baseview{ - add(obj:any, index?:number, parentId?:string):string; - addCellCss(id:string, name:string, css:string):void; - addCss(id:string|number, css:string, silent?:boolean):void; - addRowCss(id:string, css:string):void; - adjust():void; - adjustColumn(id:string|number, header?:string):void; - adjustRowHeight(columnId:string, silent:boolean):void; - attachEvent(type:treetableEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - checkAll(id?:string|number):void; - checkItem(id:string):void; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearValidation():void; - close(id:string|number):void; - closeAll():void; - collectValues(id:string|number):any[]; - columnId(index:number):string|number; - copy(sid:string|number, tindex:number, tobj?:webix.ui.baseview, details?:any):string|number; - count():number; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - eachColumn(handler:WebixCallback, all?:boolean):void; - eachRow(handler:WebixCallback):void; - edit(id:any):void; - editCancel():void; - editCell(row:string|number, col:string|number, preserve?:boolean, show?:boolean):void; - editColumn(id:string):void; - editNext():boolean; - editRow(id:string):void; - editStop():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - filterByAll():void; - find(criterion:WebixCallback, first?:boolean):any; - focusEditor():void; - freezeRow(id:number|string, state:boolean):void; - getBranchIndex(id:string|number, parent?:string|number):number; - getChecked():any[]; - getChildViews():any[]; - getColumnConfig(id:string):any; - getColumnIndex(id:string|number):number; - getCss(rowId:string|number, columnId:string|number):string; - getEditState():any; - getEditor(row?:any, column?:string|number):any; - getEditorValue():string; - getFilter(columnID:string|number):any; - getFirstChildId(id:string|number):string; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getHeaderContent(id:string|number):{ [key: string]: any; }; - getHeaderNode(columnId:string, rowIndex?:number):HTMLElement; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNextSiblingId(id:string|number):string|number; - getNode():any; - getOpenItems():any[]; - getPage():number; - getPager():any; - getParentId(id:string|number):string|number; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getPrevSiblingId(id:string|number):string|number; - getScrollState():any; - getSelectedId(asArray:boolean, asString:boolean):any; - getSelectedItem(as_array?:boolean):any; - getState():any; - getText(rowid:string|number, colid:string|number):string; - getTopParentView():webix.ui.baseview; - getVisibleCount():number; - group(config:any, mode:boolean):void; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - hideColumn(id:string|number):void; - hideOverlay():void; - isBranch(id:string|number):boolean; - isBranchOpen(id:string|number):boolean; - isChecked(id:string|number):boolean; - isColumnVisible(id:string|number):boolean; - isEnabled():boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadBranch(id:string|number, callback:WebixCallback, url:string):void; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(node:HTMLElement|Event):any; - mapCells(startrow:number, startcol:string, numrows:number, numcols:number, callback:WebixCallback):void; - mapEvent(map:any):void; - markSorting(column_id:string, direction:string):void; - move(sid:string|number, tindex:number, tobj?:webix.ui.baseview, details?:any):string|number; - moveBottom(id:string|number):void; - moveColumn(id:string, index:number):void; - moveDown(id:string|number, step:number):void; - moveSelection(direction:string):void; - moveTop(id:string|number):void; - moveUp(id:string|number, step:number):void; - open(id:string|number, show?:boolean):void; - openAll():void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - refreshColumns(config?:any[], reset?:boolean):void; - refreshFilter(id:string|number):void; - refreshHeaderContent():void; - registerFilter(object:any, config:any, controller:any):void; - remove(id:string|number):void; - removeCellCss(id:string, name:string, css_name:string):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - removeRowCss(id:string, css_name:string):void; - render(id:string|number, data:any, operation:string):void; - resize():void; - scrollTo(x:number, y:number):void; - serialize():any; - setColumnWidth(id:string|number, width:number):void; - setPage(page:number):void; - setRowHeight(id:string|number, height:number):void; - setState(state:any):void; - show(force?:boolean, animation?:boolean):void; - showCell(row:string, column:string):void; - showColumn(id:string|number):void; - showColumnBatch(batch:string|number, preserve:boolean):void; - showItem(id:string|number):void; - showItemByIndex(index:number):void; - showOverlay(message:string):void; - sort(by:string, dir?:string, as?:string):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - uncheckAll(id?:string|number):void; - uncheckItem(id:string):void; - ungroup(mode:boolean):void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - validateEditor(id?:string|number):boolean; - - $drag(source:HTMLElement, ev:Event):string; - $dragHTML: WebixCallback; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragMark(context:any, ev:Event):boolean; - $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dropAllow: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: treetableConfig; - headerContent: any; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - data:DataStore; - waitData: webix.promise; -} -interface unitlistConfig{ - view?: string; - animate?: any; - autoheight?: boolean; - autowidth?: boolean; - borderless?: boolean; - click?: string|WebixCallback; - clipboard?: boolean|string; - container?: string|HTMLElement; - css?: string; - data?: string|any[]; - datathrottle?: number; - datatype?: string; - disabled?: boolean; - drag?: boolean|string; - dragscroll?: boolean|string; - externalData?: WebixCallback; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - item?: any; - layout?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - mouseEventDelay?: number; - multiselect?: boolean; - navigation?: boolean; - on?: EventHash; - onClick?: { [key: string]: any; }; - onContext?: { [key: string]: any; }; - onDblClick?: WebixCallback; - onMouseMove?: WebixCallback; - pager?: any; - ready?: WebixCallback; - removeMissed?: boolean; - rules?: any; - save?: string; - scheme?: any; - scroll?: boolean|string; - scrollSpeed?: string; - select?: boolean|string; - template?: string|WebixCallback; - templateCopy?: WebixCallback; - tooltip?: string|boolean; - type?: any; - uniteBy?: WebixCallback; - url?: string; - width?: number; - xCount?: number; - yCount?: number; -} -type unitlistEventName ='onAfterAdd'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|'onAfterDropOrder'|'onAfterLoad'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onBeforeAdd'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDropOrder'|'onBeforeDropOut'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBindRequest'|'onBlur'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onFocus'|'onItemClick'|'onItemDblClick'|'onItemRender'|'onKeyPress'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onPaste'|'onSelectChange'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; -class unitlist implements webix.ui.baseview{ - add(obj:any, index?:number):string|number; - addCss(id:string|number, css:string, silent?:boolean):void; - adjust():void; - attachEvent(type:unitlistEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - clearAll():void; - clearCss(css:string, silent?:boolean):void; - clearValidation():void; - copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - count():number; - customize(obj:any):void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - exists(id:string|number):boolean; - filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; - find(criterion:WebixCallback, first?:boolean):any; - getChildViews():any[]; - getFirstId():string|number; - getFormView():webix.ui.baseview; - getIdByIndex(index:number):string|number; - getIndexById(id:string|number):number; - getItem(id:string|number):any; - getItemNode(id:string|number):HTMLElement; - getLastId():string|number; - getNextId(id:string|number, step:number):string|number; - getNode():any; - getPage():number; - getPager():any; - getParentView():any; - getPrevId(id:string|number, step:number):string|number; - getScrollState():any; - getSelectedId(as_array:boolean):string|any[]; - getSelectedItem(as_array:boolean):any; - getTopParentView():webix.ui.baseview; - getUnitList(name:string):any[]; - getUnits():any[]; - getVisibleCount():number; - hasCss(id:string|number, css:string):boolean; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isSelected(id:string|number):boolean; - isVisible():boolean; - load(url:string, type?:string, callback?:WebixCallback):webix.promise; - loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; - locate(e:Event):string|number; - mapEvent(map:any):void; - move(sid:string, tindex:number, tobj?:any, details?:any):string; - moveBottom(id:string|number):void; - moveDown(id:string|number, step:number):void; - moveSelection(direction:string):void; - moveTop(id:string|number):void; - moveUp(id:string|number, step:number):void; - parse(data:any, type:string):void; - refresh(id?:string|number):void; - remove(id:string|number):void; - removeCss(id:string|number, css:string, silent?:boolean):void; - render(id:string|number, data:any, type:string):void; - resize():void; - scrollTo(x:number, y:number):void; - select(id:string|any[], preserve:boolean):void; - selectAll(from?:string, to?:string):void; - serialize():any; - setPage(page:number):void; - show(force?:boolean, animation?:boolean):void; - showItem(id:string|number):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - unselect(id?:string):void; - unselectAll():void; - updateItem(id:string|number, data:any):void; - validate(id?:string):boolean; - - $drag(source:HTMLElement, ev:Event):string; - $dragHTML: WebixCallback; - $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; - $dragMark(context:any, ev:Event):boolean; - $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; - $drop(source:HTMLElement, target:HTMLElement, ev:Event):void; - $dropAllow: WebixCallback; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: unitlistConfig; - name: string; - on_click: WebixCallback; - on_context: { [key: string]: any; }; - on_dblclick: WebixCallback; - on_mouse_move: WebixCallback; - type: { [key: string]: any; }; - types: { [key: string]: any; }; - data:DataStore; - waitData: webix.promise; -} -interface uploaderConfig{ - view?: string; - align?: string; - animate?: any; - apiOnly?: boolean; - autosend?: boolean; - autowidth?: boolean; - borderless?: boolean; - click?: WebixCallback; - container?: string|HTMLElement; - css?: string; - datatype?: string; - directory?: string; - disabled?: boolean; - formData?: { [key: string]: any; }; - gravity?: number; - height?: number; - hidden?: boolean; - hotkey?: string; - id?: string|number; - inputHeight?: number; - inputName?: string; - inputWidth?: number; - label?: string; - link?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - multiple?: boolean; - name?: string; - on?: EventHash; - popup?: string; - tooltip?: string; - type?: string; - upload?: string; - urlData?: { [key: string]: any; }; - value?: string|number; - width?: number; -} -type uploaderEventName ='onAfterFileAdd'|'onAfterRender'|'onAfterScroll'|'onBeforeFileAdd'|'onBeforeRender'|'onBindRequest'|'onBlur'|'onDestruct'|'onFileUpload'|'onFileUploadError'|'onFocus'|'onItemClick'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onUploadComplete'|'onViewResize'; -class uploader implements webix.ui.baseview{ - addDropZone(element:HTMLElement):void; - addFile(name:string, size:number, type?:string):void; - adjust():void; - attachEvent(type:uploaderEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - blur():void; - callEvent(name:string, params:any[]):boolean; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - fileDialog(content?:any):void; - focus():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getInputNode():HTMLElement; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getValue():string; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isUploaded():boolean; - isVisible():boolean; - mapEvent(map:any):void; - refresh():void; - render(id:string|number, data:any, type:string):void; - resize():void; - send(id:number|string|WebixCallback):void; - setValue(value:string):void; - show(force?:boolean, animation?:boolean):void; - stopUpload(id:string|number):void; - sync(source:any, filter:WebixCallback, silent:boolean):void; - unbind():void; - unblockEvent():void; - - $compareValue: WebixCallback; - $cssName: string; - $getSize():any[]; - $getValue():string; - $height: number; - $onUploadComplete: WebixCallback; - $prepareValue: WebixCallback; - $renderInput(config:any):HTMLElement; - $scope: any; - $setSize(x:number, y:number):boolean; - $setValue(value:string):void; - $skin: any; - $updateProgress: WebixCallback; - $view: HTMLElement; - $width: number; - config: uploaderConfig; - name: string; - on_click: WebixCallback; - touchable: boolean; -} -interface videoConfig{ - view?: string; - animate?: any; - borderless?: boolean; - container?: string|HTMLElement; - controls?: boolean; - css?: string; - disabled?: boolean; - gravity?: number; - height?: number; - hidden?: boolean; - id?: string|number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - src?: string; - width?: number; -} -type videoEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; -class video implements webix.ui.baseview{ - adjust():void; - bind(target:any, rule?:WebixCallback, format?:string):void; - define(property:string, value:any):void; - destructor():void; - disable():void; - enable():void; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - getVideo():void; - hide():void; - isEnabled():boolean; - isVisible():boolean; - resize():void; - show(force?:boolean, animation?:boolean):void; - unbind():void; - - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: videoConfig; - name: string; -} -interface windowConfig{ - view?: string; - animate?: any; - autofit?: boolean; - autofocus?: boolean; - body?: string|webix.ui.baseview; - borderless?: boolean; - container?: string|HTMLElement; - css?: string; - disabled?: boolean; - fullscreen?: boolean; - gravity?: number; - head?: any; - headHeight?: number; - height?: number; - hidden?: boolean; - id?: string|number; - left?: number; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: boolean; - move?: boolean; - on?: EventHash; - padding?: any; - position?: string|WebixCallback; - relative?: string; - resize?: boolean; - toFront?: boolean; - top?: number; - width?: number; - zIndex?: number; -} -type windowEventName ='onAfterScroll'|'onBeforeShow'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onHide'|'onKeyPress'|'onLongTouch'|'onShow'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewMove'|'onViewMoveEnd'|'onViewResize'; -class window implements webix.ui.baseview{ - adjust():void; - attachEvent(type:windowEventName, functor:WebixCallback, id?:string):string|number; - bind(target:any, rule?:WebixCallback, format?:string):void; - blockEvent():void; - callEvent(name:string, params:any[]):boolean; - close():void; - define(property:string, value:any):void; - destructor():void; - detachEvent(id:string):void; - disable():void; - enable():void; - getBody():any; - getChildViews():any[]; - getFormView():webix.ui.baseview; - getHead():any; - getNode():any; - getParentView():any; - getTopParentView():webix.ui.baseview; - hasEvent(name:string):boolean; - hide():void; - isEnabled():boolean; - isVisible():boolean; - mapEvent(map:any):void; - resize():void; - resizeChildren():void; - setPosition(x:number, y:number):void; - show(node?:HTMLElement, position?:any, point?:string):void; - unbind():void; - unblockEvent():void; - show(force:boolean,animation:boolean):void; - $getSize():any[]; - $height: number; - $scope: any; - $setSize(x:number, y:number):boolean; - $skin: any; - $view: HTMLElement; - $width: number; - config: windowConfig; - name: string; -} - -}} - -declare function $$(id: string | Event | HTMLElement): webix.ui.baseview; diff --git a/types/webix/tsconfig.json b/types/webix/tsconfig.json deleted file mode 100644 index 5b395aed79..0000000000 --- a/types/webix/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "files": [ - "index.d.ts", - "webix-tests.ts" - ], - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - } -} \ No newline at end of file diff --git a/types/webix/webix-tests.ts b/types/webix/webix-tests.ts deleted file mode 100755 index 1c1e9c9b02..0000000000 --- a/types/webix/webix-tests.ts +++ /dev/null @@ -1,115 +0,0 @@ -//ajax operations -webix.ready(function(){ - webix.ajax().get("te").then(function(){ - webix.message( webix.env.isFF ? "FireFox" : "Other" ); - }); -}); - -//webix helpers -webix.html.addCss(document.body, "text"); -webix.storage.local.get("mydata"); - -var proxy = webix.proxy("meteor", "books"); - -//webix ui helpers -webix.ui.zIndexBase = 101; -webix.ui.zIndex(); -webix.ui.resize(); - -//webix ui constructor -//basic view -var ui = webix.ui({ - view:"list", id:"l1" -}); -ui.adjust(); -$$("l1").adjust(); - -var l1 = {}; -var l2 = {}; - -//specific view types -var ui2 = webix.ui({ - view:"list", id:"21" -}); -ui2.add({ value:"100" }); - -//specific types by id -var list = $$("l1"); -list.add({ value:"100" }); -list.config.height = 100; - - - - -//config typing -var table:webix.ui.datatableConfig = {}; -table.columns = []; -table.autowidth = true; - -webix.ui({ rows:[ table ] }); - -//events -list.attachEvent("onItemClick", function(id:string, e:Event){ - var item = (this).getItem(id); - var self = webix.$$(e); - return true; -}); - -//data collections -var data = new webix.DataCollection(); -data.config["test"]= 123; - -//mixins -var t = webix.DataDriver.json; - -//each ui type has its own events and config options -var tObj = $$("table"); -tObj.attachEvent("onAfterOpen", () => false); -tObj.config.threeState = false; - -var mObj = $$("menu"); -mObj.attachEvent("onMenuItemClick", () => false); -mObj.config.submenuConfig = {}; - -//template cna be a function or a string -mObj.config.template = ""; -mObj.config.template = (obj) => obj.str; - - -//getList return a list -var suggestBox = $$("suggest"); -var list = suggestBox.getList() -var listData = list.serialize(); - -//creating a new UI - -//this is public interface -interface myUI extends webix.ui.list{ - customApi():number; -} -//and this is the actual implementations -var next = webix.protoUI({ - name:"myUI", - customApi(){ - webix.message("test"); - return 1; - } -}, webix.ui.list, webix.EditAbility, webix.EventSystem); - -//test method of new UI -var my = webix.ui({ - view:"myUI" -}); -var tn:number = my.customApi(); - -//datastore -var t = my.data.getItem(1) -var mSize = webix.html.getTextSize( [].concat(my.data.order).map((a) => a.value )) - -//filters -namespace webix.ui.datafilter{ - var avgColumn = webix.extend({ - refresh:function(){ - } - }, webix.ui.datafilter.summColumn) -} diff --git a/types/webpack-bundle-analyzer/index.d.ts b/types/webpack-bundle-analyzer/index.d.ts index c563a9e3cf..3f856a7328 100644 --- a/types/webpack-bundle-analyzer/index.d.ts +++ b/types/webpack-bundle-analyzer/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/th0r/webpack-bundle-analyzer // Definitions by: Michael Strobel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import * as webpack from 'webpack'; diff --git a/types/webpack-chain/index.d.ts b/types/webpack-chain/index.d.ts index 6f6c46daa8..05aa4e5845 100644 --- a/types/webpack-chain/index.d.ts +++ b/types/webpack-chain/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mozilla-neutrino/webpack-chain // Definitions by: Eirikur Nilsson , Paul Sachs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import * as webpack from 'webpack'; import * as https from 'https'; diff --git a/types/webpack-chain/webpack-chain-tests.ts b/types/webpack-chain/webpack-chain-tests.ts index 07593687cf..bd83dfbccb 100644 --- a/types/webpack-chain/webpack-chain-tests.ts +++ b/types/webpack-chain/webpack-chain-tests.ts @@ -1,4 +1,4 @@ -import * as Config from 'webpack-chain'; +import Config = require('webpack-chain'); import * as webpack from 'webpack'; const config = new Config(); diff --git a/types/webpack-chunk-hash/index.d.ts b/types/webpack-chunk-hash/index.d.ts index dc8f697a44..f499a00dc9 100644 --- a/types/webpack-chunk-hash/index.d.ts +++ b/types/webpack-chunk-hash/index.d.ts @@ -2,12 +2,13 @@ // Project: https://github.com/alexindigo/webpack-chunk-hash#readme // Definitions by: Matt Traynham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import webpack = require('webpack'); +import { Plugin } from 'webpack'; export = WebpackChunkHash; -declare class WebpackChunkHash extends webpack.Plugin { +declare class WebpackChunkHash extends Plugin { constructor(options?: WebpackChunkHash.Options); } diff --git a/types/webpack-cleanup-plugin/index.d.ts b/types/webpack-cleanup-plugin/index.d.ts index f5fa620413..a6efd31af7 100644 --- a/types/webpack-cleanup-plugin/index.d.ts +++ b/types/webpack-cleanup-plugin/index.d.ts @@ -2,12 +2,12 @@ // Project: https://github.com/gpbl/webpack-cleanup-plugin#readme // Definitions by: Luka Maljic // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import webpack = require('webpack'); - +import { Plugin } from 'webpack'; export = WebpackCleanupPlugin; -declare class WebpackCleanupPlugin extends webpack.Plugin { +declare class WebpackCleanupPlugin extends Plugin { constructor(options?: WebpackCleanupPlugin.Options); } diff --git a/types/webpack-cleanup-plugin/tsconfig.json b/types/webpack-cleanup-plugin/tsconfig.json index f2712d3d73..3e45140ded 100644 --- a/types/webpack-cleanup-plugin/tsconfig.json +++ b/types/webpack-cleanup-plugin/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "webpack-cleanup-plugin-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/webpack-dev-middleware/v1/webpack-dev-middleware-tests.ts b/types/webpack-dev-middleware/v1/webpack-dev-middleware-tests.ts index 8df4675595..179924ef66 100644 --- a/types/webpack-dev-middleware/v1/webpack-dev-middleware-tests.ts +++ b/types/webpack-dev-middleware/v1/webpack-dev-middleware-tests.ts @@ -1,6 +1,6 @@ -import * as express from 'express'; -import * as webpack from 'webpack'; -import * as webpackDevMiddleware from 'webpack-dev-middleware'; +import express = require('express'); +import webpack = require('webpack'); +import webpackDevMiddleware = require('webpack-dev-middleware'); const compiler = webpack({}); diff --git a/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts b/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts index 2ccfb90a0c..beb3c1abe6 100644 --- a/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts +++ b/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts @@ -1,6 +1,6 @@ -import * as express from 'express'; -import * as webpack from 'webpack'; -import * as webpackDevMiddleware from 'webpack-dev-middleware'; +import express = require('express'); +import webpack = require('webpack'); +import webpackDevMiddleware = require('webpack-dev-middleware'); const compiler = webpack({}); diff --git a/types/webpack-dev-server/index.d.ts b/types/webpack-dev-server/index.d.ts index 797ae437dc..c6bab12c3b 100644 --- a/types/webpack-dev-server/index.d.ts +++ b/types/webpack-dev-server/index.d.ts @@ -15,6 +15,10 @@ import * as spdy from 'spdy'; import * as httpProxyMiddleware from 'http-proxy-middleware'; declare namespace WebpackDevServer { + interface ListeningApp { + address(): { port?: number }; + } + interface proxyConfigMap { [url: string]: string | httpProxyMiddleware.Config; } @@ -76,6 +80,12 @@ declare class WebpackDevServer { config: WebpackDevServer.Configuration ); + static addDevServerEntrypoints( + webpackOptions: webpack.Configuration | webpack.Configuration[], + config: WebpackDevServer.Configuration, + listeningApp?: WebpackDevServer.ListeningApp + ): void; + listen(port: number, hostname: string, callback?: (error?: Error) => void): http.Server; listen(port: number, callback?: (error?: Error) => void): http.Server; diff --git a/types/webpack-dev-server/webpack-dev-server-tests.ts b/types/webpack-dev-server/webpack-dev-server-tests.ts index e13babe83c..5a23a60ad7 100644 --- a/types/webpack-dev-server/webpack-dev-server-tests.ts +++ b/types/webpack-dev-server/webpack-dev-server-tests.ts @@ -1,5 +1,5 @@ -import * as webpack from 'webpack'; -import * as WebpackDevServer from 'webpack-dev-server'; +import webpack = require('webpack'); +import WebpackDevServer = require('webpack-dev-server'); import * as core from 'express-serve-static-core'; const compiler = webpack({}); const multipleCompiler = webpack([]); @@ -75,7 +75,7 @@ const config: WebpackDevServer.Configuration = { // API example server = new WebpackDevServer(compiler, config); -server.listen(8080, "localhost", () => {}); +server.listen(8080, "localhost", () => { }); // HTTPS example server = new WebpackDevServer(compiler, { @@ -83,10 +83,25 @@ server = new WebpackDevServer(compiler, { https: true }); -server.listen(8080, "localhost", () => {}); +server.listen(8080, "localhost", () => { }); server.close(); -// multiple compilers +WebpackDevServer.addDevServerEntrypoints(config, { + publicPath: "/assets/", + https: true +}); +WebpackDevServer.addDevServerEntrypoints( + [config], + { + publicPath: "/assets/", + https: true + }, + { + address: () => ({ port: 80 }) + } +); + +// multiple compilers server = new WebpackDevServer(multipleCompiler, config); diff --git a/types/webpack-dotenv-plugin/index.d.ts b/types/webpack-dotenv-plugin/index.d.ts index 4200c3b15e..b8cfb33ef8 100644 --- a/types/webpack-dotenv-plugin/index.d.ts +++ b/types/webpack-dotenv-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/nwinch/webpack-dotenv-plugin#readme // Definitions by: Michael Strobel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import * as webpack from 'webpack'; diff --git a/types/webpack-dotenv-plugin/webpack-dotenv-plugin-tests.ts b/types/webpack-dotenv-plugin/webpack-dotenv-plugin-tests.ts index 8ea3993d39..a757b7d718 100644 --- a/types/webpack-dotenv-plugin/webpack-dotenv-plugin-tests.ts +++ b/types/webpack-dotenv-plugin/webpack-dotenv-plugin-tests.ts @@ -1,5 +1,5 @@ import * as webpack from 'webpack'; -import * as DotenvPlugin from 'webpack-dotenv-plugin'; +import DotenvPlugin = require('webpack-dotenv-plugin'); const config: webpack.Configuration = { plugins: [ diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index 9d866cbba8..1f03a25647 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -31,8 +31,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: (id: string) => any) => void, chunkName?: string): void; - ensure(paths: string[], callback: (require: (id: string) => T) => void, chunkName?: string): void; + ensure(paths: string[], callback: (require: NodeRequire) => void, chunkName?: string): void; context(path: string, deep?: boolean, filter?: RegExp): 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. @@ -43,7 +42,7 @@ declare namespace __WebpackModuleApi { /** * Like require.resolve, but doesn’t include the module into the bundle. It’s a weak dependency. */ - resolveWeak(path: string): number; + resolveWeak(path: string): number | string; /** * Ensures that the dependency is available, but don’t execute it. This can be use for optimizing the position of a module in the chunks. */ diff --git a/types/webpack-fail-plugin/index.d.ts b/types/webpack-fail-plugin/index.d.ts index 04f037e084..2db28733c2 100644 --- a/types/webpack-fail-plugin/index.d.ts +++ b/types/webpack-fail-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/TiddoLangerak/webpack-fail-plugin // Definitions by: Simon Hartcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts b/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts index e654d012d0..b87b379379 100644 --- a/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts +++ b/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts @@ -1,6 +1,6 @@ -import * as express from 'express'; -import * as webpack from 'webpack'; -import * as webpackHotMiddleware from 'webpack-hot-middleware'; +import express = require('express'); +import webpack = require('webpack'); +import webpackHotMiddleware = require('webpack-hot-middleware'); const compiler = webpack({}); diff --git a/types/webpack-manifest-plugin/tsconfig.json b/types/webpack-manifest-plugin/tsconfig.json index 9ff3d85f05..bc7e4e0c08 100644 --- a/types/webpack-manifest-plugin/tsconfig.json +++ b/types/webpack-manifest-plugin/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "webpack-manifest-plugin-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/webpack-merge/index.d.ts b/types/webpack-merge/index.d.ts index 54c94a738e..23caff9575 100644 --- a/types/webpack-merge/index.d.ts +++ b/types/webpack-merge/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -import webpack = require('webpack'); +import { Configuration } from 'webpack'; export = webpackMerge; @@ -18,18 +18,18 @@ declare namespace webpackMerge { customizeArray?: CustomizeArrayFunction | UniqueFunction; customizeObject?: CustomizeObjectFunction; } - type ConfigurationMergeFunction = (...configs: webpack.Configuration[]) => webpack.Configuration; + type ConfigurationMergeFunction = (...configs: Configuration[]) => Configuration; type ConfigurationMergeConfigFunction = (customizeOptions: CustomizeOptions) => ConfigurationMergeFunction; type MergeFunction = ConfigurationMergeFunction | ConfigurationMergeConfigFunction; type MergeStrategy = 'prepend' | 'append' | 'replace'; interface WebpackMerge { - (...configs: webpack.Configuration[]): webpack.Configuration; + (...configs: Configuration[]): Configuration; (customizeOptions: CustomizeOptions): ConfigurationMergeFunction; unique: UniqueFunction; smart: ConfigurationMergeFunction; multiple: ConfigurationMergeFunction; - strategy(options: {[field: string]: MergeStrategy}): ConfigurationMergeFunction; - smartStrategy(options: {[key: string]: MergeStrategy}): ConfigurationMergeFunction; + strategy(options: { [field: string]: MergeStrategy }): ConfigurationMergeFunction; + smartStrategy(options: { [key: string]: MergeStrategy }): ConfigurationMergeFunction; } } diff --git a/types/webpack-merge/v0/index.d.ts b/types/webpack-merge/v0/index.d.ts index a939a2ed53..4cf82afd88 100644 --- a/types/webpack-merge/v0/index.d.ts +++ b/types/webpack-merge/v0/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/survivejs/webpack-merge // Definitions by: Simon Hartcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack-node-externals/index.d.ts b/types/webpack-node-externals/index.d.ts index e1a4078c26..c93d3edecf 100644 --- a/types/webpack-node-externals/index.d.ts +++ b/types/webpack-node-externals/index.d.ts @@ -2,12 +2,13 @@ // Project: https://github.com/liady/webpack-node-externals // Definitions by: Matt Traynham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import webpack = require('webpack'); +import { ExternalsFunctionElement } from 'webpack'; export = webpackNodeExternals; -declare function webpackNodeExternals(options?: webpackNodeExternals.Options): webpack.ExternalsFunctionElement; +declare function webpackNodeExternals(options?: webpackNodeExternals.Options): ExternalsFunctionElement; declare namespace webpackNodeExternals { type WhitelistOption = string | RegExp; @@ -22,7 +23,7 @@ declare namespace webpackNodeExternals { * they should be bundled. * @default [] */ - whitelist?: WhitelistOption[]; + whitelist?: WhitelistOption[] | WhitelistOption; /** * @default ['.bin'] */ diff --git a/types/webpack-notifier/index.d.ts b/types/webpack-notifier/index.d.ts index 1b8e92651f..372b4f2b1c 100644 --- a/types/webpack-notifier/index.d.ts +++ b/types/webpack-notifier/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Turbo87/webpack-notifier#readme // Definitions by: Benjamin Lim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack'; diff --git a/types/webpack-notifier/webpack-notifier-tests.ts b/types/webpack-notifier/webpack-notifier-tests.ts index f71fe5800f..ad73a10764 100644 --- a/types/webpack-notifier/webpack-notifier-tests.ts +++ b/types/webpack-notifier/webpack-notifier-tests.ts @@ -1,5 +1,5 @@ import { Plugin } from 'webpack'; -import * as WebpackNotifierPlugin from 'webpack-notifier'; +import WebpackNotifierPlugin = require('webpack-notifier'); const optionsArray: WebpackNotifierPlugin.Options[] = [ { diff --git a/types/webpack-stream/index.d.ts b/types/webpack-stream/index.d.ts index 41fbb3592b..19159f402d 100644 --- a/types/webpack-stream/index.d.ts +++ b/types/webpack-stream/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/shama/webpack-stream // Definitions by: Ian Clanton-Thuon , Benjamin Lim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack-stream/webpack-stream-tests.ts b/types/webpack-stream/webpack-stream-tests.ts index b6e4cce807..15ec19c7bd 100644 --- a/types/webpack-stream/webpack-stream-tests.ts +++ b/types/webpack-stream/webpack-stream-tests.ts @@ -1,5 +1,5 @@ import * as webpack from 'webpack'; -import * as webpackStream from 'webpack-stream'; +import webpackStream = require('webpack-stream'); let output: NodeJS.ReadWriteStream; diff --git a/types/webpack-validator/index.d.ts b/types/webpack-validator/index.d.ts index 4b6b260877..242a71e6f4 100644 --- a/types/webpack-validator/index.d.ts +++ b/types/webpack-validator/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/js-dxtools/webpack-validator // Definitions by: Simon Hartcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 18eed1cc7a..d6102808b6 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -8,12 +8,16 @@ // Jonathan Creamer // Ahmed T. Ali // Alan Agius +// Spencer Elliott +// Jason Cheatham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// -import * as Tapable from 'tapable'; +import Tapable = require('tapable'); import * as UglifyJS from 'uglify-js'; +import { RawSourceMap } from 'source-map'; export = webpack; @@ -75,7 +79,7 @@ declare namespace webpack { /** Capture timing information for each module. */ profile?: boolean; /** Cache generated modules and chunks to improve performance for multiple incremental builds. */ - cache?: boolean | any; + cache?: boolean | object; /** Enter watch mode, which rebuilds on file change. */ watch?: boolean; watchOptions?: Options.WatchOptions; @@ -490,7 +494,7 @@ declare namespace webpack { */ maxEntrypointSize?: number; } - type Stats = webpack.Stats.ToStringOptions; + type Stats = Stats.ToStringOptions; type WatchOptions = ICompiler.WatchOptions; } @@ -515,7 +519,7 @@ declare namespace webpack { * It is possible to exclude a huge folder like node_modules. * It is also possible to use anymatch patterns. */ - ignored?: string | RegExp; + ignored?: string | string[] | RegExp; /** Turn on polling by passing true, or specifying a poll interval in milliseconds. */ poll?: boolean | number; } @@ -540,7 +544,7 @@ declare namespace webpack { type Handler = ICompiler.Handler; type WatchOptions = ICompiler.WatchOptions; - class Watching implements webpack.Watching { + class Watching implements Watching { constructor(compiler: Compiler, watchOptions: Watching.WatchOptions, handler: Watching.Handler); close(callback: () => void): void; @@ -853,7 +857,7 @@ declare namespace webpack { } class ProgressPlugin extends Plugin { - constructor(options?: (percentage: number, msg: string) => void); + constructor(options?: (percentage: number, msg: string, moduleProgress?: string, activeModules?: string, moduleName?: string) => void); } class EnvironmentPlugin extends Plugin { @@ -1019,7 +1023,7 @@ declare namespace webpack { namespace loader { interface Loader extends Function { - (this: LoaderContext, source: string | Buffer, sourceMap: string | Buffer): string | Buffer | void | undefined; + (this: LoaderContext, source: string | Buffer, sourceMap?: RawSourceMap): string | Buffer | void | undefined; /** * The order of chained loaders are always called from right to left. @@ -1028,7 +1032,7 @@ declare namespace webpack { * If a loader delivers a result in the pitch method the process turns around and skips the remaining loaders, * continuing with the calls to the more left loaders. data can be passed between pitch and normal call. */ - pitch?(remainingRequest: string, precedingRequest: string, data: any): any | undefined; + pitch?(remainingRequest: string, precedingRequest: string, data: any): any; /** * By default, the resource file is treated as utf-8 string and passed as String to the loader. @@ -1039,7 +1043,7 @@ declare namespace webpack { raw?: boolean; } - type loaderCallback = (err: Error | undefined | null, content?: string | Buffer, sourceMap?: string | Buffer) => void; + type loaderCallback = (err: Error | undefined | null, content?: string | Buffer, sourceMap?: RawSourceMap) => void; interface LoaderContext { /** @@ -1258,37 +1262,40 @@ declare namespace webpack { /** @deprecated */ namespace compiler { /** @deprecated use webpack.Compiler */ + // tslint:disable-next-line:no-unnecessary-qualifier type Compiler = webpack.Compiler; /** @deprecated use webpack.Compiler.Watching */ - type Watching = webpack.Compiler.Watching; + type Watching = Compiler.Watching; /** @deprecated use webpack.Compiler.WatchOptions */ - type WatchOptions = webpack.Compiler.WatchOptions; + + type WatchOptions = Compiler.WatchOptions; /** @deprecated use webpack.Stats */ + // tslint:disable-next-line:no-unnecessary-qualifier type Stats = webpack.Stats; /** @deprecated use webpack.Stats.ToJsonOptions */ - type StatsOptions = webpack.Stats.ToJsonOptions; + type StatsOptions = Stats.ToJsonOptions; /** @deprecated use webpack.Stats.ToStringOptions */ - type StatsToStringOptions = webpack.Stats.ToStringOptions; + type StatsToStringOptions = Stats.ToStringOptions; /** @deprecated use webpack.Compiler.Handler */ - type CompilerCallback = webpack.Compiler.Handler; + type CompilerCallback = Compiler.Handler; } /** @deprecated use webpack.Options.Performance */ - type PerformanceOptions = webpack.Options.Performance; + type PerformanceOptions = Options.Performance; /** @deprecated use webpack.Options.WatchOptions */ - type WatchOptions = webpack.Options.WatchOptions; + type WatchOptions = Options.WatchOptions; /** @deprecated use webpack.EvalSourceMapDevToolPlugin.Options */ - type EvalSourceMapDevToolPluginOptions = webpack.EvalSourceMapDevToolPlugin.Options; + type EvalSourceMapDevToolPluginOptions = EvalSourceMapDevToolPlugin.Options; /** @deprecated use webpack.SourceMapDevToolPlugin.Options */ - type SourceMapDevToolPluginOptions = webpack.SourceMapDevToolPlugin.Options; + type SourceMapDevToolPluginOptions = SourceMapDevToolPlugin.Options; /** @deprecated use webpack.optimize.UglifyJsPlugin.CommentFilter */ - type UglifyCommentFunction = webpack.optimize.UglifyJsPlugin.CommentFilter; + type UglifyCommentFunction = optimize.UglifyJsPlugin.CommentFilter; /** @deprecated use webpack.optimize.UglifyJsPlugin.Options */ - type UglifyPluginOptions = webpack.optimize.UglifyJsPlugin.Options; + type UglifyPluginOptions = optimize.UglifyJsPlugin.Options; } diff --git a/types/webpack/package.json b/types/webpack/package.json new file mode 100644 index 0000000000..59c231c54c --- /dev/null +++ b/types/webpack/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "source-map": "^0.6.0" + } +} diff --git a/types/webpack/tslint.json b/types/webpack/tslint.json index 590af11d7e..b4b47a0378 100644 --- a/types/webpack/tslint.json +++ b/types/webpack/tslint.json @@ -1,10 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-any-union": false, - "no-unnecessary-qualifier": false, - "no-void-expression": false, - "space-within-parens": false - } + "extends": "dtslint/dt.json" } diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index 0816416c2c..f56dbb84b6 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -1,4 +1,5 @@ -import * as webpack from 'webpack'; +import webpack = require('webpack'); +import { RawSourceMap } from 'source-map'; const { optimize, @@ -453,6 +454,7 @@ plugin = new webpack.LoaderOptionsPlugin({ plugin = new webpack.EnvironmentPlugin(['a', 'b']); plugin = new webpack.EnvironmentPlugin({ a: true, b: 'c' }); plugin = new webpack.ProgressPlugin((percent: number, message: string) => { }); +plugin = new webpack.ProgressPlugin((percent: number, message: string, moduleProgress?: string, activeModules?: string, moduleName?: string) => { }); plugin = new webpack.HashedModuleIdsPlugin(); plugin = new webpack.HashedModuleIdsPlugin({ hashFunction: 'sha256', @@ -508,8 +510,10 @@ declare function successfullyCompiled(): void; webpack({ // configuration }, (err, stats) => { - if (err) - return handleFatalError(err); + if (err) { + handleFatalError(err); + return; + } const jsonStats = stats.toJson(); const jsonStatsWithAllOptions = stats.toJson({ assets: true, @@ -536,10 +540,13 @@ webpack({ excludeAssets: ["filter", "excluded"] }); - if (jsonStats.errors.length > 0) - return handleSoftErrors(jsonStats.errors); - if (jsonStats.warnings.length > 0) + if (jsonStats.errors.length > 0) { + handleSoftErrors(jsonStats.errors); + return; + } + if (jsonStats.warnings.length > 0) { handleWarnings(jsonStats.warnings); + } successfullyCompiled(); }); @@ -636,7 +643,7 @@ configuration = { performance, }; -function loader(this: webpack.loader.LoaderContext, source: string | Buffer, sourcemap: string | Buffer): void { +function loader(this: webpack.loader.LoaderContext, source: string | Buffer, sourcemap?: RawSourceMap): void { this.cacheable(); this.async(); diff --git a/types/webrtc/RTCPeerConnection.d.ts b/types/webrtc/RTCPeerConnection.d.ts index 472f2b0318..210ab66ddd 100644 --- a/types/webrtc/RTCPeerConnection.d.ts +++ b/types/webrtc/RTCPeerConnection.d.ts @@ -314,6 +314,7 @@ interface RTCPeerConnection extends EventTarget { addIceCandidate(candidate?: RTCIceCandidateInit | RTCIceCandidate): Promise; readonly signalingState: RTCSignalingState; + readonly connectionState: RTCPeerConnectionState; getConfiguration(): RTCConfiguration; setConfiguration(configuration: RTCConfiguration): void; diff --git a/types/webrtc/test/RTCPeerConnection.ts b/types/webrtc/test/RTCPeerConnection.ts index 95a6d45694..f99ed1c05b 100644 --- a/types/webrtc/test/RTCPeerConnection.ts +++ b/types/webrtc/test/RTCPeerConnection.ts @@ -56,6 +56,12 @@ pc.onconnectionstatechange = ev => console.log(ev.type); pc.ontrack = ev => console.log(ev.receiver); pc.ondatachannel = ev => console.log(ev.channel); +// State properties +console.log(pc.signalingState); +console.log(pc.iceGatheringState); +console.log(pc.iceConnectionState); +console.log(pc.connectionState); + // Legacy interface extensions pc.createOffer( (sdp: RTCSessionDescription) => console.log(sdp.sdp), diff --git a/types/website-scraper/website-scraper-tests.ts b/types/website-scraper/website-scraper-tests.ts index dc479d5c76..bbcb1fda9d 100644 --- a/types/website-scraper/website-scraper-tests.ts +++ b/types/website-scraper/website-scraper-tests.ts @@ -1,4 +1,4 @@ -import * as scraper from "website-scraper"; +import scraper = require("website-scraper"); scraper({ urls: [ diff --git a/types/websocket/index.d.ts b/types/websocket/index.d.ts index ab4e453e80..f67a5da142 100644 --- a/types/websocket/index.d.ts +++ b/types/websocket/index.d.ts @@ -3,7 +3,9 @@ // Definitions by: Paul Loyd , // Kay Schecker , // Zhao Lei +// Sheng Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// @@ -564,10 +566,16 @@ declare class client extends events.EventEmitter { * any scripting content that caused the connection to be requested. * @param requestUrl should be a standard websocket url */ - connect(requestUrl: url.Url, protocols?: string[], origin?: string, headers?: any[], extraRequestOptions?: http.RequestOptions): void; - connect(requestUrl: string, protocols?: string[], origin?: string, headers?: any[], extraRequestOptions?: http.RequestOptions): void; - connect(requestUrl: url.Url, protocols?: string, origin?: string, headers?: any[], extraRequestOptions?: http.RequestOptions): void; - connect(requestUrl: string, protocols?: string, origin?: string, headers?: any[], extraRequestOptions?: http.RequestOptions): void; + connect(requestUrl: url.Url, protocols?: string[], origin?: string, headers?: object, extraRequestOptions?: http.RequestOptions): void; + connect(requestUrl: string, protocols?: string[], origin?: string, headers?: object, extraRequestOptions?: http.RequestOptions): void; + connect(requestUrl: url.Url, protocols?: string, origin?: string, headers?: object, extraRequestOptions?: http.RequestOptions): void; + connect(requestUrl: string, protocols?: string, origin?: string, headers?: object, extraRequestOptions?: http.RequestOptions): void; + + /** + * Will cancel an in-progress connection request before either the `connect` event or the `connectFailed` event has been emitted. + * If the `connect` or `connectFailed` event has already been emitted, calling `abort()` will do nothing. + */ + abort(): void; // Events on(event: string, listener: () => void): this; diff --git a/types/websocket/websocket-tests.ts b/types/websocket/websocket-tests.ts index 3044f9bf7d..94f8a11e16 100644 --- a/types/websocket/websocket-tests.ts +++ b/types/websocket/websocket-tests.ts @@ -180,8 +180,18 @@ function clientTest2() { } +function testClientAbortApi() { + var ipArray = getLocalIpArray(); + var client = new websocket.client(); + client.connect(`ws://${ipArray[0]}:8888`, undefined, undefined, undefined, { + localAddress: ipArray[0] + }); + client.abort(); +} + { console.log(`websocket test start.`); serverTest2(); clientTest2(); + testClientAbortApi(); } diff --git a/types/webtorrent/webtorrent-tests.ts b/types/webtorrent/webtorrent-tests.ts index 06d8f853f3..63a9647902 100644 --- a/types/webtorrent/webtorrent-tests.ts +++ b/types/webtorrent/webtorrent-tests.ts @@ -1,4 +1,4 @@ -import * as WebTorrent from 'webtorrent'; +import WebTorrent = require('webtorrent'); import * as fs from 'fs'; const client = new WebTorrent(); diff --git a/types/weixin-app/index.d.ts b/types/weixin-app/index.d.ts index 851216466e..88d8c4bfc5 100644 --- a/types/weixin-app/index.d.ts +++ b/types/weixin-app/index.d.ts @@ -1,2133 +1,3361 @@ -// Type definitions for wx-app 1.0 +// Type definitions for wx-app 1.9 // Project: https://mp.weixin.qq.com/debug/wxadoc/dev/api/ // Definitions by: taoqf +// AlexStacker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 declare namespace wx { - interface DataResponse { - /** 回调函数返回的内容 */ - data: any; - } - interface ErrMsgResponse { - /** 成功:ok,错误:详细信息 */ - errMsg: 'ok' | string; - } - interface TempFileResponse { - /** 文件的临时路径 */ - tempFilePath: string; - } - - interface PageOptions { - /** 页面的初始数据 */ - data?: any; - /** 生命周期函数--监听页面加载 */ - onLoad?(this: Page, options: any): void; - /** 生命周期函数--监听页面渲染完成 */ - onReady?(this: Page): void; - /** 生命周期函数--监听页面显示 */ - onShow?(this: Page): void; - /** 生命周期函数--监听页面隐藏 */ - onHide?(this: Page): void; - /** 生命周期函数--监听页面卸载 */ - onUnload?(this: Page): void; - [key: string]: any; - } - - interface AppOptions { - /** - * 生命周期函数--监听小程序初始化 - * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次) - */ - onLaunch?(this: App): void; - /** - * 生命周期函数--监听小程序显示 - * 当小程序启动,或从后台进入前台显示,会触发 onShow - */ - onShow?(this: App): void; - /** - * 生命周期函数--监听小程序隐藏 - * 当小程序从前台进入后台,会触发 onHide - */ - onHide?(this: App): void; - [key: string]: any; - } - - interface BaseOptions { - /** 接口调用成功的回调函数 */ - success?(res: any): void; - /** 接口调用失败的回调函数 */ - fail?(res: any): void; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?(res: any): void; - } + // #region 基本参数 + interface DataResponse { + /** 回调函数返回的内容 */ + data: any; + } + interface ErrMsgResponse { + /** 成功:ok,错误:详细信息 */ + errMsg: 'ok' | string; + } + interface TempFileResponse { + /** 文件的临时路径 */ + tempFilePath: string; + } + interface BaseOptions { + /** 接口调用成功的回调函数 */ + success?(res: any): void; + /** 接口调用失败的回调函数 */ + fail?(res: any): void; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?(res: any): void; + } + // #endregion + // #region 网络API列表 + // 发起请求 + interface RequestHeader { + [key: string]: string; + } + interface RequestOptions extends BaseOptions { + /** 开发者服务器接口地址 */ + url: string; + /** 请求的参数 */ + data?: string | any; + /** 设置请求的 header , header 中不能设置 Referer */ + header?: RequestHeader; + /** 默认为 GET,有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT */ + method?: string; + /** 如果设为json,会尝试对返回的数据做一次 JSON.parse */ + dataType?: string; + /** + * 设置响应的数据类型。合法值:text、arraybuffer + * @version 1.7.0 + */ + responseType?: string; + /** 收到开发者服务成功返回的回调函数,res = {data: '开发者服务器返回的内容'} */ + success?(res: DataResponse): void; + } + /** + * wx.request发起的是https请求。一个微信小程序,同时只能有5个网络请求连接。 + */ + function request(options: RequestOptions): void; + interface UploadTask { + /** + * 监听上传进度变化 + * @version 1.4.0 + */ + onProgressUpdate(callback?: (res: { + /** 上传进度百分比 */ + progress: number; + /** 已经上传的数据长度,单位 Bytes */ + totalBytesSent: number; + /** 预期需要上传的数据总长度,单位 Bytes */ + totalBytesExpectedToSend: number; + }) => void): void; + /** + * 中断下载任务 + * @version 1.4.0 + */ + abort(): void; + } + // 上传下载 + interface UploadFileOptions extends BaseOptions { + /** 开发者服务器 url */ + url: string; + /** 要上传文件资源的路径 */ + filePath: string; + /** 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容 */ + name: string; + /** HTTP 请求 Header , header 中不能设置 Referer */ + header?: RequestHeader; + /** HTTP 请求中其他额外的 form data */ + formData?: any; + } + /** + * 将本地资源上传到开发者服务器。 + * 如页面通过 wx.chooseImage 等接口获取到一个本地资源的临时文件路径后, + * 可通过此接口将本地资源上传到指定服务器。 + * 客户端发起一个 HTTPS POST 请求, + * 其中 Content-Type 为 multipart/form-data 。 + */ + function uploadFile(options: UploadFileOptions): UploadTask; + interface DownloadTask { + /** + * 监听下载进度变化 + * @version 1.4.0 + */ + onProgressUpdate(callback?: (res: { + /** 下载进度百分比 */ + progress: number; + /** 已经下载的数据长度,单位 Bytes */ + totalBytesWritten: number; + /** 预期需要下载的数据总长度,单位 Bytes */ + totalBytesExpectedToWrite: number; + }) => void): void; + /** + * 中断下载任务 + * @version 1.4.0 + */ + abort(): void; + } + interface DownloadFileOptions extends BaseOptions { + /** 下载资源的 url */ + url: string; + /** 下载资源的类型,用于客户端识别处理,有效值:image/audio/video */ + type?: string; + /** HTTP 请求 Header */ + header?: RequestHeader; + /** 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'} */ + success?(res: TempFileResponse): void; + } + /** + * 下载文件资源到本地。客户端直接发起一个 HTTP GET 请求, + * 把下载到的资源根据 type 进行处理,并返回文件的本地临时路径。 + */ + function downloadFile(options: DownloadFileOptions): DownloadTask; + // WebSocket + interface ConnectSocketOptions extends BaseOptions { + /** 开发者服务器接口地址,必须是 HTTPS 协议,且域名必须是后台配置的合法域名 */ + url: string; + /** 请求的数据 */ + data?: any; + /** HTTP Header , header 中不能设置 Referer */ + header?: RequestHeader; + /** 默认是GET,有效值为: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT */ + method?: string; + /** + * 子协议数组 + * @version 1.4.0 + */ + protocols?: string[]; + } + /** + * 创建一个 WebSocket 连接; + * 一个微信小程序同时只能有一个 WebSocket 连接, + * 如果当前已存在一个 WebSocket 连接, + * 会自动关闭该连接,并重新创建一个 WebSocket 连接。 + */ + function connectSocket(options: ConnectSocketOptions): void; + /** 监听WebSocket连接打开事件。 */ + function onSocketOpen(callback: () => void): void; + /** 监听WebSocket错误。 */ + function onSocketError(callback: (error: any) => void): void; + interface SendSocketMessageOptions extends BaseOptions { + /** 需要发送的内容 */ + data: string; + } + /** + * 通过 WebSocket 连接发送数据,需要先 wx.connectSocket, + * 并在 wx.onSocketOpen 回调之后才能发送。 + */ + function sendSocketMessage(options: SendSocketMessageOptions): void; + /** + * 监听WebSocket接受到服务器的消息事件。 + */ + function onSocketMessage(callback: (res: DataResponse) => void): void; + /** + * 关闭WebSocket连接。 + */ + function closeSocket(): void; + /** 监听WebSocket关闭。 */ + function onSocketClose(callback: () => void): void; + // #endregion + // #region 媒体API列表 + // 媒体-----图片 + type ImageSizeType = 'original' | 'compressed'; + type ImageSourceType = 'album' | 'camera'; + type VideoSourceType = 'album' | 'camera'; + type CameraDevice = 'front' | 'back'; + interface TempFile { + /** 本地文件路径 */ + path: string; + /** 本地文件大小,单位:B */ + size: number; + } + interface TempFilesData { + /** 文件的临时路径 */ + tempFilePaths: string; + /** + * 图片的本地文件列表,每一项是一个 File 对象 + * @version 1.2.0 + */ + tempFiles: TempFile[]; + } + interface ChooseImageOptions extends BaseOptions { + /** 最多可以选择的图片张数,默认9 */ + count?: number; + /** original 原图,compressed 压缩图,默认二者都有 */ + sizeType?: ImageSizeType[]; + /** album 从相册选图,camera 使用相机,默认二者都有 */ + sourceType?: ImageSourceType[]; + /** 成功则返回图片的本地文件路径列表 tempFilePaths */ + success(res: TempFilesData): void; + } + /** + * 从本地相册选择图片或使用相机拍照。 + */ + function chooseImage(options: ChooseImageOptions): void; + interface PreviewImageOptions extends BaseOptions { + /** 当前显示图片的链接,不填则默认为 urls 的第一张 */ + current?: string; + /** 需要预览的图片链接列表 */ + urls: string[]; + } + /** + * 预览图片。 + */ + function previewImage(options: PreviewImageOptions): void; + interface GetImageInfoOptions extends BaseOptions { + /** + * 图片的路径,可以是相对路径,临时文件路径,存储文件路径,网络图片路径 + */ + src: string; + } + /** + * 获取图片信息 + */ + function getImageInfo(options: GetImageInfoOptions): void; + interface SaveImageToPhotosAlbumOptions extends BaseOptions { + /** + * 图片的路径,可以是相对路径,临时文件路径,存储文件路径,网络图片路径 + */ + filePath: string; + success(res: { + errMsg: string + }): void; + } + /** + * 保存图片到系统相册。 + * 需要用户授权 scope.writePhotosAlbum + * @version 1.2.0 + */ + function saveImageToPhotosAlbum(options: SaveImageToPhotosAlbumOptions): void; + // 媒体-----录音 + interface StartRecordOptions extends BaseOptions { + /** 录音成功后调用,返回录音文件的临时文件路径,res = {tempFilePath: '录音文件的临时路径'} */ + success?(res: TempFileResponse): void; + } + /** + * 开始录音。当主动调用wx.stopRecord, + * 或者录音超过1分钟时自动结束录音,返回录音文件的临时文件路径。 + * 注:文件的临时路径,在小程序本次启动期间可以正常使用, + * 如需持久保存,需在主动调用wx.saveFile,在小程序下次启动时才能访问得到。 + * @deprecated 1.6.0 + */ + function startRecord(options: StartRecordOptions): void; + interface StopRecordOptions extends BaseOptions { + success?(): void; + } + /** + * 主动调用停止录音。 + */ + function stopRecord(options?: StopRecordOptions): void; + type EncodeBitRate = 8000 | 11025 | 12000 | 16000 | 22050 | 24000 | 32000 | 44100 | 48000; + interface RecorderManagerStartOptions { + /** + * 指定录音的时长,单位 ms + * 如果传入了合法的 duration + * 在到达指定的 duration 后会自动停止录音,最大值 600000(10 分钟),默认值 60000(1 分钟) + */ + duration?: number; + /** + * 采样率,有效值 8000/16000/44100 + */ + sampleRate?: number; + /** + * 否 录音通道数,有效值 1/2 + */ + numberOfChannels?: number; + /** + * 编码码率 + * 采样率和码率有一定要求,具体有效值如下: + * 采样率 编码码率 + * + 8000 16000 ~ 48000 + * + 11025 16000 ~ 48000 + * + 12000 24000 ~ 64000 + * + 16000 24000 ~ 96000 + * + 22050 32000 ~ 128000 + * + 24000 32000 ~ 128000 + * + 32000 48000 ~ 192000 + * + 44100 64000 ~ 320000 + * + 48000 64000 ~ 320000 + */ + encodeBitRate: number; + /** 音频格式,有效值 aac/mp3 */ + format: string; + /** + * 指定帧大小,单位 KB + * 传入 frameSize 后,每录制指定帧大小的内容后 + * 会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3 格式。 + */ + frameSize: number; + } + interface OnRecorderManagerStopOptions { + tempFilePath: string; + } + interface OnFrameRecordedOptions { + /** 录音分片结果数据 */ + frameBuffer: ArrayBuffer; + /** 当前帧是否正常录音结束前的最后一帧 */ + isLastFrame: boolean; + } + interface RecorderManager { + /** 开始录音 */ + start(options?: RecorderManagerStartOptions): void; + /** 暂停录音 */ + pause(): void; + /** 继续录音 */ + resume(): void; + /** 停止录音 */ + stop(): void; + /** 录音开始事件 */ + onStart(callback?: () => void): void; + /** 录音暂停事件 */ + onPause(callback?: () => void): void; + /** 录音恢复事件 */ + onResume(callback?: () => void): void; + /** 录音停止事件,会回调文件地址 */ + onStop(callback?: (options: OnRecorderManagerStopOptions) => void): void; + /** 已录制完指定帧大小的文件,会回调录音分片结果数据。如果设置了 frameSize ,则会回调此事件 */ + onFrameRecorded(callback?: (options: OnFrameRecordedOptions) => void): void; + /** 录音错误事件, 会回调错误信息 */ + onError(callback?: (err: ErrMsgResponse) => void): void; + } + /** + * 获取全局唯一的录音管理器 recorderManager + * @version 1.6.0 + */ + function getRecorderManager(): RecorderManager; + // 媒体-----音频播放控制 + interface PlayVoiceOptions extends BaseOptions { + /** 需要播放的语音文件的文件路径 */ + filePath: string; + } + /** + * 开始播放语音,同时只允许一个语音文件正在播放, + * 如果前一个语音文件还没播放完,将中断前一个语音播放。 + * @deprecated 1.6.0 + */ + function playVoice(options: PlayVoiceOptions): void; + /** + * 暂停正在播放的语音。 + * 再次调用wx.playVoice播放同一个文件时,会从暂停处开始播放。 + * 如果想从头开始播放,需要先调用 wx.stopVoice。 + * @deprecated 1.6.0 + */ + function pauseVoice(): void; + /** + * 结束播放语音。 + * @deprecated 1.6.0 + */ + function stopVoice(): void; + // 媒体-----音乐播放控制 + interface BackgroundAudioPlayerState { + /** 选定音频的长度(单位:s),只有在当前有音乐播放时返回 */ + duration: number; + /** 选定音频的播放位置(单位:s),只有在当前有音乐播放时返回 */ + currentPosition: number; + /** 播放状态(2:没有音乐在播放,1:播放中,0:暂停中) */ + status: number; + /** 音频的下载进度(整数,80 代表 80%),只有在当前有音乐播放时返回 */ + downloadPercent: number; + /** 歌曲数据链接,只有在当前有音乐播放时返回 */ + dataUrl: string; + } + interface GetBackgroundAudioPlayerStateOptions extends BaseOptions { + /** 接口调用成功的回调函数 */ + success?(state: BackgroundAudioPlayerState): void; + /** 接口调用失败的回调函数 */ + fail?(): void; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?(): void; + } + /** + * 获取音乐播放状态。 + * @deprecated 1.2.0 + */ + function getBackgroundAudioPlayerState(options: GetBackgroundAudioPlayerStateOptions): void; + interface PlayBackgroundAudioOptions extends BaseOptions { + /** 音乐链接 */ + dataUrl: string; + /** 音乐标题 */ + title?: string; + /** 封面URL */ + coverImgUrl?: string; + } + /** + * 播放音乐,同时只能有一首音乐正在播放。 + * @deprecated 1.2.0 + */ + function playBackgroundAudio(options: PlayBackgroundAudioOptions): void; + /** + * 暂停播放音乐。 + * @deprecated 1.2.0 + */ + function pauseBackgroundAudio(options?: PlayBackgroundAudioOptions): void; + interface SeekBackgroundAudioOptions extends BaseOptions { + /** 音乐位置,单位:秒 */ + position: number; + } + /** + * 控制音乐播放进度。 + * @deprecated 1.2.0 + */ + function seekBackgroundAudio(options: SeekBackgroundAudioOptions): void; + /** + * 停止播放音乐。 + * @deprecated 1.2.0 + */ + function stopBackgroundAudio(options?: PlayBackgroundAudioOptions): void; + /** + * 监听音乐播放。 + * @deprecated 1.2.0 + */ + function onBackgroundAudioPlay(callback: () => void): void; + /** + * 监听音乐暂停。 + * @deprecated 1.2.0 + */ + function onBackgroundAudioPause(callback: () => void): void; + /** + * 监听音乐停止。 + * @deprecated 1.2.0 + */ + function onBackgroundAudioStop(callback: () => void): void; + interface BackgroundAudioManager { + /** 当前音频的长度(单位:s),只有在当前有合法的 src 时返回 */ + readonly duration: number; + /** 当前音频的播放位置(单位:s),只有在当前有合法的 src 时返回 */ + readonly currentTime: number; + /** 当前是是否暂停或停止状态,true 表示暂停或停止,false 表示正在播放 */ + readonly paused: boolean; + /** 音频的数据源,默认为空字符串,当设置了新的 src 时,会自动开始播放 ,目前支持的格式有 m4a, aac, mp3, wav */ + src: string; + /** 音频开始播放的位置(单位:s) */ + startTime: number; + /** 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲。 是 */ + buffered: number; + /** 音频标题,用于做原生音频播放器音频标题。原生音频播放器中的分享功能,分享出去的卡片标题,也将使用该值。 */ + title: string; + /** 专辑名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值 */ + epname: string; + /** 歌手名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值 */ + singer: string; + /** 封面图url,用于做原生音频播放器背景图。原生音频播放器中的分享功能,分享出去的卡片配图及背景也将使用该图。 */ + coverImgUrl: string; + /** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值 */ + webUrl: string; + /** 播放 */ + play(): void; + /** 暂停 */ + pause(): void; + /** 停止 */ + stop(): void; + /** 跳转到指定位置,单位 s */ + seek(position: number): void; + /** 背景音频进入可以播放状态,但不保证后面可以流畅播放 */ + onCanplay(callback?: () => void): void; + /** 背景音频播放事件 */ + onPlay(callback?: () => void): void; + /** 背景音频暂停事件 */ + onPause(callback?: () => void): void; + /** 背景音频停止事件 */ + onStop(callback?: () => void): void; + /** 背景音频自然播放结束事件 */ + onEnded(callback?: () => void): void; + /** 背景音频播放进度更新事件 */ + onTimeUpdate(callback?: () => void): void; + /** 用户在系统音乐播放面板点击上一曲事件(iOS only) */ + onPrev(callback?: () => void): void; + /** 用户在系统音乐播放面板点击下一曲事件(iOS only) */ + onNext(callback?: () => void): void; + /** 背景音频播放错误事件 */ + onError(callback?: () => void): void; + /** 音频加载中事件,当音频因为数据不足,需要停下来加载时会触发 */ + onWaiting(callback?: () => void): void; + } + /** + * 获取全局唯一的背景音频管理器 backgroundAudioManager。 + * @version 1.2.0 + */ + function getBackgroundAudioManager(): BackgroundAudioManager; + // 媒体-----音频组件控制 + /** + * audioContext 通过 audioId 跟一个