From d888986101a31cd3b46f4a7e2e6d0de15e9640cb Mon Sep 17 00:00:00 2001 From: Greateck Date: Wed, 16 Jan 2019 11:21:14 +0200 Subject: [PATCH] Add Transfer Funds(STEEM/SBD) functionality --- pages/transaction-success.vue | 0 pages/wallet.vue | 80 +- patches/vue-steemconnect+0.3.1.patch | 5783 ++++++++++++++++++++++++++ 3 files changed, 5861 insertions(+), 2 deletions(-) create mode 100644 pages/transaction-success.vue create mode 100644 patches/vue-steemconnect+0.3.1.patch diff --git a/pages/transaction-success.vue b/pages/transaction-success.vue new file mode 100644 index 00000000..e69de29b diff --git a/pages/wallet.vue b/pages/wallet.vue index 210ed006..32fca59c 100644 --- a/pages/wallet.vue +++ b/pages/wallet.vue @@ -26,6 +26,35 @@ {{ this.steemPower }} {{ formattedSTEEMBalance() }} {{ formattedSTEEMBalance('1') }} +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ {{ this.error_msg}} +
+
+
+ +
+
Claimable STEEM Rewards
@@ -67,6 +96,11 @@ claimVests: '', claimSBD: '', claimWindow: '', + transferMode: 0, + transferType: 'STEEM', + error_proceeding: '', + error_msg: '', + transferAction: 'Transfer Funds', } }, components: { @@ -86,7 +120,7 @@ }, isClaimableDataAvailable () { //confirms whether we have useful claimable data to control display of the relevant section - console.log('isClaimableDataAvailable'); + //console.log('isClaimableDataAvailable'); return (parseFloat(this.claimSTEEM)>0 || parseFloat(this.claimSP) || parseFloat(this.claimVests) || @@ -167,7 +201,7 @@ //console.log(link); - this.claimWindow = window.open(link); + window.open(link); //Below would have been preferred approach, but claimRewardBalance keeps failing. Keeping here for future further exploration /* @@ -177,6 +211,48 @@ await this.$steemconnect.claimRewardBalance(this.user.account.name, this.claimSTEEM, this.claimSBD, this.claimSP); console.log('done');*/ }, + transferFunds () { + //function handles opening/closing transfer section + this.transferMode = !this.transferMode; + if (this.transferAction == 'Transfer Funds'){ + this.transferAction = 'Hide Transfer'; + }else{ + this.transferAction = 'Transfer Funds'; + } + }, + proceedTransfer () { + //function handles the actual processing of the transfer + this.error_proceeding = false; + this.error_msg = ''; + //ensure we have proper values + if (this.$refs["transfer-recipient"].value.trim() == '' || + this.$refs["transfer-amount"].value.trim() == ''){ + this.error_proceeding = true; + this.error_msg = 'Please ensure to fill all required transfer fields properly.'; + return; + } + if (isNaN(this.$refs["transfer-amount"].value.trim()) || this.$refs["transfer-amount"].value == 0){ + this.error_proceeding = true; + this.error_msg = 'The amount needs to be a positive numeric value.'; + return; + } + + //https://steemconnect.com/sign/transfer?from=mcfarhat&to=mcfarhat&amount=20.000%20STEEM&memo=test + var link = this.$steemconnect.sign('transfer', { + from: this.user.account.name, + to: this.$refs["transfer-recipient"].value, + amount: this.$refs["transfer-amount"].value + ' ' + this.transferType, + memo: this.$refs["transfer-memo"].value, + }, window.location.origin + '/wallet'); + //console.log(link); + window.open(link); + }, + transferTypeChange (e) { + //handles the drop down select option to ensure we have proper value + if(e.target.options.selectedIndex > -1) { + this.transferType = e.target.options[e.target.options.selectedIndex].value; + } + } }, async mounted () { // login diff --git a/patches/vue-steemconnect+0.3.1.patch b/patches/vue-steemconnect+0.3.1.patch new file mode 100644 index 00000000..4bc31c77 --- /dev/null +++ b/patches/vue-steemconnect+0.3.1.patch @@ -0,0 +1,5783 @@ +patch-package +--- a/node_modules/vue-steemconnect/dist/index.js ++++ b/node_modules/vue-steemconnect/dist/index.js +@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", { + value: true + }); + +-var _sc2Sdk = require('sc2-sdk'); ++var _sc2Sdk = require('steemconnect'); + +-var sc2 = require('sc2-sdk'); ++var sc2 = require('steemconnect'); + + + var VueSteemConnect = { +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/LICENSE +@@ -0,0 +1,21 @@ ++The MIT License (MIT) ++ ++Copyright (c) 2017-2018 Steemit Inc. ++ ++Permission is hereby granted, free of charge, to any person obtaining a copy ++of this software and associated documentation files (the "Software"), to deal ++in the Software without restriction, including without limitation the rights ++to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++copies of the Software, and to permit persons to whom the Software is ++furnished to do so, subject to the following conditions: ++ ++The above copyright notice and this permission notice shall be included in all ++copies or substantial portions of the Software. ++ ++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++LIABILITY, 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. +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/README.md +@@ -0,0 +1,197 @@ ++[![npm](https://img.shields.io/npm/v/steemconnect.svg)](https://www.npmjs.com/package/steemconnect) ++![CircleCI](https://img.shields.io/circleci/project/github/steemit/steemconnect.js.svg) ++[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/steemit/steemconnect.js/master/LICENSE) ++ ++# SteemConnect.js ++ ++SteemConnect JavaScript SDK. ++ ++## Getting started ++ ++To install and run SteemConnect.js, follow this quick start guide ++ ++### Install ++ ++SteemConnect.js was designed to work both in the browser and in Node.js. ++ ++#### Node.js ++To install SteemConnect.js on Node.js, open your terminal and run: ++``` ++npm i steemconnect --save ++``` ++ ++#### Browser ++ ++You can create an index.html file and include SteemConnect.js with: ++ ++```html ++ ++``` ++ ++### Usage ++ ++For general information about SteemConnect V2 and setting up your app you can follow these guides: ++ ++- [How to configure SteemConnect v2 and use it with your application](https://steemit.com/steemconnect/@noisy/how-to-configure-steemconnect-v2-and-use-it-with-your-application-how-it-works-and-how-it-is-different-from-v1) ++- [JS: Steemconnect - Steem Developer](https://developers.steem.io/tutorials-javascript/steemconnect) ++ ++## SDK Methods ++### Init SDK ++Call the Initialize() method when your app first loads to initialize the SDK: ++``` ++var sc2 = require('steemconnect'); ++ ++var api = sc2.Initialize({ ++ app: 'busy', ++ callbackURL: 'http://localhost:8000/demo/', ++ accessToken: 'access_token', ++ scope: ['vote', 'comment'] ++}); ++``` ++Parameters: ++- __app__: This is the name of the app that was registered in the SteemConnect V2 dashboard ++- __callbackURL__: This is the URL that users will be redirected to after interacting with SC2. It must be listed in the "Redirect URI(s)" list in the app settings EXACTLY the same as it is specified here ++- __accessToken__: If you have an oauth2 access token for this user already you can specify it here, otherwise you can leave it and set it later using sc2.setAccessToken(accessToken). ++- __scope__: This is a list of operations the app will be able to access on the user's account. For a complete list of scopes see: [https://github.com/steemit/steemconnect/wiki/OAuth-2#scopes](https://github.com/steemit/steemconnect/wiki/OAuth-2#scopes) ++ ++### Get Login URL ++The following method returns a URL that you can redirect the user to so that they may log in to your app through SC2: ++``` ++var link = api.getLoginURL(state); ++console.log(link) ++// => https://steemconnect.com/oauth2/authorize?client_id=[app]&redirect_uri=[callbackURL]&scope=vote,comment&state=[state] ++``` ++Parameters: ++- __state__: Data that will be passed to the callbackURL for your app after the user has logged in. ++ ++After logging in, SC2 will redirect the user to the "redirect_uri" specified in the login url above and add the following query string parameters for your app to use: ++- __access_token__: This is the oauth2 access token that is required to make any Steem API calls on behalf of the current user. Once you have this you need to tell the SC2 SDK to use it by either specifying it as a parameter to the init() method call or by calling sc2.setAccessToken([accessToken]). ++- __expires_in__: The number of seconds until the access token expires. ++- __username__: The username of the current user. ++ ++### Get user profile ++Once a user is logged in to your app you can call the following method to get the details of their account: ++``` ++api.me(function (err, res) { ++ console.log(err, res) ++}); ++``` ++If it is successful, the result will be a JSON object with the following properties: ++``` ++{ ++ account: { id: 338059, name: "yabapmatt", ...}, ++ name: "yabapmatt", ++ scope: ["vote"], ++ user: "yabapmatt", ++ user_metadata: {}, ++ _id: "yabapmatt" ++} ++``` ++ ++### Vote ++The vote() method will cast a vote on the specified post or comment from the current user: ++``` ++api.vote(voter, author, permlink, weight, function (err, res) { ++ console.log(err, res) ++}); ++``` ++Parameters: ++- __voter__: The Steem username of the current user. ++- __author__: The Steem username of the author of the post or comment. ++- __permlink__: The link to the post or comment on which to vote. This is the portion of the URL after the last "/". For example the "permlink" for this post: https://steemit.com/steem/@ned/announcing-smart-media-tokens-smts would be "announcing-smart-media-tokens-smts". ++- __weight__: The weight of the vote. 10000 equale a 100% vote. ++- __callback__: A function that is called once the vote is submitted and included in a block. If successful the "res" variable will be a JSON object containing the details of the block and the vote operation. ++ ++### Comment ++The comment() method will post a comment on an existing post or comment from the current user: ++``` ++api.comment(parentAuthor, parentPermlink, author, permlink, title, body, jsonMetadata, function (err, res) { ++ console.log(err, res) ++}); ++``` ++The comment() method is rate limited to 5 minutes per root comment (post), and 20 seconds per non-root comment (reply). ++ ++### Delete Comment ++The deleteComment() method will mark a comment as deleted. ++``` ++api.deleteComment(author, permlink, function (err, res) { ++ console.log(err, res) ++}) ++``` ++ ++### Generate hot signing link ++The sign() method creates a URL to which your app can redirect the user to perform a signed transaction on the blockchain such as a transfer or delegation: ++``` ++var link = api.sign('transfer', { ++ to: 'fabien', ++ amount: '1.000 STEEM', ++ memo: 'Hello World!', ++}, 'http://localhost:8000/demo/transfer-complete'); ++ ++console.log(link); ++// => https://steemconnect.com/sign/transfer?to=fabien&amount=1.000%20STEEM&memo=Hello%20World!&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2Fdemo%2Ftransfer-complete ++``` ++ ++### Logout ++The revokeToken() method will log the current user out of your application by revoking the access token provided to your app for that user: ++``` ++api.revokeToken(function (err, res) { ++ console.log(err, res) ++}); ++``` ++ ++### Reblog ++``` ++api.reblog(account, author, permlink, function (err, res) { ++ console.log(err, res) ++}); ++``` ++ ++### Follow ++``` ++api.follow(follower, following, function (err, res) { ++ console.log(err, res) ++}); ++``` ++ ++### Unfollow ++``` ++api.unfollow(unfollower, unfollowing, function (err, res) { ++ console.log(err, res) ++}); ++``` ++ ++### Ignore ++``` ++api.ignore(follower, following, function (err, res) { ++ console.log(err, res) ++}); ++``` ++ ++### Claim Reward Balance ++``` ++api.claimRewardBalance(account, rewardSteem, rewardSbd, rewardVests, function (err, res) { ++ console.log(err, res) ++}); ++``` ++ ++### Update User Metadata ++``` ++api.updateUserMetadata(metadata, function (err, res) { ++ console.log(err, res) ++}); ++``` ++ ++## Changelog ++ ++#### 2.0.0 ++- Update to Webpack 4, fix import issue #50 ++ ++#### 1.0.2 ++- Deprecate `v2.steemconnect.com` endpoint ++ ++#### 1.0.1 ++- Fixed response error checking. ++ ++#### 1.0.0 ++- Migrated to instance based architecture. You have to create new instance using `Initialize` function now. See documentation above. +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/dist/sc2.min.js +@@ -0,0 +1 @@ ++!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("sc2",[],e):"object"==typeof exports?exports.sc2=e():t.sc2=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=54)}([function(t,e){var r=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=r)},function(t,e){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,e,r){var n=r(25)("wks"),o=r(17),i=r(1).Symbol,u="function"==typeof i;(t.exports=function(t){return n[t]||(n[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=n},function(t,e,r){var n=r(5);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t,e,r){var n=r(1),o=r(0),i=r(13),u=r(7),s=r(6),c=function(t,e,r){var a,f,p,l=t&c.F,h=t&c.G,d=t&c.S,y=t&c.P,v=t&c.B,b=t&c.W,m=h?o:o[e]||(o[e]={}),_=m.prototype,w=h?n:d?n[e]:(n[e]||{}).prototype;for(a in h&&(r=e),r)(f=!l&&w&&void 0!==w[a])&&s(m,a)||(p=f?w[a]:r[a],m[a]=h&&"function"!=typeof w[a]?r[a]:v&&f?i(p,n):b&&w[a]==p?function(t){var e=function(e,r,n){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,r)}return new t(e,r,n)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(p):y&&"function"==typeof p?i(Function.call,p):p,y&&((m.virtual||(m.virtual={}))[a]=p,t&c.R&&_&&!_[a]&&u(_,a,p)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){var r={}.hasOwnProperty;t.exports=function(t,e){return r.call(t,e)}},function(t,e,r){var n=r(8),o=r(19);t.exports=r(9)?function(t,e,r){return n.f(t,e,o(1,r))}:function(t,e,r){return t[e]=r,t}},function(t,e,r){var n=r(3),o=r(38),i=r(28),u=Object.defineProperty;e.f=r(9)?Object.defineProperty:function(t,e,r){if(n(t),e=i(e,!0),n(r),o)try{return u(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t}},function(t,e,r){t.exports=!r(14)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,r){var n=r(58),o=r(22);t.exports=function(t){return n(o(t))}},function(t,e){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,e){t.exports=!0},function(t,e,r){var n=r(18);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports={}},function(t,e,r){var n=r(35),o=r(26);t.exports=Object.keys||function(t){return n(t,o)}},function(t,e){var r=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+n).toString(36))}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,r){var n=r(8).f,o=r(6),i=r(2)("toStringTag");t.exports=function(t,e,r){t&&!o(t=r?t:t.prototype,i)&&n(t,i,{configurable:!0,value:e})}},function(t,e,r){var n=r(22);t.exports=function(t){return Object(n(t))}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){var r=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:r)(t)}},function(t,e,r){var n=r(25)("keys"),o=r(17);t.exports=function(t){return n[t]||(n[t]=o(t))}},function(t,e,r){var n=r(0),o=r(1),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:n.version,mode:r(12)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,r){var n=r(5),o=r(1).document,i=n(o)&&n(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,r){var n=r(5);t.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!n(o=r.call(t)))return o;if(!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,r){"use strict";e.__esModule=!0;var n=u(r(61)),o=u(r(69)),i="function"==typeof o.default&&"symbol"==typeof n.default?function(t){return typeof t}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":typeof t};function u(t){return t&&t.__esModule?t:{default:t}}e.default="function"==typeof o.default&&"symbol"===i(n.default)?function(t){return void 0===t?"undefined":i(t)}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":void 0===t?"undefined":i(t)}},function(t,e,r){var n=r(3),o=r(65),i=r(26),u=r(24)("IE_PROTO"),s=function(){},c=function(){var t,e=r(27)("iframe"),n=i.length;for(e.style.display="none",r(42).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write(" ++ ++ +\ No newline at end of file +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/lib/index.js +@@ -0,0 +1,284 @@ ++'use strict'; ++ ++Object.defineProperty(exports, "__esModule", { ++ value: true ++}); ++ ++var _keys = require('babel-runtime/core-js/object/keys'); ++ ++var _keys2 = _interopRequireDefault(_keys); ++ ++var _typeof2 = require('babel-runtime/helpers/typeof'); ++ ++var _typeof3 = _interopRequireDefault(_typeof2); ++ ++var _promise = require('babel-runtime/core-js/promise'); ++ ++var _promise2 = _interopRequireDefault(_promise); ++ ++var _stringify = require('babel-runtime/core-js/json/stringify'); ++ ++var _stringify2 = _interopRequireDefault(_stringify); ++ ++var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); ++ ++var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); ++ ++var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); ++ ++var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); ++ ++var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); ++ ++var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); ++ ++var _inherits2 = require('babel-runtime/helpers/inherits'); ++ ++var _inherits3 = _interopRequireDefault(_inherits2); ++ ++var _crossFetch = require('cross-fetch'); ++ ++var _crossFetch2 = _interopRequireDefault(_crossFetch); ++ ++function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } ++ ++var SDKError = function (_Error) { ++ (0, _inherits3.default)(SDKError, _Error); ++ ++ function SDKError(message, obj) { ++ (0, _classCallCheck3.default)(this, SDKError); ++ ++ var _this = (0, _possibleConstructorReturn3.default)(this, (SDKError.__proto__ || (0, _getPrototypeOf2.default)(SDKError)).call(this, message)); ++ ++ _this.name = 'SDKError'; ++ _this.error = obj.error; ++ _this.error_description = obj.error_description; ++ if (typeof Error.captureStackTrace === 'function') { ++ Error.captureStackTrace(_this, _this.constructor); ++ } else { ++ _this.stack = new Error(message).stack; ++ } ++ return _this; ++ } ++ ++ return SDKError; ++}(Error); ++ ++function SteemConnect() { ++ this.options = { ++ baseURL: 'https://steemconnect.com', ++ app: '', ++ callbackURL: '', ++ scope: [] ++ }; ++} ++ ++SteemConnect.prototype.setBaseURL = function setBaseURL(baseURL) { ++ this.options.baseURL = baseURL; ++}; ++SteemConnect.prototype.setApp = function setApp(app) { ++ this.options.app = app; ++}; ++SteemConnect.prototype.setCallbackURL = function setCallbackURL(callbackURL) { ++ this.options.callbackURL = callbackURL; ++}; ++SteemConnect.prototype.setAccessToken = function setAccessToken(accessToken) { ++ this.options.accessToken = accessToken; ++}; ++SteemConnect.prototype.removeAccessToken = function removeAccessToken() { ++ this.options.accessToken = undefined; ++}; ++SteemConnect.prototype.setScope = function setScope(scope) { ++ this.options.scope = scope; ++}; ++ ++SteemConnect.prototype.getLoginURL = function getLoginURL(state) { ++ var loginURL = this.options.baseURL + '/oauth2/authorize?client_id=' + this.options.app + '&redirect_uri=' + encodeURIComponent(this.options.callbackURL); ++ loginURL += this.options.scope ? '&scope=' + this.options.scope.join(',') : ''; ++ loginURL += state ? '&state=' + encodeURIComponent(state) : ''; ++ return loginURL; ++}; ++ ++SteemConnect.prototype.send = function send(route, method, body, cb) { ++ var url = this.options.baseURL + '/api/' + route; ++ var promise = (0, _crossFetch2.default)(url, { ++ method: method, ++ headers: { ++ Accept: 'application/json, text/plain, */*', ++ 'Content-Type': 'application/json', ++ Authorization: this.options.accessToken ++ }, ++ body: (0, _stringify2.default)(body) ++ }).then(function (res) { ++ var json = res.json(); ++ // If the status is something other than 200 we need ++ // to reject the result since the request is not considered as a fail ++ if (res.status !== 200) { ++ return json.then(function (result) { ++ return _promise2.default.reject(new SDKError('sc2-sdk error', result)); ++ }); ++ } ++ return json; ++ }).then(function (res) { ++ if (res.error) { ++ return _promise2.default.reject(new SDKError('sc2-sdk error', res)); ++ } ++ return res; ++ }); ++ ++ if (!cb) return promise; ++ ++ return promise.then(function (res) { ++ return cb(null, res); ++ }).catch(function (err) { ++ return cb(err, null); ++ }); ++}; ++ ++SteemConnect.prototype.broadcast = function broadcast(operations, cb) { ++ return this.send('broadcast', 'POST', { operations: operations }, cb); ++}; ++ ++SteemConnect.prototype.me = function me(cb) { ++ return this.send('me', 'POST', {}, cb); ++}; ++ ++SteemConnect.prototype.vote = function vote(voter, author, permlink, weight, cb) { ++ var params = { ++ voter: voter, ++ author: author, ++ permlink: permlink, ++ weight: weight ++ }; ++ return this.broadcast([['vote', params]], cb); ++}; ++ ++SteemConnect.prototype.comment = function comment(parentAuthor, parentPermlink, author, permlink, title, body, jsonMetadata, cb) { ++ var params = { ++ parent_author: parentAuthor, ++ parent_permlink: parentPermlink, ++ author: author, ++ permlink: permlink, ++ title: title, ++ body: body, ++ json_metadata: (0, _stringify2.default)(jsonMetadata) ++ }; ++ return this.broadcast([['comment', params]], cb); ++}; ++ ++SteemConnect.prototype.deleteComment = function deleteComment(author, permlink, cb) { ++ var params = { ++ author: author, ++ permlink: permlink ++ }; ++ return this.broadcast([['delete_comment', params]], cb); ++}; ++ ++SteemConnect.prototype.reblog = function reblog(account, author, permlink, cb) { ++ var params = { ++ required_auths: [], ++ required_posting_auths: [account], ++ id: 'follow', ++ json: (0, _stringify2.default)(['reblog', { ++ account: account, ++ author: author, ++ permlink: permlink ++ }]) ++ }; ++ return this.broadcast([['custom_json', params]], cb); ++}; ++ ++SteemConnect.prototype.follow = function follow(follower, following, cb) { ++ var params = { ++ required_auths: [], ++ required_posting_auths: [follower], ++ id: 'follow', ++ json: (0, _stringify2.default)(['follow', { follower: follower, following: following, what: ['blog'] }]) ++ }; ++ return this.broadcast([['custom_json', params]], cb); ++}; ++ ++SteemConnect.prototype.unfollow = function unfollow(unfollower, unfollowing, cb) { ++ var params = { ++ required_auths: [], ++ required_posting_auths: [unfollower], ++ id: 'follow', ++ json: (0, _stringify2.default)(['follow', { follower: unfollower, following: unfollowing, what: [] }]) ++ }; ++ return this.broadcast([['custom_json', params]], cb); ++}; ++ ++SteemConnect.prototype.ignore = function ignore(follower, following, cb) { ++ var params = { ++ required_auths: [], ++ required_posting_auths: [follower], ++ id: 'follow', ++ json: (0, _stringify2.default)(['follow', { follower: follower, following: following, what: ['ignore'] }]) ++ }; ++ return this.broadcast([['custom_json', params]], cb); ++}; ++ ++SteemConnect.prototype.claimRewardBalance = function claimRewardBalance(account, rewardSteem, rewardSbd, rewardVests, cb) { ++ var params = { ++ account: account, ++ reward_steem: rewardSteem, ++ reward_sbd: rewardSbd, ++ reward_vests: rewardVests ++ }; ++ return this.broadcast([['claim_reward_balance', params]], cb); ++}; ++ ++SteemConnect.prototype.revokeToken = function revokeToken(cb) { ++ var _this2 = this; ++ ++ return this.send('oauth2/token/revoke', 'POST', { token: this.options.accessToken }, cb).then(function () { ++ return _this2.removeAccessToken(); ++ }); ++}; ++ ++SteemConnect.prototype.updateUserMetadata = function updateUserMetadata() { ++ var metadata = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; ++ var cb = arguments[1]; ++ ++ return this.send('me', 'PUT', { user_metadata: metadata }, cb); ++}; ++ ++SteemConnect.prototype.sign = function sign(name, params, redirectUri) { ++ if (typeof name !== 'string' || (typeof params === 'undefined' ? 'undefined' : (0, _typeof3.default)(params)) !== 'object') { ++ return new SDKError('sc2-sdk error', { ++ error: 'invalid_request', ++ error_description: 'Request has an invalid format' ++ }); ++ } ++ var url = this.options.baseURL + '/sign/' + name + '?'; ++ url += (0, _keys2.default)(params).map(function (key) { ++ return key + '=' + encodeURIComponent(params[key]); ++ }).join('&'); ++ url += redirectUri ? '&redirect_uri=' + encodeURIComponent(redirectUri) : ''; ++ return url; ++}; ++ ++var Initialize = function Initialize(config) { ++ var instance = new SteemConnect(); ++ ++ if (!config) { ++ throw new Error('You have to provide config'); ++ } ++ ++ if ((typeof config === 'undefined' ? 'undefined' : (0, _typeof3.default)(config)) !== 'object') { ++ throw new Error('Config must be an object'); ++ } ++ ++ if (config.baseURL) instance.setBaseURL(config.baseURL); ++ if (config.app) instance.setApp(config.app); ++ if (config.callbackURL) instance.setCallbackURL(config.callbackURL); ++ if (config.accessToken) instance.setAccessToken(config.accessToken); ++ if (config.scope) instance.setScope(config.scope); ++ ++ return instance; ++}; ++ ++exports.default = { ++ Initialize: Initialize ++}; ++module.exports = exports['default']; +\ No newline at end of file +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/cross-fetch/LICENSE +@@ -0,0 +1,21 @@ ++The MIT License (MIT) ++ ++Copyright (c) 2017 Leonardo Quixadá ++ ++Permission is hereby granted, free of charge, to any person obtaining a copy ++of this software and associated documentation files (the "Software"), to deal ++in the Software without restriction, including without limitation the rights ++to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++copies of the Software, and to permit persons to whom the Software is ++furnished to do so, subject to the following conditions: ++ ++The above copyright notice and this permission notice shall be included in all ++copies or substantial portions of the Software. ++ ++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++LIABILITY, 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. +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/cross-fetch/README.md +@@ -0,0 +1,182 @@ ++cross-fetch
++[![Build Status](https://travis-ci.org/lquixada/cross-fetch.svg?branch=master)](https://travis-ci.org/lquixada/cross-fetch) ++[![Build Status](https://saucelabs.com/buildstatus/cross-fetch)](https://saucelabs.com/u/cross-fetch) ++[![codecov](https://codecov.io/gh/lquixada/cross-fetch/branch/master/graph/badge.svg)](https://codecov.io/gh/lquixada/cross-fetch) ++[![dependencies Status](https://david-dm.org/lquixada/cross-fetch/status.svg)](https://david-dm.org/lquixada/cross-fetch) ++[![NPM Version](https://img.shields.io/npm/v/cross-fetch.svg?branch=master)](https://www.npmjs.com/package/cross-fetch) ++[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) ++================ ++ ++Universal WHATWG Fetch API for Node, Browsers and React Native. The scenario that cross-fetch really shines is when the same javascript codebase needs to run on different platforms. ++ ++- **Platform agnostic**: browsers, node or react native ++- **Optional polyfill**: it's up to you if something is going to be added to the global object or not ++- **Simple interface**: no instantiation, no configuration and no extra dependency ++- **WHATWG compliant**: it works the same way wherever your code runs ++- **Updated**: latest version of whatwg-fetch and node-fetch used ++ ++ ++* * * ++ ++## Table of Contents ++ ++- [Install](#install) ++- [Usage](#usage) ++- [Demo & API](#demo--api) ++- [FAQ](#faq) ++- [Supported environments](#supported-environments) ++- [Thanks](#thanks) ++- [License](#license) ++- [Author](#author) ++ ++* * * ++ ++## Install ++ ++```sh ++npm install --save cross-fetch ++``` ++ ++As a [ponyfill](https://github.com/sindresorhus/ponyfill): ++ ++```javascript ++// Using ES6 modules with Babel or TypeScript ++import fetch from 'cross-fetch'; ++ ++// Using CommonJS modules ++const fetch = require('cross-fetch'); ++``` ++ ++As a polyfill: ++ ++```javascript ++// Using ES6 modules ++import 'cross-fetch/polyfill'; ++ ++// Using CommonJS modules ++require('cross-fetch/polyfill'); ++``` ++ ++ ++The CDN build is also available on unpkg: ++ ++```html ++ ++``` ++ ++This adds the fetch function to the window object. Note that this is not UMD compatible. ++ ++ ++* * * ++ ++## Usage ++ ++With [promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise): ++ ++```javascript ++import fetch from 'cross-fetch'; ++// Or just: import 'cross-fetch/polyfill'; ++ ++fetch('//api.github.com/users/lquixada') ++ .then(res => { ++ if (res.status >= 400) { ++ throw new Error("Bad response from server"); ++ } ++ return res.json(); ++ }) ++ .then(user => { ++ console.log(user); ++ }) ++ .catch(err => { ++ console.error(err); ++ }); ++``` ++ ++With [async/await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function): ++ ++```javascript ++import fetch from 'cross-fetch'; ++// Or just: import 'cross-fetch/polyfill'; ++ ++(async () => { ++ try { ++ const res = await fetch('//api.github.com/users/lquixada'); ++ ++ if (res.status >= 400) { ++ throw new Error("Bad response from server"); ++ } ++ ++ const user = await res.json(); ++ ++ console.log(user); ++ } catch (err) { ++ console.error(err); ++ } ++})(); ++``` ++ ++> ⚠️ **Warning**: If you're in an environment that doesn't support Promises such as Internet Explorer, you must install an ES6 Promise compatible polyfill. [es6-promise](https://github.com/jakearchibald/es6-promise) is suggested. ++ ++ ++## Demo & API ++ ++You can find a comprehensive doc at [Github's fetch](https://github.github.io/fetch/) page. If you want to play with cross-fetch, these resources can be useful: ++ ++* [**JSFiddle playground**](https://jsfiddle.net/lquixada/3ypqgacp/) ➡️ ++* [**Public test suite**](https://lquixada.github.io/cross-fetch/test/saucelabs/) ➡️ ++ ++> **Tip**: Run theses resources on various browsers and with different settings (for instance: cross-domain requests, wrong urls or text requests). Don't forget to open the console in the test suite page and play around. ++ ++ ++## FAQ ++ ++#### Yet another fetch library? ++ ++I did a lot of research in order to find a fetch library that could be simple, cross-platform and provide polyfill as an option. There's a plethora of libs out there but none could match those requirements. ++ ++ ++#### Why not isomorphic-fetch? ++ ++My preferred library used to be [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) but it has this [bug](https://github.com/matthew-andrews/isomorphic-fetch/issues/125) that prevents it from running in a react native environment. It seems it will never be fixed since the author hasn't been committing for more than a year. That means dependencies are outdated as well. ++ ++ ++#### Why polyfill might not be a good idea? ++ ++In a word? Risk. If the spec changes in the future, it might be problematic to debug. Read more about it on [sindresorhus's ponyfill](https://github.com/sindresorhus/ponyfill#how-are-ponyfills-better-than-polyfills) page. It's up to you if you're fine with it or not. ++ ++ ++#### How does cross-fetch work? ++ ++Just like isomorphic-fetch, it is just a proxy. If you're in node, it delivers you the [node-fetch](https://www.npmjs.com/package/node-fetch) library, if you're in a browser or React Native, it delivers you the github's [whatwg-fetch](https://github.com/github/fetch/). The same strategy applies whether you're using polyfill or ponyfill. ++ ++ ++## Who's Using It? ++ ++* [VulcanJS](http://vulcanjs.org) ++* [graphql-request](https://github.com/graphcool/graphql-request) ++* [Swagger](https://swagger.io/) ++ ++ ++## Supported environments ++ ++* Node 6+ ++* React-Native ++ ++[![Build Status](https://saucelabs.com/browser-matrix/cross-fetch.svg)](https://saucelabs.com/u/cross-fetch) ++ ++ ++## Thanks ++ ++Heavily inspired by the works of [matthew-andrews](https://github.com/matthew-andrews). Kudos to him! ++ ++ ++## License ++ ++cross-fetch is licensed under the [MIT license](https://github.com/lquixada/cross-fetch/blob/master/LICENSE) © [Leonardo Quixadá](https://twitter.com/lquixada/) ++ ++ ++## Author ++ ++|[![@lquixada](https://avatars0.githubusercontent.com/u/195494?v=4&s=96)](https://github.com/lquixada)| ++|:---:| ++|[@lquixada](http://www.github.com/lquixada)| +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/cross-fetch/dist/browser-polyfill.js +@@ -0,0 +1,465 @@ ++(function(self) { ++ ++ if (self.fetch) { ++ return ++ } ++ ++ var support = { ++ searchParams: 'URLSearchParams' in self, ++ iterable: 'Symbol' in self && 'iterator' in Symbol, ++ blob: 'FileReader' in self && 'Blob' in self && (function() { ++ try { ++ new Blob(); ++ return true ++ } catch(e) { ++ return false ++ } ++ })(), ++ formData: 'FormData' in self, ++ arrayBuffer: 'ArrayBuffer' in self ++ }; ++ ++ if (support.arrayBuffer) { ++ var viewClasses = [ ++ '[object Int8Array]', ++ '[object Uint8Array]', ++ '[object Uint8ClampedArray]', ++ '[object Int16Array]', ++ '[object Uint16Array]', ++ '[object Int32Array]', ++ '[object Uint32Array]', ++ '[object Float32Array]', ++ '[object Float64Array]' ++ ]; ++ ++ var isDataView = function(obj) { ++ return obj && DataView.prototype.isPrototypeOf(obj) ++ }; ++ ++ var isArrayBufferView = ArrayBuffer.isView || function(obj) { ++ return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 ++ }; ++ } ++ ++ function normalizeName(name) { ++ if (typeof name !== 'string') { ++ name = String(name); ++ } ++ if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) { ++ throw new TypeError('Invalid character in header field name') ++ } ++ return name.toLowerCase() ++ } ++ ++ function normalizeValue(value) { ++ if (typeof value !== 'string') { ++ value = String(value); ++ } ++ return value ++ } ++ ++ // Build a destructive iterator for the value list ++ function iteratorFor(items) { ++ var iterator = { ++ next: function() { ++ var value = items.shift(); ++ return {done: value === undefined, value: value} ++ } ++ }; ++ ++ if (support.iterable) { ++ iterator[Symbol.iterator] = function() { ++ return iterator ++ }; ++ } ++ ++ return iterator ++ } ++ ++ function Headers(headers) { ++ this.map = {}; ++ ++ if (headers instanceof Headers) { ++ headers.forEach(function(value, name) { ++ this.append(name, value); ++ }, this); ++ } else if (Array.isArray(headers)) { ++ headers.forEach(function(header) { ++ this.append(header[0], header[1]); ++ }, this); ++ } else if (headers) { ++ Object.getOwnPropertyNames(headers).forEach(function(name) { ++ this.append(name, headers[name]); ++ }, this); ++ } ++ } ++ ++ Headers.prototype.append = function(name, value) { ++ name = normalizeName(name); ++ value = normalizeValue(value); ++ var oldValue = this.map[name]; ++ this.map[name] = oldValue ? oldValue+','+value : value; ++ }; ++ ++ Headers.prototype['delete'] = function(name) { ++ delete this.map[normalizeName(name)]; ++ }; ++ ++ Headers.prototype.get = function(name) { ++ name = normalizeName(name); ++ return this.has(name) ? this.map[name] : null ++ }; ++ ++ Headers.prototype.has = function(name) { ++ return this.map.hasOwnProperty(normalizeName(name)) ++ }; ++ ++ Headers.prototype.set = function(name, value) { ++ this.map[normalizeName(name)] = normalizeValue(value); ++ }; ++ ++ Headers.prototype.forEach = function(callback, thisArg) { ++ for (var name in this.map) { ++ if (this.map.hasOwnProperty(name)) { ++ callback.call(thisArg, this.map[name], name, this); ++ } ++ } ++ }; ++ ++ Headers.prototype.keys = function() { ++ var items = []; ++ this.forEach(function(value, name) { items.push(name); }); ++ return iteratorFor(items) ++ }; ++ ++ Headers.prototype.values = function() { ++ var items = []; ++ this.forEach(function(value) { items.push(value); }); ++ return iteratorFor(items) ++ }; ++ ++ Headers.prototype.entries = function() { ++ var items = []; ++ this.forEach(function(value, name) { items.push([name, value]); }); ++ return iteratorFor(items) ++ }; ++ ++ if (support.iterable) { ++ Headers.prototype[Symbol.iterator] = Headers.prototype.entries; ++ } ++ ++ function consumed(body) { ++ if (body.bodyUsed) { ++ return Promise.reject(new TypeError('Already read')) ++ } ++ body.bodyUsed = true; ++ } ++ ++ function fileReaderReady(reader) { ++ return new Promise(function(resolve, reject) { ++ reader.onload = function() { ++ resolve(reader.result); ++ }; ++ reader.onerror = function() { ++ reject(reader.error); ++ }; ++ }) ++ } ++ ++ function readBlobAsArrayBuffer(blob) { ++ var reader = new FileReader(); ++ var promise = fileReaderReady(reader); ++ reader.readAsArrayBuffer(blob); ++ return promise ++ } ++ ++ function readBlobAsText(blob) { ++ var reader = new FileReader(); ++ var promise = fileReaderReady(reader); ++ reader.readAsText(blob); ++ return promise ++ } ++ ++ function readArrayBufferAsText(buf) { ++ var view = new Uint8Array(buf); ++ var chars = new Array(view.length); ++ ++ for (var i = 0; i < view.length; i++) { ++ chars[i] = String.fromCharCode(view[i]); ++ } ++ return chars.join('') ++ } ++ ++ function bufferClone(buf) { ++ if (buf.slice) { ++ return buf.slice(0) ++ } else { ++ var view = new Uint8Array(buf.byteLength); ++ view.set(new Uint8Array(buf)); ++ return view.buffer ++ } ++ } ++ ++ function Body() { ++ this.bodyUsed = false; ++ ++ this._initBody = function(body) { ++ this._bodyInit = body; ++ if (!body) { ++ this._bodyText = ''; ++ } else if (typeof body === 'string') { ++ this._bodyText = body; ++ } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { ++ this._bodyBlob = body; ++ } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { ++ this._bodyFormData = body; ++ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { ++ this._bodyText = body.toString(); ++ } else if (support.arrayBuffer && support.blob && isDataView(body)) { ++ this._bodyArrayBuffer = bufferClone(body.buffer); ++ // IE 10-11 can't handle a DataView body. ++ this._bodyInit = new Blob([this._bodyArrayBuffer]); ++ } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { ++ this._bodyArrayBuffer = bufferClone(body); ++ } else { ++ throw new Error('unsupported BodyInit type') ++ } ++ ++ if (!this.headers.get('content-type')) { ++ if (typeof body === 'string') { ++ this.headers.set('content-type', 'text/plain;charset=UTF-8'); ++ } else if (this._bodyBlob && this._bodyBlob.type) { ++ this.headers.set('content-type', this._bodyBlob.type); ++ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { ++ this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); ++ } ++ } ++ }; ++ ++ if (support.blob) { ++ this.blob = function() { ++ var rejected = consumed(this); ++ if (rejected) { ++ return rejected ++ } ++ ++ if (this._bodyBlob) { ++ return Promise.resolve(this._bodyBlob) ++ } else if (this._bodyArrayBuffer) { ++ return Promise.resolve(new Blob([this._bodyArrayBuffer])) ++ } else if (this._bodyFormData) { ++ throw new Error('could not read FormData body as blob') ++ } else { ++ return Promise.resolve(new Blob([this._bodyText])) ++ } ++ }; ++ ++ this.arrayBuffer = function() { ++ if (this._bodyArrayBuffer) { ++ return consumed(this) || Promise.resolve(this._bodyArrayBuffer) ++ } else { ++ return this.blob().then(readBlobAsArrayBuffer) ++ } ++ }; ++ } ++ ++ this.text = function() { ++ var rejected = consumed(this); ++ if (rejected) { ++ return rejected ++ } ++ ++ if (this._bodyBlob) { ++ return readBlobAsText(this._bodyBlob) ++ } else if (this._bodyArrayBuffer) { ++ return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) ++ } else if (this._bodyFormData) { ++ throw new Error('could not read FormData body as text') ++ } else { ++ return Promise.resolve(this._bodyText) ++ } ++ }; ++ ++ if (support.formData) { ++ this.formData = function() { ++ return this.text().then(decode) ++ }; ++ } ++ ++ this.json = function() { ++ return this.text().then(JSON.parse) ++ }; ++ ++ return this ++ } ++ ++ // HTTP methods whose capitalization should be normalized ++ var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']; ++ ++ function normalizeMethod(method) { ++ var upcased = method.toUpperCase(); ++ return (methods.indexOf(upcased) > -1) ? upcased : method ++ } ++ ++ function Request(input, options) { ++ options = options || {}; ++ var body = options.body; ++ ++ if (input instanceof Request) { ++ if (input.bodyUsed) { ++ throw new TypeError('Already read') ++ } ++ this.url = input.url; ++ this.credentials = input.credentials; ++ if (!options.headers) { ++ this.headers = new Headers(input.headers); ++ } ++ this.method = input.method; ++ this.mode = input.mode; ++ if (!body && input._bodyInit != null) { ++ body = input._bodyInit; ++ input.bodyUsed = true; ++ } ++ } else { ++ this.url = String(input); ++ } ++ ++ this.credentials = options.credentials || this.credentials || 'omit'; ++ if (options.headers || !this.headers) { ++ this.headers = new Headers(options.headers); ++ } ++ this.method = normalizeMethod(options.method || this.method || 'GET'); ++ this.mode = options.mode || this.mode || null; ++ this.referrer = null; ++ ++ if ((this.method === 'GET' || this.method === 'HEAD') && body) { ++ throw new TypeError('Body not allowed for GET or HEAD requests') ++ } ++ this._initBody(body); ++ } ++ ++ Request.prototype.clone = function() { ++ return new Request(this, { body: this._bodyInit }) ++ }; ++ ++ function decode(body) { ++ var form = new FormData(); ++ body.trim().split('&').forEach(function(bytes) { ++ if (bytes) { ++ var split = bytes.split('='); ++ var name = split.shift().replace(/\+/g, ' '); ++ var value = split.join('=').replace(/\+/g, ' '); ++ form.append(decodeURIComponent(name), decodeURIComponent(value)); ++ } ++ }); ++ return form ++ } ++ ++ function parseHeaders(rawHeaders) { ++ var headers = new Headers(); ++ // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space ++ // https://tools.ietf.org/html/rfc7230#section-3.2 ++ var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); ++ preProcessedHeaders.split(/\r?\n/).forEach(function(line) { ++ var parts = line.split(':'); ++ var key = parts.shift().trim(); ++ if (key) { ++ var value = parts.join(':').trim(); ++ headers.append(key, value); ++ } ++ }); ++ return headers ++ } ++ ++ Body.call(Request.prototype); ++ ++ function Response(bodyInit, options) { ++ if (!options) { ++ options = {}; ++ } ++ ++ this.type = 'default'; ++ this.status = options.status === undefined ? 200 : options.status; ++ this.ok = this.status >= 200 && this.status < 300; ++ this.statusText = 'statusText' in options ? options.statusText : 'OK'; ++ this.headers = new Headers(options.headers); ++ this.url = options.url || ''; ++ this._initBody(bodyInit); ++ } ++ ++ Body.call(Response.prototype); ++ ++ Response.prototype.clone = function() { ++ return new Response(this._bodyInit, { ++ status: this.status, ++ statusText: this.statusText, ++ headers: new Headers(this.headers), ++ url: this.url ++ }) ++ }; ++ ++ Response.error = function() { ++ var response = new Response(null, {status: 0, statusText: ''}); ++ response.type = 'error'; ++ return response ++ }; ++ ++ var redirectStatuses = [301, 302, 303, 307, 308]; ++ ++ Response.redirect = function(url, status) { ++ if (redirectStatuses.indexOf(status) === -1) { ++ throw new RangeError('Invalid status code') ++ } ++ ++ return new Response(null, {status: status, headers: {location: url}}) ++ }; ++ ++ self.Headers = Headers; ++ self.Request = Request; ++ self.Response = Response; ++ ++ self.fetch = function(input, init) { ++ return new Promise(function(resolve, reject) { ++ var request = new Request(input, init); ++ var xhr = new XMLHttpRequest(); ++ ++ xhr.onload = function() { ++ var options = { ++ status: xhr.status, ++ statusText: xhr.statusText, ++ headers: parseHeaders(xhr.getAllResponseHeaders() || '') ++ }; ++ options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); ++ var body = 'response' in xhr ? xhr.response : xhr.responseText; ++ resolve(new Response(body, options)); ++ }; ++ ++ xhr.onerror = function() { ++ reject(new TypeError('Network request failed')); ++ }; ++ ++ xhr.ontimeout = function() { ++ reject(new TypeError('Network request failed')); ++ }; ++ ++ xhr.open(request.method, request.url, true); ++ ++ if (request.credentials === 'include') { ++ xhr.withCredentials = true; ++ } else if (request.credentials === 'omit') { ++ xhr.withCredentials = false; ++ } ++ ++ if ('responseType' in xhr && support.blob) { ++ xhr.responseType = 'blob'; ++ } ++ ++ request.headers.forEach(function(value, name) { ++ xhr.setRequestHeader(name, value); ++ }); ++ ++ xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); ++ }) ++ }; ++ self.fetch.polyfill = true; ++})(typeof self !== 'undefined' ? self : this); +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/cross-fetch/dist/browser-ponyfill.js +@@ -0,0 +1,482 @@ ++var __root__ = (function (root) { ++function F() { this.fetch = false; } ++F.prototype = root; ++return new F(); ++})(typeof self !== 'undefined' ? self : this); ++(function(self) { ++ ++(function(self) { ++ ++ if (self.fetch) { ++ return ++ } ++ ++ var support = { ++ searchParams: 'URLSearchParams' in self, ++ iterable: 'Symbol' in self && 'iterator' in Symbol, ++ blob: 'FileReader' in self && 'Blob' in self && (function() { ++ try { ++ new Blob(); ++ return true ++ } catch(e) { ++ return false ++ } ++ })(), ++ formData: 'FormData' in self, ++ arrayBuffer: 'ArrayBuffer' in self ++ }; ++ ++ if (support.arrayBuffer) { ++ var viewClasses = [ ++ '[object Int8Array]', ++ '[object Uint8Array]', ++ '[object Uint8ClampedArray]', ++ '[object Int16Array]', ++ '[object Uint16Array]', ++ '[object Int32Array]', ++ '[object Uint32Array]', ++ '[object Float32Array]', ++ '[object Float64Array]' ++ ]; ++ ++ var isDataView = function(obj) { ++ return obj && DataView.prototype.isPrototypeOf(obj) ++ }; ++ ++ var isArrayBufferView = ArrayBuffer.isView || function(obj) { ++ return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 ++ }; ++ } ++ ++ function normalizeName(name) { ++ if (typeof name !== 'string') { ++ name = String(name); ++ } ++ if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) { ++ throw new TypeError('Invalid character in header field name') ++ } ++ return name.toLowerCase() ++ } ++ ++ function normalizeValue(value) { ++ if (typeof value !== 'string') { ++ value = String(value); ++ } ++ return value ++ } ++ ++ // Build a destructive iterator for the value list ++ function iteratorFor(items) { ++ var iterator = { ++ next: function() { ++ var value = items.shift(); ++ return {done: value === undefined, value: value} ++ } ++ }; ++ ++ if (support.iterable) { ++ iterator[Symbol.iterator] = function() { ++ return iterator ++ }; ++ } ++ ++ return iterator ++ } ++ ++ function Headers(headers) { ++ this.map = {}; ++ ++ if (headers instanceof Headers) { ++ headers.forEach(function(value, name) { ++ this.append(name, value); ++ }, this); ++ } else if (Array.isArray(headers)) { ++ headers.forEach(function(header) { ++ this.append(header[0], header[1]); ++ }, this); ++ } else if (headers) { ++ Object.getOwnPropertyNames(headers).forEach(function(name) { ++ this.append(name, headers[name]); ++ }, this); ++ } ++ } ++ ++ Headers.prototype.append = function(name, value) { ++ name = normalizeName(name); ++ value = normalizeValue(value); ++ var oldValue = this.map[name]; ++ this.map[name] = oldValue ? oldValue+','+value : value; ++ }; ++ ++ Headers.prototype['delete'] = function(name) { ++ delete this.map[normalizeName(name)]; ++ }; ++ ++ Headers.prototype.get = function(name) { ++ name = normalizeName(name); ++ return this.has(name) ? this.map[name] : null ++ }; ++ ++ Headers.prototype.has = function(name) { ++ return this.map.hasOwnProperty(normalizeName(name)) ++ }; ++ ++ Headers.prototype.set = function(name, value) { ++ this.map[normalizeName(name)] = normalizeValue(value); ++ }; ++ ++ Headers.prototype.forEach = function(callback, thisArg) { ++ for (var name in this.map) { ++ if (this.map.hasOwnProperty(name)) { ++ callback.call(thisArg, this.map[name], name, this); ++ } ++ } ++ }; ++ ++ Headers.prototype.keys = function() { ++ var items = []; ++ this.forEach(function(value, name) { items.push(name); }); ++ return iteratorFor(items) ++ }; ++ ++ Headers.prototype.values = function() { ++ var items = []; ++ this.forEach(function(value) { items.push(value); }); ++ return iteratorFor(items) ++ }; ++ ++ Headers.prototype.entries = function() { ++ var items = []; ++ this.forEach(function(value, name) { items.push([name, value]); }); ++ return iteratorFor(items) ++ }; ++ ++ if (support.iterable) { ++ Headers.prototype[Symbol.iterator] = Headers.prototype.entries; ++ } ++ ++ function consumed(body) { ++ if (body.bodyUsed) { ++ return Promise.reject(new TypeError('Already read')) ++ } ++ body.bodyUsed = true; ++ } ++ ++ function fileReaderReady(reader) { ++ return new Promise(function(resolve, reject) { ++ reader.onload = function() { ++ resolve(reader.result); ++ }; ++ reader.onerror = function() { ++ reject(reader.error); ++ }; ++ }) ++ } ++ ++ function readBlobAsArrayBuffer(blob) { ++ var reader = new FileReader(); ++ var promise = fileReaderReady(reader); ++ reader.readAsArrayBuffer(blob); ++ return promise ++ } ++ ++ function readBlobAsText(blob) { ++ var reader = new FileReader(); ++ var promise = fileReaderReady(reader); ++ reader.readAsText(blob); ++ return promise ++ } ++ ++ function readArrayBufferAsText(buf) { ++ var view = new Uint8Array(buf); ++ var chars = new Array(view.length); ++ ++ for (var i = 0; i < view.length; i++) { ++ chars[i] = String.fromCharCode(view[i]); ++ } ++ return chars.join('') ++ } ++ ++ function bufferClone(buf) { ++ if (buf.slice) { ++ return buf.slice(0) ++ } else { ++ var view = new Uint8Array(buf.byteLength); ++ view.set(new Uint8Array(buf)); ++ return view.buffer ++ } ++ } ++ ++ function Body() { ++ this.bodyUsed = false; ++ ++ this._initBody = function(body) { ++ this._bodyInit = body; ++ if (!body) { ++ this._bodyText = ''; ++ } else if (typeof body === 'string') { ++ this._bodyText = body; ++ } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { ++ this._bodyBlob = body; ++ } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { ++ this._bodyFormData = body; ++ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { ++ this._bodyText = body.toString(); ++ } else if (support.arrayBuffer && support.blob && isDataView(body)) { ++ this._bodyArrayBuffer = bufferClone(body.buffer); ++ // IE 10-11 can't handle a DataView body. ++ this._bodyInit = new Blob([this._bodyArrayBuffer]); ++ } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { ++ this._bodyArrayBuffer = bufferClone(body); ++ } else { ++ throw new Error('unsupported BodyInit type') ++ } ++ ++ if (!this.headers.get('content-type')) { ++ if (typeof body === 'string') { ++ this.headers.set('content-type', 'text/plain;charset=UTF-8'); ++ } else if (this._bodyBlob && this._bodyBlob.type) { ++ this.headers.set('content-type', this._bodyBlob.type); ++ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { ++ this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); ++ } ++ } ++ }; ++ ++ if (support.blob) { ++ this.blob = function() { ++ var rejected = consumed(this); ++ if (rejected) { ++ return rejected ++ } ++ ++ if (this._bodyBlob) { ++ return Promise.resolve(this._bodyBlob) ++ } else if (this._bodyArrayBuffer) { ++ return Promise.resolve(new Blob([this._bodyArrayBuffer])) ++ } else if (this._bodyFormData) { ++ throw new Error('could not read FormData body as blob') ++ } else { ++ return Promise.resolve(new Blob([this._bodyText])) ++ } ++ }; ++ ++ this.arrayBuffer = function() { ++ if (this._bodyArrayBuffer) { ++ return consumed(this) || Promise.resolve(this._bodyArrayBuffer) ++ } else { ++ return this.blob().then(readBlobAsArrayBuffer) ++ } ++ }; ++ } ++ ++ this.text = function() { ++ var rejected = consumed(this); ++ if (rejected) { ++ return rejected ++ } ++ ++ if (this._bodyBlob) { ++ return readBlobAsText(this._bodyBlob) ++ } else if (this._bodyArrayBuffer) { ++ return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) ++ } else if (this._bodyFormData) { ++ throw new Error('could not read FormData body as text') ++ } else { ++ return Promise.resolve(this._bodyText) ++ } ++ }; ++ ++ if (support.formData) { ++ this.formData = function() { ++ return this.text().then(decode) ++ }; ++ } ++ ++ this.json = function() { ++ return this.text().then(JSON.parse) ++ }; ++ ++ return this ++ } ++ ++ // HTTP methods whose capitalization should be normalized ++ var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']; ++ ++ function normalizeMethod(method) { ++ var upcased = method.toUpperCase(); ++ return (methods.indexOf(upcased) > -1) ? upcased : method ++ } ++ ++ function Request(input, options) { ++ options = options || {}; ++ var body = options.body; ++ ++ if (input instanceof Request) { ++ if (input.bodyUsed) { ++ throw new TypeError('Already read') ++ } ++ this.url = input.url; ++ this.credentials = input.credentials; ++ if (!options.headers) { ++ this.headers = new Headers(input.headers); ++ } ++ this.method = input.method; ++ this.mode = input.mode; ++ if (!body && input._bodyInit != null) { ++ body = input._bodyInit; ++ input.bodyUsed = true; ++ } ++ } else { ++ this.url = String(input); ++ } ++ ++ this.credentials = options.credentials || this.credentials || 'omit'; ++ if (options.headers || !this.headers) { ++ this.headers = new Headers(options.headers); ++ } ++ this.method = normalizeMethod(options.method || this.method || 'GET'); ++ this.mode = options.mode || this.mode || null; ++ this.referrer = null; ++ ++ if ((this.method === 'GET' || this.method === 'HEAD') && body) { ++ throw new TypeError('Body not allowed for GET or HEAD requests') ++ } ++ this._initBody(body); ++ } ++ ++ Request.prototype.clone = function() { ++ return new Request(this, { body: this._bodyInit }) ++ }; ++ ++ function decode(body) { ++ var form = new FormData(); ++ body.trim().split('&').forEach(function(bytes) { ++ if (bytes) { ++ var split = bytes.split('='); ++ var name = split.shift().replace(/\+/g, ' '); ++ var value = split.join('=').replace(/\+/g, ' '); ++ form.append(decodeURIComponent(name), decodeURIComponent(value)); ++ } ++ }); ++ return form ++ } ++ ++ function parseHeaders(rawHeaders) { ++ var headers = new Headers(); ++ // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space ++ // https://tools.ietf.org/html/rfc7230#section-3.2 ++ var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); ++ preProcessedHeaders.split(/\r?\n/).forEach(function(line) { ++ var parts = line.split(':'); ++ var key = parts.shift().trim(); ++ if (key) { ++ var value = parts.join(':').trim(); ++ headers.append(key, value); ++ } ++ }); ++ return headers ++ } ++ ++ Body.call(Request.prototype); ++ ++ function Response(bodyInit, options) { ++ if (!options) { ++ options = {}; ++ } ++ ++ this.type = 'default'; ++ this.status = options.status === undefined ? 200 : options.status; ++ this.ok = this.status >= 200 && this.status < 300; ++ this.statusText = 'statusText' in options ? options.statusText : 'OK'; ++ this.headers = new Headers(options.headers); ++ this.url = options.url || ''; ++ this._initBody(bodyInit); ++ } ++ ++ Body.call(Response.prototype); ++ ++ Response.prototype.clone = function() { ++ return new Response(this._bodyInit, { ++ status: this.status, ++ statusText: this.statusText, ++ headers: new Headers(this.headers), ++ url: this.url ++ }) ++ }; ++ ++ Response.error = function() { ++ var response = new Response(null, {status: 0, statusText: ''}); ++ response.type = 'error'; ++ return response ++ }; ++ ++ var redirectStatuses = [301, 302, 303, 307, 308]; ++ ++ Response.redirect = function(url, status) { ++ if (redirectStatuses.indexOf(status) === -1) { ++ throw new RangeError('Invalid status code') ++ } ++ ++ return new Response(null, {status: status, headers: {location: url}}) ++ }; ++ ++ self.Headers = Headers; ++ self.Request = Request; ++ self.Response = Response; ++ ++ self.fetch = function(input, init) { ++ return new Promise(function(resolve, reject) { ++ var request = new Request(input, init); ++ var xhr = new XMLHttpRequest(); ++ ++ xhr.onload = function() { ++ var options = { ++ status: xhr.status, ++ statusText: xhr.statusText, ++ headers: parseHeaders(xhr.getAllResponseHeaders() || '') ++ }; ++ options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); ++ var body = 'response' in xhr ? xhr.response : xhr.responseText; ++ resolve(new Response(body, options)); ++ }; ++ ++ xhr.onerror = function() { ++ reject(new TypeError('Network request failed')); ++ }; ++ ++ xhr.ontimeout = function() { ++ reject(new TypeError('Network request failed')); ++ }; ++ ++ xhr.open(request.method, request.url, true); ++ ++ if (request.credentials === 'include') { ++ xhr.withCredentials = true; ++ } else if (request.credentials === 'omit') { ++ xhr.withCredentials = false; ++ } ++ ++ if ('responseType' in xhr && support.blob) { ++ xhr.responseType = 'blob'; ++ } ++ ++ request.headers.forEach(function(value, name) { ++ xhr.setRequestHeader(name, value); ++ }); ++ ++ xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); ++ }) ++ }; ++ self.fetch.polyfill = true; ++})(typeof self !== 'undefined' ? self : this); ++}).call(__root__, void(0)); ++var fetch = __root__.fetch; ++var Response = fetch.Response = __root__.Response; ++var Request = fetch.Request = __root__.Request; ++var Headers = fetch.Headers = __root__.Headers; ++if (typeof module === 'object' && module.exports) { ++module.exports = fetch; ++// Needed for TypeScript consumers without esModuleInterop. ++module.exports.default = fetch; ++} +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/cross-fetch/dist/cross-fetch.js +@@ -0,0 +1,2 @@ ++!function(t){if(!t.fetch){var e="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,s="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,n="ArrayBuffer"in t;if(n)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=function(t){return t&&DataView.prototype.isPrototypeOf(t)},h=ArrayBuffer.isView||function(t){return t&&-1 -1\n }\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue+','+value : value\n }\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n }\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n }\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n }\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n }\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n }\n\n Headers.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) { items.push(name) })\n return iteratorFor(items)\n }\n\n Headers.prototype.values = function() {\n var items = []\n this.forEach(function(value) { items.push(value) })\n return iteratorFor(items)\n }\n\n Headers.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) { items.push([name, value]) })\n return iteratorFor(items)\n }\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'omit'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n }\n\n function decode(body) {\n var form = new FormData()\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers()\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ')\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n }\n\n Body.call(Request.prototype)\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = options.status === undefined ? 200 : options.status\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = 'statusText' in options ? options.statusText : 'OK'\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n }\n\n Body.call(Response.prototype)\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n }\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n }\n\n var redirectStatuses = [301, 302, 303, 307, 308]\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n }\n\n self.Headers = Headers\n self.Request = Request\n self.Response = Response\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n var xhr = new XMLHttpRequest()\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n resolve(new Response(body, options))\n }\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.open(request.method, request.url, true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob'\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n }\n self.fetch.polyfill = true\n})(typeof self !== 'undefined' ? self : this);\n"],"names":["self","fetch","support","Symbol","Blob","e","viewClasses","isDataView","obj","DataView","prototype","isPrototypeOf","isArrayBufferView","ArrayBuffer","isView","indexOf","Object","toString","call","Headers","append","name","value","normalizeName","normalizeValue","oldValue","this","map","get","has","hasOwnProperty","set","forEach","callback","thisArg","keys","items","push","iteratorFor","values","entries","iterator","methods","Request","clone","body","_bodyInit","Body","Response","status","statusText","headers","url","error","response","type","redirectStatuses","redirect","RangeError","location","input","init","Promise","resolve","reject","request","xhr","XMLHttpRequest","onload","rawHeaders","options","getAllResponseHeaders","replace","split","line","parts","key","shift","trim","join","responseURL","responseText","onerror","TypeError","ontimeout","open","method","credentials","withCredentials","responseType","setRequestHeader","send","polyfill","String","test","toLowerCase","next","done","undefined","Array","isArray","header","getOwnPropertyNames","consumed","bodyUsed","fileReaderReady","reader","result","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","bufferClone","buf","slice","view","Uint8Array","byteLength","buffer","_initBody","_bodyText","_bodyBlob","FormData","_bodyFormData","URLSearchParams","_bodyArrayBuffer","Error","rejected","arrayBuffer","then","text","readAsText","chars","length","i","fromCharCode","readArrayBufferAsText","formData","decode","json","JSON","parse","upcased","mode","toUpperCase","referrer","form","bytes","decodeURIComponent","bodyInit","ok"],"mappings":"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"} +\ No newline at end of file +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/cross-fetch/dist/node-polyfill.js +@@ -0,0 +1,11 @@ ++var fetchNode = require('./node-ponyfill') ++var fetch = fetchNode.fetch.bind({}) ++ ++fetch.polyfill = true ++ ++if (!global.fetch) { ++ global.fetch = fetch ++ global.Response = fetchNode.Response ++ global.Headers = fetchNode.Headers ++ global.Request = fetchNode.Request ++} +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/cross-fetch/dist/node-ponyfill.js +@@ -0,0 +1,22 @@ ++var nodeFetch = require('node-fetch') ++var realFetch = nodeFetch.default || nodeFetch ++ ++var fetch = function (url, options) { ++ // Support schemaless URIs on the server for parity with the browser. ++ // Ex: //github.com/ -> https://github.com/ ++ if (/^\/\//.test(url)) { ++ url = 'https:' + url ++ } ++ return realFetch.call(this, url, options) ++} ++ ++fetch.polyfill = false ++ ++module.exports = exports = fetch ++exports.fetch = fetch ++exports.Headers = nodeFetch.Headers ++exports.Request = nodeFetch.Request ++exports.Response = nodeFetch.Response ++ ++// Needed for TypeScript consumers without esModuleInterop. ++exports.default = fetch +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/cross-fetch/index.d.ts +@@ -0,0 +1,12 @@ ++declare const fet: typeof fetch; ++declare const req: typeof Request; ++declare const res: typeof Response; ++declare const headers: typeof Headers; ++ ++declare module "cross-fetch" { ++ export const fetch: typeof fet; ++ export const Request: typeof req; ++ export const Response: typeof res; ++ export const Headers: typeof headers; ++ export default fetch; ++} +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/node-fetch/CHANGELOG.md +@@ -0,0 +1,219 @@ ++ ++Changelog ++========= ++ ++ ++# 2.x release ++ ++## v2.1.2 ++ ++- Fix: allow `Body` methods to work on ArrayBuffer`-backed `Body` objects ++- Fix: reject promise returned by `Body` methods when the accumulated `Buffer` exceeds the maximum size ++- Fix: support custom `Host` headers with any casing ++- Fix: support importing `fetch()` from TypeScript in `browser.js` ++- Fix: handle the redirect response body properly ++ ++## v2.1.1 ++ ++Fix packaging errors in v2.1.0. ++ ++## v2.1.0 ++ ++- Enhance: allow using ArrayBuffer as the `body` of a `fetch()` or `Request` ++- Fix: store HTTP headers of a `Headers` object internally with the given case, for compatibility with older servers that incorrectly treated header names in a case-sensitive manner ++- Fix: silently ignore invalid HTTP headers ++- Fix: handle HTTP redirect responses without a `Location` header just like non-redirect responses ++- Fix: include bodies when following a redirection when appropriate ++ ++## v2.0.0 ++ ++This is a major release. Check [our upgrade guide](https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md) for an overview on some key differences between v1 and v2. ++ ++### General changes ++ ++- Major: Node.js 0.10.x and 0.12.x support is dropped ++- Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports ++- Enhance: start testing on Node.js v4.x, v6.x, v8.x LTS, as well as v9.x stable ++- Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup) ++- Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings ++- Other: rewrite in ES2015 using Babel ++- Other: use Codecov for code coverage tracking ++- Other: update package.json script for npm 5 ++- Other: `encoding` module is now optional (alpha.7) ++- Other: expose browser.js through package.json, avoid bundling mishaps (alpha.9) ++- Other: allow TypeScript to `import` node-fetch by exposing default (alpha.9) ++ ++### HTTP requests ++ ++- Major: overwrite user's `Content-Length` if we can be sure our information is correct (per spec) ++- Fix: errors in a response are caught before the body is accessed ++- Fix: support WHATWG URL objects, created by `whatwg-url` package or `require('url').URL` in Node.js 7+ ++ ++### Response and Request classes ++ ++- Major: `response.text()` no longer attempts to detect encoding, instead always opting for UTF-8 (per spec); use `response.textConverted()` for the v1 behavior ++- Major: make `response.json()` throw error instead of returning an empty object on 204 no-content respose (per spec; reverts behavior changed in v1.6.2) ++- Major: internal methods are no longer exposed ++- Major: throw error when a `GET` or `HEAD` Request is constructed with a non-null body (per spec) ++- Enhance: add `response.arrayBuffer()` (also applies to Requests) ++- Enhance: add experimental `response.blob()` (also applies to Requests) ++- Enhance: `URLSearchParams` is now accepted as a body ++- Enhance: wrap `response.json()` json parsing error as `FetchError` ++- Fix: fix Request and Response with `null` body ++ ++### Headers class ++ ++- Major: remove `headers.getAll()`; make `get()` return all headers delimited by commas (per spec) ++- Enhance: make Headers iterable ++- Enhance: make Headers constructor accept an array of tuples ++- Enhance: make sure header names and values are valid in HTTP ++- Fix: coerce Headers prototype function parameters to strings, where applicable ++ ++### Documentation ++ ++- Enhance: more comprehensive API docs ++- Enhance: add a list of default headers in README ++ ++ ++# 1.x release ++ ++## backport releases (v1.7.0 and beyond) ++ ++See [changelog on 1.x branch](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) for details. ++ ++## v1.6.3 ++ ++- Enhance: error handling document to explain `FetchError` design ++- Fix: support `form-data` 2.x releases (requires `form-data` >= 2.1.0) ++ ++## v1.6.2 ++ ++- Enhance: minor document update ++- Fix: response.json() returns empty object on 204 no-content response instead of throwing a syntax error ++ ++## v1.6.1 ++ ++- Fix: if `res.body` is a non-stream non-formdata object, we will call `body.toString` and send it as a string ++- Fix: `counter` value is incorrectly set to `follow` value when wrapping Request instance ++- Fix: documentation update ++ ++## v1.6.0 ++ ++- Enhance: added `res.buffer()` api for convenience, it returns body as a Node.js buffer ++- Enhance: better old server support by handling raw deflate response ++- Enhance: skip encoding detection for non-HTML/XML response ++- Enhance: minor document update ++- Fix: HEAD request doesn't need decompression, as body is empty ++- Fix: `req.body` now accepts a Node.js buffer ++ ++## v1.5.3 ++ ++- Fix: handle 204 and 304 responses when body is empty but content-encoding is gzip/deflate ++- Fix: allow resolving response and cloned response in any order ++- Fix: avoid setting `content-length` when `form-data` body use streams ++- Fix: send DELETE request with content-length when body is present ++- Fix: allow any url when calling new Request, but still reject non-http(s) url in fetch ++ ++## v1.5.2 ++ ++- Fix: allow node.js core to handle keep-alive connection pool when passing a custom agent ++ ++## v1.5.1 ++ ++- Fix: redirect mode `manual` should work even when there is no redirection or broken redirection ++ ++## v1.5.0 ++ ++- Enhance: rejected promise now use custom `Error` (thx to @pekeler) ++- Enhance: `FetchError` contains `err.type` and `err.code`, allows for better error handling (thx to @pekeler) ++- Enhance: basic support for redirect mode `manual` and `error`, allows for location header extraction (thx to @jimmywarting for the initial PR) ++ ++## v1.4.1 ++ ++- Fix: wrapping Request instance with FormData body again should preserve the body as-is ++ ++## v1.4.0 ++ ++- Enhance: Request and Response now have `clone` method (thx to @kirill-konshin for the initial PR) ++- Enhance: Request and Response now have proper string and buffer body support (thx to @kirill-konshin) ++- Enhance: Body constructor has been refactored out (thx to @kirill-konshin) ++- Enhance: Headers now has `forEach` method (thx to @tricoder42) ++- Enhance: back to 100% code coverage ++- Fix: better form-data support (thx to @item4) ++- Fix: better character encoding detection under chunked encoding (thx to @dsuket for the initial PR) ++ ++## v1.3.3 ++ ++- Fix: make sure `Content-Length` header is set when body is string for POST/PUT/PATCH requests ++- Fix: handle body stream error, for cases such as incorrect `Content-Encoding` header ++- Fix: when following certain redirects, use `GET` on subsequent request per Fetch Spec ++- Fix: `Request` and `Response` constructors now parse headers input using `Headers` ++ ++## v1.3.2 ++ ++- Enhance: allow auto detect of form-data input (no `FormData` spec on node.js, this is form-data specific feature) ++ ++## v1.3.1 ++ ++- Enhance: allow custom host header to be set (server-side only feature, as it's a forbidden header on client-side) ++ ++## v1.3.0 ++ ++- Enhance: now `fetch.Request` is exposed as well ++ ++## v1.2.1 ++ ++- Enhance: `Headers` now normalized `Number` value to `String`, prevent common mistakes ++ ++## v1.2.0 ++ ++- Enhance: now fetch.Headers and fetch.Response are exposed, making testing easier ++ ++## v1.1.2 ++ ++- Fix: `Headers` should only support `String` and `Array` properties, and ignore others ++ ++## v1.1.1 ++ ++- Enhance: now req.headers accept both plain object and `Headers` instance ++ ++## v1.1.0 ++ ++- Enhance: timeout now also applies to response body (in case of slow response) ++- Fix: timeout is now cleared properly when fetch is done/has failed ++ ++## v1.0.6 ++ ++- Fix: less greedy content-type charset matching ++ ++## v1.0.5 ++ ++- Fix: when `follow = 0`, fetch should not follow redirect ++- Enhance: update tests for better coverage ++- Enhance: code formatting ++- Enhance: clean up doc ++ ++## v1.0.4 ++ ++- Enhance: test iojs support ++- Enhance: timeout attached to socket event only fire once per redirect ++ ++## v1.0.3 ++ ++- Fix: response size limit should reject large chunk ++- Enhance: added character encoding detection for xml, such as rss/atom feed (encoding in DTD) ++ ++## v1.0.2 ++ ++- Fix: added res.ok per spec change ++ ++## v1.0.0 ++ ++- Enhance: better test coverage and doc ++ ++ ++# 0.x release ++ ++## v0.1 ++ ++- Major: initial public release +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/node-fetch/LICENSE.md +@@ -0,0 +1,22 @@ ++The MIT License (MIT) ++ ++Copyright (c) 2016 David Frank ++ ++Permission is hereby granted, free of charge, to any person obtaining a copy ++of this software and associated documentation files (the "Software"), to deal ++in the Software without restriction, including without limitation the rights ++to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++copies of the Software, and to permit persons to whom the Software is ++furnished to do so, subject to the following conditions: ++ ++The above copyright notice and this permission notice shall be included in all ++copies or substantial portions of the Software. ++ ++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++LIABILITY, 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. ++ +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/node-fetch/README.md +@@ -0,0 +1,409 @@ ++ ++node-fetch ++========== ++ ++[![npm stable version][npm-image]][npm-url] ++[![npm next version][npm-next-image]][npm-url] ++[![build status][travis-image]][travis-url] ++[![coverage status][codecov-image]][codecov-url] ++ ++A light-weight module that brings `window.fetch` to Node.js ++ ++ ++## Motivation ++ ++Instead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime. ++ ++See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) or Leonardo Quixada's [cross-fetch](https://github.com/lquixada/cross-fetch) for isomorphic usage (exports `node-fetch` for server-side, `whatwg-fetch` for client-side). ++ ++ ++## Features ++ ++- Stay consistent with `window.fetch` API. ++- Make conscious trade-off when following [whatwg fetch spec][whatwg-fetch] and [stream spec](https://streams.spec.whatwg.org/) implementation details, document known difference. ++- Use native promise, but allow substituting it with [insert your favorite promise library]. ++- Use native stream for body, on both request and response. ++- Decode content encoding (gzip/deflate) properly, convert `res.text()` output to UTF-8 optionally. ++- Useful extensions such as timeout, redirect limit, response size limit, [explicit errors][ERROR-HANDLING.md] for troubleshooting. ++ ++ ++## Difference from client-side fetch ++ ++- See [Known Differences][LIMITS.md] for details. ++- If you happen to use a missing feature that `window.fetch` offers, feel free to open an issue. ++- Pull requests are welcomed too! ++ ++ ++## Install ++ ++Stable release (`2.x`) ++ ++```sh ++$ npm install node-fetch --save ++``` ++ ++## Usage ++ ++Note that documentation below is up-to-date with `2.x` releases, [see `1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide][UPGRADE-GUIDE.md] if you want to find out the difference. ++ ++```javascript ++import fetch from 'node-fetch'; ++// or ++// const fetch = require('node-fetch'); ++ ++// if you are using your own Promise library, set it through fetch.Promise. Eg. ++ ++// import Bluebird from 'bluebird'; ++// fetch.Promise = Bluebird; ++ ++// plain text or html ++ ++fetch('https://github.com/') ++ .then(res => res.text()) ++ .then(body => console.log(body)); ++ ++// json ++ ++fetch('https://api.github.com/users/github') ++ .then(res => res.json()) ++ .then(json => console.log(json)); ++ ++// catching network error ++// 3xx-5xx responses are NOT network errors, and should be handled in then() ++// you only need one catch() at the end of your promise chain ++ ++fetch('http://domain.invalid/') ++ .catch(err => console.error(err)); ++ ++// stream ++// the node.js way is to use stream when possible ++ ++fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') ++ .then(res => { ++ const dest = fs.createWriteStream('./octocat.png'); ++ res.body.pipe(dest); ++ }); ++ ++// buffer ++// if you prefer to cache binary data in full, use buffer() ++// note that buffer() is a node-fetch only API ++ ++import fileType from 'file-type'; ++ ++fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') ++ .then(res => res.buffer()) ++ .then(buffer => fileType(buffer)) ++ .then(type => { /* ... */ }); ++ ++// meta ++ ++fetch('https://github.com/') ++ .then(res => { ++ console.log(res.ok); ++ console.log(res.status); ++ console.log(res.statusText); ++ console.log(res.headers.raw()); ++ console.log(res.headers.get('content-type')); ++ }); ++ ++// post ++ ++fetch('http://httpbin.org/post', { method: 'POST', body: 'a=1' }) ++ .then(res => res.json()) ++ .then(json => console.log(json)); ++ ++// post with stream from file ++ ++import { createReadStream } from 'fs'; ++ ++const stream = createReadStream('input.txt'); ++fetch('http://httpbin.org/post', { method: 'POST', body: stream }) ++ .then(res => res.json()) ++ .then(json => console.log(json)); ++ ++// post with JSON ++ ++var body = { a: 1 }; ++fetch('http://httpbin.org/post', { ++ method: 'POST', ++ body: JSON.stringify(body), ++ headers: { 'Content-Type': 'application/json' }, ++}) ++ .then(res => res.json()) ++ .then(json => console.log(json)); ++ ++// post form parameters (x-www-form-urlencoded) ++ ++import { URLSearchParams } from 'url'; ++ ++const params = new URLSearchParams(); ++params.append('a', 1); ++fetch('http://httpbin.org/post', { method: 'POST', body: params }) ++ .then(res => res.json()) ++ .then(json => console.log(json)); ++ ++// post with form-data (detect multipart) ++ ++import FormData from 'form-data'; ++ ++const form = new FormData(); ++form.append('a', 1); ++fetch('http://httpbin.org/post', { method: 'POST', body: form }) ++ .then(res => res.json()) ++ .then(json => console.log(json)); ++ ++// post with form-data (custom headers) ++// note that getHeaders() is non-standard API ++ ++import FormData from 'form-data'; ++ ++const form = new FormData(); ++form.append('a', 1); ++fetch('http://httpbin.org/post', { method: 'POST', body: form, headers: form.getHeaders() }) ++ .then(res => res.json()) ++ .then(json => console.log(json)); ++ ++// node 7+ with async function ++ ++(async function () { ++ const res = await fetch('https://api.github.com/users/github'); ++ const json = await res.json(); ++ console.log(json); ++})(); ++``` ++ ++See [test cases](https://github.com/bitinn/node-fetch/blob/master/test/test.js) for more examples. ++ ++ ++## API ++ ++### fetch(url[, options]) ++ ++- `url` A string representing the URL for fetching ++- `options` [Options](#fetch-options) for the HTTP(S) request ++- Returns: Promise<[Response](#class-response)> ++ ++Perform an HTTP(S) fetch. ++ ++`url` should be an absolute url, such as `http://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected promise. ++ ++ ++#### Options ++ ++The default values are shown after each option key. ++ ++```js ++{ ++ // These properties are part of the Fetch Standard ++ method: 'GET', ++ headers: {}, // request headers. format is the identical to that accepted by the Headers constructor (see below) ++ body: null, // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream ++ redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect ++ ++ // The following properties are node-fetch extensions ++ follow: 20, // maximum redirect count. 0 to not follow redirect ++ timeout: 0, // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies) ++ compress: true, // support gzip/deflate content encoding. false to disable ++ size: 0, // maximum response body size in bytes. 0 to disable ++ agent: null // http(s).Agent instance, allows custom proxy, certificate etc. ++} ++``` ++ ++##### Default Headers ++ ++If no values are set, the following request headers will be sent automatically: ++ ++Header | Value ++----------------- | -------------------------------------------------------- ++`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_ ++`Accept` | `*/*` ++`Connection` | `close` _(when no `options.agent` is present)_ ++`Content-Length` | _(automatically calculated, if possible)_ ++`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)` ++ ++ ++### Class: Request ++ ++An HTTP(S) request containing information about URL, method, headers, and the body. This class implements the [Body](#iface-body) interface. ++ ++Due to the nature of Node.js, the following properties are not implemented at this moment: ++ ++- `type` ++- `destination` ++- `referrer` ++- `referrerPolicy` ++- `mode` ++- `credentials` ++- `cache` ++- `integrity` ++- `keepalive` ++ ++The following node-fetch extension properties are provided: ++ ++- `follow` ++- `compress` ++- `counter` ++- `agent` ++ ++See [options](#fetch-options) for exact meaning of these extensions. ++ ++#### new Request(input[, options]) ++ ++*(spec-compliant)* ++ ++- `input` A string representing a URL, or another `Request` (which will be cloned) ++- `options` [Options][#fetch-options] for the HTTP(S) request ++ ++Constructs a new `Request` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). ++ ++In most cases, directly `fetch(url, options)` is simpler than creating a `Request` object. ++ ++ ++### Class: Response ++ ++An HTTP(S) response. This class implements the [Body](#iface-body) interface. ++ ++The following properties are not implemented in node-fetch at this moment: ++ ++- `Response.error()` ++- `Response.redirect()` ++- `type` ++- `redirected` ++- `trailer` ++ ++#### new Response([body[, options]]) ++ ++*(spec-compliant)* ++ ++- `body` A string or [Readable stream][node-readable] ++- `options` A [`ResponseInit`][response-init] options dictionary ++ ++Constructs a new `Response` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response). ++ ++Because Node.js does not implement service workers (for which this class was designed), one rarely has to construct a `Response` directly. ++ ++#### response.ok ++ ++Convenience property representing if the request ended normally. Will evaluate to true if the response status was greater than or equal to 200 but smaller than 300. ++ ++ ++### Class: Headers ++ ++This class allows manipulating and iterating over a set of HTTP headers. All methods specified in the [Fetch Standard][whatwg-fetch] are implemented. ++ ++#### new Headers([init]) ++ ++*(spec-compliant)* ++ ++- `init` Optional argument to pre-fill the `Headers` object ++ ++Construct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object, or any iterable object. ++ ++```js ++// Example adapted from https://fetch.spec.whatwg.org/#example-headers-class ++ ++const meta = { ++ 'Content-Type': 'text/xml', ++ 'Breaking-Bad': '<3' ++}; ++const headers = new Headers(meta); ++ ++// The above is equivalent to ++const meta = [ ++ [ 'Content-Type', 'text/xml' ], ++ [ 'Breaking-Bad', '<3' ] ++]; ++const headers = new Headers(meta); ++ ++// You can in fact use any iterable objects, like a Map or even another Headers ++const meta = new Map(); ++meta.set('Content-Type', 'text/xml'); ++meta.set('Breaking-Bad', '<3'); ++const headers = new Headers(meta); ++const copyOfHeaders = new Headers(headers); ++``` ++ ++ ++### Interface: Body ++ ++`Body` is an abstract interface with methods that are applicable to both `Request` and `Response` classes. ++ ++The following methods are not yet implemented in node-fetch at this moment: ++ ++- `formData()` ++ ++#### body.body ++ ++*(deviation from spec)* ++ ++* Node.js [`Readable` stream][node-readable] ++ ++The data encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable]. ++ ++#### body.bodyUsed ++ ++*(spec-compliant)* ++ ++* `Boolean` ++ ++A boolean property for if this body has been consumed. Per spec, a consumed body cannot be used again. ++ ++#### body.arrayBuffer() ++#### body.blob() ++#### body.json() ++#### body.text() ++ ++*(spec-compliant)* ++ ++* Returns: Promise ++ ++Consume the body and return a promise that will resolve to one of these formats. ++ ++#### body.buffer() ++ ++*(node-fetch extension)* ++ ++* Returns: Promise<Buffer> ++ ++Consume the body and return a promise that will resolve to a Buffer. ++ ++#### body.textConverted() ++ ++*(node-fetch extension)* ++ ++* Returns: Promise<String> ++ ++Identical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8, if possible. ++ ++ ++### Class: FetchError ++ ++*(node-fetch extension)* ++ ++An operational error in the fetching process. See [ERROR-HANDLING.md][] for more info. ++ ++## License ++ ++MIT ++ ++ ++## Acknowledgement ++ ++Thanks to [github/fetch](https://github.com/github/fetch) for providing a solid implementation reference. ++ ++ ++[npm-image]: https://img.shields.io/npm/v/node-fetch.svg?style=flat-square ++[npm-next-image]: https://img.shields.io/npm/v/node-fetch/next.svg?style=flat-square ++[npm-url]: https://www.npmjs.com/package/node-fetch ++[travis-image]: https://img.shields.io/travis/bitinn/node-fetch.svg?style=flat-square ++[travis-url]: https://travis-ci.org/bitinn/node-fetch ++[codecov-image]: https://img.shields.io/codecov/c/github/bitinn/node-fetch.svg?style=flat-square ++[codecov-url]: https://codecov.io/gh/bitinn/node-fetch ++ ++[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md ++[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md ++[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md ++ ++[whatwg-fetch]: https://fetch.spec.whatwg.org/ ++[response-init]: https://fetch.spec.whatwg.org/#responseinit ++[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/node-fetch/browser.js +@@ -0,0 +1,8 @@ ++module.exports = exports = window.fetch; ++ ++// Needed for TypeScript and Webpack. ++exports.default = window.fetch.bind(window); ++ ++exports.Headers = window.Headers; ++exports.Request = window.Request; ++exports.Response = window.Response; +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/node-fetch/lib/index.es.js +@@ -0,0 +1,1550 @@ ++// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js ++// (MIT licensed) ++ ++const BUFFER = Symbol('buffer'); ++const TYPE = Symbol('type'); ++ ++class Blob { ++ constructor() { ++ this[TYPE] = ''; ++ ++ const blobParts = arguments[0]; ++ const options = arguments[1]; ++ ++ const buffers = []; ++ ++ if (blobParts) { ++ const a = blobParts; ++ const length = Number(a.length); ++ for (let i = 0; i < length; i++) { ++ const element = a[i]; ++ let buffer; ++ if (element instanceof Buffer) { ++ buffer = element; ++ } else if (ArrayBuffer.isView(element)) { ++ buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); ++ } else if (element instanceof ArrayBuffer) { ++ buffer = Buffer.from(element); ++ } else if (element instanceof Blob) { ++ buffer = element[BUFFER]; ++ } else { ++ buffer = Buffer.from(typeof element === 'string' ? element : String(element)); ++ } ++ buffers.push(buffer); ++ } ++ } ++ ++ this[BUFFER] = Buffer.concat(buffers); ++ ++ let type = options && options.type !== undefined && String(options.type).toLowerCase(); ++ if (type && !/[^\u0020-\u007E]/.test(type)) { ++ this[TYPE] = type; ++ } ++ } ++ get size() { ++ return this[BUFFER].length; ++ } ++ get type() { ++ return this[TYPE]; ++ } ++ slice() { ++ const size = this.size; ++ ++ const start = arguments[0]; ++ const end = arguments[1]; ++ let relativeStart, relativeEnd; ++ if (start === undefined) { ++ relativeStart = 0; ++ } else if (start < 0) { ++ relativeStart = Math.max(size + start, 0); ++ } else { ++ relativeStart = Math.min(start, size); ++ } ++ if (end === undefined) { ++ relativeEnd = size; ++ } else if (end < 0) { ++ relativeEnd = Math.max(size + end, 0); ++ } else { ++ relativeEnd = Math.min(end, size); ++ } ++ const span = Math.max(relativeEnd - relativeStart, 0); ++ ++ const buffer = this[BUFFER]; ++ const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); ++ const blob = new Blob([], { type: arguments[2] }); ++ blob[BUFFER] = slicedBuffer; ++ return blob; ++ } ++} ++ ++Object.defineProperties(Blob.prototype, { ++ size: { enumerable: true }, ++ type: { enumerable: true }, ++ slice: { enumerable: true } ++}); ++ ++Object.defineProperty(Blob.prototype, Symbol.toStringTag, { ++ value: 'Blob', ++ writable: false, ++ enumerable: false, ++ configurable: true ++}); ++ ++/** ++ * fetch-error.js ++ * ++ * FetchError interface for operational errors ++ */ ++ ++/** ++ * Create FetchError instance ++ * ++ * @param String message Error message for human ++ * @param String type Error type for machine ++ * @param String systemError For Node.js system error ++ * @return FetchError ++ */ ++function FetchError(message, type, systemError) { ++ Error.call(this, message); ++ ++ this.message = message; ++ this.type = type; ++ ++ // when err.type is `system`, err.code contains system error code ++ if (systemError) { ++ this.code = this.errno = systemError.code; ++ } ++ ++ // hide custom error implementation details from end-users ++ Error.captureStackTrace(this, this.constructor); ++} ++ ++FetchError.prototype = Object.create(Error.prototype); ++FetchError.prototype.constructor = FetchError; ++FetchError.prototype.name = 'FetchError'; ++ ++/** ++ * body.js ++ * ++ * Body interface provides common methods for Request and Response ++ */ ++ ++const Stream = require('stream'); ++ ++var _require = require('stream'); ++ ++const PassThrough = _require.PassThrough; ++ ++ ++let convert; ++try { ++ convert = require('encoding').convert; ++} catch (e) {} ++ ++const INTERNALS = Symbol('Body internals'); ++ ++/** ++ * Body mixin ++ * ++ * Ref: https://fetch.spec.whatwg.org/#body ++ * ++ * @param Stream body Readable stream ++ * @param Object opts Response options ++ * @return Void ++ */ ++function Body(body) { ++ var _this = this; ++ ++ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, ++ _ref$size = _ref.size; ++ ++ let size = _ref$size === undefined ? 0 : _ref$size; ++ var _ref$timeout = _ref.timeout; ++ let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; ++ ++ if (body == null) { ++ // body is undefined or null ++ body = null; ++ } else if (typeof body === 'string') { ++ // body is string ++ } else if (isURLSearchParams(body)) { ++ // body is a URLSearchParams ++ } else if (body instanceof Blob) { ++ // body is blob ++ } else if (Buffer.isBuffer(body)) { ++ // body is buffer ++ } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { ++ // body is array buffer ++ } else if (body instanceof Stream) { ++ // body is stream ++ } else { ++ // none of the above ++ // coerce to string ++ body = String(body); ++ } ++ this[INTERNALS] = { ++ body, ++ disturbed: false, ++ error: null ++ }; ++ this.size = size; ++ this.timeout = timeout; ++ ++ if (body instanceof Stream) { ++ body.on('error', function (err) { ++ _this[INTERNALS].error = new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); ++ }); ++ } ++} ++ ++Body.prototype = { ++ get body() { ++ return this[INTERNALS].body; ++ }, ++ ++ get bodyUsed() { ++ return this[INTERNALS].disturbed; ++ }, ++ ++ /** ++ * Decode response as ArrayBuffer ++ * ++ * @return Promise ++ */ ++ arrayBuffer() { ++ return consumeBody.call(this).then(function (buf) { ++ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); ++ }); ++ }, ++ ++ /** ++ * Return raw response as Blob ++ * ++ * @return Promise ++ */ ++ blob() { ++ let ct = this.headers && this.headers.get('content-type') || ''; ++ return consumeBody.call(this).then(function (buf) { ++ return Object.assign( ++ // Prevent copying ++ new Blob([], { ++ type: ct.toLowerCase() ++ }), { ++ [BUFFER]: buf ++ }); ++ }); ++ }, ++ ++ /** ++ * Decode response as json ++ * ++ * @return Promise ++ */ ++ json() { ++ var _this2 = this; ++ ++ return consumeBody.call(this).then(function (buffer) { ++ try { ++ return JSON.parse(buffer.toString()); ++ } catch (err) { ++ return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); ++ } ++ }); ++ }, ++ ++ /** ++ * Decode response as text ++ * ++ * @return Promise ++ */ ++ text() { ++ return consumeBody.call(this).then(function (buffer) { ++ return buffer.toString(); ++ }); ++ }, ++ ++ /** ++ * Decode response as buffer (non-spec api) ++ * ++ * @return Promise ++ */ ++ buffer() { ++ return consumeBody.call(this); ++ }, ++ ++ /** ++ * Decode response as text, while automatically detecting the encoding and ++ * trying to decode to UTF-8 (non-spec api) ++ * ++ * @return Promise ++ */ ++ textConverted() { ++ var _this3 = this; ++ ++ return consumeBody.call(this).then(function (buffer) { ++ return convertBody(buffer, _this3.headers); ++ }); ++ } ++ ++}; ++ ++// In browsers, all properties are enumerable. ++Object.defineProperties(Body.prototype, { ++ body: { enumerable: true }, ++ bodyUsed: { enumerable: true }, ++ arrayBuffer: { enumerable: true }, ++ blob: { enumerable: true }, ++ json: { enumerable: true }, ++ text: { enumerable: true } ++}); ++ ++Body.mixIn = function (proto) { ++ for (const name of Object.getOwnPropertyNames(Body.prototype)) { ++ // istanbul ignore else: future proof ++ if (!(name in proto)) { ++ const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); ++ Object.defineProperty(proto, name, desc); ++ } ++ } ++}; ++ ++/** ++ * Consume and convert an entire Body to a Buffer. ++ * ++ * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body ++ * ++ * @return Promise ++ */ ++function consumeBody() { ++ var _this4 = this; ++ ++ if (this[INTERNALS].disturbed) { ++ return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); ++ } ++ ++ this[INTERNALS].disturbed = true; ++ ++ if (this[INTERNALS].error) { ++ return Body.Promise.reject(this[INTERNALS].error); ++ } ++ ++ // body is null ++ if (this.body === null) { ++ return Body.Promise.resolve(Buffer.alloc(0)); ++ } ++ ++ // body is string ++ if (typeof this.body === 'string') { ++ return Body.Promise.resolve(Buffer.from(this.body)); ++ } ++ ++ // body is blob ++ if (this.body instanceof Blob) { ++ return Body.Promise.resolve(this.body[BUFFER]); ++ } ++ ++ // body is buffer ++ if (Buffer.isBuffer(this.body)) { ++ return Body.Promise.resolve(this.body); ++ } ++ ++ // body is buffer ++ if (Object.prototype.toString.call(this.body) === '[object ArrayBuffer]') { ++ return Body.Promise.resolve(Buffer.from(this.body)); ++ } ++ ++ // istanbul ignore if: should never happen ++ if (!(this.body instanceof Stream)) { ++ return Body.Promise.resolve(Buffer.alloc(0)); ++ } ++ ++ // body is stream ++ // get ready to actually consume the body ++ let accum = []; ++ let accumBytes = 0; ++ let abort = false; ++ ++ return new Body.Promise(function (resolve, reject) { ++ let resTimeout; ++ ++ // allow timeout on slow response body ++ if (_this4.timeout) { ++ resTimeout = setTimeout(function () { ++ abort = true; ++ reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); ++ }, _this4.timeout); ++ } ++ ++ // handle stream error, such as incorrect content-encoding ++ _this4.body.on('error', function (err) { ++ reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); ++ }); ++ ++ _this4.body.on('data', function (chunk) { ++ if (abort || chunk === null) { ++ return; ++ } ++ ++ if (_this4.size && accumBytes + chunk.length > _this4.size) { ++ abort = true; ++ reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); ++ return; ++ } ++ ++ accumBytes += chunk.length; ++ accum.push(chunk); ++ }); ++ ++ _this4.body.on('end', function () { ++ if (abort) { ++ return; ++ } ++ ++ clearTimeout(resTimeout); ++ ++ try { ++ resolve(Buffer.concat(accum)); ++ } catch (err) { ++ // handle streams that have accumulated too much data (issue #414) ++ reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); ++ } ++ }); ++ }); ++} ++ ++/** ++ * Detect buffer encoding and convert to target encoding ++ * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding ++ * ++ * @param Buffer buffer Incoming buffer ++ * @param String encoding Target encoding ++ * @return String ++ */ ++function convertBody(buffer, headers) { ++ if (typeof convert !== 'function') { ++ throw new Error('The package `encoding` must be installed to use the textConverted() function'); ++ } ++ ++ const ct = headers.get('content-type'); ++ let charset = 'utf-8'; ++ let res, str; ++ ++ // header ++ if (ct) { ++ res = /charset=([^;]*)/i.exec(ct); ++ } ++ ++ // no charset in content type, peek at response body for at most 1024 bytes ++ str = buffer.slice(0, 1024).toString(); ++ ++ // html5 ++ if (!res && str) { ++ res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; ++ ++ this[MAP] = Object.create(null); ++ ++ if (init instanceof Headers) { ++ const rawHeaders = init.raw(); ++ const headerNames = Object.keys(rawHeaders); ++ ++ for (const headerName of headerNames) { ++ for (const value of rawHeaders[headerName]) { ++ this.append(headerName, value); ++ } ++ } ++ ++ return; ++ } ++ ++ // We don't worry about converting prop to ByteString here as append() ++ // will handle it. ++ if (init == null) { ++ // no op ++ } else if (typeof init === 'object') { ++ const method = init[Symbol.iterator]; ++ if (method != null) { ++ if (typeof method !== 'function') { ++ throw new TypeError('Header pairs must be iterable'); ++ } ++ ++ // sequence> ++ // Note: per spec we have to first exhaust the lists then process them ++ const pairs = []; ++ for (const pair of init) { ++ if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { ++ throw new TypeError('Each header pair must be iterable'); ++ } ++ pairs.push(Array.from(pair)); ++ } ++ ++ for (const pair of pairs) { ++ if (pair.length !== 2) { ++ throw new TypeError('Each header pair must be a name/value tuple'); ++ } ++ this.append(pair[0], pair[1]); ++ } ++ } else { ++ // record ++ for (const key of Object.keys(init)) { ++ const value = init[key]; ++ this.append(key, value); ++ } ++ } ++ } else { ++ throw new TypeError('Provided initializer must be an object'); ++ } ++ } ++ ++ /** ++ * Return combined header value given name ++ * ++ * @param String name Header name ++ * @return Mixed ++ */ ++ get(name) { ++ name = `${name}`; ++ validateName(name); ++ const key = find(this[MAP], name); ++ if (key === undefined) { ++ return null; ++ } ++ ++ return this[MAP][key].join(', '); ++ } ++ ++ /** ++ * Iterate over all headers ++ * ++ * @param Function callback Executed for each item with parameters (value, name, thisArg) ++ * @param Boolean thisArg `this` context for callback function ++ * @return Void ++ */ ++ forEach(callback) { ++ let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; ++ ++ let pairs = getHeaders(this); ++ let i = 0; ++ while (i < pairs.length) { ++ var _pairs$i = pairs[i]; ++ const name = _pairs$i[0], ++ value = _pairs$i[1]; ++ ++ callback.call(thisArg, value, name, this); ++ pairs = getHeaders(this); ++ i++; ++ } ++ } ++ ++ /** ++ * Overwrite header values given name ++ * ++ * @param String name Header name ++ * @param String value Header value ++ * @return Void ++ */ ++ set(name, value) { ++ name = `${name}`; ++ value = `${value}`; ++ validateName(name); ++ validateValue(value); ++ const key = find(this[MAP], name); ++ this[MAP][key !== undefined ? key : name] = [value]; ++ } ++ ++ /** ++ * Append a value onto existing header ++ * ++ * @param String name Header name ++ * @param String value Header value ++ * @return Void ++ */ ++ append(name, value) { ++ name = `${name}`; ++ value = `${value}`; ++ validateName(name); ++ validateValue(value); ++ const key = find(this[MAP], name); ++ if (key !== undefined) { ++ this[MAP][key].push(value); ++ } else { ++ this[MAP][name] = [value]; ++ } ++ } ++ ++ /** ++ * Check for header name existence ++ * ++ * @param String name Header name ++ * @return Boolean ++ */ ++ has(name) { ++ name = `${name}`; ++ validateName(name); ++ return find(this[MAP], name) !== undefined; ++ } ++ ++ /** ++ * Delete all header values given name ++ * ++ * @param String name Header name ++ * @return Void ++ */ ++ delete(name) { ++ name = `${name}`; ++ validateName(name); ++ const key = find(this[MAP], name); ++ if (key !== undefined) { ++ delete this[MAP][key]; ++ } ++ } ++ ++ /** ++ * Return raw headers (non-spec api) ++ * ++ * @return Object ++ */ ++ raw() { ++ return this[MAP]; ++ } ++ ++ /** ++ * Get an iterator on keys. ++ * ++ * @return Iterator ++ */ ++ keys() { ++ return createHeadersIterator(this, 'key'); ++ } ++ ++ /** ++ * Get an iterator on values. ++ * ++ * @return Iterator ++ */ ++ values() { ++ return createHeadersIterator(this, 'value'); ++ } ++ ++ /** ++ * Get an iterator on entries. ++ * ++ * This is the default iterator of the Headers object. ++ * ++ * @return Iterator ++ */ ++ [Symbol.iterator]() { ++ return createHeadersIterator(this, 'key+value'); ++ } ++} ++Headers.prototype.entries = Headers.prototype[Symbol.iterator]; ++ ++Object.defineProperty(Headers.prototype, Symbol.toStringTag, { ++ value: 'Headers', ++ writable: false, ++ enumerable: false, ++ configurable: true ++}); ++ ++Object.defineProperties(Headers.prototype, { ++ get: { enumerable: true }, ++ forEach: { enumerable: true }, ++ set: { enumerable: true }, ++ append: { enumerable: true }, ++ has: { enumerable: true }, ++ delete: { enumerable: true }, ++ keys: { enumerable: true }, ++ values: { enumerable: true }, ++ entries: { enumerable: true } ++}); ++ ++function getHeaders(headers) { ++ let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; ++ ++ const keys = Object.keys(headers[MAP]).sort(); ++ return keys.map(kind === 'key' ? function (k) { ++ return k.toLowerCase(); ++ } : kind === 'value' ? function (k) { ++ return headers[MAP][k].join(', '); ++ } : function (k) { ++ return [k.toLowerCase(), headers[MAP][k].join(', ')]; ++ }); ++} ++ ++const INTERNAL = Symbol('internal'); ++ ++function createHeadersIterator(target, kind) { ++ const iterator = Object.create(HeadersIteratorPrototype); ++ iterator[INTERNAL] = { ++ target, ++ kind, ++ index: 0 ++ }; ++ return iterator; ++} ++ ++const HeadersIteratorPrototype = Object.setPrototypeOf({ ++ next() { ++ // istanbul ignore if ++ if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { ++ throw new TypeError('Value of `this` is not a HeadersIterator'); ++ } ++ ++ var _INTERNAL = this[INTERNAL]; ++ const target = _INTERNAL.target, ++ kind = _INTERNAL.kind, ++ index = _INTERNAL.index; ++ ++ const values = getHeaders(target, kind); ++ const len = values.length; ++ if (index >= len) { ++ return { ++ value: undefined, ++ done: true ++ }; ++ } ++ ++ this[INTERNAL].index = index + 1; ++ ++ return { ++ value: values[index], ++ done: false ++ }; ++ } ++}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); ++ ++Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { ++ value: 'HeadersIterator', ++ writable: false, ++ enumerable: false, ++ configurable: true ++}); ++ ++/** ++ * Export the Headers object in a form that Node.js can consume. ++ * ++ * @param Headers headers ++ * @return Object ++ */ ++function exportNodeCompatibleHeaders(headers) { ++ const obj = Object.assign({ __proto__: null }, headers[MAP]); ++ ++ // http.request() only supports string as Host header. This hack makes ++ // specifying custom Host header possible. ++ const hostHeaderKey = find(headers[MAP], 'Host'); ++ if (hostHeaderKey !== undefined) { ++ obj[hostHeaderKey] = obj[hostHeaderKey][0]; ++ } ++ ++ return obj; ++} ++ ++/** ++ * Create a Headers object from an object of headers, ignoring those that do ++ * not conform to HTTP grammar productions. ++ * ++ * @param Object obj Object of headers ++ * @return Headers ++ */ ++function createHeadersLenient(obj) { ++ const headers = new Headers(); ++ for (const name of Object.keys(obj)) { ++ if (invalidTokenRegex.test(name)) { ++ continue; ++ } ++ if (Array.isArray(obj[name])) { ++ for (const val of obj[name]) { ++ if (invalidHeaderCharRegex.test(val)) { ++ continue; ++ } ++ if (headers[MAP][name] === undefined) { ++ headers[MAP][name] = [val]; ++ } else { ++ headers[MAP][name].push(val); ++ } ++ } ++ } else if (!invalidHeaderCharRegex.test(obj[name])) { ++ headers[MAP][name] = [obj[name]]; ++ } ++ } ++ return headers; ++} ++ ++/** ++ * response.js ++ * ++ * Response class provides content decoding ++ */ ++ ++var _require$1 = require('http'); ++ ++const STATUS_CODES = _require$1.STATUS_CODES; ++ ++ ++const INTERNALS$1 = Symbol('Response internals'); ++ ++/** ++ * Response class ++ * ++ * @param Stream body Readable stream ++ * @param Object opts Response options ++ * @return Void ++ */ ++class Response { ++ constructor() { ++ let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; ++ let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; ++ ++ Body.call(this, body, opts); ++ ++ const status = opts.status || 200; ++ ++ this[INTERNALS$1] = { ++ url: opts.url, ++ status, ++ statusText: opts.statusText || STATUS_CODES[status], ++ headers: new Headers(opts.headers) ++ }; ++ } ++ ++ get url() { ++ return this[INTERNALS$1].url; ++ } ++ ++ get status() { ++ return this[INTERNALS$1].status; ++ } ++ ++ /** ++ * Convenience property representing if the request ended normally ++ */ ++ get ok() { ++ return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; ++ } ++ ++ get statusText() { ++ return this[INTERNALS$1].statusText; ++ } ++ ++ get headers() { ++ return this[INTERNALS$1].headers; ++ } ++ ++ /** ++ * Clone this response ++ * ++ * @return Response ++ */ ++ clone() { ++ return new Response(clone(this), { ++ url: this.url, ++ status: this.status, ++ statusText: this.statusText, ++ headers: this.headers, ++ ok: this.ok ++ }); ++ } ++} ++ ++Body.mixIn(Response.prototype); ++ ++Object.defineProperties(Response.prototype, { ++ url: { enumerable: true }, ++ status: { enumerable: true }, ++ ok: { enumerable: true }, ++ statusText: { enumerable: true }, ++ headers: { enumerable: true }, ++ clone: { enumerable: true } ++}); ++ ++Object.defineProperty(Response.prototype, Symbol.toStringTag, { ++ value: 'Response', ++ writable: false, ++ enumerable: false, ++ configurable: true ++}); ++ ++/** ++ * request.js ++ * ++ * Request class contains server only options ++ * ++ * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/. ++ */ ++ ++var _require$2 = require('url'); ++ ++const format_url = _require$2.format; ++const parse_url = _require$2.parse; ++ ++ ++const INTERNALS$2 = Symbol('Request internals'); ++ ++/** ++ * Check if a value is an instance of Request. ++ * ++ * @param Mixed input ++ * @return Boolean ++ */ ++function isRequest(input) { ++ return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; ++} ++ ++/** ++ * Request class ++ * ++ * @param Mixed input Url or Request instance ++ * @param Object init Custom options ++ * @return Void ++ */ ++class Request { ++ constructor(input) { ++ let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; ++ ++ let parsedURL; ++ ++ // normalize input ++ if (!isRequest(input)) { ++ if (input && input.href) { ++ // in order to support Node.js' Url objects; though WHATWG's URL objects ++ // will fall into this branch also (since their `toString()` will return ++ // `href` property anyway) ++ parsedURL = parse_url(input.href); ++ } else { ++ // coerce input to a string before attempting to parse ++ parsedURL = parse_url(`${input}`); ++ } ++ input = {}; ++ } else { ++ parsedURL = parse_url(input.url); ++ } ++ ++ let method = init.method || input.method || 'GET'; ++ method = method.toUpperCase(); ++ ++ if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { ++ throw new TypeError('Request with GET/HEAD method cannot have body'); ++ } ++ ++ let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; ++ ++ Body.call(this, inputBody, { ++ timeout: init.timeout || input.timeout || 0, ++ size: init.size || input.size || 0 ++ }); ++ ++ const headers = new Headers(init.headers || input.headers || {}); ++ ++ if (init.body != null) { ++ const contentType = extractContentType(this); ++ if (contentType !== null && !headers.has('Content-Type')) { ++ headers.append('Content-Type', contentType); ++ } ++ } ++ ++ this[INTERNALS$2] = { ++ method, ++ redirect: init.redirect || input.redirect || 'follow', ++ headers, ++ parsedURL ++ }; ++ ++ // node-fetch-only options ++ this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; ++ this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; ++ this.counter = init.counter || input.counter || 0; ++ this.agent = init.agent || input.agent; ++ } ++ ++ get method() { ++ return this[INTERNALS$2].method; ++ } ++ ++ get url() { ++ return format_url(this[INTERNALS$2].parsedURL); ++ } ++ ++ get headers() { ++ return this[INTERNALS$2].headers; ++ } ++ ++ get redirect() { ++ return this[INTERNALS$2].redirect; ++ } ++ ++ /** ++ * Clone this request ++ * ++ * @return Request ++ */ ++ clone() { ++ return new Request(this); ++ } ++} ++ ++Body.mixIn(Request.prototype); ++ ++Object.defineProperty(Request.prototype, Symbol.toStringTag, { ++ value: 'Request', ++ writable: false, ++ enumerable: false, ++ configurable: true ++}); ++ ++Object.defineProperties(Request.prototype, { ++ method: { enumerable: true }, ++ url: { enumerable: true }, ++ headers: { enumerable: true }, ++ redirect: { enumerable: true }, ++ clone: { enumerable: true } ++}); ++ ++/** ++ * Convert a Request to Node.js http request options. ++ * ++ * @param Request A Request instance ++ * @return Object The options object to be passed to http.request ++ */ ++function getNodeRequestOptions(request) { ++ const parsedURL = request[INTERNALS$2].parsedURL; ++ const headers = new Headers(request[INTERNALS$2].headers); ++ ++ // fetch step 1.3 ++ if (!headers.has('Accept')) { ++ headers.set('Accept', '*/*'); ++ } ++ ++ // Basic fetch ++ if (!parsedURL.protocol || !parsedURL.hostname) { ++ throw new TypeError('Only absolute URLs are supported'); ++ } ++ ++ if (!/^https?:$/.test(parsedURL.protocol)) { ++ throw new TypeError('Only HTTP(S) protocols are supported'); ++ } ++ ++ // HTTP-network-or-cache fetch steps 2.4-2.7 ++ let contentLengthValue = null; ++ if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { ++ contentLengthValue = '0'; ++ } ++ if (request.body != null) { ++ const totalBytes = getTotalBytes(request); ++ if (typeof totalBytes === 'number') { ++ contentLengthValue = String(totalBytes); ++ } ++ } ++ if (contentLengthValue) { ++ headers.set('Content-Length', contentLengthValue); ++ } ++ ++ // HTTP-network-or-cache fetch step 2.11 ++ if (!headers.has('User-Agent')) { ++ headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); ++ } ++ ++ // HTTP-network-or-cache fetch step 2.15 ++ if (request.compress) { ++ headers.set('Accept-Encoding', 'gzip,deflate'); ++ } ++ if (!headers.has('Connection') && !request.agent) { ++ headers.set('Connection', 'close'); ++ } ++ ++ // HTTP-network fetch step 4.2 ++ // chunked encoding is handled by Node.js ++ ++ return Object.assign({}, parsedURL, { ++ method: request.method, ++ headers: exportNodeCompatibleHeaders(headers), ++ agent: request.agent ++ }); ++} ++ ++/** ++ * index.js ++ * ++ * a request API compatible with window.fetch ++ * ++ * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/. ++ */ ++ ++const http = require('http'); ++const https = require('https'); ++ ++var _require$3 = require('stream'); ++ ++const PassThrough$1 = _require$3.PassThrough; ++ ++var _require2 = require('url'); ++ ++const resolve_url = _require2.resolve; ++ ++const zlib = require('zlib'); ++ ++/** ++ * Fetch function ++ * ++ * @param Mixed url Absolute url or Request instance ++ * @param Object opts Fetch options ++ * @return Promise ++ */ ++function fetch(url, opts) { ++ ++ // allow custom promise ++ if (!fetch.Promise) { ++ throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); ++ } ++ ++ Body.Promise = fetch.Promise; ++ ++ // wrap http.request into fetch ++ return new fetch.Promise(function (resolve, reject) { ++ // build request object ++ const request = new Request(url, opts); ++ const options = getNodeRequestOptions(request); ++ ++ const send = (options.protocol === 'https:' ? https : http).request; ++ ++ // send request ++ const req = send(options); ++ let reqTimeout; ++ ++ function finalize() { ++ req.abort(); ++ clearTimeout(reqTimeout); ++ } ++ ++ if (request.timeout) { ++ req.once('socket', function (socket) { ++ reqTimeout = setTimeout(function () { ++ reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); ++ finalize(); ++ }, request.timeout); ++ }); ++ } ++ ++ req.on('error', function (err) { ++ reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); ++ finalize(); ++ }); ++ ++ req.on('response', function (res) { ++ clearTimeout(reqTimeout); ++ ++ const headers = createHeadersLenient(res.headers); ++ ++ // HTTP fetch step 5 ++ if (fetch.isRedirect(res.statusCode)) { ++ // HTTP fetch step 5.2 ++ const location = headers.get('Location'); ++ ++ // HTTP fetch step 5.3 ++ const locationURL = location === null ? null : resolve_url(request.url, location); ++ ++ // HTTP fetch step 5.5 ++ switch (request.redirect) { ++ case 'error': ++ reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect')); ++ finalize(); ++ return; ++ case 'manual': ++ // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. ++ if (locationURL !== null) { ++ headers.set('Location', locationURL); ++ } ++ break; ++ case 'follow': ++ // HTTP-redirect fetch step 2 ++ if (locationURL === null) { ++ break; ++ } ++ ++ // HTTP-redirect fetch step 5 ++ if (request.counter >= request.follow) { ++ reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); ++ finalize(); ++ return; ++ } ++ ++ // HTTP-redirect fetch step 6 (counter increment) ++ // Create a new Request object. ++ const requestOpts = { ++ headers: new Headers(request.headers), ++ follow: request.follow, ++ counter: request.counter + 1, ++ agent: request.agent, ++ compress: request.compress, ++ method: request.method, ++ body: request.body ++ }; ++ ++ // HTTP-redirect fetch step 9 ++ if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { ++ reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); ++ finalize(); ++ return; ++ } ++ ++ // HTTP-redirect fetch step 11 ++ if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { ++ requestOpts.method = 'GET'; ++ requestOpts.body = undefined; ++ requestOpts.headers.delete('content-length'); ++ } ++ ++ // HTTP-redirect fetch step 15 ++ resolve(fetch(new Request(locationURL, requestOpts))); ++ finalize(); ++ return; ++ } ++ } ++ ++ // prepare response ++ let body = res.pipe(new PassThrough$1()); ++ const response_options = { ++ url: request.url, ++ status: res.statusCode, ++ statusText: res.statusMessage, ++ headers: headers, ++ size: request.size, ++ timeout: request.timeout ++ }; ++ ++ // HTTP-network fetch step 12.1.1.3 ++ const codings = headers.get('Content-Encoding'); ++ ++ // HTTP-network fetch step 12.1.1.4: handle content codings ++ ++ // in following scenarios we ignore compression support ++ // 1. compression support is disabled ++ // 2. HEAD request ++ // 3. no Content-Encoding header ++ // 4. no content response (204) ++ // 5. content not modified response (304) ++ if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { ++ resolve(new Response(body, response_options)); ++ return; ++ } ++ ++ // For Node v6+ ++ // Be less strict when decoding compressed responses, since sometimes ++ // servers send slightly invalid responses that are still accepted ++ // by common browsers. ++ // Always using Z_SYNC_FLUSH is what cURL does. ++ const zlibOptions = { ++ flush: zlib.Z_SYNC_FLUSH, ++ finishFlush: zlib.Z_SYNC_FLUSH ++ }; ++ ++ // for gzip ++ if (codings == 'gzip' || codings == 'x-gzip') { ++ body = body.pipe(zlib.createGunzip(zlibOptions)); ++ resolve(new Response(body, response_options)); ++ return; ++ } ++ ++ // for deflate ++ if (codings == 'deflate' || codings == 'x-deflate') { ++ // handle the infamous raw deflate response from old servers ++ // a hack for old IIS and Apache servers ++ const raw = res.pipe(new PassThrough$1()); ++ raw.once('data', function (chunk) { ++ // see http://stackoverflow.com/questions/37519828 ++ if ((chunk[0] & 0x0F) === 0x08) { ++ body = body.pipe(zlib.createInflate()); ++ } else { ++ body = body.pipe(zlib.createInflateRaw()); ++ } ++ resolve(new Response(body, response_options)); ++ }); ++ return; ++ } ++ ++ // otherwise, use response as-is ++ resolve(new Response(body, response_options)); ++ }); ++ ++ writeToStream(req, request); ++ }); ++} ++ ++/** ++ * Redirect code matching ++ * ++ * @param Number code Status code ++ * @return Boolean ++ */ ++fetch.isRedirect = function (code) { ++ return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; ++}; ++ ++// Needed for TypeScript. ++fetch.default = fetch; ++ ++// expose Promise ++fetch.Promise = global.Promise; ++ ++export default fetch; ++export { Headers, Request, Response, FetchError }; +new file mode 100644 +--- /dev/null ++++ b/node_modules/vue-steemconnect/node_modules/steemconnect/node_modules/node-fetch/lib/index.js +@@ -0,0 +1,1557 @@ ++'use strict'; ++ ++Object.defineProperty(exports, '__esModule', { value: true }); ++ ++// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js ++// (MIT licensed) ++ ++const BUFFER = Symbol('buffer'); ++const TYPE = Symbol('type'); ++ ++class Blob { ++ constructor() { ++ this[TYPE] = ''; ++ ++ const blobParts = arguments[0]; ++ const options = arguments[1]; ++ ++ const buffers = []; ++ ++ if (blobParts) { ++ const a = blobParts; ++ const length = Number(a.length); ++ for (let i = 0; i < length; i++) { ++ const element = a[i]; ++ let buffer; ++ if (element instanceof Buffer) { ++ buffer = element; ++ } else if (ArrayBuffer.isView(element)) { ++ buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); ++ } else if (element instanceof ArrayBuffer) { ++ buffer = Buffer.from(element); ++ } else if (element instanceof Blob) { ++ buffer = element[BUFFER]; ++ } else { ++ buffer = Buffer.from(typeof element === 'string' ? element : String(element)); ++ } ++ buffers.push(buffer); ++ } ++ } ++ ++ this[BUFFER] = Buffer.concat(buffers); ++ ++ let type = options && options.type !== undefined && String(options.type).toLowerCase(); ++ if (type && !/[^\u0020-\u007E]/.test(type)) { ++ this[TYPE] = type; ++ } ++ } ++ get size() { ++ return this[BUFFER].length; ++ } ++ get type() { ++ return this[TYPE]; ++ } ++ slice() { ++ const size = this.size; ++ ++ const start = arguments[0]; ++ const end = arguments[1]; ++ let relativeStart, relativeEnd; ++ if (start === undefined) { ++ relativeStart = 0; ++ } else if (start < 0) { ++ relativeStart = Math.max(size + start, 0); ++ } else { ++ relativeStart = Math.min(start, size); ++ } ++ if (end === undefined) { ++ relativeEnd = size; ++ } else if (end < 0) { ++ relativeEnd = Math.max(size + end, 0); ++ } else { ++ relativeEnd = Math.min(end, size); ++ } ++ const span = Math.max(relativeEnd - relativeStart, 0); ++ ++ const buffer = this[BUFFER]; ++ const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); ++ const blob = new Blob([], { type: arguments[2] }); ++ blob[BUFFER] = slicedBuffer; ++ return blob; ++ } ++} ++ ++Object.defineProperties(Blob.prototype, { ++ size: { enumerable: true }, ++ type: { enumerable: true }, ++ slice: { enumerable: true } ++}); ++ ++Object.defineProperty(Blob.prototype, Symbol.toStringTag, { ++ value: 'Blob', ++ writable: false, ++ enumerable: false, ++ configurable: true ++}); ++ ++/** ++ * fetch-error.js ++ * ++ * FetchError interface for operational errors ++ */ ++ ++/** ++ * Create FetchError instance ++ * ++ * @param String message Error message for human ++ * @param String type Error type for machine ++ * @param String systemError For Node.js system error ++ * @return FetchError ++ */ ++function FetchError(message, type, systemError) { ++ Error.call(this, message); ++ ++ this.message = message; ++ this.type = type; ++ ++ // when err.type is `system`, err.code contains system error code ++ if (systemError) { ++ this.code = this.errno = systemError.code; ++ } ++ ++ // hide custom error implementation details from end-users ++ Error.captureStackTrace(this, this.constructor); ++} ++ ++FetchError.prototype = Object.create(Error.prototype); ++FetchError.prototype.constructor = FetchError; ++FetchError.prototype.name = 'FetchError'; ++ ++/** ++ * body.js ++ * ++ * Body interface provides common methods for Request and Response ++ */ ++ ++const Stream = require('stream'); ++ ++var _require = require('stream'); ++ ++const PassThrough = _require.PassThrough; ++ ++ ++let convert; ++try { ++ convert = require('encoding').convert; ++} catch (e) {} ++ ++const INTERNALS = Symbol('Body internals'); ++ ++/** ++ * Body mixin ++ * ++ * Ref: https://fetch.spec.whatwg.org/#body ++ * ++ * @param Stream body Readable stream ++ * @param Object opts Response options ++ * @return Void ++ */ ++function Body(body) { ++ var _this = this; ++ ++ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, ++ _ref$size = _ref.size; ++ ++ let size = _ref$size === undefined ? 0 : _ref$size; ++ var _ref$timeout = _ref.timeout; ++ let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; ++ ++ if (body == null) { ++ // body is undefined or null ++ body = null; ++ } else if (typeof body === 'string') { ++ // body is string ++ } else if (isURLSearchParams(body)) { ++ // body is a URLSearchParams ++ } else if (body instanceof Blob) { ++ // body is blob ++ } else if (Buffer.isBuffer(body)) { ++ // body is buffer ++ } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { ++ // body is array buffer ++ } else if (body instanceof Stream) { ++ // body is stream ++ } else { ++ // none of the above ++ // coerce to string ++ body = String(body); ++ } ++ this[INTERNALS] = { ++ body, ++ disturbed: false, ++ error: null ++ }; ++ this.size = size; ++ this.timeout = timeout; ++ ++ if (body instanceof Stream) { ++ body.on('error', function (err) { ++ _this[INTERNALS].error = new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); ++ }); ++ } ++} ++ ++Body.prototype = { ++ get body() { ++ return this[INTERNALS].body; ++ }, ++ ++ get bodyUsed() { ++ return this[INTERNALS].disturbed; ++ }, ++ ++ /** ++ * Decode response as ArrayBuffer ++ * ++ * @return Promise ++ */ ++ arrayBuffer() { ++ return consumeBody.call(this).then(function (buf) { ++ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); ++ }); ++ }, ++ ++ /** ++ * Return raw response as Blob ++ * ++ * @return Promise ++ */ ++ blob() { ++ let ct = this.headers && this.headers.get('content-type') || ''; ++ return consumeBody.call(this).then(function (buf) { ++ return Object.assign( ++ // Prevent copying ++ new Blob([], { ++ type: ct.toLowerCase() ++ }), { ++ [BUFFER]: buf ++ }); ++ }); ++ }, ++ ++ /** ++ * Decode response as json ++ * ++ * @return Promise ++ */ ++ json() { ++ var _this2 = this; ++ ++ return consumeBody.call(this).then(function (buffer) { ++ try { ++ return JSON.parse(buffer.toString()); ++ } catch (err) { ++ return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); ++ } ++ }); ++ }, ++ ++ /** ++ * Decode response as text ++ * ++ * @return Promise ++ */ ++ text() { ++ return consumeBody.call(this).then(function (buffer) { ++ return buffer.toString(); ++ }); ++ }, ++ ++ /** ++ * Decode response as buffer (non-spec api) ++ * ++ * @return Promise ++ */ ++ buffer() { ++ return consumeBody.call(this); ++ }, ++ ++ /** ++ * Decode response as text, while automatically detecting the encoding and ++ * trying to decode to UTF-8 (non-spec api) ++ * ++ * @return Promise ++ */ ++ textConverted() { ++ var _this3 = this; ++ ++ return consumeBody.call(this).then(function (buffer) { ++ return convertBody(buffer, _this3.headers); ++ }); ++ } ++ ++}; ++ ++// In browsers, all properties are enumerable. ++Object.defineProperties(Body.prototype, { ++ body: { enumerable: true }, ++ bodyUsed: { enumerable: true }, ++ arrayBuffer: { enumerable: true }, ++ blob: { enumerable: true }, ++ json: { enumerable: true }, ++ text: { enumerable: true } ++}); ++ ++Body.mixIn = function (proto) { ++ for (const name of Object.getOwnPropertyNames(Body.prototype)) { ++ // istanbul ignore else: future proof ++ if (!(name in proto)) { ++ const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); ++ Object.defineProperty(proto, name, desc); ++ } ++ } ++}; ++ ++/** ++ * Consume and convert an entire Body to a Buffer. ++ * ++ * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body ++ * ++ * @return Promise ++ */ ++function consumeBody() { ++ var _this4 = this; ++ ++ if (this[INTERNALS].disturbed) { ++ return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); ++ } ++ ++ this[INTERNALS].disturbed = true; ++ ++ if (this[INTERNALS].error) { ++ return Body.Promise.reject(this[INTERNALS].error); ++ } ++ ++ // body is null ++ if (this.body === null) { ++ return Body.Promise.resolve(Buffer.alloc(0)); ++ } ++ ++ // body is string ++ if (typeof this.body === 'string') { ++ return Body.Promise.resolve(Buffer.from(this.body)); ++ } ++ ++ // body is blob ++ if (this.body instanceof Blob) { ++ return Body.Promise.resolve(this.body[BUFFER]); ++ } ++ ++ // body is buffer ++ if (Buffer.isBuffer(this.body)) { ++ return Body.Promise.resolve(this.body); ++ } ++ ++ // body is buffer ++ if (Object.prototype.toString.call(this.body) === '[object ArrayBuffer]') { ++ return Body.Promise.resolve(Buffer.from(this.body)); ++ } ++ ++ // istanbul ignore if: should never happen ++ if (!(this.body instanceof Stream)) { ++ return Body.Promise.resolve(Buffer.alloc(0)); ++ } ++ ++ // body is stream ++ // get ready to actually consume the body ++ let accum = []; ++ let accumBytes = 0; ++ let abort = false; ++ ++ return new Body.Promise(function (resolve, reject) { ++ let resTimeout; ++ ++ // allow timeout on slow response body ++ if (_this4.timeout) { ++ resTimeout = setTimeout(function () { ++ abort = true; ++ reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); ++ }, _this4.timeout); ++ } ++ ++ // handle stream error, such as incorrect content-encoding ++ _this4.body.on('error', function (err) { ++ reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); ++ }); ++ ++ _this4.body.on('data', function (chunk) { ++ if (abort || chunk === null) { ++ return; ++ } ++ ++ if (_this4.size && accumBytes + chunk.length > _this4.size) { ++ abort = true; ++ reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); ++ return; ++ } ++ ++ accumBytes += chunk.length; ++ accum.push(chunk); ++ }); ++ ++ _this4.body.on('end', function () { ++ if (abort) { ++ return; ++ } ++ ++ clearTimeout(resTimeout); ++ ++ try { ++ resolve(Buffer.concat(accum)); ++ } catch (err) { ++ // handle streams that have accumulated too much data (issue #414) ++ reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); ++ } ++ }); ++ }); ++} ++ ++/** ++ * Detect buffer encoding and convert to target encoding ++ * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding ++ * ++ * @param Buffer buffer Incoming buffer ++ * @param String encoding Target encoding ++ * @return String ++ */ ++function convertBody(buffer, headers) { ++ if (typeof convert !== 'function') { ++ throw new Error('The package `encoding` must be installed to use the textConverted() function'); ++ } ++ ++ const ct = headers.get('content-type'); ++ let charset = 'utf-8'; ++ let res, str; ++ ++ // header ++ if (ct) { ++ res = /charset=([^;]*)/i.exec(ct); ++ } ++ ++ // no charset in content type, peek at response body for at most 1024 bytes ++ str = buffer.slice(0, 1024).toString(); ++ ++ // html5 ++ if (!res && str) { ++ res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; ++ ++ this[MAP] = Object.create(null); ++ ++ if (init instanceof Headers) { ++ const rawHeaders = init.raw(); ++ const headerNames = Object.keys(rawHeaders); ++ ++ for (const headerName of headerNames) { ++ for (const value of rawHeaders[headerName]) { ++ this.append(headerName, value); ++ } ++ } ++ ++ return; ++ } ++ ++ // We don't worry about converting prop to ByteString here as append() ++ // will handle it. ++ if (init == null) { ++ // no op ++ } else if (typeof init === 'object') { ++ const method = init[Symbol.iterator]; ++ if (method != null) { ++ if (typeof method !== 'function') { ++ throw new TypeError('Header pairs must be iterable'); ++ } ++ ++ // sequence> ++ // Note: per spec we have to first exhaust the lists then process them ++ const pairs = []; ++ for (const pair of init) { ++ if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { ++ throw new TypeError('Each header pair must be iterable'); ++ } ++ pairs.push(Array.from(pair)); ++ } ++ ++ for (const pair of pairs) { ++ if (pair.length !== 2) { ++ throw new TypeError('Each header pair must be a name/value tuple'); ++ } ++ this.append(pair[0], pair[1]); ++ } ++ } else { ++ // record ++ for (const key of Object.keys(init)) { ++ const value = init[key]; ++ this.append(key, value); ++ } ++ } ++ } else { ++ throw new TypeError('Provided initializer must be an object'); ++ } ++ } ++ ++ /** ++ * Return combined header value given name ++ * ++ * @param String name Header name ++ * @return Mixed ++ */ ++ get(name) { ++ name = `${name}`; ++ validateName(name); ++ const key = find(this[MAP], name); ++ if (key === undefined) { ++ return null; ++ } ++ ++ return this[MAP][key].join(', '); ++ } ++ ++ /** ++ * Iterate over all headers ++ * ++ * @param Function callback Executed for each item with parameters (value, name, thisArg) ++ * @param Boolean thisArg `this` context for callback function ++ * @return Void ++ */ ++ forEach(callback) { ++ let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; ++ ++ let pairs = getHeaders(this); ++ let i = 0; ++ while (i < pairs.length) { ++ var _pairs$i = pairs[i]; ++ const name = _pairs$i[0], ++ value = _pairs$i[1]; ++ ++ callback.call(thisArg, value, name, this); ++ pairs = getHeaders(this); ++ i++; ++ } ++ } ++ ++ /** ++ * Overwrite header values given name ++ * ++ * @param String name Header name ++ * @param String value Header value ++ * @return Void ++ */ ++ set(name, value) { ++ name = `${name}`; ++ value = `${value}`; ++ validateName(name); ++ validateValue(value); ++ const key = find(this[MAP], name); ++ this[MAP][key !== undefined ? key : name] = [value]; ++ } ++ ++ /** ++ * Append a value onto existing header ++ * ++ * @param String name Header name ++ * @param String value Header value ++ * @return Void ++ */ ++ append(name, value) { ++ name = `${name}`; ++ value = `${value}`; ++ validateName(name); ++ validateValue(value); ++ const key = find(this[MAP], name); ++ if (key !== undefined) { ++ this[MAP][key].push(value); ++ } else { ++ this[MAP][name] = [value]; ++ } ++ } ++ ++ /** ++ * Check for header name existence ++ * ++ * @param String name Header name ++ * @return Boolean ++ */ ++ has(name) { ++ name = `${name}`; ++ validateName(name); ++ return find(this[MAP], name) !== undefined; ++ } ++ ++ /** ++ * Delete all header values given name ++ * ++ * @param String name Header name ++ * @return Void ++ */ ++ delete(name) { ++ name = `${name}`; ++ validateName(name); ++ const key = find(this[MAP], name); ++ if (key !== undefined) { ++ delete this[MAP][key]; ++ } ++ } ++ ++ /** ++ * Return raw headers (non-spec api) ++ * ++ * @return Object ++ */ ++ raw() { ++ return this[MAP]; ++ } ++ ++ /** ++ * Get an iterator on keys. ++ * ++ * @return Iterator ++ */ ++ keys() { ++ return createHeadersIterator(this, 'key'); ++ } ++ ++ /** ++ * Get an iterator on values. ++ * ++ * @return Iterator ++ */ ++ values() { ++ return createHeadersIterator(this, 'value'); ++ } ++ ++ /** ++ * Get an iterator on entries. ++ * ++ * This is the default iterator of the Headers object. ++ * ++ * @return Iterator ++ */ ++ [Symbol.iterator]() { ++ return createHeadersIterator(this, 'key+value'); ++ } ++} ++Headers.prototype.entries = Headers.prototype[Symbol.iterator]; ++ ++Object.defineProperty(Headers.prototype, Symbol.toStringTag, { ++ value: 'Headers', ++ writable: false, ++ enumerable: false, ++ configurable: true ++}); ++ ++Object.defineProperties(Headers.prototype, { ++ get: { enumerable: true }, ++ forEach: { enumerable: true }, ++ set: { enumerable: true }, ++ append: { enumerable: true }, ++ has: { enumerable: true }, ++ delete: { enumerable: true }, ++ keys: { enumerable: true }, ++ values: { enumerable: true }, ++ entries: { enumerable: true } ++}); ++ ++function getHeaders(headers) { ++ let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; ++ ++ const keys = Object.keys(headers[MAP]).sort(); ++ return keys.map(kind === 'key' ? function (k) { ++ return k.toLowerCase(); ++ } : kind === 'value' ? function (k) { ++ return headers[MAP][k].join(', '); ++ } : function (k) { ++ return [k.toLowerCase(), headers[MAP][k].join(', ')]; ++ }); ++} ++ ++const INTERNAL = Symbol('internal'); ++ ++function createHeadersIterator(target, kind) { ++ const iterator = Object.create(HeadersIteratorPrototype); ++ iterator[INTERNAL] = { ++ target, ++ kind, ++ index: 0 ++ }; ++ return iterator; ++} ++ ++const HeadersIteratorPrototype = Object.setPrototypeOf({ ++ next() { ++ // istanbul ignore if ++ if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { ++ throw new TypeError('Value of `this` is not a HeadersIterator'); ++ } ++ ++ var _INTERNAL = this[INTERNAL]; ++ const target = _INTERNAL.target, ++ kind = _INTERNAL.kind, ++ index = _INTERNAL.index; ++ ++ const values = getHeaders(target, kind); ++ const len = values.length; ++ if (index >= len) { ++ return { ++ value: undefined, ++ done: true ++ }; ++ } ++ ++ this[INTERNAL].index = index + 1; ++ ++ return { ++ value: values[index], ++ done: false ++ }; ++ } ++}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); ++ ++Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { ++ value: 'HeadersIterator', ++ writable: false, ++ enumerable: false, ++ configurable: true ++}); ++ ++/** ++ * Export the Headers object in a form that Node.js can consume. ++ * ++ * @param Headers headers ++ * @return Object ++ */ ++function exportNodeCompatibleHeaders(headers) { ++ const obj = Object.assign({ __proto__: null }, headers[MAP]); ++ ++ // http.request() only supports string as Host header. This hack makes ++ // specifying custom Host header possible. ++ const hostHeaderKey = find(headers[MAP], 'Host'); ++ if (hostHeaderKey !== undefined) { ++ obj[hostHeaderKey] = obj[hostHeaderKey][0]; ++ } ++ ++ return obj; ++} ++ ++/** ++ * Create a Headers object from an object of headers, ignoring those that do ++ * not conform to HTTP grammar productions. ++ * ++ * @param Object obj Object of headers ++ * @return Headers ++ */ ++function createHeadersLenient(obj) { ++ const headers = new Headers(); ++ for (const name of Object.keys(obj)) { ++ if (invalidTokenRegex.test(name)) { ++ continue; ++ } ++ if (Array.isArray(obj[name])) { ++ for (const val of obj[name]) { ++ if (invalidHeaderCharRegex.test(val)) { ++ continue; ++ } ++ if (headers[MAP][name] === undefined) { ++ headers[MAP][name] = [val]; ++ } else { ++ headers[MAP][name].push(val); ++ } ++ } ++ } else if (!invalidHeaderCharRegex.test(obj[name])) { ++ headers[MAP][name] = [obj[name]]; ++ } ++ } ++ return headers; ++} ++ ++/** ++ * response.js ++ * ++ * Response class provides content decoding ++ */ ++ ++var _require$1 = require('http'); ++ ++const STATUS_CODES = _require$1.STATUS_CODES; ++ ++ ++const INTERNALS$1 = Symbol('Response internals'); ++ ++/** ++ * Response class ++ * ++ * @param Stream body Readable stream ++ * @param Object opts Response options ++ * @return Void ++ */ ++class Response { ++ constructor() { ++ let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; ++ let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; ++ ++ Body.call(this, body, opts); ++ ++ const status = opts.status || 200; ++ ++ this[INTERNALS$1] = { ++ url: opts.url, ++ status, ++ statusText: opts.statusText || STATUS_CODES[status], ++ headers: new Headers(opts.headers) ++ }; ++ } ++ ++ get url() { ++ return this[INTERNALS$1].url; ++ } ++ ++ get status() { ++ return this[INTERNALS$1].status; ++ } ++ ++ /** ++ * Convenience property representing if the request ended normally ++ */ ++ get ok() { ++ return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; ++ } ++ ++ get statusText() { ++ return this[INTERNALS$1].statusText; ++ } ++ ++ get headers() { ++ return this[INTERNALS$1].headers; ++ } ++ ++ /** ++ * Clone this response ++ * ++ * @return Response ++ */ ++ clone() { ++ return new Response(clone(this), { ++ url: this.url, ++ status: this.status, ++ statusText: this.statusText, ++ headers: this.headers, ++ ok: this.ok ++ }); ++ } ++} ++ ++Body.mixIn(Response.prototype); ++ ++Object.defineProperties(Response.prototype, { ++ url: { enumerable: true }, ++ status: { enumerable: true }, ++ ok: { enumerable: true }, ++ statusText: { enumerable: true }, ++ headers: { enumerable: true }, ++ clone: { enumerable: true } ++}); ++ ++Object.defineProperty(Response.prototype, Symbol.toStringTag, { ++ value: 'Response', ++ writable: false, ++ enumerable: false, ++ configurable: true ++}); ++ ++/** ++ * request.js ++ * ++ * Request class contains server only options ++ * ++ * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/. ++ */ ++ ++var _require$2 = require('url'); ++ ++const format_url = _require$2.format; ++const parse_url = _require$2.parse; ++ ++ ++const INTERNALS$2 = Symbol('Request internals'); ++ ++/** ++ * Check if a value is an instance of Request. ++ * ++ * @param Mixed input ++ * @return Boolean ++ */ ++function isRequest(input) { ++ return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; ++} ++ ++/** ++ * Request class ++ * ++ * @param Mixed input Url or Request instance ++ * @param Object init Custom options ++ * @return Void ++ */ ++class Request { ++ constructor(input) { ++ let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; ++ ++ let parsedURL; ++ ++ // normalize input ++ if (!isRequest(input)) { ++ if (input && input.href) { ++ // in order to support Node.js' Url objects; though WHATWG's URL objects ++ // will fall into this branch also (since their `toString()` will return ++ // `href` property anyway) ++ parsedURL = parse_url(input.href); ++ } else { ++ // coerce input to a string before attempting to parse ++ parsedURL = parse_url(`${input}`); ++ } ++ input = {}; ++ } else { ++ parsedURL = parse_url(input.url); ++ } ++ ++ let method = init.method || input.method || 'GET'; ++ method = method.toUpperCase(); ++ ++ if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { ++ throw new TypeError('Request with GET/HEAD method cannot have body'); ++ } ++ ++ let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; ++ ++ Body.call(this, inputBody, { ++ timeout: init.timeout || input.timeout || 0, ++ size: init.size || input.size || 0 ++ }); ++ ++ const headers = new Headers(init.headers || input.headers || {}); ++ ++ if (init.body != null) { ++ const contentType = extractContentType(this); ++ if (contentType !== null && !headers.has('Content-Type')) { ++ headers.append('Content-Type', contentType); ++ } ++ } ++ ++ this[INTERNALS$2] = { ++ method, ++ redirect: init.redirect || input.redirect || 'follow', ++ headers, ++ parsedURL ++ }; ++ ++ // node-fetch-only options ++ this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; ++ this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; ++ this.counter = init.counter || input.counter || 0; ++ this.agent = init.agent || input.agent; ++ } ++ ++ get method() { ++ return this[INTERNALS$2].method; ++ } ++ ++ get url() { ++ return format_url(this[INTERNALS$2].parsedURL); ++ } ++ ++ get headers() { ++ return this[INTERNALS$2].headers; ++ } ++ ++ get redirect() { ++ return this[INTERNALS$2].redirect; ++ } ++ ++ /** ++ * Clone this request ++ * ++ * @return Request ++ */ ++ clone() { ++ return new Request(this); ++ } ++} ++ ++Body.mixIn(Request.prototype); ++ ++Object.defineProperty(Request.prototype, Symbol.toStringTag, { ++ value: 'Request', ++ writable: false, ++ enumerable: false, ++ configurable: true ++}); ++ ++Object.defineProperties(Request.prototype, { ++ method: { enumerable: true }, ++ url: { enumerable: true }, ++ headers: { enumerable: true }, ++ redirect: { enumerable: true }, ++ clone: { enumerable: true } ++}); ++ ++/** ++ * Convert a Request to Node.js http request options. ++ * ++ * @param Request A Request instance ++ * @return Object The options object to be passed to http.request ++ */ ++function getNodeRequestOptions(request) { ++ const parsedURL = request[INTERNALS$2].parsedURL; ++ const headers = new Headers(request[INTERNALS$2].headers); ++ ++ // fetch step 1.3 ++ if (!headers.has('Accept')) { ++ headers.set('Accept', '*/*'); ++ } ++ ++ // Basic fetch ++ if (!parsedURL.protocol || !parsedURL.hostname) { ++ throw new TypeError('Only absolute URLs are supported'); ++ } ++ ++ if (!/^https?:$/.test(parsedURL.protocol)) { ++ throw new TypeError('Only HTTP(S) protocols are supported'); ++ } ++ ++ // HTTP-network-or-cache fetch steps 2.4-2.7 ++ let contentLengthValue = null; ++ if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { ++ contentLengthValue = '0'; ++ } ++ if (request.body != null) { ++ const totalBytes = getTotalBytes(request); ++ if (typeof totalBytes === 'number') { ++ contentLengthValue = String(totalBytes); ++ } ++ } ++ if (contentLengthValue) { ++ headers.set('Content-Length', contentLengthValue); ++ } ++ ++ // HTTP-network-or-cache fetch step 2.11 ++ if (!headers.has('User-Agent')) { ++ headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); ++ } ++ ++ // HTTP-network-or-cache fetch step 2.15 ++ if (request.compress) { ++ headers.set('Accept-Encoding', 'gzip,deflate'); ++ } ++ if (!headers.has('Connection') && !request.agent) { ++ headers.set('Connection', 'close'); ++ } ++ ++ // HTTP-network fetch step 4.2 ++ // chunked encoding is handled by Node.js ++ ++ return Object.assign({}, parsedURL, { ++ method: request.method, ++ headers: exportNodeCompatibleHeaders(headers), ++ agent: request.agent ++ }); ++} ++ ++/** ++ * index.js ++ * ++ * a request API compatible with window.fetch ++ * ++ * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/. ++ */ ++ ++const http = require('http'); ++const https = require('https'); ++ ++var _require$3 = require('stream'); ++ ++const PassThrough$1 = _require$3.PassThrough; ++ ++var _require2 = require('url'); ++ ++const resolve_url = _require2.resolve; ++ ++const zlib = require('zlib'); ++ ++/** ++ * Fetch function ++ * ++ * @param Mixed url Absolute url or Request instance ++ * @param Object opts Fetch options ++ * @return Promise ++ */ ++function fetch(url, opts) { ++ ++ // allow custom promise ++ if (!fetch.Promise) { ++ throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); ++ } ++ ++ Body.Promise = fetch.Promise; ++ ++ // wrap http.request into fetch ++ return new fetch.Promise(function (resolve, reject) { ++ // build request object ++ const request = new Request(url, opts); ++ const options = getNodeRequestOptions(request); ++ ++ const send = (options.protocol === 'https:' ? https : http).request; ++ ++ // send request ++ const req = send(options); ++ let reqTimeout; ++ ++ function finalize() { ++ req.abort(); ++ clearTimeout(reqTimeout); ++ } ++ ++ if (request.timeout) { ++ req.once('socket', function (socket) { ++ reqTimeout = setTimeout(function () { ++ reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); ++ finalize(); ++ }, request.timeout); ++ }); ++ } ++ ++ req.on('error', function (err) { ++ reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); ++ finalize(); ++ }); ++ ++ req.on('response', function (res) { ++ clearTimeout(reqTimeout); ++ ++ const headers = createHeadersLenient(res.headers); ++ ++ // HTTP fetch step 5 ++ if (fetch.isRedirect(res.statusCode)) { ++ // HTTP fetch step 5.2 ++ const location = headers.get('Location'); ++ ++ // HTTP fetch step 5.3 ++ const locationURL = location === null ? null : resolve_url(request.url, location); ++ ++ // HTTP fetch step 5.5 ++ switch (request.redirect) { ++ case 'error': ++ reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect')); ++ finalize(); ++ return; ++ case 'manual': ++ // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. ++ if (locationURL !== null) { ++ headers.set('Location', locationURL); ++ } ++ break; ++ case 'follow': ++ // HTTP-redirect fetch step 2 ++ if (locationURL === null) { ++ break; ++ } ++ ++ // HTTP-redirect fetch step 5 ++ if (request.counter >= request.follow) { ++ reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); ++ finalize(); ++ return; ++ } ++ ++ // HTTP-redirect fetch step 6 (counter increment) ++ // Create a new Request object. ++ const requestOpts = { ++ headers: new Headers(request.headers), ++ follow: request.follow, ++ counter: request.counter + 1, ++ agent: request.agent, ++ compress: request.compress, ++ method: request.method, ++ body: request.body ++ }; ++ ++ // HTTP-redirect fetch step 9 ++ if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { ++ reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); ++ finalize(); ++ return; ++ } ++ ++ // HTTP-redirect fetch step 11 ++ if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { ++ requestOpts.method = 'GET'; ++ requestOpts.body = undefined; ++ requestOpts.headers.delete('content-length'); ++ } ++ ++ // HTTP-redirect fetch step 15 ++ resolve(fetch(new Request(locationURL, requestOpts))); ++ finalize(); ++ return; ++ } ++ } ++ ++ // prepare response ++ let body = res.pipe(new PassThrough$1()); ++ const response_options = { ++ url: request.url, ++ status: res.statusCode, ++ statusText: res.statusMessage, ++ headers: headers, ++ size: request.size, ++ timeout: request.timeout ++ }; ++ ++ // HTTP-network fetch step 12.1.1.3 ++ const codings = headers.get('Content-Encoding'); ++ ++ // HTTP-network fetch step 12.1.1.4: handle content codings ++ ++ // in following scenarios we ignore compression support ++ // 1. compression support is disabled ++ // 2. HEAD request ++ // 3. no Content-Encoding header ++ // 4. no content response (204) ++ // 5. content not modified response (304) ++ if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { ++ resolve(new Response(body, response_options)); ++ return; ++ } ++ ++ // For Node v6+ ++ // Be less strict when decoding compressed responses, since sometimes ++ // servers send slightly invalid responses that are still accepted ++ // by common browsers. ++ // Always using Z_SYNC_FLUSH is what cURL does. ++ const zlibOptions = { ++ flush: zlib.Z_SYNC_FLUSH, ++ finishFlush: zlib.Z_SYNC_FLUSH ++ }; ++ ++ // for gzip ++ if (codings == 'gzip' || codings == 'x-gzip') { ++ body = body.pipe(zlib.createGunzip(zlibOptions)); ++ resolve(new Response(body, response_options)); ++ return; ++ } ++ ++ // for deflate ++ if (codings == 'deflate' || codings == 'x-deflate') { ++ // handle the infamous raw deflate response from old servers ++ // a hack for old IIS and Apache servers ++ const raw = res.pipe(new PassThrough$1()); ++ raw.once('data', function (chunk) { ++ // see http://stackoverflow.com/questions/37519828 ++ if ((chunk[0] & 0x0F) === 0x08) { ++ body = body.pipe(zlib.createInflate()); ++ } else { ++ body = body.pipe(zlib.createInflateRaw()); ++ } ++ resolve(new Response(body, response_options)); ++ }); ++ return; ++ } ++ ++ // otherwise, use response as-is ++ resolve(new Response(body, response_options)); ++ }); ++ ++ writeToStream(req, request); ++ }); ++} ++ ++/** ++ * Redirect code matching ++ * ++ * @param Number code Status code ++ * @return Boolean ++ */ ++fetch.isRedirect = function (code) { ++ return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; ++}; ++ ++// Needed for TypeScript. ++fetch.default = fetch; ++ ++// expose Promise ++fetch.Promise = global.Promise; ++ ++module.exports = exports = fetch; ++exports.Headers = Headers; ++exports.Request = Request; ++exports.Response = Response; ++exports.FetchError = FetchError; +--- a/node_modules/vue-steemconnect/src/index.js ++++ b/node_modules/vue-steemconnect/src/index.js +@@ -1,5 +1,5 @@ +-const sc2 = require('sc2-sdk'); +-import { Initialize } from 'sc2-sdk'; ++const sc2 = require('steemconnect'); ++import { Initialize } from 'steemconnect'; + + const VueSteemConnect = { + install(Vue, _options) {